mirror of
https://github.com/PikaMug/Quests.git
synced 2024-11-22 10:36:09 +01:00
Clean up a few warnings, update library
This commit is contained in:
parent
a7e9e41d68
commit
4dacb4532f
@ -171,7 +171,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>de.tr7zw</groupId>
|
<groupId>de.tr7zw</groupId>
|
||||||
<artifactId>item-nbt-api-plugin</artifactId>
|
<artifactId>item-nbt-api-plugin</artifactId>
|
||||||
<version>2.12.3</version>
|
<version>2.12.4</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>xyz.upperlevel.spigot.book</groupId>
|
<groupId>xyz.upperlevel.spigot.book</groupId>
|
||||||
|
@ -592,7 +592,7 @@ public class BukkitQuestsPlugin extends JavaPlugin implements Quests {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void saveResourceAs(String resourcePath, final String outputPath, final boolean replace) {
|
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");
|
throw new IllegalArgumentException("ResourcePath cannot be null or empty");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -127,7 +127,7 @@ public abstract class BukkitQuestsSubCommand {
|
|||||||
s.append(args[i]).append(delimiter);
|
s.append(args[i]).append(delimiter);
|
||||||
}
|
}
|
||||||
s = new StringBuilder(s.substring(0, s.length()));
|
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) {
|
public static Map<String, Integer> sort(final Map<String, Integer> unsortedMap) {
|
||||||
|
@ -199,7 +199,7 @@ public class ActionMenuPrompt extends ActionsEditorNumericPrompt {
|
|||||||
context.getForWhom().sendRawMessage(ChatColor.RED + BukkitLang.get("questEditorInvalidQuestName"));
|
context.getForWhom().sendRawMessage(ChatColor.RED + BukkitLang.get("questEditorInvalidQuestName"));
|
||||||
return new ActionSelectCreatePrompt(context);
|
return new ActionSelectCreatePrompt(context);
|
||||||
}
|
}
|
||||||
if (input.equals("")) {
|
if (input.isEmpty()) {
|
||||||
context.getForWhom().sendRawMessage(ChatColor.RED + BukkitLang.get("itemCreateInvalidInput"));
|
context.getForWhom().sendRawMessage(ChatColor.RED + BukkitLang.get("itemCreateInvalidInput"));
|
||||||
return new ActionSelectCreatePrompt(context);
|
return new ActionSelectCreatePrompt(context);
|
||||||
}
|
}
|
||||||
|
@ -198,7 +198,7 @@ public class ConditionMenuPrompt extends ConditionsEditorNumericPrompt {
|
|||||||
context.getForWhom().sendRawMessage(ChatColor.RED + BukkitLang.get("questEditorInvalidQuestName"));
|
context.getForWhom().sendRawMessage(ChatColor.RED + BukkitLang.get("questEditorInvalidQuestName"));
|
||||||
return new ConditionSelectCreatePrompt(context);
|
return new ConditionSelectCreatePrompt(context);
|
||||||
}
|
}
|
||||||
if (input.equals("")) {
|
if (input.isEmpty()) {
|
||||||
context.getForWhom().sendRawMessage(ChatColor.RED + BukkitLang.get("itemCreateInvalidInput"));
|
context.getForWhom().sendRawMessage(ChatColor.RED + BukkitLang.get("itemCreateInvalidInput"));
|
||||||
return new ConditionSelectCreatePrompt(context);
|
return new ConditionSelectCreatePrompt(context);
|
||||||
}
|
}
|
||||||
|
@ -182,7 +182,7 @@ public class QuestMenuPrompt extends QuestsEditorNumericPrompt {
|
|||||||
context.getForWhom().sendRawMessage(ChatColor.RED + BukkitLang.get("questEditorInvalidQuestName"));
|
context.getForWhom().sendRawMessage(ChatColor.RED + BukkitLang.get("questEditorInvalidQuestName"));
|
||||||
return new QuestSelectCreatePrompt(context);
|
return new QuestSelectCreatePrompt(context);
|
||||||
}
|
}
|
||||||
if (input.equals("")) {
|
if (input.isEmpty()) {
|
||||||
context.getForWhom().sendRawMessage(ChatColor.RED + BukkitLang.get("itemCreateInvalidInput"));
|
context.getForWhom().sendRawMessage(ChatColor.RED + BukkitLang.get("itemCreateInvalidInput"));
|
||||||
return new QuestSelectCreatePrompt(context);
|
return new QuestSelectCreatePrompt(context);
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,7 @@ public class BukkitPartiesListener implements Listener {
|
|||||||
if (event.getCreator() != null) {
|
if (event.getCreator() != null) {
|
||||||
final Player p = Bukkit.getServer().getPlayer(event.getCreator().getPlayerUUID());
|
final Player p = Bukkit.getServer().getPlayer(event.getCreator().getPlayerUUID());
|
||||||
if (p != null) {
|
if (p != null) {
|
||||||
if (BukkitLang.get("questPartiesCreate").length() > 0) {
|
if (!BukkitLang.get("questPartiesCreate").isEmpty()) {
|
||||||
BukkitLang.send(p, ChatColor.YELLOW + BukkitLang.get("questPartiesCreate"));
|
BukkitLang.send(p, ChatColor.YELLOW + BukkitLang.get("questPartiesCreate"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -39,7 +39,7 @@ public class BukkitPartiesListener implements Listener {
|
|||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlayerJoinEvent(final BukkitPartiesPlayerPostJoinEvent event) {
|
public void onPlayerJoinEvent(final BukkitPartiesPlayerPostJoinEvent event) {
|
||||||
final Player p = Bukkit.getServer().getPlayer(event.getPartyPlayer().getPlayerUUID());
|
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"));
|
BukkitLang.send(p, ChatColor.GREEN + BukkitLang.get(p, "questPartiesJoin"));
|
||||||
event.getParty().broadcastMessage(ChatColor.GREEN + BukkitLang.get("questPartiesJoinBroadcast")
|
event.getParty().broadcastMessage(ChatColor.GREEN + BukkitLang.get("questPartiesJoinBroadcast")
|
||||||
.replace("<player>", event.getPartyPlayer().getName()), event.getPartyPlayer());
|
.replace("<player>", event.getPartyPlayer().getName()), event.getPartyPlayer());
|
||||||
@ -49,7 +49,7 @@ public class BukkitPartiesListener implements Listener {
|
|||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlayerLeaveEvent(final BukkitPartiesPlayerPostLeaveEvent event) {
|
public void onPlayerLeaveEvent(final BukkitPartiesPlayerPostLeaveEvent event) {
|
||||||
final Player p = Bukkit.getServer().getPlayer(event.getPartyPlayer().getPlayerUUID());
|
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"));
|
BukkitLang.send(p, ChatColor.RED + BukkitLang.get(p, "questPartiesLeave"));
|
||||||
event.getParty().broadcastMessage(ChatColor.RED + BukkitLang.get("questPartiesLeaveBroadcast")
|
event.getParty().broadcastMessage(ChatColor.RED + BukkitLang.get("questPartiesLeaveBroadcast")
|
||||||
.replace("<player>", event.getPartyPlayer().getName()), event.getPartyPlayer());
|
.replace("<player>", event.getPartyPlayer().getName()), event.getPartyPlayer());
|
||||||
|
@ -28,7 +28,7 @@ public class BukkitUniteListener implements Listener {
|
|||||||
if (event.getCreator() != null) {
|
if (event.getCreator() != null) {
|
||||||
final Player p = Bukkit.getServer().getPlayer(event.getCreator());
|
final Player p = Bukkit.getServer().getPlayer(event.getCreator());
|
||||||
if (p != null) {
|
if (p != null) {
|
||||||
if (BukkitLang.get("questPartiesCreate").length() > 0) {
|
if (!BukkitLang.get("questPartiesCreate").isEmpty()) {
|
||||||
BukkitLang.send(p, ChatColor.YELLOW + BukkitLang.get("questPartiesCreate"));
|
BukkitLang.send(p, ChatColor.YELLOW + BukkitLang.get("questPartiesCreate"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -40,7 +40,7 @@ public class BukkitUniteListener implements Listener {
|
|||||||
if (event.getDisbander() != null) {
|
if (event.getDisbander() != null) {
|
||||||
final Player p = Bukkit.getServer().getPlayer(event.getDisbander());
|
final Player p = Bukkit.getServer().getPlayer(event.getDisbander());
|
||||||
if (p != null) {
|
if (p != null) {
|
||||||
if (BukkitLang.get("questPartiesDelete").length() > 0) {
|
if (!BukkitLang.get("questPartiesDelete").isEmpty()) {
|
||||||
BukkitLang.send(p, ChatColor.RED + BukkitLang.get("questPartiesDelete"));
|
BukkitLang.send(p, ChatColor.RED + BukkitLang.get("questPartiesDelete"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -50,9 +50,9 @@ public class BukkitUniteListener implements Listener {
|
|||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlayerJoinEvent(final PartyJoinEvent event) {
|
public void onPlayerJoinEvent(final PartyJoinEvent event) {
|
||||||
final Player p = Bukkit.getServer().getPlayer(event.getPlayer());
|
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"));
|
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()) {
|
for (final Player online : Bukkit.getOnlinePlayers()) {
|
||||||
if (event.getPlayer().equals(online.getUniqueId())) {
|
if (event.getPlayer().equals(online.getUniqueId())) {
|
||||||
continue;
|
continue;
|
||||||
@ -69,9 +69,9 @@ public class BukkitUniteListener implements Listener {
|
|||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlayerLeaveEvent(final PartyLeaveEvent event) {
|
public void onPlayerLeaveEvent(final PartyLeaveEvent event) {
|
||||||
final Player p = Bukkit.getServer().getPlayer(event.getPlayer());
|
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"));
|
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()) {
|
for (final Player online : Bukkit.getOnlinePlayers()) {
|
||||||
if (event.getPlayer().equals(online.getUniqueId())) {
|
if (event.getPlayer().equals(online.getUniqueId())) {
|
||||||
continue;
|
continue;
|
||||||
|
@ -896,7 +896,7 @@ public class BukkitQuester implements Quester {
|
|||||||
plugin.getLogger().info(getOfflinePlayer().getUniqueId() + " quit quest " + quest.getName());
|
plugin.getLogger().info(getOfflinePlayer().getUniqueId() + " quit quest " + quest.getName());
|
||||||
}
|
}
|
||||||
for (final String message : messages) {
|
for (final String message : messages) {
|
||||||
if (message != null && !message.equals("") && getOfflinePlayer().isOnline()) {
|
if (message != null && !message.isEmpty() && getOfflinePlayer().isOnline()) {
|
||||||
sendMessage(message);
|
sendMessage(message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1582,7 +1582,7 @@ public class BukkitQuester implements Quester {
|
|||||||
}
|
}
|
||||||
if (!ignoreOverrides && !stage.getObjectiveOverrides().isEmpty()) {
|
if (!ignoreOverrides && !stage.getObjectiveOverrides().isEmpty()) {
|
||||||
for (final String s: stage.getObjectiveOverrides()) {
|
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());
|
.parseString(s, quest, quester.getPlayer());
|
||||||
if (plugin.getDependencies().getPlaceholderApi() != null) {
|
if (plugin.getDependencies().getPlaceholderApi() != null) {
|
||||||
message = PlaceholderAPI.setPlaceholders(quester.getPlayer(), message);
|
message = PlaceholderAPI.setPlaceholders(quester.getPlayer(), message);
|
||||||
@ -4321,7 +4321,7 @@ public class BukkitQuester implements Quester {
|
|||||||
index = 0;
|
index = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (list.size() > 0) {
|
if (!list.isEmpty()) {
|
||||||
final Quest quest = plugin.getQuestById(list.get(index));
|
final Quest quest = plugin.getQuestById(list.get(index));
|
||||||
compassTargetQuestId = quest.getId();
|
compassTargetQuestId = quest.getId();
|
||||||
final Stage stage = getCurrentStage(quest);
|
final Stage stage = getCurrentStage(quest);
|
||||||
|
@ -995,7 +995,7 @@ public class BukkitQuest implements Quest {
|
|||||||
for (final String s : rewards.getCommands()) {
|
for (final String s : rewards.getCommands()) {
|
||||||
if (!rewards.getCommandsOverrideDisplay().isEmpty()
|
if (!rewards.getCommandsOverrideDisplay().isEmpty()
|
||||||
&& rewards.getCommandsOverrideDisplay().size() > index) {
|
&& rewards.getCommandsOverrideDisplay().size() > index) {
|
||||||
if (!rewards.getCommandsOverrideDisplay().get(index).trim().equals("")) {
|
if (!rewards.getCommandsOverrideDisplay().get(index).trim().isEmpty()) {
|
||||||
quester.sendMessage("- " + ChatColor.DARK_GREEN
|
quester.sendMessage("- " + ChatColor.DARK_GREEN
|
||||||
+ rewards.getCommandsOverrideDisplay().get(index));
|
+ rewards.getCommandsOverrideDisplay().get(index));
|
||||||
}
|
}
|
||||||
|
@ -273,7 +273,7 @@ public class BukkitItemUtil {
|
|||||||
final EnchantmentStorageMeta esMeta;
|
final EnchantmentStorageMeta esMeta;
|
||||||
for (final String targ : args) {
|
for (final String targ : args) {
|
||||||
final String arg = targ.replace("minecraft|", "minecraft:");
|
final String arg = targ.replace("minecraft|", "minecraft:");
|
||||||
if (arg.equals("")) {
|
if (arg.isEmpty()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (arg.startsWith("name-")) {
|
if (arg.startsWith("name-")) {
|
||||||
@ -429,7 +429,7 @@ public class BukkitItemUtil {
|
|||||||
meta.setLore(lore);
|
meta.setLore(lore);
|
||||||
}
|
}
|
||||||
for (final String flag : flags) {
|
for (final String flag : flags) {
|
||||||
if (flag != null && !flag.equals("")) {
|
if (flag != null && !flag.isEmpty()) {
|
||||||
try {
|
try {
|
||||||
meta.addItemFlags(ItemFlag.valueOf(flag));
|
meta.addItemFlags(ItemFlag.valueOf(flag));
|
||||||
} catch (final NullPointerException npe) {
|
} catch (final NullPointerException npe) {
|
||||||
|
@ -180,7 +180,7 @@ public class BukkitLang {
|
|||||||
* @param message The message to be sent
|
* @param message The message to be sent
|
||||||
*/
|
*/
|
||||||
public static void send(final Player player, final String message) {
|
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);
|
player.sendMessage(message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -69,7 +69,7 @@ public class BukkitMiscUtil {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (message.length() > 0) {
|
if (!message.isEmpty()) {
|
||||||
message = message.substring(1, message.length() - 1);
|
message = message.substring(1, message.length() - 1);
|
||||||
} else {
|
} else {
|
||||||
message = "-1 " + BukkitLang.get("timeSeconds");
|
message = "-1 " + BukkitLang.get("timeSeconds");
|
||||||
@ -260,7 +260,7 @@ public class BukkitMiscUtil {
|
|||||||
currentLength += piece.length() + 1;
|
currentLength += piece.length() + 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!line.toString().equals(""))
|
if (!line.toString().isEmpty())
|
||||||
if (lineColor != null) {
|
if (lineColor != null) {
|
||||||
toReturn.add(lineColor + line.toString());
|
toReturn.add(lineColor + line.toString());
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user