diff --git a/libs/MythicMobs-4.9.0.jar b/libs/MythicMobs-4.9.0.jar
deleted file mode 100644
index 0a3a6860..00000000
Binary files a/libs/MythicMobs-4.9.0.jar and /dev/null differ
diff --git a/pom.xml b/pom.xml
index 238035d3..a96cd0f4 100644
--- a/pom.xml
+++ b/pom.xml
@@ -69,13 +69,12 @@
system
${basedir}/libs/MythicMobs-2.4.5.jar
-
+
- io.lumine.xikage.mythicmobs
+ io.lumine.xikage
MythicMobs
- 4.9.0
- system
- ${basedir}/libs/MythicMobs-4.9.0.jar
+ 4.9.1
+ provided
@@ -205,6 +204,13 @@
always
+
+
+ nexus
+ Lumine Releases
+ https://mvn.lumine.io/repository/maven-public/
+
+
diff --git a/src/main/java/com/gamingmesh/jobs/CMILib/CMIItemStack.java b/src/main/java/com/gamingmesh/jobs/CMILib/CMIItemStack.java
index a75e2ff0..aa14880d 100644
--- a/src/main/java/com/gamingmesh/jobs/CMILib/CMIItemStack.java
+++ b/src/main/java/com/gamingmesh/jobs/CMILib/CMIItemStack.java
@@ -295,7 +295,7 @@ public class CMIItemStack {
@SuppressWarnings("deprecation")
public CMIItemStack setItemStack(ItemStack item) {
- this.item = item == null ? null : item;
+ this.item = item;
if (item != null) {
this.amount = item.getAmount();
this.material = item.getType();
diff --git a/src/main/java/com/gamingmesh/jobs/config/NameTranslatorManager.java b/src/main/java/com/gamingmesh/jobs/config/NameTranslatorManager.java
index 779cf329..37f8b6d8 100644
--- a/src/main/java/com/gamingmesh/jobs/config/NameTranslatorManager.java
+++ b/src/main/java/com/gamingmesh/jobs/config/NameTranslatorManager.java
@@ -106,7 +106,7 @@ public class NameTranslatorManager {
case TAME:
for (NameList one : ListOfEntities) {
String ids = one.getId() + ":" + one.getMeta();
- if (!one.getMeta().equalsIgnoreCase("") && ids.equalsIgnoreCase(id + ":" + meta) && !one.getId().equals("0")) {
+ if (!one.getMeta().isEmpty() && ids.equalsIgnoreCase(id + ":" + meta) && !one.getId().equals("0")) {
return one.getName();
}
ids = one.getId();
diff --git a/src/main/java/com/gamingmesh/jobs/container/JobInfo.java b/src/main/java/com/gamingmesh/jobs/container/JobInfo.java
index 0cf0abdc..39a868fe 100644
--- a/src/main/java/com/gamingmesh/jobs/container/JobInfo.java
+++ b/src/main/java/com/gamingmesh/jobs/container/JobInfo.java
@@ -81,7 +81,7 @@ public class JobInfo {
public String getRealisticName() {
String materialName = getName().toLowerCase().replace('_', ' ');
materialName = Character.toUpperCase(materialName.charAt(0)) + materialName.substring(1);
- materialName = Jobs.getNameTranslatorManager().Translate(getActionType().equals(ActionType.MMKILL) ? getName() : materialName, this);
+ materialName = Jobs.getNameTranslatorManager().Translate(actionType == ActionType.MMKILL ? getName() : materialName, this);
materialName = CMIChatColor.translate(materialName);
return materialName;
}
diff --git a/src/main/java/com/gamingmesh/jobs/hooks/HookManager.java b/src/main/java/com/gamingmesh/jobs/hooks/HookManager.java
index c9bda19e..b29fb08d 100644
--- a/src/main/java/com/gamingmesh/jobs/hooks/HookManager.java
+++ b/src/main/java/com/gamingmesh/jobs/hooks/HookManager.java
@@ -102,7 +102,7 @@ public class HookManager {
}
if (MythicManager == null) {
- Jobs.consoleMsg("&cYour MythicMobs version is not supported by Jobs! Supported versions: 2.4.5+, 4.6.5");
+ Jobs.consoleMsg("&cYour MythicMobs version is not supported by Jobs! Supported versions: 2.4.5+, 4.6.5+");
return;
}
diff --git a/src/main/java/com/gamingmesh/jobs/hooks/MythicMobs/MythicMobs2.java b/src/main/java/com/gamingmesh/jobs/hooks/MythicMobs/MythicMobs2.java
index a6b73ad1..7203ddb7 100644
--- a/src/main/java/com/gamingmesh/jobs/hooks/MythicMobs/MythicMobs2.java
+++ b/src/main/java/com/gamingmesh/jobs/hooks/MythicMobs/MythicMobs2.java
@@ -13,7 +13,7 @@ import net.elseland.xikage.MythicMobs.Mobs.MythicMob;
public class MythicMobs2 implements MythicMobInterface {
- public MythicMobsAPI MMAPI = null;
+ public MythicMobsAPI MMAPI;
private Jobs plugin;
public MythicMobs2(Jobs plugin) {
@@ -22,7 +22,7 @@ public class MythicMobs2 implements MythicMobInterface {
@Override
public void registerListener() {
- Bukkit.getServer().getPluginManager().registerEvents(new MythicMobs2Listener(plugin), plugin);
+ Bukkit.getServer().getPluginManager().registerEvents(new MythicMobs2Listener(), plugin);
}
@Override
@@ -30,10 +30,7 @@ public class MythicMobs2 implements MythicMobInterface {
if (MMAPI == null || lVictim == null)
return false;
- if (MMAPI.getMobAPI().isMythicMob(lVictim))
- return true;
-
- return false;
+ return MMAPI.getMobAPI().isMythicMob(lVictim);
}
@Override
@@ -59,14 +56,15 @@ public class MythicMobs2 implements MythicMobInterface {
@Override
public String getDisplayName(String id) {
- try {
- MythicMob mm = MMAPI.getMobAPI().getMythicMob(id);
- if (mm != null)
- return mm.getDisplayName();
- } catch (InvalidMobTypeException e) {
+ if (MMAPI == null || id == null) {
return "";
}
- return "";
+ try {
+ MythicMob mm = MMAPI.getMobAPI().getMythicMob(id);
+ return mm != null ? mm.getDisplayName() : "";
+ } catch (InvalidMobTypeException e) {
+ return "";
+ }
}
}
diff --git a/src/main/java/com/gamingmesh/jobs/hooks/MythicMobs/MythicMobs2Listener.java b/src/main/java/com/gamingmesh/jobs/hooks/MythicMobs/MythicMobs2Listener.java
index 4dd816c4..8288f596 100644
--- a/src/main/java/com/gamingmesh/jobs/hooks/MythicMobs/MythicMobs2Listener.java
+++ b/src/main/java/com/gamingmesh/jobs/hooks/MythicMobs/MythicMobs2Listener.java
@@ -1,6 +1,5 @@
package com.gamingmesh.jobs.hooks.MythicMobs;
-import org.bukkit.GameMode;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
@@ -11,23 +10,15 @@ import com.gamingmesh.jobs.Jobs;
import com.gamingmesh.jobs.actions.MMKillInfo;
import com.gamingmesh.jobs.container.ActionType;
import com.gamingmesh.jobs.container.JobsPlayer;
+import com.gamingmesh.jobs.listeners.JobsPaymentListener;
+
import net.elseland.xikage.MythicMobs.API.Bukkit.Events.MythicMobDeathEvent;
import net.elseland.xikage.MythicMobs.Mobs.MythicMob;
public class MythicMobs2Listener implements Listener {
- private Jobs plugin;
-
- public MythicMobs2Listener(Jobs plugin) {
- this.plugin = plugin;
- }
-
@EventHandler
public void OnMythicMobDeath(MythicMobDeathEvent event) {
- // make sure plugin is enabled
- if (!plugin.isEnabled())
- return;
-
//disabling plugin in world
if (event.getEntity() != null && !Jobs.getGCManager().canPerformActionInWorld(event.getEntity().getWorld()))
return;
@@ -52,7 +43,7 @@ public class MythicMobs2Listener implements Listener {
return;
// check if in creative
- if (pDamager.getGameMode().equals(GameMode.CREATIVE) && !pDamager.hasPermission("jobs.paycreative") && !Jobs.getGCManager().payInCreative())
+ if (!JobsPaymentListener.payIfCreative(pDamager))
return;
if (!Jobs.getPermissionHandler().hasWorldPermission(pDamager, pDamager.getLocation().getWorld().getName()))
diff --git a/src/main/java/com/gamingmesh/jobs/hooks/MythicMobs/MythicMobs4.java b/src/main/java/com/gamingmesh/jobs/hooks/MythicMobs/MythicMobs4.java
index 6d4d0d75..5beb914f 100644
--- a/src/main/java/com/gamingmesh/jobs/hooks/MythicMobs/MythicMobs4.java
+++ b/src/main/java/com/gamingmesh/jobs/hooks/MythicMobs/MythicMobs4.java
@@ -12,7 +12,7 @@ import io.lumine.xikage.mythicmobs.mobs.MythicMob;
public class MythicMobs4 implements MythicMobInterface {
- public BukkitAPIHelper MMAPI = null;
+ public BukkitAPIHelper MMAPI;
private Jobs plugin;
public MythicMobs4(Jobs plugin) {
@@ -21,7 +21,7 @@ public class MythicMobs4 implements MythicMobInterface {
@Override
public void registerListener() {
- Bukkit.getServer().getPluginManager().registerEvents(new MythicMobs4Listener(plugin), plugin);
+ Bukkit.getServer().getPluginManager().registerEvents(new MythicMobs4Listener(), plugin);
}
@Override
@@ -29,10 +29,7 @@ public class MythicMobs4 implements MythicMobInterface {
if (MMAPI == null || lVictim == null)
return false;
- if (MMAPI.isMythicMob(lVictim))
- return true;
-
- return false;
+ return MMAPI.isMythicMob(lVictim);
}
@Override
@@ -61,17 +58,14 @@ public class MythicMobs4 implements MythicMobInterface {
@Override
public String getDisplayName(String id) {
- if (failed)
- return "";
-
- if (MMAPI == null)
+ if (failed || MMAPI == null)
return "";
MythicMob mm = MMAPI.getMythicMob(id);
try {
if (mm != null)
return mm.getDisplayName().toString();
- } catch (Exception | Error e) {
+ } catch (Throwable e) {
if (!failed) {
failed = true;
Jobs.consoleMsg("&cEncountered error when checking MythicMob entity name. Support for mythicMobs will be suspended for time beying. Please report this issue.");
diff --git a/src/main/java/com/gamingmesh/jobs/hooks/MythicMobs/MythicMobs4Listener.java b/src/main/java/com/gamingmesh/jobs/hooks/MythicMobs/MythicMobs4Listener.java
index a2cecb96..05444119 100644
--- a/src/main/java/com/gamingmesh/jobs/hooks/MythicMobs/MythicMobs4Listener.java
+++ b/src/main/java/com/gamingmesh/jobs/hooks/MythicMobs/MythicMobs4Listener.java
@@ -1,6 +1,5 @@
package com.gamingmesh.jobs.hooks.MythicMobs;
-import org.bukkit.GameMode;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
@@ -11,24 +10,15 @@ import com.gamingmesh.jobs.Jobs;
import com.gamingmesh.jobs.actions.MMKillInfo;
import com.gamingmesh.jobs.container.ActionType;
import com.gamingmesh.jobs.container.JobsPlayer;
+import com.gamingmesh.jobs.listeners.JobsPaymentListener;
import io.lumine.xikage.mythicmobs.api.bukkit.events.MythicMobDeathEvent;
import io.lumine.xikage.mythicmobs.mobs.MythicMob;
public class MythicMobs4Listener implements Listener {
- private Jobs plugin;
-
- public MythicMobs4Listener(Jobs plugin) {
- this.plugin = plugin;
- }
-
@EventHandler
public void OnMythicMobDeath(MythicMobDeathEvent event) {
- // make sure plugin is enabled
- if (!plugin.isEnabled())
- return;
-
//disabling plugin in world
if (event.getEntity() != null && !Jobs.getGCManager().canPerformActionInWorld(event.getEntity().getWorld()))
return;
@@ -53,7 +43,7 @@ public class MythicMobs4Listener implements Listener {
return;
// check if in creative
- if (pDamager.getGameMode().equals(GameMode.CREATIVE) && !pDamager.hasPermission("jobs.paycreative") && !Jobs.getGCManager().payInCreative())
+ if (!JobsPaymentListener.payIfCreative(pDamager))
return;
if (!Jobs.getPermissionHandler().hasWorldPermission(pDamager, pDamager.getLocation().getWorld().getName()))
diff --git a/src/main/java/com/gamingmesh/jobs/listeners/JobsPaymentListener.java b/src/main/java/com/gamingmesh/jobs/listeners/JobsPaymentListener.java
index 9b826917..7778c9f1 100644
--- a/src/main/java/com/gamingmesh/jobs/listeners/JobsPaymentListener.java
+++ b/src/main/java/com/gamingmesh/jobs/listeners/JobsPaymentListener.java
@@ -196,8 +196,6 @@ public class JobsPaymentListener implements Listener {
return;
ItemStack itemInHand = Jobs.getNms().getItemInMainHand(player);
- if (itemInHand == null)
- return;
if ((cow.getType() == EntityType.COW && itemInHand.getType() != Material.BUCKET)
|| (cow.getType() == EntityType.MUSHROOM_COW && itemInHand.getType() != Material.BOWL)) {
@@ -277,7 +275,7 @@ public class JobsPaymentListener implements Listener {
// pay
JobsPlayer jDamager = Jobs.getPlayerManager().getJobsPlayer(player);
- if (jDamager == null)
+ if (jDamager == null || sheep.getColor() == null)
return;
Jobs.action(jDamager, new CustomKillInfo(sheep.getColor().name(), ActionType.SHEAR));
@@ -373,7 +371,7 @@ public class JobsPaymentListener implements Listener {
return;
ItemStack item = Jobs.getNms().getItemInMainHand(player);
- if (item != null && item.getType() != Material.AIR) {
+ if (item.getType() != Material.AIR) {
// Protection for block break with silktouch
if (Jobs.getGCManager().useSilkTouchProtection) {
for (Enchantment one : item.getEnchantments().keySet()) {
@@ -667,7 +665,7 @@ public class JobsPaymentListener implements Listener {
ItemStack currentItem = event.getCurrentItem();
// when we trying to craft tipped arrow effects
- if (currentItem != null && currentItem.hasItemMeta() && currentItem.getItemMeta() instanceof PotionMeta) {
+ if (currentItem != null && currentItem.getItemMeta() instanceof PotionMeta) {
PotionMeta potion = (PotionMeta) currentItem.getItemMeta();
Jobs.action(jPlayer, new PotionItemActionInfo(currentItem, ActionType.CRAFT, potion.getBasePotionData().getType()));
} else if (resultStack.hasItemMeta() && resultStack.getItemMeta().hasDisplayName()) {