mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2025-06-25 02:04:44 +02:00
Refactor BlockVector2
This commit is contained in:
@ -19,7 +19,15 @@ import com.github.intellectualsites.plotsquared.plot.util.StringMan;
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
public abstract class Command {
|
||||
|
@ -1,6 +1,11 @@
|
||||
package com.github.intellectualsites.plotsquared.configuration;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* A type of {@link ConfigurationSection} that is stored in memory.
|
||||
|
@ -4,7 +4,16 @@ import com.github.intellectualsites.plotsquared.configuration.Configuration;
|
||||
import com.github.intellectualsites.plotsquared.configuration.InvalidConfigurationException;
|
||||
import com.github.intellectualsites.plotsquared.configuration.MemoryConfiguration;
|
||||
|
||||
import java.io.*;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.io.Reader;
|
||||
import java.io.Writer;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
@ -7,8 +7,15 @@ import java.lang.reflect.Field;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.util.*;
|
||||
import java.util.Collection;
|
||||
import java.util.Enumeration;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.ResourceBundle;
|
||||
import java.util.Set;
|
||||
import java.util.stream.IntStream;
|
||||
|
||||
/**
|
||||
@ -554,7 +561,9 @@ public class JSONObject {
|
||||
return new JSONObject((Map<String, Object>) object);
|
||||
}
|
||||
Package objectPackage = object.getClass().getPackage();
|
||||
|
||||
String objectPackageName = objectPackage != null ? objectPackage.getName() : "";
|
||||
|
||||
if (objectPackageName.startsWith("java.") || objectPackageName.startsWith("javax.") || (
|
||||
object.getClass().getClassLoader() == null)) {
|
||||
return object.toString();
|
||||
|
@ -1,6 +1,11 @@
|
||||
package com.github.intellectualsites.plotsquared.json;
|
||||
|
||||
import java.io.*;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.Reader;
|
||||
import java.io.StringReader;
|
||||
|
||||
/**
|
||||
* A JSONTokener takes a source string and extracts characters and tokens from it. It is used by the JSONObject and
|
||||
|
@ -6,7 +6,17 @@ import com.github.intellectualsites.plotsquared.plot.generator.IndependentPlotGe
|
||||
import com.github.intellectualsites.plotsquared.plot.logger.ILogger;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.BlockRegistry;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.*;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.ChatManager;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.ChunkManager;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.EconHandler;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.EventUtil;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.InventoryUtil;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.LegacyMappings;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.SchematicHandler;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.SetupUtils;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.TaskManager;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.UUIDHandlerImplementation;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.WorldUtil;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.block.QueueProvider;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
|
@ -20,12 +20,39 @@ import com.github.intellectualsites.plotsquared.plot.generator.HybridUtils;
|
||||
import com.github.intellectualsites.plotsquared.plot.generator.IndependentPlotGenerator;
|
||||
import com.github.intellectualsites.plotsquared.plot.listener.WESubscriber;
|
||||
import com.github.intellectualsites.plotsquared.plot.logger.ILogger;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.*;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.BlockBucket;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.Location;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.Plot;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotArea;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotBlock;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotCluster;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotFilter;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotId;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotManager;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.RegionWrapper;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.StringWrapper;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.worlds.DefaultPlotAreaManager;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.worlds.PlotAreaManager;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.worlds.SinglePlotArea;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.worlds.SinglePlotAreaManager;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.*;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.ChatManager;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.ChunkManager;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.CommentManager;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.EconHandler;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.EventUtil;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.InventoryUtil;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.LegacyConverter;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.MathMan;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.ReflectionUtils;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.SchematicHandler;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.SetupUtils;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.StringMan;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.TaskManager;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.UUIDHandler;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.UpdateUtility;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.WorldUtil;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.block.GlobalBlockQueue;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.expiry.ExpireManager;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.expiry.ExpiryTask;
|
||||
@ -35,15 +62,37 @@ import lombok.NonNull;
|
||||
import lombok.Setter;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.io.*;
|
||||
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.MalformedURLException;
|
||||
import java.net.URISyntaxException;
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
import java.nio.file.Files;
|
||||
import java.sql.SQLException;
|
||||
import java.util.*;
|
||||
import java.util.ArrayDeque;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Objects;
|
||||
import java.util.Properties;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
|
@ -7,8 +7,24 @@ import com.github.intellectualsites.plotsquared.plot.config.Captions;
|
||||
import com.github.intellectualsites.plotsquared.plot.config.Configuration;
|
||||
import com.github.intellectualsites.plotsquared.plot.generator.AugmentedUtils;
|
||||
import com.github.intellectualsites.plotsquared.plot.generator.HybridPlotWorld;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.*;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.*;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.Location;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotArea;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotId;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotMessage;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.RegionWrapper;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.RunnableVal;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.RunnableVal3;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.SetupObject;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.ChunkManager;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.CmdConfirm;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.MathMan;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.Permissions;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.SetupUtils;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.StringMan;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.WorldUtil;
|
||||
import com.sk89q.worldedit.math.BlockVector2;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
@ -120,10 +136,10 @@ import java.util.Set;
|
||||
player.teleport(WorldUtil.IMP.getSpawn(world));
|
||||
if (area.TERRAIN != 3) {
|
||||
ChunkManager.largeRegionTask(world, region,
|
||||
new RunnableVal<ChunkLoc>() {
|
||||
@Override public void run(ChunkLoc value) {
|
||||
new RunnableVal<BlockVector2>() {
|
||||
@Override public void run(BlockVector2 value) {
|
||||
AugmentedUtils
|
||||
.generate(world, value.x, value.z,
|
||||
.generate(world, value.getX(), value.getZ(),
|
||||
null);
|
||||
}
|
||||
}, null);
|
||||
@ -415,9 +431,9 @@ import java.util.Set;
|
||||
return false;
|
||||
}
|
||||
ChunkManager
|
||||
.largeRegionTask(area.worldname, area.getRegion(), new RunnableVal<ChunkLoc>() {
|
||||
@Override public void run(ChunkLoc value) {
|
||||
AugmentedUtils.generate(area.worldname, value.x, value.z, null);
|
||||
.largeRegionTask(area.worldname, area.getRegion(), new RunnableVal<BlockVector2>() {
|
||||
@Override public void run(BlockVector2 value) {
|
||||
AugmentedUtils.generate(area.worldname, value.getX(), value.getZ(), null);
|
||||
}
|
||||
}, () -> player.sendMessage("Regen complete"));
|
||||
return true;
|
||||
|
@ -5,14 +5,20 @@ import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||
import com.github.intellectualsites.plotsquared.plot.config.Captions;
|
||||
import com.github.intellectualsites.plotsquared.plot.config.Settings;
|
||||
import com.github.intellectualsites.plotsquared.plot.database.DBFunc;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.*;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.Direction;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.Expression;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.Plot;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotArea;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotId;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.RunnableVal;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.ByteArrayUtilities;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.EconHandler;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.Permissions;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.TaskManager;
|
||||
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
@CommandDeclaration(command = "auto", permission = "plots.auto",
|
||||
|
@ -4,7 +4,13 @@ import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
||||
import com.github.intellectualsites.plotsquared.plot.config.Captions;
|
||||
import com.github.intellectualsites.plotsquared.plot.config.Settings;
|
||||
import com.github.intellectualsites.plotsquared.plot.database.DBFunc;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.*;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.Direction;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.Expression;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.Location;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.Plot;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotArea;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.RunnableVal;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.ByteArrayUtilities;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.EconHandler;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.Permissions;
|
||||
|
@ -5,7 +5,13 @@ import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||
import com.github.intellectualsites.plotsquared.plot.config.Captions;
|
||||
import com.github.intellectualsites.plotsquared.plot.config.Settings;
|
||||
import com.github.intellectualsites.plotsquared.plot.database.DBFunc;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.*;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.BlockLoc;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.Location;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.Plot;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotArea;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotCluster;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotId;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.Permissions;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.UUIDHandler;
|
||||
|
@ -4,12 +4,19 @@ import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||
import com.github.intellectualsites.plotsquared.plot.config.Captions;
|
||||
import com.github.intellectualsites.plotsquared.plot.database.DBFunc;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.*;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.Location;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.Plot;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotArea;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotId;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotManager;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.StringWrapper;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.ChunkManager;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.UUIDHandler;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.WorldUtil;
|
||||
import com.google.common.collect.BiMap;
|
||||
import com.sk89q.worldedit.math.BlockVector2;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Map;
|
||||
@ -55,7 +62,7 @@ public class DebugClaimTest extends SubCommand {
|
||||
continue;
|
||||
}
|
||||
Location location = manager.getSignLoc(plot);
|
||||
ChunkLoc chunk = new ChunkLoc(location.getX() >> 4, location.getZ() >> 4);
|
||||
BlockVector2 chunk = BlockVector2.at(location.getX() >> 4, location.getZ() >> 4);
|
||||
ChunkManager.manager.loadChunk(area.worldname, chunk, false).thenRun(() -> {
|
||||
String[] lines = WorldUtil.IMP.getSign(location);
|
||||
if (lines != null) {
|
||||
|
@ -10,8 +10,29 @@ import com.github.intellectualsites.plotsquared.plot.flag.Flag;
|
||||
import com.github.intellectualsites.plotsquared.plot.flag.FlagManager;
|
||||
import com.github.intellectualsites.plotsquared.plot.generator.HybridUtils;
|
||||
import com.github.intellectualsites.plotsquared.plot.listener.WEManager;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.*;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.*;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.ConsolePlayer;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.Location;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.OfflinePlotPlayer;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.Plot;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotArea;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotBlock;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotId;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotMessage;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.RunnableVal;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.RunnableVal2;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.RunnableVal3;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.ChunkManager;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.EconHandler;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.EventUtil;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.MathMan;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.SchematicHandler;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.SetupUtils;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.StringMan;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.TaskManager;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.UUIDHandler;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.WorldUtil;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.block.GlobalBlockQueue;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.expiry.ExpireManager;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.expiry.PlotAnalysis;
|
||||
|
@ -22,7 +22,16 @@ import com.github.intellectualsites.plotsquared.plot.util.PlotWeather;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.StringComparison;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.StringMan;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
@CommandDeclaration(command = "setflag", aliases = {"f", "flag",
|
||||
"setflag"}, usage = "/plot flag <set|remove|add|list|info> <flag> <value>", description = "Set plot flags", category = CommandCategory.SETTINGS, requiredType = RequiredType.NONE, permission = "plots.flag")
|
||||
|
@ -14,7 +14,11 @@ import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.Permissions;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.TaskManager;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
@CommandDeclaration(command = "like", permission = "plots.like", description = "Like the plot",
|
||||
usage = "/plot like [next|purge]", category = CommandCategory.INFO,
|
||||
|
@ -11,7 +11,13 @@ import com.github.intellectualsites.plotsquared.plot.object.PlotMessage;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.Rating;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.RunnableVal3;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.*;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.EconHandler;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.MathMan;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.Permissions;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.StringComparison;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.StringMan;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.UUIDHandler;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.expiry.ExpireManager;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@ -5,7 +5,14 @@ import com.github.intellectualsites.plotsquared.commands.CommandCaller;
|
||||
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
||||
import com.github.intellectualsites.plotsquared.plot.config.Captions;
|
||||
import com.github.intellectualsites.plotsquared.plot.config.Settings;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.*;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.ConsolePlayer;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.Expression;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.Location;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.Plot;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotArea;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.RunnableVal2;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.RunnableVal3;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.CmdConfirm;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.EconHandler;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.Permissions;
|
||||
|
@ -7,8 +7,16 @@ import com.github.intellectualsites.plotsquared.plot.config.Captions;
|
||||
import com.github.intellectualsites.plotsquared.plot.config.Settings;
|
||||
import com.github.intellectualsites.plotsquared.plot.database.DBFunc;
|
||||
import com.github.intellectualsites.plotsquared.plot.flag.Flags;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.*;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.*;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.Plot;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotInventory;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotItemStack;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.Rating;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.EventUtil;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.MathMan;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.Permissions;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.TaskManager;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
@ -43,7 +43,7 @@ import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
|
||||
MainUtil.sendMessage(player, Captions.NOT_VALID_PLOT_WORLD);
|
||||
return false;
|
||||
}
|
||||
//Set<ChunkLoc> chunks = ChunkManager.manager.getChunkChunks(name);
|
||||
//Set<BlockVector2> chunks = ChunkManager.manager.getChunkChunks(name);
|
||||
MainUtil
|
||||
.sendMessage(player, "&cIf no schematic is set, the following will not do anything");
|
||||
MainUtil.sendMessage(player,
|
||||
|
@ -3,7 +3,11 @@ package com.github.intellectualsites.plotsquared.plot.commands;
|
||||
import com.github.intellectualsites.plotsquared.commands.Command;
|
||||
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
||||
import com.github.intellectualsites.plotsquared.plot.config.Captions;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.*;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.Plot;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.RunnableVal;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.RunnableVal2;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.RunnableVal3;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.ChunkManager;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.block.LocalBlockQueue;
|
||||
|
||||
|
@ -3,7 +3,11 @@ package com.github.intellectualsites.plotsquared.plot.commands;
|
||||
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||
import com.github.intellectualsites.plotsquared.plot.config.Captions;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.*;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.Location;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.Plot;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotId;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.RunnableVal;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.Permissions;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.SchematicHandler;
|
||||
|
@ -15,11 +15,23 @@ import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.SetupUtils;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.StringMan;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.WorldUtil;
|
||||
import lombok.*;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.NonNull;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.ToString;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.UUID;
|
||||
|
||||
@CommandDeclaration(command = "setup", permission = "plots.admin.command.setup",
|
||||
description = "Setup wizard for plot worlds", usage = "/plot setup", aliases = {"create"},
|
||||
|
@ -8,14 +8,21 @@ import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||
import com.github.intellectualsites.plotsquared.plot.config.Captions;
|
||||
import com.github.intellectualsites.plotsquared.plot.config.ConfigurationNode;
|
||||
import com.github.intellectualsites.plotsquared.plot.config.Settings;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.*;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.FileBytes;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotArea;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotManager;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.SetupObject;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.SetupUtils;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.TaskManager;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.WorldUtil;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.block.GlobalBlockQueue;
|
||||
|
||||
import java.io.*;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.Set;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipInputStream;
|
||||
|
@ -3,7 +3,12 @@ package com.github.intellectualsites.plotsquared.plot.commands;
|
||||
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||
import com.github.intellectualsites.plotsquared.plot.config.Captions;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.*;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.Location;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.Plot;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.RegionWrapper;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.RunnableVal;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.RunnableVal2;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.ChunkManager;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.TaskManager;
|
||||
@ -11,6 +16,7 @@ import com.github.intellectualsites.plotsquared.plot.util.WorldUtil;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.block.GlobalBlockQueue;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.block.LocalBlockQueue;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.expiry.ExpireManager;
|
||||
import com.sk89q.worldedit.math.BlockVector2;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
@ -31,7 +37,7 @@ import java.util.Set;
|
||||
public static ArrayList<Plot> expired = null;
|
||||
private static volatile boolean TASK = false;
|
||||
|
||||
public static boolean getBulkRegions(final ArrayList<ChunkLoc> empty, final String world,
|
||||
public static boolean getBulkRegions(final ArrayList<BlockVector2> empty, final String world,
|
||||
final Runnable whenDone) {
|
||||
if (Trim.TASK) {
|
||||
return false;
|
||||
@ -71,7 +77,7 @@ import java.util.Set;
|
||||
String[] split = name.split("\\.");
|
||||
int x = Integer.parseInt(split[1]);
|
||||
int z = Integer.parseInt(split[2]);
|
||||
ChunkLoc loc = new ChunkLoc(x, z);
|
||||
BlockVector2 loc = BlockVector2.at(x, z);
|
||||
empty.add(loc);
|
||||
} catch (NumberFormatException ignored) {
|
||||
PlotSquared.debug("INVALID MCA: " + name);
|
||||
@ -90,7 +96,7 @@ import java.util.Set;
|
||||
* @return
|
||||
*/
|
||||
public static boolean getTrimRegions(String world,
|
||||
final RunnableVal2<Set<ChunkLoc>, Set<ChunkLoc>> result) {
|
||||
final RunnableVal2<Set<BlockVector2>, Set<BlockVector2>> result) {
|
||||
if (result == null) {
|
||||
return false;
|
||||
}
|
||||
@ -114,7 +120,7 @@ import java.util.Set;
|
||||
int ccz2 = pos2.getZ() >> 9;
|
||||
for (int x = ccx1; x <= ccx2; x++) {
|
||||
for (int z = ccz1; z <= ccz2; z++) {
|
||||
ChunkLoc loc = new ChunkLoc(x, z);
|
||||
BlockVector2 loc = BlockVector2.at(x, z);
|
||||
if (result.value1.remove(loc)) {
|
||||
result.value2.add(loc);
|
||||
}
|
||||
@ -141,8 +147,8 @@ import java.util.Set;
|
||||
}
|
||||
Trim.TASK = true;
|
||||
final boolean regen = args.length == 2 && Boolean.parseBoolean(args[1]);
|
||||
getTrimRegions(world, new RunnableVal2<Set<ChunkLoc>, Set<ChunkLoc>>() {
|
||||
@Override public void run(Set<ChunkLoc> viable, final Set<ChunkLoc> nonViable) {
|
||||
getTrimRegions(world, new RunnableVal2<Set<BlockVector2>, Set<BlockVector2>>() {
|
||||
@Override public void run(Set<BlockVector2> viable, final Set<BlockVector2> nonViable) {
|
||||
Runnable regenTask;
|
||||
if (regen) {
|
||||
PlotSquared.log("Starting regen task:");
|
||||
@ -155,16 +161,16 @@ import java.util.Set;
|
||||
player.sendMessage("Trim done!");
|
||||
return;
|
||||
}
|
||||
Iterator<ChunkLoc> iterator = nonViable.iterator();
|
||||
ChunkLoc mcr = iterator.next();
|
||||
Iterator<BlockVector2> iterator = nonViable.iterator();
|
||||
BlockVector2 mcr = iterator.next();
|
||||
iterator.remove();
|
||||
int cbx = mcr.x << 5;
|
||||
int cbz = mcr.z << 5;
|
||||
int cbx = mcr.getX() << 5;
|
||||
int cbz = mcr.getZ() << 5;
|
||||
// get all 1024 chunks
|
||||
HashSet<ChunkLoc> chunks = new HashSet<>();
|
||||
HashSet<BlockVector2> chunks = new HashSet<>();
|
||||
for (int x = cbx; x < cbx + 32; x++) {
|
||||
for (int z = cbz; z < cbz + 32; z++) {
|
||||
ChunkLoc loc = new ChunkLoc(x, z);
|
||||
BlockVector2 loc = BlockVector2.at(x, z);
|
||||
chunks.add(loc);
|
||||
}
|
||||
}
|
||||
@ -182,16 +188,16 @@ import java.util.Set;
|
||||
}
|
||||
for (int x = plotReg.minX >> 4; x <= plotReg.maxX >> 4; x++) {
|
||||
for (int z = plotReg.minZ >> 4; z <= plotReg.maxZ >> 4; z++) {
|
||||
ChunkLoc loc = new ChunkLoc(x, z);
|
||||
BlockVector2 loc = BlockVector2.at(x, z);
|
||||
chunks.remove(loc);
|
||||
}
|
||||
}
|
||||
}
|
||||
final LocalBlockQueue queue =
|
||||
GlobalBlockQueue.IMP.getNewQueue(world, false);
|
||||
TaskManager.objectTask(chunks, new RunnableVal<ChunkLoc>() {
|
||||
@Override public void run(ChunkLoc value) {
|
||||
queue.regenChunk(value.x, value.z);
|
||||
TaskManager.objectTask(chunks, new RunnableVal<BlockVector2>() {
|
||||
@Override public void run(BlockVector2 value) {
|
||||
queue.regenChunk(value.getX(), value.getZ());
|
||||
}
|
||||
}, this);
|
||||
}
|
||||
|
@ -6,13 +6,21 @@ import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||
import com.github.intellectualsites.plotsquared.plot.config.Captions;
|
||||
import com.github.intellectualsites.plotsquared.plot.config.Settings;
|
||||
import com.github.intellectualsites.plotsquared.plot.flag.Flags;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.*;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.Plot;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotArea;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.RunnableVal2;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.RunnableVal3;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.MathMan;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.Permissions;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.UUIDHandler;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
@CommandDeclaration(command = "visit", permission = "plots.visit",
|
||||
|
@ -14,7 +14,11 @@ import java.lang.annotation.Target;
|
||||
import java.lang.invoke.MethodHandles;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.util.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class Config {
|
||||
|
||||
|
@ -3,7 +3,11 @@ package com.github.intellectualsites.plotsquared.plot.database;
|
||||
import com.github.intellectualsites.plotsquared.plot.config.Storage;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.StringMan;
|
||||
|
||||
import java.sql.*;
|
||||
import java.sql.Connection;
|
||||
import java.sql.DriverManager;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Statement;
|
||||
|
||||
/**
|
||||
* Connects to and uses a MySQL database
|
||||
|
@ -6,7 +6,13 @@ import com.github.intellectualsites.plotsquared.plot.config.Settings;
|
||||
import com.github.intellectualsites.plotsquared.plot.config.Storage;
|
||||
import com.github.intellectualsites.plotsquared.plot.flag.Flag;
|
||||
import com.github.intellectualsites.plotsquared.plot.flag.FlagManager;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.*;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.BlockLoc;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.Plot;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotArea;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotCluster;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotId;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotSettings;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.RunnableVal;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.comment.PlotComment;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.StringMan;
|
||||
@ -14,11 +20,26 @@ import com.github.intellectualsites.plotsquared.plot.util.TaskManager;
|
||||
import com.google.common.base.Charsets;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.sql.*;
|
||||
import java.sql.Connection;
|
||||
import java.sql.DatabaseMetaData;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Statement;
|
||||
import java.sql.Timestamp;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Queue;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
@ -857,10 +878,10 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||
statement.setInt(i * 10 + 9, hash);
|
||||
BlockLoc loc = pair.settings.getPosition();
|
||||
String position;
|
||||
if (loc.y == 0) {
|
||||
if (loc.getY() == 0) {
|
||||
position = "DEFAULT";
|
||||
} else {
|
||||
position = loc.x + "," + loc.y + ',' + loc.z;
|
||||
position = loc.getX() + "," + loc.getY() + ',' + loc.getZ();
|
||||
}
|
||||
statement.setString(i * 10 + 10, position);
|
||||
}
|
||||
@ -898,10 +919,10 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||
stmt.setInt(i * 10 + 9, n);
|
||||
BlockLoc loc = pair.settings.getPosition();
|
||||
String position;
|
||||
if (loc.y == 0) {
|
||||
if (loc.getY() == 0) {
|
||||
position = "DEFAULT";
|
||||
} else {
|
||||
position = loc.x + "," + loc.y + ',' + loc.z;
|
||||
position = loc.getX() + "," + loc.getY() + ',' + loc.getZ();
|
||||
}
|
||||
stmt.setString(i * 10 + 10, position);
|
||||
}
|
||||
|
@ -4,7 +4,11 @@ import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.sql.*;
|
||||
import java.sql.Connection;
|
||||
import java.sql.DriverManager;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Statement;
|
||||
|
||||
/**
|
||||
* Connects to and uses a SQLite database.
|
||||
|
@ -10,7 +10,12 @@ import com.github.intellectualsites.plotsquared.plot.util.EventUtil;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.Permissions;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
|
@ -9,7 +9,6 @@ import com.github.intellectualsites.plotsquared.plot.util.StringMan;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class PlotBlockListFlag extends ListFlag<HashSet<PlotBlock>> {
|
||||
|
@ -1,6 +1,5 @@
|
||||
package com.github.intellectualsites.plotsquared.plot.flag;
|
||||
|
||||
|
||||
import com.github.intellectualsites.plotsquared.plot.config.Captions;
|
||||
|
||||
public class StringFlag extends Flag<String> {
|
||||
|
@ -1,7 +1,13 @@
|
||||
package com.github.intellectualsites.plotsquared.plot.generator;
|
||||
|
||||
import com.github.intellectualsites.plotsquared.plot.config.Settings;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.*;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.BlockBucket;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.Direction;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.Location;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.Plot;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotBlock;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotId;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.RegionWrapper;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.MathMan;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.block.GlobalBlockQueue;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.block.LocalBlockQueue;
|
||||
|
@ -10,7 +10,6 @@ import com.github.intellectualsites.plotsquared.plot.object.PlotBlock;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotId;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.Locale;
|
||||
|
||||
|
@ -2,7 +2,11 @@ package com.github.intellectualsites.plotsquared.plot.generator;
|
||||
|
||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||
import com.github.intellectualsites.plotsquared.plot.config.Settings;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.*;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.BlockBucket;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.Location;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotArea;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotBlock;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotId;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.MathMan;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.block.ScopedLocalBlockQueue;
|
||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||
|
@ -3,7 +3,13 @@ package com.github.intellectualsites.plotsquared.plot.generator;
|
||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||
import com.github.intellectualsites.plotsquared.plot.commands.Template;
|
||||
import com.github.intellectualsites.plotsquared.plot.config.Settings;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.*;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.BlockBucket;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.FileBytes;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.Location;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.Plot;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotBlock;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotId;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.RunnableVal;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.ChunkManager;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.MathMan;
|
||||
|
@ -5,7 +5,14 @@ import com.github.intellectualsites.plotsquared.plot.config.Settings;
|
||||
import com.github.intellectualsites.plotsquared.plot.flag.FlagManager;
|
||||
import com.github.intellectualsites.plotsquared.plot.flag.Flags;
|
||||
import com.github.intellectualsites.plotsquared.plot.listener.WEExtent;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.*;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.Location;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.Plot;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotArea;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotBlock;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotId;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotManager;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.RegionWrapper;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.RunnableVal;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.ChunkManager;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.MathMan;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.SchematicHandler;
|
||||
@ -15,18 +22,26 @@ import com.github.intellectualsites.plotsquared.plot.util.block.GlobalBlockQueue
|
||||
import com.github.intellectualsites.plotsquared.plot.util.block.LocalBlockQueue;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.expiry.PlotAnalysis;
|
||||
import com.sk89q.jnbt.CompoundTag;
|
||||
import com.sk89q.worldedit.math.BlockVector2;
|
||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.*;
|
||||
import java.util.ArrayDeque;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
public abstract class HybridUtils {
|
||||
|
||||
public static HybridUtils manager;
|
||||
public static Set<ChunkLoc> regions;
|
||||
public static Set<ChunkLoc> chunks = new HashSet<>();
|
||||
public static Set<BlockVector2> regions;
|
||||
public static Set<BlockVector2> chunks = new HashSet<>();
|
||||
public static PlotArea area;
|
||||
public static boolean UPDATE = false;
|
||||
|
||||
@ -113,13 +128,13 @@ public abstract class HybridUtils {
|
||||
return count;
|
||||
}
|
||||
|
||||
public final ArrayList<ChunkLoc> getChunks(ChunkLoc region) {
|
||||
ArrayList<ChunkLoc> chunks = new ArrayList<>();
|
||||
int sx = region.x << 5;
|
||||
int sz = region.z << 5;
|
||||
public final ArrayList<BlockVector2> getChunks(BlockVector2 region) {
|
||||
ArrayList<BlockVector2> chunks = new ArrayList<>();
|
||||
int sx = region.getX() << 5;
|
||||
int sz = region.getZ() << 5;
|
||||
for (int x = sx; x < sx + 32; x++) {
|
||||
for (int z = sz; z < sz + 32; z++) {
|
||||
chunks.add(new ChunkLoc(x, z));
|
||||
chunks.add(BlockVector2.at(x, z));
|
||||
}
|
||||
}
|
||||
return chunks;
|
||||
@ -130,7 +145,7 @@ public abstract class HybridUtils {
|
||||
return false;
|
||||
}
|
||||
HybridUtils.UPDATE = true;
|
||||
Set<ChunkLoc> regions = ChunkManager.manager.getChunkChunks(area.worldname);
|
||||
Set<BlockVector2> regions = ChunkManager.manager.getChunkChunks(area.worldname);
|
||||
return scheduleRoadUpdate(area, regions, extend);
|
||||
}
|
||||
|
||||
@ -139,12 +154,12 @@ public abstract class HybridUtils {
|
||||
return false;
|
||||
}
|
||||
HybridUtils.UPDATE = true;
|
||||
Set<ChunkLoc> regions = new HashSet<>();
|
||||
regions.add(ChunkManager.getChunkChunk(plot.getCenter()));
|
||||
Set<BlockVector2> regions = new HashSet<>();
|
||||
regions.add(ChunkManager.getRegion(plot.getCenter()));
|
||||
return scheduleRoadUpdate(plot.getArea(), regions, extend);
|
||||
}
|
||||
|
||||
public boolean scheduleRoadUpdate(final PlotArea area, Set<ChunkLoc> regions,
|
||||
public boolean scheduleRoadUpdate(final PlotArea area, Set<BlockVector2> regions,
|
||||
final int extend) {
|
||||
HybridUtils.regions = regions;
|
||||
HybridUtils.area = area;
|
||||
@ -153,9 +168,9 @@ public abstract class HybridUtils {
|
||||
TaskManager.runTask(new Runnable() {
|
||||
@Override public void run() {
|
||||
if (!UPDATE) {
|
||||
Iterator<ChunkLoc> iter = chunks.iterator();
|
||||
Iterator<BlockVector2> iter = chunks.iterator();
|
||||
while (iter.hasNext()) {
|
||||
ChunkLoc chunk = iter.next();
|
||||
BlockVector2 chunk = iter.next();
|
||||
iter.remove();
|
||||
boolean regenedRoad = regenerateRoad(area, chunk, extend);
|
||||
if (!regenedRoad) {
|
||||
@ -183,10 +198,10 @@ public abstract class HybridUtils {
|
||||
try {
|
||||
if (chunks.size() < 1024) {
|
||||
if (!HybridUtils.regions.isEmpty()) {
|
||||
Iterator<ChunkLoc> iterator = HybridUtils.regions.iterator();
|
||||
ChunkLoc loc = iterator.next();
|
||||
Iterator<BlockVector2> iterator = HybridUtils.regions.iterator();
|
||||
BlockVector2 loc = iterator.next();
|
||||
iterator.remove();
|
||||
PlotSquared.debug("Updating .mcr: " + loc.x + ", " + loc.z
|
||||
PlotSquared.debug("Updating .mcr: " + loc.getX() + ", " + loc.getZ()
|
||||
+ " (approx 1024 chunks)");
|
||||
PlotSquared
|
||||
.debug(" - Remaining: " + HybridUtils.regions.size());
|
||||
@ -198,10 +213,10 @@ public abstract class HybridUtils {
|
||||
TaskManager.IMP.sync(new RunnableVal<Object>() {
|
||||
@Override public void run(Object value) {
|
||||
long start = System.currentTimeMillis();
|
||||
Iterator<ChunkLoc> iterator = chunks.iterator();
|
||||
Iterator<BlockVector2> iterator = chunks.iterator();
|
||||
while (System.currentTimeMillis() - start < 20 && !chunks
|
||||
.isEmpty()) {
|
||||
final ChunkLoc chunk = iterator.next();
|
||||
final BlockVector2 chunk = iterator.next();
|
||||
iterator.remove();
|
||||
boolean regenedRoads =
|
||||
regenerateRoad(area, chunk, extend);
|
||||
@ -214,18 +229,18 @@ public abstract class HybridUtils {
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
Iterator<ChunkLoc> iterator = HybridUtils.regions.iterator();
|
||||
ChunkLoc loc = iterator.next();
|
||||
Iterator<BlockVector2> iterator = HybridUtils.regions.iterator();
|
||||
BlockVector2 loc = iterator.next();
|
||||
iterator.remove();
|
||||
PlotSquared.debug(
|
||||
"[ERROR] Could not update '" + area.worldname + "/region/r." + loc.x
|
||||
+ "." + loc.z + ".mca' (Corrupt chunk?)");
|
||||
int sx = loc.x << 5;
|
||||
int sz = loc.z << 5;
|
||||
"[ERROR] Could not update '" + area.worldname + "/region/r." + loc.getX()
|
||||
+ "." + loc.getZ() + ".mca' (Corrupt chunk?)");
|
||||
int sx = loc.getX() << 5;
|
||||
int sz = loc.getZ() << 5;
|
||||
for (int x = sx; x < sx + 32; x++) {
|
||||
for (int z = sz; z < sz + 32; z++) {
|
||||
ChunkManager.manager
|
||||
.unloadChunk(area.worldname, new ChunkLoc(x, z), true);
|
||||
.unloadChunk(area.worldname, BlockVector2.at(x, z), true);
|
||||
}
|
||||
}
|
||||
PlotSquared.debug(" - Potentially skipping 1024 chunks");
|
||||
@ -303,9 +318,9 @@ public abstract class HybridUtils {
|
||||
return ey;
|
||||
}
|
||||
|
||||
public boolean regenerateRoad(final PlotArea area, final ChunkLoc chunk, int extend) {
|
||||
int x = chunk.x << 4;
|
||||
int z = chunk.z << 4;
|
||||
public boolean regenerateRoad(final PlotArea area, final BlockVector2 chunk, int extend) {
|
||||
int x = chunk.getX() << 4;
|
||||
int z = chunk.getZ() << 4;
|
||||
int ex = x + 15;
|
||||
int ez = z + 15;
|
||||
HybridPlotWorld plotWorld = (HybridPlotWorld) area;
|
||||
|
@ -1,7 +1,10 @@
|
||||
package com.github.intellectualsites.plotsquared.plot.generator;
|
||||
|
||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.*;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.BlockBucket;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotArea;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotId;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.SetupObject;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.block.ScopedLocalBlockQueue;
|
||||
|
||||
/**
|
||||
|
@ -1,7 +1,12 @@
|
||||
package com.github.intellectualsites.plotsquared.plot.generator;
|
||||
|
||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.*;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.Direction;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.Location;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.Plot;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotArea;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotId;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.RegionWrapper;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.ChunkManager;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
|
||||
|
||||
|
@ -11,7 +11,16 @@ import com.github.intellectualsites.plotsquared.plot.object.PlotArea;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotBlock;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.RunnableVal;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.*;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.ByteArrayUtilities;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.CommentManager;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.EventUtil;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.Permissions;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.PlotGameMode;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.PlotWeather;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.StringMan;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.TaskManager;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.UUIDHandler;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.expiry.ExpireManager;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
@ -10,8 +10,14 @@ import lombok.NonNull;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Random;
|
||||
|
||||
/**
|
||||
* A block bucket is a container of block types, where each block
|
||||
|
@ -2,12 +2,12 @@ package com.github.intellectualsites.plotsquared.plot.object;
|
||||
|
||||
public class BlockLoc {
|
||||
|
||||
public final int x;
|
||||
public final int y;
|
||||
public final int z;
|
||||
private final int x;
|
||||
private final int y;
|
||||
private final int z;
|
||||
|
||||
public final float yaw;
|
||||
public final float pitch;
|
||||
private final float yaw;
|
||||
private final float pitch;
|
||||
|
||||
public BlockLoc(int x, int y, int z, float yaw, float pitch) {
|
||||
this.x = x;
|
||||
@ -27,10 +27,6 @@ public class BlockLoc {
|
||||
|
||||
float yaw;
|
||||
float pitch;
|
||||
if (parts.length == 3) {
|
||||
yaw = 0f;
|
||||
pitch = 0f;
|
||||
}
|
||||
if (parts.length == 5) {
|
||||
yaw = Float.parseFloat(parts[3]);
|
||||
pitch = Float.parseFloat(parts[4]);
|
||||
@ -47,9 +43,9 @@ public class BlockLoc {
|
||||
@Override public int hashCode() {
|
||||
int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + this.x;
|
||||
result = prime * result + this.y;
|
||||
result = prime * result + this.z;
|
||||
result = prime * result + this.getX();
|
||||
result = prime * result + this.getY();
|
||||
result = prime * result + this.getZ();
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -58,20 +54,42 @@ public class BlockLoc {
|
||||
return true;
|
||||
}
|
||||
if (obj == null) {
|
||||
return this.x == 0 && this.y == 0 && this.z == 0;
|
||||
return this.getX() == 0 && this.getY() == 0 && this.getZ() == 0;
|
||||
}
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
BlockLoc other = (BlockLoc) obj;
|
||||
return this.x == other.x && this.y == other.y && this.z == other.z;
|
||||
return this.getX() == other.getX() && this.getY() == other.getY() && this.getZ() == other
|
||||
.getZ();
|
||||
}
|
||||
|
||||
@Override public String toString() {
|
||||
if (this.x == 0 && this.y == 0 && this.z == 0) {
|
||||
if (this.getX() == 0 && this.getY() == 0 && this.getZ() == 0) {
|
||||
return "";
|
||||
}
|
||||
return this.x + "," + this.y + ',' + this.z + ',' + this.yaw + ',' + this.pitch;
|
||||
return this.getX() + "," + this.getY() + ',' + this.getZ() + ',' + this.getYaw()
|
||||
+ ',' + this.getPitch();
|
||||
|
||||
}
|
||||
|
||||
public int getX() {
|
||||
return x;
|
||||
}
|
||||
|
||||
public int getY() {
|
||||
return y;
|
||||
}
|
||||
|
||||
public int getZ() {
|
||||
return z;
|
||||
}
|
||||
|
||||
public float getYaw() {
|
||||
return yaw;
|
||||
}
|
||||
|
||||
public float getPitch() {
|
||||
return pitch;
|
||||
}
|
||||
}
|
||||
|
@ -1,50 +0,0 @@
|
||||
package com.github.intellectualsites.plotsquared.plot.object;
|
||||
|
||||
public class ChunkLoc {
|
||||
|
||||
public int x;
|
||||
public int z;
|
||||
|
||||
public ChunkLoc(int x, int z) {
|
||||
this.x = x;
|
||||
this.z = z;
|
||||
}
|
||||
|
||||
public static long getChunkLong(int x, int z) {
|
||||
return (long) x & 0xffffffffL | ((long) z & 0xffffffffL) << 32;
|
||||
}
|
||||
|
||||
public long toLong() {
|
||||
return getChunkLong(this.x,this.z);
|
||||
}
|
||||
|
||||
public static int getX(long chunkLong) {
|
||||
return (int)(chunkLong & 0xffffffffL);
|
||||
}
|
||||
|
||||
public static int getZ(long chunkLong) {
|
||||
return (int)(chunkLong >>> 32 & 0xffffffffL);
|
||||
}
|
||||
|
||||
@Override public int hashCode() {
|
||||
return (x << 16) | (z & 0xFFFF);
|
||||
}
|
||||
|
||||
@Override public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
ChunkLoc other = (ChunkLoc) obj;
|
||||
return (this.x == other.x) && (this.z == other.z);
|
||||
}
|
||||
|
||||
@Override public String toString() {
|
||||
return this.x + "," + this.z;
|
||||
}
|
||||
}
|
@ -1,7 +1,6 @@
|
||||
package com.github.intellectualsites.plotsquared.plot.object;
|
||||
|
||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
import com.sk89q.worldedit.world.registry.LegacyMapper;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
@ -2,6 +2,7 @@ package com.github.intellectualsites.plotsquared.plot.object;
|
||||
|
||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.MathMan;
|
||||
import com.sk89q.worldedit.math.BlockVector2;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
@ -127,8 +128,8 @@ public class Location implements Cloneable, Comparable<Location> {
|
||||
}
|
||||
}
|
||||
|
||||
public ChunkLoc getChunkLoc() {
|
||||
return new ChunkLoc(this.x >> 4, this.z >> 4);
|
||||
public BlockVector2 getBlockVector2() {
|
||||
return BlockVector2.at(this.x >> 4, this.z >> 4);
|
||||
}
|
||||
|
||||
public Location add(int x, int y, int z) {
|
||||
|
@ -12,7 +12,16 @@ import com.github.intellectualsites.plotsquared.plot.generator.SquarePlotWorld;
|
||||
import com.github.intellectualsites.plotsquared.plot.listener.PlotListener;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.comment.PlotComment;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.schematic.Schematic;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.*;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.ChunkManager;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.EventUtil;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.MathMan;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.Permissions;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.SchematicHandler;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.StringMan;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.TaskManager;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.UUIDHandler;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.WorldUtil;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.block.GlobalBlockQueue;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.block.LocalBlockQueue;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.expiry.ExpireManager;
|
||||
@ -21,6 +30,7 @@ import com.google.common.collect.BiMap;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.Sets;
|
||||
import com.sk89q.jnbt.CompoundTag;
|
||||
import com.sk89q.worldedit.math.BlockVector2;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@ -30,8 +40,18 @@ import java.awt.geom.Rectangle2D;
|
||||
import java.io.File;
|
||||
import java.net.URL;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.*;
|
||||
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;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@ -920,7 +940,7 @@ public class Plot {
|
||||
region.maxZ + extendBiome);
|
||||
ChunkManager.chunkTask(pos1, pos2, new RunnableVal<int[]>() {
|
||||
@Override public void run(int[] value) {
|
||||
ChunkLoc loc = new ChunkLoc(value[0], value[1]);
|
||||
BlockVector2 loc = BlockVector2.at(value[0], value[1]);
|
||||
ChunkManager.manager.loadChunk(getWorldName(), loc, false);
|
||||
MainUtil.setBiome(getWorldName(), value[2], value[3], value[4], value[5],
|
||||
biome);
|
||||
@ -1251,13 +1271,14 @@ public class Plot {
|
||||
*/
|
||||
public Location getHome() {
|
||||
BlockLoc home = this.getPosition();
|
||||
if (home == null || home.x == 0 && home.z == 0) {
|
||||
if (home == null || home.getX() == 0 && home.getZ() == 0) {
|
||||
return this.getDefaultHome(true);
|
||||
} else {
|
||||
Location bottom = this.getBottomAbs();
|
||||
Location location =
|
||||
new Location(bottom.getWorld(), bottom.getX() + home.x, bottom.getY() + home.y,
|
||||
bottom.getZ() + home.z, home.yaw, home.pitch);
|
||||
new Location(bottom.getWorld(), bottom.getX() + home.getX(), bottom.getY() + home
|
||||
.getY(),
|
||||
bottom.getZ() + home.getZ(), home.getYaw(), home.getPitch());
|
||||
if (!isLoaded()) {
|
||||
return location;
|
||||
}
|
||||
@ -1413,11 +1434,11 @@ public class Plot {
|
||||
*/
|
||||
public void refreshChunks() {
|
||||
LocalBlockQueue queue = GlobalBlockQueue.IMP.getNewQueue(getWorldName(), false);
|
||||
HashSet<ChunkLoc> chunks = new HashSet<>();
|
||||
HashSet<BlockVector2> chunks = new HashSet<>();
|
||||
for (RegionWrapper region : Plot.this.getRegions()) {
|
||||
for (int x = region.minX >> 4; x <= region.maxX >> 4; x++) {
|
||||
for (int z = region.minZ >> 4; z <= region.maxZ >> 4; z++) {
|
||||
if (chunks.add(new ChunkLoc(x, z))) {
|
||||
if (chunks.add(BlockVector2.at(x, z))) {
|
||||
queue.refreshChunk(x, z);
|
||||
}
|
||||
}
|
||||
@ -2142,7 +2163,7 @@ public class Plot {
|
||||
String[] lines = TaskManager.IMP.sync(new RunnableVal<String[]>() {
|
||||
@Override public void run(String[] value) {
|
||||
ChunkManager.manager
|
||||
.loadChunk(location.getWorld(), location.getChunkLoc(), false);
|
||||
.loadChunk(location.getWorld(), location.getBlockVector2(), false);
|
||||
this.value = WorldUtil.IMP.getSign(location);
|
||||
}
|
||||
});
|
||||
|
@ -24,8 +24,16 @@ import com.google.common.collect.ImmutableSet;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.*;
|
||||
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;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
|
@ -126,7 +126,7 @@ public class PlotCluster {
|
||||
public Location getHome() {
|
||||
BlockLoc home = this.settings.getPosition();
|
||||
Location toReturn;
|
||||
if (home.y == 0) {
|
||||
if (home.getY() == 0) {
|
||||
// default pos
|
||||
Plot center = getCenterPlot();
|
||||
toReturn = center.getHome();
|
||||
@ -136,7 +136,7 @@ public class PlotCluster {
|
||||
toReturn.setY(location.getY());
|
||||
}
|
||||
} else {
|
||||
toReturn = getClusterBottom().add(home.x, home.y, home.z);
|
||||
toReturn = getClusterBottom().add(home.getX(), home.getY(), home.getZ());
|
||||
}
|
||||
int max = MainUtil.getHeighestBlock(this.area.worldname, toReturn.getX(), toReturn.getZ());
|
||||
if (max > toReturn.getY()) {
|
||||
|
@ -10,7 +10,13 @@ import com.github.intellectualsites.plotsquared.plot.flag.Flags;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.worlds.PlotAreaManager;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.worlds.SinglePlotArea;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.worlds.SinglePlotAreaManager;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.*;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.EconHandler;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.EventUtil;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.Permissions;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.PlotGameMode;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.PlotWeather;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.TaskManager;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.UUIDHandler;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.expiry.ExpireManager;
|
||||
import com.google.common.base.Preconditions;
|
||||
import lombok.NonNull;
|
||||
|
@ -104,7 +104,7 @@ public class PlotSettings {
|
||||
}
|
||||
|
||||
public void setPosition(BlockLoc position) {
|
||||
if (position != null && position.x == 0 && position.y == 0 && position.z == 0) {
|
||||
if (position != null && position.getX() == 0 && position.getY() == 0 && position.getZ() == 0) {
|
||||
position = null;
|
||||
}
|
||||
this.position = position;
|
||||
|
@ -6,7 +6,13 @@ import com.github.intellectualsites.plotsquared.plot.object.RegionWrapper;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.StringMan;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.area.QuadMap;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Set;
|
||||
|
||||
public class DefaultPlotAreaManager implements PlotAreaManager {
|
||||
|
||||
|
@ -2,7 +2,13 @@ package com.github.intellectualsites.plotsquared.plot.object.worlds;
|
||||
|
||||
import com.github.intellectualsites.plotsquared.plot.config.Captions;
|
||||
import com.github.intellectualsites.plotsquared.plot.flag.Flag;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.*;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.BlockLoc;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.Location;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.Plot;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotArea;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotId;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.RegionWrapper;
|
||||
import com.google.common.collect.Sets;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
|
@ -5,7 +5,14 @@ import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||
import com.github.intellectualsites.plotsquared.plot.config.Configuration;
|
||||
import com.github.intellectualsites.plotsquared.plot.config.ConfigurationNode;
|
||||
import com.github.intellectualsites.plotsquared.plot.generator.GridPlotWorld;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.*;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.Location;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.Plot;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotId;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotLoc;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotManager;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotSettings;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.RunnableVal;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.SetupObject;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.SetupUtils;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.TaskManager;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.WorldUtil;
|
||||
|
@ -1,7 +1,12 @@
|
||||
package com.github.intellectualsites.plotsquared.plot.object.worlds;
|
||||
|
||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.*;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.BlockBucket;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.Location;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.Plot;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotArea;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotId;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotManager;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.SetupUtils;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.TaskManager;
|
||||
|
@ -2,7 +2,11 @@ package com.github.intellectualsites.plotsquared.plot.object.worlds;
|
||||
|
||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||
import com.github.intellectualsites.plotsquared.plot.generator.IndependentPlotGenerator;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.*;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.BlockBucket;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.Location;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotArea;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotBlock;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotId;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.block.ScopedLocalBlockQueue;
|
||||
|
||||
public class SingleWorldGenerator extends IndependentPlotGenerator {
|
||||
|
@ -1,7 +1,6 @@
|
||||
package com.github.intellectualsites.plotsquared.plot.util;
|
||||
|
||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.ChunkLoc;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.Location;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.Plot;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.RegionWrapper;
|
||||
@ -9,6 +8,7 @@ import com.github.intellectualsites.plotsquared.plot.object.RunnableVal;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.block.GlobalBlockQueue;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.block.LocalBlockQueue;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.block.ScopedLocalBlockQueue;
|
||||
import com.sk89q.worldedit.math.BlockVector2;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
@ -21,31 +21,31 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
public abstract class ChunkManager {
|
||||
|
||||
private static final Map<ChunkLoc, RunnableVal<ScopedLocalBlockQueue>> forceChunks =
|
||||
private static final Map<BlockVector2, RunnableVal<ScopedLocalBlockQueue>> forceChunks =
|
||||
new ConcurrentHashMap<>();
|
||||
private static final Map<ChunkLoc, RunnableVal<ScopedLocalBlockQueue>> addChunks =
|
||||
private static final Map<BlockVector2, RunnableVal<ScopedLocalBlockQueue>> addChunks =
|
||||
new ConcurrentHashMap<>();
|
||||
public static ChunkManager manager = null;
|
||||
|
||||
public static ChunkLoc getChunkChunk(Location location) {
|
||||
public static BlockVector2 getRegion(Location location) {
|
||||
int x = location.getX() >> 9;
|
||||
int z = location.getZ() >> 9;
|
||||
return new ChunkLoc(x, z);
|
||||
return BlockVector2.at(x, z);
|
||||
}
|
||||
|
||||
public static void setChunkInPlotArea(RunnableVal<ScopedLocalBlockQueue> force,
|
||||
RunnableVal<ScopedLocalBlockQueue> add, String world, ChunkLoc loc) {
|
||||
RunnableVal<ScopedLocalBlockQueue> add, String world, BlockVector2 loc) {
|
||||
LocalBlockQueue queue = GlobalBlockQueue.IMP.getNewQueue(world, false);
|
||||
if (PlotSquared.get().isAugmented(world)) {
|
||||
int blockX = loc.x << 4;
|
||||
int blockZ = loc.z << 4;
|
||||
int blockX = loc.getX() << 4;
|
||||
int blockZ = loc.getZ() << 4;
|
||||
ScopedLocalBlockQueue scoped =
|
||||
new ScopedLocalBlockQueue(queue, new Location(world, blockX, 0, blockZ),
|
||||
new Location(world, blockX + 15, 255, blockZ + 15));
|
||||
if (force != null) {
|
||||
force.run(scoped);
|
||||
} else {
|
||||
scoped.regenChunk(loc.x, loc.z);
|
||||
scoped.regenChunk(loc.getX(), loc.getZ());
|
||||
if (add != null) {
|
||||
add.run(scoped);
|
||||
}
|
||||
@ -54,13 +54,13 @@ public abstract class ChunkManager {
|
||||
} else {
|
||||
forceChunks.put(loc, force);
|
||||
addChunks.put(loc, add);
|
||||
queue.regenChunk(loc.x, loc.z);
|
||||
queue.regenChunk(loc.getX(), loc.getZ());
|
||||
forceChunks.remove(loc);
|
||||
addChunks.remove(loc);
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean preProcessChunk(ChunkLoc loc, ScopedLocalBlockQueue queue) {
|
||||
public static boolean preProcessChunk(BlockVector2 loc, ScopedLocalBlockQueue queue) {
|
||||
final RunnableVal<ScopedLocalBlockQueue> forceChunk = forceChunks.get(loc);
|
||||
if (forceChunk != null) {
|
||||
forceChunk.run(queue);
|
||||
@ -70,7 +70,7 @@ public abstract class ChunkManager {
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean postProcessChunk(ChunkLoc loc, ScopedLocalBlockQueue queue) {
|
||||
public static boolean postProcessChunk(BlockVector2 loc, ScopedLocalBlockQueue queue) {
|
||||
final RunnableVal<ScopedLocalBlockQueue> addChunk = forceChunks.get(loc);
|
||||
if (addChunk != null) {
|
||||
addChunk.run(queue);
|
||||
@ -81,13 +81,13 @@ public abstract class ChunkManager {
|
||||
}
|
||||
|
||||
public static void largeRegionTask(final String world, final RegionWrapper region,
|
||||
final RunnableVal<ChunkLoc> task, final Runnable whenDone) {
|
||||
final RunnableVal<BlockVector2> task, final Runnable whenDone) {
|
||||
TaskManager.runTaskAsync(() -> {
|
||||
HashSet<ChunkLoc> chunks = new HashSet<>();
|
||||
Set<ChunkLoc> mcrs = manager.getChunkChunks(world);
|
||||
for (ChunkLoc mcr : mcrs) {
|
||||
int bx = mcr.x << 9;
|
||||
int bz = mcr.z << 9;
|
||||
HashSet<BlockVector2> chunks = new HashSet<>();
|
||||
Set<BlockVector2> mcrs = manager.getChunkChunks(world);
|
||||
for (BlockVector2 mcr : mcrs) {
|
||||
int bx = mcr.getX() << 9;
|
||||
int bz = mcr.getZ() << 9;
|
||||
int tx = bx + 511;
|
||||
int tz = bz + 511;
|
||||
if (bx <= region.maxX && tx >= region.minX && bz <= region.maxZ
|
||||
@ -100,16 +100,16 @@ public abstract class ChunkManager {
|
||||
int cbz = z << 4;
|
||||
int ctz = cbz + 15;
|
||||
if (cbz <= region.maxZ && ctz >= region.minZ) {
|
||||
chunks.add(new ChunkLoc(x, z));
|
||||
chunks.add(BlockVector2.at(x, z));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
TaskManager.objectTask(chunks, new RunnableVal<ChunkLoc>() {
|
||||
TaskManager.objectTask(chunks, new RunnableVal<BlockVector2>() {
|
||||
|
||||
@Override public void run(ChunkLoc value) {
|
||||
@Override public void run(BlockVector2 value) {
|
||||
manager.loadChunk(world, value, false).thenRun(()-> task.run(value));
|
||||
}
|
||||
}, whenDone);
|
||||
@ -152,21 +152,21 @@ public abstract class ChunkManager {
|
||||
final int bcz = p1z >> 4;
|
||||
final int tcx = p2x >> 4;
|
||||
final int tcz = p2z >> 4;
|
||||
final ArrayList<ChunkLoc> chunks = new ArrayList<>();
|
||||
final ArrayList<BlockVector2> chunks = new ArrayList<>();
|
||||
|
||||
for (int x = bcx; x <= tcx; x++) {
|
||||
for (int z = bcz; z <= tcz; z++) {
|
||||
chunks.add(new ChunkLoc(x, z));
|
||||
chunks.add(BlockVector2.at(x, z));
|
||||
}
|
||||
}
|
||||
TaskManager.runTask(new Runnable() {
|
||||
@Override public void run() {
|
||||
long start = System.currentTimeMillis();
|
||||
while (!chunks.isEmpty() && ((System.currentTimeMillis() - start) < allocate)) {
|
||||
ChunkLoc chunk = chunks.remove(0);
|
||||
BlockVector2 chunk = chunks.remove(0);
|
||||
task.value = new int[7];
|
||||
task.value[0] = chunk.x;
|
||||
task.value[1] = chunk.z;
|
||||
task.value[0] = chunk.getX();
|
||||
task.value[1] = chunk.getZ();
|
||||
task.value[2] = task.value[0] << 4;
|
||||
task.value[3] = task.value[1] << 4;
|
||||
task.value[4] = task.value[2] + 15;
|
||||
@ -211,11 +211,11 @@ public abstract class ChunkManager {
|
||||
*/
|
||||
public abstract int[] countEntities(Plot plot);
|
||||
|
||||
public abstract CompletableFuture loadChunk(String world, ChunkLoc loc, boolean force);
|
||||
public abstract CompletableFuture loadChunk(String world, BlockVector2 loc, boolean force);
|
||||
|
||||
public abstract void unloadChunk(String world, ChunkLoc loc, boolean save);
|
||||
public abstract void unloadChunk(String world, BlockVector2 loc, boolean save);
|
||||
|
||||
public Set<ChunkLoc> getChunkChunks(String world) {
|
||||
public Set<BlockVector2> getChunkChunks(String world) {
|
||||
File folder =
|
||||
new File(PlotSquared.get().IMP.getWorldContainer(), world + File.separator + "region");
|
||||
File[] regionFiles = folder.listFiles();
|
||||
@ -223,7 +223,7 @@ public abstract class ChunkManager {
|
||||
throw new RuntimeException(
|
||||
"Could not find worlds folder: " + folder + " ? (no read access?)");
|
||||
}
|
||||
HashSet<ChunkLoc> chunks = new HashSet<>();
|
||||
HashSet<BlockVector2> chunks = new HashSet<>();
|
||||
for (File file : regionFiles) {
|
||||
String name = file.getName();
|
||||
if (name.endsWith("mca")) {
|
||||
@ -231,7 +231,7 @@ public abstract class ChunkManager {
|
||||
try {
|
||||
int x = Integer.parseInt(split[1]);
|
||||
int z = Integer.parseInt(split[2]);
|
||||
ChunkLoc loc = new ChunkLoc(x, z);
|
||||
BlockVector2 loc = BlockVector2.at(x, z);
|
||||
chunks.add(loc);
|
||||
} catch (NumberFormatException ignored) {
|
||||
}
|
||||
@ -240,16 +240,16 @@ public abstract class ChunkManager {
|
||||
return chunks;
|
||||
}
|
||||
|
||||
public void deleteRegionFiles(String world, Collection<ChunkLoc> chunks) {
|
||||
public void deleteRegionFiles(String world, Collection<BlockVector2> chunks) {
|
||||
deleteRegionFiles(world, chunks, null);
|
||||
}
|
||||
|
||||
public void deleteRegionFiles(final String world, final Collection<ChunkLoc> chunks,
|
||||
public void deleteRegionFiles(final String world, final Collection<BlockVector2> chunks,
|
||||
final Runnable whenDone) {
|
||||
TaskManager.runTaskAsync(() -> {
|
||||
for (ChunkLoc loc : chunks) {
|
||||
for (BlockVector2 loc : chunks) {
|
||||
String directory =
|
||||
world + File.separator + "region" + File.separator + "r." + loc.x + "." + loc.z
|
||||
world + File.separator + "region" + File.separator + "r." + loc.getX() + "." + loc.getZ()
|
||||
+ ".mca";
|
||||
File file = new File(PlotSquared.get().IMP.getWorldContainer(), directory);
|
||||
PlotSquared.log("&6 - Deleting file: " + file.getName() + " (max 1024 chunks)");
|
||||
@ -261,9 +261,9 @@ public abstract class ChunkManager {
|
||||
});
|
||||
}
|
||||
|
||||
public Plot hasPlot(String world, ChunkLoc chunk) {
|
||||
int x1 = chunk.x << 4;
|
||||
int z1 = chunk.z << 4;
|
||||
public Plot hasPlot(String world, BlockVector2 chunk) {
|
||||
int x1 = chunk.getX() << 4;
|
||||
int z1 = chunk.getZ() << 4;
|
||||
int x2 = x1 + 15;
|
||||
int z2 = z1 + 15;
|
||||
Location bot = new Location(world, x1, 0, z1);
|
||||
|
@ -6,11 +6,18 @@ import com.github.intellectualsites.plotsquared.plot.config.Settings;
|
||||
import com.github.intellectualsites.plotsquared.plot.flag.Flag;
|
||||
import com.github.intellectualsites.plotsquared.plot.flag.Flags;
|
||||
import com.github.intellectualsites.plotsquared.plot.listener.PlayerBlockEventType;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.*;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.LazyBlock;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.Location;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.Plot;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotArea;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotBlock;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotId;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.Rating;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.worlds.SinglePlotArea;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.expiry.ExpireManager;
|
||||
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
@ -9,7 +9,12 @@ import java.io.OutputStream;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
* Single class paster for the Incendo paste service
|
||||
|
@ -10,12 +10,25 @@ import com.github.intellectualsites.plotsquared.plot.flag.DoubleFlag;
|
||||
import com.github.intellectualsites.plotsquared.plot.flag.Flag;
|
||||
import com.github.intellectualsites.plotsquared.plot.flag.FlagManager;
|
||||
import com.github.intellectualsites.plotsquared.plot.flag.Flags;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.*;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.ConsolePlayer;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.Location;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.Plot;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotArea;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotId;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.RegionWrapper;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.RunnableVal;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.stream.AbstractDelegateOutputStream;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.expiry.ExpireManager;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.io.*;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.OutputStream;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.io.PrintWriter;
|
||||
import java.io.Reader;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
@ -23,8 +36,17 @@ import java.net.URLConnection;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.Paths;
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.*;
|
||||
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;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.IntStream;
|
||||
|
||||
|
@ -7,7 +7,6 @@ import com.github.intellectualsites.plotsquared.plot.config.Settings;
|
||||
import com.github.intellectualsites.plotsquared.plot.flag.Flag;
|
||||
import com.github.intellectualsites.plotsquared.plot.flag.Flags;
|
||||
import com.github.intellectualsites.plotsquared.plot.generator.ClassicPlotWorld;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.ChunkLoc;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.Location;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.Plot;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotArea;
|
||||
@ -26,16 +25,34 @@ import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormats;
|
||||
import com.sk89q.worldedit.extent.clipboard.io.ClipboardReader;
|
||||
import com.sk89q.worldedit.extent.clipboard.io.MCEditSchematicReader;
|
||||
import com.sk89q.worldedit.extent.clipboard.io.SpongeSchematicReader;
|
||||
import com.sk89q.worldedit.math.BlockVector2;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.io.*;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.OutputStream;
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
import java.nio.channels.Channels;
|
||||
import java.nio.channels.ReadableByteChannel;
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.zip.GZIPInputStream;
|
||||
import java.util.zip.GZIPOutputStream;
|
||||
@ -197,9 +214,9 @@ public abstract class SchematicHandler {
|
||||
|
||||
ChunkManager.chunkTask(pos1, pos2, new RunnableVal<int[]>() {
|
||||
@Override public void run(int[] value) {
|
||||
ChunkLoc chunk = new ChunkLoc(value[0], value[1]);
|
||||
int x = chunk.x;
|
||||
int z = chunk.z;
|
||||
BlockVector2 chunk = BlockVector2.at(value[0], value[1]);
|
||||
int x = chunk.getX();
|
||||
int z = chunk.getZ();
|
||||
int xxb = x << 4;
|
||||
int zzb = z << 4;
|
||||
int xxt = xxb + 15;
|
||||
|
@ -10,8 +10,8 @@ import com.github.intellectualsites.plotsquared.plot.object.StringWrapper;
|
||||
import com.github.intellectualsites.plotsquared.plot.uuid.UUIDWrapper;
|
||||
import com.google.common.collect.BiMap;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
|
@ -14,8 +14,8 @@ import com.google.common.base.Charsets;
|
||||
import com.google.common.collect.BiMap;
|
||||
import com.google.common.collect.HashBiMap;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
|
@ -1,13 +1,19 @@
|
||||
package com.github.intellectualsites.plotsquared.plot.util;
|
||||
|
||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.*;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.Location;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.Plot;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotBlock;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.RegionWrapper;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.RunnableVal;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.schematic.PlotItem;
|
||||
import com.sk89q.jnbt.CompoundTag;
|
||||
import com.sk89q.jnbt.IntTag;
|
||||
import com.sk89q.jnbt.NBTInputStream;
|
||||
import com.sk89q.jnbt.NBTOutputStream;
|
||||
import com.sk89q.jnbt.Tag;
|
||||
import com.sk89q.worldedit.math.BlockVector2;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
@ -104,10 +110,10 @@ public abstract class WorldUtil {
|
||||
int brz = bot.getZ() >> 9;
|
||||
int trx = top.getX() >> 9;
|
||||
int trz = top.getZ() >> 9;
|
||||
Set<ChunkLoc> files = ChunkManager.manager.getChunkChunks(bot.getWorld());
|
||||
for (ChunkLoc mca : files) {
|
||||
if (mca.x >= brx && mca.x <= trx && mca.z >= brz && mca.z <= trz) {
|
||||
final File file = getMcr(plot.getWorldName(), mca.x, mca.z);
|
||||
Set<BlockVector2> files = ChunkManager.manager.getChunkChunks(bot.getWorld());
|
||||
for (BlockVector2 mca : files) {
|
||||
if (mca.getX() >= brx && mca.getX() <= trx && mca.getZ() >= brz && mca.getZ() <= trz) {
|
||||
final File file = getMcr(plot.getWorldName(), mca.getX(), mca.getZ());
|
||||
if (file != null) {
|
||||
//final String name = "r." + (x - cx) + "." + (z - cz) + ".mca";
|
||||
String name = file.getName();
|
||||
|
@ -1,7 +1,6 @@
|
||||
package com.github.intellectualsites.plotsquared.plot.util.block;
|
||||
|
||||
import com.github.intellectualsites.plotsquared.plot.object.BlockBucket;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.ChunkLoc;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.Location;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotBlock;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
||||
@ -10,6 +9,7 @@ import com.github.intellectualsites.plotsquared.plot.util.StringMan;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.UUIDHandler;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.WorldUtil;
|
||||
import com.sk89q.jnbt.CompoundTag;
|
||||
import com.sk89q.worldedit.math.BlockVector2;
|
||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||
|
||||
import java.util.Map;
|
||||
@ -83,11 +83,11 @@ public abstract class LocalBlockQueue {
|
||||
public final void regenChunkSafe(int x, int z) {
|
||||
regenChunk(x, z);
|
||||
fixChunkLighting(x, z);
|
||||
ChunkLoc loc = new ChunkLoc(x, z);
|
||||
BlockVector2 loc = BlockVector2.at(x, z);
|
||||
for (Map.Entry<String, PlotPlayer> entry : UUIDHandler.getPlayers().entrySet()) {
|
||||
PlotPlayer pp = entry.getValue();
|
||||
Location pLoc = pp.getLocation();
|
||||
if (!StringMan.isEqual(getWorld(), pLoc.getWorld()) || !pLoc.getChunkLoc()
|
||||
if (!StringMan.isEqual(getWorld(), pLoc.getWorld()) || !pLoc.getBlockVector2()
|
||||
.equals(loc)) {
|
||||
continue;
|
||||
}
|
||||
|
@ -7,13 +7,28 @@ import com.github.intellectualsites.plotsquared.plot.database.DBFunc;
|
||||
import com.github.intellectualsites.plotsquared.plot.flag.FlagManager;
|
||||
import com.github.intellectualsites.plotsquared.plot.flag.Flags;
|
||||
import com.github.intellectualsites.plotsquared.plot.generator.HybridUtils;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.*;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.OfflinePlotPlayer;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.Plot;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotArea;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotMessage;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.RunnableVal;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.RunnableVal3;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.StringMan;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.TaskManager;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.UUIDHandler;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.ArrayDeque;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ConcurrentLinkedDeque;
|
||||
|
||||
|
@ -10,7 +10,12 @@ import com.github.intellectualsites.plotsquared.plot.util.MathMan;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.TaskManager;
|
||||
|
||||
import java.lang.reflect.Array;
|
||||
import java.util.*;
|
||||
import java.util.ArrayDeque;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
public class PlotAnalysis {
|
||||
|
@ -1,7 +1,12 @@
|
||||
package com.github.intellectualsites.plotsquared.plot.util;
|
||||
|
||||
import com.github.intellectualsites.plotsquared.plot.flag.Flag;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.*;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.Location;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.Plot;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotArea;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotId;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.Rating;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
Reference in New Issue
Block a user