Fixing some more things

This commit is contained in:
boy0001
2015-07-31 00:25:16 +10:00
parent bfa877e607
commit e1dad77d8f
264 changed files with 6920 additions and 2146 deletions

View File

@ -0,0 +1,19 @@
package com.intellectualcrafters.plot.util;
import com.intellectualcrafters.plot.object.ConsolePlayer;
import com.intellectualcrafters.plot.object.PlotPlayer;
public abstract class AbstractTitle {
public static AbstractTitle TITLE_CLASS;
public static void sendTitle(PlotPlayer player, String head, String sub) {
if (ConsolePlayer.isConsole(player)) {
return;
}
if (TITLE_CLASS != null && !player.getAttribute("disabletitles")) {
TITLE_CLASS.sendTitle(player, head, sub, 1, 2, 1);
}
}
public abstract void sendTitle(PlotPlayer player, String head, String sub, int in, int delay, int out);
}

View File

@ -19,7 +19,7 @@ public abstract class BlockManager {
public abstract int getBiomeFromString(String biome);
public abstract int getBlockIdFromString(String block);
public abstract PlotBlock getPlotBlockFromString(String block);
public abstract int getHeighestBlock(String world, int x, int z);

View File

@ -1,9 +1,9 @@
package com.intellectualcrafters.plot.util;
import com.intellectualcrafters.plot.object.ChunkLoc;
import java.util.Collection;
import com.intellectualcrafters.plot.object.ChunkLoc;
public abstract class BlockUpdateUtil {
public static BlockUpdateUtil setBlockManager = null;

View File

@ -1,12 +1,19 @@
package com.intellectualcrafters.plot.util;
import com.intellectualcrafters.plot.object.*;
import com.intellectualcrafters.plot.util.SetBlockQueue.ChunkWrapper;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import com.intellectualcrafters.plot.object.ChunkLoc;
import com.intellectualcrafters.plot.object.Location;
import com.intellectualcrafters.plot.object.Plot;
import com.intellectualcrafters.plot.object.PlotBlock;
import com.intellectualcrafters.plot.object.PlotId;
import com.intellectualcrafters.plot.object.PlotLoc;
import com.intellectualcrafters.plot.object.RegionWrapper;
import com.intellectualcrafters.plot.object.RunnableVal;
import com.intellectualcrafters.plot.util.SetBlockQueue.ChunkWrapper;
public abstract class ChunkManager {
public static ChunkManager manager = null;

View File

@ -1,20 +1,29 @@
package com.intellectualcrafters.plot.util;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.object.*;
import com.plotsquared.bukkit.generator.AugmentedPopulator;
import com.plotsquared.bukkit.util.bukkit.BukkitUtil;
import org.bukkit.Bukkit;
import org.bukkit.Chunk;
import org.bukkit.World;
import org.bukkit.generator.BlockPopulator;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Random;
import org.bukkit.Bukkit;
import org.bukkit.Chunk;
import org.bukkit.World;
import org.bukkit.generator.BlockPopulator;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.object.BlockLoc;
import com.intellectualcrafters.plot.object.ChunkLoc;
import com.intellectualcrafters.plot.object.Location;
import com.intellectualcrafters.plot.object.Plot;
import com.intellectualcrafters.plot.object.PlotCluster;
import com.intellectualcrafters.plot.object.PlotClusterId;
import com.intellectualcrafters.plot.object.PlotId;
import com.intellectualcrafters.plot.object.PlotManager;
import com.intellectualcrafters.plot.object.PlotPlayer;
import com.intellectualcrafters.plot.object.PlotWorld;
import com.plotsquared.bukkit.generator.AugmentedPopulator;
public class ClusterManager {
public static HashMap<String, HashSet<PlotCluster>> clusters;
public static PlotCluster last;

View File

@ -1,11 +1,11 @@
package com.intellectualcrafters.plot.util;
import java.util.HashMap;
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.object.CmdInstance;
import com.intellectualcrafters.plot.object.PlotPlayer;
import java.util.HashMap;
public class CmdConfirm {
private static HashMap<String, CmdInstance> pending = new HashMap<>();

View File

@ -1,17 +1,20 @@
package com.intellectualcrafters.plot.util;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.concurrent.atomic.AtomicInteger;
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.config.Settings;
import com.intellectualcrafters.plot.object.Plot;
import com.intellectualcrafters.plot.object.PlotPlayer;
import com.intellectualcrafters.plot.object.RunnableVal;
import com.intellectualcrafters.plot.object.comment.*;
import com.plotsquared.bukkit.titles.AbstractTitle;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.concurrent.atomic.AtomicInteger;
import com.intellectualcrafters.plot.object.comment.CommentInbox;
import com.intellectualcrafters.plot.object.comment.InboxOwner;
import com.intellectualcrafters.plot.object.comment.InboxPublic;
import com.intellectualcrafters.plot.object.comment.InboxReport;
import com.intellectualcrafters.plot.object.comment.PlotComment;
public class CommentManager {

View File

@ -7,7 +7,6 @@ import java.util.UUID;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.flag.Flag;
import com.intellectualcrafters.plot.flag.FlagManager;
import com.plotsquared.bukkit.listeners.PlayerBlockEventType;
import com.intellectualcrafters.plot.object.LazyBlock;
import com.intellectualcrafters.plot.object.Location;
import com.intellectualcrafters.plot.object.Plot;
@ -15,6 +14,7 @@ import com.intellectualcrafters.plot.object.PlotBlock;
import com.intellectualcrafters.plot.object.PlotCluster;
import com.intellectualcrafters.plot.object.PlotId;
import com.intellectualcrafters.plot.object.PlotPlayer;
import com.plotsquared.bukkit.listeners.PlayerBlockEventType;
public abstract class EventUtil {

View File

@ -1,20 +1,27 @@
package com.intellectualcrafters.plot.util;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;
import org.bukkit.Bukkit;
import org.bukkit.OfflinePlayer;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.config.Settings;
import com.intellectualcrafters.plot.flag.Flag;
import com.intellectualcrafters.plot.flag.FlagManager;
import com.intellectualcrafters.plot.generator.HybridUtils;
import com.intellectualcrafters.plot.object.*;
import org.bukkit.Bukkit;
import org.bukkit.OfflinePlayer;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;
import com.intellectualcrafters.plot.object.Plot;
import com.intellectualcrafters.plot.object.PlotAnalysis;
import com.intellectualcrafters.plot.object.PlotHandler;
import com.intellectualcrafters.plot.object.PlotManager;
import com.intellectualcrafters.plot.object.PlotPlayer;
import com.intellectualcrafters.plot.object.PlotWorld;
import com.intellectualcrafters.plot.object.RunnableVal;
public class ExpireManager {
public static ConcurrentHashMap<String, List<Plot>> expiredPlots = new ConcurrentHashMap<>();
@ -42,7 +49,7 @@ public class ExpireManager {
public void run() {
try {
final List<Plot> plots = getOldPlots(world);
PS.log("$2[&5Expire&dManager$2] $4Found " + plots.size() + " expired plots for " + world + "!");
PS.debug("$2[&5Expire&dManager$2] $4Found " + plots.size() + " expired plots for " + world + "!");
expiredPlots.put(world, plots);
updatingPlots.put(world, false);
}
@ -69,18 +76,18 @@ public class ExpireManager {
}
final Boolean updating = ExpireManager.updatingPlots.get(world);
if (updating) {
PS.log("$2[&5Expire&dManager$2] $4Waiting on fetch...");
PS.debug("$2[&5Expire&dManager$2] $4Waiting on fetch...");
return;
}
if (!expiredPlots.containsKey(world)) {
PS.log("$2[&5Expire&dManager$2] $4Updating expired plots for: " + world);
PS.debug("$2[&5Expire&dManager$2] $4Updating expired plots for: " + world);
updateExpired(world);
return;
}
final List<Plot> plots = expiredPlots.get(world);
if ((plots == null) || (plots.size() == 0)) {
if (updateExpired(world)) {
PS.log("$2[&5Expire&dManager$2] $4Re-evaluating expired plots for: " + world);
PS.debug("$2[&5Expire&dManager$2] $4Re-evaluating expired plots for: " + world);
return;
}
continue;
@ -88,7 +95,7 @@ public class ExpireManager {
final Plot plot = plots.iterator().next();
if (!isExpired(plot)) {
expiredPlots.get(world).remove(plot);
PS.log("$2[&5Expire&dManager$2] &bSkipping no longer expired: " + plot);
PS.debug("$2[&5Expire&dManager$2] &bSkipping no longer expired: " + plot);
return;
}
for (final UUID helper : plot.getTrusted()) {
@ -105,7 +112,7 @@ public class ExpireManager {
}
final PlotManager manager = PS.get().getPlotManager(world);
if (manager == null) {
PS.log("$2[&5Expire&dManager$2] &cThis is a friendly reminder to create or delete " + world +" as it is currently setup incorrectly");
PS.debug("$2[&5Expire&dManager$2] &cThis is a friendly reminder to create or delete " + world +" as it is currently setup incorrectly");
expiredPlots.get(world).remove(plot);
return;
}
@ -116,7 +123,7 @@ public class ExpireManager {
PlotAnalysis changed = this.value;
if (Settings.CLEAR_THRESHOLD != -1 && plotworld.TYPE == 0 && changed != null) {
if (changed.getComplexity() > Settings.CLEAR_THRESHOLD) {
PS.log("$2[&5Expire&dManager$2] &bIgnoring modified plot: " + plot + " : " + changed.getComplexity() + " - " + changed.changes);
PS.debug("$2[&5Expire&dManager$2] &bIgnoring modified plot: " + plot + " : " + changed.getComplexity() + " - " + changed.changes);
expiredPlots.get(world).remove(plot);
FlagManager.addPlotFlag(plot, new Flag(FlagManager.getFlag("analysis"), value));
return;
@ -129,17 +136,17 @@ public class ExpireManager {
expiredPlots.get(world).remove(plot);
int complexity = changed == null ? 0 : changed.getComplexity();
int modified = changed == null ? 0 : changed.changes;
PS.log("$2[&5Expire&dManager$2] &cDeleted expired plot: " + plot + " : " + complexity + " - " + modified);
PS.log("$4 - World: " + plot.world);
PS.debug("$2[&5Expire&dManager$2] &cDeleted expired plot: " + plot + " : " + complexity + " - " + modified);
PS.debug("$4 - World: " + plot.world);
if (plot.hasOwner()) {
PS.log("$4 - Owner: " + UUIDHandler.getName(plot.owner));
PS.debug("$4 - Owner: " + UUIDHandler.getName(plot.owner));
} else {
PS.log("$4 - Owner: Unowned");
PS.debug("$4 - Owner: Unowned");
}
}
};
if (MainUtil.runners.containsKey(plot)) {
PS.log("$2[&5Expire&dManager$2] &bSkipping plot in use: " + plot);
PS.debug("$2[&5Expire&dManager$2] &bSkipping plot in use: " + plot);
expiredPlots.get(world).remove(plot);
this.run();
return;
@ -148,7 +155,7 @@ public class ExpireManager {
PlotAnalysis analysis = plot.getComplexity();
if (analysis != null) {
if (analysis.getComplexity() > Settings.CLEAR_THRESHOLD) {
PS.log("$2[&5Expire&dManager$2] &bSkipping modified: " + plot);
PS.debug("$2[&5Expire&dManager$2] &bSkipping modified: " + plot);
expiredPlots.get(world).remove(plot);
this.run();
return;

View File

@ -1,6 +1,11 @@
package com.intellectualcrafters.plot.util;
import java.io.*;
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.regex.Matcher;

View File

@ -20,16 +20,30 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.util;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map.Entry;
import java.util.UUID;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.config.Settings;
import com.intellectualcrafters.plot.database.DBFunc;
import com.intellectualcrafters.plot.object.*;
import com.plotsquared.bukkit.listeners.PlotListener;
import com.plotsquared.bukkit.util.bukkit.BukkitUtil;
import java.util.*;
import java.util.Map.Entry;
import com.intellectualcrafters.plot.object.BlockLoc;
import com.intellectualcrafters.plot.object.ChunkLoc;
import com.intellectualcrafters.plot.object.Location;
import com.intellectualcrafters.plot.object.Plot;
import com.intellectualcrafters.plot.object.PlotBlock;
import com.intellectualcrafters.plot.object.PlotCluster;
import com.intellectualcrafters.plot.object.PlotId;
import com.intellectualcrafters.plot.object.PlotManager;
import com.intellectualcrafters.plot.object.PlotPlayer;
import com.intellectualcrafters.plot.object.PlotWorld;
import com.intellectualcrafters.plot.object.PseudoRandom;
import com.intellectualcrafters.plot.object.RunnableVal;
import com.plotsquared.listener.PlotListener;
/**
* plot functions
@ -46,6 +60,30 @@ public class MainUtil {
static long state = 1;
static PseudoRandom random = new PseudoRandom();
public static short[][] x_loc;
public static short[][] y_loc;
public static short[][] z_loc;
public static void initCache() {
if (x_loc == null) {
x_loc = new short[16][4096];
y_loc = new short[16][4096];
z_loc = new short[16][4096];
for (int i = 0; i < 16; i++) {
int i4 = i << 4;
for (int j = 0; j < 4096; j++) {
final int y = (i4) + (j >> 8);
final int a = (j - ((y & 0xF) << 8));
final int z1 = (a >> 4);
final int x1 = a - (z1 << 4);
x_loc[i][j] = (short) x1;
y_loc[i][j] = (short) y;
z_loc[i][j] = (short) z1;
}
}
}
}
public static boolean isPlotArea(final Location location) {
final PlotWorld plotworld = PS.get().getPlotWorld(location.getWorld());
if (plotworld.TYPE == 2) {
@ -56,11 +94,11 @@ public class MainUtil {
public static String getName(UUID owner) {
if (owner == null) {
return "unowned";
return C.NONE.s();
}
String name = UUIDHandler.getName(owner);
if (name == null) {
return "unknown";
return C.UNKNOWN.s();
}
return name;
}
@ -80,8 +118,8 @@ public class MainUtil {
@Override
public void run() {
for (PlotPlayer pp : getPlayersInPlot(plot)) {
PlotListener.manager.plotExit(pp, plot);
PlotListener.manager.plotEntry(pp, plot);
PlotListener.plotExit(pp, plot);
PlotListener.plotEntry(pp, plot);
}
}
}, 1);
@ -751,7 +789,7 @@ public class MainUtil {
if (plotworld.ALLOW_SIGNS) {
final Location loc = manager.getSignLoc(plotworld, p);
final String id = p.id.x + ";" + p.id.y;
final String[] lines = new String[] { C.OWNER_SIGN_LINE_1.translated().replaceAll("%id%", id), C.OWNER_SIGN_LINE_2.translated().replaceAll("%id%", id).replaceAll("%plr%", name), C.OWNER_SIGN_LINE_3.translated().replaceAll("%id%", id).replaceAll("%plr%", name), C.OWNER_SIGN_LINE_4.translated().replaceAll("%id%", id).replaceAll("%plr%", name) };
final String[] lines = new String[] { C.OWNER_SIGN_LINE_1.formatted().replaceAll("%id%", id), C.OWNER_SIGN_LINE_2.formatted().replaceAll("%id%", id).replaceAll("%plr%", name), C.OWNER_SIGN_LINE_3.formatted().replaceAll("%id%", id).replaceAll("%plr%", name), C.OWNER_SIGN_LINE_4.formatted().replaceAll("%id%", id).replaceAll("%plr%", name) };
BlockManager.setSign(p.world, loc.getX(), loc.getY(), loc.getZ(), lines);
}
}

View File

@ -1,5 +1,34 @@
package com.intellectualcrafters.plot.util;
import java.io.BufferedInputStream;
import java.io.DataInput;
import java.io.DataInputStream;
import java.io.DataOutput;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.util.AbstractList;
import java.util.AbstractMap;
import java.util.AbstractSet;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentMap;
import java.util.zip.GZIPInputStream;
import java.util.zip.GZIPOutputStream;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.Server;
import org.bukkit.inventory.ItemStack;
import com.google.common.base.Splitter;
import com.google.common.collect.BiMap;
import com.google.common.collect.HashBiMap;
@ -10,20 +39,6 @@ import com.google.common.io.Files;
import com.google.common.io.InputSupplier;
import com.google.common.io.OutputSupplier;
import com.google.common.primitives.Primitives;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.Server;
import org.bukkit.inventory.ItemStack;
import java.io.*;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.util.*;
import java.util.concurrent.ConcurrentMap;
import java.util.zip.GZIPInputStream;
import java.util.zip.GZIPOutputStream;
public class NbtFactory {
// Convert between NBT id and the equivalent class in java

View File

@ -1,9 +0,0 @@
package com.intellectualcrafters.plot.util;
import com.intellectualcrafters.plot.object.PlotPlayer;
public abstract class PlayerManager {
public static PlayerManager manager;
public abstract void kickPlayer(PlotPlayer player, String reason);
}

View File

@ -0,0 +1,8 @@
package com.intellectualcrafters.plot.util;
public enum PlotGamemode {
ADVENTURE,
SURVIVAL,
CREATIVE,
SPECTATOR;
}

View File

@ -1,54 +0,0 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
// PlotSquared - A plot manager and world generator for the Bukkit API /
// Copyright (c) 2014 IntellectualSites/IntellectualCrafters /
// /
// This program is free software; you can redistribute it and/or modify /
// it under the terms of the GNU General Public License as published by /
// the Free Software Foundation; either version 3 of the License, or /
// (at your option) any later version. /
// /
// This program is distributed in the hope that it will be useful, /
// but WITHOUT ANY WARRANTY; without even the implied warranty of /
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /
// GNU General Public License for more details. /
// /
// You should have received a copy of the GNU General Public License /
// along with this program; if not, write to the Free Software Foundation, /
// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA /
// /
// You can contact us via: support@intellectualsites.com /
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.util;
import com.intellectualcrafters.plot.PS;
/**
* Created 2014-09-29 for PlotSquared
*
* @author Citymonstret
*/
public class PlotSquaredException extends RuntimeException {
public PlotSquaredException(final PlotError error, final String details) {
super("PlotError >> " + error.getHeader() + ": " + details);
PS.log("&cPlotError &6>> &c" + error.getHeader() + ": &6" + details);
}
public static enum PlotError {
PLOTMAIN_NULL("The PlotSquared instance was null"),
MISSING_DEPENDENCY("Missing Dependency");
private final String errorHeader;
PlotError(final String errorHeader) {
this.errorHeader = errorHeader;
}
public String getHeader() {
return this.errorHeader;
}
@Override
public String toString() {
return this.getHeader();
}
}
}

View File

@ -0,0 +1,7 @@
package com.intellectualcrafters.plot.util;
public enum PlotWeather {
RAIN,
CLEAR,
RESET;
}

View File

@ -20,9 +20,6 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.util;
import org.bukkit.Bukkit;
import org.bukkit.Server;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
@ -32,6 +29,9 @@ import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import org.bukkit.Bukkit;
import org.bukkit.Server;
/**
* @author DPOH-VAR
* @version 1.0

View File

@ -1,29 +1,56 @@
package com.intellectualcrafters.plot.util;
import com.google.common.collect.Lists;
import com.intellectualcrafters.jnbt.*;
import com.intellectualcrafters.json.JSONArray;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.Settings;
import com.intellectualcrafters.plot.object.*;
import com.intellectualcrafters.plot.object.schematic.PlotItem;
import com.plotsquared.bukkit.object.schematic.StateWrapper;
import com.plotsquared.bukkit.util.WorldEditSchematic;
import com.plotsquared.bukkit.util.bukkit.BukkitSchematicHandler;
import com.plotsquared.bukkit.util.bukkit.BukkitUtil;
import java.io.*;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLConnection;
import java.nio.channels.Channels;
import java.nio.channels.ReadableByteChannel;
import java.util.*;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import java.util.zip.GZIPInputStream;
import java.util.zip.GZIPOutputStream;
import com.google.common.collect.Lists;
import com.intellectualcrafters.jnbt.ByteArrayTag;
import com.intellectualcrafters.jnbt.CompoundTag;
import com.intellectualcrafters.jnbt.IntTag;
import com.intellectualcrafters.jnbt.ListTag;
import com.intellectualcrafters.jnbt.NBTInputStream;
import com.intellectualcrafters.jnbt.NBTOutputStream;
import com.intellectualcrafters.jnbt.ShortTag;
import com.intellectualcrafters.jnbt.StringTag;
import com.intellectualcrafters.jnbt.Tag;
import com.intellectualcrafters.json.JSONArray;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.Settings;
import com.intellectualcrafters.plot.object.ChunkLoc;
import com.intellectualcrafters.plot.object.Location;
import com.intellectualcrafters.plot.object.Plot;
import com.intellectualcrafters.plot.object.PlotBlock;
import com.intellectualcrafters.plot.object.PlotId;
import com.intellectualcrafters.plot.object.RunnableVal;
import com.intellectualcrafters.plot.object.schematic.PlotItem;
import com.plotsquared.bukkit.object.schematic.StateWrapper;
import com.plotsquared.bukkit.util.WorldEditSchematic;
public abstract class SchematicHandler {
public static SchematicHandler manager = new BukkitSchematicHandler();
public static SchematicHandler manager;
private boolean exportAll = false;
@ -69,7 +96,7 @@ public abstract class SchematicHandler {
Location bot = plot.getBottom();
int area = (1 + top.getX() - bot.getX()) * (1 + top.getZ() - bot.getZ());
if (area > 4096) {
PS.log("The plot is > 64 x 64 - Fast lossy schematic saving will be used");
PS.debug("The plot is > 64 x 64 - Fast lossy schematic saving will be used");
}
if (area <= 4096 && PS.get().worldEdit != null) {
new WorldEditSchematic().saveSchematic(directory + File.separator + name + ".schematic", plot.world, plot.id);
@ -126,7 +153,7 @@ public abstract class SchematicHandler {
public void run() {
if (whenDone != null) whenDone.value = false;
if (schematic == null) {
PS.log("Schematic == null :|");
PS.debug("Schematic == null :|");
TaskManager.runTask(whenDone);
return;
}
@ -139,7 +166,7 @@ public abstract class SchematicHandler {
Location bottom = plot.getBottom();
Location top = plot.getTop();
if (top.getX() - bottom.getX() < WIDTH || top.getZ() - bottom.getZ() < LENGTH || HEIGHT > 256) {
PS.log("Schematic is too large");
PS.debug("Schematic is too large");
TaskManager.runTask(whenDone);
return;
}
@ -338,7 +365,7 @@ public abstract class SchematicHandler {
public boolean pasteStates(final Schematic schematic, final Plot plot, final int x_offset, final int z_offset) {
if (schematic == null) {
PS.log("Schematic == null :|");
PS.debug("Schematic == null :|");
return false;
}
HashSet<PlotItem> items = schematic.getItems();
@ -461,7 +488,7 @@ public abstract class SchematicHandler {
*/
public Schematic getSchematic(File file) {
if (!file.exists()) {
PS.log(file.toString() + " doesn't exist");
PS.debug(file.toString() + " doesn't exist");
return null;
}
try {
@ -496,7 +523,7 @@ public abstract class SchematicHandler {
}
catch (Exception e) {
e.printStackTrace();
PS.log(is.toString() + " | " + is.getClass().getCanonicalName() + " is not in GZIP format : " + e.getMessage());
PS.debug(is.toString() + " | " + is.getClass().getCanonicalName() + " is not in GZIP format : " + e.getMessage());
}
return null;
}
@ -530,7 +557,7 @@ public abstract class SchematicHandler {
public URL upload(final CompoundTag tag, UUID uuid, String file) {
if (tag == null) {
PS.log("&cCannot save empty tag");
PS.debug("&cCannot save empty tag");
return null;
}
try {
@ -610,7 +637,7 @@ public abstract class SchematicHandler {
*/
public boolean save(final CompoundTag tag, final String path) {
if (tag == null) {
PS.log("&cCannot save empty tag");
PS.debug("&cCannot save empty tag");
return false;
}
try {

View File

@ -1,14 +1,13 @@
package com.intellectualcrafters.plot.util;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.object.ChunkLoc;
import com.intellectualcrafters.plot.object.PlotBlock;
import com.plotsquared.bukkit.generator.AugmentedPopulator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map.Entry;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.object.ChunkLoc;
import com.intellectualcrafters.plot.object.PlotBlock;
public class SetBlockQueue {
private volatile static HashMap<ChunkWrapper, PlotBlock[][]> blocks;
@ -46,8 +45,8 @@ public class SetBlockQueue {
public synchronized static void init() {
if (blocks == null) {
if (AugmentedPopulator.x_loc == null) {
AugmentedPopulator.initCache();
if (MainUtil.x_loc == null) {
MainUtil.initCache();
}
blocks = new HashMap<>();
runnables = new HashSet<>();
@ -100,9 +99,9 @@ public class SetBlockQueue {
}
PlotBlock block = blocksj[k];
if (block != null) {
int x = AugmentedPopulator.x_loc[j][k];
int y = AugmentedPopulator.y_loc[j][k];
int z = AugmentedPopulator.z_loc[j][k];
int x = MainUtil.x_loc[j][k];
int y = MainUtil.y_loc[j][k];
int z = MainUtil.z_loc[j][k];
BlockManager.manager.functionSetBlock(world, X + x, y, Z + z, block.id, block.data);
blocks[j][k] = null;
once = true;
@ -120,9 +119,9 @@ public class SetBlockQueue {
for (int k = 0; k < blocksj.length; k++) {
PlotBlock block = blocksj[k];
if (block != null) {
int x = AugmentedPopulator.x_loc[j][k];
int y = AugmentedPopulator.y_loc[j][k];
int z = AugmentedPopulator.z_loc[j][k];
int x = MainUtil.x_loc[j][k];
int y = MainUtil.y_loc[j][k];
int z = MainUtil.z_loc[j][k];
BlockManager.manager.functionSetBlock(world, X + x, y, Z + z, block.id, block.data);
}
}

View File

@ -1,14 +1,12 @@
package com.intellectualcrafters.plot.util;
import java.util.HashMap;
import java.util.Map;
import com.intellectualcrafters.plot.generator.PlotGenerator;
import com.intellectualcrafters.plot.object.PlotWorld;
import com.intellectualcrafters.plot.object.SetupObject;
import org.bukkit.generator.ChunkGenerator;
import java.util.HashMap;
import java.util.Map;
public abstract class SetupUtils {
public static SetupUtils manager;

View File

@ -62,13 +62,17 @@ public class StringComparison<T> {
this.bestMatchObject = objects[0];
input = input.toLowerCase();
for (final T o : objects) {
if ((c = compare(input, o.toString().toLowerCase())) < this.match) {
if ((c = compare(input, getString(o).toLowerCase())) < this.match) {
this.match = c;
this.bestMatch = o;
this.bestMatchObject = o;
}
}
}
public String getString(T o) {
return o.toString();
}
/**
* Compare two strings
@ -137,7 +141,7 @@ public class StringComparison<T> {
* @return match value
*/
public String getBestMatch() {
return this.bestMatch.toString();
return getString(this.bestMatch);
}
/**

View File

@ -1,11 +1,11 @@
package com.intellectualcrafters.plot.util;
import com.intellectualcrafters.plot.PS;
import java.util.HashMap;
import java.util.HashSet;
import java.util.concurrent.atomic.AtomicInteger;
import com.intellectualcrafters.plot.PS;
public abstract class TaskManager {
public static HashSet<String> TELEPORT_QUEUE = new HashSet<>();

View File

@ -1,14 +1,18 @@
package com.intellectualcrafters.plot.util;
import com.google.common.collect.BiMap;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.object.*;
import com.intellectualcrafters.plot.uuid.UUIDWrapper;
import java.util.HashSet;
import java.util.Map;
import java.util.UUID;
import com.google.common.collect.BiMap;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.object.OfflinePlotPlayer;
import com.intellectualcrafters.plot.object.Plot;
import com.intellectualcrafters.plot.object.PlotPlayer;
import com.intellectualcrafters.plot.object.RunnableVal;
import com.intellectualcrafters.plot.object.StringWrapper;
import com.intellectualcrafters.plot.uuid.UUIDWrapper;
public class UUIDHandler {
public static UUIDHandlerImplementation implementation;

View File

@ -1,5 +1,9 @@
package com.intellectualcrafters.plot.util;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
import com.google.common.collect.BiMap;
import com.google.common.collect.HashBiMap;
import com.intellectualcrafters.plot.PS;
@ -9,14 +13,8 @@ import com.intellectualcrafters.plot.object.OfflinePlotPlayer;
import com.intellectualcrafters.plot.object.PlotPlayer;
import com.intellectualcrafters.plot.object.RunnableVal;
import com.intellectualcrafters.plot.object.StringWrapper;
import com.plotsquared.bukkit.uuid.LowerOfflineUUIDWrapper;
import com.plotsquared.bukkit.uuid.OfflineUUIDWrapper;
import com.intellectualcrafters.plot.uuid.UUIDWrapper;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
public abstract class UUIDHandlerImplementation {
private BiMap<StringWrapper, UUID> uuidMap = HashBiMap.create(new HashMap<StringWrapper, UUID>());
@ -83,7 +81,7 @@ public abstract class UUIDHandlerImplementation {
}
uuidMap.put(name, uuid);
}
PS.log(C.PREFIX.s() + "&6Cached a total of: " + uuidMap.size() + " UUIDs");
PS.debug(C.PREFIX.s() + "&6Cached a total of: " + uuidMap.size() + " UUIDs");
}
});
}
@ -155,7 +153,7 @@ public abstract class UUIDHandlerImplementation {
return uuid;
}
// Read from disk OR convert directly to offline UUID
if (uuidWrapper instanceof OfflineUUIDWrapper || uuidWrapper instanceof LowerOfflineUUIDWrapper) {
if (Settings.OFFLINE_MODE) {
uuid = uuidWrapper.getUUID(name);
add(new StringWrapper(name), uuid);
return uuid;

View File

@ -1,12 +1,12 @@
package com.intellectualcrafters.plot.util.helpmenu;
import java.util.List;
import com.intellectualcrafters.plot.commands.CommandCategory;
import com.intellectualcrafters.plot.commands.MainCommand;
import com.intellectualcrafters.plot.object.PlotPlayer;
import com.plotsquared.general.commands.Command;
import java.util.List;
public class HelpMenu {
public static final int PER_PAGE = 5;

View File

@ -1,13 +1,13 @@
package com.intellectualcrafters.plot.util.helpmenu;
import java.util.ArrayList;
import java.util.List;
import com.intellectualcrafters.plot.commands.CommandCategory;
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.object.PlotPlayer;
import com.intellectualcrafters.plot.util.MainUtil;
import java.util.ArrayList;
import java.util.List;
public class HelpPage {
private final List<HelpObject> _helpObjecs;