Merge branch 'manuelgu-feature/rm-redundant-methods'

This commit is contained in:
MattBDev 2016-03-20 19:54:46 -04:00
commit 0e49dd6f62
16 changed files with 288 additions and 275 deletions

View File

@ -45,7 +45,6 @@ import org.bukkit.OfflinePlayer;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.HashSet; import java.util.HashSet;
@ -66,21 +65,21 @@ import java.util.UUID;
* @see PS * @see PS
*/ */
public class PlotAPI { public class PlotAPI {
/** /**
* Permission that allows for admin access, this permission node will allow the player to use any part of the * Permission that allows for admin access, this permission node will allow the player to use any part of the
* plugin, without limitations. * plugin, without limitations.
* @deprecated Use C.PERMISSION_ADMIN.s() instead * @deprecated Use C.PERMISSION_ADMIN instead
*/ */
@Deprecated @Deprecated
public static final String ADMIN_PERMISSION = C.PERMISSION_ADMIN.s(); public static final String ADMIN_PERMISSION = C.PERMISSION_ADMIN.s();
/** /**
* @deprecated Use new PlotAPI() instead * @deprecated Use new PlotAPI() instead
*/ */
@Deprecated @Deprecated
public PlotAPI(final JavaPlugin plugin) {} public PlotAPI(final JavaPlugin plugin) {}
/** /**
* @see PS * @see PS
* *
@ -93,7 +92,7 @@ public class PlotAPI {
*/ */
@Deprecated @Deprecated
public PlotAPI() {} public PlotAPI() {}
/** /**
* Get all plots * Get all plots
* *
@ -104,7 +103,7 @@ public class PlotAPI {
public Set<Plot> getAllPlots() { public Set<Plot> getAllPlots() {
return PS.get().getPlots(); return PS.get().getPlots();
} }
/** /**
* Return all plots for a player * Return all plots for a player
* *
@ -115,7 +114,7 @@ public class PlotAPI {
public Set<Plot> getPlayerPlots(final Player player) { public Set<Plot> getPlayerPlots(final Player player) {
return PS.get().getPlots(BukkitUtil.getPlayer(player)); return PS.get().getPlots(BukkitUtil.getPlayer(player));
} }
/** /**
* Add a plot world * Add a plot world
* *
@ -125,7 +124,7 @@ public class PlotAPI {
public void addPlotArea(final PlotArea plotArea) { public void addPlotArea(final PlotArea plotArea) {
PS.get().addPlotArea(plotArea); PS.get().addPlotArea(plotArea);
} }
/** /**
* @return main configuration * @return main configuration
* *
@ -134,7 +133,7 @@ public class PlotAPI {
public YamlConfiguration getConfig() { public YamlConfiguration getConfig() {
return PS.get().config; return PS.get().config;
} }
/** /**
* @return storage configuration * @return storage configuration
* *
@ -143,7 +142,7 @@ public class PlotAPI {
public YamlConfiguration getStorage() { public YamlConfiguration getStorage() {
return PS.get().storage; return PS.get().storage;
} }
/** /**
* Get the main class for this plugin <br> - Contains a lot of fields and methods - not very well organized <br> * Get the main class for this plugin <br> - Contains a lot of fields and methods - not very well organized <br>
* Only use this if you really need it * Only use this if you really need it
@ -155,7 +154,7 @@ public class PlotAPI {
public PS getMain() { public PS getMain() {
return PS.get(); return PS.get();
} }
/** /**
* ChunkManager class contains several useful methods<br> * ChunkManager class contains several useful methods<br>
* - Chunk deletion<br> * - Chunk deletion<br>
@ -179,7 +178,7 @@ public class PlotAPI {
public SetQueue getSetQueue() { public SetQueue getSetQueue() {
return SetQueue.IMP; return SetQueue.IMP;
} }
/** /**
* UUIDWrapper class has basic methods for getting UUIDS (it's recommended to use the UUIDHandler class instead) * UUIDWrapper class has basic methods for getting UUIDS (it's recommended to use the UUIDHandler class instead)
* *
@ -190,7 +189,7 @@ public class PlotAPI {
public UUIDWrapper getUUIDWrapper() { public UUIDWrapper getUUIDWrapper() {
return UUIDHandler.getUUIDWrapper(); return UUIDHandler.getUUIDWrapper();
} }
/** /**
* Do not use this. Instead use FlagManager.[method] in your code. * Do not use this. Instead use FlagManager.[method] in your code.
* - Flag related stuff * - Flag related stuff
@ -203,7 +202,7 @@ public class PlotAPI {
public FlagManager getFlagManager() { public FlagManager getFlagManager() {
return new FlagManager(); return new FlagManager();
} }
/** /**
* Do not use this. Instead use MainUtil.[method] in your code. * Do not use this. Instead use MainUtil.[method] in your code.
* - Basic plot management stuff * - Basic plot management stuff
@ -216,7 +215,7 @@ public class PlotAPI {
public MainUtil getMainUtil() { public MainUtil getMainUtil() {
return new MainUtil(); return new MainUtil();
} }
/** /**
* Do not use this. Instead use C.PERMISSION_[method] in your code. * Do not use this. Instead use C.PERMISSION_[method] in your code.
* - Basic permission management stuff * - Basic permission management stuff
@ -235,7 +234,7 @@ public class PlotAPI {
} }
return perms.toArray(new String[perms.size()]); return perms.toArray(new String[perms.size()]);
} }
/** /**
* SchematicHandler class contains methods related to pasting, reading and writing schematics * SchematicHandler class contains methods related to pasting, reading and writing schematics
* *
@ -246,7 +245,7 @@ public class PlotAPI {
public SchematicHandler getSchematicHandler() { public SchematicHandler getSchematicHandler() {
return SchematicHandler.manager; return SchematicHandler.manager;
} }
/** /**
* Use C.[caption] instead * Use C.[caption] instead
* *
@ -258,7 +257,7 @@ public class PlotAPI {
public C[] getCaptions() { public C[] getCaptions() {
return C.values(); return C.values();
} }
/** /**
* Get the plot manager for a world. - Most of these methods can be accessed through the MainUtil * Get the plot manager for a world. - Most of these methods can be accessed through the MainUtil
* *
@ -276,7 +275,7 @@ public class PlotAPI {
} }
return getPlotManager(world.getName()); return getPlotManager(world.getName());
} }
public Set<PlotArea> getPlotAreas(World world) { public Set<PlotArea> getPlotAreas(World world) {
if (world == null) { if (world == null) {
return new HashSet<>(); return new HashSet<>();
@ -308,7 +307,7 @@ public class PlotAPI {
return null; return null;
} }
} }
/** /**
* Get the settings for a world (settings bundled in PlotArea class) - You will need to downcast for the specific * Get the settings for a world (settings bundled in PlotArea class) - You will need to downcast for the specific
* settings a Generator has. e.g. DefaultPlotWorld class implements PlotArea * settings a Generator has. e.g. DefaultPlotWorld class implements PlotArea
@ -327,7 +326,7 @@ public class PlotAPI {
} }
return getWorldSettings(world.getName()); return getWorldSettings(world.getName());
} }
/** /**
* Get the settings for a world (settings bundled in PlotArea class) * Get the settings for a world (settings bundled in PlotArea class)
* *
@ -354,7 +353,7 @@ public class PlotAPI {
return null; return null;
} }
} }
/** /**
* Send a message to a player. * Send a message to a player.
* *
@ -367,7 +366,7 @@ public class PlotAPI {
public void sendMessage(final Player player, final C c) { public void sendMessage(final Player player, final C c) {
MainUtil.sendMessage(BukkitUtil.getPlayer(player), c); MainUtil.sendMessage(BukkitUtil.getPlayer(player), c);
} }
/** /**
* Send a message to a player. - Supports color codes * Send a message to a player. - Supports color codes
* *
@ -379,7 +378,7 @@ public class PlotAPI {
public void sendMessage(final Player player, final String string) { public void sendMessage(final Player player, final String string) {
MainUtil.sendMessage(BukkitUtil.getPlayer(player), string); MainUtil.sendMessage(BukkitUtil.getPlayer(player), string);
} }
/** /**
* Send a message to the console. - Supports color codes * Send a message to the console. - Supports color codes
* *
@ -390,7 +389,7 @@ public class PlotAPI {
public void sendConsoleMessage(final String msg) { public void sendConsoleMessage(final String msg) {
PS.log(msg); PS.log(msg);
} }
/** /**
* Send a message to the console * Send a message to the console
* *
@ -400,9 +399,9 @@ public class PlotAPI {
* @see com.intellectualcrafters.plot.config.C * @see com.intellectualcrafters.plot.config.C
*/ */
public void sendConsoleMessage(final C c) { public void sendConsoleMessage(final C c) {
sendConsoleMessage(c.s()); sendConsoleMessage(c);
} }
/** /**
* Register a flag for use in plots * Register a flag for use in plots
* *
@ -414,7 +413,7 @@ public class PlotAPI {
public void addFlag(final AbstractFlag flag) { public void addFlag(final AbstractFlag flag) {
FlagManager.addFlag(flag); FlagManager.addFlag(flag);
} }
/** /**
* get all the currently registered flags * get all the currently registered flags
* *
@ -426,7 +425,7 @@ public class PlotAPI {
public AbstractFlag[] getFlags() { public AbstractFlag[] getFlags() {
return FlagManager.getFlags().toArray(new AbstractFlag[FlagManager.getFlags().size()]); return FlagManager.getFlags().toArray(new AbstractFlag[FlagManager.getFlags().size()]);
} }
/** /**
* Get a plot based on the ID * Get a plot based on the ID
* *
@ -449,7 +448,7 @@ public class PlotAPI {
} }
return area.getPlot(new PlotId(x, z)); return area.getPlot(new PlotId(x, z));
} }
/** /**
* Get a plot based on the location * Get a plot based on the location
* *
@ -465,7 +464,7 @@ public class PlotAPI {
} }
return BukkitUtil.getLocation(l).getPlot(); return BukkitUtil.getLocation(l).getPlot();
} }
/** /**
* Get a plot based on the player location * Get a plot based on the player location
* *
@ -479,7 +478,7 @@ public class PlotAPI {
public Plot getPlot(final Player player) { public Plot getPlot(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
* *
@ -493,7 +492,7 @@ public class PlotAPI {
public boolean hasPlot(final World world, final Player player) { public boolean hasPlot(final World world, 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;
} }
/** /**
* Get all plots for the player * Get all plots for the player
* *
@ -517,7 +516,7 @@ public class PlotAPI {
} }
return pPlots.toArray(new Plot[pPlots.size()]); return pPlots.toArray(new Plot[pPlots.size()]);
} }
/** /**
* Get all plots for the world * Get all plots for the world
* *
@ -536,7 +535,7 @@ public class PlotAPI {
Collection<Plot> plots = PS.get().getPlots(world.getName()); Collection<Plot> plots = PS.get().getPlots(world.getName());
return plots.toArray(new Plot[plots.size()]); return plots.toArray(new Plot[plots.size()]);
} }
/** /**
* Get all plot worlds * Get all plot worlds
* *
@ -548,7 +547,7 @@ public class PlotAPI {
Set<String> plotWorldStrings = PS.get().getPlotWorldStrings(); Set<String> plotWorldStrings = PS.get().getPlotWorldStrings();
return plotWorldStrings.toArray(new String[plotWorldStrings.size()]); return plotWorldStrings.toArray(new String[plotWorldStrings.size()]);
} }
/** /**
* Get if plot world * Get if plot world
* *
@ -562,7 +561,7 @@ public class PlotAPI {
public boolean isPlotWorld(final World world) { public boolean isPlotWorld(final World world) {
return PS.get().hasPlotArea(world.getName()); return PS.get().hasPlotArea(world.getName());
} }
/** /**
* Get plot locations * Get plot locations
* *
@ -578,7 +577,7 @@ public class PlotAPI {
public Location[] getLocations(final Plot p) { public Location[] getLocations(final Plot p) {
return new Location[] { BukkitUtil.getLocation(p.getBottom()), BukkitUtil.getLocation(p.getTop()), BukkitUtil.getLocation(p.getHome()) }; return new Location[] { BukkitUtil.getLocation(p.getBottom()), BukkitUtil.getLocation(p.getTop()), BukkitUtil.getLocation(p.getHome()) };
} }
/** /**
* Get home location * Get home location
* *
@ -591,7 +590,7 @@ public class PlotAPI {
public Location getHomeLocation(final Plot p) { public Location getHomeLocation(final Plot p) {
return BukkitUtil.getLocation(p.getHome()); return BukkitUtil.getLocation(p.getHome());
} }
/** /**
* Get Bottom Location (min, min, min) * Get Bottom Location (min, min, min)
* *
@ -607,14 +606,14 @@ public class PlotAPI {
public Location getBottomLocation(final Plot p) { public Location getBottomLocation(final Plot p) {
return BukkitUtil.getLocation(p.getBottom()); return BukkitUtil.getLocation(p.getBottom());
} }
/** /**
* Get Top Location (max, max, max) * Get Top Location (max, max, max)
* *
* @param p Plot that you want to get the location for * @param p Plot that you want to get the location for
* *
* @return plot top location * @return plot top location
* *
* @deprecated As merged plots may not have a rectangular shape * @deprecated As merged plots may not have a rectangular shape
* *
* @see Plot * @see Plot
@ -623,7 +622,7 @@ public class PlotAPI {
public Location getTopLocation(final Plot p) { public Location getTopLocation(final Plot p) {
return BukkitUtil.getLocation(p.getTop()); return BukkitUtil.getLocation(p.getTop());
} }
/** /**
* Check whether or not a player is in a plot * Check whether or not a player is in a plot
* *
@ -635,7 +634,7 @@ public class PlotAPI {
public boolean isInPlot(final Player player) { public boolean isInPlot(final Player player) {
return getPlot(player) != null; return getPlot(player) != null;
} }
/** /**
* Register a subcommand * Register a subcommand
* *
@ -650,7 +649,7 @@ public class PlotAPI {
MainCommand.getInstance().createCommand(c); MainCommand.getInstance().createCommand(c);
} }
} }
/** /**
* Get the PlotSquared class * Get the PlotSquared class
* *
@ -661,7 +660,7 @@ public class PlotAPI {
public PS getPlotSquared() { public PS getPlotSquared() {
return PS.get(); return PS.get();
} }
/** /**
* Get the player plot count * Get the player plot count
* *
@ -677,7 +676,7 @@ public class PlotAPI {
} }
return BukkitUtil.getPlayer(player).getPlotCount(world.getName()); return BukkitUtil.getPlayer(player).getPlotCount(world.getName());
} }
/** /**
* Get a collection containing the players plots * Get a collection containing the players plots
* *
@ -696,7 +695,7 @@ public class PlotAPI {
} }
return BukkitUtil.getPlayer(player).getPlots(world.getName()); return BukkitUtil.getPlayer(player).getPlots(world.getName());
} }
/** /**
* Get the numbers of plots, which the player is able to build in * Get the numbers of plots, which the player is able to build in
* *
@ -709,7 +708,7 @@ public class PlotAPI {
final PlotPlayer pp = BukkitUtil.getPlayer(player); final PlotPlayer pp = BukkitUtil.getPlayer(player);
return pp.getAllowedPlots(); return pp.getAllowedPlots();
} }
/** /**
* Get the PlotPlayer for a player<br> * Get the PlotPlayer for a player<br>
* - The PlotPlayer is usually cached and will provide useful functions relating to players * - The PlotPlayer is usually cached and will provide useful functions relating to players
@ -722,7 +721,7 @@ public class PlotAPI {
public PlotPlayer wrapPlayer(final Player player) { public PlotPlayer wrapPlayer(final Player player) {
return PlotPlayer.wrap(player); return PlotPlayer.wrap(player);
} }
/** /**
* Get the PlotPlayer for a UUID (Please note that PlotSquared can be configured to provide different UUIDs than bukkit) * Get the PlotPlayer for a UUID (Please note that PlotSquared can be configured to provide different UUIDs than bukkit)
* *
@ -734,7 +733,7 @@ public class PlotAPI {
public PlotPlayer wrapPlayer(final UUID uuid) { public PlotPlayer wrapPlayer(final UUID uuid) {
return PlotPlayer.wrap(uuid); return PlotPlayer.wrap(uuid);
} }
/** /**
* Get the PlotPlayer for a username * Get the PlotPlayer for a username
* *
@ -746,7 +745,7 @@ public class PlotAPI {
public PlotPlayer wrapPlayer(final String player) { public PlotPlayer wrapPlayer(final String player) {
return PlotPlayer.wrap(player); return PlotPlayer.wrap(player);
} }
/** /**
* Get the PlotPlayer for an offline player<br> * Get the PlotPlayer for an offline player<br>
* Note that this will work if the player is offline, however not all functionality will work * Note that this will work if the player is offline, however not all functionality will work

View File

@ -87,7 +87,6 @@ import org.bukkit.generator.ChunkGenerator;
import org.bukkit.metadata.MetadataValue; import org.bukkit.metadata.MetadataValue;
import org.bukkit.plugin.Plugin; import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
@ -97,12 +96,12 @@ import java.util.List;
import java.util.UUID; import java.util.UUID;
public class BukkitMain extends JavaPlugin implements Listener, IPlotMain { public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
public static BukkitMain THIS; public static BukkitMain THIS;
public static WorldEditPlugin worldEdit; public static WorldEditPlugin worldEdit;
private int[] version; private int[] version;
@Override @Override
public int[] getServerVersion() { public int[] getServerVersion() {
if (version == null) { if (version == null) {
@ -123,20 +122,20 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
} }
return version; return version;
} }
@Override @Override
public void onEnable() { public void onEnable() {
THIS = this; THIS = this;
new PS(this, "Bukkit"); new PS(this, "Bukkit");
} }
@Override @Override
public void onDisable() { public void onDisable() {
PS.get().disable(); PS.get().disable();
Bukkit.getScheduler().cancelTasks(this); Bukkit.getScheduler().cancelTasks(this);
THIS = null; THIS = null;
} }
@Override @Override
public void log(String message) { public void log(String message) {
if ((THIS != null) && (Bukkit.getServer().getConsoleSender() != null)) { if ((THIS != null) && (Bukkit.getServer().getConsoleSender() != null)) {
@ -151,20 +150,20 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
} }
System.out.println(ConsoleColors.fromString(message)); System.out.println(ConsoleColors.fromString(message));
} }
@Override @Override
public void disable() { public void disable() {
if (THIS != null) { if (THIS != null) {
onDisable(); onDisable();
} }
} }
@Override @Override
public int[] getPluginVersion() { public int[] getPluginVersion() {
final String[] split = getDescription().getVersion().split("\\."); final String[] split = getDescription().getVersion().split("\\.");
return new int[] { Integer.parseInt(split[0]), Integer.parseInt(split[1]), Integer.parseInt(split[2]) }; return new int[] { Integer.parseInt(split[0]), Integer.parseInt(split[1]), Integer.parseInt(split[2]) };
} }
@Override @Override
public void registerCommands() { public void registerCommands() {
final BukkitCommand bcmd = new BukkitCommand(); final BukkitCommand bcmd = new BukkitCommand();
@ -174,25 +173,25 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
plotCommand.setTabCompleter(bcmd); plotCommand.setTabCompleter(bcmd);
MainCommand.getInstance().addCommand(new DebugUUID()); MainCommand.getInstance().addCommand(new DebugUUID());
} }
@Override @Override
public File getDirectory() { public File getDirectory() {
return getDataFolder(); return getDataFolder();
} }
@Override @Override
public File getWorldContainer() { public File getWorldContainer() {
return Bukkit.getWorldContainer(); return Bukkit.getWorldContainer();
} }
@Override @Override
public TaskManager getTaskManager() { public TaskManager getTaskManager() {
return new BukkitTaskManager(); return new BukkitTaskManager();
} }
@Override @Override
public void runEntityTask() { public void runEntityTask() {
log(C.PREFIX.s() + "KillAllEntities started."); log(C.PREFIX + "KillAllEntities started.");
TaskManager.runTaskRepeat(new Runnable() { TaskManager.runTaskRepeat(new Runnable() {
@Override @Override
public void run() { public void run() {
@ -335,7 +334,7 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
} }
}, 20); }, 20);
} }
@Override @Override
final public ChunkGenerator getDefaultWorldGenerator(final String world, final String id) { final public ChunkGenerator getDefaultWorldGenerator(final String world, final String id) {
final HybridGen result = new HybridGen(); final HybridGen result = new HybridGen();
@ -344,7 +343,7 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
} }
return (ChunkGenerator) result.specify(); return (ChunkGenerator) result.specify();
} }
@Override @Override
public void registerPlayerEvents() { public void registerPlayerEvents() {
getServer().getPluginManager().registerEvents(new PlayerEvents(), this); getServer().getPluginManager().registerEvents(new PlayerEvents(), this);
@ -355,23 +354,23 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
getServer().getPluginManager().registerEvents(new PlayerEvents_1_8_3(), this); getServer().getPluginManager().registerEvents(new PlayerEvents_1_8_3(), this);
} }
} }
@Override @Override
public void registerInventoryEvents() { public void registerInventoryEvents() {
// Part of PlayerEvents - can be moved if necessary // Part of PlayerEvents - can be moved if necessary
} }
@Override @Override
public void registerPlotPlusEvents() { public void registerPlotPlusEvents() {
PlotPlusListener.startRunnable(this); PlotPlusListener.startRunnable(this);
getServer().getPluginManager().registerEvents(new PlotPlusListener(), this); getServer().getPluginManager().registerEvents(new PlotPlusListener(), this);
} }
@Override @Override
public void registerForceFieldEvents() { public void registerForceFieldEvents() {
getServer().getPluginManager().registerEvents(new ForceFieldListener(), this); getServer().getPluginManager().registerEvents(new ForceFieldListener(), this);
} }
@Override @Override
public boolean initWorldEdit() { public boolean initWorldEdit() {
if (getServer().getPluginManager().getPlugin("WorldEdit") != null) { if (getServer().getPluginManager().getPlugin("WorldEdit") != null) {
@ -388,7 +387,7 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
} }
return false; return false;
} }
@Override @Override
public EconHandler getEconomyHandler() { public EconHandler getEconomyHandler() {
try { try {
@ -400,7 +399,7 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
} }
return null; return null;
} }
@Override @Override
public PlotQueue initPlotQueue() { public PlotQueue initPlotQueue() {
try { try {
@ -439,12 +438,12 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
return new SlowQueue(); return new SlowQueue();
} }
} }
@Override @Override
public WorldUtil initWorldUtil() { public WorldUtil initWorldUtil() {
return new BukkitUtil(); return new BukkitUtil();
} }
@Override @Override
public boolean initPlotMeConverter() { public boolean initPlotMeConverter() {
TaskManager.runTaskLaterAsync(new Runnable() { TaskManager.runTaskLaterAsync(new Runnable() {
@ -463,7 +462,7 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
}, 20); }, 20);
return (Bukkit.getPluginManager().getPlugin("PlotMe") != null) || (Bukkit.getPluginManager().getPlugin("AthionPlots") != null); return (Bukkit.getPluginManager().getPlugin("PlotMe") != null) || (Bukkit.getPluginManager().getPlugin("AthionPlots") != null);
} }
@Override @Override
public GeneratorWrapper<?> getGenerator(final String world, final String name) { public GeneratorWrapper<?> getGenerator(final String world, final String name) {
if (name == null) { if (name == null) {
@ -480,17 +479,17 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
return new BukkitPlotGenerator(new HybridGen()); return new BukkitPlotGenerator(new HybridGen());
} }
} }
@Override @Override
public HybridUtils initHybridUtils() { public HybridUtils initHybridUtils() {
return new BukkitHybridUtils(); return new BukkitHybridUtils();
} }
@Override @Override
public SetupUtils initSetupUtils() { public SetupUtils initSetupUtils() {
return new BukkitSetupUtils(); return new BukkitSetupUtils();
} }
@Override @Override
public UUIDHandlerImplementation initUUIDHandler() { public UUIDHandlerImplementation initUUIDHandler() {
final boolean checkVersion = PS.get().checkVersion(getServerVersion(), 1, 7, 6); final boolean checkVersion = PS.get().checkVersion(getServerVersion(), 1, 7, 6);
@ -514,7 +513,7 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
Settings.OFFLINE_MODE = true; Settings.OFFLINE_MODE = true;
} }
if (!checkVersion) { if (!checkVersion) {
log(C.PREFIX.s() + " &c[WARN] Titles are disabled - please update your version of Bukkit to support this feature."); log(C.PREFIX + " &c[WARN] Titles are disabled - please update your version of Bukkit to support this feature.");
Settings.TITLES = false; Settings.TITLES = false;
FlagManager.removeFlag(FlagManager.getFlag("titles")); FlagManager.removeFlag(FlagManager.getFlag("titles"));
} else { } else {
@ -524,59 +523,59 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
} }
} }
if (Settings.OFFLINE_MODE) { if (Settings.OFFLINE_MODE) {
log(C.PREFIX.s() + " &6PlotSquared is using Offline Mode UUIDs either because of user preference, or because you are using an old version of Bukkit"); log(C.PREFIX + " &6PlotSquared is using Offline Mode UUIDs either because of user preference, or because you are using an old version of Bukkit");
} else { } else {
log(C.PREFIX.s() + " &6PlotSquared is using online UUIDs"); log(C.PREFIX + " &6PlotSquared is using online UUIDs");
} }
return Settings.USE_SQLUUIDHANDLER ? new SQLUUIDHandler(wrapper) : new FileUUIDHandler(wrapper); return Settings.USE_SQLUUIDHANDLER ? new SQLUUIDHandler(wrapper) : new FileUUIDHandler(wrapper);
} }
@Override @Override
public ChunkManager initChunkManager() { public ChunkManager initChunkManager() {
return new BukkitChunkManager(); return new BukkitChunkManager();
} }
@Override @Override
public EventUtil initEventUtil() { public EventUtil initEventUtil() {
return new BukkitEventUtil(); return new BukkitEventUtil();
} }
@Override @Override
public void unregister(final PlotPlayer player) { public void unregister(final PlotPlayer player) {
BukkitUtil.removePlayer(player.getName()); BukkitUtil.removePlayer(player.getName());
} }
@Override @Override
public void registerChunkProcessor() { public void registerChunkProcessor() {
getServer().getPluginManager().registerEvents(new ChunkListener(), this); getServer().getPluginManager().registerEvents(new ChunkListener(), this);
} }
@Override @Override
public void registerWorldEvents() { public void registerWorldEvents() {
getServer().getPluginManager().registerEvents(new WorldEvents(), this); getServer().getPluginManager().registerEvents(new WorldEvents(), this);
} }
@Override @Override
public InventoryUtil initInventoryUtil() { public InventoryUtil initInventoryUtil() {
return new BukkitInventoryUtil(); return new BukkitInventoryUtil();
} }
@Override @Override
public String getServerName() { public String getServerName() {
return Bukkit.getServerName(); return Bukkit.getServerName();
} }
@Override @Override
public void startMetrics() { public void startMetrics() {
try { try {
Metrics metrics = new Metrics(this); Metrics metrics = new Metrics(this);
metrics.start(); metrics.start();
log(C.PREFIX.s() + "&6Metrics enabled."); log(C.PREFIX + "&6Metrics enabled.");
} catch (IOException e) { } catch (IOException e) {
log(C.PREFIX.s() + "&cFailed to load up metrics."); log(C.PREFIX + "&cFailed to load up metrics.");
} }
} }
@Override @Override
public void setGenerator(final String worldname) { public void setGenerator(final String worldname) {
World world = BukkitUtil.getWorld(worldname); World world = BukkitUtil.getWorld(worldname);
@ -615,18 +614,18 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
PS.get().loadWorld(worldname, null); PS.get().loadWorld(worldname, null);
} }
} }
@Override @Override
public SchematicHandler initSchematicHandler() { public SchematicHandler initSchematicHandler() {
return new BukkitSchematicHandler(); return new BukkitSchematicHandler();
} }
@Override @Override
public AbstractTitle initTitleManager() { public AbstractTitle initTitleManager() {
// Already initialized in UUID handler // Already initialized in UUID handler
return AbstractTitle.TITLE_CLASS; return AbstractTitle.TITLE_CLASS;
} }
@Override @Override
public PlotPlayer wrapPlayer(final Object obj) { public PlotPlayer wrapPlayer(final Object obj) {
if (obj instanceof Player) { if (obj instanceof Player) {
@ -640,13 +639,13 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
} }
return null; return null;
} }
@Override @Override
public String getNMSPackage() { public String getNMSPackage() {
String name = Bukkit.getServer().getClass().getPackage().getName(); String name = Bukkit.getServer().getClass().getPackage().getName();
return name.substring(name.lastIndexOf('.') + 1); return name.substring(name.lastIndexOf('.') + 1);
} }
@Override @Override
public ChatManager<?> initChatManager() { public ChatManager<?> initChatManager() {
if (Settings.FANCY_CHAT) { if (Settings.FANCY_CHAT) {
@ -655,12 +654,12 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
return new BukkitPlainChatManager(); return new BukkitPlainChatManager();
} }
} }
@Override @Override
public GeneratorWrapper<?> wrapPlotGenerator(IndependentPlotGenerator generator) { public GeneratorWrapper<?> wrapPlotGenerator(IndependentPlotGenerator generator) {
return new BukkitPlotGenerator(generator); return new BukkitPlotGenerator(generator);
} }
@Override @Override
public List<String> getPluginIds() { public List<String> getPluginIds() {
ArrayList<String> names = new ArrayList<>(); ArrayList<String> names = new ArrayList<>();

View File

@ -42,7 +42,6 @@ import com.plotsquared.bukkit.uuid.LowerOfflineUUIDWrapper;
import com.plotsquared.bukkit.uuid.OfflineUUIDWrapper; import com.plotsquared.bukkit.uuid.OfflineUUIDWrapper;
import com.plotsquared.general.commands.Argument; import com.plotsquared.general.commands.Argument;
import com.plotsquared.general.commands.CommandDeclaration; import com.plotsquared.general.commands.CommandDeclaration;
import java.io.File; import java.io.File;
import java.io.FilenameFilter; import java.io.FilenameFilter;
import java.io.IOException; import java.io.IOException;
@ -63,16 +62,16 @@ usage = "/plot uuidconvert <lower|offline|online>",
requiredType = RequiredType.CONSOLE, requiredType = RequiredType.CONSOLE,
category = CommandCategory.DEBUG) category = CommandCategory.DEBUG)
public class DebugUUID extends SubCommand { public class DebugUUID extends SubCommand {
public DebugUUID() { public DebugUUID() {
requiredArguments = new Argument[] { Argument.String }; requiredArguments = new Argument[] { Argument.String };
} }
@Override @Override
public boolean onCommand(final PlotPlayer player, final String[] args) { public boolean onCommand(final PlotPlayer player, final String[] args) {
final UUIDWrapper currentUUIDWrapper = UUIDHandler.getUUIDWrapper(); final UUIDWrapper currentUUIDWrapper = UUIDHandler.getUUIDWrapper();
final UUIDWrapper newWrapper; final UUIDWrapper newWrapper;
switch (args[0].toLowerCase()) { switch (args[0].toLowerCase()) {
case "lower": case "lower":
newWrapper = new LowerOfflineUUIDWrapper(); newWrapper = new LowerOfflineUUIDWrapper();
@ -104,7 +103,7 @@ public class DebugUUID extends SubCommand {
MainUtil.sendMessage(player, "&7Retype the command with the override parameter when ready :)"); MainUtil.sendMessage(player, "&7Retype the command with the override parameter when ready :)");
return false; return false;
} }
if (currentUUIDWrapper.getClass().getCanonicalName().equals(newWrapper.getClass().getCanonicalName())) { if (currentUUIDWrapper.getClass().getCanonicalName().equals(newWrapper.getClass().getCanonicalName())) {
MainUtil.sendMessage(player, "&cUUID mode already in use!"); MainUtil.sendMessage(player, "&cUUID mode already in use!");
return false; return false;
@ -114,14 +113,14 @@ public class DebugUUID extends SubCommand {
for (Entry<String, PlotPlayer> entry : UUIDHandler.getPlayers().entrySet()) { for (Entry<String, PlotPlayer> entry : UUIDHandler.getPlayers().entrySet()) {
entry.getValue().kick("PlotSquared UUID conversion has been initiated. You may reconnect when finished."); entry.getValue().kick("PlotSquared UUID conversion has been initiated. You may reconnect when finished.");
} }
MainUtil.sendMessage(player, "&7 - Initializing map"); MainUtil.sendMessage(player, "&7 - Initializing map");
final HashMap<UUID, UUID> uCMap = new HashMap<>(); final HashMap<UUID, UUID> uCMap = new HashMap<>();
final HashMap<UUID, UUID> uCReverse = new HashMap<>(); final HashMap<UUID, UUID> uCReverse = new HashMap<>();
MainUtil.sendMessage(player, "&7 - Collecting playerdata"); MainUtil.sendMessage(player, "&7 - Collecting playerdata");
final HashSet<String> worlds = new HashSet<>(); final HashSet<String> worlds = new HashSet<>();
worlds.add(WorldUtil.IMP.getMainWorld()); worlds.add(WorldUtil.IMP.getMainWorld());
worlds.add("world"); worlds.add("world");
@ -142,7 +141,7 @@ public class DebugUUID extends SubCommand {
final UUID uuid = UUID.fromString(s); final UUID uuid = UUID.fromString(s);
uuids.add(uuid); uuids.add(uuid);
} catch (final Exception e) { } catch (final Exception e) {
MainUtil.sendMessage(player, C.PREFIX.s() + "Invalid playerdata: " + current); MainUtil.sendMessage(player, C.PREFIX + "Invalid playerdata: " + current);
} }
} }
final File playersFolder = new File(worldname + File.separator + "players"); final File playersFolder = new File(worldname + File.separator + "players");
@ -158,7 +157,7 @@ public class DebugUUID extends SubCommand {
} }
} }
} }
MainUtil.sendMessage(player, "&7 - Populating map"); MainUtil.sendMessage(player, "&7 - Populating map");
UUID uuid2; UUID uuid2;
final UUIDWrapper wrapper = new DefaultUUIDWrapper(); final UUIDWrapper wrapper = new DefaultUUIDWrapper();
@ -172,7 +171,7 @@ public class DebugUUID extends SubCommand {
uCReverse.put(uuid2, uuid); uCReverse.put(uuid2, uuid);
} }
} catch (final Throwable e) { } catch (final Throwable e) {
MainUtil.sendMessage(player, C.PREFIX.s() + "&6Invalid playerdata: " + uuid.toString() + ".dat"); MainUtil.sendMessage(player, C.PREFIX + "&6Invalid playerdata: " + uuid.toString() + ".dat");
} }
} }
for (final String name : names) { for (final String name : names) {
@ -204,7 +203,7 @@ public class DebugUUID extends SubCommand {
MainUtil.sendMessage(player, "&a - Successfully repopulated"); MainUtil.sendMessage(player, "&a - Successfully repopulated");
} }
} }
MainUtil.sendMessage(player, "&7 - Replacing cache"); MainUtil.sendMessage(player, "&7 - Replacing cache");
TaskManager.runTaskAsync(new Runnable() { TaskManager.runTaskAsync(new Runnable() {
@Override @Override
@ -215,9 +214,9 @@ public class DebugUUID extends SubCommand {
UUIDHandler.add(new StringWrapper(name), entry.getValue()); UUIDHandler.add(new StringWrapper(name), entry.getValue());
} }
} }
MainUtil.sendMessage(player, "&7 - Scanning for applicable files (uuids.txt)"); MainUtil.sendMessage(player, "&7 - Scanning for applicable files (uuids.txt)");
final File file = new File(PS.get().IMP.getDirectory(), "uuids.txt"); final File file = new File(PS.get().IMP.getDirectory(), "uuids.txt");
if (file.exists()) { if (file.exists()) {
try { try {
@ -250,12 +249,12 @@ public class DebugUUID extends SubCommand {
e.printStackTrace(); e.printStackTrace();
} }
} }
MainUtil.sendMessage(player, "&7 - Replacing wrapper"); MainUtil.sendMessage(player, "&7 - Replacing wrapper");
UUIDHandler.setUUIDWrapper(newWrapper); UUIDHandler.setUUIDWrapper(newWrapper);
MainUtil.sendMessage(player, "&7 - Updating plot objects"); MainUtil.sendMessage(player, "&7 - Updating plot objects");
for (final Plot plot : PS.get().getPlots()) { for (final Plot plot : PS.get().getPlots()) {
final UUID value = uCMap.get(plot.owner); final UUID value = uCMap.get(plot.owner);
if (value != null) { if (value != null) {
@ -265,13 +264,13 @@ public class DebugUUID extends SubCommand {
plot.getMembers().clear(); plot.getMembers().clear();
plot.getDenied().clear(); plot.getDenied().clear();
} }
MainUtil.sendMessage(player, "&7 - Deleting database"); MainUtil.sendMessage(player, "&7 - Deleting database");
final AbstractDB database = DBFunc.dbManager; final AbstractDB database = DBFunc.dbManager;
final boolean result = database.deleteTables(); final boolean result = database.deleteTables();
MainUtil.sendMessage(player, "&7 - Creating tables"); MainUtil.sendMessage(player, "&7 - Creating tables");
try { try {
database.createTables(); database.createTables();
if (!result) { if (!result) {
@ -294,7 +293,7 @@ public class DebugUUID extends SubCommand {
e.printStackTrace(); e.printStackTrace();
return; return;
} }
if (newWrapper instanceof OfflineUUIDWrapper) { if (newWrapper instanceof OfflineUUIDWrapper) {
PS.get().config.set("UUID.force-lowercase", false); PS.get().config.set("UUID.force-lowercase", false);
PS.get().config.set("UUID.offline", true); PS.get().config.set("UUID.offline", true);
@ -307,9 +306,9 @@ public class DebugUUID extends SubCommand {
} catch (IOException e) { } catch (IOException e) {
MainUtil.sendMessage(player, "Could not save configuration. It will need to be manuall set!"); MainUtil.sendMessage(player, "Could not save configuration. It will need to be manuall set!");
} }
MainUtil.sendMessage(player, "&7 - Populating tables"); MainUtil.sendMessage(player, "&7 - Populating tables");
TaskManager.runTaskAsync(new Runnable() { TaskManager.runTaskAsync(new Runnable() {
@Override @Override
public void run() { public void run() {
@ -322,7 +321,7 @@ public class DebugUUID extends SubCommand {
}); });
} }
}); });
MainUtil.sendMessage(player, "&aIt is now safe for players to join"); MainUtil.sendMessage(player, "&aIt is now safe for players to join");
MainUtil.sendMessage(player, "&cConversion is still in progress, you will be notified when it is complete"); MainUtil.sendMessage(player, "&cConversion is still in progress, you will be notified when it is complete");
} }

View File

@ -10,12 +10,15 @@ import com.intellectualcrafters.plot.database.DBFunc;
import com.intellectualcrafters.plot.object.OfflinePlotPlayer; import com.intellectualcrafters.plot.object.OfflinePlotPlayer;
import com.intellectualcrafters.plot.object.RunnableVal; import com.intellectualcrafters.plot.object.RunnableVal;
import com.intellectualcrafters.plot.object.StringWrapper; import com.intellectualcrafters.plot.object.StringWrapper;
import com.intellectualcrafters.plot.util.*; import com.intellectualcrafters.plot.util.ExpireManager;
import com.intellectualcrafters.plot.util.StringMan;
import com.intellectualcrafters.plot.util.TaskManager;
import com.intellectualcrafters.plot.util.UUIDHandler;
import com.intellectualcrafters.plot.util.UUIDHandlerImplementation;
import com.intellectualcrafters.plot.uuid.UUIDWrapper; import com.intellectualcrafters.plot.uuid.UUIDWrapper;
import com.plotsquared.bukkit.util.NbtFactory; import com.plotsquared.bukkit.util.NbtFactory;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.World; import org.bukkit.World;
import java.io.File; import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.FilenameFilter; import java.io.FilenameFilter;
@ -28,16 +31,16 @@ import java.util.List;
import java.util.UUID; import java.util.UUID;
public class FileUUIDHandler extends UUIDHandlerImplementation { public class FileUUIDHandler extends UUIDHandlerImplementation {
public FileUUIDHandler(final UUIDWrapper wrapper) { public FileUUIDHandler(final UUIDWrapper wrapper) {
super(wrapper); super(wrapper);
} }
@Override @Override
public boolean startCaching(final Runnable whenDone) { public boolean startCaching(final Runnable whenDone) {
return super.startCaching(whenDone) && cache(whenDone); return super.startCaching(whenDone) && cache(whenDone);
} }
public boolean cache(final Runnable whenDone) { public boolean cache(final Runnable whenDone) {
final File container = Bukkit.getWorldContainer(); final File container = Bukkit.getWorldContainer();
final List<World> worlds = Bukkit.getWorlds(); final List<World> worlds = Bukkit.getWorlds();
@ -50,7 +53,7 @@ public class FileUUIDHandler extends UUIDHandlerImplementation {
TaskManager.runTaskAsync(new Runnable() { TaskManager.runTaskAsync(new Runnable() {
@Override @Override
public void run() { public void run() {
PS.debug(C.PREFIX.s() + "&6Starting player data caching for: " + world); PS.debug(C.PREFIX + "&6Starting player data caching for: " + world);
final File uuidfile = new File(PS.get().IMP.getDirectory(), "uuids.txt"); final File uuidfile = new File(PS.get().IMP.getDirectory(), "uuids.txt");
if (uuidfile.exists()) { if (uuidfile.exists()) {
try { try {
@ -112,7 +115,7 @@ public class FileUUIDHandler extends UUIDHandlerImplementation {
} }
} catch (final Exception e) { } catch (final Exception e) {
e.printStackTrace(); e.printStackTrace();
PS.debug(C.PREFIX.s() + "Invalid playerdata: " + current); PS.debug(C.PREFIX + "Invalid playerdata: " + current);
} }
} }
} }
@ -150,7 +153,7 @@ public class FileUUIDHandler extends UUIDHandlerImplementation {
final UUID uuid = UUID.fromString(s); final UUID uuid = UUID.fromString(s);
uuids.add(uuid); uuids.add(uuid);
} catch (final Exception e) { } catch (final Exception e) {
PS.debug(C.PREFIX.s() + "Invalid playerdata: " + current); PS.debug(C.PREFIX + "Invalid playerdata: " + current);
} }
} }
break; break;
@ -195,7 +198,7 @@ public class FileUUIDHandler extends UUIDHandlerImplementation {
} }
toAdd.put(new StringWrapper(name), uuid); toAdd.put(new StringWrapper(name), uuid);
} catch (final Throwable e) { } catch (final Throwable e) {
PS.debug(C.PREFIX.s() + "&6Invalid playerdata: " + uuid.toString() + ".dat"); PS.debug(C.PREFIX + "&6Invalid playerdata: " + uuid.toString() + ".dat");
} }
} }
for (final String name : names) { for (final String name : names) {
@ -226,7 +229,7 @@ public class FileUUIDHandler extends UUIDHandlerImplementation {
}); });
return true; return true;
} }
@Override @Override
public void fetchUUID(final String name, final RunnableVal<UUID> ifFetch) { public void fetchUUID(final String name, final RunnableVal<UUID> ifFetch) {
TaskManager.runTaskAsync(new Runnable() { TaskManager.runTaskAsync(new Runnable() {

View File

@ -30,7 +30,7 @@ import java.util.HashMap;
import java.util.UUID; import java.util.UUID;
public class SQLUUIDHandler extends UUIDHandlerImplementation { public class SQLUUIDHandler extends UUIDHandlerImplementation {
final String PROFILE_URL = "https://sessionserver.mojang.com/session/minecraft/profile/"; final String PROFILE_URL = "https://sessionserver.mojang.com/session/minecraft/profile/";
final int MAX_REQUESTS = 500; final int MAX_REQUESTS = 500;
final int INTERVAL = 12000; final int INTERVAL = 12000;
@ -56,13 +56,13 @@ public class SQLUUIDHandler extends UUIDHandlerImplementation {
} }
startCaching(null); startCaching(null);
} }
private Connection getConnection() { private Connection getConnection() {
synchronized (_sqLite) { synchronized (_sqLite) {
return _sqLite.getConnection(); return _sqLite.getConnection();
} }
} }
@Override @Override
public boolean startCaching(final Runnable whenDone) { public boolean startCaching(final Runnable whenDone) {
if (!super.startCaching(whenDone)) { if (!super.startCaching(whenDone)) {
@ -192,10 +192,10 @@ public class SQLUUIDHandler extends UUIDHandlerImplementation {
}); });
return true; return true;
} }
@Override @Override
public void fetchUUID(final String name, final RunnableVal<UUID> ifFetch) { public void fetchUUID(final String name, final RunnableVal<UUID> ifFetch) {
PS.debug(C.PREFIX.s() + "UUID for '" + name + "' was null. We'll cache this from the mojang servers!"); PS.debug(C.PREFIX + "UUID for '" + name + "' was null. We'll cache this from the mojang servers!");
if (ifFetch == null) { if (ifFetch == null) {
return; return;
} }
@ -227,7 +227,7 @@ public class SQLUUIDHandler extends UUIDHandlerImplementation {
} }
}); });
} }
@Override @Override
public void handleShutdown() { public void handleShutdown() {
super.handleShutdown(); super.handleShutdown();
@ -237,7 +237,7 @@ public class SQLUUIDHandler extends UUIDHandlerImplementation {
throw new SQLUUIDHandlerException("Couldn't close database connection", e); throw new SQLUUIDHandlerException("Couldn't close database connection", e);
} }
} }
@Override @Override
public boolean add(final StringWrapper name, final UUID uuid) { public boolean add(final StringWrapper name, final UUID uuid) {
// Ignoring duplicates // Ignoring duplicates
@ -250,7 +250,7 @@ public class SQLUUIDHandler extends UUIDHandlerImplementation {
statement.setString(1, uuid.toString()); statement.setString(1, uuid.toString());
statement.setString(2, name.toString()); statement.setString(2, name.toString());
statement.execute(); statement.execute();
PS.debug(C.PREFIX.s() + "&cAdded '&6" + uuid + "&c' - '&6" + name + "&c'"); PS.debug(C.PREFIX + "&cAdded '&6" + uuid + "&c' - '&6" + name + "&c'");
} catch (final SQLException e) { } catch (final SQLException e) {
e.printStackTrace(); e.printStackTrace();
} }
@ -260,7 +260,7 @@ public class SQLUUIDHandler extends UUIDHandlerImplementation {
} }
return false; return false;
} }
/** /**
* This is useful for name changes * This is useful for name changes
*/ */
@ -275,7 +275,7 @@ public class SQLUUIDHandler extends UUIDHandlerImplementation {
statement.setString(1, name.value); statement.setString(1, name.value);
statement.setString(2, uuid.toString()); statement.setString(2, uuid.toString());
statement.execute(); statement.execute();
PS.debug(C.PREFIX.s() + "Name change for '" + uuid + "' to '" + name.value + "'"); PS.debug(C.PREFIX + "Name change for '" + uuid + "' to '" + name.value + "'");
} catch (final SQLException e) { } catch (final SQLException e) {
e.printStackTrace(); e.printStackTrace();
} }

View File

@ -54,7 +54,6 @@ import com.intellectualcrafters.plot.util.WorldUtil;
import com.intellectualcrafters.plot.util.area.QuadMap; import com.intellectualcrafters.plot.util.area.QuadMap;
import com.plotsquared.listener.WESubscriber; import com.plotsquared.listener.WESubscriber;
import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.WorldEdit;
import java.io.File; import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.FileOutputStream; import java.io.FileOutputStream;
@ -165,7 +164,7 @@ public class PS {
} }
TASK = IMP.getTaskManager(); TASK = IMP.getTaskManager();
if (!C.ENABLED.s().isEmpty()) { if (!C.ENABLED.s().isEmpty()) {
log(C.ENABLED.s()); log(C.ENABLED);
} }
setupConfigs(); setupConfigs();
translationFile = new File(IMP.getDirectory() + File.separator + "translations" + File.separator + "PlotSquared.use_THIS.yml"); translationFile = new File(IMP.getDirectory() + File.separator + "translations" + File.separator + "PlotSquared.use_THIS.yml");
@ -1370,10 +1369,10 @@ public class PS {
// Conventional plot generator // Conventional plot generator
PlotArea plotArea = pg.getNewPlotArea(world, null, null, null); PlotArea plotArea = pg.getNewPlotArea(world, null, null, null);
PlotManager plotManager = pg.getNewPlotManager(); PlotManager plotManager = pg.getNewPlotManager();
log(C.PREFIX.s() + "&aDetected world load for '" + world + "'"); log(C.PREFIX + "&aDetected world load for '" + world + "'");
log(C.PREFIX.s() + "&3 - generator: &7" + baseGenerator + ">" + pg); log(C.PREFIX + "&3 - generator: &7" + baseGenerator + ">" + pg);
log(C.PREFIX.s() + "&3 - plotworld: &7" + plotArea.getClass().getName()); log(C.PREFIX + "&3 - plotworld: &7" + plotArea.getClass().getName());
log(C.PREFIX.s() + "&3 - manager: &7" + plotManager.getClass().getName()); log(C.PREFIX + "&3 - manager: &7" + plotManager.getClass().getName());
if (!config.contains(path)) { if (!config.contains(path)) {
config.createSection(path); config.createSection(path);
worldSection = config.getConfigurationSection(path); worldSection = config.getConfigurationSection(path);
@ -1399,7 +1398,7 @@ public class PS {
PS.debug("World possibly already loaded: " + world); PS.debug("World possibly already loaded: " + world);
return; return;
} }
log(C.PREFIX.s() + "&aDetected world load for '" + world + "'"); log(C.PREFIX + "&aDetected world load for '" + world + "'");
String gen_string = worldSection.getString("generator.plugin", "PlotSquared"); String gen_string = worldSection.getString("generator.plugin", "PlotSquared");
if (type == 2) { if (type == 2) {
Set<PlotCluster> clusters = clusters_tmp != null ? clusters_tmp.get(world) : new HashSet<PlotCluster>(); Set<PlotCluster> clusters = clusters_tmp != null ? clusters_tmp.get(world) : new HashSet<PlotCluster>();
@ -1415,7 +1414,7 @@ public class PS {
worldSection.createSection("areas." + fullId); worldSection.createSection("areas." + fullId);
DBFunc.replaceWorld(world, world + ";" + name, pos1, pos2); // NPE DBFunc.replaceWorld(world, world + ";" + name, pos1, pos2); // NPE
log(C.PREFIX.s() + "&3 - " + name + "-" + pos1 + "-" + pos2); log(C.PREFIX + "&3 - " + name + "-" + pos1 + "-" + pos2);
GeneratorWrapper<?> areaGen = IMP.getGenerator(world, gen_string); GeneratorWrapper<?> areaGen = IMP.getGenerator(world, gen_string);
if (areaGen == null) { if (areaGen == null) {
throw new IllegalArgumentException("Invalid Generator: " + gen_string); throw new IllegalArgumentException("Invalid Generator: " + gen_string);
@ -1428,10 +1427,10 @@ public class PS {
} catch (final IOException e) { } catch (final IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
log(C.PREFIX.s() + "&c | &9generator: &7" + baseGenerator + ">" + areaGen); log(C.PREFIX + "&c | &9generator: &7" + baseGenerator + ">" + areaGen);
log(C.PREFIX.s() + "&c | &9plotworld: &7" + pa); log(C.PREFIX + "&c | &9plotworld: &7" + pa);
log(C.PREFIX.s() + "&c | &9manager: &7" + pa); log(C.PREFIX + "&c | &9manager: &7" + pa);
log(C.PREFIX.s() + "&cNote: &7Area created for cluster:" + name + " (invalid or old configuration?)"); log(C.PREFIX + "&cNote: &7Area created for cluster:" + name + " (invalid or old configuration?)");
areaGen.getPlotGenerator().initialize(pa); areaGen.getPlotGenerator().initialize(pa);
areaGen.augment(pa); areaGen.augment(pa);
toLoad.add(pa); toLoad.add(pa);
@ -1453,9 +1452,9 @@ public class PS {
} catch (final IOException e) { } catch (final IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
log(C.PREFIX.s() + "&3 - generator: &7" + baseGenerator + ">" + areaGen); log(C.PREFIX + "&3 - generator: &7" + baseGenerator + ">" + areaGen);
log(C.PREFIX.s() + "&3 - plotworld: &7" + pa); log(C.PREFIX + "&3 - plotworld: &7" + pa);
log(C.PREFIX.s() + "&3 - manager: &7" + pa.getPlotManager()); log(C.PREFIX + "&3 - manager: &7" + pa.getPlotManager());
areaGen.getPlotGenerator().initialize(pa); areaGen.getPlotGenerator().initialize(pa);
areaGen.augment(pa); areaGen.augment(pa);
addPlotArea(pa); addPlotArea(pa);
@ -1465,7 +1464,7 @@ public class PS {
throw new IllegalArgumentException("Invalid type for multi-area world. Expected `2`, got `" + type + "`"); throw new IllegalArgumentException("Invalid type for multi-area world. Expected `2`, got `" + type + "`");
} }
for (String areaId : areasSection.getKeys(false)) { for (String areaId : areasSection.getKeys(false)) {
log(C.PREFIX.s() + "&3 - " + areaId); log(C.PREFIX + "&3 - " + areaId);
String[] split = areaId.split("([^\\-]+)(?:-{1})(-{0,1}\\d+\\;-{0,1}\\d+)(?:-{1})(-{0,1}\\d+\\;-{0,1}\\d+)"); String[] split = areaId.split("([^\\-]+)(?:-{1})(-{0,1}\\d+\\;-{0,1}\\d+)(?:-{1})(-{0,1}\\d+\\;-{0,1}\\d+)");
if (split.length != 3) { if (split.length != 3) {
throw new IllegalArgumentException("Invalid Area identifier: " + areaId + ". Expected form `<name>-<pos1>-<pos2>`"); throw new IllegalArgumentException("Invalid Area identifier: " + areaId + ". Expected form `<name>-<pos1>-<pos2>`");
@ -1524,10 +1523,10 @@ public class PS {
} catch (final IOException e) { } catch (final IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
log(C.PREFIX.s() + "&aDetected area load for '" + world + "'"); log(C.PREFIX + "&aDetected area load for '" + world + "'");
log(C.PREFIX.s() + "&c | &9generator: &7" + baseGenerator + ">" + areaGen); log(C.PREFIX + "&c | &9generator: &7" + baseGenerator + ">" + areaGen);
log(C.PREFIX.s() + "&c | &9plotworld: &7" + pa); log(C.PREFIX + "&c | &9plotworld: &7" + pa);
log(C.PREFIX.s() + "&c | &9manager: &7" + pa.getPlotManager()); log(C.PREFIX + "&c | &9manager: &7" + pa.getPlotManager());
areaGen.getPlotGenerator().initialize(pa); areaGen.getPlotGenerator().initialize(pa);
areaGen.augment(pa); areaGen.augment(pa);
addPlotArea(pa); addPlotArea(pa);
@ -1764,7 +1763,7 @@ public class PS {
public void setupDatabase() { public void setupDatabase() {
try { try {
if (Settings.DB.USE_MONGO) { if (Settings.DB.USE_MONGO) {
log(C.PREFIX.s() + "MongoDB is not yet implemented"); log(C.PREFIX + "MongoDB is not yet implemented");
log(C.PREFIX + "&cNo storage type is set!"); log(C.PREFIX + "&cNo storage type is set!");
IMP.disable(); IMP.disable();
return; return;
@ -1786,7 +1785,7 @@ public class PS {
this.clusters_tmp = DBFunc.getClusters(); this.clusters_tmp = DBFunc.getClusters();
} }
} catch (ClassNotFoundException | SQLException e) { } catch (ClassNotFoundException | SQLException e) {
log(C.PREFIX.s() + "&cFailed to open DATABASE connection. The plugin will disable itself."); log(C.PREFIX + "&cFailed to open DATABASE connection. The plugin will disable itself.");
if (Settings.DB.USE_MONGO) { if (Settings.DB.USE_MONGO) {
log("$4MONGO"); log("$4MONGO");
} else if (Settings.DB.USE_MYSQL) { } else if (Settings.DB.USE_MYSQL) {
@ -2195,7 +2194,7 @@ public class PS {
// Misc // Misc
Settings.DEBUG = config.getBoolean("debug"); Settings.DEBUG = config.getBoolean("debug");
if (Settings.DEBUG) { if (Settings.DEBUG) {
log(C.PREFIX.s() + "&6Debug Mode Enabled (Default). Edit the config to turn this off."); log(C.PREFIX + "&6Debug Mode Enabled (Default). Edit the config to turn this off.");
} }
Settings.CONSOLE_COLOR = config.getBoolean("console.color"); Settings.CONSOLE_COLOR = config.getBoolean("console.color");
if (!config.getBoolean("chat.fancy") || !checkVersion(IMP.getServerVersion(), 1, 8, 0)) { if (!config.getBoolean("chat.fancy") || !checkVersion(IMP.getServerVersion(), 1, 8, 0)) {
@ -2216,7 +2215,7 @@ public class PS {
public void setupConfigs() { public void setupConfigs() {
final File folder = new File(IMP.getDirectory() + File.separator + "config"); final File folder = new File(IMP.getDirectory() + File.separator + "config");
if (!folder.exists() && !folder.mkdirs()) { if (!folder.exists() && !folder.mkdirs()) {
log(C.PREFIX.s() + "&cFailed to create the /plugins/config folder. Please create it manually."); log(C.PREFIX + "&cFailed to create the /plugins/config folder. Please create it manually.");
} }
try { try {
styleFile = new File(IMP.getDirectory() + File.separator + "translations" + File.separator + "style.yml"); styleFile = new File(IMP.getDirectory() + File.separator + "translations" + File.separator + "style.yml");
@ -2315,7 +2314,7 @@ public class PS {
settings.put("Schematics Save Path", "" + Settings.SCHEMATIC_SAVE_PATH); settings.put("Schematics Save Path", "" + Settings.SCHEMATIC_SAVE_PATH);
settings.put("API Location", "" + Settings.API_URL); settings.put("API Location", "" + Settings.API_URL);
for (final Entry<String, String> setting : settings.entrySet()) { for (final Entry<String, String> setting : settings.entrySet()) {
log(C.PREFIX.s() + String.format("&cKey: &6%s&c, Value: &6%s", setting.getKey(), setting.getValue())); log(C.PREFIX + String.format("&cKey: &6%s&c, Value: &6%s", setting.getKey(), setting.getValue()));
} }
} }
} }

View File

@ -26,7 +26,6 @@ import com.intellectualcrafters.plot.util.SetupUtils;
import com.intellectualcrafters.plot.util.StringMan; import com.intellectualcrafters.plot.util.StringMan;
import com.intellectualcrafters.plot.util.WorldUtil; import com.intellectualcrafters.plot.util.WorldUtil;
import com.plotsquared.general.commands.CommandDeclaration; import com.plotsquared.general.commands.CommandDeclaration;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Objects; import java.util.Objects;
@ -35,7 +34,7 @@ import java.util.Set;
@CommandDeclaration(command = "area", permission = "plots.area", category = CommandCategory.ADMINISTRATION, requiredType = RequiredType.NONE, @CommandDeclaration(command = "area", permission = "plots.area", category = CommandCategory.ADMINISTRATION, requiredType = RequiredType.NONE,
description = "Create a new PlotArea", aliases = "world", usage = "/plot area <create|info|list|tp|regen>") description = "Create a new PlotArea", aliases = "world", usage = "/plot area <create|info|list|tp|regen>")
public class Area extends SubCommand { public class Area extends SubCommand {
@Override @Override
public boolean onCommand(final PlotPlayer plr, String[] args) { public boolean onCommand(final PlotPlayer plr, String[] args) {
if (args.length == 0) { if (args.length == 0) {
@ -380,7 +379,7 @@ public class Area extends SubCommand {
.text("\nClusters=").color("$1").text("" + clusters).color("$2") .text("\nClusters=").color("$1").text("" + clusters).color("$2")
.text("\nRegion=").color("$1").text(region).color("$2") .text("\nRegion=").color("$1").text(region).color("$2")
.text("\nGenerator=").color("$1").text(generator).color("$2"); .text("\nGenerator=").color("$1").text(generator).color("$2");
// type / terrain // type / terrain
String visit = "/plot area tp " + area.toString(); String visit = "/plot area tp " + area.toString();
message.text("[").color("$3") message.text("[").color("$3")
@ -457,5 +456,5 @@ public class Area extends SubCommand {
C.COMMAND_SYNTAX.send(plr, getUsage()); C.COMMAND_SYNTAX.send(plr, getUsage());
return false; return false;
} }
} }

View File

@ -37,7 +37,7 @@ aliases = { "biome", "sb", "setb", "b" },
category = CommandCategory.APPEARANCE, category = CommandCategory.APPEARANCE,
requiredType = RequiredType.NONE) requiredType = RequiredType.NONE)
public class Biome extends SetCommand { public class Biome extends SetCommand {
@Override @Override
public boolean set(final PlotPlayer plr, final Plot plot, final String value) { public boolean set(final PlotPlayer plr, final Plot plot, final String value) {
final int biome = WorldUtil.IMP.getBiomeFromString(value); final int biome = WorldUtil.IMP.getBiomeFromString(value);

View File

@ -33,7 +33,6 @@ import com.intellectualcrafters.plot.util.Permissions;
import com.intellectualcrafters.plot.util.StringMan; import com.intellectualcrafters.plot.util.StringMan;
import com.intellectualcrafters.plot.util.UUIDHandler; import com.intellectualcrafters.plot.util.UUIDHandler;
import com.plotsquared.general.commands.CommandDeclaration; import com.plotsquared.general.commands.CommandDeclaration;
import java.util.HashSet; import java.util.HashSet;
import java.util.UUID; import java.util.UUID;
@ -43,7 +42,7 @@ import java.util.UUID;
public class Merge extends SubCommand { public class Merge extends SubCommand {
public final static String[] values = new String[] { "north", "east", "south", "west", "auto" }; public final static String[] values = new String[] { "north", "east", "south", "west", "auto" };
public final static String[] aliases = new String[] { "n", "e", "s", "w", "all" }; public final static String[] aliases = new String[] { "n", "e", "s", "w", "all" };
public static String direction(float yaw) { public static String direction(float yaw) {
yaw = yaw / 90; yaw = yaw / 90;
final int i = Math.round(yaw); final int i = Math.round(yaw);
@ -65,7 +64,7 @@ public class Merge extends SubCommand {
return ""; return "";
} }
} }
@Override @Override
public boolean onCommand(final PlotPlayer plr, final String[] args) { public boolean onCommand(final PlotPlayer plr, final String[] args) {
final Location loc = plr.getLocationFull(); final Location loc = plr.getLocationFull();
@ -131,7 +130,7 @@ public class Merge extends SubCommand {
} }
MainUtil.sendMessage(plr, C.NO_AVAILABLE_AUTOMERGE); MainUtil.sendMessage(plr, C.NO_AVAILABLE_AUTOMERGE);
return false; return false;
} }
for (int i = 0; i < values.length; i++) { for (int i = 0; i < values.length; i++) {
if (args[0].equalsIgnoreCase(values[i]) || args[0].equalsIgnoreCase(aliases[i])) { if (args[0].equalsIgnoreCase(values[i]) || args[0].equalsIgnoreCase(aliases[i])) {
@ -165,7 +164,7 @@ public class Merge extends SubCommand {
return false; return false;
} }
if (!Permissions.hasPermission(plr, C.PERMISSION_MERGE_OTHER)) { if (!Permissions.hasPermission(plr, C.PERMISSION_MERGE_OTHER)) {
MainUtil.sendMessage(plr, C.NO_PERMISSION, C.PERMISSION_MERGE_OTHER.s()); MainUtil.sendMessage(plr, C.NO_PERMISSION, C.PERMISSION_MERGE_OTHER);
return false; return false;
} }
HashSet<UUID> uuids = adjacent.getOwners(); HashSet<UUID> uuids = adjacent.getOwners();

View File

@ -23,22 +23,32 @@ package com.intellectualcrafters.plot.flag;
import com.intellectualcrafters.plot.PS; import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.database.DBFunc; import com.intellectualcrafters.plot.database.DBFunc;
import com.intellectualcrafters.plot.object.*; import com.intellectualcrafters.plot.object.Plot;
import com.intellectualcrafters.plot.object.PlotArea;
import com.intellectualcrafters.plot.object.PlotCluster;
import com.intellectualcrafters.plot.object.PlotPlayer;
import com.intellectualcrafters.plot.object.PlotSettings;
import com.intellectualcrafters.plot.object.RunnableVal;
import com.intellectualcrafters.plot.util.EventUtil; import com.intellectualcrafters.plot.util.EventUtil;
import com.intellectualcrafters.plot.util.Permissions; import com.intellectualcrafters.plot.util.Permissions;
import java.util.ArrayList;
import java.util.*; import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
/** /**
* Flag Manager Utility * Flag Manager Utility
* *
*/ */
public class FlagManager { public class FlagManager {
private final static HashSet<String> reserved = new HashSet<>(); private final static HashSet<String> reserved = new HashSet<>();
private final static HashSet<AbstractFlag> flags = new HashSet<>(); private final static HashSet<AbstractFlag> flags = new HashSet<>();
/** /**
* Reserve a flag so that it cannot be set by players * Reserve a flag so that it cannot be set by players
* @param flag * @param flag
@ -46,7 +56,7 @@ public class FlagManager {
public static void reserveFlag(final String flag) { public static void reserveFlag(final String flag) {
reserved.add(flag); reserved.add(flag);
} }
/** /**
* Get if a flag is reserved * Get if a flag is reserved
* @param flag * @param flag
@ -55,7 +65,7 @@ public class FlagManager {
public static boolean isReserved(final String flag) { public static boolean isReserved(final String flag) {
return reserved.contains(flag); return reserved.contains(flag);
} }
/** /**
* Get the reserved flags * Get the reserved flags
* @return * @return
@ -63,7 +73,7 @@ public class FlagManager {
public static HashSet<String> getReservedFlags() { public static HashSet<String> getReservedFlags() {
return (HashSet<String>) reserved.clone(); return (HashSet<String>) reserved.clone();
} }
/** /**
* Unreserve a flag * Unreserve a flag
* @param flag * @param flag
@ -71,7 +81,7 @@ public class FlagManager {
public static void unreserveFlag(final String flag) { public static void unreserveFlag(final String flag) {
reserved.remove(flag); reserved.remove(flag);
} }
/** /**
* Register an AbstractFlag with PlotSquared * Register an AbstractFlag with PlotSquared
* *
@ -82,9 +92,9 @@ public class FlagManager {
public static boolean addFlag(final AbstractFlag af) { public static boolean addFlag(final AbstractFlag af) {
return addFlag(af, false); return addFlag(af, false);
} }
public static boolean addFlag(final AbstractFlag af, final boolean reserved) { public static boolean addFlag(final AbstractFlag af, final boolean reserved) {
PS.debug(C.PREFIX.s() + "&8 - Adding flag: &7" + af); PS.debug(C.PREFIX + "&8 - Adding flag: &7" + af);
PS.get().foreachPlotArea(new RunnableVal<PlotArea>() { PS.get().foreachPlotArea(new RunnableVal<PlotArea>() {
@Override @Override
public void run(PlotArea value) { public void run(PlotArea value) {
@ -125,7 +135,7 @@ public class FlagManager {
} }
return flag_string.toString(); return flag_string.toString();
} }
public static Flag getSettingFlag(final PlotArea area, final PlotSettings settings, final String id) { public static Flag getSettingFlag(final PlotArea area, final PlotSettings settings, final String id) {
Flag flag; Flag flag;
if (settings.flags.isEmpty() || (flag = settings.flags.get(id)) == null) { if (settings.flags.isEmpty() || (flag = settings.flags.get(id)) == null) {
@ -139,7 +149,7 @@ public class FlagManager {
} }
return flag; return flag;
} }
public static boolean isBooleanFlag(final Plot plot, final String key, final boolean defaultValue) { public static boolean isBooleanFlag(final Plot plot, final String key, final boolean defaultValue) {
final Flag flag = FlagManager.getPlotFlagRaw(plot, key); final Flag flag = FlagManager.getPlotFlagRaw(plot, key);
if (flag == null) { if (flag == null) {
@ -151,7 +161,7 @@ public class FlagManager {
} }
return defaultValue; return defaultValue;
} }
/** /**
* Get the value of a flag for a plot (respects flag defaults) * Get the value of a flag for a plot (respects flag defaults)
* @param plot * @param plot
@ -177,7 +187,7 @@ public class FlagManager {
} }
return getSettingFlag(plot.getArea(), plot.getSettings(), flag); return getSettingFlag(plot.getArea(), plot.getSettings(), flag);
} }
public static boolean isPlotFlagTrue(final Plot plot, final String strFlag) { public static boolean isPlotFlagTrue(final Plot plot, final String strFlag) {
if (plot.owner == null) { if (plot.owner == null) {
return false; return false;
@ -185,7 +195,7 @@ public class FlagManager {
final Flag flag = getPlotFlagRaw(plot, strFlag); final Flag flag = getPlotFlagRaw(plot, strFlag);
return !(flag == null || !((Boolean) flag.getValue())); return !(flag == null || !((Boolean) flag.getValue()));
} }
public static boolean isPlotFlagFalse(final Plot plot, final String strFlag) { public static boolean isPlotFlagFalse(final Plot plot, final String strFlag) {
if (plot.owner == null) { if (plot.owner == null) {
return false; return false;
@ -196,7 +206,7 @@ public class FlagManager {
} }
return false; return false;
} }
/** /**
* Get the value of a flag for a plot (ignores flag defaults) * Get the value of a flag for a plot (ignores flag defaults)
* @param plot * @param plot
@ -206,14 +216,14 @@ public class FlagManager {
public static Flag getPlotFlagAbs(final Plot plot, final String flag) { public static Flag getPlotFlagAbs(final Plot plot, final String flag) {
return getSettingFlagAbs(plot.getSettings(), flag); return getSettingFlagAbs(plot.getSettings(), flag);
} }
public static Flag getSettingFlagAbs(final PlotSettings settings, final String flag) { public static Flag getSettingFlagAbs(final PlotSettings settings, final String flag) {
if (settings.flags.isEmpty()) { if (settings.flags.isEmpty()) {
return null; return null;
} }
return settings.flags.get(flag); return settings.flags.get(flag);
} }
/** /**
* Add a flag to a plot * Add a flag to a plot
* @param origin * @param origin
@ -231,7 +241,7 @@ public class FlagManager {
} }
return true; return true;
} }
public static boolean addPlotFlagAbs(final Plot plot, final Flag flag) { public static boolean addPlotFlagAbs(final Plot plot, final Flag flag) {
final boolean result = EventUtil.manager.callFlagAdd(flag, plot); final boolean result = EventUtil.manager.callFlagAdd(flag, plot);
if (!result) { if (!result) {
@ -240,14 +250,14 @@ public class FlagManager {
plot.getFlags().put(flag.getKey(), flag); plot.getFlags().put(flag.getKey(), flag);
return true; return true;
} }
public static boolean addClusterFlag(final PlotCluster cluster, final Flag flag) { public static boolean addClusterFlag(final PlotCluster cluster, final Flag flag) {
getSettingFlag(cluster.area, cluster.settings, flag.getKey()); getSettingFlag(cluster.area, cluster.settings, flag.getKey());
cluster.settings.flags.put(flag.getKey(), flag); cluster.settings.flags.put(flag.getKey(), flag);
DBFunc.setFlags(cluster, cluster.settings.flags.values()); DBFunc.setFlags(cluster, cluster.settings.flags.values());
return true; return true;
} }
/** /**
* *
* @param plot * @param plot
@ -259,7 +269,7 @@ public class FlagManager {
} }
return getSettingFlags(plot.getArea(), plot.getSettings()); return getSettingFlags(plot.getArea(), plot.getSettings());
} }
public static HashMap<String, Flag> getPlotFlags(PlotArea area, final PlotSettings settings, final boolean ignorePluginflags) { public static HashMap<String, Flag> getPlotFlags(PlotArea area, final PlotSettings settings, final boolean ignorePluginflags) {
final HashMap<String, Flag> flags = new HashMap<>(); final HashMap<String, Flag> flags = new HashMap<>();
if (area != null && !area.DEFAULT_FLAGS.isEmpty()) { if (area != null && !area.DEFAULT_FLAGS.isEmpty()) {
@ -275,14 +285,14 @@ public class FlagManager {
} else { } else {
flags.putAll(settings.flags); flags.putAll(settings.flags);
} }
return flags; return flags;
} }
public static HashMap<String, Flag> getSettingFlags(PlotArea area, final PlotSettings settings) { public static HashMap<String, Flag> getSettingFlags(PlotArea area, final PlotSettings settings) {
return getPlotFlags(area, settings, false); return getPlotFlags(area, settings, false);
} }
public static boolean removePlotFlag(final Plot plot, final String id) { public static boolean removePlotFlag(final Plot plot, final String id) {
final Flag flag = plot.getFlags().remove(id); final Flag flag = plot.getFlags().remove(id);
if (flag == null) { if (flag == null) {
@ -297,7 +307,7 @@ public class FlagManager {
DBFunc.setFlags(plot, plot.getFlags().values()); DBFunc.setFlags(plot, plot.getFlags().values());
return true; return true;
} }
public static boolean removeClusterFlag(final PlotCluster cluster, final String id) { public static boolean removeClusterFlag(final PlotCluster cluster, final String id) {
final Flag flag = cluster.settings.flags.remove(id); final Flag flag = cluster.settings.flags.remove(id);
if (flag == null) { if (flag == null) {
@ -311,7 +321,7 @@ public class FlagManager {
DBFunc.setFlags(cluster, cluster.settings.flags.values()); DBFunc.setFlags(cluster, cluster.settings.flags.values());
return true; return true;
} }
public static void setPlotFlags(final Plot origin, final Set<Flag> flags) { public static void setPlotFlags(final Plot origin, final Set<Flag> flags) {
for (Plot plot : origin.getConnectedPlots()) { for (Plot plot : origin.getConnectedPlots()) {
if (flags != null && !flags.isEmpty()) { if (flags != null && !flags.isEmpty()) {
@ -328,7 +338,7 @@ public class FlagManager {
DBFunc.setFlags(plot, plot.getFlags().values()); DBFunc.setFlags(plot, plot.getFlags().values());
} }
} }
public static void setClusterFlags(final PlotCluster cluster, final Set<Flag> flags) { public static void setClusterFlags(final PlotCluster cluster, final Set<Flag> flags) {
if (flags != null && !flags.isEmpty()) { if (flags != null && !flags.isEmpty()) {
cluster.settings.flags.clear(); cluster.settings.flags.clear();
@ -342,7 +352,7 @@ public class FlagManager {
} }
DBFunc.setFlags(cluster, cluster.settings.flags.values()); DBFunc.setFlags(cluster, cluster.settings.flags.values());
} }
public static Flag[] removeFlag(final Flag[] flags, final String r) { public static Flag[] removeFlag(final Flag[] flags, final String r) {
final Flag[] f = new Flag[flags.length - 1]; final Flag[] f = new Flag[flags.length - 1];
int index = 0; int index = 0;
@ -353,7 +363,7 @@ public class FlagManager {
} }
return f; return f;
} }
public static Set<Flag> removeFlag(final Set<Flag> flags, final String r) { public static Set<Flag> removeFlag(final Set<Flag> flags, final String r) {
final HashSet<Flag> newflags = new HashSet<>(); final HashSet<Flag> newflags = new HashSet<>();
for (final Flag flag : flags) { for (final Flag flag : flags) {
@ -363,7 +373,7 @@ public class FlagManager {
} }
return newflags; return newflags;
} }
/** /**
* Get a list of registered AbstractFlag objects * Get a list of registered AbstractFlag objects
* *
@ -372,7 +382,7 @@ public class FlagManager {
public static HashSet<AbstractFlag> getFlags() { public static HashSet<AbstractFlag> getFlags() {
return flags; return flags;
} }
/** /**
* Get a list of registered AbstractFlag objects based on player permissions * Get a list of registered AbstractFlag objects based on player permissions
* *
@ -389,7 +399,7 @@ public class FlagManager {
} }
return returnFlags; return returnFlags;
} }
/** /**
* Get an AbstractFlag by a string Returns null if flag does not exist * Get an AbstractFlag by a string Returns null if flag does not exist
* *
@ -405,7 +415,7 @@ public class FlagManager {
} }
return null; return null;
} }
/** /**
* Get an AbstractFlag by a string * Get an AbstractFlag by a string
* *
@ -420,7 +430,7 @@ public class FlagManager {
} }
return getFlag(string); return getFlag(string);
} }
/** /**
* Remove a registered AbstractFlag * Remove a registered AbstractFlag
* *
@ -431,7 +441,7 @@ public class FlagManager {
public static boolean removeFlag(final AbstractFlag flag) { public static boolean removeFlag(final AbstractFlag flag) {
return flags.remove(flag); return flags.remove(flag);
} }
public static HashMap<String, Flag> parseFlags(final List<String> flagstrings) { public static HashMap<String, Flag> parseFlags(final List<String> flagstrings) {
final HashMap<String, Flag> map = new HashMap<>(); final HashMap<String, Flag> map = new HashMap<>();
for (final String key : flagstrings) { for (final String key : flagstrings) {

View File

@ -32,7 +32,6 @@ import com.intellectualcrafters.plot.util.MathMan;
import com.intellectualcrafters.plot.util.SchematicHandler; import com.intellectualcrafters.plot.util.SchematicHandler;
import com.intellectualcrafters.plot.util.SchematicHandler.Dimension; import com.intellectualcrafters.plot.util.SchematicHandler.Dimension;
import com.intellectualcrafters.plot.util.SchematicHandler.Schematic; import com.intellectualcrafters.plot.util.SchematicHandler.Schematic;
import java.io.File; import java.io.File;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
@ -177,7 +176,7 @@ public class HybridPlotWorld extends ClassicPlotWorld {
PS.debug("&c - road schematics are disabled for this world."); PS.debug("&c - road schematics are disabled for this world.");
} }
} }
@Override @Override
public boolean isCompatible(PlotArea plotworld) { public boolean isCompatible(PlotArea plotworld) {
if (!(plotworld instanceof SquarePlotWorld)) { if (!(plotworld instanceof SquarePlotWorld)) {
@ -250,7 +249,7 @@ public class HybridPlotWorld extends ClassicPlotWorld {
} }
} }
if (schem1 == null || schem2 == null || ROAD_WIDTH == 0) { if (schem1 == null || schem2 == null || ROAD_WIDTH == 0) {
PS.debug(C.PREFIX.s() + "&3 - schematic: &7false"); PS.debug(C.PREFIX + "&3 - schematic: &7false");
return; return;
} }
ROAD_SCHEMATIC_ENABLED = true; ROAD_SCHEMATIC_ENABLED = true;
@ -298,7 +297,7 @@ public class HybridPlotWorld extends ClassicPlotWorld {
} }
} }
} }
public void addOverlayBlock(short x, final short y, short z, final short id, byte data, final boolean rotate) { public void addOverlayBlock(short x, final short y, short z, final short id, byte data, final boolean rotate) {
if (z < 0) { if (z < 0) {
z += SIZE; z += SIZE;

View File

@ -34,7 +34,7 @@ import java.util.Set;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
public abstract class HybridUtils { public abstract class HybridUtils {
public static HybridUtils manager; public static HybridUtils manager;
public static Set<ChunkLoc> regions; public static Set<ChunkLoc> regions;
public static Set<ChunkLoc> chunks = new HashSet<>(); public static Set<ChunkLoc> chunks = new HashSet<>();
@ -110,7 +110,7 @@ public abstract class HybridUtils {
} }
public abstract int checkModified(final String world, final int x1, final int x2, final int y1, final int y2, final int z1, final int z2, final PlotBlock[] blocks); public abstract int checkModified(final String world, final int x1, final int x2, final int y1, final int y2, final int z1, final int z2, final PlotBlock[] blocks);
public final ArrayList<ChunkLoc> getChunks(final ChunkLoc region) { public final ArrayList<ChunkLoc> getChunks(final ChunkLoc region) {
final ArrayList<ChunkLoc> chunks = new ArrayList<>(); final ArrayList<ChunkLoc> chunks = new ArrayList<>();
final int sx = region.x << 5; final int sx = region.x << 5;
@ -122,7 +122,7 @@ public abstract class HybridUtils {
} }
return chunks; return chunks;
} }
/** /**
* Checks all connected plots * Checks all connected plots
* @param plot * @param plot
@ -145,7 +145,7 @@ public abstract class HybridUtils {
@Override @Override
public void run() { public void run() {
if (zones.isEmpty()) { if (zones.isEmpty()) {
TaskManager.runTask(whenDone); TaskManager.runTask(whenDone);
return; return;
} }
@ -167,12 +167,12 @@ public abstract class HybridUtils {
plot.getArea().worldname, bx, ex, cpw.PLOT_HEIGHT + 1, 255, bz, ez, new PlotBlock[] { new PlotBlock((short) 0, (byte) 0) }); plot.getArea().worldname, bx, ex, cpw.PLOT_HEIGHT + 1, 255, bz, ez, new PlotBlock[] { new PlotBlock((short) 0, (byte) 0) });
} }
}, this, 5); }, this, 5);
} }
}; };
run.run(); run.run();
} }
public boolean scheduleRoadUpdate(final PlotArea area, final int extend) { public boolean scheduleRoadUpdate(final PlotArea area, final int extend) {
if (HybridUtils.UPDATE) { if (HybridUtils.UPDATE) {
return false; return false;
@ -181,7 +181,7 @@ public abstract class HybridUtils {
final Set<ChunkLoc> regions = ChunkManager.manager.getChunkChunks(area.worldname); final Set<ChunkLoc> regions = ChunkManager.manager.getChunkChunks(area.worldname);
return scheduleRoadUpdate(area, regions, extend); return scheduleRoadUpdate(area, regions, extend);
} }
public boolean scheduleRoadUpdate(final PlotArea area, final Set<ChunkLoc> rgs, final int extend) { public boolean scheduleRoadUpdate(final PlotArea area, final Set<ChunkLoc> rgs, final int extend) {
HybridUtils.regions = rgs; HybridUtils.regions = rgs;
HybridUtils.area = area; HybridUtils.area = area;
@ -210,7 +210,7 @@ public abstract class HybridUtils {
} }
if (regions.isEmpty() && chunks.isEmpty()) { if (regions.isEmpty() && chunks.isEmpty()) {
HybridUtils.UPDATE = false; HybridUtils.UPDATE = false;
PS.debug(C.PREFIX.s() + "Finished road conversion"); PS.debug(C.PREFIX + "Finished road conversion");
// CANCEL TASK // CANCEL TASK
} else { } else {
final Runnable task = this; final Runnable task = this;
@ -236,7 +236,7 @@ public abstract class HybridUtils {
final long diff = System.currentTimeMillis() + 1; final long diff = System.currentTimeMillis() + 1;
if (((System.currentTimeMillis() - baseTime - last.get()) > 2000) && (last.get() != 0)) { if (((System.currentTimeMillis() - baseTime - last.get()) > 2000) && (last.get() != 0)) {
last.set(0); last.set(0);
PS.debug(C.PREFIX.s() + "Detected low TPS. Rescheduling in 30s"); PS.debug(C.PREFIX + "Detected low TPS. Rescheduling in 30s");
Iterator<ChunkLoc> iter = chunks.iterator(); Iterator<ChunkLoc> iter = chunks.iterator();
final ChunkLoc chunk = iter.next(); final ChunkLoc chunk = iter.next();
iter.remove(); iter.remove();
@ -294,7 +294,7 @@ public abstract class HybridUtils {
}); });
return true; return true;
} }
public boolean setupRoadSchematic(final Plot plot) { public boolean setupRoadSchematic(final Plot plot) {
final String world = plot.getArea().worldname; final String world = plot.getArea().worldname;
final Location bot = plot.getBottomAbs().subtract(1, 0, 1); final Location bot = plot.getBottomAbs().subtract(1, 0, 1);
@ -309,7 +309,7 @@ public abstract class HybridUtils {
final int bz = sz - plotworld.ROAD_WIDTH; final int bz = sz - plotworld.ROAD_WIDTH;
final int tz = sz - 1; final int tz = sz - 1;
final int ty = get_ey(world, sx, ex, bz, tz, sy); final int ty = get_ey(world, sx, ex, bz, tz, sy);
final Set<RegionWrapper> sideroad = new HashSet<>(Collections.singletonList(new RegionWrapper(sx, ex, sy, ey, sz, ez))); final Set<RegionWrapper> sideroad = new HashSet<>(Collections.singletonList(new RegionWrapper(sx, ex, sy, ey, sz, ez)));
final Set<RegionWrapper> intersection = new HashSet<>(Collections.singletonList(new RegionWrapper(sx, ex, sy, ty, bz, tz))); final Set<RegionWrapper> intersection = new HashSet<>(Collections.singletonList(new RegionWrapper(sx, ex, sy, ty, bz, tz)));
@ -331,9 +331,9 @@ public abstract class HybridUtils {
}); });
return true; return true;
} }
public abstract int get_ey(final String world, final int sx, final int ex, final int sz, final int ez, final int sy); public abstract int get_ey(final String world, final int sx, final int ex, final int sz, final int ez, final int sy);
public boolean regenerateRoad(final PlotArea area, final ChunkLoc chunk, int extend) { public boolean regenerateRoad(final PlotArea area, final ChunkLoc chunk, int extend) {
int x = chunk.x << 4; int x = chunk.x << 4;
int z = chunk.z << 4; int z = chunk.z << 4;

View File

@ -14,7 +14,6 @@ import com.intellectualcrafters.plot.object.PlotPlayer;
import com.intellectualcrafters.plot.object.RunnableVal; import com.intellectualcrafters.plot.object.RunnableVal;
import com.intellectualcrafters.plot.object.StringWrapper; import com.intellectualcrafters.plot.object.StringWrapper;
import com.intellectualcrafters.plot.uuid.UUIDWrapper; import com.intellectualcrafters.plot.uuid.UUIDWrapper;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.Map; import java.util.Map;
@ -29,19 +28,19 @@ public abstract class UUIDHandlerImplementation {
public UUIDWrapper uuidWrapper = null; public UUIDWrapper uuidWrapper = null;
public HashSet<UUID> unknown = new HashSet<>(); public HashSet<UUID> unknown = new HashSet<>();
private BiMap<StringWrapper, UUID> uuidMap = HashBiMap.create(new HashMap<StringWrapper, UUID>()); private BiMap<StringWrapper, UUID> uuidMap = HashBiMap.create(new HashMap<StringWrapper, UUID>());
public UUIDHandlerImplementation(final UUIDWrapper wrapper) { public UUIDHandlerImplementation(final UUIDWrapper wrapper) {
uuidWrapper = wrapper; uuidWrapper = wrapper;
players = new ConcurrentHashMap<>(); players = new ConcurrentHashMap<>();
} }
/** /**
* If the UUID is not found, some commands can request to fetch the UUID when possible * If the UUID is not found, some commands can request to fetch the UUID when possible
* @param name * @param name
* @param ifFetch * @param ifFetch
*/ */
public abstract void fetchUUID(final String name, final RunnableVal<UUID> ifFetch); public abstract void fetchUUID(final String name, final RunnableVal<UUID> ifFetch);
/** /**
* Start UUID caching (this should be an async task) * Start UUID caching (this should be an async task)
* Recommended to override this is you want to cache offline players * Recommended to override this is you want to cache offline players
@ -52,20 +51,20 @@ public abstract class UUIDHandlerImplementation {
} }
return CACHED = true; return CACHED = true;
} }
public UUIDWrapper getUUIDWrapper() { public UUIDWrapper getUUIDWrapper() {
return uuidWrapper; return uuidWrapper;
} }
public void setUUIDWrapper(final UUIDWrapper wrapper) { public void setUUIDWrapper(final UUIDWrapper wrapper) {
uuidWrapper = wrapper; uuidWrapper = wrapper;
} }
public void rename(final UUID uuid, final StringWrapper name) { public void rename(final UUID uuid, final StringWrapper name) {
uuidMap.inverse().remove(uuid); uuidMap.inverse().remove(uuid);
uuidMap.put(name, uuid); uuidMap.put(name, uuid);
} }
public void add(final BiMap<StringWrapper, UUID> toAdd) { public void add(final BiMap<StringWrapper, UUID> toAdd) {
if (uuidMap.isEmpty()) { if (uuidMap.isEmpty()) {
uuidMap = toAdd; uuidMap = toAdd;
@ -86,9 +85,9 @@ public abstract class UUIDHandlerImplementation {
} }
uuidMap.put(name, uuid); uuidMap.put(name, uuid);
} }
PS.debug(C.PREFIX.s() + "&6Cached a total of: " + uuidMap.size() + " UUIDs"); PS.debug(C.PREFIX + "&6Cached a total of: " + uuidMap.size() + " UUIDs");
} }
public boolean add(final StringWrapper name, final UUID uuid) { public boolean add(final StringWrapper name, final UUID uuid) {
if ((uuid == null)) { if ((uuid == null)) {
return false; return false;
@ -102,7 +101,7 @@ public abstract class UUIDHandlerImplementation {
} }
return false; return false;
} }
/* /*
* lazy UUID conversion: * lazy UUID conversion:
* - Useful if the person misconfigured the database, or settings before PlotMe conversion * - Useful if the person misconfigured the database, or settings before PlotMe conversion
@ -165,25 +164,25 @@ public abstract class UUIDHandlerImplementation {
} }
return true; return true;
} }
public boolean uuidExists(final UUID uuid) { public boolean uuidExists(final UUID uuid) {
return uuidMap.containsValue(uuid); return uuidMap.containsValue(uuid);
} }
public BiMap<StringWrapper, UUID> getUUIDMap() { public BiMap<StringWrapper, UUID> getUUIDMap() {
return uuidMap; return uuidMap;
} }
public boolean nameExists(final StringWrapper wrapper) { public boolean nameExists(final StringWrapper wrapper) {
return uuidMap.containsKey(wrapper); return uuidMap.containsKey(wrapper);
} }
public void handleShutdown() { public void handleShutdown() {
players.clear(); players.clear();
uuidMap.clear(); uuidMap.clear();
uuidWrapper = null; uuidWrapper = null;
} }
public String getName(final UUID uuid) { public String getName(final UUID uuid) {
if (uuid == null) { if (uuid == null) {
return null; return null;
@ -200,7 +199,7 @@ public abstract class UUIDHandlerImplementation {
} }
return null; return null;
} }
public UUID getUUID(final String name, final RunnableVal<UUID> ifFetch) { public UUID getUUID(final String name, final RunnableVal<UUID> ifFetch) {
if ((name == null) || (name.isEmpty())) { if ((name == null) || (name.isEmpty())) {
return null; return null;
@ -228,15 +227,15 @@ public abstract class UUIDHandlerImplementation {
} }
return null; return null;
} }
public UUID getUUID(final PlotPlayer player) { public UUID getUUID(final PlotPlayer player) {
return uuidWrapper.getUUID(player); return uuidWrapper.getUUID(player);
} }
public UUID getUUID(final OfflinePlotPlayer player) { public UUID getUUID(final OfflinePlotPlayer player) {
return uuidWrapper.getUUID(player); return uuidWrapper.getUUID(player);
} }
public PlotPlayer getPlayer(final UUID uuid) { public PlotPlayer getPlayer(final UUID uuid) {
String name = getName(uuid); String name = getName(uuid);
if (name != null) { if (name != null) {
@ -244,13 +243,13 @@ public abstract class UUIDHandlerImplementation {
} }
return null; return null;
} }
public PlotPlayer getPlayer(final String name) { public PlotPlayer getPlayer(final String name) {
return players.get(name); return players.get(name);
} }
public Map<String, PlotPlayer> getPlayers() { public Map<String, PlotPlayer> getPlayers() {
return players; return players;
} }
} }

View File

@ -1,36 +1,35 @@
package com.intellectualcrafters.plot.util.helpmenu; package com.intellectualcrafters.plot.util.helpmenu;
import java.util.ArrayList;
import java.util.List;
import com.intellectualcrafters.plot.commands.CommandCategory; import com.intellectualcrafters.plot.commands.CommandCategory;
import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.object.PlotPlayer; import com.intellectualcrafters.plot.object.PlotPlayer;
import com.intellectualcrafters.plot.util.MainUtil; import com.intellectualcrafters.plot.util.MainUtil;
import java.util.ArrayList;
import java.util.List;
public class HelpPage { public class HelpPage {
private final List<HelpObject> helpObjects; private final List<HelpObject> helpObjects;
private final String _header; private final String _header;
public HelpPage(final CommandCategory category, final int currentPage, final int maxPages) { public HelpPage(final CommandCategory category, final int currentPage, final int maxPages) {
helpObjects = new ArrayList<>(); helpObjects = new ArrayList<>();
_header = C.HELP_PAGE_HEADER.s().replace("%category%", category == null ? "ALL" : category.toString()).replace("%current%", (currentPage + 1) + "").replace("%max%", (maxPages + 1) + ""); _header = C.HELP_PAGE_HEADER.s().replace("%category%", category == null ? "ALL" : category.toString()).replace("%current%", (currentPage + 1) + "").replace("%max%", (maxPages + 1) + "");
} }
public void render(final PlotPlayer player) { public void render(final PlotPlayer player) {
if (helpObjects.size() < 1) { if (helpObjects.size() < 1) {
MainUtil.sendMessage(player, C.NOT_VALID_NUMBER, "(0)"); MainUtil.sendMessage(player, C.NOT_VALID_NUMBER, "(0)");
} else { } else {
MainUtil.sendMessage(player, C.HELP_HEADER.s(), false); MainUtil.sendMessage(player, C.HELP_HEADER, false);
MainUtil.sendMessage(player, _header, false); MainUtil.sendMessage(player, _header, false);
for (final HelpObject object : helpObjects) { for (final HelpObject object : helpObjects) {
MainUtil.sendMessage(player, object.toString(), false); MainUtil.sendMessage(player, object.toString(), false);
} }
MainUtil.sendMessage(player, C.HELP_FOOTER.s(), false); MainUtil.sendMessage(player, C.HELP_FOOTER, false);
} }
} }
public void addHelpItem(final HelpObject object) { public void addHelpItem(final HelpObject object) {
helpObjects.add(object); helpObjects.add(object);
} }

View File

@ -29,8 +29,17 @@ import com.intellectualcrafters.plot.object.Plot;
import com.intellectualcrafters.plot.object.PlotArea; import com.intellectualcrafters.plot.object.PlotArea;
import com.intellectualcrafters.plot.object.PlotPlayer; import com.intellectualcrafters.plot.object.PlotPlayer;
import com.intellectualcrafters.plot.object.RunnableVal; import com.intellectualcrafters.plot.object.RunnableVal;
import com.intellectualcrafters.plot.util.*; import com.intellectualcrafters.plot.util.AbstractTitle;
import com.intellectualcrafters.plot.util.CommentManager;
import com.intellectualcrafters.plot.util.EventUtil;
import com.intellectualcrafters.plot.util.ExpireManager;
import com.intellectualcrafters.plot.util.MainUtil;
import com.intellectualcrafters.plot.util.Permissions;
import com.intellectualcrafters.plot.util.PlotGamemode;
import com.intellectualcrafters.plot.util.PlotWeather;
import com.intellectualcrafters.plot.util.StringMan;
import com.intellectualcrafters.plot.util.TaskManager;
import com.intellectualcrafters.plot.util.UUIDHandler;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.UUID; import java.util.UUID;
@ -40,7 +49,7 @@ import java.util.UUID;
*/ */
public class PlotListener { public class PlotListener {
public static boolean plotEntry(final PlotPlayer pp, final Plot plot) { public static boolean plotEntry(final PlotPlayer pp, final Plot plot) {
if (plot.isDenied(pp.getUUID()) && !Permissions.hasPermission(pp, "plots.admin.entry.denied")) { if (plot.isDenied(pp.getUUID()) && !Permissions.hasPermission(pp, "plots.admin.entry.denied")) {
return false; return false;
@ -59,7 +68,7 @@ public class PlotListener {
final int size = flags.size(); final int size = flags.size();
boolean titles = Settings.TITLES; boolean titles = Settings.TITLES;
final String greeting; final String greeting;
if (size != 0) { if (size != 0) {
final Flag titleFlag = flags.get("titles"); final Flag titleFlag = flags.get("titles");
if (titleFlag != null) { if (titleFlag != null) {
@ -115,7 +124,7 @@ public class PlotListener {
if (weatherFlag != null) { if (weatherFlag != null) {
pp.setWeather((PlotWeather) weatherFlag.getValue()); pp.setWeather((PlotWeather) weatherFlag.getValue());
} }
final Flag musicFlag = flags.get("music"); final Flag musicFlag = flags.get("music");
if (musicFlag != null) { if (musicFlag != null) {
final Integer id = (Integer) musicFlag.getValue(); final Integer id = (Integer) musicFlag.getValue();
@ -174,7 +183,7 @@ public class PlotListener {
} }
return true; return true;
} }
public static boolean plotExit(final PlotPlayer pp, final Plot plot) { public static boolean plotExit(final PlotPlayer pp, final Plot plot) {
pp.deleteMeta("lastplot"); pp.deleteMeta("lastplot");
EventUtil.manager.callLeave(pp, plot); EventUtil.manager.callLeave(pp, plot);

View File

@ -84,7 +84,7 @@ public class MainListener {
if (Settings.USE_PLOTME_ALIAS) { if (Settings.USE_PLOTME_ALIAS) {
SpongeMain.THIS.getGame().getCommandManager().process(source, ("plots " + event.getArguments()).trim()); SpongeMain.THIS.getGame().getCommandManager().process(source, ("plots " + event.getArguments()).trim());
} else { } else {
source.sendMessage(SpongeUtil.getText(C.NOT_USING_PLOTME.s())); source.sendMessage(SpongeUtil.getText(C.NOT_USING_PLOTME));
} }
event.setCancelled(true); event.setCancelled(true);
} }