mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 13:16:45 +01:00
Merge branch 'manuelgu-feature/rm-redundant-methods'
This commit is contained in:
commit
0e49dd6f62
@ -45,7 +45,6 @@ import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
@ -66,21 +65,21 @@ import java.util.UUID;
|
||||
* @see PS
|
||||
*/
|
||||
public class PlotAPI {
|
||||
|
||||
|
||||
/**
|
||||
* Permission that allows for admin access, this permission node will allow the player to use any part of the
|
||||
* plugin, without limitations.
|
||||
* @deprecated Use C.PERMISSION_ADMIN.s() instead
|
||||
* @deprecated Use C.PERMISSION_ADMIN instead
|
||||
*/
|
||||
@Deprecated
|
||||
public static final String ADMIN_PERMISSION = C.PERMISSION_ADMIN.s();
|
||||
|
||||
|
||||
/**
|
||||
* @deprecated Use new PlotAPI() instead
|
||||
*/
|
||||
@Deprecated
|
||||
public PlotAPI(final JavaPlugin plugin) {}
|
||||
|
||||
|
||||
/**
|
||||
* @see PS
|
||||
*
|
||||
@ -93,7 +92,7 @@ public class PlotAPI {
|
||||
*/
|
||||
@Deprecated
|
||||
public PlotAPI() {}
|
||||
|
||||
|
||||
/**
|
||||
* Get all plots
|
||||
*
|
||||
@ -104,7 +103,7 @@ public class PlotAPI {
|
||||
public Set<Plot> getAllPlots() {
|
||||
return PS.get().getPlots();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return all plots for a player
|
||||
*
|
||||
@ -115,7 +114,7 @@ public class PlotAPI {
|
||||
public Set<Plot> getPlayerPlots(final Player player) {
|
||||
return PS.get().getPlots(BukkitUtil.getPlayer(player));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add a plot world
|
||||
*
|
||||
@ -125,7 +124,7 @@ public class PlotAPI {
|
||||
public void addPlotArea(final PlotArea plotArea) {
|
||||
PS.get().addPlotArea(plotArea);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return main configuration
|
||||
*
|
||||
@ -134,7 +133,7 @@ public class PlotAPI {
|
||||
public YamlConfiguration getConfig() {
|
||||
return PS.get().config;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return storage configuration
|
||||
*
|
||||
@ -143,7 +142,7 @@ public class PlotAPI {
|
||||
public YamlConfiguration getStorage() {
|
||||
return PS.get().storage;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 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
|
||||
@ -155,7 +154,7 @@ public class PlotAPI {
|
||||
public PS getMain() {
|
||||
return PS.get();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* ChunkManager class contains several useful methods<br>
|
||||
* - Chunk deletion<br>
|
||||
@ -179,7 +178,7 @@ public class PlotAPI {
|
||||
public SetQueue getSetQueue() {
|
||||
return SetQueue.IMP;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 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() {
|
||||
return UUIDHandler.getUUIDWrapper();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Do not use this. Instead use FlagManager.[method] in your code.
|
||||
* - Flag related stuff
|
||||
@ -203,7 +202,7 @@ public class PlotAPI {
|
||||
public FlagManager getFlagManager() {
|
||||
return new FlagManager();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Do not use this. Instead use MainUtil.[method] in your code.
|
||||
* - Basic plot management stuff
|
||||
@ -216,7 +215,7 @@ public class PlotAPI {
|
||||
public MainUtil getMainUtil() {
|
||||
return new MainUtil();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Do not use this. Instead use C.PERMISSION_[method] in your code.
|
||||
* - Basic permission management stuff
|
||||
@ -235,7 +234,7 @@ public class PlotAPI {
|
||||
}
|
||||
return perms.toArray(new String[perms.size()]);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* SchematicHandler class contains methods related to pasting, reading and writing schematics
|
||||
*
|
||||
@ -246,7 +245,7 @@ public class PlotAPI {
|
||||
public SchematicHandler getSchematicHandler() {
|
||||
return SchematicHandler.manager;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Use C.[caption] instead
|
||||
*
|
||||
@ -258,7 +257,7 @@ public class PlotAPI {
|
||||
public C[] getCaptions() {
|
||||
return C.values();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 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());
|
||||
}
|
||||
|
||||
|
||||
public Set<PlotArea> getPlotAreas(World world) {
|
||||
if (world == null) {
|
||||
return new HashSet<>();
|
||||
@ -308,7 +307,7 @@ public class PlotAPI {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 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
|
||||
@ -327,7 +326,7 @@ public class PlotAPI {
|
||||
}
|
||||
return getWorldSettings(world.getName());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the settings for a world (settings bundled in PlotArea class)
|
||||
*
|
||||
@ -354,7 +353,7 @@ public class PlotAPI {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Send a message to a player.
|
||||
*
|
||||
@ -367,7 +366,7 @@ public class PlotAPI {
|
||||
public void sendMessage(final Player player, final C c) {
|
||||
MainUtil.sendMessage(BukkitUtil.getPlayer(player), c);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 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) {
|
||||
MainUtil.sendMessage(BukkitUtil.getPlayer(player), string);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Send a message to the console. - Supports color codes
|
||||
*
|
||||
@ -390,7 +389,7 @@ public class PlotAPI {
|
||||
public void sendConsoleMessage(final String msg) {
|
||||
PS.log(msg);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Send a message to the console
|
||||
*
|
||||
@ -400,9 +399,9 @@ public class PlotAPI {
|
||||
* @see com.intellectualcrafters.plot.config.C
|
||||
*/
|
||||
public void sendConsoleMessage(final C c) {
|
||||
sendConsoleMessage(c.s());
|
||||
sendConsoleMessage(c);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Register a flag for use in plots
|
||||
*
|
||||
@ -414,7 +413,7 @@ public class PlotAPI {
|
||||
public void addFlag(final AbstractFlag flag) {
|
||||
FlagManager.addFlag(flag);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* get all the currently registered flags
|
||||
*
|
||||
@ -426,7 +425,7 @@ public class PlotAPI {
|
||||
public AbstractFlag[] getFlags() {
|
||||
return FlagManager.getFlags().toArray(new AbstractFlag[FlagManager.getFlags().size()]);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get a plot based on the ID
|
||||
*
|
||||
@ -449,7 +448,7 @@ public class PlotAPI {
|
||||
}
|
||||
return area.getPlot(new PlotId(x, z));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get a plot based on the location
|
||||
*
|
||||
@ -465,7 +464,7 @@ public class PlotAPI {
|
||||
}
|
||||
return BukkitUtil.getLocation(l).getPlot();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get a plot based on the player location
|
||||
*
|
||||
@ -479,7 +478,7 @@ public class PlotAPI {
|
||||
public Plot getPlot(final Player player) {
|
||||
return this.getPlot(player.getLocation());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 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) {
|
||||
return getPlots(world, player, true) != null && getPlots(world, player, true).length > 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get all plots for the player
|
||||
*
|
||||
@ -517,7 +516,7 @@ public class PlotAPI {
|
||||
}
|
||||
return pPlots.toArray(new Plot[pPlots.size()]);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get all plots for the world
|
||||
*
|
||||
@ -536,7 +535,7 @@ public class PlotAPI {
|
||||
Collection<Plot> plots = PS.get().getPlots(world.getName());
|
||||
return plots.toArray(new Plot[plots.size()]);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get all plot worlds
|
||||
*
|
||||
@ -548,7 +547,7 @@ public class PlotAPI {
|
||||
Set<String> plotWorldStrings = PS.get().getPlotWorldStrings();
|
||||
return plotWorldStrings.toArray(new String[plotWorldStrings.size()]);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get if plot world
|
||||
*
|
||||
@ -562,7 +561,7 @@ public class PlotAPI {
|
||||
public boolean isPlotWorld(final World world) {
|
||||
return PS.get().hasPlotArea(world.getName());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get plot locations
|
||||
*
|
||||
@ -578,7 +577,7 @@ public class PlotAPI {
|
||||
public Location[] getLocations(final Plot p) {
|
||||
return new Location[] { BukkitUtil.getLocation(p.getBottom()), BukkitUtil.getLocation(p.getTop()), BukkitUtil.getLocation(p.getHome()) };
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get home location
|
||||
*
|
||||
@ -591,7 +590,7 @@ public class PlotAPI {
|
||||
public Location getHomeLocation(final Plot p) {
|
||||
return BukkitUtil.getLocation(p.getHome());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get Bottom Location (min, min, min)
|
||||
*
|
||||
@ -607,14 +606,14 @@ public class PlotAPI {
|
||||
public Location getBottomLocation(final Plot p) {
|
||||
return BukkitUtil.getLocation(p.getBottom());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get Top Location (max, max, max)
|
||||
*
|
||||
* @param p Plot that you want to get the location for
|
||||
*
|
||||
* @return plot top location
|
||||
*
|
||||
*
|
||||
* @deprecated As merged plots may not have a rectangular shape
|
||||
*
|
||||
* @see Plot
|
||||
@ -623,7 +622,7 @@ public class PlotAPI {
|
||||
public Location getTopLocation(final Plot p) {
|
||||
return BukkitUtil.getLocation(p.getTop());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check whether or not a player is in a plot
|
||||
*
|
||||
@ -635,7 +634,7 @@ public class PlotAPI {
|
||||
public boolean isInPlot(final Player player) {
|
||||
return getPlot(player) != null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Register a subcommand
|
||||
*
|
||||
@ -650,7 +649,7 @@ public class PlotAPI {
|
||||
MainCommand.getInstance().createCommand(c);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the PlotSquared class
|
||||
*
|
||||
@ -661,7 +660,7 @@ public class PlotAPI {
|
||||
public PS getPlotSquared() {
|
||||
return PS.get();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the player plot count
|
||||
*
|
||||
@ -677,7 +676,7 @@ public class PlotAPI {
|
||||
}
|
||||
return BukkitUtil.getPlayer(player).getPlotCount(world.getName());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get a collection containing the players plots
|
||||
*
|
||||
@ -696,7 +695,7 @@ public class PlotAPI {
|
||||
}
|
||||
return BukkitUtil.getPlayer(player).getPlots(world.getName());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 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);
|
||||
return pp.getAllowedPlots();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the PlotPlayer for a player<br>
|
||||
* - 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) {
|
||||
return PlotPlayer.wrap(player);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 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) {
|
||||
return PlotPlayer.wrap(uuid);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the PlotPlayer for a username
|
||||
*
|
||||
@ -746,7 +745,7 @@ public class PlotAPI {
|
||||
public PlotPlayer wrapPlayer(final String player) {
|
||||
return PlotPlayer.wrap(player);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the PlotPlayer for an offline player<br>
|
||||
* Note that this will work if the player is offline, however not all functionality will work
|
||||
|
@ -87,7 +87,6 @@ import org.bukkit.generator.ChunkGenerator;
|
||||
import org.bukkit.metadata.MetadataValue;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
@ -97,12 +96,12 @@ import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
|
||||
|
||||
|
||||
public static BukkitMain THIS;
|
||||
public static WorldEditPlugin worldEdit;
|
||||
|
||||
|
||||
private int[] version;
|
||||
|
||||
|
||||
@Override
|
||||
public int[] getServerVersion() {
|
||||
if (version == null) {
|
||||
@ -123,20 +122,20 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
|
||||
}
|
||||
return version;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
THIS = this;
|
||||
new PS(this, "Bukkit");
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onDisable() {
|
||||
PS.get().disable();
|
||||
Bukkit.getScheduler().cancelTasks(this);
|
||||
THIS = null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void log(String message) {
|
||||
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));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void disable() {
|
||||
if (THIS != null) {
|
||||
onDisable();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int[] getPluginVersion() {
|
||||
final String[] split = getDescription().getVersion().split("\\.");
|
||||
return new int[] { Integer.parseInt(split[0]), Integer.parseInt(split[1]), Integer.parseInt(split[2]) };
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void registerCommands() {
|
||||
final BukkitCommand bcmd = new BukkitCommand();
|
||||
@ -174,25 +173,25 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
|
||||
plotCommand.setTabCompleter(bcmd);
|
||||
MainCommand.getInstance().addCommand(new DebugUUID());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public File getDirectory() {
|
||||
return getDataFolder();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public File getWorldContainer() {
|
||||
return Bukkit.getWorldContainer();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public TaskManager getTaskManager() {
|
||||
return new BukkitTaskManager();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void runEntityTask() {
|
||||
log(C.PREFIX.s() + "KillAllEntities started.");
|
||||
log(C.PREFIX + "KillAllEntities started.");
|
||||
TaskManager.runTaskRepeat(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
@ -335,7 +334,7 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
|
||||
}
|
||||
}, 20);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
final public ChunkGenerator getDefaultWorldGenerator(final String world, final String id) {
|
||||
final HybridGen result = new HybridGen();
|
||||
@ -344,7 +343,7 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
|
||||
}
|
||||
return (ChunkGenerator) result.specify();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void registerPlayerEvents() {
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void registerInventoryEvents() {
|
||||
// Part of PlayerEvents - can be moved if necessary
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void registerPlotPlusEvents() {
|
||||
PlotPlusListener.startRunnable(this);
|
||||
getServer().getPluginManager().registerEvents(new PlotPlusListener(), this);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void registerForceFieldEvents() {
|
||||
getServer().getPluginManager().registerEvents(new ForceFieldListener(), this);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean initWorldEdit() {
|
||||
if (getServer().getPluginManager().getPlugin("WorldEdit") != null) {
|
||||
@ -388,7 +387,7 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public EconHandler getEconomyHandler() {
|
||||
try {
|
||||
@ -400,7 +399,7 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public PlotQueue initPlotQueue() {
|
||||
try {
|
||||
@ -439,12 +438,12 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
|
||||
return new SlowQueue();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public WorldUtil initWorldUtil() {
|
||||
return new BukkitUtil();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean initPlotMeConverter() {
|
||||
TaskManager.runTaskLaterAsync(new Runnable() {
|
||||
@ -463,7 +462,7 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
|
||||
}, 20);
|
||||
return (Bukkit.getPluginManager().getPlugin("PlotMe") != null) || (Bukkit.getPluginManager().getPlugin("AthionPlots") != null);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public GeneratorWrapper<?> getGenerator(final String world, final String name) {
|
||||
if (name == null) {
|
||||
@ -480,17 +479,17 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
|
||||
return new BukkitPlotGenerator(new HybridGen());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public HybridUtils initHybridUtils() {
|
||||
return new BukkitHybridUtils();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public SetupUtils initSetupUtils() {
|
||||
return new BukkitSetupUtils();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public UUIDHandlerImplementation initUUIDHandler() {
|
||||
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;
|
||||
}
|
||||
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;
|
||||
FlagManager.removeFlag(FlagManager.getFlag("titles"));
|
||||
} else {
|
||||
@ -524,59 +523,59 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
|
||||
}
|
||||
}
|
||||
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 {
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public ChunkManager initChunkManager() {
|
||||
return new BukkitChunkManager();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public EventUtil initEventUtil() {
|
||||
return new BukkitEventUtil();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void unregister(final PlotPlayer player) {
|
||||
BukkitUtil.removePlayer(player.getName());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void registerChunkProcessor() {
|
||||
getServer().getPluginManager().registerEvents(new ChunkListener(), this);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void registerWorldEvents() {
|
||||
getServer().getPluginManager().registerEvents(new WorldEvents(), this);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public InventoryUtil initInventoryUtil() {
|
||||
return new BukkitInventoryUtil();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getServerName() {
|
||||
return Bukkit.getServerName();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void startMetrics() {
|
||||
try {
|
||||
Metrics metrics = new Metrics(this);
|
||||
metrics.start();
|
||||
log(C.PREFIX.s() + "&6Metrics enabled.");
|
||||
log(C.PREFIX + "&6Metrics enabled.");
|
||||
} catch (IOException e) {
|
||||
log(C.PREFIX.s() + "&cFailed to load up metrics.");
|
||||
log(C.PREFIX + "&cFailed to load up metrics.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setGenerator(final String worldname) {
|
||||
World world = BukkitUtil.getWorld(worldname);
|
||||
@ -615,18 +614,18 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
|
||||
PS.get().loadWorld(worldname, null);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public SchematicHandler initSchematicHandler() {
|
||||
return new BukkitSchematicHandler();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public AbstractTitle initTitleManager() {
|
||||
// Already initialized in UUID handler
|
||||
return AbstractTitle.TITLE_CLASS;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public PlotPlayer wrapPlayer(final Object obj) {
|
||||
if (obj instanceof Player) {
|
||||
@ -640,13 +639,13 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getNMSPackage() {
|
||||
String name = Bukkit.getServer().getClass().getPackage().getName();
|
||||
return name.substring(name.lastIndexOf('.') + 1);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public ChatManager<?> initChatManager() {
|
||||
if (Settings.FANCY_CHAT) {
|
||||
@ -655,12 +654,12 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
|
||||
return new BukkitPlainChatManager();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public GeneratorWrapper<?> wrapPlotGenerator(IndependentPlotGenerator generator) {
|
||||
return new BukkitPlotGenerator(generator);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<String> getPluginIds() {
|
||||
ArrayList<String> names = new ArrayList<>();
|
||||
|
@ -42,7 +42,6 @@ import com.plotsquared.bukkit.uuid.LowerOfflineUUIDWrapper;
|
||||
import com.plotsquared.bukkit.uuid.OfflineUUIDWrapper;
|
||||
import com.plotsquared.general.commands.Argument;
|
||||
import com.plotsquared.general.commands.CommandDeclaration;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FilenameFilter;
|
||||
import java.io.IOException;
|
||||
@ -63,16 +62,16 @@ usage = "/plot uuidconvert <lower|offline|online>",
|
||||
requiredType = RequiredType.CONSOLE,
|
||||
category = CommandCategory.DEBUG)
|
||||
public class DebugUUID extends SubCommand {
|
||||
|
||||
|
||||
public DebugUUID() {
|
||||
requiredArguments = new Argument[] { Argument.String };
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onCommand(final PlotPlayer player, final String[] args) {
|
||||
final UUIDWrapper currentUUIDWrapper = UUIDHandler.getUUIDWrapper();
|
||||
final UUIDWrapper newWrapper;
|
||||
|
||||
|
||||
switch (args[0].toLowerCase()) {
|
||||
case "lower":
|
||||
newWrapper = new LowerOfflineUUIDWrapper();
|
||||
@ -104,7 +103,7 @@ public class DebugUUID extends SubCommand {
|
||||
MainUtil.sendMessage(player, "&7Retype the command with the override parameter when ready :)");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
if (currentUUIDWrapper.getClass().getCanonicalName().equals(newWrapper.getClass().getCanonicalName())) {
|
||||
MainUtil.sendMessage(player, "&cUUID mode already in use!");
|
||||
return false;
|
||||
@ -114,14 +113,14 @@ public class DebugUUID extends SubCommand {
|
||||
for (Entry<String, PlotPlayer> entry : UUIDHandler.getPlayers().entrySet()) {
|
||||
entry.getValue().kick("PlotSquared UUID conversion has been initiated. You may reconnect when finished.");
|
||||
}
|
||||
|
||||
|
||||
MainUtil.sendMessage(player, "&7 - Initializing map");
|
||||
|
||||
final HashMap<UUID, UUID> uCMap = new HashMap<>();
|
||||
final HashMap<UUID, UUID> uCReverse = new HashMap<>();
|
||||
|
||||
|
||||
MainUtil.sendMessage(player, "&7 - Collecting playerdata");
|
||||
|
||||
|
||||
final HashSet<String> worlds = new HashSet<>();
|
||||
worlds.add(WorldUtil.IMP.getMainWorld());
|
||||
worlds.add("world");
|
||||
@ -142,7 +141,7 @@ public class DebugUUID extends SubCommand {
|
||||
final UUID uuid = UUID.fromString(s);
|
||||
uuids.add(uuid);
|
||||
} 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");
|
||||
@ -158,7 +157,7 @@ public class DebugUUID extends SubCommand {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
MainUtil.sendMessage(player, "&7 - Populating map");
|
||||
UUID uuid2;
|
||||
final UUIDWrapper wrapper = new DefaultUUIDWrapper();
|
||||
@ -172,7 +171,7 @@ public class DebugUUID extends SubCommand {
|
||||
uCReverse.put(uuid2, uuid);
|
||||
}
|
||||
} 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) {
|
||||
@ -204,7 +203,7 @@ public class DebugUUID extends SubCommand {
|
||||
MainUtil.sendMessage(player, "&a - Successfully repopulated");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
MainUtil.sendMessage(player, "&7 - Replacing cache");
|
||||
TaskManager.runTaskAsync(new Runnable() {
|
||||
@Override
|
||||
@ -215,9 +214,9 @@ public class DebugUUID extends SubCommand {
|
||||
UUIDHandler.add(new StringWrapper(name), entry.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
MainUtil.sendMessage(player, "&7 - Scanning for applicable files (uuids.txt)");
|
||||
|
||||
|
||||
final File file = new File(PS.get().IMP.getDirectory(), "uuids.txt");
|
||||
if (file.exists()) {
|
||||
try {
|
||||
@ -250,12 +249,12 @@ public class DebugUUID extends SubCommand {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
MainUtil.sendMessage(player, "&7 - Replacing wrapper");
|
||||
UUIDHandler.setUUIDWrapper(newWrapper);
|
||||
|
||||
|
||||
MainUtil.sendMessage(player, "&7 - Updating plot objects");
|
||||
|
||||
|
||||
for (final Plot plot : PS.get().getPlots()) {
|
||||
final UUID value = uCMap.get(plot.owner);
|
||||
if (value != null) {
|
||||
@ -265,13 +264,13 @@ public class DebugUUID extends SubCommand {
|
||||
plot.getMembers().clear();
|
||||
plot.getDenied().clear();
|
||||
}
|
||||
|
||||
|
||||
MainUtil.sendMessage(player, "&7 - Deleting database");
|
||||
final AbstractDB database = DBFunc.dbManager;
|
||||
final boolean result = database.deleteTables();
|
||||
|
||||
|
||||
MainUtil.sendMessage(player, "&7 - Creating tables");
|
||||
|
||||
|
||||
try {
|
||||
database.createTables();
|
||||
if (!result) {
|
||||
@ -294,7 +293,7 @@ public class DebugUUID extends SubCommand {
|
||||
e.printStackTrace();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (newWrapper instanceof OfflineUUIDWrapper) {
|
||||
PS.get().config.set("UUID.force-lowercase", false);
|
||||
PS.get().config.set("UUID.offline", true);
|
||||
@ -307,9 +306,9 @@ public class DebugUUID extends SubCommand {
|
||||
} catch (IOException e) {
|
||||
MainUtil.sendMessage(player, "Could not save configuration. It will need to be manuall set!");
|
||||
}
|
||||
|
||||
|
||||
MainUtil.sendMessage(player, "&7 - Populating tables");
|
||||
|
||||
|
||||
TaskManager.runTaskAsync(new Runnable() {
|
||||
@Override
|
||||
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, "&cConversion is still in progress, you will be notified when it is complete");
|
||||
}
|
||||
|
@ -10,12 +10,15 @@ import com.intellectualcrafters.plot.database.DBFunc;
|
||||
import com.intellectualcrafters.plot.object.OfflinePlotPlayer;
|
||||
import com.intellectualcrafters.plot.object.RunnableVal;
|
||||
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.plotsquared.bukkit.util.NbtFactory;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.World;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FilenameFilter;
|
||||
@ -28,16 +31,16 @@ import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
public class FileUUIDHandler extends UUIDHandlerImplementation {
|
||||
|
||||
|
||||
public FileUUIDHandler(final UUIDWrapper wrapper) {
|
||||
super(wrapper);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean startCaching(final Runnable whenDone) {
|
||||
return super.startCaching(whenDone) && cache(whenDone);
|
||||
}
|
||||
|
||||
|
||||
public boolean cache(final Runnable whenDone) {
|
||||
final File container = Bukkit.getWorldContainer();
|
||||
final List<World> worlds = Bukkit.getWorlds();
|
||||
@ -50,7 +53,7 @@ public class FileUUIDHandler extends UUIDHandlerImplementation {
|
||||
TaskManager.runTaskAsync(new Runnable() {
|
||||
@Override
|
||||
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");
|
||||
if (uuidfile.exists()) {
|
||||
try {
|
||||
@ -112,7 +115,7 @@ public class FileUUIDHandler extends UUIDHandlerImplementation {
|
||||
}
|
||||
} catch (final Exception e) {
|
||||
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);
|
||||
uuids.add(uuid);
|
||||
} catch (final Exception e) {
|
||||
PS.debug(C.PREFIX.s() + "Invalid playerdata: " + current);
|
||||
PS.debug(C.PREFIX + "Invalid playerdata: " + current);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -195,7 +198,7 @@ public class FileUUIDHandler extends UUIDHandlerImplementation {
|
||||
}
|
||||
toAdd.put(new StringWrapper(name), uuid);
|
||||
} 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) {
|
||||
@ -226,7 +229,7 @@ public class FileUUIDHandler extends UUIDHandlerImplementation {
|
||||
});
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void fetchUUID(final String name, final RunnableVal<UUID> ifFetch) {
|
||||
TaskManager.runTaskAsync(new Runnable() {
|
||||
|
@ -30,7 +30,7 @@ import java.util.HashMap;
|
||||
import java.util.UUID;
|
||||
|
||||
public class SQLUUIDHandler extends UUIDHandlerImplementation {
|
||||
|
||||
|
||||
final String PROFILE_URL = "https://sessionserver.mojang.com/session/minecraft/profile/";
|
||||
final int MAX_REQUESTS = 500;
|
||||
final int INTERVAL = 12000;
|
||||
@ -56,13 +56,13 @@ public class SQLUUIDHandler extends UUIDHandlerImplementation {
|
||||
}
|
||||
startCaching(null);
|
||||
}
|
||||
|
||||
|
||||
private Connection getConnection() {
|
||||
synchronized (_sqLite) {
|
||||
return _sqLite.getConnection();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean startCaching(final Runnable whenDone) {
|
||||
if (!super.startCaching(whenDone)) {
|
||||
@ -192,10 +192,10 @@ public class SQLUUIDHandler extends UUIDHandlerImplementation {
|
||||
});
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
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) {
|
||||
return;
|
||||
}
|
||||
@ -227,7 +227,7 @@ public class SQLUUIDHandler extends UUIDHandlerImplementation {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void handleShutdown() {
|
||||
super.handleShutdown();
|
||||
@ -237,7 +237,7 @@ public class SQLUUIDHandler extends UUIDHandlerImplementation {
|
||||
throw new SQLUUIDHandlerException("Couldn't close database connection", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean add(final StringWrapper name, final UUID uuid) {
|
||||
// Ignoring duplicates
|
||||
@ -250,7 +250,7 @@ public class SQLUUIDHandler extends UUIDHandlerImplementation {
|
||||
statement.setString(1, uuid.toString());
|
||||
statement.setString(2, name.toString());
|
||||
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) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@ -260,7 +260,7 @@ public class SQLUUIDHandler extends UUIDHandlerImplementation {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This is useful for name changes
|
||||
*/
|
||||
@ -275,7 +275,7 @@ public class SQLUUIDHandler extends UUIDHandlerImplementation {
|
||||
statement.setString(1, name.value);
|
||||
statement.setString(2, uuid.toString());
|
||||
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) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
@ -54,7 +54,6 @@ import com.intellectualcrafters.plot.util.WorldUtil;
|
||||
import com.intellectualcrafters.plot.util.area.QuadMap;
|
||||
import com.plotsquared.listener.WESubscriber;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
@ -165,7 +164,7 @@ public class PS {
|
||||
}
|
||||
TASK = IMP.getTaskManager();
|
||||
if (!C.ENABLED.s().isEmpty()) {
|
||||
log(C.ENABLED.s());
|
||||
log(C.ENABLED);
|
||||
}
|
||||
setupConfigs();
|
||||
translationFile = new File(IMP.getDirectory() + File.separator + "translations" + File.separator + "PlotSquared.use_THIS.yml");
|
||||
@ -1370,10 +1369,10 @@ public class PS {
|
||||
// Conventional plot generator
|
||||
PlotArea plotArea = pg.getNewPlotArea(world, null, null, null);
|
||||
PlotManager plotManager = pg.getNewPlotManager();
|
||||
log(C.PREFIX.s() + "&aDetected world load for '" + world + "'");
|
||||
log(C.PREFIX.s() + "&3 - generator: &7" + baseGenerator + ">" + pg);
|
||||
log(C.PREFIX.s() + "&3 - plotworld: &7" + plotArea.getClass().getName());
|
||||
log(C.PREFIX.s() + "&3 - manager: &7" + plotManager.getClass().getName());
|
||||
log(C.PREFIX + "&aDetected world load for '" + world + "'");
|
||||
log(C.PREFIX + "&3 - generator: &7" + baseGenerator + ">" + pg);
|
||||
log(C.PREFIX + "&3 - plotworld: &7" + plotArea.getClass().getName());
|
||||
log(C.PREFIX + "&3 - manager: &7" + plotManager.getClass().getName());
|
||||
if (!config.contains(path)) {
|
||||
config.createSection(path);
|
||||
worldSection = config.getConfigurationSection(path);
|
||||
@ -1399,7 +1398,7 @@ public class PS {
|
||||
PS.debug("World possibly already loaded: " + world);
|
||||
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");
|
||||
if (type == 2) {
|
||||
Set<PlotCluster> clusters = clusters_tmp != null ? clusters_tmp.get(world) : new HashSet<PlotCluster>();
|
||||
@ -1415,7 +1414,7 @@ public class PS {
|
||||
worldSection.createSection("areas." + fullId);
|
||||
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);
|
||||
if (areaGen == null) {
|
||||
throw new IllegalArgumentException("Invalid Generator: " + gen_string);
|
||||
@ -1428,10 +1427,10 @@ public class PS {
|
||||
} catch (final IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
log(C.PREFIX.s() + "&c | &9generator: &7" + baseGenerator + ">" + areaGen);
|
||||
log(C.PREFIX.s() + "&c | &9plotworld: &7" + pa);
|
||||
log(C.PREFIX.s() + "&c | &9manager: &7" + pa);
|
||||
log(C.PREFIX.s() + "&cNote: &7Area created for cluster:" + name + " (invalid or old configuration?)");
|
||||
log(C.PREFIX + "&c | &9generator: &7" + baseGenerator + ">" + areaGen);
|
||||
log(C.PREFIX + "&c | &9plotworld: &7" + pa);
|
||||
log(C.PREFIX + "&c | &9manager: &7" + pa);
|
||||
log(C.PREFIX + "&cNote: &7Area created for cluster:" + name + " (invalid or old configuration?)");
|
||||
areaGen.getPlotGenerator().initialize(pa);
|
||||
areaGen.augment(pa);
|
||||
toLoad.add(pa);
|
||||
@ -1453,9 +1452,9 @@ public class PS {
|
||||
} catch (final IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
log(C.PREFIX.s() + "&3 - generator: &7" + baseGenerator + ">" + areaGen);
|
||||
log(C.PREFIX.s() + "&3 - plotworld: &7" + pa);
|
||||
log(C.PREFIX.s() + "&3 - manager: &7" + pa.getPlotManager());
|
||||
log(C.PREFIX + "&3 - generator: &7" + baseGenerator + ">" + areaGen);
|
||||
log(C.PREFIX + "&3 - plotworld: &7" + pa);
|
||||
log(C.PREFIX + "&3 - manager: &7" + pa.getPlotManager());
|
||||
areaGen.getPlotGenerator().initialize(pa);
|
||||
areaGen.augment(pa);
|
||||
addPlotArea(pa);
|
||||
@ -1465,7 +1464,7 @@ public class PS {
|
||||
throw new IllegalArgumentException("Invalid type for multi-area world. Expected `2`, got `" + type + "`");
|
||||
}
|
||||
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+)");
|
||||
if (split.length != 3) {
|
||||
throw new IllegalArgumentException("Invalid Area identifier: " + areaId + ". Expected form `<name>-<pos1>-<pos2>`");
|
||||
@ -1524,10 +1523,10 @@ public class PS {
|
||||
} catch (final IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
log(C.PREFIX.s() + "&aDetected area load for '" + world + "'");
|
||||
log(C.PREFIX.s() + "&c | &9generator: &7" + baseGenerator + ">" + areaGen);
|
||||
log(C.PREFIX.s() + "&c | &9plotworld: &7" + pa);
|
||||
log(C.PREFIX.s() + "&c | &9manager: &7" + pa.getPlotManager());
|
||||
log(C.PREFIX + "&aDetected area load for '" + world + "'");
|
||||
log(C.PREFIX + "&c | &9generator: &7" + baseGenerator + ">" + areaGen);
|
||||
log(C.PREFIX + "&c | &9plotworld: &7" + pa);
|
||||
log(C.PREFIX + "&c | &9manager: &7" + pa.getPlotManager());
|
||||
areaGen.getPlotGenerator().initialize(pa);
|
||||
areaGen.augment(pa);
|
||||
addPlotArea(pa);
|
||||
@ -1764,7 +1763,7 @@ public class PS {
|
||||
public void setupDatabase() {
|
||||
try {
|
||||
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!");
|
||||
IMP.disable();
|
||||
return;
|
||||
@ -1786,7 +1785,7 @@ public class PS {
|
||||
this.clusters_tmp = DBFunc.getClusters();
|
||||
}
|
||||
} 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) {
|
||||
log("$4MONGO");
|
||||
} else if (Settings.DB.USE_MYSQL) {
|
||||
@ -2195,7 +2194,7 @@ public class PS {
|
||||
// Misc
|
||||
Settings.DEBUG = config.getBoolean("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");
|
||||
if (!config.getBoolean("chat.fancy") || !checkVersion(IMP.getServerVersion(), 1, 8, 0)) {
|
||||
@ -2216,7 +2215,7 @@ public class PS {
|
||||
public void setupConfigs() {
|
||||
final File folder = new File(IMP.getDirectory() + File.separator + "config");
|
||||
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 {
|
||||
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("API Location", "" + Settings.API_URL);
|
||||
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()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -26,7 +26,6 @@ import com.intellectualcrafters.plot.util.SetupUtils;
|
||||
import com.intellectualcrafters.plot.util.StringMan;
|
||||
import com.intellectualcrafters.plot.util.WorldUtil;
|
||||
import com.plotsquared.general.commands.CommandDeclaration;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Objects;
|
||||
@ -35,7 +34,7 @@ import java.util.Set;
|
||||
@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>")
|
||||
public class Area extends SubCommand {
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onCommand(final PlotPlayer plr, String[] args) {
|
||||
if (args.length == 0) {
|
||||
@ -380,7 +379,7 @@ public class Area extends SubCommand {
|
||||
.text("\nClusters=").color("$1").text("" + clusters).color("$2")
|
||||
.text("\nRegion=").color("$1").text(region).color("$2")
|
||||
.text("\nGenerator=").color("$1").text(generator).color("$2");
|
||||
|
||||
|
||||
// type / terrain
|
||||
String visit = "/plot area tp " + area.toString();
|
||||
message.text("[").color("$3")
|
||||
@ -457,5 +456,5 @@ public class Area extends SubCommand {
|
||||
C.COMMAND_SYNTAX.send(plr, getUsage());
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ aliases = { "biome", "sb", "setb", "b" },
|
||||
category = CommandCategory.APPEARANCE,
|
||||
requiredType = RequiredType.NONE)
|
||||
public class Biome extends SetCommand {
|
||||
|
||||
|
||||
@Override
|
||||
public boolean set(final PlotPlayer plr, final Plot plot, final String value) {
|
||||
final int biome = WorldUtil.IMP.getBiomeFromString(value);
|
||||
|
@ -33,7 +33,6 @@ import com.intellectualcrafters.plot.util.Permissions;
|
||||
import com.intellectualcrafters.plot.util.StringMan;
|
||||
import com.intellectualcrafters.plot.util.UUIDHandler;
|
||||
import com.plotsquared.general.commands.CommandDeclaration;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.UUID;
|
||||
|
||||
@ -43,7 +42,7 @@ import java.util.UUID;
|
||||
public class Merge extends SubCommand {
|
||||
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 static String direction(float yaw) {
|
||||
yaw = yaw / 90;
|
||||
final int i = Math.round(yaw);
|
||||
@ -65,7 +64,7 @@ public class Merge extends SubCommand {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onCommand(final PlotPlayer plr, final String[] args) {
|
||||
final Location loc = plr.getLocationFull();
|
||||
@ -131,7 +130,7 @@ public class Merge extends SubCommand {
|
||||
}
|
||||
MainUtil.sendMessage(plr, C.NO_AVAILABLE_AUTOMERGE);
|
||||
return false;
|
||||
|
||||
|
||||
}
|
||||
for (int i = 0; i < values.length; i++) {
|
||||
if (args[0].equalsIgnoreCase(values[i]) || args[0].equalsIgnoreCase(aliases[i])) {
|
||||
@ -165,7 +164,7 @@ public class Merge extends SubCommand {
|
||||
return false;
|
||||
}
|
||||
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;
|
||||
}
|
||||
HashSet<UUID> uuids = adjacent.getOwners();
|
||||
|
@ -23,22 +23,32 @@ package com.intellectualcrafters.plot.flag;
|
||||
import com.intellectualcrafters.plot.PS;
|
||||
import com.intellectualcrafters.plot.config.C;
|
||||
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.Permissions;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
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
|
||||
*
|
||||
*/
|
||||
public class FlagManager {
|
||||
|
||||
|
||||
private final static HashSet<String> reserved = new HashSet<>();
|
||||
|
||||
|
||||
private final static HashSet<AbstractFlag> flags = new HashSet<>();
|
||||
|
||||
|
||||
/**
|
||||
* Reserve a flag so that it cannot be set by players
|
||||
* @param flag
|
||||
@ -46,7 +56,7 @@ public class FlagManager {
|
||||
public static void reserveFlag(final String flag) {
|
||||
reserved.add(flag);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get if a flag is reserved
|
||||
* @param flag
|
||||
@ -55,7 +65,7 @@ public class FlagManager {
|
||||
public static boolean isReserved(final String flag) {
|
||||
return reserved.contains(flag);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the reserved flags
|
||||
* @return
|
||||
@ -63,7 +73,7 @@ public class FlagManager {
|
||||
public static HashSet<String> getReservedFlags() {
|
||||
return (HashSet<String>) reserved.clone();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Unreserve a flag
|
||||
* @param flag
|
||||
@ -71,7 +81,7 @@ public class FlagManager {
|
||||
public static void unreserveFlag(final String flag) {
|
||||
reserved.remove(flag);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Register an AbstractFlag with PlotSquared
|
||||
*
|
||||
@ -82,9 +92,9 @@ public class FlagManager {
|
||||
public static boolean addFlag(final AbstractFlag af) {
|
||||
return addFlag(af, false);
|
||||
}
|
||||
|
||||
|
||||
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>() {
|
||||
@Override
|
||||
public void run(PlotArea value) {
|
||||
@ -125,7 +135,7 @@ public class FlagManager {
|
||||
}
|
||||
return flag_string.toString();
|
||||
}
|
||||
|
||||
|
||||
public static Flag getSettingFlag(final PlotArea area, final PlotSettings settings, final String id) {
|
||||
Flag flag;
|
||||
if (settings.flags.isEmpty() || (flag = settings.flags.get(id)) == null) {
|
||||
@ -139,7 +149,7 @@ public class FlagManager {
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
|
||||
public static boolean isBooleanFlag(final Plot plot, final String key, final boolean defaultValue) {
|
||||
final Flag flag = FlagManager.getPlotFlagRaw(plot, key);
|
||||
if (flag == null) {
|
||||
@ -151,7 +161,7 @@ public class FlagManager {
|
||||
}
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the value of a flag for a plot (respects flag defaults)
|
||||
* @param plot
|
||||
@ -177,7 +187,7 @@ public class FlagManager {
|
||||
}
|
||||
return getSettingFlag(plot.getArea(), plot.getSettings(), flag);
|
||||
}
|
||||
|
||||
|
||||
public static boolean isPlotFlagTrue(final Plot plot, final String strFlag) {
|
||||
if (plot.owner == null) {
|
||||
return false;
|
||||
@ -185,7 +195,7 @@ public class FlagManager {
|
||||
final Flag flag = getPlotFlagRaw(plot, strFlag);
|
||||
return !(flag == null || !((Boolean) flag.getValue()));
|
||||
}
|
||||
|
||||
|
||||
public static boolean isPlotFlagFalse(final Plot plot, final String strFlag) {
|
||||
if (plot.owner == null) {
|
||||
return false;
|
||||
@ -196,7 +206,7 @@ public class FlagManager {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the value of a flag for a plot (ignores flag defaults)
|
||||
* @param plot
|
||||
@ -206,14 +216,14 @@ public class FlagManager {
|
||||
public static Flag getPlotFlagAbs(final Plot plot, final String flag) {
|
||||
return getSettingFlagAbs(plot.getSettings(), flag);
|
||||
}
|
||||
|
||||
|
||||
public static Flag getSettingFlagAbs(final PlotSettings settings, final String flag) {
|
||||
if (settings.flags.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
return settings.flags.get(flag);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add a flag to a plot
|
||||
* @param origin
|
||||
@ -231,7 +241,7 @@ public class FlagManager {
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public static boolean addPlotFlagAbs(final Plot plot, final Flag flag) {
|
||||
final boolean result = EventUtil.manager.callFlagAdd(flag, plot);
|
||||
if (!result) {
|
||||
@ -240,14 +250,14 @@ public class FlagManager {
|
||||
plot.getFlags().put(flag.getKey(), flag);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public static boolean addClusterFlag(final PlotCluster cluster, final Flag flag) {
|
||||
getSettingFlag(cluster.area, cluster.settings, flag.getKey());
|
||||
cluster.settings.flags.put(flag.getKey(), flag);
|
||||
DBFunc.setFlags(cluster, cluster.settings.flags.values());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @param plot
|
||||
@ -259,7 +269,7 @@ public class FlagManager {
|
||||
}
|
||||
return getSettingFlags(plot.getArea(), plot.getSettings());
|
||||
}
|
||||
|
||||
|
||||
public static HashMap<String, Flag> getPlotFlags(PlotArea area, final PlotSettings settings, final boolean ignorePluginflags) {
|
||||
final HashMap<String, Flag> flags = new HashMap<>();
|
||||
if (area != null && !area.DEFAULT_FLAGS.isEmpty()) {
|
||||
@ -275,14 +285,14 @@ public class FlagManager {
|
||||
} else {
|
||||
flags.putAll(settings.flags);
|
||||
}
|
||||
|
||||
|
||||
return flags;
|
||||
}
|
||||
|
||||
|
||||
public static HashMap<String, Flag> getSettingFlags(PlotArea area, final PlotSettings settings) {
|
||||
return getPlotFlags(area, settings, false);
|
||||
}
|
||||
|
||||
|
||||
public static boolean removePlotFlag(final Plot plot, final String id) {
|
||||
final Flag flag = plot.getFlags().remove(id);
|
||||
if (flag == null) {
|
||||
@ -297,7 +307,7 @@ public class FlagManager {
|
||||
DBFunc.setFlags(plot, plot.getFlags().values());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public static boolean removeClusterFlag(final PlotCluster cluster, final String id) {
|
||||
final Flag flag = cluster.settings.flags.remove(id);
|
||||
if (flag == null) {
|
||||
@ -311,7 +321,7 @@ public class FlagManager {
|
||||
DBFunc.setFlags(cluster, cluster.settings.flags.values());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public static void setPlotFlags(final Plot origin, final Set<Flag> flags) {
|
||||
for (Plot plot : origin.getConnectedPlots()) {
|
||||
if (flags != null && !flags.isEmpty()) {
|
||||
@ -328,7 +338,7 @@ public class FlagManager {
|
||||
DBFunc.setFlags(plot, plot.getFlags().values());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static void setClusterFlags(final PlotCluster cluster, final Set<Flag> flags) {
|
||||
if (flags != null && !flags.isEmpty()) {
|
||||
cluster.settings.flags.clear();
|
||||
@ -342,7 +352,7 @@ public class FlagManager {
|
||||
}
|
||||
DBFunc.setFlags(cluster, cluster.settings.flags.values());
|
||||
}
|
||||
|
||||
|
||||
public static Flag[] removeFlag(final Flag[] flags, final String r) {
|
||||
final Flag[] f = new Flag[flags.length - 1];
|
||||
int index = 0;
|
||||
@ -353,7 +363,7 @@ public class FlagManager {
|
||||
}
|
||||
return f;
|
||||
}
|
||||
|
||||
|
||||
public static Set<Flag> removeFlag(final Set<Flag> flags, final String r) {
|
||||
final HashSet<Flag> newflags = new HashSet<>();
|
||||
for (final Flag flag : flags) {
|
||||
@ -363,7 +373,7 @@ public class FlagManager {
|
||||
}
|
||||
return newflags;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get a list of registered AbstractFlag objects
|
||||
*
|
||||
@ -372,7 +382,7 @@ public class FlagManager {
|
||||
public static HashSet<AbstractFlag> getFlags() {
|
||||
return flags;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get a list of registered AbstractFlag objects based on player permissions
|
||||
*
|
||||
@ -389,7 +399,7 @@ public class FlagManager {
|
||||
}
|
||||
return returnFlags;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get an AbstractFlag by a string Returns null if flag does not exist
|
||||
*
|
||||
@ -405,7 +415,7 @@ public class FlagManager {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get an AbstractFlag by a string
|
||||
*
|
||||
@ -420,7 +430,7 @@ public class FlagManager {
|
||||
}
|
||||
return getFlag(string);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Remove a registered AbstractFlag
|
||||
*
|
||||
@ -431,7 +441,7 @@ public class FlagManager {
|
||||
public static boolean removeFlag(final AbstractFlag flag) {
|
||||
return flags.remove(flag);
|
||||
}
|
||||
|
||||
|
||||
public static HashMap<String, Flag> parseFlags(final List<String> flagstrings) {
|
||||
final HashMap<String, Flag> map = new HashMap<>();
|
||||
for (final String key : flagstrings) {
|
||||
|
@ -32,7 +32,6 @@ import com.intellectualcrafters.plot.util.MathMan;
|
||||
import com.intellectualcrafters.plot.util.SchematicHandler;
|
||||
import com.intellectualcrafters.plot.util.SchematicHandler.Dimension;
|
||||
import com.intellectualcrafters.plot.util.SchematicHandler.Schematic;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
@ -177,7 +176,7 @@ public class HybridPlotWorld extends ClassicPlotWorld {
|
||||
PS.debug("&c - road schematics are disabled for this world.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isCompatible(PlotArea plotworld) {
|
||||
if (!(plotworld instanceof SquarePlotWorld)) {
|
||||
@ -250,7 +249,7 @@ public class HybridPlotWorld extends ClassicPlotWorld {
|
||||
}
|
||||
}
|
||||
if (schem1 == null || schem2 == null || ROAD_WIDTH == 0) {
|
||||
PS.debug(C.PREFIX.s() + "&3 - schematic: &7false");
|
||||
PS.debug(C.PREFIX + "&3 - schematic: &7false");
|
||||
return;
|
||||
}
|
||||
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) {
|
||||
if (z < 0) {
|
||||
z += SIZE;
|
||||
|
@ -34,7 +34,7 @@ import java.util.Set;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
public abstract class HybridUtils {
|
||||
|
||||
|
||||
public static HybridUtils manager;
|
||||
public static Set<ChunkLoc> regions;
|
||||
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 final ArrayList<ChunkLoc> getChunks(final ChunkLoc region) {
|
||||
final ArrayList<ChunkLoc> chunks = new ArrayList<>();
|
||||
final int sx = region.x << 5;
|
||||
@ -122,7 +122,7 @@ public abstract class HybridUtils {
|
||||
}
|
||||
return chunks;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Checks all connected plots
|
||||
* @param plot
|
||||
@ -145,7 +145,7 @@ public abstract class HybridUtils {
|
||||
@Override
|
||||
public void run() {
|
||||
if (zones.isEmpty()) {
|
||||
|
||||
|
||||
TaskManager.runTask(whenDone);
|
||||
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) });
|
||||
}
|
||||
}, this, 5);
|
||||
|
||||
|
||||
}
|
||||
};
|
||||
run.run();
|
||||
}
|
||||
|
||||
|
||||
public boolean scheduleRoadUpdate(final PlotArea area, final int extend) {
|
||||
if (HybridUtils.UPDATE) {
|
||||
return false;
|
||||
@ -181,7 +181,7 @@ public abstract class HybridUtils {
|
||||
final Set<ChunkLoc> regions = ChunkManager.manager.getChunkChunks(area.worldname);
|
||||
return scheduleRoadUpdate(area, regions, extend);
|
||||
}
|
||||
|
||||
|
||||
public boolean scheduleRoadUpdate(final PlotArea area, final Set<ChunkLoc> rgs, final int extend) {
|
||||
HybridUtils.regions = rgs;
|
||||
HybridUtils.area = area;
|
||||
@ -210,7 +210,7 @@ public abstract class HybridUtils {
|
||||
}
|
||||
if (regions.isEmpty() && chunks.isEmpty()) {
|
||||
HybridUtils.UPDATE = false;
|
||||
PS.debug(C.PREFIX.s() + "Finished road conversion");
|
||||
PS.debug(C.PREFIX + "Finished road conversion");
|
||||
// CANCEL TASK
|
||||
} else {
|
||||
final Runnable task = this;
|
||||
@ -236,7 +236,7 @@ public abstract class HybridUtils {
|
||||
final long diff = System.currentTimeMillis() + 1;
|
||||
if (((System.currentTimeMillis() - baseTime - last.get()) > 2000) && (last.get() != 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();
|
||||
final ChunkLoc chunk = iter.next();
|
||||
iter.remove();
|
||||
@ -294,7 +294,7 @@ public abstract class HybridUtils {
|
||||
});
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public boolean setupRoadSchematic(final Plot plot) {
|
||||
final String world = plot.getArea().worldname;
|
||||
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 tz = sz - 1;
|
||||
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> intersection = new HashSet<>(Collections.singletonList(new RegionWrapper(sx, ex, sy, ty, bz, tz)));
|
||||
|
||||
@ -331,9 +331,9 @@ public abstract class HybridUtils {
|
||||
});
|
||||
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 boolean regenerateRoad(final PlotArea area, final ChunkLoc chunk, int extend) {
|
||||
int x = chunk.x << 4;
|
||||
int z = chunk.z << 4;
|
||||
|
@ -14,7 +14,6 @@ import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||
import com.intellectualcrafters.plot.object.RunnableVal;
|
||||
import com.intellectualcrafters.plot.object.StringWrapper;
|
||||
import com.intellectualcrafters.plot.uuid.UUIDWrapper;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
@ -29,19 +28,19 @@ public abstract class UUIDHandlerImplementation {
|
||||
public UUIDWrapper uuidWrapper = null;
|
||||
public HashSet<UUID> unknown = new HashSet<>();
|
||||
private BiMap<StringWrapper, UUID> uuidMap = HashBiMap.create(new HashMap<StringWrapper, UUID>());
|
||||
|
||||
|
||||
public UUIDHandlerImplementation(final UUIDWrapper wrapper) {
|
||||
uuidWrapper = wrapper;
|
||||
players = new ConcurrentHashMap<>();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* If the UUID is not found, some commands can request to fetch the UUID when possible
|
||||
* @param name
|
||||
* @param ifFetch
|
||||
*/
|
||||
public abstract void fetchUUID(final String name, final RunnableVal<UUID> ifFetch);
|
||||
|
||||
|
||||
/**
|
||||
* Start UUID caching (this should be an async task)
|
||||
* Recommended to override this is you want to cache offline players
|
||||
@ -52,20 +51,20 @@ public abstract class UUIDHandlerImplementation {
|
||||
}
|
||||
return CACHED = true;
|
||||
}
|
||||
|
||||
|
||||
public UUIDWrapper getUUIDWrapper() {
|
||||
return uuidWrapper;
|
||||
}
|
||||
|
||||
|
||||
public void setUUIDWrapper(final UUIDWrapper wrapper) {
|
||||
uuidWrapper = wrapper;
|
||||
}
|
||||
|
||||
|
||||
public void rename(final UUID uuid, final StringWrapper name) {
|
||||
uuidMap.inverse().remove(uuid);
|
||||
uuidMap.put(name, uuid);
|
||||
}
|
||||
|
||||
|
||||
public void add(final BiMap<StringWrapper, UUID> toAdd) {
|
||||
if (uuidMap.isEmpty()) {
|
||||
uuidMap = toAdd;
|
||||
@ -86,9 +85,9 @@ public abstract class UUIDHandlerImplementation {
|
||||
}
|
||||
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) {
|
||||
if ((uuid == null)) {
|
||||
return false;
|
||||
@ -102,7 +101,7 @@ public abstract class UUIDHandlerImplementation {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* lazy UUID conversion:
|
||||
* - Useful if the person misconfigured the database, or settings before PlotMe conversion
|
||||
@ -165,25 +164,25 @@ public abstract class UUIDHandlerImplementation {
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public boolean uuidExists(final UUID uuid) {
|
||||
return uuidMap.containsValue(uuid);
|
||||
}
|
||||
|
||||
|
||||
public BiMap<StringWrapper, UUID> getUUIDMap() {
|
||||
return uuidMap;
|
||||
}
|
||||
|
||||
|
||||
public boolean nameExists(final StringWrapper wrapper) {
|
||||
return uuidMap.containsKey(wrapper);
|
||||
}
|
||||
|
||||
|
||||
public void handleShutdown() {
|
||||
players.clear();
|
||||
uuidMap.clear();
|
||||
uuidWrapper = null;
|
||||
}
|
||||
|
||||
|
||||
public String getName(final UUID uuid) {
|
||||
if (uuid == null) {
|
||||
return null;
|
||||
@ -200,7 +199,7 @@ public abstract class UUIDHandlerImplementation {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public UUID getUUID(final String name, final RunnableVal<UUID> ifFetch) {
|
||||
if ((name == null) || (name.isEmpty())) {
|
||||
return null;
|
||||
@ -228,15 +227,15 @@ public abstract class UUIDHandlerImplementation {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public UUID getUUID(final PlotPlayer player) {
|
||||
return uuidWrapper.getUUID(player);
|
||||
}
|
||||
|
||||
|
||||
public UUID getUUID(final OfflinePlotPlayer player) {
|
||||
return uuidWrapper.getUUID(player);
|
||||
}
|
||||
|
||||
|
||||
public PlotPlayer getPlayer(final UUID uuid) {
|
||||
String name = getName(uuid);
|
||||
if (name != null) {
|
||||
@ -244,13 +243,13 @@ public abstract class UUIDHandlerImplementation {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public PlotPlayer getPlayer(final String name) {
|
||||
return players.get(name);
|
||||
}
|
||||
|
||||
|
||||
public Map<String, PlotPlayer> getPlayers() {
|
||||
return players;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -1,36 +1,35 @@
|
||||
package com.intellectualcrafters.plot.util.helpmenu;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.intellectualcrafters.plot.commands.CommandCategory;
|
||||
import com.intellectualcrafters.plot.config.C;
|
||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||
import com.intellectualcrafters.plot.util.MainUtil;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class HelpPage {
|
||||
|
||||
|
||||
private final List<HelpObject> helpObjects;
|
||||
private final String _header;
|
||||
|
||||
|
||||
public HelpPage(final CommandCategory category, final int currentPage, final int maxPages) {
|
||||
helpObjects = new ArrayList<>();
|
||||
_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) {
|
||||
if (helpObjects.size() < 1) {
|
||||
MainUtil.sendMessage(player, C.NOT_VALID_NUMBER, "(0)");
|
||||
} else {
|
||||
MainUtil.sendMessage(player, C.HELP_HEADER.s(), false);
|
||||
MainUtil.sendMessage(player, C.HELP_HEADER, false);
|
||||
MainUtil.sendMessage(player, _header, false);
|
||||
for (final HelpObject object : helpObjects) {
|
||||
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) {
|
||||
helpObjects.add(object);
|
||||
}
|
||||
|
@ -29,8 +29,17 @@ import com.intellectualcrafters.plot.object.Plot;
|
||||
import com.intellectualcrafters.plot.object.PlotArea;
|
||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||
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.Map;
|
||||
import java.util.UUID;
|
||||
@ -40,7 +49,7 @@ import java.util.UUID;
|
||||
|
||||
*/
|
||||
public class PlotListener {
|
||||
|
||||
|
||||
public static boolean plotEntry(final PlotPlayer pp, final Plot plot) {
|
||||
if (plot.isDenied(pp.getUUID()) && !Permissions.hasPermission(pp, "plots.admin.entry.denied")) {
|
||||
return false;
|
||||
@ -59,7 +68,7 @@ public class PlotListener {
|
||||
final int size = flags.size();
|
||||
boolean titles = Settings.TITLES;
|
||||
final String greeting;
|
||||
|
||||
|
||||
if (size != 0) {
|
||||
final Flag titleFlag = flags.get("titles");
|
||||
if (titleFlag != null) {
|
||||
@ -115,7 +124,7 @@ public class PlotListener {
|
||||
if (weatherFlag != null) {
|
||||
pp.setWeather((PlotWeather) weatherFlag.getValue());
|
||||
}
|
||||
|
||||
|
||||
final Flag musicFlag = flags.get("music");
|
||||
if (musicFlag != null) {
|
||||
final Integer id = (Integer) musicFlag.getValue();
|
||||
@ -174,7 +183,7 @@ public class PlotListener {
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public static boolean plotExit(final PlotPlayer pp, final Plot plot) {
|
||||
pp.deleteMeta("lastplot");
|
||||
EventUtil.manager.callLeave(pp, plot);
|
||||
|
@ -84,7 +84,7 @@ public class MainListener {
|
||||
if (Settings.USE_PLOTME_ALIAS) {
|
||||
SpongeMain.THIS.getGame().getCommandManager().process(source, ("plots " + event.getArguments()).trim());
|
||||
} else {
|
||||
source.sendMessage(SpongeUtil.getText(C.NOT_USING_PLOTME.s()));
|
||||
source.sendMessage(SpongeUtil.getText(C.NOT_USING_PLOTME));
|
||||
}
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user