mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-04 09:10:17 +01:00
Various fixes and tweaks.
This commit is contained in:
parent
042d8950ee
commit
f21d159911
@ -35,7 +35,7 @@ import java.util.UUID;
|
||||
/**
|
||||
* PlotSquared API.
|
||||
*
|
||||
* <p>Useful classes:</p>
|
||||
* <p>Useful classes:
|
||||
* <ul>
|
||||
* <li>{@link BukkitUtil}</li>
|
||||
* <li>{@link PlotPlayer}</li>
|
||||
@ -655,7 +655,7 @@ public class PlotAPI {
|
||||
/**
|
||||
* Get the numbers of plots, which the player is able to build in.
|
||||
*
|
||||
* @param player Player, for whom we're getting the plots
|
||||
* @param player player, for whom we're getting the plots
|
||||
*
|
||||
* @return the number of allowed plots
|
||||
*
|
||||
@ -671,8 +671,8 @@ public class PlotAPI {
|
||||
*
|
||||
* @see PlotPlayer#wrap(Object)
|
||||
*
|
||||
* @param player The player to wrap
|
||||
* @return A PlotPlayer
|
||||
* @param player the player to wrap
|
||||
* @return a {@code PlotPlayer}
|
||||
*/
|
||||
public PlotPlayer wrapPlayer(Player player) {
|
||||
return PlotPlayer.wrap(player);
|
||||
@ -682,12 +682,12 @@ public class PlotAPI {
|
||||
* Get the PlotPlayer for a UUID.
|
||||
*
|
||||
* <p><i>Please note that PlotSquared can be configured to provide
|
||||
* different UUIDs than bukkit</i></p>
|
||||
* different UUIDs than bukkit</i>
|
||||
*
|
||||
* @see PlotPlayer#wrap(Object)
|
||||
*
|
||||
* @param uuid The uuid of the player to wrap
|
||||
* @return A PlotPlayer
|
||||
* @param uuid the uuid of the player to wrap
|
||||
* @return a {@code PlotPlayer}
|
||||
*/
|
||||
public PlotPlayer wrapPlayer(UUID uuid) {
|
||||
return PlotPlayer.wrap(uuid);
|
||||
@ -698,8 +698,8 @@ public class PlotAPI {
|
||||
*
|
||||
* @see PlotPlayer#wrap(Object)
|
||||
*
|
||||
* @param player The player to wrap
|
||||
* @return The PlotPlayer
|
||||
* @param player the player to wrap
|
||||
* @return a {@code PlotPlayer}
|
||||
*/
|
||||
public PlotPlayer wrapPlayer(String player) {
|
||||
return PlotPlayer.wrap(player);
|
||||
@ -707,13 +707,14 @@ public class PlotAPI {
|
||||
|
||||
/**
|
||||
* Get the PlotPlayer for an offline player.
|
||||
*
|
||||
* <p>Note that this will work if the player is offline, however not all
|
||||
* functionality will work</p>
|
||||
* functionality will work.
|
||||
*
|
||||
* @see PlotPlayer#wrap(Object)
|
||||
*
|
||||
* @param player The player to wrap
|
||||
* @return The PlotPlayer
|
||||
* @param player the player to wrap
|
||||
* @return a {@code PlotPlayer}
|
||||
*/
|
||||
public PlotPlayer wrapPlayer(OfflinePlayer player) {
|
||||
return PlotPlayer.wrap(player);
|
||||
|
@ -70,7 +70,7 @@ 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.bukkit.WorldEditPlugin;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Chunk;
|
||||
@ -95,7 +95,7 @@ import java.util.UUID;
|
||||
|
||||
public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
|
||||
|
||||
public static WorldEditPlugin worldEdit;
|
||||
public static WorldEdit worldEdit;
|
||||
|
||||
private int[] version;
|
||||
|
||||
@ -385,7 +385,7 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
|
||||
@Override
|
||||
public boolean initWorldEdit() {
|
||||
if (getServer().getPluginManager().getPlugin("WorldEdit") != null) {
|
||||
worldEdit = (WorldEditPlugin) getServer().getPluginManager().getPlugin("WorldEdit");
|
||||
worldEdit = WorldEdit.getInstance();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -9,9 +9,9 @@ import java.util.Collection;
|
||||
/**
|
||||
* Represents a wrapper around an array class of an arbitrary reference type,
|
||||
* which properly implements "value" hash code and equality functions.
|
||||
* <p>
|
||||
* This class is intended for use as a key to a map.
|
||||
* </p>
|
||||
*
|
||||
* <p>This class is intended for use as a key to a map.
|
||||
*
|
||||
* @author Glen Husman
|
||||
* @param <E> The type of elements in the array.
|
||||
* @see Arrays
|
||||
|
@ -109,6 +109,7 @@ import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.projectiles.BlockProjectileSource;
|
||||
import org.bukkit.projectiles.ProjectileSource;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
@ -303,7 +304,6 @@ public class PlayerEvents extends PlotListener implements Listener {
|
||||
return true;
|
||||
}
|
||||
Plot plot = area.getPlotAbs(loc);
|
||||
//
|
||||
ProjectileSource shooter = entity.getShooter();
|
||||
if (shooter instanceof Player) {
|
||||
PlotPlayer pp = BukkitUtil.getPlayer((Player) shooter);
|
||||
@ -780,7 +780,6 @@ public class PlayerEvents extends PlotListener implements Listener {
|
||||
return;
|
||||
}
|
||||
Plot plot = area.getOwnedPlot(location);
|
||||
Optional<Boolean> flag;
|
||||
switch (block.getType()) {
|
||||
case GRASS:
|
||||
if (Flags.GRASS_GROW.isFalse(plot)) {
|
||||
|
@ -10,8 +10,8 @@ public class BukkitOfflinePlayer implements OfflinePlotPlayer {
|
||||
public final OfflinePlayer player;
|
||||
|
||||
/**
|
||||
* <p>Please do not use this method. Instead use BukkitUtil.getPlayer(Player),
|
||||
* as it caches player objects.</p>
|
||||
* Please do not use this method. Instead use BukkitUtil.getPlayer(Player),
|
||||
* as it caches player objects.
|
||||
*
|
||||
* @param player
|
||||
*/
|
||||
|
@ -100,7 +100,6 @@ public class PS {
|
||||
private final int[] version;
|
||||
private final String platform;
|
||||
private final Thread thread;
|
||||
public ILogger logger;
|
||||
public HashMap<String, Set<PlotCluster>> clusters_tmp;
|
||||
public HashMap<String, HashMap<PlotId, Plot>> plots_tmp;
|
||||
public File styleFile;
|
||||
@ -114,6 +113,7 @@ public class PS {
|
||||
public TaskManager TASK;
|
||||
public WorldEdit worldedit;
|
||||
public URL update;
|
||||
private ILogger logger;
|
||||
private boolean plotAreaHasCollision = false;
|
||||
/**
|
||||
* All plot areas (quick global access).
|
||||
@ -148,11 +148,6 @@ public class PS {
|
||||
this.file = new File(this.IMP.getDirectory().getParentFile(), "PlotSquared-" + platform + ".jar");
|
||||
}
|
||||
}
|
||||
if (getJavaVersion() < 1.7) {
|
||||
PS.log(C.CONSOLE_JAVA_OUTDATED_1_7);
|
||||
this.IMP.disable();
|
||||
return;
|
||||
}
|
||||
if (getJavaVersion() < 1.8) {
|
||||
PS.log(C.CONSOLE_JAVA_OUTDATED_1_8);
|
||||
}
|
||||
@ -176,8 +171,7 @@ public class PS {
|
||||
new WE_Anywhere();
|
||||
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
} catch (Exception e) {
|
||||
PS.debug("Incompatible version of WorldEdit, please upgrade: http://builds.enginehub.org/job/worldedit?branch=master");
|
||||
}
|
||||
|
||||
@ -238,8 +232,7 @@ public class PS {
|
||||
PS.log("&aThanks for installing PlotSquared!");
|
||||
} else if (!get().checkVersion(PS.this.lastVersion, PS.this.version)) {
|
||||
PS.log("&aThanks for updating from " + StringMan.join(PS.this.lastVersion, ".") + " to " + StringMan
|
||||
.join(PS.this.version, ".")
|
||||
+ "!");
|
||||
.join(PS.this.version, ".") + "!");
|
||||
DBFunc.dbManager.updateTables(PS.this.lastVersion);
|
||||
}
|
||||
}
|
||||
@ -291,9 +284,9 @@ public class PS {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the instance of PlotSquared.
|
||||
* Get an instance of PlotSquared.
|
||||
*
|
||||
* @return the instance created by IPlotMain
|
||||
* @return instance of PlotSquared
|
||||
*/
|
||||
public static PS get() {
|
||||
return PS.instance;
|
||||
@ -323,6 +316,7 @@ public class PS {
|
||||
|
||||
/**
|
||||
* Get the current logger
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public ILogger getLogger() {
|
||||
@ -418,19 +412,20 @@ public class PS {
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>Get the server platform this plugin is running on this is running on.
|
||||
* This will be either <b>Bukkit</b> or <b>Sponge</b></p>
|
||||
* @return The server platform
|
||||
* Get the server platform this plugin is running on this is running on.
|
||||
*
|
||||
* <p>This will be either <b>Bukkit</b> or <b>Sponge</b></p>
|
||||
* @return the server implementation
|
||||
*/
|
||||
public String getPlatform() {
|
||||
return this.platform;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the database object.
|
||||
* Get the {@link Database} object.
|
||||
*
|
||||
* @return Database object
|
||||
* @see Database#getConnection() To get the database connection
|
||||
* @return the database
|
||||
* @see Database#getConnection() to get the database connection
|
||||
*/
|
||||
public Database getDatabase() {
|
||||
return this.database;
|
||||
@ -643,7 +638,7 @@ public class PS {
|
||||
/**
|
||||
* Add a global reference to a plot world.
|
||||
*
|
||||
* @param plotArea The PlotArea
|
||||
* @param plotArea the {@code PlotArea} to add.
|
||||
* @see #removePlotArea(PlotArea) To remove the reference
|
||||
*/
|
||||
public void addPlotArea(PlotArea plotArea) {
|
||||
@ -710,8 +705,7 @@ public class PS {
|
||||
/**
|
||||
* Remove a plot world reference.
|
||||
*
|
||||
* @param area The PlotArea
|
||||
* @see #addPlotArea(PlotArea) To add a reference
|
||||
* @param area the {@code PlotArea} to remove
|
||||
*/
|
||||
public void removePlotArea(PlotArea area) {
|
||||
Set<PlotArea> areas = getPlotAreas(area.worldname);
|
||||
@ -1135,8 +1129,7 @@ public class PS {
|
||||
* @return Set of plot
|
||||
*/
|
||||
public Set<Plot> getPlots(String world, PlotPlayer player) {
|
||||
UUID uuid = player.getUUID();
|
||||
return getPlots(world, uuid);
|
||||
return getPlots(world, player.getUUID());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1146,8 +1139,7 @@ public class PS {
|
||||
* @return Set of plot
|
||||
*/
|
||||
public Set<Plot> getPlots(PlotArea area, PlotPlayer player) {
|
||||
UUID uuid = player.getUUID();
|
||||
return getPlots(area, uuid);
|
||||
return getPlots(area, player.getUUID());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2209,10 +2201,10 @@ public class PS {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the java version.
|
||||
* @return Java version as a double
|
||||
* Get the Java version.
|
||||
* @return the java version
|
||||
*/
|
||||
public double getJavaVersion() {
|
||||
private double getJavaVersion() {
|
||||
return Double.parseDouble(System.getProperty("java.specification.version"));
|
||||
}
|
||||
|
||||
|
@ -73,10 +73,10 @@ public enum C {
|
||||
/*
|
||||
* Static console
|
||||
*/
|
||||
CONSOLE_JAVA_OUTDATED_1_7("&cYour java version is outdated. Please update to at least 1.7.\n&cURL: &6https://java.com/en/download/index.jsp",
|
||||
"static.console"),
|
||||
CONSOLE_JAVA_OUTDATED_1_8("&cIt's really recommended to run Java 1.8, as it increases performance", "static.console"),
|
||||
CONSOLE_PLEASE_ENABLE_METRICS("&dUsing metrics will allow us to improve the plugin, please consider it :)", "static.console"),
|
||||
CONSOLE_JAVA_OUTDATED_1_8("&cYour version of java is outdated. It is highly recommended that you update to Java 8 as it increases performance "
|
||||
+ "and security. PlotSquared will require Java 9 in a future update.", "static.console"),
|
||||
CONSOLE_PLEASE_ENABLE_METRICS("&dPlease enable metrics for PlotSquared. Using metrics improves plugin stabability, performance, and features. "
|
||||
+ "Bug fixes and new features are influenced on metrics.", "static.console"),
|
||||
/*
|
||||
* Confirm
|
||||
*/
|
||||
@ -111,8 +111,7 @@ public enum C {
|
||||
*/
|
||||
CLUSTER_AVAILABLE_ARGS(
|
||||
"$1The following sub commands are available: $4list$2, $4create$2, $4delete$2, $4resize$2, $4invite$2, $4kick$2, $4leave$2, "
|
||||
+ "$4members$2, $4info$2, $4tp$2, $4sethome",
|
||||
"Cluster"),
|
||||
+ "$4members$2, $4info$2, $4tp$2, $4sethome", "Cluster"),
|
||||
CLUSTER_LIST_HEADING("$2There are $1%s$2 clusters in this world", "Cluster"),
|
||||
CLUSTER_LIST_ELEMENT("$2 - $1%s&-", "Cluster"),
|
||||
CLUSTER_INTERSECTION("$2The proposed area overlaps with: %s0", "Cluster"),
|
||||
@ -262,12 +261,10 @@ public enum C {
|
||||
SETUP_WORLD_TAKEN("$2%s is already a registered plotworld", "Setup"),
|
||||
SETUP_MISSING_WORLD(
|
||||
"$2You need to specify a world name ($1/plot setup &l<world>$1 <generator>$2)&-$1Additional commands:&-$2 - $1/plot setup <value>&-$2 -"
|
||||
+ " $1/plot setup back&-$2 - $1/plot setup cancel",
|
||||
"Setup"),
|
||||
+ " $1/plot setup back&-$2 - $1/plot setup cancel", "Setup"),
|
||||
SETUP_MISSING_GENERATOR(
|
||||
"$2You need to specify a generator ($1/plot setup <world> &l<generator>&r$2)&-$1Additional commands:&-$2 - $1/plot setup <value>&-$2 - "
|
||||
+ "$1/plot setup back&-$2 - $1/plot setup cancel",
|
||||
"Setup"),
|
||||
+ "$1/plot setup back&-$2 - $1/plot setup cancel", "Setup"),
|
||||
SETUP_INVALID_GENERATOR("$2Invalid generator. Possible options: %s", "Setup"),
|
||||
/*
|
||||
* Schematic Stuff
|
||||
@ -687,10 +684,6 @@ public enum C {
|
||||
}
|
||||
}
|
||||
|
||||
public String f(final Object... args) {
|
||||
return format(s(), args);
|
||||
}
|
||||
|
||||
public static String color(String string) {
|
||||
return StringMan.replaceFromMap(string, replacements);
|
||||
}
|
||||
@ -779,6 +772,10 @@ public enum C {
|
||||
}
|
||||
}
|
||||
|
||||
public String f(final Object... args) {
|
||||
return format(s(), args);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return this.s;
|
||||
|
@ -5,6 +5,7 @@ import com.intellectualcrafters.plot.PS;
|
||||
import com.intellectualcrafters.plot.config.Settings;
|
||||
import com.intellectualcrafters.plot.flag.Flag;
|
||||
import com.intellectualcrafters.plot.flag.FlagManager;
|
||||
import com.intellectualcrafters.plot.flag.StringFlag;
|
||||
import com.intellectualcrafters.plot.object.BlockLoc;
|
||||
import com.intellectualcrafters.plot.object.Plot;
|
||||
import com.intellectualcrafters.plot.object.PlotArea;
|
||||
@ -795,7 +796,7 @@ public class SQLManager implements AbstractDB {
|
||||
if (k != 0) {
|
||||
flag_string.append(',');
|
||||
}
|
||||
flag_string.append(flag.getKey().getName() + ':' + flag.getKey().valueToString(flag.getValue()).replaceAll(":", "¯")
|
||||
flag_string.append(flag.getKey().getName()).append(':').append(flag.getKey().valueToString(flag.getValue()).replaceAll(":", "¯")
|
||||
.replaceAll(",", "´"));
|
||||
k++;
|
||||
}
|
||||
@ -832,7 +833,7 @@ public class SQLManager implements AbstractDB {
|
||||
if (k != 0) {
|
||||
flag_string.append(',');
|
||||
}
|
||||
flag_string.append(flag.getKey().getName() + ':' + flag.getKey().valueToString(flag.getValue()).replaceAll(":", "¯")
|
||||
flag_string.append(flag.getKey().getName()).append(':').append(flag.getKey().valueToString(flag.getValue()).replaceAll(":", "¯")
|
||||
.replaceAll(",", "´"));
|
||||
k++;
|
||||
}
|
||||
@ -1814,12 +1815,15 @@ public class SQLManager implements AbstractDB {
|
||||
String[] split = element.split(":");
|
||||
try {
|
||||
String flag_str = split[1].replaceAll("¯", ":").replaceAll("\u00B4", ",");
|
||||
Flag<?> flag = FlagManager.getFlag(split[0],false);
|
||||
Flag<?> flag = FlagManager.getFlag(split[0],true);
|
||||
if (flag == null) {
|
||||
PS.debug(String.format("No flag found for string value of: %s", split[0]));
|
||||
} else {
|
||||
flags.put(flag, flag.parseValue(flag_str));
|
||||
flag = new StringFlag(split[0]) {
|
||||
@Override public String getValueDescription() {
|
||||
return "Generic Filler Flag";
|
||||
}
|
||||
};
|
||||
}
|
||||
flags.put(flag, flag.parseValue(flag_str));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
exception = true;
|
||||
@ -1827,12 +1831,15 @@ public class SQLManager implements AbstractDB {
|
||||
} else {
|
||||
element = element.replaceAll("\u00AF", ":").replaceAll("\u00B4", ",");
|
||||
if (StringMan.isAlpha(element.replaceAll("_", "").replaceAll("-", ""))) {
|
||||
Flag flag = FlagManager.getFlag(element,false);
|
||||
Flag flag = FlagManager.getFlag(element,true);
|
||||
if (flag == null) {
|
||||
PS.debug(String.format("No flag found for string value of: %s", element));
|
||||
} else {
|
||||
flags.put(flag, flag.parseValue(""));
|
||||
flag = new StringFlag(element) {
|
||||
@Override public String getValueDescription() {
|
||||
return "Generic Filler Flag";
|
||||
}
|
||||
};
|
||||
}
|
||||
flags.put(flag, flag.parseValue(""));
|
||||
} else {
|
||||
PS.debug("INVALID FLAG: " + element);
|
||||
}
|
||||
@ -2630,19 +2637,25 @@ public class SQLManager implements AbstractDB {
|
||||
if (element.contains(":")) {
|
||||
String[] split = element.split(":");
|
||||
String flag_str = split[1].replaceAll("\u00AF", ":").replaceAll("<EFBFBD>", ",");
|
||||
Flag flag = FlagManager.getFlag(split[0],false);
|
||||
Flag flag = FlagManager.getFlag(split[0],true);
|
||||
if (flag == null) {
|
||||
PS.debug(String.format("No flag found for string value of: %s", split[0]));
|
||||
} else {
|
||||
flags.put(flag, flag.parseValue(flag_str));
|
||||
flag = new StringFlag(split[0]) {
|
||||
@Override public String getValueDescription() {
|
||||
return "Generic Filler Flag";
|
||||
}
|
||||
};
|
||||
}
|
||||
flags.put(flag, flag.parseValue(flag_str));
|
||||
} else {
|
||||
Flag flag = FlagManager.getFlag(element,false);
|
||||
Flag flag = FlagManager.getFlag(element,true);
|
||||
if (flag == null) {
|
||||
PS.debug(String.format("No flag found for string value of: %s", element));
|
||||
} else {
|
||||
flags.put(flag, flag.parseValue(""));
|
||||
flag = new StringFlag(element) {
|
||||
@Override public String getValueDescription() {
|
||||
return "Generic Filler Flag";
|
||||
}
|
||||
};
|
||||
}
|
||||
flags.put(flag, flag.parseValue(""));
|
||||
}
|
||||
}
|
||||
cluster.settings.flags = flags;
|
||||
|
@ -152,15 +152,15 @@ public class Flags {
|
||||
PS.get().foreachPlotArea(new RunnableVal<PlotArea>() {
|
||||
@Override public void run(PlotArea value) {
|
||||
if (dupFinal != null) {
|
||||
Object remove = null;
|
||||
Object remove;
|
||||
if (value.DEFAULT_FLAGS.containsKey(dupFinal)) {
|
||||
remove = value.DEFAULT_FLAGS.remove(dupFinal);
|
||||
if (!(remove instanceof String)) {
|
||||
//error message? maybe?
|
||||
return;
|
||||
}
|
||||
value.DEFAULT_FLAGS.put(flag,flag.parseValue((String) remove));
|
||||
}
|
||||
if (!(remove instanceof String)) {
|
||||
//error message? maybe?
|
||||
return;
|
||||
}
|
||||
value.DEFAULT_FLAGS.put(flag,flag.parseValue((String) remove));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -23,6 +23,7 @@ import com.intellectualcrafters.plot.util.TaskManager;
|
||||
import com.intellectualcrafters.plot.util.UUIDHandler;
|
||||
import com.intellectualcrafters.plot.util.WorldUtil;
|
||||
import com.plotsquared.listener.PlotListener;
|
||||
|
||||
import java.awt.Rectangle;
|
||||
import java.awt.geom.Area;
|
||||
import java.awt.geom.PathIterator;
|
||||
@ -1957,8 +1958,8 @@ public class Plot {
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a plot can be claimed
|
||||
* @param player
|
||||
* Check if a plot can be claimed by the provided player.
|
||||
* @param player the claiming player
|
||||
* @return
|
||||
*/
|
||||
public boolean canClaim(PlotPlayer player) {
|
||||
|
@ -137,7 +137,7 @@ public abstract class PlotArea {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the min PlotId.
|
||||
* Returns the minimum value of a {@link PlotId}.
|
||||
* @return
|
||||
*/
|
||||
public PlotId getMin() {
|
||||
@ -491,19 +491,18 @@ public abstract class PlotArea {
|
||||
}
|
||||
|
||||
public int getPlotCount(UUID uuid) {
|
||||
int count = 0;
|
||||
if (!Settings.DONE_COUNTS_TOWARDS_LIMIT) {
|
||||
int count = 0;
|
||||
for (Plot plot : getPlotsAbs(uuid)) {
|
||||
if (!plot.hasFlag(Flags.DONE)) {
|
||||
count++;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
count += getPlotsAbs(uuid).size();
|
||||
return count;
|
||||
}
|
||||
return count;
|
||||
return getPlotsAbs(uuid).size();
|
||||
}
|
||||
|
||||
|
||||
public int getPlotCount(PlotPlayer player) {
|
||||
return player != null ? getPlotCount(player.getUUID()) : 0;
|
||||
}
|
||||
@ -529,7 +528,12 @@ public abstract class PlotArea {
|
||||
}
|
||||
return plot.getBasePlot(false);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Retrieves the number of claimed plot in the {@code PlotArea}.
|
||||
*
|
||||
* @return the number of claimed plots
|
||||
*/
|
||||
public int getPlotCount() {
|
||||
return this.plots.size();
|
||||
}
|
||||
@ -590,7 +594,11 @@ public abstract class PlotArea {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* A collection of the claimed plots in this {@code PlotArea}.
|
||||
* @return
|
||||
*/
|
||||
public Collection<Plot> getPlots() {
|
||||
return this.plots.values();
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ public abstract class PlotPlayer implements CommandCaller {
|
||||
}
|
||||
|
||||
/**
|
||||
* Set some session only metadata for the player
|
||||
* Set some session only metadata for the player.
|
||||
* @param key
|
||||
* @param value
|
||||
*/
|
||||
@ -70,7 +70,7 @@ public abstract class PlotPlayer implements CommandCaller {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the metadata for a key.
|
||||
* Get the session metadata for a key.
|
||||
* @param <T>
|
||||
* @param key
|
||||
* @return
|
||||
@ -82,6 +82,13 @@ public abstract class PlotPlayer implements CommandCaller {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param key
|
||||
* @param def
|
||||
* @param <T>
|
||||
* @return
|
||||
*/
|
||||
public <T> T getMeta(String key, T def) {
|
||||
if (this.meta != null) {
|
||||
T value = (T) this.meta.get(key);
|
||||
@ -161,7 +168,7 @@ public abstract class PlotPlayer implements CommandCaller {
|
||||
|
||||
/**
|
||||
* Get the number of plots the player owns in the world.
|
||||
* @param world
|
||||
* @param world the name of the plotworld to check.
|
||||
* @return
|
||||
*/
|
||||
public int getPlotCount(String world) {
|
||||
@ -170,7 +177,7 @@ public abstract class PlotPlayer implements CommandCaller {
|
||||
for (PlotArea area : PS.get().getPlotAreas(world)) {
|
||||
if (!Settings.DONE_COUNTS_TOWARDS_LIMIT) {
|
||||
for (Plot plot : area.getPlotsAbs(uuid)) {
|
||||
if (!plot.getFlags().containsKey("done")) {
|
||||
if (!plot.getFlag(Flags.DONE).isPresent()) {
|
||||
count++;
|
||||
}
|
||||
}
|
||||
@ -248,26 +255,26 @@ public abstract class PlotPlayer implements CommandCaller {
|
||||
public abstract UUID getUUID();
|
||||
|
||||
/**
|
||||
* Teleport the player to a location
|
||||
* @param location
|
||||
* Teleport the player to a location.
|
||||
* @param location the target location
|
||||
*/
|
||||
public abstract void teleport(Location location);
|
||||
|
||||
/**
|
||||
* Is the player online
|
||||
* @return
|
||||
* Checks if the player is online.
|
||||
* @return true if the player is online
|
||||
*/
|
||||
public abstract boolean isOnline();
|
||||
|
||||
/**
|
||||
* Get the player's name.
|
||||
* @return
|
||||
* Retrieves the name of the player.
|
||||
* @return the players username
|
||||
*/
|
||||
public abstract String getName();
|
||||
|
||||
/**
|
||||
* Set the compass target.
|
||||
* @param location
|
||||
* @param location the target location
|
||||
*/
|
||||
public abstract void setCompassTarget(Location location);
|
||||
|
||||
@ -283,8 +290,10 @@ public abstract class PlotPlayer implements CommandCaller {
|
||||
|
||||
|
||||
/**
|
||||
* The attribute will be either true or false.
|
||||
* Retrieves the player attribute.
|
||||
*
|
||||
* @param key
|
||||
* @return the attribute will be either true or false
|
||||
*/
|
||||
public boolean getAttribute(String key) {
|
||||
if (!hasPersistentMeta("attrib_" + key)) {
|
||||
@ -303,31 +312,31 @@ public abstract class PlotPlayer implements CommandCaller {
|
||||
|
||||
/**
|
||||
* Set the player's local weather
|
||||
* @param weather
|
||||
* @param weather the weather visible to the player
|
||||
*/
|
||||
public abstract void setWeather(PlotWeather weather);
|
||||
|
||||
/**
|
||||
* Get the player's gamemode.
|
||||
* @return
|
||||
* @return the gamemode of the player.
|
||||
*/
|
||||
public abstract PlotGameMode getGameMode();
|
||||
|
||||
/**
|
||||
* Set the player's gameMode.
|
||||
* @param gameMode
|
||||
* @param gameMode the gamemode to set
|
||||
*/
|
||||
public abstract void setGameMode(PlotGameMode gameMode);
|
||||
|
||||
/**
|
||||
* Set the player's local time (ticks).
|
||||
* @param time
|
||||
* @param time the time visible to the player
|
||||
*/
|
||||
public abstract void setTime(long time);
|
||||
|
||||
/**
|
||||
* Set the player's fly mode.
|
||||
* @param fly
|
||||
* @param fly if the player can fly
|
||||
*/
|
||||
public abstract void setFlight(boolean fly);
|
||||
|
||||
@ -340,13 +349,13 @@ public abstract class PlotPlayer implements CommandCaller {
|
||||
|
||||
/**
|
||||
* Check if the player is banned
|
||||
* @return
|
||||
* @return true if the player is banned, false otherwise.
|
||||
*/
|
||||
public abstract boolean isBanned();
|
||||
|
||||
/**
|
||||
* Kick the player from the game.
|
||||
* @param message
|
||||
* @param message the reason for the kick
|
||||
*/
|
||||
public abstract void kick(String message);
|
||||
|
||||
@ -389,7 +398,7 @@ public abstract class PlotPlayer implements CommandCaller {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the amount of clusters a player owns
|
||||
* Get the amount of clusters a player owns.
|
||||
* @return
|
||||
*/
|
||||
public int getPlayerClusterCount() {
|
||||
@ -404,9 +413,9 @@ public abstract class PlotPlayer implements CommandCaller {
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a Set of all plots a player owns
|
||||
* @param world
|
||||
* @return
|
||||
* Return a set of all plots a player owns in a certain world.
|
||||
* @param world the world to retrieve plots from
|
||||
* @return a set of plots the player owns in the provided world
|
||||
*/
|
||||
public Set<Plot> getPlots(String world) {
|
||||
UUID uuid = getUUID();
|
||||
|
@ -10,7 +10,7 @@ buildscript {
|
||||
}
|
||||
dependencies {
|
||||
classpath 'net.minecrell:VanillaGradle:2.0.3_1'
|
||||
classpath 'net.minecraftforge.gradle:ForgeGradle:2.1-SNAPSHOT'
|
||||
classpath 'net.minecraftforge.gradle:ForgeGradle:2.2-SNAPSHOT'
|
||||
}
|
||||
}
|
||||
|
||||
@ -19,7 +19,7 @@ apply plugin: 'com.github.johnrengelman.shadow'
|
||||
|
||||
dependencies {
|
||||
compile project(':Core')
|
||||
compile 'org.spongepowered:spongeapi:4.+'
|
||||
compile 'org.spongepowered:spongeapi:5.0.0-SNAPSHOT'
|
||||
//compile 'org.mcstats.sponge:metrics:R8-SNAPSHOT'
|
||||
}
|
||||
|
||||
@ -41,8 +41,8 @@ repositories {
|
||||
}
|
||||
}
|
||||
minecraft {
|
||||
version = "1.8.9"
|
||||
mappings = "stable_22"
|
||||
version = "1.9.4"
|
||||
mappings = "snapshot_20160530"
|
||||
runDir = 'run'
|
||||
}
|
||||
|
||||
|
@ -1,3 +1,5 @@
|
||||
import org.ajoberstar.grgit.Grgit
|
||||
|
||||
buildscript {
|
||||
repositories {
|
||||
mavenCentral()
|
||||
@ -14,7 +16,7 @@ buildscript {
|
||||
group = 'com.intellectualcrafters'
|
||||
def revision = ""
|
||||
ext {
|
||||
git = org.ajoberstar.grgit.Grgit.open(file(".git"))
|
||||
git = Grgit.open(file(".git"))
|
||||
revision = "-${git.head().abbreviatedId}"
|
||||
}
|
||||
version = "3.4.0${revision}"
|
||||
@ -27,7 +29,7 @@ subprojects {
|
||||
apply plugin: 'idea'
|
||||
|
||||
dependencies {
|
||||
compile(group: 'com.sk89q', name: 'worldedit', version:'6.0.0-SNAPSHOT') {
|
||||
compile(group: 'com.sk89q.worldedit', name: 'worldedit-core', version:'6.1.3-SNAPSHOT') {
|
||||
exclude(module: 'bukkit-classloader-check')
|
||||
}
|
||||
compile 'com.google.guava:guava:10.0'
|
||||
|
Loading…
Reference in New Issue
Block a user