diff --git a/libs/MythicMobs-2.4.5.jar b/libs/MythicMobs-2.4.5.jar deleted file mode 100644 index b3648352..00000000 Binary files a/libs/MythicMobs-2.4.5.jar and /dev/null differ diff --git a/pom.xml b/pom.xml index 0c38c80b..a3f9ec8d 100644 --- a/pom.xml +++ b/pom.xml @@ -61,15 +61,7 @@ - - - net.elseland.xikage - MythicMobs - 2.4.5 - system - ${basedir}/libs/MythicMobs-2.4.5.jar - - + io.lumine.xikage MythicMobs diff --git a/src/main/java/com/gamingmesh/jobs/PlayerManager.java b/src/main/java/com/gamingmesh/jobs/PlayerManager.java index d556f48e..ebbf0917 100644 --- a/src/main/java/com/gamingmesh/jobs/PlayerManager.java +++ b/src/main/java/com/gamingmesh/jobs/PlayerManager.java @@ -540,13 +540,8 @@ public class PlayerManager { if (prog.getLevel() < oldLevel) { String message = Jobs.getLanguage().getMessage("message.leveldown.message"); - message = message.replace("%jobname%", job.getChatColor() + job.getName()); - - if (player != null) - message = message.replace("%playername%", player.getDisplayName()); - else - message = message.replace("%playername%", jPlayer.getName()); - + message = message.replace("%jobname%", job.getNameWithColor()); + message = message.replace("%playername%", player != null ? player.getDisplayName() : jPlayer.getName()); message = message.replace("%joblevel%", "" + prog.getLevel()); message = message.replace("%lostLevel%", "" + oldLevel); @@ -693,17 +688,14 @@ public class PlayerManager { else message = Jobs.getLanguage().getMessage("message.levelup.nobroadcast"); - message = message.replace("%jobname%", job.getChatColor() + job.getName()); + message = message.replace("%jobname%", job.getNameWithColor()); if (levelUpEvent.getOldTitle() != null) message = message.replace("%titlename%", levelUpEvent.getOldTitleColor() + levelUpEvent.getOldTitleName()); - if (player != null) - message = message.replace("%playername%", player.getDisplayName()); - else - message = message.replace("%playername%", jPlayer.getName()); - + message = message.replace("%playername%", player != null ? player.getDisplayName() : jPlayer.getName()); message = message.replace("%joblevel%", "" + prog.getLevel()); + for (String line : message.split("\n")) { if (Jobs.getGCManager().isBroadcastingLevelups()) { if (Jobs.getGCManager().BroadcastingLevelUpLevels.contains(oldLevel + 1) || Jobs.getGCManager().BroadcastingLevelUpLevels.contains(0)) @@ -737,13 +729,10 @@ public class PlayerManager { else message = Jobs.getLanguage().getMessage("message.skillup.nobroadcast"); - if (player != null) - message = message.replace("%playername%", player.getDisplayName()); - else - message = message.replace("%playername%", jPlayer.getName()); - + message = message.replace("%playername%", player != null ? player.getDisplayName() : jPlayer.getName()); message = message.replace("%titlename%", levelUpEvent.getNewTitleColor() + levelUpEvent.getNewTitleName()); - message = message.replace("%jobname%", job.getChatColor() + job.getName()); + message = message.replace("%jobname%", job.getNameWithColor()); + for (String line : message.split("\n")) { if (Jobs.getGCManager().isBroadcastingSkillups()) { Bukkit.getServer().broadcastMessage(line); diff --git a/src/main/java/com/gamingmesh/jobs/hooks/HookManager.java b/src/main/java/com/gamingmesh/jobs/hooks/HookManager.java index 0b1f0e70..53c5c13a 100644 --- a/src/main/java/com/gamingmesh/jobs/hooks/HookManager.java +++ b/src/main/java/com/gamingmesh/jobs/hooks/HookManager.java @@ -9,7 +9,6 @@ import com.gamingmesh.jobs.hooks.McMMO.McMMO2_X_listener; import com.gamingmesh.jobs.hooks.McMMO.McMMOManager; import com.gamingmesh.jobs.hooks.MyPet.MyPetManager; import com.gamingmesh.jobs.hooks.MythicMobs.MythicMobInterface; -import com.gamingmesh.jobs.hooks.MythicMobs.MythicMobs2; import com.gamingmesh.jobs.hooks.MythicMobs.MythicMobs4; import com.gamingmesh.jobs.hooks.WorldGuard.WorldGuardManager; import com.gamingmesh.jobs.hooks.stackMob.StackMobHandler; @@ -113,18 +112,13 @@ public class HookManager { return; try { - Class.forName("net.elseland.xikage.MythicMobs.API.MythicMobsAPI"); - MythicManager = new MythicMobs2(Jobs.getInstance()); - } catch (ClassNotFoundException e) { - try { - Class.forName("io.lumine.xikage.mythicmobs.api.bukkit.BukkitAPIHelper"); - MythicManager = new MythicMobs4(Jobs.getInstance()); - } catch (ClassNotFoundException ex) { - } + Class.forName("io.lumine.xikage.mythicmobs.api.bukkit.BukkitAPIHelper"); + MythicManager = new MythicMobs4(Jobs.getInstance()); + } catch (ClassNotFoundException ex) { } 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: 4.9.1+"); 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 deleted file mode 100644 index 806b0eab..00000000 --- a/src/main/java/com/gamingmesh/jobs/hooks/MythicMobs/MythicMobs2.java +++ /dev/null @@ -1,67 +0,0 @@ -package com.gamingmesh.jobs.hooks.MythicMobs; - -import org.bukkit.Bukkit; -import org.bukkit.entity.LivingEntity; -import org.bukkit.plugin.Plugin; - -import com.gamingmesh.jobs.Jobs; - -import net.elseland.xikage.MythicMobs.MythicMobs; -import net.elseland.xikage.MythicMobs.API.MythicMobsAPI; -import net.elseland.xikage.MythicMobs.API.Exceptions.InvalidMobTypeException; -import net.elseland.xikage.MythicMobs.Mobs.MythicMob; - -public class MythicMobs2 implements MythicMobInterface { - - public MythicMobsAPI MMAPI; - private Jobs plugin; - - public MythicMobs2(Jobs plugin) { - this.plugin = plugin; - } - - @Override - public void registerListener() { - Bukkit.getServer().getPluginManager().registerEvents(new MythicMobs2Listener(), plugin); - } - - @Override - public boolean isMythicMob(LivingEntity lVictim) { - return MMAPI != null && lVictim != null && MMAPI.getMobAPI().isMythicMob(lVictim); - } - - @Override - public boolean Check() { - Plugin mm = Bukkit.getPluginManager().getPlugin("MythicMobs"); - if (mm == null) - return false; - - try { - Class.forName("net.elseland.xikage.MythicMobs.API.Bukkit.Events.MythicMobDeathEvent"); - Class.forName("net.elseland.xikage.MythicMobs.API.MythicMobsAPI"); - Class.forName("net.elseland.xikage.MythicMobs.Mobs.MythicMob"); - } catch (ClassNotFoundException e) { - // Disabling - Jobs.consoleMsg("&e[Jobs] &6MythicMobs was found - &cBut your version is outdated, please update for full support."); - return false; - } - - MMAPI = ((MythicMobs) mm).getAPI(); - Jobs.consoleMsg("&e[Jobs] &6MythicMobs2 was found - Enabling capabilities."); - return true; - } - - @Override - public String getDisplayName(String id) { - if (MMAPI == null || id == null) { - 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 deleted file mode 100644 index 8288f596..00000000 --- a/src/main/java/com/gamingmesh/jobs/hooks/MythicMobs/MythicMobs2Listener.java +++ /dev/null @@ -1,64 +0,0 @@ -package com.gamingmesh.jobs.hooks.MythicMobs; - -import org.bukkit.entity.Entity; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -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 { - - @EventHandler - public void OnMythicMobDeath(MythicMobDeathEvent event) { - //disabling plugin in world - if (event.getEntity() != null && !Jobs.getGCManager().canPerformActionInWorld(event.getEntity().getWorld())) - return; - - // Entity that died must be living - if (!(event.getEntity() instanceof LivingEntity)) - return; - - Player pDamager = null; - - // Checking if killer is player - Entity ent = null; - if (event.getKiller() instanceof Player) - pDamager = (Player) event.getKiller(); - // Checking if killer is tamed animal - else if (event.getEntity().getLastDamageCause() instanceof EntityDamageByEntityEvent) { - ent = ((EntityDamageByEntityEvent) event.getEntity().getLastDamageCause()).getDamager(); - } else - return; - - if (pDamager == null) - return; - - // check if in creative - if (!JobsPaymentListener.payIfCreative(pDamager)) - return; - - if (!Jobs.getPermissionHandler().hasWorldPermission(pDamager, pDamager.getLocation().getWorld().getName())) - return; - - // pay - JobsPlayer jDamager = Jobs.getPlayerManager().getJobsPlayer(pDamager); - if (jDamager == null) - return; - - MythicMob lVictim = event.getMobType(); - if (lVictim == null) { - return; - } - - Jobs.action(jDamager, new MMKillInfo(lVictim.getInternalName(), ActionType.MMKILL), ent); - } -}