mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-24 12:16:44 +01:00
Merge remote-tracking branch 'origin/master'
# Conflicts: # src/main/java/com/intellectualcrafters/plot/commands/Condense.java # src/main/java/com/intellectualcrafters/plot/commands/Deny.java # src/main/java/com/intellectualcrafters/plot/commands/Save.java # src/main/java/com/intellectualcrafters/plot/commands/list.java # src/main/java/com/intellectualcrafters/plot/database/SQLManager.java
This commit is contained in:
commit
03aec43f5d
1
.gitignore
vendored
1
.gitignore
vendored
@ -127,3 +127,4 @@ local.properties
|
|||||||
|
|
||||||
# STS (Spring Tool Suite)
|
# STS (Spring Tool Suite)
|
||||||
.springBeans
|
.springBeans
|
||||||
|
/target/
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
package com.intellectualcrafters.configuration.serialization;
|
package com.intellectualcrafters.configuration.serialization;
|
||||||
|
|
||||||
|
import com.intellectualcrafters.configuration.Configuration;
|
||||||
|
|
||||||
import java.lang.reflect.Constructor;
|
import java.lang.reflect.Constructor;
|
||||||
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
@ -9,8 +11,6 @@ import java.util.Map;
|
|||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import com.intellectualcrafters.configuration.Configuration;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Utility class for storing and retrieving classes for {@link Configuration}.
|
* Utility class for storing and retrieving classes for {@link Configuration}.
|
||||||
*/
|
*/
|
||||||
@ -86,15 +86,11 @@ public class ConfigurationSerialization {
|
|||||||
throw new NullPointerException("Args must not be null");
|
throw new NullPointerException("Args must not be null");
|
||||||
}
|
}
|
||||||
ConfigurationSerializable result = null;
|
ConfigurationSerializable result = null;
|
||||||
Method method = null;
|
Method method = getMethod("deserialize", true);
|
||||||
|
|
||||||
if (result == null) {
|
|
||||||
method = getMethod("deserialize", true);
|
|
||||||
|
|
||||||
if (method != null) {
|
if (method != null) {
|
||||||
result = deserializeViaMethod(method, args);
|
result = deserializeViaMethod(method, args);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (result == null) {
|
if (result == null) {
|
||||||
method = getMethod("valueOf", true);
|
method = getMethod("valueOf", true);
|
||||||
@ -248,13 +244,11 @@ public class ConfigurationSerialization {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (delegate == null) {
|
|
||||||
final SerializableAs alias = clazz.getAnnotation(SerializableAs.class);
|
final SerializableAs alias = clazz.getAnnotation(SerializableAs.class);
|
||||||
|
|
||||||
if ((alias != null) && (alias.value() != null)) {
|
if ((alias != null) && (alias.value() != null)) {
|
||||||
return alias.value();
|
return alias.value();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return clazz.getName();
|
return clazz.getName();
|
||||||
}
|
}
|
||||||
|
@ -1,33 +1,5 @@
|
|||||||
package com.intellectualcrafters.plot;
|
package com.intellectualcrafters.plot;
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.FileInputStream;
|
|
||||||
import java.io.FileOutputStream;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.InputStream;
|
|
||||||
import java.io.InputStreamReader;
|
|
||||||
import java.net.URL;
|
|
||||||
import java.net.URLConnection;
|
|
||||||
import java.nio.file.Files;
|
|
||||||
import java.sql.Connection;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.Comparator;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Map.Entry;
|
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.Set;
|
|
||||||
import java.util.UUID;
|
|
||||||
import java.util.regex.Pattern;
|
|
||||||
import java.util.zip.ZipEntry;
|
|
||||||
import java.util.zip.ZipInputStream;
|
|
||||||
|
|
||||||
import com.intellectualcrafters.configuration.ConfigurationSection;
|
import com.intellectualcrafters.configuration.ConfigurationSection;
|
||||||
import com.intellectualcrafters.configuration.MemorySection;
|
import com.intellectualcrafters.configuration.MemorySection;
|
||||||
import com.intellectualcrafters.configuration.file.YamlConfiguration;
|
import com.intellectualcrafters.configuration.file.YamlConfiguration;
|
||||||
@ -84,6 +56,34 @@ import com.intellectualcrafters.plot.util.area.QuadMap;
|
|||||||
import com.plotsquared.listener.WESubscriber;
|
import com.plotsquared.listener.WESubscriber;
|
||||||
import com.sk89q.worldedit.WorldEdit;
|
import com.sk89q.worldedit.WorldEdit;
|
||||||
|
|
||||||
|
import java.io.BufferedReader;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileInputStream;
|
||||||
|
import java.io.FileOutputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
|
import java.net.URL;
|
||||||
|
import java.net.URLConnection;
|
||||||
|
import java.nio.file.Files;
|
||||||
|
import java.sql.Connection;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Comparator;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Map.Entry;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.UUID;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
import java.util.zip.ZipEntry;
|
||||||
|
import java.util.zip.ZipInputStream;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An implementation of the core,
|
* An implementation of the core,
|
||||||
* with a static getter for easy access
|
* with a static getter for easy access
|
||||||
@ -407,7 +407,7 @@ public class PS {
|
|||||||
* @param plot Plot Object to update
|
* @param plot Plot Object to update
|
||||||
*/
|
*/
|
||||||
public boolean updatePlot(final Plot plot) {
|
public boolean updatePlot(final Plot plot) {
|
||||||
return plot.area.addPlot(plot);
|
return plot.getArea().addPlot(plot);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -595,7 +595,7 @@ public class PS {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public PlotManager getPlotManager(Plot plot) {
|
public PlotManager getPlotManager(Plot plot) {
|
||||||
return plot.area.manager;
|
return plot.getArea().manager;
|
||||||
}
|
}
|
||||||
|
|
||||||
public PlotManager getPlotManager(Location loc) {
|
public PlotManager getPlotManager(Location loc) {
|
||||||
@ -1159,10 +1159,10 @@ public class PS {
|
|||||||
Collection<Plot> lastList = null;
|
Collection<Plot> lastList = null;
|
||||||
PlotArea lastWorld = null;
|
PlotArea lastWorld = null;
|
||||||
for (final Plot plot : myplots) {
|
for (final Plot plot : myplots) {
|
||||||
if (lastWorld == plot.area) {
|
if (lastWorld == plot.getArea()) {
|
||||||
lastList.add(plot);
|
lastList.add(plot);
|
||||||
} else {
|
} else {
|
||||||
lastWorld = plot.area;
|
lastWorld = plot.getArea();
|
||||||
lastList = map.get(lastWorld);
|
lastList = map.get(lastWorld);
|
||||||
lastList.add(plot);
|
lastList.add(plot);
|
||||||
}
|
}
|
||||||
@ -1418,12 +1418,12 @@ public class PS {
|
|||||||
if (callEvent) {
|
if (callEvent) {
|
||||||
EventUtil.manager.callDelete(plot);
|
EventUtil.manager.callDelete(plot);
|
||||||
}
|
}
|
||||||
if (plot.area.removePlot(plot.id)) {
|
if (plot.getArea().removePlot(plot.getId())) {
|
||||||
PlotId last = (PlotId) plot.area.getMeta("lastPlot");
|
PlotId last = (PlotId) plot.getArea().getMeta("lastPlot");
|
||||||
final int last_max = Math.max(Math.abs(last.x), Math.abs(last.y));
|
final int last_max = Math.max(Math.abs(last.x), Math.abs(last.y));
|
||||||
final int this_max = Math.max(Math.abs(plot.id.x), Math.abs(plot.id.y));
|
final int this_max = Math.max(Math.abs(plot.getId().x), Math.abs(plot.getId().y));
|
||||||
if (this_max < last_max) {
|
if (this_max < last_max) {
|
||||||
plot.area.setMeta("lastPlot", plot.id);
|
plot.getArea().setMeta("lastPlot", plot.getId());
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -54,7 +54,7 @@ public class Alias extends SetCommand {
|
|||||||
C.NOT_VALID_VALUE.send(plr);
|
C.NOT_VALID_VALUE.send(plr);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
for (final Plot p : PS.get().getPlots(plot.area)) {
|
for (final Plot p : PS.get().getPlots(plot.getArea())) {
|
||||||
if (p.getAlias().equalsIgnoreCase(alias)) {
|
if (p.getAlias().equalsIgnoreCase(alias)) {
|
||||||
MainUtil.sendMessage(plr, C.ALIAS_IS_TAKEN);
|
MainUtil.sendMessage(plr, C.ALIAS_IS_TAKEN);
|
||||||
return false;
|
return false;
|
||||||
|
@ -190,7 +190,7 @@ public class Auto extends SubCommand {
|
|||||||
Claim.claimPlot(plr, plot, true, true);
|
Claim.claimPlot(plr, plot, true, true);
|
||||||
br = true;
|
br = true;
|
||||||
}
|
}
|
||||||
plotarea.setMeta("lastPlot", getNextPlotId(plot.id, 1));
|
plotarea.setMeta("lastPlot", getNextPlotId(plot.getId(), 1));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
while (!br) {
|
while (!br) {
|
||||||
|
@ -146,7 +146,7 @@ public class Condense extends SubCommand {
|
|||||||
final Plot origin = allPlots.remove(0);
|
final Plot origin = allPlots.remove(0);
|
||||||
int i = 0;
|
int i = 0;
|
||||||
while (free.size() > i) {
|
while (free.size() > i) {
|
||||||
final Plot possible = origin.area.getPlotAbs(free.get(i));
|
final Plot possible = origin.getArea().getPlotAbs(free.get(i));
|
||||||
if (possible.owner != null) {
|
if (possible.owner != null) {
|
||||||
free.remove(i);
|
free.remove(i);
|
||||||
continue;
|
continue;
|
||||||
|
@ -20,26 +20,6 @@
|
|||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
package com.intellectualcrafters.plot.commands;
|
package com.intellectualcrafters.plot.commands;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.FileNotFoundException;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.PrintWriter;
|
|
||||||
import java.nio.charset.StandardCharsets;
|
|
||||||
import java.sql.Timestamp;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
import javax.script.Bindings;
|
|
||||||
import javax.script.ScriptContext;
|
|
||||||
import javax.script.ScriptEngine;
|
|
||||||
import javax.script.ScriptEngineManager;
|
|
||||||
import javax.script.ScriptException;
|
|
||||||
import javax.script.SimpleScriptContext;
|
|
||||||
|
|
||||||
import com.google.common.io.Files;
|
import com.google.common.io.Files;
|
||||||
import com.intellectualcrafters.plot.PS;
|
import com.intellectualcrafters.plot.PS;
|
||||||
import com.intellectualcrafters.plot.config.C;
|
import com.intellectualcrafters.plot.config.C;
|
||||||
@ -74,6 +54,26 @@ import com.intellectualcrafters.plot.util.WorldUtil;
|
|||||||
import com.plotsquared.general.commands.Command;
|
import com.plotsquared.general.commands.Command;
|
||||||
import com.plotsquared.general.commands.CommandDeclaration;
|
import com.plotsquared.general.commands.CommandDeclaration;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileNotFoundException;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.PrintWriter;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
|
import java.sql.Timestamp;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import javax.script.Bindings;
|
||||||
|
import javax.script.ScriptContext;
|
||||||
|
import javax.script.ScriptEngine;
|
||||||
|
import javax.script.ScriptEngineManager;
|
||||||
|
import javax.script.ScriptException;
|
||||||
|
import javax.script.SimpleScriptContext;
|
||||||
|
|
||||||
@CommandDeclaration(command = "debugexec", permission = "plots.admin", description = "Mutli-purpose debug command", aliases = { "exec" }, category = CommandCategory.DEBUG)
|
@CommandDeclaration(command = "debugexec", permission = "plots.admin", description = "Mutli-purpose debug command", aliases = { "exec" }, category = CommandCategory.DEBUG)
|
||||||
public class DebugExec extends SubCommand {
|
public class DebugExec extends SubCommand {
|
||||||
|
|
||||||
@ -289,7 +289,7 @@ public class DebugExec extends SubCommand {
|
|||||||
MainUtil.sendMessage(player, "Expired plots (" + ExpireManager.expiredPlots.get(args[1]).size() + "):");
|
MainUtil.sendMessage(player, "Expired plots (" + ExpireManager.expiredPlots.get(args[1]).size() + "):");
|
||||||
for (final Plot plot : ExpireManager.expiredPlots.get(args[1])) {
|
for (final Plot plot : ExpireManager.expiredPlots.get(args[1])) {
|
||||||
MainUtil.sendMessage(player,
|
MainUtil.sendMessage(player,
|
||||||
" - " + plot.area + ";" + plot.getId().x + ";" + plot.getId().y + ";" + UUIDHandler.getName(plot.owner) + " : " + ExpireManager.dates.get(plot.owner));
|
" - " + plot.getArea() + ";" + plot.getId().x + ";" + plot.getId().y + ";" + UUIDHandler.getName(plot.owner) + " : " + ExpireManager.dates.get(plot.owner));
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -50,7 +50,7 @@ public class Deny extends SubCommand {
|
|||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
return !sendMessage(plr, C.NOT_IN_PLOT);
|
return !sendMessage(plr, C.NOT_IN_PLOT);
|
||||||
}
|
}
|
||||||
if ((plot == null) || !plot.hasOwner()) {
|
if (!plot.hasOwner()) {
|
||||||
MainUtil.sendMessage(plr, C.PLOT_UNOWNED);
|
MainUtil.sendMessage(plr, C.PLOT_UNOWNED);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -20,13 +20,6 @@
|
|||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
package com.intellectualcrafters.plot.commands;
|
package com.intellectualcrafters.plot.commands;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.config.C;
|
import com.intellectualcrafters.plot.config.C;
|
||||||
import com.intellectualcrafters.plot.config.Settings;
|
import com.intellectualcrafters.plot.config.Settings;
|
||||||
import com.intellectualcrafters.plot.object.ConsolePlayer;
|
import com.intellectualcrafters.plot.object.ConsolePlayer;
|
||||||
@ -45,6 +38,13 @@ import com.plotsquared.general.commands.Command;
|
|||||||
import com.plotsquared.general.commands.CommandHandlingOutput;
|
import com.plotsquared.general.commands.CommandHandlingOutput;
|
||||||
import com.plotsquared.general.commands.CommandManager;
|
import com.plotsquared.general.commands.CommandManager;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PlotSquared command class
|
* PlotSquared command class
|
||||||
*
|
*
|
||||||
@ -278,7 +278,7 @@ public class MainCommand extends CommandManager<PlotPlayer> {
|
|||||||
if (newPlot == null) {
|
if (newPlot == null) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (!ConsolePlayer.isConsole(player) && (!newPlot.area.equals(area) || newPlot.isDenied(player.getUUID())) && !Permissions.hasPermission(player, C.PERMISSION_ADMIN)) {
|
if (!ConsolePlayer.isConsole(player) && (!newPlot.getArea().equals(area) || newPlot.isDenied(player.getUUID())) && !Permissions.hasPermission(player, C.PERMISSION_ADMIN)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// Save meta
|
// Save meta
|
||||||
|
@ -62,7 +62,7 @@ public class Move extends SubCommand {
|
|||||||
MainUtil.sendMessage(plr, C.COMMAND_SYNTAX, "/plot copy <X;Z>");
|
MainUtil.sendMessage(plr, C.COMMAND_SYNTAX, "/plot copy <X;Z>");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!plot1.area.isCompatible(plot2.area)) {
|
if (!plot1.getArea().isCompatible(plot2.getArea())) {
|
||||||
C.PLOTWORLD_INCOMPATIBLE.send(plr);
|
C.PLOTWORLD_INCOMPATIBLE.send(plr);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -20,9 +20,6 @@
|
|||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
package com.intellectualcrafters.plot.commands;
|
package com.intellectualcrafters.plot.commands;
|
||||||
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.config.C;
|
import com.intellectualcrafters.plot.config.C;
|
||||||
import com.intellectualcrafters.plot.config.Settings;
|
import com.intellectualcrafters.plot.config.Settings;
|
||||||
import com.intellectualcrafters.plot.object.Plot;
|
import com.intellectualcrafters.plot.object.Plot;
|
||||||
@ -32,6 +29,9 @@ import com.intellectualcrafters.plot.util.Permissions;
|
|||||||
import com.intellectualcrafters.plot.util.UUIDHandler;
|
import com.intellectualcrafters.plot.util.UUIDHandler;
|
||||||
import com.plotsquared.general.commands.CommandDeclaration;
|
import com.plotsquared.general.commands.CommandDeclaration;
|
||||||
|
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
@CommandDeclaration(
|
@CommandDeclaration(
|
||||||
command = "setowner",
|
command = "setowner",
|
||||||
permission = "plots.set.owner",
|
permission = "plots.set.owner",
|
||||||
@ -82,7 +82,7 @@ public class Owner extends SetCommand {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final int size = plots.size();
|
final int size = plots.size();
|
||||||
final int currentPlots = (Settings.GLOBAL_LIMIT ? other.getPlotCount() : other.getPlotCount(plot.area.worldname)) + size;
|
final int currentPlots = (Settings.GLOBAL_LIMIT ? other.getPlotCount() : other.getPlotCount(plot.getArea().worldname)) + size;
|
||||||
if (currentPlots > other.getAllowedPlots()) {
|
if (currentPlots > other.getAllowedPlots()) {
|
||||||
sendMessage(plr, C.CANT_TRANSFER_MORE_PLOTS);
|
sendMessage(plr, C.CANT_TRANSFER_MORE_PLOTS);
|
||||||
return false;
|
return false;
|
||||||
@ -93,7 +93,7 @@ public class Owner extends SetCommand {
|
|||||||
plot.setSign(name);
|
plot.setSign(name);
|
||||||
MainUtil.sendMessage(plr, C.SET_OWNER);
|
MainUtil.sendMessage(plr, C.SET_OWNER);
|
||||||
if (other != null) {
|
if (other != null) {
|
||||||
MainUtil.sendMessage(other, C.NOW_OWNER, plot.area + ";" + plot.getId());
|
MainUtil.sendMessage(other, C.NOW_OWNER, plot.getArea() + ";" + plot.getId());
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -20,12 +20,6 @@
|
|||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
package com.intellectualcrafters.plot.commands;
|
package com.intellectualcrafters.plot.commands;
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.Map.Entry;
|
|
||||||
import java.util.Set;
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.PS;
|
import com.intellectualcrafters.plot.PS;
|
||||||
import com.intellectualcrafters.plot.config.C;
|
import com.intellectualcrafters.plot.config.C;
|
||||||
import com.intellectualcrafters.plot.database.DBFunc;
|
import com.intellectualcrafters.plot.database.DBFunc;
|
||||||
@ -38,6 +32,12 @@ import com.intellectualcrafters.plot.util.StringMan;
|
|||||||
import com.intellectualcrafters.plot.util.UUIDHandler;
|
import com.intellectualcrafters.plot.util.UUIDHandler;
|
||||||
import com.plotsquared.general.commands.CommandDeclaration;
|
import com.plotsquared.general.commands.CommandDeclaration;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Map.Entry;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
@CommandDeclaration(
|
@CommandDeclaration(
|
||||||
usage = "/plot purge world:<world> area:<area> id:<id> owner:<owner> shared:<shared> unknown:[true|false]",
|
usage = "/plot purge world:<world> area:<area> id:<id> owner:<owner> shared:<shared> unknown:[true|false]",
|
||||||
command = "purge",
|
command = "purge",
|
||||||
@ -117,13 +117,13 @@ public class Purge extends SubCommand {
|
|||||||
final HashSet<Integer> toDelete = new HashSet<>();
|
final HashSet<Integer> toDelete = new HashSet<>();
|
||||||
Set<Plot> basePlots = PS.get().getBasePlots();
|
Set<Plot> basePlots = PS.get().getBasePlots();
|
||||||
for (Plot plot : PS.get().getBasePlots()) {
|
for (Plot plot : PS.get().getBasePlots()) {
|
||||||
if (world != null && !plot.area.worldname.equalsIgnoreCase(world)) {
|
if (world != null && !plot.getArea().worldname.equalsIgnoreCase(world)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (area != null && !plot.area.equals(area)) {
|
if (area != null && !plot.getArea().equals(area)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (id != null && !plot.id.equals(id)) {
|
if (id != null && !plot.getId().equals(id)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (owner != null && !plot.isOwner(owner)) {
|
if (owner != null && !plot.isOwner(owner)) {
|
||||||
@ -150,7 +150,7 @@ public class Purge extends SubCommand {
|
|||||||
}
|
}
|
||||||
for (Entry<PlotId, Plot> entry2 : entry.getValue().entrySet()) {
|
for (Entry<PlotId, Plot> entry2 : entry.getValue().entrySet()) {
|
||||||
Plot plot = entry2.getValue();
|
Plot plot = entry2.getValue();
|
||||||
if (id != null && !plot.id.equals(id)) {
|
if (id != null && !plot.getId().equals(id)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (owner != null && !plot.isOwner(owner)) {
|
if (owner != null && !plot.isOwner(owner)) {
|
||||||
|
@ -61,7 +61,7 @@ public class Save extends SubCommand {
|
|||||||
Location[] corners = plot.getCorners();
|
Location[] corners = plot.getCorners();
|
||||||
final int size = (corners[1].getX() - corners[0].getX()) + 1;
|
final int size = (corners[1].getX() - corners[0].getX()) + 1;
|
||||||
final PlotId id = plot.getId();
|
final PlotId id = plot.getId();
|
||||||
final String world = plot.area.toString().replaceAll(";", "-").replaceAll("[^A-Za-z0-9]", "");
|
final String world = plot.getArea().toString().replaceAll(";", "-").replaceAll("[^A-Za-z0-9]", "");
|
||||||
final String file = time + "_" + world + "_" + id.x + "_" + id.y + "_" + size + "_" + name;
|
final String file = time + "_" + world + "_" + id.x + "_" + id.y + "_" + size + "_" + name;
|
||||||
final UUID uuid = plr.getUUID();
|
final UUID uuid = plr.getUUID();
|
||||||
|
|
||||||
|
@ -55,7 +55,7 @@ public class Swap extends SubCommand {
|
|||||||
MainUtil.sendMessage(plr, C.COMMAND_SYNTAX, "/plot copy <X;Z>");
|
MainUtil.sendMessage(plr, C.COMMAND_SYNTAX, "/plot copy <X;Z>");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!plot1.area.isCompatible(plot2.area)) {
|
if (!plot1.getArea().isCompatible(plot2.getArea())) {
|
||||||
C.PLOTWORLD_INCOMPATIBLE.send(plr);
|
C.PLOTWORLD_INCOMPATIBLE.send(plr);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -100,7 +100,7 @@ public class list extends SubCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void noArgs(final PlotPlayer plr) {
|
public void noArgs(final PlotPlayer plr) {
|
||||||
MainUtil.sendMessage(plr, C.SUBCOMMAND_SET_OPTIONS_HEADER.s() + getArgumentList(getArgumentList(plr)));
|
MainUtil.sendMessage(plr, C.SUBCOMMAND_SET_OPTIONS_HEADER.s() + getArgumentList(plr));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -388,8 +388,9 @@ public class list extends SubCommand {
|
|||||||
strFlags = C.NONE.s();
|
strFlags = C.NONE.s();
|
||||||
}
|
}
|
||||||
final PlotMessage flags = new PlotMessage().text(C.color(C.PLOT_INFO_FLAGS.s().replaceAll("%flags%", strFlags))).color("$1");
|
final PlotMessage flags = new PlotMessage().text(C.color(C.PLOT_INFO_FLAGS.s().replaceAll("%flags%", strFlags))).color("$1");
|
||||||
message.text("[").color("$3").text(i + "").command("/plot visit " + plot.area + ";" + plot.getId()).tooltip("/plot visit " + plot.area + ";" + plot.getId()).color("$1").text("]")
|
message.text("[").color("$3").text(i + "").command("/plot visit " + plot.getArea() + ";" + plot.getId()).tooltip("/plot visit " + plot.getArea() + ";" + plot.getId()).color("$1")
|
||||||
.color("$3").text(" " + plot.toString()).tooltip(trusted, members, flags).command("/plot info " + plot.area + ";" + plot.getId()).color(color).text(" - ").color("$2");
|
.text("]")
|
||||||
|
.color("$3").text(" " + plot.toString()).tooltip(trusted, members, flags).command("/plot info " + plot.getArea() + ";" + plot.getId()).color(color).text(" - ").color("$2");
|
||||||
String prefix = "";
|
String prefix = "";
|
||||||
for (final UUID uuid : plot.getOwners()) {
|
for (final UUID uuid : plot.getOwners()) {
|
||||||
final String name = UUIDHandler.getName(uuid);
|
final String name = UUIDHandler.getName(uuid);
|
||||||
|
@ -471,7 +471,7 @@ public class SQLManager implements AbstractDB {
|
|||||||
statement.setString(1, uuid.toString());
|
statement.setString(1, uuid.toString());
|
||||||
statement.setInt(2, plot.getId().x);
|
statement.setInt(2, plot.getId().x);
|
||||||
statement.setInt(3, plot.getId().y);
|
statement.setInt(3, plot.getId().y);
|
||||||
statement.setString(4, plot.area.toString());
|
statement.setString(4, plot.getArea().toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -657,7 +657,7 @@ public class SQLManager implements AbstractDB {
|
|||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
stmt.setString((i * 5) + 3, everyone.toString());
|
stmt.setString((i * 5) + 3, everyone.toString());
|
||||||
}
|
}
|
||||||
stmt.setString((i * 5) + 4, plot.area.toString());
|
stmt.setString((i * 5) + 4, plot.getArea().toString());
|
||||||
stmt.setTimestamp((i * 5) + 5, new Timestamp(plot.getTimestamp()));
|
stmt.setTimestamp((i * 5) + 5, new Timestamp(plot.getTimestamp()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -671,7 +671,7 @@ public class SQLManager implements AbstractDB {
|
|||||||
} catch (final Exception e1) {
|
} catch (final Exception e1) {
|
||||||
stmt.setString((i * 6) + 4, everyone.toString());
|
stmt.setString((i * 6) + 4, everyone.toString());
|
||||||
}
|
}
|
||||||
stmt.setString((i * 6) + 5, plot.area.toString());
|
stmt.setString((i * 6) + 5, plot.getArea().toString());
|
||||||
stmt.setTimestamp((i * 6) + 6, new Timestamp(plot.getTimestamp()));
|
stmt.setTimestamp((i * 6) + 6, new Timestamp(plot.getTimestamp()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -680,7 +680,7 @@ public class SQLManager implements AbstractDB {
|
|||||||
stmt.setInt(1, plot.getId().x);
|
stmt.setInt(1, plot.getId().x);
|
||||||
stmt.setInt(2, plot.getId().y);
|
stmt.setInt(2, plot.getId().y);
|
||||||
stmt.setString(3, plot.owner.toString());
|
stmt.setString(3, plot.owner.toString());
|
||||||
stmt.setString(4, plot.area.toString());
|
stmt.setString(4, plot.getArea().toString());
|
||||||
stmt.setTimestamp(5, new Timestamp(plot.getTimestamp()));
|
stmt.setTimestamp(5, new Timestamp(plot.getTimestamp()));
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -994,7 +994,7 @@ public class SQLManager implements AbstractDB {
|
|||||||
stmt.setInt(1, plot.getId().x);
|
stmt.setInt(1, plot.getId().x);
|
||||||
stmt.setInt(2, plot.getId().y);
|
stmt.setInt(2, plot.getId().y);
|
||||||
stmt.setString(3, plot.owner.toString());
|
stmt.setString(3, plot.owner.toString());
|
||||||
stmt.setString(4, plot.area.toString());
|
stmt.setString(4, plot.getArea().toString());
|
||||||
stmt.setTimestamp(5, new Timestamp(plot.getTimestamp()));
|
stmt.setTimestamp(5, new Timestamp(plot.getTimestamp()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1027,7 +1027,7 @@ public class SQLManager implements AbstractDB {
|
|||||||
stmt.setInt(1, plot.getId().x);
|
stmt.setInt(1, plot.getId().x);
|
||||||
stmt.setInt(2, plot.getId().y);
|
stmt.setInt(2, plot.getId().y);
|
||||||
stmt.setString(3, plot.owner.toString());
|
stmt.setString(3, plot.owner.toString());
|
||||||
stmt.setString(4, plot.area.toString());
|
stmt.setString(4, plot.getArea().toString());
|
||||||
stmt.setTimestamp(5, new Timestamp(plot.getTimestamp()));
|
stmt.setTimestamp(5, new Timestamp(plot.getTimestamp()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1363,7 +1363,7 @@ public class SQLManager implements AbstractDB {
|
|||||||
addPlotTask(plot, new UniqueStatement("delete_plot_comments") {
|
addPlotTask(plot, new UniqueStatement("delete_plot_comments") {
|
||||||
@Override
|
@Override
|
||||||
public void set(final PreparedStatement stmt) throws SQLException {
|
public void set(final PreparedStatement stmt) throws SQLException {
|
||||||
stmt.setString(1, plot.area.toString());
|
stmt.setString(1, plot.getArea().toString());
|
||||||
stmt.setInt(2, plot.hashCode());
|
stmt.setInt(2, plot.hashCode());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1493,7 +1493,7 @@ public class SQLManager implements AbstractDB {
|
|||||||
stmt = connection.prepareStatement("SELECT `id` FROM `" + prefix + "plot` WHERE `plot_id_x` = ? AND `plot_id_z` = ? AND world = ? ORDER BY `timestamp` ASC");
|
stmt = connection.prepareStatement("SELECT `id` FROM `" + prefix + "plot` WHERE `plot_id_x` = ? AND `plot_id_z` = ? AND world = ? ORDER BY `timestamp` ASC");
|
||||||
stmt.setInt(1, plot.getId().x);
|
stmt.setInt(1, plot.getId().x);
|
||||||
stmt.setInt(2, plot.getId().y);
|
stmt.setInt(2, plot.getId().y);
|
||||||
stmt.setString(3, plot.area.toString());
|
stmt.setString(3, plot.getArea().toString());
|
||||||
final ResultSet r = stmt.executeQuery();
|
final ResultSet r = stmt.executeQuery();
|
||||||
int id = Integer.MAX_VALUE;
|
int id = Integer.MAX_VALUE;
|
||||||
while (r.next()) {
|
while (r.next()) {
|
||||||
@ -1711,9 +1711,9 @@ public class SQLManager implements AbstractDB {
|
|||||||
p = new Plot(plot_id, user, new HashSet<UUID>(), new HashSet<UUID>(), new HashSet<UUID>(), "", null, null, null, new boolean[] { false, false, false, false }, time, id);
|
p = new Plot(plot_id, user, new HashSet<UUID>(), new HashSet<UUID>(), new HashSet<UUID>(), "", null, null, null, new boolean[] { false, false, false, false }, time, id);
|
||||||
HashMap<PlotId, Plot> map = newplots.get(areaid);
|
HashMap<PlotId, Plot> map = newplots.get(areaid);
|
||||||
if (map != null) {
|
if (map != null) {
|
||||||
Plot last = map.put(p.id, p);
|
Plot last = map.put(p.getId(), p);
|
||||||
if (last != null) {
|
if (last != null) {
|
||||||
map.put(last.id, last);
|
map.put(last.getId(), last);
|
||||||
if (Settings.AUTO_PURGE) {
|
if (Settings.AUTO_PURGE) {
|
||||||
toDelete.add(id);
|
toDelete.add(id);
|
||||||
} else {
|
} else {
|
||||||
@ -1724,7 +1724,7 @@ public class SQLManager implements AbstractDB {
|
|||||||
} else {
|
} else {
|
||||||
map = new HashMap<PlotId, Plot>();
|
map = new HashMap<PlotId, Plot>();
|
||||||
newplots.put(areaid, map);
|
newplots.put(areaid, map);
|
||||||
map.put(p.id, p);
|
map.put(p.getId(), p);
|
||||||
}
|
}
|
||||||
plots.put(id, p);
|
plots.put(id, p);
|
||||||
}
|
}
|
||||||
@ -1991,7 +1991,7 @@ public class SQLManager implements AbstractDB {
|
|||||||
public void set(final PreparedStatement stmt) throws SQLException {
|
public void set(final PreparedStatement stmt) throws SQLException {
|
||||||
stmt.setInt(1, newPlot.getId().x);
|
stmt.setInt(1, newPlot.getId().x);
|
||||||
stmt.setInt(2, newPlot.getId().y);
|
stmt.setInt(2, newPlot.getId().y);
|
||||||
stmt.setString(3, newPlot.area.toString());
|
stmt.setString(3, newPlot.getArea().toString());
|
||||||
stmt.setInt(4, getId(original));
|
stmt.setInt(4, getId(original));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2149,7 +2149,7 @@ public class SQLManager implements AbstractDB {
|
|||||||
@Override
|
@Override
|
||||||
public void set(final PreparedStatement statement) throws SQLException {
|
public void set(final PreparedStatement statement) throws SQLException {
|
||||||
if (plot != null) {
|
if (plot != null) {
|
||||||
statement.setString(1, plot.area.toString());
|
statement.setString(1, plot.getArea().toString());
|
||||||
statement.setInt(2, plot.getId().hashCode());
|
statement.setInt(2, plot.getId().hashCode());
|
||||||
statement.setString(3, comment.comment);
|
statement.setString(3, comment.comment);
|
||||||
statement.setString(4, comment.inbox);
|
statement.setString(4, comment.inbox);
|
||||||
@ -2177,7 +2177,7 @@ public class SQLManager implements AbstractDB {
|
|||||||
@Override
|
@Override
|
||||||
public void set(final PreparedStatement statement) throws SQLException {
|
public void set(final PreparedStatement statement) throws SQLException {
|
||||||
if (plot != null) {
|
if (plot != null) {
|
||||||
statement.setString(1, plot.area.toString());
|
statement.setString(1, plot.getArea().toString());
|
||||||
statement.setInt(2, plot.getId().hashCode());
|
statement.setInt(2, plot.getId().hashCode());
|
||||||
statement.setString(3, inbox);
|
statement.setString(3, inbox);
|
||||||
} else {
|
} else {
|
||||||
@ -2201,7 +2201,7 @@ public class SQLManager implements AbstractDB {
|
|||||||
@Override
|
@Override
|
||||||
public void set(final PreparedStatement statement) throws SQLException {
|
public void set(final PreparedStatement statement) throws SQLException {
|
||||||
if (plot != null) {
|
if (plot != null) {
|
||||||
statement.setString(1, plot.area.toString());
|
statement.setString(1, plot.getArea().toString());
|
||||||
statement.setInt(2, plot.getId().hashCode());
|
statement.setInt(2, plot.getId().hashCode());
|
||||||
statement.setString(3, inbox);
|
statement.setString(3, inbox);
|
||||||
} else {
|
} else {
|
||||||
@ -2251,7 +2251,7 @@ public class SQLManager implements AbstractDB {
|
|||||||
addPlotTask(plot, new UniqueStatement("setComment") {
|
addPlotTask(plot, new UniqueStatement("setComment") {
|
||||||
@Override
|
@Override
|
||||||
public void set(final PreparedStatement statement) throws SQLException {
|
public void set(final PreparedStatement statement) throws SQLException {
|
||||||
statement.setString(1, plot.area.toString());
|
statement.setString(1, plot.getArea().toString());
|
||||||
statement.setInt(2, plot.getId().hashCode());
|
statement.setInt(2, plot.getId().hashCode());
|
||||||
statement.setString(3, comment.comment);
|
statement.setString(3, comment.comment);
|
||||||
statement.setString(4, comment.inbox);
|
statement.setString(4, comment.inbox);
|
||||||
@ -2989,7 +2989,7 @@ public class SQLManager implements AbstractDB {
|
|||||||
if (plot.temp == -1) {
|
if (plot.temp == -1) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
final HashMap<PlotId, Plot> worldplots = database.get(plot.area.toString());
|
final HashMap<PlotId, Plot> worldplots = database.get(plot.getArea().toString());
|
||||||
if (worldplots == null) {
|
if (worldplots == null) {
|
||||||
PS.debug("&8 - &7Creating plot (1): " + plot);
|
PS.debug("&8 - &7Creating plot (1): " + plot);
|
||||||
toCreate.add(plot);
|
toCreate.add(plot);
|
||||||
|
@ -20,13 +20,6 @@
|
|||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
package com.intellectualcrafters.plot.flag;
|
package com.intellectualcrafters.plot.flag;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.PS;
|
import com.intellectualcrafters.plot.PS;
|
||||||
import com.intellectualcrafters.plot.config.C;
|
import com.intellectualcrafters.plot.config.C;
|
||||||
import com.intellectualcrafters.plot.database.DBFunc;
|
import com.intellectualcrafters.plot.database.DBFunc;
|
||||||
@ -39,6 +32,13 @@ import com.intellectualcrafters.plot.object.RunnableVal;
|
|||||||
import com.intellectualcrafters.plot.util.EventUtil;
|
import com.intellectualcrafters.plot.util.EventUtil;
|
||||||
import com.intellectualcrafters.plot.util.Permissions;
|
import com.intellectualcrafters.plot.util.Permissions;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Flag Manager Utility
|
* Flag Manager Utility
|
||||||
*
|
*
|
||||||
@ -173,7 +173,7 @@ public class FlagManager {
|
|||||||
if (plot.owner == null) {
|
if (plot.owner == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return getSettingFlag(plot.area, plot.getSettings(), flag);
|
return getSettingFlag(plot.getArea(), plot.getSettings(), flag);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isPlotFlagTrue(final Plot plot, final String strFlag) {
|
public static boolean isPlotFlagTrue(final Plot plot, final String strFlag) {
|
||||||
@ -255,7 +255,7 @@ public class FlagManager {
|
|||||||
if (!plot.hasOwner()) {
|
if (!plot.hasOwner()) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return getSettingFlags(plot.area, plot.getSettings());
|
return getSettingFlags(plot.getArea(), plot.getSettings());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static HashMap<String, Flag> getPlotFlags(PlotArea area, final PlotSettings settings, final boolean ignorePluginflags) {
|
public static HashMap<String, Flag> getPlotFlags(PlotArea area, final PlotSettings settings, final boolean ignorePluginflags) {
|
||||||
|
@ -1,17 +1,5 @@
|
|||||||
package com.intellectualcrafters.plot.generator;
|
package com.intellectualcrafters.plot.generator;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.util.ArrayDeque;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map.Entry;
|
|
||||||
import java.util.Set;
|
|
||||||
import java.util.concurrent.atomic.AtomicInteger;
|
|
||||||
|
|
||||||
import com.intellectualcrafters.jnbt.CompoundTag;
|
import com.intellectualcrafters.jnbt.CompoundTag;
|
||||||
import com.intellectualcrafters.plot.PS;
|
import com.intellectualcrafters.plot.PS;
|
||||||
import com.intellectualcrafters.plot.config.C;
|
import com.intellectualcrafters.plot.config.C;
|
||||||
@ -33,6 +21,18 @@ import com.intellectualcrafters.plot.util.SchematicHandler;
|
|||||||
import com.intellectualcrafters.plot.util.SetQueue;
|
import com.intellectualcrafters.plot.util.SetQueue;
|
||||||
import com.intellectualcrafters.plot.util.TaskManager;
|
import com.intellectualcrafters.plot.util.TaskManager;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.ArrayDeque;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map.Entry;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
|
||||||
public abstract class HybridUtils {
|
public abstract class HybridUtils {
|
||||||
|
|
||||||
public static HybridUtils manager;
|
public static HybridUtils manager;
|
||||||
@ -93,7 +93,7 @@ public abstract class HybridUtils {
|
|||||||
}
|
}
|
||||||
RegionWrapper region = zones.poll();
|
RegionWrapper region = zones.poll();
|
||||||
final Runnable task = this;
|
final Runnable task = this;
|
||||||
analyzeRegion(origin.area.worldname, region, new RunnableVal<PlotAnalysis>() {
|
analyzeRegion(origin.getArea().worldname, region, new RunnableVal<PlotAnalysis>() {
|
||||||
@Override
|
@Override
|
||||||
public void run(PlotAnalysis value) {
|
public void run(PlotAnalysis value) {
|
||||||
analysis.add(value);
|
analysis.add(value);
|
||||||
@ -151,20 +151,21 @@ public abstract class HybridUtils {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
RegionWrapper region = zones.poll();
|
RegionWrapper region = zones.poll();
|
||||||
Location pos1 = new Location(plot.area.worldname, region.minX, region.minY, region.minZ);
|
Location pos1 = new Location(plot.getArea().worldname, region.minX, region.minY, region.minZ);
|
||||||
Location pos2 = new Location(plot.area.worldname, region.maxX, region.maxY, region.maxZ);
|
Location pos2 = new Location(plot.getArea().worldname, region.maxX, region.maxY, region.maxZ);
|
||||||
ChunkManager.chunkTask(pos1, pos2, new RunnableVal<int[]>() {
|
ChunkManager.chunkTask(pos1, pos2, new RunnableVal<int[]>() {
|
||||||
@Override
|
@Override
|
||||||
public void run(int[] value) {
|
public void run(int[] value) {
|
||||||
final ChunkLoc loc = new ChunkLoc(value[0], value[1]);
|
final ChunkLoc loc = new ChunkLoc(value[0], value[1]);
|
||||||
ChunkManager.manager.loadChunk(plot.area.worldname, loc, false);
|
ChunkManager.manager.loadChunk(plot.getArea().worldname, loc, false);
|
||||||
final int bx = value[2];
|
final int bx = value[2];
|
||||||
final int bz = value[3];
|
final int bz = value[3];
|
||||||
final int ex = value[4];
|
final int ex = value[4];
|
||||||
final int ez = value[5];
|
final int ez = value[5];
|
||||||
whenDone.value += checkModified(plot.area.worldname, bx, ex, 1, cpw.PLOT_HEIGHT - 1, bz, ez, cpw.MAIN_BLOCK);
|
whenDone.value += checkModified(plot.getArea().worldname, bx, ex, 1, cpw.PLOT_HEIGHT - 1, bz, ez, cpw.MAIN_BLOCK);
|
||||||
whenDone.value += checkModified(plot.area.worldname, bx, ex, cpw.PLOT_HEIGHT, cpw.PLOT_HEIGHT, bz, ez, cpw.TOP_BLOCK);
|
whenDone.value += checkModified(plot.getArea().worldname, bx, ex, cpw.PLOT_HEIGHT, cpw.PLOT_HEIGHT, bz, ez, cpw.TOP_BLOCK);
|
||||||
whenDone.value += checkModified(plot.area.worldname, bx, ex, cpw.PLOT_HEIGHT + 1, 255, bz, ez, new PlotBlock[] { new PlotBlock((short) 0, (byte) 0) });
|
whenDone.value += checkModified(
|
||||||
|
plot.getArea().worldname, bx, ex, cpw.PLOT_HEIGHT + 1, 255, bz, ez, new PlotBlock[] { new PlotBlock((short) 0, (byte) 0) });
|
||||||
}
|
}
|
||||||
}, this, 5);
|
}, this, 5);
|
||||||
|
|
||||||
@ -296,10 +297,10 @@ public abstract class HybridUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean setupRoadSchematic(final Plot plot) {
|
public boolean setupRoadSchematic(final Plot plot) {
|
||||||
final String world = plot.area.worldname;
|
final String world = plot.getArea().worldname;
|
||||||
final Location bot = plot.getBottomAbs().subtract(1, 0, 1);
|
final Location bot = plot.getBottomAbs().subtract(1, 0, 1);
|
||||||
final Location top = plot.getTopAbs();
|
final Location top = plot.getTopAbs();
|
||||||
final HybridPlotWorld plotworld = (HybridPlotWorld) plot.area;
|
final HybridPlotWorld plotworld = (HybridPlotWorld) plot.getArea();
|
||||||
final int sx = (bot.getX() - plotworld.ROAD_WIDTH) + 1;
|
final int sx = (bot.getX() - plotworld.ROAD_WIDTH) + 1;
|
||||||
final int sz = bot.getZ() + 1;
|
final int sz = bot.getZ() + 1;
|
||||||
final int sy = plotworld.ROAD_HEIGHT;
|
final int sy = plotworld.ROAD_HEIGHT;
|
||||||
@ -313,7 +314,8 @@ public abstract class HybridUtils {
|
|||||||
final Set<RegionWrapper> sideroad = new HashSet<>(Collections.singletonList(new RegionWrapper(sx, ex, sy, ey, sz, ez)));
|
final Set<RegionWrapper> sideroad = new HashSet<>(Collections.singletonList(new RegionWrapper(sx, ex, sy, ey, sz, ez)));
|
||||||
final Set<RegionWrapper> intersection = new HashSet<>(Collections.singletonList(new RegionWrapper(sx, ex, sy, ty, bz, tz)));
|
final Set<RegionWrapper> intersection = new HashSet<>(Collections.singletonList(new RegionWrapper(sx, ex, sy, ty, bz, tz)));
|
||||||
|
|
||||||
final String dir = PS.get().IMP.getDirectory() + File.separator + "schematics" + File.separator + "GEN_ROAD_SCHEMATIC" + File.separator + plot.area.toString() + File.separator;
|
final String dir = PS.get().IMP.getDirectory() + File.separator + "schematics" + File.separator + "GEN_ROAD_SCHEMATIC" + File.separator + plot
|
||||||
|
.getArea().toString() + File.separator;
|
||||||
SchematicHandler.manager.getCompoundTag(world, sideroad, new RunnableVal<CompoundTag>() {
|
SchematicHandler.manager.getCompoundTag(world, sideroad, new RunnableVal<CompoundTag>() {
|
||||||
@Override
|
@Override
|
||||||
public void run(CompoundTag value) {
|
public void run(CompoundTag value) {
|
||||||
|
@ -1,9 +1,5 @@
|
|||||||
package com.intellectualcrafters.plot.generator;
|
package com.intellectualcrafters.plot.generator;
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.Iterator;
|
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.PS;
|
import com.intellectualcrafters.plot.PS;
|
||||||
import com.intellectualcrafters.plot.object.Location;
|
import com.intellectualcrafters.plot.object.Location;
|
||||||
import com.intellectualcrafters.plot.object.Plot;
|
import com.intellectualcrafters.plot.object.Plot;
|
||||||
@ -13,6 +9,10 @@ import com.intellectualcrafters.plot.object.RegionWrapper;
|
|||||||
import com.intellectualcrafters.plot.util.ChunkManager;
|
import com.intellectualcrafters.plot.util.ChunkManager;
|
||||||
import com.intellectualcrafters.plot.util.MainUtil;
|
import com.intellectualcrafters.plot.util.MainUtil;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Iterator;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A plot manager with a square grid layout, with square shaped plots
|
* A plot manager with a square grid layout, with square shaped plots
|
||||||
*/
|
*/
|
||||||
@ -30,8 +30,8 @@ public abstract class SquarePlotManager extends GridPlotManager {
|
|||||||
Iterator<RegionWrapper> iter = regions.iterator();
|
Iterator<RegionWrapper> iter = regions.iterator();
|
||||||
RegionWrapper region = iter.next();
|
RegionWrapper region = iter.next();
|
||||||
iter.remove();
|
iter.remove();
|
||||||
Location pos1 = new Location(plot.area.worldname, region.minX, region.minY, region.minZ);
|
Location pos1 = new Location(plot.getArea().worldname, region.minX, region.minY, region.minZ);
|
||||||
Location pos2 = new Location(plot.area.worldname, region.maxX, region.maxY, region.maxZ);
|
Location pos2 = new Location(plot.getArea().worldname, region.maxX, region.maxY, region.maxZ);
|
||||||
ChunkManager.manager.regenerateRegion(pos1, pos2, false, this);
|
ChunkManager.manager.regenerateRegion(pos1, pos2, false, this);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -20,22 +20,6 @@
|
|||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
package com.intellectualcrafters.plot.object;
|
package com.intellectualcrafters.plot.object;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.net.URL;
|
|
||||||
import java.nio.charset.StandardCharsets;
|
|
||||||
import java.util.ArrayDeque;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map.Entry;
|
|
||||||
import java.util.Set;
|
|
||||||
import java.util.UUID;
|
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
|
||||||
import java.util.concurrent.atomic.AtomicInteger;
|
|
||||||
|
|
||||||
import com.google.common.collect.BiMap;
|
import com.google.common.collect.BiMap;
|
||||||
import com.intellectualcrafters.jnbt.CompoundTag;
|
import com.intellectualcrafters.jnbt.CompoundTag;
|
||||||
import com.intellectualcrafters.plot.PS;
|
import com.intellectualcrafters.plot.PS;
|
||||||
@ -57,6 +41,22 @@ import com.intellectualcrafters.plot.util.UUIDHandler;
|
|||||||
import com.intellectualcrafters.plot.util.WorldUtil;
|
import com.intellectualcrafters.plot.util.WorldUtil;
|
||||||
import com.plotsquared.listener.PlotListener;
|
import com.plotsquared.listener.PlotListener;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.net.URL;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
|
import java.util.ArrayDeque;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map.Entry;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.UUID;
|
||||||
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The plot class
|
* The plot class
|
||||||
*/
|
*/
|
||||||
@ -72,8 +72,7 @@ public class Plot {
|
|||||||
* plot world
|
* plot world
|
||||||
* Direct access is Deprecated: use getWorld()
|
* Direct access is Deprecated: use getWorld()
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
private PlotArea area;
|
||||||
public PlotArea area;
|
|
||||||
/**
|
/**
|
||||||
* plot owner
|
* plot owner
|
||||||
* (Merged plots can have multiple owners)
|
* (Merged plots can have multiple owners)
|
||||||
@ -304,7 +303,7 @@ public class Plot {
|
|||||||
* @return the PlotCluster object, or null
|
* @return the PlotCluster object, or null
|
||||||
*/
|
*/
|
||||||
public PlotCluster getCluster() {
|
public PlotCluster getCluster() {
|
||||||
return area.getCluster(id);
|
return getArea().getCluster(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -389,7 +388,7 @@ public class Plot {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setArea(PlotArea area) {
|
public void setArea(PlotArea area) {
|
||||||
if (this.area != null) {
|
if (this.getArea() != null) {
|
||||||
this.area.removePlot(id);
|
this.area.removePlot(id);
|
||||||
}
|
}
|
||||||
this.area = area;
|
this.area = area;
|
||||||
|
@ -20,18 +20,6 @@
|
|||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
package com.intellectualcrafters.plot.object;
|
package com.intellectualcrafters.plot.object;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Map.Entry;
|
|
||||||
import java.util.Set;
|
|
||||||
import java.util.UUID;
|
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
|
||||||
|
|
||||||
import com.intellectualcrafters.configuration.ConfigurationSection;
|
import com.intellectualcrafters.configuration.ConfigurationSection;
|
||||||
import com.intellectualcrafters.plot.PS;
|
import com.intellectualcrafters.plot.PS;
|
||||||
import com.intellectualcrafters.plot.config.C;
|
import com.intellectualcrafters.plot.config.C;
|
||||||
@ -50,6 +38,18 @@ import com.intellectualcrafters.plot.util.StringMan;
|
|||||||
import com.intellectualcrafters.plot.util.WorldUtil;
|
import com.intellectualcrafters.plot.util.WorldUtil;
|
||||||
import com.intellectualcrafters.plot.util.area.QuadMap;
|
import com.intellectualcrafters.plot.util.area.QuadMap;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Map.Entry;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.UUID;
|
||||||
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Jesse Boyd
|
* @author Jesse Boyd
|
||||||
*/
|
*/
|
||||||
@ -517,7 +517,7 @@ public abstract class PlotArea {
|
|||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return clusters != null ? clusters.get(plot.id.x, plot.id.y) : null;
|
return clusters != null ? clusters.get(plot.getId().x, plot.getId().y) : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public PlotCluster getFirstIntersectingCluster(PlotId pos1, PlotId pos2) {
|
public PlotCluster getFirstIntersectingCluster(PlotId pos1, PlotId pos2) {
|
||||||
@ -607,11 +607,11 @@ public abstract class PlotArea {
|
|||||||
for (PlotPlayer pp : plot.getPlayersInPlot()) {
|
for (PlotPlayer pp : plot.getPlayersInPlot()) {
|
||||||
pp.setMeta("lastplot", plot);
|
pp.setMeta("lastplot", plot);
|
||||||
}
|
}
|
||||||
return plots.put(plot.id, plot) == null;
|
return plots.put(plot.getId(), plot) == null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean addPlotIfAbsent(Plot plot) {
|
public boolean addPlotIfAbsent(Plot plot) {
|
||||||
if (plots.putIfAbsent(plot.id, plot) == null) {
|
if (plots.putIfAbsent(plot.getId(), plot) == null) {
|
||||||
for (PlotPlayer pp : plot.getPlayersInPlot()) {
|
for (PlotPlayer pp : plot.getPlayersInPlot()) {
|
||||||
pp.setMeta("lastplot", plot);
|
pp.setMeta("lastplot", plot);
|
||||||
}
|
}
|
||||||
@ -621,12 +621,11 @@ public abstract class PlotArea {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean addPlotAbs(Plot plot) {
|
public boolean addPlotAbs(Plot plot) {
|
||||||
return plots.put(plot.id, plot) == null;
|
return plots.put(plot.getId(), plot) == null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if the plots in a selection are unowned
|
* Check if the plots in a selection are unowned
|
||||||
* @param world
|
|
||||||
* @param pos1
|
* @param pos1
|
||||||
* @param pos2
|
* @param pos2
|
||||||
* @return
|
* @return
|
||||||
@ -635,7 +634,7 @@ public abstract class PlotArea {
|
|||||||
int area = (pos2.x - pos1.x + 1) * (pos2.y - pos1.y + 1);
|
int area = (pos2.x - pos1.x + 1) * (pos2.y - pos1.y + 1);
|
||||||
if (area > getPlotCount()) {
|
if (area > getPlotCount()) {
|
||||||
for (Plot plot : getPlots()) {
|
for (Plot plot : getPlots()) {
|
||||||
if (plot.id.x >= pos1.x && plot.id.x <= pos2.x && plot.id.y >= pos1.y && plot.id.y <= pos2.y) {
|
if (plot.getId().x >= pos1.x && plot.getId().x <= pos2.x && plot.getId().y >= pos1.y && plot.getId().y <= pos2.y) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -654,7 +653,6 @@ public abstract class PlotArea {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the plot border distance for a world<br>
|
* Get the plot border distance for a world<br>
|
||||||
* @param worldname
|
|
||||||
* @return The border distance or Integer.MAX_VALUE if no border is set
|
* @return The border distance or Integer.MAX_VALUE if no border is set
|
||||||
*/
|
*/
|
||||||
public int getBorder() {
|
public int getBorder() {
|
||||||
@ -672,7 +670,6 @@ public abstract class PlotArea {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Setup the plot border for a world (usually done when the world is created)
|
* Setup the plot border for a world (usually done when the world is created)
|
||||||
* @param world
|
|
||||||
*/
|
*/
|
||||||
public void setupBorder() {
|
public void setupBorder() {
|
||||||
if (!WORLD_BORDER) {
|
if (!WORLD_BORDER) {
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
package com.intellectualcrafters.plot.object;
|
package com.intellectualcrafters.plot.object;
|
||||||
|
|
||||||
|
import com.intellectualcrafters.plot.database.DBFunc;
|
||||||
|
import com.intellectualcrafters.plot.util.UUIDHandler;
|
||||||
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.database.DBFunc;
|
|
||||||
import com.intellectualcrafters.plot.util.UUIDHandler;
|
|
||||||
|
|
||||||
public class PlotHandler {
|
public class PlotHandler {
|
||||||
public static HashSet<UUID> getOwners(final Plot plot) {
|
public static HashSet<UUID> getOwners(final Plot plot) {
|
||||||
if (plot.owner == null) {
|
if (plot.owner == null) {
|
||||||
@ -238,7 +238,7 @@ public class PlotHandler {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
for (Plot current : plot.getConnectedPlots()) {
|
for (Plot current : plot.getConnectedPlots()) {
|
||||||
plot.area.removePlot(plot.id);
|
plot.getArea().removePlot(plot.getId());
|
||||||
DBFunc.delete(current);
|
DBFunc.delete(current);
|
||||||
current.settings = null;
|
current.settings = null;
|
||||||
}
|
}
|
||||||
|
@ -1,15 +1,5 @@
|
|||||||
package com.intellectualcrafters.plot.util;
|
package com.intellectualcrafters.plot.util;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.nio.charset.StandardCharsets;
|
|
||||||
import java.nio.file.Files;
|
|
||||||
import java.nio.file.StandardOpenOption;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map.Entry;
|
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.PS;
|
import com.intellectualcrafters.plot.PS;
|
||||||
import com.intellectualcrafters.plot.config.Settings;
|
import com.intellectualcrafters.plot.config.Settings;
|
||||||
import com.intellectualcrafters.plot.flag.FlagManager;
|
import com.intellectualcrafters.plot.flag.FlagManager;
|
||||||
@ -23,6 +13,16 @@ import com.intellectualcrafters.plot.object.PlotBlock;
|
|||||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
import com.intellectualcrafters.plot.object.RegionWrapper;
|
import com.intellectualcrafters.plot.object.RegionWrapper;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
|
import java.nio.file.Files;
|
||||||
|
import java.nio.file.StandardOpenOption;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
public class BO3Handler {
|
public class BO3Handler {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -51,7 +51,7 @@ public class BO3Handler {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static boolean saveBO3(final PlotPlayer plr, final Plot plot) {
|
public static boolean saveBO3(final PlotPlayer plr, final Plot plot) {
|
||||||
final PlotArea plotworld = plot.area;
|
final PlotArea plotworld = plot.getArea();
|
||||||
if (!(plotworld instanceof ClassicPlotWorld) || (plotworld.TYPE != 0)) {
|
if (!(plotworld instanceof ClassicPlotWorld) || (plotworld.TYPE != 0)) {
|
||||||
MainUtil.sendMessage(plr, "BO3 exporting only supports type 0 classic generation.");
|
MainUtil.sendMessage(plr, "BO3 exporting only supports type 0 classic generation.");
|
||||||
return false;
|
return false;
|
||||||
@ -78,13 +78,13 @@ public class BO3Handler {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (ChunkLoc loc : chunks) {
|
for (ChunkLoc loc : chunks) {
|
||||||
ChunkManager.manager.loadChunk(plot.area.worldname, loc, false);
|
ChunkManager.manager.loadChunk(plot.getArea().worldname, loc, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean content = false;
|
boolean content = false;
|
||||||
for (RegionWrapper region : regions) {
|
for (RegionWrapper region : regions) {
|
||||||
Location pos1 = new Location(plot.area.worldname, region.minX, region.minY, region.minZ);
|
Location pos1 = new Location(plot.getArea().worldname, region.minX, region.minY, region.minZ);
|
||||||
Location pos2 = new Location(plot.area.worldname, region.maxX, region.maxY, region.maxZ);
|
Location pos2 = new Location(plot.getArea().worldname, region.maxX, region.maxY, region.maxZ);
|
||||||
for (int x = pos1.getX(); x <= pos2.getX(); x++) {
|
for (int x = pos1.getX(); x <= pos2.getX(); x++) {
|
||||||
final int X = ((x + 7) - cx) >> 4;
|
final int X = ((x + 7) - cx) >> 4;
|
||||||
final int xx = (x - cx) % 16;
|
final int xx = (x - cx) % 16;
|
||||||
@ -94,7 +94,7 @@ public class BO3Handler {
|
|||||||
final ChunkLoc loc = new ChunkLoc(X, Z);
|
final ChunkLoc loc = new ChunkLoc(X, Z);
|
||||||
BO3 bo3 = map.get(loc);
|
BO3 bo3 = map.get(loc);
|
||||||
for (int y = 1; y < height; y++) {
|
for (int y = 1; y < height; y++) {
|
||||||
final PlotBlock block = WorldUtil.IMP.getBlock(new Location(plot.area.worldname, x, y, z));
|
final PlotBlock block = WorldUtil.IMP.getBlock(new Location(plot.getArea().worldname, x, y, z));
|
||||||
if ((block != null) && !contains(cpw.MAIN_BLOCK, block)) {
|
if ((block != null) && !contains(cpw.MAIN_BLOCK, block)) {
|
||||||
if (bo3 == null) {
|
if (bo3 == null) {
|
||||||
bo3 = new BO3(alias, loc);
|
bo3 = new BO3(alias, loc);
|
||||||
@ -104,7 +104,7 @@ public class BO3Handler {
|
|||||||
bo3.addBlock(xx, y - height - 1, zz, block);
|
bo3.addBlock(xx, y - height - 1, zz, block);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
final PlotBlock floor = WorldUtil.IMP.getBlock(new Location(plot.area.worldname, x, height, z));
|
final PlotBlock floor = WorldUtil.IMP.getBlock(new Location(plot.getArea().worldname, x, height, z));
|
||||||
if ((floor != null) && !contains(cpw.TOP_BLOCK, floor)) {
|
if ((floor != null) && !contains(cpw.TOP_BLOCK, floor)) {
|
||||||
if (bo3 == null) {
|
if (bo3 == null) {
|
||||||
bo3 = new BO3(alias, loc);
|
bo3 = new BO3(alias, loc);
|
||||||
@ -114,7 +114,7 @@ public class BO3Handler {
|
|||||||
bo3.addBlock(xx, -1, zz, floor);
|
bo3.addBlock(xx, -1, zz, floor);
|
||||||
}
|
}
|
||||||
for (int y = height + 1; y < 256; y++) {
|
for (int y = height + 1; y < 256; y++) {
|
||||||
final PlotBlock block = WorldUtil.IMP.getBlock(new Location(plot.area.worldname, x, y, z));
|
final PlotBlock block = WorldUtil.IMP.getBlock(new Location(plot.getArea().worldname, x, y, z));
|
||||||
if ((block != null) && (block.id != 0)) {
|
if ((block != null) && (block.id != 0)) {
|
||||||
if (bo3 == null) {
|
if (bo3 == null) {
|
||||||
bo3 = new BO3(alias, loc);
|
bo3 = new BO3(alias, loc);
|
||||||
@ -172,7 +172,7 @@ public class BO3Handler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static boolean save(final Plot plot, final BO3 bo3) {
|
public static boolean save(final Plot plot, final BO3 bo3) {
|
||||||
final File base = getBaseFile(plot.area.worldname);
|
final File base = getBaseFile(plot.getArea().worldname);
|
||||||
try {
|
try {
|
||||||
final List<String> lines = Files.readAllLines(base.toPath(), StandardCharsets.UTF_8);
|
final List<String> lines = Files.readAllLines(base.toPath(), StandardCharsets.UTF_8);
|
||||||
for (int i = 0; i < lines.size(); i++) {
|
for (int i = 0; i < lines.size(); i++) {
|
||||||
|
@ -1,10 +1,5 @@
|
|||||||
package com.intellectualcrafters.plot.util;
|
package com.intellectualcrafters.plot.util;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.concurrent.atomic.AtomicInteger;
|
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.config.C;
|
import com.intellectualcrafters.plot.config.C;
|
||||||
import com.intellectualcrafters.plot.config.Settings;
|
import com.intellectualcrafters.plot.config.Settings;
|
||||||
import com.intellectualcrafters.plot.object.Plot;
|
import com.intellectualcrafters.plot.object.Plot;
|
||||||
@ -16,6 +11,11 @@ import com.intellectualcrafters.plot.object.comment.InboxPublic;
|
|||||||
import com.intellectualcrafters.plot.object.comment.InboxReport;
|
import com.intellectualcrafters.plot.object.comment.InboxReport;
|
||||||
import com.intellectualcrafters.plot.object.comment.PlotComment;
|
import com.intellectualcrafters.plot.object.comment.PlotComment;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
|
||||||
public class CommentManager {
|
public class CommentManager {
|
||||||
public static HashMap<String, CommentInbox> inboxes = new HashMap<>();
|
public static HashMap<String, CommentInbox> inboxes = new HashMap<>();
|
||||||
|
|
||||||
@ -33,13 +33,13 @@ public class CommentManager {
|
|||||||
final AtomicInteger count = new AtomicInteger(0);
|
final AtomicInteger count = new AtomicInteger(0);
|
||||||
final AtomicInteger size = new AtomicInteger(boxes.size());
|
final AtomicInteger size = new AtomicInteger(boxes.size());
|
||||||
for (final CommentInbox inbox : inboxes.values()) {
|
for (final CommentInbox inbox : inboxes.values()) {
|
||||||
inbox.getComments(plot, new RunnableVal() {
|
inbox.getComments(plot, new RunnableVal<List<PlotComment>>() {
|
||||||
@Override
|
@Override
|
||||||
public void run(Object value) {
|
public void run(List<PlotComment> value) {
|
||||||
int total;
|
int total;
|
||||||
if (value != null) {
|
if (value != null) {
|
||||||
int num = 0;
|
int num = 0;
|
||||||
for (final PlotComment comment : (ArrayList<PlotComment>) value) {
|
for (final PlotComment comment : value) {
|
||||||
if (comment.timestamp > getTimestamp(player, inbox.toString())) {
|
if (comment.timestamp > getTimestamp(player, inbox.toString())) {
|
||||||
num++;
|
num++;
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,5 @@
|
|||||||
package com.intellectualcrafters.plot.util;
|
package com.intellectualcrafters.plot.util;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.UUID;
|
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.PS;
|
import com.intellectualcrafters.plot.PS;
|
||||||
import com.intellectualcrafters.plot.config.C;
|
import com.intellectualcrafters.plot.config.C;
|
||||||
import com.intellectualcrafters.plot.config.Settings;
|
import com.intellectualcrafters.plot.config.Settings;
|
||||||
@ -20,6 +14,12 @@ import com.intellectualcrafters.plot.object.PlotHandler;
|
|||||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
import com.intellectualcrafters.plot.object.RunnableVal;
|
import com.intellectualcrafters.plot.object.RunnableVal;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
public class ExpireManager {
|
public class ExpireManager {
|
||||||
public static ConcurrentHashMap<String, List<Plot>> expiredPlots = new ConcurrentHashMap<>();
|
public static ConcurrentHashMap<String, List<Plot>> expiredPlots = new ConcurrentHashMap<>();
|
||||||
public static ConcurrentHashMap<String, Boolean> updatingPlots = new ConcurrentHashMap<>();
|
public static ConcurrentHashMap<String, Boolean> updatingPlots = new ConcurrentHashMap<>();
|
||||||
@ -123,7 +123,7 @@ public class ExpireManager {
|
|||||||
final int complexity = changed == null ? 0 : changed.getComplexity();
|
final int complexity = changed == null ? 0 : changed.getComplexity();
|
||||||
final int modified = changed == null ? 0 : changed.changes;
|
final int modified = changed == null ? 0 : changed.changes;
|
||||||
PS.debug("$2[&5Expire&dManager$2] &cDeleted expired plot: " + plot + " : " + complexity + " - " + modified);
|
PS.debug("$2[&5Expire&dManager$2] &cDeleted expired plot: " + plot + " : " + complexity + " - " + modified);
|
||||||
PS.debug("$4 - Area: " + plot.area);
|
PS.debug("$4 - Area: " + plot.getArea());
|
||||||
if (plot.hasOwner()) {
|
if (plot.hasOwner()) {
|
||||||
PS.debug("$4 - Owner: " + UUIDHandler.getName(plot.owner));
|
PS.debug("$4 - Owner: " + UUIDHandler.getName(plot.owner));
|
||||||
} else {
|
} else {
|
||||||
|
@ -20,15 +20,6 @@
|
|||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
package com.intellectualcrafters.plot.util;
|
package com.intellectualcrafters.plot.util;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map.Entry;
|
|
||||||
import java.util.UUID;
|
|
||||||
import java.util.regex.Matcher;
|
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.PS;
|
import com.intellectualcrafters.plot.PS;
|
||||||
import com.intellectualcrafters.plot.config.C;
|
import com.intellectualcrafters.plot.config.C;
|
||||||
import com.intellectualcrafters.plot.config.Settings;
|
import com.intellectualcrafters.plot.config.Settings;
|
||||||
@ -47,6 +38,15 @@ import com.intellectualcrafters.plot.object.PseudoRandom;
|
|||||||
import com.intellectualcrafters.plot.object.RegionWrapper;
|
import com.intellectualcrafters.plot.object.RegionWrapper;
|
||||||
import com.intellectualcrafters.plot.object.RunnableVal;
|
import com.intellectualcrafters.plot.object.RunnableVal;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map.Entry;
|
||||||
|
import java.util.UUID;
|
||||||
|
import java.util.regex.Matcher;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* plot functions
|
* plot functions
|
||||||
*
|
*
|
||||||
@ -216,10 +216,7 @@ public class MainUtil {
|
|||||||
if (uuid == null) {
|
if (uuid == null) {
|
||||||
uuid = UUID.fromString(term);
|
uuid = UUID.fromString(term);
|
||||||
}
|
}
|
||||||
if (uuid != null) {
|
|
||||||
uuids.add(uuid);
|
uuids.add(uuid);
|
||||||
continue;
|
|
||||||
}
|
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
id = PlotId.fromString(term);
|
id = PlotId.fromString(term);
|
||||||
if (id != null) {
|
if (id != null) {
|
||||||
@ -253,7 +250,7 @@ public class MainUtil {
|
|||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ((area != null) && plot.area.equals(area)) {
|
if ((area != null) && plot.getArea().equals(area)) {
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
if ((alias != null) && alias.equals(plot.getAlias())) {
|
if ((alias != null) && alias.equals(plot.getAlias())) {
|
||||||
@ -633,7 +630,7 @@ public class MainUtil {
|
|||||||
final int num = plot.getConnectedPlots().size();
|
final int num = plot.getConnectedPlots().size();
|
||||||
final String alias = plot.getAlias().length() > 0 ? plot.getAlias() : C.NONE.s();
|
final String alias = plot.getAlias().length() > 0 ? plot.getAlias() : C.NONE.s();
|
||||||
final Location bot = plot.getCorners()[0];
|
final Location bot = plot.getCorners()[0];
|
||||||
final String biome = WorldUtil.IMP.getBiome(plot.area.worldname, bot.getX(), bot.getZ());
|
final String biome = WorldUtil.IMP.getBiome(plot.getArea().worldname, bot.getX(), bot.getZ());
|
||||||
final String trusted = getPlayerList(plot.getTrusted());
|
final String trusted = getPlayerList(plot.getTrusted());
|
||||||
final String members = getPlayerList(plot.getMembers());
|
final String members = getPlayerList(plot.getMembers());
|
||||||
final String denied = getPlayerList(plot.getDenied());
|
final String denied = getPlayerList(plot.getDenied());
|
||||||
@ -643,7 +640,9 @@ public class MainUtil {
|
|||||||
|
|
||||||
final String flags = StringMan.replaceFromMap(
|
final String flags = StringMan.replaceFromMap(
|
||||||
"$2"
|
"$2"
|
||||||
+ (StringMan.join(FlagManager.getPlotFlags(plot.area, plot.getSettings(), true).values(), "").length() > 0 ? StringMan.join(FlagManager.getPlotFlags(plot.area, plot.getSettings(), true)
|
+ (StringMan.join(FlagManager.getPlotFlags(plot.getArea(), plot.getSettings(), true).values(), "").length() > 0 ? StringMan.join(FlagManager.getPlotFlags(
|
||||||
|
|
||||||
|
plot.getArea(), plot.getSettings(), true)
|
||||||
.values(), "$1, $2") : C.NONE.s()), C.replacements);
|
.values(), "$1, $2") : C.NONE.s()), C.replacements);
|
||||||
final boolean build = plot.isAdded(player.getUUID());
|
final boolean build = plot.isAdded(player.getUUID());
|
||||||
|
|
||||||
|
@ -1,5 +1,28 @@
|
|||||||
package com.intellectualcrafters.plot.util;
|
package com.intellectualcrafters.plot.util;
|
||||||
|
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
import com.intellectualcrafters.jnbt.ByteArrayTag;
|
||||||
|
import com.intellectualcrafters.jnbt.CompoundTag;
|
||||||
|
import com.intellectualcrafters.jnbt.IntTag;
|
||||||
|
import com.intellectualcrafters.jnbt.ListTag;
|
||||||
|
import com.intellectualcrafters.jnbt.NBTInputStream;
|
||||||
|
import com.intellectualcrafters.jnbt.NBTOutputStream;
|
||||||
|
import com.intellectualcrafters.jnbt.ShortTag;
|
||||||
|
import com.intellectualcrafters.jnbt.StringTag;
|
||||||
|
import com.intellectualcrafters.jnbt.Tag;
|
||||||
|
import com.intellectualcrafters.json.JSONArray;
|
||||||
|
import com.intellectualcrafters.plot.PS;
|
||||||
|
import com.intellectualcrafters.plot.config.Settings;
|
||||||
|
import com.intellectualcrafters.plot.generator.ClassicPlotWorld;
|
||||||
|
import com.intellectualcrafters.plot.object.ChunkLoc;
|
||||||
|
import com.intellectualcrafters.plot.object.Location;
|
||||||
|
import com.intellectualcrafters.plot.object.Plot;
|
||||||
|
import com.intellectualcrafters.plot.object.PlotArea;
|
||||||
|
import com.intellectualcrafters.plot.object.PlotBlock;
|
||||||
|
import com.intellectualcrafters.plot.object.RegionWrapper;
|
||||||
|
import com.intellectualcrafters.plot.object.RunnableVal;
|
||||||
|
import com.intellectualcrafters.plot.object.schematic.PlotItem;
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
@ -29,29 +52,6 @@ import java.util.UUID;
|
|||||||
import java.util.zip.GZIPInputStream;
|
import java.util.zip.GZIPInputStream;
|
||||||
import java.util.zip.GZIPOutputStream;
|
import java.util.zip.GZIPOutputStream;
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
|
||||||
import com.intellectualcrafters.jnbt.ByteArrayTag;
|
|
||||||
import com.intellectualcrafters.jnbt.CompoundTag;
|
|
||||||
import com.intellectualcrafters.jnbt.IntTag;
|
|
||||||
import com.intellectualcrafters.jnbt.ListTag;
|
|
||||||
import com.intellectualcrafters.jnbt.NBTInputStream;
|
|
||||||
import com.intellectualcrafters.jnbt.NBTOutputStream;
|
|
||||||
import com.intellectualcrafters.jnbt.ShortTag;
|
|
||||||
import com.intellectualcrafters.jnbt.StringTag;
|
|
||||||
import com.intellectualcrafters.jnbt.Tag;
|
|
||||||
import com.intellectualcrafters.json.JSONArray;
|
|
||||||
import com.intellectualcrafters.plot.PS;
|
|
||||||
import com.intellectualcrafters.plot.config.Settings;
|
|
||||||
import com.intellectualcrafters.plot.generator.ClassicPlotWorld;
|
|
||||||
import com.intellectualcrafters.plot.object.ChunkLoc;
|
|
||||||
import com.intellectualcrafters.plot.object.Location;
|
|
||||||
import com.intellectualcrafters.plot.object.Plot;
|
|
||||||
import com.intellectualcrafters.plot.object.PlotArea;
|
|
||||||
import com.intellectualcrafters.plot.object.PlotBlock;
|
|
||||||
import com.intellectualcrafters.plot.object.RegionWrapper;
|
|
||||||
import com.intellectualcrafters.plot.object.RunnableVal;
|
|
||||||
import com.intellectualcrafters.plot.object.schematic.PlotItem;
|
|
||||||
|
|
||||||
public abstract class SchematicHandler {
|
public abstract class SchematicHandler {
|
||||||
public static SchematicHandler manager;
|
public static SchematicHandler manager;
|
||||||
|
|
||||||
@ -83,10 +83,10 @@ public abstract class SchematicHandler {
|
|||||||
}
|
}
|
||||||
final String name;
|
final String name;
|
||||||
if (namingScheme == null) {
|
if (namingScheme == null) {
|
||||||
name = plot.getId().x + ";" + plot.getId().y + "," + plot.area + "," + o;
|
name = plot.getId().x + ";" + plot.getId().y + "," + plot.getArea() + "," + o;
|
||||||
} else {
|
} else {
|
||||||
name = namingScheme.replaceAll("%owner%", o).replaceAll("%id%", plot.getId().toString()).replaceAll("%idx%", plot.getId().x + "").replaceAll("%idy%", plot.getId().y + "")
|
name = namingScheme.replaceAll("%owner%", o).replaceAll("%id%", plot.getId().toString()).replaceAll("%idx%", plot.getId().x + "").replaceAll("%idy%", plot.getId().y + "")
|
||||||
.replaceAll("%world%", plot.area.toString());
|
.replaceAll("%world%", plot.getArea().toString());
|
||||||
}
|
}
|
||||||
final String directory;
|
final String directory;
|
||||||
if (outputDir == null) {
|
if (outputDir == null) {
|
||||||
@ -170,14 +170,14 @@ public abstract class SchematicHandler {
|
|||||||
if (HEIGHT >= 256) {
|
if (HEIGHT >= 256) {
|
||||||
y_offset = 0;
|
y_offset = 0;
|
||||||
} else {
|
} else {
|
||||||
PlotArea pw = plot.area;
|
PlotArea pw = plot.getArea();
|
||||||
if (pw instanceof ClassicPlotWorld) {
|
if (pw instanceof ClassicPlotWorld) {
|
||||||
y_offset = ((ClassicPlotWorld) pw).PLOT_HEIGHT;
|
y_offset = ((ClassicPlotWorld) pw).PLOT_HEIGHT;
|
||||||
} else {
|
} else {
|
||||||
y_offset = MainUtil.getHeighestBlock(plot.area.worldname, region.minX + 1, region.minZ + 1);
|
y_offset = MainUtil.getHeighestBlock(plot.getArea().worldname, region.minX + 1, region.minZ + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
final Location pos1 = new Location(plot.area.worldname, region.minX + x_offset, y_offset, region.minZ + z_offset);
|
final Location pos1 = new Location(plot.getArea().worldname, region.minX + x_offset, y_offset, region.minZ + z_offset);
|
||||||
final Location pos2 = pos1.clone().add(WIDTH - 1, HEIGHT - 1, LENGTH - 1);
|
final Location pos2 = pos1.clone().add(WIDTH - 1, HEIGHT - 1, LENGTH - 1);
|
||||||
// TODO switch to ChunkManager.chunkTask(pos1, pos2, task, whenDone, allocate);
|
// TODO switch to ChunkManager.chunkTask(pos1, pos2, task, whenDone, allocate);
|
||||||
final int p1x = pos1.getX();
|
final int p1x = pos1.getX();
|
||||||
@ -306,11 +306,11 @@ public abstract class SchematicHandler {
|
|||||||
case 190:
|
case 190:
|
||||||
case 191:
|
case 191:
|
||||||
case 192: {
|
case 192: {
|
||||||
SetQueue.IMP.setBlock(plot.area.worldname, xx, yy, zz, id);
|
SetQueue.IMP.setBlock(plot.getArea().worldname, xx, yy, zz, id);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
SetQueue.IMP.setBlock(plot.area.worldname, xx, yy, zz, new PlotBlock((short) id, datas[i]));
|
SetQueue.IMP.setBlock(plot.getArea().worldname, xx, yy, zz, new PlotBlock((short) id, datas[i]));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -362,9 +362,9 @@ public abstract class SchematicHandler {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
RegionWrapper region = plot.getLargestRegion();
|
RegionWrapper region = plot.getLargestRegion();
|
||||||
Location l1 = new Location(plot.area.worldname, region.minX + x_offset, 1, region.minZ + z_offset);
|
Location l1 = new Location(plot.getArea().worldname, region.minX + x_offset, 1, region.minZ + z_offset);
|
||||||
// Location l1 = MainUtil.getPlotBottomLoc(plot.world, plot.getId());
|
// Location l1 = MainUtil.getPlotBottomLoc(plot.world, plot.getId());
|
||||||
final int sy = MainUtil.getHeighestBlock(plot.area.worldname, l1.getX() + 1, l1.getZ() + 1);
|
final int sy = MainUtil.getHeighestBlock(plot.getArea().worldname, l1.getX() + 1, l1.getZ() + 1);
|
||||||
final Dimension demensions = schematic.getSchematicDimension();
|
final Dimension demensions = schematic.getSchematicDimension();
|
||||||
final int HEIGHT = demensions.getY();
|
final int HEIGHT = demensions.getY();
|
||||||
if ((HEIGHT < 255)) {
|
if ((HEIGHT < 255)) {
|
||||||
@ -377,7 +377,7 @@ public abstract class SchematicHandler {
|
|||||||
item.x += X;
|
item.x += X;
|
||||||
item.y += Y;
|
item.y += Y;
|
||||||
item.z += Z;
|
item.z += Z;
|
||||||
WorldUtil.IMP.addItems(plot.area.worldname, item);
|
WorldUtil.IMP.addItems(plot.getArea().worldname, item);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -672,7 +672,7 @@ public abstract class SchematicHandler {
|
|||||||
public abstract void getCompoundTag(final String world, Set<RegionWrapper> regions, final RunnableVal<CompoundTag> whenDone);
|
public abstract void getCompoundTag(final String world, Set<RegionWrapper> regions, final RunnableVal<CompoundTag> whenDone);
|
||||||
|
|
||||||
public void getCompoundTag(Plot plot, final RunnableVal<CompoundTag> whenDone) {
|
public void getCompoundTag(Plot plot, final RunnableVal<CompoundTag> whenDone) {
|
||||||
getCompoundTag(plot.area.worldname, plot.getRegions(), whenDone);
|
getCompoundTag(plot.getArea().worldname, plot.getRegions(), whenDone);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -685,32 +685,9 @@ public abstract class SchematicHandler {
|
|||||||
private final short[] ids;
|
private final short[] ids;
|
||||||
private final byte[] datas;
|
private final byte[] datas;
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
private DataCollection[] collection;
|
|
||||||
|
|
||||||
private final Dimension schematicDimension;
|
private final Dimension schematicDimension;
|
||||||
private HashSet<PlotItem> items;
|
private HashSet<PlotItem> items;
|
||||||
|
|
||||||
/**
|
|
||||||
* This is deprecated as having a wrapper for each block is slow.<br>
|
|
||||||
* - There's also a performance hit by having to cast the DataCollection short / byte
|
|
||||||
* -
|
|
||||||
* @param blockCollection
|
|
||||||
* @param schematicDimension
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public Schematic(final DataCollection[] blockCollection, final Dimension schematicDimension) {
|
|
||||||
ids = new short[blockCollection.length];
|
|
||||||
datas = new byte[blockCollection.length];
|
|
||||||
for (int i = 0; i < blockCollection.length; i++) {
|
|
||||||
final DataCollection block = blockCollection[i];
|
|
||||||
ids[i] = (byte) block.block;
|
|
||||||
datas[i] = block.data;
|
|
||||||
}
|
|
||||||
collection = blockCollection;
|
|
||||||
this.schematicDimension = schematicDimension;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Schematic(final short[] i, final byte[] b, final Dimension d) {
|
public Schematic(final short[] i, final byte[] b, final Dimension d) {
|
||||||
ids = i;
|
ids = i;
|
||||||
datas = b;
|
datas = b;
|
||||||
@ -760,21 +737,6 @@ public abstract class SchematicHandler {
|
|||||||
return datas;
|
return datas;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated as it is slow to wrap each block
|
|
||||||
* @return DataCollection of schematic blocks
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public DataCollection[] getBlockCollection() {
|
|
||||||
if (collection == null) {
|
|
||||||
collection = new DataCollection[ids.length];
|
|
||||||
for (int i = 0; i < ids.length; i++) {
|
|
||||||
collection[i] = new DataCollection(ids[i], datas[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return collection;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Schematic copySection(RegionWrapper region) {
|
public Schematic copySection(RegionWrapper region) {
|
||||||
|
|
||||||
int x1 = region.minX;
|
int x1 = region.minX;
|
||||||
@ -856,28 +818,4 @@ public abstract class SchematicHandler {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Schematic Data Collection
|
|
||||||
* @deprecated as it is slow to wrap each block
|
|
||||||
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public class DataCollection {
|
|
||||||
private final short block;
|
|
||||||
private final byte data;
|
|
||||||
|
|
||||||
// public CompoundTag tag;
|
|
||||||
public DataCollection(final short block, final byte data) {
|
|
||||||
this.block = block;
|
|
||||||
this.data = data;
|
|
||||||
}
|
|
||||||
|
|
||||||
public short getBlock() {
|
|
||||||
return block;
|
|
||||||
}
|
|
||||||
|
|
||||||
public byte getData() {
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -20,18 +20,6 @@
|
|||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
package com.plotsquared.bukkit.commands;
|
package com.plotsquared.bukkit.commands;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.FilenameFilter;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.nio.charset.StandardCharsets;
|
|
||||||
import java.nio.file.Files;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map.Entry;
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.PS;
|
import com.intellectualcrafters.plot.PS;
|
||||||
import com.intellectualcrafters.plot.commands.CommandCategory;
|
import com.intellectualcrafters.plot.commands.CommandCategory;
|
||||||
import com.intellectualcrafters.plot.commands.RequiredType;
|
import com.intellectualcrafters.plot.commands.RequiredType;
|
||||||
@ -55,6 +43,18 @@ import com.plotsquared.bukkit.uuid.OfflineUUIDWrapper;
|
|||||||
import com.plotsquared.general.commands.Argument;
|
import com.plotsquared.general.commands.Argument;
|
||||||
import com.plotsquared.general.commands.CommandDeclaration;
|
import com.plotsquared.general.commands.CommandDeclaration;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FilenameFilter;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
|
import java.nio.file.Files;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map.Entry;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
@CommandDeclaration(
|
@CommandDeclaration(
|
||||||
command = "uuidconvert",
|
command = "uuidconvert",
|
||||||
permission = "plots.admin",
|
permission = "plots.admin",
|
||||||
@ -139,7 +139,7 @@ public class DebugUUID extends SubCommand {
|
|||||||
return s.endsWith(".dat");
|
return s.endsWith(".dat");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (dat != null) {
|
if (dat != null)
|
||||||
for (final String current : dat) {
|
for (final String current : dat) {
|
||||||
final String s = current.replaceAll(".dat$", "");
|
final String s = current.replaceAll(".dat$", "");
|
||||||
try {
|
try {
|
||||||
@ -149,7 +149,6 @@ public class DebugUUID extends SubCommand {
|
|||||||
MainUtil.sendMessage(player, C.PREFIX.s() + "Invalid playerdata: " + current);
|
MainUtil.sendMessage(player, C.PREFIX.s() + "Invalid playerdata: " + current);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
final File playersFolder = new File(worldname + File.separator + "players");
|
final File playersFolder = new File(worldname + File.separator + "players");
|
||||||
dat = playersFolder.list(new FilenameFilter() {
|
dat = playersFolder.list(new FilenameFilter() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,15 +1,5 @@
|
|||||||
package com.plotsquared.bukkit.database.plotme;
|
package com.plotsquared.bukkit.database.plotme;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.sql.Connection;
|
|
||||||
import java.sql.DriverManager;
|
|
||||||
import java.sql.PreparedStatement;
|
|
||||||
import java.sql.ResultSet;
|
|
||||||
import java.sql.SQLException;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map.Entry;
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
import com.intellectualcrafters.configuration.file.FileConfiguration;
|
import com.intellectualcrafters.configuration.file.FileConfiguration;
|
||||||
import com.intellectualcrafters.plot.PS;
|
import com.intellectualcrafters.plot.PS;
|
||||||
import com.intellectualcrafters.plot.config.Settings;
|
import com.intellectualcrafters.plot.config.Settings;
|
||||||
@ -22,6 +12,16 @@ import com.intellectualcrafters.plot.object.PlotId;
|
|||||||
import com.intellectualcrafters.plot.object.StringWrapper;
|
import com.intellectualcrafters.plot.object.StringWrapper;
|
||||||
import com.intellectualcrafters.plot.util.UUIDHandler;
|
import com.intellectualcrafters.plot.util.UUIDHandler;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.sql.Connection;
|
||||||
|
import java.sql.DriverManager;
|
||||||
|
import java.sql.PreparedStatement;
|
||||||
|
import java.sql.ResultSet;
|
||||||
|
import java.sql.SQLException;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map.Entry;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
public class PlotMeConnector_017 extends APlotMeConnector {
|
public class PlotMeConnector_017 extends APlotMeConnector {
|
||||||
private String plugin;
|
private String plugin;
|
||||||
private String prefix;
|
private String prefix;
|
||||||
@ -135,7 +135,7 @@ public class PlotMeConnector_017 extends APlotMeConnector {
|
|||||||
}
|
}
|
||||||
for (final Entry<Integer, Plot> entry : plots.entrySet()) {
|
for (final Entry<Integer, Plot> entry : plots.entrySet()) {
|
||||||
final Plot plot = entry.getValue();
|
final Plot plot = entry.getValue();
|
||||||
final HashMap<PlotId, boolean[]> mergeMap = merges.get(plot.area.worldname);
|
final HashMap<PlotId, boolean[]> mergeMap = merges.get(plot.getArea().worldname);
|
||||||
if (mergeMap != null) {
|
if (mergeMap != null) {
|
||||||
if (mergeMap.containsKey(plot.getId())) {
|
if (mergeMap.containsKey(plot.getId())) {
|
||||||
plot.setMerged(mergeMap.get(plot.getId()));
|
plot.setMerged(mergeMap.get(plot.getId()));
|
||||||
@ -184,10 +184,10 @@ public class PlotMeConnector_017 extends APlotMeConnector {
|
|||||||
|
|
||||||
for (final Entry<Integer, Plot> entry : plots.entrySet()) {
|
for (final Entry<Integer, Plot> entry : plots.entrySet()) {
|
||||||
final Plot plot = entry.getValue();
|
final Plot plot = entry.getValue();
|
||||||
HashMap<PlotId, Plot> map = processed.get(plot.area.worldname);
|
HashMap<PlotId, Plot> map = processed.get(plot.getArea().worldname);
|
||||||
if (map == null) {
|
if (map == null) {
|
||||||
map = new HashMap<>();
|
map = new HashMap<>();
|
||||||
processed.put(plot.area.worldname, map);
|
processed.put(plot.getArea().worldname, map);
|
||||||
}
|
}
|
||||||
map.put(plot.getId(), plot);
|
map.put(plot.getId(), plot);
|
||||||
}
|
}
|
||||||
|
@ -1,16 +1,33 @@
|
|||||||
package com.plotsquared.bukkit.listeners;
|
package com.plotsquared.bukkit.listeners;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import com.intellectualcrafters.plot.PS;
|
||||||
import java.util.Arrays;
|
import com.intellectualcrafters.plot.config.C;
|
||||||
import java.util.HashSet;
|
import com.intellectualcrafters.plot.config.Settings;
|
||||||
import java.util.Iterator;
|
import com.intellectualcrafters.plot.flag.Flag;
|
||||||
import java.util.List;
|
import com.intellectualcrafters.plot.flag.FlagManager;
|
||||||
import java.util.Map.Entry;
|
import com.intellectualcrafters.plot.object.Location;
|
||||||
import java.util.Objects;
|
import com.intellectualcrafters.plot.object.Plot;
|
||||||
import java.util.Set;
|
import com.intellectualcrafters.plot.object.PlotArea;
|
||||||
import java.util.UUID;
|
import com.intellectualcrafters.plot.object.PlotBlock;
|
||||||
import java.util.regex.Pattern;
|
import com.intellectualcrafters.plot.object.PlotHandler;
|
||||||
|
import com.intellectualcrafters.plot.object.PlotId;
|
||||||
|
import com.intellectualcrafters.plot.object.PlotInventory;
|
||||||
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
|
import com.intellectualcrafters.plot.object.StringWrapper;
|
||||||
|
import com.intellectualcrafters.plot.util.EventUtil;
|
||||||
|
import com.intellectualcrafters.plot.util.ExpireManager;
|
||||||
|
import com.intellectualcrafters.plot.util.MainUtil;
|
||||||
|
import com.intellectualcrafters.plot.util.MathMan;
|
||||||
|
import com.intellectualcrafters.plot.util.Permissions;
|
||||||
|
import com.intellectualcrafters.plot.util.RegExUtil;
|
||||||
|
import com.intellectualcrafters.plot.util.StringMan;
|
||||||
|
import com.intellectualcrafters.plot.util.TaskManager;
|
||||||
|
import com.intellectualcrafters.plot.util.UUIDHandler;
|
||||||
|
import com.plotsquared.bukkit.BukkitMain;
|
||||||
|
import com.plotsquared.bukkit.object.BukkitLazyBlock;
|
||||||
|
import com.plotsquared.bukkit.object.BukkitPlayer;
|
||||||
|
import com.plotsquared.bukkit.util.BukkitUtil;
|
||||||
|
import com.plotsquared.listener.PlayerBlockEventType;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
@ -89,34 +106,16 @@ import org.bukkit.projectiles.BlockProjectileSource;
|
|||||||
import org.bukkit.projectiles.ProjectileSource;
|
import org.bukkit.projectiles.ProjectileSource;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.PS;
|
import java.util.ArrayList;
|
||||||
import com.intellectualcrafters.plot.config.C;
|
import java.util.Arrays;
|
||||||
import com.intellectualcrafters.plot.config.Settings;
|
import java.util.HashSet;
|
||||||
import com.intellectualcrafters.plot.flag.Flag;
|
import java.util.Iterator;
|
||||||
import com.intellectualcrafters.plot.flag.FlagManager;
|
import java.util.List;
|
||||||
import com.intellectualcrafters.plot.object.Location;
|
import java.util.Map.Entry;
|
||||||
import com.intellectualcrafters.plot.object.Plot;
|
import java.util.Objects;
|
||||||
import com.intellectualcrafters.plot.object.PlotArea;
|
import java.util.Set;
|
||||||
import com.intellectualcrafters.plot.object.PlotBlock;
|
import java.util.UUID;
|
||||||
import com.intellectualcrafters.plot.object.PlotHandler;
|
import java.util.regex.Pattern;
|
||||||
import com.intellectualcrafters.plot.object.PlotId;
|
|
||||||
import com.intellectualcrafters.plot.object.PlotInventory;
|
|
||||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
|
||||||
import com.intellectualcrafters.plot.object.StringWrapper;
|
|
||||||
import com.intellectualcrafters.plot.util.EventUtil;
|
|
||||||
import com.intellectualcrafters.plot.util.ExpireManager;
|
|
||||||
import com.intellectualcrafters.plot.util.MainUtil;
|
|
||||||
import com.intellectualcrafters.plot.util.MathMan;
|
|
||||||
import com.intellectualcrafters.plot.util.Permissions;
|
|
||||||
import com.intellectualcrafters.plot.util.RegExUtil;
|
|
||||||
import com.intellectualcrafters.plot.util.StringMan;
|
|
||||||
import com.intellectualcrafters.plot.util.TaskManager;
|
|
||||||
import com.intellectualcrafters.plot.util.UUIDHandler;
|
|
||||||
import com.plotsquared.bukkit.BukkitMain;
|
|
||||||
import com.plotsquared.bukkit.object.BukkitLazyBlock;
|
|
||||||
import com.plotsquared.bukkit.object.BukkitPlayer;
|
|
||||||
import com.plotsquared.bukkit.util.BukkitUtil;
|
|
||||||
import com.plotsquared.listener.PlayerBlockEventType;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Player Events involving plots
|
* Player Events involving plots
|
||||||
@ -226,7 +225,6 @@ public class PlayerEvents extends com.plotsquared.listener.PlotListener implemen
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
event.setNewCurrent(0);
|
event.setNewCurrent(0);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -484,66 +482,64 @@ public class PlayerEvents extends com.plotsquared.listener.PlotListener implemen
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Plot now = area.getPlotAbs(loc);
|
Plot now = area.getPlotAbs(loc);
|
||||||
final Plot lastPlot = (Plot) pp.getMeta("lastplot");
|
final Plot lastPlot = pp.getMeta("lastplot");
|
||||||
if (now == null) {
|
if (now == null) {
|
||||||
if ((lastPlot != null) && !plotExit(pp, lastPlot)) {
|
if ((lastPlot != null) && !plotExit(pp, lastPlot)) {
|
||||||
MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_EXIT_DENIED);
|
MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_EXIT_DENIED);
|
||||||
if (lastPlot.equals((BukkitUtil.getLocation(from).getPlot()))) {
|
if (lastPlot.equals((BukkitUtil.getLocation(from).getPlot()))) {
|
||||||
player.teleport(from);
|
player.teleport(from);
|
||||||
} else {
|
} else {
|
||||||
player.teleport(player.getWorld().getSpawnLocation());
|
player.teleport(player.getWorld().getSpawnLocation());
|
||||||
}
|
}
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else if ((lastPlot != null) && now.equals(lastPlot)) {
|
} else if ((lastPlot != null) && now.equals(lastPlot)) {
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
if (!plotEntry(pp, now)) {
|
if (!plotEntry(pp, now)) {
|
||||||
MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_ENTRY_DENIED);
|
MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_ENTRY_DENIED);
|
||||||
if (!now.equals(lastPlot)) {
|
if (!now.equals(lastPlot)) {
|
||||||
player.teleport(from);
|
player.teleport(from);
|
||||||
} else {
|
} else {
|
||||||
player.teleport(player.getWorld().getSpawnLocation());
|
player.teleport(player.getWorld().getSpawnLocation());
|
||||||
}
|
}
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
final Integer border = area.getBorder();;
|
final Integer border = area.getBorder();
|
||||||
if (border != null) {
|
if (x2 > border) {
|
||||||
if (x2 > border) {
|
to.setX(border - 4);
|
||||||
to.setX(border - 4);
|
player.teleport(event.getTo());
|
||||||
player.teleport(event.getTo());
|
MainUtil.sendMessage(pp, C.BORDER);
|
||||||
MainUtil.sendMessage(pp, C.BORDER);
|
return;
|
||||||
return;
|
} else if (x2 < -border) {
|
||||||
} else if (x2 < -border) {
|
to.setX(-border + 4);
|
||||||
to.setX(-border + 4);
|
player.teleport(event.getTo());
|
||||||
player.teleport(event.getTo());
|
MainUtil.sendMessage(pp, C.BORDER);
|
||||||
MainUtil.sendMessage(pp, C.BORDER);
|
return;
|
||||||
return;
|
}
|
||||||
}
|
return;
|
||||||
}
|
}
|
||||||
return;
|
int z2;
|
||||||
}
|
if (MathMan.roundInt(from.getZ()) != (z2 = MathMan.roundInt(to.getZ()))) {
|
||||||
int z2;
|
final Player player = event.getPlayer();
|
||||||
if (MathMan.roundInt(from.getZ()) != (z2 = MathMan.roundInt(to.getZ()))) {
|
final PlotPlayer pp = BukkitUtil.getPlayer(player);
|
||||||
final Player player = event.getPlayer();
|
|
||||||
final PlotPlayer pp = BukkitUtil.getPlayer(player);
|
// Cancel teleport
|
||||||
|
TaskManager.TELEPORT_QUEUE.remove(pp.getName());
|
||||||
// Cancel teleport
|
|
||||||
TaskManager.TELEPORT_QUEUE.remove(pp.getName());
|
// Set last location
|
||||||
|
Location loc = BukkitUtil.getLocation(to);
|
||||||
// Set last location
|
pp.setMeta("location", loc);
|
||||||
Location loc = BukkitUtil.getLocation(to);
|
|
||||||
pp.setMeta("location", loc);
|
PlotArea area = loc.getPlotArea();
|
||||||
|
if (area == null) {
|
||||||
PlotArea area = loc.getPlotArea();
|
return;
|
||||||
if (area == null) {
|
}
|
||||||
return;
|
Plot now = area.getPlotAbs(loc);
|
||||||
}
|
final Plot lastPlot = pp.getMeta("lastplot");
|
||||||
Plot now = area.getPlotAbs(loc);
|
|
||||||
final Plot lastPlot = (Plot) pp.getMeta("lastplot");
|
|
||||||
if (now == null) {
|
if (now == null) {
|
||||||
if ((lastPlot != null) && !plotExit(pp, lastPlot)) {
|
if ((lastPlot != null) && !plotExit(pp, lastPlot)) {
|
||||||
MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_EXIT_DENIED);
|
MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_EXIT_DENIED);
|
||||||
@ -570,7 +566,6 @@ public class PlayerEvents extends com.plotsquared.listener.PlotListener implemen
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
final Integer border = area.getBorder();
|
final Integer border = area.getBorder();
|
||||||
if (border != null) {
|
|
||||||
if (z2 > border) {
|
if (z2 > border) {
|
||||||
to.setZ(border - 4);
|
to.setZ(border - 4);
|
||||||
player.teleport(event.getTo());
|
player.teleport(event.getTo());
|
||||||
@ -582,7 +577,6 @@ public class PlayerEvents extends com.plotsquared.listener.PlotListener implemen
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
||||||
public void onChat(final AsyncPlayerChatEvent event) {
|
public void onChat(final AsyncPlayerChatEvent event) {
|
||||||
@ -713,7 +707,6 @@ public class PlayerEvents extends com.plotsquared.listener.PlotListener implemen
|
|||||||
iter.remove();
|
iter.remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
@ -791,7 +784,6 @@ public class PlayerEvents extends com.plotsquared.listener.PlotListener implemen
|
|||||||
public void onBD(final BlockDamageEvent event) {
|
public void onBD(final BlockDamageEvent event) {
|
||||||
final Player player = event.getPlayer();
|
final Player player = event.getPlayer();
|
||||||
Location loc = BukkitUtil.getLocation(event.getBlock().getLocation());
|
Location loc = BukkitUtil.getLocation(event.getBlock().getLocation());
|
||||||
final String world;
|
|
||||||
if (player == null) {
|
if (player == null) {
|
||||||
if (loc.isPlotRoad()) {
|
if (loc.isPlotRoad()) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
@ -871,7 +863,6 @@ public class PlayerEvents extends com.plotsquared.listener.PlotListener implemen
|
|||||||
final Location loc = BukkitUtil.getLocation(b.getLocation());
|
final Location loc = BukkitUtil.getLocation(b.getLocation());
|
||||||
if (loc.isUnownedPlotArea()) {
|
if (loc.isUnownedPlotArea()) {
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -973,7 +964,6 @@ public class PlayerEvents extends com.plotsquared.listener.PlotListener implemen
|
|||||||
Plot newPlot = area.getOwnedPlot(loc);
|
Plot newPlot = area.getOwnedPlot(loc);
|
||||||
if (!Objects.equals(plot, newPlot)) {
|
if (!Objects.equals(plot, newPlot)) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1269,7 +1259,6 @@ public class PlayerEvents extends com.plotsquared.listener.PlotListener implemen
|
|||||||
}
|
}
|
||||||
if (checkEntity(entity, plot)) {
|
if (checkEntity(entity, plot)) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1557,7 +1546,7 @@ public class PlayerEvents extends com.plotsquared.listener.PlotListener implemen
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Plot now = area.getPlotAbs(loc);
|
Plot now = area.getPlotAbs(loc);
|
||||||
final Plot lastPlot = (Plot) pp.getMeta("lastplot");
|
final Plot lastPlot = pp.getMeta("lastplot");
|
||||||
if (now == null) {
|
if (now == null) {
|
||||||
if ((lastPlot != null) && !plotExit(pp, lastPlot) && tmp_teleport) {
|
if ((lastPlot != null) && !plotExit(pp, lastPlot) && tmp_teleport) {
|
||||||
MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_EXIT_DENIED);
|
MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_EXIT_DENIED);
|
||||||
@ -1598,7 +1587,7 @@ public class PlayerEvents extends com.plotsquared.listener.PlotListener implemen
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
final Integer border = area.getBorder();
|
final Integer border = area.getBorder();
|
||||||
if (border != null && tmp_teleport) {
|
if (tmp_teleport) {
|
||||||
if (x2 > border) {
|
if (x2 > border) {
|
||||||
to.setX(border - 4);
|
to.setX(border - 4);
|
||||||
tmp_teleport = false;
|
tmp_teleport = false;
|
||||||
@ -1629,7 +1618,7 @@ public class PlayerEvents extends com.plotsquared.listener.PlotListener implemen
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Plot now = area.getPlotAbs(loc);
|
Plot now = area.getPlotAbs(loc);
|
||||||
final Plot lastPlot = (Plot) pp.getMeta("lastplot");
|
final Plot lastPlot = pp.getMeta("lastplot");
|
||||||
if (now == null) {
|
if (now == null) {
|
||||||
if ((lastPlot != null) && !plotExit(pp, lastPlot) && tmp_teleport) {
|
if ((lastPlot != null) && !plotExit(pp, lastPlot) && tmp_teleport) {
|
||||||
MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_EXIT_DENIED);
|
MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_EXIT_DENIED);
|
||||||
@ -1670,24 +1659,21 @@ public class PlayerEvents extends com.plotsquared.listener.PlotListener implemen
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
final Integer border = area.getBorder();
|
final Integer border = area.getBorder();
|
||||||
if (border != null && tmp_teleport) {
|
if (tmp_teleport) {
|
||||||
if (z2 > border) {
|
if (z2 > border) {
|
||||||
to.setZ(border - 4);
|
to.setZ(border - 4);
|
||||||
tmp_teleport = false;
|
tmp_teleport = false;
|
||||||
player.teleport(event.getTo());
|
player.teleport(event.getTo());
|
||||||
tmp_teleport = true;
|
tmp_teleport = true;
|
||||||
MainUtil.sendMessage(pp, C.BORDER);
|
MainUtil.sendMessage(pp, C.BORDER);
|
||||||
return;
|
|
||||||
} else if (z2 < -border) {
|
} else if (z2 < -border) {
|
||||||
to.setZ(-border + 4);
|
to.setZ(-border + 4);
|
||||||
tmp_teleport = false;
|
tmp_teleport = false;
|
||||||
player.teleport(event.getTo());
|
player.teleport(event.getTo());
|
||||||
tmp_teleport = true;
|
tmp_teleport = true;
|
||||||
MainUtil.sendMessage(pp, C.BORDER);
|
MainUtil.sendMessage(pp, C.BORDER);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1737,7 +1723,7 @@ public class PlayerEvents extends com.plotsquared.listener.PlotListener implemen
|
|||||||
}
|
}
|
||||||
final Player player = (Player) clicker;
|
final Player player = (Player) clicker;
|
||||||
final PlotPlayer pp = BukkitUtil.getPlayer(player);
|
final PlotPlayer pp = BukkitUtil.getPlayer(player);
|
||||||
final PlotInventory inv = (PlotInventory) pp.getMeta("inventory");
|
final PlotInventory inv = pp.getMeta("inventory");
|
||||||
if ((inv != null) && (event.getRawSlot() == event.getSlot())) {
|
if ((inv != null) && (event.getRawSlot() == event.getSlot())) {
|
||||||
if (!inv.onClick(event.getSlot())) {
|
if (!inv.onClick(event.getSlot())) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
@ -1857,7 +1843,6 @@ public class PlayerEvents extends com.plotsquared.listener.PlotListener implemen
|
|||||||
}
|
}
|
||||||
if (checkEntity(e.getEntity(), plot)) {
|
if (checkEntity(e.getEntity(), plot)) {
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -2154,10 +2139,7 @@ public class PlayerEvents extends com.plotsquared.listener.PlotListener implemen
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
// player is null
|
// player is null
|
||||||
if ((damager instanceof Arrow) && (!(victim instanceof Creature))) {
|
return !((damager instanceof Arrow) && (!(victim instanceof Creature)));
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||||
|
@ -137,43 +137,20 @@ public class BukkitPlayer extends PlotPlayer {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setAttribute(String key) {
|
public void setAttribute(String key) {
|
||||||
key = "plotsquared_user_attributes." + key;
|
setPersistentMeta("attrib_" + key, new byte[]{(byte) 1});
|
||||||
if ((EconHandler.manager == null) || player.hasPermission("plotsquared_user_attributes.*")) {
|
|
||||||
setMeta(key, true);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
EconHandler.manager.setPermission(getName(), key, true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean getAttribute(String key) {
|
public boolean getAttribute(String key) {
|
||||||
key = "plotsquared_user_attributes." + key;
|
if (!hasPersistentMeta(key)) {
|
||||||
if ((EconHandler.manager == null) || player.hasPermission("plotsquared_user_attributes.*")) {
|
return false;
|
||||||
final Object v = getMeta(key);
|
|
||||||
return v == null ? false : (Boolean) v;
|
|
||||||
}
|
}
|
||||||
Permission perm = Bukkit.getServer().getPluginManager().getPermission(key);
|
return getPersistentMeta("attrib_" + key)[0] == 1;
|
||||||
if (perm == null) {
|
|
||||||
try {
|
|
||||||
perm = new Permission(key, PermissionDefault.FALSE);
|
|
||||||
Bukkit.getServer().getPluginManager().addPermission(perm);
|
|
||||||
Bukkit.getServer().getPluginManager().recalculatePermissionDefaults(perm);
|
|
||||||
}
|
|
||||||
catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return player.hasPermission(key);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void removeAttribute(String key) {
|
public void removeAttribute(String key) {
|
||||||
key = "plotsquared_user_attributes." + key;
|
removePersistentMeta("attrib_" + key);
|
||||||
if ((EconHandler.manager == null) || player.hasPermission("plotsquared_user_attributes.*")) {
|
|
||||||
deleteMeta(key);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
EconHandler.manager.setPermission(getName(), key, false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.plotsquared.bukkit.object.entity;
|
package com.plotsquared.bukkit.object.entity;
|
||||||
|
|
||||||
|
import com.intellectualcrafters.plot.PS;
|
||||||
import org.bukkit.Art;
|
import org.bukkit.Art;
|
||||||
import org.bukkit.DyeColor;
|
import org.bukkit.DyeColor;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
@ -31,8 +32,6 @@ import org.bukkit.inventory.ItemStack;
|
|||||||
import org.bukkit.util.EulerAngle;
|
import org.bukkit.util.EulerAngle;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.PS;
|
|
||||||
|
|
||||||
public class EntityWrapper {
|
public class EntityWrapper {
|
||||||
public short id;
|
public short id;
|
||||||
public float yaw;
|
public float yaw;
|
||||||
@ -71,9 +70,7 @@ public class EntityWrapper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void restoreLiving(final LivingEntity entity) {
|
private void restoreLiving(final LivingEntity entity) {
|
||||||
if (lived.loot) {
|
|
||||||
entity.setCanPickupItems(lived.loot);
|
entity.setCanPickupItems(lived.loot);
|
||||||
}
|
|
||||||
if (lived.name != null) {
|
if (lived.name != null) {
|
||||||
entity.setCustomName(lived.name);
|
entity.setCustomName(lived.name);
|
||||||
entity.setCustomNameVisible(lived.visible);
|
entity.setCustomNameVisible(lived.visible);
|
||||||
@ -143,9 +140,7 @@ public class EntityWrapper {
|
|||||||
if (!aged.adult) {
|
if (!aged.adult) {
|
||||||
entity.setBaby();
|
entity.setBaby();
|
||||||
}
|
}
|
||||||
if (aged.locked) {
|
|
||||||
entity.setAgeLock(aged.locked);
|
entity.setAgeLock(aged.locked);
|
||||||
}
|
|
||||||
if (aged.age > 0) {
|
if (aged.age > 0) {
|
||||||
entity.setAge(aged.age);
|
entity.setAge(aged.age);
|
||||||
}
|
}
|
||||||
|
@ -1,13 +1,24 @@
|
|||||||
package com.plotsquared.bukkit.util;
|
package com.plotsquared.bukkit.util;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import com.intellectualcrafters.plot.PS;
|
||||||
import java.util.Collections;
|
import com.intellectualcrafters.plot.generator.AugmentedUtils;
|
||||||
import java.util.HashMap;
|
import com.intellectualcrafters.plot.object.BlockLoc;
|
||||||
import java.util.HashSet;
|
import com.intellectualcrafters.plot.object.ChunkLoc;
|
||||||
import java.util.List;
|
import com.intellectualcrafters.plot.object.Location;
|
||||||
import java.util.Map.Entry;
|
import com.intellectualcrafters.plot.object.Plot;
|
||||||
import java.util.Set;
|
import com.intellectualcrafters.plot.object.PlotArea;
|
||||||
|
import com.intellectualcrafters.plot.object.PlotBlock;
|
||||||
|
import com.intellectualcrafters.plot.object.PlotLoc;
|
||||||
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
|
import com.intellectualcrafters.plot.object.RegionWrapper;
|
||||||
|
import com.intellectualcrafters.plot.object.RunnableVal;
|
||||||
|
import com.intellectualcrafters.plot.util.ChunkManager;
|
||||||
|
import com.intellectualcrafters.plot.util.PlotChunk;
|
||||||
|
import com.intellectualcrafters.plot.util.SetQueue;
|
||||||
|
import com.intellectualcrafters.plot.util.TaskManager;
|
||||||
|
import com.intellectualcrafters.plot.util.UUIDHandler;
|
||||||
|
import com.intellectualcrafters.plot.util.WorldUtil;
|
||||||
|
import com.plotsquared.bukkit.object.entity.EntityWrapper;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Chunk;
|
import org.bukkit.Chunk;
|
||||||
import org.bukkit.DyeColor;
|
import org.bukkit.DyeColor;
|
||||||
@ -42,25 +53,13 @@ import org.bukkit.entity.Player;
|
|||||||
import org.bukkit.inventory.InventoryHolder;
|
import org.bukkit.inventory.InventoryHolder;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.PS;
|
import java.util.ArrayList;
|
||||||
import com.intellectualcrafters.plot.generator.AugmentedUtils;
|
import java.util.Collections;
|
||||||
import com.intellectualcrafters.plot.object.BlockLoc;
|
import java.util.HashMap;
|
||||||
import com.intellectualcrafters.plot.object.ChunkLoc;
|
import java.util.HashSet;
|
||||||
import com.intellectualcrafters.plot.object.Location;
|
import java.util.List;
|
||||||
import com.intellectualcrafters.plot.object.Plot;
|
import java.util.Map.Entry;
|
||||||
import com.intellectualcrafters.plot.object.PlotArea;
|
import java.util.Set;
|
||||||
import com.intellectualcrafters.plot.object.PlotBlock;
|
|
||||||
import com.intellectualcrafters.plot.object.PlotLoc;
|
|
||||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
|
||||||
import com.intellectualcrafters.plot.object.RegionWrapper;
|
|
||||||
import com.intellectualcrafters.plot.object.RunnableVal;
|
|
||||||
import com.intellectualcrafters.plot.util.ChunkManager;
|
|
||||||
import com.intellectualcrafters.plot.util.PlotChunk;
|
|
||||||
import com.intellectualcrafters.plot.util.SetQueue;
|
|
||||||
import com.intellectualcrafters.plot.util.TaskManager;
|
|
||||||
import com.intellectualcrafters.plot.util.UUIDHandler;
|
|
||||||
import com.intellectualcrafters.plot.util.WorldUtil;
|
|
||||||
import com.plotsquared.bukkit.object.entity.EntityWrapper;
|
|
||||||
|
|
||||||
public class BukkitChunkManager extends ChunkManager {
|
public class BukkitChunkManager extends ChunkManager {
|
||||||
@Override
|
@Override
|
||||||
@ -1026,7 +1025,7 @@ public class BukkitChunkManager extends ChunkManager {
|
|||||||
@Override
|
@Override
|
||||||
public int[] countEntities(final Plot plot) {
|
public int[] countEntities(final Plot plot) {
|
||||||
final int[] count = new int[6];
|
final int[] count = new int[6];
|
||||||
PlotArea area = plot.area;
|
PlotArea area = plot.getArea();
|
||||||
final World world = BukkitUtil.getWorld(area.worldname);
|
final World world = BukkitUtil.getWorld(area.worldname);
|
||||||
|
|
||||||
final Location bot = plot.getBottomAbs();
|
final Location bot = plot.getBottomAbs();
|
||||||
|
@ -1,13 +1,5 @@
|
|||||||
package com.plotsquared.bukkit.util;
|
package com.plotsquared.bukkit.util;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.event.Cancellable;
|
|
||||||
import org.bukkit.event.Event;
|
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.flag.Flag;
|
import com.intellectualcrafters.plot.flag.Flag;
|
||||||
import com.intellectualcrafters.plot.object.Location;
|
import com.intellectualcrafters.plot.object.Location;
|
||||||
import com.intellectualcrafters.plot.object.Plot;
|
import com.intellectualcrafters.plot.object.Plot;
|
||||||
@ -33,6 +25,13 @@ import com.plotsquared.bukkit.events.PlotMergeEvent;
|
|||||||
import com.plotsquared.bukkit.events.PlotRateEvent;
|
import com.plotsquared.bukkit.events.PlotRateEvent;
|
||||||
import com.plotsquared.bukkit.events.PlotUnlinkEvent;
|
import com.plotsquared.bukkit.events.PlotUnlinkEvent;
|
||||||
import com.plotsquared.bukkit.object.BukkitPlayer;
|
import com.plotsquared.bukkit.object.BukkitPlayer;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.Cancellable;
|
||||||
|
import org.bukkit.event.Event;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
public class BukkitEventUtil extends EventUtil {
|
public class BukkitEventUtil extends EventUtil {
|
||||||
|
|
||||||
@ -83,7 +82,7 @@ public class BukkitEventUtil extends EventUtil {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean callMerge(final Plot plot, final ArrayList<PlotId> plots) {
|
public boolean callMerge(final Plot plot, final ArrayList<PlotId> plots) {
|
||||||
return callEvent(new PlotMergeEvent(BukkitUtil.getWorld(plot.area.worldname), plot, plots));
|
return callEvent(new PlotMergeEvent(BukkitUtil.getWorld(plot.getArea().worldname), plot, plots));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -2,18 +2,6 @@ package com.plotsquared.bukkit.util;
|
|||||||
|
|
||||||
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.HashMap;
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map.Entry;
|
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.Chunk;
|
|
||||||
import org.bukkit.World;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.PS;
|
import com.intellectualcrafters.plot.PS;
|
||||||
import com.intellectualcrafters.plot.object.ChunkLoc;
|
import com.intellectualcrafters.plot.object.ChunkLoc;
|
||||||
import com.intellectualcrafters.plot.object.Location;
|
import com.intellectualcrafters.plot.object.Location;
|
||||||
@ -26,10 +14,22 @@ import com.intellectualcrafters.plot.util.ReflectionUtils.RefMethod;
|
|||||||
import com.intellectualcrafters.plot.util.TaskManager;
|
import com.intellectualcrafters.plot.util.TaskManager;
|
||||||
import com.intellectualcrafters.plot.util.UUIDHandler;
|
import com.intellectualcrafters.plot.util.UUIDHandler;
|
||||||
import com.plotsquared.bukkit.object.BukkitPlayer;
|
import com.plotsquared.bukkit.object.BukkitPlayer;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.Chunk;
|
||||||
|
import org.bukkit.World;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An utility that can be used to send chunks, rather than using bukkit code to do so (uses heavy NMS)
|
* An utility that can be used to send chunks, rather than using bukkit code to do so (uses heavy NMS)
|
||||||
*
|
*
|
||||||
|
|
||||||
*/
|
*/
|
||||||
public class SendChunk {
|
public class SendChunk {
|
||||||
|
|
||||||
@ -83,7 +83,7 @@ public class SendChunk {
|
|||||||
Location loc = null;
|
Location loc = null;
|
||||||
String world;
|
String world;
|
||||||
if (plot != null) {
|
if (plot != null) {
|
||||||
world = plot.area.worldname;
|
world = plot.getArea().worldname;
|
||||||
} else {
|
} else {
|
||||||
loc = pp.getLocation();
|
loc = pp.getLocation();
|
||||||
world = loc.getWorld();
|
world = loc.getWorld();
|
||||||
|
@ -2,16 +2,6 @@ package com.plotsquared.bukkit.util.block;
|
|||||||
|
|
||||||
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.HashMap;
|
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.Map.Entry;
|
|
||||||
|
|
||||||
import org.bukkit.Chunk;
|
|
||||||
import org.bukkit.World;
|
|
||||||
import org.bukkit.block.Biome;
|
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.object.ChunkLoc;
|
import com.intellectualcrafters.plot.object.ChunkLoc;
|
||||||
import com.intellectualcrafters.plot.object.PlotBlock;
|
import com.intellectualcrafters.plot.object.PlotBlock;
|
||||||
import com.intellectualcrafters.plot.util.MainUtil;
|
import com.intellectualcrafters.plot.util.MainUtil;
|
||||||
@ -23,6 +13,15 @@ import com.intellectualcrafters.plot.util.SetQueue.ChunkWrapper;
|
|||||||
import com.intellectualcrafters.plot.util.TaskManager;
|
import com.intellectualcrafters.plot.util.TaskManager;
|
||||||
import com.plotsquared.bukkit.util.BukkitUtil;
|
import com.plotsquared.bukkit.util.BukkitUtil;
|
||||||
import com.plotsquared.bukkit.util.SendChunk;
|
import com.plotsquared.bukkit.util.SendChunk;
|
||||||
|
import org.bukkit.Chunk;
|
||||||
|
import org.bukkit.World;
|
||||||
|
import org.bukkit.block.Biome;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
public class FastQueue_1_7 extends SlowQueue {
|
public class FastQueue_1_7 extends SlowQueue {
|
||||||
|
|
||||||
@ -54,7 +53,7 @@ public class FastQueue_1_7 extends SlowQueue {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int count = 0;
|
int count = 0;
|
||||||
final ArrayList<Chunk> chunks = new ArrayList<Chunk>();
|
final ArrayList<Chunk> chunks = new ArrayList<>();
|
||||||
final Iterator<Entry<ChunkWrapper, Chunk>> i = toUpdate.entrySet().iterator();
|
final Iterator<Entry<ChunkWrapper, Chunk>> i = toUpdate.entrySet().iterator();
|
||||||
while (i.hasNext() && (count < 128)) {
|
while (i.hasNext() && (count < 128)) {
|
||||||
chunks.add(i.next().getValue());
|
chunks.add(i.next().getValue());
|
||||||
@ -145,7 +144,7 @@ public class FastQueue_1_7 extends SlowQueue {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* This should be overriden by any specialized queues
|
* This should be overriden by any specialized queues
|
||||||
* @param pc
|
* @param wrap
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public PlotChunk<Chunk> getChunk(ChunkWrapper wrap) {
|
public PlotChunk<Chunk> getChunk(ChunkWrapper wrap) {
|
||||||
@ -154,7 +153,8 @@ public class FastQueue_1_7 extends SlowQueue {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* This should be overriden by any specialized queues
|
* This should be overriden by any specialized queues
|
||||||
* @param pc
|
* @param chunk
|
||||||
|
* @param fixAll
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean fixLighting(PlotChunk<Chunk> chunk, boolean fixAll) {
|
public boolean fixLighting(PlotChunk<Chunk> chunk, boolean fixAll) {
|
||||||
@ -165,7 +165,8 @@ public class FastQueue_1_7 extends SlowQueue {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* This should be overriden by any specialized queues
|
* This should be overriden by any specialized queues
|
||||||
* @param pc
|
* @param world
|
||||||
|
* @param locs
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void sendChunk(String world, Collection<ChunkLoc> locs) {
|
public void sendChunk(String world, Collection<ChunkLoc> locs) {
|
||||||
|
@ -2,22 +2,6 @@ package com.plotsquared.bukkit.util.block;
|
|||||||
|
|
||||||
import static com.intellectualcrafters.plot.util.ReflectionUtils.getRefClass;
|
import static com.intellectualcrafters.plot.util.ReflectionUtils.getRefClass;
|
||||||
|
|
||||||
import java.lang.reflect.Field;
|
|
||||||
import java.lang.reflect.Method;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map.Entry;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import org.bukkit.Chunk;
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.World;
|
|
||||||
import org.bukkit.World.Environment;
|
|
||||||
import org.bukkit.block.Biome;
|
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.object.ChunkLoc;
|
import com.intellectualcrafters.plot.object.ChunkLoc;
|
||||||
import com.intellectualcrafters.plot.object.PseudoRandom;
|
import com.intellectualcrafters.plot.object.PseudoRandom;
|
||||||
import com.intellectualcrafters.plot.util.ChunkManager;
|
import com.intellectualcrafters.plot.util.ChunkManager;
|
||||||
@ -33,6 +17,21 @@ import com.intellectualcrafters.plot.util.SetQueue.ChunkWrapper;
|
|||||||
import com.intellectualcrafters.plot.util.TaskManager;
|
import com.intellectualcrafters.plot.util.TaskManager;
|
||||||
import com.plotsquared.bukkit.util.BukkitUtil;
|
import com.plotsquared.bukkit.util.BukkitUtil;
|
||||||
import com.plotsquared.bukkit.util.SendChunk;
|
import com.plotsquared.bukkit.util.SendChunk;
|
||||||
|
import org.bukkit.Chunk;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.World;
|
||||||
|
import org.bukkit.World.Environment;
|
||||||
|
import org.bukkit.block.Biome;
|
||||||
|
|
||||||
|
import java.lang.reflect.Field;
|
||||||
|
import java.lang.reflect.Method;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map.Entry;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
public class FastQueue_1_8_3 extends SlowQueue {
|
public class FastQueue_1_8_3 extends SlowQueue {
|
||||||
|
|
||||||
@ -209,10 +208,6 @@ public class FastQueue_1_8_3 extends SlowQueue {
|
|||||||
boolean fill = true;
|
boolean fill = true;
|
||||||
for (int k = 0; k < newArray.length; k++) {
|
for (int k = 0; k < newArray.length; k++) {
|
||||||
final char n = newArray[k];
|
final char n = newArray[k];
|
||||||
if (n == 0) {
|
|
||||||
fill = false;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
switch (n) {
|
switch (n) {
|
||||||
case 0:
|
case 0:
|
||||||
fill = false;
|
fill = false;
|
||||||
@ -263,7 +258,7 @@ public class FastQueue_1_8_3 extends SlowQueue {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* This should be overriden by any specialized queues
|
* This should be overriden by any specialized queues
|
||||||
* @param pc
|
* @param wrap
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public PlotChunk<Chunk> getChunk(ChunkWrapper wrap) {
|
public PlotChunk<Chunk> getChunk(ChunkWrapper wrap) {
|
||||||
@ -415,7 +410,8 @@ public class FastQueue_1_8_3 extends SlowQueue {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* This should be overriden by any specialized queues
|
* This should be overriden by any specialized queues
|
||||||
* @param pc
|
* @param world
|
||||||
|
* @param locs
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void sendChunk(String world, Collection<ChunkLoc> locs) {
|
public void sendChunk(String world, Collection<ChunkLoc> locs) {
|
||||||
|
@ -20,10 +20,6 @@
|
|||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
package com.plotsquared.listener;
|
package com.plotsquared.listener;
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.config.C;
|
import com.intellectualcrafters.plot.config.C;
|
||||||
import com.intellectualcrafters.plot.config.Settings;
|
import com.intellectualcrafters.plot.config.Settings;
|
||||||
import com.intellectualcrafters.plot.flag.Flag;
|
import com.intellectualcrafters.plot.flag.Flag;
|
||||||
@ -45,6 +41,10 @@ import com.intellectualcrafters.plot.util.StringMan;
|
|||||||
import com.intellectualcrafters.plot.util.TaskManager;
|
import com.intellectualcrafters.plot.util.TaskManager;
|
||||||
import com.intellectualcrafters.plot.util.UUIDHandler;
|
import com.intellectualcrafters.plot.util.UUIDHandler;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
||||||
|
|
||||||
@ -168,7 +168,7 @@ public class PlotListener {
|
|||||||
final Map<String, String> replacements = new HashMap<>();
|
final Map<String, String> replacements = new HashMap<>();
|
||||||
replacements.put("%x%", lastPlot.getId().x + "");
|
replacements.put("%x%", lastPlot.getId().x + "");
|
||||||
replacements.put("%z%", lastPlot.getId().y + "");
|
replacements.put("%z%", lastPlot.getId().y + "");
|
||||||
replacements.put("%world%", plot.area.toString());
|
replacements.put("%world%", plot.getArea().toString());
|
||||||
replacements.put("%greeting%", greeting);
|
replacements.put("%greeting%", greeting);
|
||||||
replacements.put("%alias", plot.toString());
|
replacements.put("%alias", plot.toString());
|
||||||
replacements.put("%s", MainUtil.getName(plot.owner));
|
replacements.put("%s", MainUtil.getName(plot.owner));
|
||||||
|
Loading…
Reference in New Issue
Block a user