Fixes books being loaded twice
All checks were successful
EpicKnarvik97/Books-Without-Borders/pipeline/head This commit looks good
All checks were successful
EpicKnarvik97/Books-Without-Borders/pipeline/head This commit looks good
This commit is contained in:
2
pom.xml
2
pom.xml
@@ -113,7 +113,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.spigotmc</groupId>
|
<groupId>org.spigotmc</groupId>
|
||||||
<artifactId>spigot-api</artifactId>
|
<artifactId>spigot-api</artifactId>
|
||||||
<version>1.21-R0.1-SNAPSHOT</version>
|
<version>1.21.8-R0.1-SNAPSHOT</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
@@ -35,7 +35,7 @@ public class CommandLoad implements TabExecutor {
|
|||||||
* @param loadPublic <p>Whether to list public files as loadable</p>
|
* @param loadPublic <p>Whether to list public files as loadable</p>
|
||||||
* @return <p>True if the book was loaded successfully</p>
|
* @return <p>True if the book was loaded successfully</p>
|
||||||
*/
|
*/
|
||||||
boolean loadBook(CommandSender sender, String[] args, String directory, boolean loadPublic) {
|
public boolean loadBook(CommandSender sender, String[] args, String directory, boolean loadPublic) {
|
||||||
if (!(sender instanceof Player player)) {
|
if (!(sender instanceof Player player)) {
|
||||||
BooksWithoutBorders.sendErrorMessage(sender, "This command can only be used by a player!");
|
BooksWithoutBorders.sendErrorMessage(sender, "This command can only be used by a player!");
|
||||||
return false;
|
return false;
|
||||||
|
@@ -3,6 +3,7 @@ package net.knarcraft.bookswithoutborders.listener;
|
|||||||
import net.knarcraft.bookswithoutborders.config.BooksWithoutBordersConfig;
|
import net.knarcraft.bookswithoutborders.config.BooksWithoutBordersConfig;
|
||||||
import net.knarcraft.bookswithoutborders.utility.IntegerToRomanConverter;
|
import net.knarcraft.bookswithoutborders.utility.IntegerToRomanConverter;
|
||||||
import net.md_5.bungee.api.ChatColor;
|
import net.md_5.bungee.api.ChatColor;
|
||||||
|
import org.bukkit.NamespacedKey;
|
||||||
import org.bukkit.block.ChiseledBookshelf;
|
import org.bukkit.block.ChiseledBookshelf;
|
||||||
import org.bukkit.enchantments.Enchantment;
|
import org.bukkit.enchantments.Enchantment;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@@ -140,7 +141,12 @@ public class BookshelfListener implements Listener {
|
|||||||
* @return <p>The prettified enchantment name</p>
|
* @return <p>The prettified enchantment name</p>
|
||||||
*/
|
*/
|
||||||
private String getEnchantmentName(Enchantment enchantment) {
|
private String getEnchantmentName(Enchantment enchantment) {
|
||||||
return uppercaseFirst(enchantment.getKey().getKey().replace("_", " "));
|
NamespacedKey key = enchantment.getKeyOrNull();
|
||||||
|
if (key != null) {
|
||||||
|
return uppercaseFirst(key.getKey().replace("_", " "));
|
||||||
|
} else {
|
||||||
|
return "Unknown Enchantment";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -158,8 +158,9 @@ public final class BookFileHelper {
|
|||||||
String userName = data[1].substring(0, data[1].length() - 4);
|
String userName = data[1].substring(0, data[1].length() - 4);
|
||||||
data[1] = BookHelper.authorFromUUID(userName) + extension;
|
data[1] = BookHelper.authorFromUUID(userName) + extension;
|
||||||
fileList.add(String.join(separator, data));
|
fileList.add(String.join(separator, data));
|
||||||
|
} else {
|
||||||
|
fileList.add(fileName);
|
||||||
}
|
}
|
||||||
fileList.add(fileName);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return fileList;
|
return fileList;
|
||||||
|
Reference in New Issue
Block a user