mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 21:26:45 +01:00
Refactor + optimizations
This commit is contained in:
parent
7ce300c47b
commit
4eae78590f
@ -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 + ".*")) {
|
||||
|
@ -2,13 +2,16 @@ package com.plotsquared.bukkit;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Arrays;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.command.PluginCommand;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.generator.ChunkGenerator;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
@ -36,9 +39,9 @@ import com.intellectualcrafters.plot.util.MainUtil;
|
||||
import com.intellectualcrafters.plot.util.SchematicHandler;
|
||||
import com.intellectualcrafters.plot.util.SetupUtils;
|
||||
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.commands.BukkitCommand;
|
||||
import com.plotsquared.bukkit.database.plotme.ClassicPlotMeConnector;
|
||||
import com.plotsquared.bukkit.database.plotme.LikePlotMeConverter;
|
||||
import com.plotsquared.bukkit.database.plotme.PlotMeConnector_017;
|
||||
@ -55,27 +58,28 @@ import com.plotsquared.bukkit.listeners.WorldEvents;
|
||||
import com.plotsquared.bukkit.listeners.worldedit.WEListener;
|
||||
import com.plotsquared.bukkit.listeners.worldedit.WESubscriber;
|
||||
import com.plotsquared.bukkit.titles.DefaultTitle;
|
||||
import com.plotsquared.bukkit.util.BukkitChunkManager;
|
||||
import com.plotsquared.bukkit.util.BukkitCommand;
|
||||
import com.plotsquared.bukkit.util.BukkitEconHandler;
|
||||
import com.plotsquared.bukkit.util.BukkitEventUtil;
|
||||
import com.plotsquared.bukkit.util.BukkitHybridUtils;
|
||||
import com.plotsquared.bukkit.util.bukkit.BukkitChunkManager;
|
||||
import com.plotsquared.bukkit.util.bukkit.BukkitEconHandler;
|
||||
import com.plotsquared.bukkit.util.bukkit.BukkitEventUtil;
|
||||
import com.plotsquared.bukkit.util.bukkit.BukkitInventoryUtil;
|
||||
import com.plotsquared.bukkit.util.bukkit.BukkitSchematicHandler;
|
||||
import com.plotsquared.bukkit.util.bukkit.BukkitSetBlockManager;
|
||||
import com.plotsquared.bukkit.util.bukkit.BukkitSetupUtils;
|
||||
import com.plotsquared.bukkit.util.bukkit.BukkitTaskManager;
|
||||
import com.plotsquared.bukkit.util.bukkit.BukkitUtil;
|
||||
import com.plotsquared.bukkit.util.bukkit.Metrics;
|
||||
import com.plotsquared.bukkit.util.bukkit.SendChunk;
|
||||
import com.plotsquared.bukkit.util.bukkit.SetBlockFast;
|
||||
import com.plotsquared.bukkit.util.bukkit.SetBlockFast_1_8;
|
||||
import com.plotsquared.bukkit.util.bukkit.SetBlockSlow;
|
||||
import com.plotsquared.bukkit.util.bukkit.SetGenCB;
|
||||
import com.plotsquared.bukkit.util.bukkit.uuid.FileUUIDHandler;
|
||||
import com.plotsquared.bukkit.util.bukkit.uuid.SQLUUIDHandler;
|
||||
import com.plotsquared.bukkit.util.BukkitInventoryUtil;
|
||||
import com.plotsquared.bukkit.util.BukkitSchematicHandler;
|
||||
import com.plotsquared.bukkit.util.BukkitSetBlockManager;
|
||||
import com.plotsquared.bukkit.util.BukkitSetupUtils;
|
||||
import com.plotsquared.bukkit.util.BukkitTaskManager;
|
||||
import com.plotsquared.bukkit.util.BukkitUtil;
|
||||
import com.plotsquared.bukkit.util.Metrics;
|
||||
import com.plotsquared.bukkit.util.SendChunk;
|
||||
import com.plotsquared.bukkit.util.SetBlockFast;
|
||||
import com.plotsquared.bukkit.util.SetBlockFast_1_8;
|
||||
import com.plotsquared.bukkit.util.SetBlockSlow;
|
||||
import com.plotsquared.bukkit.util.SetGenCB;
|
||||
import com.plotsquared.bukkit.uuid.DefaultUUIDWrapper;
|
||||
import com.plotsquared.bukkit.uuid.FileUUIDHandler;
|
||||
import com.plotsquared.bukkit.uuid.LowerOfflineUUIDWrapper;
|
||||
import com.plotsquared.bukkit.uuid.OfflineUUIDWrapper;
|
||||
import com.plotsquared.bukkit.uuid.SQLUUIDHandler;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.bukkit.WorldEditPlugin;
|
||||
|
||||
@ -543,4 +547,21 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
|
||||
// Already initialized in UUID handler
|
||||
return AbstractTitle.TITLE_CLASS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PlotPlayer wrapPlayer(Object obj) {
|
||||
if (obj instanceof Player) {
|
||||
return BukkitUtil.getPlayer((Player) obj);
|
||||
}
|
||||
else if (obj instanceof OfflinePlayer) {
|
||||
return BukkitUtil.getPlayer((OfflinePlayer) obj);
|
||||
}
|
||||
else if (obj instanceof String) {
|
||||
return UUIDHandler.getPlayer((String) obj);
|
||||
}
|
||||
else if (obj instanceof UUID) {
|
||||
return UUIDHandler.getPlayer((UUID) obj);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
package com.plotsquared.bukkit.util.bukkit.chat;
|
||||
package com.plotsquared.bukkit.chat;
|
||||
|
||||
import java.lang.reflect.Array;
|
||||
import java.util.Arrays;
|
@ -1,6 +1,6 @@
|
||||
package com.plotsquared.bukkit.util.bukkit.chat;
|
||||
package com.plotsquared.bukkit.chat;
|
||||
|
||||
import static com.plotsquared.bukkit.util.bukkit.chat.TextualComponent.rawText;
|
||||
import static com.plotsquared.bukkit.chat.TextualComponent.rawText;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.StringWriter;
|
@ -1,4 +1,4 @@
|
||||
package com.plotsquared.bukkit.util.bukkit.chat;
|
||||
package com.plotsquared.bukkit.chat;
|
||||
|
||||
import java.io.IOException;
|
||||
|
@ -1,4 +1,4 @@
|
||||
package com.plotsquared.bukkit.util.bukkit.chat;
|
||||
package com.plotsquared.bukkit.chat;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
@ -1,4 +1,4 @@
|
||||
package com.plotsquared.bukkit.util.bukkit.chat;
|
||||
package com.plotsquared.bukkit.chat;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
@ -1,4 +1,4 @@
|
||||
package com.plotsquared.bukkit.util.bukkit.chat;
|
||||
package com.plotsquared.bukkit.chat;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Method;
|
@ -1,4 +1,4 @@
|
||||
package com.plotsquared.bukkit.util.bukkit.chat;
|
||||
package com.plotsquared.bukkit.chat;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
@ -23,8 +23,8 @@ import com.intellectualcrafters.plot.object.RegionWrapper;
|
||||
import com.intellectualcrafters.plot.util.ChunkManager;
|
||||
import com.intellectualcrafters.plot.util.MainUtil;
|
||||
import com.intellectualcrafters.plot.util.TaskManager;
|
||||
import com.plotsquared.bukkit.util.bukkit.BukkitChunkManager;
|
||||
import com.plotsquared.bukkit.util.bukkit.BukkitSetBlockManager;
|
||||
import com.plotsquared.bukkit.util.BukkitChunkManager;
|
||||
import com.plotsquared.bukkit.util.BukkitSetBlockManager;
|
||||
|
||||
public class AugmentedPopulator extends BlockPopulator {
|
||||
public final PlotWorld plotworld;
|
||||
|
@ -40,7 +40,6 @@ import com.intellectualcrafters.plot.object.RegionWrapper;
|
||||
import com.intellectualcrafters.plot.object.SetupObject;
|
||||
import com.intellectualcrafters.plot.util.ChunkManager;
|
||||
import com.plotsquared.bukkit.listeners.WorldEvents;
|
||||
import com.plotsquared.bukkit.object.BukkitPlotPopulator;
|
||||
|
||||
public abstract class BukkitPlotGenerator extends ChunkGenerator {
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
package com.plotsquared.bukkit.object;
|
||||
package com.plotsquared.bukkit.generator;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map.Entry;
|
@ -36,7 +36,6 @@ import com.intellectualcrafters.plot.object.PlotManager;
|
||||
import com.intellectualcrafters.plot.object.PlotWorld;
|
||||
import com.intellectualcrafters.plot.object.PseudoRandom;
|
||||
import com.intellectualcrafters.plot.object.RegionWrapper;
|
||||
import com.plotsquared.bukkit.object.BukkitPlotPopulator;
|
||||
|
||||
/**
|
||||
* The default generator is very messy, as we have decided to try externalize all calculations from within the loop. -
|
||||
|
@ -14,7 +14,6 @@ import com.intellectualcrafters.plot.object.PseudoRandom;
|
||||
import com.intellectualcrafters.plot.object.RegionWrapper;
|
||||
import com.intellectualcrafters.plot.object.schematic.PlotItem;
|
||||
import com.intellectualcrafters.plot.util.BlockManager;
|
||||
import com.plotsquared.bukkit.object.BukkitPlotPopulator;
|
||||
|
||||
/**
|
||||
* @author Citymonstret
|
||||
|
@ -18,7 +18,7 @@ import com.intellectualcrafters.plot.object.PlotId;
|
||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||
import com.intellectualcrafters.plot.object.PlotWorld;
|
||||
import com.intellectualcrafters.plot.util.MainUtil;
|
||||
import com.plotsquared.bukkit.util.bukkit.BukkitUtil;
|
||||
import com.plotsquared.bukkit.util.BukkitUtil;
|
||||
|
||||
/**
|
||||
* Created 2015-07-13 for PlotSquaredGit
|
||||
|
@ -36,8 +36,8 @@ import com.intellectualcrafters.plot.object.Plot;
|
||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||
import com.intellectualcrafters.plot.util.UUIDHandler;
|
||||
import com.plotsquared.bukkit.events.PlayerEnterPlotEvent;
|
||||
import com.plotsquared.bukkit.util.bukkit.BukkitPlayerFunctions;
|
||||
import com.plotsquared.bukkit.util.bukkit.BukkitUtil;
|
||||
import com.plotsquared.bukkit.util.BukkitPlayerFunctions;
|
||||
import com.plotsquared.bukkit.util.BukkitUtil;
|
||||
|
||||
/**
|
||||
* @author Citymonstret
|
||||
|
@ -142,7 +142,7 @@ import com.intellectualcrafters.plot.util.UUIDHandler;
|
||||
import com.plotsquared.bukkit.listeners.worldedit.WEManager;
|
||||
import com.plotsquared.bukkit.object.BukkitLazyBlock;
|
||||
import com.plotsquared.bukkit.object.BukkitPlayer;
|
||||
import com.plotsquared.bukkit.util.bukkit.BukkitUtil;
|
||||
import com.plotsquared.bukkit.util.BukkitUtil;
|
||||
|
||||
/**
|
||||
* Player Events involving plots
|
||||
@ -445,6 +445,10 @@ public class PlayerEvents extends com.plotsquared.listener.PlotListener implemen
|
||||
player.saveData();
|
||||
}
|
||||
final PlotPlayer pp = BukkitUtil.getPlayer(player);
|
||||
|
||||
// Set last location
|
||||
pp.setMeta("location", BukkitUtil.getLocation(player.getLocation()));
|
||||
|
||||
final String username = pp.getName();
|
||||
final StringWrapper name = new StringWrapper(username);
|
||||
final UUID uuid = pp.getUUID();
|
||||
@ -485,6 +489,12 @@ public class PlayerEvents extends com.plotsquared.listener.PlotListener implemen
|
||||
org.bukkit.Location to = event.getTo();
|
||||
int x2;
|
||||
if (getInt(from.getX()) != (x2 = getInt(to.getX()))) {
|
||||
Player player = event.getPlayer();
|
||||
PlotPlayer pp = BukkitUtil.getPlayer(player);
|
||||
|
||||
// Set last location
|
||||
pp.setMeta("location", BukkitUtil.getLocation(to));
|
||||
|
||||
String worldname = to.getWorld().getName();
|
||||
PlotWorld plotworld = PS.get().getPlotWorld(worldname);
|
||||
if (plotworld == null) {
|
||||
@ -492,8 +502,6 @@ public class PlayerEvents extends com.plotsquared.listener.PlotListener implemen
|
||||
}
|
||||
PlotManager plotManager = PS.get().getPlotManager(worldname);
|
||||
PlotId id = plotManager.getPlotId(plotworld, x2, 0, getInt(to.getZ()));
|
||||
Player player = event.getPlayer();
|
||||
PlotPlayer pp = BukkitUtil.getPlayer(player);
|
||||
Plot lastPlot = (Plot) pp.getMeta("lastplot");
|
||||
if (id == null) {
|
||||
if (lastPlot == null) {
|
||||
@ -547,6 +555,12 @@ public class PlayerEvents extends com.plotsquared.listener.PlotListener implemen
|
||||
}
|
||||
int z2;
|
||||
if (getInt(from.getZ()) != (z2 = getInt(to.getZ())) ) {
|
||||
Player player = event.getPlayer();
|
||||
PlotPlayer pp = BukkitUtil.getPlayer(player);
|
||||
|
||||
// Set last location
|
||||
pp.setMeta("location", BukkitUtil.getLocation(to));
|
||||
|
||||
String worldname = to.getWorld().getName();
|
||||
PlotWorld plotworld = PS.get().getPlotWorld(worldname);
|
||||
if (plotworld == null) {
|
||||
@ -554,8 +568,6 @@ public class PlayerEvents extends com.plotsquared.listener.PlotListener implemen
|
||||
}
|
||||
PlotManager plotManager = PS.get().getPlotManager(worldname);
|
||||
PlotId id = plotManager.getPlotId(plotworld, x2, 0, z2);
|
||||
Player player = event.getPlayer();
|
||||
PlotPlayer pp = BukkitUtil.getPlayer(player);
|
||||
Plot lastPlot = (Plot) pp.getMeta("lastplot");
|
||||
if (id == null) {
|
||||
if (lastPlot == null) {
|
||||
@ -722,13 +734,19 @@ public class PlayerEvents extends com.plotsquared.listener.PlotListener implemen
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void onWorldChanged(final PlayerChangedWorldEvent event) {
|
||||
final PlotPlayer player = BukkitUtil.getPlayer(event.getPlayer());
|
||||
Player player = event.getPlayer();
|
||||
final PlotPlayer pp = BukkitUtil.getPlayer(player);
|
||||
|
||||
// Delete last location
|
||||
BukkitUtil.getPlayer(event.getPlayer()).deleteMeta("location");
|
||||
BukkitUtil.getPlayer(event.getPlayer()).deleteMeta("lastplot");
|
||||
|
||||
if (PS.get().worldEdit != null) {
|
||||
if (!Permissions.hasPermission(player, PERMISSION_WORLDEDIT_BYPASS)) {
|
||||
WEManager.bypass.remove(player.getName());
|
||||
if (!Permissions.hasPermission(pp, PERMISSION_WORLDEDIT_BYPASS)) {
|
||||
WEManager.bypass.remove(pp.getName());
|
||||
}
|
||||
else {
|
||||
WEManager.bypass.add(player.getName());
|
||||
WEManager.bypass.add(pp.getName());
|
||||
}
|
||||
}
|
||||
((BukkitPlayer) player).hasPerm = new HashSet<>();
|
||||
@ -1382,6 +1400,8 @@ public class PlayerEvents extends com.plotsquared.listener.PlotListener implemen
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void onTeleport(final PlayerTeleportEvent event) {
|
||||
if (event.getTo() == null || event.getFrom() == null) {
|
||||
BukkitUtil.getPlayer(event.getPlayer()).deleteMeta("location");
|
||||
BukkitUtil.getPlayer(event.getPlayer()).deleteMeta("lastplot");
|
||||
return;
|
||||
}
|
||||
final org.bukkit.Location from = event.getFrom();
|
||||
@ -1389,6 +1409,12 @@ public class PlayerEvents extends com.plotsquared.listener.PlotListener implemen
|
||||
|
||||
int x2;
|
||||
if (getInt(from.getX()) != (x2 = getInt(to.getX()))) {
|
||||
Player player = event.getPlayer();
|
||||
PlotPlayer pp = BukkitUtil.getPlayer(player);
|
||||
|
||||
// Set last location
|
||||
pp.setMeta("location", BukkitUtil.getLocation(to));
|
||||
|
||||
String worldname = to.getWorld().getName();
|
||||
PlotWorld plotworld = PS.get().getPlotWorld(worldname);
|
||||
if (plotworld == null) {
|
||||
@ -1396,8 +1422,6 @@ public class PlayerEvents extends com.plotsquared.listener.PlotListener implemen
|
||||
}
|
||||
PlotManager plotManager = PS.get().getPlotManager(worldname);
|
||||
PlotId id = plotManager.getPlotId(plotworld, x2, 0, getInt(to.getZ()));
|
||||
Player player = event.getPlayer();
|
||||
PlotPlayer pp = BukkitUtil.getPlayer(player);
|
||||
Plot lastPlot = (Plot) pp.getMeta("lastplot");
|
||||
if (id == null) {
|
||||
if (lastPlot == null) {
|
||||
@ -1451,6 +1475,12 @@ public class PlayerEvents extends com.plotsquared.listener.PlotListener implemen
|
||||
}
|
||||
int z2;
|
||||
if (getInt(from.getZ()) != (z2 = getInt(to.getZ())) ) {
|
||||
Player player = event.getPlayer();
|
||||
PlotPlayer pp = BukkitUtil.getPlayer(player);
|
||||
|
||||
// Set last location
|
||||
pp.setMeta("location", BukkitUtil.getLocation(to));
|
||||
|
||||
String worldname = to.getWorld().getName();
|
||||
PlotWorld plotworld = PS.get().getPlotWorld(worldname);
|
||||
if (plotworld == null) {
|
||||
@ -1458,8 +1488,6 @@ public class PlayerEvents extends com.plotsquared.listener.PlotListener implemen
|
||||
}
|
||||
PlotManager plotManager = PS.get().getPlotManager(worldname);
|
||||
PlotId id = plotManager.getPlotId(plotworld, x2, 0, z2);
|
||||
Player player = event.getPlayer();
|
||||
PlotPlayer pp = BukkitUtil.getPlayer(player);
|
||||
Plot lastPlot = (Plot) pp.getMeta("lastplot");
|
||||
if (id == null) {
|
||||
if (lastPlot == null) {
|
||||
|
@ -27,7 +27,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.plotsquared.bukkit.util.bukkit.BukkitUtil;
|
||||
import com.plotsquared.bukkit.util.BukkitUtil;
|
||||
import com.plotsquared.listener.PlotListener;
|
||||
|
||||
public class PlayerEvents_1_8 extends PlotListener implements Listener {
|
||||
|
@ -13,7 +13,7 @@ import com.intellectualcrafters.plot.flag.FlagManager;
|
||||
import com.intellectualcrafters.plot.object.Location;
|
||||
import com.intellectualcrafters.plot.object.Plot;
|
||||
import com.intellectualcrafters.plot.util.MainUtil;
|
||||
import com.plotsquared.bukkit.util.bukkit.BukkitUtil;
|
||||
import com.plotsquared.bukkit.util.BukkitUtil;
|
||||
|
||||
public class PlayerEvents_1_8_3 implements Listener {
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
|
@ -54,7 +54,7 @@ import com.intellectualcrafters.plot.util.Permissions;
|
||||
import com.intellectualcrafters.plot.util.UUIDHandler;
|
||||
import com.plotsquared.bukkit.events.PlayerEnterPlotEvent;
|
||||
import com.plotsquared.bukkit.events.PlayerLeavePlotEvent;
|
||||
import com.plotsquared.bukkit.util.bukkit.BukkitUtil;
|
||||
import com.plotsquared.bukkit.util.BukkitUtil;
|
||||
import com.plotsquared.listener.PlotListener;
|
||||
|
||||
/**
|
||||
|
@ -17,7 +17,7 @@ import com.intellectualcrafters.plot.flag.FlagManager;
|
||||
import com.intellectualcrafters.plot.object.Location;
|
||||
import com.intellectualcrafters.plot.object.Plot;
|
||||
import com.intellectualcrafters.plot.util.MainUtil;
|
||||
import com.plotsquared.bukkit.util.bukkit.BukkitUtil;
|
||||
import com.plotsquared.bukkit.util.BukkitUtil;
|
||||
|
||||
public class TNTListener implements Listener {
|
||||
private double lastRadius;
|
||||
|
@ -19,7 +19,7 @@ import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||
import com.intellectualcrafters.plot.object.RegionWrapper;
|
||||
import com.intellectualcrafters.plot.util.MainUtil;
|
||||
import com.intellectualcrafters.plot.util.Permissions;
|
||||
import com.plotsquared.bukkit.util.bukkit.BukkitUtil;
|
||||
import com.plotsquared.bukkit.util.BukkitUtil;
|
||||
import com.sk89q.worldedit.BlockVector;
|
||||
import com.sk89q.worldedit.bukkit.selections.Selection;
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
package com.plotsquared.bukkit.object;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.UUID;
|
||||
|
||||
@ -13,7 +12,6 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.permissions.Permission;
|
||||
import org.bukkit.permissions.PermissionDefault;
|
||||
|
||||
import com.intellectualcrafters.plot.commands.RequiredType;
|
||||
import com.intellectualcrafters.plot.config.C;
|
||||
import com.intellectualcrafters.plot.config.Settings;
|
||||
import com.intellectualcrafters.plot.object.Location;
|
||||
@ -23,19 +21,16 @@ 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.bukkit.util.bukkit.BukkitUtil;
|
||||
import com.plotsquared.bukkit.util.BukkitUtil;
|
||||
|
||||
public class BukkitPlayer implements PlotPlayer {
|
||||
public class BukkitPlayer extends PlotPlayer {
|
||||
|
||||
public final Player player;
|
||||
private UUID uuid;
|
||||
private String name;
|
||||
private int op = 0;
|
||||
private long last = 0;
|
||||
public HashSet<String> hasPerm = new HashSet<>();
|
||||
public HashSet<String> noPerm = new HashSet<>();
|
||||
|
||||
private HashMap<String, Object> meta;
|
||||
|
||||
/**
|
||||
* Please do not use this method. Instead use BukkitUtil.getPlayer(Player), as it caches player objects.
|
||||
@ -54,7 +49,8 @@ public class BukkitPlayer implements PlotPlayer {
|
||||
|
||||
@Override
|
||||
public Location getLocation() {
|
||||
return BukkitUtil.getLocation(this.player);
|
||||
Location loc = super.getLocation();
|
||||
return loc == null ? BukkitUtil.getLocation(this.player) : loc;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -100,20 +96,6 @@ public class BukkitPlayer implements PlotPlayer {
|
||||
this.player.teleport(new org.bukkit.Location(BukkitUtil.getWorld(loc.getWorld()), loc.getX() + 0.5, loc.getY(), loc.getZ() + 0.5, loc.getYaw(), loc.getPitch()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOp() {
|
||||
if (this.op != 0) {
|
||||
return this.op != 1;
|
||||
}
|
||||
final boolean result = this.player.isOp();
|
||||
if (!result) {
|
||||
this.op = 1;
|
||||
return false;
|
||||
}
|
||||
this.op = 2;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
if (this.name == null) {
|
||||
@ -138,34 +120,6 @@ public class BukkitPlayer implements PlotPlayer {
|
||||
return BukkitUtil.getLocationFull(this.player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMeta(String key, Object value) {
|
||||
if (this.meta == null) {
|
||||
this.meta = new HashMap<String, Object>();
|
||||
}
|
||||
this.meta.put(key, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getMeta(String key) {
|
||||
if (this.meta != null) {
|
||||
return this.meta.get(key);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteMeta(String key) {
|
||||
if (this.meta != null) {
|
||||
this.meta.remove(key);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAttribute(String key) {
|
||||
key = "plotsquared_user_attributes." + key;
|
||||
@ -202,11 +156,6 @@ public class BukkitPlayer implements PlotPlayer {
|
||||
player.saveData();
|
||||
}
|
||||
|
||||
@Override
|
||||
public RequiredType getSuperCaller() {
|
||||
return RequiredType.PLAYER;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setWeather(PlotWeather weather) {
|
||||
switch (weather) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
package com.plotsquared.bukkit.util.bukkit;
|
||||
package com.plotsquared.bukkit.util;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
@ -1,4 +1,4 @@
|
||||
package com.plotsquared.bukkit.commands;
|
||||
package com.plotsquared.bukkit.util;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
@ -16,7 +16,6 @@ import com.intellectualcrafters.plot.commands.MainCommand;
|
||||
import com.intellectualcrafters.plot.object.ConsolePlayer;
|
||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||
import com.intellectualcrafters.plot.util.StringComparison;
|
||||
import com.plotsquared.bukkit.util.bukkit.BukkitUtil;
|
||||
import com.plotsquared.general.commands.Command;
|
||||
|
||||
/**
|
@ -1,4 +1,4 @@
|
||||
package com.plotsquared.bukkit.util.bukkit;
|
||||
package com.plotsquared.bukkit.util;
|
||||
|
||||
import net.milkbowl.vault.economy.Economy;
|
||||
import net.milkbowl.vault.permission.Permission;
|
@ -1,4 +1,4 @@
|
||||
package com.plotsquared.bukkit.util.bukkit;
|
||||
package com.plotsquared.bukkit.util;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.UUID;
|
@ -37,7 +37,6 @@ import com.intellectualcrafters.plot.util.MainUtil;
|
||||
import com.intellectualcrafters.plot.util.MathMan;
|
||||
import com.intellectualcrafters.plot.util.TaskManager;
|
||||
import com.plotsquared.bukkit.BukkitMain;
|
||||
import com.plotsquared.bukkit.util.bukkit.BukkitUtil;
|
||||
|
||||
public class BukkitHybridUtils extends HybridUtils {
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
package com.plotsquared.bukkit.util.bukkit;
|
||||
package com.plotsquared.bukkit.util;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
@ -18,7 +18,7 @@
|
||||
// /
|
||||
// You can contact us via: support@intellectualsites.com /
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
package com.plotsquared.bukkit.util.bukkit;
|
||||
package com.plotsquared.bukkit.util;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
@ -18,7 +18,7 @@
|
||||
// /
|
||||
// You can contact us via: support@intellectualsites.com /
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
package com.plotsquared.bukkit.util.bukkit;
|
||||
package com.plotsquared.bukkit.util;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
@ -1,4 +1,4 @@
|
||||
package com.plotsquared.bukkit.util.bukkit;
|
||||
package com.plotsquared.bukkit.util;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
@ -1,4 +1,4 @@
|
||||
package com.plotsquared.bukkit.util.bukkit;
|
||||
package com.plotsquared.bukkit.util;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Map.Entry;
|
@ -1,4 +1,4 @@
|
||||
package com.plotsquared.bukkit.util.bukkit;
|
||||
package com.plotsquared.bukkit.util;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
|
@ -1,4 +1,4 @@
|
||||
package com.plotsquared.bukkit.util.bukkit;
|
||||
package com.plotsquared.bukkit.util;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
@ -23,7 +23,6 @@ import org.bukkit.material.Step;
|
||||
import org.bukkit.material.Tree;
|
||||
import org.bukkit.material.WoodenStep;
|
||||
import org.bukkit.material.Wool;
|
||||
import org.spongepowered.api.world.extent.Extent;
|
||||
|
||||
import com.intellectualcrafters.plot.object.Location;
|
||||
import com.intellectualcrafters.plot.object.PlotBlock;
|
@ -18,7 +18,7 @@
|
||||
// /
|
||||
// You can contact us via: support@intellectualsites.com /
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
package com.plotsquared.bukkit.util.bukkit;
|
||||
package com.plotsquared.bukkit.util;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.ByteArrayOutputStream;
|
@ -1,4 +1,4 @@
|
||||
package com.plotsquared.bukkit.util.bukkit;
|
||||
package com.plotsquared.bukkit.util;
|
||||
|
||||
import static com.intellectualcrafters.plot.util.ReflectionUtils.callConstructor;
|
||||
import static com.intellectualcrafters.plot.util.ReflectionUtils.callMethod;
|
@ -1,4 +1,4 @@
|
||||
package com.plotsquared.bukkit.util.bukkit;
|
||||
package com.plotsquared.bukkit.util;
|
||||
|
||||
import static com.intellectualcrafters.plot.util.ReflectionUtils.getRefClass;
|
||||
|
@ -18,7 +18,7 @@
|
||||
// /
|
||||
// You can contact us via: support@intellectualsites.com /
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
package com.plotsquared.bukkit.util.bukkit;
|
||||
package com.plotsquared.bukkit.util;
|
||||
|
||||
import static com.intellectualcrafters.plot.util.ReflectionUtils.getRefClass;
|
||||
|
@ -18,7 +18,7 @@
|
||||
// /
|
||||
// You can contact us via: support@intellectualsites.com /
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
package com.plotsquared.bukkit.util.bukkit;
|
||||
package com.plotsquared.bukkit.util;
|
||||
|
||||
import static com.intellectualcrafters.plot.util.ReflectionUtils.getRefClass;
|
||||
|
@ -1,4 +1,4 @@
|
||||
package com.plotsquared.bukkit.util.bukkit;
|
||||
package com.plotsquared.bukkit.util;
|
||||
|
||||
import java.util.Collection;
|
||||
|
@ -1,4 +1,4 @@
|
||||
package com.plotsquared.bukkit.util.bukkit;
|
||||
package com.plotsquared.bukkit.util;
|
||||
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.lang.reflect.Field;
|
@ -1,4 +1,4 @@
|
||||
package com.plotsquared.bukkit.util.bukkit.uuid;
|
||||
package com.plotsquared.bukkit.uuid;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
@ -1,4 +1,4 @@
|
||||
package com.plotsquared.bukkit.util.bukkit.uuid;
|
||||
package com.plotsquared.bukkit.uuid;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
@ -11,6 +11,7 @@ import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
@ -23,7 +24,6 @@ import org.spongepowered.api.block.BlockTypes;
|
||||
import org.spongepowered.api.data.manipulator.block.StoneData;
|
||||
import org.spongepowered.api.entity.player.Player;
|
||||
import org.spongepowered.api.entity.player.gamemode.GameModes;
|
||||
import org.spongepowered.api.event.EventHandler;
|
||||
import org.spongepowered.api.event.Subscribe;
|
||||
import org.spongepowered.api.event.entity.player.PlayerChatEvent;
|
||||
import org.spongepowered.api.event.state.PreInitializationEvent;
|
||||
@ -38,7 +38,6 @@ import org.spongepowered.api.text.translation.Translation;
|
||||
import org.spongepowered.api.world.DimensionTypes;
|
||||
import org.spongepowered.api.world.GeneratorTypes;
|
||||
import org.spongepowered.api.world.World;
|
||||
import org.spongepowered.api.world.gen.WorldGeneratorModifier;
|
||||
|
||||
import com.google.common.base.Optional;
|
||||
import com.google.inject.Inject;
|
||||
@ -49,21 +48,18 @@ import com.intellectualcrafters.plot.config.C;
|
||||
import com.intellectualcrafters.plot.config.Configuration;
|
||||
import com.intellectualcrafters.plot.config.Settings;
|
||||
import com.intellectualcrafters.plot.generator.HybridUtils;
|
||||
import com.intellectualcrafters.plot.generator.PlotGenerator;
|
||||
import com.intellectualcrafters.plot.object.PlotBlock;
|
||||
import com.intellectualcrafters.plot.object.PlotManager;
|
||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||
import com.intellectualcrafters.plot.object.PlotWorld;
|
||||
import com.intellectualcrafters.plot.util.AbstractTitle;
|
||||
import com.intellectualcrafters.plot.util.BlockManager;
|
||||
import com.intellectualcrafters.plot.util.ChunkManager;
|
||||
import com.intellectualcrafters.plot.util.ConsoleColors;
|
||||
import com.intellectualcrafters.plot.util.EconHandler;
|
||||
import com.intellectualcrafters.plot.util.EventUtil;
|
||||
import com.intellectualcrafters.plot.util.InventoryUtil;
|
||||
import com.intellectualcrafters.plot.util.SchematicHandler;
|
||||
import com.intellectualcrafters.plot.util.SetupUtils;
|
||||
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.sponge.generator.SpongeBasicGen;
|
||||
@ -72,11 +68,13 @@ import com.plotsquared.sponge.generator.WorldModify;
|
||||
import com.plotsquared.sponge.listener.MainListener;
|
||||
import com.plotsquared.sponge.util.KillRoadMobs;
|
||||
import com.plotsquared.sponge.util.SpongeBlockManager;
|
||||
import com.plotsquared.sponge.util.SpongeChunkManager;
|
||||
import com.plotsquared.sponge.util.SpongeCommand;
|
||||
import com.plotsquared.sponge.util.SpongeEventUtil;
|
||||
import com.plotsquared.sponge.util.SpongeInventoryUtil;
|
||||
import com.plotsquared.sponge.util.SpongeMetrics;
|
||||
import com.plotsquared.sponge.util.SpongeTaskManager;
|
||||
import com.plotsquared.sponge.util.SpongeTitleManager;
|
||||
import com.plotsquared.sponge.util.SpongeUtil;
|
||||
import com.plotsquared.sponge.uuid.SpongeLowerOfflineUUIDWrapper;
|
||||
import com.plotsquared.sponge.uuid.SpongeOnlineUUIDWrapper;
|
||||
@ -596,4 +594,21 @@ public class SpongeMain implements IPlotMain, PluginContainer {
|
||||
public AbstractTitle initTitleManager() {
|
||||
return new SpongeTitleManager();
|
||||
}
|
||||
|
||||
@Override
|
||||
public PlotPlayer wrapPlayer(Object obj) {
|
||||
if (obj instanceof Player) {
|
||||
return SpongeUtil.getPlayer((Player) obj);
|
||||
}
|
||||
// else if (obj instanceof OfflinePlayer) {
|
||||
// return BukkitUtil.getPlayer((OfflinePlayer) obj);
|
||||
// }
|
||||
else if (obj instanceof String) {
|
||||
return UUIDHandler.getPlayer((String) obj);
|
||||
}
|
||||
else if (obj instanceof UUID) {
|
||||
return UUIDHandler.getPlayer((UUID) obj);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
@ -4,10 +4,6 @@ import org.spongepowered.api.data.DataContainer;
|
||||
import org.spongepowered.api.world.WorldCreationSettings;
|
||||
import org.spongepowered.api.world.gen.WorldGenerator;
|
||||
import org.spongepowered.api.world.gen.WorldGeneratorModifier;
|
||||
import org.spongepowered.common.world.gen.SpongeWorldGenerator;
|
||||
|
||||
import com.intellectualcrafters.plot.PS;
|
||||
import com.plotsquared.sponge.SpongeMain;
|
||||
|
||||
public class WorldModify implements WorldGeneratorModifier {
|
||||
|
||||
|
@ -22,7 +22,6 @@ import org.spongepowered.api.block.BlockState;
|
||||
import org.spongepowered.api.entity.Entity;
|
||||
import org.spongepowered.api.entity.EntityTypes;
|
||||
import org.spongepowered.api.entity.player.Player;
|
||||
import org.spongepowered.api.event.Cancellable;
|
||||
import org.spongepowered.api.event.Subscribe;
|
||||
import org.spongepowered.api.event.block.BlockMoveEvent;
|
||||
import org.spongepowered.api.event.block.BlockRedstoneUpdateEvent;
|
||||
@ -36,20 +35,16 @@ import org.spongepowered.api.event.entity.player.PlayerChangeWorldEvent;
|
||||
import org.spongepowered.api.event.entity.player.PlayerChatEvent;
|
||||
import org.spongepowered.api.event.entity.player.PlayerInteractBlockEvent;
|
||||
import org.spongepowered.api.event.entity.player.PlayerJoinEvent;
|
||||
import org.spongepowered.api.event.entity.player.PlayerMessageEvent;
|
||||
import org.spongepowered.api.event.entity.player.PlayerMoveEvent;
|
||||
import org.spongepowered.api.event.entity.player.PlayerPlaceBlockEvent;
|
||||
import org.spongepowered.api.event.entity.player.PlayerQuitEvent;
|
||||
import org.spongepowered.api.event.message.CommandEvent;
|
||||
import org.spongepowered.api.event.network.PlayerConnectionEvent;
|
||||
import org.spongepowered.api.event.world.ChunkLoadEvent;
|
||||
import org.spongepowered.api.event.world.ChunkPreGenerateEvent;
|
||||
import org.spongepowered.api.event.world.ChunkPrePopulateEvent;
|
||||
import org.spongepowered.api.network.PlayerConnection;
|
||||
import org.spongepowered.api.text.Text;
|
||||
import org.spongepowered.api.text.Texts;
|
||||
import org.spongepowered.api.util.command.CommandSource;
|
||||
import org.spongepowered.api.util.event.callback.EventCallback;
|
||||
import org.spongepowered.api.world.World;
|
||||
import org.spongepowered.api.world.extent.Extent;
|
||||
|
||||
@ -80,7 +75,7 @@ import com.intellectualcrafters.plot.util.UUIDHandler;
|
||||
import com.plotsquared.bukkit.object.BukkitPlayer;
|
||||
import com.plotsquared.listener.PlotListener;
|
||||
import com.plotsquared.sponge.SpongeMain;
|
||||
import com.plotsquared.sponge.SpongePlayer;
|
||||
import com.plotsquared.sponge.object.SpongePlayer;
|
||||
import com.plotsquared.sponge.util.SpongeUtil;
|
||||
|
||||
public class MainListener {
|
||||
@ -557,10 +552,14 @@ public class MainListener {
|
||||
org.spongepowered.api.world.Location to = event.getNewLocation();
|
||||
int x2;
|
||||
if (getInt(from.getX()) != (x2 = getInt(to.getX()))) {
|
||||
Player player = event.getUser();
|
||||
PlotPlayer pp = SpongeUtil.getPlayer(player);
|
||||
Extent extent = to.getExtent();
|
||||
if (!(extent instanceof World)) {
|
||||
pp.deleteMeta("location");
|
||||
return;
|
||||
}
|
||||
pp.setMeta("location", SpongeUtil.getLocation(player));
|
||||
World world = (World) extent;
|
||||
String worldname = ((World) extent).getName();
|
||||
PlotWorld plotworld = PS.get().getPlotWorld(worldname);
|
||||
@ -569,8 +568,6 @@ public class MainListener {
|
||||
}
|
||||
PlotManager plotManager = PS.get().getPlotManager(worldname);
|
||||
PlotId id = plotManager.getPlotId(plotworld, x2, 0, getInt(to.getZ()));
|
||||
Player player = event.getUser();
|
||||
PlotPlayer pp = SpongeUtil.getPlayer(player);
|
||||
Plot lastPlot = (Plot) pp.getMeta("lastplot");
|
||||
if (id == null) {
|
||||
if (lastPlot == null) {
|
||||
@ -622,10 +619,14 @@ public class MainListener {
|
||||
}
|
||||
int z2;
|
||||
if (getInt(from.getZ()) != (z2 = getInt(to.getZ())) ) {
|
||||
Player player = event.getUser();
|
||||
PlotPlayer pp = SpongeUtil.getPlayer(player);
|
||||
Extent extent = to.getExtent();
|
||||
if (!(extent instanceof World)) {
|
||||
pp.deleteMeta("location");
|
||||
return;
|
||||
}
|
||||
pp.setMeta("location", SpongeUtil.getLocation(player));
|
||||
World world = (World) extent;
|
||||
String worldname = ((World) extent).getName();
|
||||
PlotWorld plotworld = PS.get().getPlotWorld(worldname);
|
||||
@ -634,8 +635,6 @@ public class MainListener {
|
||||
}
|
||||
PlotManager plotManager = PS.get().getPlotManager(worldname);
|
||||
PlotId id = plotManager.getPlotId(plotworld, x2, 0, z2);
|
||||
Player player = event.getUser();
|
||||
PlotPlayer pp = SpongeUtil.getPlayer(player);
|
||||
Plot lastPlot = (Plot) pp.getMeta("lastplot");
|
||||
if (id == null) {
|
||||
if (lastPlot == null) {
|
||||
@ -694,10 +693,14 @@ public class MainListener {
|
||||
org.spongepowered.api.world.Location to = event.getNewLocation();
|
||||
int x2;
|
||||
if (getInt(from.getX()) != (x2 = getInt(to.getX()))) {
|
||||
Player player = (Player) entity;
|
||||
PlotPlayer pp = SpongeUtil.getPlayer(player);
|
||||
Extent extent = to.getExtent();
|
||||
if (!(extent instanceof World)) {
|
||||
pp.deleteMeta("location");
|
||||
return;
|
||||
}
|
||||
pp.setMeta("location", SpongeUtil.getLocation(player));
|
||||
World world = (World) extent;
|
||||
String worldname = ((World) extent).getName();
|
||||
PlotWorld plotworld = PS.get().getPlotWorld(worldname);
|
||||
@ -706,8 +709,6 @@ public class MainListener {
|
||||
}
|
||||
PlotManager plotManager = PS.get().getPlotManager(worldname);
|
||||
PlotId id = plotManager.getPlotId(plotworld, x2, 0, getInt(to.getZ()));
|
||||
Player player = (Player) entity;
|
||||
PlotPlayer pp = SpongeUtil.getPlayer(player);
|
||||
Plot lastPlot = (Plot) pp.getMeta("lastplot");
|
||||
if (id == null) {
|
||||
if (lastPlot == null) {
|
||||
@ -759,10 +760,14 @@ public class MainListener {
|
||||
}
|
||||
int z2;
|
||||
if (getInt(from.getZ()) != (z2 = getInt(to.getZ())) ) {
|
||||
Player player = (Player) entity;
|
||||
PlotPlayer pp = SpongeUtil.getPlayer(player);
|
||||
Extent extent = to.getExtent();
|
||||
if (!(extent instanceof World)) {
|
||||
pp.deleteMeta("location");
|
||||
return;
|
||||
}
|
||||
pp.setMeta("location", SpongeUtil.getLocation(player));
|
||||
World world = (World) extent;
|
||||
String worldname = ((World) extent).getName();
|
||||
PlotWorld plotworld = PS.get().getPlotWorld(worldname);
|
||||
@ -771,8 +776,6 @@ public class MainListener {
|
||||
}
|
||||
PlotManager plotManager = PS.get().getPlotManager(worldname);
|
||||
PlotId id = plotManager.getPlotId(plotworld, x2, 0, z2);
|
||||
Player player = (Player) entity;
|
||||
PlotPlayer pp = SpongeUtil.getPlayer(player);
|
||||
Plot lastPlot = (Plot) pp.getMeta("lastplot");
|
||||
if (id == null) {
|
||||
if (lastPlot == null) {
|
||||
@ -828,6 +831,9 @@ public class MainListener {
|
||||
public void onWorldChange(PlayerChangeWorldEvent event) {
|
||||
final PlotPlayer player = SpongeUtil.getPlayer(event.getUser());
|
||||
|
||||
player.deleteMeta("location");
|
||||
player.deleteMeta("lastplot");
|
||||
|
||||
// TODO worldedit mask
|
||||
|
||||
((BukkitPlayer) player).hasPerm = new HashSet<>();
|
||||
|
@ -1,20 +1,14 @@
|
||||
package com.plotsquared.sponge;
|
||||
package com.plotsquared.sponge.object;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.spongepowered.api.entity.player.Player;
|
||||
import org.spongepowered.api.entity.player.gamemode.GameMode;
|
||||
import org.spongepowered.api.entity.player.gamemode.GameModes;
|
||||
import org.spongepowered.api.service.permission.PermissionService;
|
||||
import org.spongepowered.api.text.Texts;
|
||||
import org.spongepowered.api.text.chat.ChatTypes;
|
||||
import org.spongepowered.api.text.title.Title;
|
||||
import org.spongepowered.api.world.World;
|
||||
|
||||
import com.flowpowered.math.vector.Vector3d;
|
||||
import com.intellectualcrafters.plot.PS;
|
||||
import com.intellectualcrafters.plot.commands.RequiredType;
|
||||
import com.intellectualcrafters.plot.config.C;
|
||||
import com.intellectualcrafters.plot.config.Settings;
|
||||
@ -25,19 +19,17 @@ 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.sponge.SpongeMain;
|
||||
import com.plotsquared.sponge.util.SpongeUtil;
|
||||
|
||||
public class SpongePlayer implements PlotPlayer {
|
||||
public class SpongePlayer extends PlotPlayer {
|
||||
|
||||
public final Player player;
|
||||
private UUID uuid;
|
||||
private String name;
|
||||
private int op = 0;
|
||||
private long last = 0;
|
||||
private HashSet<String> hasPerm = new HashSet<>();
|
||||
private HashSet<String> noPerm = new HashSet<>();
|
||||
|
||||
private HashMap<String, Object> meta;
|
||||
|
||||
public SpongePlayer(Player player) {
|
||||
this.player = player;
|
||||
@ -60,7 +52,8 @@ public class SpongePlayer implements PlotPlayer {
|
||||
|
||||
@Override
|
||||
public Location getLocation() {
|
||||
return SpongeUtil.getLocation(player);
|
||||
Location loc = super.getLocation();
|
||||
return loc == null ? SpongeUtil.getLocation(this.player) : loc;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -114,20 +107,6 @@ public class SpongePlayer implements PlotPlayer {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOp() {
|
||||
if (this.op != 0) {
|
||||
return this.op != 1;
|
||||
}
|
||||
final boolean result = this.player.hasPermission("*");
|
||||
if (!result) {
|
||||
this.op = 1;
|
||||
return false;
|
||||
}
|
||||
this.op = 2;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOnline() {
|
||||
return player.isOnline();
|
||||
@ -159,34 +138,6 @@ public class SpongePlayer implements PlotPlayer {
|
||||
throw new UnsupportedOperationException("NOT IMPLEMENTED YET");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMeta(String key, Object value) {
|
||||
if (this.meta == null) {
|
||||
this.meta = new HashMap<String, Object>();
|
||||
}
|
||||
this.meta.put(key, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getMeta(String key) {
|
||||
if (this.meta != null) {
|
||||
return this.meta.get(key);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteMeta(String key) {
|
||||
if (this.meta != null) {
|
||||
this.meta.remove(key);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAttribute(String key) {
|
||||
key = "plotsquared_user_attributes." + key;
|
@ -12,7 +12,6 @@ import org.spongepowered.api.world.World;
|
||||
import org.spongepowered.api.world.biome.BiomeType;
|
||||
import org.spongepowered.api.world.biome.BiomeTypes;
|
||||
|
||||
import com.intellectualcrafters.plot.PS;
|
||||
import com.intellectualcrafters.plot.object.Location;
|
||||
import com.intellectualcrafters.plot.object.PlotBlock;
|
||||
import com.intellectualcrafters.plot.object.schematic.PlotItem;
|
||||
|
@ -1,27 +1,22 @@
|
||||
package com.plotsquared.sponge;
|
||||
package com.plotsquared.sponge.util;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.spongepowered.api.data.DataContainer;
|
||||
import org.spongepowered.api.world.Chunk;
|
||||
import org.spongepowered.api.world.World;
|
||||
import org.spongepowered.api.world.storage.ChunkDataStream;
|
||||
import org.spongepowered.api.world.storage.WorldStorage;
|
||||
|
||||
import com.google.common.base.Optional;
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
import com.intellectualcrafters.plot.object.ChunkLoc;
|
||||
import com.intellectualcrafters.plot.object.Location;
|
||||
import com.intellectualcrafters.plot.object.Plot;
|
||||
import com.intellectualcrafters.plot.object.PlotBlock;
|
||||
import com.intellectualcrafters.plot.object.PlotId;
|
||||
import com.intellectualcrafters.plot.util.ChunkManager;
|
||||
import com.intellectualcrafters.plot.util.TaskManager;
|
||||
import com.intellectualcrafters.plot.util.SetBlockQueue.ChunkWrapper;
|
||||
import com.plotsquared.sponge.util.SpongeUtil;
|
||||
import com.intellectualcrafters.plot.util.TaskManager;
|
||||
|
||||
public class SpongeChunkManager extends ChunkManager {
|
||||
|
@ -14,7 +14,6 @@ import org.spongepowered.api.util.command.CommandResult;
|
||||
import org.spongepowered.api.util.command.CommandSource;
|
||||
|
||||
import com.google.common.base.Optional;
|
||||
import com.intellectualcrafters.plot.PS;
|
||||
import com.intellectualcrafters.plot.commands.MainCommand;
|
||||
import com.intellectualcrafters.plot.object.ConsolePlayer;
|
||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||
|
@ -20,7 +20,7 @@ import com.intellectualcrafters.plot.object.PlotItemStack;
|
||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||
import com.intellectualcrafters.plot.util.InventoryUtil;
|
||||
import com.plotsquared.sponge.SpongeMain;
|
||||
import com.plotsquared.sponge.SpongePlayer;
|
||||
import com.plotsquared.sponge.object.SpongePlayer;
|
||||
|
||||
public class SpongeInventoryUtil extends InventoryUtil {
|
||||
|
||||
|
@ -1,10 +1,11 @@
|
||||
package com.plotsquared.sponge;
|
||||
package com.plotsquared.sponge.util;
|
||||
|
||||
import org.spongepowered.api.text.title.Title;
|
||||
|
||||
import com.intellectualcrafters.plot.PS;
|
||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||
import com.intellectualcrafters.plot.util.AbstractTitle;
|
||||
import com.plotsquared.sponge.SpongeMain;
|
||||
import com.plotsquared.sponge.object.SpongePlayer;
|
||||
|
||||
public class SpongeTitleManager extends AbstractTitle {
|
||||
|
@ -13,7 +13,7 @@ import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||
import com.intellectualcrafters.plot.util.MathMan;
|
||||
import com.intellectualcrafters.plot.util.UUIDHandler;
|
||||
import com.plotsquared.sponge.SpongeMain;
|
||||
import com.plotsquared.sponge.SpongePlayer;
|
||||
import com.plotsquared.sponge.object.SpongePlayer;
|
||||
|
||||
public class SpongeUtil {
|
||||
|
||||
|
@ -7,7 +7,7 @@ import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||
import com.intellectualcrafters.plot.util.UUIDHandler;
|
||||
import com.intellectualcrafters.plot.uuid.UUIDWrapper;
|
||||
import com.plotsquared.sponge.SpongeMain;
|
||||
import com.plotsquared.sponge.SpongePlayer;
|
||||
import com.plotsquared.sponge.object.SpongePlayer;
|
||||
|
||||
public class SpongeOnlineUUIDWrapper extends UUIDWrapper {
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user