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

Fix for TNTBreak action not works when entity type is not ender crystal

Fixes #912
This commit is contained in:
montlikadani 2020-09-05 12:11:26 +02:00
parent e52e954843
commit 08e4893e81
3 changed files with 13 additions and 14 deletions

View File

@ -363,9 +363,6 @@ public class editjobs implements Cmd {
meta = keyValue.getMeta();
int id = keyValue.getId();
if (actionT == ActionType.TNTBREAK)
Jobs.getGCManager().setTntFinder(true);
double income = 0D,
points = 0D,
experience = 0D;

View File

@ -627,6 +627,9 @@ public class ConfigManager {
type = CMIMaterial.getGeneralMaterialName(type);
}
if (actionType == ActionType.TNTBREAK)
Jobs.getGCManager().setTntFinder(true);
KeyValues kv = new KeyValues();
kv.setId(id);
kv.setMeta(meta);
@ -1210,9 +1213,6 @@ public class ConfigManager {
subType = keyValue.getSubType(),
meta = keyValue.getMeta();
if (actionType == ActionType.TNTBREAK)
Jobs.getGCManager().setTntFinder(true);
double income = section.getDouble("income", 0.0);
income = updateValue(CurrencyType.MONEY, income);
double points = section.getDouble("points", 0.0);

View File

@ -1509,7 +1509,7 @@ public class JobsPaymentListener implements Listener {
if (type != EntityType.PRIMED_TNT && type != EntityType.MINECART_TNT && type != CMIEntityType.ENDER_CRYSTAL.getType())
return;
if (!Jobs.getGCManager().isUseTntFinder() || type != CMIEntityType.ENDER_CRYSTAL.getType())
if (!Jobs.getGCManager().isUseTntFinder() && type != CMIEntityType.ENDER_CRYSTAL.getType())
return;
double closest = 60.0;
@ -1541,13 +1541,15 @@ public class JobsPaymentListener implements Listener {
if (jPlayer == null)
return;
String meta = "enderCrystalDamage";
if (type == CMIEntityType.ENDER_CRYSTAL.getType() && e.hasMetadata(meta) && !e.getMetadata(meta).isEmpty()) {
Entity killed = (Entity) e.getMetadata(meta).get(0).value();
if (killed != null) {
Jobs.action(jPlayer, new EntityActionInfo(killed, ActionType.KILL));
killed.removeMetadata(meta, plugin);
return;
if (!Jobs.getGCManager().isUseTntFinder() && type == CMIEntityType.ENDER_CRYSTAL.getType()) {
String meta = "enderCrystalDamage";
if (type == CMIEntityType.ENDER_CRYSTAL.getType() && e.hasMetadata(meta) && !e.getMetadata(meta).isEmpty()) {
Entity killed = (Entity) e.getMetadata(meta).get(0).value();
if (killed != null) {
Jobs.action(jPlayer, new EntityActionInfo(killed, ActionType.KILL));
killed.removeMetadata(meta, plugin);
return;
}
}
}