mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-26 15:16:45 +01:00
Misc. code changes
A lot of renaming Some formatting Narrowed scope of variables Added annotations
This commit is contained in:
parent
84911c1a8c
commit
b66734a472
@ -2,6 +2,7 @@ package com.github.intellectualsites.plotsquared.bukkit.object;
|
|||||||
|
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.OfflinePlotPlayer;
|
import com.github.intellectualsites.plotsquared.plot.object.OfflinePlotPlayer;
|
||||||
import org.bukkit.OfflinePlayer;
|
import org.bukkit.OfflinePlayer;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
@ -19,7 +20,7 @@ public class BukkitOfflinePlayer implements OfflinePlotPlayer {
|
|||||||
this.player = player;
|
this.player = player;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public UUID getUUID() {
|
@NotNull @Override public UUID getUUID() {
|
||||||
return this.player.getUniqueId();
|
return this.player.getUniqueId();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,7 +6,12 @@ import com.github.intellectualsites.plotsquared.plot.config.Captions;
|
|||||||
import com.github.intellectualsites.plotsquared.plot.object.Location;
|
import com.github.intellectualsites.plotsquared.plot.object.Location;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.PlotBlock;
|
import com.github.intellectualsites.plotsquared.plot.object.PlotBlock;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
||||||
import com.github.intellectualsites.plotsquared.plot.util.*;
|
import com.github.intellectualsites.plotsquared.plot.util.EconHandler;
|
||||||
|
import com.github.intellectualsites.plotsquared.plot.util.MathMan;
|
||||||
|
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.UUIDHandler;
|
||||||
import org.bukkit.GameMode;
|
import org.bukkit.GameMode;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.Sound;
|
import org.bukkit.Sound;
|
||||||
@ -18,8 +23,8 @@ import org.bukkit.event.player.PlayerTeleportEvent;
|
|||||||
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
|
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
|
||||||
import org.bukkit.permissions.PermissionAttachmentInfo;
|
import org.bukkit.permissions.PermissionAttachmentInfo;
|
||||||
import org.bukkit.plugin.RegisteredListener;
|
import org.bukkit.plugin.RegisteredListener;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
@ -55,7 +60,7 @@ public class BukkitPlayer extends PlotPlayer {
|
|||||||
return location == null ? BukkitUtil.getLocation(this.player) : location;
|
return location == null ? BukkitUtil.getLocation(this.player) : location;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nonnull @Override public UUID getUUID() {
|
@NotNull @Override public UUID getUUID() {
|
||||||
if (this.uuid == null) {
|
if (this.uuid == null) {
|
||||||
this.uuid = UUIDHandler.getUUID(this);
|
this.uuid = UUIDHandler.getUUID(this);
|
||||||
}
|
}
|
||||||
|
@ -13,14 +13,6 @@ import static com.github.intellectualsites.plotsquared.plot.util.ReflectionUtils
|
|||||||
|
|
||||||
public class OfflinePlayerUtil {
|
public class OfflinePlayerUtil {
|
||||||
|
|
||||||
public static Player loadPlayer(String name) {
|
|
||||||
return loadPlayer(Bukkit.getOfflinePlayer(name));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Player loadPlayer(UUID id) {
|
|
||||||
return loadPlayer(Bukkit.getOfflinePlayer(id));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Player loadPlayer(OfflinePlayer player) {
|
public static Player loadPlayer(OfflinePlayer player) {
|
||||||
if (player == null) {
|
if (player == null) {
|
||||||
return null;
|
return null;
|
||||||
|
@ -26,8 +26,8 @@ public class GenChunk extends ScopedLocalBlockQueue {
|
|||||||
public BiomeGrid biomeGrid;
|
public BiomeGrid biomeGrid;
|
||||||
public Chunk chunk;
|
public Chunk chunk;
|
||||||
public String world;
|
public String world;
|
||||||
public int cx;
|
public int chunkX;
|
||||||
public int cz;
|
public int chunkZ;
|
||||||
@Getter @Setter private ChunkData cd = null;
|
@Getter @Setter private ChunkData cd = null;
|
||||||
|
|
||||||
public GenChunk() {
|
public GenChunk() {
|
||||||
@ -39,7 +39,7 @@ public class GenChunk extends ScopedLocalBlockQueue {
|
|||||||
if (chunk == null) {
|
if (chunk == null) {
|
||||||
World worldObj = BukkitUtil.getWorld(world);
|
World worldObj = BukkitUtil.getWorld(world);
|
||||||
if (worldObj != null) {
|
if (worldObj != null) {
|
||||||
this.chunk = worldObj.getChunkAt(cx, cz);
|
this.chunk = worldObj.getChunkAt(chunkX, chunkZ);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return chunk;
|
return chunk;
|
||||||
@ -52,8 +52,8 @@ public class GenChunk extends ScopedLocalBlockQueue {
|
|||||||
public void setChunk(ChunkWrapper wrap) {
|
public void setChunk(ChunkWrapper wrap) {
|
||||||
chunk = null;
|
chunk = null;
|
||||||
world = wrap.world;
|
world = wrap.world;
|
||||||
cx = wrap.x;
|
chunkX = wrap.x;
|
||||||
cz = wrap.z;
|
chunkZ = wrap.z;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public void fillBiome(String biomeName) {
|
@Override public void fillBiome(String biomeName) {
|
||||||
@ -82,13 +82,13 @@ public class GenChunk extends ScopedLocalBlockQueue {
|
|||||||
Arrays.fill(data, start, end, block);
|
Arrays.fill(data, start, end, block);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
int minx = Math.min(pos1.getX(), pos2.getX());
|
int minX = Math.min(pos1.getX(), pos2.getX());
|
||||||
int miny = Math.min(pos1.getY(), pos2.getY());
|
int minY = Math.min(pos1.getY(), pos2.getY());
|
||||||
int minz = Math.min(pos1.getZ(), pos2.getZ());
|
int minZ = Math.min(pos1.getZ(), pos2.getZ());
|
||||||
int maxx = Math.max(pos1.getX(), pos2.getX());
|
int maxX = Math.max(pos1.getX(), pos2.getX());
|
||||||
int maxy = Math.max(pos1.getY(), pos2.getY());
|
int maxY = Math.max(pos1.getY(), pos2.getY());
|
||||||
int maxz = Math.max(pos1.getZ(), pos2.getZ());
|
int maxZ = Math.max(pos1.getZ(), pos2.getZ());
|
||||||
cd.setRegion(minx, miny, minz, maxx + 1, maxy + 1, maxz + 1, block.to(Material.class));
|
cd.setRegion(minX, minY, minZ, maxX + 1, maxY + 1, maxZ + 1, block.to(Material.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public boolean setBiome(int x, int z, String biome) {
|
@Override public boolean setBiome(int x, int z, String biome) {
|
||||||
@ -147,11 +147,11 @@ public class GenChunk extends ScopedLocalBlockQueue {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public int getX() {
|
public int getX() {
|
||||||
return chunk == null ? cx : chunk.getX();
|
return chunk == null ? chunkX : chunk.getX();
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getZ() {
|
public int getZ() {
|
||||||
return chunk == null ? cz : chunk.getZ();
|
return chunk == null ? chunkZ : chunk.getZ();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public String getWorld() {
|
@Override public String getWorld() {
|
||||||
|
@ -7,13 +7,14 @@ import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
|||||||
import com.github.intellectualsites.plotsquared.plot.uuid.UUIDWrapper;
|
import com.github.intellectualsites.plotsquared.plot.uuid.UUIDWrapper;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.OfflinePlayer;
|
import org.bukkit.OfflinePlayer;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
public class DefaultUUIDWrapper extends UUIDWrapper {
|
public class DefaultUUIDWrapper extends UUIDWrapper {
|
||||||
|
|
||||||
@Override public UUID getUUID(PlotPlayer player) {
|
@NotNull @Override public UUID getUUID(PlotPlayer player) {
|
||||||
return ((BukkitPlayer) player).player.getUniqueId();
|
return ((BukkitPlayer) player).player.getUniqueId();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,14 +4,14 @@ import com.github.intellectualsites.plotsquared.plot.object.OfflinePlotPlayer;
|
|||||||
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
||||||
import com.google.common.base.Charsets;
|
import com.google.common.base.Charsets;
|
||||||
import org.bukkit.OfflinePlayer;
|
import org.bukkit.OfflinePlayer;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
public class LowerOfflineUUIDWrapper extends OfflineUUIDWrapper {
|
public class LowerOfflineUUIDWrapper extends OfflineUUIDWrapper {
|
||||||
|
|
||||||
@Override public UUID getUUID(PlotPlayer player) {
|
@NotNull @Override public UUID getUUID(PlotPlayer player) {
|
||||||
return UUID.nameUUIDFromBytes(
|
return UUID.nameUUIDFromBytes(("OfflinePlayer:" + player.getName().toLowerCase()).getBytes(Charsets.UTF_8));
|
||||||
("OfflinePlayer:" + player.getName().toLowerCase()).getBytes(Charsets.UTF_8));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public UUID getUUID(OfflinePlotPlayer player) {
|
@Override public UUID getUUID(OfflinePlotPlayer player) {
|
||||||
|
@ -13,6 +13,7 @@ import org.bukkit.Bukkit;
|
|||||||
import org.bukkit.OfflinePlayer;
|
import org.bukkit.OfflinePlayer;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
@ -33,9 +34,8 @@ public class OfflineUUIDWrapper extends UUIDWrapper {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public UUID getUUID(PlotPlayer player) {
|
@NotNull @Override public UUID getUUID(PlotPlayer player) {
|
||||||
return UUID
|
return UUID.nameUUIDFromBytes(("OfflinePlayer:" + player.getName()).getBytes(Charsets.UTF_8));
|
||||||
.nameUUIDFromBytes(("OfflinePlayer:" + player.getName()).getBytes(Charsets.UTF_8));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public UUID getUUID(OfflinePlotPlayer player) {
|
@Override public UUID getUUID(OfflinePlotPlayer player) {
|
||||||
|
@ -10,7 +10,11 @@ import com.github.intellectualsites.plotsquared.plot.object.PlotMessage;
|
|||||||
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.RunnableVal2;
|
import com.github.intellectualsites.plotsquared.plot.object.RunnableVal2;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.RunnableVal3;
|
import com.github.intellectualsites.plotsquared.plot.object.RunnableVal3;
|
||||||
import com.github.intellectualsites.plotsquared.plot.util.*;
|
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 java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
@ -150,10 +154,10 @@ public abstract class Command {
|
|||||||
this.perm = declaration.permission();
|
this.perm = declaration.permission();
|
||||||
this.required = declaration.requiredType();
|
this.required = declaration.requiredType();
|
||||||
this.category = declaration.category();
|
this.category = declaration.category();
|
||||||
HashMap<String, Object> options = new HashMap<>();
|
|
||||||
List<String> aliasOptions = new ArrayList<>();
|
List<String> aliasOptions = new ArrayList<>();
|
||||||
aliasOptions.add(this.id);
|
aliasOptions.add(this.id);
|
||||||
aliasOptions.addAll(Arrays.asList(declaration.aliases()));
|
aliasOptions.addAll(Arrays.asList(declaration.aliases()));
|
||||||
|
HashMap<String, Object> options = new HashMap<>();
|
||||||
options.put("aliases", aliasOptions);
|
options.put("aliases", aliasOptions);
|
||||||
options.put("description", declaration.description());
|
options.put("description", declaration.description());
|
||||||
options.put("usage", declaration.usage());
|
options.put("usage", declaration.usage());
|
||||||
|
@ -212,10 +212,15 @@ public class ConfigurationSerialization {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
} catch (IllegalAccessException | InvocationTargetException | IllegalArgumentException ex) {
|
} catch (IllegalAccessException | InvocationTargetException | IllegalArgumentException ex) {
|
||||||
|
if (ex instanceof InvocationTargetException) {
|
||||||
Logger.getLogger(ConfigurationSerialization.class.getName()).log(Level.SEVERE,
|
Logger.getLogger(ConfigurationSerialization.class.getName()).log(Level.SEVERE,
|
||||||
"Could not call method '" + method.toString() + "' of " + this.clazz
|
"Could not call method '" + method.toString() + "' of " + this.clazz
|
||||||
+ " for deserialization",
|
+ " for deserialization", ex.getCause());
|
||||||
ex instanceof InvocationTargetException ? ex.getCause() : ex);
|
} else {
|
||||||
|
Logger.getLogger(ConfigurationSerialization.class.getName()).log(Level.SEVERE,
|
||||||
|
"Could not call method '" + method.toString() + "' of " + this.clazz
|
||||||
|
+ " for deserialization", ex);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
@ -226,10 +231,15 @@ public class ConfigurationSerialization {
|
|||||||
try {
|
try {
|
||||||
return ctor.newInstance(args);
|
return ctor.newInstance(args);
|
||||||
} catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException | InstantiationException ex) {
|
} catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException | InstantiationException ex) {
|
||||||
|
if (ex instanceof InvocationTargetException) {
|
||||||
Logger.getLogger(ConfigurationSerialization.class.getName()).log(Level.SEVERE,
|
Logger.getLogger(ConfigurationSerialization.class.getName()).log(Level.SEVERE,
|
||||||
"Could not call constructor '" + ctor.toString() + "' of " + this.clazz
|
"Could not call constructor '" + ctor.toString() + "' of " + this.clazz
|
||||||
+ " for deserialization",
|
+ " for deserialization", ex.getCause());
|
||||||
ex instanceof InvocationTargetException ? ex.getCause() : ex);
|
} else {
|
||||||
|
Logger.getLogger(ConfigurationSerialization.class.getName()).log(Level.SEVERE,
|
||||||
|
"Could not call constructor '" + ctor.toString() + "' of " + this.clazz
|
||||||
|
+ " for deserialization", ex);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
@ -5,8 +5,17 @@ import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
|||||||
import com.github.intellectualsites.plotsquared.plot.config.Captions;
|
import com.github.intellectualsites.plotsquared.plot.config.Captions;
|
||||||
import com.github.intellectualsites.plotsquared.plot.config.Settings;
|
import com.github.intellectualsites.plotsquared.plot.config.Settings;
|
||||||
import com.github.intellectualsites.plotsquared.plot.database.DBFunc;
|
import com.github.intellectualsites.plotsquared.plot.database.DBFunc;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.*;
|
import com.github.intellectualsites.plotsquared.plot.object.Expression;
|
||||||
import com.github.intellectualsites.plotsquared.plot.util.*;
|
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 javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
@ -68,15 +77,15 @@ public class Auto extends SubCommand {
|
|||||||
* @param player
|
* @param player
|
||||||
* @param area
|
* @param area
|
||||||
* @param start
|
* @param start
|
||||||
* @param schem
|
* @param schematic
|
||||||
*/
|
*/
|
||||||
public static void homeOrAuto(final PlotPlayer player, final PlotArea area, PlotId start,
|
public static void homeOrAuto(final PlotPlayer player, final PlotArea area, PlotId start,
|
||||||
final String schem) {
|
final String schematic) {
|
||||||
Set<Plot> plots = player.getPlots();
|
Set<Plot> plots = player.getPlots();
|
||||||
if (!plots.isEmpty()) {
|
if (!plots.isEmpty()) {
|
||||||
plots.iterator().next().teleportPlayer(player);
|
plots.iterator().next().teleportPlayer(player);
|
||||||
} else {
|
} else {
|
||||||
autoClaimSafe(player, area, start, schem);
|
autoClaimSafe(player, area, start, schematic);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -86,11 +95,11 @@ public class Auto extends SubCommand {
|
|||||||
* @param player
|
* @param player
|
||||||
* @param area
|
* @param area
|
||||||
* @param start
|
* @param start
|
||||||
* @param schem
|
* @param schematic
|
||||||
*/
|
*/
|
||||||
public static void autoClaimSafe(final PlotPlayer player, final PlotArea area, PlotId start,
|
public static void autoClaimSafe(final PlotPlayer player, final PlotArea area, PlotId start,
|
||||||
final String schem) {
|
final String schematic) {
|
||||||
autoClaimSafe(player, area, start, schem, null);
|
autoClaimSafe(player, area, start, schematic, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -99,10 +108,10 @@ public class Auto extends SubCommand {
|
|||||||
* @param player
|
* @param player
|
||||||
* @param area
|
* @param area
|
||||||
* @param start
|
* @param start
|
||||||
* @param schem
|
* @param schematic
|
||||||
*/
|
*/
|
||||||
public static void autoClaimSafe(final PlotPlayer player, final PlotArea area, PlotId start,
|
public static void autoClaimSafe(final PlotPlayer player, final PlotArea area, PlotId start,
|
||||||
final String schem, @Nullable final Integer allowedPlots) {
|
final String schematic, @Nullable final Integer allowedPlots) {
|
||||||
player.setMeta(Auto.class.getName(), true);
|
player.setMeta(Auto.class.getName(), true);
|
||||||
autoClaimFromDatabase(player, area, start, new RunnableVal<Plot>() {
|
autoClaimFromDatabase(player, area, start, new RunnableVal<Plot>() {
|
||||||
@Override public void run(final Plot plot) {
|
@Override public void run(final Plot plot) {
|
||||||
@ -112,7 +121,7 @@ public class Auto extends SubCommand {
|
|||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
MainUtil.sendMessage(player, Captions.NO_FREE_PLOTS);
|
MainUtil.sendMessage(player, Captions.NO_FREE_PLOTS);
|
||||||
} else if (checkAllowedPlots(player, area, allowedPlots, 1, 1)) {
|
} else if (checkAllowedPlots(player, area, allowedPlots, 1, 1)) {
|
||||||
plot.claim(player, true, schem, false);
|
plot.claim(player, true, schematic, false);
|
||||||
if (area.AUTO_MERGE) {
|
if (area.AUTO_MERGE) {
|
||||||
plot.autoMerge(-1, Integer.MAX_VALUE, player.getUUID(), true);
|
plot.autoMerge(-1, Integer.MAX_VALUE, player.getUUID(), true);
|
||||||
}
|
}
|
||||||
|
@ -36,14 +36,11 @@ import com.github.intellectualsites.plotsquared.plot.util.block.GlobalBlockQueue
|
|||||||
checkTrue(plot.getRunning() == 0, Captions.WAIT_FOR_TIMER);
|
checkTrue(plot.getRunning() == 0, Captions.WAIT_FOR_TIMER);
|
||||||
checkTrue(!Settings.Done.RESTRICT_BUILDING || !Flags.DONE.isSet(plot) || Permissions
|
checkTrue(!Settings.Done.RESTRICT_BUILDING || !Flags.DONE.isSet(plot) || Permissions
|
||||||
.hasPermission(player, Captions.PERMISSION_CONTINUE), Captions.DONE_ALREADY_DONE);
|
.hasPermission(player, Captions.PERMISSION_CONTINUE), Captions.DONE_ALREADY_DONE);
|
||||||
confirm.run(this, new Runnable() {
|
confirm.run(this, () -> {
|
||||||
@Override public void run() {
|
|
||||||
final long start = System.currentTimeMillis();
|
final long start = System.currentTimeMillis();
|
||||||
boolean result = plot.clear(true, false, new Runnable() {
|
boolean result = plot.clear(true, false, () -> {
|
||||||
@Override public void run() {
|
|
||||||
plot.unlink();
|
plot.unlink();
|
||||||
GlobalBlockQueue.IMP.addTask(new Runnable() {
|
GlobalBlockQueue.IMP.addTask(() -> {
|
||||||
@Override public void run() {
|
|
||||||
plot.removeRunning();
|
plot.removeRunning();
|
||||||
// If the state changes, then mark it as no longer done
|
// If the state changes, then mark it as no longer done
|
||||||
if (plot.getFlag(Flags.DONE).isPresent()) {
|
if (plot.getFlag(Flags.DONE).isPresent()) {
|
||||||
@ -54,16 +51,13 @@ import com.github.intellectualsites.plotsquared.plot.util.block.GlobalBlockQueue
|
|||||||
}
|
}
|
||||||
MainUtil.sendMessage(player, Captions.CLEARING_DONE,
|
MainUtil.sendMessage(player, Captions.CLEARING_DONE,
|
||||||
"" + (System.currentTimeMillis() - start));
|
"" + (System.currentTimeMillis() - start));
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
|
||||||
});
|
});
|
||||||
if (!result) {
|
if (!result) {
|
||||||
MainUtil.sendMessage(player, Captions.WAIT_FOR_TIMER);
|
MainUtil.sendMessage(player, Captions.WAIT_FOR_TIMER);
|
||||||
} else {
|
} else {
|
||||||
plot.addRunning();
|
plot.addRunning();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}, null);
|
}, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -466,7 +466,6 @@ import java.util.UUID;
|
|||||||
PlotSquared.get().getPlots(player.getLocation().getWorld(), uuid))) {
|
PlotSquared.get().getPlots(player.getLocation().getWorld(), uuid))) {
|
||||||
PlotCluster current = plot.getCluster();
|
PlotCluster current = plot.getCluster();
|
||||||
if (current != null && current.equals(cluster)) {
|
if (current != null && current.equals(cluster)) {
|
||||||
player.getLocation().getWorld();
|
|
||||||
plot.unclaim();
|
plot.unclaim();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,8 +11,12 @@ import com.github.intellectualsites.plotsquared.plot.util.MathMan;
|
|||||||
import com.github.intellectualsites.plotsquared.plot.util.TaskManager;
|
import com.github.intellectualsites.plotsquared.plot.util.TaskManager;
|
||||||
import com.github.intellectualsites.plotsquared.plot.util.WorldUtil;
|
import com.github.intellectualsites.plotsquared.plot.util.WorldUtil;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.*;
|
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
|
|
||||||
@CommandDeclaration(command = "condense", permission = "plots.admin",
|
@CommandDeclaration(command = "condense", permission = "plots.admin",
|
||||||
@ -104,6 +108,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
MainUtil.sendMessage(player, "TASK STARTED...");
|
MainUtil.sendMessage(player, "TASK STARTED...");
|
||||||
|
Condense.TASK = true;
|
||||||
Runnable run = new Runnable() {
|
Runnable run = new Runnable() {
|
||||||
@Override public void run() {
|
@Override public void run() {
|
||||||
if (!Condense.TASK) {
|
if (!Condense.TASK) {
|
||||||
@ -147,7 +152,6 @@ import java.util.concurrent.atomic.AtomicBoolean;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
Condense.TASK = true;
|
|
||||||
TaskManager.runTaskAsync(run);
|
TaskManager.runTaskAsync(run);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -87,8 +87,8 @@ import java.util.Map.Entry;
|
|||||||
HashMap<String, HashMap<PlotId, Plot>> map = manager.getPlots();
|
HashMap<String, HashMap<PlotId, Plot>> map = manager.getPlots();
|
||||||
plots = new ArrayList<>();
|
plots = new ArrayList<>();
|
||||||
for (Entry<String, HashMap<PlotId, Plot>> entry : map.entrySet()) {
|
for (Entry<String, HashMap<PlotId, Plot>> entry : map.entrySet()) {
|
||||||
String areaname = entry.getKey();
|
String areaName = entry.getKey();
|
||||||
PlotArea pa = PlotSquared.get().getPlotAreaByString(areaname);
|
PlotArea pa = PlotSquared.get().getPlotAreaByString(areaName);
|
||||||
if (pa != null) {
|
if (pa != null) {
|
||||||
for (Entry<PlotId, Plot> entry2 : entry.getValue().entrySet()) {
|
for (Entry<PlotId, Plot> entry2 : entry.getValue().entrySet()) {
|
||||||
Plot plot = entry2.getValue();
|
Plot plot = entry2.getValue();
|
||||||
@ -123,9 +123,9 @@ import java.util.Map.Entry;
|
|||||||
plots.add(plot);
|
plots.add(plot);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
HashMap<PlotId, Plot> plotmap = PlotSquared.get().plots_tmp
|
HashMap<PlotId, Plot> plotMap = PlotSquared.get().plots_tmp
|
||||||
.computeIfAbsent(areaname, k -> new HashMap<>());
|
.computeIfAbsent(areaName, k -> new HashMap<>());
|
||||||
plotmap.putAll(entry.getValue());
|
plotMap.putAll(entry.getValue());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
DBFunc.createPlotsAndData(plots,
|
DBFunc.createPlotsAndData(plots,
|
||||||
|
@ -27,11 +27,11 @@ import java.util.stream.Collectors;
|
|||||||
extends SubCommand {
|
extends SubCommand {
|
||||||
|
|
||||||
private static String readFile(@NonNull final File file) throws IOException {
|
private static String readFile(@NonNull final File file) throws IOException {
|
||||||
final StringBuilder content = new StringBuilder();
|
|
||||||
final List<String> lines;
|
final List<String> lines;
|
||||||
try (final BufferedReader reader = new BufferedReader(new FileReader(file))) {
|
try (final BufferedReader reader = new BufferedReader(new FileReader(file))) {
|
||||||
lines = reader.lines().collect(Collectors.toList());
|
lines = reader.lines().collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
final StringBuilder content = new StringBuilder();
|
||||||
for (int i = Math.max(0, lines.size() - 1000); i < lines.size(); i++) {
|
for (int i = Math.max(0, lines.size() - 1000); i < lines.size(); i++) {
|
||||||
content.append(lines.get(i)).append("\n");
|
content.append(lines.get(i)).append("\n");
|
||||||
}
|
}
|
||||||
@ -41,7 +41,6 @@ import java.util.stream.Collectors;
|
|||||||
@Override public boolean onCommand(final PlotPlayer player, String[] args) {
|
@Override public boolean onCommand(final PlotPlayer player, String[] args) {
|
||||||
TaskManager.runTaskAsync(() -> {
|
TaskManager.runTaskAsync(() -> {
|
||||||
try {
|
try {
|
||||||
final IncendoPaster incendoPaster = new IncendoPaster("plotsquared");
|
|
||||||
|
|
||||||
StringBuilder b = new StringBuilder();
|
StringBuilder b = new StringBuilder();
|
||||||
b.append(
|
b.append(
|
||||||
@ -79,6 +78,7 @@ import java.util.stream.Collectors;
|
|||||||
"\n# You can do so at https://github.com/IntellectualSites/PlotSquared/issues");
|
"\n# You can do so at https://github.com/IntellectualSites/PlotSquared/issues");
|
||||||
b.append("\n# or via our Discord at https://discord.gg/ngZCzbU");
|
b.append("\n# or via our Discord at https://discord.gg/ngZCzbU");
|
||||||
|
|
||||||
|
final IncendoPaster incendoPaster = new IncendoPaster("plotsquared");
|
||||||
incendoPaster.addFile(new IncendoPaster.PasteFile("information", b.toString()));
|
incendoPaster.addFile(new IncendoPaster.PasteFile("information", b.toString()));
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -8,9 +8,13 @@ import com.github.intellectualsites.plotsquared.plot.database.DBFunc;
|
|||||||
import com.github.intellectualsites.plotsquared.plot.object.Location;
|
import com.github.intellectualsites.plotsquared.plot.object.Location;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.Plot;
|
import com.github.intellectualsites.plotsquared.plot.object.Plot;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
||||||
import com.github.intellectualsites.plotsquared.plot.util.*;
|
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.UUIDHandler;
|
||||||
|
import com.github.intellectualsites.plotsquared.plot.util.WorldUtil;
|
||||||
|
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
@ -44,9 +48,7 @@ import java.util.UUID;
|
|||||||
MainUtil.sendMessage(player, Captions.INVALID_PLAYER, args[0]);
|
MainUtil.sendMessage(player, Captions.INVALID_PLAYER, args[0]);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Iterator<UUID> iter = uuids.iterator();
|
for (UUID uuid : uuids) {
|
||||||
while (iter.hasNext()) {
|
|
||||||
UUID uuid = iter.next();
|
|
||||||
if (uuid == DBFunc.EVERYONE && !(
|
if (uuid == DBFunc.EVERYONE && !(
|
||||||
Permissions.hasPermission(player, Captions.PERMISSION_DENY_EVERYONE) || Permissions
|
Permissions.hasPermission(player, Captions.PERMISSION_DENY_EVERYONE) || Permissions
|
||||||
.hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_DENY))) {
|
.hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_DENY))) {
|
||||||
|
@ -5,12 +5,22 @@ import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
|||||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared.SortType;
|
import com.github.intellectualsites.plotsquared.plot.PlotSquared.SortType;
|
||||||
import com.github.intellectualsites.plotsquared.plot.config.Captions;
|
import com.github.intellectualsites.plotsquared.plot.config.Captions;
|
||||||
import com.github.intellectualsites.plotsquared.plot.flag.Flags;
|
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.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.*;
|
||||||
import com.github.intellectualsites.plotsquared.plot.util.expiry.ExpireManager;
|
import com.github.intellectualsites.plotsquared.plot.util.expiry.ExpireManager;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
|
import java.util.Optional;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
@CommandDeclaration(command = "list", aliases = {"l", "find", "search"}, description = "List plots",
|
@CommandDeclaration(command = "list", aliases = {"l", "find", "search"}, description = "List plots",
|
||||||
permission = "plots.list", category = CommandCategory.INFO,
|
permission = "plots.list", category = CommandCategory.INFO,
|
||||||
@ -20,7 +30,7 @@ public class ListCmd extends SubCommand {
|
|||||||
private String[] getArgumentList(PlotPlayer player) {
|
private String[] getArgumentList(PlotPlayer player) {
|
||||||
List<String> args = new ArrayList<>();
|
List<String> args = new ArrayList<>();
|
||||||
if (EconHandler.manager != null && Permissions
|
if (EconHandler.manager != null && Permissions
|
||||||
.hasPermission(player, Captions.PERMISSION_LIST_FORSALE)) {
|
.hasPermission(player, Captions.PERMISSION_LIST_FOR_SALE)) {
|
||||||
args.add("forsale");
|
args.add("forsale");
|
||||||
}
|
}
|
||||||
if (Permissions.hasPermission(player, Captions.PERMISSION_LIST_MINE)) {
|
if (Permissions.hasPermission(player, Captions.PERMISSION_LIST_MINE)) {
|
||||||
@ -222,9 +232,9 @@ public class ListCmd extends SubCommand {
|
|||||||
sort = false;
|
sort = false;
|
||||||
break;
|
break;
|
||||||
case "forsale":
|
case "forsale":
|
||||||
if (!Permissions.hasPermission(player, Captions.PERMISSION_LIST_FORSALE)) {
|
if (!Permissions.hasPermission(player, Captions.PERMISSION_LIST_FOR_SALE)) {
|
||||||
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
|
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
|
||||||
Captions.PERMISSION_LIST_FORSALE);
|
Captions.PERMISSION_LIST_FOR_SALE);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (EconHandler.manager == null) {
|
if (EconHandler.manager == null) {
|
||||||
|
@ -4,7 +4,11 @@ import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
|||||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||||
import com.github.intellectualsites.plotsquared.plot.config.Captions;
|
import com.github.intellectualsites.plotsquared.plot.config.Captions;
|
||||||
import com.github.intellectualsites.plotsquared.plot.config.Settings;
|
import com.github.intellectualsites.plotsquared.plot.config.Settings;
|
||||||
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.PlotId;
|
||||||
|
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
||||||
|
import com.github.intellectualsites.plotsquared.plot.object.RunnableVal;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.schematic.Schematic;
|
import com.github.intellectualsites.plotsquared.plot.object.schematic.Schematic;
|
||||||
import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
|
import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
|
||||||
import com.github.intellectualsites.plotsquared.plot.util.Permissions;
|
import com.github.intellectualsites.plotsquared.plot.util.Permissions;
|
||||||
@ -50,9 +54,9 @@ import java.util.List;
|
|||||||
MainUtil.sendMessage(player, Captions.LOAD_NULL);
|
MainUtil.sendMessage(player, Captions.LOAD_NULL);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
String schem;
|
String schematic;
|
||||||
try {
|
try {
|
||||||
schem = schematics.get(Integer.parseInt(args[0]) - 1);
|
schematic = schematics.get(Integer.parseInt(args[0]) - 1);
|
||||||
} catch (Exception ignored) {
|
} catch (Exception ignored) {
|
||||||
// use /plot load <index>
|
// use /plot load <index>
|
||||||
MainUtil.sendMessage(player, Captions.NOT_VALID_NUMBER,
|
MainUtil.sendMessage(player, Captions.NOT_VALID_NUMBER,
|
||||||
@ -61,7 +65,7 @@ import java.util.List;
|
|||||||
}
|
}
|
||||||
final URL url;
|
final URL url;
|
||||||
try {
|
try {
|
||||||
url = new URL(Settings.Web.URL + "saves/" + player.getUUID() + '/' + schem);
|
url = new URL(Settings.Web.URL + "saves/" + player.getUUID() + '/' + schematic);
|
||||||
} catch (MalformedURLException e) {
|
} catch (MalformedURLException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
MainUtil.sendMessage(player, Captions.LOAD_FAILED);
|
MainUtil.sendMessage(player, Captions.LOAD_FAILED);
|
||||||
@ -70,8 +74,8 @@ import java.util.List;
|
|||||||
plot.addRunning();
|
plot.addRunning();
|
||||||
MainUtil.sendMessage(player, Captions.GENERATING_COMPONENT);
|
MainUtil.sendMessage(player, Captions.GENERATING_COMPONENT);
|
||||||
TaskManager.runTaskAsync(() -> {
|
TaskManager.runTaskAsync(() -> {
|
||||||
Schematic schematic = SchematicHandler.manager.getSchematic(url);
|
Schematic taskSchematic = SchematicHandler.manager.getSchematic(url);
|
||||||
if (schematic == null) {
|
if (taskSchematic == null) {
|
||||||
plot.removeRunning();
|
plot.removeRunning();
|
||||||
sendMessage(player, Captions.SCHEMATIC_INVALID,
|
sendMessage(player, Captions.SCHEMATIC_INVALID,
|
||||||
"non-existent or not in gzip format");
|
"non-existent or not in gzip format");
|
||||||
@ -79,7 +83,7 @@ import java.util.List;
|
|||||||
}
|
}
|
||||||
PlotArea area = plot.getArea();
|
PlotArea area = plot.getArea();
|
||||||
SchematicHandler.manager
|
SchematicHandler.manager
|
||||||
.paste(schematic, plot, 0, area.MIN_BUILD_HEIGHT, 0, false,
|
.paste(taskSchematic, plot, 0, area.MIN_BUILD_HEIGHT, 0, false,
|
||||||
new RunnableVal<Boolean>() {
|
new RunnableVal<Boolean>() {
|
||||||
@Override public void run(Boolean value) {
|
@Override public void run(Boolean value) {
|
||||||
plot.removeRunning();
|
plot.removeRunning();
|
||||||
|
@ -44,11 +44,11 @@ import java.util.UUID;
|
|||||||
int count = 0;
|
int count = 0;
|
||||||
switch (args[0]) {
|
switch (args[0]) {
|
||||||
case "unknown": {
|
case "unknown": {
|
||||||
ArrayList<UUID> toRemove = new ArrayList<>();
|
|
||||||
HashSet<UUID> all = new HashSet<>();
|
HashSet<UUID> all = new HashSet<>();
|
||||||
all.addAll(plot.getMembers());
|
all.addAll(plot.getMembers());
|
||||||
all.addAll(plot.getTrusted());
|
all.addAll(plot.getTrusted());
|
||||||
all.addAll(plot.getDenied());
|
all.addAll(plot.getDenied());
|
||||||
|
ArrayList<UUID> toRemove = new ArrayList<>();
|
||||||
for (UUID uuid : all) {
|
for (UUID uuid : all) {
|
||||||
if (UUIDHandler.getName(uuid) == null) {
|
if (UUIDHandler.getName(uuid) == null) {
|
||||||
toRemove.add(uuid);
|
toRemove.add(uuid);
|
||||||
|
@ -4,9 +4,19 @@ import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
|
|||||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||||
import com.github.intellectualsites.plotsquared.plot.config.Captions;
|
import com.github.intellectualsites.plotsquared.plot.config.Captions;
|
||||||
import com.github.intellectualsites.plotsquared.plot.config.Settings;
|
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.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.object.schematic.Schematic;
|
import com.github.intellectualsites.plotsquared.plot.object.schematic.Schematic;
|
||||||
import com.github.intellectualsites.plotsquared.plot.util.*;
|
import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
|
||||||
|
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.google.common.collect.Lists;
|
||||||
|
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -191,9 +201,7 @@ public class SchematicCmd extends SubCommand {
|
|||||||
MainUtil.sendMessage(player, Captions.NO_PLOT_PERMS);
|
MainUtil.sendMessage(player, Captions.NO_PLOT_PERMS);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
location.getWorld();
|
ArrayList<Plot> plots = Lists.newArrayList(plot);
|
||||||
Collection<Plot> plots = new ArrayList<>();
|
|
||||||
plots.add(plot);
|
|
||||||
boolean result = SchematicHandler.manager.exportAll(plots, null, null, () -> {
|
boolean result = SchematicHandler.manager.exportAll(plots, null, null, () -> {
|
||||||
MainUtil.sendMessage(player, "&aFinished export");
|
MainUtil.sendMessage(player, "&aFinished export");
|
||||||
SchematicCmd.this.running = false;
|
SchematicCmd.this.running = false;
|
||||||
@ -212,7 +220,7 @@ public class SchematicCmd extends SubCommand {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final String string =
|
final String string =
|
||||||
StringMan.join(SchematicHandler.manager.getShematicNames(), "$2, $1");
|
StringMan.join(SchematicHandler.manager.getSchematicNames(), "$2, $1");
|
||||||
Captions.SCHEMATIC_LIST.send(player, string);
|
Captions.SCHEMATIC_LIST.send(player, string);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -6,7 +6,11 @@ import com.github.intellectualsites.plotsquared.plot.config.Captions;
|
|||||||
import com.github.intellectualsites.plotsquared.plot.config.Configuration;
|
import com.github.intellectualsites.plotsquared.plot.config.Configuration;
|
||||||
import com.github.intellectualsites.plotsquared.plot.config.ConfigurationNode;
|
import com.github.intellectualsites.plotsquared.plot.config.ConfigurationNode;
|
||||||
import com.github.intellectualsites.plotsquared.plot.generator.GeneratorWrapper;
|
import com.github.intellectualsites.plotsquared.plot.generator.GeneratorWrapper;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.*;
|
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.SetupObject;
|
||||||
import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
|
import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
|
||||||
import com.github.intellectualsites.plotsquared.plot.util.SetupUtils;
|
import com.github.intellectualsites.plotsquared.plot.util.SetupUtils;
|
||||||
import com.github.intellectualsites.plotsquared.plot.util.StringMan;
|
import com.github.intellectualsites.plotsquared.plot.util.StringMan;
|
||||||
@ -345,7 +349,7 @@ import java.util.Map.Entry;
|
|||||||
return messages;
|
return messages;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public boolean parseInut(String input) {
|
@Override public boolean parseInput(String input) {
|
||||||
this.generator = input.toLowerCase();
|
this.generator = input.toLowerCase();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -385,7 +389,7 @@ import java.util.Map.Entry;
|
|||||||
return messages;
|
return messages;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public boolean parseInut(String input) {
|
@Override public boolean parseInput(String input) {
|
||||||
if (!WORLD_TYPES.keySet().contains(input.toLowerCase())) {
|
if (!WORLD_TYPES.keySet().contains(input.toLowerCase())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -416,7 +420,7 @@ import java.util.Map.Entry;
|
|||||||
|
|
||||||
public abstract Collection<PlotMessage> showDescriptionMessage();
|
public abstract Collection<PlotMessage> showDescriptionMessage();
|
||||||
|
|
||||||
public abstract boolean parseInut(String input);
|
public abstract boolean parseInput(String input);
|
||||||
|
|
||||||
public final PlotMessage getUsage() {
|
public final PlotMessage getUsage() {
|
||||||
return new PlotMessage("Usage: ").color("$1")
|
return new PlotMessage("Usage: ").color("$1")
|
||||||
|
@ -39,25 +39,25 @@ import java.util.UUID;
|
|||||||
checkTrue(args.length == 1, Captions.COMMAND_SYNTAX, getUsage());
|
checkTrue(args.length == 1, Captions.COMMAND_SYNTAX, getUsage());
|
||||||
final Set<UUID> uuids = MainUtil.getUUIDsFromString(args[0]);
|
final Set<UUID> uuids = MainUtil.getUUIDsFromString(args[0]);
|
||||||
checkTrue(!uuids.isEmpty(), Captions.INVALID_PLAYER, args[0]);
|
checkTrue(!uuids.isEmpty(), Captions.INVALID_PLAYER, args[0]);
|
||||||
Iterator<UUID> iter = uuids.iterator();
|
Iterator<UUID> iterator = uuids.iterator();
|
||||||
int size = currentPlot.getTrusted().size() + currentPlot.getMembers().size();
|
int size = currentPlot.getTrusted().size() + currentPlot.getMembers().size();
|
||||||
while (iter.hasNext()) {
|
while (iterator.hasNext()) {
|
||||||
UUID uuid = iter.next();
|
UUID uuid = iterator.next();
|
||||||
if (uuid == DBFunc.EVERYONE && !(
|
if (uuid == DBFunc.EVERYONE && !(
|
||||||
Permissions.hasPermission(player, Captions.PERMISSION_TRUST_EVERYONE) || Permissions
|
Permissions.hasPermission(player, Captions.PERMISSION_TRUST_EVERYONE) || Permissions
|
||||||
.hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_TRUST))) {
|
.hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_TRUST))) {
|
||||||
MainUtil.sendMessage(player, Captions.INVALID_PLAYER, MainUtil.getName(uuid));
|
MainUtil.sendMessage(player, Captions.INVALID_PLAYER, MainUtil.getName(uuid));
|
||||||
iter.remove();
|
iterator.remove();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (currentPlot.isOwner(uuid)) {
|
if (currentPlot.isOwner(uuid)) {
|
||||||
MainUtil.sendMessage(player, Captions.ALREADY_OWNER, MainUtil.getName(uuid));
|
MainUtil.sendMessage(player, Captions.ALREADY_OWNER, MainUtil.getName(uuid));
|
||||||
iter.remove();
|
iterator.remove();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (currentPlot.getTrusted().contains(uuid)) {
|
if (currentPlot.getTrusted().contains(uuid)) {
|
||||||
MainUtil.sendMessage(player, Captions.ALREADY_ADDED, MainUtil.getName(uuid));
|
MainUtil.sendMessage(player, Captions.ALREADY_ADDED, MainUtil.getName(uuid));
|
||||||
iter.remove();
|
iterator.remove();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
size += currentPlot.getMembers().contains(uuid) ? 0 : 1;
|
size += currentPlot.getMembers().contains(uuid) ? 0 : 1;
|
||||||
|
@ -125,8 +125,8 @@ public enum Captions {
|
|||||||
PERMISSION_FLAG_ADD("plots.flag.add", "static.permissions"),
|
PERMISSION_FLAG_ADD("plots.flag.add", "static.permissions"),
|
||||||
PERMISSION_FLAG_LIST("plots.flag.list", "static.permissions"),
|
PERMISSION_FLAG_LIST("plots.flag.list", "static.permissions"),
|
||||||
PERMISSION_ADMIN_COMMAND_KICK("plots.admin.command.kick", "static.permissions"),
|
PERMISSION_ADMIN_COMMAND_KICK("plots.admin.command.kick", "static.permissions"),
|
||||||
PERMISSION_GRANT("plots.grant.%s0", "static.permissions"),
|
PERMISSION_GRANT("plots.grant.%s0", "static.permissions"), PERMISSION_LIST_FOR_SALE(
|
||||||
PERMISSION_LIST_FORSALE("plots.list.forsale", "static.permissions"),
|
"plots.list.forsale", "static.permissions"),
|
||||||
PERMISSION_LIST_MINE("plots.list.mine", "static.permissions"),
|
PERMISSION_LIST_MINE("plots.list.mine", "static.permissions"),
|
||||||
PERMISSION_LIST_SHARED("plots.list.shared", "static.permissions"),
|
PERMISSION_LIST_SHARED("plots.list.shared", "static.permissions"),
|
||||||
PERMISSION_LIST_WORLD("plots.list.world", "static.permissions"),
|
PERMISSION_LIST_WORLD("plots.list.world", "static.permissions"),
|
||||||
@ -211,37 +211,25 @@ public enum Captions {
|
|||||||
CLUSTER_AVAILABLE_ARGS(
|
CLUSTER_AVAILABLE_ARGS(
|
||||||
"$1The following sub commands are available: $4list$2, $4create$2, $4delete$2, $4resize$2, $4invite$2, $4kick$2, $4leave$2, "
|
"$1The following sub commands are available: $4list$2, $4create$2, $4delete$2, $4resize$2, $4invite$2, $4kick$2, $4leave$2, "
|
||||||
+ "$4members$2, $4info$2, $4tp$2, $4sethome", "Cluster"), CLUSTER_LIST_HEADING(
|
+ "$4members$2, $4info$2, $4tp$2, $4sethome", "Cluster"), CLUSTER_LIST_HEADING(
|
||||||
"$2There are $1%s$2 clusters in this world", "Cluster"),
|
"$2There are $1%s$2 clusters in this world", "Cluster"), CLUSTER_LIST_ELEMENT("$2 - $1%s&-",
|
||||||
|
"Cluster"), CLUSTER_INTERSECTION(
|
||||||
CLUSTER_LIST_ELEMENT("$2 - $1%s&-", "Cluster"), CLUSTER_INTERSECTION(
|
"$2The proposed area overlaps with: %s0", "Cluster"), CLUSTER_OUTSIDE(
|
||||||
"$2The proposed area overlaps with: %s0", "Cluster"),
|
"$2The proposed area is outside the plot area: %s0", "Cluster"), CLUSTER_ADDED(
|
||||||
|
"$4Successfully created the cluster.", "Cluster"), CLUSTER_DELETED(
|
||||||
CLUSTER_OUTSIDE("$2The proposed area is outside the plot area: %s0", "Cluster"), CLUSTER_ADDED(
|
"$4Successfully deleted the cluster.", "Cluster"), CLUSTER_RESIZED(
|
||||||
"$4Successfully created the cluster.", "Cluster"),
|
"$4Successfully resized the cluster.", "Cluster"), CLUSTER_ADDED_USER(
|
||||||
|
"$4Successfully added user to the cluster.", "Cluster"), CANNOT_KICK_PLAYER(
|
||||||
CLUSTER_DELETED("$4Successfully deleted the cluster.", "Cluster"), CLUSTER_RESIZED(
|
"$2You cannot kick that player", "Cluster"), CLUSTER_INVITED(
|
||||||
"$4Successfully resized the cluster.", "Cluster"),
|
"$1You have been invited to the following cluster: $2%s", "Cluster"), CLUSTER_REMOVED(
|
||||||
|
"$1You have been removed from cluster: $2%s", "Cluster"), CLUSTER_KICKED_USER(
|
||||||
CLUSTER_ADDED_USER("$4Successfully added user to the cluster.", "Cluster"), CANNOT_KICK_PLAYER(
|
"$4Successfully kicked the user", "Cluster"), INVALID_CLUSTER(
|
||||||
"$2You cannot kick that player", "Cluster"),
|
"$1Invalid cluster name: $2%s", "Cluster"), CLUSTER_NOT_ADDED(
|
||||||
|
"$2That player was not added to the plot cluster", "Cluster"), CLUSTER_CANNOT_LEAVE(
|
||||||
CLUSTER_INVITED("$1You have been invited to the following cluster: $2%s",
|
"$1You must delete or transfer ownership before leaving",
|
||||||
"Cluster"), CLUSTER_REMOVED("$1You have been removed from cluster: $2%s", "Cluster"),
|
"Cluster"), CLUSTER_ADDED_HELPER("$4Successfully added a helper to the cluster",
|
||||||
|
|
||||||
CLUSTER_KICKED_USER("$4Successfully kicked the user", "Cluster"), INVALID_CLUSTER(
|
|
||||||
"$1Invalid cluster name: $2%s", "Cluster"),
|
|
||||||
|
|
||||||
CLUSTER_NOT_ADDED("$2That player was not added to the plot cluster",
|
|
||||||
"Cluster"), CLUSTER_CANNOT_LEAVE("$1You must delete or transfer ownership before leaving",
|
|
||||||
"Cluster"),
|
|
||||||
|
|
||||||
CLUSTER_ADDED_HELPER("$4Successfully added a helper to the cluster",
|
|
||||||
"Cluster"), CLUSTER_REMOVED_HELPER("$4Successfully removed a helper from the cluster",
|
"Cluster"), CLUSTER_REMOVED_HELPER("$4Successfully removed a helper from the cluster",
|
||||||
"Cluster"),
|
"Cluster"), CLUSTER_REGENERATED("$4Successfully started cluster regeneration",
|
||||||
|
|
||||||
CLUSTER_REGENERATED("$4Successfully started cluster regeneration",
|
|
||||||
"Cluster"), CLUSTER_TELEPORTING("$4Teleporting...", "Cluster"),
|
"Cluster"), CLUSTER_TELEPORTING("$4Teleporting...", "Cluster"),
|
||||||
|
|
||||||
CLUSTER_INFO(
|
CLUSTER_INFO(
|
||||||
"$1Current cluster: $2%id%&-$1Name: $2%name%&-$1Owner: $2%owner%&-$1Size: $2%size%&-$1Rights: $2%rights%",
|
"$1Current cluster: $2%id%&-$1Name: $2%name%&-$1Owner: $2%owner%&-$1Size: $2%size%&-$1Rights: $2%rights%",
|
||||||
"Cluster"),
|
"Cluster"),
|
||||||
|
@ -308,7 +308,6 @@ import java.util.concurrent.atomic.AtomicInteger;
|
|||||||
PlotSquared.debug("============ DATABASE ERROR ============");
|
PlotSquared.debug("============ DATABASE ERROR ============");
|
||||||
PlotSquared.debug("There was an error updating the database.");
|
PlotSquared.debug("There was an error updating the database.");
|
||||||
PlotSquared.debug(" - It will be corrected on shutdown");
|
PlotSquared.debug(" - It will be corrected on shutdown");
|
||||||
PlotSquared.debug("========================================");
|
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
PlotSquared.debug("========================================");
|
PlotSquared.debug("========================================");
|
||||||
}
|
}
|
||||||
@ -326,15 +325,15 @@ import java.util.concurrent.atomic.AtomicInteger;
|
|||||||
PreparedStatement statement = null;
|
PreparedStatement statement = null;
|
||||||
UniqueStatement task = null;
|
UniqueStatement task = null;
|
||||||
UniqueStatement lastTask = null;
|
UniqueStatement lastTask = null;
|
||||||
Iterator<Entry<Plot, Queue<UniqueStatement>>> iter =
|
Iterator<Entry<Plot, Queue<UniqueStatement>>> iterator =
|
||||||
this.plotTasks.entrySet().iterator();
|
this.plotTasks.entrySet().iterator();
|
||||||
while (iter.hasNext()) {
|
while (iterator.hasNext()) {
|
||||||
try {
|
try {
|
||||||
Entry<Plot, Queue<UniqueStatement>> entry = iter.next();
|
Entry<Plot, Queue<UniqueStatement>> entry = iterator.next();
|
||||||
Plot plot = entry.getKey();
|
Plot plot = entry.getKey();
|
||||||
Queue<UniqueStatement> tasks = entry.getValue();
|
Queue<UniqueStatement> tasks = entry.getValue();
|
||||||
if (tasks.isEmpty()) {
|
if (tasks.isEmpty()) {
|
||||||
iter.remove();
|
iterator.remove();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
task = tasks.remove();
|
task = tasks.remove();
|
||||||
@ -352,7 +351,7 @@ import java.util.concurrent.atomic.AtomicInteger;
|
|||||||
task.set(statement);
|
task.set(statement);
|
||||||
task.addBatch(statement);
|
task.addBatch(statement);
|
||||||
try {
|
try {
|
||||||
if (statement != null && statement.isClosed()) {
|
if (statement.isClosed()) {
|
||||||
statement = null;
|
statement = null;
|
||||||
}
|
}
|
||||||
} catch (AbstractMethodError ignore) {
|
} catch (AbstractMethodError ignore) {
|
||||||
@ -1615,17 +1614,17 @@ import java.util.concurrent.atomic.AtomicInteger;
|
|||||||
PlotId plot_id = new PlotId(resultSet.getInt("plot_id_x"),
|
PlotId plot_id = new PlotId(resultSet.getInt("plot_id_x"),
|
||||||
resultSet.getInt("plot_id_z"));
|
resultSet.getInt("plot_id_z"));
|
||||||
id = resultSet.getInt("id");
|
id = resultSet.getInt("id");
|
||||||
String areaid = resultSet.getString("world");
|
String areaID = resultSet.getString("world");
|
||||||
if (!areas.contains(areaid)) {
|
if (!areas.contains(areaID)) {
|
||||||
if (Settings.Enabled_Components.DATABASE_PURGER) {
|
if (Settings.Enabled_Components.DATABASE_PURGER) {
|
||||||
toDelete.add(id);
|
toDelete.add(id);
|
||||||
continue;
|
continue;
|
||||||
} else {
|
} else {
|
||||||
AtomicInteger value = noExist.get(areaid);
|
AtomicInteger value = noExist.get(areaID);
|
||||||
if (value != null) {
|
if (value != null) {
|
||||||
value.incrementAndGet();
|
value.incrementAndGet();
|
||||||
} else {
|
} else {
|
||||||
noExist.put(areaid, new AtomicInteger(1));
|
noExist.put(areaID, new AtomicInteger(1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1657,7 +1656,7 @@ import java.util.concurrent.atomic.AtomicInteger;
|
|||||||
.getTime();
|
.getTime();
|
||||||
} catch (ParseException e) {
|
} catch (ParseException e) {
|
||||||
PlotSquared.debug(
|
PlotSquared.debug(
|
||||||
"Could not parse date for plot: #" + id + "(" + areaid + ";"
|
"Could not parse date for plot: #" + id + "(" + areaID + ";"
|
||||||
+ plot_id + ") (" + parsable + ")");
|
+ plot_id + ") (" + parsable + ")");
|
||||||
time = System.currentTimeMillis() + id;
|
time = System.currentTimeMillis() + id;
|
||||||
}
|
}
|
||||||
@ -1665,7 +1664,7 @@ import java.util.concurrent.atomic.AtomicInteger;
|
|||||||
Plot p = new Plot(plot_id, user, new HashSet<>(), new HashSet<>(),
|
Plot p = new Plot(plot_id, user, new HashSet<>(), new HashSet<>(),
|
||||||
new HashSet<>(), "", null, null, null,
|
new HashSet<>(), "", null, null, null,
|
||||||
new boolean[] {false, false, false, false}, time, id);
|
new boolean[] {false, false, false, false}, time, id);
|
||||||
HashMap<PlotId, Plot> map = newPlots.get(areaid);
|
HashMap<PlotId, Plot> map = newPlots.get(areaID);
|
||||||
if (map != null) {
|
if (map != null) {
|
||||||
Plot last = map.put(p.getId(), p);
|
Plot last = map.put(p.getId(), p);
|
||||||
if (last != null) {
|
if (last != null) {
|
||||||
@ -1679,7 +1678,7 @@ import java.util.concurrent.atomic.AtomicInteger;
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
map = new HashMap<>();
|
map = new HashMap<>();
|
||||||
newPlots.put(areaid, map);
|
newPlots.put(areaID, map);
|
||||||
map.put(p.getId(), p);
|
map.put(p.getId(), p);
|
||||||
}
|
}
|
||||||
plots.put(id, p);
|
plots.put(id, p);
|
||||||
|
@ -1,7 +1,12 @@
|
|||||||
package com.github.intellectualsites.plotsquared.plot.generator;
|
package com.github.intellectualsites.plotsquared.plot.generator;
|
||||||
|
|
||||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
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.PlotArea;
|
||||||
|
import com.github.intellectualsites.plotsquared.plot.object.PlotBlock;
|
||||||
|
import com.github.intellectualsites.plotsquared.plot.object.PlotManager;
|
||||||
|
import com.github.intellectualsites.plotsquared.plot.object.RegionWrapper;
|
||||||
|
import com.github.intellectualsites.plotsquared.plot.object.StringPlotBlock;
|
||||||
import com.github.intellectualsites.plotsquared.plot.util.block.DelegateLocalBlockQueue;
|
import com.github.intellectualsites.plotsquared.plot.util.block.DelegateLocalBlockQueue;
|
||||||
import com.github.intellectualsites.plotsquared.plot.util.block.GlobalBlockQueue;
|
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.LocalBlockQueue;
|
||||||
@ -49,7 +54,7 @@ public class AugmentedUtils {
|
|||||||
queue = GlobalBlockQueue.IMP.getNewQueue(world, false);
|
queue = GlobalBlockQueue.IMP.getNewQueue(world, false);
|
||||||
}
|
}
|
||||||
LocalBlockQueue primaryMask;
|
LocalBlockQueue primaryMask;
|
||||||
// coords
|
// coordinates
|
||||||
int bxx;
|
int bxx;
|
||||||
int bzz;
|
int bzz;
|
||||||
int txx;
|
int txx;
|
||||||
|
@ -3,14 +3,7 @@ package com.github.intellectualsites.plotsquared.plot.generator;
|
|||||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||||
import com.github.intellectualsites.plotsquared.plot.commands.Template;
|
import com.github.intellectualsites.plotsquared.plot.commands.Template;
|
||||||
import com.github.intellectualsites.plotsquared.plot.config.Settings;
|
import com.github.intellectualsites.plotsquared.plot.config.Settings;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.BlockBucket;
|
import com.github.intellectualsites.plotsquared.plot.object.*;
|
||||||
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.PlotArea;
|
|
||||||
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.ChunkManager;
|
||||||
import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
|
import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
|
||||||
import com.github.intellectualsites.plotsquared.plot.util.MathMan;
|
import com.github.intellectualsites.plotsquared.plot.util.MathMan;
|
||||||
@ -18,6 +11,7 @@ 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.LocalBlockQueue;
|
||||||
import com.google.common.collect.Sets;
|
import com.google.common.collect.Sets;
|
||||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
@ -32,12 +26,11 @@ public class HybridPlotManager extends ClassicPlotManager {
|
|||||||
new FileBytes(Settings.Paths.TEMPLATES + "/tmp-data.yml", Template.getBytes(plotArea)));
|
new FileBytes(Settings.Paths.TEMPLATES + "/tmp-data.yml", Template.getBytes(plotArea)));
|
||||||
String dir = "schematics" + File.separator + "GEN_ROAD_SCHEMATIC" + File.separator
|
String dir = "schematics" + File.separator + "GEN_ROAD_SCHEMATIC" + File.separator
|
||||||
+ plotArea.worldname + File.separator;
|
+ plotArea.worldname + File.separator;
|
||||||
String newDir =
|
|
||||||
"schematics" + File.separator + "GEN_ROAD_SCHEMATIC" + File.separator + "__TEMP_DIR__"
|
|
||||||
+ File.separator;
|
|
||||||
try {
|
try {
|
||||||
File sideroad =
|
File sideroad =
|
||||||
MainUtil.getFile(PlotSquared.get().IMP.getDirectory(), dir + "sideroad.schem");
|
MainUtil.getFile(PlotSquared.get().IMP.getDirectory(), dir + "sideroad.schem");
|
||||||
|
String newDir = "schematics" + File.separator + "GEN_ROAD_SCHEMATIC" + File.separator
|
||||||
|
+ "__TEMP_DIR__" + File.separator;
|
||||||
if (sideroad.exists()) {
|
if (sideroad.exists()) {
|
||||||
files.add(new FileBytes(newDir + "sideroad.schem",
|
files.add(new FileBytes(newDir + "sideroad.schem",
|
||||||
Files.readAllBytes(sideroad.toPath())));
|
Files.readAllBytes(sideroad.toPath())));
|
||||||
|
@ -3,7 +3,11 @@ package com.github.intellectualsites.plotsquared.plot.listener;
|
|||||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||||
import com.github.intellectualsites.plotsquared.plot.config.Settings;
|
import com.github.intellectualsites.plotsquared.plot.config.Settings;
|
||||||
import com.github.intellectualsites.plotsquared.plot.flag.Flags;
|
import com.github.intellectualsites.plotsquared.plot.flag.Flags;
|
||||||
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.PlotPlayer;
|
||||||
|
import com.github.intellectualsites.plotsquared.plot.object.RegionWrapper;
|
||||||
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
@ -68,7 +72,6 @@ public class WEManager {
|
|||||||
}
|
}
|
||||||
boolean allowMember = player.hasPermission("plots.worldedit.member");
|
boolean allowMember = player.hasPermission("plots.worldedit.member");
|
||||||
Plot plot = player.getCurrentPlot();
|
Plot plot = player.getCurrentPlot();
|
||||||
HashSet<RegionWrapper> allowed = new HashSet<>();
|
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
plot = player.getMeta("WorldEditRegionPlot");
|
plot = player.getMeta("WorldEditRegionPlot");
|
||||||
}
|
}
|
||||||
|
@ -166,16 +166,16 @@ import java.util.Map.Entry;
|
|||||||
compile();
|
compile();
|
||||||
}
|
}
|
||||||
final StringBuilder builder = new StringBuilder();
|
final StringBuilder builder = new StringBuilder();
|
||||||
Iterator<Entry<PlotBlock, Double>> iter = blocks.entrySet().iterator();
|
Iterator<Entry<PlotBlock, Double>> iterator = blocks.entrySet().iterator();
|
||||||
while (iter.hasNext()) {
|
while (iterator.hasNext()) {
|
||||||
Entry<PlotBlock, Double> entry = iter.next();
|
Entry<PlotBlock, Double> entry = iterator.next();
|
||||||
PlotBlock block = entry.getKey();
|
PlotBlock block = entry.getKey();
|
||||||
builder.append(block.getRawId());
|
builder.append(block.getRawId());
|
||||||
Double weight = entry.getValue();
|
Double weight = entry.getValue();
|
||||||
if (weight != 1) {
|
if (weight != 1) {
|
||||||
builder.append(":").append(weight.intValue());
|
builder.append(":").append(weight.intValue());
|
||||||
}
|
}
|
||||||
if (iter.hasNext()) {
|
if (iterator.hasNext()) {
|
||||||
builder.append(",");
|
builder.append(",");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2220,13 +2220,13 @@ public class Plot {
|
|||||||
if (!EventUtil.manager.callMerge(this, dir, max)) {
|
if (!EventUtil.manager.callMerge(this, dir, max)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
HashSet<Plot> visited = new HashSet<>();
|
|
||||||
HashSet<PlotId> merged;
|
|
||||||
Set<Plot> connected = this.getConnectedPlots();
|
Set<Plot> connected = this.getConnectedPlots();
|
||||||
merged = connected.stream().map(Plot::getId).collect(Collectors.toCollection(HashSet::new));
|
HashSet<PlotId> merged =
|
||||||
|
connected.stream().map(Plot::getId).collect(Collectors.toCollection(HashSet::new));
|
||||||
ArrayDeque<Plot> frontier = new ArrayDeque<>(connected);
|
ArrayDeque<Plot> frontier = new ArrayDeque<>(connected);
|
||||||
Plot current;
|
Plot current;
|
||||||
boolean toReturn = false;
|
boolean toReturn = false;
|
||||||
|
HashSet<Plot> visited = new HashSet<>();
|
||||||
while ((current = frontier.poll()) != null && max >= 0) {
|
while ((current = frontier.poll()) != null && max >= 0) {
|
||||||
if (visited.contains(current)) {
|
if (visited.contains(current)) {
|
||||||
continue;
|
continue;
|
||||||
@ -2421,10 +2421,10 @@ public class Plot {
|
|||||||
regions_cache = null;
|
regions_cache = null;
|
||||||
|
|
||||||
HashSet<Plot> tmpSet = new HashSet<>();
|
HashSet<Plot> tmpSet = new HashSet<>();
|
||||||
ArrayDeque<Plot> frontier = new ArrayDeque<>();
|
|
||||||
HashSet<Object> queuecache = new HashSet<>();
|
|
||||||
tmpSet.add(this);
|
tmpSet.add(this);
|
||||||
Plot tmp;
|
Plot tmp;
|
||||||
|
HashSet<Object> queuecache = new HashSet<>();
|
||||||
|
ArrayDeque<Plot> frontier = new ArrayDeque<>();
|
||||||
if (merged[0]) {
|
if (merged[0]) {
|
||||||
tmp = this.area.getPlotAbs(this.id.getRelative(Direction.NORTH));
|
tmp = this.area.getPlotAbs(this.id.getRelative(Direction.NORTH));
|
||||||
if (!tmp.getMerged(Direction.SOUTH)) {
|
if (!tmp.getMerged(Direction.SOUTH)) {
|
||||||
@ -2923,6 +2923,26 @@ public class Plot {
|
|||||||
plot.swapData(other, null);
|
plot.swapData(other, null);
|
||||||
}
|
}
|
||||||
// copy terrain
|
// copy terrain
|
||||||
|
if (occupied) {
|
||||||
|
Runnable swap = new Runnable() {
|
||||||
|
@Override public void run() {
|
||||||
|
if (regions.isEmpty()) {
|
||||||
|
TaskManager.runTask(whenDone);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
RegionWrapper region = regions.poll();
|
||||||
|
Location[] corners = region.getCorners(getWorldName());
|
||||||
|
Location pos1 = corners[0];
|
||||||
|
Location pos2 = corners[1];
|
||||||
|
Location pos3 = pos1.clone().add(offsetX, 0, offsetZ);
|
||||||
|
Location pos4 = pos2.clone().add(offsetX, 0, offsetZ);
|
||||||
|
pos3.setWorld(destination.getWorldName());
|
||||||
|
pos4.setWorld(destination.getWorldName());
|
||||||
|
ChunkManager.manager.swap(pos1, pos2, pos3, pos4, this);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
swap.run();
|
||||||
|
} else {
|
||||||
Runnable move = new Runnable() {
|
Runnable move = new Runnable() {
|
||||||
@Override public void run() {
|
@Override public void run() {
|
||||||
if (regions.isEmpty()) {
|
if (regions.isEmpty()) {
|
||||||
@ -2948,26 +2968,6 @@ public class Plot {
|
|||||||
() -> ChunkManager.manager.regenerateRegion(pos1, pos2, false, task));
|
() -> ChunkManager.manager.regenerateRegion(pos1, pos2, false, task));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
Runnable swap = new Runnable() {
|
|
||||||
@Override public void run() {
|
|
||||||
if (regions.isEmpty()) {
|
|
||||||
TaskManager.runTask(whenDone);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
RegionWrapper region = regions.poll();
|
|
||||||
Location[] corners = region.getCorners(getWorldName());
|
|
||||||
Location pos1 = corners[0];
|
|
||||||
Location pos2 = corners[1];
|
|
||||||
Location pos3 = pos1.clone().add(offsetX, 0, offsetZ);
|
|
||||||
Location pos4 = pos2.clone().add(offsetX, 0, offsetZ);
|
|
||||||
pos3.setWorld(destination.getWorldName());
|
|
||||||
pos4.setWorld(destination.getWorldName());
|
|
||||||
ChunkManager.manager.swap(pos1, pos2, pos3, pos4, this);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
if (occupied) {
|
|
||||||
swap.run();
|
|
||||||
} else {
|
|
||||||
move.run();
|
move.run();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -10,7 +10,12 @@ import com.github.intellectualsites.plotsquared.plot.flag.FlagManager;
|
|||||||
import com.github.intellectualsites.plotsquared.plot.flag.Flags;
|
import com.github.intellectualsites.plotsquared.plot.flag.Flags;
|
||||||
import com.github.intellectualsites.plotsquared.plot.generator.GridPlotWorld;
|
import com.github.intellectualsites.plotsquared.plot.generator.GridPlotWorld;
|
||||||
import com.github.intellectualsites.plotsquared.plot.generator.IndependentPlotGenerator;
|
import com.github.intellectualsites.plotsquared.plot.generator.IndependentPlotGenerator;
|
||||||
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.MainUtil;
|
||||||
|
import com.github.intellectualsites.plotsquared.plot.util.MathMan;
|
||||||
|
import com.github.intellectualsites.plotsquared.plot.util.PlotGameMode;
|
||||||
|
import com.github.intellectualsites.plotsquared.plot.util.StringMan;
|
||||||
import com.github.intellectualsites.plotsquared.plot.util.area.QuadMap;
|
import com.github.intellectualsites.plotsquared.plot.util.area.QuadMap;
|
||||||
import com.github.intellectualsites.plotsquared.plot.util.block.GlobalBlockQueue;
|
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.LocalBlockQueue;
|
||||||
@ -844,11 +849,10 @@ public abstract class PlotArea {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
manager.startPlotMerge(this, plotIds);
|
||||||
final Set<UUID> trusted = new HashSet<>();
|
final Set<UUID> trusted = new HashSet<>();
|
||||||
final Set<UUID> members = new HashSet<>();
|
final Set<UUID> members = new HashSet<>();
|
||||||
final Set<UUID> denied = new HashSet<>();
|
final Set<UUID> denied = new HashSet<>();
|
||||||
|
|
||||||
manager.startPlotMerge(this, plotIds);
|
|
||||||
for (int x = pos1.x; x <= pos2.x; x++) {
|
for (int x = pos1.x; x <= pos2.x; x++) {
|
||||||
for (int y = pos1.y; y <= pos2.y; y++) {
|
for (int y = pos1.y; y <= pos2.y; y++) {
|
||||||
PlotId id = new PlotId(x, y);
|
PlotId id = new PlotId(x, y);
|
||||||
|
@ -50,21 +50,21 @@ public class SinglePlotArea extends GridPlotWorld {
|
|||||||
// Duplicate 0;0
|
// Duplicate 0;0
|
||||||
if (setup.type != 0) {
|
if (setup.type != 0) {
|
||||||
File container = PlotSquared.imp().getWorldContainer();
|
File container = PlotSquared.imp().getWorldContainer();
|
||||||
File dest = new File(container, worldName);
|
File destination = new File(container, worldName);
|
||||||
if (!dest.exists()) {
|
if (!destination.exists()) {
|
||||||
File src = new File(container, "0,0");
|
File src = new File(container, "0,0");
|
||||||
if (src.exists()) {
|
if (src.exists()) {
|
||||||
if (!dest.exists()) {
|
if (!destination.exists()) {
|
||||||
dest.mkdirs();
|
destination.mkdirs();
|
||||||
}
|
}
|
||||||
File levelDat = new File(src, "level.dat");
|
File levelDat = new File(src, "level.dat");
|
||||||
if (levelDat.exists()) {
|
if (levelDat.exists()) {
|
||||||
try {
|
try {
|
||||||
Files.copy(levelDat.toPath(),
|
Files.copy(levelDat.toPath(),
|
||||||
new File(dest, levelDat.getName()).toPath());
|
new File(destination, levelDat.getName()).toPath());
|
||||||
File data = new File(src, "data");
|
File data = new File(src, "data");
|
||||||
if (data.exists()) {
|
if (data.exists()) {
|
||||||
File dataDest = new File(dest, "data");
|
File dataDest = new File(destination, "data");
|
||||||
dataDest.mkdirs();
|
dataDest.mkdirs();
|
||||||
for (File file : data.listFiles()) {
|
for (File file : data.listFiles()) {
|
||||||
Files.copy(file.toPath(),
|
Files.copy(file.toPath(),
|
||||||
|
@ -35,8 +35,7 @@ public class SinglePlotAreaManager extends DefaultPlotAreaManager {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
int mode = 0;
|
int mode = 0;
|
||||||
for (int i = 0; i < chars.length; i++) {
|
for (char c : chars) {
|
||||||
char c = chars[i];
|
|
||||||
switch (mode) {
|
switch (mode) {
|
||||||
case 0:
|
case 0:
|
||||||
mode = 1;
|
mode = 1;
|
||||||
|
@ -1,6 +1,11 @@
|
|||||||
package com.github.intellectualsites.plotsquared.plot.util;
|
package com.github.intellectualsites.plotsquared.plot.util;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.BufferedReader;
|
||||||
|
import java.io.DataOutputStream;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileReader;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
import java.net.HttpURLConnection;
|
import java.net.HttpURLConnection;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -47,7 +52,6 @@ public class HastebinUtility {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static String upload(final File file) throws IOException {
|
public static String upload(final File file) throws IOException {
|
||||||
final StringBuilder content = new StringBuilder();
|
|
||||||
List<String> lines = new ArrayList<>();
|
List<String> lines = new ArrayList<>();
|
||||||
try (BufferedReader reader = new BufferedReader(new FileReader(file))) {
|
try (BufferedReader reader = new BufferedReader(new FileReader(file))) {
|
||||||
String line;
|
String line;
|
||||||
@ -56,6 +60,7 @@ public class HastebinUtility {
|
|||||||
lines.add(line);
|
lines.add(line);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
final StringBuilder content = new StringBuilder();
|
||||||
for (int i = Math.max(0, lines.size() - 1000); i < lines.size(); i++) {
|
for (int i = Math.max(0, lines.size() - 1000); i < lines.size(); i++) {
|
||||||
content.append(lines.get(i)).append("\n");
|
content.append(lines.get(i)).append("\n");
|
||||||
}
|
}
|
||||||
|
@ -399,8 +399,6 @@ public class MainUtil {
|
|||||||
|
|
||||||
List<UUID> uuids = new ArrayList<>();
|
List<UUID> uuids = new ArrayList<>();
|
||||||
PlotId id = null;
|
PlotId id = null;
|
||||||
PlotArea area = null;
|
|
||||||
String alias = null;
|
|
||||||
|
|
||||||
for (String term : split) {
|
for (String term : split) {
|
||||||
try {
|
try {
|
||||||
@ -418,6 +416,8 @@ public class MainUtil {
|
|||||||
IntStream.range(0, size).mapToObj(i -> new ArrayList<Plot>())
|
IntStream.range(0, size).mapToObj(i -> new ArrayList<Plot>())
|
||||||
.collect(Collectors.toCollection(() -> new ArrayList<>(size)));
|
.collect(Collectors.toCollection(() -> new ArrayList<>(size)));
|
||||||
|
|
||||||
|
PlotArea area = null;
|
||||||
|
String alias = null;
|
||||||
for (Plot plot : PlotSquared.get().getPlots()) {
|
for (Plot plot : PlotSquared.get().getPlots()) {
|
||||||
int count = 0;
|
int count = 0;
|
||||||
if (!uuids.isEmpty()) {
|
if (!uuids.isEmpty()) {
|
||||||
|
@ -1,7 +1,15 @@
|
|||||||
package com.github.intellectualsites.plotsquared.plot.util;
|
package com.github.intellectualsites.plotsquared.plot.util;
|
||||||
|
|
||||||
import java.lang.reflect.*;
|
import java.lang.reflect.Constructor;
|
||||||
import java.util.*;
|
import java.lang.reflect.Field;
|
||||||
|
import java.lang.reflect.InvocationTargetException;
|
||||||
|
import java.lang.reflect.Method;
|
||||||
|
import java.lang.reflect.Modifier;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author DPOH-VAR
|
* @author DPOH-VAR
|
||||||
@ -137,21 +145,22 @@ public class ReflectionUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public static <T> Constructor<T> makeConstructor(Class<?> clazz, Class<?>... paramaterTypes) {
|
public static <T> Constructor<T> makeConstructor(Class<?> clazz, Class<?>... parameterTypes) {
|
||||||
try {
|
try {
|
||||||
return (Constructor<T>) clazz.getConstructor(paramaterTypes);
|
return (Constructor<T>) clazz.getConstructor(parameterTypes);
|
||||||
} catch (NoSuchMethodException ignored) {
|
} catch (NoSuchMethodException ignored) {
|
||||||
|
//todo print a constructor not found method
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static <T> T callConstructor(Constructor<T> constructor, Object... paramaters) {
|
public static <T> T callConstructor(Constructor<T> constructor, Object... parameters) {
|
||||||
if (constructor == null) {
|
if (constructor == null) {
|
||||||
throw new RuntimeException("No such constructor");
|
throw new RuntimeException("No such constructor");
|
||||||
}
|
}
|
||||||
constructor.setAccessible(true);
|
constructor.setAccessible(true);
|
||||||
try {
|
try {
|
||||||
return constructor.newInstance(paramaters);
|
return constructor.newInstance(parameters);
|
||||||
} catch (InvocationTargetException ex) {
|
} catch (InvocationTargetException ex) {
|
||||||
throw new RuntimeException(ex.getCause());
|
throw new RuntimeException(ex.getCause());
|
||||||
} catch (IllegalAccessException | IllegalArgumentException | InstantiationException ex) {
|
} catch (IllegalAccessException | IllegalArgumentException | InstantiationException ex) {
|
||||||
|
@ -7,12 +7,25 @@ import com.github.intellectualsites.plotsquared.plot.config.Settings;
|
|||||||
import com.github.intellectualsites.plotsquared.plot.flag.Flag;
|
import com.github.intellectualsites.plotsquared.plot.flag.Flag;
|
||||||
import com.github.intellectualsites.plotsquared.plot.flag.Flags;
|
import com.github.intellectualsites.plotsquared.plot.flag.Flags;
|
||||||
import com.github.intellectualsites.plotsquared.plot.generator.ClassicPlotWorld;
|
import com.github.intellectualsites.plotsquared.plot.generator.ClassicPlotWorld;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.*;
|
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;
|
||||||
|
import com.github.intellectualsites.plotsquared.plot.object.RegionWrapper;
|
||||||
|
import com.github.intellectualsites.plotsquared.plot.object.RunnableVal;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.schematic.Schematic;
|
import com.github.intellectualsites.plotsquared.plot.object.schematic.Schematic;
|
||||||
import com.github.intellectualsites.plotsquared.plot.util.block.LocalBlockQueue;
|
import com.github.intellectualsites.plotsquared.plot.util.block.LocalBlockQueue;
|
||||||
import com.sk89q.jnbt.*;
|
import com.sk89q.jnbt.CompoundTag;
|
||||||
|
import com.sk89q.jnbt.NBTInputStream;
|
||||||
|
import com.sk89q.jnbt.NBTOutputStream;
|
||||||
|
import com.sk89q.jnbt.StringTag;
|
||||||
|
import com.sk89q.jnbt.Tag;
|
||||||
import com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard;
|
import com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard;
|
||||||
import com.sk89q.worldedit.extent.clipboard.io.*;
|
import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormat;
|
||||||
|
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.BlockVector3;
|
import com.sk89q.worldedit.math.BlockVector3;
|
||||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||||
|
|
||||||
@ -267,7 +280,7 @@ public abstract class SchematicHandler {
|
|||||||
*
|
*
|
||||||
* @return Immutable collection with schematic names
|
* @return Immutable collection with schematic names
|
||||||
*/
|
*/
|
||||||
public Collection<String> getShematicNames() {
|
public Collection<String> getSchematicNames() {
|
||||||
final File parent =
|
final File parent =
|
||||||
MainUtil.getFile(PlotSquared.get().IMP.getDirectory(), Settings.Paths.SCHEMATICS);
|
MainUtil.getFile(PlotSquared.get().IMP.getDirectory(), Settings.Paths.SCHEMATICS);
|
||||||
final List<String> names = new ArrayList<>();
|
final List<String> names = new ArrayList<>();
|
||||||
|
@ -9,8 +9,9 @@ import com.github.intellectualsites.plotsquared.plot.object.RunnableVal;
|
|||||||
import com.github.intellectualsites.plotsquared.plot.object.StringWrapper;
|
import com.github.intellectualsites.plotsquared.plot.object.StringWrapper;
|
||||||
import com.github.intellectualsites.plotsquared.plot.uuid.UUIDWrapper;
|
import com.github.intellectualsites.plotsquared.plot.uuid.UUIDWrapper;
|
||||||
import com.google.common.collect.BiMap;
|
import com.google.common.collect.BiMap;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nullable;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -85,7 +86,7 @@ public class UUIDHandler {
|
|||||||
implementation.add(toAdd);
|
implementation.add(toAdd);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nonnull public static UUID getUUID(PlotPlayer player) {
|
@NotNull public static UUID getUUID(PlotPlayer player) {
|
||||||
return implementation.getUUID(player);
|
return implementation.getUUID(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -96,7 +97,7 @@ public class UUIDHandler {
|
|||||||
return implementation.getUUID(player);
|
return implementation.getUUID(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getName(UUID uuid) {
|
@Nullable public static String getName(UUID uuid) {
|
||||||
if (implementation == null) {
|
if (implementation == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -120,13 +121,13 @@ public class UUIDHandler {
|
|||||||
return check(implementation.getPlayer(name));
|
return check(implementation.getPlayer(name));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static PlotPlayer check(PlotPlayer plr) {
|
private static PlotPlayer check(@Nullable PlotPlayer player) {
|
||||||
if (plr != null && !plr.isOnline()) {
|
if (player != null && !player.isOnline()) {
|
||||||
UUIDHandler.getPlayers().remove(plr.getName());
|
UUIDHandler.getPlayers().remove(player.getName());
|
||||||
PlotSquared.get().IMP.unregister(plr);
|
PlotSquared.get().IMP.unregister(player);
|
||||||
plr = null;
|
player = null;
|
||||||
}
|
}
|
||||||
return plr;
|
return player;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static UUID getUUIDFromString(String nameOrUUIDString) {
|
public static UUID getUUIDFromString(String nameOrUUIDString) {
|
||||||
|
@ -4,13 +4,23 @@ import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
|||||||
import com.github.intellectualsites.plotsquared.plot.config.Captions;
|
import com.github.intellectualsites.plotsquared.plot.config.Captions;
|
||||||
import com.github.intellectualsites.plotsquared.plot.config.Settings;
|
import com.github.intellectualsites.plotsquared.plot.config.Settings;
|
||||||
import com.github.intellectualsites.plotsquared.plot.database.DBFunc;
|
import com.github.intellectualsites.plotsquared.plot.database.DBFunc;
|
||||||
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.PlotPlayer;
|
||||||
|
import com.github.intellectualsites.plotsquared.plot.object.RunnableVal;
|
||||||
|
import com.github.intellectualsites.plotsquared.plot.object.StringWrapper;
|
||||||
import com.github.intellectualsites.plotsquared.plot.uuid.UUIDWrapper;
|
import com.github.intellectualsites.plotsquared.plot.uuid.UUIDWrapper;
|
||||||
import com.google.common.base.Charsets;
|
import com.google.common.base.Charsets;
|
||||||
import com.google.common.collect.BiMap;
|
import com.google.common.collect.BiMap;
|
||||||
import com.google.common.collect.HashBiMap;
|
import com.google.common.collect.HashBiMap;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import java.util.*;
|
import javax.annotation.Nullable;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.UUID;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
public abstract class UUIDHandlerImplementation {
|
public abstract class UUIDHandlerImplementation {
|
||||||
@ -216,7 +226,7 @@ public abstract class UUIDHandlerImplementation {
|
|||||||
this.uuidMap.clear();
|
this.uuidMap.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getName(UUID uuid) {
|
@Nullable public String getName(UUID uuid) {
|
||||||
if (uuid == null) {
|
if (uuid == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -227,7 +237,7 @@ public abstract class UUIDHandlerImplementation {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public UUID getUUID(String name, RunnableVal<UUID> ifFetch) {
|
@Nullable public UUID getUUID(String name, RunnableVal<UUID> ifFetch) {
|
||||||
if (name.isEmpty()) {
|
if (name.isEmpty()) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -255,7 +265,7 @@ public abstract class UUIDHandlerImplementation {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public UUID getUUID(PlotPlayer player) {
|
@NotNull public UUID getUUID(PlotPlayer player) {
|
||||||
return this.uuidWrapper.getUUID(player);
|
return this.uuidWrapper.getUUID(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -263,7 +273,7 @@ public abstract class UUIDHandlerImplementation {
|
|||||||
return this.uuidWrapper.getUUID(player);
|
return this.uuidWrapper.getUUID(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
public PlotPlayer getPlayer(UUID uuid) {
|
@Nullable public PlotPlayer getPlayer(UUID uuid) {
|
||||||
String name = getName(uuid);
|
String name = getName(uuid);
|
||||||
if (name != null) {
|
if (name != null) {
|
||||||
return getPlayer(name);
|
return getPlayer(name);
|
||||||
|
@ -3,9 +3,17 @@ package com.github.intellectualsites.plotsquared.plot.util;
|
|||||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.*;
|
import com.github.intellectualsites.plotsquared.plot.object.*;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.schematic.PlotItem;
|
import com.github.intellectualsites.plotsquared.plot.object.schematic.PlotItem;
|
||||||
import com.sk89q.jnbt.*;
|
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 java.io.*;
|
import java.io.ByteArrayOutputStream;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileInputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.OutputStream;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
@ -66,7 +74,6 @@ public abstract class WorldUtil {
|
|||||||
try (final ZipOutputStream zos = new ZipOutputStream(output)) {
|
try (final ZipOutputStream zos = new ZipOutputStream(output)) {
|
||||||
File dat = getDat(plot.getWorldName());
|
File dat = getDat(plot.getWorldName());
|
||||||
Location spawn = getSpawn(plot.getWorldName());
|
Location spawn = getSpawn(plot.getWorldName());
|
||||||
byte[] buffer = new byte[1024];
|
|
||||||
if (dat != null) {
|
if (dat != null) {
|
||||||
ZipEntry ze = new ZipEntry("world" + File.separator + dat.getName());
|
ZipEntry ze = new ZipEntry("world" + File.separator + dat.getName());
|
||||||
zos.putNextEntry(ze);
|
zos.putNextEntry(ze);
|
||||||
@ -89,6 +96,7 @@ public abstract class WorldUtil {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
setSpawn(spawn);
|
setSpawn(spawn);
|
||||||
|
byte[] buffer = new byte[1024];
|
||||||
for (Plot current : plot.getConnectedPlots()) {
|
for (Plot current : plot.getConnectedPlots()) {
|
||||||
Location bot = current.getBottomAbs();
|
Location bot = current.getBottomAbs();
|
||||||
Location top = current.getTopAbs();
|
Location top = current.getTopAbs();
|
||||||
@ -107,12 +115,12 @@ public abstract class WorldUtil {
|
|||||||
"world" + File.separator + "region" + File.separator
|
"world" + File.separator + "region" + File.separator
|
||||||
+ name);
|
+ name);
|
||||||
zos.putNextEntry(ze);
|
zos.putNextEntry(ze);
|
||||||
final FileInputStream in = new FileInputStream(file);
|
try (FileInputStream in = new FileInputStream(file)) {
|
||||||
int len;
|
int len;
|
||||||
while ((len = in.read(buffer)) > 0) {
|
while ((len = in.read(buffer)) > 0) {
|
||||||
zos.write(buffer, 0, len);
|
zos.write(buffer, 0, len);
|
||||||
}
|
}
|
||||||
in.close();
|
}
|
||||||
zos.closeEntry();
|
zos.closeEntry();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -81,8 +81,7 @@ public class GlobalBlockQueue {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
running.set(true);
|
running.set(true);
|
||||||
TaskManager.runTaskRepeat(new Runnable() {
|
TaskManager.runTaskRepeat(() -> {
|
||||||
@Override public void run() {
|
|
||||||
if (inactiveQueues.isEmpty() && activeQueues.isEmpty()) {
|
if (inactiveQueues.isEmpty() && activeQueues.isEmpty()) {
|
||||||
lastSuccess = System.currentTimeMillis();
|
lastSuccess = System.currentTimeMillis();
|
||||||
tasks();
|
tasks();
|
||||||
@ -127,7 +126,6 @@ public class GlobalBlockQueue {
|
|||||||
// Enable it again (note that we are still on the main thread)
|
// Enable it again (note that we are still on the main thread)
|
||||||
SET_TASK.value2.endSet(true);
|
SET_TASK.value2.endSet(true);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}, 1);
|
}, 1);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -169,13 +169,12 @@ public class ExpireManager {
|
|||||||
return new ArrayList<>();
|
return new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean shouldCheckAccountAge = false;
|
|
||||||
|
|
||||||
long diff = getAge(plot);
|
long diff = getAge(plot);
|
||||||
if (diff == 0) {
|
if (diff == 0) {
|
||||||
return new ArrayList<>();
|
return new ArrayList<>();
|
||||||
}
|
}
|
||||||
// Filter out non old plots
|
// Filter out non old plots
|
||||||
|
boolean shouldCheckAccountAge = false;
|
||||||
for (int i = 0; i < applicable.size(); i++) {
|
for (int i = 0; i < applicable.size(); i++) {
|
||||||
ExpiryTask et = applicable.poll();
|
ExpiryTask et = applicable.poll();
|
||||||
if (et.applies(diff)) {
|
if (et.applies(diff)) {
|
||||||
|
@ -2,12 +2,13 @@ package com.github.intellectualsites.plotsquared.plot.uuid;
|
|||||||
|
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.OfflinePlotPlayer;
|
import com.github.intellectualsites.plotsquared.plot.object.OfflinePlotPlayer;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
public abstract class UUIDWrapper {
|
public abstract class UUIDWrapper {
|
||||||
|
|
||||||
public abstract UUID getUUID(PlotPlayer player);
|
@NotNull public abstract UUID getUUID(PlotPlayer player);
|
||||||
|
|
||||||
public abstract UUID getUUID(OfflinePlotPlayer player);
|
public abstract UUID getUUID(OfflinePlotPlayer player);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user