Clean up a few warnings, update library

This commit is contained in:
PikaMug 2024-05-21 05:03:52 -04:00
parent a7e9e41d68
commit 4dacb4532f
13 changed files with 24 additions and 24 deletions

View File

@ -171,7 +171,7 @@
<dependency>
<groupId>de.tr7zw</groupId>
<artifactId>item-nbt-api-plugin</artifactId>
<version>2.12.3</version>
<version>2.12.4</version>
</dependency>
<dependency>
<groupId>xyz.upperlevel.spigot.book</groupId>

View File

@ -592,7 +592,7 @@ public class BukkitQuestsPlugin extends JavaPlugin implements Quests {
*/
@Override
public void saveResourceAs(String resourcePath, final String outputPath, final boolean replace) {
if (resourcePath == null || resourcePath.equals("")) {
if (resourcePath == null || resourcePath.isEmpty()) {
throw new IllegalArgumentException("ResourcePath cannot be null or empty");
}

View File

@ -127,7 +127,7 @@ public abstract class BukkitQuestsSubCommand {
s.append(args[i]).append(delimiter);
}
s = new StringBuilder(s.substring(0, s.length()));
return s.toString().trim().equals("") ? null : s.toString().trim();
return s.toString().trim().isEmpty() ? null : s.toString().trim();
}
public static Map<String, Integer> sort(final Map<String, Integer> unsortedMap) {

View File

@ -199,7 +199,7 @@ public class ActionMenuPrompt extends ActionsEditorNumericPrompt {
context.getForWhom().sendRawMessage(ChatColor.RED + BukkitLang.get("questEditorInvalidQuestName"));
return new ActionSelectCreatePrompt(context);
}
if (input.equals("")) {
if (input.isEmpty()) {
context.getForWhom().sendRawMessage(ChatColor.RED + BukkitLang.get("itemCreateInvalidInput"));
return new ActionSelectCreatePrompt(context);
}

View File

@ -198,7 +198,7 @@ public class ConditionMenuPrompt extends ConditionsEditorNumericPrompt {
context.getForWhom().sendRawMessage(ChatColor.RED + BukkitLang.get("questEditorInvalidQuestName"));
return new ConditionSelectCreatePrompt(context);
}
if (input.equals("")) {
if (input.isEmpty()) {
context.getForWhom().sendRawMessage(ChatColor.RED + BukkitLang.get("itemCreateInvalidInput"));
return new ConditionSelectCreatePrompt(context);
}

View File

@ -182,7 +182,7 @@ public class QuestMenuPrompt extends QuestsEditorNumericPrompt {
context.getForWhom().sendRawMessage(ChatColor.RED + BukkitLang.get("questEditorInvalidQuestName"));
return new QuestSelectCreatePrompt(context);
}
if (input.equals("")) {
if (input.isEmpty()) {
context.getForWhom().sendRawMessage(ChatColor.RED + BukkitLang.get("itemCreateInvalidInput"));
return new QuestSelectCreatePrompt(context);
}

View File

@ -29,7 +29,7 @@ public class BukkitPartiesListener implements Listener {
if (event.getCreator() != null) {
final Player p = Bukkit.getServer().getPlayer(event.getCreator().getPlayerUUID());
if (p != null) {
if (BukkitLang.get("questPartiesCreate").length() > 0) {
if (!BukkitLang.get("questPartiesCreate").isEmpty()) {
BukkitLang.send(p, ChatColor.YELLOW + BukkitLang.get("questPartiesCreate"));
}
}
@ -39,7 +39,7 @@ public class BukkitPartiesListener implements Listener {
@EventHandler
public void onPlayerJoinEvent(final BukkitPartiesPlayerPostJoinEvent event) {
final Player p = Bukkit.getServer().getPlayer(event.getPartyPlayer().getPlayerUUID());
if (p != null && BukkitLang.get("questPartiesLeave").length() > 0) {
if (p != null && !BukkitLang.get("questPartiesLeave").isEmpty()) {
BukkitLang.send(p, ChatColor.GREEN + BukkitLang.get(p, "questPartiesJoin"));
event.getParty().broadcastMessage(ChatColor.GREEN + BukkitLang.get("questPartiesJoinBroadcast")
.replace("<player>", event.getPartyPlayer().getName()), event.getPartyPlayer());
@ -49,7 +49,7 @@ public class BukkitPartiesListener implements Listener {
@EventHandler
public void onPlayerLeaveEvent(final BukkitPartiesPlayerPostLeaveEvent event) {
final Player p = Bukkit.getServer().getPlayer(event.getPartyPlayer().getPlayerUUID());
if (p != null && BukkitLang.get("questPartiesLeave").length() > 0) {
if (p != null && !BukkitLang.get("questPartiesLeave").isEmpty()) {
BukkitLang.send(p, ChatColor.RED + BukkitLang.get(p, "questPartiesLeave"));
event.getParty().broadcastMessage(ChatColor.RED + BukkitLang.get("questPartiesLeaveBroadcast")
.replace("<player>", event.getPartyPlayer().getName()), event.getPartyPlayer());

View File

@ -28,7 +28,7 @@ public class BukkitUniteListener implements Listener {
if (event.getCreator() != null) {
final Player p = Bukkit.getServer().getPlayer(event.getCreator());
if (p != null) {
if (BukkitLang.get("questPartiesCreate").length() > 0) {
if (!BukkitLang.get("questPartiesCreate").isEmpty()) {
BukkitLang.send(p, ChatColor.YELLOW + BukkitLang.get("questPartiesCreate"));
}
}
@ -40,7 +40,7 @@ public class BukkitUniteListener implements Listener {
if (event.getDisbander() != null) {
final Player p = Bukkit.getServer().getPlayer(event.getDisbander());
if (p != null) {
if (BukkitLang.get("questPartiesDelete").length() > 0) {
if (!BukkitLang.get("questPartiesDelete").isEmpty()) {
BukkitLang.send(p, ChatColor.RED + BukkitLang.get("questPartiesDelete"));
}
}
@ -50,9 +50,9 @@ public class BukkitUniteListener implements Listener {
@EventHandler
public void onPlayerJoinEvent(final PartyJoinEvent event) {
final Player p = Bukkit.getServer().getPlayer(event.getPlayer());
if (p != null && BukkitLang.get("questPartiesLeave").length() > 0) {
if (p != null && !BukkitLang.get("questPartiesLeave").isEmpty()) {
BukkitLang.send(p, ChatColor.GREEN + BukkitLang.get(p, "questPartiesJoin"));
if (BukkitLang.get("questPartiesJoinBroadcast").length() > 0) {
if (!BukkitLang.get("questPartiesJoinBroadcast").isEmpty()) {
for (final Player online : Bukkit.getOnlinePlayers()) {
if (event.getPlayer().equals(online.getUniqueId())) {
continue;
@ -69,9 +69,9 @@ public class BukkitUniteListener implements Listener {
@EventHandler
public void onPlayerLeaveEvent(final PartyLeaveEvent event) {
final Player p = Bukkit.getServer().getPlayer(event.getPlayer());
if (p != null && BukkitLang.get("questPartiesLeave").length() > 0) {
if (p != null && !BukkitLang.get("questPartiesLeave").isEmpty()) {
BukkitLang.send(p, ChatColor.RED + BukkitLang.get(p, "questPartiesLeave"));
if (BukkitLang.get("questPartiesLeaveBroadcast").length() > 0) {
if (!BukkitLang.get("questPartiesLeaveBroadcast").isEmpty()) {
for (final Player online : Bukkit.getOnlinePlayers()) {
if (event.getPlayer().equals(online.getUniqueId())) {
continue;

View File

@ -896,7 +896,7 @@ public class BukkitQuester implements Quester {
plugin.getLogger().info(getOfflinePlayer().getUniqueId() + " quit quest " + quest.getName());
}
for (final String message : messages) {
if (message != null && !message.equals("") && getOfflinePlayer().isOnline()) {
if (message != null && !message.isEmpty() && getOfflinePlayer().isOnline()) {
sendMessage(message);
}
}
@ -1582,7 +1582,7 @@ public class BukkitQuester implements Quester {
}
if (!ignoreOverrides && !stage.getObjectiveOverrides().isEmpty()) {
for (final String s: stage.getObjectiveOverrides()) {
String message = (s.trim().length() > 0 ? "- " : "") + ChatColor.GREEN + BukkitConfigUtil
String message = (!s.trim().isEmpty() ? "- " : "") + ChatColor.GREEN + BukkitConfigUtil
.parseString(s, quest, quester.getPlayer());
if (plugin.getDependencies().getPlaceholderApi() != null) {
message = PlaceholderAPI.setPlaceholders(quester.getPlayer(), message);
@ -4321,7 +4321,7 @@ public class BukkitQuester implements Quester {
index = 0;
}
}
if (list.size() > 0) {
if (!list.isEmpty()) {
final Quest quest = plugin.getQuestById(list.get(index));
compassTargetQuestId = quest.getId();
final Stage stage = getCurrentStage(quest);

View File

@ -995,7 +995,7 @@ public class BukkitQuest implements Quest {
for (final String s : rewards.getCommands()) {
if (!rewards.getCommandsOverrideDisplay().isEmpty()
&& rewards.getCommandsOverrideDisplay().size() > index) {
if (!rewards.getCommandsOverrideDisplay().get(index).trim().equals("")) {
if (!rewards.getCommandsOverrideDisplay().get(index).trim().isEmpty()) {
quester.sendMessage("- " + ChatColor.DARK_GREEN
+ rewards.getCommandsOverrideDisplay().get(index));
}

View File

@ -273,7 +273,7 @@ public class BukkitItemUtil {
final EnchantmentStorageMeta esMeta;
for (final String targ : args) {
final String arg = targ.replace("minecraft|", "minecraft:");
if (arg.equals("")) {
if (arg.isEmpty()) {
continue;
}
if (arg.startsWith("name-")) {
@ -429,7 +429,7 @@ public class BukkitItemUtil {
meta.setLore(lore);
}
for (final String flag : flags) {
if (flag != null && !flag.equals("")) {
if (flag != null && !flag.isEmpty()) {
try {
meta.addItemFlags(ItemFlag.valueOf(flag));
} catch (final NullPointerException npe) {

View File

@ -180,7 +180,7 @@ public class BukkitLang {
* @param message The message to be sent
*/
public static void send(final Player player, final String message) {
if (message != null && !ChatColor.stripColor(message).equals("")) {
if (message != null && !ChatColor.stripColor(message).isEmpty()) {
player.sendMessage(message);
}
}

View File

@ -69,7 +69,7 @@ public class BukkitMiscUtil {
}
}
}
if (message.length() > 0) {
if (!message.isEmpty()) {
message = message.substring(1, message.length() - 1);
} else {
message = "-1 " + BukkitLang.get("timeSeconds");
@ -260,7 +260,7 @@ public class BukkitMiscUtil {
currentLength += piece.length() + 1;
}
}
if (!line.toString().equals(""))
if (!line.toString().isEmpty())
if (lineColor != null) {
toReturn.add(lineColor + line.toString());
} else {