Merge remote-tracking branch 'origin/master'

Conflicts:

	PlotSquared/src/main/java/com/intellectualcrafters/plot/util/PlotHelper.java
This commit is contained in:
boy0001 2014-11-21 14:14:33 +11:00
commit 2a9119c7c3
55 changed files with 1021 additions and 377 deletions

View File

@ -75,6 +75,9 @@ import java.util.concurrent.TimeUnit;
@SuppressWarnings("unused") @SuppressWarnings("unused")
public class PlotMain extends JavaPlugin { public class PlotMain extends JavaPlugin {
/**
* Permission that allows for "everything"
*/
public static final String ADMIN_PERMISSION = public static final String ADMIN_PERMISSION =
"plots.admin"; "plots.admin";
/** /**
@ -192,7 +195,7 @@ public class PlotMain extends JavaPlugin {
e.printStackTrace(); e.printStackTrace();
} }
} }
}, 0l, /*12 * 60 * 60 * 20l*/ 86_40_00L); }, 0l, 86_40_00L);
} }
/** /**
@ -274,6 +277,7 @@ public class PlotMain extends JavaPlugin {
* Set the uuid saver * Set the uuid saver
* *
* @param saver new saver * @param saver new saver
* @see com.intellectualcrafters.plot.uuid.UUIDSaver
*/ */
public static void setUUIDSaver(final UUIDSaver saver) { public static void setUUIDSaver(final UUIDSaver saver) {
uuidSaver = saver; uuidSaver = saver;
@ -372,6 +376,12 @@ public class PlotMain extends JavaPlugin {
return new HashSet<>(myplots); return new HashSet<>(myplots);
} }
/**
* Get plots for the specified world
*
* @param world A world, in which you want to search for plots
* @return HashMap containing Plot IDs and Plot Objects
*/
public static HashMap<PlotId, Plot> getPlots(final String world) { public static HashMap<PlotId, Plot> getPlots(final String world) {
if (plots.containsKey(world)) { if (plots.containsKey(world)) {
return plots.get(world); return plots.get(world);
@ -479,6 +489,13 @@ public class PlotMain extends JavaPlugin {
return (values.toArray(new Plot[values.size()])); return (values.toArray(new Plot[values.size()]));
} }
/**
* Remove a plot
* @param world The Plot World
* @param id The Plot ID
* @param callEvent Whether or not to call the PlotDeleteEvent
* @return true if successful, false if not
*/
public static boolean removePlot(final String world, final PlotId id, final boolean callEvent) { public static boolean removePlot(final String world, final PlotId id, final boolean callEvent) {
if (callEvent) { if (callEvent) {
final PlotDeleteEvent event = new PlotDeleteEvent(world, id); final PlotDeleteEvent event = new PlotDeleteEvent(world, id);
@ -595,7 +612,12 @@ public class PlotMain extends JavaPlugin {
} }
} }
private static double getJavaVersion() { /**
* Get the java version
*
* @return Java Version as a double
*/
public static double getJavaVersion() {
return Double.parseDouble(System.getProperty("java.specification.version")); return Double.parseDouble(System.getProperty("java.specification.version"));
} }
@ -623,27 +645,12 @@ public class PlotMain extends JavaPlugin {
} }
/** /**
* .. * Teleport a player to a plot
* @param player Player to teleport
* @param from Previous Location
* @param plot Plot to teleport to
* @return true if successful
*/ */
// Old Stuff
/*
* private static boolean checkForUpdate() throws IOException { URL call =
* new URL(Settings.Update.VERSION_URL); InputStream stream =
* call.openStream(); BufferedReader reader = new BufferedReader(new
* InputStreamReader(stream)); String latest = reader.readLine();
* reader.close(); return
* !getPlotMain().getDescription().getVersion().equalsIgnoreCase(latest); }
* private static String getNextUpdateString() throws IOException { URL call
* = new URL(Settings.Update.VERSION_URL); InputStream stream =
* call.openStream(); BufferedReader reader = new BufferedReader(new
* InputStreamReader(stream)); return reader.readLine(); } private static
* void update() throws IOException { sendConsoleSenderMessage(C.PREFIX.s()
* + "&c&lThere is an update! New Update: &6&l" + getNextUpdateString() +
* "&c&l, Current Update: &6&l" +
* getPlotMain().getDescription().getVersion()); }
*/
public static boolean teleportPlayer(final Player player, final Location from, final Plot plot) { public static boolean teleportPlayer(final Player player, final Location from, final Plot plot) {
final PlayerTeleportToPlotEvent event = new PlayerTeleportToPlotEvent(player, from, plot); final PlayerTeleportToPlotEvent event = new PlayerTeleportToPlotEvent(player, from, plot);
Bukkit.getServer().getPluginManager().callEvent(event); Bukkit.getServer().getPluginManager().callEvent(event);
@ -704,10 +711,19 @@ public class PlotMain extends JavaPlugin {
System.out.println(ChatColor.stripColor(ChatColor.translateAlternateColorCodes('&', C.PREFIX.s() + c.s()))); System.out.println(ChatColor.stripColor(ChatColor.translateAlternateColorCodes('&', C.PREFIX.s() + c.s())));
} }
/**
* Reload all translations
* @throws IOException
*/
public static void reloadTranslations() throws IOException { public static void reloadTranslations() throws IOException {
C.setupTranslations(); C.setupTranslations();
} }
/**
* Ge the last played time
* @param uuid UUID for the player
* @return last play time as a long
*/
public static long getLastPlayed(final UUID uuid) { public static long getLastPlayed(final UUID uuid) {
if (uuid == null) { if (uuid == null) {
return 0; return 0;
@ -923,7 +939,7 @@ public class PlotMain extends JavaPlugin {
options.put("api.location", Settings.API_URL); options.put("api.location", Settings.API_URL);
options.put("api.custom", Settings.CUSTOM_API); options.put("api.custom", Settings.CUSTOM_API);
options.put("titles", Settings.TITLES); options.put("titles", Settings.TITLES);
options.put("teleport.on_login", Settings.TELEPORT_ON_LOGIN);
options.put("perm-based-mob-cap.enabled", Settings.MOB_CAP_ENABLED); options.put("perm-based-mob-cap.enabled", Settings.MOB_CAP_ENABLED);
options.put("perm-based-mob-cap.max", Settings.MOB_CAP); options.put("perm-based-mob-cap.max", Settings.MOB_CAP);
@ -936,6 +952,7 @@ public class PlotMain extends JavaPlugin {
if (Settings.DEBUG) { if (Settings.DEBUG) {
sendConsoleSenderMessage(C.PREFIX.s() + "&6Debug Mode Enabled (Default). Edit the config to turn this off."); sendConsoleSenderMessage(C.PREFIX.s() + "&6Debug Mode Enabled (Default). Edit the config to turn this off.");
} }
Settings.TELEPORT_ON_LOGIN = config.getBoolean("teleport.on_login");
Settings.KILL_ROAD_MOBS = config.getBoolean("kill_road_mobs"); Settings.KILL_ROAD_MOBS = config.getBoolean("kill_road_mobs");
Settings.WORLDGUARD = config.getBoolean("worldguard.enabled"); Settings.WORLDGUARD = config.getBoolean("worldguard.enabled");
Settings.MOB_PATHFINDING = config.getBoolean("mob_pathfinding"); Settings.MOB_PATHFINDING = config.getBoolean("mob_pathfinding");
@ -949,6 +966,10 @@ public class PlotMain extends JavaPlugin {
Settings.SCHEMATIC_SAVE_PATH = config.getString("schematics.save_path"); Settings.SCHEMATIC_SAVE_PATH = config.getString("schematics.save_path");
} }
/**
* Create a plotworld config section
* @param plotworld World to create the section for
*/
@SuppressWarnings("unused") @SuppressWarnings("unused")
public static void createConfiguration(final PlotWorld plotworld) { public static void createConfiguration(final PlotWorld plotworld) {
final Map<String, Object> options = new HashMap<>(); final Map<String, Object> options = new HashMap<>();
@ -1276,6 +1297,12 @@ public class PlotMain extends JavaPlugin {
}); });
} }
/**
* Add a Plot world
* @param world World to add
* @param plotworld PlotWorld Object
* @param manager Plot Manager for the new world
*/
public static void addPlotWorld(final String world, final PlotWorld plotworld, final PlotManager manager) { public static void addPlotWorld(final String world, final PlotWorld plotworld, final PlotManager manager) {
worlds.put(world, plotworld); worlds.put(world, plotworld);
managers.put(world, manager); managers.put(world, manager);
@ -1284,33 +1311,56 @@ public class PlotMain extends JavaPlugin {
} }
} }
/**
* Remove a plot world
* @param world World to remove
*/
public static void removePlotWorld(final String world) { public static void removePlotWorld(final String world) {
plots.remove(world); plots.remove(world);
managers.remove(world); managers.remove(world);
worlds.remove(world); worlds.remove(world);
} }
/**
* Get all plots
* @return All Plos in a hashmap (world, Hashmap contiang ids and objects))
*/
public static HashMap<String, HashMap<PlotId, Plot>> getAllPlotsRaw() { public static HashMap<String, HashMap<PlotId, Plot>> getAllPlotsRaw() {
return plots; return plots;
} }
public static void setAllPlotsRaw(final HashMap<String, HashMap<PlotId, Plot>> plots) { /**
PlotMain.plots = new LinkedHashMap<>(plots); * Set all plots
// PlotMain.plots.putAll(plots); *
} * @param plots New Plot LinkedHashMap
*/
public static void setAllPlotsRaw(final LinkedHashMap<String, HashMap<PlotId, Plot>> plots) { public static void setAllPlotsRaw(final LinkedHashMap<String, HashMap<PlotId, Plot>> plots) {
PlotMain.plots = plots; PlotMain.plots = plots;
} }
/** /**
* !!WorldGeneration!! * Set all plots
*
* @param plots New Plot HashMap
*/
public static void setAllPlotsRaw(final HashMap<String, HashMap<PlotId, Plot>> plots) {
PlotMain.plots = new LinkedHashMap<>(plots);
// PlotMain.plots.putAll(plots);
}
/**
* Get the PlotSquared World Generator
*
* @see com.intellectualcrafters.plot.generator.WorldGenerator
*/ */
@Override @Override
public ChunkGenerator getDefaultWorldGenerator(final String world, final String id) { final public ChunkGenerator getDefaultWorldGenerator(final String world, final String id) {
return new WorldGenerator(world); return new WorldGenerator(world);
} }
/**
* Setup the logger mechanics
*/
private void setupLogger() { private void setupLogger() {
final File log = new File(getMain().getDataFolder() + File.separator + "logs" + File.separator + "plots.log"); final File log = new File(getMain().getDataFolder() + File.separator + "logs" + File.separator + "plots.log");
if (!log.exists()) { if (!log.exists()) {
@ -1337,7 +1387,7 @@ public class PlotMain extends JavaPlugin {
*/ */
@Override @Override
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
public void onEnable() { final public void onEnable() {
// Pre-Steps // Pre-Steps
{ {
// Init the logger // Init the logger
@ -1569,7 +1619,7 @@ public class PlotMain extends JavaPlugin {
* On unload * On unload
*/ */
@Override @Override
public void onDisable() { final public void onDisable() {
try { try {
C.saveTranslations(); C.saveTranslations();
} catch (Exception e) { } catch (Exception e) {

View File

@ -33,7 +33,9 @@ import com.intellectualcrafters.plot.object.PlotManager;
import com.intellectualcrafters.plot.object.PlotWorld; import com.intellectualcrafters.plot.object.PlotWorld;
import com.intellectualcrafters.plot.util.PlayerFunctions; import com.intellectualcrafters.plot.util.PlayerFunctions;
import com.intellectualcrafters.plot.util.PlotHelper; import com.intellectualcrafters.plot.util.PlotHelper;
import com.intellectualcrafters.plot.util.PlotSquaredException;
import com.intellectualcrafters.plot.util.SchematicHandler; import com.intellectualcrafters.plot.util.SchematicHandler;
import com.sun.istack.internal.NotNull;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.World; import org.bukkit.World;
@ -45,41 +47,70 @@ import java.util.ArrayList;
import java.util.Set; import java.util.Set;
/** /**
* The plotMain api class. * PlotSquared API
* *
* @author Citymonstret, Empire92 * @author Citymonstret
* @author Empire92
*
* @version API 2.0
*/ */
@SuppressWarnings({"unused", "javadoc"})
@SuppressWarnings("unused")
public class PlotAPI { public class PlotAPI {
/** /**
* Admin Permission * Permission that allows for admin access,
* this permission node will allow the player
* to use any part of the plugin, without limitations.
*/ */
public static final String ADMIN_PERMISSION = "plots.admin"; public static final String ADMIN_PERMISSION = "plots.admin";
/**
* Plot Helper Class
* <p/>
* General functions involving plots, and the management of them
*
* @see com.intellectualcrafters.plot.util.PlotHelper
*/
private static PlotHelper plotHelper; private static PlotHelper plotHelper;
/**
* Player Functions
*
* General functions involving players, and plot worlds
* @see com.intellectualcrafters.plot.util.PlayerFunctions
*/
private static PlayerFunctions playerFunctions; private static PlayerFunctions playerFunctions;
/**
* Flag Manager
*
* The manager which handles all flags
* @see com.intellectualcrafters.plot.flag.FlagManager
*/
private static FlagManager flagManager; private static FlagManager flagManager;
/**
* Schematic Handler
*
* The handler which is used to create, and paste, schematics
* @see com.intellectualcrafters.plot.util.SchematicHandler
*/
private static SchematicHandler schematicHandler; private static SchematicHandler schematicHandler;
// Methods/fields in PlotMain class /**
* The translation class.
// PlotMain.checkForExpiredPlots(); #Ignore *
// PlotMain.killAllEntities(); #Ignore * @see com.intellectualcrafters.plot.config.C
// */
// PlotMain.createConfiguration(plotworld);
// PlotMain.getPlots(player)
// PlotMain.getPlots(world)
// PlotMain.getPlots(world, player)
// PlotMain.getWorldPlots(world)
// PlotMain.getPlotWorlds()
// PlotMain.isPlotWorld(world)
// PlotMain.removePlot(world, id, callEvent)
// PlotMain.teleportPlayer(player, from, plot)
// PlotMain.updatePlot(plot);
private static C c; private static C c;
// Reference /**
// To access plotMain stuff. * PlotMain instance
*
* This is the instance that allows for most methods to be used.
* @see com.intellectualcrafters.plot.PlotMain
*/
private final PlotMain plotMain; private final PlotMain plotMain;
/** /**
@ -87,15 +118,21 @@ public class PlotAPI {
* (Optimally the plugin that is accessing the method) * (Optimally the plugin that is accessing the method)
* *
* @param plugin Plugin used to access this method * @param plugin Plugin used to access this method
* @throws com.intellectualcrafters.plot.util.PlotSquaredException if the program fails to fetch the PlotMain instance
* @see com.intellectualcrafters.plot.PlotMain
*/ */
public PlotAPI(final JavaPlugin plugin) { public PlotAPI(@NotNull final JavaPlugin plugin) {
this.plotMain = JavaPlugin.getPlugin(PlotMain.class); this.plotMain = JavaPlugin.getPlugin(PlotMain.class);
if (plotMain == null) {
throw new PlotSquaredException(PlotSquaredException.PlotError.PLOTMAIN_NULL, "Failed to fetch the plotmain instance, Plot API for " + plugin.getName() + " will be disabled");
}
} }
/** /**
* Get all plots * Get all plots
* *
* @return all plots * @return all plots
* @see com.intellectualcrafters.plot.PlotMain#getPlots()
*/ */
public Set<Plot> getAllPlots() { public Set<Plot> getAllPlots() {
return PlotMain.getPlots(); return PlotMain.getPlots();
@ -104,15 +141,15 @@ public class PlotAPI {
/** /**
* Return all plots for a player * Return all plots for a player
* *
* @param player * @param player Player, whose plots to search for
* @return all plots that a player owns * @return all plots that a player owns
*/ */
public Set<Plot> getPlayerPlots(final Player player) { public Set<Plot> getPlayerPlots(@NotNull final Player player) {
return PlotMain.getPlots(player); return PlotMain.getPlots(player);
} }
/** /**
* Add a plotoworld * Add a plot world
* *
* @param world World Name * @param world World Name
* @param plotWorld Plot World Object * @param plotWorld Plot World Object
@ -121,7 +158,7 @@ public class PlotAPI {
* com.intellectualcrafters.plot.object.PlotWorld, * com.intellectualcrafters.plot.object.PlotWorld,
* com.intellectualcrafters.plot.object.PlotManager) * com.intellectualcrafters.plot.object.PlotManager)
*/ */
public void addPlotWorld(final String world, final PlotWorld plotWorld, final PlotManager manager) { public void addPlotWorld(@NotNull final String world, @NotNull final PlotWorld plotWorld, @NotNull final PlotManager manager) {
PlotMain.addPlotWorld(world, plotWorld, manager); PlotMain.addPlotWorld(world, plotWorld, manager);
} }
@ -147,6 +184,7 @@ public class PlotAPI {
* Only use this if you really need it * Only use this if you really need it
* *
* @return PlotMain PlotSquared Main Class * @return PlotMain PlotSquared Main Class
* @see com.intellectualcrafters.plot.PlotMain
*/ */
public PlotMain getMain() { public PlotMain getMain() {
return this.plotMain; return this.plotMain;
@ -156,6 +194,7 @@ public class PlotAPI {
* PlotHelper class contains useful methods relating to plots. * PlotHelper class contains useful methods relating to plots.
* *
* @return PlotHelper * @return PlotHelper
* @see com.intellectualcrafters.plot.util.PlotHelper
*/ */
public PlotHelper getPlotHelper() { public PlotHelper getPlotHelper() {
return plotHelper; return plotHelper;
@ -166,6 +205,7 @@ public class PlotAPI {
* player/plot methods are here as well * player/plot methods are here as well
* *
* @return PlayerFunctions * @return PlayerFunctions
* @see com.intellectualcrafters.plot.util.PlayerFunctions
*/ */
public PlayerFunctions getPlayerFunctions() { public PlayerFunctions getPlayerFunctions() {
return playerFunctions; return playerFunctions;
@ -175,6 +215,7 @@ public class PlotAPI {
* FlagManager class contains methods relating to plot flags * FlagManager class contains methods relating to plot flags
* *
* @return FlagManager * @return FlagManager
* @see com.intellectualcrafters.plot.flag.FlagManager
*/ */
public FlagManager getFlagManager() { public FlagManager getFlagManager() {
return flagManager; return flagManager;
@ -184,6 +225,7 @@ public class PlotAPI {
* SchematicHandler class contains methods related to pasting schematics * SchematicHandler class contains methods related to pasting schematics
* *
* @return SchematicHandler * @return SchematicHandler
* @see com.intellectualcrafters.plot.util.SchematicHandler
*/ */
public SchematicHandler getSchematicHandler() { public SchematicHandler getSchematicHandler() {
return schematicHandler; return schematicHandler;
@ -193,6 +235,7 @@ public class PlotAPI {
* C class contains all the captions from the translations.yml file. * C class contains all the captions from the translations.yml file.
* *
* @return C * @return C
* @see com.intellectualcrafters.plot.config.C
*/ */
public C getCaptions() { public C getCaptions() {
return c; return c;
@ -202,10 +245,12 @@ public class PlotAPI {
* Get the plot manager for a world. - Most of these methods can be accessed * Get the plot manager for a world. - Most of these methods can be accessed
* through the PlotHelper * through the PlotHelper
* *
* @param world * @param world Which manager to get
* @return PlotManager * @return PlotManager
* @see com.intellectualcrafters.plot.object.PlotManager
* @see PlotMain#getPlotManager(org.bukkit.World)
*/ */
public PlotManager getPlotManager(final World world) { public PlotManager getPlotManager(@NotNull final World world) {
return PlotMain.getPlotManager(world); return PlotMain.getPlotManager(world);
} }
@ -213,10 +258,12 @@ public class PlotAPI {
* Get the plot manager for a world. - Contains useful low level methods for * Get the plot manager for a world. - Contains useful low level methods for
* plot merging, clearing, and tessellation * plot merging, clearing, and tessellation
* *
* @param world * @param world Plot World
* @return PlotManager * @return PlotManager
* @see PlotMain#getPlotManager(String)
* @see com.intellectualcrafters.plot.object.PlotManager
*/ */
public PlotManager getPlotManager(final String world) { public PlotManager getPlotManager(@NotNull final String world) {
return PlotMain.getPlotManager(world); return PlotMain.getPlotManager(world);
} }
@ -228,8 +275,10 @@ public class PlotAPI {
* @param world (to get settings of) * @param world (to get settings of)
* @return PlotWorld class for that world ! will return null if not a plot * @return PlotWorld class for that world ! will return null if not a plot
* world world * world world
* @see PlotMain#getWorldSettings(org.bukkit.World)
* @see com.intellectualcrafters.plot.object.PlotWorld
*/ */
public PlotWorld getWorldSettings(final World world) { public PlotWorld getWorldSettings(@NotNull final World world) {
return PlotMain.getWorldSettings(world); return PlotMain.getWorldSettings(world);
} }
@ -239,37 +288,42 @@ public class PlotAPI {
* @param world (to get settings of) * @param world (to get settings of)
* @return PlotWorld class for that world ! will return null if not a plot * @return PlotWorld class for that world ! will return null if not a plot
* world world * world world
* @see PlotMain#getWorldSettings(String)
* @see com.intellectualcrafters.plot.object.PlotWorld
*/ */
public PlotWorld getWorldSettings(final String world) { public PlotWorld getWorldSettings(@NotNull final String world) {
return PlotMain.getWorldSettings(world); return PlotMain.getWorldSettings(world);
} }
/** /**
* Send a message to a player. * Send a message to a player.
* *
* @param player * @param player Player that will receive the message
* @param c (Caption) * @param c (Caption)
* @see com.intellectualcrafters.plot.util.PlayerFunctions#sendMessage(org.bukkit.entity.Player, com.intellectualcrafters.plot.config.C, String...)
*/ */
public void sendMessage(final Player player, final C c) { public void sendMessage(@NotNull final Player player, @NotNull final C c) {
PlayerFunctions.sendMessage(player, c); PlayerFunctions.sendMessage(player, c);
} }
/** /**
* Send a message to a player. - Supports color codes * Send a message to a player. - Supports color codes
* *
* @param player * @param player Player that will receive the message
* @param string * @param string The message
* @see com.intellectualcrafters.plot.util.PlayerFunctions#sendMessage(org.bukkit.entity.Player, String)
*/ */
public void sendMessage(final Player player, final String string) { public void sendMessage(@NotNull final Player player, @NotNull final String string) {
PlayerFunctions.sendMessage(player, string); PlayerFunctions.sendMessage(player, string);
} }
/** /**
* Send a message to the console. - Supports color codes * Send a message to the console. - Supports color codes
* *
* @param msg * @param msg Message that should be sent to the console
* @see PlotMain#sendConsoleSenderMessage(String)
*/ */
public void sendConsoleMessage(final String msg) { public void sendConsoleMessage(@NotNull final String msg) {
PlotMain.sendConsoleSenderMessage(msg); PlotMain.sendConsoleSenderMessage(msg);
} }
@ -277,17 +331,21 @@ public class PlotAPI {
* Send a message to the console * Send a message to the console
* *
* @param c (Caption) * @param c (Caption)
* @see #sendConsoleMessage(String)
* @see com.intellectualcrafters.plot.config.C
*/ */
public void sendConsoleMessage(final C c) { public void sendConsoleMessage(@NotNull final C c) {
sendConsoleMessage(c.s()); sendConsoleMessage(c.s());
} }
/** /**
* Register a flag for use in plots * Register a flag for use in plots
* *
* @param flag * @param flag Flag that should be registered
* @see com.intellectualcrafters.plot.flag.FlagManager#addFlag(com.intellectualcrafters.plot.flag.AbstractFlag)
* @see com.intellectualcrafters.plot.flag.AbstractFlag
*/ */
public void addFlag(final AbstractFlag flag) { public void addFlag(@NotNull final AbstractFlag flag) {
FlagManager.addFlag(flag); FlagManager.addFlag(flag);
} }
@ -295,6 +353,8 @@ public class PlotAPI {
* get all the currently registered flags * get all the currently registered flags
* *
* @return array of Flag[] * @return array of Flag[]
* @see com.intellectualcrafters.plot.flag.FlagManager#getFlags()
* @see com.intellectualcrafters.plot.flag.AbstractFlag
*/ */
public AbstractFlag[] getFlags() { public AbstractFlag[] getFlags() {
return FlagManager.getFlags().toArray(new AbstractFlag[FlagManager.getFlags().size()]); return FlagManager.getFlags().toArray(new AbstractFlag[FlagManager.getFlags().size()]);
@ -303,42 +363,49 @@ public class PlotAPI {
/** /**
* Get a plot based on the ID * Get a plot based on the ID
* *
* @param world * @param world World in which the plot is located
* @param x * @param x Plot Location X Co-ord
* @param z * @param z Plot Location Z Co-ord
* @return plot, null if ID is wrong * @return plot, null if ID is wrong
* @see PlotHelper#getPlot(org.bukkit.World, com.intellectualcrafters.plot.object.PlotId)
* @see com.intellectualcrafters.plot.object.Plot
*/ */
public Plot getPlot(final World world, final int x, final int z) { public Plot getPlot(@NotNull final World world, final int x, final int z) {
return PlotHelper.getPlot(world, new PlotId(x, z)); return PlotHelper.getPlot(world, new PlotId(x, z));
} }
/** /**
* Get a plot based on the location * Get a plot based on the location
* *
* @param l * @param l The location that you want to to retrieve the plot from
* @return plot if found, otherwise it creates a temporary plot- * @return plot if found, otherwise it creates a temporary plot-
* @see PlotHelper#getCurrentPlot(org.bukkit.Location)
* @see com.intellectualcrafters.plot.object.Plot
*/ */
public Plot getPlot(final Location l) { public Plot getPlot(@NotNull final Location l) {
return PlotHelper.getCurrentPlot(l); return PlotHelper.getCurrentPlot(l);
} }
/** /**
* Get a plot based on the player location * Get a plot based on the player location
* *
* @param player * @param player Get the current plot for the player location
* @return plot if found, otherwise it creates a temporary plot * @return plot if found, otherwise it creates a temporary plot
* @see #getPlot(org.bukkit.Location)
* @see com.intellectualcrafters.plot.object.Plot
*/ */
public Plot getPlot(final Player player) { public Plot getPlot(@NotNull final Player player) {
return this.getPlot(player.getLocation()); return this.getPlot(player.getLocation());
} }
/** /**
* Check whether or not a player has a plot * Check whether or not a player has a plot
* *
* @param player * @param player Player that you want to check for
* @return true if player has a plot, false if not. * @return true if player has a plot, false if not.
* @see #getPlots(org.bukkit.World, org.bukkit.entity.Player, boolean)
*/ */
public boolean hasPlot(final World world, final Player player) { public boolean hasPlot(@NotNull final World world, @NotNull final Player player) {
return (getPlots(world, player, true) != null) && (getPlots(world, player, true).length > 0); return (getPlots(world, player, true) != null) && (getPlots(world, player, true).length > 0);
} }
@ -347,8 +414,9 @@ public class PlotAPI {
* *
* @param plr to search for * @param plr to search for
* @param just_owner should we just search for owner? Or with rights? * @param just_owner should we just search for owner? Or with rights?
* @see com.intellectualcrafters.plot.object.Plot
*/ */
public Plot[] getPlots(final World world, final Player plr, final boolean just_owner) { public Plot[] getPlots(@NotNull final World world, @NotNull final Player plr, final boolean just_owner) {
final ArrayList<Plot> pPlots = new ArrayList<>(); final ArrayList<Plot> pPlots = new ArrayList<>();
for (final Plot plot : PlotMain.getPlots(world).values()) { for (final Plot plot : PlotMain.getPlots(world).values()) {
if (just_owner) { if (just_owner) {
@ -369,8 +437,10 @@ public class PlotAPI {
* *
* @param world to get plots of * @param world to get plots of
* @return Plot[] - array of plot objects in world * @return Plot[] - array of plot objects in world
* @see PlotMain#getWorldPlots(org.bukkit.World)
* @see com.intellectualcrafters.plot.object.Plot
*/ */
public Plot[] getPlots(final World world) { public Plot[] getPlots(@NotNull final World world) {
return PlotMain.getWorldPlots(world); return PlotMain.getWorldPlots(world);
} }
@ -378,6 +448,7 @@ public class PlotAPI {
* Get all plot worlds * Get all plot worlds
* *
* @return World[] - array of plot worlds * @return World[] - array of plot worlds
* @see com.intellectualcrafters.plot.PlotMain#getPlotWorlds()
*/ */
public String[] getPlotWorlds() { public String[] getPlotWorlds() {
return PlotMain.getPlotWorlds(); return PlotMain.getPlotWorlds();
@ -388,18 +459,24 @@ public class PlotAPI {
* *
* @param world (to check if plot world) * @param world (to check if plot world)
* @return boolean (if plot world or not) * @return boolean (if plot world or not)
* @see com.intellectualcrafters.plot.PlotMain#isPlotWorld(org.bukkit.World)
*/ */
public boolean isPlotWorld(final World world) { public boolean isPlotWorld(@NotNull final World world) {
return PlotMain.isPlotWorld(world); return PlotMain.isPlotWorld(world);
} }
/** /**
* Get plot locations * Get plot locations
* *
* @param p * @param p Plot that you want to get the locations for
* @return [0] = bottomLc, [1] = topLoc, [2] = home * @return [0] = bottomLc, [1] = topLoc, [2] = home
* @see com.intellectualcrafters.plot.util.PlotHelper#getPlotBottomLoc(org.bukkit.World, com.intellectualcrafters.plot.object.PlotId)
* @see com.intellectualcrafters.plot.util.PlotHelper#getPlotTopLoc(org.bukkit.World, com.intellectualcrafters.plot.object.PlotId)
* @see com.intellectualcrafters.plot.util.PlotHelper#getPlotHome(org.bukkit.World, com.intellectualcrafters.plot.object.Plot)
* @see com.intellectualcrafters.plot.object.PlotHomePosition
* @see com.intellectualcrafters.plot.object.Plot
*/ */
public Location[] getLocations(final Plot p) { public Location[] getLocations(@NotNull final Plot p) {
final World world = Bukkit.getWorld(p.world); final World world = Bukkit.getWorld(p.world);
return new Location[]{PlotHelper.getPlotBottomLoc(world, p.id), PlotHelper.getPlotTopLoc(world, p.id), PlotHelper.getPlotHome(world, p.id)}; return new Location[]{PlotHelper.getPlotBottomLoc(world, p.id), PlotHelper.getPlotTopLoc(world, p.id), PlotHelper.getPlotHome(world, p.id)};
} }
@ -407,31 +484,38 @@ public class PlotAPI {
/** /**
* Get home location * Get home location
* *
* @param p * @param p Plot that you want to get the location for
* @return plot bottom location * @return plot bottom location
* @see com.intellectualcrafters.plot.util.PlotHelper#getPlotHome(org.bukkit.World, com.intellectualcrafters.plot.object.Plot)
* @see com.intellectualcrafters.plot.object.PlotHomePosition
* @see com.intellectualcrafters.plot.object.Plot
*/ */
public Location getHomeLocation(final Plot p) { public Location getHomeLocation(@NotNull final Plot p) {
return PlotHelper.getPlotHome(p.getWorld(), p.id); return PlotHelper.getPlotHome(p.getWorld(), p.id);
} }
/** /**
* Get Bottom Location * Get Bottom Location (min, min, min)
* *
* @param p * @param p Plot that you want to get the location for
* @return plot bottom location * @return plot bottom location
* @see com.intellectualcrafters.plot.util.PlotHelper#getPlotBottomLoc(org.bukkit.World, com.intellectualcrafters.plot.object.PlotId)
* @see com.intellectualcrafters.plot.object.Plot
*/ */
public Location getBottomLocation(final Plot p) { public Location getBottomLocation(@NotNull final Plot p) {
final World world = Bukkit.getWorld(p.world); final World world = Bukkit.getWorld(p.world);
return PlotHelper.getPlotBottomLoc(world, p.id); return PlotHelper.getPlotBottomLoc(world, p.id);
} }
/** /**
* Get Top Location * Get Top Location (max, max, max)
* *
* @param p * @param p Plot that you want to get the location for
* @return plot top location * @return plot top location
* @see PlotHelper#getPlotTopLoc(org.bukkit.World, com.intellectualcrafters.plot.object.PlotId)
* @see com.intellectualcrafters.plot.object.Plot
*/ */
public Location getTopLocation(final Plot p) { public Location getTopLocation(@NotNull final Plot p) {
final World world = Bukkit.getWorld(p.world); final World world = Bukkit.getWorld(p.world);
return PlotHelper.getPlotTopLoc(world, p.id); return PlotHelper.getPlotTopLoc(world, p.id);
} }
@ -439,19 +523,22 @@ public class PlotAPI {
/** /**
* Check whether or not a player is in a plot * Check whether or not a player is in a plot
* *
* @param player * @param player who we're checking for
* @return true if the player is in a plot, false if not- * @return true if the player is in a plot, false if not-
* @see com.intellectualcrafters.plot.util.PlayerFunctions#isInPlot(org.bukkit.entity.Player)
*/ */
public boolean isInPlot(final Player player) { public boolean isInPlot(@NotNull final Player player) {
return PlayerFunctions.isInPlot(player); return PlayerFunctions.isInPlot(player);
} }
/** /**
* Register a subcommand * Register a subcommand
* *
* @param c * @param c SubCommand, that we want to register
* @see com.intellectualcrafters.plot.commands.MainCommand#subCommands
* @see com.intellectualcrafters.plot.commands.SubCommand
*/ */
public void registerCommand(final SubCommand c) { public void registerCommand(@NotNull final SubCommand c) {
MainCommand.subCommands.add(c); MainCommand.subCommands.add(c);
} }
@ -459,6 +546,7 @@ public class PlotAPI {
* Get the plotMain class * Get the plotMain class
* *
* @return PlotMain Class * @return PlotMain Class
* @see com.intellectualcrafters.plot.PlotMain
*/ */
public PlotMain getPlotMain() { public PlotMain getPlotMain() {
return this.plotMain; return this.plotMain;
@ -467,30 +555,36 @@ public class PlotAPI {
/** /**
* Get the player plot count * Get the player plot count
* *
* @param player * @param world Specify the world we want to select the plots from
* @return * @param player Player, for whom we're getting the plot count
* @return the number of plots the player has
* @see com.intellectualcrafters.plot.util.PlayerFunctions#getPlayerPlotCount(org.bukkit.World, org.bukkit.entity.Player)
*/ */
public int getPlayerPlotCount(final World world, final Player player) { public int getPlayerPlotCount(@NotNull final World world, @NotNull final Player player) {
return PlayerFunctions.getPlayerPlotCount(world, player); return PlayerFunctions.getPlayerPlotCount(world, player);
} }
/** /**
* Get a players plots * Get a collection containing the players plots
* *
* @param player * @param world Specify the world we want to select the plots from
* @param player Player, for whom we're getting the plots
* @return a set containing the players plots * @return a set containing the players plots
* @see com.intellectualcrafters.plot.util.PlayerFunctions#getPlayerPlots(org.bukkit.World, org.bukkit.entity.Player)
* @see com.intellectualcrafters.plot.object.Plot
*/ */
public Set<Plot> getPlayerPlots(final World world, final Player player) { public Set<Plot> getPlayerPlots(@NotNull final World world, @NotNull final Player player) {
return PlayerFunctions.getPlayerPlots(world, player); return PlayerFunctions.getPlayerPlots(world, player);
} }
/** /**
* Get the allowed plot count for a player * Get the numbers of plots, which the player is able to build in
* *
* @param player * @param player Player, for whom we're getting the plots (trusted, helper and owner)
* @return the number of allowed plots * @return the number of allowed plots
* @see com.intellectualcrafters.plot.util.PlayerFunctions#getAllowedPlots(org.bukkit.entity.Player)
*/ */
public int getAllowedPlots(final Player player) { public int getAllowedPlots(@NotNull final Player player) {
return PlayerFunctions.getAllowedPlots(player); return PlayerFunctions.getAllowedPlots(player);
} }
} }

View File

@ -153,7 +153,7 @@ public class Auto extends SubCommand {
Plot plot = PlotHelper.getPlot(world, Auto.lastPlot); Plot plot = PlotHelper.getPlot(world, Auto.lastPlot);
if ((plot == null) || (plot.owner == null)) { if ((plot == null) || (plot.owner == null)) {
plot = PlotHelper.getPlot(world, Auto.lastPlot); plot = PlotHelper.getPlot(world, Auto.lastPlot);
Claim.claimPlot(plr, plot, true); Claim.claimPlot(plr, plot, true, true);
br = true; br = true;
final PlotWorld pw = PlotMain.getWorldSettings(world); final PlotWorld pw = PlotMain.getWorldSettings(world);
final Plot plot2 = PlotMain.getPlots(world).get(plot.id); final Plot plot2 = PlotMain.getPlots(world).get(plot.id);
@ -187,7 +187,7 @@ public class Auto extends SubCommand {
for (int j = start.y; j <= end.y; j++) { for (int j = start.y; j <= end.y; j++) {
final Plot plot = PlotHelper.getPlot(world, new PlotId(i, j)); final Plot plot = PlotHelper.getPlot(world, new PlotId(i, j));
final boolean teleport = ((i == end.x) && (j == end.y)); final boolean teleport = ((i == end.x) && (j == end.y));
Claim.claimPlot(plr, plot, teleport); Claim.claimPlot(plr, plot, teleport, true);
} }
} }
if (!PlotHelper.mergePlots(plr, world, PlayerFunctions.getPlotSelectionIds(world, start, end))) { if (!PlotHelper.mergePlots(plr, world, PlayerFunctions.getPlotSelectionIds(world, start, end))) {

View File

@ -47,12 +47,12 @@ public class Claim extends SubCommand {
super(Command.CLAIM, "Claim the current plot you're standing on.", "claim", CommandCategory.CLAIMING, true); super(Command.CLAIM, "Claim the current plot you're standing on.", "claim", CommandCategory.CLAIMING, true);
} }
public static boolean claimPlot(final Player player, final Plot plot, final boolean teleport) { public static boolean claimPlot(final Player player, final Plot plot, final boolean teleport, boolean auto) {
return claimPlot(player, plot, teleport, ""); return claimPlot(player, plot, teleport, "", auto);
} }
public static boolean claimPlot(final Player player, final Plot plot, final boolean teleport, final String schematic) { public static boolean claimPlot(final Player player, final Plot plot, final boolean teleport, final String schematic, boolean auto) {
final PlayerClaimPlotEvent event = new PlayerClaimPlotEvent(player, plot); final PlayerClaimPlotEvent event = new PlayerClaimPlotEvent(player, plot, auto);
Bukkit.getPluginManager().callEvent(event); Bukkit.getPluginManager().callEvent(event);
if (!event.isCancelled()) { if (!event.isCancelled()) {
PlotHelper.createPlot(player, plot); PlotHelper.createPlot(player, plot);
@ -134,6 +134,6 @@ public class Claim extends SubCommand {
} }
} }
return !claimPlot(plr, plot, false, schematic) || sendMessage(plr, C.PLOT_NOT_CLAIMED); return !claimPlot(plr, plot, false, schematic, false) || sendMessage(plr, C.PLOT_NOT_CLAIMED);
} }
} }

View File

@ -25,6 +25,7 @@ package com.intellectualcrafters.plot.commands;
* Created by Citymonstret on 2014-08-03. * Created by Citymonstret on 2014-08-03.
* *
* @author Citymonstret * @author Citymonstret
* @author Empire92
*/ */
public enum Command { public enum Command {
@ -37,6 +38,9 @@ public enum Command {
// - /plot rate <number out of 10> // - /plot rate <number out of 10>
// - /plot list <some parameter to list the most popular, and highest rated // - /plot list <some parameter to list the most popular, and highest rated
// plots> // plots>
/**
*
*/
SWAP("swap"), SWAP("swap"),
/** /**
* *
@ -58,7 +62,13 @@ public enum Command {
* *
*/ */
PASTE("paste"), PASTE("paste"),
/**
*
*/
CLIPBOARD("clipboard", "cboard"), CLIPBOARD("clipboard", "cboard"),
/**
*
*/
COPY("copy"), COPY("copy"),
/** /**
* *
@ -128,26 +138,44 @@ public enum Command {
* *
*/ */
OP("op", "admin"), OP("op", "admin"),
/**
*
*/
DEOP("deop", "deadmin"), DEOP("deop", "deadmin"),
/**
*
*/
BAN("ban", "block"), BAN("ban", "block"),
/**
*
*/
UNBAN("unban", "unblock"), UNBAN("unban", "unblock"),
/**
*
*/
DATABASE("database", "convert"), DATABASE("database", "convert"),
/**
*
*/
TP("tp", "tp"); TP("tp", "tp");
/**
*
*/
private String command;
/**
*
*/
private String alias;
/**
*
*/
private CommandPermission permission;
/** /**
* @param command * Command
*/
private final String command;
/**
* Alias
*/
private final String alias;
/**
* Permission Node
*/
private final CommandPermission permission;
/**
* @param command Command "name" (/plot [cmd])
*/ */
Command(final String command) { Command(final String command) {
this.command = command; this.command = command;
@ -156,8 +184,8 @@ public enum Command {
} }
/** /**
* @param command * @param command Command "name" (/plot [cmd])
* @param permission * @param permission Command Permission Node
*/ */
Command(final String command, final CommandPermission permission) { Command(final String command, final CommandPermission permission) {
this.command = command; this.command = command;
@ -166,8 +194,8 @@ public enum Command {
} }
/** /**
* @param command * @param command Command "name" (/plot [cmd])
* @param alias * @param alias Command Alias
*/ */
Command(final String command, final String alias) { Command(final String command, final String alias) {
this.command = command; this.command = command;
@ -176,9 +204,9 @@ public enum Command {
} }
/** /**
* @param Command * @param command Command "name" (/plot [cmd])
* @param alias * @param alias Command Alias
* @param permission * @param permission Required Permission Node
*/ */
Command(final String command, final String alias, final CommandPermission permission) { Command(final String command, final String alias, final CommandPermission permission) {
this.command = command; this.command = command;
@ -187,21 +215,22 @@ public enum Command {
} }
/** /**
* @return * @return command
*/ */
public String getCommand() { public String getCommand() {
return this.command; return this.command;
} }
/** /**
* @return * @return alias
*/ */
public String getAlias() { public String getAlias() {
return this.alias; return this.alias;
} }
/** /**
* @return * @return permission object
* @see com.intellectualcrafters.plot.commands.CommandPermission
*/ */
public CommandPermission getPermission() { public CommandPermission getPermission() {
return this.permission; return this.permission;

View File

@ -32,9 +32,9 @@ import org.bukkit.entity.Player;
public class CommandPermission { public class CommandPermission {
/** /**
* * Permission Node
*/ */
public String permission; public final String permission;
/** /**
* @param permission Command Permission * @param permission Command Permission

View File

@ -57,7 +57,7 @@ public class DebugClaimTest extends SubCommand {
} }
public static boolean claimPlot(final Player player, final Plot plot, final boolean teleport, @SuppressWarnings("unused") final String schematic) { public static boolean claimPlot(final Player player, final Plot plot, final boolean teleport, @SuppressWarnings("unused") final String schematic) {
final PlayerClaimPlotEvent event = new PlayerClaimPlotEvent(player, plot); final PlayerClaimPlotEvent event = new PlayerClaimPlotEvent(player, plot, true);
Bukkit.getPluginManager().callEvent(event); Bukkit.getPluginManager().callEvent(event);
if (!event.isCancelled()) { if (!event.isCancelled()) {
PlotHelper.createPlot(player, plot); PlotHelper.createPlot(player, plot);

View File

@ -43,6 +43,9 @@ import java.util.List;
*/ */
public class MainCommand implements CommandExecutor, TabCompleter { public class MainCommand implements CommandExecutor, TabCompleter {
/**
* Main Permission Node
*/
public static final String public static final String
MAIN_PERMISSION = "plots.use"; MAIN_PERMISSION = "plots.use";

View File

@ -30,32 +30,37 @@ import org.bukkit.entity.Player;
* *
* @author Citymonstret * @author Citymonstret
*/ */
@SuppressWarnings({"deprecation", "unused", "javadoc"}) @SuppressWarnings({"deprecation", "unused"})
public abstract class SubCommand { public abstract class SubCommand {
public boolean isPlayer;
/** /**
* Command * Command
*/ */
public String cmd; public final String cmd;
/** /**
* Permission node * Permission node
*/ */
public CommandPermission permission; public final CommandPermission permission;
/** /**
* Simple description * Simple description
*/ */
public String description; public final String description;
/** /**
* Alias * Alias
*/ */
public String alias; public final String alias;
/** /**
* Command usage * Command usage
*/ */
public String usage; public final String usage;
/**
public CommandCategory category; * The category
*/
public final CommandCategory category;
/**
* Is this a player-online command?
*/
public boolean isPlayer;
/** /**
* @param cmd Command /plot {cmd} <-- That! * @param cmd Command /plot {cmd} <-- That!
@ -100,6 +105,11 @@ public abstract class SubCommand {
*/ */
public abstract boolean execute(final Player plr, final String... args); public abstract boolean execute(final Player plr, final String... args);
/**
* Execute the command as console
*
* @param args Arguments
*/
public void executeConsole(final String... args) { public void executeConsole(final String... args) {
this.execute(null, args); this.execute(null, args);
} }
@ -107,23 +117,64 @@ public abstract class SubCommand {
/** /**
* Send a message * Send a message
* *
* @param plr * @param plr Player who will receive the mssage
* @param c * @param c Caption
* @param args * @param args Arguments (%s's)
* @see com.intellectualcrafters.plot.util.PlayerFunctions#sendMessage(org.bukkit.entity.Player, com.intellectualcrafters.plot.config.C, String...)
*/ */
public boolean sendMessage(final Player plr, final C c, final String... args) { public boolean sendMessage(final Player plr, final C c, final String... args) {
PlayerFunctions.sendMessage(plr, c, args); PlayerFunctions.sendMessage(plr, c, args);
return true; return true;
} }
/**
* CommandCategory
*
* @author Citymonstret
* @author Empire92
*/
public enum CommandCategory { public enum CommandCategory {
/**
* Claiming Commands
* <p/>
* Such as: /plot claim
*/
CLAIMING("Claiming"), CLAIMING("Claiming"),
/**
* Teleportation Commands
* <p/>
* Such as: /plot visit
*/
TELEPORT("Teleportation"), TELEPORT("Teleportation"),
/**
* Action Commands
* <p/>
* Such as: /plot clear
*/
ACTIONS("Actions"), ACTIONS("Actions"),
/**
* Information Commands
* <p/>
* Such as: /plot info
*/
INFO("Information"), INFO("Information"),
/**
* Debug Commands
* <p/>
* Such as: /plot debug
*/
DEBUG("Debug"); DEBUG("Debug");
private String name;
/**
* The category name (Readable)
*/
private final String name;
/**
* Constructor
*
* @param name readable name
*/
CommandCategory(final String name) { CommandCategory(final String name) {
this.name = name; this.name = name;
} }

View File

@ -197,6 +197,7 @@ public enum C {
* Teleport / Entry * Teleport / Entry
*/ */
TELEPORTED_TO_PLOT("&6You have been teleported"), TELEPORTED_TO_PLOT("&6You have been teleported"),
TELEPORTED_TO_ROAD("&cYou got teleported to the road"),
/* /*
* Set Block * Set Block
*/ */
@ -367,13 +368,6 @@ public enum C {
HELP_INFO("&6You have to specify a category"), HELP_INFO("&6You have to specify a category"),
HELP_INFO_ITEM("&6/plots help %category% &c- &6%category_desc%"), HELP_INFO_ITEM("&6/plots help %category% &c- &6%category_desc%"),
HELP_ITEM("&6%usage% [%alias%]\n &c%desc%\n"), HELP_ITEM("&6%usage% [%alias%]\n &c%desc%\n"),
/*
HELP_CATEGORY("&6Current Category&c: &l%category%"),
HELP_INFO("&6You need to specify a help category"),
HELP_INFO_ITEM("&6/plots help %category% &c- &6%category_desc%"),
HELP_PAGE("&c>> &6%usage% &c[&6%alias%&c]\n" + "&c>> &6%desc%\n"),
HELP_ITEM_SEPARATOR("&c%lines"),
HELP_HEADER("&c(Page &6%cur&c/&6%max&c) &6Help for Plots"),*/
/* /*
* Direction * Direction
*/ */
@ -382,13 +376,33 @@ public enum C {
* Custom * Custom
*/ */
CUSTOM_STRING("-"); CUSTOM_STRING("-");
static TranslationLanguage lang = new TranslationLanguage("PlotSquared", "this", "use");
/**
* Special Language
*
* @see com.intellectualsites.translation.TranslationLanguage
*/
protected static TranslationLanguage lang = new TranslationLanguage("PlotSquared", "this", "use");
/**
* The TranslationManager
*
* @see com.intellectualsites.translation.TranslationManager
*/
private static TranslationManager manager; private static TranslationManager manager;
/**
* The default file
*
* @see com.intellectualsites.translation.TranslationFile
*/
private static TranslationFile defaultFile; private static TranslationFile defaultFile;
/** /**
* Default * Default
*/ */
private String d; private String d;
/** /**
* Translated * Translated
*/ */
@ -472,6 +486,7 @@ public enum C {
/** /**
* @return translated and color decoded * @return translated and color decoded
* @see org.bukkit.ChatColor#translateAlternateColorCodes(char, String)
*/ */
public String translated() { public String translated() {
return ChatColor.translateAlternateColorCodes('&', this.s()); return ChatColor.translateAlternateColorCodes('&', this.s());

View File

@ -26,6 +26,11 @@ import org.apache.commons.lang.StringUtils;
import java.util.Arrays; import java.util.Arrays;
/**
* Configuration Node
*
* @author Empire92
*/
public class ConfigurationNode { public class ConfigurationNode {
private final String constant; private final String constant;
private final Object default_value; private final Object default_value;

View File

@ -29,66 +29,96 @@ package com.intellectualcrafters.plot.config;
*/ */
public class Settings { public class Settings {
/**
* Teleport to path on login
*/
public static boolean TELEPORT_ON_LOGIN = false;
/**
* Mob Cap Enabled
*/
public static boolean MOB_CAP_ENABLED = false; public static boolean MOB_CAP_ENABLED = false;
/**
* The Mob Cap
*/
public static int MOB_CAP = 20; public static int MOB_CAP = 20;
/**
* Display titles
*/
public static boolean TITLES = true; public static boolean TITLES = true;
/** /**
* Schematic Save Path * Schematic Save Path
*/ */
public static String SCHEMATIC_SAVE_PATH = "/var/www/schematics"; public static String SCHEMATIC_SAVE_PATH = "/var/www/schematics";
/** /**
* Max allowed plots * Max allowed plots
*/ */
public static int MAX_PLOTS = 20; public static int MAX_PLOTS = 20;
/** /**
* WorldGuard region on claimed plots * WorldGuard region on claimed plots
*/ */
public static boolean WORLDGUARD = false; public static boolean WORLDGUARD = false;
/** /**
* metrics * metrics
*/ */
public static boolean METRICS = true; public static boolean METRICS = true;
/** /**
* plot specific resource pack * plot specific resource pack
*/ */
public static String PLOT_SPECIFIC_RESOURCE_PACK = ""; public static String PLOT_SPECIFIC_RESOURCE_PACK = "";
/** /**
* Kill road mobs? * Kill road mobs?
*/ */
public static boolean KILL_ROAD_MOBS; public static boolean KILL_ROAD_MOBS;
/** /**
* Default kill road mobs: true * Default kill road mobs: true
*/ */
public static boolean KILL_ROAD_MOBS_DEFAULT = true; public static boolean KILL_ROAD_MOBS_DEFAULT = true;
/** /**
* mob pathfinding? * mob pathfinding?
*/ */
public static boolean MOB_PATHFINDING; public static boolean MOB_PATHFINDING;
/** /**
* Default mob pathfinding: true * Default mob pathfinding: true
*/ */
public static boolean MOB_PATHFINDING_DEFAULT = true; public static boolean MOB_PATHFINDING_DEFAULT = true;
/** /**
* Delete plots on ban? * Delete plots on ban?
*/ */
public static boolean DELETE_PLOTS_ON_BAN = false; public static boolean DELETE_PLOTS_ON_BAN = false;
/** /**
* Verbose? * Verbose?
*/ */
public static boolean DEBUG = true; public static boolean DEBUG = true;
/** /**
* Auto clear enabled * Auto clear enabled
*/ */
public static boolean AUTO_CLEAR = false; public static boolean AUTO_CLEAR = false;
/** /**
* Days until a plot gets cleared * Days until a plot gets cleared
*/ */
public static int AUTO_CLEAR_DAYS = 365; public static int AUTO_CLEAR_DAYS = 365;
/** /**
* API Location * API Location
*/ */
public static String API_URL = "http://www.intellectualsites.com/minecraft.php"; public static String API_URL = "http://www.intellectualsites.com/minecraft.php";
/** /**
* Use the custom API * Use the custom API
*/ */

View File

@ -35,136 +35,207 @@ import java.util.UUID;
/** /**
* @author Citymonstret * @author Citymonstret
* @author Empire92
*/ */
public abstract class AbstractDB { public interface AbstractDB {
// TODO MongoDB @Brandon // TODO MongoDB @Brandon
/** /**
* * The UUID that will count as everyone
*/ */
public UUID everyone = UUID.fromString("1-1-3-3-7"); public UUID everyone = UUID.fromString("1-1-3-3-7");
/** /**
* Set Plot owner * Set Plot owner
* *
* @param plot * @param plot Plot in which the owner should be set
* @param uuid * @param uuid The uuid of the new owner
*/ */
public abstract void setOwner(final Plot plot, final UUID uuid); public void setOwner(final Plot plot, final UUID uuid);
public abstract void createAllSettingsAndHelpers(final ArrayList<Plot> plots); /**
* Create all settings, and create default helpers, trusted + denied lists
*
* @param plots Plots for which the default table entries should be created
*/
public void createAllSettingsAndHelpers(final ArrayList<Plot> plots);
/** /**
* Create a plot * Create a plot
* *
* @param plots * @param plots Plots that should be created
*/ */
public abstract void createPlots(final ArrayList<Plot> plots); public void createPlots(final ArrayList<Plot> plots);
/** /**
* Create a plot * Create a plot
* *
* @param plot * @param plot That should be created
*/ */
public abstract void createPlot(final Plot plot); public void createPlot(final Plot plot);
/** /**
* Create tables * Create tables
* *
* @throws SQLException * @param database Database in which the tables will be created
*
* @throws SQLException If the database manager is unable to create the tables
*/ */
public abstract void createTables(final String database, final boolean add_constraint) throws Exception; public void createTables(final String database, final boolean add_constraint) throws Exception;
/** /**
* Delete a plot * Delete a plot
* *
* @param plot * @param plot Plot that should be deleted
*/ */
public abstract void delete(final String world, final Plot plot); public void delete(final String world, final Plot plot);
/** /**
* Create plot settings * Create plot settings
* *
* @param id * @param id Plot Entry ID
* @param plot * @param plot Plot Object
*/ */
public abstract void createPlotSettings(final int id, final Plot plot); public void createPlotSettings(final int id, final Plot plot);
public abstract int getId(final String world, final PlotId id2);
/** /**
* @return * Get the table entry ID
*
* @param world Which the plot is located in
* @param id2 Plot ID
* @return Integer = Plot Entry Id
*/ */
public abstract LinkedHashMap<String, HashMap<PlotId, Plot>> getPlots(); public int getId(final String world, final PlotId id2);
public abstract void setMerged(final String world, final Plot plot, final boolean[] merged);
public abstract void setFlags(final String world, final Plot plot, final Flag[] flags);
/** /**
* @param plot * @return A linked hashmap containing all plots
* @param alias
*/ */
public abstract void setAlias(final String world, final Plot plot, final String alias); public LinkedHashMap<String, HashMap<PlotId, Plot>> getPlots();
public abstract void purge(final String world, final PlotId id);
public abstract void purge(final String world);
/** /**
* @param plot * Set the merged status for a plot
* @param position *
* @param world World in which the plot is located
* @param plot Plot Object
* @param merged boolean[]
*/ */
public abstract void setPosition(final String world, final Plot plot, final String position); public void setMerged(final String world, final Plot plot, final boolean[] merged);
/** /**
* @param id * Set plot flags
* @return *
* @param world World in which the plot is located
* @param plot Plot Object
* @param flags flags to set (flag[])
*/ */
public abstract HashMap<String, Object> getSettings(final int id); public void setFlags(final String world, final Plot plot, final Flag[] flags);
/** /**
* @param plot * Set the plot alias
* @param player *
* @param plot Plot for which the alias should be set
* @param alias Plot Alias
*/ */
public abstract void removeHelper(final String world, final Plot plot, final OfflinePlayer player); public void setAlias(final String world, final Plot plot, final String alias);
/** /**
* @param plot * Purgle a plot
* @param player *
* @param world World in which the plot is located
* @param id Plot ID
*/ */
public abstract void removeTrusted(final String world, final Plot plot, final OfflinePlayer player); public void purge(final String world, final PlotId id);
/** /**
* @param plot * Purge a whole world
* @param player *
* @param world World in which the plots should be purged
*/ */
public abstract void setHelper(final String world, final Plot plot, final OfflinePlayer player); public void purge(final String world);
/** /**
* @param plot * Set Plot Home Position
* @param player * @param plot Plot Object
* @param position Plot Home Position
*/ */
public abstract void setTrusted(final String world, final Plot plot, final OfflinePlayer player); public void setPosition(final String world, final Plot plot, final String position);
/** /**
* @param plot * @param id Plot Entry ID
* @param player * @return Plot Settings
*/ */
public abstract void removeDenied(final String world, final Plot plot, final OfflinePlayer player); public HashMap<String, Object> getSettings(final int id);
/** /**
* @param plot * @param plot Plot Object
* @param player * @param player Player that should be removed
*/ */
public abstract void setDenied(final String world, final Plot plot, final OfflinePlayer player); public void removeHelper(final String world, final Plot plot, final OfflinePlayer player);
public abstract double getRatings(final Plot plot); /**
* @param plot Plot Object
* @param player Player that should be removed
*/
public void removeTrusted(final String world, final Plot plot, final OfflinePlayer player);
public abstract void removeComment(final String world, final Plot plot, final PlotComment comment); /**
* @param plot Plot Object
* @param player Player that should be removed
*/
public void setHelper(final String world, final Plot plot, final OfflinePlayer player);
public abstract void setComment(final String world, final Plot plot, final PlotComment comment); /**
* @param plot Plot Object
* @param player Player that should be added
*/
public void setTrusted(final String world, final Plot plot, final OfflinePlayer player);
public abstract ArrayList<PlotComment> getComments(final String world, final Plot plot, final int tier); /**
* @param plot Plot Object
* @param player Player that should be added
*/
public void removeDenied(final String world, final Plot plot, final OfflinePlayer player);
/**
* @param plot Plot Object
* @param player Player that should be added
*/
public void setDenied(final String world, final Plot plot, final OfflinePlayer player);
/**
* Get Plots ratings
*
* @param plot Plot Object
* @return Plot Ratings (pre-calculated)
*/
public double getRatings(final Plot plot);
/**
* Remove a plot comment
*
* @param world World in which the plot is located
* @param plot Plot Object
* @param comment Comment to remove
*/
public void removeComment(final String world, final Plot plot, final PlotComment comment);
/**
* Set a plot comment
*
* @param world World in which the plot is located
* @param plot Plot Object
* @param comment Comment to add
*/
public void setComment(final String world, final Plot plot, final PlotComment comment);
/**
* Get Plot Comments
*
* @param world World in which the plot is located
* @param plot Plot Object
* @param tier Comment Tier
* @return Plot Comments within the specified tier
*/
public ArrayList<PlotComment> getComments(final String world, final Plot plot, final int tier);
} }

View File

@ -40,17 +40,9 @@ public class DBFunc {
public static AbstractDB dbManager; public static AbstractDB dbManager;
// TODO MongoDB @Brandon // TODO MongoDB @Brandon
/**
*
*/
public static UUID everyone = UUID.fromString("1-1-3-3-7"); public static UUID everyone = UUID.fromString("1-1-3-3-7");
/**
* Set Plot owner
*
* @param plot
* @param uuid
*/
public static void setOwner(final Plot plot, final UUID uuid) { public static void setOwner(final Plot plot, final UUID uuid) {
dbManager.setOwner(plot, uuid); dbManager.setOwner(plot, uuid);
} }
@ -59,11 +51,6 @@ public class DBFunc {
dbManager.createAllSettingsAndHelpers(plots); dbManager.createAllSettingsAndHelpers(plots);
} }
/**
* Create a plot
*
* @param plots
*/
public static void createPlots(final ArrayList<Plot> plots) { public static void createPlots(final ArrayList<Plot> plots) {
dbManager.createPlots(plots); dbManager.createPlots(plots);
} }

View File

@ -41,7 +41,7 @@ import java.util.*;
/** /**
* @author Citymonstret * @author Citymonstret
*/ */
public class SQLManager extends AbstractDB { public class SQLManager implements AbstractDB {
// Public final // Public final
public final String SET_OWNER; public final String SET_OWNER;
@ -452,7 +452,6 @@ public class SQLManager extends AbstractDB {
plots.put(id, p); plots.put(id, p);
} }
// stmt.close(); // stmt.close();
/* /*
* Getting helpers * Getting helpers
*/ */

View File

@ -28,22 +28,26 @@ import org.bukkit.event.HandlerList;
import org.bukkit.event.player.PlayerEvent; import org.bukkit.event.player.PlayerEvent;
/** /**
* Created by Citymonstret on 2014-08-09. * @author Citymonstret
* @author Empire92
*/ */
@SuppressWarnings("unused")
public class PlayerClaimPlotEvent extends PlayerEvent implements Cancellable { public class PlayerClaimPlotEvent extends PlayerEvent implements Cancellable {
private static HandlerList handlers = new HandlerList(); private static HandlerList handlers = new HandlerList();
private final Plot plot; private final Plot plot;
private final boolean auto;
private boolean cancelled; private boolean cancelled;
/** /**
* PlayerClaimPlotEvent: Called when a plot is claimed * PlayerClaimPlotEvent: Called when a plot is claimed
* *
* @param player * @param player Player that claimed the plot
* @param plot * @param plot Plot that was claimed
*/ */
public PlayerClaimPlotEvent(final Player player, final Plot plot) { public PlayerClaimPlotEvent(final Player player, final Plot plot, boolean auto) {
super(player); super(player);
this.plot = plot; this.plot = plot;
this.auto = auto;
} }
public static HandlerList getHandlerList() { public static HandlerList getHandlerList() {
@ -59,6 +63,13 @@ public class PlayerClaimPlotEvent extends PlayerEvent implements Cancellable {
return this.plot; return this.plot;
} }
/**
* @return true if it was an automated claim, else false
*/
public boolean wasAuto() {
return this.auto;
}
@Override @Override
public HandlerList getHandlers() { public HandlerList getHandlers() {
return handlers; return handlers;

View File

@ -27,7 +27,8 @@ import org.bukkit.event.HandlerList;
import org.bukkit.event.player.PlayerEvent; import org.bukkit.event.player.PlayerEvent;
/** /**
* Created by Citymonstret on 2014-08-16. * @author Citymonstret
* @author Empire92
*/ */
public class PlayerEnterPlotEvent extends PlayerEvent { public class PlayerEnterPlotEvent extends PlayerEvent {
@ -38,8 +39,8 @@ public class PlayerEnterPlotEvent extends PlayerEvent {
/** /**
* PlayerEnterPlotEvent: Called when a player leaves a plot * PlayerEnterPlotEvent: Called when a player leaves a plot
* *
* @param player * @param player Player that entered the plot
* @param plot * @param plot Plot that was entered
*/ */
public PlayerEnterPlotEvent(final Player player, final Plot plot) { public PlayerEnterPlotEvent(final Player player, final Plot plot) {
super(player); super(player);

View File

@ -27,7 +27,8 @@ import org.bukkit.event.HandlerList;
import org.bukkit.event.player.PlayerEvent; import org.bukkit.event.player.PlayerEvent;
/** /**
* Created by Citymonstret on 2014-08-16. * @author Citymonstret
* @author Empire92
*/ */
public class PlayerLeavePlotEvent extends PlayerEvent { public class PlayerLeavePlotEvent extends PlayerEvent {
private static HandlerList handlers = new HandlerList(); private static HandlerList handlers = new HandlerList();
@ -37,8 +38,8 @@ public class PlayerLeavePlotEvent extends PlayerEvent {
/** /**
* PlayerLeavePlotEvent: Called when a player leaves a plot * PlayerLeavePlotEvent: Called when a player leaves a plot
* *
* @param player * @param player Player that left the plot
* @param plot * @param plot Plot that was left
*/ */
public PlayerLeavePlotEvent(final Player player, final Plot plot) { public PlayerLeavePlotEvent(final Player player, final Plot plot) {
super(player); super(player);

View File

@ -29,7 +29,8 @@ import org.bukkit.event.HandlerList;
import java.util.UUID; import java.util.UUID;
/** /**
* Created by Citymonstret on 2014-08-16. * @author Citymonstret
* @author Empire92
*/ */
public class PlayerPlotDeniedEvent extends Event { public class PlayerPlotDeniedEvent extends Event {
private static HandlerList handlers = new HandlerList(); private static HandlerList handlers = new HandlerList();
@ -43,10 +44,10 @@ public class PlayerPlotDeniedEvent extends Event {
* PlayerPlotDeniedEvent: Called when the denied UUID list is modified for a * PlayerPlotDeniedEvent: Called when the denied UUID list is modified for a
* plot * plot
* *
* @param initiator * @param initiator Player that initiated the event
* @param plot * @param plot Plot in which the event occurred
* @param player * @param player Player that was denied/un-denied
* @param added * @param added true of add to deny list, false if removed
*/ */
public PlayerPlotDeniedEvent(final Player initiator, final Plot plot, final UUID player, final boolean added) { public PlayerPlotDeniedEvent(final Player initiator, final Plot plot, final UUID player, final boolean added) {
this.initiator = initiator; this.initiator = initiator;

View File

@ -29,7 +29,8 @@ import org.bukkit.event.HandlerList;
import java.util.UUID; import java.util.UUID;
/** /**
* Created by Citymonstret on 2014-08-16. * @author Empire92
* @author Citymonstret
*/ */
public class PlayerPlotHelperEvent extends Event { public class PlayerPlotHelperEvent extends Event {
private static HandlerList handlers = new HandlerList(); private static HandlerList handlers = new HandlerList();
@ -42,10 +43,10 @@ public class PlayerPlotHelperEvent extends Event {
/** /**
* PlayerPlotHelperEvent: Called when a plot helper is added/removed * PlayerPlotHelperEvent: Called when a plot helper is added/removed
* *
* @param initiator * @param initiator Player that initiated the event
* @param plot * @param plot Plot in which the event occurred
* @param player * @param player Player that was added/removed from the helper list
* @param added * @param added true of the player was added, false if the player was removed
*/ */
public PlayerPlotHelperEvent(final Player initiator, final Plot plot, final UUID player, final boolean added) { public PlayerPlotHelperEvent(final Player initiator, final Plot plot, final UUID player, final boolean added) {
this.initiator = initiator; this.initiator = initiator;

View File

@ -29,7 +29,8 @@ import org.bukkit.event.HandlerList;
import java.util.UUID; import java.util.UUID;
/** /**
* Created by Citymonstret on 2014-08-16. * @author Citymonstret
* @author Empire92
*/ */
public class PlayerPlotTrustedEvent extends Event { public class PlayerPlotTrustedEvent extends Event {
private static HandlerList handlers = new HandlerList(); private static HandlerList handlers = new HandlerList();
@ -42,10 +43,10 @@ public class PlayerPlotTrustedEvent extends Event {
/** /**
* PlayerPlotTrustedEvent: Called when a plot trusted user is added/removed * PlayerPlotTrustedEvent: Called when a plot trusted user is added/removed
* *
* @param initiator * @param initiator Player that initiated the event
* @param plot * @param plot Plot in which the event occurred
* @param player * @param player Player that was added/removed from the trusted list
* @param added * @param added true of the player was added, false if the player was removed
*/ */
public PlayerPlotTrustedEvent(final Player initiator, final Plot plot, final UUID player, final boolean added) { public PlayerPlotTrustedEvent(final Player initiator, final Plot plot, final UUID player, final boolean added) {
this.initiator = initiator; this.initiator = initiator;

View File

@ -30,6 +30,9 @@ import org.bukkit.event.player.PlayerEvent;
/** /**
* Called when a player teleports to a plot * Called when a player teleports to a plot
*
* @author Citymonstret
* @author Empire92
*/ */
public class PlayerTeleportToPlotEvent extends PlayerEvent implements Cancellable { public class PlayerTeleportToPlotEvent extends PlayerEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList(); private static final HandlerList handlers = new HandlerList();
@ -42,9 +45,9 @@ public class PlayerTeleportToPlotEvent extends PlayerEvent implements Cancellabl
/** /**
* PlayerTeleportToPlotEvent: Called when a player teleports to a plot * PlayerTeleportToPlotEvent: Called when a player teleports to a plot
* *
* @param player * @param player That was teleported
* @param from * @param from Start location
* @param plot * @param plot Plot to which the player was teleported
*/ */
public PlayerTeleportToPlotEvent(final Player player, final Location from, final Plot plot) { public PlayerTeleportToPlotEvent(final Player player, final Location from, final Plot plot) {
super(player); super(player);

View File

@ -28,6 +28,9 @@ import org.bukkit.event.HandlerList;
/** /**
* Called when a plot is cleared * Called when a plot is cleared
*
* @author Citymonstret
* @author Empire92
*/ */
public class PlotClearEvent extends Event implements Cancellable { public class PlotClearEvent extends Event implements Cancellable {
private static HandlerList handlers = new HandlerList(); private static HandlerList handlers = new HandlerList();
@ -38,8 +41,8 @@ public class PlotClearEvent extends Event implements Cancellable {
/** /**
* PlotDeleteEvent: Called when a plot is cleared * PlotDeleteEvent: Called when a plot is cleared
* *
* @param world * @param world The world in which the plot was cleared
* @param id * @param id The plot that was cleared
*/ */
public PlotClearEvent(final String world, final PlotId id) { public PlotClearEvent(final String world, final PlotId id) {
this.id = id; this.id = id;

View File

@ -28,6 +28,9 @@ import org.bukkit.event.HandlerList;
/** /**
* Called when a plot is deleted * Called when a plot is deleted
*
* @author Citymonstret
* @author Empire92
*/ */
public class PlotDeleteEvent extends Event implements Cancellable { public class PlotDeleteEvent extends Event implements Cancellable {
private static HandlerList handlers = new HandlerList(); private static HandlerList handlers = new HandlerList();
@ -38,8 +41,8 @@ public class PlotDeleteEvent extends Event implements Cancellable {
/** /**
* PlotDeleteEvent: Called when a plot is deleted * PlotDeleteEvent: Called when a plot is deleted
* *
* @param world * @param world The world in which the plot was deleted
* @param id * @param id The ID of the plot that was deleted
*/ */
public PlotDeleteEvent(final String world, final PlotId id) { public PlotDeleteEvent(final String world, final PlotId id) {
this.id = id; this.id = id;

View File

@ -29,6 +29,9 @@ import org.bukkit.event.HandlerList;
/** /**
* Called when a Flag is added to a plot * Called when a Flag is added to a plot
*
* @author Citymonstret
* @author Empire92
*/ */
public class PlotFlagAddEvent extends Event implements Cancellable { public class PlotFlagAddEvent extends Event implements Cancellable {
private static HandlerList handlers = new HandlerList(); private static HandlerList handlers = new HandlerList();
@ -39,8 +42,8 @@ public class PlotFlagAddEvent extends Event implements Cancellable {
/** /**
* PlotFlagAddEvent: Called when a Flag is added to a plot * PlotFlagAddEvent: Called when a Flag is added to a plot
* *
* @param flag * @param flag Flag that was added
* @param plot * @param plot Plot to which the flag was added
*/ */
public PlotFlagAddEvent(final Flag flag, final Plot plot) { public PlotFlagAddEvent(final Flag flag, final Plot plot) {
this.plot = plot; this.plot = plot;

View File

@ -29,6 +29,9 @@ import org.bukkit.event.HandlerList;
/** /**
* Called when a flag is removed from a plot * Called when a flag is removed from a plot
*
* @author Citymonstret
* @author Empire92
*/ */
public class PlotFlagRemoveEvent extends Event implements Cancellable { public class PlotFlagRemoveEvent extends Event implements Cancellable {
private static HandlerList handlers = new HandlerList(); private static HandlerList handlers = new HandlerList();
@ -39,8 +42,8 @@ public class PlotFlagRemoveEvent extends Event implements Cancellable {
/** /**
* PlotFlagRemoveEvent: Called when a flag is removed from a plot * PlotFlagRemoveEvent: Called when a flag is removed from a plot
* *
* @param flag * @param flag Flag that was removed
* @param plot * @param plot Plot from which the flag was removed
*/ */
public PlotFlagRemoveEvent(final Flag flag, final Plot plot) { public PlotFlagRemoveEvent(final Flag flag, final Plot plot) {
this.plot = plot; this.plot = plot;

View File

@ -31,7 +31,7 @@ import org.bukkit.event.HandlerList;
import java.util.ArrayList; import java.util.ArrayList;
/** /**
* Created by Citymonstret on 2014-08-09. * @author Empire92
*/ */
public class PlotMergeEvent extends Event implements Cancellable { public class PlotMergeEvent extends Event implements Cancellable {
private static HandlerList handlers = new HandlerList(); private static HandlerList handlers = new HandlerList();
@ -43,8 +43,9 @@ public class PlotMergeEvent extends Event implements Cancellable {
/** /**
* PlotMergeEvent: Called when plots are merged * PlotMergeEvent: Called when plots are merged
* *
* @param player * @param world World in which the event occurred
* @param plot * @param plot Plot that was merged
* @param plots A list of plots involved in the event
*/ */
public PlotMergeEvent(final World world, final Plot plot, final ArrayList<PlotId> plots) { public PlotMergeEvent(final World world, final Plot plot, final ArrayList<PlotId> plots) {
this.plots = plots; this.plots = plots;

View File

@ -30,7 +30,7 @@ import org.bukkit.event.HandlerList;
import java.util.ArrayList; import java.util.ArrayList;
/** /**
* Created by Citymonstret on 2014-08-09. * @author Empire92
*/ */
public class PlotUnlinkEvent extends Event implements Cancellable { public class PlotUnlinkEvent extends Event implements Cancellable {
private static HandlerList handlers = new HandlerList(); private static HandlerList handlers = new HandlerList();
@ -41,8 +41,8 @@ public class PlotUnlinkEvent extends Event implements Cancellable {
/** /**
* Called when a mega-plot is unlinked. * Called when a mega-plot is unlinked.
* *
* @param world * @param world World in which the event occurred
* @param plots * @param plots Plots that are involved in the event
*/ */
public PlotUnlinkEvent(final World world, final ArrayList<PlotId> plots) { public PlotUnlinkEvent(final World world, final ArrayList<PlotId> plots) {
this.plots = plots; this.plots = plots;

View File

@ -52,11 +52,15 @@ public class AbstractFlag {
throw new IllegalArgumentException("Key must be <= 16 characters"); throw new IllegalArgumentException("Key must be <= 16 characters");
} }
this.key = key.toLowerCase(); this.key = key.toLowerCase();
if (value == null) {
this.value = new FlagValue.StringValue(); this.value = new FlagValue.StringValue();
} else {
this.value = value;
}
} }
public String parseValue(final String value) { public String parseValue(final String value) {
return this.value.parse(value).toString(); return this.value.parse(value);
} }
public String getValueDesc() { public String getValueDesc() {

View File

@ -33,6 +33,7 @@ import java.util.Random;
/** /**
* @author Citymonstret * @author Citymonstret
*/ */
@SuppressWarnings("unused")
public class XPopulator extends BlockPopulator { public class XPopulator extends BlockPopulator {
/* /*
@ -237,7 +238,6 @@ public class XPopulator extends BlockPopulator {
setCuboidRegion(16 - value, (16 - value) + 1, this.roadheight, this.roadheight + 1, start, 16, this.floor2, w); // setCuboidRegion(16 - value, (16 - value) + 1, this.roadheight, this.roadheight + 1, start, 16, this.floor2, w); //
} }
if ((roadStartZ <= 16) && (roadStartZ > 1)) { if ((roadStartZ <= 16) && (roadStartZ > 1)) {
final int val = roadStartZ;
int start, end; int start, end;
if ((plotMinX + 2) <= 16) { if ((plotMinX + 2) <= 16) {
start = 16 - plotMinX - 1; start = 16 - plotMinX - 1;
@ -252,11 +252,10 @@ public class XPopulator extends BlockPopulator {
if (!(((plotMinX + 2) <= 16) || ((roadStartX - 1) <= 16))) { if (!(((plotMinX + 2) <= 16) || ((roadStartX - 1) <= 16))) {
start = 0; start = 0;
} }
setCuboidRegion(0, end, this.roadheight, this.roadheight + 1, (16 - val) + 1, (16 - val) + 2, this.floor2, w); setCuboidRegion(0, end, this.roadheight, this.roadheight + 1, (16 - roadStartZ) + 1, (16 - roadStartZ) + 2, this.floor2, w);
setCuboidRegion(start, 16, this.roadheight, this.roadheight + 1, (16 - val) + 1, (16 - val) + 2, this.floor2, w); setCuboidRegion(start, 16, this.roadheight, this.roadheight + 1, (16 - roadStartZ) + 1, (16 - roadStartZ) + 2, this.floor2, w);
} }
if ((roadStartX <= 16) && (roadStartX > 1)) { if ((roadStartX <= 16) && (roadStartX > 1)) {
final int val = roadStartX;
int start, end; int start, end;
if ((plotMinZ + 2) <= 16) { if ((plotMinZ + 2) <= 16) {
start = 16 - plotMinZ - 1; start = 16 - plotMinZ - 1;
@ -271,8 +270,8 @@ public class XPopulator extends BlockPopulator {
if (!(((plotMinZ + 2) <= 16) || ((roadStartZ - 1) <= 16))) { if (!(((plotMinZ + 2) <= 16) || ((roadStartZ - 1) <= 16))) {
start = 0; start = 0;
} }
setCuboidRegion((16 - val) + 1, (16 - val) + 2, this.roadheight, this.roadheight + 1, 0, end, this.floor2, w); // setCuboidRegion((16 - roadStartX) + 1, (16 - roadStartX) + 2, this.roadheight, this.roadheight + 1, 0, end, this.floor2, w); //
setCuboidRegion((16 - val) + 1, (16 - val) + 2, this.roadheight, this.roadheight + 1, start, 16, this.floor2, w); // setCuboidRegion((16 - roadStartX) + 1, (16 - roadStartX) + 2, this.roadheight, this.roadheight + 1, start, 16, this.floor2, w); //
} }
} }
// WALLS // WALLS
@ -460,6 +459,7 @@ public class XPopulator extends BlockPopulator {
} }
} }
@SuppressWarnings("deprecation")
private void setBlock(final World w, final int x, final int y, final int z, final short id, final byte val) { private void setBlock(final World w, final int x, final int y, final int z, final short id, final byte val) {
w.getBlockAt(this.X + x, y, this.Z + z).setData(val, false); w.getBlockAt(this.X + x, y, this.Z + z).setData(val, false);
} }

View File

@ -15,6 +15,7 @@ import org.bukkit.inventory.Inventory;
* *
* @author Citymonstret * @author Citymonstret
*/ */
@SuppressWarnings("unused")
public class InventoryListener implements Listener { public class InventoryListener implements Listener {
@EventHandler @EventHandler

View File

@ -28,6 +28,7 @@ import com.intellectualcrafters.plot.config.Settings;
import com.intellectualcrafters.plot.database.DBFunc; import com.intellectualcrafters.plot.database.DBFunc;
import com.intellectualcrafters.plot.object.*; import com.intellectualcrafters.plot.object.*;
import com.intellectualcrafters.plot.util.PlayerFunctions; import com.intellectualcrafters.plot.util.PlayerFunctions;
import com.intellectualcrafters.plot.util.PlotHelper;
import org.bukkit.*; import org.bukkit.*;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.block.BlockFace; import org.bukkit.block.BlockFace;
@ -73,9 +74,14 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
} }
// textures(event.getPlayer()); // textures(event.getPlayer());
if (isInPlot(event.getPlayer().getLocation())) { if (isInPlot(event.getPlayer().getLocation())) {
if (Settings.TELEPORT_ON_LOGIN) {
event.getPlayer().teleport(PlotHelper.getPlotHomeDefault(getPlot(event.getPlayer())));
PlayerFunctions.sendMessage(event.getPlayer(), C.TELEPORTED_TO_ROAD);
} else {
plotEntry(event.getPlayer(), getCurrentPlot(event.getPlayer().getLocation())); plotEntry(event.getPlayer(), getCurrentPlot(event.getPlayer().getLocation()));
} }
} }
}
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public static void PlayerMove(final PlayerMoveEvent event) { public static void PlayerMove(final PlayerMoveEvent event) {

View File

@ -21,6 +21,10 @@
package com.intellectualcrafters.plot.object; package com.intellectualcrafters.plot.object;
import com.sun.istack.internal.NotNull;
import org.bukkit.World;
import org.bukkit.block.Block;
/** /**
* Wrapper class for blocks, using * Wrapper class for blocks, using
* pure data rather than the object. * pure data rather than the object.
@ -28,16 +32,34 @@ package com.intellectualcrafters.plot.object;
* Useful for NMS * Useful for NMS
* *
* @author Empire92 * @author Empire92
* @author Citymonstret
*/ */
public class BlockWrapper { public class BlockWrapper {
// Public Final ////////////////////////// /**
public final int x; // * X Coordinate
public final int y; // */
public final int z; // public final int x;
public final int id; //
public final byte data; // /**
////////////////////////////////////////// * Y Coordinate
*/
public final int y;
/**
* Z Coordinate
*/
public final int z;
/**
* Block ID
*/
public final int id;
/**
* Block Data Value
*/
public final byte data;
/** /**
* Constructor * Constructor
@ -48,11 +70,39 @@ public class BlockWrapper {
* @param id Material ID * @param id Material ID
* @param data Data Value * @param data Data Value
*/ */
public BlockWrapper(int x, int y, int z, short id, byte data) { public BlockWrapper(final int x, final int y, final int z, final short id, final byte data) {
this.x = x; this.x = x;
this.y = y; this.y = y;
this.z = z; this.z = z;
this.id = id; this.id = id;
this.data = data; this.data = data;
} }
/**
* Alternative Constructor
* Uses block data, rather than typed data
*
* @param block Block from which we get the data
*/
@SuppressWarnings({"deprecation", "unused"})
public BlockWrapper(@NotNull final Block block) {
this.x = block.getX();
this.y = block.getY();
this.z = block.getZ();
this.id = block.getTypeId();
this.data = block.getData();
}
/**
* Get a block based on the block wrapper
*
* @param world World in which the block is/will be, located
* @return block created/fetched from settings
*/
@SuppressWarnings({"unused", "deprecation"})
public Block toBlock(@NotNull final World world) {
Block block = world.getBlockAt(x, y, z);
block.setTypeIdAndData(id, data, true);
return block;
}
} }

View File

@ -37,6 +37,7 @@ import java.util.UUID;
* The plot class * The plot class
* *
* @author Citymonstret * @author Citymonstret
* @author Empire92
*/ */
@SuppressWarnings("javadoc") @SuppressWarnings("javadoc")
public class Plot implements Cloneable { public class Plot implements Cloneable {
@ -91,7 +92,11 @@ public class Plot implements Cloneable {
* @param plotBiome * @param plotBiome
* @param helpers * @param helpers
* @param denied * @param denied
*
* @deprecated
*/ */
@Deprecated
@SuppressWarnings("unused")
public Plot(final PlotId id, final UUID owner, final Biome plotBiome, final ArrayList<UUID> helpers, final ArrayList<UUID> denied, final String world) { public Plot(final PlotId id, final UUID owner, final Biome plotBiome, final ArrayList<UUID> helpers, final ArrayList<UUID> denied, final String world) {
this.id = id; this.id = id;
this.settings = new PlotSettings(this); this.settings = new PlotSettings(this);
@ -107,6 +112,29 @@ public class Plot implements Cloneable {
this.world = world; this.world = world;
} }
/**
* Primary constructor
*
* @param id
* @param owner
* @param helpers
* @param denied
*/
public Plot(final PlotId id, final UUID owner, final ArrayList<UUID> helpers, final ArrayList<UUID> denied, final String world) {
this.id = id;
this.settings = new PlotSettings(this);
this.owner = owner;
this.deny_entry = this.owner == null;
this.helpers = helpers;
this.denied = denied;
this.trusted = new ArrayList<>();
this.settings.setAlias("");
this.settings.setPosition(PlotHomePosition.DEFAULT);
this.delete = false;
this.settings.setFlags(new Flag[0]);
this.world = world;
}
/** /**
* Constructor for saved plots * Constructor for saved plots
* *
@ -116,7 +144,11 @@ public class Plot implements Cloneable {
* @param helpers * @param helpers
* @param denied * @param denied
* @param merged * @param merged
*
* @deprecated
*/ */
@Deprecated
@SuppressWarnings("unused")
public Plot(final PlotId id, final UUID owner, final Biome plotBiome, final ArrayList<UUID> helpers, final ArrayList<UUID> trusted, final ArrayList<UUID> denied, final String alias, final PlotHomePosition position, final Flag[] flags, final String world, final boolean[] merged) { public Plot(final PlotId id, final UUID owner, final Biome plotBiome, final ArrayList<UUID> helpers, final ArrayList<UUID> trusted, final ArrayList<UUID> denied, final String alias, final PlotHomePosition position, final Flag[] flags, final String world, final boolean[] merged) {
this.id = id; this.id = id;
this.settings = new PlotSettings(this); this.settings = new PlotSettings(this);
@ -137,6 +169,35 @@ public class Plot implements Cloneable {
this.world = world; this.world = world;
} }
/**
* Constructor for saved plots
*
* @param id
* @param owner
* @param helpers
* @param denied
* @param merged
*/
public Plot(final PlotId id, final UUID owner, final ArrayList<UUID> helpers, final ArrayList<UUID> trusted, final ArrayList<UUID> denied, final String alias, final PlotHomePosition position, final Flag[] flags, final String world, final boolean[] merged) {
this.id = id;
this.settings = new PlotSettings(this);
this.owner = owner;
this.deny_entry = this.owner != null;
this.trusted = trusted;
this.helpers = helpers;
this.denied = denied;
this.settings.setAlias(alias);
this.settings.setPosition(position);
this.settings.setMerged(merged);
this.delete = false;
if (flags != null) {
this.settings.setFlags(flags);
} else {
this.settings.setFlags(new Flag[0]);
}
this.world = world;
}
/** /**
* Check if the plot has a set owner * Check if the plot has a set owner
* *
@ -205,7 +266,7 @@ public class Plot implements Cloneable {
public Object clone() throws CloneNotSupportedException { public Object clone() throws CloneNotSupportedException {
Plot p = (Plot) super.clone(); Plot p = (Plot) super.clone();
if (!p.equals(this) || p != this) { if (!p.equals(this) || p != this) {
return new Plot(id, owner, settings.getBiome(), helpers, trusted, denied, settings.getAlias(), settings.getPosition(), settings.getFlags().toArray(new Flag[settings.getFlags().size()]), getWorld().getName(), settings.getMerged()); return new Plot(id, owner, helpers, trusted, denied, settings.getAlias(), settings.getPosition(), settings.getFlags().toArray(new Flag[settings.getFlags().size()]), getWorld().getName(), settings.getMerged());
} }
return p; return p;
} }

View File

@ -21,6 +21,9 @@
package com.intellectualcrafters.plot.object; package com.intellectualcrafters.plot.object;
/**
* @author Empire92
*/
public class PlotBlock { public class PlotBlock {
public short id; public short id;
public byte data; public byte data;

View File

@ -21,6 +21,9 @@
package com.intellectualcrafters.plot.object; package com.intellectualcrafters.plot.object;
/**
* @author Empire92
*/
public class PlotComment { public class PlotComment {
public final String comment; public final String comment;
public final int tier; public final int tier;

View File

@ -22,7 +22,7 @@
package com.intellectualcrafters.plot.object; package com.intellectualcrafters.plot.object;
/** /**
* Created by Citymonstret on 2014-08-05. * @author Citymonstret
*/ */
public enum PlotHomePosition { public enum PlotHomePosition {
CENTER("Center", 'c'), CENTER("Center", 'c'),
@ -37,13 +37,7 @@ public enum PlotHomePosition {
} }
public boolean isMatching(final String string) { public boolean isMatching(final String string) {
if ((string.length() < 2) && (string.charAt(0) == this.ch)) { return (string.length() < 2) && (string.charAt(0) == this.ch) || string.equalsIgnoreCase(this.string);
return true;
}
if (string.equalsIgnoreCase(this.string)) {
return true;
}
return false;
} }
} }

View File

@ -23,6 +23,7 @@ package com.intellectualcrafters.plot.object;
import com.intellectualcrafters.plot.flag.Flag; import com.intellectualcrafters.plot.flag.Flag;
import com.intellectualcrafters.plot.util.PlotHelper; import com.intellectualcrafters.plot.util.PlotHelper;
import com.sun.istack.internal.NotNull;
import org.bukkit.block.Biome; import org.bukkit.block.Biome;
import java.util.ArrayList; import java.util.ArrayList;
@ -36,6 +37,7 @@ import java.util.Set;
* @author Citymonstret * @author Citymonstret
* @author Empire92 * @author Empire92
*/ */
@SuppressWarnings("unused")
public class PlotSettings { public class PlotSettings {
/** /**
* merged plots * merged plots
@ -133,15 +135,19 @@ public class PlotSettings {
} }
/** /**
* @param flags * Set multiple flags
*
* @param flags Flag Array
*/ */
public void setFlags(final Flag[] flags) { public void setFlags(@NotNull final Flag[] flags) {
this.flags = new HashSet<Flag>(Arrays.asList(flags)); this.flags = new HashSet<>(Arrays.asList(flags));
} }
/** /**
* @param flag * Get a flag
* @return *
* @param flag Flag to get
* @return flag
*/ */
public Flag getFlag(final String flag) { public Flag getFlag(final String flag) {
for (final Flag myflag : this.flags) { for (final Flag myflag : this.flags) {

View File

@ -42,7 +42,7 @@ public abstract class PlotWorld {
// TODO make this configurable // TODO make this configurable
// make non static and static_default_valu + add config option // make non static and static_default_valu + add config option
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
public static ArrayList<Material> BLOCKS = new ArrayList<Material>(Arrays.asList(new Material[]{ACACIA_STAIRS, BEACON, BEDROCK, BIRCH_WOOD_STAIRS, BOOKSHELF, BREWING_STAND, BRICK, BRICK_STAIRS, BURNING_FURNACE, CAKE_BLOCK, CAULDRON, CLAY_BRICK, CLAY, COAL_BLOCK, COAL_ORE, COBBLE_WALL, COBBLESTONE, COBBLESTONE_STAIRS, COMMAND, DARK_OAK_STAIRS, DAYLIGHT_DETECTOR, DIAMOND_ORE, DIAMOND_BLOCK, DIRT, DISPENSER, DROPPER, EMERALD_BLOCK, EMERALD_ORE, ENCHANTMENT_TABLE, ENDER_PORTAL_FRAME, ENDER_STONE, FURNACE, GLOWSTONE, GOLD_ORE, GOLD_BLOCK, GRASS, GRAVEL, GLASS, HARD_CLAY, HAY_BLOCK, HUGE_MUSHROOM_1, HUGE_MUSHROOM_2, IRON_BLOCK, IRON_ORE, JACK_O_LANTERN, JUKEBOX, JUNGLE_WOOD_STAIRS, LAPIS_BLOCK, LAPIS_ORE, LEAVES, LEAVES_2, LOG, LOG_2, MELON_BLOCK, MOB_SPAWNER, MOSSY_COBBLESTONE, MYCEL, NETHER_BRICK, NETHER_BRICK_STAIRS, NETHERRACK, NOTE_BLOCK, OBSIDIAN, PACKED_ICE, PUMPKIN, QUARTZ_BLOCK, QUARTZ_ORE, QUARTZ_STAIRS, REDSTONE_BLOCK, SANDSTONE, SAND, public static ArrayList<Material> BLOCKS = new ArrayList<>(Arrays.asList(new Material[]{ACACIA_STAIRS, BEACON, BEDROCK, BIRCH_WOOD_STAIRS, BOOKSHELF, BREWING_STAND, BRICK, BRICK_STAIRS, BURNING_FURNACE, CAKE_BLOCK, CAULDRON, CLAY_BRICK, CLAY, COAL_BLOCK, COAL_ORE, COBBLE_WALL, COBBLESTONE, COBBLESTONE_STAIRS, COMMAND, DARK_OAK_STAIRS, DAYLIGHT_DETECTOR, DIAMOND_ORE, DIAMOND_BLOCK, DIRT, DISPENSER, DROPPER, EMERALD_BLOCK, EMERALD_ORE, ENCHANTMENT_TABLE, ENDER_PORTAL_FRAME, ENDER_STONE, FURNACE, GLOWSTONE, GOLD_ORE, GOLD_BLOCK, GRASS, GRAVEL, GLASS, HARD_CLAY, HAY_BLOCK, HUGE_MUSHROOM_1, HUGE_MUSHROOM_2, IRON_BLOCK, IRON_ORE, JACK_O_LANTERN, JUKEBOX, JUNGLE_WOOD_STAIRS, LAPIS_BLOCK, LAPIS_ORE, LEAVES, LEAVES_2, LOG, LOG_2, MELON_BLOCK, MOB_SPAWNER, MOSSY_COBBLESTONE, MYCEL, NETHER_BRICK, NETHER_BRICK_STAIRS, NETHERRACK, NOTE_BLOCK, OBSIDIAN, PACKED_ICE, PUMPKIN, QUARTZ_BLOCK, QUARTZ_ORE, QUARTZ_STAIRS, REDSTONE_BLOCK, SANDSTONE, SAND,
SANDSTONE_STAIRS, SMOOTH_BRICK, SMOOTH_STAIRS, SNOW_BLOCK, SOUL_SAND, SPONGE, SPRUCE_WOOD_STAIRS, STONE, WOOD, WOOD_STAIRS, WORKBENCH, WOOL, getMaterial(44), getMaterial(126)})); SANDSTONE_STAIRS, SMOOTH_BRICK, SMOOTH_STAIRS, SNOW_BLOCK, SOUL_SAND, SPONGE, SPRUCE_WOOD_STAIRS, STONE, WOOD, WOOD_STAIRS, WORKBENCH, WOOL, getMaterial(44), getMaterial(126)}));
public static boolean AUTO_MERGE_DEFAULT = false; public static boolean AUTO_MERGE_DEFAULT = false;
public static boolean MOB_SPAWNING_DEFAULT = false; public static boolean MOB_SPAWNING_DEFAULT = false;
@ -52,7 +52,7 @@ public abstract class PlotWorld {
public static boolean SCHEMATIC_ON_CLAIM_DEFAULT = false; public static boolean SCHEMATIC_ON_CLAIM_DEFAULT = false;
public static String SCHEMATIC_FILE_DEFAULT = "null"; public static String SCHEMATIC_FILE_DEFAULT = "null";
public static List<String> SCHEMATICS_DEFAULT = null; public static List<String> SCHEMATICS_DEFAULT = null;
public static List<String> DEFAULT_FLAGS_DEFAULT = new ArrayList<String>(); public static List<String> DEFAULT_FLAGS_DEFAULT = new ArrayList<>();
public static boolean USE_ECONOMY_DEFAULT = false; public static boolean USE_ECONOMY_DEFAULT = false;
public static double PLOT_PRICE_DEFAULT = 100; public static double PLOT_PRICE_DEFAULT = 100;
public static double MERGE_PRICE_DEFAULT = 100; public static double MERGE_PRICE_DEFAULT = 100;
@ -89,7 +89,7 @@ public abstract class PlotWorld {
/** /**
* When a world is created, the following method will be called for each * When a world is created, the following method will be called for each
* *
* @param config * @param config Configuration Section
*/ */
public void loadDefaultConfiguration(final ConfigurationSection config) { public void loadDefaultConfiguration(final ConfigurationSection config) {
this.MOB_SPAWNING = config.getBoolean("natural_mob_spawning"); this.MOB_SPAWNING = config.getBoolean("natural_mob_spawning");
@ -118,10 +118,10 @@ public abstract class PlotWorld {
/** /**
* Saving core plotworld settings * Saving core plotworld settings
* *
* @param config * @param config Configuration Section
*/ */
public void saveConfiguration(final ConfigurationSection config) { public void saveConfiguration(final ConfigurationSection config) {
final HashMap<String, Object> options = new HashMap<String, Object>(); final HashMap<String, Object> options = new HashMap<>();
options.put("natural_mob_spawning", PlotWorld.MOB_SPAWNING_DEFAULT); options.put("natural_mob_spawning", PlotWorld.MOB_SPAWNING_DEFAULT);
options.put("plot.auto_merge", PlotWorld.AUTO_MERGE_DEFAULT); options.put("plot.auto_merge", PlotWorld.AUTO_MERGE_DEFAULT);

View File

@ -43,6 +43,7 @@ public class Title {
static { static {
CORRESPONDING_TYPES = new HashMap<>(); CORRESPONDING_TYPES = new HashMap<>();
} }
/* Title packet */ /* Title packet */
private Class<?> packetTitle; private Class<?> packetTitle;
/* Title packet actions ENUM */ /* Title packet actions ENUM */
@ -50,7 +51,7 @@ public class Title {
/* Chat serializer */ /* Chat serializer */
private Class<?> nmsChatSerializer; private Class<?> nmsChatSerializer;
/* Title text and color */ /* Title text and color */
private String title = ""; private String title;
private ChatColor titleColor = ChatColor.WHITE; private ChatColor titleColor = ChatColor.WHITE;
/* Subtitle text and color */ /* Subtitle text and color */
private String subtitle = ""; private String subtitle = "";
@ -78,6 +79,7 @@ public class Title {
* @param subtitle Subtitle text * @param subtitle Subtitle text
*/ */
public Title(final String title, final String subtitle) { public Title(final String title, final String subtitle) {
this.title = "";
this.title = title; this.title = title;
this.subtitle = subtitle; this.subtitle = subtitle;
loadClasses(); loadClasses();
@ -93,6 +95,7 @@ public class Title {
* @param fadeOutTime Fade out time * @param fadeOutTime Fade out time
*/ */
public Title(final String title, final String subtitle, final int fadeInTime, final int stayTime, final int fadeOutTime) { public Title(final String title, final String subtitle, final int fadeInTime, final int stayTime, final int fadeOutTime) {
this.title = "";
this.title = title; this.title = title;
this.subtitle = subtitle; this.subtitle = subtitle;
this.fadeInTime = fadeInTime; this.fadeInTime = fadeInTime;

View File

@ -28,6 +28,7 @@ import org.bukkit.Location;
* *
* @author Citymonstret * @author Citymonstret
*/ */
@SuppressWarnings({"javadoc", "unused"})
public class LSetCube { public class LSetCube {
/** /**

View File

@ -39,10 +39,11 @@ import org.bukkit.entity.Player;
/** /**
* @author Citymonstret * @author Citymonstret
* @author Empire92
*/ */
@SuppressWarnings("ALL")
public class PWE { public class PWE {
@SuppressWarnings("deprecation")
public static void setMask(final Player p, final Location l) { public static void setMask(final Player p, final Location l) {
try { try {
LocalSession s; LocalSession s;
@ -98,6 +99,7 @@ public class PWE {
return s.getMask() == null; return s.getMask() == null;
} }
@SuppressWarnings("deprecation")
public static void setNoMask(final Player p) { public static void setNoMask(final Player p) {
try { try {
LocalSession s; LocalSession s;
@ -110,7 +112,7 @@ public class PWE {
final Vector p1 = new Vector(69, 69, 69), p2 = new Vector(69, 69, 69); final Vector p1 = new Vector(69, 69, 69), p2 = new Vector(69, 69, 69);
s.setMask(new RegionMask(new CuboidRegion(plr.getWorld(), p1, p2))); s.setMask(new RegionMask(new CuboidRegion(plr.getWorld(), p1, p2)));
} catch (final Exception e) { } catch (final Exception e) {
//
} }
} }

View File

@ -26,7 +26,9 @@ import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.database.DBFunc; import com.intellectualcrafters.plot.database.DBFunc;
import com.intellectualcrafters.plot.listeners.PlotListener; import com.intellectualcrafters.plot.listeners.PlotListener;
import com.intellectualcrafters.plot.object.*; import com.intellectualcrafters.plot.object.*;
import net.milkbowl.vault.economy.Economy; import net.milkbowl.vault.economy.Economy;
import org.bukkit.*; import org.bukkit.*;
import org.bukkit.block.Biome; import org.bukkit.block.Biome;
import org.bukkit.block.Block; import org.bukkit.block.Block;
@ -45,11 +47,12 @@ import java.util.UUID;
* *
* @author Citymonstret * @author Citymonstret
*/ */
@SuppressWarnings({"unused", "javadoc", "deprecation"})
public class PlotHelper { public class PlotHelper {
public static boolean canSetFast = false; public static boolean canSetFast = false;
public static boolean canSendChunk = false; public static boolean canSendChunk = false;
public static ArrayList<String> runners_p = new ArrayList<String>(); public static ArrayList<String> runners_p = new ArrayList<>();
public static HashMap<Plot, Integer> runners = new HashMap<Plot, Integer>(); public static HashMap<Plot, Integer> runners = new HashMap<>();
static long state = 1; static long state = 1;
/** /**
@ -191,7 +194,7 @@ public class PlotHelper {
final PlotManager manager = PlotMain.getPlotManager(world); final PlotManager manager = PlotMain.getPlotManager(world);
final PlotWorld plotworld = PlotMain.getWorldSettings(world); final PlotWorld plotworld = PlotMain.getWorldSettings(world);
if (lesserPlot.id.x == greaterPlot.id.x) { if (lesserPlot.id.x.equals(greaterPlot.id.x)) {
if (!lesserPlot.settings.getMerged(2)) { if (!lesserPlot.settings.getMerged(2)) {
lesserPlot.settings.setMerged(2, true); lesserPlot.settings.setMerged(2, true);
greaterPlot.settings.setMerged(0, true); greaterPlot.settings.setMerged(0, true);
@ -209,7 +212,7 @@ public class PlotHelper {
/* /*
* Random number gen section * Random number gen section
*/ */
public static final long nextLong() { public static long nextLong() {
final long a = state; final long a = state;
state = xorShift64(a); state = xorShift64(a);
return a; return a;
@ -219,14 +222,14 @@ public class PlotHelper {
* End of random number gen section * End of random number gen section
*/ */
public static final long xorShift64(long a) { public static long xorShift64(long a) {
a ^= (a << 21); a ^= (a << 21);
a ^= (a >>> 35); a ^= (a >>> 35);
a ^= (a << 4); a ^= (a << 4);
return a; return a;
} }
public static final int random(final int n) { public static int random(final int n) {
if (n == 1) { if (n == 1) {
return 0; return 0;
} }
@ -353,7 +356,6 @@ public class PlotHelper {
count++; count++;
final PlotId bot = PlayerFunctions.getBottomPlot(world, plot).id; final PlotId bot = PlayerFunctions.getBottomPlot(world, plot).id;
final PlotId top = PlayerFunctions.getTopPlot(world, plot).id; final PlotId top = PlayerFunctions.getTopPlot(world, plot).id;
merge = false;
plots = PlayerFunctions.getPlotSelectionIds(world, new PlotId(bot.x, bot.y - 1), new PlotId(top.x, top.y)); plots = PlayerFunctions.getPlotSelectionIds(world, new PlotId(bot.x, bot.y - 1), new PlotId(top.x, top.y));
if (ownsPlots(world, plots, player, 0)) { if (ownsPlots(world, plots, player, 0)) {
final boolean result = mergePlots(world, plots); final boolean result = mergePlots(world, plots);
@ -765,6 +767,7 @@ public class PlotHelper {
} }
} }
} catch (final Exception e) { } catch (final Exception e) {
//
} }
} }
} }
@ -794,7 +797,7 @@ public class PlotHelper {
} }
} }
} catch (final Exception e) { } catch (final Exception e) {
//
} }
} }
} }
@ -829,6 +832,13 @@ public class PlotHelper {
return 64; return 64;
} }
/**
* Get plot home
*
* @param w World in which the plot is located
* @param plotid Plot ID
* @return Home Location
*/
public static Location getPlotHome(final World w, final PlotId plotid) { public static Location getPlotHome(final World w, final PlotId plotid) {
if (getPlot(w, plotid).settings.getPosition() == PlotHomePosition.DEFAULT) { if (getPlot(w, plotid).settings.getPosition() == PlotHomePosition.DEFAULT) {
@ -848,10 +858,33 @@ public class PlotHelper {
} }
} }
/**
* Retrieve the location of the default plot home position
* @param plot Plot
* @return the location
*/
public static Location getPlotHomeDefault(final Plot plot) {
final Location l = getPlotBottomLoc(plot.getWorld(), plot.getId()).subtract(0, 0, 0);
l.setY(getHeighestBlock(plot.getWorld(), l.getBlockX(), l.getBlockZ()));
return l;
}
/**
* Get the plot home
* @param w World
* @param plot Plot Object
* @return Plot Home Location
* @see #getPlotHome(org.bukkit.World, com.intellectualcrafters.plot.object.PlotId)
*/
public static Location getPlotHome(final World w, final Plot plot) { public static Location getPlotHome(final World w, final Plot plot) {
return getPlotHome(w, plot.id); return getPlotHome(w, plot.id);
} }
/**
* Refresh the plot chunks
* @param world World in which the plot is located
* @param plot Plot Object
*/
public static void refreshPlotChunks(final World world, final Plot plot) { public static void refreshPlotChunks(final World world, final Plot plot) {
final int bottomX = getPlotBottomLoc(world, plot.id).getBlockX(); final int bottomX = getPlotBottomLoc(world, plot.id).getBlockX();
final int topX = getPlotTopLoc(world, plot.id).getBlockX(); final int topX = getPlotTopLoc(world, plot.id).getBlockX();

View File

@ -24,7 +24,9 @@ package com.intellectualcrafters.plot.util;
import com.intellectualcrafters.plot.PlotMain; import com.intellectualcrafters.plot.PlotMain;
/** /**
* Created by Citymonstret on 2014-09-29. * Created 2014-09-29 for PlotSquared
*
* @author Citymonstret
*/ */
public class PlotSquaredException extends RuntimeException { public class PlotSquaredException extends RuntimeException {
@ -34,6 +36,7 @@ public class PlotSquaredException extends RuntimeException {
} }
public static enum PlotError { public static enum PlotError {
PLOTMAIN_NULL("The PlotMain instance was null"),
MISSING_DEPENDENCY("Missing Dependency"); MISSING_DEPENDENCY("Missing Dependency");
private String errorHeader; private String errorHeader;

View File

@ -28,6 +28,7 @@ import java.lang.reflect.Constructor;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
@ -232,8 +233,8 @@ public class ReflectionUtils {
if (methodTypes.length != classes.length) { if (methodTypes.length != classes.length) {
continue; continue;
} }
for (int i = 0; i < classes.length; i++) { for (Class aClass : classes) {
if (!classes.equals(methodTypes)) { if (!Arrays.equals(classes, methodTypes)) {
continue findMethod; continue findMethod;
} }
return new RefMethod(m); return new RefMethod(m);

View File

@ -45,7 +45,6 @@ import java.util.zip.GZIPOutputStream;
* @author Citymonstret * @author Citymonstret
* @author Empire92 * @author Empire92
*/ */
@SuppressWarnings({"all"})
public class SchematicHandler { public class SchematicHandler {
/** /**
* Paste a schematic * Paste a schematic
@ -125,7 +124,9 @@ public class SchematicHandler {
{ {
final File parent = new File(JavaPlugin.getPlugin(PlotMain.class).getDataFolder() + File.separator + "schematics"); final File parent = new File(JavaPlugin.getPlugin(PlotMain.class).getDataFolder() + File.separator + "schematics");
if (!parent.exists()) { if (!parent.exists()) {
parent.mkdir(); if (!parent.mkdir()) {
throw new RuntimeException("Could not create schematic parent directory");
}
} }
} }
final File file = new File(JavaPlugin.getPlugin(PlotMain.class).getDataFolder() + File.separator + "schematics" + File.separator + name + ".schematic"); final File file = new File(JavaPlugin.getPlugin(PlotMain.class).getDataFolder() + File.separator + "schematics" + File.separator + name + ".schematic");
@ -252,6 +253,7 @@ public class SchematicHandler {
* @param id plot * @param id plot
* @return tag * @return tag
*/ */
@SuppressWarnings("deprecation")
public static CompoundTag getCompoundTag(final World world, final PlotId id) { public static CompoundTag getCompoundTag(final World world, final PlotId id) {
if (!PlotMain.getPlots(world).containsKey(id)) { if (!PlotMain.getPlots(world).containsKey(id)) {
@ -307,6 +309,7 @@ public class SchematicHandler {
final Block block = world.getBlockAt(new Location(world, pos1.getBlockX() + x, y, pos1.getBlockZ() + z)); final Block block = world.getBlockAt(new Location(world, pos1.getBlockX() + x, y, pos1.getBlockZ() + z));
@SuppressWarnings("deprecation")
final int id2 = block.getTypeId(); final int id2 = block.getTypeId();
if (id2 > 255) { if (id2 > 255) {

View File

@ -34,6 +34,8 @@ import static com.intellectualcrafters.plot.util.ReflectionUtils.getRefClass;
/** /**
* SetBlockFast class<br> * SetBlockFast class<br>
* Used to do fast world editing * Used to do fast world editing
*
* @author Empire92
*/ */
public class SetBlockFast { public class SetBlockFast {
@ -47,6 +49,11 @@ public class SetBlockFast {
private static RefMethod methodA; private static RefMethod methodA;
private static RefMethod methodGetById; private static RefMethod methodGetById;
/**
* Constructor
*
* @throws NoSuchMethodException
*/
public SetBlockFast() throws NoSuchMethodException { public SetBlockFast() throws NoSuchMethodException {
methodGetHandle = classCraftWorld.getMethod("getHandle"); methodGetHandle = classCraftWorld.getMethod("getHandle");
methodGetChunkAt = classWorld.getMethod("getChunkAt", int.class, int.class); methodGetChunkAt = classWorld.getMethod("getChunkAt", int.class, int.class);
@ -54,6 +61,17 @@ public class SetBlockFast {
methodGetById = classBlock.getMethod("getById", int.class); methodGetById = classBlock.getMethod("getById", int.class);
} }
/**
* Set the block at the location
* @param world World in which the block should be set
* @param x X Coordinate
* @param y Y Coordinate
* @param z Z Coordinate
* @param blockId Block ID
* @param data Block Data Value
* @return true
* @throws NoSuchMethodException
*/
public static boolean set(final org.bukkit.World world, final int x, final int y, final int z, final int blockId, final byte data) throws NoSuchMethodException { public static boolean set(final org.bukkit.World world, final int x, final int y, final int z, final int blockId, final byte data) throws NoSuchMethodException {
final Object w = methodGetHandle.of(world).call(); final Object w = methodGetHandle.of(world).call();
@ -63,6 +81,10 @@ public class SetBlockFast {
return true; return true;
} }
/**
* Update chunks
* @param player Player whose chunks we're updating
*/
public static void update(final org.bukkit.entity.Player player) { public static void update(final org.bukkit.entity.Player player) {
if (!PlotHelper.canSendChunk) { if (!PlotHelper.canSendChunk) {

View File

@ -36,12 +36,14 @@ public class StringComparison {
* Best Match * Best Match
*/ */
private String bestMatch; private String bestMatch;
/** /**
* Match Value * Match Value
* <p/> * <p/>
* Can be checked for low match (< .25 or something) * Can be checked for low match (< .25 or something)
*/ */
private double match = 0; private double match = 0;
/** /**
* The actual object * The actual object
*/ */

View File

@ -71,7 +71,8 @@ public class UUIDHandler {
private static boolean online = Bukkit.getServer().getOnlineMode(); private static boolean online = Bukkit.getServer().getOnlineMode();
/** /**
* Map containing names and UUID's * Map containing names and UUIDs
* @see com.google.common.collect.BiMap
*/ */
private static BiMap<StringWrapper, UUID> uuidMap = HashBiMap.create(new HashMap<StringWrapper, UUID>()); private static BiMap<StringWrapper, UUID> uuidMap = HashBiMap.create(new HashMap<StringWrapper, UUID>());
@ -79,6 +80,7 @@ public class UUIDHandler {
* Get the map containing all names/uuids * Get the map containing all names/uuids
* *
* @return map with names + uuids * @return map with names + uuids
* @see com.google.common.collect.BiMap
*/ */
public static BiMap<StringWrapper, UUID> getUuidMap() { public static BiMap<StringWrapper, UUID> getUuidMap() {
return uuidMap; return uuidMap;
@ -89,6 +91,7 @@ public class UUIDHandler {
* *
* @param uuid to check * @param uuid to check
* @return true of the uuid is cached * @return true of the uuid is cached
* @see com.google.common.collect.BiMap#containsValue(Object)
*/ */
public static boolean uuidExists(final UUID uuid) { public static boolean uuidExists(final UUID uuid) {
return uuidMap.containsValue(uuid); return uuidMap.containsValue(uuid);
@ -99,6 +102,7 @@ public class UUIDHandler {
* *
* @param name to check * @param name to check
* @return true of the name is cached * @return true of the name is cached
* @see com.google.common.collect.BiMap#containsKey(Object)
*/ */
public static boolean nameExists(final StringWrapper name) { public static boolean nameExists(final StringWrapper name) {
return uuidMap.containsKey(name); return uuidMap.containsKey(name);

View File

@ -35,7 +35,8 @@ import java.util.UUID;
import java.util.concurrent.Callable; import java.util.concurrent.Callable;
/** /**
* @author * Name Fetcher Class
* From Bukkit
*/ */
public class NameFetcher implements Callable<Map<UUID, String>> { public class NameFetcher implements Callable<Map<UUID, String>> {
private static final String PROFILE_URL = "https://sessionserver.mojang.com/session/minecraft/profile/"; private static final String PROFILE_URL = "https://sessionserver.mojang.com/session/minecraft/profile/";
@ -48,7 +49,7 @@ public class NameFetcher implements Callable<Map<UUID, String>> {
@Override @Override
public Map<UUID, String> call() throws Exception { public Map<UUID, String> call() throws Exception {
final Map<UUID, String> uuidStringMap = new HashMap<UUID, String>(); final Map<UUID, String> uuidStringMap = new HashMap<>();
for (final UUID uuid : this.uuids) { for (final UUID uuid : this.uuids) {
if (uuidStringMap.containsKey(uuid)) { if (uuidStringMap.containsKey(uuid)) {
continue; continue;

View File

@ -37,9 +37,12 @@ import java.net.URLConnection;
import java.util.UUID; import java.util.UUID;
/** /**
* Created by Citymonstret on 2014-10-13. * Plot UUID Saver/Fetcher
*
* @author Citymonstret
* @author Empire92
*/ */
public class PlotUUIDSaver extends UUIDSaver { public class PlotUUIDSaver implements UUIDSaver {
@Override @Override
public void globalPopulate() { public void globalPopulate() {

View File

@ -35,7 +35,8 @@ import java.util.*;
import java.util.concurrent.Callable; import java.util.concurrent.Callable;
/** /**
* @author * UUID Fetcher
* From Bukkit
*/ */
public class UUIDFetcher implements Callable<Map<String, UUID>> { public class UUIDFetcher implements Callable<Map<String, UUID>> {
private static final double PROFILES_PER_REQUEST = 100; private static final double PROFILES_PER_REQUEST = 100;
@ -53,29 +54,6 @@ public class UUIDFetcher implements Callable<Map<String, UUID>> {
this(names, true); this(names, true);
} }
@Override
public Map<String, UUID> call() throws Exception {
final Map<String, UUID> uuidMap = new HashMap<String, UUID>();
final int requests = (int) Math.ceil(this.names.size() / PROFILES_PER_REQUEST);
for (int i = 0; i < requests; i++) {
final HttpURLConnection connection = createConnection();
final String body = JSONArray.toJSONString(this.names.subList(i * 100, Math.min((i + 1) * 100, this.names.size())));
writeBody(connection, body);
final JSONArray array = (JSONArray) this.jsonParser.parse(new InputStreamReader(connection.getInputStream()));
for (final Object profile : array) {
final JSONObject jsonProfile = (JSONObject) profile;
final String id = (String) jsonProfile.get("id");
final String name = (String) jsonProfile.get("name");
final UUID uuid = UUIDFetcher.getUUID(id);
uuidMap.put(name, uuid);
}
if (this.rateLimiting && (i != (requests - 1))) {
Thread.sleep(100L);
}
}
return uuidMap;
}
private static void writeBody(final HttpURLConnection connection, final String body) throws Exception { private static void writeBody(final HttpURLConnection connection, final String body) throws Exception {
final OutputStream stream = connection.getOutputStream(); final OutputStream stream = connection.getOutputStream();
stream.write(body.getBytes()); stream.write(body.getBytes());
@ -98,6 +76,7 @@ public class UUIDFetcher implements Callable<Map<String, UUID>> {
return UUID.fromString(id.substring(0, 8) + "-" + id.substring(8, 12) + "-" + id.substring(12, 16) + "-" + id.substring(16, 20) + "-" + id.substring(20, 32)); return UUID.fromString(id.substring(0, 8) + "-" + id.substring(8, 12) + "-" + id.substring(12, 16) + "-" + id.substring(16, 20) + "-" + id.substring(20, 32));
} }
@SuppressWarnings("unused")
public static byte[] toBytes(final UUID uuid) { public static byte[] toBytes(final UUID uuid) {
final ByteBuffer byteBuffer = ByteBuffer.wrap(new byte[16]); final ByteBuffer byteBuffer = ByteBuffer.wrap(new byte[16]);
byteBuffer.putLong(uuid.getMostSignificantBits()); byteBuffer.putLong(uuid.getMostSignificantBits());
@ -105,6 +84,7 @@ public class UUIDFetcher implements Callable<Map<String, UUID>> {
return byteBuffer.array(); return byteBuffer.array();
} }
@SuppressWarnings("unused")
public static UUID fromBytes(final byte[] array) { public static UUID fromBytes(final byte[] array) {
if (array.length != 16) { if (array.length != 16) {
throw new IllegalArgumentException("Illegal byte array length: " + array.length); throw new IllegalArgumentException("Illegal byte array length: " + array.length);
@ -115,7 +95,31 @@ public class UUIDFetcher implements Callable<Map<String, UUID>> {
return new UUID(mostSignificant, leastSignificant); return new UUID(mostSignificant, leastSignificant);
} }
@SuppressWarnings("unused")
public static UUID getUUIDOf(final String name) throws Exception { public static UUID getUUIDOf(final String name) throws Exception {
return new UUIDFetcher(Arrays.asList(name)).call().get(name); return new UUIDFetcher(Arrays.asList(name)).call().get(name);
} }
@Override
public Map<String, UUID> call() throws Exception {
final Map<String, UUID> uuidMap = new HashMap<>();
final int requests = (int) Math.ceil(this.names.size() / PROFILES_PER_REQUEST);
for (int i = 0; i < requests; i++) {
final HttpURLConnection connection = createConnection();
final String body = JSONArray.toJSONString(this.names.subList(i * 100, Math.min((i + 1) * 100, this.names.size())));
writeBody(connection, body);
final JSONArray array = (JSONArray) this.jsonParser.parse(new InputStreamReader(connection.getInputStream()));
for (final Object profile : array) {
final JSONObject jsonProfile = (JSONObject) profile;
final String id = (String) jsonProfile.get("id");
final String name = (String) jsonProfile.get("name");
final UUID uuid = UUIDFetcher.getUUID(id);
uuidMap.put(name, uuid);
}
if (this.rateLimiting && (i != (requests - 1))) {
Thread.sleep(100L);
}
}
return uuidMap;
}
} }

View File

@ -27,20 +27,60 @@ import com.intellectualcrafters.plot.object.StringWrapper;
import java.util.UUID; import java.util.UUID;
/** /**
* Created by Citymonstret on 2014-10-13. * @author Citymonstret
*/ */
public abstract class UUIDSaver { public interface UUIDSaver {
public abstract void globalPopulate();
public abstract void globalSave(final BiMap<StringWrapper, UUID> biMap); /**
* Populate the default list
*/
public void globalPopulate();
public abstract void save(final UUIDSet set); /**
* Save the UUIDs
*
* @param biMap Map containing names and UUIDs
*/
public void globalSave(final BiMap<StringWrapper, UUID> biMap);
public abstract UUIDSet get(final String name); /**
* Save a single UUIDSet
*
* @param set Set to save
*/
public void save(final UUIDSet set);
public abstract UUIDSet get(final UUID uuid); /**
* Get a single UUIDSet
*
* @param name Username
* @return UUID Set
*/
public UUIDSet get(final String name);
public abstract UUID mojangUUID(final String name) throws Exception; /**
* Get a single UUIDSet
*
* @param uuid UUID
* @return UUID Set
*/
public UUIDSet get(final UUID uuid);
public abstract String mojangName(final UUID uuid) throws Exception; /**
* Fetch uuid from mojang servers
*
* @param name Username
* @return uuid
* @throws Exception
*/
public UUID mojangUUID(final String name) throws Exception;
/**
* Fetch username from mojang servers
*
* @param uuid UUID
* @return username
* @throws Exception
*/
public String mojangName(final UUID uuid) throws Exception;
} }

View File

@ -24,12 +24,26 @@ package com.intellectualcrafters.plot.uuid;
import java.util.UUID; import java.util.UUID;
/** /**
* Created by Citymonstret on 2014-10-13. * @author Citymonstret
*/ */
public class UUIDSet { public class UUIDSet {
/**
* Player Name
*/
private final String name; private final String name;
/**
* Player UUID
*/
private final UUID uuid; private final UUID uuid;
/**
* Constructor
*
* @param name Username
* @param uuid UUID
*/
public UUIDSet(final String name, final UUID uuid) { public UUIDSet(final String name, final UUID uuid) {
this.name = name; this.name = name;
this.uuid = uuid; this.uuid = uuid;
@ -40,6 +54,11 @@ public class UUIDSet {
return getName(); return getName();
} }
/**
* Return the name
*
* @return Name
*/
public String getName() { public String getName() {
return this.name; return this.name;
} }

View File

@ -1,6 +1,14 @@
PlotSquared Official Repo PlotSquared Official Repo
========================================================== ==========================================================
This is the official PlotSquared repo, if you didn't understand that by the title... PlotSquared - Plot Plugin Extraordinaire.
## Compile: ##
Build the project using your favourite compiler (maven is the recommended way to build), then package the jar using `mvn package` **MAVEN IS REQUIRED TO BUILD AND PACKAGE THE JAR**
To build the PlotMe converted, you need a PlotMe jar file (a release post-UUID), we won't like to this for obvious reasons.
## API: ##
The main API class can be found [here](https://github.com/IntellectualCrafters/PlotSquared/blob/master/PlotSquared/src/main/java/com/intellectualcrafters/plot/api/PlotAPI.java "API"). JavaDoc's can be found [here](http://git.plotworld.info/jdocs/ "JDOCS").
## Links: ## ## Links: ##
@ -13,5 +21,6 @@ This is the official PlotSquared repo, if you didn't understand that by the titl
- [AdvPlots](http://www.spigotmc.org/resources/advplots-%CE%B2.1500/ "AdvPlots") - [AdvPlots](http://www.spigotmc.org/resources/advplots-%CE%B2.1500/ "AdvPlots")
- [PlotRankup](http://www.spigotmc.org/resources/plotrankup.1571/ "PlotRankup") - [PlotRankup](http://www.spigotmc.org/resources/plotrankup.1571/ "PlotRankup")
Dependencies: ...
[http://intellectualsites.com/download.php?key=a12f1474-6bbc-4017-ba43-d26f8de36a7c](http://intellectualsites.com/download.php?key=a12f1474-6bbc-4017-ba43-d26f8de36a7c "Dependencies (/lib)") Read [THIS](https://intellectualsites.com/?p=view_post&post=106) before saying that we've stolen code.