Hows this?

This commit is contained in:
boy0001
2015-09-13 14:04:31 +10:00
parent 1cccdd9d4d
commit 5137b23357
379 changed files with 18471 additions and 28437 deletions

View File

@ -61,9 +61,8 @@ import com.plotsquared.bukkit.util.BukkitUtil;
* @version API 2.0
*
*/
public class PlotAPI
*/
public class PlotAPI {
/**
@ -71,14 +70,13 @@ public class PlotAPI
* plugin, without limitations.
* @deprecated Use C.PERMISSION_ADMIN.s() instead
*/
@Deprecated
@Deprecated
public static final String ADMIN_PERMISSION = C.PERMISSION_ADMIN.s();
/**
* @deprecated Use new PlotAPI() instead
*/
@Deprecated
public PlotAPI(final JavaPlugin plugin)
*/
@Deprecated
public PlotAPI(final JavaPlugin plugin) {}
/**
@ -94,9 +92,8 @@ public class PlotAPI
* - For more advanced/intensive tasks you should consider using other classes
*
*
*/
@Deprecated
public PlotAPI()
*/
@Deprecated
public PlotAPI() {}
/**
@ -104,11 +101,10 @@ public class PlotAPI
*
* @return all plots
*
* @see com.intellectualcrafters.plot.PS#getPlots()
*/
* @see com.intellectualcrafters.plot.PS#getPlots()
*/
public Set<Plot> getAllPlots() {
return PS.get().getPlots();
return PS.get().getPlots();
}
/**
@ -116,11 +112,10 @@ public class PlotAPI
*
* @param player Player, whose plots to search for
*
* @return all plots that a player owns
*/
* @return all plots that a player owns
*/
public Set<Plot> getPlayerPlots(final Player player) {
return PS.get().getPlots(BukkitUtil.getPlayer(player));
return PS.get().getPlots(BukkitUtil.getPlayer(player));
}
/**
@ -131,31 +126,28 @@ public class PlotAPI
* @param manager World Manager
*
* @see com.intellectualcrafters.plot.PS#addPlotWorld(String, com.intellectualcrafters.plot.object.PlotWorld,
* com.intellectualcrafters.plot.object.PlotManager)
*/
* com.intellectualcrafters.plot.object.PlotManager)
*/
public void addPlotWorld(final String world, final PlotWorld plotWorld, final PlotManager manager) {
PS.get().addPlotWorld(world, plotWorld, manager);
PS.get().addPlotWorld(world, plotWorld, manager);
}
/**
* @return main configuration
*
* @see com.intellectualcrafters.plot.PS#config
*/
* @see com.intellectualcrafters.plot.PS#config
*/
public YamlConfiguration getConfig() {
return PS.get().config;
return PS.get().config;
}
/**
* @return storage configuration
*
* @see com.intellectualcrafters.plot.PS#storage
*/
* @see com.intellectualcrafters.plot.PS#storage
*/
public YamlConfiguration getStorage() {
return PS.get().storage;
return PS.get().storage;
}
/**
@ -164,11 +156,10 @@ public class PlotAPI
*
* @return PlotSquared PlotSquared Main Class
*
* @see com.intellectualcrafters.plot.PS
*/
* @see com.intellectualcrafters.plot.PS
*/
public PS getMain() {
return PS.get();
return PS.get();
}
/**
@ -181,11 +172,10 @@ public class PlotAPI
*
* @return ChunkManager
*
* @see com.intellectualcrafters.plot.util.ChunkManager
*/
* @see com.intellectualcrafters.plot.util.ChunkManager
*/
public ChunkManager getChunkManager() {
return ChunkManager.manager;
return ChunkManager.manager;
}
/**
@ -193,11 +183,10 @@ public class PlotAPI
*
* @return BlockManager
*
* @see com.intellectualcrafters.plot.util.BlockManager
*/
* @see com.intellectualcrafters.plot.util.BlockManager
*/
public BlockManager getBlockManager() {
return BlockManager.manager;
return BlockManager.manager;
}
/**
@ -205,11 +194,10 @@ public class PlotAPI
*
* @return BukkitSetBlockManager
*
* @see com.plotsquared.bukkit.util.BukkitSetBlockManager
*/
* @see com.plotsquared.bukkit.util.BukkitSetBlockManager
*/
public BukkitSetBlockManager getBukkitBlockManager() {
return BukkitSetBlockManager.setBlockManager;
return BukkitSetBlockManager.setBlockManager;
}
/**
@ -217,11 +205,10 @@ public class PlotAPI
*
* @return UUIDWrapper
*
* @see com.intellectualcrafters.plot.uuid.UUIDWrapper
*/
* @see com.intellectualcrafters.plot.uuid.UUIDWrapper
*/
public UUIDWrapper getUUIDWrapper() {
return UUIDHandler.getUUIDWrapper();
return UUIDHandler.getUUIDWrapper();
}
/**
@ -231,11 +218,10 @@ public class PlotAPI
* @return FlagManager
*
* @see com.intellectualcrafters.plot.flag.FlagManager
*/
@Deprecated
*/
@Deprecated
public FlagManager getFlagManager() {
return new FlagManager();
return new FlagManager();
}
/**
@ -245,11 +231,10 @@ public class PlotAPI
* @return ClusterManager
*
* @see com.intellectualcrafters.plot.util.ClusterManager
*/
@Deprecated
*/
@Deprecated
public ClusterManager getClusterManager() {
return new ClusterManager();
return new ClusterManager();
}
/**
@ -259,11 +244,10 @@ public class PlotAPI
* @return MainUtil
*
* @see com.intellectualcrafters.plot.util.MainUtil
*/
@Deprecated
*/
@Deprecated
public MainUtil getMainUtil() {
return new MainUtil();
return new MainUtil();
}
/**
@ -273,19 +257,16 @@ public class PlotAPI
* @return Array of strings
*
* @see com.intellectualcrafters.plot.util.Permissions
*/
@Deprecated
*/
@Deprecated
{
final ArrayList<String> perms = new ArrayList<>();
for (final C c : C.values())
{
public String[] getPermissions() {
final ArrayList<String> perms = new ArrayList<>();
for (final C c : C.values()) {
if (c.getCat().equals("static.permissions")) {
perms.add(c.s());
}
}
return perms.toArray(new String[0]);
return perms.toArray(new String[0]);
}
/**
@ -293,11 +274,10 @@ public class PlotAPI
*
* @return SchematicHandler
*
* @see com.intellectualcrafters.plot.util.SchematicHandler
*/
* @see com.intellectualcrafters.plot.util.SchematicHandler
*/
public SchematicHandler getSchematicHandler() {
return SchematicHandler.manager;
return SchematicHandler.manager;
}
/**
@ -306,11 +286,10 @@ public class PlotAPI
* @return C
*
* @see com.intellectualcrafters.plot.config.C
*/
@Deprecated
*/
@Deprecated
public C[] getCaptions() {
return C.values();
return C.values();
}
/**
@ -321,11 +300,10 @@ public class PlotAPI
* @return PlotManager
*
* @see com.intellectualcrafters.plot.object.PlotManager
* @see PS#getPlotManager(String)
*/
* @see PS#getPlotManager(String)
*/
public PlotManager getPlotManager(final World world) {
return PS.get().getPlotManager(world.getName());
return PS.get().getPlotManager(world.getName());
}
/**
@ -337,11 +315,10 @@ public class PlotAPI
* @return PlotManager
*
* @see PS#getPlotManager(String)
* @see com.intellectualcrafters.plot.object.PlotManager
*/
* @see com.intellectualcrafters.plot.object.PlotManager
*/
public PlotManager getPlotManager(final String world) {
return PS.get().getPlotManager(world);
return PS.get().getPlotManager(world);
}
/**
@ -353,11 +330,10 @@ public class PlotAPI
* @return PlotWorld class for that world ! will return null if not a plot world world
*
* @see PS#getPlotWorld(String)
* @see com.intellectualcrafters.plot.object.PlotWorld
*/
* @see com.intellectualcrafters.plot.object.PlotWorld
*/
public PlotWorld getWorldSettings(final World world) {
return PS.get().getPlotWorld(world.getName());
return PS.get().getPlotWorld(world.getName());
}
/**
@ -368,11 +344,10 @@ public class PlotAPI
* @return PlotWorld class for that world ! will return null if not a plot world world
*
* @see PS#getPlotWorld(String)
* @see com.intellectualcrafters.plot.object.PlotWorld
*/
* @see com.intellectualcrafters.plot.object.PlotWorld
*/
public PlotWorld getWorldSettings(final String world) {
return PS.get().getPlotWorld(world);
return PS.get().getPlotWorld(world);
}
/**
@ -382,11 +357,10 @@ public class PlotAPI
* @param c (Caption)
*
* @see com.intellectualcrafters.plot.util.MainUtil#sendMessage(PlotPlayer, C, String...)
* com.intellectualcrafters.plot.config.C, String...)
*/
* com.intellectualcrafters.plot.config.C, String...)
*/
public void sendMessage(final Player player, final C c) {
MainUtil.sendMessage(BukkitUtil.getPlayer(player), c);
MainUtil.sendMessage(BukkitUtil.getPlayer(player), c);
}
/**
@ -395,11 +369,10 @@ public class PlotAPI
* @param player Player that will receive the message
* @param string The message
*
* @see com.intellectualcrafters.plot.util.MainUtil#sendMessage(PlotPlayer, String)
*/
* @see com.intellectualcrafters.plot.util.MainUtil#sendMessage(PlotPlayer, String)
*/
public void sendMessage(final Player player, final String string) {
MainUtil.sendMessage(BukkitUtil.getPlayer(player), string);
MainUtil.sendMessage(BukkitUtil.getPlayer(player), string);
}
/**
@ -407,11 +380,10 @@ public class PlotAPI
*
* @param msg Message that should be sent to the console
*
* @see MainUtil#sendConsoleMessage(String)
*/
* @see MainUtil#sendConsoleMessage(String)
*/
public void sendConsoleMessage(final String msg) {
MainUtil.sendConsoleMessage(msg);
MainUtil.sendConsoleMessage(msg);
}
/**
@ -420,11 +392,10 @@ public class PlotAPI
* @param c (Caption)
*
* @see #sendConsoleMessage(String)
* @see com.intellectualcrafters.plot.config.C
*/
* @see com.intellectualcrafters.plot.config.C
*/
public void sendConsoleMessage(final C c) {
sendConsoleMessage(c.s());
sendConsoleMessage(c.s());
}
/**
@ -433,11 +404,10 @@ public class PlotAPI
* @param flag Flag that should be registered
*
* @see com.intellectualcrafters.plot.flag.FlagManager#addFlag(com.intellectualcrafters.plot.flag.AbstractFlag)
* @see com.intellectualcrafters.plot.flag.AbstractFlag
*/
* @see com.intellectualcrafters.plot.flag.AbstractFlag
*/
public void addFlag(final AbstractFlag flag) {
FlagManager.addFlag(flag);
FlagManager.addFlag(flag);
}
/**
@ -446,11 +416,10 @@ public class PlotAPI
* @return array of Flag[]
*
* @see com.intellectualcrafters.plot.flag.FlagManager#getFlags()
* @see com.intellectualcrafters.plot.flag.AbstractFlag
*/
* @see com.intellectualcrafters.plot.flag.AbstractFlag
*/
public AbstractFlag[] getFlags() {
return FlagManager.getFlags().toArray(new AbstractFlag[FlagManager.getFlags().size()]);
return FlagManager.getFlags().toArray(new AbstractFlag[FlagManager.getFlags().size()]);
}
/**
@ -463,11 +432,10 @@ public class PlotAPI
* @return plot, null if ID is wrong
*
* @see MainUtil#getPlot(String, com.intellectualcrafters.plot.object.PlotId)
* @see com.intellectualcrafters.plot.object.Plot
*/
* @see com.intellectualcrafters.plot.object.Plot
*/
public Plot getPlot(final World world, final int x, final int z) {
return MainUtil.getPlot(world.getName(), new PlotId(x, z));
return MainUtil.getPlot(world.getName(), new PlotId(x, z));
}
/**
@ -478,11 +446,10 @@ public class PlotAPI
* @return plot if found, otherwise it creates a temporary plot-
*
* @see MainUtil#getPlot(com.intellectualcrafters.plot.object.Location)
* @see com.intellectualcrafters.plot.object.Plot
*/
* @see com.intellectualcrafters.plot.object.Plot
*/
public Plot getPlot(final Location l) {
return MainUtil.getPlot(BukkitUtil.getLocation(l));
return MainUtil.getPlot(BukkitUtil.getLocation(l));
}
/**
@ -493,11 +460,10 @@ public class PlotAPI
* @return plot if found, otherwise it creates a temporary plot
*
* @see #getPlot(org.bukkit.Location)
* @see com.intellectualcrafters.plot.object.Plot
*/
* @see com.intellectualcrafters.plot.object.Plot
*/
public Plot getPlot(final Player player) {
return this.getPlot(player.getLocation());
return this.getPlot(player.getLocation());
}
/**
@ -507,11 +473,10 @@ public class PlotAPI
*
* @return true if player has a plot, false if not.
*
* @see #getPlots(World, Player, boolean)
*/
* @see #getPlots(World, Player, boolean)
*/
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);
}
/**
@ -520,29 +485,22 @@ public class PlotAPI
* @param plr to search for
* @param just_owner should we just search for owner? Or with rights?
*
* @see com.intellectualcrafters.plot.object.Plot
*/
* @see com.intellectualcrafters.plot.object.Plot
*/
{
final ArrayList<Plot> pPlots = new ArrayList<>();
for (final Plot plot : PS.get().getPlotsInWorld(world.getName()))
{
if (just_owner)
{
public Plot[] getPlots(final World world, final Player plr, final boolean just_owner) {
final ArrayList<Plot> pPlots = new ArrayList<>();
for (final Plot plot : PS.get().getPlotsInWorld(world.getName())) {
if (just_owner) {
if ((plot.owner != null) && (plot.owner.equals(UUIDHandler.getUUID(BukkitUtil.getPlayer(plr))))) {
pPlots.add(plot);
}
}
else
{
pPlots.add(plot);
}
} else {
if (plot.isAdded(UUIDHandler.getUUID(BukkitUtil.getPlayer(plr)))) {
pPlots.add(plot);
}
}
}
return pPlots.toArray(new Plot[pPlots.size()]);
return pPlots.toArray(new Plot[pPlots.size()]);
}
/**
@ -553,12 +511,11 @@ public class PlotAPI
* @return Plot[] - array of plot objects in world
*
* @see PS#getPlots(String)
* @see com.intellectualcrafters.plot.object.Plot
*/
* @see com.intellectualcrafters.plot.object.Plot
*/
public Plot[] getPlots(final World world) {
final Collection<Plot> plots = PS.get().getPlotsInWorld(world.getName());
return plots.toArray(new Plot[plots.size()]);
return plots.toArray(new Plot[plots.size()]);
}
/**
@ -566,12 +523,11 @@ public class PlotAPI
*
* @return World[] - array of plot worlds
*
* @see com.intellectualcrafters.plot.PS#getPlotWorlds()
*/
* @see com.intellectualcrafters.plot.PS#getPlotWorlds()
*/
public String[] getPlotWorlds() {
final Set<String> worlds = PS.get().getPlotWorlds();
return worlds.toArray(new String[worlds.size()]);
return worlds.toArray(new String[worlds.size()]);
}
/**
@ -581,11 +537,10 @@ public class PlotAPI
*
* @return boolean (if plot world or not)
*
* @see com.intellectualcrafters.plot.PS#isPlotWorld(String)
*/
* @see com.intellectualcrafters.plot.PS#isPlotWorld(String)
*/
public boolean isPlotWorld(final World world) {
return PS.get().isPlotWorld(world.getName());
return PS.get().isPlotWorld(world.getName());
}
/**
@ -601,14 +556,13 @@ public class PlotAPI
* com.intellectualcrafters.plot.object.PlotId)
* @see com.intellectualcrafters.plot.util.MainUtil#getPlotHome(String,
* com.intellectualcrafters.plot.object.Plot)
* @see com.intellectualcrafters.plot.object.Plot
*/
* @see com.intellectualcrafters.plot.object.Plot
*/
public Location[] getLocations(final Plot p) {
return new Location[] {
BukkitUtil.getLocation(MainUtil.getPlotBottomLoc(p.world, p.id)),
BukkitUtil.getLocation(MainUtil.getPlotTopLoc(p.world, p.id)),
BukkitUtil.getLocation(MainUtil.getPlotHome(p.world, p.id)) };
BukkitUtil.getLocation(MainUtil.getPlotHome(p.world, p.id)) };
}
/**
@ -620,11 +574,10 @@ public class PlotAPI
*
* @see com.intellectualcrafters.plot.util.MainUtil#getPlotHome(String,
* com.intellectualcrafters.plot.object.Plot)
* @see com.intellectualcrafters.plot.object.Plot
*/
* @see com.intellectualcrafters.plot.object.Plot
*/
public Location getHomeLocation(final Plot p) {
return BukkitUtil.getLocation(MainUtil.getPlotHome(p.world, p.id));
return BukkitUtil.getLocation(MainUtil.getPlotHome(p.world, p.id));
}
/**
@ -636,11 +589,10 @@ public class PlotAPI
*
* @see com.intellectualcrafters.plot.util.MainUtil#getPlotBottomLoc(String,
* com.intellectualcrafters.plot.object.PlotId)
* @see com.intellectualcrafters.plot.object.Plot
*/
* @see com.intellectualcrafters.plot.object.Plot
*/
public Location getBottomLocation(final Plot p) {
return BukkitUtil.getLocation(MainUtil.getPlotBottomLoc(p.world, p.id));
return BukkitUtil.getLocation(MainUtil.getPlotBottomLoc(p.world, p.id));
}
/**
@ -651,11 +603,10 @@ public class PlotAPI
* @return plot top location
*
* @see MainUtil#getPlotTopLoc(String, com.intellectualcrafters.plot.object.PlotId)
* @see com.intellectualcrafters.plot.object.Plot
*/
* @see com.intellectualcrafters.plot.object.Plot
*/
public Location getTopLocation(final Plot p) {
return BukkitUtil.getLocation(MainUtil.getPlotTopLoc(p.world, p.id));
return BukkitUtil.getLocation(MainUtil.getPlotTopLoc(p.world, p.id));
}
/**
@ -665,11 +616,10 @@ public class PlotAPI
*
* @return true if the player is in a plot, false if not-
*
* @see com.intellectualcrafters.plot.util.MainUtil#getPlot(com.intellectualcrafters.plot.object.Location)
*/
* @see com.intellectualcrafters.plot.util.MainUtil#getPlot(com.intellectualcrafters.plot.object.Location)
*/
public boolean isInPlot(final Player player) {
return MainUtil.getPlot(BukkitUtil.getLocation(player)) != null;
return MainUtil.getPlot(BukkitUtil.getLocation(player)) != null;
}
/**
@ -677,18 +627,14 @@ public class PlotAPI
*
* @param c SubCommand, that we want to register
*
* @see com.intellectualcrafters.plot.commands.SubCommand
*/
public void registerCommand(final SubCommand c)
{
* @see com.intellectualcrafters.plot.commands.SubCommand
*/
public void registerCommand(final SubCommand c) {
{
MainCommand.getInstance().addCommand(c);
}
if (c.getCommand() != null) {
MainCommand.getInstance().addCommand(c);
} else {
MainCommand.getInstance().createCommand(c);
}
}
}
/**
@ -696,11 +642,10 @@ public class PlotAPI
*
* @return PlotSquared Class
*
* @see com.intellectualcrafters.plot.PS
*/
* @see com.intellectualcrafters.plot.PS
*/
public PS getPlotSquared() {
return PS.get();
return PS.get();
}
/**
@ -711,11 +656,10 @@ public class PlotAPI
*
* @return the number of plots the player has
*
* @see com.intellectualcrafters.plot.util.MainUtil#getPlayerPlotCount(String, PlotPlayer)
*/
* @see com.intellectualcrafters.plot.util.MainUtil#getPlayerPlotCount(String, PlotPlayer)
*/
public int getPlayerPlotCount(final World world, final Player player) {
return MainUtil.getPlayerPlotCount(world.getName(), BukkitUtil.getPlayer(player));
return MainUtil.getPlayerPlotCount(world.getName(), BukkitUtil.getPlayer(player));
}
/**
@ -728,11 +672,10 @@ public class PlotAPI
*
* @see com.intellectualcrafters.plot.PS#getPlots(String, PlotPlayer)
* org.bukkit.entity.Player)
* @see com.intellectualcrafters.plot.object.Plot
*/
* @see com.intellectualcrafters.plot.object.Plot
*/
public Set<Plot> getPlayerPlots(final World world, final Player player) {
return PS.get().getPlots(world.getName(), BukkitUtil.getPlayer(player));
return PS.get().getPlots(world.getName(), BukkitUtil.getPlayer(player));
}
/**
@ -741,12 +684,11 @@ public class PlotAPI
* @param player Player, for whom we're getting the plots (trusted, member and owner)
*
* @return the number of allowed plots
*
*/
*
*/
public int getAllowedPlots(final Player player) {
final PlotPlayer pp = BukkitUtil.getPlayer(player);
return MainUtil.getAllowedPlots(pp);
return MainUtil.getAllowedPlots(pp);
}
/**
@ -756,11 +698,10 @@ public class PlotAPI
* @see PlotPlayer.wrap(Player|OfflinePlayer|String|UUID)
*
* @param player
* @return
*/
* @return
*/
public PlotPlayer wrapPlayer(final Player player) {
return PlotPlayer.wrap(player);
return PlotPlayer.wrap(player);
}
/**
@ -769,11 +710,10 @@ public class PlotAPI
* @see PlotPlayer.wrap(UUID uuid)
*
* @param player
* @return
*/
* @return
*/
public PlotPlayer wrapPlayer(final UUID uuid) {
return PlotPlayer.wrap(uuid);
return PlotPlayer.wrap(uuid);
}
/**
@ -782,11 +722,10 @@ public class PlotAPI
* @see PlotPlayer.wrap(String name)
*
* @param player
* @return
*/
* @return
*/
public PlotPlayer wrapPlayer(final String player) {
return PlotPlayer.wrap(player);
return PlotPlayer.wrap(player);
}
/**
@ -796,8 +735,7 @@ public class PlotAPI
* @see PlotPlayer.wrap(OfflinePlayer op)
*
* @param player
* @return
*/
* @return
*/
public PlotPlayer wrapPlayer(final OfflinePlayer player) {
return PlotPlayer.wrap(player);