diff --git a/libs/MyPet-3.0-SNAPSHOT.jar b/libs/MyPet-3.1-SNAPSHOT-B1433.jar similarity index 66% rename from libs/MyPet-3.0-SNAPSHOT.jar rename to libs/MyPet-3.1-SNAPSHOT-B1433.jar index 27a430c1..ead18f15 100644 Binary files a/libs/MyPet-3.0-SNAPSHOT.jar and b/libs/MyPet-3.1-SNAPSHOT-B1433.jar differ diff --git a/pom.xml b/pom.xml index bb00c2f7..3ce9ab50 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ 4.0.0 Jobs jobs - 4.11.2 + 4.12.0 Jobs http://maven.apache.org @@ -16,16 +16,16 @@ org.spigotmc spigot-api - 1.14.1-R0.1-SNAPSHOT + 1.14.2-R0.1-SNAPSHOT provided de.Keyle.MyPet MyPet - 3.0-SNAPSHOT + 3.1-SNAPSHOT-B1433 system - ${basedir}/libs/MyPet-3.0-SNAPSHOT.jar + ${basedir}/libs/MyPet-3.1-SNAPSHOT-B1433.jar diff --git a/src/main/java/com/gamingmesh/jobs/CMILib/ActionBarTitleMessages.java b/src/main/java/com/gamingmesh/jobs/CMILib/ActionBarTitleMessages.java index bbf74a86..8a6228f1 100644 --- a/src/main/java/com/gamingmesh/jobs/CMILib/ActionBarTitleMessages.java +++ b/src/main/java/com/gamingmesh/jobs/CMILib/ActionBarTitleMessages.java @@ -169,8 +169,8 @@ public class ActionBarTitleMessages { } } catch (SecurityException | InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException | NoSuchFieldException ex) { - simpleTitleMessages = true; - Bukkit.getLogger().log(Level.SEVERE, "Your server can't fully support title messages. They will be shown in chat instead."); + simpleTitleMessages = true; + Bukkit.getLogger().log(Level.SEVERE, "Your server can't fully support title messages. They will be shown in chat instead."); } return; }); diff --git a/src/main/java/com/gamingmesh/jobs/CMILib/CMIItemStack.java b/src/main/java/com/gamingmesh/jobs/CMILib/CMIItemStack.java index 6d1d2418..a65d9ddc 100644 --- a/src/main/java/com/gamingmesh/jobs/CMILib/CMIItemStack.java +++ b/src/main/java/com/gamingmesh/jobs/CMILib/CMIItemStack.java @@ -147,48 +147,48 @@ public class CMIItemStack { } public CMIItemStack addEnchant(Enchantment enchant, Integer level) { - if (enchant == null) - return this; - ItemMeta meta = getItemStack().getItemMeta(); - meta.addEnchant(enchant, level, true); - getItemStack().setItemMeta(meta); - return this; + if (enchant == null) + return this; + ItemMeta meta = getItemStack().getItemMeta(); + meta.addEnchant(enchant, level, true); + getItemStack().setItemMeta(meta); + return this; } public CMIItemStack addEnchant(HashMap enchants) { - if (enchants == null || enchants.isEmpty()) - return this; - for (Entry oneEnch : enchants.entrySet()) { - addEnchant(oneEnch.getKey(), oneEnch.getValue()); - } - return this; + if (enchants == null || enchants.isEmpty()) + return this; + for (Entry oneEnch : enchants.entrySet()) { + addEnchant(oneEnch.getKey(), oneEnch.getValue()); + } + return this; } public CMIItemStack clearEnchants() { - ItemMeta meta = getItemStack().getItemMeta(); - meta.getEnchants().clear(); - getItemStack().setItemMeta(meta); - return this; + ItemMeta meta = getItemStack().getItemMeta(); + meta.getEnchants().clear(); + getItemStack().setItemMeta(meta); + return this; } public List getLore() { - ItemMeta meta = this.getItemStack().getItemMeta(); + ItemMeta meta = this.getItemStack().getItemMeta(); // List lore = null; - if (meta != null) { - List lore = meta.getLore(); - if (lore == null) { - lore = new ArrayList(); - meta.setLore(lore); + if (meta != null) { + List lore = meta.getLore(); + if (lore == null) { + lore = new ArrayList(); + meta.setLore(lore); // this.getItemStack().setItemMeta(meta); - } + } - return meta.getLore() == null ? new ArrayList() : meta.getLore(); - } - return new ArrayList(); + return meta.getLore() == null ? new ArrayList() : meta.getLore(); + } + return new ArrayList(); } public String getRealName() { - return getCMIType() == null || getCMIType() == CMIMaterial.NONE ? getType().name() : getCMIType().getName(); + return getCMIType() == null || getCMIType() == CMIMaterial.NONE ? getType().name() : getCMIType().getName(); // if (this.getItemStack() != null) { // //// String translated = CMI.getInstance().getItemManager().getTranslatedName(this.getItemStack()); @@ -203,11 +203,11 @@ public class CMIItemStack { } public String getBukkitName() { - return bukkitName == null || bukkitName.isEmpty() ? null : bukkitName; + return bukkitName == null || bukkitName.isEmpty() ? null : bukkitName; } public void setBukkitName(String bukkitName) { - this.bukkitName = bukkitName; + this.bukkitName = bukkitName; } public String getMojangName() { @@ -218,7 +218,7 @@ public class CMIItemStack { // } catch (Exception e) { // // } - return mojangName == null || mojangName.isEmpty() ? getCMIType().getMaterial().name() : mojangName; + return mojangName == null || mojangName.isEmpty() ? getCMIType().getMaterial().name() : mojangName; } public void setMojangName(String mojangName) { diff --git a/src/main/java/com/gamingmesh/jobs/CMILib/ItemManager.java b/src/main/java/com/gamingmesh/jobs/CMILib/ItemManager.java index 3273c8f5..2602f3fe 100644 --- a/src/main/java/com/gamingmesh/jobs/CMILib/ItemManager.java +++ b/src/main/java/com/gamingmesh/jobs/CMILib/ItemManager.java @@ -1534,7 +1534,7 @@ public class ItemManager { MAGMA_CREAM(378, 0, 25097, "Magma Cream"), MAGMA_CUBE_SPAWN_EGG(383, 62, 26638, "Spawn Magma Cube", "Magma Cube Spawn Egg"), MAP(395, 0, 21655, "Empty Map"), - MELON(103, 0, 25172, "Melon", "Melon_Block"), + MELON_BLOCK(103, 0, 25172, "Melon"), MELON_SEEDS(362, 0, 18340, "Melon Seeds"), MELON_SLICE(360, 0, 5347, "Melon Slice"), MELON_STEM(105, 0, 8247, "Melon Stem"), @@ -2035,7 +2035,7 @@ public class ItemManager { LEGACY_DIODE_BLOCK_ON(94, 0, null, "Diode Block On"), LEGACY_BREWING_STAND(117, null, null, "Brewing Stand"), // LEGACY_CAULDRON(118, 0, null, "LEGACY_CAULDRON", ""), -// LEGACY_REDSTONE_LAMP_ON(124, null, null, "LEGACY_REDSTONE_LAMP_ON", ""), + LEGACY_REDSTONE_LAMP_ON(124, 0, null, "LEGACY_REDSTONE_LAMP_ON"), // LEGACY_WOOD_DOUBLE_STEP(125, null, null, "LEGACY_WOOD_DOUBLE_STEP", ""), // LEGACY_FLOWER_POT(140, null, null, "LEGACY_FLOWER_POT", ""), LEGACY_REDSTONE_COMPARATOR_OFF(149, 0, null, "Redstone Comparator Off", ""), diff --git a/src/main/java/com/gamingmesh/jobs/CMILib/ItemReflection.java b/src/main/java/com/gamingmesh/jobs/CMILib/ItemReflection.java index 9e367657..af104453 100644 --- a/src/main/java/com/gamingmesh/jobs/CMILib/ItemReflection.java +++ b/src/main/java/com/gamingmesh/jobs/CMILib/ItemReflection.java @@ -87,7 +87,7 @@ public class ItemReflection { Object nmsStack = asNMSCopy(item); Method itemMeth = Item.getMethod("getById", int.class); @SuppressWarnings("deprecation") - Object res = itemMeth.invoke(Item, item.getType().getId()); + Object res = itemMeth.invoke(Item, item.getType().getId()); Method nameThingy = Item.getMethod("j", IStack); Object resThingy = nameThingy.invoke(res, nmsStack); return resThingy.toString(); diff --git a/src/main/java/com/gamingmesh/jobs/McMMO/McMMOManager.java b/src/main/java/com/gamingmesh/jobs/McMMO/McMMOManager.java index 08188637..123c8b18 100644 --- a/src/main/java/com/gamingmesh/jobs/McMMO/McMMOManager.java +++ b/src/main/java/com/gamingmesh/jobs/McMMO/McMMOManager.java @@ -18,7 +18,6 @@ public class McMMOManager { private HashMap> map = new HashMap<>(); public double getMultiplier(Player player) { - if (player == null) return 0D; @@ -32,14 +31,14 @@ public class McMMOManager { return -(1 - Jobs.getGCManager().TreeFellerMultiplier); InfoMap.remove(SuperAbilityType.TREE_FELLER.toString()); } - + t = InfoMap.get(SuperAbilityType.GIGA_DRILL_BREAKER.toString()); if (t != null) { if (t > System.currentTimeMillis()) return -(1 - Jobs.getGCManager().gigaDrillMultiplier); InfoMap.remove(SuperAbilityType.GIGA_DRILL_BREAKER.toString()); } - + t = InfoMap.get(SuperAbilityType.SUPER_BREAKER.toString()); if (t != null) { if (t > System.currentTimeMillis()) diff --git a/src/main/java/com/gamingmesh/jobs/Placeholders/Placeholder.java b/src/main/java/com/gamingmesh/jobs/Placeholders/Placeholder.java index 4551c928..c875620c 100644 --- a/src/main/java/com/gamingmesh/jobs/Placeholders/Placeholder.java +++ b/src/main/java/com/gamingmesh/jobs/Placeholders/Placeholder.java @@ -396,11 +396,11 @@ public class Placeholder { case user_totallevels: return Integer.toString(user.getTotalLevels()); case user_points: - PlayerPoints pointInfo = Jobs.getPlayerManager().getPointsData().getPlayerPointsInfo(user.getPlayerUUID()); - return Double.toString(pointInfo.getCurrentPoints()); + PlayerPoints pointInfo = Jobs.getPlayerManager().getPointsData().getPlayerPointsInfo(user.getPlayerUUID()); + return Double.toString(pointInfo.getCurrentPoints()); case user_total_points: - pointInfo = Jobs.getPlayerManager().getPointsData().getPlayerPointsInfo(user.getPlayerUUID()); - return Double.toString(pointInfo.getTotalPoints()); + pointInfo = Jobs.getPlayerManager().getPointsData().getPlayerPointsInfo(user.getPlayerUUID()); + return Double.toString(pointInfo.getTotalPoints()); case user_issaved: return convert(user.isSaved()); case user_displayhonorific: diff --git a/src/main/java/com/gamingmesh/jobs/api/BaseEvent.java b/src/main/java/com/gamingmesh/jobs/api/BaseEvent.java new file mode 100644 index 00000000..f7b0fc2b --- /dev/null +++ b/src/main/java/com/gamingmesh/jobs/api/BaseEvent.java @@ -0,0 +1,18 @@ +package com.gamingmesh.jobs.api; + +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; + +public class BaseEvent extends Event { + + private static final HandlerList handlers = new HandlerList(); + + @Override + public HandlerList getHandlers() { + return handlers; + } + + public static HandlerList getHandlerList() { + return handlers; + } +} diff --git a/src/main/java/com/gamingmesh/jobs/api/JobsAreaSelectionEvent.java b/src/main/java/com/gamingmesh/jobs/api/JobsAreaSelectionEvent.java index a64d53d3..5a24a937 100644 --- a/src/main/java/com/gamingmesh/jobs/api/JobsAreaSelectionEvent.java +++ b/src/main/java/com/gamingmesh/jobs/api/JobsAreaSelectionEvent.java @@ -1,13 +1,10 @@ package com.gamingmesh.jobs.api; import org.bukkit.entity.Player; -import org.bukkit.event.Event; -import org.bukkit.event.HandlerList; import com.gamingmesh.jobs.container.CuboidArea; -public final class JobsAreaSelectionEvent extends Event { - private static final HandlerList handlers = new HandlerList(); +public final class JobsAreaSelectionEvent extends BaseEvent { private CuboidArea area; private Player player; @@ -23,13 +20,4 @@ public final class JobsAreaSelectionEvent extends Event { public CuboidArea getArea() { return area; } - - @Override - public HandlerList getHandlers() { - return handlers; - } - - public static HandlerList getHandlerList() { - return handlers; - } } \ No newline at end of file diff --git a/src/main/java/com/gamingmesh/jobs/api/JobsChunkChangeEvent.java b/src/main/java/com/gamingmesh/jobs/api/JobsChunkChangeEvent.java index dd991240..377d0a81 100644 --- a/src/main/java/com/gamingmesh/jobs/api/JobsChunkChangeEvent.java +++ b/src/main/java/com/gamingmesh/jobs/api/JobsChunkChangeEvent.java @@ -3,11 +3,8 @@ package com.gamingmesh.jobs.api; import org.bukkit.Chunk; import org.bukkit.entity.Player; import org.bukkit.event.Cancellable; -import org.bukkit.event.Event; -import org.bukkit.event.HandlerList; -public final class JobsChunkChangeEvent extends Event implements Cancellable { - private static final HandlerList handlers = new HandlerList(); +public final class JobsChunkChangeEvent extends BaseEvent implements Cancellable { private Player player; private Chunk oldChunk; private Chunk newChunk; @@ -40,13 +37,4 @@ public final class JobsChunkChangeEvent extends Event implements Cancellable { public void setCancelled(boolean cancelled) { this.cancelled = cancelled; } - - @Override - public HandlerList getHandlers() { - return handlers; - } - - public static HandlerList getHandlerList() { - return handlers; - } } \ No newline at end of file diff --git a/src/main/java/com/gamingmesh/jobs/api/JobsExpGainEvent.java b/src/main/java/com/gamingmesh/jobs/api/JobsExpGainEvent.java index f1b8a4ff..791552db 100644 --- a/src/main/java/com/gamingmesh/jobs/api/JobsExpGainEvent.java +++ b/src/main/java/com/gamingmesh/jobs/api/JobsExpGainEvent.java @@ -2,13 +2,10 @@ package com.gamingmesh.jobs.api; import org.bukkit.OfflinePlayer; import org.bukkit.event.Cancellable; -import org.bukkit.event.Event; -import org.bukkit.event.HandlerList; import com.gamingmesh.jobs.container.Job; -public final class JobsExpGainEvent extends Event implements Cancellable { - private static final HandlerList handlers = new HandlerList(); +public final class JobsExpGainEvent extends BaseEvent implements Cancellable { private OfflinePlayer offlinePlayer; private double exp; private Job job; @@ -45,13 +42,4 @@ public final class JobsExpGainEvent extends Event implements Cancellable { public void setCancelled(boolean cancelled) { this.cancelled = cancelled; } - - @Override - public HandlerList getHandlers() { - return handlers; - } - - public static HandlerList getHandlerList() { - return handlers; - } } \ No newline at end of file diff --git a/src/main/java/com/gamingmesh/jobs/api/JobsJoinEvent.java b/src/main/java/com/gamingmesh/jobs/api/JobsJoinEvent.java index 420f83d6..147fbe73 100644 --- a/src/main/java/com/gamingmesh/jobs/api/JobsJoinEvent.java +++ b/src/main/java/com/gamingmesh/jobs/api/JobsJoinEvent.java @@ -1,14 +1,11 @@ package com.gamingmesh.jobs.api; import org.bukkit.event.Cancellable; -import org.bukkit.event.Event; -import org.bukkit.event.HandlerList; import com.gamingmesh.jobs.container.Job; import com.gamingmesh.jobs.container.JobsPlayer; -public final class JobsJoinEvent extends Event implements Cancellable { - private static final HandlerList handlers = new HandlerList(); +public final class JobsJoinEvent extends BaseEvent implements Cancellable { private JobsPlayer player; private Job job; private boolean cancelled = false; @@ -35,13 +32,4 @@ public final class JobsJoinEvent extends Event implements Cancellable { public void setCancelled(boolean cancelled) { this.cancelled = cancelled; } - - @Override - public HandlerList getHandlers() { - return handlers; - } - - public static HandlerList getHandlerList() { - return handlers; - } } \ No newline at end of file diff --git a/src/main/java/com/gamingmesh/jobs/api/JobsLeaveEvent.java b/src/main/java/com/gamingmesh/jobs/api/JobsLeaveEvent.java index 5ca7a7dc..01427ee3 100644 --- a/src/main/java/com/gamingmesh/jobs/api/JobsLeaveEvent.java +++ b/src/main/java/com/gamingmesh/jobs/api/JobsLeaveEvent.java @@ -1,14 +1,11 @@ package com.gamingmesh.jobs.api; import org.bukkit.event.Cancellable; -import org.bukkit.event.Event; -import org.bukkit.event.HandlerList; import com.gamingmesh.jobs.container.Job; import com.gamingmesh.jobs.container.JobsPlayer; -public final class JobsLeaveEvent extends Event implements Cancellable { - private static final HandlerList handlers = new HandlerList(); +public final class JobsLeaveEvent extends BaseEvent implements Cancellable { private JobsPlayer player; private Job job; private boolean cancelled = false; @@ -35,13 +32,4 @@ public final class JobsLeaveEvent extends Event implements Cancellable { public void setCancelled(boolean cancelled) { this.cancelled = cancelled; } - - @Override - public HandlerList getHandlers() { - return handlers; - } - - public static HandlerList getHandlerList() { - return handlers; - } } \ No newline at end of file diff --git a/src/main/java/com/gamingmesh/jobs/api/JobsLevelUpEvent.java b/src/main/java/com/gamingmesh/jobs/api/JobsLevelUpEvent.java index 70863eb5..7d622d04 100644 --- a/src/main/java/com/gamingmesh/jobs/api/JobsLevelUpEvent.java +++ b/src/main/java/com/gamingmesh/jobs/api/JobsLevelUpEvent.java @@ -2,14 +2,11 @@ package com.gamingmesh.jobs.api; import org.bukkit.Sound; import org.bukkit.event.Cancellable; -import org.bukkit.event.Event; -import org.bukkit.event.HandlerList; import com.gamingmesh.jobs.container.JobsPlayer; import com.gamingmesh.jobs.container.Title; -public final class JobsLevelUpEvent extends Event implements Cancellable { - private static final HandlerList handlers = new HandlerList(); +public final class JobsLevelUpEvent extends BaseEvent implements Cancellable { private JobsPlayer player; private String JobName; private Title OldTitle; @@ -157,13 +154,4 @@ public final class JobsLevelUpEvent extends Event implements Cancellable { public void setCancelled(boolean cancelled) { this.cancelled = cancelled; } - - @Override - public HandlerList getHandlers() { - return handlers; - } - - public static HandlerList getHandlerList() { - return handlers; - } } \ No newline at end of file diff --git a/src/main/java/com/gamingmesh/jobs/api/JobsScheduleStartEvent.java b/src/main/java/com/gamingmesh/jobs/api/JobsScheduleStartEvent.java index c6d441a7..616d3e6c 100644 --- a/src/main/java/com/gamingmesh/jobs/api/JobsScheduleStartEvent.java +++ b/src/main/java/com/gamingmesh/jobs/api/JobsScheduleStartEvent.java @@ -2,11 +2,8 @@ package com.gamingmesh.jobs.api; import com.gamingmesh.jobs.container.Schedule; import org.bukkit.event.Cancellable; -import org.bukkit.event.Event; -import org.bukkit.event.HandlerList; -public class JobsScheduleStartEvent extends Event implements Cancellable { - private static final HandlerList handlers = new HandlerList(); +public class JobsScheduleStartEvent extends BaseEvent implements Cancellable { private boolean cancelled = false; private Schedule schedule; @@ -27,13 +24,4 @@ public class JobsScheduleStartEvent extends Event implements Cancellable { public void setCancelled(boolean cancelled) { this.cancelled = cancelled; } - - @Override - public HandlerList getHandlers() { - return handlers; - } - - public static HandlerList getHandlerList() { - return handlers; - } } diff --git a/src/main/java/com/gamingmesh/jobs/api/JobsScheduleStopEvent.java b/src/main/java/com/gamingmesh/jobs/api/JobsScheduleStopEvent.java index cad259af..e862fb33 100644 --- a/src/main/java/com/gamingmesh/jobs/api/JobsScheduleStopEvent.java +++ b/src/main/java/com/gamingmesh/jobs/api/JobsScheduleStopEvent.java @@ -2,11 +2,8 @@ package com.gamingmesh.jobs.api; import com.gamingmesh.jobs.container.Schedule; import org.bukkit.event.Cancellable; -import org.bukkit.event.Event; -import org.bukkit.event.HandlerList; -public class JobsScheduleStopEvent extends Event implements Cancellable { - private static final HandlerList handlers = new HandlerList(); +public class JobsScheduleStopEvent extends BaseEvent implements Cancellable { private boolean cancelled = false; private Schedule schedule; @@ -27,13 +24,4 @@ public class JobsScheduleStopEvent extends Event implements Cancellable { public void setCancelled(boolean cancelled) { this.cancelled = cancelled; } - - @Override - public HandlerList getHandlers() { - return handlers; - } - - public static HandlerList getHandlerList() { - return handlers; - } } diff --git a/src/main/java/com/gamingmesh/jobs/commands/list/exp.java b/src/main/java/com/gamingmesh/jobs/commands/list/exp.java index ac5fd40b..e47528f7 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/list/exp.java +++ b/src/main/java/com/gamingmesh/jobs/commands/list/exp.java @@ -52,7 +52,7 @@ public class exp implements Cmd { double amount = 0.0; try { - amount = Double.parseDouble(args[3]); + amount = Double.parseDouble(args[3]); } catch (Throwable e) { sender.sendMessage(Jobs.getLanguage().getMessage("general.admin.error")); return true; @@ -80,7 +80,7 @@ public class exp implements Cmd { sender.sendMessage(Jobs.getLanguage().getMessage("general.admin.success")); } else - sender.sendMessage(Jobs.getLanguage().getMessage("command.exp.error.nojob")); + sender.sendMessage(Jobs.getLanguage().getMessage("command.exp.error.nojob")); } catch (Throwable e) { sender.sendMessage(Jobs.getLanguage().getMessage("general.admin.error")); } diff --git a/src/main/java/com/gamingmesh/jobs/commands/list/quests.java b/src/main/java/com/gamingmesh/jobs/commands/list/quests.java index 7165f64b..369a1ae8 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/list/quests.java +++ b/src/main/java/com/gamingmesh/jobs/commands/list/quests.java @@ -16,7 +16,6 @@ import com.gamingmesh.jobs.container.QuestObjective; import com.gamingmesh.jobs.container.QuestProgression; import com.gamingmesh.jobs.CMILib.RawMessage; import com.gamingmesh.jobs.stuff.TimeManage; -import com.gamingmesh.jobs.stuff.Util; public class quests implements Cmd { @@ -81,18 +80,14 @@ public class quests implements Cmd { } for (Entry oneObjective : q.getQuest().getObjectives().entrySet()) { - hoverList.add(Jobs.getLanguage().getMessage("command.info.output." + oneObjective.getValue().getAction().toString().toLowerCase() + ".info") + " " + Jobs.getNameTranslatorManager().Translate(oneObjective.getKey(), oneObjective.getValue().getAction(), oneObjective.getValue().getTargetId(), oneObjective.getValue() .getTargetMeta(), oneObjective.getValue().getTargetName()) + " " + q.getAmountDone(oneObjective.getValue()) + "/" + oneObjective.getValue().getAmount()); - - } String hover = ""; - for (String one : hoverList) { if (!hover.isEmpty()) hover += "\n"; diff --git a/src/main/java/com/gamingmesh/jobs/container/JobsPlayer.java b/src/main/java/com/gamingmesh/jobs/container/JobsPlayer.java index 36d8fe04..35079b52 100644 --- a/src/main/java/com/gamingmesh/jobs/container/JobsPlayer.java +++ b/src/main/java/com/gamingmesh/jobs/container/JobsPlayer.java @@ -33,7 +33,6 @@ import com.gamingmesh.jobs.dao.JobsDAO; import com.gamingmesh.jobs.economy.PaymentData; import com.gamingmesh.jobs.resources.jfep.Parser; import com.gamingmesh.jobs.stuff.ChatColor; -import com.gamingmesh.jobs.stuff.Debug; import com.gamingmesh.jobs.stuff.FurnaceBrewingHandling; import com.gamingmesh.jobs.stuff.TimeManage; @@ -907,7 +906,7 @@ public class JobsPlayer { g.put(qp.getQuest().getConfigName(), qp); } - + if (qp.getQuest() == null) { g.remove(one.getKey()); continue; diff --git a/src/main/java/com/gamingmesh/jobs/container/Quest.java b/src/main/java/com/gamingmesh/jobs/container/Quest.java index dcd45634..d3706103 100644 --- a/src/main/java/com/gamingmesh/jobs/container/Quest.java +++ b/src/main/java/com/gamingmesh/jobs/container/Quest.java @@ -24,8 +24,8 @@ public class Quest { private List rewardCmds = new ArrayList<>(); private List rewards = new ArrayList<>(); - private HashMap objectives = new HashMap(); - private Set actions = new HashSet(); + private HashMap objectives = new HashMap<>(); + private Set actions = new HashSet<>(); public Quest(String questName, Job job) { this.questName = questName; diff --git a/src/main/java/com/gamingmesh/jobs/container/QuestProgression.java b/src/main/java/com/gamingmesh/jobs/container/QuestProgression.java index 269c5a11..dcf22cd2 100644 --- a/src/main/java/com/gamingmesh/jobs/container/QuestProgression.java +++ b/src/main/java/com/gamingmesh/jobs/container/QuestProgression.java @@ -12,7 +12,7 @@ public class QuestProgression { // private int amountDone = 0; private Long validUntil; private boolean givenReward = false; - private HashMap done = new HashMap(); + private HashMap done = new HashMap<>(); public QuestProgression(Quest quest) { this.quest = quest; diff --git a/src/main/java/com/gamingmesh/jobs/listeners/JobsPaymentListener.java b/src/main/java/com/gamingmesh/jobs/listeners/JobsPaymentListener.java index ceec541b..7af70144 100644 --- a/src/main/java/com/gamingmesh/jobs/listeners/JobsPaymentListener.java +++ b/src/main/java/com/gamingmesh/jobs/listeners/JobsPaymentListener.java @@ -402,7 +402,7 @@ public class JobsPaymentListener implements Listener { if (item != null && !item.getType().equals(Material.AIR)) { // Prevent item durability loss if (!Jobs.getGCManager().payItemDurabilityLoss && item.getType().getMaxDurability() - - Jobs.getNms().getDurability(item) != item.getType().getMaxDurability()) + - Jobs.getNms().getDurability(item) != item.getType().getMaxDurability()) return; // Protection for block break with silktouch @@ -715,7 +715,6 @@ public class JobsPaymentListener implements Listener { return stack != null && stack.getAmount() > 0; } - @SuppressWarnings("deprecation") private static boolean hasSameItem(ItemStack a, ItemStack b) { if (a == null) return b == null; @@ -723,8 +722,8 @@ public class JobsPaymentListener implements Listener { return false; CMIMaterial mat1 = CMIMaterial.get(a); CMIMaterial mat2 = CMIMaterial.get(b); - return mat1 == mat2 && a.getDurability() == b.getDurability() && Objects.equal(a.getData(), b.getData()) && Objects.equal(a.getEnchantments(), b - .getEnchantments()); + return mat1 == mat2 && Jobs.getNms().getDurability(a) == Jobs.getNms().getDurability(b) && Objects.equal(a.getData(), b.getData()) && + Objects.equal(a.getEnchantments(), b.getEnchantments()); } private static boolean isStackSumLegal(ItemStack a, ItemStack b) { @@ -812,7 +811,7 @@ public class JobsPaymentListener implements Listener { if (jPlayer == null) return; - if (Jobs.getGCManager().PayForEnchantingOnAnvil && inv.getItem(1).getType().equals(Material.ENCHANTED_BOOK)) { + if (Jobs.getGCManager().PayForEnchantingOnAnvil && inv.getItem(1) != null && inv.getItem(1).getType().equals(Material.ENCHANTED_BOOK)) { Map enchants = resultStack.getEnchantments(); for (Entry oneEnchant : enchants.entrySet()) { Enchantment enchant = oneEnchant.getKey(); @@ -1119,7 +1118,7 @@ public class JobsPaymentListener implements Listener { if (item != null && !item.getType().equals(Material.AIR)) { // Prevent item durability loss if (!Jobs.getGCManager().payItemDurabilityLoss && item.getType().getMaxDurability() - - Jobs.getNms().getDurability(item) != item.getType().getMaxDurability()) + - Jobs.getNms().getDurability(item) != item.getType().getMaxDurability()) return; }