mirror of
https://github.com/Zrips/Jobs.git
synced 2025-01-02 14:29:07 +01:00
No one uses old mythicmobs
This commit is contained in:
parent
c91f88858a
commit
2bb9d44d95
Binary file not shown.
10
pom.xml
10
pom.xml
@ -61,15 +61,7 @@
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<!-- MythicMobs 2 -->
|
||||
<dependency>
|
||||
<groupId>net.elseland.xikage</groupId>
|
||||
<artifactId>MythicMobs</artifactId>
|
||||
<version>2.4.5</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${basedir}/libs/MythicMobs-2.4.5.jar</systemPath>
|
||||
</dependency>
|
||||
<!-- MythicMobs new -->
|
||||
<!-- MythicMobs -->
|
||||
<dependency>
|
||||
<groupId>io.lumine.xikage</groupId>
|
||||
<artifactId>MythicMobs</artifactId>
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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 "";
|
||||
}
|
||||
}
|
||||
}
|
@ -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);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user