mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-26 15:16:45 +01:00
Max plot members, keep if modified, added block data to SetBlockQueue, rgar debug commands
This commit is contained in:
parent
a2480c0458
commit
79564eed08
@ -8,7 +8,7 @@
|
|||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
</properties>
|
</properties>
|
||||||
<artifactId>PlotSquared</artifactId>
|
<artifactId>PlotSquared</artifactId>
|
||||||
<version>2.11.13</version>
|
<version>2.11.14</version>
|
||||||
<name>PlotSquared</name>
|
<name>PlotSquared</name>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
<build>
|
<build>
|
||||||
|
@ -415,10 +415,13 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EconHandler getEconomyHandler() {
|
public EconHandler getEconomyHandler() {
|
||||||
BukkitEconHandler econ = new BukkitEconHandler();
|
try {
|
||||||
if (econ.init()) {
|
BukkitEconHandler econ = new BukkitEconHandler();
|
||||||
return econ;
|
if (econ.init()) {
|
||||||
|
return econ;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
catch (Throwable e) {};
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -832,6 +832,7 @@ public class PlotSquared {
|
|||||||
options.put("clear.on.ban", false);
|
options.put("clear.on.ban", false);
|
||||||
options.put("clear.fastmode", Settings.ENABLE_CLUSTERS);
|
options.put("clear.fastmode", Settings.ENABLE_CLUSTERS);
|
||||||
options.put("clear.auto.clear-interval-seconds", Settings.CLEAR_INTERVAL);
|
options.put("clear.auto.clear-interval-seconds", Settings.CLEAR_INTERVAL);
|
||||||
|
options.put("clear.keep-if-modified", Settings.MIN_BLOCKS_CHANGED);
|
||||||
|
|
||||||
// Schematics
|
// Schematics
|
||||||
options.put("schematics.save_path", Settings.SCHEMATIC_SAVE_PATH);
|
options.put("schematics.save_path", Settings.SCHEMATIC_SAVE_PATH);
|
||||||
@ -908,9 +909,10 @@ public class PlotSquared {
|
|||||||
Settings.FAST_CLEAR = config.getBoolean("clear.fastmode");
|
Settings.FAST_CLEAR = config.getBoolean("clear.fastmode");
|
||||||
Settings.AUTO_CLEAR_DAYS = config.getInt("clear.auto.days");
|
Settings.AUTO_CLEAR_DAYS = config.getInt("clear.auto.days");
|
||||||
Settings.AUTO_CLEAR_CHECK_DISK = config.getBoolean("clear.check-disk");
|
Settings.AUTO_CLEAR_CHECK_DISK = config.getBoolean("clear.check-disk");
|
||||||
|
Settings.DELETE_PLOTS_ON_BAN = config.getBoolean("clear.on.ban");
|
||||||
Settings.AUTO_CLEAR = config.getBoolean("clear.auto.enabled");
|
Settings.AUTO_CLEAR = config.getBoolean("clear.auto.enabled");
|
||||||
|
|
||||||
Settings.CLEAR_INTERVAL = config.getInt("clear.auto.clear-interval-seconds");
|
Settings.CLEAR_INTERVAL = config.getInt("clear.auto.clear-interval-seconds");
|
||||||
|
Settings.MIN_BLOCKS_CHANGED = config.getInt("clear.keep-if-modified");
|
||||||
|
|
||||||
// Schematics
|
// Schematics
|
||||||
Settings.SCHEMATIC_SAVE_PATH = config.getString("schematics.save_path");
|
Settings.SCHEMATIC_SAVE_PATH = config.getString("schematics.save_path");
|
||||||
|
@ -22,6 +22,7 @@ package com.intellectualcrafters.plot.commands;
|
|||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import com.intellectualcrafters.plot.PlotSquared;
|
||||||
import com.intellectualcrafters.plot.config.C;
|
import com.intellectualcrafters.plot.config.C;
|
||||||
import com.intellectualcrafters.plot.database.DBFunc;
|
import com.intellectualcrafters.plot.database.DBFunc;
|
||||||
import com.intellectualcrafters.plot.object.Location;
|
import com.intellectualcrafters.plot.object.Location;
|
||||||
@ -76,6 +77,10 @@ public class Add extends SubCommand {
|
|||||||
DBFunc.removeTrusted(loc.getWorld(), plot, uuid);
|
DBFunc.removeTrusted(loc.getWorld(), plot, uuid);
|
||||||
}
|
}
|
||||||
if (plot.denied.contains(uuid)) {
|
if (plot.denied.contains(uuid)) {
|
||||||
|
if (plot.members.size() + plot.trusted.size() >= PlotSquared.getPlotWorld(plot.world).MAX_PLOT_MEMBERS) {
|
||||||
|
MainUtil.sendMessage(plr, C.PLOT_MAX_MEMBERS);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
plot.denied.remove(uuid);
|
plot.denied.remove(uuid);
|
||||||
DBFunc.removeDenied(loc.getWorld(), plot, uuid);
|
DBFunc.removeDenied(loc.getWorld(), plot, uuid);
|
||||||
}
|
}
|
||||||
@ -86,6 +91,10 @@ public class Add extends SubCommand {
|
|||||||
MainUtil.sendMessage(plr, C.ALREADY_ADDED);
|
MainUtil.sendMessage(plr, C.ALREADY_ADDED);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
if (plot.members.size() + plot.trusted.size() >= PlotSquared.getPlotWorld(plot.world).MAX_PLOT_MEMBERS) {
|
||||||
|
MainUtil.sendMessage(plr, C.PLOT_MAX_MEMBERS);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
MainUtil.sendMessage(plr, C.MEMBER_ADDED);
|
MainUtil.sendMessage(plr, C.MEMBER_ADDED);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -34,11 +34,14 @@ import org.apache.commons.lang.StringUtils;
|
|||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.PlotSquared;
|
import com.intellectualcrafters.plot.PlotSquared;
|
||||||
|
import com.intellectualcrafters.plot.generator.BukkitHybridUtils;
|
||||||
|
import com.intellectualcrafters.plot.generator.HybridUtils;
|
||||||
import com.intellectualcrafters.plot.object.ChunkLoc;
|
import com.intellectualcrafters.plot.object.ChunkLoc;
|
||||||
import com.intellectualcrafters.plot.object.OfflinePlotPlayer;
|
import com.intellectualcrafters.plot.object.OfflinePlotPlayer;
|
||||||
import com.intellectualcrafters.plot.object.Plot;
|
import com.intellectualcrafters.plot.object.Plot;
|
||||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
import com.intellectualcrafters.plot.util.BlockManager;
|
import com.intellectualcrafters.plot.util.BlockManager;
|
||||||
|
import com.intellectualcrafters.plot.util.ChunkManager;
|
||||||
import com.intellectualcrafters.plot.util.ExpireManager;
|
import com.intellectualcrafters.plot.util.ExpireManager;
|
||||||
import com.intellectualcrafters.plot.util.MainUtil;
|
import com.intellectualcrafters.plot.util.MainUtil;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
|
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
|
||||||
@ -63,6 +66,40 @@ public class DebugExec extends SubCommand {
|
|||||||
ExpireManager.task = -1;
|
ExpireManager.task = -1;
|
||||||
return MainUtil.sendMessage(player, "Cancelled task.");
|
return MainUtil.sendMessage(player, "Cancelled task.");
|
||||||
}
|
}
|
||||||
|
case "start-rgar": {
|
||||||
|
if (args.length != 2) {
|
||||||
|
PlotSquared.log("&cInvalid syntax: /plot debugexec start-rgar <world>");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
boolean result;
|
||||||
|
if (BukkitHybridUtils.regions != null) {
|
||||||
|
result = ((BukkitHybridUtils)(HybridUtils.manager)).scheduleRoadUpdate(args[1], BukkitHybridUtils.regions);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
result = HybridUtils.manager.scheduleRoadUpdate(args[1]);
|
||||||
|
}
|
||||||
|
if (!result) {
|
||||||
|
PlotSquared.log("&cCannot schedule mass schematic update! (Is one already in progress?)");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
case "stop-rgar": {
|
||||||
|
if (((BukkitHybridUtils)(HybridUtils.manager)).task == 0) {
|
||||||
|
PlotSquared.log("&cTASK NOT RUNNING!");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
Bukkit.getScheduler().cancelTask(((BukkitHybridUtils)(HybridUtils.manager)).task);
|
||||||
|
PlotSquared.log("&cCancelling task...");
|
||||||
|
while (BukkitHybridUtils.chunks.size() > 0) {
|
||||||
|
ChunkLoc chunk = BukkitHybridUtils.chunks.get(0);
|
||||||
|
BukkitHybridUtils.chunks.remove(0);
|
||||||
|
((BukkitHybridUtils)(HybridUtils.manager)).regenerateRoad(BukkitHybridUtils.world, chunk);
|
||||||
|
ChunkManager.manager.unloadChunk(BukkitHybridUtils.world, chunk);
|
||||||
|
}
|
||||||
|
PlotSquared.log("&cCancelled!");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
case "start-expire": {
|
case "start-expire": {
|
||||||
if (ExpireManager.task == -1) {
|
if (ExpireManager.task == -1) {
|
||||||
ExpireManager.runTask();
|
ExpireManager.runTask();
|
||||||
|
@ -22,6 +22,7 @@ package com.intellectualcrafters.plot.commands;
|
|||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import com.intellectualcrafters.plot.PlotSquared;
|
||||||
import com.intellectualcrafters.plot.config.C;
|
import com.intellectualcrafters.plot.config.C;
|
||||||
import com.intellectualcrafters.plot.database.DBFunc;
|
import com.intellectualcrafters.plot.database.DBFunc;
|
||||||
import com.intellectualcrafters.plot.object.Location;
|
import com.intellectualcrafters.plot.object.Location;
|
||||||
@ -76,6 +77,10 @@ public class Trust extends SubCommand {
|
|||||||
DBFunc.removeMember(loc.getWorld(), plot, uuid);
|
DBFunc.removeMember(loc.getWorld(), plot, uuid);
|
||||||
}
|
}
|
||||||
if (plot.denied.contains(uuid)) {
|
if (plot.denied.contains(uuid)) {
|
||||||
|
if (plot.members.size() + plot.trusted.size() >= PlotSquared.getPlotWorld(plot.world).MAX_PLOT_MEMBERS) {
|
||||||
|
MainUtil.sendMessage(plr, C.PLOT_MAX_MEMBERS);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
plot.denied.remove(uuid);
|
plot.denied.remove(uuid);
|
||||||
DBFunc.removeDenied(loc.getWorld(), plot, uuid);
|
DBFunc.removeDenied(loc.getWorld(), plot, uuid);
|
||||||
}
|
}
|
||||||
@ -86,6 +91,10 @@ public class Trust extends SubCommand {
|
|||||||
MainUtil.sendMessage(plr, C.ALREADY_ADDED);
|
MainUtil.sendMessage(plr, C.ALREADY_ADDED);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
if (plot.members.size() + plot.trusted.size() >= PlotSquared.getPlotWorld(plot.world).MAX_PLOT_MEMBERS) {
|
||||||
|
MainUtil.sendMessage(plr, C.PLOT_MAX_MEMBERS);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
MainUtil.sendMessage(plr, C.TRUSTED_ADDED);
|
MainUtil.sendMessage(plr, C.TRUSTED_ADDED);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -450,6 +450,7 @@ public enum C {
|
|||||||
MEMBER_ADDED("$4That user can now build while the plot owner is online", "Member"),
|
MEMBER_ADDED("$4That user can now build while the plot owner is online", "Member"),
|
||||||
MEMBER_REMOVED("$1You successfully removed a user from the plot", "Member"),
|
MEMBER_REMOVED("$1You successfully removed a user from the plot", "Member"),
|
||||||
MEMBER_WAS_NOT_ADDED("$2That player was not added as a user on this plot", "Member"),
|
MEMBER_WAS_NOT_ADDED("$2That player was not added as a user on this plot", "Member"),
|
||||||
|
PLOT_MAX_MEMBERS("$2You are not allowed to add any more players to this plot", "Member"),
|
||||||
/*
|
/*
|
||||||
* Set Owner
|
* Set Owner
|
||||||
*/
|
*/
|
||||||
|
@ -167,7 +167,7 @@ public class BukkitHybridUtils extends HybridUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static boolean UPDATE = false;
|
private static boolean UPDATE = false;
|
||||||
private int task;
|
public int task;
|
||||||
private long last;
|
private long last;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -180,12 +180,23 @@ public class BukkitHybridUtils extends HybridUtils {
|
|||||||
return scheduleRoadUpdate(world, regions);
|
return scheduleRoadUpdate(world, regions);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean scheduleRoadUpdate(final String world, final List<ChunkLoc> regions) {
|
public static List<ChunkLoc> regions;
|
||||||
final List<ChunkLoc> chunks = new ArrayList<ChunkLoc>();
|
public static List<ChunkLoc> chunks = new ArrayList<>();
|
||||||
|
public static String world;
|
||||||
|
|
||||||
|
public boolean scheduleRoadUpdate(final String world, final List<ChunkLoc> rgs) {
|
||||||
|
BukkitHybridUtils.regions = rgs;
|
||||||
|
BukkitHybridUtils.world = world;
|
||||||
|
chunks = new ArrayList<ChunkLoc>();
|
||||||
final Plugin plugin = BukkitMain.THIS;
|
final Plugin plugin = BukkitMain.THIS;
|
||||||
|
final MutableInt count = new MutableInt(0);
|
||||||
this.task = Bukkit.getScheduler().scheduleSyncRepeatingTask(plugin, new Runnable() {
|
this.task = Bukkit.getScheduler().scheduleSyncRepeatingTask(plugin, new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
count.increment();
|
||||||
|
if (count.intValue() % 20 == 0) {
|
||||||
|
PlotSquared.log("PROGRESS: " + ((100 * (2048 - chunks.size())) / 1024) + "%");
|
||||||
|
}
|
||||||
if (regions.size() == 0 && chunks.size() == 0) {
|
if (regions.size() == 0 && chunks.size() == 0) {
|
||||||
BukkitHybridUtils.UPDATE = false;
|
BukkitHybridUtils.UPDATE = false;
|
||||||
PlotSquared.log(C.PREFIX.s() + "Finished road conversion");
|
PlotSquared.log(C.PREFIX.s() + "Finished road conversion");
|
||||||
@ -205,7 +216,7 @@ public class BukkitHybridUtils extends HybridUtils {
|
|||||||
}
|
}
|
||||||
if (chunks.size() > 0) {
|
if (chunks.size() > 0) {
|
||||||
long diff = System.currentTimeMillis() + 25;
|
long diff = System.currentTimeMillis() + 25;
|
||||||
if (System.currentTimeMillis() - last > 1000 && last != 0) {
|
if (System.currentTimeMillis() - last > 1200 && last != 0) {
|
||||||
last = 0;
|
last = 0;
|
||||||
PlotSquared.log(C.PREFIX.s() + "Detected low TPS. Rescheduling in 30s");
|
PlotSquared.log(C.PREFIX.s() + "Detected low TPS. Rescheduling in 30s");
|
||||||
while (chunks.size() > 0) {
|
while (chunks.size() > 0) {
|
||||||
@ -220,10 +231,10 @@ public class BukkitHybridUtils extends HybridUtils {
|
|||||||
public void run() {
|
public void run() {
|
||||||
scheduleRoadUpdate(world, regions);
|
scheduleRoadUpdate(world, regions);
|
||||||
}
|
}
|
||||||
}, 600);
|
}, 2400);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (System.currentTimeMillis() - last < 50) {
|
if (System.currentTimeMillis() - last < 1000) {
|
||||||
while (System.currentTimeMillis() < diff && chunks.size() > 0) {
|
while (System.currentTimeMillis() < diff && chunks.size() > 0) {
|
||||||
ChunkLoc chunk = chunks.get(0);
|
ChunkLoc chunk = chunks.get(0);
|
||||||
chunks.remove(0);
|
chunks.remove(0);
|
||||||
@ -249,7 +260,7 @@ public class BukkitHybridUtils extends HybridUtils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, 1, 1);
|
}, 20, 20);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1459,10 +1459,10 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
|||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else if (aPlr && FlagManager.isBooleanFlag(plot, "pvp", false)) {
|
} else if (aPlr && FlagManager.isPlotFlagTrue(plot, "pvp")) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!aPlr && FlagManager.isBooleanFlag(plot, "pve", false)) {
|
if (!aPlr && FlagManager.isPlotFlagTrue(plot, "pve")) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
assert plot != null;
|
assert plot != null;
|
||||||
|
@ -59,6 +59,7 @@ public abstract class PlotWorld {
|
|||||||
public final static boolean SPAWN_CUSTOM_DEFAULT = true;
|
public final static boolean SPAWN_CUSTOM_DEFAULT = true;
|
||||||
public final static boolean SPAWN_BREEDING_DEFAULT = false;
|
public final static boolean SPAWN_BREEDING_DEFAULT = false;
|
||||||
public final static boolean WORLD_BORDER_DEFAULT = false;
|
public final static boolean WORLD_BORDER_DEFAULT = false;
|
||||||
|
public final static int MAX_PLOT_MEMBERS_DEFAULT = 128;
|
||||||
// are plot clusters enabled
|
// are plot clusters enabled
|
||||||
// require claim in cluster
|
// require claim in cluster
|
||||||
// TODO make this configurable
|
// TODO make this configurable
|
||||||
@ -68,6 +69,7 @@ public abstract class PlotWorld {
|
|||||||
BLOCKS = new int[] { 1, 2, 3, 4, 5, 7, 14, 15, 16, 17, 19, 21, 22, 23, 24, 25, 35, 41, 42, 43, 45, 47, 48, 49, 52, 56, 57, 58, 61, 62, 73, 74, 80, 82, 84, 86, 87, 88, 91, 97, 98, 99, 100, 103, 110, 112, 120, 121, 123, 124, 125, 129, 133, 153, 155, 159, 162, 165, 166, 168, 170, 172, 173, 174, 179, 181 };
|
BLOCKS = new int[] { 1, 2, 3, 4, 5, 7, 14, 15, 16, 17, 19, 21, 22, 23, 24, 25, 35, 41, 42, 43, 45, 47, 48, 49, 52, 56, 57, 58, 61, 62, 73, 74, 80, 82, 84, 86, 87, 88, 91, 97, 98, 99, 100, 103, 110, 112, 120, 121, 123, 124, 125, 129, 133, 153, 155, 159, 162, 165, 166, 168, 170, 172, 173, 174, 179, 181 };
|
||||||
}
|
}
|
||||||
public final String worldname;
|
public final String worldname;
|
||||||
|
public int MAX_PLOT_MEMBERS;
|
||||||
public boolean AUTO_MERGE;
|
public boolean AUTO_MERGE;
|
||||||
public boolean ALLOW_SIGNS;
|
public boolean ALLOW_SIGNS;
|
||||||
public boolean MOB_SPAWNING;
|
public boolean MOB_SPAWNING;
|
||||||
@ -134,6 +136,7 @@ public abstract class PlotWorld {
|
|||||||
}
|
}
|
||||||
this.MOB_SPAWNING = config.getBoolean("natural_mob_spawning");
|
this.MOB_SPAWNING = config.getBoolean("natural_mob_spawning");
|
||||||
this.AUTO_MERGE = config.getBoolean("plot.auto_merge");
|
this.AUTO_MERGE = config.getBoolean("plot.auto_merge");
|
||||||
|
this.MAX_PLOT_MEMBERS = config.getInt("limits.max-members");
|
||||||
this.ALLOW_SIGNS = config.getBoolean("plot.create_signs");
|
this.ALLOW_SIGNS = config.getBoolean("plot.create_signs");
|
||||||
this.PLOT_BIOME = (String) Configuration.BIOME.parseString(config.getString("plot.biome"));
|
this.PLOT_BIOME = (String) Configuration.BIOME.parseString(config.getString("plot.biome"));
|
||||||
this.SCHEMATIC_ON_CLAIM = config.getBoolean("schematic.on_claim");
|
this.SCHEMATIC_ON_CLAIM = config.getBoolean("schematic.on_claim");
|
||||||
@ -223,7 +226,7 @@ public abstract class PlotWorld {
|
|||||||
options.put("event.spawn.custom", PlotWorld.SPAWN_CUSTOM_DEFAULT);
|
options.put("event.spawn.custom", PlotWorld.SPAWN_CUSTOM_DEFAULT);
|
||||||
options.put("event.spawn.breeding", PlotWorld.SPAWN_BREEDING_DEFAULT);
|
options.put("event.spawn.breeding", PlotWorld.SPAWN_BREEDING_DEFAULT);
|
||||||
options.put("world.border", PlotWorld.WORLD_BORDER_DEFAULT);
|
options.put("world.border", PlotWorld.WORLD_BORDER_DEFAULT);
|
||||||
|
options.put("limits.max-members", PlotWorld.MAX_PLOT_MEMBERS_DEFAULT);
|
||||||
options.put("home.default", "side");
|
options.put("home.default", "side");
|
||||||
options.put("home.allow-nonmembers", false);
|
options.put("home.allow-nonmembers", false);
|
||||||
|
|
||||||
|
@ -18,12 +18,16 @@ import com.intellectualcrafters.plot.config.Settings;
|
|||||||
import com.intellectualcrafters.plot.database.DBFunc;
|
import com.intellectualcrafters.plot.database.DBFunc;
|
||||||
import com.intellectualcrafters.plot.flag.Flag;
|
import com.intellectualcrafters.plot.flag.Flag;
|
||||||
import com.intellectualcrafters.plot.flag.FlagManager;
|
import com.intellectualcrafters.plot.flag.FlagManager;
|
||||||
|
import com.intellectualcrafters.plot.generator.ClassicPlotManager;
|
||||||
|
import com.intellectualcrafters.plot.generator.HybridPlotManager;
|
||||||
|
import com.intellectualcrafters.plot.generator.HybridUtils;
|
||||||
import com.intellectualcrafters.plot.object.OfflinePlotPlayer;
|
import com.intellectualcrafters.plot.object.OfflinePlotPlayer;
|
||||||
import com.intellectualcrafters.plot.object.Plot;
|
import com.intellectualcrafters.plot.object.Plot;
|
||||||
import com.intellectualcrafters.plot.object.PlotHandler;
|
import com.intellectualcrafters.plot.object.PlotHandler;
|
||||||
import com.intellectualcrafters.plot.object.PlotManager;
|
import com.intellectualcrafters.plot.object.PlotManager;
|
||||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
import com.intellectualcrafters.plot.object.PlotWorld;
|
import com.intellectualcrafters.plot.object.PlotWorld;
|
||||||
|
import com.intellectualcrafters.plot.object.RunnableVal;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
|
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
|
||||||
|
|
||||||
public class ExpireManager {
|
public class ExpireManager {
|
||||||
@ -47,35 +51,6 @@ public class ExpireManager {
|
|||||||
final long now = System.currentTimeMillis();
|
final long now = System.currentTimeMillis();
|
||||||
if (now > getTimeStamp(world)) {
|
if (now > getTimeStamp(world)) {
|
||||||
timestamp.put(world, now + 86400000l);
|
timestamp.put(world, now + 86400000l);
|
||||||
|
|
||||||
|
|
||||||
// TaskManager.index.increment();
|
|
||||||
// final ArrayList<Plot> plots = new ArrayList<>(PlotSquared.getPlots(world).values());
|
|
||||||
// int value = TaskManager.index.intValue();
|
|
||||||
// int id = TaskManager.runTaskRepeat(new Runnable() {
|
|
||||||
// @Override
|
|
||||||
// public void run() {
|
|
||||||
// long start = System.currentTimeMillis();
|
|
||||||
// while (System.currentTimeMillis() - start < 15) {
|
|
||||||
// Plot plot = plots.remove(0);
|
|
||||||
// final Flag keepFlag = FlagManager.getPlotFlag(plot, "keep");
|
|
||||||
// if (keepFlag != null && (Boolean) keepFlag.getValue()) {
|
|
||||||
// continue;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// final HashMap<Plot, Long> toRemove = new HashMap<>();
|
|
||||||
// final HashMap<UUID, Long> remove = new HashMap<>();
|
|
||||||
// final Set<UUID> keep = new HashSet<>();
|
|
||||||
// Iterator<Plot> iter = plots.iterator();
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }, 1);
|
|
||||||
//
|
|
||||||
// TaskManager.tasks.put(value, id);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
TaskManager.runTaskAsync(new Runnable() {
|
TaskManager.runTaskAsync(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
@ -147,18 +122,39 @@ public class ExpireManager {
|
|||||||
MainUtil.unlinkPlot(plot);
|
MainUtil.unlinkPlot(plot);
|
||||||
}
|
}
|
||||||
final PlotWorld plotworld = PlotSquared.getPlotWorld(world);
|
final PlotWorld plotworld = PlotSquared.getPlotWorld(world);
|
||||||
manager.clearPlot(plotworld, plot, false, null);
|
RunnableVal run = new RunnableVal() {
|
||||||
MainUtil.removeSign(plot);
|
@Override
|
||||||
DBFunc.delete(world, plot);
|
public void run() {
|
||||||
PlotSquared.removePlot(world, plot.id, false);
|
int changed = (int) this.value;
|
||||||
expiredPlots.get(world).remove(plot);
|
if (changed >= Settings.MIN_BLOCKS_CHANGED) {
|
||||||
PlotSquared.log("&cDeleted expired plot: " + plot.id);
|
PlotSquared.log("&aKeep flag added to: " + plot.id + (changed != -1 ? " (changed " + value + ")" : ""));
|
||||||
PlotSquared.log("&3 - World: " + plot.world);
|
FlagManager.addPlotFlag(plot, new Flag(FlagManager.getFlag("keep"), true));
|
||||||
if (plot.hasOwner()) {
|
expiredPlots.get(world).remove(plot);
|
||||||
PlotSquared.log("&3 - Owner: " + UUIDHandler.getName(plot.owner));
|
return;
|
||||||
} else {
|
}
|
||||||
PlotSquared.log("&3 - Owner: Unowned");
|
manager.clearPlot(plotworld, plot, false, null);
|
||||||
|
MainUtil.removeSign(plot);
|
||||||
|
DBFunc.delete(world, plot);
|
||||||
|
PlotSquared.removePlot(world, plot.id, false);
|
||||||
|
expiredPlots.get(world).remove(plot);
|
||||||
|
PlotSquared.log("&cDeleted expired plot: " + plot.id + (changed != -1 ? " (changed " + value + ")" : ""));
|
||||||
|
PlotSquared.log("&3 - World: " + plot.world);
|
||||||
|
if (plot.hasOwner()) {
|
||||||
|
PlotSquared.log("&3 - Owner: " + UUIDHandler.getName(plot.owner));
|
||||||
|
} else {
|
||||||
|
PlotSquared.log("&3 - Owner: Unowned");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
if (Settings.MIN_BLOCKS_CHANGED > 0 && manager instanceof ClassicPlotManager) {
|
||||||
|
HybridUtils.manager.checkModified(plot, run);
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
run.value = -1;
|
||||||
|
run.run();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -773,7 +773,7 @@ public class MainUtil {
|
|||||||
final Runnable run = new Runnable() {
|
final Runnable run = new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
MainUtil.setBiome(world, plot, "FOREST");
|
// MainUtil.setBiome(world, plot, "FOREST");
|
||||||
runners.remove(plot);
|
runners.remove(plot);
|
||||||
TaskManager.runTask(whenDone);
|
TaskManager.runTask(whenDone);
|
||||||
}
|
}
|
||||||
|
@ -159,6 +159,29 @@ public class SetBlockQueue {
|
|||||||
private static int lastInt = 0;
|
private static int lastInt = 0;
|
||||||
private static PlotBlock lastBlock = new PlotBlock((short) 0, (byte) 0);
|
private static PlotBlock lastBlock = new PlotBlock((short) 0, (byte) 0);
|
||||||
|
|
||||||
|
public static void setData(final String world, int x, final int y, int z, final byte data) {
|
||||||
|
locked = true;
|
||||||
|
if (!running) {
|
||||||
|
init();
|
||||||
|
}
|
||||||
|
int X = x >> 4;
|
||||||
|
int Z = z >> 4;
|
||||||
|
x -= X << 4;
|
||||||
|
z -= Z << 4;
|
||||||
|
ChunkWrapper wrap = new ChunkWrapper(world, X, Z);
|
||||||
|
PlotBlock[][] result;
|
||||||
|
result = blocks.get(wrap);
|
||||||
|
if (!blocks.containsKey(wrap)) {
|
||||||
|
result = new PlotBlock[16][];
|
||||||
|
blocks.put(wrap, result);
|
||||||
|
}
|
||||||
|
if (result[y >> 4] == null) {
|
||||||
|
result[y >> 4] = new PlotBlock[4096];
|
||||||
|
}
|
||||||
|
result[y >> 4][((y & 0xF) << 8) | (z << 4) | x] = new PlotBlock((short) -1, data);
|
||||||
|
locked = false;
|
||||||
|
}
|
||||||
|
|
||||||
public static void setBlock(final String world, int x, final int y, int z, final int id) {
|
public static void setBlock(final String world, int x, final int y, int z, final int id) {
|
||||||
locked = true;
|
locked = true;
|
||||||
if (!running) {
|
if (!running) {
|
||||||
|
@ -26,6 +26,7 @@ import java.util.Collection;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
import org.bukkit.Chunk;
|
import org.bukkit.Chunk;
|
||||||
|
import org.bukkit.block.Block;
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.object.ChunkLoc;
|
import com.intellectualcrafters.plot.object.ChunkLoc;
|
||||||
import com.intellectualcrafters.plot.util.MainUtil;
|
import com.intellectualcrafters.plot.util.MainUtil;
|
||||||
@ -86,7 +87,10 @@ public class SetBlockFast extends BukkitSetBlockManager {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void set(final org.bukkit.World world, final int x, final int y, final int z, final int blockId, final byte data) {
|
public void set(final org.bukkit.World world, final int x, final int y, final int z, final int blockId, final byte data) {
|
||||||
|
if (blockId == -1) {
|
||||||
|
world.getBlockAt(x, y, z).setData(data, false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
int X = x >> 4;
|
int X = x >> 4;
|
||||||
int Z = z >> 4;
|
int Z = z >> 4;
|
||||||
ChunkLoc loc = new ChunkLoc(X, Z);
|
ChunkLoc loc = new ChunkLoc(X, Z);
|
||||||
|
@ -22,8 +22,11 @@ package com.intellectualcrafters.plot.util.bukkit;
|
|||||||
|
|
||||||
import static com.intellectualcrafters.plot.util.ReflectionUtils.getRefClass;
|
import static com.intellectualcrafters.plot.util.ReflectionUtils.getRefClass;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
import org.bukkit.Chunk;
|
import org.bukkit.Chunk;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
@ -71,9 +74,18 @@ public class SetBlockFast_1_8 extends BukkitSetBlockManager {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
// TODO Auto-generated method stub
|
int count = 0;
|
||||||
update(toUpdate.values());
|
ArrayList<Chunk> chunks = new ArrayList<Chunk>();
|
||||||
toUpdate = new HashMap<>();
|
Iterator<Entry<ChunkLoc, Chunk>> i = toUpdate.entrySet().iterator();
|
||||||
|
while (i.hasNext() && count < 1024) {
|
||||||
|
chunks.add(i.next().getValue());
|
||||||
|
i.remove();
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
if (count == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
update(chunks);
|
||||||
}
|
}
|
||||||
}, 20);
|
}, 20);
|
||||||
}
|
}
|
||||||
@ -93,7 +105,10 @@ public class SetBlockFast_1_8 extends BukkitSetBlockManager {
|
|||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
@Override
|
@Override
|
||||||
public void set(final World world, final int x, final int y, final int z, final int id, final byte data) {
|
public void set(final World world, final int x, final int y, final int z, final int id, final byte data) {
|
||||||
|
if (id == -1) {
|
||||||
|
world.getBlockAt(x, y, z).setData(data, false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
// Start blockstate workaround //
|
// Start blockstate workaround //
|
||||||
switch (id) {
|
switch (id) {
|
||||||
case 54:
|
case 54:
|
||||||
|
@ -12,6 +12,10 @@ public class SetBlockSlow extends BukkitSetBlockManager {
|
|||||||
@Override
|
@Override
|
||||||
public void set(final World world, final int x, final int y, final int z, final int id, final byte data) {
|
public void set(final World world, final int x, final int y, final int z, final int id, final byte data) {
|
||||||
final Block block = world.getBlockAt(x, y, z);
|
final Block block = world.getBlockAt(x, y, z);
|
||||||
|
if (id == -1) {
|
||||||
|
block.setData(data, false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (block.getData() == data) {
|
if (block.getData() == data) {
|
||||||
if (block.getTypeId() != id) {
|
if (block.getTypeId() != id) {
|
||||||
block.setTypeId(id, false);
|
block.setTypeId(id, false);
|
||||||
|
Loading…
Reference in New Issue
Block a user