1
0
mirror of https://github.com/Zrips/Jobs.git synced 2025-01-04 23:37:49 +01:00

Update mythicmobs repo

This commit is contained in:
montlikadani 2020-08-27 09:47:17 +02:00
parent e933bc3a84
commit f3151489be
11 changed files with 38 additions and 61 deletions

Binary file not shown.

16
pom.xml
View File

@ -69,13 +69,12 @@
<scope>system</scope> <scope>system</scope>
<systemPath>${basedir}/libs/MythicMobs-2.4.5.jar</systemPath> <systemPath>${basedir}/libs/MythicMobs-2.4.5.jar</systemPath>
</dependency> </dependency>
<!-- MythicMobs 4 --> <!-- MythicMobs new -->
<dependency> <dependency>
<groupId>io.lumine.xikage.mythicmobs</groupId> <groupId>io.lumine.xikage</groupId>
<artifactId>MythicMobs</artifactId> <artifactId>MythicMobs</artifactId>
<version>4.9.0</version> <version>4.9.1</version>
<scope>system</scope> <scope>provided</scope>
<systemPath>${basedir}/libs/MythicMobs-4.9.0.jar</systemPath>
</dependency> </dependency>
<!-- WorldGuard old version --> <!-- WorldGuard old version -->
<dependency> <dependency>
@ -205,6 +204,13 @@
<updatePolicy>always</updatePolicy> <updatePolicy>always</updatePolicy>
</snapshots> </snapshots>
</repository> </repository>
<!-- MythicMobs -->
<repository>
<id>nexus</id>
<name>Lumine Releases</name>
<url>https://mvn.lumine.io/repository/maven-public/</url>
</repository>
</repositories> </repositories>
<!-- Builds Plugin --> <!-- Builds Plugin -->
<build> <build>

View File

@ -295,7 +295,7 @@ public class CMIItemStack {
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
public CMIItemStack setItemStack(ItemStack item) { public CMIItemStack setItemStack(ItemStack item) {
this.item = item == null ? null : item; this.item = item;
if (item != null) { if (item != null) {
this.amount = item.getAmount(); this.amount = item.getAmount();
this.material = item.getType(); this.material = item.getType();

View File

@ -106,7 +106,7 @@ public class NameTranslatorManager {
case TAME: case TAME:
for (NameList one : ListOfEntities) { for (NameList one : ListOfEntities) {
String ids = one.getId() + ":" + one.getMeta(); 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(); return one.getName();
} }
ids = one.getId(); ids = one.getId();

View File

@ -81,7 +81,7 @@ public class JobInfo {
public String getRealisticName() { public String getRealisticName() {
String materialName = getName().toLowerCase().replace('_', ' '); String materialName = getName().toLowerCase().replace('_', ' ');
materialName = Character.toUpperCase(materialName.charAt(0)) + materialName.substring(1); 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); materialName = CMIChatColor.translate(materialName);
return materialName; return materialName;
} }

View File

@ -102,7 +102,7 @@ public class HookManager {
} }
if (MythicManager == null) { 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; return;
} }

View File

@ -13,7 +13,7 @@ import net.elseland.xikage.MythicMobs.Mobs.MythicMob;
public class MythicMobs2 implements MythicMobInterface { public class MythicMobs2 implements MythicMobInterface {
public MythicMobsAPI MMAPI = null; public MythicMobsAPI MMAPI;
private Jobs plugin; private Jobs plugin;
public MythicMobs2(Jobs plugin) { public MythicMobs2(Jobs plugin) {
@ -22,7 +22,7 @@ public class MythicMobs2 implements MythicMobInterface {
@Override @Override
public void registerListener() { public void registerListener() {
Bukkit.getServer().getPluginManager().registerEvents(new MythicMobs2Listener(plugin), plugin); Bukkit.getServer().getPluginManager().registerEvents(new MythicMobs2Listener(), plugin);
} }
@Override @Override
@ -30,10 +30,7 @@ public class MythicMobs2 implements MythicMobInterface {
if (MMAPI == null || lVictim == null) if (MMAPI == null || lVictim == null)
return false; return false;
if (MMAPI.getMobAPI().isMythicMob(lVictim)) return MMAPI.getMobAPI().isMythicMob(lVictim);
return true;
return false;
} }
@Override @Override
@ -59,14 +56,15 @@ public class MythicMobs2 implements MythicMobInterface {
@Override @Override
public String getDisplayName(String id) { public String getDisplayName(String id) {
try { if (MMAPI == null || id == null) {
MythicMob mm = MMAPI.getMobAPI().getMythicMob(id);
if (mm != null)
return mm.getDisplayName();
} catch (InvalidMobTypeException e) {
return ""; return "";
} }
return ""; try {
MythicMob mm = MMAPI.getMobAPI().getMythicMob(id);
return mm != null ? mm.getDisplayName() : "";
} catch (InvalidMobTypeException e) {
return "";
}
} }
} }

View File

@ -1,6 +1,5 @@
package com.gamingmesh.jobs.hooks.MythicMobs; package com.gamingmesh.jobs.hooks.MythicMobs;
import org.bukkit.GameMode;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -11,23 +10,15 @@ import com.gamingmesh.jobs.Jobs;
import com.gamingmesh.jobs.actions.MMKillInfo; import com.gamingmesh.jobs.actions.MMKillInfo;
import com.gamingmesh.jobs.container.ActionType; import com.gamingmesh.jobs.container.ActionType;
import com.gamingmesh.jobs.container.JobsPlayer; 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.API.Bukkit.Events.MythicMobDeathEvent;
import net.elseland.xikage.MythicMobs.Mobs.MythicMob; import net.elseland.xikage.MythicMobs.Mobs.MythicMob;
public class MythicMobs2Listener implements Listener { public class MythicMobs2Listener implements Listener {
private Jobs plugin;
public MythicMobs2Listener(Jobs plugin) {
this.plugin = plugin;
}
@EventHandler @EventHandler
public void OnMythicMobDeath(MythicMobDeathEvent event) { public void OnMythicMobDeath(MythicMobDeathEvent event) {
// make sure plugin is enabled
if (!plugin.isEnabled())
return;
//disabling plugin in world //disabling plugin in world
if (event.getEntity() != null && !Jobs.getGCManager().canPerformActionInWorld(event.getEntity().getWorld())) if (event.getEntity() != null && !Jobs.getGCManager().canPerformActionInWorld(event.getEntity().getWorld()))
return; return;
@ -52,7 +43,7 @@ public class MythicMobs2Listener implements Listener {
return; return;
// check if in creative // check if in creative
if (pDamager.getGameMode().equals(GameMode.CREATIVE) && !pDamager.hasPermission("jobs.paycreative") && !Jobs.getGCManager().payInCreative()) if (!JobsPaymentListener.payIfCreative(pDamager))
return; return;
if (!Jobs.getPermissionHandler().hasWorldPermission(pDamager, pDamager.getLocation().getWorld().getName())) if (!Jobs.getPermissionHandler().hasWorldPermission(pDamager, pDamager.getLocation().getWorld().getName()))

View File

@ -12,7 +12,7 @@ import io.lumine.xikage.mythicmobs.mobs.MythicMob;
public class MythicMobs4 implements MythicMobInterface { public class MythicMobs4 implements MythicMobInterface {
public BukkitAPIHelper MMAPI = null; public BukkitAPIHelper MMAPI;
private Jobs plugin; private Jobs plugin;
public MythicMobs4(Jobs plugin) { public MythicMobs4(Jobs plugin) {
@ -21,7 +21,7 @@ public class MythicMobs4 implements MythicMobInterface {
@Override @Override
public void registerListener() { public void registerListener() {
Bukkit.getServer().getPluginManager().registerEvents(new MythicMobs4Listener(plugin), plugin); Bukkit.getServer().getPluginManager().registerEvents(new MythicMobs4Listener(), plugin);
} }
@Override @Override
@ -29,10 +29,7 @@ public class MythicMobs4 implements MythicMobInterface {
if (MMAPI == null || lVictim == null) if (MMAPI == null || lVictim == null)
return false; return false;
if (MMAPI.isMythicMob(lVictim)) return MMAPI.isMythicMob(lVictim);
return true;
return false;
} }
@Override @Override
@ -61,17 +58,14 @@ public class MythicMobs4 implements MythicMobInterface {
@Override @Override
public String getDisplayName(String id) { public String getDisplayName(String id) {
if (failed) if (failed || MMAPI == null)
return "";
if (MMAPI == null)
return ""; return "";
MythicMob mm = MMAPI.getMythicMob(id); MythicMob mm = MMAPI.getMythicMob(id);
try { try {
if (mm != null) if (mm != null)
return mm.getDisplayName().toString(); return mm.getDisplayName().toString();
} catch (Exception | Error e) { } catch (Throwable e) {
if (!failed) { if (!failed) {
failed = true; failed = true;
Jobs.consoleMsg("&cEncountered error when checking MythicMob entity name. Support for mythicMobs will be suspended for time beying. Please report this issue."); Jobs.consoleMsg("&cEncountered error when checking MythicMob entity name. Support for mythicMobs will be suspended for time beying. Please report this issue.");

View File

@ -1,6 +1,5 @@
package com.gamingmesh.jobs.hooks.MythicMobs; package com.gamingmesh.jobs.hooks.MythicMobs;
import org.bukkit.GameMode;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -11,24 +10,15 @@ import com.gamingmesh.jobs.Jobs;
import com.gamingmesh.jobs.actions.MMKillInfo; import com.gamingmesh.jobs.actions.MMKillInfo;
import com.gamingmesh.jobs.container.ActionType; import com.gamingmesh.jobs.container.ActionType;
import com.gamingmesh.jobs.container.JobsPlayer; 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.api.bukkit.events.MythicMobDeathEvent;
import io.lumine.xikage.mythicmobs.mobs.MythicMob; import io.lumine.xikage.mythicmobs.mobs.MythicMob;
public class MythicMobs4Listener implements Listener { public class MythicMobs4Listener implements Listener {
private Jobs plugin;
public MythicMobs4Listener(Jobs plugin) {
this.plugin = plugin;
}
@EventHandler @EventHandler
public void OnMythicMobDeath(MythicMobDeathEvent event) { public void OnMythicMobDeath(MythicMobDeathEvent event) {
// make sure plugin is enabled
if (!plugin.isEnabled())
return;
//disabling plugin in world //disabling plugin in world
if (event.getEntity() != null && !Jobs.getGCManager().canPerformActionInWorld(event.getEntity().getWorld())) if (event.getEntity() != null && !Jobs.getGCManager().canPerformActionInWorld(event.getEntity().getWorld()))
return; return;
@ -53,7 +43,7 @@ public class MythicMobs4Listener implements Listener {
return; return;
// check if in creative // check if in creative
if (pDamager.getGameMode().equals(GameMode.CREATIVE) && !pDamager.hasPermission("jobs.paycreative") && !Jobs.getGCManager().payInCreative()) if (!JobsPaymentListener.payIfCreative(pDamager))
return; return;
if (!Jobs.getPermissionHandler().hasWorldPermission(pDamager, pDamager.getLocation().getWorld().getName())) if (!Jobs.getPermissionHandler().hasWorldPermission(pDamager, pDamager.getLocation().getWorld().getName()))

View File

@ -196,8 +196,6 @@ public class JobsPaymentListener implements Listener {
return; return;
ItemStack itemInHand = Jobs.getNms().getItemInMainHand(player); ItemStack itemInHand = Jobs.getNms().getItemInMainHand(player);
if (itemInHand == null)
return;
if ((cow.getType() == EntityType.COW && itemInHand.getType() != Material.BUCKET) if ((cow.getType() == EntityType.COW && itemInHand.getType() != Material.BUCKET)
|| (cow.getType() == EntityType.MUSHROOM_COW && itemInHand.getType() != Material.BOWL)) { || (cow.getType() == EntityType.MUSHROOM_COW && itemInHand.getType() != Material.BOWL)) {
@ -277,7 +275,7 @@ public class JobsPaymentListener implements Listener {
// pay // pay
JobsPlayer jDamager = Jobs.getPlayerManager().getJobsPlayer(player); JobsPlayer jDamager = Jobs.getPlayerManager().getJobsPlayer(player);
if (jDamager == null) if (jDamager == null || sheep.getColor() == null)
return; return;
Jobs.action(jDamager, new CustomKillInfo(sheep.getColor().name(), ActionType.SHEAR)); Jobs.action(jDamager, new CustomKillInfo(sheep.getColor().name(), ActionType.SHEAR));
@ -373,7 +371,7 @@ public class JobsPaymentListener implements Listener {
return; return;
ItemStack item = Jobs.getNms().getItemInMainHand(player); ItemStack item = Jobs.getNms().getItemInMainHand(player);
if (item != null && item.getType() != Material.AIR) { if (item.getType() != Material.AIR) {
// Protection for block break with silktouch // Protection for block break with silktouch
if (Jobs.getGCManager().useSilkTouchProtection) { if (Jobs.getGCManager().useSilkTouchProtection) {
for (Enchantment one : item.getEnchantments().keySet()) { for (Enchantment one : item.getEnchantments().keySet()) {
@ -667,7 +665,7 @@ public class JobsPaymentListener implements Listener {
ItemStack currentItem = event.getCurrentItem(); ItemStack currentItem = event.getCurrentItem();
// when we trying to craft tipped arrow effects // 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(); PotionMeta potion = (PotionMeta) currentItem.getItemMeta();
Jobs.action(jPlayer, new PotionItemActionInfo(currentItem, ActionType.CRAFT, potion.getBasePotionData().getType())); Jobs.action(jPlayer, new PotionItemActionInfo(currentItem, ActionType.CRAFT, potion.getBasePotionData().getType()));
} else if (resultStack.hasItemMeta() && resultStack.getItemMeta().hasDisplayName()) { } else if (resultStack.hasItemMeta() && resultStack.getItemMeta().hasDisplayName()) {