1
0
mirror of https://github.com/Zrips/Jobs.git synced 2025-01-20 07:01:22 +01:00

Check for null if possible

- Fix NPE when a item not found in enchant_table
- Melon can be used for now as melon_block
- We needs the redstone_lamp_on material, #440
This commit is contained in:
montlikadani 2019-05-30 18:40:41 +02:00
parent 1db6723904
commit 23e349bd10
23 changed files with 82 additions and 168 deletions

View File

@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>Jobs</groupId> <groupId>Jobs</groupId>
<artifactId>jobs</artifactId> <artifactId>jobs</artifactId>
<version>4.11.2</version> <version>4.12.0</version>
<name>Jobs</name> <name>Jobs</name>
<url>http://maven.apache.org</url> <url>http://maven.apache.org</url>
<properties> <properties>
@ -16,16 +16,16 @@
<dependency> <dependency>
<groupId>org.spigotmc</groupId> <groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId> <artifactId>spigot-api</artifactId>
<version>1.14.1-R0.1-SNAPSHOT</version> <version>1.14.2-R0.1-SNAPSHOT</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<!-- MyPet --> <!-- MyPet -->
<dependency> <dependency>
<groupId>de.Keyle.MyPet</groupId> <groupId>de.Keyle.MyPet</groupId>
<artifactId>MyPet</artifactId> <artifactId>MyPet</artifactId>
<version>3.0-SNAPSHOT</version> <version>3.1-SNAPSHOT-B1433</version>
<scope>system</scope> <scope>system</scope>
<systemPath>${basedir}/libs/MyPet-3.0-SNAPSHOT.jar</systemPath> <systemPath>${basedir}/libs/MyPet-3.1-SNAPSHOT-B1433.jar</systemPath>
</dependency> </dependency>
<!-- McMMO --> <!-- McMMO -->
<dependency> <dependency>

View File

@ -169,8 +169,8 @@ public class ActionBarTitleMessages {
} }
} catch (SecurityException | InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException | NoSuchFieldException ex) { } catch (SecurityException | InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException | NoSuchFieldException ex) {
simpleTitleMessages = true; simpleTitleMessages = true;
Bukkit.getLogger().log(Level.SEVERE, "Your server can't fully support title messages. They will be shown in chat instead."); Bukkit.getLogger().log(Level.SEVERE, "Your server can't fully support title messages. They will be shown in chat instead.");
} }
return; return;
}); });

View File

@ -147,48 +147,48 @@ public class CMIItemStack {
} }
public CMIItemStack addEnchant(Enchantment enchant, Integer level) { public CMIItemStack addEnchant(Enchantment enchant, Integer level) {
if (enchant == null) if (enchant == null)
return this; return this;
ItemMeta meta = getItemStack().getItemMeta(); ItemMeta meta = getItemStack().getItemMeta();
meta.addEnchant(enchant, level, true); meta.addEnchant(enchant, level, true);
getItemStack().setItemMeta(meta); getItemStack().setItemMeta(meta);
return this; return this;
} }
public CMIItemStack addEnchant(HashMap<Enchantment, Integer> enchants) { public CMIItemStack addEnchant(HashMap<Enchantment, Integer> enchants) {
if (enchants == null || enchants.isEmpty()) if (enchants == null || enchants.isEmpty())
return this; return this;
for (Entry<Enchantment, Integer> oneEnch : enchants.entrySet()) { for (Entry<Enchantment, Integer> oneEnch : enchants.entrySet()) {
addEnchant(oneEnch.getKey(), oneEnch.getValue()); addEnchant(oneEnch.getKey(), oneEnch.getValue());
} }
return this; return this;
} }
public CMIItemStack clearEnchants() { public CMIItemStack clearEnchants() {
ItemMeta meta = getItemStack().getItemMeta(); ItemMeta meta = getItemStack().getItemMeta();
meta.getEnchants().clear(); meta.getEnchants().clear();
getItemStack().setItemMeta(meta); getItemStack().setItemMeta(meta);
return this; return this;
} }
public List<String> getLore() { public List<String> getLore() {
ItemMeta meta = this.getItemStack().getItemMeta(); ItemMeta meta = this.getItemStack().getItemMeta();
// List<String> lore = null; // List<String> lore = null;
if (meta != null) { if (meta != null) {
List<String> lore = meta.getLore(); List<String> lore = meta.getLore();
if (lore == null) { if (lore == null) {
lore = new ArrayList<String>(); lore = new ArrayList<String>();
meta.setLore(lore); meta.setLore(lore);
// this.getItemStack().setItemMeta(meta); // this.getItemStack().setItemMeta(meta);
} }
return meta.getLore() == null ? new ArrayList<String>() : meta.getLore(); return meta.getLore() == null ? new ArrayList<String>() : meta.getLore();
} }
return new ArrayList<String>(); return new ArrayList<String>();
} }
public String getRealName() { 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) { // if (this.getItemStack() != null) {
// //
//// String translated = CMI.getInstance().getItemManager().getTranslatedName(this.getItemStack()); //// String translated = CMI.getInstance().getItemManager().getTranslatedName(this.getItemStack());
@ -203,11 +203,11 @@ public class CMIItemStack {
} }
public String getBukkitName() { public String getBukkitName() {
return bukkitName == null || bukkitName.isEmpty() ? null : bukkitName; return bukkitName == null || bukkitName.isEmpty() ? null : bukkitName;
} }
public void setBukkitName(String bukkitName) { public void setBukkitName(String bukkitName) {
this.bukkitName = bukkitName; this.bukkitName = bukkitName;
} }
public String getMojangName() { public String getMojangName() {
@ -218,7 +218,7 @@ public class CMIItemStack {
// } catch (Exception e) { // } 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) { public void setMojangName(String mojangName) {

View File

@ -1534,7 +1534,7 @@ public class ItemManager {
MAGMA_CREAM(378, 0, 25097, "Magma Cream"), MAGMA_CREAM(378, 0, 25097, "Magma Cream"),
MAGMA_CUBE_SPAWN_EGG(383, 62, 26638, "Spawn Magma Cube", "Magma Cube Spawn Egg"), MAGMA_CUBE_SPAWN_EGG(383, 62, 26638, "Spawn Magma Cube", "Magma Cube Spawn Egg"),
MAP(395, 0, 21655, "Empty Map"), 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_SEEDS(362, 0, 18340, "Melon Seeds"),
MELON_SLICE(360, 0, 5347, "Melon Slice"), MELON_SLICE(360, 0, 5347, "Melon Slice"),
MELON_STEM(105, 0, 8247, "Melon Stem"), 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_DIODE_BLOCK_ON(94, 0, null, "Diode Block On"),
LEGACY_BREWING_STAND(117, null, null, "Brewing Stand"), LEGACY_BREWING_STAND(117, null, null, "Brewing Stand"),
// LEGACY_CAULDRON(118, 0, null, "LEGACY_CAULDRON", ""), // 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_WOOD_DOUBLE_STEP(125, null, null, "LEGACY_WOOD_DOUBLE_STEP", ""),
// LEGACY_FLOWER_POT(140, null, null, "LEGACY_FLOWER_POT", ""), // LEGACY_FLOWER_POT(140, null, null, "LEGACY_FLOWER_POT", ""),
LEGACY_REDSTONE_COMPARATOR_OFF(149, 0, null, "Redstone Comparator Off", ""), LEGACY_REDSTONE_COMPARATOR_OFF(149, 0, null, "Redstone Comparator Off", ""),

View File

@ -87,7 +87,7 @@ public class ItemReflection {
Object nmsStack = asNMSCopy(item); Object nmsStack = asNMSCopy(item);
Method itemMeth = Item.getMethod("getById", int.class); Method itemMeth = Item.getMethod("getById", int.class);
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
Object res = itemMeth.invoke(Item, item.getType().getId()); Object res = itemMeth.invoke(Item, item.getType().getId());
Method nameThingy = Item.getMethod("j", IStack); Method nameThingy = Item.getMethod("j", IStack);
Object resThingy = nameThingy.invoke(res, nmsStack); Object resThingy = nameThingy.invoke(res, nmsStack);
return resThingy.toString(); return resThingy.toString();

View File

@ -18,7 +18,6 @@ public class McMMOManager {
private HashMap<UUID, HashMap<String, Long>> map = new HashMap<>(); private HashMap<UUID, HashMap<String, Long>> map = new HashMap<>();
public double getMultiplier(Player player) { public double getMultiplier(Player player) {
if (player == null) if (player == null)
return 0D; return 0D;
@ -32,14 +31,14 @@ public class McMMOManager {
return -(1 - Jobs.getGCManager().TreeFellerMultiplier); return -(1 - Jobs.getGCManager().TreeFellerMultiplier);
InfoMap.remove(SuperAbilityType.TREE_FELLER.toString()); InfoMap.remove(SuperAbilityType.TREE_FELLER.toString());
} }
t = InfoMap.get(SuperAbilityType.GIGA_DRILL_BREAKER.toString()); t = InfoMap.get(SuperAbilityType.GIGA_DRILL_BREAKER.toString());
if (t != null) { if (t != null) {
if (t > System.currentTimeMillis()) if (t > System.currentTimeMillis())
return -(1 - Jobs.getGCManager().gigaDrillMultiplier); return -(1 - Jobs.getGCManager().gigaDrillMultiplier);
InfoMap.remove(SuperAbilityType.GIGA_DRILL_BREAKER.toString()); InfoMap.remove(SuperAbilityType.GIGA_DRILL_BREAKER.toString());
} }
t = InfoMap.get(SuperAbilityType.SUPER_BREAKER.toString()); t = InfoMap.get(SuperAbilityType.SUPER_BREAKER.toString());
if (t != null) { if (t != null) {
if (t > System.currentTimeMillis()) if (t > System.currentTimeMillis())

View File

@ -396,11 +396,11 @@ public class Placeholder {
case user_totallevels: case user_totallevels:
return Integer.toString(user.getTotalLevels()); return Integer.toString(user.getTotalLevels());
case user_points: case user_points:
PlayerPoints pointInfo = Jobs.getPlayerManager().getPointsData().getPlayerPointsInfo(user.getPlayerUUID()); PlayerPoints pointInfo = Jobs.getPlayerManager().getPointsData().getPlayerPointsInfo(user.getPlayerUUID());
return Double.toString(pointInfo.getCurrentPoints()); return Double.toString(pointInfo.getCurrentPoints());
case user_total_points: case user_total_points:
pointInfo = Jobs.getPlayerManager().getPointsData().getPlayerPointsInfo(user.getPlayerUUID()); pointInfo = Jobs.getPlayerManager().getPointsData().getPlayerPointsInfo(user.getPlayerUUID());
return Double.toString(pointInfo.getTotalPoints()); return Double.toString(pointInfo.getTotalPoints());
case user_issaved: case user_issaved:
return convert(user.isSaved()); return convert(user.isSaved());
case user_displayhonorific: case user_displayhonorific:

View File

@ -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;
}
}

View File

@ -1,13 +1,10 @@
package com.gamingmesh.jobs.api; package com.gamingmesh.jobs.api;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
import com.gamingmesh.jobs.container.CuboidArea; import com.gamingmesh.jobs.container.CuboidArea;
public final class JobsAreaSelectionEvent extends Event { public final class JobsAreaSelectionEvent extends BaseEvent {
private static final HandlerList handlers = new HandlerList();
private CuboidArea area; private CuboidArea area;
private Player player; private Player player;
@ -23,13 +20,4 @@ public final class JobsAreaSelectionEvent extends Event {
public CuboidArea getArea() { public CuboidArea getArea() {
return area; return area;
} }
@Override
public HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
} }

View File

@ -3,11 +3,8 @@ package com.gamingmesh.jobs.api;
import org.bukkit.Chunk; import org.bukkit.Chunk;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable; import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
public final class JobsChunkChangeEvent extends Event implements Cancellable { public final class JobsChunkChangeEvent extends BaseEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList();
private Player player; private Player player;
private Chunk oldChunk; private Chunk oldChunk;
private Chunk newChunk; private Chunk newChunk;
@ -40,13 +37,4 @@ public final class JobsChunkChangeEvent extends Event implements Cancellable {
public void setCancelled(boolean cancelled) { public void setCancelled(boolean cancelled) {
this.cancelled = cancelled; this.cancelled = cancelled;
} }
@Override
public HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
} }

View File

@ -2,13 +2,10 @@ package com.gamingmesh.jobs.api;
import org.bukkit.OfflinePlayer; import org.bukkit.OfflinePlayer;
import org.bukkit.event.Cancellable; 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.Job;
public final class JobsExpGainEvent extends Event implements Cancellable { public final class JobsExpGainEvent extends BaseEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList();
private OfflinePlayer offlinePlayer; private OfflinePlayer offlinePlayer;
private double exp; private double exp;
private Job job; private Job job;
@ -45,13 +42,4 @@ public final class JobsExpGainEvent extends Event implements Cancellable {
public void setCancelled(boolean cancelled) { public void setCancelled(boolean cancelled) {
this.cancelled = cancelled; this.cancelled = cancelled;
} }
@Override
public HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
} }

View File

@ -1,14 +1,11 @@
package com.gamingmesh.jobs.api; package com.gamingmesh.jobs.api;
import org.bukkit.event.Cancellable; 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.Job;
import com.gamingmesh.jobs.container.JobsPlayer; import com.gamingmesh.jobs.container.JobsPlayer;
public final class JobsJoinEvent extends Event implements Cancellable { public final class JobsJoinEvent extends BaseEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList();
private JobsPlayer player; private JobsPlayer player;
private Job job; private Job job;
private boolean cancelled = false; private boolean cancelled = false;
@ -35,13 +32,4 @@ public final class JobsJoinEvent extends Event implements Cancellable {
public void setCancelled(boolean cancelled) { public void setCancelled(boolean cancelled) {
this.cancelled = cancelled; this.cancelled = cancelled;
} }
@Override
public HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
} }

View File

@ -1,14 +1,11 @@
package com.gamingmesh.jobs.api; package com.gamingmesh.jobs.api;
import org.bukkit.event.Cancellable; 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.Job;
import com.gamingmesh.jobs.container.JobsPlayer; import com.gamingmesh.jobs.container.JobsPlayer;
public final class JobsLeaveEvent extends Event implements Cancellable { public final class JobsLeaveEvent extends BaseEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList();
private JobsPlayer player; private JobsPlayer player;
private Job job; private Job job;
private boolean cancelled = false; private boolean cancelled = false;
@ -35,13 +32,4 @@ public final class JobsLeaveEvent extends Event implements Cancellable {
public void setCancelled(boolean cancelled) { public void setCancelled(boolean cancelled) {
this.cancelled = cancelled; this.cancelled = cancelled;
} }
@Override
public HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
} }

View File

@ -2,14 +2,11 @@ package com.gamingmesh.jobs.api;
import org.bukkit.Sound; import org.bukkit.Sound;
import org.bukkit.event.Cancellable; 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.JobsPlayer;
import com.gamingmesh.jobs.container.Title; import com.gamingmesh.jobs.container.Title;
public final class JobsLevelUpEvent extends Event implements Cancellable { public final class JobsLevelUpEvent extends BaseEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList();
private JobsPlayer player; private JobsPlayer player;
private String JobName; private String JobName;
private Title OldTitle; private Title OldTitle;
@ -157,13 +154,4 @@ public final class JobsLevelUpEvent extends Event implements Cancellable {
public void setCancelled(boolean cancelled) { public void setCancelled(boolean cancelled) {
this.cancelled = cancelled; this.cancelled = cancelled;
} }
@Override
public HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
} }

View File

@ -2,11 +2,8 @@ package com.gamingmesh.jobs.api;
import com.gamingmesh.jobs.container.Schedule; import com.gamingmesh.jobs.container.Schedule;
import org.bukkit.event.Cancellable; import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
public class JobsScheduleStartEvent extends Event implements Cancellable { public class JobsScheduleStartEvent extends BaseEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList();
private boolean cancelled = false; private boolean cancelled = false;
private Schedule schedule; private Schedule schedule;
@ -27,13 +24,4 @@ public class JobsScheduleStartEvent extends Event implements Cancellable {
public void setCancelled(boolean cancelled) { public void setCancelled(boolean cancelled) {
this.cancelled = cancelled; this.cancelled = cancelled;
} }
@Override
public HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
} }

View File

@ -2,11 +2,8 @@ package com.gamingmesh.jobs.api;
import com.gamingmesh.jobs.container.Schedule; import com.gamingmesh.jobs.container.Schedule;
import org.bukkit.event.Cancellable; import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
public class JobsScheduleStopEvent extends Event implements Cancellable { public class JobsScheduleStopEvent extends BaseEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList();
private boolean cancelled = false; private boolean cancelled = false;
private Schedule schedule; private Schedule schedule;
@ -27,13 +24,4 @@ public class JobsScheduleStopEvent extends Event implements Cancellable {
public void setCancelled(boolean cancelled) { public void setCancelled(boolean cancelled) {
this.cancelled = cancelled; this.cancelled = cancelled;
} }
@Override
public HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
} }

View File

@ -52,7 +52,7 @@ public class exp implements Cmd {
double amount = 0.0; double amount = 0.0;
try { try {
amount = Double.parseDouble(args[3]); amount = Double.parseDouble(args[3]);
} catch (Throwable e) { } catch (Throwable e) {
sender.sendMessage(Jobs.getLanguage().getMessage("general.admin.error")); sender.sendMessage(Jobs.getLanguage().getMessage("general.admin.error"));
return true; return true;
@ -80,7 +80,7 @@ public class exp implements Cmd {
sender.sendMessage(Jobs.getLanguage().getMessage("general.admin.success")); sender.sendMessage(Jobs.getLanguage().getMessage("general.admin.success"));
} else } else
sender.sendMessage(Jobs.getLanguage().getMessage("command.exp.error.nojob")); sender.sendMessage(Jobs.getLanguage().getMessage("command.exp.error.nojob"));
} catch (Throwable e) { } catch (Throwable e) {
sender.sendMessage(Jobs.getLanguage().getMessage("general.admin.error")); sender.sendMessage(Jobs.getLanguage().getMessage("general.admin.error"));
} }

View File

@ -16,7 +16,6 @@ import com.gamingmesh.jobs.container.QuestObjective;
import com.gamingmesh.jobs.container.QuestProgression; import com.gamingmesh.jobs.container.QuestProgression;
import com.gamingmesh.jobs.CMILib.RawMessage; import com.gamingmesh.jobs.CMILib.RawMessage;
import com.gamingmesh.jobs.stuff.TimeManage; import com.gamingmesh.jobs.stuff.TimeManage;
import com.gamingmesh.jobs.stuff.Util;
public class quests implements Cmd { public class quests implements Cmd {
@ -81,18 +80,14 @@ public class quests implements Cmd {
} }
for (Entry<String, QuestObjective> oneObjective : q.getQuest().getObjectives().entrySet()) { for (Entry<String, QuestObjective> oneObjective : q.getQuest().getObjectives().entrySet()) {
hoverList.add(Jobs.getLanguage().getMessage("command.info.output." + oneObjective.getValue().getAction().toString().toLowerCase() + ".info") + " " + 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() Jobs.getNameTranslatorManager().Translate(oneObjective.getKey(), oneObjective.getValue().getAction(), oneObjective.getValue().getTargetId(), oneObjective.getValue()
.getTargetMeta(), oneObjective.getValue().getTargetName()) .getTargetMeta(), oneObjective.getValue().getTargetName())
+ " " + q.getAmountDone(oneObjective.getValue()) + "/" + " " + q.getAmountDone(oneObjective.getValue()) + "/"
+ oneObjective.getValue().getAmount()); + oneObjective.getValue().getAmount());
} }
String hover = ""; String hover = "";
for (String one : hoverList) { for (String one : hoverList) {
if (!hover.isEmpty()) if (!hover.isEmpty())
hover += "\n"; hover += "\n";

View File

@ -33,7 +33,6 @@ import com.gamingmesh.jobs.dao.JobsDAO;
import com.gamingmesh.jobs.economy.PaymentData; import com.gamingmesh.jobs.economy.PaymentData;
import com.gamingmesh.jobs.resources.jfep.Parser; import com.gamingmesh.jobs.resources.jfep.Parser;
import com.gamingmesh.jobs.stuff.ChatColor; import com.gamingmesh.jobs.stuff.ChatColor;
import com.gamingmesh.jobs.stuff.Debug;
import com.gamingmesh.jobs.stuff.FurnaceBrewingHandling; import com.gamingmesh.jobs.stuff.FurnaceBrewingHandling;
import com.gamingmesh.jobs.stuff.TimeManage; import com.gamingmesh.jobs.stuff.TimeManage;
@ -907,7 +906,7 @@ public class JobsPlayer {
g.put(qp.getQuest().getConfigName(), qp); g.put(qp.getQuest().getConfigName(), qp);
} }
if (qp.getQuest() == null) { if (qp.getQuest() == null) {
g.remove(one.getKey()); g.remove(one.getKey());
continue; continue;

View File

@ -24,8 +24,8 @@ public class Quest {
private List<String> rewardCmds = new ArrayList<>(); private List<String> rewardCmds = new ArrayList<>();
private List<String> rewards = new ArrayList<>(); private List<String> rewards = new ArrayList<>();
private HashMap<String, QuestObjective> objectives = new HashMap<String, QuestObjective>(); private HashMap<String, QuestObjective> objectives = new HashMap<>();
private Set<ActionType> actions = new HashSet<ActionType>(); private Set<ActionType> actions = new HashSet<>();
public Quest(String questName, Job job) { public Quest(String questName, Job job) {
this.questName = questName; this.questName = questName;

View File

@ -12,7 +12,7 @@ public class QuestProgression {
// private int amountDone = 0; // private int amountDone = 0;
private Long validUntil; private Long validUntil;
private boolean givenReward = false; private boolean givenReward = false;
private HashMap<QuestObjective, Integer> done = new HashMap<QuestObjective, Integer>(); private HashMap<QuestObjective, Integer> done = new HashMap<>();
public QuestProgression(Quest quest) { public QuestProgression(Quest quest) {
this.quest = quest; this.quest = quest;

View File

@ -402,7 +402,7 @@ public class JobsPaymentListener implements Listener {
if (item != null && !item.getType().equals(Material.AIR)) { if (item != null && !item.getType().equals(Material.AIR)) {
// Prevent item durability loss // Prevent item durability loss
if (!Jobs.getGCManager().payItemDurabilityLoss && item.getType().getMaxDurability() if (!Jobs.getGCManager().payItemDurabilityLoss && item.getType().getMaxDurability()
- Jobs.getNms().getDurability(item) != item.getType().getMaxDurability()) - Jobs.getNms().getDurability(item) != item.getType().getMaxDurability())
return; return;
// Protection for block break with silktouch // Protection for block break with silktouch
@ -715,7 +715,6 @@ public class JobsPaymentListener implements Listener {
return stack != null && stack.getAmount() > 0; return stack != null && stack.getAmount() > 0;
} }
@SuppressWarnings("deprecation")
private static boolean hasSameItem(ItemStack a, ItemStack b) { private static boolean hasSameItem(ItemStack a, ItemStack b) {
if (a == null) if (a == null)
return b == null; return b == null;
@ -723,8 +722,8 @@ public class JobsPaymentListener implements Listener {
return false; return false;
CMIMaterial mat1 = CMIMaterial.get(a); CMIMaterial mat1 = CMIMaterial.get(a);
CMIMaterial mat2 = CMIMaterial.get(b); CMIMaterial mat2 = CMIMaterial.get(b);
return mat1 == mat2 && a.getDurability() == b.getDurability() && Objects.equal(a.getData(), b.getData()) && Objects.equal(a.getEnchantments(), b return mat1 == mat2 && Jobs.getNms().getDurability(a) == Jobs.getNms().getDurability(b) && Objects.equal(a.getData(), b.getData()) &&
.getEnchantments()); Objects.equal(a.getEnchantments(), b.getEnchantments());
} }
private static boolean isStackSumLegal(ItemStack a, ItemStack b) { private static boolean isStackSumLegal(ItemStack a, ItemStack b) {
@ -812,7 +811,7 @@ public class JobsPaymentListener implements Listener {
if (jPlayer == null) if (jPlayer == null)
return; 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<Enchantment, Integer> enchants = resultStack.getEnchantments(); Map<Enchantment, Integer> enchants = resultStack.getEnchantments();
for (Entry<Enchantment, Integer> oneEnchant : enchants.entrySet()) { for (Entry<Enchantment, Integer> oneEnchant : enchants.entrySet()) {
Enchantment enchant = oneEnchant.getKey(); Enchantment enchant = oneEnchant.getKey();
@ -1119,7 +1118,7 @@ public class JobsPaymentListener implements Listener {
if (item != null && !item.getType().equals(Material.AIR)) { if (item != null && !item.getType().equals(Material.AIR)) {
// Prevent item durability loss // Prevent item durability loss
if (!Jobs.getGCManager().payItemDurabilityLoss && item.getType().getMaxDurability() if (!Jobs.getGCManager().payItemDurabilityLoss && item.getType().getMaxDurability()
- Jobs.getNms().getDurability(item) != item.getType().getMaxDurability()) - Jobs.getNms().getDurability(item) != item.getType().getMaxDurability())
return; return;
} }