mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2025-06-26 10:44:42 +02:00
Refactor + optimizations
This commit is contained in:
@ -30,6 +30,13 @@ public interface IPlotMain {
|
||||
*/
|
||||
File getDirectory();
|
||||
|
||||
/**
|
||||
* Wrap a player into a PlotPlayer object
|
||||
* @param obj
|
||||
* @return
|
||||
*/
|
||||
PlotPlayer wrapPlayer(Object obj);
|
||||
|
||||
/**
|
||||
* Disable the implementation
|
||||
* - If a full disable isn't feasibly, just disable what it can
|
||||
|
@ -50,8 +50,8 @@ import com.intellectualcrafters.plot.util.Permissions;
|
||||
import com.intellectualcrafters.plot.util.SchematicHandler;
|
||||
import com.intellectualcrafters.plot.util.UUIDHandler;
|
||||
import com.intellectualcrafters.plot.uuid.UUIDWrapper;
|
||||
import com.plotsquared.bukkit.util.bukkit.BukkitSetBlockManager;
|
||||
import com.plotsquared.bukkit.util.bukkit.BukkitUtil;
|
||||
import com.plotsquared.bukkit.util.BukkitSetBlockManager;
|
||||
import com.plotsquared.bukkit.util.BukkitUtil;
|
||||
|
||||
/**
|
||||
* PlotSquared API
|
||||
@ -185,7 +185,7 @@ import com.plotsquared.bukkit.util.bukkit.BukkitUtil;
|
||||
*
|
||||
* @return BukkitSetBlockManager
|
||||
*
|
||||
* @see com.plotsquared.bukkit.util.bukkit.BukkitSetBlockManager
|
||||
* @see com.plotsquared.bukkit.util.BukkitSetBlockManager
|
||||
*/
|
||||
public BukkitSetBlockManager getBukkitBlockManager() {
|
||||
return BukkitSetBlockManager.setBlockManager;
|
||||
|
@ -32,7 +32,7 @@ import com.intellectualcrafters.plot.util.EventUtil;
|
||||
import com.intellectualcrafters.plot.util.MainUtil;
|
||||
import com.intellectualcrafters.plot.util.Permissions;
|
||||
import com.intellectualcrafters.plot.util.UUIDHandler;
|
||||
import com.plotsquared.bukkit.util.bukkit.uuid.SQLUUIDHandler;
|
||||
import com.plotsquared.bukkit.uuid.SQLUUIDHandler;
|
||||
import com.plotsquared.general.commands.Argument;
|
||||
import com.plotsquared.general.commands.CommandDeclaration;
|
||||
|
||||
|
@ -30,7 +30,6 @@ import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import com.intellectualcrafters.plot.util.StringMan;
|
||||
import org.bukkit.Bukkit;
|
||||
|
||||
import com.intellectualcrafters.plot.PS;
|
||||
@ -47,6 +46,7 @@ import com.intellectualcrafters.plot.util.BlockManager;
|
||||
import com.intellectualcrafters.plot.util.ChunkManager;
|
||||
import com.intellectualcrafters.plot.util.ExpireManager;
|
||||
import com.intellectualcrafters.plot.util.MainUtil;
|
||||
import com.intellectualcrafters.plot.util.StringMan;
|
||||
import com.intellectualcrafters.plot.util.UUIDHandler;
|
||||
import com.plotsquared.bukkit.util.BukkitHybridUtils;
|
||||
import com.plotsquared.general.commands.CommandDeclaration;
|
||||
|
@ -32,7 +32,7 @@ import com.intellectualcrafters.plot.util.EventUtil;
|
||||
import com.intellectualcrafters.plot.util.MainUtil;
|
||||
import com.intellectualcrafters.plot.util.Permissions;
|
||||
import com.intellectualcrafters.plot.util.UUIDHandler;
|
||||
import com.plotsquared.bukkit.util.bukkit.uuid.SQLUUIDHandler;
|
||||
import com.plotsquared.bukkit.uuid.SQLUUIDHandler;
|
||||
import com.plotsquared.general.commands.Argument;
|
||||
import com.plotsquared.general.commands.CommandDeclaration;
|
||||
|
||||
|
@ -24,8 +24,6 @@ import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
|
||||
import com.intellectualcrafters.plot.util.StringMan;
|
||||
|
||||
import com.intellectualcrafters.plot.config.C;
|
||||
import com.intellectualcrafters.plot.database.DBFunc;
|
||||
import com.intellectualcrafters.plot.flag.AbstractFlag;
|
||||
@ -37,6 +35,7 @@ import com.intellectualcrafters.plot.object.Plot;
|
||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||
import com.intellectualcrafters.plot.util.MainUtil;
|
||||
import com.intellectualcrafters.plot.util.Permissions;
|
||||
import com.intellectualcrafters.plot.util.StringMan;
|
||||
import com.plotsquared.general.commands.CommandDeclaration;
|
||||
|
||||
@CommandDeclaration(
|
||||
|
@ -23,8 +23,6 @@ package com.intellectualcrafters.plot.commands;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.intellectualcrafters.plot.util.StringMan;
|
||||
|
||||
import com.intellectualcrafters.plot.config.C;
|
||||
import com.intellectualcrafters.plot.object.Plot;
|
||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||
|
@ -25,9 +25,6 @@ import java.util.Collection;
|
||||
import java.util.UUID;
|
||||
import java.util.regex.Matcher;
|
||||
|
||||
import com.intellectualcrafters.plot.util.StringMan;
|
||||
|
||||
import com.intellectualcrafters.plot.PS;
|
||||
import com.intellectualcrafters.plot.config.C;
|
||||
import com.intellectualcrafters.plot.config.Settings;
|
||||
import com.intellectualcrafters.plot.database.DBFunc;
|
||||
@ -146,7 +143,7 @@ public class Info extends SubCommand {
|
||||
};
|
||||
UUID uuid = player.getUUID();
|
||||
String name = MainUtil.getName(plot.owner);
|
||||
inv.setItem(1, new PlotItemStack(388, (short) 0, 1, "&cPlot Info", new String[] { "&cID: &6" + plot.getId().toString(), "&cOwner: &6" + name, "&cAlias: &6" + plot.getSettings().getAlias(), "&cBiome: &6" + plot.getSettings().getBiome().toString().replaceAll("_", "").toLowerCase(), "&cCan Build: &6" + plot.isAdded(uuid), "&cIs Denied: &6" + plot.isDenied(uuid)}));
|
||||
inv.setItem(1, new PlotItemStack(388, (short) 0, 1, "&cPlot Info", new String[] { "&cID: &6" + plot.getId().toString(), "&cOwner: &6" + name, "&cAlias: &6" + plot.getSettings().getAlias(), "&cBiome: &6" + plot.getBiome().toString().replaceAll("_", "").toLowerCase(), "&cCan Build: &6" + plot.isAdded(uuid), "&cIs Denied: &6" + plot.isDenied(uuid)}));
|
||||
inv.setItem(1, new PlotItemStack(388, (short) 0, 1, "&cTrusted", new String[] {"&cAmount: &6" + plot.getTrusted().size(), "&8Click to view a list of the trusted users"}));
|
||||
inv.setItem(1, new PlotItemStack(388, (short) 0, 1, "&cMembers", new String[] {"&cAmount: &6" + plot.getMembers().size(), "&8Click to view a list of plot members"}));
|
||||
inv.setItem(1, new PlotItemStack(388, (short) 0, 1, "&cDenied", new String[] {"&cDenied", "&cAmount: &6" + plot.getDenied().size(), "&8Click to view a list of denied players"}));
|
||||
|
@ -24,8 +24,6 @@ import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.UUID;
|
||||
|
||||
import com.intellectualcrafters.plot.util.StringMan;
|
||||
|
||||
import com.intellectualcrafters.plot.PS;
|
||||
import com.intellectualcrafters.plot.config.C;
|
||||
import com.intellectualcrafters.plot.object.Location;
|
||||
@ -38,6 +36,7 @@ import com.intellectualcrafters.plot.util.EconHandler;
|
||||
import com.intellectualcrafters.plot.util.EventUtil;
|
||||
import com.intellectualcrafters.plot.util.MainUtil;
|
||||
import com.intellectualcrafters.plot.util.Permissions;
|
||||
import com.intellectualcrafters.plot.util.StringMan;
|
||||
import com.intellectualcrafters.plot.util.UUIDHandler;
|
||||
import com.plotsquared.general.commands.Argument;
|
||||
import com.plotsquared.general.commands.CommandDeclaration;
|
||||
|
@ -26,8 +26,6 @@ import java.util.Comparator;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.UUID;
|
||||
|
||||
import com.intellectualcrafters.plot.util.StringMan;
|
||||
|
||||
import org.apache.commons.lang.mutable.MutableInt;
|
||||
import org.bukkit.Bukkit;
|
||||
|
||||
|
@ -31,7 +31,7 @@ import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||
import com.intellectualcrafters.plot.util.MainUtil;
|
||||
import com.intellectualcrafters.plot.util.Permissions;
|
||||
import com.intellectualcrafters.plot.util.UUIDHandler;
|
||||
import com.plotsquared.bukkit.util.bukkit.uuid.SQLUUIDHandler;
|
||||
import com.plotsquared.bukkit.uuid.SQLUUIDHandler;
|
||||
import com.plotsquared.general.commands.Argument;
|
||||
import com.plotsquared.general.commands.CommandDeclaration;
|
||||
|
||||
|
@ -24,8 +24,6 @@ import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import com.intellectualcrafters.plot.util.StringMan;
|
||||
|
||||
import com.intellectualcrafters.plot.PS;
|
||||
import com.intellectualcrafters.plot.config.C;
|
||||
import com.intellectualcrafters.plot.config.Configuration;
|
||||
|
@ -25,8 +25,6 @@ import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import com.intellectualcrafters.plot.util.StringMan;
|
||||
|
||||
import com.intellectualcrafters.plot.config.C;
|
||||
import com.intellectualcrafters.plot.config.ConfigurationNode;
|
||||
import com.intellectualcrafters.plot.config.Settings;
|
||||
@ -36,6 +34,7 @@ import com.intellectualcrafters.plot.object.SetupObject;
|
||||
import com.intellectualcrafters.plot.util.BlockManager;
|
||||
import com.intellectualcrafters.plot.util.MainUtil;
|
||||
import com.intellectualcrafters.plot.util.SetupUtils;
|
||||
import com.intellectualcrafters.plot.util.StringMan;
|
||||
import com.plotsquared.general.commands.CommandDeclaration;
|
||||
|
||||
@CommandDeclaration(
|
||||
|
@ -20,7 +20,6 @@
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
package com.intellectualcrafters.plot.commands;
|
||||
|
||||
import com.intellectualcrafters.plot.util.StringMan;
|
||||
import com.intellectualcrafters.plot.PS;
|
||||
import com.intellectualcrafters.plot.config.C;
|
||||
import com.intellectualcrafters.plot.object.Location;
|
||||
|
@ -32,7 +32,7 @@ import com.intellectualcrafters.plot.util.EventUtil;
|
||||
import com.intellectualcrafters.plot.util.MainUtil;
|
||||
import com.intellectualcrafters.plot.util.Permissions;
|
||||
import com.intellectualcrafters.plot.util.UUIDHandler;
|
||||
import com.plotsquared.bukkit.util.bukkit.uuid.SQLUUIDHandler;
|
||||
import com.plotsquared.bukkit.uuid.SQLUUIDHandler;
|
||||
import com.plotsquared.general.commands.Argument;
|
||||
import com.plotsquared.general.commands.CommandDeclaration;
|
||||
|
||||
|
@ -30,7 +30,7 @@ import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||
import com.intellectualcrafters.plot.util.MainUtil;
|
||||
import com.intellectualcrafters.plot.util.Permissions;
|
||||
import com.intellectualcrafters.plot.util.UUIDHandler;
|
||||
import com.plotsquared.bukkit.util.bukkit.uuid.SQLUUIDHandler;
|
||||
import com.plotsquared.bukkit.uuid.SQLUUIDHandler;
|
||||
import com.plotsquared.general.commands.Argument;
|
||||
import com.plotsquared.general.commands.CommandDeclaration;
|
||||
|
||||
|
@ -27,7 +27,6 @@ import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.UUID;
|
||||
|
||||
import com.intellectualcrafters.plot.util.StringMan;
|
||||
import org.bukkit.ChatColor;
|
||||
|
||||
import com.intellectualcrafters.plot.PS;
|
||||
@ -43,9 +42,10 @@ import com.intellectualcrafters.plot.util.EconHandler;
|
||||
import com.intellectualcrafters.plot.util.MainUtil;
|
||||
import com.intellectualcrafters.plot.util.Permissions;
|
||||
import com.intellectualcrafters.plot.util.StringComparison;
|
||||
import com.intellectualcrafters.plot.util.StringMan;
|
||||
import com.intellectualcrafters.plot.util.UUIDHandler;
|
||||
import com.plotsquared.bukkit.chat.FancyMessage;
|
||||
import com.plotsquared.bukkit.object.BukkitPlayer;
|
||||
import com.plotsquared.bukkit.util.bukkit.chat.FancyMessage;
|
||||
import com.plotsquared.general.commands.CommandDeclaration;
|
||||
|
||||
@CommandDeclaration(
|
||||
|
@ -12,7 +12,7 @@ import com.intellectualcrafters.plot.util.MainUtil;
|
||||
import com.intellectualcrafters.plot.util.PlotGamemode;
|
||||
import com.intellectualcrafters.plot.util.PlotWeather;
|
||||
|
||||
public class ConsolePlayer implements PlotPlayer {
|
||||
public class ConsolePlayer extends PlotPlayer {
|
||||
|
||||
private static ConsolePlayer instance;
|
||||
private Location loc;
|
||||
@ -82,11 +82,6 @@ public class ConsolePlayer implements PlotPlayer {
|
||||
this.loc = loc;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOp() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOnline() {
|
||||
return true;
|
||||
|
@ -29,6 +29,7 @@ import java.util.UUID;
|
||||
import com.intellectualcrafters.plot.PS;
|
||||
import com.intellectualcrafters.plot.database.DBFunc;
|
||||
import com.intellectualcrafters.plot.flag.Flag;
|
||||
import com.intellectualcrafters.plot.util.BlockManager;
|
||||
import com.intellectualcrafters.plot.util.ChunkManager;
|
||||
import com.intellectualcrafters.plot.util.MainUtil;
|
||||
|
||||
@ -473,6 +474,14 @@ public class Plot {
|
||||
MainUtil.setBiome(this, biome, whenDone);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the biome (String)
|
||||
*/
|
||||
public String getBiome() {
|
||||
final Location loc = getBottom().add(1, 0, 1);
|
||||
return BlockManager.manager.getBiome(loc.getWorld(), loc.getX(), loc.getZ());
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the top location for the plot
|
||||
* @return
|
||||
|
@ -1,9 +1,15 @@
|
||||
package com.intellectualcrafters.plot.object;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import com.intellectualcrafters.plot.PS;
|
||||
import com.intellectualcrafters.plot.commands.RequiredType;
|
||||
import com.intellectualcrafters.plot.util.MainUtil;
|
||||
import com.intellectualcrafters.plot.util.PlotGamemode;
|
||||
import com.intellectualcrafters.plot.util.PlotWeather;
|
||||
import com.intellectualcrafters.plot.util.UUIDHandler;
|
||||
import com.plotsquared.general.commands.CommandCaller;
|
||||
|
||||
/**
|
||||
@ -11,33 +17,214 @@ import com.plotsquared.general.commands.CommandCaller;
|
||||
*
|
||||
* @author Citymonstret
|
||||
*/
|
||||
public interface PlotPlayer extends CommandCaller {
|
||||
public abstract class PlotPlayer implements CommandCaller {
|
||||
|
||||
long getPreviousLogin();
|
||||
|
||||
Location getLocation();
|
||||
|
||||
Location getLocationFull();
|
||||
|
||||
UUID getUUID();
|
||||
|
||||
boolean hasPermission(final String perm);
|
||||
|
||||
void sendMessage(final String message);
|
||||
/**
|
||||
* The metadata map
|
||||
*/
|
||||
private ConcurrentHashMap<String, Object> meta;
|
||||
|
||||
void teleport(final Location loc);
|
||||
/**
|
||||
* Wrap a Player object to get a PlotPlayer<br>
|
||||
* - This will usually be cached, so no new object creation
|
||||
* @param obj
|
||||
* @return
|
||||
*/
|
||||
public static PlotPlayer wrap(Object obj) {
|
||||
return PS.get().IMP.wrapPlayer(obj);
|
||||
}
|
||||
|
||||
boolean isOp();
|
||||
/**
|
||||
* Get the cached PlotPlayer from a username<br>
|
||||
* - This will return null if the player has just logged in or is not online
|
||||
* @param name
|
||||
* @return
|
||||
*/
|
||||
public static PlotPlayer get(String name) {
|
||||
return UUIDHandler.getPlayer(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set some session only metadata for the player
|
||||
* @param key
|
||||
* @param value
|
||||
*/
|
||||
public void setMeta(String key, Object value) {
|
||||
if (this.meta == null) {
|
||||
this.meta = new ConcurrentHashMap<String, Object>();
|
||||
}
|
||||
this.meta.put(key, value);
|
||||
}
|
||||
|
||||
boolean isOnline();
|
||||
/**
|
||||
* Get the metadata for a key
|
||||
* @param key
|
||||
* @return
|
||||
*/
|
||||
public Object getMeta(String key) {
|
||||
if (this.meta != null) {
|
||||
return this.meta.get(key);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
String getName();
|
||||
/**
|
||||
* Delete the metadata for a key<br>
|
||||
* - metadata is session only
|
||||
* - deleting other plugin's metadata may cause issues
|
||||
* @param key
|
||||
*/
|
||||
public void deleteMeta(String key) {
|
||||
if (this.meta != null) {
|
||||
this.meta.remove(key);
|
||||
}
|
||||
}
|
||||
|
||||
void setCompassTarget(Location loc);
|
||||
/**
|
||||
* Returns the player's name
|
||||
* @see #getName()
|
||||
*/
|
||||
public String toString() {
|
||||
return getName();
|
||||
}
|
||||
|
||||
void loadData();
|
||||
/**
|
||||
* Get the player's current plot<br>
|
||||
* - This is cached
|
||||
* @return
|
||||
*/
|
||||
public Plot getCurrentPlot() {
|
||||
return (Plot) getMeta("lastplot");
|
||||
}
|
||||
|
||||
void saveData();
|
||||
/**
|
||||
* Get the total number of allowed plots
|
||||
* @return
|
||||
*/
|
||||
public int getAllowedPlots() {
|
||||
return MainUtil.getAllowedPlots(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the number of plots the player owns
|
||||
* @return
|
||||
*/
|
||||
public int getPlotCount() {
|
||||
return MainUtil.getPlayerPlotCount(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the number of plots the player owns in the world
|
||||
* @param world
|
||||
* @return
|
||||
*/
|
||||
public int getPlotCount(String world) {
|
||||
return MainUtil.getPlayerPlotCount(world, this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the plots the player owns
|
||||
* @see #PS.java for more searching functions
|
||||
* @return Set of plots
|
||||
*/
|
||||
public Set<Plot> getPlots() {
|
||||
return PS.get().getPlots(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the PlotWorld the player is currently in, or null
|
||||
* @return
|
||||
*/
|
||||
public PlotWorld getPlotWorld() {
|
||||
return PS.get().getPlotWorld(getLocation().getWorld());
|
||||
}
|
||||
|
||||
@Override
|
||||
public RequiredType getSuperCaller() {
|
||||
return RequiredType.PLAYER;
|
||||
}
|
||||
|
||||
/////////////// PLAYER META ///////////////
|
||||
|
||||
////////////// PARTIALLY IMPLEMENTED ///////////
|
||||
/**
|
||||
* Get the player's last recorded location
|
||||
* @return
|
||||
*/
|
||||
public Location getLocation() {
|
||||
Location loc = (Location) getMeta("location");
|
||||
if (loc != null) {
|
||||
return loc;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Get the previous time the player logged in
|
||||
* @return
|
||||
*/
|
||||
public abstract long getPreviousLogin();
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Get the player's full location (including yaw/pitch)
|
||||
* @return
|
||||
*/
|
||||
public abstract Location getLocationFull();
|
||||
|
||||
/**
|
||||
* Get the player's UUID
|
||||
* @return
|
||||
*/
|
||||
public abstract UUID getUUID();
|
||||
|
||||
/**
|
||||
* Check the player's permissions<br>
|
||||
* - Will be cached if permission caching is enabled
|
||||
*/
|
||||
public abstract boolean hasPermission(final String perm);
|
||||
|
||||
/**
|
||||
* Send the player a message
|
||||
*/
|
||||
public abstract void sendMessage(final String message);
|
||||
|
||||
/**
|
||||
* Teleport the player to a location
|
||||
* @param loc
|
||||
*/
|
||||
public abstract void teleport(final Location loc);
|
||||
|
||||
/**
|
||||
* Is the player online
|
||||
* @return
|
||||
*/
|
||||
public abstract boolean isOnline();
|
||||
|
||||
/**
|
||||
* Get the player's name
|
||||
* @return
|
||||
*/
|
||||
public abstract String getName();
|
||||
|
||||
/**
|
||||
* Set the compass target
|
||||
* @param loc
|
||||
*/
|
||||
public abstract void setCompassTarget(Location loc);
|
||||
|
||||
/**
|
||||
* Load the player data from disk (if applicable)
|
||||
*/
|
||||
public abstract void loadData();
|
||||
|
||||
/**
|
||||
* Save the player data from disk (if applicable)
|
||||
*/
|
||||
public abstract void saveData();
|
||||
|
||||
/**
|
||||
* Set player data that will persist restarts
|
||||
@ -45,35 +232,60 @@ public interface PlotPlayer extends CommandCaller {
|
||||
* - For session only data use meta
|
||||
* @param key
|
||||
*/
|
||||
void setAttribute(String key);
|
||||
public abstract void setAttribute(String key);
|
||||
|
||||
/**
|
||||
* The attribute will be either true or false
|
||||
* @param key
|
||||
*/
|
||||
boolean getAttribute(String key);
|
||||
public abstract boolean getAttribute(String key);
|
||||
|
||||
/**
|
||||
* Remove an attribute from a player
|
||||
* @param key
|
||||
*/
|
||||
void removeAttribute(String key);
|
||||
public abstract void removeAttribute(String key);
|
||||
|
||||
void setMeta(String key, Object value);
|
||||
Object getMeta(String key);
|
||||
void deleteMeta(String key);
|
||||
/**
|
||||
* Set the player's local weather
|
||||
* @param weather
|
||||
*/
|
||||
public abstract void setWeather(PlotWeather weather);
|
||||
|
||||
void setWeather(PlotWeather weather);
|
||||
/**
|
||||
* Get the player's gamemode
|
||||
* @return
|
||||
*/
|
||||
public abstract PlotGamemode getGamemode();
|
||||
|
||||
PlotGamemode getGamemode();
|
||||
/**
|
||||
* Set the player's gamemode
|
||||
* @param gamemode
|
||||
*/
|
||||
public abstract void setGamemode(PlotGamemode gamemode);
|
||||
|
||||
void setGamemode(PlotGamemode gamemode);
|
||||
/**
|
||||
* Set the player's local time
|
||||
* @param time
|
||||
*/
|
||||
public abstract void setTime(long time);
|
||||
|
||||
void setTime(long time);
|
||||
/**
|
||||
* Set the player's fly mode
|
||||
* @param fly
|
||||
*/
|
||||
public abstract void setFlight(boolean fly);
|
||||
|
||||
void setFlight(boolean fly);
|
||||
/**
|
||||
* Play music at a location for the player
|
||||
* @param loc
|
||||
* @param id
|
||||
*/
|
||||
public abstract void playMusic(Location loc, int id);
|
||||
|
||||
void playMusic(Location loc, int id);
|
||||
|
||||
void kick(String message);
|
||||
/**
|
||||
* Kick the player from the game
|
||||
* @param message
|
||||
*/
|
||||
public abstract void kick(String message);
|
||||
}
|
||||
|
@ -28,8 +28,6 @@ import java.util.UUID;
|
||||
import com.intellectualcrafters.plot.flag.Flag;
|
||||
import com.intellectualcrafters.plot.flag.FlagManager;
|
||||
import com.intellectualcrafters.plot.object.comment.PlotComment;
|
||||
import com.intellectualcrafters.plot.util.BlockManager;
|
||||
import com.intellectualcrafters.plot.util.MainUtil;
|
||||
|
||||
/**
|
||||
* plot settings
|
||||
@ -111,14 +109,6 @@ public class PlotSettings {
|
||||
this.merged[direction] = merged;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return biome at plot loc
|
||||
*/
|
||||
public String getBiome() {
|
||||
final Location loc = MainUtil.getPlotBottomLoc(this.plot.world, this.plot.getId()).add(1, 0, 1);
|
||||
return BlockManager.manager.getBiome(loc.getWorld(), loc.getX(), loc.getZ());
|
||||
}
|
||||
|
||||
public BlockLoc getPosition() {
|
||||
if (this.position == null) {
|
||||
return new BlockLoc(0, 0, 0);
|
||||
|
@ -35,7 +35,7 @@ public enum Permissions {
|
||||
|
||||
|
||||
public static boolean hasPermission(final PlotPlayer player, final String perm) {
|
||||
if ((player == null) || player.isOp() || player.hasPermission(ADMIN.s)) {
|
||||
if ((player == null) || player.hasPermission(ADMIN.s)) {
|
||||
return true;
|
||||
}
|
||||
if (player.hasPermission(perm)) {
|
||||
@ -53,7 +53,7 @@ public enum Permissions {
|
||||
}
|
||||
|
||||
public static boolean hasPermission(final PlotPlayer player, final String perm, boolean notify) {
|
||||
if ((player == null) || player.isOp() || player.hasPermission(ADMIN.s)) {
|
||||
if ((player == null) || player.hasPermission(ADMIN.s)) {
|
||||
return true;
|
||||
}
|
||||
if (player.hasPermission(perm)) {
|
||||
@ -74,7 +74,7 @@ public enum Permissions {
|
||||
}
|
||||
|
||||
public static int hasPermissionRange(final PlotPlayer player, final String stub, final int range) {
|
||||
if ((player == null) || player.isOp() || player.hasPermission(ADMIN.s)) {
|
||||
if ((player == null) || player.hasPermission(ADMIN.s)) {
|
||||
return Integer.MAX_VALUE;
|
||||
}
|
||||
if (player.hasPermission(stub + ".*")) {
|
||||
|
Reference in New Issue
Block a user