mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 21:26:45 +01:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
a579df00db
@ -15,6 +15,7 @@ import com.intellectualcrafters.plot.object.PlotArea;
|
|||||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
import com.intellectualcrafters.plot.object.RunnableVal;
|
import com.intellectualcrafters.plot.object.RunnableVal;
|
||||||
import com.intellectualcrafters.plot.object.SetupObject;
|
import com.intellectualcrafters.plot.object.SetupObject;
|
||||||
|
import com.intellectualcrafters.plot.object.chat.PlainChatManager;
|
||||||
import com.intellectualcrafters.plot.util.AbstractTitle;
|
import com.intellectualcrafters.plot.util.AbstractTitle;
|
||||||
import com.intellectualcrafters.plot.util.ChatManager;
|
import com.intellectualcrafters.plot.util.ChatManager;
|
||||||
import com.intellectualcrafters.plot.util.ChunkManager;
|
import com.intellectualcrafters.plot.util.ChunkManager;
|
||||||
@ -52,7 +53,6 @@ import com.plotsquared.bukkit.util.BukkitEconHandler;
|
|||||||
import com.plotsquared.bukkit.util.BukkitEventUtil;
|
import com.plotsquared.bukkit.util.BukkitEventUtil;
|
||||||
import com.plotsquared.bukkit.util.BukkitHybridUtils;
|
import com.plotsquared.bukkit.util.BukkitHybridUtils;
|
||||||
import com.plotsquared.bukkit.util.BukkitInventoryUtil;
|
import com.plotsquared.bukkit.util.BukkitInventoryUtil;
|
||||||
import com.plotsquared.bukkit.util.BukkitPlainChatManager;
|
|
||||||
import com.plotsquared.bukkit.util.BukkitSchematicHandler;
|
import com.plotsquared.bukkit.util.BukkitSchematicHandler;
|
||||||
import com.plotsquared.bukkit.util.BukkitSetupUtils;
|
import com.plotsquared.bukkit.util.BukkitSetupUtils;
|
||||||
import com.plotsquared.bukkit.util.BukkitTaskManager;
|
import com.plotsquared.bukkit.util.BukkitTaskManager;
|
||||||
@ -428,7 +428,7 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
|
|||||||
new SendChunk();
|
new SendChunk();
|
||||||
MainUtil.canSendChunk = true;
|
MainUtil.canSendChunk = true;
|
||||||
} catch (ClassNotFoundException | NoSuchFieldException | NoSuchMethodException e) {
|
} catch (ClassNotFoundException | NoSuchFieldException | NoSuchMethodException e) {
|
||||||
e.printStackTrace();
|
PS.debug(SendChunk.class + " does not support " + StringMan.getString(getServerVersion()));
|
||||||
MainUtil.canSendChunk = false;
|
MainUtil.canSendChunk = false;
|
||||||
}
|
}
|
||||||
if (PS.get().checkVersion(getServerVersion(), 1, 9, 0)) {
|
if (PS.get().checkVersion(getServerVersion(), 1, 9, 0)) {
|
||||||
@ -653,7 +653,7 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
|
|||||||
if (Settings.Chat.INTERACTIVE) {
|
if (Settings.Chat.INTERACTIVE) {
|
||||||
return new BukkitChatManager();
|
return new BukkitChatManager();
|
||||||
} else {
|
} else {
|
||||||
return new BukkitPlainChatManager();
|
return new PlainChatManager();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,6 +14,20 @@ import java.util.Map;
|
|||||||
*/
|
*/
|
||||||
public final class Reflection {
|
public final class Reflection {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Stores loaded classes from the {@code net.minecraft.server} package.
|
||||||
|
*/
|
||||||
|
private static final Map<String, Class<?>> _loadedNMSClasses = new HashMap<String, Class<?>>();
|
||||||
|
/**
|
||||||
|
* Stores loaded classes from the {@code org.bukkit.craftbukkit} package (and subpackages).
|
||||||
|
*/
|
||||||
|
private static final Map<String, Class<?>> _loadedOBCClasses = new HashMap<String, Class<?>>();
|
||||||
|
private static final Map<Class<?>, Map<String, Field>> _loadedFields = new HashMap<Class<?>, Map<String, Field>>();
|
||||||
|
/**
|
||||||
|
* Contains loaded methods in a cache.
|
||||||
|
* The map maps [types to maps of [method names to maps of [parameter types to method instances]]].
|
||||||
|
*/
|
||||||
|
private static final Map<Class<?>, Map<String, Map<ArrayWrapper<Class<?>>, Method>>> _loadedMethods = new HashMap<Class<?>, Map<String, Map<ArrayWrapper<Class<?>>, Method>>>();
|
||||||
private static String _versionString;
|
private static String _versionString;
|
||||||
|
|
||||||
private Reflection() { }
|
private Reflection() { }
|
||||||
@ -37,16 +51,6 @@ public final class Reflection {
|
|||||||
return _versionString;
|
return _versionString;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Stores loaded classes from the {@code net.minecraft.server} package.
|
|
||||||
*/
|
|
||||||
private static final Map<String, Class<?>> _loadedNMSClasses = new HashMap<String, Class<?>>();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Stores loaded classes from the {@code org.bukkit.craftbukkit} package (and subpackages).
|
|
||||||
*/
|
|
||||||
private static final Map<String, Class<?>> _loadedOBCClasses = new HashMap<String, Class<?>>();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets a {@link Class} object representing a type contained within the {@code net.minecraft.server} versioned package.
|
* Gets a {@link Class} object representing a type contained within the {@code net.minecraft.server} versioned package.
|
||||||
* The class instances returned by this method are cached, such that no lookup will be done twice (unless multiple threads are accessing this method simultaneously).
|
* The class instances returned by this method are cached, such that no lookup will be done twice (unless multiple threads are accessing this method simultaneously).
|
||||||
@ -64,9 +68,8 @@ public final class Reflection {
|
|||||||
try {
|
try {
|
||||||
clazz = Class.forName(fullName);
|
clazz = Class.forName(fullName);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
|
||||||
_loadedNMSClasses.put(className, null);
|
_loadedNMSClasses.put(className, null);
|
||||||
return null;
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
_loadedNMSClasses.put(className, clazz);
|
_loadedNMSClasses.put(className, clazz);
|
||||||
return clazz;
|
return clazz;
|
||||||
@ -89,9 +92,8 @@ public final class Reflection {
|
|||||||
try {
|
try {
|
||||||
clazz = Class.forName(fullName);
|
clazz = Class.forName(fullName);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
|
||||||
_loadedOBCClasses.put(className, null);
|
_loadedOBCClasses.put(className, null);
|
||||||
return null;
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
_loadedOBCClasses.put(className, clazz);
|
_loadedOBCClasses.put(className, clazz);
|
||||||
return clazz;
|
return clazz;
|
||||||
@ -110,13 +112,10 @@ public final class Reflection {
|
|||||||
try {
|
try {
|
||||||
return getMethod(obj.getClass(), "getHandle").invoke(obj);
|
return getMethod(obj.getClass(), "getHandle").invoke(obj);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
throw new RuntimeException(e);
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final Map<Class<?>, Map<String, Field>> _loadedFields = new HashMap<Class<?>, Map<String, Field>>();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves a {@link Field} instance declared by the specified class with the specified name.
|
* Retrieves a {@link Field} instance declared by the specified class with the specified name.
|
||||||
* Java access modifiers are ignored during this retrieval. No guarantee is made as to whether the field
|
* Java access modifiers are ignored during this retrieval. No guarantee is made as to whether the field
|
||||||
@ -161,12 +160,6 @@ public final class Reflection {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Contains loaded methods in a cache.
|
|
||||||
* The map maps [types to maps of [method names to maps of [parameter types to method instances]]].
|
|
||||||
*/
|
|
||||||
private static final Map<Class<?>, Map<String, Map<ArrayWrapper<Class<?>>, Method>>> _loadedMethods = new HashMap<Class<?>, Map<String, Map<ArrayWrapper<Class<?>>, Method>>>();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves a {@link Method} instance declared by the specified class with the specified name and argument types.
|
* Retrieves a {@link Method} instance declared by the specified class with the specified name and argument types.
|
||||||
* Java access modifiers are ignored during this retrieval. No guarantee is made as to whether the field
|
* Java access modifiers are ignored during this retrieval. No guarantee is made as to whether the field
|
||||||
|
@ -30,7 +30,6 @@ public class DefaultTitleManager_183 extends DefaultTitleManager {
|
|||||||
this.chatBaseComponent = Reflection.getNMSClass("IChatBaseComponent");
|
this.chatBaseComponent = Reflection.getNMSClass("IChatBaseComponent");
|
||||||
this.packetActions = Reflection.getNMSClass("PacketPlayOutTitle$EnumTitleAction");
|
this.packetActions = Reflection.getNMSClass("PacketPlayOutTitle$EnumTitleAction");
|
||||||
this.nmsChatSerializer = Reflection.getNMSClass("IChatBaseComponent$ChatSerializer");
|
this.nmsChatSerializer = Reflection.getNMSClass("IChatBaseComponent$ChatSerializer");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -26,9 +26,8 @@ import java.util.HashSet;
|
|||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An utility that can be used to send chunks, rather than using bukkit code to do so (uses heavy NMS)
|
* An utility that can be used to send chunks, rather than using bukkit code
|
||||||
*
|
* to do so (uses heavy NMS).
|
||||||
|
|
||||||
*/
|
*/
|
||||||
public class SendChunk {
|
public class SendChunk {
|
||||||
|
|
||||||
@ -40,7 +39,7 @@ public class SendChunk {
|
|||||||
private final RefMethod methodInitLighting;
|
private final RefMethod methodInitLighting;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor.
|
||||||
*/
|
*/
|
||||||
public SendChunk() throws ClassNotFoundException, NoSuchMethodException, NoSuchFieldException {
|
public SendChunk() throws ClassNotFoundException, NoSuchMethodException, NoSuchFieldException {
|
||||||
RefConstructor tempMapChunk;
|
RefConstructor tempMapChunk;
|
||||||
|
@ -85,7 +85,7 @@ public class BukkitLocalQueue<T> extends BasicLocalBlockQueue<T> {
|
|||||||
if (block != null) {
|
if (block != null) {
|
||||||
int x = MainUtil.x_loc[layer][j];
|
int x = MainUtil.x_loc[layer][j];
|
||||||
int y = MainUtil.y_loc[layer][j];
|
int y = MainUtil.y_loc[layer][j];
|
||||||
int z = MainUtil.y_loc[layer][j];
|
int z = MainUtil.z_loc[layer][j];
|
||||||
Block existing = chunk.getBlock(x, y, z);
|
Block existing = chunk.getBlock(x, y, z);
|
||||||
int existingId = existing.getTypeId();
|
int existingId = existing.getTypeId();
|
||||||
if (existingId == block.id) {
|
if (existingId == block.id) {
|
||||||
|
@ -54,7 +54,7 @@ public class Kick extends SubCommand {
|
|||||||
}
|
}
|
||||||
players.add(pp);
|
players.add(pp);
|
||||||
}
|
}
|
||||||
break;
|
continue;
|
||||||
}
|
}
|
||||||
PlotPlayer pp = UUIDHandler.getPlayer(uuid);
|
PlotPlayer pp = UUIDHandler.getPlayer(uuid);
|
||||||
if (pp != null) {
|
if (pp != null) {
|
||||||
@ -67,8 +67,7 @@ public class Kick extends SubCommand {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
for (PlotPlayer player2 : players) {
|
for (PlotPlayer player2 : players) {
|
||||||
Location location2 = player2.getLocation();
|
if (!plot.equals(player2.getCurrentPlot())) {
|
||||||
if (!player2.getLocation().getWorld().equals(location2.getWorld()) || !plot.equals(location2.getPlot())) {
|
|
||||||
MainUtil.sendMessage(player, C.INVALID_PLAYER, args[0]);
|
MainUtil.sendMessage(player, C.INVALID_PLAYER, args[0]);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -454,6 +454,7 @@ public enum C {
|
|||||||
* Info
|
* Info
|
||||||
*/
|
*/
|
||||||
NONE("None", "Info"),
|
NONE("None", "Info"),
|
||||||
|
NOW("Now", "Info"),
|
||||||
NEVER("Never", "Info"),
|
NEVER("Never", "Info"),
|
||||||
UNKNOWN("Unknown", "Info"),
|
UNKNOWN("Unknown", "Info"),
|
||||||
EVERYONE("Everyone", "Info"),
|
EVERYONE("Everyone", "Info"),
|
||||||
|
@ -65,7 +65,7 @@ public class Settings extends Config {
|
|||||||
Enabled_Components.KILL_ROAD_VEHICLES = config.getBoolean("kill_road_vehicles", Enabled_Components.KILL_ROAD_VEHICLES);
|
Enabled_Components.KILL_ROAD_VEHICLES = config.getBoolean("kill_road_vehicles", Enabled_Components.KILL_ROAD_VEHICLES);
|
||||||
|
|
||||||
// Clearing + Expiry
|
// Clearing + Expiry
|
||||||
// FAST_CLEAR = config.getBoolean("clear.fastmode");
|
//FAST_CLEAR = config.getBoolean("clear.fastmode");
|
||||||
Enabled_Components.PLOT_EXPIRY = config.getBoolean("clear.auto.enabled", Enabled_Components.PLOT_EXPIRY);
|
Enabled_Components.PLOT_EXPIRY = config.getBoolean("clear.auto.enabled", Enabled_Components.PLOT_EXPIRY);
|
||||||
if (Enabled_Components.PLOT_EXPIRY) {
|
if (Enabled_Components.PLOT_EXPIRY) {
|
||||||
Enabled_Components.BAN_DELETER = config.getBoolean("clear.on.ban");
|
Enabled_Components.BAN_DELETER = config.getBoolean("clear.on.ban");
|
||||||
@ -119,7 +119,7 @@ public class Settings extends Config {
|
|||||||
Teleport.ON_DEATH = config.getBoolean("teleport.on_death", Teleport.ON_DEATH);
|
Teleport.ON_DEATH = config.getBoolean("teleport.on_death", Teleport.ON_DEATH);
|
||||||
|
|
||||||
// WorldEdit
|
// WorldEdit
|
||||||
// WE_ALLOW_HELPER = config.getBoolean("worldedit.enable-for-helpers");
|
//WE_ALLOW_HELPER = config.getBoolean("worldedit.enable-for-helpers");
|
||||||
|
|
||||||
// Chunk processor
|
// Chunk processor
|
||||||
Enabled_Components.CHUNK_PROCESSOR = config.getBoolean("chunk-processor.enabled", Enabled_Components.CHUNK_PROCESSOR);
|
Enabled_Components.CHUNK_PROCESSOR = config.getBoolean("chunk-processor.enabled", Enabled_Components.CHUNK_PROCESSOR);
|
||||||
|
@ -1650,7 +1650,7 @@ public class Plot {
|
|||||||
if (uuid == DBFunc.everyone) {
|
if (uuid == DBFunc.everyone) {
|
||||||
boolean result = false;
|
boolean result = false;
|
||||||
for (UUID other : new HashSet<>(getDenied())) {
|
for (UUID other : new HashSet<>(getDenied())) {
|
||||||
result = result || rmvDenied(other);
|
result = rmvDenied(other) || result;
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -1677,7 +1677,7 @@ public class Plot {
|
|||||||
if (uuid == DBFunc.everyone) {
|
if (uuid == DBFunc.everyone) {
|
||||||
boolean result = false;
|
boolean result = false;
|
||||||
for (UUID other : new HashSet<>(getTrusted())) {
|
for (UUID other : new HashSet<>(getTrusted())) {
|
||||||
result = result || rmvTrusted(other);
|
result = rmvTrusted(other) || result;
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -1707,7 +1707,7 @@ public class Plot {
|
|||||||
if (uuid == DBFunc.everyone) {
|
if (uuid == DBFunc.everyone) {
|
||||||
boolean result = false;
|
boolean result = false;
|
||||||
for (UUID other : new HashSet<>(this.members)) {
|
for (UUID other : new HashSet<>(this.members)) {
|
||||||
result = result || rmvMember(other);
|
result = rmvMember(other) || result;
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -2681,7 +2681,7 @@ public class Plot {
|
|||||||
greaterPlot.setMerged(3, true);
|
greaterPlot.setMerged(3, true);
|
||||||
lesserPlot.mergeData(greaterPlot);
|
lesserPlot.mergeData(greaterPlot);
|
||||||
if (removeRoads) {
|
if (removeRoads) {
|
||||||
Plot diagonal = greaterPlot.getRelative(1);
|
Plot diagonal = greaterPlot.getRelative(2);
|
||||||
if (diagonal.getMerged(7)) {
|
if (diagonal.getMerged(7)) {
|
||||||
lesserPlot.removeRoadSouthEast();
|
lesserPlot.removeRoadSouthEast();
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
package com.intellectualcrafters.plot.object;
|
package com.intellectualcrafters.plot.object;
|
||||||
|
|
||||||
|
import com.intellectualcrafters.plot.PS;
|
||||||
import com.intellectualcrafters.plot.config.C;
|
import com.intellectualcrafters.plot.config.C;
|
||||||
|
import com.intellectualcrafters.plot.object.chat.PlainChatManager;
|
||||||
import com.intellectualcrafters.plot.util.ChatManager;
|
import com.intellectualcrafters.plot.util.ChatManager;
|
||||||
|
|
||||||
public class PlotMessage {
|
public class PlotMessage {
|
||||||
@ -8,7 +10,13 @@ public class PlotMessage {
|
|||||||
private Object builder;
|
private Object builder;
|
||||||
|
|
||||||
public PlotMessage() {
|
public PlotMessage() {
|
||||||
|
try {
|
||||||
reset(ChatManager.manager);
|
reset(ChatManager.manager);
|
||||||
|
} catch (Throwable e) {
|
||||||
|
PS.debug("PlotSquared doesn't support fancy chat for " + PS.get().IMP.getServerVersion());
|
||||||
|
ChatManager.manager = new PlainChatManager();
|
||||||
|
reset(ChatManager.manager);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public PlotMessage(String text) {
|
public PlotMessage(String text) {
|
||||||
|
@ -55,7 +55,7 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set some session only metadata for the player.
|
* Set some session only metadata for this player.
|
||||||
* @param key
|
* @param key
|
||||||
* @param value
|
* @param value
|
||||||
*/
|
*/
|
||||||
@ -102,7 +102,7 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The player's name.
|
* This player's name.
|
||||||
*
|
*
|
||||||
* @return the name of the player
|
* @return the name of the player
|
||||||
*/
|
*/
|
||||||
@ -112,7 +112,7 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the player's current plot.
|
* Get this player's current plot.
|
||||||
* @return the plot the player is standing on or null if standing on a road or not in a {@link PlotArea}
|
* @return the plot the player is standing on or null if standing on a road or not in a {@link PlotArea}
|
||||||
*/
|
*/
|
||||||
public Plot getCurrentPlot() {
|
public Plot getCurrentPlot() {
|
||||||
@ -133,7 +133,7 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the number of plots the player owns.
|
* Get the number of plots this player owns.
|
||||||
*
|
*
|
||||||
* @see #getPlotCount(String);
|
* @see #getPlotCount(String);
|
||||||
* @see #getPlots()
|
* @see #getPlots()
|
||||||
@ -164,7 +164,7 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the number of plots the player owns in the world.
|
* Get the number of plots this player owns in the world.
|
||||||
* @param world the name of the plotworld to check.
|
* @param world the name of the plotworld to check.
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@ -196,7 +196,7 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the PlotArea the player is currently in, or null.
|
* Return the PlotArea this player is currently in, or null.
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public PlotArea getPlotAreaAbs() {
|
public PlotArea getPlotAreaAbs() {
|
||||||
@ -216,7 +216,7 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer {
|
|||||||
|
|
||||||
////////////// PARTIALLY IMPLEMENTED ///////////
|
////////////// PARTIALLY IMPLEMENTED ///////////
|
||||||
/**
|
/**
|
||||||
* Get the player's last recorded location or null if they don't any plot relevant location.
|
* Get this player's last recorded location or null if they don't any plot relevant location.
|
||||||
* @return The location
|
* @return The location
|
||||||
*/
|
*/
|
||||||
public Location getLocation() {
|
public Location getLocation() {
|
||||||
@ -235,13 +235,13 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the player's full location (including yaw/pitch)
|
* Get this player's full location (including yaw/pitch)
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public abstract Location getLocationFull();
|
public abstract Location getLocationFull();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the player's UUID.
|
* Get this player's UUID.
|
||||||
* === !IMPORTANT ===<br>
|
* === !IMPORTANT ===<br>
|
||||||
* The UUID is dependent on the mode chosen in the settings.yml and may not be the same as Bukkit has
|
* The UUID is dependent on the mode chosen in the settings.yml and may not be the same as Bukkit has
|
||||||
* (especially if using an old version of Bukkit that does not support UUIDs)
|
* (especially if using an old version of Bukkit that does not support UUIDs)
|
||||||
@ -262,13 +262,13 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Teleport the player to a location.
|
* Teleport this player to a location.
|
||||||
* @param location the target location
|
* @param location the target location
|
||||||
*/
|
*/
|
||||||
public abstract void teleport(Location location);
|
public abstract void teleport(Location location);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the compass target.
|
* Set this compass target.
|
||||||
* @param location the target location
|
* @param location the target location
|
||||||
*/
|
*/
|
||||||
public abstract void setCompassTarget(Location location);
|
public abstract void setCompassTarget(Location location);
|
||||||
@ -285,7 +285,7 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer {
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves t player attribute.
|
* Retrieves the attribute of this player.
|
||||||
*
|
*
|
||||||
* @param key
|
* @param key
|
||||||
* @return the attribute will be either true or false
|
* @return the attribute will be either true or false
|
||||||
@ -312,19 +312,19 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer {
|
|||||||
public abstract void setWeather(PlotWeather weather);
|
public abstract void setWeather(PlotWeather weather);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the player's gamemode.
|
* Get this player's gamemode.
|
||||||
* @return the gamemode of the player.
|
* @return the gamemode of the player.
|
||||||
*/
|
*/
|
||||||
public abstract PlotGameMode getGameMode();
|
public abstract PlotGameMode getGameMode();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the player's gameMode.
|
* Set this player's gameMode.
|
||||||
* @param gameMode the gamemode to set
|
* @param gameMode the gamemode to set
|
||||||
*/
|
*/
|
||||||
public abstract void setGameMode(PlotGameMode gameMode);
|
public abstract void setGameMode(PlotGameMode gameMode);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the player's local time (ticks).
|
* Set this player's local time (ticks).
|
||||||
* @param time the time visible to the player
|
* @param time the time visible to the player
|
||||||
*/
|
*/
|
||||||
public abstract void setTime(long time);
|
public abstract void setTime(long time);
|
||||||
@ -332,32 +332,32 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer {
|
|||||||
public abstract boolean getFlight();
|
public abstract boolean getFlight();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the player's fly mode.
|
* Set this player's fly mode.
|
||||||
* @param fly if the player can fly
|
* @param fly if the player can fly
|
||||||
*/
|
*/
|
||||||
public abstract void setFlight(boolean fly);
|
public abstract void setFlight(boolean fly);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Play music at a location for the player.
|
* Play music at a location for this player.
|
||||||
* @param location where to play the music
|
* @param location where to play the music
|
||||||
* @param id the numerical record item id
|
* @param id the numerical record item id
|
||||||
*/
|
*/
|
||||||
public abstract void playMusic(Location location, int id);
|
public abstract void playMusic(Location location, int id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if the player is banned.
|
* Check if this player is banned.
|
||||||
* @return true if the player is banned, false otherwise.
|
* @return true if the player is banned, false otherwise.
|
||||||
*/
|
*/
|
||||||
public abstract boolean isBanned();
|
public abstract boolean isBanned();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Kick the player from the game.
|
* Kick this player from the game.
|
||||||
* @param message the reason for the kick
|
* @param message the reason for the kick
|
||||||
*/
|
*/
|
||||||
public abstract void kick(String message);
|
public abstract void kick(String message);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when the player quits.
|
* Called when this player quits.
|
||||||
*/
|
*/
|
||||||
public void unregister() {
|
public void unregister() {
|
||||||
Plot plot = getCurrentPlot();
|
Plot plot = getCurrentPlot();
|
||||||
@ -379,7 +379,7 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the amount of clusters a player owns in the specific world.
|
* Get the amount of clusters this player owns in the specific world.
|
||||||
* @param world
|
* @param world
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@ -395,7 +395,7 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the amount of clusters a player owns.
|
* Get the amount of clusters this player owns.
|
||||||
* @return the number of clusters this player owns
|
* @return the number of clusters this player owns
|
||||||
*/
|
*/
|
||||||
public int getPlayerClusterCount() {
|
public int getPlayerClusterCount() {
|
||||||
@ -410,9 +410,9 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a {@code Set} of all plots a player owns in a certain world.
|
* Return a {@code Set} of all plots this player owns in a certain world.
|
||||||
* @param world the world to retrieve plots from
|
* @param world the world to retrieve plots from
|
||||||
* @return a {@code Set} of plots the player owns in the provided world
|
* @return a {@code Set} of plots this player owns in the provided world
|
||||||
*/
|
*/
|
||||||
public Set<Plot> getPlots(String world) {
|
public Set<Plot> getPlots(String world) {
|
||||||
UUID uuid = getUUID();
|
UUID uuid = getUUID();
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
package com.plotsquared.bukkit.util;
|
package com.intellectualcrafters.plot.object.chat;
|
||||||
|
|
||||||
|
import com.intellectualcrafters.plot.config.C;
|
||||||
import com.intellectualcrafters.plot.object.PlotMessage;
|
import com.intellectualcrafters.plot.object.PlotMessage;
|
||||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
import com.intellectualcrafters.plot.util.ChatManager;
|
import com.intellectualcrafters.plot.util.ChatManager;
|
||||||
import org.bukkit.ChatColor;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class BukkitPlainChatManager extends ChatManager<List<StringBuilder>> {
|
public class PlainChatManager extends ChatManager<List<StringBuilder>> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<StringBuilder> builder() {
|
public List<StringBuilder> builder() {
|
||||||
@ -29,7 +29,7 @@ public class BukkitPlainChatManager extends ChatManager<List<StringBuilder>> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void text(PlotMessage message, String text) {
|
public void text(PlotMessage message, String text) {
|
||||||
message.$(this).add(new StringBuilder(ChatColor.stripColor(text)));
|
message.$(this).add(new StringBuilder(C.color(text)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
@ -17,6 +17,7 @@ import com.intellectualcrafters.plot.object.PlotPlayer;
|
|||||||
import com.intellectualcrafters.plot.object.RegionWrapper;
|
import com.intellectualcrafters.plot.object.RegionWrapper;
|
||||||
import com.intellectualcrafters.plot.object.RunnableVal;
|
import com.intellectualcrafters.plot.object.RunnableVal;
|
||||||
import com.intellectualcrafters.plot.util.expiry.ExpireManager;
|
import com.intellectualcrafters.plot.util.expiry.ExpireManager;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
@ -208,29 +209,29 @@ public class MainUtil {
|
|||||||
|
|
||||||
public static String secToTime(long time) {
|
public static String secToTime(long time) {
|
||||||
StringBuilder toreturn = new StringBuilder();
|
StringBuilder toreturn = new StringBuilder();
|
||||||
if (time>=33868800) {
|
if (time >= 33868800) {
|
||||||
int years = (int) (time/33868800);
|
int years = (int) (time / 33868800);
|
||||||
time-=years*33868800;
|
time -= years * 33868800;
|
||||||
toreturn.append(years+"y ");
|
toreturn.append(years+"y ");
|
||||||
}
|
}
|
||||||
if (time>=604800) {
|
if (time >= 604800) {
|
||||||
int weeks = (int) (time/604800);
|
int weeks = (int) (time / 604800);
|
||||||
time-=weeks*604800;
|
time -= weeks * 604800;
|
||||||
toreturn.append(weeks+"w ");
|
toreturn.append(weeks+"w ");
|
||||||
}
|
}
|
||||||
if (time>=86400) {
|
if (time >= 86400) {
|
||||||
int days = (int) (time/86400);
|
int days = (int) (time / 86400);
|
||||||
time-=days*86400;
|
time -= days * 86400;
|
||||||
toreturn.append(days+"d ");
|
toreturn.append(days+"d ");
|
||||||
}
|
}
|
||||||
if (time>=3600) {
|
if (time >= 3600) {
|
||||||
int hours = (int) (time/3600);
|
int hours = (int) (time / 3600);
|
||||||
time-=hours*3600;
|
time -= hours * 3600;
|
||||||
toreturn.append(hours+"h ");
|
toreturn.append(hours+"h ");
|
||||||
}
|
}
|
||||||
if (time>=60) {
|
if (time>=60) {
|
||||||
int minutes = (int) (time/60);
|
int minutes = (int) (time / 60);
|
||||||
time-=minutes*60;
|
time -= minutes * 60;
|
||||||
toreturn.append(minutes+"m ");
|
toreturn.append(minutes+"m ");
|
||||||
}
|
}
|
||||||
if (toreturn.equals("")||time>0){
|
if (toreturn.equals("")||time>0){
|
||||||
@ -719,10 +720,18 @@ public class MainUtil {
|
|||||||
String trusted = getPlayerList(plot.getTrusted());
|
String trusted = getPlayerList(plot.getTrusted());
|
||||||
String members = getPlayerList(plot.getMembers());
|
String members = getPlayerList(plot.getMembers());
|
||||||
String denied = getPlayerList(plot.getDenied());
|
String denied = getPlayerList(plot.getDenied());
|
||||||
String seen = C.UNKNOWN.s();
|
String seen;
|
||||||
if (Settings.Enabled_Components.PLOT_EXPIRY) {
|
if (Settings.Enabled_Components.PLOT_EXPIRY) {
|
||||||
|
if (plot.isOnline()) {
|
||||||
|
seen = C.NOW.s();
|
||||||
|
} else {
|
||||||
int time = (int) (ExpireManager.IMP.getAge(plot) / 1000);
|
int time = (int) (ExpireManager.IMP.getAge(plot) / 1000);
|
||||||
|
if (time != 0) {
|
||||||
seen = MainUtil.secToTime(time);
|
seen = MainUtil.secToTime(time);
|
||||||
|
} else {
|
||||||
|
seen = C.UNKNOWN.s();
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
seen = C.NEVER.s();
|
seen = C.NEVER.s();
|
||||||
}
|
}
|
||||||
@ -741,9 +750,7 @@ public class MainUtil {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
boolean build = plot.isAdded(player.getUUID());
|
boolean build = plot.isAdded(player.getUUID());
|
||||||
|
|
||||||
String owner = plot.getOwners().isEmpty() ? "unowned" : getPlayerList(plot.getOwners());
|
String owner = plot.getOwners().isEmpty() ? "unowned" : getPlayerList(plot.getOwners());
|
||||||
|
|
||||||
info = info.replace("%id%", plot.getId().toString());
|
info = info.replace("%id%", plot.getId().toString());
|
||||||
info = info.replace("%alias%", alias);
|
info = info.replace("%alias%", alias);
|
||||||
info = info.replace("%num%", String.valueOf(num));
|
info = info.replace("%num%", String.valueOf(num));
|
||||||
@ -771,10 +778,6 @@ public class MainUtil {
|
|||||||
String info;
|
String info;
|
||||||
if (full && Settings.Ratings.CATEGORIES != null && Settings.Ratings.CATEGORIES.size() > 1) {
|
if (full && Settings.Ratings.CATEGORIES != null && Settings.Ratings.CATEGORIES.size() > 1) {
|
||||||
double[] ratings = MainUtil.getAverageRatings(plot);
|
double[] ratings = MainUtil.getAverageRatings(plot);
|
||||||
for (double v : ratings) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
String rating = "";
|
String rating = "";
|
||||||
String prefix = "";
|
String prefix = "";
|
||||||
for (int i = 0; i < ratings.length; i++) {
|
for (int i = 0; i < ratings.length; i++) {
|
||||||
|
@ -300,7 +300,7 @@ public class ExpireManager {
|
|||||||
}
|
}
|
||||||
}, 86400000);
|
}, 86400000);
|
||||||
} else {
|
} else {
|
||||||
TaskManager.runTaskLaterAsync(this, 20);
|
TaskManager.runTaskLaterAsync(this, 20 * 10);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user