Merge branch 'reformat' into v5

This commit is contained in:
dordsor21 2020-04-30 11:39:02 +01:00
commit b56d4d0fea
198 changed files with 1376 additions and 1133 deletions

View File

@ -82,7 +82,8 @@ import static com.plotsquared.core.util.entity.EntityCategories.CAP_VEHICLE;
public class BukkitChunkManager extends ChunkManager { public class BukkitChunkManager extends ChunkManager {
public static boolean isIn(CuboidRegion region, int x, int z) { public static boolean isIn(CuboidRegion region, int x, int z) {
return x >= region.getMinimumPoint().getX() && x <= region.getMaximumPoint().getX() && z >= region.getMinimumPoint().getZ() && z <= region.getMaximumPoint().getZ(); return x >= region.getMinimumPoint().getX() && x <= region.getMaximumPoint().getX()
&& z >= region.getMinimumPoint().getZ() && z <= region.getMaximumPoint().getZ();
} }
public static ContentMap swapChunk(World world1, World world2, Chunk pos1, Chunk pos2, public static ContentMap swapChunk(World world1, World world2, Chunk pos1, Chunk pos2,
@ -106,8 +107,10 @@ public class BukkitChunkManager extends ChunkManager {
LocalBlockQueue queue1 = GlobalBlockQueue.IMP.getNewQueue(worldName1, false); LocalBlockQueue queue1 = GlobalBlockQueue.IMP.getNewQueue(worldName1, false);
LocalBlockQueue queue2 = GlobalBlockQueue.IMP.getNewQueue(worldName2, false); LocalBlockQueue queue2 = GlobalBlockQueue.IMP.getNewQueue(worldName2, false);
for (int x = Math.max(r1.getMinimumPoint().getX(), sx); x <= Math.min(r1.getMaximumPoint().getX(), sx + 15); x++) { for (int x = Math.max(r1.getMinimumPoint().getX(), sx);
for (int z = Math.max(r1.getMinimumPoint().getZ(), sz); z <= Math.min(r1.getMaximumPoint().getZ(), sz + 15); z++) { x <= Math.min(r1.getMaximumPoint().getX(), sx + 15); x++) {
for (int z = Math.max(r1.getMinimumPoint().getZ(), sz);
z <= Math.min(r1.getMaximumPoint().getZ(), sz + 15); z++) {
for (int y = 0; y < 256; y++) { for (int y = 0; y < 256; y++) {
Block block1 = world1.getBlockAt(x, y, z); Block block1 = world1.getBlockAt(x, y, z);
BaseBlock baseBlock1 = bukkitWorld1.getFullBlock(BlockVector3.at(x, y, z)); BaseBlock baseBlock1 = bukkitWorld1.getFullBlock(BlockVector3.at(x, y, z));
@ -159,7 +162,8 @@ public class BukkitChunkManager extends ChunkManager {
+ " Will halt the calling thread until completed."); + " Will halt the calling thread until completed.");
semaphore.acquire(); semaphore.acquire();
Bukkit.getScheduler().runTask(BukkitMain.getPlugin(BukkitMain.class), () -> { Bukkit.getScheduler().runTask(BukkitMain.getPlugin(BukkitMain.class), () -> {
for (Chunk chunk : Objects.requireNonNull(Bukkit.getWorld(world)).getLoadedChunks()) { for (Chunk chunk : Objects.requireNonNull(Bukkit.getWorld(world))
.getLoadedChunks()) {
BlockVector2 loc = BlockVector2.at(chunk.getX() >> 5, chunk.getZ() >> 5); BlockVector2 loc = BlockVector2.at(chunk.getX() >> 5, chunk.getZ() >> 5);
chunks.add(loc); chunks.add(loc);
} }
@ -214,7 +218,7 @@ public class BukkitChunkManager extends ChunkManager {
if (doWhole) { if (doWhole) {
for (Entity entity : entities) { for (Entity entity : entities) {
org.bukkit.Location location = entity.getLocation(); org.bukkit.Location location = entity.getLocation();
PaperLib.getChunkAtAsync(location).thenAccept( chunk -> { PaperLib.getChunkAtAsync(location).thenAccept(chunk -> {
if (chunks.contains(chunk)) { if (chunks.contains(chunk)) {
int X = chunk.getX(); int X = chunk.getX();
int Z = chunk.getZ(); int Z = chunk.getZ();
@ -249,7 +253,8 @@ public class BukkitChunkManager extends ChunkManager {
return count; return count;
} }
@Override public boolean copyRegion(Location pos1, Location pos2, Location newPos, @Override
public boolean copyRegion(Location pos1, Location pos2, Location newPos,
final Runnable whenDone) { final Runnable whenDone) {
final int relX = newPos.getX() - pos1.getX(); final int relX = newPos.getX() - pos1.getX();
final int relZ = newPos.getZ() - pos1.getZ(); final int relZ = newPos.getZ() - pos1.getZ();
@ -303,7 +308,8 @@ public class BukkitChunkManager extends ChunkManager {
return true; return true;
} }
@Override public boolean regenerateRegion(final Location pos1, final Location pos2, @Override
public boolean regenerateRegion(final Location pos1, final Location pos2,
final boolean ignoreAugment, final Runnable whenDone) { final boolean ignoreAugment, final Runnable whenDone) {
final String world = pos1.getWorld(); final String world = pos1.getWorld();
@ -341,7 +347,8 @@ public class BukkitChunkManager extends ChunkManager {
if (chunkObj == null) { if (chunkObj == null) {
return; return;
} }
final LocalBlockQueue queue = GlobalBlockQueue.IMP.getNewQueue(world, false); final LocalBlockQueue queue =
GlobalBlockQueue.IMP.getNewQueue(world, false);
if (xxb >= p1x && xxt <= p2x && zzb >= p1z && zzt <= p2z) { if (xxb >= p1x && xxt <= p2x && zzb >= p1z && zzt <= p2z) {
AugmentedUtils.bypass(ignoreAugment, AugmentedUtils.bypass(ignoreAugment,
() -> queue.regenChunkSafe(chunk.getX(), chunk.getZ())); () -> queue.regenChunkSafe(chunk.getX(), chunk.getZ()));
@ -406,11 +413,11 @@ public class BukkitChunkManager extends ChunkManager {
if (checkX2 && checkZ2) { if (checkX2 && checkZ2) {
map.saveRegion(bukkitWorldObj, xxt2, xxt, zzt2, zzt); // map.saveRegion(bukkitWorldObj, xxt2, xxt, zzt2, zzt); //
} }
CuboidRegion currentPlotClear = CuboidRegion currentPlotClear = RegionUtil
RegionUtil.createRegion(pos1.getX(), pos2.getX(), pos1.getZ(), pos2.getZ()); .createRegion(pos1.getX(), pos2.getX(), pos1.getZ(), pos2.getZ());
map.saveEntitiesOut(chunkObj, currentPlotClear); map.saveEntitiesOut(chunkObj, currentPlotClear);
AugmentedUtils.bypass(ignoreAugment, AugmentedUtils.bypass(ignoreAugment, () -> setChunkInPlotArea(null,
() -> setChunkInPlotArea(null, new RunnableVal<ScopedLocalBlockQueue>() { new RunnableVal<ScopedLocalBlockQueue>() {
@Override public void run(ScopedLocalBlockQueue value) { @Override public void run(ScopedLocalBlockQueue value) {
Location min = value.getMin(); Location min = value.getMin();
int bx = min.getX(); int bx = min.getX();
@ -420,12 +427,14 @@ public class BukkitChunkManager extends ChunkManager {
PlotLoc plotLoc = new PlotLoc(bx + x1, bz + z1); PlotLoc plotLoc = new PlotLoc(bx + x1, bz + z1);
BaseBlock[] ids = map.allBlocks.get(plotLoc); BaseBlock[] ids = map.allBlocks.get(plotLoc);
if (ids != null) { if (ids != null) {
for (int y = 0; y < Math.min(128, ids.length); y++) { for (int y = 0;
y < Math.min(128, ids.length); y++) {
BaseBlock id = ids[y]; BaseBlock id = ids[y];
if (id != null) { if (id != null) {
value.setBlock(x1, y, z1, id); value.setBlock(x1, y, z1, id);
} else { } else {
value.setBlock(x1, y, z1, BlockTypes.AIR.getDefaultState()); value.setBlock(x1, y, z1,
BlockTypes.AIR.getDefaultState());
} }
} }
for (int y = Math.min(128, ids.length); for (int y = Math.min(128, ids.length);
@ -454,15 +463,17 @@ public class BukkitChunkManager extends ChunkManager {
return true; return true;
} }
@Override public CompletableFuture<?> loadChunk(String world, BlockVector2 chunkLoc, boolean force) { @Override
return PaperLib.getChunkAtAsync(BukkitUtil.getWorld(world),chunkLoc.getX(), chunkLoc.getZ(), force); public CompletableFuture<?> loadChunk(String world, BlockVector2 chunkLoc, boolean force) {
return PaperLib
.getChunkAtAsync(BukkitUtil.getWorld(world), chunkLoc.getX(), chunkLoc.getZ(), force);
} }
@Override @Override
public void unloadChunk(final String world, final BlockVector2 chunkLoc, final boolean save) { public void unloadChunk(final String world, final BlockVector2 chunkLoc, final boolean save) {
if (!PlotSquared.get().isMainThread(Thread.currentThread())) { if (!PlotSquared.get().isMainThread(Thread.currentThread())) {
TaskManager.runTask( TaskManager.runTask(() -> BukkitUtil.getWorld(world)
() -> BukkitUtil.getWorld(world).unloadChunk(chunkLoc.getX(), chunkLoc.getZ(), save)); .unloadChunk(chunkLoc.getX(), chunkLoc.getZ(), save));
} else { } else {
BukkitUtil.getWorld(world).unloadChunk(chunkLoc.getX(), chunkLoc.getZ(), save); BukkitUtil.getWorld(world).unloadChunk(chunkLoc.getX(), chunkLoc.getZ(), save);
} }
@ -489,7 +500,8 @@ public class BukkitChunkManager extends ChunkManager {
} }
} }
@Override public void swap(Location bot1, Location top1, Location bot2, Location top2, @Override
public void swap(Location bot1, Location top1, Location bot2, Location top2,
final Runnable whenDone) { final Runnable whenDone) {
CuboidRegion region1 = CuboidRegion region1 =
RegionUtil.createRegion(bot1.getX(), top1.getX(), bot1.getZ(), top1.getZ()); RegionUtil.createRegion(bot1.getX(), top1.getX(), bot1.getZ(), top1.getZ());
@ -497,8 +509,8 @@ public class BukkitChunkManager extends ChunkManager {
RegionUtil.createRegion(bot2.getX(), top2.getX(), bot2.getZ(), top2.getZ()); RegionUtil.createRegion(bot2.getX(), top2.getX(), bot2.getZ(), top2.getZ());
final World world1 = Bukkit.getWorld(bot1.getWorld()); final World world1 = Bukkit.getWorld(bot1.getWorld());
final World world2 = Bukkit.getWorld(bot2.getWorld()); final World world2 = Bukkit.getWorld(bot2.getWorld());
checkNotNull(world1,"Critical error during swap."); checkNotNull(world1, "Critical error during swap.");
checkNotNull(world2,"Critical error during swap."); checkNotNull(world2, "Critical error during swap.");
int relX = bot2.getX() - bot1.getX(); int relX = bot2.getX() - bot1.getX();
int relZ = bot2.getZ() - bot1.getZ(); int relZ = bot2.getZ() - bot1.getZ();
@ -525,13 +537,11 @@ public class BukkitChunkManager extends ChunkManager {
if (EntityCategories.PLAYER.contains(entityType)) { if (EntityCategories.PLAYER.contains(entityType)) {
return; return;
} else if (EntityCategories.PROJECTILE.contains(entityType) || } else if (EntityCategories.PROJECTILE.contains(entityType) || EntityCategories.OTHER
EntityCategories.OTHER.contains(entityType) || .contains(entityType) || EntityCategories.HANGING.contains(entityType)) {
EntityCategories.HANGING.contains(entityType)) {
count[CAP_MISC]++; count[CAP_MISC]++;
} else if (EntityCategories.ANIMAL.contains(entityType) || } else if (EntityCategories.ANIMAL.contains(entityType) || EntityCategories.VILLAGER
EntityCategories.VILLAGER.contains(entityType) || .contains(entityType) || EntityCategories.TAMEABLE.contains(entityType)) {
EntityCategories.TAMEABLE.contains(entityType)) {
count[CAP_MOB]++; count[CAP_MOB]++;
count[CAP_ANIMAL]++; count[CAP_ANIMAL]++;
} else if (EntityCategories.VEHICLE.contains(entityType)) { } else if (EntityCategories.VEHICLE.contains(entityType)) {

View File

@ -74,7 +74,8 @@ public class BukkitCommand implements CommandExecutor, TabCompleter {
if (args.length == 0) { if (args.length == 0) {
return Collections.singletonList("plots"); return Collections.singletonList("plots");
} }
Collection<com.plotsquared.core.command.Command> objects = MainCommand.getInstance().tab(player, args, s.endsWith(" ")); Collection<com.plotsquared.core.command.Command> objects =
MainCommand.getInstance().tab(player, args, s.endsWith(" "));
if (objects == null) { if (objects == null) {
return null; return null;
} }

View File

@ -25,6 +25,7 @@
*/ */
package com.plotsquared.bukkit; package com.plotsquared.bukkit;
import com.plotsquared.bukkit.generator.BukkitHybridUtils;
import com.plotsquared.bukkit.generator.BukkitPlotGenerator; import com.plotsquared.bukkit.generator.BukkitPlotGenerator;
import com.plotsquared.bukkit.listener.ChunkListener; import com.plotsquared.bukkit.listener.ChunkListener;
import com.plotsquared.bukkit.listener.EntitySpawnListener; import com.plotsquared.bukkit.listener.EntitySpawnListener;
@ -33,42 +34,46 @@ import com.plotsquared.bukkit.listener.SingleWorldListener;
import com.plotsquared.bukkit.listener.WorldEvents; import com.plotsquared.bukkit.listener.WorldEvents;
import com.plotsquared.bukkit.placeholder.PlaceholderFormatter; import com.plotsquared.bukkit.placeholder.PlaceholderFormatter;
import com.plotsquared.bukkit.placeholder.Placeholders; import com.plotsquared.bukkit.placeholder.Placeholders;
import com.plotsquared.bukkit.queue.BukkitLocalQueue;
import com.plotsquared.bukkit.schematic.BukkitSchematicHandler;
import com.plotsquared.bukkit.util.BukkitChatManager; import com.plotsquared.bukkit.util.BukkitChatManager;
import com.plotsquared.bukkit.util.BukkitEconHandler; import com.plotsquared.bukkit.util.BukkitEconHandler;
import com.plotsquared.bukkit.generator.BukkitHybridUtils;
import com.plotsquared.bukkit.util.BukkitInventoryUtil; import com.plotsquared.bukkit.util.BukkitInventoryUtil;
import com.plotsquared.bukkit.schematic.BukkitSchematicHandler;
import com.plotsquared.bukkit.util.BukkitSetupUtils; import com.plotsquared.bukkit.util.BukkitSetupUtils;
import com.plotsquared.bukkit.util.BukkitTaskManager; import com.plotsquared.bukkit.util.BukkitTaskManager;
import com.plotsquared.bukkit.util.BukkitUtil; import com.plotsquared.bukkit.util.BukkitUtil;
import com.plotsquared.bukkit.util.SetGenCB; import com.plotsquared.bukkit.util.SetGenCB;
import com.plotsquared.bukkit.util.UpdateUtility; import com.plotsquared.bukkit.util.UpdateUtility;
import com.plotsquared.bukkit.queue.BukkitLocalQueue;
import com.plotsquared.bukkit.util.uuid.DefaultUUIDWrapper; import com.plotsquared.bukkit.util.uuid.DefaultUUIDWrapper;
import com.plotsquared.bukkit.util.uuid.FileUUIDHandler; import com.plotsquared.bukkit.util.uuid.FileUUIDHandler;
import com.plotsquared.bukkit.util.uuid.LowerOfflineUUIDWrapper; import com.plotsquared.bukkit.util.uuid.LowerOfflineUUIDWrapper;
import com.plotsquared.bukkit.util.uuid.OfflineUUIDWrapper; import com.plotsquared.bukkit.util.uuid.OfflineUUIDWrapper;
import com.plotsquared.bukkit.util.uuid.SQLUUIDHandler; import com.plotsquared.bukkit.util.uuid.SQLUUIDHandler;
import com.plotsquared.core.configuration.*;
import com.plotsquared.core.IPlotMain; import com.plotsquared.core.IPlotMain;
import com.plotsquared.core.PlotSquared; import com.plotsquared.core.PlotSquared;
import com.plotsquared.core.configuration.Captions;
import com.plotsquared.core.configuration.ChatFormatter;
import com.plotsquared.core.configuration.ConfigurationNode;
import com.plotsquared.core.configuration.ConfigurationSection;
import com.plotsquared.core.configuration.Settings;
import com.plotsquared.core.generator.GeneratorWrapper; import com.plotsquared.core.generator.GeneratorWrapper;
import com.plotsquared.core.generator.HybridGen; import com.plotsquared.core.generator.HybridGen;
import com.plotsquared.core.generator.HybridUtils; import com.plotsquared.core.generator.HybridUtils;
import com.plotsquared.core.generator.IndependentPlotGenerator; import com.plotsquared.core.generator.IndependentPlotGenerator;
import com.plotsquared.core.generator.SingleWorldGenerator;
import com.plotsquared.core.listener.PlotListener; import com.plotsquared.core.listener.PlotListener;
import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.plot.Plot; import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.plot.PlotArea; import com.plotsquared.core.plot.PlotArea;
import com.plotsquared.core.plot.PlotAreaTerrainType; import com.plotsquared.core.plot.PlotAreaTerrainType;
import com.plotsquared.core.plot.PlotAreaType; import com.plotsquared.core.plot.PlotAreaType;
import com.plotsquared.core.plot.PlotId; import com.plotsquared.core.plot.PlotId;
import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.plot.SetupObject; import com.plotsquared.core.plot.SetupObject;
import com.plotsquared.core.plot.message.PlainChatManager; import com.plotsquared.core.plot.message.PlainChatManager;
import com.plotsquared.core.plot.world.PlotAreaManager; import com.plotsquared.core.plot.world.PlotAreaManager;
import com.plotsquared.core.plot.world.SinglePlotArea; import com.plotsquared.core.plot.world.SinglePlotArea;
import com.plotsquared.core.plot.world.SinglePlotAreaManager; import com.plotsquared.core.plot.world.SinglePlotAreaManager;
import com.plotsquared.core.generator.SingleWorldGenerator; import com.plotsquared.core.queue.QueueProvider;
import com.plotsquared.core.util.ChatManager; import com.plotsquared.core.util.ChatManager;
import com.plotsquared.core.util.ChunkManager; import com.plotsquared.core.util.ChunkManager;
import com.plotsquared.core.util.ConsoleColors; import com.plotsquared.core.util.ConsoleColors;
@ -80,11 +85,10 @@ import com.plotsquared.core.util.ReflectionUtils;
import com.plotsquared.core.util.SchematicHandler; import com.plotsquared.core.util.SchematicHandler;
import com.plotsquared.core.util.SetupUtils; import com.plotsquared.core.util.SetupUtils;
import com.plotsquared.core.util.StringMan; import com.plotsquared.core.util.StringMan;
import com.plotsquared.core.util.WorldUtil;
import com.plotsquared.core.util.task.TaskManager; import com.plotsquared.core.util.task.TaskManager;
import com.plotsquared.core.util.uuid.UUIDHandler; import com.plotsquared.core.util.uuid.UUIDHandler;
import com.plotsquared.core.util.uuid.UUIDHandlerImplementation; import com.plotsquared.core.util.uuid.UUIDHandlerImplementation;
import com.plotsquared.core.util.WorldUtil;
import com.plotsquared.core.queue.QueueProvider;
import com.plotsquared.core.util.uuid.UUIDWrapper; import com.plotsquared.core.util.uuid.UUIDWrapper;
import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.bukkit.WorldEditPlugin; import com.sk89q.worldedit.bukkit.WorldEditPlugin;
@ -123,7 +127,9 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.UUID; import java.util.UUID;
import static com.plotsquared.core.util.PremiumVerification.*; import static com.plotsquared.core.util.PremiumVerification.getDownloadID;
import static com.plotsquared.core.util.PremiumVerification.getResourceID;
import static com.plotsquared.core.util.PremiumVerification.getUserID;
import static com.plotsquared.core.util.ReflectionUtils.getRefClass; import static com.plotsquared.core.util.ReflectionUtils.getRefClass;
public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain { public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
@ -191,8 +197,10 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
} }
if (PremiumVerification.isPremium()) { if (PremiumVerification.isPremium()) {
PlotSquared.log(Captions.PREFIX + "&6PlotSquared version licensed to Spigot user " + getUserID()); PlotSquared.log(
PlotSquared.log(Captions.PREFIX + "&6https://www.spigotmc.org/resources/" + getResourceID()); Captions.PREFIX + "&6PlotSquared version licensed to Spigot user " + getUserID());
PlotSquared
.log(Captions.PREFIX + "&6https://www.spigotmc.org/resources/" + getResourceID());
PlotSquared.log(Captions.PREFIX + "&6Download ID: " + getDownloadID()); PlotSquared.log(Captions.PREFIX + "&6Download ID: " + getDownloadID());
PlotSquared.log(Captions.PREFIX + "&6Thanks for supporting us :)"); PlotSquared.log(Captions.PREFIX + "&6Thanks for supporting us :)");
} else { } else {
@ -206,7 +214,8 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
} }
PlotSquared.log(Captions.PREFIX + "&6PlotSquared hooked into PlaceholderAPI"); PlotSquared.log(Captions.PREFIX + "&6PlotSquared hooked into PlaceholderAPI");
} else { } else {
PlotSquared.debug(Captions.PREFIX + "&6PlaceholderAPI is not in use. Hook deactivated."); PlotSquared
.debug(Captions.PREFIX + "&6PlaceholderAPI is not in use. Hook deactivated.");
} }
this.startMetrics(); this.startMetrics();
@ -409,8 +418,8 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
case MINECART_TNT: case MINECART_TNT:
case BOAT: case BOAT:
if (Settings.Enabled_Components.KILL_ROAD_VEHICLES) { if (Settings.Enabled_Components.KILL_ROAD_VEHICLES) {
com.plotsquared.core.location.Location com.plotsquared.core.location.Location location =
location = BukkitUtil.getLocation(entity.getLocation()); BukkitUtil.getLocation(entity.getLocation());
Plot plot = location.getPlot(); Plot plot = location.getPlot();
if (plot == null) { if (plot == null) {
if (location.isPlotArea()) { if (location.isPlotArea()) {
@ -466,8 +475,8 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
PlotId originalPlotId = (PlotId) meta.get(0).value(); PlotId originalPlotId = (PlotId) meta.get(0).value();
if (originalPlotId != null) { if (originalPlotId != null) {
com.plotsquared.core.location.Location com.plotsquared.core.location.Location pLoc =
pLoc = BukkitUtil.getLocation(entity.getLocation()); BukkitUtil.getLocation(entity.getLocation());
PlotArea area = pLoc.getPlotArea(); PlotArea area = pLoc.getPlotArea();
if (area != null) { if (area != null) {
PlotId currentPlotId = PlotId.of(area.getPlotAbs(pLoc)); PlotId currentPlotId = PlotId.of(area.getPlotAbs(pLoc));
@ -485,14 +494,15 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
} }
} else { } else {
//This is to apply the metadata to already spawned shulkers (see EntitySpawnListener.java) //This is to apply the metadata to already spawned shulkers (see EntitySpawnListener.java)
com.plotsquared.core.location.Location com.plotsquared.core.location.Location pLoc =
pLoc = BukkitUtil.getLocation(entity.getLocation()); BukkitUtil.getLocation(entity.getLocation());
PlotArea area = pLoc.getPlotArea(); PlotArea area = pLoc.getPlotArea();
if (area != null) { if (area != null) {
PlotId currentPlotId = PlotId.of(area.getPlotAbs(pLoc)); PlotId currentPlotId = PlotId.of(area.getPlotAbs(pLoc));
if (currentPlotId != null) { if (currentPlotId != null) {
entity.setMetadata("shulkerPlot", new FixedMetadataValue( entity.setMetadata("shulkerPlot",
(Plugin) PlotSquared.get().IMP, currentPlotId)); new FixedMetadataValue(
(Plugin) PlotSquared.get().IMP, currentPlotId));
} }
} }
} }
@ -668,7 +678,8 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
return new BukkitUtil(); return new BukkitUtil();
} }
@Override @Nullable public GeneratorWrapper<?> getGenerator(@NonNull final String world, @Override @Nullable
public GeneratorWrapper<?> getGenerator(@NonNull final String world,
@Nullable final String name) { @Nullable final String name) {
if (name == null) { if (name == null) {
return null; return null;
@ -709,7 +720,8 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
map.put(plotAreaType.name().toLowerCase(), terrainTypes); map.put(plotAreaType.name().toLowerCase(), terrainTypes);
} }
for (final PlotArea plotArea : PlotSquared.get().getPlotAreas()) { for (final PlotArea plotArea : PlotSquared.get().getPlotAreas()) {
final Map<String, Integer> terrainTypeMap = map.get(plotArea.getType().name().toLowerCase()); final Map<String, Integer> terrainTypeMap =
map.get(plotArea.getType().name().toLowerCase());
terrainTypeMap.put(plotArea.getTerrain().name().toLowerCase(), terrainTypeMap.put(plotArea.getTerrain().name().toLowerCase(),
terrainTypeMap.get(plotArea.getTerrain().name().toLowerCase()) + 1); terrainTypeMap.get(plotArea.getTerrain().name().toLowerCase()) + 1);
} }
@ -847,7 +859,8 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
} }
} }
@Override public GeneratorWrapper<?> wrapPlotGenerator(@Nullable final String world, @Override
public GeneratorWrapper<?> wrapPlotGenerator(@Nullable final String world,
@NonNull final IndependentPlotGenerator generator) { @NonNull final IndependentPlotGenerator generator) {
return new BukkitPlotGenerator(world, generator); return new BukkitPlotGenerator(world, generator);
} }
@ -855,7 +868,8 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
@Override public List<Map.Entry<Map.Entry<String, String>, Boolean>> getPluginIds() { @Override public List<Map.Entry<Map.Entry<String, String>, Boolean>> getPluginIds() {
List<Map.Entry<Map.Entry<String, String>, Boolean>> names = new ArrayList<>(); List<Map.Entry<Map.Entry<String, String>, Boolean>> names = new ArrayList<>();
for (final Plugin plugin : Bukkit.getPluginManager().getPlugins()) { for (final Plugin plugin : Bukkit.getPluginManager().getPlugins()) {
Map.Entry<String, String> id = new AbstractMap.SimpleEntry<>(plugin.getName(), plugin.getDescription().getVersion()); Map.Entry<String, String> id = new AbstractMap.SimpleEntry<>(plugin.getName(),
plugin.getDescription().getVersion());
names.add(new AbstractMap.SimpleEntry<>(id, plugin.isEnabled())); names.add(new AbstractMap.SimpleEntry<>(id, plugin.isEnabled()));
} }
return names; return names;
@ -863,7 +877,8 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
@Override public Actor getConsole() { @Override public Actor getConsole() {
@NotNull ConsoleCommandSender console = Bukkit.getServer().getConsoleSender(); @NotNull ConsoleCommandSender console = Bukkit.getServer().getConsoleSender();
WorldEditPlugin wePlugin = ((WorldEditPlugin) Bukkit.getPluginManager().getPlugin("WorldEdit")); WorldEditPlugin wePlugin =
((WorldEditPlugin) Bukkit.getPluginManager().getPlugin("WorldEdit"));
return wePlugin.wrapCommandSender(console); return wePlugin.wrapCommandSender(console);
} }
} }

View File

@ -25,29 +25,29 @@
*/ */
package com.plotsquared.bukkit.command; package com.plotsquared.bukkit.command;
import com.google.common.collect.Sets;
import com.plotsquared.bukkit.util.uuid.DatFileFilter; import com.plotsquared.bukkit.util.uuid.DatFileFilter;
import com.plotsquared.bukkit.util.uuid.DefaultUUIDWrapper; import com.plotsquared.bukkit.util.uuid.DefaultUUIDWrapper;
import com.plotsquared.bukkit.util.uuid.LowerOfflineUUIDWrapper; import com.plotsquared.bukkit.util.uuid.LowerOfflineUUIDWrapper;
import com.plotsquared.bukkit.util.uuid.OfflineUUIDWrapper; import com.plotsquared.bukkit.util.uuid.OfflineUUIDWrapper;
import com.plotsquared.core.command.Argument;
import com.plotsquared.core.command.CommandDeclaration;
import com.plotsquared.core.PlotSquared; import com.plotsquared.core.PlotSquared;
import com.plotsquared.core.command.Argument;
import com.plotsquared.core.command.CommandCategory; import com.plotsquared.core.command.CommandCategory;
import com.plotsquared.core.command.CommandDeclaration;
import com.plotsquared.core.command.RequiredType; import com.plotsquared.core.command.RequiredType;
import com.plotsquared.core.command.SubCommand; import com.plotsquared.core.command.SubCommand;
import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.configuration.Captions;
import com.plotsquared.core.database.DBFunc; import com.plotsquared.core.database.DBFunc;
import com.plotsquared.core.player.OfflinePlotPlayer; import com.plotsquared.core.player.OfflinePlotPlayer;
import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.util.StringWrapper; import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.util.MainUtil; import com.plotsquared.core.util.MainUtil;
import com.plotsquared.core.util.StringMan; import com.plotsquared.core.util.StringMan;
import com.plotsquared.core.util.StringWrapper;
import com.plotsquared.core.util.WorldUtil;
import com.plotsquared.core.util.task.TaskManager; import com.plotsquared.core.util.task.TaskManager;
import com.plotsquared.core.util.uuid.UUIDHandler; import com.plotsquared.core.util.uuid.UUIDHandler;
import com.plotsquared.core.util.WorldUtil;
import com.plotsquared.core.util.uuid.UUIDWrapper; import com.plotsquared.core.util.uuid.UUIDWrapper;
import com.google.common.collect.Sets;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
@ -60,10 +60,13 @@ import java.util.List;
import java.util.Map.Entry; import java.util.Map.Entry;
import java.util.UUID; import java.util.UUID;
@CommandDeclaration(command = "uuidconvert", permission = "plots.admin", @CommandDeclaration(command = "uuidconvert",
description = "Debug UUID conversion", usage = "/plot uuidconvert <lower|offline|online>", permission = "plots.admin",
requiredType = RequiredType.CONSOLE, category = CommandCategory.DEBUG) public class DebugUUID description = "Debug UUID conversion",
extends SubCommand { usage = "/plot uuidconvert <lower|offline|online>",
requiredType = RequiredType.CONSOLE,
category = CommandCategory.DEBUG)
public class DebugUUID extends SubCommand {
public DebugUUID() { public DebugUUID() {
super(Argument.String); super(Argument.String);

View File

@ -32,7 +32,8 @@ import org.bukkit.World;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType; import org.bukkit.entity.EntityType;
@Getter public abstract class EntityWrapper { @Getter
public abstract class EntityWrapper {
protected final float yaw; protected final float yaw;
protected final float pitch; protected final float pitch;

View File

@ -329,7 +329,7 @@ public final class ReplicatingEntityWrapper extends EntityWrapper {
} }
storeLiving((LivingEntity) entity); storeLiving((LivingEntity) entity);
return; return;
// END LIVING // // END LIVING //
default: default:
PlotSquared.debug("&cCOULD NOT IDENTIFY ENTITY: " + entity.getType()); PlotSquared.debug("&cCOULD NOT IDENTIFY ENTITY: " + entity.getType());
} }

View File

@ -32,12 +32,13 @@ import com.plotsquared.core.plot.PlotArea;
import com.plotsquared.core.queue.GlobalBlockQueue; import com.plotsquared.core.queue.GlobalBlockQueue;
import com.plotsquared.core.queue.LocalBlockQueue; import com.plotsquared.core.queue.LocalBlockQueue;
import com.plotsquared.core.queue.ScopedLocalBlockQueue; import com.plotsquared.core.queue.ScopedLocalBlockQueue;
import java.util.Random;
import org.bukkit.Chunk; import org.bukkit.Chunk;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.generator.BlockPopulator; import org.bukkit.generator.BlockPopulator;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import java.util.Random;
final class BlockStatePopulator extends BlockPopulator { final class BlockStatePopulator extends BlockPopulator {
private final IndependentPlotGenerator plotGenerator; private final IndependentPlotGenerator plotGenerator;
@ -47,13 +48,15 @@ final class BlockStatePopulator extends BlockPopulator {
this.plotGenerator = plotGenerator; this.plotGenerator = plotGenerator;
} }
@Override public void populate(@NotNull final World world, @NotNull final Random random, @Override
public void populate(@NotNull final World world, @NotNull final Random random,
@NotNull final Chunk source) { @NotNull final Chunk source) {
if (this.queue == null) { if (this.queue == null) {
this.queue = GlobalBlockQueue.IMP.getNewQueue(world.getName(), false); this.queue = GlobalBlockQueue.IMP.getNewQueue(world.getName(), false);
} }
final PlotArea area = PlotSquared.get().getPlotArea(world.getName(), null); final PlotArea area = PlotSquared.get().getPlotArea(world.getName(), null);
final ChunkWrapper wrap = new ChunkWrapper(area.getWorldName(), source.getX(), source.getZ()); final ChunkWrapper wrap =
new ChunkWrapper(area.getWorldName(), source.getX(), source.getZ());
final ScopedLocalBlockQueue chunk = this.queue.getForChunk(wrap.x, wrap.z); final ScopedLocalBlockQueue chunk = this.queue.getForChunk(wrap.x, wrap.z);
if (this.plotGenerator.populateChunk(chunk, area)) { if (this.plotGenerator.populateChunk(chunk, area)) {
this.queue.flush(); this.queue.flush();

View File

@ -25,17 +25,17 @@
*/ */
package com.plotsquared.bukkit.generator; package com.plotsquared.bukkit.generator;
import com.plotsquared.bukkit.util.BukkitUtil;
import com.plotsquared.bukkit.queue.GenChunk; import com.plotsquared.bukkit.queue.GenChunk;
import com.plotsquared.bukkit.util.BukkitUtil;
import com.plotsquared.core.PlotSquared; import com.plotsquared.core.PlotSquared;
import com.plotsquared.core.generator.GeneratorWrapper; import com.plotsquared.core.generator.GeneratorWrapper;
import com.plotsquared.core.generator.IndependentPlotGenerator; import com.plotsquared.core.generator.IndependentPlotGenerator;
import com.plotsquared.core.generator.SingleWorldGenerator;
import com.plotsquared.core.location.ChunkWrapper; import com.plotsquared.core.location.ChunkWrapper;
import com.plotsquared.core.plot.PlotArea; import com.plotsquared.core.plot.PlotArea;
import com.plotsquared.core.generator.SingleWorldGenerator; import com.plotsquared.core.queue.ScopedLocalBlockQueue;
import com.plotsquared.core.util.ChunkManager; import com.plotsquared.core.util.ChunkManager;
import com.plotsquared.core.util.MainUtil; import com.plotsquared.core.util.MainUtil;
import com.plotsquared.core.queue.ScopedLocalBlockQueue;
import com.sk89q.worldedit.math.BlockVector2; import com.sk89q.worldedit.math.BlockVector2;
import lombok.Getter; import lombok.Getter;
import org.bukkit.World; import org.bukkit.World;
@ -103,9 +103,7 @@ public class BukkitPlotGenerator extends ChunkGenerator
return this.platformGenerator; return this.platformGenerator;
} }
@Override @Override @NotNull public List<BlockPopulator> getDefaultPopulators(@NotNull World world) {
@NotNull
public List<BlockPopulator> getDefaultPopulators(@NotNull World world) {
try { try {
if (!this.loaded) { if (!this.loaded) {
String name = world.getName(); String name = world.getName();
@ -149,8 +147,7 @@ public class BukkitPlotGenerator extends ChunkGenerator
return toAdd; return toAdd;
} }
@Override @Override @NotNull
@NotNull
public ChunkData generateChunkData(@NotNull World world, @NotNull Random random, int x, int z, public ChunkData generateChunkData(@NotNull World world, @NotNull Random random, int x, int z,
@NotNull BiomeGrid biome) { @NotNull BiomeGrid biome) {
@ -203,8 +200,9 @@ public class BukkitPlotGenerator extends ChunkGenerator
} }
PlotArea area = PlotSquared.get().getPlotArea(world.getName(), null); PlotArea area = PlotSquared.get().getPlotArea(world.getName(), null);
if (area == null && (area = PlotSquared.get().getPlotArea(this.levelName, null)) == null) { if (area == null && (area = PlotSquared.get().getPlotArea(this.levelName, null)) == null) {
throw new IllegalStateException("Cannot regenerate chunk that does not belong to a plot area." throw new IllegalStateException(
+ " Location: " + loc + ", world: " + world); "Cannot regenerate chunk that does not belong to a plot area." + " Location: " + loc
+ ", world: " + world);
} }
try { try {
this.plotGenerator.generateChunk(result, area); this.plotGenerator.generateChunk(result, area);
@ -215,8 +213,7 @@ public class BukkitPlotGenerator extends ChunkGenerator
ChunkManager.postProcessChunk(loc, result); ChunkManager.postProcessChunk(loc, result);
} }
@Override @Override public boolean canSpawn(@NotNull final World world, final int x, final int z) {
public boolean canSpawn(@NotNull final World world, final int x, final int z) {
return true; return true;
} }

View File

@ -31,10 +31,9 @@ import com.plotsquared.core.generator.IndependentPlotGenerator;
import com.plotsquared.core.location.Location; import com.plotsquared.core.location.Location;
import com.plotsquared.core.plot.PlotArea; import com.plotsquared.core.plot.PlotArea;
import com.plotsquared.core.plot.PlotId; import com.plotsquared.core.plot.PlotId;
import com.plotsquared.core.util.MathMan;
import com.plotsquared.core.queue.ScopedLocalBlockQueue; import com.plotsquared.core.queue.ScopedLocalBlockQueue;
import com.plotsquared.core.util.MathMan;
import com.sk89q.worldedit.bukkit.BukkitAdapter; import com.sk89q.worldedit.bukkit.BukkitAdapter;
import java.util.Random;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.block.Biome; import org.bukkit.block.Biome;
import org.bukkit.generator.BlockPopulator; import org.bukkit.generator.BlockPopulator;
@ -42,6 +41,8 @@ import org.bukkit.generator.ChunkGenerator;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Range; import org.jetbrains.annotations.Range;
import java.util.Random;
final class DelegatePlotGenerator extends IndependentPlotGenerator { final class DelegatePlotGenerator extends IndependentPlotGenerator {
private final ChunkGenerator chunkGenerator; private final ChunkGenerator chunkGenerator;
@ -71,7 +72,8 @@ final class DelegatePlotGenerator extends IndependentPlotGenerator {
Random random = new Random(MathMan.pair((short) chunkX, (short) chunkZ)); Random random = new Random(MathMan.pair((short) chunkX, (short) chunkZ));
try { try {
ChunkGenerator.BiomeGrid grid = new ChunkGenerator.BiomeGrid() { ChunkGenerator.BiomeGrid grid = new ChunkGenerator.BiomeGrid() {
@Override public void setBiome(@Range(from = 0, to = 15) int x, @Override
public void setBiome(@Range(from = 0, to = 15) int x,
@Range(from = 0, to = 15) int z, @NotNull Biome biome) { @Range(from = 0, to = 15) int z, @NotNull Biome biome) {
result.setBiome(x, z, BukkitAdapter.adapt(biome)); result.setBiome(x, z, BukkitAdapter.adapt(biome));
} }
@ -86,8 +88,7 @@ final class DelegatePlotGenerator extends IndependentPlotGenerator {
return Biome.FOREST; return Biome.FOREST;
} }
@Override @Override public @NotNull Biome getBiome(int x, int y, int z) {
public @NotNull Biome getBiome(int x, int y, int z) {
return Biome.FOREST; return Biome.FOREST;
} }
}; };

View File

@ -57,7 +57,8 @@ import java.util.HashSet;
import static com.plotsquared.core.util.ReflectionUtils.getRefClass; import static com.plotsquared.core.util.ReflectionUtils.getRefClass;
@SuppressWarnings("unused") public class ChunkListener implements Listener { @SuppressWarnings("unused")
public class ChunkListener implements Listener {
private RefMethod methodGetHandleChunk; private RefMethod methodGetHandleChunk;
private RefField mustSave; private RefField mustSave;
@ -291,11 +292,15 @@ import static com.plotsquared.core.util.ReflectionUtils.getRefClass;
ent.remove(); ent.remove();
} }
} }
PlotSquared.debug("PlotSquared detected unsafe chunk and processed: " + (chunk.getX() << 4) + "," + (chunk.getX() << 4)); PlotSquared.debug(
"PlotSquared detected unsafe chunk and processed: " + (chunk.getX() << 4) + "," + (
chunk.getX() << 4));
} }
if (tiles.length > Settings.Chunk_Processor.MAX_TILES) { if (tiles.length > Settings.Chunk_Processor.MAX_TILES) {
if (unload) { if (unload) {
PlotSquared.debug("PlotSquared detected unsafe chunk: " + (chunk.getX()<< 4) + "," + (chunk.getX() << 4)); PlotSquared.debug(
"PlotSquared detected unsafe chunk: " + (chunk.getX() << 4) + "," + (
chunk.getX() << 4));
cleanChunk(chunk); cleanChunk(chunk);
return true; return true;
} }

View File

@ -28,10 +28,10 @@ package com.plotsquared.bukkit.listener;
import com.plotsquared.bukkit.util.BukkitUtil; import com.plotsquared.bukkit.util.BukkitUtil;
import com.plotsquared.core.PlotSquared; import com.plotsquared.core.PlotSquared;
import com.plotsquared.core.configuration.Settings; import com.plotsquared.core.configuration.Settings;
import com.plotsquared.core.plot.flag.implementations.DoneFlag;
import com.plotsquared.core.location.Location; import com.plotsquared.core.location.Location;
import com.plotsquared.core.plot.Plot; import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.plot.PlotArea; import com.plotsquared.core.plot.PlotArea;
import com.plotsquared.core.plot.flag.implementations.DoneFlag;
import io.papermc.lib.PaperLib; import io.papermc.lib.PaperLib;
import org.bukkit.Chunk; import org.bukkit.Chunk;
import org.bukkit.World; import org.bukkit.World;

View File

@ -25,15 +25,15 @@
*/ */
package com.plotsquared.bukkit.listener; package com.plotsquared.bukkit.listener;
import com.google.common.collect.Iterables;
import com.plotsquared.bukkit.player.BukkitPlayer; import com.plotsquared.bukkit.player.BukkitPlayer;
import com.plotsquared.bukkit.util.BukkitUtil; import com.plotsquared.bukkit.util.BukkitUtil;
import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.configuration.Captions;
import com.plotsquared.core.plot.flag.implementations.ForcefieldFlag;
import com.plotsquared.core.location.Location; import com.plotsquared.core.location.Location;
import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.plot.flag.implementations.ForcefieldFlag;
import com.plotsquared.core.util.Permissions; import com.plotsquared.core.util.Permissions;
import com.google.common.collect.Iterables;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
@ -41,7 +41,8 @@ import java.util.HashSet;
import java.util.Set; import java.util.Set;
import java.util.UUID; import java.util.UUID;
@SuppressWarnings("unused") public class ForceFieldListener { @SuppressWarnings("unused")
public class ForceFieldListener {
private static Set<PlotPlayer> getNearbyPlayers(Player player, Plot plot) { private static Set<PlotPlayer> getNearbyPlayers(Player player, Plot plot) {
Set<PlotPlayer> players = new HashSet<>(); Set<PlotPlayer> players = new HashSet<>();

View File

@ -26,9 +26,6 @@
package com.plotsquared.bukkit.listener; package com.plotsquared.bukkit.listener;
import com.destroystokyo.paper.MaterialTags; import com.destroystokyo.paper.MaterialTags;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import com.google.gson.stream.JsonReader;
import com.plotsquared.bukkit.player.BukkitPlayer; import com.plotsquared.bukkit.player.BukkitPlayer;
import com.plotsquared.bukkit.util.BukkitUtil; import com.plotsquared.bukkit.util.BukkitUtil;
import com.plotsquared.bukkit.util.UpdateUtility; import com.plotsquared.bukkit.util.UpdateUtility;
@ -36,6 +33,15 @@ import com.plotsquared.core.PlotSquared;
import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.configuration.Captions;
import com.plotsquared.core.configuration.Settings; import com.plotsquared.core.configuration.Settings;
import com.plotsquared.core.database.DBFunc; import com.plotsquared.core.database.DBFunc;
import com.plotsquared.core.listener.PlayerBlockEventType;
import com.plotsquared.core.listener.PlotListener;
import com.plotsquared.core.location.Location;
import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.plot.PlotArea;
import com.plotsquared.core.plot.PlotHandler;
import com.plotsquared.core.plot.PlotId;
import com.plotsquared.core.plot.PlotInventory;
import com.plotsquared.core.plot.flag.implementations.AnimalAttackFlag; import com.plotsquared.core.plot.flag.implementations.AnimalAttackFlag;
import com.plotsquared.core.plot.flag.implementations.AnimalCapFlag; import com.plotsquared.core.plot.flag.implementations.AnimalCapFlag;
import com.plotsquared.core.plot.flag.implementations.AnimalInteractFlag; import com.plotsquared.core.plot.flag.implementations.AnimalInteractFlag;
@ -88,23 +94,14 @@ import com.plotsquared.core.plot.flag.implementations.VehicleUseFlag;
import com.plotsquared.core.plot.flag.implementations.VillagerInteractFlag; import com.plotsquared.core.plot.flag.implementations.VillagerInteractFlag;
import com.plotsquared.core.plot.flag.implementations.VineGrowFlag; import com.plotsquared.core.plot.flag.implementations.VineGrowFlag;
import com.plotsquared.core.plot.flag.types.BlockTypeWrapper; import com.plotsquared.core.plot.flag.types.BlockTypeWrapper;
import com.plotsquared.core.listener.PlayerBlockEventType;
import com.plotsquared.core.listener.PlotListener;
import com.plotsquared.core.location.Location;
import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.plot.PlotArea;
import com.plotsquared.core.plot.PlotHandler;
import com.plotsquared.core.plot.PlotId;
import com.plotsquared.core.plot.PlotInventory;
import com.plotsquared.core.plot.message.PlotMessage; import com.plotsquared.core.plot.message.PlotMessage;
import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.util.PremiumVerification;
import com.plotsquared.core.util.StringWrapper;
import com.plotsquared.core.util.EntityUtil; import com.plotsquared.core.util.EntityUtil;
import com.plotsquared.core.util.MainUtil; import com.plotsquared.core.util.MainUtil;
import com.plotsquared.core.util.MathMan; import com.plotsquared.core.util.MathMan;
import com.plotsquared.core.util.Permissions; import com.plotsquared.core.util.Permissions;
import com.plotsquared.core.util.PremiumVerification;
import com.plotsquared.core.util.RegExUtil; import com.plotsquared.core.util.RegExUtil;
import com.plotsquared.core.util.StringWrapper;
import com.plotsquared.core.util.entity.EntityCategories; import com.plotsquared.core.util.entity.EntityCategories;
import com.plotsquared.core.util.task.TaskManager; import com.plotsquared.core.util.task.TaskManager;
import com.plotsquared.core.util.uuid.UUIDHandler; import com.plotsquared.core.util.uuid.UUIDHandler;
@ -209,12 +206,7 @@ import org.bukkit.projectiles.BlockProjectileSource;
import org.bukkit.projectiles.ProjectileSource; import org.bukkit.projectiles.ProjectileSource;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
import javax.net.ssl.HttpsURLConnection;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.net.URL;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashSet; import java.util.HashSet;
import java.util.Iterator; import java.util.Iterator;
@ -275,31 +267,32 @@ public class PlayerEvents extends PlotListener implements Listener {
return false; return false;
} }
final com.sk89q.worldedit.world.entity.EntityType entityType = BukkitAdapter.adapt(entity.getType()); final com.sk89q.worldedit.world.entity.EntityType entityType =
BukkitAdapter.adapt(entity.getType());
if (EntityCategories.PLAYER.contains(entityType)) { if (EntityCategories.PLAYER.contains(entityType)) {
return false; return false;
} }
if (EntityCategories.PROJECTILE.contains(entityType) || if (EntityCategories.PROJECTILE.contains(entityType) || EntityCategories.OTHER
EntityCategories.OTHER.contains(entityType) || .contains(entityType) || EntityCategories.HANGING.contains(entityType)) {
EntityCategories.HANGING.contains(entityType)) {
return EntityUtil.checkEntity(plot, EntityCapFlag.ENTITY_CAP_UNLIMITED, return EntityUtil.checkEntity(plot, EntityCapFlag.ENTITY_CAP_UNLIMITED,
MiscCapFlag.MISC_CAP_UNLIMITED); MiscCapFlag.MISC_CAP_UNLIMITED);
} }
// Has to go go before vehicle as horses are both // Has to go go before vehicle as horses are both
// animals and vehicles // animals and vehicles
if (EntityCategories.ANIMAL.contains(entityType) || if (EntityCategories.ANIMAL.contains(entityType) || EntityCategories.VILLAGER
EntityCategories.VILLAGER.contains(entityType) || .contains(entityType) || EntityCategories.TAMEABLE.contains(entityType)) {
EntityCategories.TAMEABLE.contains(entityType)) { return EntityUtil
return EntityUtil.checkEntity(plot, EntityCapFlag.ENTITY_CAP_UNLIMITED, .checkEntity(plot, EntityCapFlag.ENTITY_CAP_UNLIMITED, MobCapFlag.MOB_CAP_UNLIMITED,
MobCapFlag.MOB_CAP_UNLIMITED, AnimalCapFlag.ANIMAL_CAP_UNLIMITED); AnimalCapFlag.ANIMAL_CAP_UNLIMITED);
} }
if (EntityCategories.HOSTILE.contains(entityType)) { if (EntityCategories.HOSTILE.contains(entityType)) {
return EntityUtil.checkEntity(plot, EntityCapFlag.ENTITY_CAP_UNLIMITED, return EntityUtil
MobCapFlag.MOB_CAP_UNLIMITED, HostileCapFlag.HOSTILE_CAP_UNLIMITED); .checkEntity(plot, EntityCapFlag.ENTITY_CAP_UNLIMITED, MobCapFlag.MOB_CAP_UNLIMITED,
HostileCapFlag.HOSTILE_CAP_UNLIMITED);
} }
if (EntityCategories.VEHICLE.contains(entityType)) { if (EntityCategories.VEHICLE.contains(entityType)) {
@ -763,10 +756,12 @@ public class PlayerEvents extends PlotListener implements Listener {
} }
} }
if (Settings.Enabled_Components.KILL_ROAD_VEHICLES) { if (Settings.Enabled_Components.KILL_ROAD_VEHICLES) {
final com.sk89q.worldedit.world.entity.EntityType entityType = BukkitAdapter.adapt(vehicle.getType()); final com.sk89q.worldedit.world.entity.EntityType entityType =
BukkitAdapter.adapt(vehicle.getType());
// Horses etc are vehicles, but they're also animals // Horses etc are vehicles, but they're also animals
// so this filters out all living entities // so this filters out all living entities
if (EntityCategories.VEHICLE.contains(entityType) && !EntityCategories.ANIMAL.contains(entityType)) { if (EntityCategories.VEHICLE.contains(entityType) && !EntityCategories.ANIMAL
.contains(entityType)) {
List<MetadataValue> meta = vehicle.getMetadata("plot"); List<MetadataValue> meta = vehicle.getMetadata("plot");
Plot toPlot = BukkitUtil.getLocation(to).getPlot(); Plot toPlot = BukkitUtil.getLocation(to).getPlot();
if (!meta.isEmpty()) { if (!meta.isEmpty()) {
@ -930,7 +925,8 @@ public class PlayerEvents extends PlotListener implements Listener {
|| area.isForcingPlotChat())) { || area.isForcingPlotChat())) {
return; return;
} }
if (plot.isDenied(plotPlayer.getUUID()) && !Permissions.hasPermission(plotPlayer, Captions.PERMISSION_ADMIN_CHAT_BYPASS)) { if (plot.isDenied(plotPlayer.getUUID()) && !Permissions
.hasPermission(plotPlayer, Captions.PERMISSION_ADMIN_CHAT_BYPASS)) {
return; return;
} }
event.setCancelled(true); event.setCancelled(true);
@ -990,10 +986,9 @@ public class PlayerEvents extends PlotListener implements Listener {
event.setCancelled(true); event.setCancelled(true);
return; return;
} }
} else if ( } else if ((location.getY() > area.getMaxBuildHeight() || location.getY() < area
(location.getY() > area.getMaxBuildHeight() || location.getY() < area.getMinBuildHeight()) .getMinBuildHeight()) && !Permissions
&& !Permissions .hasPermission(plotPlayer, Captions.PERMISSION_ADMIN_BUILD_HEIGHT_LIMIT)) {
.hasPermission(plotPlayer, Captions.PERMISSION_ADMIN_BUILD_HEIGHT_LIMIT)) {
event.setCancelled(true); event.setCancelled(true);
MainUtil.sendMessage(plotPlayer, Captions.HEIGHT_LIMIT.getTranslated() MainUtil.sendMessage(plotPlayer, Captions.HEIGHT_LIMIT.getTranslated()
.replace("{limit}", String.valueOf(area.getMaxBuildHeight()))); .replace("{limit}", String.valueOf(area.getMaxBuildHeight())));
@ -2501,13 +2496,16 @@ public class PlayerEvents extends PlotListener implements Listener {
} }
} else if (!plot.isAdded(pp.getUUID())) { } else if (!plot.isAdded(pp.getUUID())) {
final Entity entity = event.getRightClicked(); final Entity entity = event.getRightClicked();
final com.sk89q.worldedit.world.entity.EntityType entityType = BukkitAdapter.adapt(entity.getType()); final com.sk89q.worldedit.world.entity.EntityType entityType =
BukkitAdapter.adapt(entity.getType());
if (EntityCategories.HOSTILE.contains(entityType) && plot.getFlag(HostileInteractFlag.class)) { if (EntityCategories.HOSTILE.contains(entityType) && plot
.getFlag(HostileInteractFlag.class)) {
return; return;
} }
if (EntityCategories.ANIMAL.contains(entityType) && plot.getFlag(AnimalInteractFlag.class)) { if (EntityCategories.ANIMAL.contains(entityType) && plot
.getFlag(AnimalInteractFlag.class)) {
return; return;
} }
@ -2518,20 +2516,23 @@ public class PlayerEvents extends PlotListener implements Listener {
return; return;
} }
if (EntityCategories.VEHICLE.contains(entityType) && plot.getFlag(VehicleUseFlag.class)) { if (EntityCategories.VEHICLE.contains(entityType) && plot
.getFlag(VehicleUseFlag.class)) {
return; return;
} }
if (EntityCategories.PLAYER.contains(entityType) && plot.getFlag(PlayerInteractFlag.class)) { if (EntityCategories.PLAYER.contains(entityType) && plot
.getFlag(PlayerInteractFlag.class)) {
return; return;
} }
if (EntityCategories.VILLAGER.contains(entityType) && plot.getFlag(VillagerInteractFlag.class)) { if (EntityCategories.VILLAGER.contains(entityType) && plot
.getFlag(VillagerInteractFlag.class)) {
return; return;
} }
if ((EntityCategories.HANGING.contains(entityType) || if ((EntityCategories.HANGING.contains(entityType) || EntityCategories.OTHER
EntityCategories.OTHER.contains(entityType)) && plot.getFlag(MiscInteractFlag.class)) { .contains(entityType)) && plot.getFlag(MiscInteractFlag.class)) {
return; return;
} }
@ -2813,7 +2814,8 @@ public class PlayerEvents extends PlotListener implements Listener {
"plots.admin.pve." + stub); "plots.admin.pve." + stub);
return false; return false;
} }
} else if (EntityCategories.VEHICLE.contains(entityType)) { // Vehicles are managed in vehicle destroy event } else if (EntityCategories.VEHICLE
.contains(entityType)) { // Vehicles are managed in vehicle destroy event
return true; return true;
} else { // victim is something else } else { // victim is something else
if (plot != null && (plot.getFlag(PveFlag.class) || plot if (plot != null && (plot.getFlag(PveFlag.class) || plot
@ -2884,8 +2886,9 @@ public class PlayerEvents extends PlotListener implements Listener {
PlotPlayer pp = BukkitUtil.getPlayer(player); PlotPlayer pp = BukkitUtil.getPlayer(player);
Plot plot = area.getPlot(location); Plot plot = area.getPlot(location);
if (plot != null) { if (plot != null) {
if ((location.getY() > area.getMaxBuildHeight() || location.getY() < area.getMinBuildHeight()) if ((location.getY() > area.getMaxBuildHeight() || location.getY() < area
&& !Permissions.hasPermission(pp, Captions.PERMISSION_ADMIN_BUILD_HEIGHT_LIMIT)) { .getMinBuildHeight()) && !Permissions
.hasPermission(pp, Captions.PERMISSION_ADMIN_BUILD_HEIGHT_LIMIT)) {
event.setCancelled(true); event.setCancelled(true);
MainUtil.sendMessage(pp, Captions.HEIGHT_LIMIT.getTranslated() MainUtil.sendMessage(pp, Captions.HEIGHT_LIMIT.getTranslated()
.replace("{limit}", String.valueOf(area.getMaxBuildHeight()))); .replace("{limit}", String.valueOf(area.getMaxBuildHeight())));

View File

@ -44,7 +44,8 @@ import java.lang.reflect.Method;
import static com.plotsquared.core.util.ReflectionUtils.getRefClass; import static com.plotsquared.core.util.ReflectionUtils.getRefClass;
@SuppressWarnings("unused") public class SingleWorldListener implements Listener { @SuppressWarnings("unused")
public class SingleWorldListener implements Listener {
private Method methodGetHandleChunk; private Method methodGetHandleChunk;
private Field mustSave; private Field mustSave;

View File

@ -40,23 +40,23 @@ import org.bukkit.generator.ChunkGenerator;
@SuppressWarnings("unused") @SuppressWarnings("unused")
public class WorldEvents implements Listener { public class WorldEvents implements Listener {
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onWorldInit(WorldInitEvent event) { public void onWorldInit(WorldInitEvent event) {
World world = event.getWorld(); World world = event.getWorld();
String name = world.getName(); String name = world.getName();
PlotAreaManager manager = PlotSquared.get().getPlotAreaManager(); PlotAreaManager manager = PlotSquared.get().getPlotAreaManager();
if (manager instanceof SinglePlotAreaManager) { if (manager instanceof SinglePlotAreaManager) {
SinglePlotAreaManager single = (SinglePlotAreaManager) manager; SinglePlotAreaManager single = (SinglePlotAreaManager) manager;
if (single.isWorld(name)) { if (single.isWorld(name)) {
world.setKeepSpawnInMemory(false); world.setKeepSpawnInMemory(false);
return; return;
} }
}
ChunkGenerator gen = world.getGenerator();
if (gen instanceof GeneratorWrapper) {
PlotSquared.get().loadWorld(name, (GeneratorWrapper<?>) gen);
} else {
PlotSquared.get().loadWorld(name, new BukkitPlotGenerator(name, gen));
}
} }
ChunkGenerator gen = world.getGenerator();
if (gen instanceof GeneratorWrapper) {
PlotSquared.get().loadWorld(name, (GeneratorWrapper<?>) gen);
} else {
PlotSquared.get().loadWorld(name, new BukkitPlotGenerator(name, gen));
}
}
} }

View File

@ -42,7 +42,7 @@ public class PlaceholderFormatter implements ChatFormatter {
final Player player = ((BukkitPlayer) recipient).player; final Player player = ((BukkitPlayer) recipient).player;
context.setMessage(PlaceholderAPI.setPlaceholders(player, context.getMessage())); context.setMessage(PlaceholderAPI.setPlaceholders(player, context.getMessage()));
} }
} }
} }
} }

View File

@ -41,33 +41,27 @@ public class Placeholders extends PlaceholderExpansion {
public Placeholders() { public Placeholders() {
} }
@Override @Override public boolean persist() {
public boolean persist() {
return true; return true;
} }
@Override @Override public boolean canRegister() {
public boolean canRegister() {
return true; return true;
} }
@Override @Override public String getAuthor() {
public String getAuthor() {
return "NotMyFault"; return "NotMyFault";
} }
@Override @Override public String getIdentifier() {
public String getIdentifier() {
return "plotsquared"; return "plotsquared";
} }
@Override @Override public String getVersion() {
public String getVersion() {
return "2.4"; return "2.4";
} }
@Override @Override public String onPlaceholderRequest(Player p, String identifier) {
public String onPlaceholderRequest(Player p, String identifier) {
final PlotPlayer pl = PlotPlayer.get(p.getName()); final PlotPlayer pl = PlotPlayer.get(p.getName());
if (pl == null) { if (pl == null) {

View File

@ -28,12 +28,12 @@ package com.plotsquared.bukkit.player;
import com.plotsquared.bukkit.util.BukkitUtil; import com.plotsquared.bukkit.util.BukkitUtil;
import com.plotsquared.core.PlotSquared; import com.plotsquared.core.PlotSquared;
import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.configuration.Captions;
import com.plotsquared.core.events.TeleportCause;
import com.plotsquared.core.location.Location; import com.plotsquared.core.location.Location;
import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.events.TeleportCause; import com.plotsquared.core.plot.PlotWeather;
import com.plotsquared.core.util.EconHandler; import com.plotsquared.core.util.EconHandler;
import com.plotsquared.core.util.MathMan; import com.plotsquared.core.util.MathMan;
import com.plotsquared.core.plot.PlotWeather;
import com.plotsquared.core.util.StringMan; import com.plotsquared.core.util.StringMan;
import com.plotsquared.core.util.uuid.UUIDHandler; import com.plotsquared.core.util.uuid.UUIDHandler;
import com.sk89q.worldedit.bukkit.BukkitAdapter; import com.sk89q.worldedit.bukkit.BukkitAdapter;
@ -167,7 +167,7 @@ public class BukkitPlayer extends PlotPlayer {
if (CHECK_EFFECTIVE) { if (CHECK_EFFECTIVE) {
boolean hasAny = false; boolean hasAny = false;
String stubPlus = stub + "."; String stubPlus = stub + ".";
final Set<PermissionAttachmentInfo> effective = player.getEffectivePermissions(); final Set<PermissionAttachmentInfo> effective = player.getEffectivePermissions();
if (!effective.isEmpty()) { if (!effective.isEmpty()) {
for (PermissionAttachmentInfo attach : effective) { for (PermissionAttachmentInfo attach : effective) {
String permStr = attach.getPermission(); String permStr = attach.getPermission();
@ -211,8 +211,7 @@ public class BukkitPlayer extends PlotPlayer {
} }
@Override public void sendMessage(String message) { @Override public void sendMessage(String message) {
message = message.replace('\u2010', '%') message = message.replace('\u2010', '%').replace('\u2020', '&').replace('\u2030', '&');
.replace('\u2020', '&').replace('\u2030', '&');
if (!StringMan.isEqual(this.getMeta("lastMessage"), message) || ( if (!StringMan.isEqual(this.getMeta("lastMessage"), message) || (
System.currentTimeMillis() - this.<Long>getMeta("lastMessageTime") > 5000)) { System.currentTimeMillis() - this.<Long>getMeta("lastMessageTime") > 5000)) {
setMeta("lastMessage", message); setMeta("lastMessage", message);
@ -221,12 +220,14 @@ public class BukkitPlayer extends PlotPlayer {
} }
} }
@Override public void teleport(@NotNull final Location location, @NotNull final TeleportCause cause) { @Override
public void teleport(@NotNull final Location location, @NotNull final TeleportCause cause) {
if (Math.abs(location.getX()) >= 30000000 || Math.abs(location.getZ()) >= 30000000) { if (Math.abs(location.getX()) >= 30000000 || Math.abs(location.getZ()) >= 30000000) {
return; return;
} }
final org.bukkit.Location bukkitLocation = new org.bukkit.Location(BukkitUtil.getWorld(location.getWorld()), location.getX() + 0.5, final org.bukkit.Location bukkitLocation =
location.getY(), location.getZ() + 0.5, location.getYaw(), location.getPitch()); new org.bukkit.Location(BukkitUtil.getWorld(location.getWorld()), location.getX() + 0.5,
location.getY(), location.getZ() + 0.5, location.getYaw(), location.getPitch());
PaperLib.teleportAsync(player, bukkitLocation, getTeleportCause(cause)); PaperLib.teleportAsync(player, bukkitLocation, getTeleportCause(cause));
} }
@ -280,7 +281,8 @@ public class BukkitPlayer extends PlotPlayer {
} }
} }
@Override public void setGameMode(@NotNull final com.sk89q.worldedit.world.gamemode.GameMode gameMode) { @Override
public void setGameMode(@NotNull final com.sk89q.worldedit.world.gamemode.GameMode gameMode) {
if (ADVENTURE.equals(gameMode)) { if (ADVENTURE.equals(gameMode)) {
this.player.setGameMode(GameMode.ADVENTURE); this.player.setGameMode(GameMode.ADVENTURE);
} else if (CREATIVE.equals(gameMode)) { } else if (CREATIVE.equals(gameMode)) {
@ -344,7 +346,8 @@ public class BukkitPlayer extends PlotPlayer {
return PlayerTeleportEvent.TeleportCause.COMMAND; return PlayerTeleportEvent.TeleportCause.COMMAND;
case PLUGIN: case PLUGIN:
return PlayerTeleportEvent.TeleportCause.PLUGIN; return PlayerTeleportEvent.TeleportCause.PLUGIN;
default: return PlayerTeleportEvent.TeleportCause.UNKNOWN; default:
return PlayerTeleportEvent.TeleportCause.UNKNOWN;
} }
} }
} }

View File

@ -28,9 +28,9 @@ package com.plotsquared.bukkit.queue;
import com.plotsquared.bukkit.schematic.StateWrapper; import com.plotsquared.bukkit.schematic.StateWrapper;
import com.plotsquared.bukkit.util.BukkitBlockUtil; import com.plotsquared.bukkit.util.BukkitBlockUtil;
import com.plotsquared.core.PlotSquared; import com.plotsquared.core.PlotSquared;
import com.plotsquared.core.util.MainUtil;
import com.plotsquared.core.queue.BasicLocalBlockQueue; import com.plotsquared.core.queue.BasicLocalBlockQueue;
import com.plotsquared.core.util.BlockUtil; import com.plotsquared.core.util.BlockUtil;
import com.plotsquared.core.util.MainUtil;
import com.sk89q.jnbt.CompoundTag; import com.sk89q.jnbt.CompoundTag;
import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.WorldEdit;
@ -139,7 +139,8 @@ public class BukkitLocalQueue extends BasicLocalBlockQueue {
BlockData blockData = BukkitAdapter.adapt(block); BlockData blockData = BukkitAdapter.adapt(block);
Block existing = chunk.getBlock(x, y, z); Block existing = chunk.getBlock(x, y, z);
final BlockState existingBaseBlock = BukkitAdapter.adapt(existing.getBlockData()); final BlockState existingBaseBlock =
BukkitAdapter.adapt(existing.getBlockData());
if (BukkitBlockUtil.get(existing).equals(existingBaseBlock) && existing if (BukkitBlockUtil.get(existing).equals(existingBaseBlock) && existing
.getBlockData().matches(blockData)) { .getBlockData().matches(blockData)) {
continue; continue;
@ -151,8 +152,8 @@ public class BukkitLocalQueue extends BasicLocalBlockQueue {
CompoundTag tag = block.getNbtData(); CompoundTag tag = block.getNbtData();
StateWrapper sw = new StateWrapper(tag); StateWrapper sw = new StateWrapper(tag);
sw.restoreTag(worldObj.getName(), existing.getX(), sw.restoreTag(worldObj.getName(), existing.getX(), existing.getY(),
existing.getY(), existing.getZ()); existing.getZ());
} }
} }
} }
@ -162,7 +163,8 @@ public class BukkitLocalQueue extends BasicLocalBlockQueue {
if (isForceSync()) { if (isForceSync()) {
chunkConsumer.accept(getChunk(worldObj, localChunk)); chunkConsumer.accept(getChunk(worldObj, localChunk));
} else { } else {
PaperLib.getChunkAtAsync(worldObj, localChunk.getX(), localChunk.getZ(), true).thenAccept(chunkConsumer); PaperLib.getChunkAtAsync(worldObj, localChunk.getX(), localChunk.getZ(), true)
.thenAccept(chunkConsumer);
} }
} }
@ -206,8 +208,8 @@ public class BukkitLocalQueue extends BasicLocalBlockQueue {
BiomeType biomeType = biomeZ[z]; BiomeType biomeType = biomeZ[z];
Biome biome = BukkitAdapter.adapt(biomeType); Biome biome = BukkitAdapter.adapt(biomeType);
worldObj.setBiome((chunk.getX() << 4) + x, (chunk.getZ() << 4) + z, worldObj
biome); .setBiome((chunk.getX() << 4) + x, (chunk.getZ() << 4) + z, biome);
} }
} }
} }
@ -216,7 +218,8 @@ public class BukkitLocalQueue extends BasicLocalBlockQueue {
if (this.isForceSync()) { if (this.isForceSync()) {
chunkConsumer.accept(getChunk(worldObj, lc)); chunkConsumer.accept(getChunk(worldObj, lc));
} else { } else {
PaperLib.getChunkAtAsync(worldObj, lc.getX(), lc.getZ(), true).thenAccept(chunkConsumer); PaperLib.getChunkAtAsync(worldObj, lc.getX(), lc.getZ(), true)
.thenAccept(chunkConsumer);
} }
} }

View File

@ -25,14 +25,14 @@
*/ */
package com.plotsquared.bukkit.queue; package com.plotsquared.bukkit.queue;
import com.google.common.base.Preconditions;
import com.plotsquared.bukkit.util.BukkitBlockUtil; import com.plotsquared.bukkit.util.BukkitBlockUtil;
import com.plotsquared.bukkit.util.BukkitUtil; import com.plotsquared.bukkit.util.BukkitUtil;
import com.plotsquared.core.location.ChunkWrapper; import com.plotsquared.core.location.ChunkWrapper;
import com.plotsquared.core.location.Location; import com.plotsquared.core.location.Location;
import com.plotsquared.core.util.MainUtil;
import com.plotsquared.core.queue.ScopedLocalBlockQueue; import com.plotsquared.core.queue.ScopedLocalBlockQueue;
import com.plotsquared.core.util.MainUtil;
import com.plotsquared.core.util.PatternUtil; import com.plotsquared.core.util.PatternUtil;
import com.google.common.base.Preconditions;
import com.sk89q.worldedit.bukkit.BukkitAdapter; import com.sk89q.worldedit.bukkit.BukkitAdapter;
import com.sk89q.worldedit.function.pattern.Pattern; import com.sk89q.worldedit.function.pattern.Pattern;
import com.sk89q.worldedit.world.biome.BiomeType; import com.sk89q.worldedit.world.biome.BiomeType;
@ -119,7 +119,8 @@ public class GenChunk extends ScopedLocalBlockQueue {
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());
chunkData.setRegion(minX, minY, minZ, maxX + 1, maxY + 1, maxZ + 1, BukkitAdapter.adapt(block)); chunkData
.setRegion(minX, minY, minZ, maxX + 1, maxY + 1, maxZ + 1, BukkitAdapter.adapt(block));
} }
@Override public boolean setBiome(int x, int z, BiomeType biomeType) { @Override public boolean setBiome(int x, int z, BiomeType biomeType) {
@ -135,7 +136,8 @@ public class GenChunk extends ScopedLocalBlockQueue {
} }
@Override public boolean setBlock(int x, int y, int z, @NotNull Pattern pattern) { @Override public boolean setBlock(int x, int y, int z, @NotNull Pattern pattern) {
return setBlock(x, y, z, PatternUtil.apply(Preconditions.checkNotNull(pattern, "Pattern may not be null"), x, y, z)); return setBlock(x, y, z, PatternUtil
.apply(Preconditions.checkNotNull(pattern, "Pattern may not be null"), x, y, z));
} }
@Override public boolean setBlock(int x, int y, int z, BlockState id) { @Override public boolean setBlock(int x, int y, int z, BlockState id) {

View File

@ -27,12 +27,19 @@ package com.plotsquared.bukkit.schematic;
import com.plotsquared.bukkit.util.BukkitUtil; import com.plotsquared.bukkit.util.BukkitUtil;
import com.plotsquared.core.location.Location; import com.plotsquared.core.location.Location;
import com.plotsquared.core.util.task.RunnableVal; import com.plotsquared.core.queue.LocalBlockQueue;
import com.plotsquared.core.util.MainUtil; import com.plotsquared.core.util.MainUtil;
import com.plotsquared.core.util.SchematicHandler; import com.plotsquared.core.util.SchematicHandler;
import com.plotsquared.core.util.task.RunnableVal;
import com.plotsquared.core.util.task.TaskManager; import com.plotsquared.core.util.task.TaskManager;
import com.plotsquared.core.queue.LocalBlockQueue; import com.sk89q.jnbt.ByteArrayTag;
import com.sk89q.jnbt.*; import com.sk89q.jnbt.CompoundTag;
import com.sk89q.jnbt.IntArrayTag;
import com.sk89q.jnbt.IntTag;
import com.sk89q.jnbt.ListTag;
import com.sk89q.jnbt.ShortTag;
import com.sk89q.jnbt.StringTag;
import com.sk89q.jnbt.Tag;
import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.extension.platform.Capability; import com.sk89q.worldedit.extension.platform.Capability;
import com.sk89q.worldedit.math.BlockVector2; import com.sk89q.worldedit.math.BlockVector2;
@ -42,7 +49,13 @@ import com.sk89q.worldedit.world.biome.BiomeType;
import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.world.block.BaseBlock;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
import java.util.*; import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.IntStream; import java.util.stream.IntStream;
/** /**
@ -50,7 +63,8 @@ import java.util.stream.IntStream;
*/ */
public class BukkitSchematicHandler extends SchematicHandler { public class BukkitSchematicHandler extends SchematicHandler {
@Override public void getCompoundTag(final String world, final Set<CuboidRegion> regions, @Override
public void getCompoundTag(final String world, final Set<CuboidRegion> regions,
final RunnableVal<CompoundTag> whenDone) { final RunnableVal<CompoundTag> whenDone) {
// async // async
TaskManager.runTaskAsync(new Runnable() { TaskManager.runTaskAsync(new Runnable() {
@ -112,10 +126,12 @@ public class BukkitSchematicHandler extends SchematicHandler {
schematic.put("BiomePaletteMax", new IntTag(biomePalette.size())); schematic.put("BiomePaletteMax", new IntTag(biomePalette.size()));
Map<String, Tag> biomePaletteTag = new HashMap<>(); Map<String, Tag> biomePaletteTag = new HashMap<>();
biomePalette.forEach((key, value) -> biomePaletteTag.put(key, new IntTag(value))); biomePalette.forEach(
(key, value) -> biomePaletteTag.put(key, new IntTag(value)));
schematic.put("BiomePalette", new CompoundTag(biomePaletteTag)); schematic.put("BiomePalette", new CompoundTag(biomePaletteTag));
schematic.put("BiomeData", new ByteArrayTag(biomeBuffer.toByteArray())); schematic
.put("BiomeData", new ByteArrayTag(biomeBuffer.toByteArray()));
whenDone.value = new CompoundTag(schematic); whenDone.value = new CompoundTag(schematic);
TaskManager.runTask(whenDone); TaskManager.runTask(whenDone);
}); });
@ -123,8 +139,10 @@ public class BukkitSchematicHandler extends SchematicHandler {
} }
final Runnable regionTask = this; final Runnable regionTask = this;
CuboidRegion region = queue.poll(); CuboidRegion region = queue.poll();
Location pos1 = new Location(world, region.getMinimumPoint().getX(), region.getMinimumPoint().getY(), region.getMinimumPoint().getZ()); Location pos1 = new Location(world, region.getMinimumPoint().getX(),
Location pos2 = new Location(world, region.getMaximumPoint().getX(), region.getMaximumPoint().getY(), region.getMaximumPoint().getZ()); region.getMinimumPoint().getY(), region.getMinimumPoint().getZ());
Location pos2 = new Location(world, region.getMaximumPoint().getX(),
region.getMaximumPoint().getY(), region.getMaximumPoint().getZ());
final int p1x = pos1.getX(); final int p1x = pos1.getX();
final int sy = pos1.getY(); final int sy = pos1.getY();
final int p1z = pos1.getZ(); final int p1z = pos1.getZ();

View File

@ -30,8 +30,8 @@ import com.plotsquared.bukkit.player.BukkitPlayer;
import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.configuration.Captions;
import com.plotsquared.core.configuration.Settings; import com.plotsquared.core.configuration.Settings;
import com.plotsquared.core.player.ConsolePlayer; import com.plotsquared.core.player.ConsolePlayer;
import com.plotsquared.core.plot.message.PlotMessage;
import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.plot.message.PlotMessage;
import com.plotsquared.core.util.ChatManager; import com.plotsquared.core.util.ChatManager;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;

View File

@ -26,9 +26,9 @@
package com.plotsquared.bukkit.util; package com.plotsquared.bukkit.util;
import com.plotsquared.bukkit.player.BukkitPlayer; import com.plotsquared.bukkit.player.BukkitPlayer;
import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.plot.PlotInventory; import com.plotsquared.core.plot.PlotInventory;
import com.plotsquared.core.plot.PlotItemStack; import com.plotsquared.core.plot.PlotItemStack;
import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.util.InventoryUtil; import com.plotsquared.core.util.InventoryUtil;
import com.sk89q.worldedit.bukkit.BukkitAdapter; import com.sk89q.worldedit.bukkit.BukkitAdapter;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;

View File

@ -26,10 +26,10 @@
package com.plotsquared.bukkit.util; package com.plotsquared.bukkit.util;
import com.plotsquared.bukkit.generator.BukkitPlotGenerator; import com.plotsquared.bukkit.generator.BukkitPlotGenerator;
import com.plotsquared.core.configuration.ConfigurationSection;
import com.plotsquared.core.configuration.file.YamlConfiguration;
import com.plotsquared.core.PlotSquared; import com.plotsquared.core.PlotSquared;
import com.plotsquared.core.configuration.ConfigurationNode; import com.plotsquared.core.configuration.ConfigurationNode;
import com.plotsquared.core.configuration.ConfigurationSection;
import com.plotsquared.core.configuration.file.YamlConfiguration;
import com.plotsquared.core.generator.GeneratorWrapper; import com.plotsquared.core.generator.GeneratorWrapper;
import com.plotsquared.core.plot.PlotArea; import com.plotsquared.core.plot.PlotArea;
import com.plotsquared.core.plot.PlotAreaType; import com.plotsquared.core.plot.PlotAreaType;
@ -88,7 +88,7 @@ public class BukkitSetupUtils extends SetupUtils {
} }
World dw = Bukkit.getWorlds().get(0); World dw = Bukkit.getWorlds().get(0);
for (Player player : world.getPlayers()) { for (Player player : world.getPlayers()) {
PaperLib.teleportAsync(player,dw.getSpawnLocation()); PaperLib.teleportAsync(player, dw.getSpawnLocation());
} }
if (save) { if (save) {
for (Chunk chunk : world.getLoadedChunks()) { for (Chunk chunk : world.getLoadedChunks()) {

View File

@ -337,15 +337,16 @@ public class BukkitUtil extends WorldUtil {
} }
@Override public void getBiome(String world, int x, int z, final Consumer<BiomeType> result) { @Override public void getBiome(String world, int x, int z, final Consumer<BiomeType> result) {
ensureLoaded(world, x, z, chunk -> ensureLoaded(world, x, z,
result.accept(BukkitAdapter.adapt(getWorld(world).getBiome(x, z)))); chunk -> result.accept(BukkitAdapter.adapt(getWorld(world).getBiome(x, z))));
} }
@Override public BiomeType getBiomeSynchronous(String world, int x, int z) { @Override public BiomeType getBiomeSynchronous(String world, int x, int z) {
return BukkitAdapter.adapt(getWorld(world).getBiome(x, z)); return BukkitAdapter.adapt(getWorld(world).getBiome(x, z));
} }
@Override public void getHighestBlock(@NonNull final String world, final int x, final int z, @Override
public void getHighestBlock(@NonNull final String world, final int x, final int z,
final IntConsumer result) { final IntConsumer result) {
ensureLoaded(world, x, z, chunk -> { ensureLoaded(world, x, z, chunk -> {
final World bukkitWorld = getWorld(world); final World bukkitWorld = getWorld(world);
@ -394,7 +395,8 @@ public class BukkitUtil extends WorldUtil {
return bukkitWorld.getMaxHeight() - 1; return bukkitWorld.getMaxHeight() - 1;
} }
@Override public void getSign(@NonNull final Location location, final Consumer<String[]> result) { @Override
public void getSign(@NonNull final Location location, final Consumer<String[]> result) {
ensureLoaded(location, chunk -> { ensureLoaded(location, chunk -> {
final Block block = chunk.getWorld().getBlockAt(getLocation(location)); final Block block = chunk.getWorld().getBlockAt(getLocation(location));
if (block.getState() instanceof Sign) { if (block.getState() instanceof Sign) {
@ -519,7 +521,8 @@ public class BukkitUtil extends WorldUtil {
return new BukkitWorld(Bukkit.getWorld(world)); return new BukkitWorld(Bukkit.getWorld(world));
} }
@Override public void getBlock(@NonNull final Location location, final Consumer<BlockState> result) { @Override
public void getBlock(@NonNull final Location location, final Consumer<BlockState> result) {
ensureLoaded(location, chunk -> { ensureLoaded(location, chunk -> {
final World world = getWorld(location.getWorld()); final World world = getWorld(location.getWorld());
final Block block = world.getBlockAt(location.getX(), location.getY(), location.getZ()); final Block block = world.getBlockAt(location.getX(), location.getY(), location.getZ());
@ -554,7 +557,8 @@ public class BukkitUtil extends WorldUtil {
} }
@Override @Override
public Set<com.sk89q.worldedit.world.entity.EntityType> getTypesInCategory(final String category) { public Set<com.sk89q.worldedit.world.entity.EntityType> getTypesInCategory(
final String category) {
final Collection<Class<?>> allowedInterfaces = new HashSet<>(); final Collection<Class<?>> allowedInterfaces = new HashSet<>();
switch (category) { switch (category) {
case "animal": { case "animal": {
@ -563,13 +567,16 @@ public class BukkitUtil extends WorldUtil {
allowedInterfaces.add(Animals.class); allowedInterfaces.add(Animals.class);
allowedInterfaces.add(WaterMob.class); allowedInterfaces.add(WaterMob.class);
allowedInterfaces.add(Ambient.class); allowedInterfaces.add(Ambient.class);
} break; }
break;
case "tameable": { case "tameable": {
allowedInterfaces.add(Tameable.class); allowedInterfaces.add(Tameable.class);
} break; }
break;
case "vehicle": { case "vehicle": {
allowedInterfaces.add(Vehicle.class); allowedInterfaces.add(Vehicle.class);
} break; }
break;
case "hostile": { case "hostile": {
allowedInterfaces.add(Shulker.class); allowedInterfaces.add(Shulker.class);
allowedInterfaces.add(Monster.class); allowedInterfaces.add(Monster.class);
@ -578,16 +585,20 @@ public class BukkitUtil extends WorldUtil {
allowedInterfaces.add(Ghast.class); allowedInterfaces.add(Ghast.class);
allowedInterfaces.add(Phantom.class); allowedInterfaces.add(Phantom.class);
allowedInterfaces.add(EnderCrystal.class); allowedInterfaces.add(EnderCrystal.class);
} break; }
break;
case "hanging": { case "hanging": {
allowedInterfaces.add(Hanging.class); allowedInterfaces.add(Hanging.class);
} break; }
break;
case "villager": { case "villager": {
allowedInterfaces.add(NPC.class); allowedInterfaces.add(NPC.class);
} break; }
break;
case "projectile": { case "projectile": {
allowedInterfaces.add(Projectile.class); allowedInterfaces.add(Projectile.class);
} break; }
break;
case "other": { case "other": {
allowedInterfaces.add(ArmorStand.class); allowedInterfaces.add(ArmorStand.class);
allowedInterfaces.add(FallingBlock.class); allowedInterfaces.add(FallingBlock.class);
@ -599,16 +610,20 @@ public class BukkitUtil extends WorldUtil {
allowedInterfaces.add(ExperienceOrb.class); allowedInterfaces.add(ExperienceOrb.class);
allowedInterfaces.add(EnderSignal.class); allowedInterfaces.add(EnderSignal.class);
allowedInterfaces.add(Firework.class); allowedInterfaces.add(Firework.class);
} break; }
break;
case "player": { case "player": {
allowedInterfaces.add(Player.class); allowedInterfaces.add(Player.class);
} break; }
break;
default: { default: {
PlotSquared.log(Captions.PREFIX + "Unknown entity category requested: " + category); PlotSquared.log(Captions.PREFIX + "Unknown entity category requested: " + category);
} break; }
break;
} }
final Set<com.sk89q.worldedit.world.entity.EntityType> types = new HashSet<>(); final Set<com.sk89q.worldedit.world.entity.EntityType> types = new HashSet<>();
outer: for (final EntityType bukkitType : EntityType.values()) { outer:
for (final EntityType bukkitType : EntityType.values()) {
final Class<? extends Entity> entityClass = bukkitType.getEntityClass(); final Class<? extends Entity> entityClass = bukkitType.getEntityClass();
if (entityClass == null) { if (entityClass == null) {
continue; continue;
@ -623,22 +638,23 @@ public class BukkitUtil extends WorldUtil {
return types; return types;
} }
private static void ensureLoaded(final String world, final int x, final int z, final Consumer<Chunk> chunkConsumer) { private static void ensureLoaded(final String world, final int x, final int z,
PaperLib.getChunkAtAsync(getWorld(world), x >> 4, z >> 4, true).thenAccept(chunk -> final Consumer<Chunk> chunkConsumer) {
ensureMainThread(chunkConsumer, chunk)); PaperLib.getChunkAtAsync(getWorld(world), x >> 4, z >> 4, true)
.thenAccept(chunk -> ensureMainThread(chunkConsumer, chunk));
} }
private static void ensureLoaded(final Location location, final Consumer<Chunk> chunkConsumer) { private static void ensureLoaded(final Location location, final Consumer<Chunk> chunkConsumer) {
PaperLib.getChunkAtAsync(getLocation(location), true).thenAccept(chunk -> PaperLib.getChunkAtAsync(getLocation(location), true)
ensureMainThread(chunkConsumer, chunk)); .thenAccept(chunk -> ensureMainThread(chunkConsumer, chunk));
} }
private static <T> void ensureMainThread(final Consumer<T> consumer, final T value) { private static <T> void ensureMainThread(final Consumer<T> consumer, final T value) {
if (Bukkit.isPrimaryThread()) { if (Bukkit.isPrimaryThread()) {
consumer.accept(value); consumer.accept(value);
} else { } else {
Bukkit.getScheduler().runTask(BukkitMain.getPlugin(BukkitMain.class), () -> Bukkit.getScheduler()
consumer.accept(value)); .runTask(BukkitMain.getPlugin(BukkitMain.class), () -> consumer.accept(value));
} }
} }

View File

@ -99,7 +99,8 @@ public class OfflinePlayerUtil {
Class<?> minecraftServerClass = getNmsClass("MinecraftServer"); Class<?> minecraftServerClass = getNmsClass("MinecraftServer");
Class<?> dimensionManager = getNmsClass("DimensionManager"); Class<?> dimensionManager = getNmsClass("DimensionManager");
Object overworld = getField(makeField(dimensionManager, "OVERWORLD"), null); Object overworld = getField(makeField(dimensionManager, "OVERWORLD"), null);
Method getWorldServer = makeMethod(minecraftServerClass, "getWorldServer", dimensionManager); Method getWorldServer =
makeMethod(minecraftServerClass, "getWorldServer", dimensionManager);
return callMethod(getWorldServer, server, overworld); return callMethod(getWorldServer, server, overworld);
} }

View File

@ -28,8 +28,8 @@ package com.plotsquared.bukkit.util;
import com.plotsquared.bukkit.player.BukkitPlayer; import com.plotsquared.bukkit.player.BukkitPlayer;
import com.plotsquared.core.PlotSquared; import com.plotsquared.core.PlotSquared;
import com.plotsquared.core.location.Location; import com.plotsquared.core.location.Location;
import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.util.ReflectionUtils.RefClass; import com.plotsquared.core.util.ReflectionUtils.RefClass;
import com.plotsquared.core.util.ReflectionUtils.RefConstructor; import com.plotsquared.core.util.ReflectionUtils.RefConstructor;
import com.plotsquared.core.util.ReflectionUtils.RefField; import com.plotsquared.core.util.ReflectionUtils.RefField;

View File

@ -75,8 +75,9 @@ public class UpdateUtility implements Listener {
if (internalVersion.isLaterVersion(spigotVersion)) { if (internalVersion.isLaterVersion(spigotVersion)) {
PlotSquared PlotSquared
.log(Captions.PREFIX + "&6There appears to be a PlotSquared update available!"); .log(Captions.PREFIX + "&6There appears to be a PlotSquared update available!");
PlotSquared.log(Captions.PREFIX + "&6You are running version " + internalVersion.versionString() PlotSquared.log(
+ ", &6latest version is " + spigotVersion); Captions.PREFIX + "&6You are running version " + internalVersion.versionString()
+ ", &6latest version is " + spigotVersion);
PlotSquared PlotSquared
.log(Captions.PREFIX + "&6https://www.spigotmc.org/resources/77506/updates"); .log(Captions.PREFIX + "&6https://www.spigotmc.org/resources/77506/updates");
hasUpdate = true; hasUpdate = true;

View File

@ -25,9 +25,9 @@
*/ */
package com.plotsquared.bukkit.util.uuid; package com.plotsquared.bukkit.util.uuid;
import com.google.common.base.Charsets;
import com.plotsquared.core.player.OfflinePlotPlayer; import com.plotsquared.core.player.OfflinePlotPlayer;
import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.player.PlotPlayer;
import com.google.common.base.Charsets;
import org.bukkit.OfflinePlayer; import org.bukkit.OfflinePlayer;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
@ -37,7 +37,8 @@ import java.util.UUID;
public class LowerOfflineUUIDWrapper extends OfflineUUIDWrapper { public class LowerOfflineUUIDWrapper extends OfflineUUIDWrapper {
@NotNull @Override public UUID getUUID(PlotPlayer player) { @NotNull @Override public UUID getUUID(PlotPlayer player) {
return UUID.nameUUIDFromBytes(("OfflinePlayer:" + player.getName().toLowerCase()).getBytes(Charsets.UTF_8)); return UUID.nameUUIDFromBytes(
("OfflinePlayer:" + player.getName().toLowerCase()).getBytes(Charsets.UTF_8));
} }
@Override public UUID getUUID(OfflinePlotPlayer player) { @Override public UUID getUUID(OfflinePlotPlayer player) {
@ -47,7 +48,8 @@ public class LowerOfflineUUIDWrapper extends OfflineUUIDWrapper {
@Override public UUID getUUID(OfflinePlayer player) { @Override public UUID getUUID(OfflinePlayer player) {
return UUID.nameUUIDFromBytes( return UUID.nameUUIDFromBytes(
("OfflinePlayer:" + Objects.requireNonNull(player.getName()).toLowerCase()).getBytes(Charsets.UTF_8)); ("OfflinePlayer:" + Objects.requireNonNull(player.getName()).toLowerCase())
.getBytes(Charsets.UTF_8));
} }
@Override public UUID getUUID(String name) { @Override public UUID getUUID(String name) {

View File

@ -25,6 +25,8 @@
*/ */
package com.plotsquared.bukkit.util.uuid; package com.plotsquared.bukkit.util.uuid;
import com.google.common.base.Charsets;
import com.google.common.collect.BiMap;
import com.plotsquared.bukkit.player.BukkitOfflinePlayer; import com.plotsquared.bukkit.player.BukkitOfflinePlayer;
import com.plotsquared.core.PlotSquared; import com.plotsquared.core.PlotSquared;
import com.plotsquared.core.player.OfflinePlotPlayer; import com.plotsquared.core.player.OfflinePlotPlayer;
@ -32,8 +34,6 @@ import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.util.StringWrapper; import com.plotsquared.core.util.StringWrapper;
import com.plotsquared.core.util.uuid.UUIDHandler; import com.plotsquared.core.util.uuid.UUIDHandler;
import com.plotsquared.core.util.uuid.UUIDWrapper; import com.plotsquared.core.util.uuid.UUIDWrapper;
import com.google.common.base.Charsets;
import com.google.common.collect.BiMap;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.OfflinePlayer; import org.bukkit.OfflinePlayer;
import org.bukkit.Server; import org.bukkit.Server;
@ -60,7 +60,8 @@ public class OfflineUUIDWrapper extends UUIDWrapper {
} }
@NotNull @Override public UUID getUUID(PlotPlayer player) { @NotNull @Override public UUID getUUID(PlotPlayer player) {
return UUID.nameUUIDFromBytes(("OfflinePlayer:" + player.getName()).getBytes(Charsets.UTF_8)); return UUID
.nameUUIDFromBytes(("OfflinePlayer:" + player.getName()).getBytes(Charsets.UTF_8));
} }
@Override public UUID getUUID(OfflinePlotPlayer player) { @Override public UUID getUUID(OfflinePlotPlayer player) {

View File

@ -25,18 +25,18 @@
*/ */
package com.plotsquared.bukkit.util.uuid; package com.plotsquared.bukkit.util.uuid;
import com.google.common.collect.HashBiMap;
import com.plotsquared.core.PlotSquared; import com.plotsquared.core.PlotSquared;
import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.configuration.Captions;
import com.plotsquared.core.configuration.Settings; import com.plotsquared.core.configuration.Settings;
import com.plotsquared.core.database.SQLite; import com.plotsquared.core.database.SQLite;
import com.plotsquared.core.util.task.RunnableVal;
import com.plotsquared.core.util.StringWrapper;
import com.plotsquared.core.util.MainUtil; import com.plotsquared.core.util.MainUtil;
import com.plotsquared.core.util.StringWrapper;
import com.plotsquared.core.util.task.RunnableVal;
import com.plotsquared.core.util.task.TaskManager; import com.plotsquared.core.util.task.TaskManager;
import com.plotsquared.core.util.uuid.UUIDHandler; import com.plotsquared.core.util.uuid.UUIDHandler;
import com.plotsquared.core.util.uuid.UUIDHandlerImplementation; import com.plotsquared.core.util.uuid.UUIDHandlerImplementation;
import com.plotsquared.core.util.uuid.UUIDWrapper; import com.plotsquared.core.util.uuid.UUIDWrapper;
import com.google.common.collect.HashBiMap;
import org.json.simple.JSONArray; import org.json.simple.JSONArray;
import org.json.simple.JSONObject; import org.json.simple.JSONObject;
import org.json.simple.parser.JSONParser; import org.json.simple.parser.JSONParser;

View File

@ -233,7 +233,7 @@ public interface IPlotMain extends ILogger {
* Gets the generator wrapper for a world (world) and generator (name). * Gets the generator wrapper for a world (world) and generator (name).
* *
* @param world the world to get the generator from * @param world the world to get the generator from
* @param name the name of the generator * @param name the name of the generator
* @return the generator being used for the provided world * @return the generator being used for the provided world
*/ */
GeneratorWrapper<?> getGenerator(String world, String name); GeneratorWrapper<?> getGenerator(String world, String name);

View File

@ -25,14 +25,14 @@
*/ */
package com.plotsquared.core.api; package com.plotsquared.core.api;
import com.plotsquared.core.configuration.file.YamlConfiguration;
import com.plotsquared.core.PlotSquared; import com.plotsquared.core.PlotSquared;
import com.plotsquared.core.configuration.Caption; import com.plotsquared.core.configuration.Caption;
import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.configuration.Captions;
import com.plotsquared.core.configuration.file.YamlConfiguration;
import com.plotsquared.core.location.Location; import com.plotsquared.core.location.Location;
import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.plot.Plot; import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.plot.PlotArea; import com.plotsquared.core.plot.PlotArea;
import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.queue.GlobalBlockQueue; import com.plotsquared.core.queue.GlobalBlockQueue;
import com.plotsquared.core.util.ChunkManager; import com.plotsquared.core.util.ChunkManager;
import com.plotsquared.core.util.EventDispatcher; import com.plotsquared.core.util.EventDispatcher;
@ -60,7 +60,9 @@ import java.util.UUID;
* *
* @version 5 * @version 5
*/ */
@SuppressWarnings({"unused", "WeakerAccess"}) @NoArgsConstructor public class PlotAPI { @SuppressWarnings({"unused", "WeakerAccess"})
@NoArgsConstructor
public class PlotAPI {
/** /**
* Gets all plots. * Gets all plots.

View File

@ -28,12 +28,12 @@ package com.plotsquared.core.command;
import com.plotsquared.core.PlotSquared; import com.plotsquared.core.PlotSquared;
import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.configuration.Captions;
import com.plotsquared.core.database.DBFunc; import com.plotsquared.core.database.DBFunc;
import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.util.task.RunnableVal2; import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.util.task.RunnableVal3;
import com.plotsquared.core.util.MainUtil; import com.plotsquared.core.util.MainUtil;
import com.plotsquared.core.util.Permissions; import com.plotsquared.core.util.Permissions;
import com.plotsquared.core.util.task.RunnableVal2;
import com.plotsquared.core.util.task.RunnableVal3;
import java.util.Iterator; import java.util.Iterator;
import java.util.Set; import java.util.Set;
@ -52,7 +52,8 @@ public class Add extends Command {
super(MainCommand.getInstance(), true); super(MainCommand.getInstance(), true);
} }
@Override public CompletableFuture<Boolean> execute(final PlotPlayer player, String[] args, @Override
public CompletableFuture<Boolean> execute(final PlotPlayer player, String[] args,
RunnableVal3<Command, Runnable, Runnable> confirm, RunnableVal3<Command, Runnable, Runnable> confirm,
RunnableVal2<Command, CommandResult> whenDone) throws CommandException { RunnableVal2<Command, CommandResult> whenDone) throws CommandException {
final Plot plot = check(player.getCurrentPlot(), Captions.NOT_IN_PLOT); final Plot plot = check(player.getCurrentPlot(), Captions.NOT_IN_PLOT);

View File

@ -28,12 +28,12 @@ package com.plotsquared.core.command;
import com.plotsquared.core.PlotSquared; import com.plotsquared.core.PlotSquared;
import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.configuration.Captions;
import com.plotsquared.core.location.Location; import com.plotsquared.core.location.Location;
import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.util.StringWrapper; import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.util.MainUtil; import com.plotsquared.core.util.MainUtil;
import com.plotsquared.core.util.MathMan; import com.plotsquared.core.util.MathMan;
import com.plotsquared.core.util.Permissions; import com.plotsquared.core.util.Permissions;
import com.plotsquared.core.util.StringWrapper;
import com.plotsquared.core.util.uuid.UUIDHandler; import com.plotsquared.core.util.uuid.UUIDHandler;
@CommandDeclaration(command = "setalias", @CommandDeclaration(command = "setalias",

View File

@ -25,31 +25,31 @@
*/ */
package com.plotsquared.core.command; package com.plotsquared.core.command;
import com.plotsquared.core.configuration.ConfigurationSection;
import com.plotsquared.core.PlotSquared; import com.plotsquared.core.PlotSquared;
import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.configuration.Captions;
import com.plotsquared.core.configuration.ConfigurationSection;
import com.plotsquared.core.configuration.ConfigurationUtil; import com.plotsquared.core.configuration.ConfigurationUtil;
import com.plotsquared.core.events.TeleportCause;
import com.plotsquared.core.generator.AugmentedUtils; import com.plotsquared.core.generator.AugmentedUtils;
import com.plotsquared.core.generator.HybridPlotWorld; import com.plotsquared.core.generator.HybridPlotWorld;
import com.plotsquared.core.location.Location; import com.plotsquared.core.location.Location;
import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.plot.PlotArea; import com.plotsquared.core.plot.PlotArea;
import com.plotsquared.core.plot.PlotAreaTerrainType; import com.plotsquared.core.plot.PlotAreaTerrainType;
import com.plotsquared.core.plot.PlotAreaType; import com.plotsquared.core.plot.PlotAreaType;
import com.plotsquared.core.plot.PlotId; import com.plotsquared.core.plot.PlotId;
import com.plotsquared.core.plot.message.PlotMessage;
import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.util.task.RunnableVal;
import com.plotsquared.core.util.task.RunnableVal3;
import com.plotsquared.core.plot.SetupObject; import com.plotsquared.core.plot.SetupObject;
import com.plotsquared.core.events.TeleportCause; import com.plotsquared.core.plot.message.PlotMessage;
import com.plotsquared.core.util.ChunkManager; import com.plotsquared.core.util.ChunkManager;
import com.plotsquared.core.util.MainUtil; import com.plotsquared.core.util.MainUtil;
import com.plotsquared.core.util.MathMan; import com.plotsquared.core.util.MathMan;
import com.plotsquared.core.util.Permissions; import com.plotsquared.core.util.Permissions;
import com.plotsquared.core.util.RegionUtil;
import com.plotsquared.core.util.SetupUtils; import com.plotsquared.core.util.SetupUtils;
import com.plotsquared.core.util.StringMan; import com.plotsquared.core.util.StringMan;
import com.plotsquared.core.util.WorldUtil; import com.plotsquared.core.util.WorldUtil;
import com.plotsquared.core.util.RegionUtil; import com.plotsquared.core.util.task.RunnableVal;
import com.plotsquared.core.util.task.RunnableVal3;
import com.sk89q.worldedit.math.BlockVector2; import com.sk89q.worldedit.math.BlockVector2;
import com.sk89q.worldedit.regions.CuboidRegion; import com.sk89q.worldedit.regions.CuboidRegion;
@ -170,15 +170,16 @@ public class Area extends SubCommand {
ChunkManager.largeRegionTask(world, region, ChunkManager.largeRegionTask(world, region,
new RunnableVal<BlockVector2>() { new RunnableVal<BlockVector2>() {
@Override public void run(BlockVector2 value) { @Override public void run(BlockVector2 value) {
AugmentedUtils.generate(null, world, value.getX(), AugmentedUtils
value.getZ(), null); .generate(null, world, value.getX(),
value.getZ(), null);
} }
}, null); }, null);
} }
} else { } else {
MainUtil.sendMessage(player, MainUtil.sendMessage(player,
"An error occurred while creating the world: " "An error occurred while creating the world: " + area
+ area.getWorldName()); .getWorldName());
} }
}; };
if (hasConfirmation(player)) { if (hasConfirmation(player)) {
@ -239,11 +240,13 @@ public class Area extends SubCommand {
break; break;
case "f": case "f":
case "floor": case "floor":
pa.TOP_BLOCK = ConfigurationUtil.BLOCK_BUCKET.parseString(pair[1]); pa.TOP_BLOCK =
ConfigurationUtil.BLOCK_BUCKET.parseString(pair[1]);
break; break;
case "m": case "m":
case "main": case "main":
pa.MAIN_BLOCK = ConfigurationUtil.BLOCK_BUCKET.parseString(pair[1]); pa.MAIN_BLOCK =
ConfigurationUtil.BLOCK_BUCKET.parseString(pair[1]);
break; break;
case "w": case "w":
case "wall": case "wall":
@ -252,14 +255,19 @@ public class Area extends SubCommand {
break; break;
case "b": case "b":
case "border": case "border":
pa.WALL_BLOCK = ConfigurationUtil.BLOCK_BUCKET.parseString(pair[1]); pa.WALL_BLOCK =
ConfigurationUtil.BLOCK_BUCKET.parseString(pair[1]);
break; break;
case "terrain": case "terrain":
pa.setTerrain(PlotAreaTerrainType.fromString(pair[1]).orElseThrow(() -> new IllegalArgumentException(pair[1] + " is not a valid terrain."))); pa.setTerrain(PlotAreaTerrainType.fromString(pair[1])
.orElseThrow(() -> new IllegalArgumentException(
pair[1] + " is not a valid terrain.")));
object.terrain = pa.getTerrain(); object.terrain = pa.getTerrain();
break; break;
case "type": case "type":
pa.setType(PlotAreaType.fromString(pair[1]).orElseThrow(() -> new IllegalArgumentException(pair[1] + " is not a valid type."))); pa.setType(PlotAreaType.fromString(pair[1]).orElseThrow(
() -> new IllegalArgumentException(
pair[1] + " is not a valid type.")));
object.type = pa.getType(); object.type = pa.getType();
break; break;
default: default:
@ -291,8 +299,8 @@ public class Area extends SubCommand {
TeleportCause.COMMAND); TeleportCause.COMMAND);
} else { } else {
MainUtil.sendMessage(player, MainUtil.sendMessage(player,
"An error occurred while creating the world: " "An error occurred while creating the world: " + pa
+ pa.getWorldName()); .getWorldName());
} }
try { try {
PlotSquared.get().worlds.save(PlotSquared.get().worldsFile); PlotSquared.get().worlds.save(PlotSquared.get().worldsFile);
@ -376,10 +384,11 @@ public class Area extends SubCommand {
percent = claimed == 0 ? 0 : 100d * claimed / Integer.MAX_VALUE; percent = claimed == 0 ? 0 : 100d * claimed / Integer.MAX_VALUE;
region = "N/A"; region = "N/A";
} }
String value = "&r$1NAME: " + name + "\n$1Type: $2" + area.getType() + "\n$1Terrain: $2" String value =
+ area.getTerrain() + "\n$1Usage: $2" + String.format("%.2f", percent) + '%' "&r$1NAME: " + name + "\n$1Type: $2" + area.getType() + "\n$1Terrain: $2" + area
+ "\n$1Claimed: $2" + claimed + "\n$1Clusters: $2" + clusters + "\n$1Region: $2" .getTerrain() + "\n$1Usage: $2" + String.format("%.2f", percent) + '%'
+ region + "\n$1Generator: $2" + generator; + "\n$1Claimed: $2" + claimed + "\n$1Clusters: $2" + clusters
+ "\n$1Region: $2" + region + "\n$1Generator: $2" + generator;
MainUtil.sendMessage(player, MainUtil.sendMessage(player,
Captions.PLOT_INFO_HEADER.getTranslated() + '\n' + value + '\n' Captions.PLOT_INFO_HEADER.getTranslated() + '\n' + value + '\n'
+ Captions.PLOT_INFO_FOOTER.getTranslated(), false); + Captions.PLOT_INFO_FOOTER.getTranslated(), false);
@ -418,7 +427,8 @@ public class Area extends SubCommand {
if (area.getType() == PlotAreaType.PARTIAL) { if (area.getType() == PlotAreaType.PARTIAL) {
PlotId min = area.getMin(); PlotId min = area.getMin();
PlotId max = area.getMax(); PlotId max = area.getMax();
name = area.getWorldName() + ';' + area.getId() + ';' + min + ';' + max; name = area.getWorldName() + ';' + area.getId() + ';' + min + ';'
+ max;
int size = (max.x - min.x + 1) * (max.y - min.y + 1); int size = (max.x - min.x + 1) * (max.y - min.y + 1);
percent = claimed == 0 ? 0 : size / (double) claimed; percent = claimed == 0 ? 0 : size / (double) claimed;
region = area.getRegion().toString(); region = area.getRegion().toString();
@ -468,7 +478,8 @@ public class Area extends SubCommand {
new RunnableVal<BlockVector2>() { new RunnableVal<BlockVector2>() {
@Override public void run(BlockVector2 value) { @Override public void run(BlockVector2 value) {
AugmentedUtils AugmentedUtils
.generate(null, area.getWorldName(), value.getX(), value.getZ(), null); .generate(null, area.getWorldName(), value.getX(), value.getZ(),
null);
} }
}, () -> player.sendMessage("Regen complete")); }, () -> player.sendMessage("Regen complete"));
return true; return true;
@ -501,10 +512,11 @@ public class Area extends SubCommand {
+ (region.getMaximumPoint().getX() - region.getMinimumPoint().getX()) / 2, + (region.getMaximumPoint().getX() - region.getMinimumPoint().getX()) / 2,
0, region.getMinimumPoint().getZ() 0, region.getMinimumPoint().getZ()
+ (region.getMaximumPoint().getZ() - region.getMinimumPoint().getZ()) / 2); + (region.getMaximumPoint().getZ() - region.getMinimumPoint().getZ()) / 2);
WorldUtil.IMP.getHighestBlock(area.getWorldName(), center.getX(), center.getZ(), y -> { WorldUtil.IMP
center.setY(1 + y); .getHighestBlock(area.getWorldName(), center.getX(), center.getZ(), y -> {
player.teleport(center, TeleportCause.COMMAND); center.setY(1 + y);
}); player.teleport(center, TeleportCause.COMMAND);
});
} }
return true; return true;
case "delete": case "delete":

View File

@ -25,6 +25,7 @@
*/ */
package com.plotsquared.core.command; package com.plotsquared.core.command;
import com.google.common.primitives.Ints;
import com.plotsquared.core.PlotSquared; import com.plotsquared.core.PlotSquared;
import com.plotsquared.core.configuration.CaptionUtility; import com.plotsquared.core.configuration.CaptionUtility;
import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.configuration.Captions;
@ -33,20 +34,19 @@ import com.plotsquared.core.database.DBFunc;
import com.plotsquared.core.events.PlayerAutoPlotEvent; import com.plotsquared.core.events.PlayerAutoPlotEvent;
import com.plotsquared.core.events.PlotAutoMergeEvent; import com.plotsquared.core.events.PlotAutoMergeEvent;
import com.plotsquared.core.events.Result; import com.plotsquared.core.events.Result;
import com.plotsquared.core.util.Expression; import com.plotsquared.core.events.TeleportCause;
import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.plot.Plot; import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.plot.PlotArea; import com.plotsquared.core.plot.PlotArea;
import com.plotsquared.core.plot.PlotAreaType; import com.plotsquared.core.plot.PlotAreaType;
import com.plotsquared.core.plot.PlotId; import com.plotsquared.core.plot.PlotId;
import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.util.task.RunnableVal;
import com.plotsquared.core.events.TeleportCause;
import com.plotsquared.core.util.task.AutoClaimFinishTask;
import com.plotsquared.core.util.EconHandler; import com.plotsquared.core.util.EconHandler;
import com.plotsquared.core.util.Expression;
import com.plotsquared.core.util.MainUtil; import com.plotsquared.core.util.MainUtil;
import com.plotsquared.core.util.Permissions; import com.plotsquared.core.util.Permissions;
import com.plotsquared.core.util.task.AutoClaimFinishTask;
import com.plotsquared.core.util.task.RunnableVal;
import com.plotsquared.core.util.task.TaskManager; import com.plotsquared.core.util.task.TaskManager;
import com.google.common.primitives.Ints;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import java.util.ArrayList; import java.util.ArrayList;
@ -117,7 +117,8 @@ public class Auto extends SubCommand {
final String schematic) { final String schematic) {
Set<Plot> plots = player.getPlots(); Set<Plot> plots = player.getPlots();
if (!plots.isEmpty()) { if (!plots.isEmpty()) {
plots.iterator().next().teleportPlayer(player, TeleportCause.COMMAND, result -> {}); plots.iterator().next().teleportPlayer(player, TeleportCause.COMMAND, result -> {
});
} else { } else {
autoClaimSafe(player, area, start, schematic); autoClaimSafe(player, area, start, schematic);
} }
@ -149,7 +150,8 @@ public class Auto extends SubCommand {
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) {
TaskManager.IMP.sync(new AutoClaimFinishTask(player, plot, area, allowedPlots, schematic)); TaskManager.IMP
.sync(new AutoClaimFinishTask(player, plot, area, allowedPlots, schematic));
} }
}); });
} }
@ -243,8 +245,8 @@ public class Auto extends SubCommand {
return false; return false;
} }
final int allowed_plots = player.getAllowedPlots(); final int allowed_plots = player.getAllowedPlots();
if (!force && (player.getMeta(Auto.class.getName(), false) || !checkAllowedPlots(player, plotarea, if (!force && (player.getMeta(Auto.class.getName(), false) || !checkAllowedPlots(player,
allowed_plots, size_x, size_z))) { plotarea, allowed_plots, size_x, size_z))) {
return false; return false;
} }

View File

@ -26,8 +26,8 @@
package com.plotsquared.core.command; package com.plotsquared.core.command;
import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.configuration.Captions;
import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.util.MainUtil; import com.plotsquared.core.util.MainUtil;
import com.plotsquared.core.util.StringMan; import com.plotsquared.core.util.StringMan;
import com.sk89q.worldedit.world.biome.BiomeType; import com.sk89q.worldedit.world.biome.BiomeType;

View File

@ -29,14 +29,14 @@ import com.plotsquared.core.PlotSquared;
import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.configuration.Captions;
import com.plotsquared.core.events.PlotFlagRemoveEvent; import com.plotsquared.core.events.PlotFlagRemoveEvent;
import com.plotsquared.core.events.Result; import com.plotsquared.core.events.Result;
import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.plot.flag.PlotFlag; import com.plotsquared.core.plot.flag.PlotFlag;
import com.plotsquared.core.plot.flag.implementations.PriceFlag; import com.plotsquared.core.plot.flag.implementations.PriceFlag;
import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.util.task.RunnableVal2;
import com.plotsquared.core.util.task.RunnableVal3;
import com.plotsquared.core.util.EconHandler; import com.plotsquared.core.util.EconHandler;
import com.plotsquared.core.util.MainUtil; import com.plotsquared.core.util.MainUtil;
import com.plotsquared.core.util.task.RunnableVal2;
import com.plotsquared.core.util.task.RunnableVal3;
import com.plotsquared.core.util.uuid.UUIDHandler; import com.plotsquared.core.util.uuid.UUIDHandler;
import java.util.Set; import java.util.Set;
@ -54,7 +54,8 @@ public class Buy extends Command {
super(MainCommand.getInstance(), true); super(MainCommand.getInstance(), true);
} }
@Override public CompletableFuture<Boolean> execute(final PlotPlayer player, String[] args, @Override
public CompletableFuture<Boolean> execute(final PlotPlayer player, String[] args,
RunnableVal3<Command, Runnable, Runnable> confirm, RunnableVal3<Command, Runnable, Runnable> confirm,
final RunnableVal2<Command, CommandResult> whenDone) { final RunnableVal2<Command, CommandResult> whenDone) {
@ -82,15 +83,16 @@ public class Buy extends Command {
confirm.run(this, () -> { confirm.run(this, () -> {
Captions.REMOVED_BALANCE.send(player, price); Captions.REMOVED_BALANCE.send(player, price);
EconHandler.manager EconHandler.manager
.depositMoney(UUIDHandler.getUUIDWrapper().getOfflinePlayer(plot.getOwnerAbs()), price); .depositMoney(UUIDHandler.getUUIDWrapper().getOfflinePlayer(plot.getOwnerAbs()),
price);
PlotPlayer owner = UUIDHandler.getPlayer(plot.getOwnerAbs()); PlotPlayer owner = UUIDHandler.getPlayer(plot.getOwnerAbs());
if (owner != null) { if (owner != null) {
Captions.PLOT_SOLD.send(owner, plot.getId(), player.getName(), price); Captions.PLOT_SOLD.send(owner, plot.getId(), player.getName(), price);
} }
PlotFlag<?, ?> plotFlag = plot.getFlagContainer().getFlag(PriceFlag.class); PlotFlag<?, ?> plotFlag = plot.getFlagContainer().getFlag(PriceFlag.class);
PlotFlagRemoveEvent PlotFlagRemoveEvent event =
event = PlotSquared.get().getEventDispatcher().callFlagRemove(plotFlag, plot); PlotSquared.get().getEventDispatcher().callFlagRemove(plotFlag, plot);
if(event.getEventResult() != Result.DENY) { if (event.getEventResult() != Result.DENY) {
plot.removeFlag(event.getFlag()); plot.removeFlag(event.getFlag());
} }
plot.setOwner(player.getUUID()); plot.setOwner(player.getUUID());

View File

@ -25,8 +25,8 @@
*/ */
package com.plotsquared.core.command; package com.plotsquared.core.command;
import com.google.common.primitives.Ints;
import com.plotsquared.core.PlotSquared; import com.plotsquared.core.PlotSquared;
import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.configuration.CaptionUtility; import com.plotsquared.core.configuration.CaptionUtility;
import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.configuration.Captions;
import com.plotsquared.core.configuration.Settings; import com.plotsquared.core.configuration.Settings;
@ -34,16 +34,16 @@ import com.plotsquared.core.database.DBFunc;
import com.plotsquared.core.events.PlayerClaimPlotEvent; import com.plotsquared.core.events.PlayerClaimPlotEvent;
import com.plotsquared.core.events.PlotMergeEvent; import com.plotsquared.core.events.PlotMergeEvent;
import com.plotsquared.core.events.Result; import com.plotsquared.core.events.Result;
import com.plotsquared.core.util.EconHandler;
import com.plotsquared.core.util.Permissions;
import com.plotsquared.core.util.task.TaskManager;
import com.plotsquared.core.util.task.RunnableVal;
import com.google.common.primitives.Ints;
import com.plotsquared.core.location.Direction; import com.plotsquared.core.location.Direction;
import com.plotsquared.core.util.Expression;
import com.plotsquared.core.location.Location; import com.plotsquared.core.location.Location;
import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.plot.Plot; import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.plot.PlotArea; import com.plotsquared.core.plot.PlotArea;
import com.plotsquared.core.util.EconHandler;
import com.plotsquared.core.util.Expression;
import com.plotsquared.core.util.Permissions;
import com.plotsquared.core.util.task.RunnableVal;
import com.plotsquared.core.util.task.TaskManager;
@CommandDeclaration(command = "claim", @CommandDeclaration(command = "claim",
aliases = "c", aliases = "c",
@ -64,8 +64,8 @@ public class Claim extends SubCommand {
if (plot == null) { if (plot == null) {
return sendMessage(player, Captions.NOT_IN_PLOT); return sendMessage(player, Captions.NOT_IN_PLOT);
} }
PlayerClaimPlotEvent PlayerClaimPlotEvent event =
event = PlotSquared.get().getEventDispatcher().callClaim(player, plot, schematic); PlotSquared.get().getEventDispatcher().callClaim(player, plot, schematic);
schematic = event.getSchematic(); schematic = event.getSchematic();
if (event.getEventResult() == Result.DENY) { if (event.getEventResult() == Result.DENY) {
sendMessage(player, Captions.EVENT_DENIED, "Claim"); sendMessage(player, Captions.EVENT_DENIED, "Claim");
@ -133,8 +133,8 @@ public class Claim extends SubCommand {
DBFunc.createPlotSafe(plot, () -> TaskManager.IMP.sync(new RunnableVal<Object>() { DBFunc.createPlotSafe(plot, () -> TaskManager.IMP.sync(new RunnableVal<Object>() {
@Override public void run(Object value) { @Override public void run(Object value) {
if (!plot.claim(player, true, finalSchematic, false)) { if (!plot.claim(player, true, finalSchematic, false)) {
PlotSquared.get().getLogger().log(Captions.PREFIX.getTranslated() + PlotSquared.get().getLogger().log(Captions.PREFIX.getTranslated() + String
String.format("Failed to claim plot %s", plot.getId().toCommaSeparatedString())); .format("Failed to claim plot %s", plot.getId().toCommaSeparatedString()));
sendMessage(player, Captions.PLOT_NOT_CLAIMED); sendMessage(player, Captions.PLOT_NOT_CLAIMED);
plot.setOwnerAbs(null); plot.setOwnerAbs(null);
} else if (area.isAutoMerge()) { } else if (area.isAutoMerge()) {
@ -148,8 +148,9 @@ public class Claim extends SubCommand {
} }
} }
}), () -> { }), () -> {
PlotSquared.get().getLogger().log(Captions.PREFIX.getTranslated() + PlotSquared.get().getLogger().log(Captions.PREFIX.getTranslated() + String
String.format("Failed to add plot %s to the database", plot.getId().toCommaSeparatedString())); .format("Failed to add plot %s to the database",
plot.getId().toCommaSeparatedString()));
sendMessage(player, Captions.PLOT_NOT_CLAIMED); sendMessage(player, Captions.PLOT_NOT_CLAIMED);
plot.setOwnerAbs(null); plot.setOwnerAbs(null);
}); });

View File

@ -30,16 +30,16 @@ import com.plotsquared.core.configuration.Captions;
import com.plotsquared.core.configuration.Settings; import com.plotsquared.core.configuration.Settings;
import com.plotsquared.core.events.PlotFlagRemoveEvent; import com.plotsquared.core.events.PlotFlagRemoveEvent;
import com.plotsquared.core.events.Result; import com.plotsquared.core.events.Result;
import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.plot.flag.PlotFlag; import com.plotsquared.core.plot.flag.PlotFlag;
import com.plotsquared.core.plot.flag.implementations.AnalysisFlag; import com.plotsquared.core.plot.flag.implementations.AnalysisFlag;
import com.plotsquared.core.plot.flag.implementations.DoneFlag; import com.plotsquared.core.plot.flag.implementations.DoneFlag;
import com.plotsquared.core.plot.Plot; import com.plotsquared.core.queue.GlobalBlockQueue;
import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.util.task.RunnableVal2;
import com.plotsquared.core.util.task.RunnableVal3;
import com.plotsquared.core.util.MainUtil; import com.plotsquared.core.util.MainUtil;
import com.plotsquared.core.util.Permissions; import com.plotsquared.core.util.Permissions;
import com.plotsquared.core.queue.GlobalBlockQueue; import com.plotsquared.core.util.task.RunnableVal2;
import com.plotsquared.core.util.task.RunnableVal3;
import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletableFuture;
@ -62,7 +62,8 @@ public class Clear extends Command {
super(MainCommand.getInstance(), true); super(MainCommand.getInstance(), true);
} }
@Override public CompletableFuture<Boolean> execute(final PlotPlayer player, String[] args, @Override
public CompletableFuture<Boolean> execute(final PlotPlayer player, String[] args,
RunnableVal3<Command, Runnable, Runnable> confirm, RunnableVal3<Command, Runnable, Runnable> confirm,
RunnableVal2<Command, CommandResult> whenDone) throws CommandException { RunnableVal2<Command, CommandResult> whenDone) throws CommandException {
checkTrue(args.length == 0, Captions.COMMAND_SYNTAX, getUsage()); checkTrue(args.length == 0, Captions.COMMAND_SYNTAX, getUsage());

View File

@ -29,14 +29,14 @@ import com.plotsquared.core.PlotSquared;
import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.configuration.Captions;
import com.plotsquared.core.configuration.Settings; import com.plotsquared.core.configuration.Settings;
import com.plotsquared.core.database.DBFunc; import com.plotsquared.core.database.DBFunc;
import com.plotsquared.core.events.TeleportCause;
import com.plotsquared.core.location.BlockLoc; import com.plotsquared.core.location.BlockLoc;
import com.plotsquared.core.location.Location; import com.plotsquared.core.location.Location;
import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.plot.Plot; import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.plot.PlotArea; import com.plotsquared.core.plot.PlotArea;
import com.plotsquared.core.plot.PlotCluster; import com.plotsquared.core.plot.PlotCluster;
import com.plotsquared.core.plot.PlotId; import com.plotsquared.core.plot.PlotId;
import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.events.TeleportCause;
import com.plotsquared.core.util.MainUtil; import com.plotsquared.core.util.MainUtil;
import com.plotsquared.core.util.Permissions; import com.plotsquared.core.util.Permissions;
import com.plotsquared.core.util.uuid.UUIDHandler; import com.plotsquared.core.util.uuid.UUIDHandler;

View File

@ -25,18 +25,18 @@
*/ */
package com.plotsquared.core.command; package com.plotsquared.core.command;
import com.plotsquared.core.configuration.file.YamlConfiguration;
import com.plotsquared.core.PlotSquared; import com.plotsquared.core.PlotSquared;
import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.configuration.Captions;
import com.plotsquared.core.plot.message.PlotMessage; import com.plotsquared.core.configuration.file.YamlConfiguration;
import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.util.task.RunnableVal2; import com.plotsquared.core.plot.message.PlotMessage;
import com.plotsquared.core.util.task.RunnableVal3;
import com.plotsquared.core.util.MainUtil; import com.plotsquared.core.util.MainUtil;
import com.plotsquared.core.util.MathMan; import com.plotsquared.core.util.MathMan;
import com.plotsquared.core.util.Permissions; import com.plotsquared.core.util.Permissions;
import com.plotsquared.core.util.StringComparison; import com.plotsquared.core.util.StringComparison;
import com.plotsquared.core.util.StringMan; import com.plotsquared.core.util.StringMan;
import com.plotsquared.core.util.task.RunnableVal2;
import com.plotsquared.core.util.task.RunnableVal3;
import java.io.IOException; import java.io.IOException;
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.InvocationTargetException;

View File

@ -30,7 +30,8 @@ import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy; import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target; import java.lang.annotation.Target;
@Target({ElementType.TYPE, ElementType.METHOD}) @Retention(RetentionPolicy.RUNTIME) @Target({ElementType.TYPE, ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
public @interface CommandDeclaration { public @interface CommandDeclaration {
String command(); String command();

View File

@ -26,11 +26,11 @@
package com.plotsquared.core.command; package com.plotsquared.core.command;
import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.configuration.Captions;
import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.plot.comment.CommentInbox; import com.plotsquared.core.plot.comment.CommentInbox;
import com.plotsquared.core.plot.comment.PlotComment;
import com.plotsquared.core.plot.comment.CommentManager; import com.plotsquared.core.plot.comment.CommentManager;
import com.plotsquared.core.plot.comment.PlotComment;
import com.plotsquared.core.util.MainUtil; import com.plotsquared.core.util.MainUtil;
import com.plotsquared.core.util.StringMan; import com.plotsquared.core.util.StringMan;
import com.plotsquared.core.util.uuid.UUIDHandler; import com.plotsquared.core.util.uuid.UUIDHandler;
@ -87,8 +87,8 @@ public class Comment extends SubCommand {
String message = StringMan.join(Arrays.copyOfRange(args, index, args.length), " "); String message = StringMan.join(Arrays.copyOfRange(args, index, args.length), " ");
PlotComment comment = PlotComment comment =
new PlotComment(player.getLocation().getWorld(), plot.getId(), message, player.getName(), inbox.toString(), new PlotComment(player.getLocation().getWorld(), plot.getId(), message,
System.currentTimeMillis()); player.getName(), inbox.toString(), System.currentTimeMillis());
boolean result = inbox.addComment(plot, comment); boolean result = inbox.addComment(plot, comment);
if (!result) { if (!result) {
sendMessage(player, Captions.NO_PLOT_INBOX, ""); sendMessage(player, Captions.NO_PLOT_INBOX, "");

View File

@ -26,14 +26,14 @@
package com.plotsquared.core.command; package com.plotsquared.core.command;
import com.plotsquared.core.PlotSquared; import com.plotsquared.core.PlotSquared;
import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.plot.Plot; import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.plot.PlotArea; import com.plotsquared.core.plot.PlotArea;
import com.plotsquared.core.plot.PlotId; import com.plotsquared.core.plot.PlotId;
import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.util.MainUtil; import com.plotsquared.core.util.MainUtil;
import com.plotsquared.core.util.MathMan; import com.plotsquared.core.util.MathMan;
import com.plotsquared.core.util.task.TaskManager;
import com.plotsquared.core.util.WorldUtil; import com.plotsquared.core.util.WorldUtil;
import com.plotsquared.core.util.task.TaskManager;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;

View File

@ -30,10 +30,10 @@ import com.plotsquared.core.configuration.Captions;
import com.plotsquared.core.configuration.Settings; import com.plotsquared.core.configuration.Settings;
import com.plotsquared.core.events.PlotFlagRemoveEvent; import com.plotsquared.core.events.PlotFlagRemoveEvent;
import com.plotsquared.core.events.Result; import com.plotsquared.core.events.Result;
import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.plot.flag.PlotFlag; import com.plotsquared.core.plot.flag.PlotFlag;
import com.plotsquared.core.plot.flag.implementations.DoneFlag; import com.plotsquared.core.plot.flag.implementations.DoneFlag;
import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.util.MainUtil; import com.plotsquared.core.util.MainUtil;
import com.plotsquared.core.util.Permissions; import com.plotsquared.core.util.Permissions;

View File

@ -27,8 +27,8 @@ package com.plotsquared.core.command;
import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.configuration.Captions;
import com.plotsquared.core.location.Location; import com.plotsquared.core.location.Location;
import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.util.MainUtil; import com.plotsquared.core.util.MainUtil;
import com.plotsquared.core.util.Permissions; import com.plotsquared.core.util.Permissions;

View File

@ -29,8 +29,8 @@ import com.plotsquared.core.configuration.Captions;
import com.plotsquared.core.generator.HybridPlotWorld; import com.plotsquared.core.generator.HybridPlotWorld;
import com.plotsquared.core.generator.HybridUtils; import com.plotsquared.core.generator.HybridUtils;
import com.plotsquared.core.location.Location; import com.plotsquared.core.location.Location;
import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.util.MainUtil; import com.plotsquared.core.util.MainUtil;
@CommandDeclaration(command = "createroadschematic", @CommandDeclaration(command = "createroadschematic",

View File

@ -27,17 +27,17 @@ package com.plotsquared.core.command;
import com.plotsquared.core.PlotSquared; import com.plotsquared.core.PlotSquared;
import com.plotsquared.core.database.DBFunc; import com.plotsquared.core.database.DBFunc;
import com.plotsquared.core.database.Database;
import com.plotsquared.core.database.MySQL; import com.plotsquared.core.database.MySQL;
import com.plotsquared.core.database.SQLManager; import com.plotsquared.core.database.SQLManager;
import com.plotsquared.core.database.SQLite; import com.plotsquared.core.database.SQLite;
import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.plot.Plot; import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.plot.PlotArea; import com.plotsquared.core.plot.PlotArea;
import com.plotsquared.core.plot.PlotId; import com.plotsquared.core.plot.PlotId;
import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.plot.world.SinglePlotArea; import com.plotsquared.core.plot.world.SinglePlotArea;
import com.plotsquared.core.util.MainUtil; import com.plotsquared.core.util.MainUtil;
import com.plotsquared.core.util.task.TaskManager; import com.plotsquared.core.util.task.TaskManager;
import com.plotsquared.core.database.Database;
import java.io.File; import java.io.File;
import java.sql.SQLException; import java.sql.SQLException;

View File

@ -58,34 +58,35 @@ public class Debug extends SubCommand {
if (args.length > 0 && "loadedchunks".equalsIgnoreCase(args[0])) { if (args.length > 0 && "loadedchunks".equalsIgnoreCase(args[0])) {
final long start = System.currentTimeMillis(); final long start = System.currentTimeMillis();
MainUtil.sendMessage(player, "Fetching loaded chunks..."); MainUtil.sendMessage(player, "Fetching loaded chunks...");
TaskManager.runTaskAsync(() -> MainUtil.sendMessage(player,"Loaded chunks: " + TaskManager.runTaskAsync(() -> MainUtil.sendMessage(player,
ChunkManager.manager.getChunkChunks(player.getLocation().getWorld()).size() + "(" + (System.currentTimeMillis() - start) + "ms) using thread: " + "Loaded chunks: " + ChunkManager.manager
Thread.currentThread().getName())); .getChunkChunks(player.getLocation().getWorld()).size() + "(" + (
System.currentTimeMillis() - start) + "ms) using thread: " + Thread
.currentThread().getName()));
return true; return true;
} }
if (args.length > 0 && "entitytypes".equalsIgnoreCase(args[0])) { if (args.length > 0 && "entitytypes".equalsIgnoreCase(args[0])) {
EntityCategories.init(); EntityCategories.init();
player.sendMessage(Captions.PREFIX.getTranslated() + "§cEntity Categories: "); player.sendMessage(Captions.PREFIX.getTranslated() + "§cEntity Categories: ");
EntityCategory.REGISTRY.forEach(category -> { EntityCategory.REGISTRY.forEach(category -> {
final StringBuilder builder = new StringBuilder("§7- §6") final StringBuilder builder =
.append(category.getId()).append("§7: §6"); new StringBuilder("§7- §6").append(category.getId()).append("§7: §6");
for (final EntityType entityType : category.getAll()) { for (final EntityType entityType : category.getAll()) {
builder.append(entityType.getId()).append(" "); builder.append(entityType.getId()).append(" ");
} }
player.sendMessage(Captions.PREFIX.getTranslated() + builder.toString()); player.sendMessage(Captions.PREFIX.getTranslated() + builder.toString());
}); });
EntityType.REGISTRY.values().stream() EntityType.REGISTRY.values().stream().sorted(Comparator.comparing(EntityType::getId))
.sorted(Comparator.comparing(EntityType::getId)) .forEach(entityType -> {
.forEach(entityType -> { long categoryCount = EntityCategory.REGISTRY.values().stream()
long categoryCount = EntityCategory.REGISTRY.values() .filter(category -> category.contains(entityType)).count();
.stream() if (categoryCount > 0) {
.filter(category -> category.contains(entityType)) return;
.count(); }
if (categoryCount > 0) { player.sendMessage(
return; Captions.PREFIX.getTranslated() + entityType.getName() + " is in "
} + categoryCount + " categories");
player.sendMessage(Captions.PREFIX.getTranslated() + entityType.getName() + " is in " + categoryCount + " categories"); });
});
return true; return true;
} }
if ((args.length > 0) && args[0].equalsIgnoreCase("msg")) { if ((args.length > 0) && args[0].equalsIgnoreCase("msg")) {

View File

@ -25,20 +25,20 @@
*/ */
package com.plotsquared.core.command; package com.plotsquared.core.command;
import com.google.common.collect.BiMap;
import com.plotsquared.core.PlotSquared; import com.plotsquared.core.PlotSquared;
import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.configuration.Captions;
import com.plotsquared.core.location.Location; import com.plotsquared.core.location.Location;
import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.plot.Plot; import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.plot.PlotArea; import com.plotsquared.core.plot.PlotArea;
import com.plotsquared.core.plot.PlotId; import com.plotsquared.core.plot.PlotId;
import com.plotsquared.core.plot.PlotManager; import com.plotsquared.core.plot.PlotManager;
import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.util.StringWrapper;
import com.plotsquared.core.util.ChunkManager; import com.plotsquared.core.util.ChunkManager;
import com.plotsquared.core.util.MainUtil; import com.plotsquared.core.util.MainUtil;
import com.plotsquared.core.util.uuid.UUIDHandler; import com.plotsquared.core.util.StringWrapper;
import com.plotsquared.core.util.WorldUtil; import com.plotsquared.core.util.WorldUtil;
import com.google.common.collect.BiMap; import com.plotsquared.core.util.uuid.UUIDHandler;
import com.sk89q.worldedit.math.BlockVector2; import com.sk89q.worldedit.math.BlockVector2;
import java.util.ArrayList; import java.util.ArrayList;

View File

@ -25,27 +25,27 @@
*/ */
package com.plotsquared.core.command; package com.plotsquared.core.command;
import com.google.common.io.Files;
import com.plotsquared.core.PlotSquared; import com.plotsquared.core.PlotSquared;
import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.configuration.Captions;
import com.plotsquared.core.configuration.Settings; import com.plotsquared.core.configuration.Settings;
import com.plotsquared.core.database.DBFunc; import com.plotsquared.core.database.DBFunc;
import com.plotsquared.core.events.PlotFlagRemoveEvent; import com.plotsquared.core.events.PlotFlagRemoveEvent;
import com.plotsquared.core.events.Result; import com.plotsquared.core.events.Result;
import com.plotsquared.core.plot.flag.GlobalFlagContainer;
import com.plotsquared.core.plot.flag.PlotFlag;
import com.plotsquared.core.generator.HybridUtils; import com.plotsquared.core.generator.HybridUtils;
import com.plotsquared.core.util.WEManager;
import com.plotsquared.core.player.ConsolePlayer;
import com.plotsquared.core.location.Location; import com.plotsquared.core.location.Location;
import com.plotsquared.core.player.ConsolePlayer;
import com.plotsquared.core.player.OfflinePlotPlayer; import com.plotsquared.core.player.OfflinePlotPlayer;
import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.plot.Plot; import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.plot.PlotArea; import com.plotsquared.core.plot.PlotArea;
import com.plotsquared.core.plot.PlotId; import com.plotsquared.core.plot.PlotId;
import com.plotsquared.core.plot.expiration.ExpireManager;
import com.plotsquared.core.plot.expiration.PlotAnalysis;
import com.plotsquared.core.plot.flag.GlobalFlagContainer;
import com.plotsquared.core.plot.flag.PlotFlag;
import com.plotsquared.core.plot.message.PlotMessage; import com.plotsquared.core.plot.message.PlotMessage;
import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.queue.GlobalBlockQueue;
import com.plotsquared.core.util.task.RunnableVal;
import com.plotsquared.core.util.task.RunnableVal2;
import com.plotsquared.core.util.task.RunnableVal3;
import com.plotsquared.core.util.ChunkManager; import com.plotsquared.core.util.ChunkManager;
import com.plotsquared.core.util.EconHandler; import com.plotsquared.core.util.EconHandler;
import com.plotsquared.core.util.MainUtil; import com.plotsquared.core.util.MainUtil;
@ -53,13 +53,13 @@ import com.plotsquared.core.util.MathMan;
import com.plotsquared.core.util.SchematicHandler; import com.plotsquared.core.util.SchematicHandler;
import com.plotsquared.core.util.SetupUtils; import com.plotsquared.core.util.SetupUtils;
import com.plotsquared.core.util.StringMan; import com.plotsquared.core.util.StringMan;
import com.plotsquared.core.util.WEManager;
import com.plotsquared.core.util.WorldUtil;
import com.plotsquared.core.util.task.RunnableVal;
import com.plotsquared.core.util.task.RunnableVal2;
import com.plotsquared.core.util.task.RunnableVal3;
import com.plotsquared.core.util.task.TaskManager; import com.plotsquared.core.util.task.TaskManager;
import com.plotsquared.core.util.uuid.UUIDHandler; import com.plotsquared.core.util.uuid.UUIDHandler;
import com.plotsquared.core.util.WorldUtil;
import com.plotsquared.core.queue.GlobalBlockQueue;
import com.plotsquared.core.plot.expiration.ExpireManager;
import com.plotsquared.core.plot.expiration.PlotAnalysis;
import com.google.common.io.Files;
import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockState;
import javax.script.Bindings; import javax.script.Bindings;
@ -72,7 +72,12 @@ import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.sql.Timestamp; import java.sql.Timestamp;
import java.util.*; import java.util.Arrays;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.UUID;
import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletableFuture;
@CommandDeclaration(command = "debugexec", @CommandDeclaration(command = "debugexec",
@ -267,8 +272,8 @@ public class DebugExec extends SubCommand {
} }
boolean result; boolean result;
if (HybridUtils.regions != null) { if (HybridUtils.regions != null) {
result = result = HybridUtils.manager
HybridUtils.manager.scheduleRoadUpdate(area, HybridUtils.regions, 0, new HashSet<>()); .scheduleRoadUpdate(area, HybridUtils.regions, 0, new HashSet<>());
} else { } else {
result = HybridUtils.manager.scheduleRoadUpdate(area, 0); result = HybridUtils.manager.scheduleRoadUpdate(area, 0);
} }
@ -333,7 +338,8 @@ public class DebugExec extends SubCommand {
System.getProperty("line.separator")); System.getProperty("line.separator"));
new Command(MainCommand.getInstance(), true, args[1].split("\\.")[0], null, new Command(MainCommand.getInstance(), true, args[1].split("\\.")[0], null,
RequiredType.NONE, CommandCategory.DEBUG) { RequiredType.NONE, CommandCategory.DEBUG) {
@Override public CompletableFuture<Boolean> execute(PlotPlayer player, @Override
public CompletableFuture<Boolean> execute(PlotPlayer player,
String[] args, RunnableVal3<Command, Runnable, Runnable> confirm, String[] args, RunnableVal3<Command, Runnable, Runnable> confirm,
RunnableVal2<Command, CommandResult> whenDone) { RunnableVal2<Command, CommandResult> whenDone) {
try { try {

View File

@ -25,17 +25,17 @@
*/ */
package com.plotsquared.core.command; package com.plotsquared.core.command;
import com.google.common.base.Charsets;
import com.plotsquared.core.PlotSquared; import com.plotsquared.core.PlotSquared;
import com.plotsquared.core.plot.PlotId;
import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.util.task.RunnableVal2; import com.plotsquared.core.plot.PlotId;
import com.plotsquared.core.util.task.RunnableVal3;
import com.plotsquared.core.plot.world.PlotAreaManager; import com.plotsquared.core.plot.world.PlotAreaManager;
import com.plotsquared.core.plot.world.SinglePlotArea; import com.plotsquared.core.plot.world.SinglePlotArea;
import com.plotsquared.core.plot.world.SinglePlotAreaManager; import com.plotsquared.core.plot.world.SinglePlotAreaManager;
import com.plotsquared.core.util.uuid.UUIDHandler;
import com.plotsquared.core.util.WorldUtil; import com.plotsquared.core.util.WorldUtil;
import com.google.common.base.Charsets; import com.plotsquared.core.util.task.RunnableVal2;
import com.plotsquared.core.util.task.RunnableVal3;
import com.plotsquared.core.util.uuid.UUIDHandler;
import java.io.File; import java.io.File;
import java.util.UUID; import java.util.UUID;
@ -51,7 +51,8 @@ public class DebugImportWorlds extends Command {
super(MainCommand.getInstance(), true); super(MainCommand.getInstance(), true);
} }
@Override public CompletableFuture<Boolean> execute(PlotPlayer player, String[] args, @Override
public CompletableFuture<Boolean> execute(PlotPlayer player, String[] args,
RunnableVal3<Command, Runnable, Runnable> confirm, RunnableVal3<Command, Runnable, Runnable> confirm,
RunnableVal2<Command, CommandResult> whenDone) throws CommandException { RunnableVal2<Command, CommandResult> whenDone) throws CommandException {
// UUID.nameUUIDFromBytes(("OfflinePlayer:" + player.getName()).getBytes(Charsets.UTF_8)) // UUID.nameUUIDFromBytes(("OfflinePlayer:" + player.getName()).getBytes(Charsets.UTF_8))

View File

@ -25,17 +25,17 @@
*/ */
package com.plotsquared.core.command; package com.plotsquared.core.command;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import com.plotsquared.core.PlotSquared; import com.plotsquared.core.PlotSquared;
import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.configuration.Captions;
import com.plotsquared.core.configuration.Settings; import com.plotsquared.core.configuration.Settings;
import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.util.net.IncendoPaster;
import com.plotsquared.core.util.MainUtil; import com.plotsquared.core.util.MainUtil;
import com.plotsquared.core.util.PremiumVerification;
import com.plotsquared.core.util.net.IncendoPaster;
import com.plotsquared.core.util.task.TaskManager; import com.plotsquared.core.util.task.TaskManager;
import com.plotsquared.core.util.uuid.UUIDHandler; import com.plotsquared.core.util.uuid.UUIDHandler;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import com.plotsquared.core.util.PremiumVerification;
import lombok.NonNull; import lombok.NonNull;
import java.io.BufferedReader; import java.io.BufferedReader;
@ -83,7 +83,8 @@ public class DebugPaste extends SubCommand {
b.append("# PlotSquared Information\n"); b.append("# PlotSquared Information\n");
b.append("Resource ID: ").append(PremiumVerification.getResourceID()).append("\n"); b.append("Resource ID: ").append(PremiumVerification.getResourceID()).append("\n");
b.append("Download ID: ").append(PremiumVerification.getDownloadID()).append("\n"); b.append("Download ID: ").append(PremiumVerification.getDownloadID()).append("\n");
b.append("This PlotSquared version is licensed to the spigot user ").append(PremiumVerification.getUserID()).append("\n\n"); b.append("This PlotSquared version is licensed to the spigot user ")
.append(PremiumVerification.getUserID()).append("\n\n");
b.append("# Server Information\n"); b.append("# Server Information\n");
b.append("Server Version: ").append(PlotSquared.get().IMP.getServerImplementation()) b.append("Server Version: ").append(PlotSquared.get().IMP.getServerImplementation())
.append("\n"); .append("\n");

View File

@ -29,10 +29,10 @@ import com.plotsquared.core.configuration.Captions;
import com.plotsquared.core.generator.HybridPlotManager; import com.plotsquared.core.generator.HybridPlotManager;
import com.plotsquared.core.generator.HybridUtils; import com.plotsquared.core.generator.HybridUtils;
import com.plotsquared.core.location.Location; import com.plotsquared.core.location.Location;
import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.plot.Plot; import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.plot.PlotArea; import com.plotsquared.core.plot.PlotArea;
import com.plotsquared.core.plot.PlotManager; import com.plotsquared.core.plot.PlotManager;
import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.util.MainUtil; import com.plotsquared.core.util.MainUtil;
import java.util.Arrays; import java.util.Arrays;

View File

@ -27,8 +27,8 @@ package com.plotsquared.core.command;
import com.plotsquared.core.PlotSquared; import com.plotsquared.core.PlotSquared;
import com.plotsquared.core.database.DBFunc; import com.plotsquared.core.database.DBFunc;
import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.util.MainUtil; import com.plotsquared.core.util.MainUtil;
import java.util.ArrayList; import java.util.ArrayList;

View File

@ -29,12 +29,12 @@ import com.plotsquared.core.PlotSquared;
import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.configuration.Captions;
import com.plotsquared.core.configuration.Settings; import com.plotsquared.core.configuration.Settings;
import com.plotsquared.core.events.Result; import com.plotsquared.core.events.Result;
import com.plotsquared.core.util.Expression;
import com.plotsquared.core.location.Location; import com.plotsquared.core.location.Location;
import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.plot.Plot; import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.plot.PlotArea; import com.plotsquared.core.plot.PlotArea;
import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.util.EconHandler; import com.plotsquared.core.util.EconHandler;
import com.plotsquared.core.util.Expression;
import com.plotsquared.core.util.MainUtil; import com.plotsquared.core.util.MainUtil;
import com.plotsquared.core.util.Permissions; import com.plotsquared.core.util.Permissions;
import com.plotsquared.core.util.task.TaskManager; import com.plotsquared.core.util.task.TaskManager;
@ -62,7 +62,8 @@ public class Delete extends SubCommand {
if (!plot.hasOwner()) { if (!plot.hasOwner()) {
return !sendMessage(player, Captions.PLOT_UNOWNED); return !sendMessage(player, Captions.PLOT_UNOWNED);
} }
Result eventResult = PlotSquared.get().getEventDispatcher().callDelete(plot).getEventResult(); Result eventResult =
PlotSquared.get().getEventDispatcher().callDelete(plot).getEventResult();
if (eventResult == Result.DENY) { if (eventResult == Result.DENY) {
sendMessage(player, Captions.EVENT_DENIED, "Delete"); sendMessage(player, Captions.EVENT_DENIED, "Delete");
return true; return true;

View File

@ -29,12 +29,12 @@ import com.plotsquared.core.PlotSquared;
import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.configuration.Captions;
import com.plotsquared.core.database.DBFunc; import com.plotsquared.core.database.DBFunc;
import com.plotsquared.core.location.Location; import com.plotsquared.core.location.Location;
import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.util.MainUtil; import com.plotsquared.core.util.MainUtil;
import com.plotsquared.core.util.Permissions; import com.plotsquared.core.util.Permissions;
import com.plotsquared.core.util.uuid.UUIDHandler;
import com.plotsquared.core.util.WorldUtil; import com.plotsquared.core.util.WorldUtil;
import com.plotsquared.core.util.uuid.UUIDHandler;
import com.sk89q.worldedit.world.gamemode.GameModes; import com.sk89q.worldedit.world.gamemode.GameModes;
import java.util.Set; import java.util.Set;

View File

@ -30,9 +30,9 @@ import com.plotsquared.core.configuration.Captions;
import com.plotsquared.core.events.PlotFlagAddEvent; import com.plotsquared.core.events.PlotFlagAddEvent;
import com.plotsquared.core.events.PlotFlagRemoveEvent; import com.plotsquared.core.events.PlotFlagRemoveEvent;
import com.plotsquared.core.events.Result; import com.plotsquared.core.events.Result;
import com.plotsquared.core.plot.flag.implementations.DescriptionFlag;
import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.plot.flag.implementations.DescriptionFlag;
import com.plotsquared.core.util.MainUtil; import com.plotsquared.core.util.MainUtil;
@CommandDeclaration(command = "setdescription", @CommandDeclaration(command = "setdescription",

View File

@ -31,17 +31,17 @@ import com.plotsquared.core.configuration.Settings;
import com.plotsquared.core.events.PlotDoneEvent; import com.plotsquared.core.events.PlotDoneEvent;
import com.plotsquared.core.events.PlotFlagAddEvent; import com.plotsquared.core.events.PlotFlagAddEvent;
import com.plotsquared.core.events.Result; import com.plotsquared.core.events.Result;
import com.plotsquared.core.plot.flag.PlotFlag;
import com.plotsquared.core.plot.flag.implementations.DoneFlag;
import com.plotsquared.core.generator.HybridUtils; import com.plotsquared.core.generator.HybridUtils;
import com.plotsquared.core.location.Location; import com.plotsquared.core.location.Location;
import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.util.task.RunnableVal; import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.util.MainUtil;
import com.plotsquared.core.util.Permissions;
import com.plotsquared.core.plot.expiration.ExpireManager; import com.plotsquared.core.plot.expiration.ExpireManager;
import com.plotsquared.core.plot.expiration.PlotAnalysis; import com.plotsquared.core.plot.expiration.PlotAnalysis;
import com.plotsquared.core.plot.flag.PlotFlag;
import com.plotsquared.core.plot.flag.implementations.DoneFlag;
import com.plotsquared.core.util.MainUtil;
import com.plotsquared.core.util.Permissions;
import com.plotsquared.core.util.task.RunnableVal;
@CommandDeclaration(command = "done", @CommandDeclaration(command = "done",
aliases = {"submit"}, aliases = {"submit"},

View File

@ -28,15 +28,15 @@ package com.plotsquared.core.command;
import com.plotsquared.core.PlotSquared; import com.plotsquared.core.PlotSquared;
import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.configuration.Captions;
import com.plotsquared.core.configuration.Settings; import com.plotsquared.core.configuration.Settings;
import com.plotsquared.core.plot.flag.implementations.DoneFlag;
import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.util.task.RunnableVal; import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.plot.flag.implementations.DoneFlag;
import com.plotsquared.core.util.MainUtil; import com.plotsquared.core.util.MainUtil;
import com.plotsquared.core.util.Permissions; import com.plotsquared.core.util.Permissions;
import com.plotsquared.core.util.SchematicHandler; import com.plotsquared.core.util.SchematicHandler;
import com.plotsquared.core.util.StringMan; import com.plotsquared.core.util.StringMan;
import com.plotsquared.core.util.WorldUtil; import com.plotsquared.core.util.WorldUtil;
import com.plotsquared.core.util.task.RunnableVal;
import com.sk89q.jnbt.CompoundTag; import com.sk89q.jnbt.CompoundTag;
import java.net.URL; import java.net.URL;

View File

@ -32,24 +32,24 @@ import com.plotsquared.core.configuration.Settings;
import com.plotsquared.core.events.PlotFlagAddEvent; import com.plotsquared.core.events.PlotFlagAddEvent;
import com.plotsquared.core.events.PlotFlagRemoveEvent; import com.plotsquared.core.events.PlotFlagRemoveEvent;
import com.plotsquared.core.events.Result; import com.plotsquared.core.events.Result;
import com.plotsquared.core.location.Location;
import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.plot.flag.FlagParseException; import com.plotsquared.core.plot.flag.FlagParseException;
import com.plotsquared.core.plot.flag.GlobalFlagContainer; import com.plotsquared.core.plot.flag.GlobalFlagContainer;
import com.plotsquared.core.plot.flag.InternalFlag; import com.plotsquared.core.plot.flag.InternalFlag;
import com.plotsquared.core.plot.flag.PlotFlag; import com.plotsquared.core.plot.flag.PlotFlag;
import com.plotsquared.core.plot.flag.types.IntegerFlag; import com.plotsquared.core.plot.flag.types.IntegerFlag;
import com.plotsquared.core.plot.flag.types.ListFlag; import com.plotsquared.core.plot.flag.types.ListFlag;
import com.plotsquared.core.location.Location;
import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.plot.message.PlotMessage; import com.plotsquared.core.plot.message.PlotMessage;
import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.util.task.RunnableVal2;
import com.plotsquared.core.util.task.RunnableVal3;
import com.plotsquared.core.util.MainUtil; import com.plotsquared.core.util.MainUtil;
import com.plotsquared.core.util.MathMan; import com.plotsquared.core.util.MathMan;
import com.plotsquared.core.util.Permissions; import com.plotsquared.core.util.Permissions;
import com.plotsquared.core.util.StringComparison; import com.plotsquared.core.util.StringComparison;
import com.plotsquared.core.util.StringMan; import com.plotsquared.core.util.StringMan;
import com.plotsquared.core.util.helpmenu.HelpMenu; import com.plotsquared.core.util.helpmenu.HelpMenu;
import com.plotsquared.core.util.task.RunnableVal2;
import com.plotsquared.core.util.task.RunnableVal3;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
@ -206,7 +206,8 @@ public final class FlagCommand extends Command {
return null; return null;
} }
@Override public CompletableFuture<Boolean> execute(PlotPlayer player, String[] args, @Override
public CompletableFuture<Boolean> execute(PlotPlayer player, String[] args,
RunnableVal3<Command, Runnable, Runnable> confirm, RunnableVal3<Command, Runnable, Runnable> confirm,
RunnableVal2<Command, CommandResult> whenDone) throws CommandException { RunnableVal2<Command, CommandResult> whenDone) throws CommandException {
if (args.length == 0 || !Arrays if (args.length == 0 || !Arrays
@ -220,7 +221,8 @@ public final class FlagCommand extends Command {
return super.execute(player, args, confirm, whenDone); return super.execute(player, args, confirm, whenDone);
} }
@Override public Collection<Command> tab(final PlotPlayer player, final String[] args, @Override
public Collection<Command> tab(final PlotPlayer player, final String[] args,
final boolean space) { final boolean space) {
if (args.length == 1) { if (args.length == 1) {
return Stream return Stream
@ -356,7 +358,8 @@ public final class FlagCommand extends Command {
return; return;
} }
} }
} final String value = StringMan.join(Arrays.copyOfRange(args, 1, args.length), " "); }
final String value = StringMan.join(Arrays.copyOfRange(args, 1, args.length), " ");
final PlotFlag parsed; final PlotFlag parsed;
try { try {
parsed = event.getFlag().parse(value); parsed = event.getFlag().parse(value);
@ -448,7 +451,8 @@ public final class FlagCommand extends Command {
PlotFlag plotFlag = parsedFlag.createFlagInstance(list); PlotFlag plotFlag = parsedFlag.createFlagInstance(list);
PlotFlagAddEvent addEvent = new PlotFlagAddEvent(plotFlag, plot); PlotFlagAddEvent addEvent = new PlotFlagAddEvent(plotFlag, plot);
if (addEvent.getEventResult() == Result.DENY) { if (addEvent.getEventResult() == Result.DENY) {
sendMessage(player, Captions.EVENT_DENIED, "Re-addition of " + plotFlag.getName()); sendMessage(player, Captions.EVENT_DENIED,
"Re-addition of " + plotFlag.getName());
return; return;
} }
if (plot.setFlag(addEvent.getFlag())) { if (plot.setFlag(addEvent.getFlag())) {

View File

@ -25,17 +25,17 @@
*/ */
package com.plotsquared.core.command; package com.plotsquared.core.command;
import com.google.common.primitives.Ints;
import com.plotsquared.core.configuration.CaptionUtility; import com.plotsquared.core.configuration.CaptionUtility;
import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.configuration.Captions;
import com.plotsquared.core.database.DBFunc; import com.plotsquared.core.database.DBFunc;
import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.util.MainUtil;
import com.plotsquared.core.util.Permissions;
import com.plotsquared.core.util.task.RunnableVal; import com.plotsquared.core.util.task.RunnableVal;
import com.plotsquared.core.util.task.RunnableVal2; import com.plotsquared.core.util.task.RunnableVal2;
import com.plotsquared.core.util.task.RunnableVal3; import com.plotsquared.core.util.task.RunnableVal3;
import com.plotsquared.core.util.MainUtil;
import com.plotsquared.core.util.Permissions;
import com.plotsquared.core.util.uuid.UUIDHandler; import com.plotsquared.core.util.uuid.UUIDHandler;
import com.google.common.primitives.Ints;
import java.util.UUID; import java.util.UUID;
import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletableFuture;
@ -51,7 +51,8 @@ public class Grant extends Command {
super(MainCommand.getInstance(), true); super(MainCommand.getInstance(), true);
} }
@Override public CompletableFuture<Boolean> execute(final PlotPlayer player, String[] args, @Override
public CompletableFuture<Boolean> execute(final PlotPlayer player, String[] args,
RunnableVal3<Command, Runnable, Runnable> confirm, RunnableVal3<Command, Runnable, Runnable> confirm,
RunnableVal2<Command, CommandResult> whenDone) throws CommandException { RunnableVal2<Command, CommandResult> whenDone) throws CommandException {
checkTrue(args.length >= 1 && args.length <= 2, Captions.COMMAND_SYNTAX, getUsage()); checkTrue(args.length >= 1 && args.length <= 2, Captions.COMMAND_SYNTAX, getUsage());

View File

@ -27,12 +27,12 @@ package com.plotsquared.core.command;
import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.configuration.Captions;
import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.util.task.RunnableVal2;
import com.plotsquared.core.util.task.RunnableVal3;
import com.plotsquared.core.util.MainUtil; import com.plotsquared.core.util.MainUtil;
import com.plotsquared.core.util.MathMan; import com.plotsquared.core.util.MathMan;
import com.plotsquared.core.util.StringMan; import com.plotsquared.core.util.StringMan;
import com.plotsquared.core.util.helpmenu.HelpMenu; import com.plotsquared.core.util.helpmenu.HelpMenu;
import com.plotsquared.core.util.task.RunnableVal2;
import com.plotsquared.core.util.task.RunnableVal3;
import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletableFuture;
@ -51,7 +51,8 @@ public class Help extends Command {
return true; return true;
} }
@Override public CompletableFuture<Boolean> execute(PlotPlayer player, String[] args, @Override
public CompletableFuture<Boolean> execute(PlotPlayer player, String[] args,
RunnableVal3<Command, Runnable, Runnable> confirm, RunnableVal3<Command, Runnable, Runnable> confirm,
RunnableVal2<Command, CommandResult> whenDone) { RunnableVal2<Command, CommandResult> whenDone) {
switch (args.length) { switch (args.length) {

View File

@ -26,14 +26,14 @@
package com.plotsquared.core.command; package com.plotsquared.core.command;
import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.configuration.Captions;
import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.util.task.RunnableVal; import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.plot.comment.CommentInbox; import com.plotsquared.core.plot.comment.CommentInbox;
import com.plotsquared.core.plot.comment.PlotComment;
import com.plotsquared.core.plot.comment.CommentManager; import com.plotsquared.core.plot.comment.CommentManager;
import com.plotsquared.core.plot.comment.PlotComment;
import com.plotsquared.core.util.MainUtil; import com.plotsquared.core.util.MainUtil;
import com.plotsquared.core.util.StringMan; import com.plotsquared.core.util.StringMan;
import com.plotsquared.core.util.task.RunnableVal;
import java.util.List; import java.util.List;

View File

@ -28,11 +28,11 @@ package com.plotsquared.core.command;
import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.configuration.Captions;
import com.plotsquared.core.configuration.Settings; import com.plotsquared.core.configuration.Settings;
import com.plotsquared.core.database.DBFunc; import com.plotsquared.core.database.DBFunc;
import com.plotsquared.core.plot.flag.implementations.HideInfoFlag;
import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.util.task.RunnableVal; import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.plot.flag.implementations.HideInfoFlag;
import com.plotsquared.core.util.MainUtil; import com.plotsquared.core.util.MainUtil;
import com.plotsquared.core.util.task.RunnableVal;
@CommandDeclaration(command = "info", @CommandDeclaration(command = "info",
aliases = "i", aliases = "i",

View File

@ -29,12 +29,12 @@ import com.plotsquared.core.PlotSquared;
import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.configuration.Captions;
import com.plotsquared.core.database.DBFunc; import com.plotsquared.core.database.DBFunc;
import com.plotsquared.core.location.Location; import com.plotsquared.core.location.Location;
import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.util.MainUtil; import com.plotsquared.core.util.MainUtil;
import com.plotsquared.core.util.Permissions; import com.plotsquared.core.util.Permissions;
import com.plotsquared.core.util.uuid.UUIDHandler;
import com.plotsquared.core.util.WorldUtil; import com.plotsquared.core.util.WorldUtil;
import com.plotsquared.core.util.uuid.UUIDHandler;
import java.util.HashSet; import java.util.HashSet;
import java.util.Set; import java.util.Set;

View File

@ -27,11 +27,11 @@ package com.plotsquared.core.command;
import com.plotsquared.core.PlotSquared; import com.plotsquared.core.PlotSquared;
import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.configuration.Captions;
import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.util.MainUtil;
import com.plotsquared.core.util.task.RunnableVal2; import com.plotsquared.core.util.task.RunnableVal2;
import com.plotsquared.core.util.task.RunnableVal3; import com.plotsquared.core.util.task.RunnableVal3;
import com.plotsquared.core.util.MainUtil;
import java.util.UUID; import java.util.UUID;
import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletableFuture;
@ -47,7 +47,8 @@ public class Leave extends Command {
super(MainCommand.getInstance(), true); super(MainCommand.getInstance(), true);
} }
@Override public CompletableFuture<Boolean> execute(PlotPlayer player, String[] args, @Override
public CompletableFuture<Boolean> execute(PlotPlayer player, String[] args,
RunnableVal3<Command, Runnable, Runnable> confirm, RunnableVal3<Command, Runnable, Runnable> confirm,
RunnableVal2<Command, CommandResult> whenDone) throws CommandException { RunnableVal2<Command, CommandResult> whenDone) throws CommandException {
final Plot plot = check(player.getCurrentPlot(), Captions.NOT_IN_PLOT); final Plot plot = check(player.getCurrentPlot(), Captions.NOT_IN_PLOT);

View File

@ -30,11 +30,11 @@ import com.plotsquared.core.configuration.Captions;
import com.plotsquared.core.configuration.Settings; import com.plotsquared.core.configuration.Settings;
import com.plotsquared.core.database.DBFunc; import com.plotsquared.core.database.DBFunc;
import com.plotsquared.core.events.PlotRateEvent; import com.plotsquared.core.events.PlotRateEvent;
import com.plotsquared.core.plot.flag.implementations.DoneFlag;
import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.plot.Rating;
import com.plotsquared.core.events.TeleportCause; import com.plotsquared.core.events.TeleportCause;
import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.plot.Rating;
import com.plotsquared.core.plot.flag.implementations.DoneFlag;
import com.plotsquared.core.util.MainUtil; import com.plotsquared.core.util.MainUtil;
import com.plotsquared.core.util.Permissions; import com.plotsquared.core.util.Permissions;
import com.plotsquared.core.util.task.TaskManager; import com.plotsquared.core.util.task.TaskManager;
@ -71,7 +71,8 @@ public class Like extends SubCommand {
for (final Plot plot : plots) { for (final Plot plot : plots) {
if ((!Settings.Done.REQUIRED_FOR_RATINGS || DoneFlag.isDone(plot)) && plot if ((!Settings.Done.REQUIRED_FOR_RATINGS || DoneFlag.isDone(plot)) && plot
.isBasePlot() && (!plot.getLikes().containsKey(uuid))) { .isBasePlot() && (!plot.getLikes().containsKey(uuid))) {
plot.teleportPlayer(player, TeleportCause.COMMAND, result -> {}); plot.teleportPlayer(player, TeleportCause.COMMAND, result -> {
});
MainUtil.sendMessage(player, Captions.RATE_THIS); MainUtil.sendMessage(player, Captions.RATE_THIS);
return true; return true;
} }
@ -123,8 +124,8 @@ public class Like extends SubCommand {
rating = 1; rating = 1;
} }
plot.addRating(uuid, new Rating(rating)); plot.addRating(uuid, new Rating(rating));
final PlotRateEvent final PlotRateEvent event =
event = PlotSquared.get().getEventDispatcher().callRating(player, plot, new Rating(rating)); PlotSquared.get().getEventDispatcher().callRating(player, plot, new Rating(rating));
if (event.getRating() != null) { if (event.getRating() != null) {
plot.addRating(uuid, event.getRating()); plot.addRating(uuid, event.getRating());
if (like) { if (like) {

View File

@ -29,22 +29,22 @@ import com.plotsquared.core.PlotSquared;
import com.plotsquared.core.PlotSquared.SortType; import com.plotsquared.core.PlotSquared.SortType;
import com.plotsquared.core.configuration.CaptionUtility; import com.plotsquared.core.configuration.CaptionUtility;
import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.configuration.Captions;
import com.plotsquared.core.plot.flag.implementations.DoneFlag; import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.plot.flag.implementations.PriceFlag;
import com.plotsquared.core.plot.Plot; import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.plot.PlotArea; import com.plotsquared.core.plot.PlotArea;
import com.plotsquared.core.plot.message.PlotMessage;
import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.plot.Rating; import com.plotsquared.core.plot.Rating;
import com.plotsquared.core.util.task.RunnableVal3; import com.plotsquared.core.plot.expiration.ExpireManager;
import com.plotsquared.core.plot.flag.implementations.DoneFlag;
import com.plotsquared.core.plot.flag.implementations.PriceFlag;
import com.plotsquared.core.plot.message.PlotMessage;
import com.plotsquared.core.util.EconHandler; import com.plotsquared.core.util.EconHandler;
import com.plotsquared.core.util.MainUtil; import com.plotsquared.core.util.MainUtil;
import com.plotsquared.core.util.MathMan; import com.plotsquared.core.util.MathMan;
import com.plotsquared.core.util.Permissions; import com.plotsquared.core.util.Permissions;
import com.plotsquared.core.util.StringComparison; import com.plotsquared.core.util.StringComparison;
import com.plotsquared.core.util.StringMan; import com.plotsquared.core.util.StringMan;
import com.plotsquared.core.util.task.RunnableVal3;
import com.plotsquared.core.util.uuid.UUIDHandler; import com.plotsquared.core.util.uuid.UUIDHandler;
import com.plotsquared.core.plot.expiration.ExpireManager;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;

View File

@ -28,15 +28,15 @@ package com.plotsquared.core.command;
import com.plotsquared.core.PlotSquared; import com.plotsquared.core.PlotSquared;
import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.configuration.Captions;
import com.plotsquared.core.configuration.Settings; import com.plotsquared.core.configuration.Settings;
import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.plot.Plot; import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.plot.PlotArea; import com.plotsquared.core.plot.PlotArea;
import com.plotsquared.core.plot.PlotId; import com.plotsquared.core.plot.PlotId;
import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.util.task.RunnableVal;
import com.plotsquared.core.plot.schematic.Schematic; import com.plotsquared.core.plot.schematic.Schematic;
import com.plotsquared.core.util.MainUtil; import com.plotsquared.core.util.MainUtil;
import com.plotsquared.core.util.Permissions; import com.plotsquared.core.util.Permissions;
import com.plotsquared.core.util.SchematicHandler; import com.plotsquared.core.util.SchematicHandler;
import com.plotsquared.core.util.task.RunnableVal;
import com.plotsquared.core.util.task.TaskManager; import com.plotsquared.core.util.task.TaskManager;
import java.net.MalformedURLException; import java.net.MalformedURLException;

View File

@ -27,16 +27,16 @@ package com.plotsquared.core.command;
import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.configuration.Captions;
import com.plotsquared.core.configuration.Settings; import com.plotsquared.core.configuration.Settings;
import com.plotsquared.core.player.ConsolePlayer;
import com.plotsquared.core.util.Expression;
import com.plotsquared.core.location.Location; import com.plotsquared.core.location.Location;
import com.plotsquared.core.player.ConsolePlayer;
import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.plot.Plot; import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.plot.PlotArea; import com.plotsquared.core.plot.PlotArea;
import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.util.EconHandler;
import com.plotsquared.core.util.Expression;
import com.plotsquared.core.util.Permissions;
import com.plotsquared.core.util.task.RunnableVal2; import com.plotsquared.core.util.task.RunnableVal2;
import com.plotsquared.core.util.task.RunnableVal3; import com.plotsquared.core.util.task.RunnableVal3;
import com.plotsquared.core.util.EconHandler;
import com.plotsquared.core.util.Permissions;
import java.util.Arrays; import java.util.Arrays;
import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletableFuture;
@ -167,7 +167,8 @@ public class MainCommand extends Command {
if (EconHandler.manager != null) { if (EconHandler.manager != null) {
PlotArea area = player.getApplicablePlotArea(); PlotArea area = player.getApplicablePlotArea();
if (area != null) { if (area != null) {
Expression<Double> priceEval = area.getPrices().get(cmd.getFullId()); Expression<Double> priceEval =
area.getPrices().get(cmd.getFullId());
Double price = priceEval != null ? priceEval.evaluate(0d) : 0d; Double price = priceEval != null ? priceEval.evaluate(0d) : 0d;
if (price != null if (price != null
&& EconHandler.manager.getMoney(player) < price) { && EconHandler.manager.getMoney(player) < price) {
@ -215,7 +216,8 @@ public class MainCommand extends Command {
return true; return true;
} }
@Override public CompletableFuture<Boolean> execute(final PlotPlayer player, String[] args, @Override
public CompletableFuture<Boolean> execute(final PlotPlayer player, String[] args,
RunnableVal3<Command, Runnable, Runnable> confirm, RunnableVal3<Command, Runnable, Runnable> confirm,
RunnableVal2<Command, CommandResult> whenDone) { RunnableVal2<Command, CommandResult> whenDone) {
// Clear perm caching // // Clear perm caching //
@ -253,7 +255,8 @@ public class MainCommand extends Command {
if (EconHandler.manager != null) { if (EconHandler.manager != null) {
PlotArea area = player.getApplicablePlotArea(); PlotArea area = player.getApplicablePlotArea();
if (area != null) { if (area != null) {
Expression<Double> priceEval = area.getPrices().get(cmd.getFullId()); Expression<Double> priceEval =
area.getPrices().get(cmd.getFullId());
Double price = priceEval != null ? priceEval.evaluate(0d) : 0d; Double price = priceEval != null ? priceEval.evaluate(0d) : 0d;
if (price != 0d if (price != 0d
&& EconHandler.manager.getMoney(player) < price) { && EconHandler.manager.getMoney(player) < price) {

View File

@ -31,12 +31,12 @@ import com.plotsquared.core.configuration.Settings;
import com.plotsquared.core.events.PlotMergeEvent; import com.plotsquared.core.events.PlotMergeEvent;
import com.plotsquared.core.events.Result; import com.plotsquared.core.events.Result;
import com.plotsquared.core.location.Direction; import com.plotsquared.core.location.Direction;
import com.plotsquared.core.util.Expression;
import com.plotsquared.core.location.Location; import com.plotsquared.core.location.Location;
import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.plot.Plot; import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.plot.PlotArea; import com.plotsquared.core.plot.PlotArea;
import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.util.EconHandler; import com.plotsquared.core.util.EconHandler;
import com.plotsquared.core.util.Expression;
import com.plotsquared.core.util.MainUtil; import com.plotsquared.core.util.MainUtil;
import com.plotsquared.core.util.Permissions; import com.plotsquared.core.util.Permissions;
import com.plotsquared.core.util.StringMan; import com.plotsquared.core.util.StringMan;
@ -182,7 +182,8 @@ public class Merge extends SubCommand {
} else { } else {
terrain = true; terrain = true;
} }
if (!force && !terrain && !Permissions.hasPermission(player, Captions.PERMISSION_MERGE_KEEP_ROAD)) { if (!force && !terrain && !Permissions
.hasPermission(player, Captions.PERMISSION_MERGE_KEEP_ROAD)) {
MainUtil.sendMessage(player, Captions.NO_PERMISSION, MainUtil.sendMessage(player, Captions.NO_PERMISSION,
Captions.PERMISSION_MERGE_KEEP_ROAD.getTranslated()); Captions.PERMISSION_MERGE_KEEP_ROAD.getTranslated());
return true; return true;

View File

@ -26,10 +26,10 @@
package com.plotsquared.core.command; package com.plotsquared.core.command;
import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.configuration.Captions;
import com.plotsquared.core.location.Location;
import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.events.TeleportCause; import com.plotsquared.core.events.TeleportCause;
import com.plotsquared.core.location.Location;
import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.plot.Plot;
/** /**
* @author manuelgu, altered by Citymonstret * @author manuelgu, altered by Citymonstret

View File

@ -28,13 +28,13 @@ package com.plotsquared.core.command;
import com.plotsquared.core.PlotSquared; import com.plotsquared.core.PlotSquared;
import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.configuration.Captions;
import com.plotsquared.core.location.Location; import com.plotsquared.core.location.Location;
import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.plot.Plot; import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.plot.PlotArea; import com.plotsquared.core.plot.PlotArea;
import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.util.task.RunnableVal2;
import com.plotsquared.core.util.task.RunnableVal3;
import com.plotsquared.core.util.MainUtil; import com.plotsquared.core.util.MainUtil;
import com.plotsquared.core.util.Permissions; import com.plotsquared.core.util.Permissions;
import com.plotsquared.core.util.task.RunnableVal2;
import com.plotsquared.core.util.task.RunnableVal3;
import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletableFuture;
@ -46,7 +46,8 @@ import java.util.concurrent.CompletableFuture;
requiredType = RequiredType.PLAYER) requiredType = RequiredType.PLAYER)
public class Move extends SubCommand { public class Move extends SubCommand {
@Override public CompletableFuture<Boolean> execute(PlotPlayer player, String[] args, @Override
public CompletableFuture<Boolean> execute(PlotPlayer player, String[] args,
RunnableVal3<Command, Runnable, Runnable> confirm, RunnableVal3<Command, Runnable, Runnable> confirm,
RunnableVal2<Command, CommandResult> whenDone) { RunnableVal2<Command, CommandResult> whenDone) {
Location location = player.getLocation(); Location location = player.getLocation();
@ -94,16 +95,16 @@ public class Move extends SubCommand {
return CompletableFuture.completedFuture(false); return CompletableFuture.completedFuture(false);
} }
return plot1.move(plot2, () -> {}, false) return plot1.move(plot2, () -> {
.thenApply(result -> { }, false).thenApply(result -> {
if (result) { if (result) {
MainUtil.sendMessage(player, Captions.MOVE_SUCCESS); MainUtil.sendMessage(player, Captions.MOVE_SUCCESS);
return true; return true;
} else { } else {
MainUtil.sendMessage(player, Captions.REQUIRES_UNOWNED); MainUtil.sendMessage(player, Captions.REQUIRES_UNOWNED);
return false; return false;
} }
}); });
} }
@Override public boolean onCommand(final PlotPlayer player, String[] args) { @Override public boolean onCommand(final PlotPlayer player, String[] args) {

View File

@ -25,17 +25,17 @@
*/ */
package com.plotsquared.core.command; package com.plotsquared.core.command;
import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.configuration.Captions;
import com.plotsquared.core.events.PlotFlagAddEvent; import com.plotsquared.core.events.PlotFlagAddEvent;
import com.plotsquared.core.events.PlotFlagRemoveEvent; import com.plotsquared.core.events.PlotFlagRemoveEvent;
import com.plotsquared.core.events.Result; import com.plotsquared.core.events.Result;
import com.plotsquared.core.plot.flag.PlotFlag;
import com.plotsquared.core.plot.flag.implementations.MusicFlag;
import com.plotsquared.core.location.Location; import com.plotsquared.core.location.Location;
import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.plot.Plot; import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.plot.PlotInventory; import com.plotsquared.core.plot.PlotInventory;
import com.plotsquared.core.plot.PlotItemStack; import com.plotsquared.core.plot.PlotItemStack;
import com.plotsquared.core.plot.flag.PlotFlag;
import com.plotsquared.core.plot.flag.implementations.MusicFlag;
import com.sk89q.worldedit.world.item.ItemTypes; import com.sk89q.worldedit.world.item.ItemTypes;
import java.util.Arrays; import java.util.Arrays;

View File

@ -26,11 +26,11 @@
package com.plotsquared.core.command; package com.plotsquared.core.command;
import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.configuration.Captions;
import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.util.StringMan;
import com.plotsquared.core.util.task.RunnableVal2; import com.plotsquared.core.util.task.RunnableVal2;
import com.plotsquared.core.util.task.RunnableVal3; import com.plotsquared.core.util.task.RunnableVal3;
import com.plotsquared.core.util.StringMan;
import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletableFuture;
@ -45,7 +45,8 @@ public class Near extends Command {
super(MainCommand.getInstance(), true); super(MainCommand.getInstance(), true);
} }
@Override public CompletableFuture<Boolean> execute(PlotPlayer player, String[] args, @Override
public CompletableFuture<Boolean> execute(PlotPlayer player, String[] args,
RunnableVal3<Command, Runnable, Runnable> confirm, RunnableVal3<Command, Runnable, Runnable> confirm,
RunnableVal2<Command, CommandResult> whenDone) throws CommandException { RunnableVal2<Command, CommandResult> whenDone) throws CommandException {
final Plot plot = check(player.getCurrentPlot(), Captions.NOT_IN_PLOT); final Plot plot = check(player.getCurrentPlot(), Captions.NOT_IN_PLOT);

View File

@ -28,8 +28,8 @@ package com.plotsquared.core.command;
import com.plotsquared.core.PlotSquared; import com.plotsquared.core.PlotSquared;
import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.util.MainUtil; import com.plotsquared.core.util.MainUtil;
import com.plotsquared.core.util.task.TaskManager;
import com.plotsquared.core.util.PremiumVerification; import com.plotsquared.core.util.PremiumVerification;
import com.plotsquared.core.util.task.TaskManager;
@CommandDeclaration(command = "plugin", @CommandDeclaration(command = "plugin",
permission = "plots.use", permission = "plots.use",
@ -48,7 +48,8 @@ public class PluginCmd extends SubCommand {
"$2>> $1&lAuthors$2: $1Citymonstret $2& $1Empire92 $2& $1MattBDev $2& $1dordsor21 $2& $1NotMyFault $2& $1SirYwell"); "$2>> $1&lAuthors$2: $1Citymonstret $2& $1Empire92 $2& $1MattBDev $2& $1dordsor21 $2& $1NotMyFault $2& $1SirYwell");
MainUtil.sendMessage(player, MainUtil.sendMessage(player,
"$2>> $1&lWiki$2: $1https://github.com/IntellectualSites/PlotSquared/wiki"); "$2>> $1&lWiki$2: $1https://github.com/IntellectualSites/PlotSquared/wiki");
MainUtil.sendMessage(player, "$2>> $1&lPremium$2: $1" + PremiumVerification.isPremium()); MainUtil
.sendMessage(player, "$2>> $1&lPremium$2: $1" + PremiumVerification.isPremium());
}); });
return true; return true;
} }

View File

@ -29,10 +29,10 @@ import com.plotsquared.core.PlotSquared;
import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.configuration.Captions;
import com.plotsquared.core.database.DBFunc; import com.plotsquared.core.database.DBFunc;
import com.plotsquared.core.listener.PlotListener; import com.plotsquared.core.listener.PlotListener;
import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.plot.Plot; import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.plot.PlotArea; import com.plotsquared.core.plot.PlotArea;
import com.plotsquared.core.plot.PlotId; import com.plotsquared.core.plot.PlotId;
import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.util.StringMan; import com.plotsquared.core.util.StringMan;
import com.plotsquared.core.util.task.TaskManager; import com.plotsquared.core.util.task.TaskManager;
import com.plotsquared.core.util.uuid.UUIDHandler; import com.plotsquared.core.util.uuid.UUIDHandler;

View File

@ -30,13 +30,13 @@ import com.plotsquared.core.configuration.Captions;
import com.plotsquared.core.configuration.Settings; import com.plotsquared.core.configuration.Settings;
import com.plotsquared.core.database.DBFunc; import com.plotsquared.core.database.DBFunc;
import com.plotsquared.core.events.PlotRateEvent; import com.plotsquared.core.events.PlotRateEvent;
import com.plotsquared.core.plot.flag.implementations.DoneFlag; import com.plotsquared.core.events.TeleportCause;
import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.plot.Plot; import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.plot.PlotInventory; import com.plotsquared.core.plot.PlotInventory;
import com.plotsquared.core.plot.PlotItemStack; import com.plotsquared.core.plot.PlotItemStack;
import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.plot.Rating; import com.plotsquared.core.plot.Rating;
import com.plotsquared.core.events.TeleportCause; import com.plotsquared.core.plot.flag.implementations.DoneFlag;
import com.plotsquared.core.util.MainUtil; import com.plotsquared.core.util.MainUtil;
import com.plotsquared.core.util.MathMan; import com.plotsquared.core.util.MathMan;
import com.plotsquared.core.util.Permissions; import com.plotsquared.core.util.Permissions;
@ -84,7 +84,8 @@ public class Rate extends SubCommand {
if ((!Settings.Done.REQUIRED_FOR_RATINGS || DoneFlag.isDone(p)) && p if ((!Settings.Done.REQUIRED_FOR_RATINGS || DoneFlag.isDone(p)) && p
.isBasePlot() && (!p.getRatings().containsKey(uuid)) && !p .isBasePlot() && (!p.getRatings().containsKey(uuid)) && !p
.isAdded(uuid)) { .isAdded(uuid)) {
p.teleportPlayer(player, TeleportCause.COMMAND, result -> {}); p.teleportPlayer(player, TeleportCause.COMMAND, result -> {
});
MainUtil.sendMessage(player, Captions.RATE_THIS); MainUtil.sendMessage(player, Captions.RATE_THIS);
return true; return true;
} }
@ -140,8 +141,8 @@ public class Rate extends SubCommand {
index.increment(); index.increment();
if (index.getValue() >= Settings.Ratings.CATEGORIES.size()) { if (index.getValue() >= Settings.Ratings.CATEGORIES.size()) {
int rV = rating.getValue(); int rV = rating.getValue();
PlotRateEvent event = PlotRateEvent event = PlotSquared.get().getEventDispatcher()
PlotSquared.get().getEventDispatcher().callRating(this.player, plot, new Rating(rV)); .callRating(this.player, plot, new Rating(rV));
if (event.getRating() != null) { if (event.getRating() != null) {
plot.addRating(this.player.getUUID(), event.getRating()); plot.addRating(this.player.getUUID(), event.getRating());
sendMessage(this.player, Captions.RATING_APPLIED, sendMessage(this.player, Captions.RATING_APPLIED,
@ -209,7 +210,8 @@ public class Rate extends SubCommand {
sendMessage(player, Captions.RATING_ALREADY_EXISTS, plot.getId().toString()); sendMessage(player, Captions.RATING_ALREADY_EXISTS, plot.getId().toString());
return; return;
} }
PlotRateEvent event = PlotSquared.get().getEventDispatcher().callRating(player, plot, new Rating(rating)); PlotRateEvent event =
PlotSquared.get().getEventDispatcher().callRating(player, plot, new Rating(rating));
if (event.getRating() != null) { if (event.getRating() != null) {
plot.addRating(uuid, event.getRating()); plot.addRating(uuid, event.getRating());
sendMessage(player, Captions.RATING_APPLIED, plot.getId().toString()); sendMessage(player, Captions.RATING_APPLIED, plot.getId().toString());

View File

@ -29,9 +29,9 @@ import com.plotsquared.core.PlotSquared;
import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.configuration.Captions;
import com.plotsquared.core.generator.HybridPlotManager; import com.plotsquared.core.generator.HybridPlotManager;
import com.plotsquared.core.generator.HybridUtils; import com.plotsquared.core.generator.HybridUtils;
import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.plot.PlotArea; import com.plotsquared.core.plot.PlotArea;
import com.plotsquared.core.plot.PlotManager; import com.plotsquared.core.plot.PlotManager;
import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.util.MainUtil; import com.plotsquared.core.util.MainUtil;
@CommandDeclaration(command = "regenallroads", @CommandDeclaration(command = "regenallroads",

View File

@ -26,13 +26,13 @@
package com.plotsquared.core.command; package com.plotsquared.core.command;
import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.configuration.Captions;
import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.queue.LocalBlockQueue;
import com.plotsquared.core.util.ChunkManager;
import com.plotsquared.core.util.task.RunnableVal; import com.plotsquared.core.util.task.RunnableVal;
import com.plotsquared.core.util.task.RunnableVal2; import com.plotsquared.core.util.task.RunnableVal2;
import com.plotsquared.core.util.task.RunnableVal3; import com.plotsquared.core.util.task.RunnableVal3;
import com.plotsquared.core.util.ChunkManager;
import com.plotsquared.core.queue.LocalBlockQueue;
import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletableFuture;
@ -46,7 +46,8 @@ public class Relight extends Command {
super(MainCommand.getInstance(), true); super(MainCommand.getInstance(), true);
} }
@Override public CompletableFuture<Boolean> execute(final PlotPlayer player, String[] args, @Override
public CompletableFuture<Boolean> execute(final PlotPlayer player, String[] args,
RunnableVal3<Command, Runnable, Runnable> confirm, RunnableVal3<Command, Runnable, Runnable> confirm,
RunnableVal2<Command, CommandResult> whenDone) { RunnableVal2<Command, CommandResult> whenDone) {
final Plot plot = player.getCurrentPlot(); final Plot plot = player.getCurrentPlot();

View File

@ -25,13 +25,13 @@
*/ */
package com.plotsquared.core.command; package com.plotsquared.core.command;
import com.plotsquared.core.PlotSquared;
import com.plotsquared.core.configuration.Captions;
import com.plotsquared.core.configuration.ConfigurationSection; import com.plotsquared.core.configuration.ConfigurationSection;
import com.plotsquared.core.configuration.MemorySection; import com.plotsquared.core.configuration.MemorySection;
import com.plotsquared.core.configuration.file.YamlConfiguration; import com.plotsquared.core.configuration.file.YamlConfiguration;
import com.plotsquared.core.PlotSquared;
import com.plotsquared.core.configuration.Captions;
import com.plotsquared.core.plot.PlotAreaType;
import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.plot.PlotAreaType;
import com.plotsquared.core.util.MainUtil; import com.plotsquared.core.util.MainUtil;
import java.io.IOException; import java.io.IOException;
@ -52,8 +52,8 @@ public class Reload extends SubCommand {
PlotSquared.get().setupConfigs(); PlotSquared.get().setupConfigs();
Captions.load(PlotSquared.get().translationFile); Captions.load(PlotSquared.get().translationFile);
PlotSquared.get().forEachPlotArea(area -> { PlotSquared.get().forEachPlotArea(area -> {
ConfigurationSection worldSection = ConfigurationSection worldSection = PlotSquared.get().worlds
PlotSquared.get().worlds.getConfigurationSection("worlds." + area.getWorldName()); .getConfigurationSection("worlds." + area.getWorldName());
if (worldSection == null) { if (worldSection == null) {
return; return;
} }

View File

@ -29,8 +29,8 @@ import com.plotsquared.core.PlotSquared;
import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.configuration.Captions;
import com.plotsquared.core.database.DBFunc; import com.plotsquared.core.database.DBFunc;
import com.plotsquared.core.location.Location; import com.plotsquared.core.location.Location;
import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.util.MainUtil; import com.plotsquared.core.util.MainUtil;
import com.plotsquared.core.util.Permissions; import com.plotsquared.core.util.Permissions;
import com.plotsquared.core.util.uuid.UUIDHandler; import com.plotsquared.core.util.uuid.UUIDHandler;
@ -95,29 +95,34 @@ public class Remove extends SubCommand {
for (UUID uuid : uuids) { for (UUID uuid : uuids) {
if (plot.getTrusted().contains(uuid)) { if (plot.getTrusted().contains(uuid)) {
if (plot.removeTrusted(uuid)) { if (plot.removeTrusted(uuid)) {
PlotSquared PlotSquared.get().getEventDispatcher()
.get().getEventDispatcher().callTrusted(player, plot, uuid, false); .callTrusted(player, plot, uuid, false);
count++; count++;
} }
} else if (plot.getMembers().contains(uuid)) { } else if (plot.getMembers().contains(uuid)) {
if (plot.removeMember(uuid)) { if (plot.removeMember(uuid)) {
PlotSquared.get().getEventDispatcher().callMember(player, plot, uuid, false); PlotSquared.get().getEventDispatcher()
.callMember(player, plot, uuid, false);
count++; count++;
} }
} else if (plot.getDenied().contains(uuid)) { } else if (plot.getDenied().contains(uuid)) {
if (plot.removeDenied(uuid)) { if (plot.removeDenied(uuid)) {
PlotSquared.get().getEventDispatcher().callDenied(player, plot, uuid, false); PlotSquared.get().getEventDispatcher()
.callDenied(player, plot, uuid, false);
count++; count++;
} }
} else if (uuid == DBFunc.EVERYONE) { } else if (uuid == DBFunc.EVERYONE) {
if (plot.removeTrusted(uuid)) { if (plot.removeTrusted(uuid)) {
PlotSquared.get().getEventDispatcher().callTrusted(player, plot, uuid, false); PlotSquared.get().getEventDispatcher()
.callTrusted(player, plot, uuid, false);
count++; count++;
} else if (plot.removeMember(uuid)) { } else if (plot.removeMember(uuid)) {
PlotSquared.get().getEventDispatcher().callMember(player, plot, uuid, false); PlotSquared.get().getEventDispatcher()
.callMember(player, plot, uuid, false);
count++; count++;
} else if (plot.removeDenied(uuid)) { } else if (plot.removeDenied(uuid)) {
PlotSquared.get().getEventDispatcher().callDenied(player, plot, uuid, false); PlotSquared.get().getEventDispatcher()
.callDenied(player, plot, uuid, false);
count++; count++;
} }
} }

View File

@ -28,13 +28,13 @@ package com.plotsquared.core.command;
import com.plotsquared.core.PlotSquared; import com.plotsquared.core.PlotSquared;
import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.configuration.Captions;
import com.plotsquared.core.location.Location; import com.plotsquared.core.location.Location;
import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.plot.Plot; import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.plot.PlotId; import com.plotsquared.core.plot.PlotId;
import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.util.task.RunnableVal;
import com.plotsquared.core.util.MainUtil; import com.plotsquared.core.util.MainUtil;
import com.plotsquared.core.util.Permissions; import com.plotsquared.core.util.Permissions;
import com.plotsquared.core.util.SchematicHandler; import com.plotsquared.core.util.SchematicHandler;
import com.plotsquared.core.util.task.RunnableVal;
import com.plotsquared.core.util.task.TaskManager; import com.plotsquared.core.util.task.TaskManager;
import com.sk89q.jnbt.CompoundTag; import com.sk89q.jnbt.CompoundTag;

View File

@ -25,22 +25,22 @@
*/ */
package com.plotsquared.core.command; package com.plotsquared.core.command;
import com.google.common.collect.Lists;
import com.plotsquared.core.PlotSquared; import com.plotsquared.core.PlotSquared;
import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.configuration.Captions;
import com.plotsquared.core.configuration.Settings; import com.plotsquared.core.configuration.Settings;
import com.plotsquared.core.player.ConsolePlayer;
import com.plotsquared.core.location.Location; import com.plotsquared.core.location.Location;
import com.plotsquared.core.player.ConsolePlayer;
import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.plot.Plot; import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.plot.PlotArea; import com.plotsquared.core.plot.PlotArea;
import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.util.task.RunnableVal;
import com.plotsquared.core.plot.schematic.Schematic; import com.plotsquared.core.plot.schematic.Schematic;
import com.plotsquared.core.util.MainUtil; import com.plotsquared.core.util.MainUtil;
import com.plotsquared.core.util.Permissions; import com.plotsquared.core.util.Permissions;
import com.plotsquared.core.util.SchematicHandler; import com.plotsquared.core.util.SchematicHandler;
import com.plotsquared.core.util.StringMan; import com.plotsquared.core.util.StringMan;
import com.plotsquared.core.util.task.RunnableVal;
import com.plotsquared.core.util.task.TaskManager; import com.plotsquared.core.util.task.TaskManager;
import com.google.common.collect.Lists;
import java.net.URL; import java.net.URL;
import java.util.ArrayList; import java.util.ArrayList;

View File

@ -27,14 +27,14 @@ package com.plotsquared.core.command;
import com.plotsquared.core.configuration.CaptionUtility; import com.plotsquared.core.configuration.CaptionUtility;
import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.configuration.Captions;
import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.plot.Plot; import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.plot.PlotManager; import com.plotsquared.core.plot.PlotManager;
import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.queue.GlobalBlockQueue;
import com.plotsquared.core.util.MainUtil; import com.plotsquared.core.util.MainUtil;
import com.plotsquared.core.util.PatternUtil;
import com.plotsquared.core.util.Permissions; import com.plotsquared.core.util.Permissions;
import com.plotsquared.core.util.StringMan; import com.plotsquared.core.util.StringMan;
import com.plotsquared.core.queue.GlobalBlockQueue;
import com.plotsquared.core.util.PatternUtil;
import com.sk89q.worldedit.function.pattern.Pattern; import com.sk89q.worldedit.function.pattern.Pattern;
import java.util.ArrayList; import java.util.ArrayList;

View File

@ -28,8 +28,8 @@ package com.plotsquared.core.command;
import com.plotsquared.core.configuration.CaptionUtility; import com.plotsquared.core.configuration.CaptionUtility;
import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.configuration.Captions;
import com.plotsquared.core.location.Location; import com.plotsquared.core.location.Location;
import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.util.MainUtil; import com.plotsquared.core.util.MainUtil;
import com.plotsquared.core.util.Permissions; import com.plotsquared.core.util.Permissions;
import com.plotsquared.core.util.StringMan; import com.plotsquared.core.util.StringMan;

View File

@ -28,8 +28,8 @@ package com.plotsquared.core.command;
import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.configuration.Captions;
import com.plotsquared.core.location.BlockLoc; import com.plotsquared.core.location.BlockLoc;
import com.plotsquared.core.location.Location; import com.plotsquared.core.location.Location;
import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.util.MainUtil; import com.plotsquared.core.util.MainUtil;
@CommandDeclaration(command = "sethome", @CommandDeclaration(command = "sethome",

View File

@ -27,17 +27,17 @@ package com.plotsquared.core.command;
import com.plotsquared.core.PlotSquared; import com.plotsquared.core.PlotSquared;
import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.configuration.Captions;
import com.plotsquared.core.configuration.ConfigurationUtil;
import com.plotsquared.core.configuration.ConfigurationNode; import com.plotsquared.core.configuration.ConfigurationNode;
import com.plotsquared.core.configuration.ConfigurationUtil;
import com.plotsquared.core.events.TeleportCause;
import com.plotsquared.core.generator.GeneratorWrapper; import com.plotsquared.core.generator.GeneratorWrapper;
import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.plot.PlotArea; import com.plotsquared.core.plot.PlotArea;
import com.plotsquared.core.plot.PlotAreaTerrainType; import com.plotsquared.core.plot.PlotAreaTerrainType;
import com.plotsquared.core.plot.PlotAreaType; import com.plotsquared.core.plot.PlotAreaType;
import com.plotsquared.core.plot.PlotId; import com.plotsquared.core.plot.PlotId;
import com.plotsquared.core.plot.message.PlotMessage;
import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.plot.SetupObject; import com.plotsquared.core.plot.SetupObject;
import com.plotsquared.core.events.TeleportCause; import com.plotsquared.core.plot.message.PlotMessage;
import com.plotsquared.core.util.MainUtil; import com.plotsquared.core.util.MainUtil;
import com.plotsquared.core.util.SetupUtils; import com.plotsquared.core.util.SetupUtils;
import com.plotsquared.core.util.StringMan; import com.plotsquared.core.util.StringMan;
@ -152,7 +152,8 @@ public class Setup extends SubCommand {
types.add("augmented"); types.add("augmented");
types.add("partial"); types.add("partial");
Optional<PlotAreaType> plotAreaType; Optional<PlotAreaType> plotAreaType;
if (args.length != 1 || !(plotAreaType = PlotAreaType.fromString(args[0])).isPresent()) { if (args.length != 1 || !(plotAreaType = PlotAreaType.fromString(args[0]))
.isPresent()) {
MainUtil.sendMessage(player, "&cYou must choose a world type!"); MainUtil.sendMessage(player, "&cYou must choose a world type!");
for (String type : types) { for (String type : types) {
int i = allTypes.indexOf(type); int i = allTypes.indexOf(type);
@ -272,7 +273,8 @@ public class Setup extends SubCommand {
break; break;
case 5: { // Choose terrain case 5: { // Choose terrain
Optional<PlotAreaTerrainType> optTerrain; Optional<PlotAreaTerrainType> optTerrain;
if (args.length != 1 || !(optTerrain = PlotAreaTerrainType.fromString(args[0])).isPresent()) { if (args.length != 1 || !(optTerrain = PlotAreaTerrainType.fromString(args[0]))
.isPresent()) {
MainUtil.sendMessage(player, MainUtil.sendMessage(player,
"&cYou must choose the terrain!" + "\n&8 - &2NONE&8 - &7No terrain at all" "&cYou must choose the terrain!" + "\n&8 - &2NONE&8 - &7No terrain at all"
+ "\n&8 - &7ORE&8 - &7Just some ore veins and trees" + "\n&8 - &7ORE&8 - &7Just some ore veins and trees"

View File

@ -53,7 +53,8 @@ public abstract class SubCommand extends Command {
return true; return true;
} }
@Override public CompletableFuture<Boolean> execute(PlotPlayer player, String[] args, @Override
public CompletableFuture<Boolean> execute(PlotPlayer player, String[] args,
RunnableVal3<Command, Runnable, Runnable> confirm, RunnableVal3<Command, Runnable, Runnable> confirm,
RunnableVal2<Command, CommandResult> whenDone) { RunnableVal2<Command, CommandResult> whenDone) {
return CompletableFuture.completedFuture(onCommand(player, args)); return CompletableFuture.completedFuture(onCommand(player, args));

View File

@ -27,12 +27,12 @@ package com.plotsquared.core.command;
import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.configuration.Captions;
import com.plotsquared.core.location.Location; import com.plotsquared.core.location.Location;
import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.util.task.RunnableVal2; import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.util.task.RunnableVal3;
import com.plotsquared.core.util.MainUtil; import com.plotsquared.core.util.MainUtil;
import com.plotsquared.core.util.Permissions; import com.plotsquared.core.util.Permissions;
import com.plotsquared.core.util.task.RunnableVal2;
import com.plotsquared.core.util.task.RunnableVal3;
import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletableFuture;
@ -44,13 +44,15 @@ import java.util.concurrent.CompletableFuture;
requiredType = RequiredType.PLAYER) requiredType = RequiredType.PLAYER)
public class Swap extends SubCommand { public class Swap extends SubCommand {
@Override public CompletableFuture<Boolean> execute(PlotPlayer player, String[] args, @Override
public CompletableFuture<Boolean> execute(PlotPlayer player, String[] args,
RunnableVal3<Command, Runnable, Runnable> confirm, RunnableVal3<Command, Runnable, Runnable> confirm,
RunnableVal2<Command, CommandResult> whenDone) { RunnableVal2<Command, CommandResult> whenDone) {
Location location = player.getLocation(); Location location = player.getLocation();
Plot plot1 = location.getPlotAbs(); Plot plot1 = location.getPlotAbs();
if (plot1 == null) { if (plot1 == null) {
return CompletableFuture.completedFuture(!MainUtil.sendMessage(player, Captions.NOT_IN_PLOT)); return CompletableFuture
.completedFuture(!MainUtil.sendMessage(player, Captions.NOT_IN_PLOT));
} }
if (!plot1.isOwner(player.getUUID()) && !Permissions if (!plot1.isOwner(player.getUUID()) && !Permissions
.hasPermission(player, Captions.PERMISSION_ADMIN.getTranslated())) { .hasPermission(player, Captions.PERMISSION_ADMIN.getTranslated())) {
@ -79,16 +81,16 @@ public class Swap extends SubCommand {
return CompletableFuture.completedFuture(false); return CompletableFuture.completedFuture(false);
} }
return plot1.move(plot2, () -> {}, true) return plot1.move(plot2, () -> {
.thenApply(result -> { }, true).thenApply(result -> {
if (result) { if (result) {
MainUtil.sendMessage(player, Captions.SWAP_SUCCESS); MainUtil.sendMessage(player, Captions.SWAP_SUCCESS);
return true; return true;
} else { } else {
MainUtil.sendMessage(player, Captions.SWAP_OVERLAP); MainUtil.sendMessage(player, Captions.SWAP_OVERLAP);
return false; return false;
} }
}); });
} }
@Override public boolean onCommand(final PlotPlayer player, String[] args) { @Override public boolean onCommand(final PlotPlayer player, String[] args) {

View File

@ -28,8 +28,8 @@ package com.plotsquared.core.command;
import com.plotsquared.core.PlotSquared; import com.plotsquared.core.PlotSquared;
import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.configuration.Captions;
import com.plotsquared.core.location.Location; import com.plotsquared.core.location.Location;
import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.util.MainUtil; import com.plotsquared.core.util.MainUtil;
import com.plotsquared.core.util.StringMan; import com.plotsquared.core.util.StringMan;

View File

@ -25,24 +25,24 @@
*/ */
package com.plotsquared.core.command; package com.plotsquared.core.command;
import com.plotsquared.core.configuration.ConfigurationSection;
import com.plotsquared.core.configuration.InvalidConfigurationException;
import com.plotsquared.core.configuration.file.YamlConfiguration;
import com.plotsquared.core.PlotSquared; import com.plotsquared.core.PlotSquared;
import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.configuration.Captions;
import com.plotsquared.core.configuration.ConfigurationNode; import com.plotsquared.core.configuration.ConfigurationNode;
import com.plotsquared.core.configuration.ConfigurationSection;
import com.plotsquared.core.configuration.InvalidConfigurationException;
import com.plotsquared.core.configuration.Settings; import com.plotsquared.core.configuration.Settings;
import com.plotsquared.core.util.FileBytes; import com.plotsquared.core.configuration.file.YamlConfiguration;
import com.plotsquared.core.events.TeleportCause;
import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.plot.PlotArea; import com.plotsquared.core.plot.PlotArea;
import com.plotsquared.core.plot.PlotManager; import com.plotsquared.core.plot.PlotManager;
import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.plot.SetupObject; import com.plotsquared.core.plot.SetupObject;
import com.plotsquared.core.events.TeleportCause; import com.plotsquared.core.queue.GlobalBlockQueue;
import com.plotsquared.core.util.FileBytes;
import com.plotsquared.core.util.MainUtil; import com.plotsquared.core.util.MainUtil;
import com.plotsquared.core.util.SetupUtils; import com.plotsquared.core.util.SetupUtils;
import com.plotsquared.core.util.task.TaskManager;
import com.plotsquared.core.util.WorldUtil; import com.plotsquared.core.util.WorldUtil;
import com.plotsquared.core.queue.GlobalBlockQueue; import com.plotsquared.core.util.task.TaskManager;
import java.io.File; import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;

View File

@ -27,9 +27,9 @@ package com.plotsquared.core.command;
import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.configuration.Captions;
import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.util.MainUtil;
import com.plotsquared.core.util.task.RunnableVal2; import com.plotsquared.core.util.task.RunnableVal2;
import com.plotsquared.core.util.task.RunnableVal3; import com.plotsquared.core.util.task.RunnableVal3;
import com.plotsquared.core.util.MainUtil;
@CommandDeclaration(command = "toggle", @CommandDeclaration(command = "toggle",
aliases = {"attribute"}, aliases = {"attribute"},

View File

@ -28,18 +28,18 @@ package com.plotsquared.core.command;
import com.plotsquared.core.PlotSquared; import com.plotsquared.core.PlotSquared;
import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.configuration.Captions;
import com.plotsquared.core.location.Location; import com.plotsquared.core.location.Location;
import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.util.task.RunnableVal; import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.util.task.RunnableVal2; import com.plotsquared.core.plot.expiration.ExpireManager;
import com.plotsquared.core.util.ChunkManager;
import com.plotsquared.core.util.MainUtil;
import com.plotsquared.core.util.task.TaskManager;
import com.plotsquared.core.util.WorldUtil;
import com.plotsquared.core.queue.GlobalBlockQueue; import com.plotsquared.core.queue.GlobalBlockQueue;
import com.plotsquared.core.queue.LocalBlockQueue; import com.plotsquared.core.queue.LocalBlockQueue;
import com.plotsquared.core.plot.expiration.ExpireManager; import com.plotsquared.core.util.ChunkManager;
import com.plotsquared.core.util.MainUtil;
import com.plotsquared.core.util.RegionUtil; import com.plotsquared.core.util.RegionUtil;
import com.plotsquared.core.util.WorldUtil;
import com.plotsquared.core.util.task.RunnableVal;
import com.plotsquared.core.util.task.RunnableVal2;
import com.plotsquared.core.util.task.TaskManager;
import com.sk89q.worldedit.math.BlockVector2; import com.sk89q.worldedit.math.BlockVector2;
import com.sk89q.worldedit.regions.CuboidRegion; import com.sk89q.worldedit.regions.CuboidRegion;

View File

@ -28,12 +28,12 @@ package com.plotsquared.core.command;
import com.plotsquared.core.PlotSquared; import com.plotsquared.core.PlotSquared;
import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.configuration.Captions;
import com.plotsquared.core.database.DBFunc; import com.plotsquared.core.database.DBFunc;
import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.util.task.RunnableVal2; import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.util.task.RunnableVal3;
import com.plotsquared.core.util.MainUtil; import com.plotsquared.core.util.MainUtil;
import com.plotsquared.core.util.Permissions; import com.plotsquared.core.util.Permissions;
import com.plotsquared.core.util.task.RunnableVal2;
import com.plotsquared.core.util.task.RunnableVal3;
import java.util.Iterator; import java.util.Iterator;
import java.util.Set; import java.util.Set;
@ -52,7 +52,8 @@ public class Trust extends Command {
super(MainCommand.getInstance(), true); super(MainCommand.getInstance(), true);
} }
@Override public CompletableFuture<Boolean> execute(final PlotPlayer player, String[] args, @Override
public CompletableFuture<Boolean> execute(final PlotPlayer player, String[] args,
RunnableVal3<Command, Runnable, Runnable> confirm, RunnableVal3<Command, Runnable, Runnable> confirm,
RunnableVal2<Command, CommandResult> whenDone) throws CommandException { RunnableVal2<Command, CommandResult> whenDone) throws CommandException {
final Plot currentPlot = player.getCurrentPlot(); final Plot currentPlot = player.getCurrentPlot();

View File

@ -30,8 +30,8 @@ import com.plotsquared.core.configuration.Captions;
import com.plotsquared.core.events.PlotUnlinkEvent; import com.plotsquared.core.events.PlotUnlinkEvent;
import com.plotsquared.core.events.Result; import com.plotsquared.core.events.Result;
import com.plotsquared.core.location.Location; import com.plotsquared.core.location.Location;
import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.util.MainUtil; import com.plotsquared.core.util.MainUtil;
import com.plotsquared.core.util.Permissions; import com.plotsquared.core.util.Permissions;
import com.plotsquared.core.util.StringMan; import com.plotsquared.core.util.StringMan;

View File

@ -28,16 +28,16 @@ package com.plotsquared.core.command;
import com.plotsquared.core.PlotSquared; import com.plotsquared.core.PlotSquared;
import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.configuration.Captions;
import com.plotsquared.core.configuration.Settings; import com.plotsquared.core.configuration.Settings;
import com.plotsquared.core.plot.flag.implementations.UntrustedVisitFlag; import com.plotsquared.core.events.TeleportCause;
import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.plot.Plot; import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.plot.PlotArea; import com.plotsquared.core.plot.PlotArea;
import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.plot.flag.implementations.UntrustedVisitFlag;
import com.plotsquared.core.util.task.RunnableVal2;
import com.plotsquared.core.util.task.RunnableVal3;
import com.plotsquared.core.events.TeleportCause;
import com.plotsquared.core.util.MainUtil; import com.plotsquared.core.util.MainUtil;
import com.plotsquared.core.util.MathMan; import com.plotsquared.core.util.MathMan;
import com.plotsquared.core.util.Permissions; import com.plotsquared.core.util.Permissions;
import com.plotsquared.core.util.task.RunnableVal2;
import com.plotsquared.core.util.task.RunnableVal3;
import com.plotsquared.core.util.uuid.UUIDHandler; import com.plotsquared.core.util.uuid.UUIDHandler;
import java.util.ArrayList; import java.util.ArrayList;
@ -64,7 +64,8 @@ public class Visit extends Command {
return tabOf(player, args, space, getUsage()); return tabOf(player, args, space, getUsage());
} }
@Override public CompletableFuture<Boolean> execute(final PlotPlayer player, String[] args, @Override
public CompletableFuture<Boolean> execute(final PlotPlayer player, String[] args,
RunnableVal3<Command, Runnable, Runnable> confirm, RunnableVal3<Command, Runnable, Runnable> confirm,
final RunnableVal2<Command, CommandResult> whenDone) throws CommandException { final RunnableVal2<Command, CommandResult> whenDone) throws CommandException {
if (args.length == 1 && args[0].contains(":")) { if (args.length == 1 && args[0].contains(":")) {
@ -170,14 +171,13 @@ public class Visit extends Command {
Captions.NO_PERMISSION.send(player, Captions.PERMISSION_VISIT_OTHER); Captions.NO_PERMISSION.send(player, Captions.PERMISSION_VISIT_OTHER);
return CompletableFuture.completedFuture(false); return CompletableFuture.completedFuture(false);
} }
if (!plot.getFlag(UntrustedVisitFlag.class) && if (!plot.getFlag(UntrustedVisitFlag.class) && !Permissions
!Permissions.hasPermission(player, Captions.PERMISSION_ADMIN_VISIT_UNTRUSTED)) { .hasPermission(player, Captions.PERMISSION_ADMIN_VISIT_UNTRUSTED)) {
Captions.NO_PERMISSION.send(player, Captions.PERMISSION_ADMIN_VISIT_UNTRUSTED); Captions.NO_PERMISSION.send(player, Captions.PERMISSION_ADMIN_VISIT_UNTRUSTED);
return CompletableFuture.completedFuture(false); return CompletableFuture.completedFuture(false);
} }
} }
confirm.run(this, () -> confirm.run(this, () -> plot.teleportPlayer(player, TeleportCause.COMMAND, result -> {
plot.teleportPlayer(player, TeleportCause.COMMAND, result -> {
if (result) { if (result) {
whenDone.run(Visit.this, CommandResult.SUCCESS); whenDone.run(Visit.this, CommandResult.SUCCESS);
} else { } else {

Some files were not shown because too many files have changed in this diff Show More