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