diff --git a/pom.xml b/pom.xml index e112677f..0d7781d0 100644 --- a/pom.xml +++ b/pom.xml @@ -79,7 +79,7 @@ com.sk89q.worldguard worldguard-bukkit - 7.0.1-SNAPSHOT + 7.0.2-SNAPSHOT bukkit @@ -107,21 +107,6 @@ - - com.sk89q.worldedit - worldedit-core - 7.1.0-SNAPSHOT - - - bukkit - org.bukkit - - - bukkit-classloader-check - org.sk89q.bukkit - - - me.clip placeholderapi diff --git a/src/main/java/com/gamingmesh/jobs/dao/JobsDAO.java b/src/main/java/com/gamingmesh/jobs/dao/JobsDAO.java index 8a7c0e57..6a0facad 100644 --- a/src/main/java/com/gamingmesh/jobs/dao/JobsDAO.java +++ b/src/main/java/com/gamingmesh/jobs/dao/JobsDAO.java @@ -1635,11 +1635,14 @@ public abstract class JobsDAO { */ public List getGlobalTopList(int start) { JobsConnection conn = getConnection(); - List names = new ArrayList<>(); - if (conn == null) return names; + + if (start < 0) { + start = 0; + } + PreparedStatement prest = null; ResultSet res = null; try { @@ -1653,10 +1656,10 @@ public abstract class JobsDAO { PlayerInfo info = Jobs.getPlayerManager().getPlayerInfo(res.getInt(JobsTableFields.userid.getCollumn())); if (info == null) continue; - if (info.getName() == null) - continue; + TopList top = new TopList(info, res.getInt("totallvl"), 0); names.add(top); + if (names.size() >= Jobs.getGCManager().JobsTopAmount) break; } @@ -1666,6 +1669,7 @@ public abstract class JobsDAO { close(res); close(prest); } + return names; } @@ -1681,6 +1685,10 @@ public abstract class JobsDAO { if (conn == null) return names; + if (start < 0) { + start = 0; + } + PreparedStatement prest = null; ResultSet res = null; try { diff --git a/src/main/java/com/gamingmesh/jobs/listeners/JobsPaymentListener.java b/src/main/java/com/gamingmesh/jobs/listeners/JobsPaymentListener.java index aeda506e..98483356 100644 --- a/src/main/java/com/gamingmesh/jobs/listeners/JobsPaymentListener.java +++ b/src/main/java/com/gamingmesh/jobs/listeners/JobsPaymentListener.java @@ -297,9 +297,6 @@ public class JobsPaymentListener implements Listener { if (block == null || !Jobs.getGCManager().canPerformActionInWorld(block.getWorld())) return; - if (!Jobs.getGCManager().isBrewingStandsReassign()) - return; - if (!block.hasMetadata(brewingOwnerMetadata)) return; @@ -1004,9 +1001,6 @@ public class JobsPaymentListener implements Listener { if (block == null || !Jobs.getGCManager().canPerformActionInWorld(block.getWorld())) return; - if (!Jobs.getGCManager().isFurnacesReassign()) - return; - if (!block.hasMetadata(furnaceOwnerMetadata)) return; @@ -1593,10 +1587,6 @@ public class JobsPaymentListener implements Listener { return; Player p = event.getPlayer(); - if (p == null) { - return; - } - if (!Jobs.getGCManager().canPerformActionInWorld(p.getWorld())) return; @@ -1641,17 +1631,17 @@ public class JobsPaymentListener implements Listener { } } - if (cmat.equals(CMIMaterial.FURNACE) || cmat.equals(CMIMaterial.LEGACY_BURNING_FURNACE) || cmat.equals(CMIMaterial.SMOKER) || cmat.equals(CMIMaterial.BLAST_FURNACE)) { - if (!Jobs.getGCManager().isFurnacesReassign()) - return; - + if (cmat.equals(CMIMaterial.FURNACE) || cmat.equals(CMIMaterial.LEGACY_BURNING_FURNACE) + || cmat.equals(CMIMaterial.SMOKER) || cmat.equals(CMIMaterial.BLAST_FURNACE)) { ownershipFeedback done = FurnaceBrewingHandling.registerFurnaces(p, block); if (done.equals(ownershipFeedback.tooMany)) { boolean report = false; + if (block.hasMetadata(furnaceOwnerMetadata)) { List data = block.getMetadata(furnaceOwnerMetadata); if (data.isEmpty()) return; + // only care about first MetadataValue value = data.get(0); String uuid = value.asString(); @@ -1669,16 +1659,15 @@ public class JobsPaymentListener implements Listener { "[max]", jPlayer.getMaxFurnacesAllowed() == 0 ? "-" : jPlayer.getMaxFurnacesAllowed())); } } else if (cmat.equals(CMIMaterial.BREWING_STAND) || cmat.equals(CMIMaterial.LEGACY_BREWING_STAND)) { - if (!Jobs.getGCManager().isBrewingStandsReassign()) - return; - ownershipFeedback done = FurnaceBrewingHandling.registerBrewingStand(p, block); if (done.equals(ownershipFeedback.tooMany)) { boolean report = false; + if (block.hasMetadata(brewingOwnerMetadata)) { List data = block.getMetadata(brewingOwnerMetadata); if (data.isEmpty()) return; + // only care about first MetadataValue value = data.get(0); String uuid = value.asString(); @@ -1717,7 +1706,6 @@ public class JobsPaymentListener implements Listener { Block b = loc.getBlock(); if (b.getType().toString().startsWith("STRIPPED_") && jPlayer != null) Jobs.action(jPlayer, new BlockActionInfo(b, ActionType.STRIPLOGS), b); - return; } }, 1); } diff --git a/src/main/java/com/gamingmesh/jobs/stuff/FurnaceBrewingHandling.java b/src/main/java/com/gamingmesh/jobs/stuff/FurnaceBrewingHandling.java index fe381b53..29cee853 100644 --- a/src/main/java/com/gamingmesh/jobs/stuff/FurnaceBrewingHandling.java +++ b/src/main/java/com/gamingmesh/jobs/stuff/FurnaceBrewingHandling.java @@ -247,9 +247,7 @@ public class FurnaceBrewingHandling { return ownershipFeedback.invalid; JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(player); - int max = jPlayer.getMaxFurnacesAllowed(); - int have = jPlayer.getFurnaceCount(); boolean owner = false; @@ -277,24 +275,25 @@ public class FurnaceBrewingHandling { block.setMetadata(JobsPaymentListener.furnaceOwnerMetadata, new FixedMetadataValue(Jobs.getInstance(), player.getUniqueId().toString())); + if (!Jobs.getGCManager().isFurnacesReassign()) { + return ownershipFeedback.newReg; + } + List ls = furnaceMap.get(player.getUniqueId()); if (ls == null) ls = new ArrayList(); + ls.add(new blockLoc(block.getLocation())); furnaceMap.put(player.getUniqueId(), ls); - return ownershipFeedback.newReg; } public static ownershipFeedback registerBrewingStand(Player player, Block block) { - if (!CMIMaterial.get(block).equals(CMIMaterial.BREWING_STAND) && !CMIMaterial.get(block).equals(CMIMaterial.LEGACY_BREWING_STAND)) return ownershipFeedback.invalid; JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(player); - int max = jPlayer.getMaxBrewingStandsAllowed(); - int have = jPlayer.getBrewingStandCount(); boolean owner = false; @@ -313,6 +312,7 @@ public class FurnaceBrewingHandling { return ownershipFeedback.notOwn; } } + if (owner) return ownershipFeedback.old; @@ -321,12 +321,16 @@ public class FurnaceBrewingHandling { block.setMetadata(JobsPaymentListener.brewingOwnerMetadata, new FixedMetadataValue(Jobs.getInstance(), player.getUniqueId().toString())); + if (!Jobs.getGCManager().isBrewingStandsReassign()) { + return ownershipFeedback.newReg; + } + List ls = brewingMap.get(player.getUniqueId()); if (ls == null) ls = new ArrayList(); + ls.add(new blockLoc(block.getLocation())); brewingMap.put(player.getUniqueId(), ls); - return ownershipFeedback.newReg; } @@ -334,15 +338,19 @@ public class FurnaceBrewingHandling { List ls = furnaceMap.remove(uuid); if (ls == null) return 0; + for (blockLoc one : ls) { Block block = one.getBlock(); if (block == null) continue; + CMIMaterial cmat = CMIMaterial.get(block); if (!cmat.equals(CMIMaterial.FURNACE) && !cmat.equals(CMIMaterial.LEGACY_BURNING_FURNACE) && !cmat.equals(CMIMaterial.SMOKER) && !cmat.equals(CMIMaterial.BLAST_FURNACE)) continue; + block.removeMetadata(JobsPaymentListener.furnaceOwnerMetadata, Jobs.getInstance()); } + return ls.size(); }