mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2025-06-25 02:04:44 +02:00
Remove redundant .s() methods
This commit is contained in:
@ -54,7 +54,6 @@ import com.intellectualcrafters.plot.util.WorldUtil;
|
||||
import com.intellectualcrafters.plot.util.area.QuadMap;
|
||||
import com.plotsquared.listener.WESubscriber;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
@ -165,7 +164,7 @@ public class PS {
|
||||
}
|
||||
TASK = IMP.getTaskManager();
|
||||
if (!C.ENABLED.s().isEmpty()) {
|
||||
log(C.ENABLED.s());
|
||||
log(C.ENABLED);
|
||||
}
|
||||
setupConfigs();
|
||||
translationFile = new File(IMP.getDirectory() + File.separator + "translations" + File.separator + "PlotSquared.use_THIS.yml");
|
||||
@ -1370,10 +1369,10 @@ public class PS {
|
||||
// Conventional plot generator
|
||||
PlotArea plotArea = pg.getNewPlotArea(world, null, null, null);
|
||||
PlotManager plotManager = pg.getNewPlotManager();
|
||||
log(C.PREFIX.s() + "&aDetected world load for '" + world + "'");
|
||||
log(C.PREFIX.s() + "&3 - generator: &7" + baseGenerator + ">" + pg);
|
||||
log(C.PREFIX.s() + "&3 - plotworld: &7" + plotArea.getClass().getName());
|
||||
log(C.PREFIX.s() + "&3 - manager: &7" + plotManager.getClass().getName());
|
||||
log(C.PREFIX + "&aDetected world load for '" + world + "'");
|
||||
log(C.PREFIX + "&3 - generator: &7" + baseGenerator + ">" + pg);
|
||||
log(C.PREFIX + "&3 - plotworld: &7" + plotArea.getClass().getName());
|
||||
log(C.PREFIX + "&3 - manager: &7" + plotManager.getClass().getName());
|
||||
if (!config.contains(path)) {
|
||||
config.createSection(path);
|
||||
worldSection = config.getConfigurationSection(path);
|
||||
@ -1399,7 +1398,7 @@ public class PS {
|
||||
PS.debug("World possibly already loaded: " + world);
|
||||
return;
|
||||
}
|
||||
log(C.PREFIX.s() + "&aDetected world load for '" + world + "'");
|
||||
log(C.PREFIX + "&aDetected world load for '" + world + "'");
|
||||
String gen_string = worldSection.getString("generator.plugin", "PlotSquared");
|
||||
if (type == 2) {
|
||||
Set<PlotCluster> clusters = clusters_tmp != null ? clusters_tmp.get(world) : new HashSet<PlotCluster>();
|
||||
@ -1415,7 +1414,7 @@ public class PS {
|
||||
worldSection.createSection("areas." + fullId);
|
||||
DBFunc.replaceWorld(world, world + ";" + name, pos1, pos2); // NPE
|
||||
|
||||
log(C.PREFIX.s() + "&3 - " + name + "-" + pos1 + "-" + pos2);
|
||||
log(C.PREFIX + "&3 - " + name + "-" + pos1 + "-" + pos2);
|
||||
GeneratorWrapper<?> areaGen = IMP.getGenerator(world, gen_string);
|
||||
if (areaGen == null) {
|
||||
throw new IllegalArgumentException("Invalid Generator: " + gen_string);
|
||||
@ -1428,10 +1427,10 @@ public class PS {
|
||||
} catch (final IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
log(C.PREFIX.s() + "&c | &9generator: &7" + baseGenerator + ">" + areaGen);
|
||||
log(C.PREFIX.s() + "&c | &9plotworld: &7" + pa);
|
||||
log(C.PREFIX.s() + "&c | &9manager: &7" + pa);
|
||||
log(C.PREFIX.s() + "&cNote: &7Area created for cluster:" + name + " (invalid or old configuration?)");
|
||||
log(C.PREFIX + "&c | &9generator: &7" + baseGenerator + ">" + areaGen);
|
||||
log(C.PREFIX + "&c | &9plotworld: &7" + pa);
|
||||
log(C.PREFIX + "&c | &9manager: &7" + pa);
|
||||
log(C.PREFIX + "&cNote: &7Area created for cluster:" + name + " (invalid or old configuration?)");
|
||||
areaGen.getPlotGenerator().initialize(pa);
|
||||
areaGen.augment(pa);
|
||||
toLoad.add(pa);
|
||||
@ -1453,9 +1452,9 @@ public class PS {
|
||||
} catch (final IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
log(C.PREFIX.s() + "&3 - generator: &7" + baseGenerator + ">" + areaGen);
|
||||
log(C.PREFIX.s() + "&3 - plotworld: &7" + pa);
|
||||
log(C.PREFIX.s() + "&3 - manager: &7" + pa.getPlotManager());
|
||||
log(C.PREFIX + "&3 - generator: &7" + baseGenerator + ">" + areaGen);
|
||||
log(C.PREFIX + "&3 - plotworld: &7" + pa);
|
||||
log(C.PREFIX + "&3 - manager: &7" + pa.getPlotManager());
|
||||
areaGen.getPlotGenerator().initialize(pa);
|
||||
areaGen.augment(pa);
|
||||
addPlotArea(pa);
|
||||
@ -1465,7 +1464,7 @@ public class PS {
|
||||
throw new IllegalArgumentException("Invalid type for multi-area world. Expected `2`, got `" + type + "`");
|
||||
}
|
||||
for (String areaId : areasSection.getKeys(false)) {
|
||||
log(C.PREFIX.s() + "&3 - " + areaId);
|
||||
log(C.PREFIX + "&3 - " + areaId);
|
||||
String[] split = areaId.split("([^\\-]+)(?:-{1})(-{0,1}\\d+\\;-{0,1}\\d+)(?:-{1})(-{0,1}\\d+\\;-{0,1}\\d+)");
|
||||
if (split.length != 3) {
|
||||
throw new IllegalArgumentException("Invalid Area identifier: " + areaId + ". Expected form `<name>-<pos1>-<pos2>`");
|
||||
@ -1524,10 +1523,10 @@ public class PS {
|
||||
} catch (final IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
log(C.PREFIX.s() + "&aDetected area load for '" + world + "'");
|
||||
log(C.PREFIX.s() + "&c | &9generator: &7" + baseGenerator + ">" + areaGen);
|
||||
log(C.PREFIX.s() + "&c | &9plotworld: &7" + pa);
|
||||
log(C.PREFIX.s() + "&c | &9manager: &7" + pa.getPlotManager());
|
||||
log(C.PREFIX + "&aDetected area load for '" + world + "'");
|
||||
log(C.PREFIX + "&c | &9generator: &7" + baseGenerator + ">" + areaGen);
|
||||
log(C.PREFIX + "&c | &9plotworld: &7" + pa);
|
||||
log(C.PREFIX + "&c | &9manager: &7" + pa.getPlotManager());
|
||||
areaGen.getPlotGenerator().initialize(pa);
|
||||
areaGen.augment(pa);
|
||||
addPlotArea(pa);
|
||||
@ -1764,7 +1763,7 @@ public class PS {
|
||||
public void setupDatabase() {
|
||||
try {
|
||||
if (Settings.DB.USE_MONGO) {
|
||||
log(C.PREFIX.s() + "MongoDB is not yet implemented");
|
||||
log(C.PREFIX + "MongoDB is not yet implemented");
|
||||
log(C.PREFIX + "&cNo storage type is set!");
|
||||
IMP.disable();
|
||||
return;
|
||||
@ -1786,7 +1785,7 @@ public class PS {
|
||||
this.clusters_tmp = DBFunc.getClusters();
|
||||
}
|
||||
} catch (ClassNotFoundException | SQLException e) {
|
||||
log(C.PREFIX.s() + "&cFailed to open DATABASE connection. The plugin will disable itself.");
|
||||
log(C.PREFIX + "&cFailed to open DATABASE connection. The plugin will disable itself.");
|
||||
if (Settings.DB.USE_MONGO) {
|
||||
log("$4MONGO");
|
||||
} else if (Settings.DB.USE_MYSQL) {
|
||||
@ -2195,7 +2194,7 @@ public class PS {
|
||||
// Misc
|
||||
Settings.DEBUG = config.getBoolean("debug");
|
||||
if (Settings.DEBUG) {
|
||||
log(C.PREFIX.s() + "&6Debug Mode Enabled (Default). Edit the config to turn this off.");
|
||||
log(C.PREFIX + "&6Debug Mode Enabled (Default). Edit the config to turn this off.");
|
||||
}
|
||||
Settings.CONSOLE_COLOR = config.getBoolean("console.color");
|
||||
if (!config.getBoolean("chat.fancy") || !checkVersion(IMP.getServerVersion(), 1, 8, 0)) {
|
||||
@ -2216,7 +2215,7 @@ public class PS {
|
||||
public void setupConfigs() {
|
||||
final File folder = new File(IMP.getDirectory() + File.separator + "config");
|
||||
if (!folder.exists() && !folder.mkdirs()) {
|
||||
log(C.PREFIX.s() + "&cFailed to create the /plugins/config folder. Please create it manually.");
|
||||
log(C.PREFIX + "&cFailed to create the /plugins/config folder. Please create it manually.");
|
||||
}
|
||||
try {
|
||||
styleFile = new File(IMP.getDirectory() + File.separator + "translations" + File.separator + "style.yml");
|
||||
@ -2315,7 +2314,7 @@ public class PS {
|
||||
settings.put("Schematics Save Path", "" + Settings.SCHEMATIC_SAVE_PATH);
|
||||
settings.put("API Location", "" + Settings.API_URL);
|
||||
for (final Entry<String, String> setting : settings.entrySet()) {
|
||||
log(C.PREFIX.s() + String.format("&cKey: &6%s&c, Value: &6%s", setting.getKey(), setting.getValue()));
|
||||
log(C.PREFIX + String.format("&cKey: &6%s&c, Value: &6%s", setting.getKey(), setting.getValue()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -26,7 +26,6 @@ import com.intellectualcrafters.plot.util.SetupUtils;
|
||||
import com.intellectualcrafters.plot.util.StringMan;
|
||||
import com.intellectualcrafters.plot.util.WorldUtil;
|
||||
import com.plotsquared.general.commands.CommandDeclaration;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Objects;
|
||||
@ -35,7 +34,7 @@ import java.util.Set;
|
||||
@CommandDeclaration(command = "area", permission = "plots.area", category = CommandCategory.ADMINISTRATION, requiredType = RequiredType.NONE,
|
||||
description = "Create a new PlotArea", aliases = "world", usage = "/plot area <create|info|list|tp|regen>")
|
||||
public class Area extends SubCommand {
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onCommand(final PlotPlayer plr, String[] args) {
|
||||
if (args.length == 0) {
|
||||
@ -380,7 +379,7 @@ public class Area extends SubCommand {
|
||||
.text("\nClusters=").color("$1").text("" + clusters).color("$2")
|
||||
.text("\nRegion=").color("$1").text(region).color("$2")
|
||||
.text("\nGenerator=").color("$1").text(generator).color("$2");
|
||||
|
||||
|
||||
// type / terrain
|
||||
String visit = "/plot area tp " + area.toString();
|
||||
message.text("[").color("$3")
|
||||
@ -457,5 +456,5 @@ public class Area extends SubCommand {
|
||||
C.COMMAND_SYNTAX.send(plr, getUsage());
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ aliases = { "biome", "sb", "setb", "b" },
|
||||
category = CommandCategory.APPEARANCE,
|
||||
requiredType = RequiredType.NONE)
|
||||
public class Biome extends SetCommand {
|
||||
|
||||
|
||||
@Override
|
||||
public boolean set(final PlotPlayer plr, final Plot plot, final String value) {
|
||||
final int biome = WorldUtil.IMP.getBiomeFromString(value);
|
||||
|
@ -33,7 +33,6 @@ import com.intellectualcrafters.plot.util.Permissions;
|
||||
import com.intellectualcrafters.plot.util.StringMan;
|
||||
import com.intellectualcrafters.plot.util.UUIDHandler;
|
||||
import com.plotsquared.general.commands.CommandDeclaration;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.UUID;
|
||||
|
||||
@ -43,7 +42,7 @@ import java.util.UUID;
|
||||
public class Merge extends SubCommand {
|
||||
public final static String[] values = new String[] { "north", "east", "south", "west", "auto" };
|
||||
public final static String[] aliases = new String[] { "n", "e", "s", "w", "all" };
|
||||
|
||||
|
||||
public static String direction(float yaw) {
|
||||
yaw = yaw / 90;
|
||||
final int i = Math.round(yaw);
|
||||
@ -65,7 +64,7 @@ public class Merge extends SubCommand {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onCommand(final PlotPlayer plr, final String[] args) {
|
||||
final Location loc = plr.getLocationFull();
|
||||
@ -131,7 +130,7 @@ public class Merge extends SubCommand {
|
||||
}
|
||||
MainUtil.sendMessage(plr, C.NO_AVAILABLE_AUTOMERGE);
|
||||
return false;
|
||||
|
||||
|
||||
}
|
||||
for (int i = 0; i < values.length; i++) {
|
||||
if (args[0].equalsIgnoreCase(values[i]) || args[0].equalsIgnoreCase(aliases[i])) {
|
||||
@ -165,7 +164,7 @@ public class Merge extends SubCommand {
|
||||
return false;
|
||||
}
|
||||
if (!Permissions.hasPermission(plr, C.PERMISSION_MERGE_OTHER)) {
|
||||
MainUtil.sendMessage(plr, C.NO_PERMISSION, C.PERMISSION_MERGE_OTHER.s());
|
||||
MainUtil.sendMessage(plr, C.NO_PERMISSION, C.PERMISSION_MERGE_OTHER);
|
||||
return false;
|
||||
}
|
||||
HashSet<UUID> uuids = adjacent.getOwners();
|
||||
|
@ -23,22 +23,32 @@ package com.intellectualcrafters.plot.flag;
|
||||
import com.intellectualcrafters.plot.PS;
|
||||
import com.intellectualcrafters.plot.config.C;
|
||||
import com.intellectualcrafters.plot.database.DBFunc;
|
||||
import com.intellectualcrafters.plot.object.*;
|
||||
import com.intellectualcrafters.plot.object.Plot;
|
||||
import com.intellectualcrafters.plot.object.PlotArea;
|
||||
import com.intellectualcrafters.plot.object.PlotCluster;
|
||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||
import com.intellectualcrafters.plot.object.PlotSettings;
|
||||
import com.intellectualcrafters.plot.object.RunnableVal;
|
||||
import com.intellectualcrafters.plot.util.EventUtil;
|
||||
import com.intellectualcrafters.plot.util.Permissions;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* Flag Manager Utility
|
||||
*
|
||||
*/
|
||||
public class FlagManager {
|
||||
|
||||
|
||||
private final static HashSet<String> reserved = new HashSet<>();
|
||||
|
||||
|
||||
private final static HashSet<AbstractFlag> flags = new HashSet<>();
|
||||
|
||||
|
||||
/**
|
||||
* Reserve a flag so that it cannot be set by players
|
||||
* @param flag
|
||||
@ -46,7 +56,7 @@ public class FlagManager {
|
||||
public static void reserveFlag(final String flag) {
|
||||
reserved.add(flag);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get if a flag is reserved
|
||||
* @param flag
|
||||
@ -55,7 +65,7 @@ public class FlagManager {
|
||||
public static boolean isReserved(final String flag) {
|
||||
return reserved.contains(flag);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the reserved flags
|
||||
* @return
|
||||
@ -63,7 +73,7 @@ public class FlagManager {
|
||||
public static HashSet<String> getReservedFlags() {
|
||||
return (HashSet<String>) reserved.clone();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Unreserve a flag
|
||||
* @param flag
|
||||
@ -71,7 +81,7 @@ public class FlagManager {
|
||||
public static void unreserveFlag(final String flag) {
|
||||
reserved.remove(flag);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Register an AbstractFlag with PlotSquared
|
||||
*
|
||||
@ -82,9 +92,9 @@ public class FlagManager {
|
||||
public static boolean addFlag(final AbstractFlag af) {
|
||||
return addFlag(af, false);
|
||||
}
|
||||
|
||||
|
||||
public static boolean addFlag(final AbstractFlag af, final boolean reserved) {
|
||||
PS.debug(C.PREFIX.s() + "&8 - Adding flag: &7" + af);
|
||||
PS.debug(C.PREFIX + "&8 - Adding flag: &7" + af);
|
||||
PS.get().foreachPlotArea(new RunnableVal<PlotArea>() {
|
||||
@Override
|
||||
public void run(PlotArea value) {
|
||||
@ -125,7 +135,7 @@ public class FlagManager {
|
||||
}
|
||||
return flag_string.toString();
|
||||
}
|
||||
|
||||
|
||||
public static Flag getSettingFlag(final PlotArea area, final PlotSettings settings, final String id) {
|
||||
Flag flag;
|
||||
if (settings.flags.isEmpty() || (flag = settings.flags.get(id)) == null) {
|
||||
@ -139,7 +149,7 @@ public class FlagManager {
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
|
||||
public static boolean isBooleanFlag(final Plot plot, final String key, final boolean defaultValue) {
|
||||
final Flag flag = FlagManager.getPlotFlagRaw(plot, key);
|
||||
if (flag == null) {
|
||||
@ -151,7 +161,7 @@ public class FlagManager {
|
||||
}
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the value of a flag for a plot (respects flag defaults)
|
||||
* @param plot
|
||||
@ -177,7 +187,7 @@ public class FlagManager {
|
||||
}
|
||||
return getSettingFlag(plot.getArea(), plot.getSettings(), flag);
|
||||
}
|
||||
|
||||
|
||||
public static boolean isPlotFlagTrue(final Plot plot, final String strFlag) {
|
||||
if (plot.owner == null) {
|
||||
return false;
|
||||
@ -185,7 +195,7 @@ public class FlagManager {
|
||||
final Flag flag = getPlotFlagRaw(plot, strFlag);
|
||||
return !(flag == null || !((Boolean) flag.getValue()));
|
||||
}
|
||||
|
||||
|
||||
public static boolean isPlotFlagFalse(final Plot plot, final String strFlag) {
|
||||
if (plot.owner == null) {
|
||||
return false;
|
||||
@ -196,7 +206,7 @@ public class FlagManager {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the value of a flag for a plot (ignores flag defaults)
|
||||
* @param plot
|
||||
@ -206,14 +216,14 @@ public class FlagManager {
|
||||
public static Flag getPlotFlagAbs(final Plot plot, final String flag) {
|
||||
return getSettingFlagAbs(plot.getSettings(), flag);
|
||||
}
|
||||
|
||||
|
||||
public static Flag getSettingFlagAbs(final PlotSettings settings, final String flag) {
|
||||
if (settings.flags.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
return settings.flags.get(flag);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add a flag to a plot
|
||||
* @param origin
|
||||
@ -231,7 +241,7 @@ public class FlagManager {
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public static boolean addPlotFlagAbs(final Plot plot, final Flag flag) {
|
||||
final boolean result = EventUtil.manager.callFlagAdd(flag, plot);
|
||||
if (!result) {
|
||||
@ -240,14 +250,14 @@ public class FlagManager {
|
||||
plot.getFlags().put(flag.getKey(), flag);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public static boolean addClusterFlag(final PlotCluster cluster, final Flag flag) {
|
||||
getSettingFlag(cluster.area, cluster.settings, flag.getKey());
|
||||
cluster.settings.flags.put(flag.getKey(), flag);
|
||||
DBFunc.setFlags(cluster, cluster.settings.flags.values());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @param plot
|
||||
@ -259,7 +269,7 @@ public class FlagManager {
|
||||
}
|
||||
return getSettingFlags(plot.getArea(), plot.getSettings());
|
||||
}
|
||||
|
||||
|
||||
public static HashMap<String, Flag> getPlotFlags(PlotArea area, final PlotSettings settings, final boolean ignorePluginflags) {
|
||||
final HashMap<String, Flag> flags = new HashMap<>();
|
||||
if (area != null && !area.DEFAULT_FLAGS.isEmpty()) {
|
||||
@ -275,14 +285,14 @@ public class FlagManager {
|
||||
} else {
|
||||
flags.putAll(settings.flags);
|
||||
}
|
||||
|
||||
|
||||
return flags;
|
||||
}
|
||||
|
||||
|
||||
public static HashMap<String, Flag> getSettingFlags(PlotArea area, final PlotSettings settings) {
|
||||
return getPlotFlags(area, settings, false);
|
||||
}
|
||||
|
||||
|
||||
public static boolean removePlotFlag(final Plot plot, final String id) {
|
||||
final Flag flag = plot.getFlags().remove(id);
|
||||
if (flag == null) {
|
||||
@ -297,7 +307,7 @@ public class FlagManager {
|
||||
DBFunc.setFlags(plot, plot.getFlags().values());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public static boolean removeClusterFlag(final PlotCluster cluster, final String id) {
|
||||
final Flag flag = cluster.settings.flags.remove(id);
|
||||
if (flag == null) {
|
||||
@ -311,7 +321,7 @@ public class FlagManager {
|
||||
DBFunc.setFlags(cluster, cluster.settings.flags.values());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public static void setPlotFlags(final Plot origin, final Set<Flag> flags) {
|
||||
for (Plot plot : origin.getConnectedPlots()) {
|
||||
if (flags != null && !flags.isEmpty()) {
|
||||
@ -328,7 +338,7 @@ public class FlagManager {
|
||||
DBFunc.setFlags(plot, plot.getFlags().values());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static void setClusterFlags(final PlotCluster cluster, final Set<Flag> flags) {
|
||||
if (flags != null && !flags.isEmpty()) {
|
||||
cluster.settings.flags.clear();
|
||||
@ -342,7 +352,7 @@ public class FlagManager {
|
||||
}
|
||||
DBFunc.setFlags(cluster, cluster.settings.flags.values());
|
||||
}
|
||||
|
||||
|
||||
public static Flag[] removeFlag(final Flag[] flags, final String r) {
|
||||
final Flag[] f = new Flag[flags.length - 1];
|
||||
int index = 0;
|
||||
@ -353,7 +363,7 @@ public class FlagManager {
|
||||
}
|
||||
return f;
|
||||
}
|
||||
|
||||
|
||||
public static Set<Flag> removeFlag(final Set<Flag> flags, final String r) {
|
||||
final HashSet<Flag> newflags = new HashSet<>();
|
||||
for (final Flag flag : flags) {
|
||||
@ -363,7 +373,7 @@ public class FlagManager {
|
||||
}
|
||||
return newflags;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get a list of registered AbstractFlag objects
|
||||
*
|
||||
@ -372,7 +382,7 @@ public class FlagManager {
|
||||
public static HashSet<AbstractFlag> getFlags() {
|
||||
return flags;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get a list of registered AbstractFlag objects based on player permissions
|
||||
*
|
||||
@ -389,7 +399,7 @@ public class FlagManager {
|
||||
}
|
||||
return returnFlags;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get an AbstractFlag by a string Returns null if flag does not exist
|
||||
*
|
||||
@ -405,7 +415,7 @@ public class FlagManager {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get an AbstractFlag by a string
|
||||
*
|
||||
@ -420,7 +430,7 @@ public class FlagManager {
|
||||
}
|
||||
return getFlag(string);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Remove a registered AbstractFlag
|
||||
*
|
||||
@ -431,7 +441,7 @@ public class FlagManager {
|
||||
public static boolean removeFlag(final AbstractFlag flag) {
|
||||
return flags.remove(flag);
|
||||
}
|
||||
|
||||
|
||||
public static HashMap<String, Flag> parseFlags(final List<String> flagstrings) {
|
||||
final HashMap<String, Flag> map = new HashMap<>();
|
||||
for (final String key : flagstrings) {
|
||||
|
@ -32,7 +32,6 @@ import com.intellectualcrafters.plot.util.MathMan;
|
||||
import com.intellectualcrafters.plot.util.SchematicHandler;
|
||||
import com.intellectualcrafters.plot.util.SchematicHandler.Dimension;
|
||||
import com.intellectualcrafters.plot.util.SchematicHandler.Schematic;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
@ -177,7 +176,7 @@ public class HybridPlotWorld extends ClassicPlotWorld {
|
||||
PS.debug("&c - road schematics are disabled for this world.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isCompatible(PlotArea plotworld) {
|
||||
if (!(plotworld instanceof SquarePlotWorld)) {
|
||||
@ -250,7 +249,7 @@ public class HybridPlotWorld extends ClassicPlotWorld {
|
||||
}
|
||||
}
|
||||
if (schem1 == null || schem2 == null || ROAD_WIDTH == 0) {
|
||||
PS.debug(C.PREFIX.s() + "&3 - schematic: &7false");
|
||||
PS.debug(C.PREFIX + "&3 - schematic: &7false");
|
||||
return;
|
||||
}
|
||||
ROAD_SCHEMATIC_ENABLED = true;
|
||||
@ -298,7 +297,7 @@ public class HybridPlotWorld extends ClassicPlotWorld {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void addOverlayBlock(short x, final short y, short z, final short id, byte data, final boolean rotate) {
|
||||
if (z < 0) {
|
||||
z += SIZE;
|
||||
|
@ -5,16 +5,35 @@ import com.intellectualcrafters.plot.PS;
|
||||
import com.intellectualcrafters.plot.config.C;
|
||||
import com.intellectualcrafters.plot.flag.Flag;
|
||||
import com.intellectualcrafters.plot.flag.FlagManager;
|
||||
import com.intellectualcrafters.plot.object.*;
|
||||
import com.intellectualcrafters.plot.util.*;
|
||||
|
||||
import com.intellectualcrafters.plot.object.ChunkLoc;
|
||||
import com.intellectualcrafters.plot.object.Location;
|
||||
import com.intellectualcrafters.plot.object.Plot;
|
||||
import com.intellectualcrafters.plot.object.PlotAnalysis;
|
||||
import com.intellectualcrafters.plot.object.PlotArea;
|
||||
import com.intellectualcrafters.plot.object.PlotBlock;
|
||||
import com.intellectualcrafters.plot.object.PlotId;
|
||||
import com.intellectualcrafters.plot.object.PlotManager;
|
||||
import com.intellectualcrafters.plot.object.RegionWrapper;
|
||||
import com.intellectualcrafters.plot.object.RunnableVal;
|
||||
import com.intellectualcrafters.plot.util.ChunkManager;
|
||||
import com.intellectualcrafters.plot.util.MathMan;
|
||||
import com.intellectualcrafters.plot.util.SchematicHandler;
|
||||
import com.intellectualcrafters.plot.util.SetQueue;
|
||||
import com.intellectualcrafters.plot.util.TaskManager;
|
||||
import java.io.File;
|
||||
import java.util.*;
|
||||
import java.util.ArrayDeque;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
public abstract class HybridUtils {
|
||||
|
||||
|
||||
public static HybridUtils manager;
|
||||
public static Set<ChunkLoc> regions;
|
||||
public static Set<ChunkLoc> chunks = new HashSet<>();
|
||||
@ -90,7 +109,7 @@ public abstract class HybridUtils {
|
||||
}
|
||||
|
||||
public abstract int checkModified(final String world, final int x1, final int x2, final int y1, final int y2, final int z1, final int z2, final PlotBlock[] blocks);
|
||||
|
||||
|
||||
public final ArrayList<ChunkLoc> getChunks(final ChunkLoc region) {
|
||||
final ArrayList<ChunkLoc> chunks = new ArrayList<>();
|
||||
final int sx = region.x << 5;
|
||||
@ -102,7 +121,7 @@ public abstract class HybridUtils {
|
||||
}
|
||||
return chunks;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Checks all connected plots
|
||||
* @param plot
|
||||
@ -125,7 +144,7 @@ public abstract class HybridUtils {
|
||||
@Override
|
||||
public void run() {
|
||||
if (zones.isEmpty()) {
|
||||
|
||||
|
||||
TaskManager.runTask(whenDone);
|
||||
return;
|
||||
}
|
||||
@ -147,12 +166,12 @@ public abstract class HybridUtils {
|
||||
plot.getArea().worldname, bx, ex, cpw.PLOT_HEIGHT + 1, 255, bz, ez, new PlotBlock[] { new PlotBlock((short) 0, (byte) 0) });
|
||||
}
|
||||
}, this, 5);
|
||||
|
||||
|
||||
}
|
||||
};
|
||||
run.run();
|
||||
}
|
||||
|
||||
|
||||
public boolean scheduleRoadUpdate(final PlotArea area, final int extend) {
|
||||
if (HybridUtils.UPDATE) {
|
||||
return false;
|
||||
@ -161,7 +180,7 @@ public abstract class HybridUtils {
|
||||
final Set<ChunkLoc> regions = ChunkManager.manager.getChunkChunks(area.worldname);
|
||||
return scheduleRoadUpdate(area, regions, extend);
|
||||
}
|
||||
|
||||
|
||||
public boolean scheduleRoadUpdate(final PlotArea area, final Set<ChunkLoc> rgs, final int extend) {
|
||||
HybridUtils.regions = rgs;
|
||||
HybridUtils.area = area;
|
||||
@ -190,7 +209,7 @@ public abstract class HybridUtils {
|
||||
}
|
||||
if ((regions.isEmpty()) && (chunks.isEmpty())) {
|
||||
HybridUtils.UPDATE = false;
|
||||
PS.debug(C.PREFIX.s() + "Finished road conversion");
|
||||
PS.debug(C.PREFIX + "Finished road conversion");
|
||||
// CANCEL TASK
|
||||
} else {
|
||||
final Runnable task = this;
|
||||
@ -216,7 +235,7 @@ public abstract class HybridUtils {
|
||||
final long diff = System.currentTimeMillis() + 1;
|
||||
if (((System.currentTimeMillis() - baseTime - last.get()) > 2000) && (last.get() != 0)) {
|
||||
last.set(0);
|
||||
PS.debug(C.PREFIX.s() + "Detected low TPS. Rescheduling in 30s");
|
||||
PS.debug(C.PREFIX + "Detected low TPS. Rescheduling in 30s");
|
||||
Iterator<ChunkLoc> iter = chunks.iterator();
|
||||
final ChunkLoc chunk = iter.next();
|
||||
iter.remove();
|
||||
@ -274,7 +293,7 @@ public abstract class HybridUtils {
|
||||
});
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public boolean setupRoadSchematic(final Plot plot) {
|
||||
final String world = plot.getArea().worldname;
|
||||
final Location bot = plot.getBottomAbs().subtract(1, 0, 1);
|
||||
@ -289,7 +308,7 @@ public abstract class HybridUtils {
|
||||
final int bz = sz - plotworld.ROAD_WIDTH;
|
||||
final int tz = sz - 1;
|
||||
final int ty = get_ey(world, sx, ex, bz, tz, sy);
|
||||
|
||||
|
||||
final Set<RegionWrapper> sideroad = new HashSet<>(Collections.singletonList(new RegionWrapper(sx, ex, sy, ey, sz, ez)));
|
||||
final Set<RegionWrapper> intersection = new HashSet<>(Collections.singletonList(new RegionWrapper(sx, ex, sy, ty, bz, tz)));
|
||||
|
||||
@ -311,9 +330,9 @@ public abstract class HybridUtils {
|
||||
});
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public abstract int get_ey(final String world, final int sx, final int ex, final int sz, final int ez, final int sy);
|
||||
|
||||
|
||||
public boolean regenerateRoad(final PlotArea area, final ChunkLoc chunk, int extend) {
|
||||
int x = chunk.x << 4;
|
||||
int z = chunk.z << 4;
|
||||
|
@ -14,7 +14,6 @@ import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||
import com.intellectualcrafters.plot.object.RunnableVal;
|
||||
import com.intellectualcrafters.plot.object.StringWrapper;
|
||||
import com.intellectualcrafters.plot.uuid.UUIDWrapper;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
@ -29,19 +28,19 @@ public abstract class UUIDHandlerImplementation {
|
||||
public UUIDWrapper uuidWrapper = null;
|
||||
public HashSet<UUID> unknown = new HashSet<>();
|
||||
private BiMap<StringWrapper, UUID> uuidMap = HashBiMap.create(new HashMap<StringWrapper, UUID>());
|
||||
|
||||
|
||||
public UUIDHandlerImplementation(final UUIDWrapper wrapper) {
|
||||
uuidWrapper = wrapper;
|
||||
players = new ConcurrentHashMap<>();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* If the UUID is not found, some commands can request to fetch the UUID when possible
|
||||
* @param name
|
||||
* @param ifFetch
|
||||
*/
|
||||
public abstract void fetchUUID(final String name, final RunnableVal<UUID> ifFetch);
|
||||
|
||||
|
||||
/**
|
||||
* Start UUID caching (this should be an async task)
|
||||
* Recommended to override this is you want to cache offline players
|
||||
@ -52,20 +51,20 @@ public abstract class UUIDHandlerImplementation {
|
||||
}
|
||||
return CACHED = true;
|
||||
}
|
||||
|
||||
|
||||
public UUIDWrapper getUUIDWrapper() {
|
||||
return uuidWrapper;
|
||||
}
|
||||
|
||||
|
||||
public void setUUIDWrapper(final UUIDWrapper wrapper) {
|
||||
uuidWrapper = wrapper;
|
||||
}
|
||||
|
||||
|
||||
public void rename(final UUID uuid, final StringWrapper name) {
|
||||
uuidMap.inverse().remove(uuid);
|
||||
uuidMap.put(name, uuid);
|
||||
}
|
||||
|
||||
|
||||
public void add(final BiMap<StringWrapper, UUID> toAdd) {
|
||||
if (uuidMap.isEmpty()) {
|
||||
uuidMap = toAdd;
|
||||
@ -86,9 +85,9 @@ public abstract class UUIDHandlerImplementation {
|
||||
}
|
||||
uuidMap.put(name, uuid);
|
||||
}
|
||||
PS.debug(C.PREFIX.s() + "&6Cached a total of: " + uuidMap.size() + " UUIDs");
|
||||
PS.debug(C.PREFIX + "&6Cached a total of: " + uuidMap.size() + " UUIDs");
|
||||
}
|
||||
|
||||
|
||||
public boolean add(final StringWrapper name, final UUID uuid) {
|
||||
if ((uuid == null)) {
|
||||
return false;
|
||||
@ -102,7 +101,7 @@ public abstract class UUIDHandlerImplementation {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* lazy UUID conversion:
|
||||
* - Useful if the person misconfigured the database, or settings before PlotMe conversion
|
||||
@ -165,25 +164,25 @@ public abstract class UUIDHandlerImplementation {
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public boolean uuidExists(final UUID uuid) {
|
||||
return uuidMap.containsValue(uuid);
|
||||
}
|
||||
|
||||
|
||||
public BiMap<StringWrapper, UUID> getUUIDMap() {
|
||||
return uuidMap;
|
||||
}
|
||||
|
||||
|
||||
public boolean nameExists(final StringWrapper wrapper) {
|
||||
return uuidMap.containsKey(wrapper);
|
||||
}
|
||||
|
||||
|
||||
public void handleShutdown() {
|
||||
players.clear();
|
||||
uuidMap.clear();
|
||||
uuidWrapper = null;
|
||||
}
|
||||
|
||||
|
||||
public String getName(final UUID uuid) {
|
||||
if (uuid == null) {
|
||||
return null;
|
||||
@ -200,7 +199,7 @@ public abstract class UUIDHandlerImplementation {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public UUID getUUID(final String name, final RunnableVal<UUID> ifFetch) {
|
||||
if ((name == null) || (name.isEmpty())) {
|
||||
return null;
|
||||
@ -228,15 +227,15 @@ public abstract class UUIDHandlerImplementation {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public UUID getUUID(final PlotPlayer player) {
|
||||
return uuidWrapper.getUUID(player);
|
||||
}
|
||||
|
||||
|
||||
public UUID getUUID(final OfflinePlotPlayer player) {
|
||||
return uuidWrapper.getUUID(player);
|
||||
}
|
||||
|
||||
|
||||
public PlotPlayer getPlayer(final UUID uuid) {
|
||||
String name = getName(uuid);
|
||||
if (name != null) {
|
||||
@ -244,13 +243,13 @@ public abstract class UUIDHandlerImplementation {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public PlotPlayer getPlayer(final String name) {
|
||||
return players.get(name);
|
||||
}
|
||||
|
||||
|
||||
public Map<String, PlotPlayer> getPlayers() {
|
||||
return players;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -1,36 +1,35 @@
|
||||
package com.intellectualcrafters.plot.util.helpmenu;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.intellectualcrafters.plot.commands.CommandCategory;
|
||||
import com.intellectualcrafters.plot.config.C;
|
||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||
import com.intellectualcrafters.plot.util.MainUtil;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class HelpPage {
|
||||
|
||||
|
||||
private final List<HelpObject> helpObjects;
|
||||
private final String _header;
|
||||
|
||||
|
||||
public HelpPage(final CommandCategory category, final int currentPage, final int maxPages) {
|
||||
helpObjects = new ArrayList<>();
|
||||
_header = C.HELP_PAGE_HEADER.s().replace("%category%", category == null ? "ALL" : category.toString()).replace("%current%", (currentPage + 1) + "").replace("%max%", (maxPages + 1) + "");
|
||||
}
|
||||
|
||||
|
||||
public void render(final PlotPlayer player) {
|
||||
if (helpObjects.size() < 1) {
|
||||
MainUtil.sendMessage(player, C.NOT_VALID_NUMBER, "(0)");
|
||||
} else {
|
||||
MainUtil.sendMessage(player, C.HELP_HEADER.s(), false);
|
||||
MainUtil.sendMessage(player, C.HELP_HEADER, false);
|
||||
MainUtil.sendMessage(player, _header, false);
|
||||
for (final HelpObject object : helpObjects) {
|
||||
MainUtil.sendMessage(player, object.toString(), false);
|
||||
}
|
||||
MainUtil.sendMessage(player, C.HELP_FOOTER.s(), false);
|
||||
MainUtil.sendMessage(player, C.HELP_FOOTER, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void addHelpItem(final HelpObject object) {
|
||||
helpObjects.add(object);
|
||||
}
|
||||
|
@ -29,8 +29,17 @@ import com.intellectualcrafters.plot.object.Plot;
|
||||
import com.intellectualcrafters.plot.object.PlotArea;
|
||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||
import com.intellectualcrafters.plot.object.RunnableVal;
|
||||
import com.intellectualcrafters.plot.util.*;
|
||||
|
||||
import com.intellectualcrafters.plot.util.AbstractTitle;
|
||||
import com.intellectualcrafters.plot.util.CommentManager;
|
||||
import com.intellectualcrafters.plot.util.EventUtil;
|
||||
import com.intellectualcrafters.plot.util.ExpireManager;
|
||||
import com.intellectualcrafters.plot.util.MainUtil;
|
||||
import com.intellectualcrafters.plot.util.Permissions;
|
||||
import com.intellectualcrafters.plot.util.PlotGamemode;
|
||||
import com.intellectualcrafters.plot.util.PlotWeather;
|
||||
import com.intellectualcrafters.plot.util.StringMan;
|
||||
import com.intellectualcrafters.plot.util.TaskManager;
|
||||
import com.intellectualcrafters.plot.util.UUIDHandler;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
@ -40,7 +49,7 @@ import java.util.UUID;
|
||||
|
||||
*/
|
||||
public class PlotListener {
|
||||
|
||||
|
||||
public static boolean plotEntry(final PlotPlayer pp, final Plot plot) {
|
||||
if (plot.isDenied(pp.getUUID()) && !Permissions.hasPermission(pp, "plots.admin.entry.denied")) {
|
||||
return false;
|
||||
@ -59,7 +68,7 @@ public class PlotListener {
|
||||
final int size = flags.size();
|
||||
boolean titles = Settings.TITLES;
|
||||
final String greeting;
|
||||
|
||||
|
||||
if (size != 0) {
|
||||
final Flag titleFlag = flags.get("titles");
|
||||
if (titleFlag != null) {
|
||||
@ -115,7 +124,7 @@ public class PlotListener {
|
||||
if (weatherFlag != null) {
|
||||
pp.setWeather((PlotWeather) weatherFlag.getValue());
|
||||
}
|
||||
|
||||
|
||||
final Flag musicFlag = flags.get("music");
|
||||
if (musicFlag != null) {
|
||||
final Integer id = (Integer) musicFlag.getValue();
|
||||
@ -174,7 +183,7 @@ public class PlotListener {
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public static boolean plotExit(final PlotPlayer pp, final Plot plot) {
|
||||
pp.deleteMeta("lastplot");
|
||||
EventUtil.manager.callLeave(pp, plot);
|
||||
|
Reference in New Issue
Block a user