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 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,
@ -106,8 +107,10 @@ public class BukkitChunkManager extends ChunkManager {
LocalBlockQueue queue1 = GlobalBlockQueue.IMP.getNewQueue(worldName1, 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 z = Math.max(r1.getMinimumPoint().getZ(), sz); z <= Math.min(r1.getMaximumPoint().getZ(), sz + 15); z++) {
for (int x = Math.max(r1.getMinimumPoint().getX(), sx);
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++) {
Block block1 = world1.getBlockAt(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.");
semaphore.acquire();
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);
chunks.add(loc);
}
@ -249,7 +253,8 @@ public class BukkitChunkManager extends ChunkManager {
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 int relX = newPos.getX() - pos1.getX();
final int relZ = newPos.getZ() - pos1.getZ();
@ -303,7 +308,8 @@ public class BukkitChunkManager extends ChunkManager {
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 String world = pos1.getWorld();
@ -341,7 +347,8 @@ public class BukkitChunkManager extends ChunkManager {
if (chunkObj == null) {
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) {
AugmentedUtils.bypass(ignoreAugment,
() -> queue.regenChunkSafe(chunk.getX(), chunk.getZ()));
@ -406,11 +413,11 @@ public class BukkitChunkManager extends ChunkManager {
if (checkX2 && checkZ2) {
map.saveRegion(bukkitWorldObj, xxt2, xxt, zzt2, zzt); //
}
CuboidRegion currentPlotClear =
RegionUtil.createRegion(pos1.getX(), pos2.getX(), pos1.getZ(), pos2.getZ());
CuboidRegion currentPlotClear = RegionUtil
.createRegion(pos1.getX(), pos2.getX(), pos1.getZ(), pos2.getZ());
map.saveEntitiesOut(chunkObj, currentPlotClear);
AugmentedUtils.bypass(ignoreAugment,
() -> setChunkInPlotArea(null, new RunnableVal<ScopedLocalBlockQueue>() {
AugmentedUtils.bypass(ignoreAugment, () -> setChunkInPlotArea(null,
new RunnableVal<ScopedLocalBlockQueue>() {
@Override public void run(ScopedLocalBlockQueue value) {
Location min = value.getMin();
int bx = min.getX();
@ -420,12 +427,14 @@ public class BukkitChunkManager extends ChunkManager {
PlotLoc plotLoc = new PlotLoc(bx + x1, bz + z1);
BaseBlock[] ids = map.allBlocks.get(plotLoc);
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];
if (id != null) {
value.setBlock(x1, y, z1, id);
} 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);
@ -454,15 +463,17 @@ public class BukkitChunkManager extends ChunkManager {
return true;
}
@Override public CompletableFuture<?> loadChunk(String world, BlockVector2 chunkLoc, boolean force) {
return PaperLib.getChunkAtAsync(BukkitUtil.getWorld(world),chunkLoc.getX(), chunkLoc.getZ(), force);
@Override
public CompletableFuture<?> loadChunk(String world, BlockVector2 chunkLoc, boolean force) {
return PaperLib
.getChunkAtAsync(BukkitUtil.getWorld(world), chunkLoc.getX(), chunkLoc.getZ(), force);
}
@Override
public void unloadChunk(final String world, final BlockVector2 chunkLoc, final boolean save) {
if (!PlotSquared.get().isMainThread(Thread.currentThread())) {
TaskManager.runTask(
() -> BukkitUtil.getWorld(world).unloadChunk(chunkLoc.getX(), chunkLoc.getZ(), save));
TaskManager.runTask(() -> BukkitUtil.getWorld(world)
.unloadChunk(chunkLoc.getX(), chunkLoc.getZ(), save));
} else {
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) {
CuboidRegion region1 =
RegionUtil.createRegion(bot1.getX(), top1.getX(), bot1.getZ(), top1.getZ());
@ -525,13 +537,11 @@ public class BukkitChunkManager extends ChunkManager {
if (EntityCategories.PLAYER.contains(entityType)) {
return;
} else if (EntityCategories.PROJECTILE.contains(entityType) ||
EntityCategories.OTHER.contains(entityType) ||
EntityCategories.HANGING.contains(entityType)) {
} else if (EntityCategories.PROJECTILE.contains(entityType) || EntityCategories.OTHER
.contains(entityType) || EntityCategories.HANGING.contains(entityType)) {
count[CAP_MISC]++;
} else if (EntityCategories.ANIMAL.contains(entityType) ||
EntityCategories.VILLAGER.contains(entityType) ||
EntityCategories.TAMEABLE.contains(entityType)) {
} else if (EntityCategories.ANIMAL.contains(entityType) || EntityCategories.VILLAGER
.contains(entityType) || EntityCategories.TAMEABLE.contains(entityType)) {
count[CAP_MOB]++;
count[CAP_ANIMAL]++;
} else if (EntityCategories.VEHICLE.contains(entityType)) {

View File

@ -74,7 +74,8 @@ public class BukkitCommand implements CommandExecutor, TabCompleter {
if (args.length == 0) {
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) {
return null;
}

View File

@ -25,6 +25,7 @@
*/
package com.plotsquared.bukkit;
import com.plotsquared.bukkit.generator.BukkitHybridUtils;
import com.plotsquared.bukkit.generator.BukkitPlotGenerator;
import com.plotsquared.bukkit.listener.ChunkListener;
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.placeholder.PlaceholderFormatter;
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.BukkitEconHandler;
import com.plotsquared.bukkit.generator.BukkitHybridUtils;
import com.plotsquared.bukkit.util.BukkitInventoryUtil;
import com.plotsquared.bukkit.schematic.BukkitSchematicHandler;
import com.plotsquared.bukkit.util.BukkitSetupUtils;
import com.plotsquared.bukkit.util.BukkitTaskManager;
import com.plotsquared.bukkit.util.BukkitUtil;
import com.plotsquared.bukkit.util.SetGenCB;
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.FileUUIDHandler;
import com.plotsquared.bukkit.util.uuid.LowerOfflineUUIDWrapper;
import com.plotsquared.bukkit.util.uuid.OfflineUUIDWrapper;
import com.plotsquared.bukkit.util.uuid.SQLUUIDHandler;
import com.plotsquared.core.configuration.*;
import com.plotsquared.core.IPlotMain;
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.HybridGen;
import com.plotsquared.core.generator.HybridUtils;
import com.plotsquared.core.generator.IndependentPlotGenerator;
import com.plotsquared.core.generator.SingleWorldGenerator;
import com.plotsquared.core.listener.PlotListener;
import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.plot.PlotArea;
import com.plotsquared.core.plot.PlotAreaTerrainType;
import com.plotsquared.core.plot.PlotAreaType;
import com.plotsquared.core.plot.PlotId;
import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.plot.SetupObject;
import com.plotsquared.core.plot.message.PlainChatManager;
import com.plotsquared.core.plot.world.PlotAreaManager;
import com.plotsquared.core.plot.world.SinglePlotArea;
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.ChunkManager;
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.SetupUtils;
import com.plotsquared.core.util.StringMan;
import com.plotsquared.core.util.WorldUtil;
import com.plotsquared.core.util.task.TaskManager;
import com.plotsquared.core.util.uuid.UUIDHandler;
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.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.bukkit.WorldEditPlugin;
@ -123,7 +127,9 @@ import java.util.List;
import java.util.Map;
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;
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()) {
PlotSquared.log(Captions.PREFIX + "&6PlotSquared version licensed to Spigot user " + getUserID());
PlotSquared.log(Captions.PREFIX + "&6https://www.spigotmc.org/resources/" + getResourceID());
PlotSquared.log(
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 + "&6Thanks for supporting us :)");
} else {
@ -206,7 +214,8 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
}
PlotSquared.log(Captions.PREFIX + "&6PlotSquared hooked into PlaceholderAPI");
} 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();
@ -409,8 +418,8 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
case MINECART_TNT:
case BOAT:
if (Settings.Enabled_Components.KILL_ROAD_VEHICLES) {
com.plotsquared.core.location.Location
location = BukkitUtil.getLocation(entity.getLocation());
com.plotsquared.core.location.Location location =
BukkitUtil.getLocation(entity.getLocation());
Plot plot = location.getPlot();
if (plot == null) {
if (location.isPlotArea()) {
@ -466,8 +475,8 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
PlotId originalPlotId = (PlotId) meta.get(0).value();
if (originalPlotId != null) {
com.plotsquared.core.location.Location
pLoc = BukkitUtil.getLocation(entity.getLocation());
com.plotsquared.core.location.Location pLoc =
BukkitUtil.getLocation(entity.getLocation());
PlotArea area = pLoc.getPlotArea();
if (area != null) {
PlotId currentPlotId = PlotId.of(area.getPlotAbs(pLoc));
@ -485,13 +494,14 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
}
} else {
//This is to apply the metadata to already spawned shulkers (see EntitySpawnListener.java)
com.plotsquared.core.location.Location
pLoc = BukkitUtil.getLocation(entity.getLocation());
com.plotsquared.core.location.Location pLoc =
BukkitUtil.getLocation(entity.getLocation());
PlotArea area = pLoc.getPlotArea();
if (area != null) {
PlotId currentPlotId = PlotId.of(area.getPlotAbs(pLoc));
if (currentPlotId != null) {
entity.setMetadata("shulkerPlot", new FixedMetadataValue(
entity.setMetadata("shulkerPlot",
new FixedMetadataValue(
(Plugin) PlotSquared.get().IMP, currentPlotId));
}
}
@ -668,7 +678,8 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
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) {
if (name == null) {
return null;
@ -709,7 +720,8 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
map.put(plotAreaType.name().toLowerCase(), terrainTypes);
}
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.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) {
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() {
List<Map.Entry<Map.Entry<String, String>, Boolean>> names = new ArrayList<>();
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()));
}
return names;
@ -863,7 +877,8 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
@Override public Actor getConsole() {
@NotNull ConsoleCommandSender console = Bukkit.getServer().getConsoleSender();
WorldEditPlugin wePlugin = ((WorldEditPlugin) Bukkit.getPluginManager().getPlugin("WorldEdit"));
WorldEditPlugin wePlugin =
((WorldEditPlugin) Bukkit.getPluginManager().getPlugin("WorldEdit"));
return wePlugin.wrapCommandSender(console);
}
}

View File

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

View File

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

View File

@ -32,12 +32,13 @@ import com.plotsquared.core.plot.PlotArea;
import com.plotsquared.core.queue.GlobalBlockQueue;
import com.plotsquared.core.queue.LocalBlockQueue;
import com.plotsquared.core.queue.ScopedLocalBlockQueue;
import java.util.Random;
import org.bukkit.Chunk;
import org.bukkit.World;
import org.bukkit.generator.BlockPopulator;
import org.jetbrains.annotations.NotNull;
import java.util.Random;
final class BlockStatePopulator extends BlockPopulator {
private final IndependentPlotGenerator plotGenerator;
@ -47,13 +48,15 @@ final class BlockStatePopulator extends BlockPopulator {
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) {
if (this.queue == null) {
this.queue = GlobalBlockQueue.IMP.getNewQueue(world.getName(), false);
}
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);
if (this.plotGenerator.populateChunk(chunk, area)) {
this.queue.flush();

View File

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

View File

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

View File

@ -57,7 +57,8 @@ import java.util.HashSet;
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 RefField mustSave;
@ -291,11 +292,15 @@ import static com.plotsquared.core.util.ReflectionUtils.getRefClass;
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 (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);
return true;
}

View File

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

View File

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

View File

@ -26,9 +26,6 @@
package com.plotsquared.bukkit.listener;
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.util.BukkitUtil;
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.Settings;
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.AnimalCapFlag;
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.VineGrowFlag;
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.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.MainUtil;
import com.plotsquared.core.util.MathMan;
import com.plotsquared.core.util.Permissions;
import com.plotsquared.core.util.PremiumVerification;
import com.plotsquared.core.util.RegExUtil;
import com.plotsquared.core.util.StringWrapper;
import com.plotsquared.core.util.entity.EntityCategories;
import com.plotsquared.core.util.task.TaskManager;
import com.plotsquared.core.util.uuid.UUIDHandler;
@ -209,12 +206,7 @@ import org.bukkit.projectiles.BlockProjectileSource;
import org.bukkit.projectiles.ProjectileSource;
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.net.URL;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
@ -275,31 +267,32 @@ public class PlayerEvents extends PlotListener implements Listener {
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)) {
return false;
}
if (EntityCategories.PROJECTILE.contains(entityType) ||
EntityCategories.OTHER.contains(entityType) ||
EntityCategories.HANGING.contains(entityType)) {
if (EntityCategories.PROJECTILE.contains(entityType) || EntityCategories.OTHER
.contains(entityType) || EntityCategories.HANGING.contains(entityType)) {
return EntityUtil.checkEntity(plot, EntityCapFlag.ENTITY_CAP_UNLIMITED,
MiscCapFlag.MISC_CAP_UNLIMITED);
}
// Has to go go before vehicle as horses are both
// animals and vehicles
if (EntityCategories.ANIMAL.contains(entityType) ||
EntityCategories.VILLAGER.contains(entityType) ||
EntityCategories.TAMEABLE.contains(entityType)) {
return EntityUtil.checkEntity(plot, EntityCapFlag.ENTITY_CAP_UNLIMITED,
MobCapFlag.MOB_CAP_UNLIMITED, AnimalCapFlag.ANIMAL_CAP_UNLIMITED);
if (EntityCategories.ANIMAL.contains(entityType) || EntityCategories.VILLAGER
.contains(entityType) || EntityCategories.TAMEABLE.contains(entityType)) {
return EntityUtil
.checkEntity(plot, EntityCapFlag.ENTITY_CAP_UNLIMITED, MobCapFlag.MOB_CAP_UNLIMITED,
AnimalCapFlag.ANIMAL_CAP_UNLIMITED);
}
if (EntityCategories.HOSTILE.contains(entityType)) {
return EntityUtil.checkEntity(plot, EntityCapFlag.ENTITY_CAP_UNLIMITED,
MobCapFlag.MOB_CAP_UNLIMITED, HostileCapFlag.HOSTILE_CAP_UNLIMITED);
return EntityUtil
.checkEntity(plot, EntityCapFlag.ENTITY_CAP_UNLIMITED, MobCapFlag.MOB_CAP_UNLIMITED,
HostileCapFlag.HOSTILE_CAP_UNLIMITED);
}
if (EntityCategories.VEHICLE.contains(entityType)) {
@ -763,10 +756,12 @@ public class PlayerEvents extends PlotListener implements Listener {
}
}
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
// 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");
Plot toPlot = BukkitUtil.getLocation(to).getPlot();
if (!meta.isEmpty()) {
@ -930,7 +925,8 @@ public class PlayerEvents extends PlotListener implements Listener {
|| area.isForcingPlotChat())) {
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;
}
event.setCancelled(true);
@ -990,9 +986,8 @@ public class PlayerEvents extends PlotListener implements Listener {
event.setCancelled(true);
return;
}
} else if (
(location.getY() > area.getMaxBuildHeight() || location.getY() < area.getMinBuildHeight())
&& !Permissions
} else if ((location.getY() > area.getMaxBuildHeight() || location.getY() < area
.getMinBuildHeight()) && !Permissions
.hasPermission(plotPlayer, Captions.PERMISSION_ADMIN_BUILD_HEIGHT_LIMIT)) {
event.setCancelled(true);
MainUtil.sendMessage(plotPlayer, Captions.HEIGHT_LIMIT.getTranslated()
@ -2501,13 +2496,16 @@ public class PlayerEvents extends PlotListener implements Listener {
}
} else if (!plot.isAdded(pp.getUUID())) {
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;
}
if (EntityCategories.ANIMAL.contains(entityType) && plot.getFlag(AnimalInteractFlag.class)) {
if (EntityCategories.ANIMAL.contains(entityType) && plot
.getFlag(AnimalInteractFlag.class)) {
return;
}
@ -2518,20 +2516,23 @@ public class PlayerEvents extends PlotListener implements Listener {
return;
}
if (EntityCategories.VEHICLE.contains(entityType) && plot.getFlag(VehicleUseFlag.class)) {
if (EntityCategories.VEHICLE.contains(entityType) && plot
.getFlag(VehicleUseFlag.class)) {
return;
}
if (EntityCategories.PLAYER.contains(entityType) && plot.getFlag(PlayerInteractFlag.class)) {
if (EntityCategories.PLAYER.contains(entityType) && plot
.getFlag(PlayerInteractFlag.class)) {
return;
}
if (EntityCategories.VILLAGER.contains(entityType) && plot.getFlag(VillagerInteractFlag.class)) {
if (EntityCategories.VILLAGER.contains(entityType) && plot
.getFlag(VillagerInteractFlag.class)) {
return;
}
if ((EntityCategories.HANGING.contains(entityType) ||
EntityCategories.OTHER.contains(entityType)) && plot.getFlag(MiscInteractFlag.class)) {
if ((EntityCategories.HANGING.contains(entityType) || EntityCategories.OTHER
.contains(entityType)) && plot.getFlag(MiscInteractFlag.class)) {
return;
}
@ -2813,7 +2814,8 @@ public class PlayerEvents extends PlotListener implements Listener {
"plots.admin.pve." + stub);
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;
} else { // victim is something else
if (plot != null && (plot.getFlag(PveFlag.class) || plot
@ -2884,8 +2886,9 @@ public class PlayerEvents extends PlotListener implements Listener {
PlotPlayer pp = BukkitUtil.getPlayer(player);
Plot plot = area.getPlot(location);
if (plot != null) {
if ((location.getY() > area.getMaxBuildHeight() || location.getY() < area.getMinBuildHeight())
&& !Permissions.hasPermission(pp, Captions.PERMISSION_ADMIN_BUILD_HEIGHT_LIMIT)) {
if ((location.getY() > area.getMaxBuildHeight() || location.getY() < area
.getMinBuildHeight()) && !Permissions
.hasPermission(pp, Captions.PERMISSION_ADMIN_BUILD_HEIGHT_LIMIT)) {
event.setCancelled(true);
MainUtil.sendMessage(pp, Captions.HEIGHT_LIMIT.getTranslated()
.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;
@SuppressWarnings("unused") public class SingleWorldListener implements Listener {
@SuppressWarnings("unused")
public class SingleWorldListener implements Listener {
private Method methodGetHandleChunk;
private Field mustSave;

View File

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

View File

@ -28,12 +28,12 @@ package com.plotsquared.bukkit.player;
import com.plotsquared.bukkit.util.BukkitUtil;
import com.plotsquared.core.PlotSquared;
import com.plotsquared.core.configuration.Captions;
import com.plotsquared.core.events.TeleportCause;
import com.plotsquared.core.location.Location;
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.MathMan;
import com.plotsquared.core.plot.PlotWeather;
import com.plotsquared.core.util.StringMan;
import com.plotsquared.core.util.uuid.UUIDHandler;
import com.sk89q.worldedit.bukkit.BukkitAdapter;
@ -211,8 +211,7 @@ public class BukkitPlayer extends PlotPlayer {
}
@Override public void sendMessage(String message) {
message = message.replace('\u2010', '%')
.replace('\u2020', '&').replace('\u2030', '&');
message = message.replace('\u2010', '%').replace('\u2020', '&').replace('\u2030', '&');
if (!StringMan.isEqual(this.getMeta("lastMessage"), message) || (
System.currentTimeMillis() - this.<Long>getMeta("lastMessageTime") > 5000)) {
setMeta("lastMessage", message);
@ -221,11 +220,13 @@ 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) {
return;
}
final org.bukkit.Location bukkitLocation = new org.bukkit.Location(BukkitUtil.getWorld(location.getWorld()), location.getX() + 0.5,
final org.bukkit.Location bukkitLocation =
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));
}
@ -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)) {
this.player.setGameMode(GameMode.ADVENTURE);
} else if (CREATIVE.equals(gameMode)) {
@ -344,7 +346,8 @@ public class BukkitPlayer extends PlotPlayer {
return PlayerTeleportEvent.TeleportCause.COMMAND;
case 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.util.BukkitBlockUtil;
import com.plotsquared.core.PlotSquared;
import com.plotsquared.core.util.MainUtil;
import com.plotsquared.core.queue.BasicLocalBlockQueue;
import com.plotsquared.core.util.BlockUtil;
import com.plotsquared.core.util.MainUtil;
import com.sk89q.jnbt.CompoundTag;
import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.WorldEdit;
@ -139,7 +139,8 @@ public class BukkitLocalQueue extends BasicLocalBlockQueue {
BlockData blockData = BukkitAdapter.adapt(block);
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
.getBlockData().matches(blockData)) {
continue;
@ -151,8 +152,8 @@ public class BukkitLocalQueue extends BasicLocalBlockQueue {
CompoundTag tag = block.getNbtData();
StateWrapper sw = new StateWrapper(tag);
sw.restoreTag(worldObj.getName(), existing.getX(),
existing.getY(), existing.getZ());
sw.restoreTag(worldObj.getName(), existing.getX(), existing.getY(),
existing.getZ());
}
}
}
@ -162,7 +163,8 @@ public class BukkitLocalQueue extends BasicLocalBlockQueue {
if (isForceSync()) {
chunkConsumer.accept(getChunk(worldObj, localChunk));
} 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];
Biome biome = BukkitAdapter.adapt(biomeType);
worldObj.setBiome((chunk.getX() << 4) + x, (chunk.getZ() << 4) + z,
biome);
worldObj
.setBiome((chunk.getX() << 4) + x, (chunk.getZ() << 4) + z, biome);
}
}
}
@ -216,7 +218,8 @@ public class BukkitLocalQueue extends BasicLocalBlockQueue {
if (this.isForceSync()) {
chunkConsumer.accept(getChunk(worldObj, lc));
} 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;
import com.google.common.base.Preconditions;
import com.plotsquared.bukkit.util.BukkitBlockUtil;
import com.plotsquared.bukkit.util.BukkitUtil;
import com.plotsquared.core.location.ChunkWrapper;
import com.plotsquared.core.location.Location;
import com.plotsquared.core.util.MainUtil;
import com.plotsquared.core.queue.ScopedLocalBlockQueue;
import com.plotsquared.core.util.MainUtil;
import com.plotsquared.core.util.PatternUtil;
import com.google.common.base.Preconditions;
import com.sk89q.worldedit.bukkit.BukkitAdapter;
import com.sk89q.worldedit.function.pattern.Pattern;
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 maxY = Math.max(pos1.getY(), pos2.getY());
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) {
@ -135,7 +136,8 @@ public class GenChunk extends ScopedLocalBlockQueue {
}
@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) {

View File

@ -27,12 +27,19 @@ package com.plotsquared.bukkit.schematic;
import com.plotsquared.bukkit.util.BukkitUtil;
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.SchematicHandler;
import com.plotsquared.core.util.task.RunnableVal;
import com.plotsquared.core.util.task.TaskManager;
import com.plotsquared.core.queue.LocalBlockQueue;
import com.sk89q.jnbt.*;
import com.sk89q.jnbt.ByteArrayTag;
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.extension.platform.Capability;
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 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;
/**
@ -50,7 +63,8 @@ import java.util.stream.IntStream;
*/
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) {
// async
TaskManager.runTaskAsync(new Runnable() {
@ -112,10 +126,12 @@ public class BukkitSchematicHandler extends SchematicHandler {
schematic.put("BiomePaletteMax", new IntTag(biomePalette.size()));
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("BiomeData", new ByteArrayTag(biomeBuffer.toByteArray()));
schematic
.put("BiomeData", new ByteArrayTag(biomeBuffer.toByteArray()));
whenDone.value = new CompoundTag(schematic);
TaskManager.runTask(whenDone);
});
@ -123,8 +139,10 @@ public class BukkitSchematicHandler extends SchematicHandler {
}
final Runnable regionTask = this;
CuboidRegion region = queue.poll();
Location pos1 = new Location(world, region.getMinimumPoint().getX(), region.getMinimumPoint().getY(), region.getMinimumPoint().getZ());
Location pos2 = new Location(world, region.getMaximumPoint().getX(), region.getMaximumPoint().getY(), region.getMaximumPoint().getZ());
Location pos1 = new Location(world, region.getMinimumPoint().getX(),
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 sy = pos1.getY();
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.Settings;
import com.plotsquared.core.player.ConsolePlayer;
import com.plotsquared.core.plot.message.PlotMessage;
import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.plot.message.PlotMessage;
import com.plotsquared.core.util.ChatManager;
import org.bukkit.ChatColor;

View File

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

View File

@ -26,10 +26,10 @@
package com.plotsquared.bukkit.util;
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.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.plot.PlotArea;
import com.plotsquared.core.plot.PlotAreaType;

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

View File

@ -99,7 +99,8 @@ public class OfflinePlayerUtil {
Class<?> minecraftServerClass = getNmsClass("MinecraftServer");
Class<?> dimensionManager = getNmsClass("DimensionManager");
Object overworld = getField(makeField(dimensionManager, "OVERWORLD"), null);
Method getWorldServer = makeMethod(minecraftServerClass, "getWorldServer", dimensionManager);
Method getWorldServer =
makeMethod(minecraftServerClass, "getWorldServer", dimensionManager);
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.core.PlotSquared;
import com.plotsquared.core.location.Location;
import com.plotsquared.core.plot.Plot;
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.RefConstructor;
import com.plotsquared.core.util.ReflectionUtils.RefField;

View File

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

View File

@ -25,9 +25,9 @@
*/
package com.plotsquared.bukkit.util.uuid;
import com.google.common.base.Charsets;
import com.plotsquared.core.player.OfflinePlotPlayer;
import com.plotsquared.core.player.PlotPlayer;
import com.google.common.base.Charsets;
import org.bukkit.OfflinePlayer;
import org.jetbrains.annotations.NotNull;
@ -37,7 +37,8 @@ import java.util.UUID;
public class LowerOfflineUUIDWrapper extends OfflineUUIDWrapper {
@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) {
@ -47,7 +48,8 @@ public class LowerOfflineUUIDWrapper extends OfflineUUIDWrapper {
@Override public UUID getUUID(OfflinePlayer player) {
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) {

View File

@ -25,6 +25,8 @@
*/
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.core.PlotSquared;
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.uuid.UUIDHandler;
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.OfflinePlayer;
import org.bukkit.Server;
@ -60,7 +60,8 @@ public class OfflineUUIDWrapper extends UUIDWrapper {
}
@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) {

View File

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

View File

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

View File

@ -28,12 +28,12 @@ package com.plotsquared.core.command;
import com.plotsquared.core.PlotSquared;
import com.plotsquared.core.configuration.Captions;
import com.plotsquared.core.database.DBFunc;
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.plot.Plot;
import com.plotsquared.core.util.MainUtil;
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.Set;
@ -52,7 +52,8 @@ public class Add extends Command {
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,
RunnableVal2<Command, CommandResult> whenDone) throws CommandException {
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.configuration.Captions;
import com.plotsquared.core.location.Location;
import com.plotsquared.core.plot.Plot;
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.MathMan;
import com.plotsquared.core.util.Permissions;
import com.plotsquared.core.util.StringWrapper;
import com.plotsquared.core.util.uuid.UUIDHandler;
@CommandDeclaration(command = "setalias",

View File

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

View File

@ -25,6 +25,7 @@
*/
package com.plotsquared.core.command;
import com.google.common.primitives.Ints;
import com.plotsquared.core.PlotSquared;
import com.plotsquared.core.configuration.CaptionUtility;
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.PlotAutoMergeEvent;
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.PlotArea;
import com.plotsquared.core.plot.PlotAreaType;
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.Expression;
import com.plotsquared.core.util.MainUtil;
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.google.common.primitives.Ints;
import org.jetbrains.annotations.Nullable;
import java.util.ArrayList;
@ -117,7 +117,8 @@ public class Auto extends SubCommand {
final String schematic) {
Set<Plot> plots = player.getPlots();
if (!plots.isEmpty()) {
plots.iterator().next().teleportPlayer(player, TeleportCause.COMMAND, result -> {});
plots.iterator().next().teleportPlayer(player, TeleportCause.COMMAND, result -> {
});
} else {
autoClaimSafe(player, area, start, schematic);
}
@ -149,7 +150,8 @@ public class Auto extends SubCommand {
player.setMeta(Auto.class.getName(), true);
autoClaimFromDatabase(player, area, start, new RunnableVal<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;
}
final int allowed_plots = player.getAllowedPlots();
if (!force && (player.getMeta(Auto.class.getName(), false) || !checkAllowedPlots(player, plotarea,
allowed_plots, size_x, size_z))) {
if (!force && (player.getMeta(Auto.class.getName(), false) || !checkAllowedPlots(player,
plotarea, allowed_plots, size_x, size_z))) {
return false;
}

View File

@ -26,8 +26,8 @@
package com.plotsquared.core.command;
import com.plotsquared.core.configuration.Captions;
import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.util.MainUtil;
import com.plotsquared.core.util.StringMan;
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.events.PlotFlagRemoveEvent;
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.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.MainUtil;
import com.plotsquared.core.util.task.RunnableVal2;
import com.plotsquared.core.util.task.RunnableVal3;
import com.plotsquared.core.util.uuid.UUIDHandler;
import java.util.Set;
@ -54,7 +54,8 @@ public class Buy extends Command {
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,
final RunnableVal2<Command, CommandResult> whenDone) {
@ -82,14 +83,15 @@ public class Buy extends Command {
confirm.run(this, () -> {
Captions.REMOVED_BALANCE.send(player, price);
EconHandler.manager
.depositMoney(UUIDHandler.getUUIDWrapper().getOfflinePlayer(plot.getOwnerAbs()), price);
.depositMoney(UUIDHandler.getUUIDWrapper().getOfflinePlayer(plot.getOwnerAbs()),
price);
PlotPlayer owner = UUIDHandler.getPlayer(plot.getOwnerAbs());
if (owner != null) {
Captions.PLOT_SOLD.send(owner, plot.getId(), player.getName(), price);
}
PlotFlag<?, ?> plotFlag = plot.getFlagContainer().getFlag(PriceFlag.class);
PlotFlagRemoveEvent
event = PlotSquared.get().getEventDispatcher().callFlagRemove(plotFlag, plot);
PlotFlagRemoveEvent event =
PlotSquared.get().getEventDispatcher().callFlagRemove(plotFlag, plot);
if (event.getEventResult() != Result.DENY) {
plot.removeFlag(event.getFlag());
}

View File

@ -25,8 +25,8 @@
*/
package com.plotsquared.core.command;
import com.google.common.primitives.Ints;
import com.plotsquared.core.PlotSquared;
import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.configuration.CaptionUtility;
import com.plotsquared.core.configuration.Captions;
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.PlotMergeEvent;
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.util.Expression;
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.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",
aliases = "c",
@ -64,8 +64,8 @@ public class Claim extends SubCommand {
if (plot == null) {
return sendMessage(player, Captions.NOT_IN_PLOT);
}
PlayerClaimPlotEvent
event = PlotSquared.get().getEventDispatcher().callClaim(player, plot, schematic);
PlayerClaimPlotEvent event =
PlotSquared.get().getEventDispatcher().callClaim(player, plot, schematic);
schematic = event.getSchematic();
if (event.getEventResult() == Result.DENY) {
sendMessage(player, Captions.EVENT_DENIED, "Claim");
@ -133,8 +133,8 @@ public class Claim extends SubCommand {
DBFunc.createPlotSafe(plot, () -> TaskManager.IMP.sync(new RunnableVal<Object>() {
@Override public void run(Object value) {
if (!plot.claim(player, true, finalSchematic, false)) {
PlotSquared.get().getLogger().log(Captions.PREFIX.getTranslated() +
String.format("Failed to claim plot %s", plot.getId().toCommaSeparatedString()));
PlotSquared.get().getLogger().log(Captions.PREFIX.getTranslated() + String
.format("Failed to claim plot %s", plot.getId().toCommaSeparatedString()));
sendMessage(player, Captions.PLOT_NOT_CLAIMED);
plot.setOwnerAbs(null);
} else if (area.isAutoMerge()) {
@ -148,8 +148,9 @@ public class Claim extends SubCommand {
}
}
}), () -> {
PlotSquared.get().getLogger().log(Captions.PREFIX.getTranslated() +
String.format("Failed to add plot %s to the database", plot.getId().toCommaSeparatedString()));
PlotSquared.get().getLogger().log(Captions.PREFIX.getTranslated() + String
.format("Failed to add plot %s to the database",
plot.getId().toCommaSeparatedString()));
sendMessage(player, Captions.PLOT_NOT_CLAIMED);
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.events.PlotFlagRemoveEvent;
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.implementations.AnalysisFlag;
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.task.RunnableVal2;
import com.plotsquared.core.util.task.RunnableVal3;
import com.plotsquared.core.queue.GlobalBlockQueue;
import com.plotsquared.core.util.MainUtil;
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;
@ -62,7 +62,8 @@ public class Clear extends Command {
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,
RunnableVal2<Command, CommandResult> whenDone) throws CommandException {
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.Settings;
import com.plotsquared.core.database.DBFunc;
import com.plotsquared.core.events.TeleportCause;
import com.plotsquared.core.location.BlockLoc;
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.PlotCluster;
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.Permissions;
import com.plotsquared.core.util.uuid.UUIDHandler;

View File

@ -25,18 +25,18 @@
*/
package com.plotsquared.core.command;
import com.plotsquared.core.configuration.file.YamlConfiguration;
import com.plotsquared.core.PlotSquared;
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.util.task.RunnableVal2;
import com.plotsquared.core.util.task.RunnableVal3;
import com.plotsquared.core.plot.message.PlotMessage;
import com.plotsquared.core.util.MainUtil;
import com.plotsquared.core.util.MathMan;
import com.plotsquared.core.util.Permissions;
import com.plotsquared.core.util.StringComparison;
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.lang.reflect.InvocationTargetException;

View File

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

View File

@ -26,11 +26,11 @@
package com.plotsquared.core.command;
import com.plotsquared.core.configuration.Captions;
import com.plotsquared.core.plot.Plot;
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.PlotComment;
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.StringMan;
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), " ");
PlotComment comment =
new PlotComment(player.getLocation().getWorld(), plot.getId(), message, player.getName(), inbox.toString(),
System.currentTimeMillis());
new PlotComment(player.getLocation().getWorld(), plot.getId(), message,
player.getName(), inbox.toString(), System.currentTimeMillis());
boolean result = inbox.addComment(plot, comment);
if (!result) {
sendMessage(player, Captions.NO_PLOT_INBOX, "");

View File

@ -26,14 +26,14 @@
package com.plotsquared.core.command;
import com.plotsquared.core.PlotSquared;
import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.plot.PlotArea;
import com.plotsquared.core.plot.PlotId;
import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.util.MainUtil;
import com.plotsquared.core.util.MathMan;
import com.plotsquared.core.util.task.TaskManager;
import com.plotsquared.core.util.WorldUtil;
import com.plotsquared.core.util.task.TaskManager;
import java.util.ArrayList;
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.events.PlotFlagRemoveEvent;
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.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.Permissions;

View File

@ -27,8 +27,8 @@ package com.plotsquared.core.command;
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.plot.Plot;
import com.plotsquared.core.util.MainUtil;
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.HybridUtils;
import com.plotsquared.core.location.Location;
import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.util.MainUtil;
@CommandDeclaration(command = "createroadschematic",

View File

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

View File

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

View File

@ -25,20 +25,20 @@
*/
package com.plotsquared.core.command;
import com.google.common.collect.BiMap;
import com.plotsquared.core.PlotSquared;
import com.plotsquared.core.configuration.Captions;
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.PlotId;
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.MainUtil;
import com.plotsquared.core.util.uuid.UUIDHandler;
import com.plotsquared.core.util.StringWrapper;
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 java.util.ArrayList;

View File

@ -25,27 +25,27 @@
*/
package com.plotsquared.core.command;
import com.google.common.io.Files;
import com.plotsquared.core.PlotSquared;
import com.plotsquared.core.configuration.Captions;
import com.plotsquared.core.configuration.Settings;
import com.plotsquared.core.database.DBFunc;
import com.plotsquared.core.events.PlotFlagRemoveEvent;
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.util.WEManager;
import com.plotsquared.core.player.ConsolePlayer;
import com.plotsquared.core.location.Location;
import com.plotsquared.core.player.ConsolePlayer;
import com.plotsquared.core.player.OfflinePlotPlayer;
import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.plot.PlotArea;
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.player.PlotPlayer;
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.queue.GlobalBlockQueue;
import com.plotsquared.core.util.ChunkManager;
import com.plotsquared.core.util.EconHandler;
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.SetupUtils;
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.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 javax.script.Bindings;
@ -72,7 +72,12 @@ import java.io.File;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
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;
@CommandDeclaration(command = "debugexec",
@ -267,8 +272,8 @@ public class DebugExec extends SubCommand {
}
boolean result;
if (HybridUtils.regions != null) {
result =
HybridUtils.manager.scheduleRoadUpdate(area, HybridUtils.regions, 0, new HashSet<>());
result = HybridUtils.manager
.scheduleRoadUpdate(area, HybridUtils.regions, 0, new HashSet<>());
} else {
result = HybridUtils.manager.scheduleRoadUpdate(area, 0);
}
@ -333,7 +338,8 @@ public class DebugExec extends SubCommand {
System.getProperty("line.separator"));
new Command(MainCommand.getInstance(), true, args[1].split("\\.")[0], null,
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,
RunnableVal2<Command, CommandResult> whenDone) {
try {

View File

@ -25,17 +25,17 @@
*/
package com.plotsquared.core.command;
import com.google.common.base.Charsets;
import com.plotsquared.core.PlotSquared;
import com.plotsquared.core.plot.PlotId;
import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.util.task.RunnableVal2;
import com.plotsquared.core.util.task.RunnableVal3;
import com.plotsquared.core.plot.PlotId;
import com.plotsquared.core.plot.world.PlotAreaManager;
import com.plotsquared.core.plot.world.SinglePlotArea;
import com.plotsquared.core.plot.world.SinglePlotAreaManager;
import com.plotsquared.core.util.uuid.UUIDHandler;
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.util.UUID;
@ -51,7 +51,8 @@ public class DebugImportWorlds extends Command {
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,
RunnableVal2<Command, CommandResult> whenDone) throws CommandException {
// UUID.nameUUIDFromBytes(("OfflinePlayer:" + player.getName()).getBytes(Charsets.UTF_8))

View File

@ -25,17 +25,17 @@
*/
package com.plotsquared.core.command;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import com.plotsquared.core.PlotSquared;
import com.plotsquared.core.configuration.Captions;
import com.plotsquared.core.configuration.Settings;
import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.util.net.IncendoPaster;
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.uuid.UUIDHandler;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import com.plotsquared.core.util.PremiumVerification;
import lombok.NonNull;
import java.io.BufferedReader;
@ -83,7 +83,8 @@ public class DebugPaste extends SubCommand {
b.append("# PlotSquared Information\n");
b.append("Resource ID: ").append(PremiumVerification.getResourceID()).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 Version: ").append(PlotSquared.get().IMP.getServerImplementation())
.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.HybridUtils;
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.PlotManager;
import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.util.MainUtil;
import java.util.Arrays;

View File

@ -27,8 +27,8 @@ package com.plotsquared.core.command;
import com.plotsquared.core.PlotSquared;
import com.plotsquared.core.database.DBFunc;
import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.util.MainUtil;
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.Settings;
import com.plotsquared.core.events.Result;
import com.plotsquared.core.util.Expression;
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.player.PlotPlayer;
import com.plotsquared.core.util.EconHandler;
import com.plotsquared.core.util.Expression;
import com.plotsquared.core.util.MainUtil;
import com.plotsquared.core.util.Permissions;
import com.plotsquared.core.util.task.TaskManager;
@ -62,7 +62,8 @@ public class Delete extends SubCommand {
if (!plot.hasOwner()) {
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) {
sendMessage(player, Captions.EVENT_DENIED, "Delete");
return true;

View File

@ -29,12 +29,12 @@ import com.plotsquared.core.PlotSquared;
import com.plotsquared.core.configuration.Captions;
import com.plotsquared.core.database.DBFunc;
import com.plotsquared.core.location.Location;
import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.util.MainUtil;
import com.plotsquared.core.util.Permissions;
import com.plotsquared.core.util.uuid.UUIDHandler;
import com.plotsquared.core.util.WorldUtil;
import com.plotsquared.core.util.uuid.UUIDHandler;
import com.sk89q.worldedit.world.gamemode.GameModes;
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.PlotFlagRemoveEvent;
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.plot.Plot;
import com.plotsquared.core.plot.flag.implementations.DescriptionFlag;
import com.plotsquared.core.util.MainUtil;
@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.PlotFlagAddEvent;
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.location.Location;
import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.util.task.RunnableVal;
import com.plotsquared.core.util.MainUtil;
import com.plotsquared.core.util.Permissions;
import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.plot.expiration.ExpireManager;
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",
aliases = {"submit"},

View File

@ -28,15 +28,15 @@ package com.plotsquared.core.command;
import com.plotsquared.core.PlotSquared;
import com.plotsquared.core.configuration.Captions;
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.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.Permissions;
import com.plotsquared.core.util.SchematicHandler;
import com.plotsquared.core.util.StringMan;
import com.plotsquared.core.util.WorldUtil;
import com.plotsquared.core.util.task.RunnableVal;
import com.sk89q.jnbt.CompoundTag;
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.PlotFlagRemoveEvent;
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.GlobalFlagContainer;
import com.plotsquared.core.plot.flag.InternalFlag;
import com.plotsquared.core.plot.flag.PlotFlag;
import com.plotsquared.core.plot.flag.types.IntegerFlag;
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.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.MathMan;
import com.plotsquared.core.util.Permissions;
import com.plotsquared.core.util.StringComparison;
import com.plotsquared.core.util.StringMan;
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.Nullable;
@ -206,7 +206,8 @@ public final class FlagCommand extends Command {
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,
RunnableVal2<Command, CommandResult> whenDone) throws CommandException {
if (args.length == 0 || !Arrays
@ -220,7 +221,8 @@ public final class FlagCommand extends Command {
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) {
if (args.length == 1) {
return Stream
@ -356,7 +358,8 @@ public final class FlagCommand extends Command {
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;
try {
parsed = event.getFlag().parse(value);
@ -448,7 +451,8 @@ public final class FlagCommand extends Command {
PlotFlag plotFlag = parsedFlag.createFlagInstance(list);
PlotFlagAddEvent addEvent = new PlotFlagAddEvent(plotFlag, plot);
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;
}
if (plot.setFlag(addEvent.getFlag())) {

View File

@ -25,17 +25,17 @@
*/
package com.plotsquared.core.command;
import com.google.common.primitives.Ints;
import com.plotsquared.core.configuration.CaptionUtility;
import com.plotsquared.core.configuration.Captions;
import com.plotsquared.core.database.DBFunc;
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.RunnableVal2;
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.google.common.primitives.Ints;
import java.util.UUID;
import java.util.concurrent.CompletableFuture;
@ -51,7 +51,8 @@ public class Grant extends Command {
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,
RunnableVal2<Command, CommandResult> whenDone) throws CommandException {
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.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.MathMan;
import com.plotsquared.core.util.StringMan;
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;
@ -51,7 +51,8 @@ public class Help extends Command {
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,
RunnableVal2<Command, CommandResult> whenDone) {
switch (args.length) {

View File

@ -26,14 +26,14 @@
package com.plotsquared.core.command;
import com.plotsquared.core.configuration.Captions;
import com.plotsquared.core.plot.Plot;
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.PlotComment;
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.StringMan;
import com.plotsquared.core.util.task.RunnableVal;
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.Settings;
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.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.task.RunnableVal;
@CommandDeclaration(command = "info",
aliases = "i",

View File

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

View File

@ -27,11 +27,11 @@ package com.plotsquared.core.command;
import com.plotsquared.core.PlotSquared;
import com.plotsquared.core.configuration.Captions;
import com.plotsquared.core.plot.Plot;
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.RunnableVal3;
import com.plotsquared.core.util.MainUtil;
import java.util.UUID;
import java.util.concurrent.CompletableFuture;
@ -47,7 +47,8 @@ public class Leave extends Command {
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,
RunnableVal2<Command, CommandResult> whenDone) throws CommandException {
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.database.DBFunc;
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.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.Permissions;
import com.plotsquared.core.util.task.TaskManager;
@ -71,7 +71,8 @@ public class Like extends SubCommand {
for (final Plot plot : plots) {
if ((!Settings.Done.REQUIRED_FOR_RATINGS || DoneFlag.isDone(plot)) && plot
.isBasePlot() && (!plot.getLikes().containsKey(uuid))) {
plot.teleportPlayer(player, TeleportCause.COMMAND, result -> {});
plot.teleportPlayer(player, TeleportCause.COMMAND, result -> {
});
MainUtil.sendMessage(player, Captions.RATE_THIS);
return true;
}
@ -123,8 +124,8 @@ public class Like extends SubCommand {
rating = 1;
}
plot.addRating(uuid, new Rating(rating));
final PlotRateEvent
event = PlotSquared.get().getEventDispatcher().callRating(player, plot, new Rating(rating));
final PlotRateEvent event =
PlotSquared.get().getEventDispatcher().callRating(player, plot, new Rating(rating));
if (event.getRating() != null) {
plot.addRating(uuid, event.getRating());
if (like) {

View File

@ -29,22 +29,22 @@ import com.plotsquared.core.PlotSquared;
import com.plotsquared.core.PlotSquared.SortType;
import com.plotsquared.core.configuration.CaptionUtility;
import com.plotsquared.core.configuration.Captions;
import com.plotsquared.core.plot.flag.implementations.DoneFlag;
import com.plotsquared.core.plot.flag.implementations.PriceFlag;
import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.plot.Plot;
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.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.MainUtil;
import com.plotsquared.core.util.MathMan;
import com.plotsquared.core.util.Permissions;
import com.plotsquared.core.util.StringComparison;
import com.plotsquared.core.util.StringMan;
import com.plotsquared.core.util.task.RunnableVal3;
import com.plotsquared.core.util.uuid.UUIDHandler;
import com.plotsquared.core.plot.expiration.ExpireManager;
import java.util.ArrayList;
import java.util.Arrays;

View File

@ -28,15 +28,15 @@ package com.plotsquared.core.command;
import com.plotsquared.core.PlotSquared;
import com.plotsquared.core.configuration.Captions;
import com.plotsquared.core.configuration.Settings;
import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.plot.PlotArea;
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.util.MainUtil;
import com.plotsquared.core.util.Permissions;
import com.plotsquared.core.util.SchematicHandler;
import com.plotsquared.core.util.task.RunnableVal;
import com.plotsquared.core.util.task.TaskManager;
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.Settings;
import com.plotsquared.core.player.ConsolePlayer;
import com.plotsquared.core.util.Expression;
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.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.RunnableVal3;
import com.plotsquared.core.util.EconHandler;
import com.plotsquared.core.util.Permissions;
import java.util.Arrays;
import java.util.concurrent.CompletableFuture;
@ -167,7 +167,8 @@ public class MainCommand extends Command {
if (EconHandler.manager != null) {
PlotArea area = player.getApplicablePlotArea();
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;
if (price != null
&& EconHandler.manager.getMoney(player) < price) {
@ -215,7 +216,8 @@ public class MainCommand extends Command {
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,
RunnableVal2<Command, CommandResult> whenDone) {
// Clear perm caching //
@ -253,7 +255,8 @@ public class MainCommand extends Command {
if (EconHandler.manager != null) {
PlotArea area = player.getApplicablePlotArea();
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;
if (price != 0d
&& 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.Result;
import com.plotsquared.core.location.Direction;
import com.plotsquared.core.util.Expression;
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.player.PlotPlayer;
import com.plotsquared.core.util.EconHandler;
import com.plotsquared.core.util.Expression;
import com.plotsquared.core.util.MainUtil;
import com.plotsquared.core.util.Permissions;
import com.plotsquared.core.util.StringMan;
@ -182,7 +182,8 @@ public class Merge extends SubCommand {
} else {
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,
Captions.PERMISSION_MERGE_KEEP_ROAD.getTranslated());
return true;

View File

@ -26,10 +26,10 @@
package com.plotsquared.core.command;
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.location.Location;
import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.plot.Plot;
/**
* @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.configuration.Captions;
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.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.Permissions;
import com.plotsquared.core.util.task.RunnableVal2;
import com.plotsquared.core.util.task.RunnableVal3;
import java.util.concurrent.CompletableFuture;
@ -46,7 +46,8 @@ import java.util.concurrent.CompletableFuture;
requiredType = RequiredType.PLAYER)
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,
RunnableVal2<Command, CommandResult> whenDone) {
Location location = player.getLocation();
@ -94,8 +95,8 @@ public class Move extends SubCommand {
return CompletableFuture.completedFuture(false);
}
return plot1.move(plot2, () -> {}, false)
.thenApply(result -> {
return plot1.move(plot2, () -> {
}, false).thenApply(result -> {
if (result) {
MainUtil.sendMessage(player, Captions.MOVE_SUCCESS);
return true;

View File

@ -25,17 +25,17 @@
*/
package com.plotsquared.core.command;
import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.configuration.Captions;
import com.plotsquared.core.events.PlotFlagAddEvent;
import com.plotsquared.core.events.PlotFlagRemoveEvent;
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.player.PlotPlayer;
import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.plot.PlotInventory;
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 java.util.Arrays;

View File

@ -26,11 +26,11 @@
package com.plotsquared.core.command;
import com.plotsquared.core.configuration.Captions;
import com.plotsquared.core.plot.Plot;
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.RunnableVal3;
import com.plotsquared.core.util.StringMan;
import java.util.concurrent.CompletableFuture;
@ -45,7 +45,8 @@ public class Near extends Command {
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,
RunnableVal2<Command, CommandResult> whenDone) throws CommandException {
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.player.PlotPlayer;
import com.plotsquared.core.util.MainUtil;
import com.plotsquared.core.util.task.TaskManager;
import com.plotsquared.core.util.PremiumVerification;
import com.plotsquared.core.util.task.TaskManager;
@CommandDeclaration(command = "plugin",
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");
MainUtil.sendMessage(player,
"$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;
}

View File

@ -29,10 +29,10 @@ import com.plotsquared.core.PlotSquared;
import com.plotsquared.core.configuration.Captions;
import com.plotsquared.core.database.DBFunc;
import com.plotsquared.core.listener.PlotListener;
import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.plot.PlotArea;
import com.plotsquared.core.plot.PlotId;
import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.util.StringMan;
import com.plotsquared.core.util.task.TaskManager;
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.database.DBFunc;
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.PlotInventory;
import com.plotsquared.core.plot.PlotItemStack;
import com.plotsquared.core.player.PlotPlayer;
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.MathMan;
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
.isBasePlot() && (!p.getRatings().containsKey(uuid)) && !p
.isAdded(uuid)) {
p.teleportPlayer(player, TeleportCause.COMMAND, result -> {});
p.teleportPlayer(player, TeleportCause.COMMAND, result -> {
});
MainUtil.sendMessage(player, Captions.RATE_THIS);
return true;
}
@ -140,8 +141,8 @@ public class Rate extends SubCommand {
index.increment();
if (index.getValue() >= Settings.Ratings.CATEGORIES.size()) {
int rV = rating.getValue();
PlotRateEvent event =
PlotSquared.get().getEventDispatcher().callRating(this.player, plot, new Rating(rV));
PlotRateEvent event = PlotSquared.get().getEventDispatcher()
.callRating(this.player, plot, new Rating(rV));
if (event.getRating() != null) {
plot.addRating(this.player.getUUID(), event.getRating());
sendMessage(this.player, Captions.RATING_APPLIED,
@ -209,7 +210,8 @@ public class Rate extends SubCommand {
sendMessage(player, Captions.RATING_ALREADY_EXISTS, plot.getId().toString());
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) {
plot.addRating(uuid, event.getRating());
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.generator.HybridPlotManager;
import com.plotsquared.core.generator.HybridUtils;
import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.plot.PlotArea;
import com.plotsquared.core.plot.PlotManager;
import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.util.MainUtil;
@CommandDeclaration(command = "regenallroads",

View File

@ -26,13 +26,13 @@
package com.plotsquared.core.command;
import com.plotsquared.core.configuration.Captions;
import com.plotsquared.core.plot.Plot;
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.RunnableVal2;
import com.plotsquared.core.util.task.RunnableVal3;
import com.plotsquared.core.util.ChunkManager;
import com.plotsquared.core.queue.LocalBlockQueue;
import java.util.concurrent.CompletableFuture;
@ -46,7 +46,8 @@ public class Relight extends Command {
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,
RunnableVal2<Command, CommandResult> whenDone) {
final Plot plot = player.getCurrentPlot();

View File

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

View File

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

View File

@ -28,13 +28,13 @@ package com.plotsquared.core.command;
import com.plotsquared.core.PlotSquared;
import com.plotsquared.core.configuration.Captions;
import com.plotsquared.core.location.Location;
import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.plot.Plot;
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.Permissions;
import com.plotsquared.core.util.SchematicHandler;
import com.plotsquared.core.util.task.RunnableVal;
import com.plotsquared.core.util.task.TaskManager;
import com.sk89q.jnbt.CompoundTag;

View File

@ -25,22 +25,22 @@
*/
package com.plotsquared.core.command;
import com.google.common.collect.Lists;
import com.plotsquared.core.PlotSquared;
import com.plotsquared.core.configuration.Captions;
import com.plotsquared.core.configuration.Settings;
import com.plotsquared.core.player.ConsolePlayer;
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.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.util.MainUtil;
import com.plotsquared.core.util.Permissions;
import com.plotsquared.core.util.SchematicHandler;
import com.plotsquared.core.util.StringMan;
import com.plotsquared.core.util.task.RunnableVal;
import com.plotsquared.core.util.task.TaskManager;
import com.google.common.collect.Lists;
import java.net.URL;
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.Captions;
import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.plot.Plot;
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.PatternUtil;
import com.plotsquared.core.util.Permissions;
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 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.Captions;
import com.plotsquared.core.location.Location;
import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.util.MainUtil;
import com.plotsquared.core.util.Permissions;
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.location.BlockLoc;
import com.plotsquared.core.location.Location;
import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.util.MainUtil;
@CommandDeclaration(command = "sethome",

View File

@ -27,17 +27,17 @@ package com.plotsquared.core.command;
import com.plotsquared.core.PlotSquared;
import com.plotsquared.core.configuration.Captions;
import com.plotsquared.core.configuration.ConfigurationUtil;
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.player.PlotPlayer;
import com.plotsquared.core.plot.PlotArea;
import com.plotsquared.core.plot.PlotAreaTerrainType;
import com.plotsquared.core.plot.PlotAreaType;
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.events.TeleportCause;
import com.plotsquared.core.plot.message.PlotMessage;
import com.plotsquared.core.util.MainUtil;
import com.plotsquared.core.util.SetupUtils;
import com.plotsquared.core.util.StringMan;
@ -152,7 +152,8 @@ public class Setup extends SubCommand {
types.add("augmented");
types.add("partial");
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!");
for (String type : types) {
int i = allTypes.indexOf(type);
@ -272,7 +273,8 @@ public class Setup extends SubCommand {
break;
case 5: { // Choose terrain
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,
"&cYou must choose the terrain!" + "\n&8 - &2NONE&8 - &7No terrain at all"
+ "\n&8 - &7ORE&8 - &7Just some ore veins and trees"

View File

@ -53,7 +53,8 @@ public abstract class SubCommand extends Command {
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,
RunnableVal2<Command, CommandResult> whenDone) {
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.location.Location;
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.plot.Plot;
import com.plotsquared.core.util.MainUtil;
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;
@ -44,13 +44,15 @@ import java.util.concurrent.CompletableFuture;
requiredType = RequiredType.PLAYER)
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,
RunnableVal2<Command, CommandResult> whenDone) {
Location location = player.getLocation();
Plot plot1 = location.getPlotAbs();
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
.hasPermission(player, Captions.PERMISSION_ADMIN.getTranslated())) {
@ -79,8 +81,8 @@ public class Swap extends SubCommand {
return CompletableFuture.completedFuture(false);
}
return plot1.move(plot2, () -> {}, true)
.thenApply(result -> {
return plot1.move(plot2, () -> {
}, true).thenApply(result -> {
if (result) {
MainUtil.sendMessage(player, Captions.SWAP_SUCCESS);
return true;

View File

@ -28,8 +28,8 @@ package com.plotsquared.core.command;
import com.plotsquared.core.PlotSquared;
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.plot.Plot;
import com.plotsquared.core.util.MainUtil;
import com.plotsquared.core.util.StringMan;

View File

@ -25,24 +25,24 @@
*/
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.configuration.Captions;
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.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.PlotManager;
import com.plotsquared.core.player.PlotPlayer;
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.SetupUtils;
import com.plotsquared.core.util.task.TaskManager;
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.FileInputStream;

View File

@ -27,9 +27,9 @@ package com.plotsquared.core.command;
import com.plotsquared.core.configuration.Captions;
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.RunnableVal3;
import com.plotsquared.core.util.MainUtil;
@CommandDeclaration(command = "toggle",
aliases = {"attribute"},

View File

@ -28,18 +28,18 @@ package com.plotsquared.core.command;
import com.plotsquared.core.PlotSquared;
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.util.task.RunnableVal;
import com.plotsquared.core.util.task.RunnableVal2;
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.plot.Plot;
import com.plotsquared.core.plot.expiration.ExpireManager;
import com.plotsquared.core.queue.GlobalBlockQueue;
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.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.regions.CuboidRegion;

View File

@ -28,12 +28,12 @@ package com.plotsquared.core.command;
import com.plotsquared.core.PlotSquared;
import com.plotsquared.core.configuration.Captions;
import com.plotsquared.core.database.DBFunc;
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.plot.Plot;
import com.plotsquared.core.util.MainUtil;
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.Set;
@ -52,7 +52,8 @@ public class Trust extends Command {
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,
RunnableVal2<Command, CommandResult> whenDone) throws CommandException {
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.Result;
import com.plotsquared.core.location.Location;
import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.util.MainUtil;
import com.plotsquared.core.util.Permissions;
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.configuration.Captions;
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.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.events.TeleportCause;
import com.plotsquared.core.plot.flag.implementations.UntrustedVisitFlag;
import com.plotsquared.core.util.MainUtil;
import com.plotsquared.core.util.MathMan;
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 java.util.ArrayList;
@ -64,7 +64,8 @@ public class Visit extends Command {
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,
final RunnableVal2<Command, CommandResult> whenDone) throws CommandException {
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);
return CompletableFuture.completedFuture(false);
}
if (!plot.getFlag(UntrustedVisitFlag.class) &&
!Permissions.hasPermission(player, Captions.PERMISSION_ADMIN_VISIT_UNTRUSTED)) {
if (!plot.getFlag(UntrustedVisitFlag.class) && !Permissions
.hasPermission(player, Captions.PERMISSION_ADMIN_VISIT_UNTRUSTED)) {
Captions.NO_PERMISSION.send(player, Captions.PERMISSION_ADMIN_VISIT_UNTRUSTED);
return CompletableFuture.completedFuture(false);
}
}
confirm.run(this, () ->
plot.teleportPlayer(player, TeleportCause.COMMAND, result -> {
confirm.run(this, () -> plot.teleportPlayer(player, TeleportCause.COMMAND, result -> {
if (result) {
whenDone.run(Visit.this, CommandResult.SUCCESS);
} else {

View File

@ -30,7 +30,8 @@ import com.plotsquared.core.player.PlotPlayer;
public class CaptionUtility {
public static String formatRaw(PlotPlayer recipient, String message, Object... args) {
final ChatFormatter.ChatContext chatContext = new ChatFormatter.ChatContext(recipient, message, args, true);
final ChatFormatter.ChatContext chatContext =
new ChatFormatter.ChatContext(recipient, message, args, true);
for (final ChatFormatter chatFormatter : ChatFormatter.formatters) {
chatFormatter.format(chatContext);
}
@ -38,7 +39,8 @@ public class CaptionUtility {
}
public static String format(PlotPlayer recipient, String message, Object... args) {
final ChatFormatter.ChatContext chatContext = new ChatFormatter.ChatContext(recipient, message, args, false);
final ChatFormatter.ChatContext chatContext =
new ChatFormatter.ChatContext(recipient, message, args, false);
for (final ChatFormatter chatFormatter : ChatFormatter.formatters) {
chatFormatter.format(chatContext);
}
@ -47,7 +49,8 @@ public class CaptionUtility {
public static String format(PlotPlayer recipient, Caption caption, Object... args) {
if (caption.usePrefix() && caption.getTranslated().length() > 0) {
return Captions.PREFIX.getTranslated() + format(recipient, caption.getTranslated(), args);
return Captions.PREFIX.getTranslated() + format(recipient, caption.getTranslated(),
args);
} else {
return format(recipient, caption.getTranslated(), args);
}

View File

@ -25,8 +25,8 @@
*/
package com.plotsquared.core.configuration;
import com.plotsquared.core.configuration.file.YamlConfiguration;
import com.plotsquared.core.PlotSquared;
import com.plotsquared.core.configuration.file.YamlConfiguration;
import com.plotsquared.core.util.StringMan;
import java.io.File;

View File

@ -34,13 +34,16 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
@FunctionalInterface public interface ChatFormatter {
@FunctionalInterface
public interface ChatFormatter {
Collection<ChatFormatter> formatters = new ArrayList<>(Collections.singletonList(new PlotSquaredChatFormatter()));
Collection<ChatFormatter> formatters =
new ArrayList<>(Collections.singletonList(new PlotSquaredChatFormatter()));
void format(ChatContext context);
@AllArgsConstructor final class ChatContext {
@AllArgsConstructor
final class ChatContext {
@Getter private final PlotPlayer recipient;
@Getter @Setter private String message;

View File

@ -25,9 +25,9 @@
*/
package com.plotsquared.core.configuration;
import com.plotsquared.core.configuration.file.YamlConfiguration;
import com.plotsquared.core.PlotSquared;
import com.plotsquared.core.configuration.Settings.Enabled_Components;
import com.plotsquared.core.configuration.file.YamlConfiguration;
import com.plotsquared.core.util.StringMan;
import java.io.File;
@ -394,21 +394,26 @@ public class Config {
/**
* Indicates that a field should be instantiated / created.
*/
@Retention(RetentionPolicy.RUNTIME) @Target({ElementType.FIELD}) public @interface Create {
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.FIELD})
public @interface Create {
}
/**
* Indicates that a field cannot be modified.
*/
@Retention(RetentionPolicy.RUNTIME) @Target({ElementType.FIELD}) public @interface Final {
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.FIELD})
public @interface Final {
}
/**
* Creates a comment.
*/
@Retention(RetentionPolicy.RUNTIME) @Target({ElementType.FIELD, ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.FIELD, ElementType.TYPE})
public @interface Comment {
String[] value();
}
@ -417,7 +422,8 @@ public class Config {
/**
* The names of any default blocks.
*/
@Retention(RetentionPolicy.RUNTIME) @Target({ElementType.FIELD, ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.FIELD, ElementType.TYPE})
public @interface BlockName {
String[] value();
}
@ -426,7 +432,8 @@ public class Config {
/**
* Any field or class with is not part of the config.
*/
@Retention(RetentionPolicy.RUNTIME) @Target({ElementType.FIELD, ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.FIELD, ElementType.TYPE})
public @interface Ignore {
}

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