mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 21:26:45 +01:00
fixes
This commit is contained in:
parent
c306ae32cc
commit
94de00f278
@ -74,8 +74,9 @@ public class DebugExec extends SubCommand {
|
||||
if (world == null) {
|
||||
return PlayerFunctions.sendMessage(null, "Invalid world: "+args[1]);
|
||||
}
|
||||
PlayerFunctions.sendMessage(null, "Updating expired plot list");
|
||||
ExpireManager.updateExpired(args[1]);
|
||||
return PlayerFunctions.sendMessage(null, "Updating expired plot list");
|
||||
return true;
|
||||
}
|
||||
return PlayerFunctions.sendMessage(null, "Use /plot debugexec update-expired <world>");
|
||||
case "show-expired":
|
||||
|
@ -165,15 +165,13 @@ public class Trim extends SubCommand {
|
||||
}
|
||||
}
|
||||
final Set<Plot> plots = ExpireManager.getOldPlots(world.getName()).keySet();
|
||||
int count2 = 0;
|
||||
Trim.TASK_ID = Bukkit.getScheduler().scheduleSyncRepeatingTask(PlotMain.getMain(), new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (manager != null && plots.size() > 0) {
|
||||
Plot plot = plots.iterator().next();
|
||||
boolean modified = false;
|
||||
if (plot.hasOwner()) {
|
||||
modified = HybridPlotManager.checkModified(plot, 0);
|
||||
HybridPlotManager.checkModified(plot, 0);
|
||||
}
|
||||
if (plot.owner == null || !HybridPlotManager.checkModified(plot, plotworld.REQUIRED_CHANGES)) {
|
||||
PlotMain.removePlot(worldname, plot.id, true);
|
||||
|
@ -118,7 +118,6 @@ public class HybridPop extends BlockPopulator {
|
||||
|
||||
@Override
|
||||
public void populate(final World w, final Random r, final Chunk c) {
|
||||
// initializing with bedrock pre-made
|
||||
int cx = c.getX(), cz = c.getZ();
|
||||
|
||||
if (doState) {
|
||||
|
@ -882,7 +882,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
||||
final Player p = (Player) d;
|
||||
final boolean aPlr = a instanceof Player;
|
||||
final PlotWorld pW = getPlotWorld(l.getWorld());
|
||||
if (!aPlr && pW.PVE && (!(a instanceof ItemFrame))) {
|
||||
if (!aPlr && pW.PVE && (!(a instanceof ItemFrame) && !(a.getEntityId() == 416) ) ) {
|
||||
return;
|
||||
} else if (aPlr && pW.PVP) {
|
||||
return;
|
||||
|
@ -1,7 +1,6 @@
|
||||
package com.intellectualcrafters.plot.util;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
@ -24,28 +23,40 @@ import com.intellectualcrafters.plot.object.PlotManager;
|
||||
|
||||
public class ExpireManager {
|
||||
|
||||
private static long timestamp = 0;
|
||||
public static ConcurrentHashMap<String, HashMap<Plot, Long>> expiredPlots = new ConcurrentHashMap<>();
|
||||
public static ConcurrentHashMap<String, Boolean> updatingPlots = new ConcurrentHashMap<>();
|
||||
public static ConcurrentHashMap<String, Long> timestamp = new ConcurrentHashMap<>();
|
||||
public static int task;
|
||||
|
||||
public static void updateExpired(final String world) {
|
||||
public static long getTimeStamp(final String world) {
|
||||
if (timestamp.containsKey(world)) {
|
||||
return timestamp.get(world);
|
||||
}
|
||||
else {
|
||||
timestamp.put(world, 0l);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean updateExpired(final String world) {
|
||||
updatingPlots.put(world, true);
|
||||
long now = System.currentTimeMillis();
|
||||
if (now > timestamp) {
|
||||
timestamp = now + 86400000;
|
||||
if (now > getTimeStamp(world)) {
|
||||
timestamp.put(world, now + 86400000l);
|
||||
TaskManager.runTask(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
HashMap<Plot, Long> plots = getOldPlots(world);
|
||||
PlotMain.sendConsoleSenderMessage("&cFound " + plots.size() + " expired plots!");
|
||||
PlotMain.sendConsoleSenderMessage("&cFound " + plots.size() + " expired plots for " + world + "!");
|
||||
expiredPlots.put(world, plots);
|
||||
updatingPlots.put(world, false);
|
||||
}
|
||||
});
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
updatingPlots.put(world, false);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@ -67,8 +78,10 @@ public class ExpireManager {
|
||||
}
|
||||
Set<Plot> plots = expiredPlots.get(world).keySet();
|
||||
if (plots == null || plots.size() == 0) {
|
||||
updateExpired(world);
|
||||
return;
|
||||
if (updateExpired(world)) {
|
||||
return;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
Plot plot = plots.iterator().next();
|
||||
if (plot.owner != null) {
|
||||
@ -87,14 +100,12 @@ public class ExpireManager {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
for (UUID helper : plot.helpers) {
|
||||
Player player = UUIDHandler.uuidWrapper.getPlayer(helper);
|
||||
if (player != null) {
|
||||
PlayerFunctions.sendMessage(player, C.PLOT_REMOVED_HELPER, plot.id.toString());
|
||||
}
|
||||
}
|
||||
|
||||
final World worldobj = Bukkit.getWorld(world);
|
||||
final PlotManager manager = PlotMain.getPlotManager(world);
|
||||
manager.clearPlot(worldobj, plot, false);
|
||||
@ -112,7 +123,6 @@ public class ExpireManager {
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
}, 2400, 2400);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user