1
0
mirror of https://github.com/Zrips/Jobs.git synced 2024-12-01 15:03:36 +01:00

Call BlockBreakEvent in any way when cancelled or not

Fixes #1194
This commit is contained in:
montlikadani 2021-05-26 21:45:22 +02:00
parent 417738f2e3
commit 8d65bb7b7e
6 changed files with 38 additions and 28 deletions

View File

@ -1306,8 +1306,8 @@ public class Jobs extends JavaPlugin {
}
if ((time > System.currentTimeMillis() || bp.isPaid()) && bp.getAction() != DBAction.DELETE) {
int sec = Math.round((time - System.currentTimeMillis()) / 1000L);
if (inform && player.canGetPaid(info)) {
int sec = Math.round((time - System.currentTimeMillis()) / 1000L);
ActionBarManager.send(player.getPlayer(), lManager.getMessage("message.blocktimer", "[time]", sec));
}
@ -1335,8 +1335,8 @@ public class Jobs extends JavaPlugin {
}
if ((time > System.currentTimeMillis() || bp.isPaid()) && bp.getAction() != DBAction.DELETE) {
int sec = Math.round((time - System.currentTimeMillis()) / 1000L);
if (inform && player.canGetPaid(info)) {
int sec = Math.round((time - System.currentTimeMillis()) / 1000L);
ActionBarManager.send(player.getPlayer(), lManager.getMessage("message.blocktimer", "[time]", sec));
}

View File

@ -1493,20 +1493,29 @@ public class ConfigManager {
double income = 0D;
if (sep.length >= 2) {
try {
income = Double.parseDouble(sep[1]);
income = updateValue(CurrencyType.MONEY, income);
} catch (NumberFormatException e) {
}
}
double points = 0D;
if (sep.length >= 3) {
try {
points = Double.parseDouble(sep[2]);
points = updateValue(CurrencyType.POINTS, points);
} catch (NumberFormatException e) {
}
}
double experience = 0D;
if (sep.length >= 4) {
try {
experience = Double.parseDouble(sep[3]);
experience = updateValue(CurrencyType.EXP, experience);
} catch (NumberFormatException e) {
}
}
jobInfo.add(new JobInfo(actionType, id, meta, type + subType, income, incomeEquation, experience, expEquation, pointsEquation, points, 1,

View File

@ -67,8 +67,9 @@ public class RestrictedBlockManager {
}
}
if (restrictedBlocksTimer.size() > 0)
Jobs.consoleMsg("&e[Jobs] Loaded " + restrictedBlocksTimer.size() + " protected blocks timers!");
int size = restrictedBlocksTimer.size();
if (size > 0)
Jobs.consoleMsg("&e[Jobs] Loaded " + size + " protected blocks timers!");
cfg.save();
}

View File

@ -65,7 +65,7 @@ public class BlockProtection {
}
public boolean isPaid() {
return paid == null ? true : paid.booleanValue();
return paid == null || paid.booleanValue();
}
public void setPaid(boolean paid) {

View File

@ -48,7 +48,7 @@ public final class JobsPayment14Listener implements Listener {
if (camps.isEmpty()) {
campPlayers.remove(map.getKey());
} else {
campPlayers.replace(map.getKey(), camps);
campPlayers.put(map.getKey(), camps);
}
}
@ -65,8 +65,9 @@ public final class JobsPayment14Listener implements Listener {
return;
List<PlayerCamp> camps = campPlayers.get(event.getPlayer().getUniqueId());
if (camps == null)
return;
if (camps != null) {
if (camps.isEmpty()) {
campPlayers.remove(event.getPlayer().getUniqueId());
return;
@ -79,14 +80,13 @@ public final class JobsPayment14Listener implements Listener {
if (camps.isEmpty()) {
campPlayers.remove(event.getPlayer().getUniqueId());
} else {
campPlayers.replace(event.getPlayer().getUniqueId(), camps);
campPlayers.put(event.getPlayer().getUniqueId(), camps);
}
break;
}
}
}
}
@EventHandler(priority = EventPriority.LOWEST)
public void onCampPlace(PlayerInteractEvent ev) {

View File

@ -362,7 +362,7 @@ public class JobsPaymentListener implements Listener {
Jobs.action(jPlayer, new ItemActionInfo(contents, ActionType.BREW));
}
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
@EventHandler(priority = EventPriority.MONITOR)
public void onBlockBreak(BlockBreakEvent event) {
final Block block = event.getBlock();