externalize strings
plotme conversion fixes
This commit is contained in:
Jesse Boyd 2016-09-26 18:31:08 +10:00
parent c99e23bd3c
commit 12f8861d07
66 changed files with 655 additions and 445 deletions

View File

@ -72,6 +72,12 @@ import com.plotsquared.bukkit.uuid.LowerOfflineUUIDWrapper;
import com.plotsquared.bukkit.uuid.OfflineUUIDWrapper; import com.plotsquared.bukkit.uuid.OfflineUUIDWrapper;
import com.plotsquared.bukkit.uuid.SQLUUIDHandler; import com.plotsquared.bukkit.uuid.SQLUUIDHandler;
import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.WorldEdit;
import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import java.util.UUID;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Location; import org.bukkit.Location;
@ -87,18 +93,12 @@ import org.bukkit.metadata.MetadataValue;
import org.bukkit.plugin.Plugin; import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import java.util.UUID;
public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain { public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
public static WorldEdit worldEdit; public static WorldEdit worldEdit;
private int[] version; private int[] version;
private String name;
@Override @Override
public int[] getServerVersion() { public int[] getServerVersion() {
@ -123,13 +123,14 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
@Override @Override
public void onEnable() { public void onEnable() {
this.name = getDescription().getName();
getServer().getName(); getServer().getName();
new PS(this, "Bukkit"); new PS(this, "Bukkit");
if (Settings.Enabled_Components.METRICS) { if (Settings.Enabled_Components.METRICS) {
new Metrics(this).start(); new Metrics(this).start();
PS.log(C.PREFIX + "&6Metrics enabled."); PS.log(C.PREFIX + "&6Metrics enabled.");
} else { } else {
PS.log(C.CONSOLE_PLEASE_ENABLE_METRICS); PS.log(C.CONSOLE_PLEASE_ENABLE_METRICS.f(getPluginName()));
} }
} }
@ -171,6 +172,11 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
return getDescription().getVersion(); return getDescription().getVersion();
} }
@Override
public String getPluginName() {
return name;
}
@Override @Override
public void registerCommands() { public void registerCommands() {
BukkitCommand bukkitCommand = new BukkitCommand(); BukkitCommand bukkitCommand = new BukkitCommand();
@ -463,18 +469,13 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
@Override @Override
public boolean initPlotMeConverter() { public boolean initPlotMeConverter() {
TaskManager.runTaskLaterAsync(new Runnable() {
@Override
public void run() {
if (new LikePlotMeConverter("PlotMe").run(new ClassicPlotMeConnector())) { if (new LikePlotMeConverter("PlotMe").run(new ClassicPlotMeConnector())) {
return; return true;
} }
if (new LikePlotMeConverter("PlotMe").run(new PlotMeConnector_017())) { else if (new LikePlotMeConverter("PlotMe").run(new PlotMeConnector_017())) {
return; return true;
} }
} return false;
}, 20);
return Bukkit.getPluginManager().getPlugin("PlotMe") != null;
} }
@Override @Override
@ -537,10 +538,10 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
} }
if (Settings.UUID.OFFLINE) { if (Settings.UUID.OFFLINE) {
PS.log(C.PREFIX PS.log(C.PREFIX
+ " &6PlotSquared is using Offline Mode UUIDs either because of user preference, or because you are using an old version of " + " &6" + getPluginName() + " is using Offline Mode UUIDs either because of user preference, or because you are using an old version of "
+ "Bukkit"); + "Bukkit");
} else { } else {
PS.log(C.PREFIX + " &6PlotSquared is using online UUIDs"); PS.log(C.PREFIX + " &6" + getPluginName() + " is using online UUIDs");
} }
if (Settings.UUID.USE_SQLUUIDHANDLER) { if (Settings.UUID.USE_SQLUUIDHANDLER) {
return new SQLUUIDHandler(wrapper); return new SQLUUIDHandler(wrapper);
@ -596,7 +597,7 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
if (world == null) { if (world == null) {
// create world // create world
ConfigurationSection worldConfig = PS.get().worlds.getConfigurationSection("worlds." + worldName); ConfigurationSection worldConfig = PS.get().worlds.getConfigurationSection("worlds." + worldName);
String manager = worldConfig.getString("generator.plugin", "PlotSquared"); String manager = worldConfig.getString("generator.plugin", getPluginName());
SetupObject setup = new SetupObject(); SetupObject setup = new SetupObject();
setup.plotManager = manager; setup.plotManager = manager;
setup.setupGenerator = worldConfig.getString("generator.init", manager); setup.setupGenerator = worldConfig.getString("generator.init", manager);

View File

@ -91,7 +91,7 @@ public class DebugUUID extends SubCommand {
MainUtil.sendMessage(player, "&6Beginning UUID mode conversion"); MainUtil.sendMessage(player, "&6Beginning UUID mode conversion");
MainUtil.sendMessage(player, "&7 - Disconnecting players"); MainUtil.sendMessage(player, "&7 - Disconnecting players");
for (Entry<String, PlotPlayer> entry : UUIDHandler.getPlayers().entrySet()) { for (Entry<String, PlotPlayer> entry : UUIDHandler.getPlayers().entrySet()) {
entry.getValue().kick("PlotSquared UUID conversion has been initiated. You may reconnect when finished."); entry.getValue().kick("UUID conversion has been initiated. You may reconnect when finished.");
} }
MainUtil.sendMessage(player, "&7 - Initializing map"); MainUtil.sendMessage(player, "&7 - Initializing map");
@ -155,7 +155,7 @@ public class DebugUUID extends SubCommand {
MainUtil.sendMessage(player, "&c - Error! Attempting to repopulate"); MainUtil.sendMessage(player, "&c - Error! Attempting to repopulate");
for (OfflinePlotPlayer op : currentUUIDWrapper.getOfflinePlayers()) { for (OfflinePlotPlayer op : currentUUIDWrapper.getOfflinePlayers()) {
if (op.getLastPlayed() != 0) { if (op.getLastPlayed() != 0) {
// String name = op.getName(); // String name = op.getPluginName();
// StringWrapper wrap = new StringWrapper(name); // StringWrapper wrap = new StringWrapper(name);
UUID uuid = currentUUIDWrapper.getUUID(op); UUID uuid = currentUUIDWrapper.getUUID(op);
uuid2 = newWrapper.getUUID(op); uuid2 = newWrapper.getUUID(op);

View File

@ -1,22 +1,17 @@
package com.plotsquared.bukkit.database.plotme; package com.plotsquared.bukkit.database.plotme;
import com.intellectualcrafters.configuration.ConfigurationSection;
import com.intellectualcrafters.configuration.MemorySection; import com.intellectualcrafters.configuration.MemorySection;
import com.intellectualcrafters.configuration.file.FileConfiguration; import com.intellectualcrafters.configuration.file.FileConfiguration;
import com.intellectualcrafters.configuration.file.YamlConfiguration; import com.intellectualcrafters.configuration.file.YamlConfiguration;
import com.intellectualcrafters.plot.PS; import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.Settings; import com.intellectualcrafters.plot.config.Settings;
import com.intellectualcrafters.plot.database.DBFunc; import com.intellectualcrafters.plot.database.DBFunc;
import com.intellectualcrafters.plot.generator.HybridGen;
import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.object.Plot;
import com.intellectualcrafters.plot.object.PlotArea; import com.intellectualcrafters.plot.object.PlotArea;
import com.intellectualcrafters.plot.object.PlotId; import com.intellectualcrafters.plot.object.PlotId;
import com.intellectualcrafters.plot.util.TaskManager; import com.intellectualcrafters.plot.util.TaskManager;
import com.plotsquared.bukkit.generator.BukkitPlotGenerator; import com.plotsquared.bukkit.generator.BukkitPlotGenerator;
import org.bukkit.Bukkit;
import org.bukkit.World;
import org.bukkit.WorldCreator;
import org.bukkit.command.CommandException;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
@ -28,9 +23,14 @@ import java.sql.SQLException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet;
import java.util.Map.Entry; import java.util.Map.Entry;
import java.util.Set; import java.util.Set;
import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicBoolean;
import org.bukkit.Bukkit;
import org.bukkit.World;
import org.bukkit.WorldCreator;
import org.bukkit.command.CommandException;
public class LikePlotMeConverter { public class LikePlotMeConverter {
@ -50,7 +50,7 @@ public class LikePlotMeConverter {
} }
private void sendMessage(String message) { private void sendMessage(String message) {
PS.debug("&3PlotMe&8->&3PlotSquared&8: &7" + message); PS.debug("&3PlotMe&8->&3" + PS.imp().getPluginName() + "&8: &7" + message);
} }
public String getPlotMePath() { public String getPlotMePath() {
@ -97,14 +97,40 @@ public class LikePlotMeConverter {
return; return;
} }
String content = new String(Files.readAllBytes(path), StandardCharsets.UTF_8); String content = new String(Files.readAllBytes(path), StandardCharsets.UTF_8);
content = content.replace("PlotMe-DefaultGenerator", "PlotSquared"); String pluginName = PS.imp().getPluginName();
content = content.replace("PlotMe", "PlotSquared"); content = content.replace("PlotMe-DefaultGenerator", pluginName);
content = content.replace("AthionPlots", "PlotSquared"); content = content.replace("PlotMe", pluginName);
content = content.replace("PlotZWorld", "PlotSquared"); content = content.replace("AthionPlots", pluginName);
content = content.replace("PlotZWorld", pluginName);
Files.write(path, content.getBytes(StandardCharsets.UTF_8)); Files.write(path, content.getBytes(StandardCharsets.UTF_8));
} catch (IOException ignored) {} } catch (IOException ignored) {}
} }
private void copyConfig(ConfigurationSection plotmeDgYml, String world) throws IOException {
String actualWorldName = getWorld(world);
String plotMeWorldName = world.toLowerCase();
Integer pathWidth = plotmeDgYml.getInt("worlds." + plotMeWorldName + ".PathWidth"); //
PS.get().worlds.set("worlds." + world + ".road.width", pathWidth);
int height = plotmeDgYml.getInt("worlds." + plotMeWorldName + ".RoadHeight", plotmeDgYml.getInt("worlds." + plotMeWorldName + ".GroundHeight", 64)); //
PS.get().worlds.set("worlds." + world + ".road.height", height);
PS.get().worlds.set("worlds." + world + ".wall.height", height);
PS.get().worlds.set("worlds." + world + ".plot.height", height);
int plotSize = plotmeDgYml.getInt("worlds." + plotMeWorldName + ".PlotSize", 32); //
PS.get().worlds.set("worlds." + world + ".plot.size", plotSize);
String wallblock = plotmeDgYml.getString("worlds." + plotMeWorldName + ".WallBlock", "44"); //
PS.get().worlds.set("worlds." + world + ".wall.block", wallblock);
String floor = plotmeDgYml.getString("worlds." + plotMeWorldName + ".PlotFloorBlock", "2"); //
PS.get().worlds.set("worlds." + world + ".plot.floor", Collections.singletonList(floor));
String filling = plotmeDgYml.getString("worlds." + plotMeWorldName + ".FillBlock", "3"); //
PS.get().worlds.set("worlds." + world + ".plot.filling", Collections.singletonList(filling));
String road = plotmeDgYml.getString("worlds." + plotMeWorldName + ".RoadMainBlock", "5");
PS.get().worlds.set("worlds." + world + ".road.block", road);
PS.get().worlds.set("worlds." + actualWorldName + ".road.height", height);
PS.get().worlds.set("worlds." + actualWorldName + ".plot.height", height);
PS.get().worlds.set("worlds." + actualWorldName + ".wall.height", height);
PS.get().worlds.save(PS.get().worldsFile);
}
public boolean run(APlotMeConnector connector) { public boolean run(APlotMeConnector connector) {
try { try {
String dataFolder = getPlotMePath(); String dataFolder = getPlotMePath();
@ -177,36 +203,16 @@ public class LikePlotMeConverter {
if (plotmeDgFile.exists()) { if (plotmeDgFile.exists()) {
YamlConfiguration plotmeDgYml = YamlConfiguration.loadConfiguration(plotmeDgFile); YamlConfiguration plotmeDgYml = YamlConfiguration.loadConfiguration(plotmeDgFile);
try { try {
for (String world : plots.keySet()) { HashSet<String> allWorlds = new HashSet<>(plots.keySet());
String actualWorldName = getWorld(world); allWorlds.addAll(worlds);
String plotMeWorldName = world.toLowerCase(); for (String world : allWorlds) {
Integer pathWidth = plotmeDgYml.getInt("worlds." + plotMeWorldName + ".PathWidth"); // copyConfig(plotmeDgYml, world);
PS.get().worlds.set("worlds." + world + ".road.width", pathWidth);
int pathHeight = plotmeDgYml.getInt("worlds." + plotMeWorldName + ".RoadHeight", 64); //
PS.get().worlds.set("worlds." + world + ".road.height", pathHeight);
PS.get().worlds.set("worlds." + world + ".wall.height", pathHeight);
PS.get().worlds.set("worlds." + world + ".plot.height", pathHeight);
int plotSize = plotmeDgYml.getInt("worlds." + plotMeWorldName + ".PlotSize", 32); //
PS.get().worlds.set("worlds." + world + ".plot.size", plotSize);
String wallblock = plotmeDgYml.getString("worlds." + plotMeWorldName + ".WallBlock", "44"); //
PS.get().worlds.set("worlds." + world + ".wall.block", wallblock);
String floor = plotmeDgYml.getString("worlds." + plotMeWorldName + ".PlotFloorBlock", "2"); //
PS.get().worlds.set("worlds." + world + ".plot.floor", Collections.singletonList(floor));
String filling = plotmeDgYml.getString("worlds." + plotMeWorldName + ".FillBlock", "3"); //
PS.get().worlds.set("worlds." + world + ".plot.filling", Collections.singletonList(filling));
String road = plotmeDgYml.getString("worlds." + plotMeWorldName + ".RoadMainBlock", "5");
PS.get().worlds.set("worlds." + world + ".road.block", road);
int height = plotmeDgYml.getInt("worlds." + plotMeWorldName + ".RoadHeight"); //
if (height == 0) {
height = plotmeDgYml.getInt("worlds." + plotMeWorldName + ".GroundHeight", 64); //
} }
PS.get().worlds.set("worlds." + actualWorldName + ".road.height", height); } catch (IOException ignored) {
PS.get().worlds.set("worlds." + actualWorldName + ".plot.height", height); ignored.printStackTrace();
PS.get().worlds.set("worlds." + actualWorldName + ".wall.height", height);
PS.get().worlds.save(PS.get().worldsFile);
} }
} catch (IOException ignored) {} } else {
System.out.println("FILE NOT EXIST " + plotmeDgFile.getAbsolutePath());
} }
for (Entry<String, HashMap<PlotId, Plot>> entry : plots.entrySet()) { for (Entry<String, HashMap<PlotId, Plot>> entry : plots.entrySet()) {
String world = entry.getKey(); String world = entry.getKey();
@ -291,6 +297,9 @@ public class LikePlotMeConverter {
} }
String actualWorldName = world.getName(); String actualWorldName = world.getName();
sendMessage("Reloading generator for world: '" + actualWorldName + "'..."); sendMessage("Reloading generator for world: '" + actualWorldName + "'...");
if (!Bukkit.getWorlds().isEmpty() && Bukkit.getWorlds().get(0).getName().equals(worldName)) {
sendMessage("&cYou need to stop the server to reload this world properly");
} else {
PS.get().removePlotAreas(actualWorldName); PS.get().removePlotAreas(actualWorldName);
if (mv) { if (mv) {
// unload world with MV // unload world with MV
@ -302,7 +311,7 @@ public class LikePlotMeConverter {
} }
// load world with MV // load world with MV
Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(),
"mv import " + actualWorldName + " normal -g PlotSquared"); "mv import " + actualWorldName + " normal -g " + PS.imp().getPluginName());
} else if (mw) { } else if (mw) {
// unload world with MW // unload world with MW
Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), "mw unload " + actualWorldName); Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), "mw unload " + actualWorldName);
@ -313,7 +322,7 @@ public class LikePlotMeConverter {
} }
// load world with MW // load world with MW
Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(),
"mw create " + actualWorldName + " plugin:PlotSquared"); "mw create " + actualWorldName + " plugin:" + PS.imp().getPluginName());
} else { } else {
// Load using Bukkit API // Load using Bukkit API
// - User must set generator manually // - User must set generator manually
@ -322,6 +331,7 @@ public class LikePlotMeConverter {
myWorld.save(); myWorld.save();
} }
} }
}
} catch (CommandException e) { } catch (CommandException e) {
e.printStackTrace(); e.printStackTrace();
} }

View File

@ -1,6 +1,7 @@
package com.plotsquared.bukkit.listeners; package com.plotsquared.bukkit.listeners;
import com.intellectualcrafters.plot.PS; import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.config.Settings; import com.intellectualcrafters.plot.config.Settings;
import com.intellectualcrafters.plot.object.Location; import com.intellectualcrafters.plot.object.Location;
import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.object.Plot;
@ -46,7 +47,7 @@ public class ChunkListener implements Listener {
this.mustSave = classChunk.getField("mustSave"); this.mustSave = classChunk.getField("mustSave");
this.methodGetHandleChunk = classCraftChunk.getMethod("getHandle"); this.methodGetHandleChunk = classCraftChunk.getMethod("getHandle");
} catch (Throwable ignored) { } catch (Throwable ignored) {
PS.debug("PlotSquared/Server not compatible for chunk processor trim/gc"); PS.debug(PS.imp().getPluginName() + "/Server not compatible for chunk processor trim/gc");
Settings.Chunk_Processor.AUTO_TRIM = false; Settings.Chunk_Processor.AUTO_TRIM = false;
} }
} }
@ -228,7 +229,7 @@ public class ChunkListener implements Listener {
if (!chunk.isLoaded()) { if (!chunk.isLoaded()) {
Bukkit.getScheduler().cancelTask(TaskManager.tasks.get(currentIndex)); Bukkit.getScheduler().cancelTask(TaskManager.tasks.get(currentIndex));
TaskManager.tasks.remove(currentIndex); TaskManager.tasks.remove(currentIndex);
PS.debug("[PlotSquared] &aSuccessfully processed and unloaded chunk!"); PS.debug(C.PREFIX.s() + "&aSuccessfully processed and unloaded chunk!");
chunk.unload(true, true); chunk.unload(true, true);
return; return;
} }
@ -236,7 +237,7 @@ public class ChunkListener implements Listener {
if (tiles.length == 0) { if (tiles.length == 0) {
Bukkit.getScheduler().cancelTask(TaskManager.tasks.get(currentIndex)); Bukkit.getScheduler().cancelTask(TaskManager.tasks.get(currentIndex));
TaskManager.tasks.remove(currentIndex); TaskManager.tasks.remove(currentIndex);
PS.debug("[PlotSquared] &aSuccessfully processed and unloaded chunk!"); PS.debug(C.PREFIX.s() + "&aSuccessfully processed and unloaded chunk!");
chunk.unload(true, true); chunk.unload(true, true);
return; return;
} }
@ -246,7 +247,7 @@ public class ChunkListener implements Listener {
if (i >= tiles.length) { if (i >= tiles.length) {
Bukkit.getScheduler().cancelTask(TaskManager.tasks.get(currentIndex)); Bukkit.getScheduler().cancelTask(TaskManager.tasks.get(currentIndex));
TaskManager.tasks.remove(currentIndex); TaskManager.tasks.remove(currentIndex);
PS.debug("[PlotSquared] &aSuccessfully processed and unloaded chunk!"); PS.debug(C.PREFIX.s() + "&aSuccessfully processed and unloaded chunk!");
chunk.unload(true, true); chunk.unload(true, true);
return; return;
} }
@ -270,11 +271,11 @@ public class ChunkListener implements Listener {
ent.remove(); ent.remove();
} }
} }
PS.debug("[PlotSquared] &a detected unsafe chunk and processed: " + (chunk.getX() << 4) + "," + (chunk.getX() << 4)); PS.debug(C.PREFIX.s() + "&a detected unsafe chunk and processed: " + (chunk.getX() << 4) + "," + (chunk.getX() << 4));
} }
if (tiles.length > Settings.Chunk_Processor.MAX_TILES) { if (tiles.length > Settings.Chunk_Processor.MAX_TILES) {
if (unload) { if (unload) {
PS.debug("[PlotSquared] &c detected unsafe chunk: " + (chunk.getX() << 4) + "," + (chunk.getX() << 4)); PS.debug(C.PREFIX.s() + "&c detected unsafe chunk: " + (chunk.getX() << 4) + "," + (chunk.getX() << 4));
cleanChunk(chunk); cleanChunk(chunk);
return true; return true;
} }

View File

@ -20,7 +20,6 @@ import com.intellectualcrafters.plot.util.MainUtil;
import com.intellectualcrafters.plot.util.MathMan; import com.intellectualcrafters.plot.util.MathMan;
import com.intellectualcrafters.plot.util.Permissions; import com.intellectualcrafters.plot.util.Permissions;
import com.intellectualcrafters.plot.util.RegExUtil; import com.intellectualcrafters.plot.util.RegExUtil;
import com.intellectualcrafters.plot.util.StringMan;
import com.intellectualcrafters.plot.util.TaskManager; import com.intellectualcrafters.plot.util.TaskManager;
import com.intellectualcrafters.plot.util.UUIDHandler; import com.intellectualcrafters.plot.util.UUIDHandler;
import com.plotsquared.bukkit.object.BukkitLazyBlock; import com.plotsquared.bukkit.object.BukkitLazyBlock;
@ -29,7 +28,6 @@ import com.plotsquared.bukkit.util.BukkitUtil;
import com.plotsquared.listener.PlayerBlockEventType; import com.plotsquared.listener.PlayerBlockEventType;
import com.plotsquared.listener.PlotListener; import com.plotsquared.listener.PlotListener;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet; import java.util.HashSet;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
@ -347,20 +345,6 @@ public class PlayerEvents extends PlotListener implements Listener {
if (msg.isEmpty()) { if (msg.isEmpty()) {
return; return;
} }
String[] split = msg.split(" ");
PluginCommand cmd = Bukkit.getServer().getPluginCommand(split[0]);
if (cmd == null) {
if (split[0].equals("plotme") || split[0].equals("ap")) {
Player player = event.getPlayer();
if (Settings.PlotMe.ALIAS) {
player.performCommand("plots " + StringMan.join(Arrays.copyOfRange(split, 1, split.length), " "));
} else {
MainUtil.sendMessage(BukkitUtil.getPlayer(player), C.NOT_USING_PLOTME);
}
event.setCancelled(true);
return;
}
}
Player player = event.getPlayer(); Player player = event.getPlayer();
PlotPlayer pp = BukkitUtil.getPlayer(player); PlotPlayer pp = BukkitUtil.getPlayer(player);
Plot plot = pp.getCurrentPlot(); Plot plot = pp.getCurrentPlot();

View File

@ -1,5 +1,6 @@
package com.plotsquared.bukkit.object; package com.plotsquared.bukkit.object;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.object.Location; import com.intellectualcrafters.plot.object.Location;
import com.intellectualcrafters.plot.object.PlotPlayer; import com.intellectualcrafters.plot.object.PlotPlayer;
import com.intellectualcrafters.plot.util.EconHandler; import com.intellectualcrafters.plot.util.EconHandler;
@ -67,7 +68,7 @@ public class BukkitPlayer extends PlotPlayer {
PlayerTeleportEvent event = new PlayerTeleportEvent(player, from, to); PlayerTeleportEvent event = new PlayerTeleportEvent(player, from, to);
RegisteredListener[] listeners = event.getHandlers().getRegisteredListeners(); RegisteredListener[] listeners = event.getHandlers().getRegisteredListeners();
for (RegisteredListener listener : listeners) { for (RegisteredListener listener : listeners) {
if (listener.getPlugin().getName().equals("PlotSquared")) { if (listener.getPlugin().getName().equals(PS.imp().getPluginName())) {
continue; continue;
} }
try { try {
@ -81,7 +82,7 @@ public class BukkitPlayer extends PlotPlayer {
} }
event = new PlayerTeleportEvent(player, to, from); event = new PlayerTeleportEvent(player, to, from);
for (RegisteredListener listener : listeners) { for (RegisteredListener listener : listeners) {
if (listener.getPlugin().getName().equals("PlotSquared")) { if (listener.getPlugin().getName().equals(PS.imp().getPluginName())) {
continue; continue;
} }
try { try {

View File

@ -10,8 +10,8 @@ loadbefore: [MultiWorld, Multiverse-Core]
database: false database: false
commands: commands:
plots: plots:
description: PlotSquared PlotSquared command. description: Plot command.
aliases: [p,plot,ps,plotsquared,p2,2] aliases: [p,plot,ps,plotsquared,p2,2,plotme]
permission: plots.use permission: plots.use
permission-message: "You are lacking the permission node 'plots.use'" permission-message: "You are lacking the permission node 'plots.use'"
permissions: permissions:
@ -153,3 +153,156 @@ permissions:
default: op default: op
plots.confirm.bypass: plots.confirm.bypass:
default: false default: false
plotme.use:
description: Gives default user commands
children:
plots.permpack.basic: true
plots.plot.1: true
plotme.admin:
description: Gives default administrator commands
children:
plots.admin: true
plotme.use.middle:
children:
plots.middle: true
plotme.use.buy:
children:
plots.buy: true
plotme.use.sell:
children:
plots.set: true
plots.flag: true
plots.set.flag: true
plots.set.price.*: true
plotme.use.dispose:
children:
plots.delete: true
plotme.use.done:
children:
plots.done: true
plotme.use.claim:
children:
plots.claim: true
plotme.use.auto:
children:
plots.auto: true
plotme.use.reset:
children:
plots.delete: true
plotme.use.home:
children:
plots.home: true
plotme.use.info:
children:
plots.info: true
plotme.use.biome:
children:
plots.set: true
plots.set.biome: true
plotme.use.clear:
children:
plots.clear: true
plotme.use.list:
children:
plots.list: true
plots.list.forsale: true
plots.list.mine: true
plots.list.shared: true
plotme.use.add:
children:
plots.add: true
plots.trust: true
plots.add.everyone: true
plots.trust.everyone: true
plotme.use.deny:
children:
plots.deny: true
plots.deny.everyone: true
plotme.use.remove:
children:
plots.remove: true
plotme.use.undeny:
children:
plots.remove: true
plotme.use.protect:
children:
plots.set: true
plots.flag: true
plots.set.flag: true
plots.set.keep.*: true
plotme.use.nameplot:
children:
plots.set.alias: true
plotme.limit.*:
children:
plots.plot.*: true
plotme.limit.1:
children:
plots.plot.1: true
plotme.limit.5:
children:
plots.plot.5: true
plotme.limit.10:
children:
plots.plot.10: true
plotme.admin.home.other:
children:
plots.plot.: true
plotme.admin.clear:
children:
plots.admin.command.clear: true
plotme.admin.reset:
children:
plots.admin.command.delete: true
plotme.admin.add:
children:
plots.admin.command.add: true
plotme.admin.deny:
children:
plots.admin.command.deny: true
plotme.admin.remove:
children:
plots.admin.command.remove: true
plotme.admin.undeny:
children:
plots.admin.command.remove: true
plotme.admin.bypassdeny:
children:
plots.admin.entry.denied: true
plotme.admin.setowner:
children:
plots.admin.command.setowner: true
plotme.admin.move:
children:
plots.admin.command.move: true
plotme.admin.weanywhere:
children:
plots.worldedit.bypass: true
plotme.admin.list:
children:
plots.list.world: true
plots.list.world.*: true
plots.list.top: true
plots.list.all: true
plots.list.unowned: true
plots.list.unknown: true
plots.list.player: true
plots.list.done: true
plots.list.expired: true
plots.list.fuzzy: true
plots.list.area: true
plotme.admin.dispose:
children:
plots.admin.command.delete: true
plotme.admin.done:
children:
plots.admin.command.done: true
plotme.admin.expired:
children:
plots.list.expired: true
plotme.admin.buildanywhere:
children:
plots.admin.vehicle.*: true
plots.admin.interact.*: true
plots.admin.build.*: true
plots.admin.destroy.*: true

View File

@ -7,5 +7,5 @@ dependencies {
sourceCompatibility = 1.7 sourceCompatibility = 1.7
targetCompatibility = 1.7 targetCompatibility = 1.7
jar.archiveName = "PlotSquared-Core-${parent.version}.jar" jar.archiveName = rootProject.name + "-Core-${parent.version}.jar"
jar.destinationDir = file '../target' jar.destinationDir = file '../target'

View File

@ -168,8 +168,8 @@ public class JSONObject {
* The key is formed by removing the <code>"get"</code> or <code>"is"</code> prefix. If the second remaining * The key is formed by removing the <code>"get"</code> or <code>"is"</code> prefix. If the second remaining
* character is not upper case, then the first character is converted to lower case. * character is not upper case, then the first character is converted to lower case.
* *
* For example, if an object has a method named <code>"getName"</code>, and if the result of calling * For example, if an object has a method named <code>"getPluginName"</code>, and if the result of calling
* <code>object.getName()</code> is <code>"Larry Fine"</code>, then the JSONObject will contain <code>"name": "Larry * <code>object.getPluginName()</code> is <code>"Larry Fine"</code>, then the JSONObject will contain <code>"name": "Larry
* Fine"</code>. * Fine"</code>.
* *
* @param bean An object that has getter methods that should be used to make a JSONObject. * @param bean An object that has getter methods that should be used to make a JSONObject.

View File

@ -69,6 +69,12 @@ public interface IPlotMain extends ILogger {
*/ */
String getPluginVersionString(); String getPluginVersionString();
/**
* Usually PlotSquared
* @return
*/
String getPluginName();
/** /**
* Get the version of Minecraft that is running. * Get the version of Minecraft that is running.
* @return * @return

View File

@ -149,12 +149,12 @@ public class PS {
} }
} }
if (getJavaVersion() < 1.8) { if (getJavaVersion() < 1.8) {
PS.log(C.CONSOLE_JAVA_OUTDATED_1_8); PS.log(C.CONSOLE_JAVA_OUTDATED_1_8.f(IMP.getPluginName()));
} }
TaskManager.IMP = this.IMP.getTaskManager(); TaskManager.IMP = this.IMP.getTaskManager();
setupConfigs(); setupConfigs();
this.translationFile = this.translationFile =
MainUtil.getFile(this.IMP.getDirectory(), Settings.Paths.TRANSLATIONS + File.separator + "PlotSquared.use_THIS.yml"); MainUtil.getFile(this.IMP.getDirectory(), Settings.Paths.TRANSLATIONS + File.separator + IMP.getPluginName() + ".use_THIS.yml");
C.load(this.translationFile); C.load(this.translationFile);
// Database // Database
@ -177,7 +177,7 @@ public class PS {
if (Settings.Enabled_Components.METRICS) { if (Settings.Enabled_Components.METRICS) {
this.IMP.startMetrics(); this.IMP.startMetrics();
} else { } else {
PS.log(C.CONSOLE_PLEASE_ENABLE_METRICS); PS.log(C.CONSOLE_PLEASE_ENABLE_METRICS.f(IMP.getPluginName()));
} }
if (Settings.Enabled_Components.CHUNK_PROCESSOR) { if (Settings.Enabled_Components.CHUNK_PROCESSOR) {
this.IMP.registerChunkProcessor(); this.IMP.registerChunkProcessor();
@ -221,7 +221,7 @@ public class PS {
if (Settings.Enabled_Components.WORLDEDIT_RESTRICTIONS) { if (Settings.Enabled_Components.WORLDEDIT_RESTRICTIONS) {
try { try {
if (this.IMP.initWorldEdit()) { if (this.IMP.initWorldEdit()) {
PS.debug("PlotSquared hooked into WorldEdit."); PS.debug(IMP.getPluginName() + " hooked into WorldEdit.");
this.worldedit = WorldEdit.getInstance(); this.worldedit = WorldEdit.getInstance();
WorldEdit.getInstance().getEventBus().register(new WESubscriber()); WorldEdit.getInstance().getEventBus().register(new WESubscriber());
if (Settings.Enabled_Components.COMMANDS) { if (Settings.Enabled_Components.COMMANDS) {
@ -252,7 +252,7 @@ public class PS {
if (url != null) { if (url != null) {
PS.this.update = url; PS.this.update = url;
} else if (PS.this.lastVersion == null) { } else if (PS.this.lastVersion == null) {
PS.log("&aThanks for installing PlotSquared!"); PS.log("&aThanks for installing " + IMP.getPluginName() + "!");
} else if (!get().checkVersion(PS.this.lastVersion, PS.this.version)) { } else if (!get().checkVersion(PS.this.lastVersion, PS.this.version)) {
PS.log("&aThanks for updating from " + StringMan.join(PS.this.lastVersion, ".") + " to " + StringMan PS.log("&aThanks for updating from " + StringMan.join(PS.this.lastVersion, ".") + " to " + StringMan
.join(PS.this.version, ".") + "!"); .join(PS.this.version, ".") + "!");
@ -281,7 +281,7 @@ public class PS {
continue; continue;
} }
if (!WorldUtil.IMP.isWorld(world)) { if (!WorldUtil.IMP.isWorld(world)) {
debug("&c`" + world + "` was not properly loaded - PlotSquared will now try to load it properly: "); debug("&c`" + world + "` was not properly loaded - " + IMP.getPluginName() + " will now try to load it properly: ");
debug( debug(
"&8 - &7Are you trying to delete this world? Remember to remove it from the settings.yml, bukkit.yml and " "&8 - &7Are you trying to delete this world? Remember to remove it from the settings.yml, bukkit.yml and "
+ "multiverse worlds.yml"); + "multiverse worlds.yml");
@ -305,9 +305,7 @@ public class PS {
} catch (Throwable e) { } catch (Throwable e) {
e.printStackTrace(); e.printStackTrace();
} }
if (!C.ENABLED.s().isEmpty()) { PS.log(C.ENABLED.f(IMP.getPluginName()));
PS.log(C.ENABLED);
}
} }
/** /**
@ -319,6 +317,13 @@ public class PS {
return PS.instance; return PS.instance;
} }
public static IPlotMain imp() {
if (instance != null) {
return instance.IMP;
}
return null;
}
/** /**
* Log a message to the IPlotMain logger. * Log a message to the IPlotMain logger.
* *
@ -326,6 +331,9 @@ public class PS {
* @see IPlotMain#log(String) * @see IPlotMain#log(String)
*/ */
public static void log(Object message) { public static void log(Object message) {
if (message == null || message.toString().isEmpty()) {
return;
}
PS.get().getLogger().log(StringMan.getString(message)); PS.get().getLogger().log(StringMan.getString(message));
} }
@ -400,7 +408,7 @@ public class PS {
private void startPlotMeConversion() { private void startPlotMeConversion() {
if (Settings.Enabled_Components.PLOTME_CONVERTER || Settings.PlotMe.CACHE_UUDS) { if (Settings.Enabled_Components.PLOTME_CONVERTER || Settings.PlotMe.CACHE_UUDS) {
TaskManager.runTaskLater(new Runnable() { TaskManager.IMP.taskAsync(new Runnable() {
@Override @Override
public void run() { public void run() {
if (PS.this.IMP.initPlotMeConverter()) { if (PS.this.IMP.initPlotMeConverter()) {
@ -411,8 +419,9 @@ public class PS {
PS.log("&c - After the conversion is finished, please set 'plotme-convert.enabled' to false in the " PS.log("&c - After the conversion is finished, please set 'plotme-convert.enabled' to false in the "
+ "'settings.yml'"); + "'settings.yml'");
} }
Settings.Enabled_Components.PLOTME_CONVERTER = false;
} }
}, 20); });
} }
} }
@ -737,7 +746,7 @@ public class PS {
* @param area the {@code PlotArea} to remove * @param area the {@code PlotArea} to remove
*/ */
public void removePlotArea(PlotArea area) { public void removePlotArea(PlotArea area) {
Set<PlotArea> areas = getPlotAreas(area.worldname); Set<PlotArea> areas = getPlotAreas();
areas.remove(area); areas.remove(area);
this.plotAreas = areas.toArray(new PlotArea[areas.size()]); this.plotAreas = areas.toArray(new PlotArea[areas.size()]);
if (areas.isEmpty()) { if (areas.isEmpty()) {
@ -1460,7 +1469,7 @@ public class PS {
return; return;
} }
PS.log(C.PREFIX + "&aDetected world load for '" + world + "'"); PS.log(C.PREFIX + "&aDetected world load for '" + world + "'");
String gen_string = worldSection.getString("generator.plugin", "PlotSquared"); String gen_string = worldSection.getString("generator.plugin", IMP.getPluginName());
if (type == 2) { if (type == 2) {
Set<PlotCluster> clusters = this.clusters_tmp != null ? this.clusters_tmp.get(world) : new HashSet<PlotCluster>(); Set<PlotCluster> clusters = this.clusters_tmp != null ? this.clusters_tmp.get(world) : new HashSet<PlotCluster>();
if (clusters == null) { if (clusters == null) {
@ -1557,7 +1566,7 @@ public class PS {
clone.set(key, worldSection.get(key)); clone.set(key, worldSection.get(key));
} }
} }
String gen_string = clone.getString("generator.plugin", "PlotSquared"); String gen_string = clone.getString("generator.plugin", IMP.getPluginName());
GeneratorWrapper<?> areaGen = this.IMP.getGenerator(world, gen_string); GeneratorWrapper<?> areaGen = this.IMP.getGenerator(world, gen_string);
if (areaGen == null) { if (areaGen == null) {
throw new IllegalArgumentException("Invalid Generator: " + gen_string); throw new IllegalArgumentException("Invalid Generator: " + gen_string);
@ -1705,7 +1714,7 @@ public class PS {
} }
MainUtil.sendMessage(sender, "$2 - Output: " + newJar); MainUtil.sendMessage(sender, "$2 - Output: " + newJar);
if (!newJar.delete()) { if (!newJar.delete()) {
MainUtil.sendMessage(sender, "Failed to update PlotSquared"); MainUtil.sendMessage(sender, "Failed to update " + IMP.getPluginName() + "");
MainUtil.sendMessage(sender, "Jar file failed to delete."); MainUtil.sendMessage(sender, "Jar file failed to delete.");
MainUtil.sendMessage(sender, " - Please update manually"); MainUtil.sendMessage(sender, " - Please update manually");
} }
@ -1714,7 +1723,7 @@ public class PS {
MainUtil.sendMessage(sender, "$1The update will take effect when the server is restarted next"); MainUtil.sendMessage(sender, "$1The update will take effect when the server is restarted next");
return true; return true;
} catch (IOException e) { } catch (IOException e) {
MainUtil.sendMessage(sender, "Failed to update PlotSquared"); MainUtil.sendMessage(sender, "Failed to update " + IMP.getPluginName() + "");
MainUtil.sendMessage(sender, " - Please update manually"); MainUtil.sendMessage(sender, " - Please update manually");
PS.log("============ Stacktrace ============"); PS.log("============ Stacktrace ============");
e.printStackTrace(); e.printStackTrace();
@ -1845,7 +1854,7 @@ public class PS {
PS.log("&d==== Here is an ugly stacktrace, if you are interested in those things ==="); PS.log("&d==== Here is an ugly stacktrace, if you are interested in those things ===");
e.printStackTrace(); e.printStackTrace();
PS.log("&d==== End of stacktrace ===="); PS.log("&d==== End of stacktrace ====");
PS.log("&6Please go to the PlotSquared 'storage.yml' and configure the database correctly."); PS.log("&6Please go to the " + IMP.getPluginName() + " 'storage.yml' and configure the database correctly.");
this.IMP.disable(); this.IMP.disable();
} }
} }
@ -1868,7 +1877,7 @@ public class PS {
try { try {
worlds.save(worldsFile); worlds.save(worldsFile);
} catch (IOException e) { } catch (IOException e) {
PS.debug("Failed to save PlotSquared worlds.yml"); PS.debug("Failed to save " + IMP.getPluginName() + " worlds.yml");
e.printStackTrace(); e.printStackTrace();
} }
} }

View File

@ -1,23 +1,23 @@
package com.intellectualcrafters.plot; package com.intellectualcrafters.plot;
import static com.intellectualcrafters.plot.PS.log;
import com.intellectualcrafters.json.JSONArray; import com.intellectualcrafters.json.JSONArray;
import com.intellectualcrafters.json.JSONObject; import com.intellectualcrafters.json.JSONObject;
import com.intellectualcrafters.plot.util.HttpUtil; import com.intellectualcrafters.plot.util.HttpUtil;
import com.intellectualcrafters.plot.util.StringMan; import com.intellectualcrafters.plot.util.StringMan;
import java.net.MalformedURLException; import java.net.MalformedURLException;
import java.net.URL; import java.net.URL;
import java.util.Arrays; import java.util.Arrays;
import static com.intellectualcrafters.plot.PS.log;
public class Updater { public class Updater {
public static URL getUpdate() { public static URL getUpdate() {
String str = HttpUtil.readUrl("https://api.github.com/repos/IntellectualSites/PlotSquared/releases/latest"); String str = HttpUtil.readUrl("https://api.github.com/repos/IntellectualSites/PlotSquared/releases/latest");
JSONObject release = new JSONObject(str); JSONObject release = new JSONObject(str);
JSONArray assets = (JSONArray) release.get("assets"); JSONArray assets = (JSONArray) release.get("assets");
String downloadURL = String.format("PlotSquared-%s.jar", PS.get().getPlatform()); String downloadURL = String.format(PS.imp().getPluginName() + "-%s.jar", PS.get().getPlatform());
for (int i = 0; i < assets.length(); i++) { for (int i = 0; i < assets.length(); i++) {
JSONObject asset = assets.getJSONObject(i); JSONObject asset = assets.getJSONObject(i);
String name = asset.getString("name"); String name = asset.getString("name");
@ -33,11 +33,11 @@ public class Updater {
// If current version >= update // If current version >= update
if (PS.get().checkVersion(PS.get().getVersion(), version)) { if (PS.get().checkVersion(PS.get().getVersion(), version)) {
if (!PS.get().IMP.getPluginVersionString().contains("-SNAPSHOT") || !Arrays.equals(PS.get().getVersion(), version)) { if (!PS.get().IMP.getPluginVersionString().contains("-SNAPSHOT") || !Arrays.equals(PS.get().getVersion(), version)) {
PS.debug("&7PlotSquared is already up to date!"); PS.debug("&7" + PS.imp().getPluginName() + " is already up to date!");
return null; return null;
} }
} }
log("&6PlotSquared " + StringMan.join(split, ".") + " is available:"); log("&6" + PS.imp().getPluginName() + " " + StringMan.join(split, ".") + " is available:");
log("&8 - &3Use: &7/plot update"); log("&8 - &3Use: &7/plot update");
log("&8 - &3Or: &7" + downloadURL); log("&8 - &3Or: &7" + downloadURL);
return new URL(asset.getString("browser_download_url")); return new URL(asset.getString("browser_download_url"));
@ -48,7 +48,7 @@ public class Updater {
} }
} }
} }
log("You are running the latest version of PlotSquared"); log("You are running the latest version of " + PS.imp().getPluginName() + "!");
return null; return null;
} }
} }

View File

@ -34,7 +34,7 @@ public class Add extends Command {
public void execute(final PlotPlayer player, String[] args, RunnableVal3<Command, Runnable, Runnable> confirm, RunnableVal2<Command, CommandResult> whenDone) throws CommandException { public void execute(final PlotPlayer player, String[] args, RunnableVal3<Command, Runnable, Runnable> confirm, RunnableVal2<Command, CommandResult> whenDone) throws CommandException {
final Plot plot = check(player.getCurrentPlot(), C.NOT_IN_PLOT); final Plot plot = check(player.getCurrentPlot(), C.NOT_IN_PLOT);
checkTrue(plot.hasOwner(), C.PLOT_UNOWNED); checkTrue(plot.hasOwner(), C.PLOT_UNOWNED);
checkTrue(plot.isOwner(player.getUUID()) || Permissions.hasPermission(player, "plots.admin.command.trust"), C.NO_PLOT_PERMS); checkTrue(plot.isOwner(player.getUUID()) || Permissions.hasPermission(player, C.PERMISSION_ADMIN_COMMAND_TRUST), C.NO_PLOT_PERMS);
checkTrue(args.length == 1, C.COMMAND_SYNTAX, getUsage()); checkTrue(args.length == 1, C.COMMAND_SYNTAX, getUsage());
final Set<UUID> uuids = MainUtil.getUUIDsFromString(args[0]); final Set<UUID> uuids = MainUtil.getUUIDsFromString(args[0]);
checkTrue(!uuids.isEmpty(), C.INVALID_PLAYER, args[0]); checkTrue(!uuids.isEmpty(), C.INVALID_PLAYER, args[0]);
@ -42,7 +42,7 @@ public class Add extends Command {
int size = plot.getTrusted().size() + plot.getMembers().size(); int size = plot.getTrusted().size() + plot.getMembers().size();
while (iter.hasNext()) { while (iter.hasNext()) {
UUID uuid = iter.next(); UUID uuid = iter.next();
if (uuid == DBFunc.everyone && !(Permissions.hasPermission(player, "plots.trust.everyone") || Permissions.hasPermission(player, "plots.admin.command.trust"))) { if (uuid == DBFunc.everyone && !(Permissions.hasPermission(player, C.PERMISSION_TRUST_EVERYONE) || Permissions.hasPermission(player, C.PERMISSION_ADMIN_COMMAND_TRUST))) {
MainUtil.sendMessage(player, C.INVALID_PLAYER, MainUtil.getName(uuid)); MainUtil.sendMessage(player, C.INVALID_PLAYER, MainUtil.getName(uuid));
iter.remove(); iter.remove();
continue; continue;
@ -60,7 +60,7 @@ public class Add extends Command {
size += plot.getTrusted().contains(uuid) ? 0 : 1; size += plot.getTrusted().contains(uuid) ? 0 : 1;
} }
checkTrue(!uuids.isEmpty(), null); checkTrue(!uuids.isEmpty(), null);
checkTrue(size <= plot.getArea().MAX_PLOT_MEMBERS || Permissions.hasPermission(player, "plots.admin.command.trust"), C.PLOT_MAX_MEMBERS); checkTrue(size <= plot.getArea().MAX_PLOT_MEMBERS || Permissions.hasPermission(player, C.PERMISSION_ADMIN_COMMAND_TRUST), C.PLOT_MAX_MEMBERS);
confirm.run(this, new Runnable() { confirm.run(this, new Runnable() {
@Override // Success @Override // Success
public void run() { public void run() {

View File

@ -15,7 +15,7 @@ import com.plotsquared.general.commands.CommandDeclaration;
permission = "plots.set.alias", permission = "plots.set.alias",
description = "Set the plot name", description = "Set the plot name",
usage = "/plot alias <alias>", usage = "/plot alias <alias>",
aliases = {"alias", "sa", "name", "rename", "setname", "seta"}, aliases = {"alias", "sa", "name", "rename", "setname", "seta", "nameplot"},
category = CommandCategory.SETTINGS, category = CommandCategory.SETTINGS,
requiredType = RequiredType.NONE) requiredType = RequiredType.NONE)
public class Alias extends SetCommand { public class Alias extends SetCommand {

View File

@ -5,7 +5,6 @@ import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.config.Configuration; import com.intellectualcrafters.plot.config.Configuration;
import com.intellectualcrafters.plot.generator.AugmentedUtils; import com.intellectualcrafters.plot.generator.AugmentedUtils;
import com.intellectualcrafters.plot.generator.HybridGen;
import com.intellectualcrafters.plot.generator.HybridPlotWorld; import com.intellectualcrafters.plot.generator.HybridPlotWorld;
import com.intellectualcrafters.plot.object.ChunkLoc; import com.intellectualcrafters.plot.object.ChunkLoc;
import com.intellectualcrafters.plot.object.Location; import com.intellectualcrafters.plot.object.Location;
@ -26,7 +25,6 @@ import com.intellectualcrafters.plot.util.SetupUtils;
import com.intellectualcrafters.plot.util.StringMan; import com.intellectualcrafters.plot.util.StringMan;
import com.intellectualcrafters.plot.util.WorldUtil; import com.intellectualcrafters.plot.util.WorldUtil;
import com.plotsquared.general.commands.CommandDeclaration; import com.plotsquared.general.commands.CommandDeclaration;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Objects; import java.util.Objects;
@ -52,8 +50,8 @@ public class Area extends SubCommand {
case "c": case "c":
case "setup": case "setup":
case "create": case "create":
if (!Permissions.hasPermission(player, "plots.area.create")) { if (!Permissions.hasPermission(player, C.PERMISSION_AREA_CREATE)) {
C.NO_PERMISSION.send(player, "plots.area.create"); C.NO_PERMISSION.send(player, C.PERMISSION_AREA_CREATE);
return false; return false;
} }
switch (args.length) { switch (args.length) {
@ -109,8 +107,8 @@ public class Area extends SubCommand {
object.type = area.TYPE; object.type = area.TYPE;
object.min = new PlotId(1, 1); object.min = new PlotId(1, 1);
object.max = new PlotId(numX, numZ); object.max = new PlotId(numX, numZ);
object.plotManager = "PlotSquared"; object.plotManager = PS.imp().getPluginName();
object.setupGenerator = "PlotSquared"; object.setupGenerator = PS.imp().getPluginName();
object.step = area.getSettingNodes(); object.step = area.getSettingNodes();
final String path = "worlds." + area.worldname + ".areas." + area.id + '-' + object.min + '-' + object.max; final String path = "worlds." + area.worldname + ".areas." + area.id + '-' + object.min + '-' + object.max;
Runnable run = new Runnable() { Runnable run = new Runnable() {
@ -237,8 +235,8 @@ public class Area extends SubCommand {
ConfigurationSection section = PS.get().worlds.getConfigurationSection(path); ConfigurationSection section = PS.get().worlds.getConfigurationSection(path);
pa.saveConfiguration(section); pa.saveConfiguration(section);
pa.loadConfiguration(section); pa.loadConfiguration(section);
object.plotManager = "PlotSquared"; object.plotManager = PS.imp().getPluginName();
object.setupGenerator = "PlotSquared"; object.setupGenerator = PS.imp().getPluginName();
String world = SetupUtils.manager.setupWorld(object); String world = SetupUtils.manager.setupWorld(object);
if (WorldUtil.IMP.isWorld(world)) { if (WorldUtil.IMP.isWorld(world)) {
C.SETUP_FINISHED.send(player); C.SETUP_FINISHED.send(player);
@ -281,8 +279,8 @@ public class Area extends SubCommand {
return true; return true;
case "i": case "i":
case "info": { case "info": {
if (!Permissions.hasPermission(player, "plots.area.info")) { if (!Permissions.hasPermission(player, C.PERMISSION_AREA_INFO)) {
C.NO_PERMISSION.send(player, "plots.area.info"); C.NO_PERMISSION.send(player, C.PERMISSION_AREA_INFO);
return false; return false;
} }
PlotArea area; PlotArea area;
@ -336,8 +334,8 @@ public class Area extends SubCommand {
} }
case "l": case "l":
case "list": case "list":
if (!Permissions.hasPermission(player, "plots.area.list")) { if (!Permissions.hasPermission(player, C.PERMISSION_AREA_LIST)) {
C.NO_PERMISSION.send(player, "plots.area.list"); C.NO_PERMISSION.send(player, C.PERMISSION_AREA_LIST);
return false; return false;
} }
int page; int page;
@ -398,8 +396,8 @@ public class Area extends SubCommand {
case "clear": case "clear":
case "reset": case "reset":
case "regenerate": { case "regenerate": {
if (!Permissions.hasPermission(player, "plots.area.regen")) { if (!Permissions.hasPermission(player, C.PERMISSION_AREA_REGEN)) {
C.NO_PERMISSION.send(player, "plots.area.regen"); C.NO_PERMISSION.send(player, C.PERMISSION_AREA_REGEN);
return false; return false;
} }
final PlotArea area = player.getApplicablePlotArea(); final PlotArea area = player.getApplicablePlotArea();
@ -424,8 +422,8 @@ public class Area extends SubCommand {
case "teleport": case "teleport":
case "visit": case "visit":
case "tp": case "tp":
if (!Permissions.hasPermission(player, "plots.area.tp")) { if (!Permissions.hasPermission(player, C.PERMISSION_AREA_TP)) {
C.NO_PERMISSION.send(player, "plots.area.tp"); C.NO_PERMISSION.send(player, C.PERMISSION_AREA_TP);
return false; return false;
} }
if (args.length != 2) { if (args.length != 2) {
@ -452,7 +450,7 @@ public class Area extends SubCommand {
case "remove": case "remove":
MainUtil.sendMessage(player, "$1World creation settings may be stored in multiple locations:" MainUtil.sendMessage(player, "$1World creation settings may be stored in multiple locations:"
+ "\n$3 - $2Bukkit bukkit.yml" + "\n$3 - $2Bukkit bukkit.yml"
+ "\n$3 - $2PlotSquared settings.yml" + "\n$3 - $2" + PS.imp().getPluginName() + " settings.yml"
+ "\n$3 - $2Multiverse worlds.yml (or any world management plugin)" + "\n$3 - $2Multiverse worlds.yml (or any world management plugin)"
+ "\n$1Stop the server and delete it from these locations."); + "\n$1Stop the server and delete it from these locations.");
return true; return true;

View File

@ -62,7 +62,7 @@ public class Auto extends SubCommand {
int size_z = 1; int size_z = 1;
String schematic = null; String schematic = null;
if (args.length > 0) { if (args.length > 0) {
if (Permissions.hasPermission(player, "plots.auto.mega")) { if (Permissions.hasPermission(player, C.PERMISSION_AUTO_MEGA)) {
try { try {
String[] split = args[0].split(",|;"); String[] split = args[0].split(",|;");
size_x = Integer.parseInt(split[0]); size_x = Integer.parseInt(split[0]);
@ -134,8 +134,8 @@ public class Auto extends SubCommand {
sendMessage(player, C.SCHEMATIC_INVALID, "non-existent: " + schematic); sendMessage(player, C.SCHEMATIC_INVALID, "non-existent: " + schematic);
return true; return true;
} }
if (!Permissions.hasPermission(player, "plots.claim." + schematic) && !Permissions.hasPermission(player, "plots.admin.command.schematic")) { if (!Permissions.hasPermission(player, C.PERMISSION_CLAIM_SCHEMATIC.f(schematic)) && !Permissions.hasPermission(player, C.PERMISSION_ADMIN_COMMAND_SCHEMATIC)) {
MainUtil.sendMessage(player, C.NO_SCHEMATIC_PERMISSION, schematic); MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_CLAIM_SCHEMATIC.f(schematic));
return true; return true;
} }
} }

View File

@ -29,7 +29,7 @@ public class BO3 extends SubCommand {
if (plot == null || !plot.hasOwner()) { if (plot == null || !plot.hasOwner()) {
return !sendMessage(player, C.NOT_IN_PLOT); return !sendMessage(player, C.NOT_IN_PLOT);
} }
if (!plot.isOwner(player.getUUID()) && !Permissions.hasPermission(player, "plots.admin.command.bo3")) { if (!plot.isOwner(player.getUUID()) && !Permissions.hasPermission(player, C.PERMISSION_ADMIN_COMMAND_BO3)) {
MainUtil.sendMessage(player, C.NO_PLOT_PERMS); MainUtil.sendMessage(player, C.NO_PLOT_PERMS);
return false; return false;
} }

View File

@ -72,7 +72,7 @@ public class Claim extends SubCommand {
if (!world.SCHEMATICS.contains(schematic.toLowerCase())) { if (!world.SCHEMATICS.contains(schematic.toLowerCase())) {
return sendMessage(player, C.SCHEMATIC_INVALID, "non-existent: " + schematic); return sendMessage(player, C.SCHEMATIC_INVALID, "non-existent: " + schematic);
} }
if (!Permissions.hasPermission(player, "plots.claim." + schematic) && !Permissions.hasPermission(player, "plots.admin.command.schematic")) { if (!Permissions.hasPermission(player, C.PERMISSION_CLAIM_SCHEMATIC.f(schematic)) && !Permissions.hasPermission(player, C.PERMISSION_ADMIN_COMMAND_SCHEMATIC)) {
return sendMessage(player, C.NO_SCHEMATIC_PERMISSION, schematic); return sendMessage(player, C.NO_SCHEMATIC_PERMISSION, schematic);
} }
} }

View File

@ -34,9 +34,9 @@ public class Clear extends Command {
public void execute(final PlotPlayer player, String[] args, RunnableVal3<Command, Runnable, Runnable> confirm, RunnableVal2<Command, CommandResult> whenDone) throws CommandException { public void execute(final PlotPlayer player, String[] args, RunnableVal3<Command, Runnable, Runnable> confirm, RunnableVal2<Command, CommandResult> whenDone) throws CommandException {
checkTrue(args.length == 0, C.COMMAND_SYNTAX, getUsage()); checkTrue(args.length == 0, C.COMMAND_SYNTAX, getUsage());
final Plot plot = check(player.getCurrentPlot(), C.NOT_IN_PLOT); final Plot plot = check(player.getCurrentPlot(), C.NOT_IN_PLOT);
checkTrue(plot.isOwner(player.getUUID()) || Permissions.hasPermission(player, "plots.admin.command.clear"), C.NO_PLOT_PERMS); checkTrue(plot.isOwner(player.getUUID()) || Permissions.hasPermission(player, C.PERMISSION_ADMIN_COMMAND_CLEAR), C.NO_PLOT_PERMS);
checkTrue(plot.getRunning() == 0, C.WAIT_FOR_TIMER); checkTrue(plot.getRunning() == 0, C.WAIT_FOR_TIMER);
checkTrue(!Settings.Done.RESTRICT_BUILDING || !Flags.DONE.isSet(plot) || Permissions.hasPermission(player, "plots.continue"), C.DONE_ALREADY_DONE); checkTrue(!Settings.Done.RESTRICT_BUILDING || !Flags.DONE.isSet(plot) || Permissions.hasPermission(player, C.PERMISSION_CONTINUE), C.DONE_ALREADY_DONE);
confirm.run(this, new Runnable() { confirm.run(this, new Runnable() {
@Override @Override
public void run() { public void run() {

View File

@ -41,8 +41,8 @@ public class Cluster extends SubCommand {
switch (sub) { switch (sub) {
case "l": case "l":
case "list": { case "list": {
if (!Permissions.hasPermission(player, "plots.cluster.list")) { if (!Permissions.hasPermission(player, C.PERMISSION_CLUSTER_LIST)) {
MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.cluster.list"); MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_CLUSTER_LIST);
return false; return false;
} }
if (args.length != 1) { if (args.length != 1) {
@ -73,8 +73,8 @@ public class Cluster extends SubCommand {
} }
case "c": case "c":
case "create": { case "create": {
if (!Permissions.hasPermission(player, "plots.cluster.create")) { if (!Permissions.hasPermission(player, C.PERMISSION_CLUSTER_CREATE)) {
MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.cluster.create"); MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_CLUSTER_CREATE);
return false; return false;
} }
PlotArea area = player.getApplicablePlotArea(); PlotArea area = player.getApplicablePlotArea();
@ -121,11 +121,11 @@ public class Cluster extends SubCommand {
} }
Set<Plot> plots = area.getPlotSelectionOwned(pos1, pos2); Set<Plot> plots = area.getPlotSelectionOwned(pos1, pos2);
if (!plots.isEmpty()) { if (!plots.isEmpty()) {
if (!Permissions.hasPermission(player, "plots.cluster.create.other")) { if (!Permissions.hasPermission(player, C.PERMISSION_CLUSTER_CREATE_OTHER)) {
UUID uuid = player.getUUID(); UUID uuid = player.getUUID();
for (Plot plot : plots) { for (Plot plot : plots) {
if (!plot.isOwner(uuid)) { if (!plot.isOwner(uuid)) {
MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.cluster.create.other"); MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_CLUSTER_CREATE_OTHER);
return false; return false;
} }
} }
@ -139,9 +139,9 @@ public class Cluster extends SubCommand {
} else { } else {
current = player.getPlayerClusterCount(player.getLocation().getWorld()); current = player.getPlayerClusterCount(player.getLocation().getWorld());
} }
int allowed = Permissions.hasPermissionRange(player, "plots.cluster.size", Settings.Limit.MAX_PLOTS); int allowed = Permissions.hasPermissionRange(player, C.PERMISSION_CLUSTER_SIZE, Settings.Limit.MAX_PLOTS);
if (current + cluster.getArea() > allowed) { if (current + cluster.getArea() > allowed) {
MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.cluster.size." + (current + cluster.getArea())); MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_CLUSTER_SIZE + "." + (current + cluster.getArea()));
return false; return false;
} }
// create cluster // create cluster
@ -163,8 +163,8 @@ public class Cluster extends SubCommand {
case "disband": case "disband":
case "del": case "del":
case "delete": { case "delete": {
if (!Permissions.hasPermission(player, "plots.cluster.delete")) { if (!Permissions.hasPermission(player, C.PERMISSION_CLUSTER_DELETE)) {
MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.cluster.delete"); MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_CLUSTER_DELETE);
return false; return false;
} }
if (args.length != 1 && args.length != 2) { if (args.length != 1 && args.length != 2) {
@ -191,8 +191,8 @@ public class Cluster extends SubCommand {
} }
} }
if (!cluster.owner.equals(player.getUUID())) { if (!cluster.owner.equals(player.getUUID())) {
if (!Permissions.hasPermission(player, "plots.cluster.delete.other")) { if (!Permissions.hasPermission(player, C.PERMISSION_CLUSTER_DELETE_OTHER)) {
MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.cluster.delete.other"); MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_CLUSTER_DELETE_OTHER);
return false; return false;
} }
} }
@ -202,8 +202,8 @@ public class Cluster extends SubCommand {
} }
case "res": case "res":
case "resize": { case "resize": {
if (!Permissions.hasPermission(player, "plots.cluster.resize")) { if (!Permissions.hasPermission(player, C.PERMISSION_CLUSTER_RESIZE)) {
MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.cluster.resize"); MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_CLUSTER_RESIZE);
return false; return false;
} }
if (args.length != 3) { if (args.length != 3) {
@ -233,8 +233,8 @@ public class Cluster extends SubCommand {
return false; return false;
} }
if (!cluster.hasHelperRights(player.getUUID())) { if (!cluster.hasHelperRights(player.getUUID())) {
if (!Permissions.hasPermission(player, "plots.cluster.resize.other")) { if (!Permissions.hasPermission(player, C.PERMISSION_CLUSTER_RESIZE_OTHER)) {
MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.cluster.resize.other"); MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_CLUSTER_RESIZE_OTHER);
return false; return false;
} }
} }
@ -250,15 +250,15 @@ public class Cluster extends SubCommand {
removed.removeAll(newPlots); removed.removeAll(newPlots);
// Check expand / shrink // Check expand / shrink
if (!removed.isEmpty()) { if (!removed.isEmpty()) {
if (!Permissions.hasPermission(player, "plots.cluster.resize.shrink")) { if (!Permissions.hasPermission(player, C.PERMISSION_CLUSTER_RESIZE_SHRINK)) {
MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.cluster.resize.shrink"); MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_CLUSTER_RESIZE_SHRINK);
return false; return false;
} }
} }
newPlots.removeAll(existing); newPlots.removeAll(existing);
if (!newPlots.isEmpty()) { if (!newPlots.isEmpty()) {
if (!Permissions.hasPermission(player, "plots.cluster.resize.expand")) { if (!Permissions.hasPermission(player, C.PERMISSION_CLUSTER_RESIZE_EXPAND)) {
MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.cluster.resize.expand"); MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_CLUSTER_RESIZE_EXPAND);
return false; return false;
} }
} }
@ -270,9 +270,9 @@ public class Cluster extends SubCommand {
current = player.getPlayerClusterCount(player.getLocation().getWorld()); current = player.getPlayerClusterCount(player.getLocation().getWorld());
} }
current -= cluster.getArea() + (1 + pos2.x - pos1.x) * (1 + pos2.y - pos1.y); current -= cluster.getArea() + (1 + pos2.x - pos1.x) * (1 + pos2.y - pos1.y);
int allowed = Permissions.hasPermissionRange(player, "plots.cluster", Settings.Limit.MAX_PLOTS); int allowed = Permissions.hasPermissionRange(player, C.PERMISSION_CLUSTER, Settings.Limit.MAX_PLOTS);
if (current + cluster.getArea() > allowed) { if (current + cluster.getArea() > allowed) {
MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.cluster." + (current + cluster.getArea())); MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_CLUSTER.s() + "." + (current + cluster.getArea()));
return false; return false;
} }
// resize cluster // resize cluster
@ -283,8 +283,8 @@ public class Cluster extends SubCommand {
case "add": case "add":
case "inv": case "inv":
case "invite": { case "invite": {
if (!Permissions.hasPermission(player, "plots.cluster.invite")) { if (!Permissions.hasPermission(player, C.PERMISSION_CLUSTER_INVITE)) {
MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.cluster.invite"); MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_CLUSTER_INVITE);
return false; return false;
} }
if (args.length != 2) { if (args.length != 2) {
@ -302,8 +302,8 @@ public class Cluster extends SubCommand {
return false; return false;
} }
if (!cluster.hasHelperRights(player.getUUID())) { if (!cluster.hasHelperRights(player.getUUID())) {
if (!Permissions.hasPermission(player, "plots.cluster.invite.other")) { if (!Permissions.hasPermission(player, C.PERMISSION_CLUSTER_INVITE_OTHER)) {
MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.cluster.invite.other"); MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_CLUSTER_INVITE_OTHER);
return false; return false;
} }
} }
@ -328,8 +328,8 @@ public class Cluster extends SubCommand {
case "k": case "k":
case "remove": case "remove":
case "kick": { case "kick": {
if (!Permissions.hasPermission(player, "plots.cluster.kick")) { if (!Permissions.hasPermission(player, C.PERMISSION_CLUSTER_KICK)) {
MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.cluster.kick"); MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_CLUSTER_KICK);
return false; return false;
} }
if (args.length != 2) { if (args.length != 2) {
@ -346,8 +346,8 @@ public class Cluster extends SubCommand {
return false; return false;
} }
if (!cluster.hasHelperRights(player.getUUID())) { if (!cluster.hasHelperRights(player.getUUID())) {
if (!Permissions.hasPermission(player, "plots.cluster.kick.other")) { if (!Permissions.hasPermission(player, C.PERMISSION_CLUSTER_KICK_OTHER)) {
MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.cluster.kick.other"); MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_CLUSTER_KICK_OTHER);
return false; return false;
} }
} }
@ -383,8 +383,8 @@ public class Cluster extends SubCommand {
} }
case "quit": case "quit":
case "leave": { case "leave": {
if (!Permissions.hasPermission(player, "plots.cluster.leave")) { if (!Permissions.hasPermission(player, C.PERMISSION_CLUSTER_LEAVE)) {
MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.cluster.leave"); MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_CLUSTER_LEAVE);
return false; return false;
} }
if (args.length != 1 && args.length != 2) { if (args.length != 1 && args.length != 2) {
@ -438,8 +438,8 @@ public class Cluster extends SubCommand {
case "admin": case "admin":
case "helper": case "helper":
case "helpers": { case "helpers": {
if (!Permissions.hasPermission(player, "plots.cluster.helpers")) { if (!Permissions.hasPermission(player, C.PERMISSION_CLUSTER_HELPERS)) {
MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.cluster.helpers"); MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_CLUSTER_HELPERS);
return false; return false;
} }
if (args.length != 3) { if (args.length != 3) {
@ -476,8 +476,8 @@ public class Cluster extends SubCommand {
case "spawn": case "spawn":
case "home": case "home":
case "tp": { case "tp": {
if (!Permissions.hasPermission(player, "plots.cluster.tp")) { if (!Permissions.hasPermission(player, C.PERMISSION_CLUSTER_TP)) {
MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.cluster.tp"); MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_CLUSTER_TP);
return false; return false;
} }
if (args.length != 2) { if (args.length != 2) {
@ -496,8 +496,8 @@ public class Cluster extends SubCommand {
} }
UUID uuid = player.getUUID(); UUID uuid = player.getUUID();
if (!cluster.isAdded(uuid)) { if (!cluster.isAdded(uuid)) {
if (!Permissions.hasPermission(player, "plots.cluster.tp.other")) { if (!Permissions.hasPermission(player, C.PERMISSION_CLUSTER_TP_OTHER)) {
MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.cluster.tp.other"); MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_CLUSTER_TP_OTHER);
return false; return false;
} }
} }
@ -508,8 +508,8 @@ public class Cluster extends SubCommand {
case "info": case "info":
case "show": case "show":
case "information": { case "information": {
if (!Permissions.hasPermission(player, "plots.cluster.info")) { if (!Permissions.hasPermission(player, C.PERMISSION_CLUSTER_INFO)) {
MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.cluster.info"); MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_CLUSTER_INFO);
return false; return false;
} }
if (args.length != 1 && args.length != 2) { if (args.length != 1 && args.length != 2) {
@ -554,8 +554,8 @@ public class Cluster extends SubCommand {
case "sh": case "sh":
case "setspawn": case "setspawn":
case "sethome": case "sethome":
if (!Permissions.hasPermission(player, "plots.cluster.sethome")) { if (!Permissions.hasPermission(player, C.PERMISSION_CLUSTER_SETHOME)) {
MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.cluster.sethome"); MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_CLUSTER_SETHOME);
return false; return false;
} }
if (args.length != 1 && args.length != 2) { if (args.length != 1 && args.length != 2) {
@ -572,8 +572,8 @@ public class Cluster extends SubCommand {
return false; return false;
} }
if (!cluster.hasHelperRights(player.getUUID())) { if (!cluster.hasHelperRights(player.getUUID())) {
if (!Permissions.hasPermission(player, "plots.cluster.sethome.other")) { if (!Permissions.hasPermission(player, C.PERMISSION_CLUSTER_SETHOME_OTHER)) {
MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.cluster.sethome.other"); MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_CLUSTER_SETHOME_OTHER);
return false; return false;
} }
} }

View File

@ -1,30 +0,0 @@
package com.intellectualcrafters.plot.commands;
import com.intellectualcrafters.plot.object.PlotPlayer;
import com.intellectualcrafters.plot.util.Permissions;
public class CommandPermission {
/**
* Permission Node.
*/
public final String permission;
/**
* Command Permission
* @param permission Command Permission
*/
public CommandPermission(String permission) {
this.permission = permission.toLowerCase();
}
/**
* Check the permissions of a player.
* @param player The player to check permissions for
*
* @return true of player has the required permission node
*/
public boolean hasPermission(PlotPlayer player) {
return Permissions.hasPermission(player, this.permission);
}
}

View File

@ -23,7 +23,7 @@ public class Continue extends SubCommand {
if ((plot == null) || !plot.hasOwner()) { if ((plot == null) || !plot.hasOwner()) {
return !sendMessage(player, C.NOT_IN_PLOT); return !sendMessage(player, C.NOT_IN_PLOT);
} }
if (!plot.isOwner(player.getUUID()) && !Permissions.hasPermission(player, "plots.admin.command.continue")) { if (!plot.isOwner(player.getUUID()) && !Permissions.hasPermission(player, C.PERMISSION_ADMIN_COMMAND_CONTINUE)) {
MainUtil.sendMessage(player, C.NO_PLOT_PERMS); MainUtil.sendMessage(player, C.NO_PLOT_PERMS);
return false; return false;
} }
@ -33,7 +33,7 @@ public class Continue extends SubCommand {
} }
int size = plot.getConnectedPlots().size(); int size = plot.getConnectedPlots().size();
if (Settings.Done.COUNTS_TOWARDS_LIMIT && (player.getAllowedPlots() < player.getPlotCount() + size)) { if (Settings.Done.COUNTS_TOWARDS_LIMIT && (player.getAllowedPlots() < player.getPlotCount() + size)) {
MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.admin.command.continue"); MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_ADMIN_COMMAND_CONTINUE);
return false; return false;
} }
if (plot.getRunning() > 0) { if (plot.getRunning() > 0) {

View File

@ -56,8 +56,8 @@ public class DebugClaimTest extends SubCommand {
"&cInvalid min/max values. &7The values are to Plot IDs in the format &cX;Y &7where X;Y are the plot coords\nThe conversion " "&cInvalid min/max values. &7The values are to Plot IDs in the format &cX;Y &7where X;Y are the plot coords\nThe conversion "
+ "will only check the plots in the selected area."); + "will only check the plots in the selected area.");
} }
MainUtil.sendMessage(player, "&3Sign Block&8->&3PlotSquared&8: &7Beginning sign to plot conversion. This may take a while..."); MainUtil.sendMessage(player, "&3Sign Block&8->&3Plot&8: &7Beginning sign to plot conversion. This may take a while...");
MainUtil.sendMessage(player, "&3Sign Block&8->&3PlotSquared&8: Found an excess of 250,000 chunks. Limiting search radius... (~3.8 min)"); MainUtil.sendMessage(player, "&3Sign Block&8->&3Plot&8: Found an excess of 250,000 chunks. Limiting search radius... (~3.8 min)");
PlotManager manager = area.getPlotManager(); PlotManager manager = area.getPlotManager();
ArrayList<Plot> plots = new ArrayList<>(); ArrayList<Plot> plots = new ArrayList<>();
for (PlotId id : MainUtil.getPlotSelectionIds(min, max)) { for (PlotId id : MainUtil.getPlotSelectionIds(min, max)) {
@ -101,7 +101,7 @@ public class DebugClaimTest extends SubCommand {
} }
} }
if (!plots.isEmpty()) { if (!plots.isEmpty()) {
MainUtil.sendMessage(player, "&3Sign Block&8->&3PlotSquared&8: &7Updating '" + plots.size() + "' plots!"); MainUtil.sendMessage(player, "&3Sign Block&8->&3Plot&8: &7Updating '" + plots.size() + "' plots!");
DBFunc.createPlotsAndData(plots, new Runnable() { DBFunc.createPlotsAndData(plots, new Runnable() {
@Override @Override
public void run() { public void run() {
@ -111,7 +111,7 @@ public class DebugClaimTest extends SubCommand {
for (Plot plot : plots) { for (Plot plot : plots) {
plot.create(); plot.create();
} }
MainUtil.sendMessage(player, "&3Sign Block&8->&3PlotSquared&8: &7Complete!"); MainUtil.sendMessage(player, "&3Sign Block&8->&3Plot&8: &7Complete!");
} else { } else {
MainUtil.sendMessage(player, "No plots were found for the given search."); MainUtil.sendMessage(player, "No plots were found for the given search.");
} }

View File

@ -196,7 +196,7 @@ public class DebugExec extends SubCommand {
PlotAnalysis.calcOptimalModifiers(new Runnable() { PlotAnalysis.calcOptimalModifiers(new Runnable() {
@Override @Override
public void run() { public void run() {
MainUtil.sendMessage(player, "$1Thank you for calibrating PlotSquared plot expiry"); MainUtil.sendMessage(player, "$1Thank you for calibrating plot expiry");
} }
}, threshold); }, threshold);
return true; return true;

View File

@ -19,7 +19,7 @@ import com.plotsquared.general.commands.CommandDeclaration;
permission = "plots.delete", permission = "plots.delete",
description = "Delete a plot", description = "Delete a plot",
usage = "/plot delete", usage = "/plot delete",
aliases = {"dispose", "del"}, aliases = {"dispose", "del", "reset"},
category = CommandCategory.CLAIMING, category = CommandCategory.CLAIMING,
requiredType = RequiredType.NONE, requiredType = RequiredType.NONE,
confirmation = true) confirmation = true)
@ -36,7 +36,7 @@ public class Delete extends SubCommand {
if (!plot.hasOwner()) { if (!plot.hasOwner()) {
return !sendMessage(player, C.PLOT_UNOWNED); return !sendMessage(player, C.PLOT_UNOWNED);
} }
if (!plot.isOwner(player.getUUID()) && !Permissions.hasPermission(player, "plots.admin.command.delete")) { if (!plot.isOwner(player.getUUID()) && !Permissions.hasPermission(player, C.PERMISSION_ADMIN_COMMAND_DELETE)) {
return !sendMessage(player, C.NO_PLOT_PERMS); return !sendMessage(player, C.NO_PLOT_PERMS);
} }
final PlotArea plotArea = plot.getArea(); final PlotArea plotArea = plot.getArea();

View File

@ -42,7 +42,7 @@ public class Deny extends SubCommand {
MainUtil.sendMessage(player, C.PLOT_UNOWNED); MainUtil.sendMessage(player, C.PLOT_UNOWNED);
return false; return false;
} }
if (!plot.isOwner(player.getUUID()) && !Permissions.hasPermission(player, "plots.admin.command.deny")) { if (!plot.isOwner(player.getUUID()) && !Permissions.hasPermission(player, C.PERMISSION_ADMIN_COMMAND_DENY)) {
MainUtil.sendMessage(player, C.NO_PLOT_PERMS); MainUtil.sendMessage(player, C.NO_PLOT_PERMS);
return true; return true;
} }
@ -54,7 +54,7 @@ public class Deny extends SubCommand {
Iterator<UUID> iter = uuids.iterator(); Iterator<UUID> iter = uuids.iterator();
while (iter.hasNext()) { while (iter.hasNext()) {
UUID uuid = iter.next(); UUID uuid = iter.next();
if (uuid == DBFunc.everyone && !(Permissions.hasPermission(player, "plots.deny.everyone") || Permissions.hasPermission(player, "plots.admin.command.deny"))) { if (uuid == DBFunc.everyone && !(Permissions.hasPermission(player, C.PERMISSION_DENY_EVERYONE) || Permissions.hasPermission(player, C.PERMISSION_ADMIN_COMMAND_DENY))) {
MainUtil.sendMessage(player, C.INVALID_PLAYER, MainUtil.getName(uuid)); MainUtil.sendMessage(player, C.INVALID_PLAYER, MainUtil.getName(uuid));
continue; continue;
} }

View File

@ -29,7 +29,7 @@ public class Done extends SubCommand {
if ((plot == null) || !plot.hasOwner()) { if ((plot == null) || !plot.hasOwner()) {
return !sendMessage(player, C.NOT_IN_PLOT); return !sendMessage(player, C.NOT_IN_PLOT);
} }
if (!plot.isOwner(player.getUUID()) && !Permissions.hasPermission(player, "plots.admin.command.done")) { if (!plot.isOwner(player.getUUID()) && !Permissions.hasPermission(player, C.PERMISSION_ADMIN_COMMAND_DONE)) {
MainUtil.sendMessage(player, C.NO_PLOT_PERMS); MainUtil.sendMessage(player, C.NO_PLOT_PERMS);
return false; return false;
} }

View File

@ -42,7 +42,7 @@ public class Download extends SubCommand {
return false; return false;
} }
if ((Settings.Done.REQUIRED_FOR_DOWNLOAD && (!plot.getFlag(Flags.DONE).isPresent())) && !Permissions if ((Settings.Done.REQUIRED_FOR_DOWNLOAD && (!plot.getFlag(Flags.DONE).isPresent())) && !Permissions
.hasPermission(player, "plots.admin.command.download")) { .hasPermission(player, C.PERMISSION_ADMIN_COMMAND_DOWNLOAD)) {
MainUtil.sendMessage(player, C.DONE_NOT_DONE); MainUtil.sendMessage(player, C.DONE_NOT_DONE);
return false; return false;
} }
@ -73,8 +73,8 @@ public class Download extends SubCommand {
} }
}); });
} else if (args.length == 1 && StringMan.isEqualIgnoreCaseToAny(args[0], "bo3", "bo2", "b03", "b02")) { } else if (args.length == 1 && StringMan.isEqualIgnoreCaseToAny(args[0], "bo3", "bo2", "b03", "b02")) {
if (!Permissions.hasPermission(player, "plots.download.bo3")) { if (!Permissions.hasPermission(player, C.PERMISSION_DOWNLOAD_BO3)) {
C.NO_PERMISSION.send(player, "plots.download.bo3"); C.NO_PERMISSION.send(player, C.PERMISSION_DOWNLOAD_BO3);
} }
if (plot.getVolume() > 128d * 128d * 256) { if (plot.getVolume() > 128d * 128d * 256) {
C.SCHEMATIC_TOO_LARGE.send(player); C.SCHEMATIC_TOO_LARGE.send(player);
@ -93,8 +93,8 @@ public class Download extends SubCommand {
} }
}); });
} else if (args.length == 1 && StringMan.isEqualIgnoreCaseToAny(args[0], "mcr", "world", "mca")) { } else if (args.length == 1 && StringMan.isEqualIgnoreCaseToAny(args[0], "mcr", "world", "mca")) {
if (!Permissions.hasPermission(player, "plots.download.world")) { if (!Permissions.hasPermission(player, C.PERMISSION_DOWNLOAD_WORLD)) {
C.NO_PERMISSION.send(player, "plots.download.world"); C.NO_PERMISSION.send(player, C.PERMISSION_DOWNLOAD_WORLD);
} }
MainUtil.sendMessage(player, "&cNote: The `.mca` files are 512x512"); MainUtil.sendMessage(player, "&cNote: The `.mca` files are 512x512");
plot.addRunning(); plot.addRunning();

View File

@ -56,8 +56,8 @@ public class FlagCmd extends SubCommand {
sendMessage(player, C.PLOT_NOT_CLAIMED); sendMessage(player, C.PLOT_NOT_CLAIMED);
return false; return false;
} }
if (!plot.isOwner(player.getUUID()) && !Permissions.hasPermission(player, "plots.set.flag.other")) { if (!plot.isOwner(player.getUUID()) && !Permissions.hasPermission(player, C.PERMISSION_SET_FLAG_OTHER)) {
MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.set.flag.other"); MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_SET_FLAG_OTHER);
return false; return false;
} }
Flag<?> flag = null; Flag<?> flag = null;
@ -81,7 +81,7 @@ public class FlagCmd extends SubCommand {
} }
switch (args[0].toLowerCase()) { switch (args[0].toLowerCase()) {
case "info": { case "info": {
if (!Permissions.hasPermission(player, "plots.set.flag")) { if (!Permissions.hasPermission(player, C.PERMISSION_SET_FLAG)) {
MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.flag.info"); MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.flag.info");
return false; return false;
} }
@ -98,8 +98,8 @@ public class FlagCmd extends SubCommand {
return true; return true;
} }
case "set": { case "set": {
if (!Permissions.hasPermission(player, "plots.set.flag")) { if (!Permissions.hasPermission(player, C.PERMISSION_SET_FLAG)) {
MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.set.flag"); MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_SET_FLAG);
return false; return false;
} }
if (args.length < 3) { if (args.length < 3) {
@ -107,8 +107,8 @@ public class FlagCmd extends SubCommand {
return false; return false;
} }
String value = StringMan.join(Arrays.copyOfRange(args, 2, args.length), " "); String value = StringMan.join(Arrays.copyOfRange(args, 2, args.length), " ");
if (!Permissions.hasPermission(player, "plots.set.flag." + args[1].toLowerCase() + '.' + value.toLowerCase())) { if (!Permissions.hasPermission(player, C.PERMISSION_SET_FLAG_KEY_VALUE.f(args[1].toLowerCase(), value.toLowerCase()))) {
MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.set.flag." + args[1].toLowerCase() + '.' + value.toLowerCase()); MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_SET_FLAG_KEY_VALUE.f(args[1].toLowerCase(), value.toLowerCase()));
return false; return false;
} }
Object parsed = flag.parseValue(value); Object parsed = flag.parseValue(value);
@ -125,22 +125,22 @@ public class FlagCmd extends SubCommand {
return true; return true;
} }
case "remove": { case "remove": {
if (!Permissions.hasPermission(player, "plots.flag.remove")) { if (!Permissions.hasPermission(player, C.PERMISSION_FLAG_REMOVE)) {
MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.flag.remove"); MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_FLAG_REMOVE);
return false; return false;
} }
if (args.length != 2 && args.length != 3) { if (args.length != 2 && args.length != 3) {
MainUtil.sendMessage(player, C.COMMAND_SYNTAX, "/plot flag remove <flag> [values]"); MainUtil.sendMessage(player, C.COMMAND_SYNTAX, "/plot flag remove <flag> [values]");
return false; return false;
} }
if (!Permissions.hasPermission(player, "plots.set.flag." + args[1].toLowerCase())) { if (!Permissions.hasPermission(player, C.PERMISSION_SET_FLAG_KEY.f(args[1].toLowerCase()))) {
if (args.length != 3) { if (args.length != 3) {
MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.set.flag." + args[1].toLowerCase()); MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_SET_FLAG_KEY.f(args[1].toLowerCase()));
return false; return false;
} }
for (String entry : args[2].split(",")) { for (String entry : args[2].split(",")) {
if (!Permissions.hasPermission(player, "plots.set.flag." + args[1].toLowerCase() + '.' + entry)) { if (!Permissions.hasPermission(player, C.PERMISSION_SET_FLAG_KEY_VALUE.f(args[1].toLowerCase(), entry))) {
MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.set.flag." + args[1].toLowerCase() + '.' + entry); MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_SET_FLAG_KEY_VALUE.f(args[1].toLowerCase(), entry));
return false; return false;
} }
} }
@ -173,8 +173,8 @@ public class FlagCmd extends SubCommand {
return true; return true;
} }
case "add": case "add":
if (!Permissions.hasPermission(player, "plots.flag.add")) { if (!Permissions.hasPermission(player, C.PERMISSION_FLAG_ADD)) {
MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.flag.add"); MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_FLAG_ADD);
return false; return false;
} }
if (args.length < 3) { if (args.length < 3) {
@ -182,8 +182,8 @@ public class FlagCmd extends SubCommand {
return false; return false;
} }
for (String entry : args[2].split(",")) { for (String entry : args[2].split(",")) {
if (!Permissions.hasPermission(player, "plots.set.flag." + args[1].toLowerCase() + '.' + entry)) { if (!Permissions.hasPermission(player, C.PERMISSION_SET_FLAG_KEY_VALUE.f(args[1].toLowerCase(), entry))) {
MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.set.flag." + args[1].toLowerCase() + '.' + entry); MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_SET_FLAG_KEY_VALUE.f(args[1].toLowerCase(), entry));
return false; return false;
} }
} }
@ -215,8 +215,8 @@ public class FlagCmd extends SubCommand {
MainUtil.sendMessage(player, C.FLAG_ADDED); MainUtil.sendMessage(player, C.FLAG_ADDED);
return true; return true;
case "list": case "list":
if (!Permissions.hasPermission(player, "plots.flag.list")) { if (!Permissions.hasPermission(player, C.PERMISSION_FLAG_LIST)) {
MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.flag.list"); MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_FLAG_LIST);
return false; return false;
} }
if (args.length > 1) { if (args.length > 1) {

View File

@ -33,8 +33,8 @@ public class Grant extends Command {
switch (arg0) { switch (arg0) {
case "add": case "add":
case "check": case "check":
if (!Permissions.hasPermission(player, "plots.grant." + arg0)) { if (!Permissions.hasPermission(player, C.PERMISSION_GRANT.f(arg0))) {
C.NO_PERMISSION.send(player, "plots.grant." + arg0); C.NO_PERMISSION.send(player, C.PERMISSION_GRANT.f(arg0));
return; return;
} }
if (args.length > 2) { if (args.length > 2) {

View File

@ -36,7 +36,7 @@ public class Kick extends SubCommand {
if (plot == null) { if (plot == null) {
return !sendMessage(player, C.NOT_IN_PLOT); return !sendMessage(player, C.NOT_IN_PLOT);
} }
if ((!plot.hasOwner() || !plot.isOwner(player.getUUID())) && !Permissions.hasPermission(player, "plots.admin.command.kick")) { if ((!plot.hasOwner() || !plot.isOwner(player.getUUID())) && !Permissions.hasPermission(player, C.PERMISSION_ADMIN_COMMAND_KICK)) {
MainUtil.sendMessage(player, C.NO_PLOT_PERMS); MainUtil.sendMessage(player, C.NO_PLOT_PERMS);
return false; return false;
} }
@ -49,7 +49,7 @@ public class Kick extends SubCommand {
for (UUID uuid : uuids) { for (UUID uuid : uuids) {
if (uuid == DBFunc.everyone) { if (uuid == DBFunc.everyone) {
for (PlotPlayer pp : plot.getPlayersInPlot()) { for (PlotPlayer pp : plot.getPlayersInPlot()) {
if (pp == player || pp.hasPermission("plots.admin.entry.denied")) { if (pp == player || Permissions.hasPermission(pp, C.PERMISSION_ADMIN_ENTRY_DENIED)) {
continue; continue;
} }
players.add(pp); players.add(pp);

View File

@ -41,43 +41,43 @@ public class ListCmd extends SubCommand {
private String[] getArgumentList(PlotPlayer player) { private String[] getArgumentList(PlotPlayer player) {
List<String> args = new ArrayList<>(); List<String> args = new ArrayList<>();
if (EconHandler.manager != null && Permissions.hasPermission(player, "plots.list.forsale")) { if (EconHandler.manager != null && Permissions.hasPermission(player, C.PERMISSION_LIST_FORSALE)) {
args.add("forsale"); args.add("forsale");
} }
if (Permissions.hasPermission(player, "plots.list.mine")) { if (Permissions.hasPermission(player, C.PERMISSION_LIST_MINE)) {
args.add("mine"); args.add("mine");
} }
if (Permissions.hasPermission(player, "plots.list.shared")) { if (Permissions.hasPermission(player, C.PERMISSION_LIST_SHARED)) {
args.add("shared"); args.add("shared");
} }
if (Permissions.hasPermission(player, "plots.list.world")) { if (Permissions.hasPermission(player, C.PERMISSION_LIST_WORLD)) {
args.add("world"); args.add("world");
} }
if (Permissions.hasPermission(player, "plots.list.top")) { if (Permissions.hasPermission(player, C.PERMISSION_LIST_TOP)) {
args.add("top"); args.add("top");
} }
if (Permissions.hasPermission(player, "plots.list.all")) { if (Permissions.hasPermission(player, C.PERMISSION_LIST_ALL)) {
args.add("all"); args.add("all");
} }
if (Permissions.hasPermission(player, "plots.list.unowned")) { if (Permissions.hasPermission(player, C.PERMISSION_LIST_UNOWNED)) {
args.add("unowned"); args.add("unowned");
} }
if (Permissions.hasPermission(player, "plots.list.unknown")) { if (Permissions.hasPermission(player, C.PERMISSION_LIST_UNKNOWN)) {
args.add("unknown"); args.add("unknown");
} }
if (Permissions.hasPermission(player, "plots.list.player")) { if (Permissions.hasPermission(player, C.PERMISSION_LIST_PLAYER)) {
args.add("<player>"); args.add("<player>");
} }
if (Permissions.hasPermission(player, "plots.list.world")) { if (Permissions.hasPermission(player, C.PERMISSION_LIST_WORLD)) {
args.add("<world>"); args.add("<world>");
} }
if (Permissions.hasPermission(player, "plots.list.done")) { if (Permissions.hasPermission(player, C.PERMISSION_LIST_DONE)) {
args.add("done"); args.add("done");
} }
if (Permissions.hasPermission(player, "plots.list.expired")) { if (Permissions.hasPermission(player, C.PERMISSION_LIST_EXPIRED)) {
args.add("expired"); args.add("expired");
} }
if (Permissions.hasPermission(player, "plots.list.fuzzy")) { if (Permissions.hasPermission(player, C.PERMISSION_LIST_FUZZY)) {
args.add("fuzzy <search...>"); args.add("fuzzy <search...>");
} }
return args.toArray(new String[args.size()]); return args.toArray(new String[args.size()]);
@ -114,16 +114,16 @@ public class ListCmd extends SubCommand {
boolean sort = true; boolean sort = true;
switch (arg) { switch (arg) {
case "mine": case "mine":
if (!Permissions.hasPermission(player, "plots.list.mine")) { if (!Permissions.hasPermission(player, C.PERMISSION_LIST_MINE)) {
MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.list.mine"); MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_LIST_MINE);
return false; return false;
} }
sort = false; sort = false;
plots = PS.get().sortPlotsByTemp(PS.get().getBasePlots(player)); plots = PS.get().sortPlotsByTemp(PS.get().getBasePlots(player));
break; break;
case "shared": case "shared":
if (!Permissions.hasPermission(player, "plots.list.shared")) { if (!Permissions.hasPermission(player, C.PERMISSION_LIST_SHARED)) {
MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.list.shared"); MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_LIST_SHARED);
return false; return false;
} }
plots = new ArrayList<>(); plots = new ArrayList<>();
@ -134,44 +134,44 @@ public class ListCmd extends SubCommand {
} }
break; break;
case "world": case "world":
if (!Permissions.hasPermission(player, "plots.list.world")) { if (!Permissions.hasPermission(player, C.PERMISSION_LIST_WORLD)) {
MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.list.world"); MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_LIST_WORLD);
return false; return false;
} }
if (!Permissions.hasPermission(player, "plots.list.world." + world)) { if (!Permissions.hasPermission(player, C.PERMISSION_LIST_WORLD_NAME.f(world))) {
MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.list.world." + world); MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_LIST_WORLD_NAME.f(world));
return false; return false;
} }
plots = new ArrayList<>(PS.get().getPlots(world)); plots = new ArrayList<>(PS.get().getPlots(world));
break; break;
case "expired": case "expired":
if (!Permissions.hasPermission(player, "plots.list.expired")) { if (!Permissions.hasPermission(player, C.PERMISSION_LIST_EXPIRED)) {
MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.list.expired"); MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_LIST_EXPIRED);
return false; return false;
} }
plots = ExpireManager.IMP == null ? new ArrayList<Plot>() : new ArrayList<>(ExpireManager.IMP.getPendingExpired()); plots = ExpireManager.IMP == null ? new ArrayList<Plot>() : new ArrayList<>(ExpireManager.IMP.getPendingExpired());
break; break;
case "area": case "area":
if (!Permissions.hasPermission(player, "plots.list.area")) { if (!Permissions.hasPermission(player, C.PERMISSION_LIST_AREA)) {
MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.list.area"); MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_LIST_AREA);
return false; return false;
} }
if (!Permissions.hasPermission(player, "plots.list.world." + world)) { if (!Permissions.hasPermission(player, C.PERMISSION_LIST_WORLD_NAME.f(world))) {
MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.list.world." + world); MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_LIST_WORLD_NAME.f(world));
return false; return false;
} }
plots = area == null ? new ArrayList<Plot>() : new ArrayList<>(area.getPlots()); plots = area == null ? new ArrayList<Plot>() : new ArrayList<>(area.getPlots());
break; break;
case "all": case "all":
if (!Permissions.hasPermission(player, "plots.list.all")) { if (!Permissions.hasPermission(player, C.PERMISSION_LIST_ALL)) {
MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.list.all"); MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_LIST_ALL);
return false; return false;
} }
plots = new ArrayList<>(PS.get().getPlots()); plots = new ArrayList<>(PS.get().getPlots());
break; break;
case "done": case "done":
if (!Permissions.hasPermission(player, "plots.list.done")) { if (!Permissions.hasPermission(player, C.PERMISSION_LIST_DONE)) {
MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.list.done"); MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_LIST_DONE);
return false; return false;
} }
plots = new ArrayList<>(); plots = new ArrayList<>();
@ -199,8 +199,8 @@ public class ListCmd extends SubCommand {
sort = false; sort = false;
break; break;
case "top": case "top":
if (!Permissions.hasPermission(player, "plots.list.top")) { if (!Permissions.hasPermission(player, C.PERMISSION_LIST_TOP)) {
MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.list.top"); MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_LIST_TOP);
return false; return false;
} }
plots = new ArrayList<>(PS.get().getPlots()); plots = new ArrayList<>(PS.get().getPlots());
@ -236,8 +236,8 @@ public class ListCmd extends SubCommand {
sort = false; sort = false;
break; break;
case "forsale": case "forsale":
if (!Permissions.hasPermission(player, "plots.list.forsale")) { if (!Permissions.hasPermission(player, C.PERMISSION_LIST_FORSALE)) {
MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.list.forsale"); MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_LIST_FORSALE);
return false; return false;
} }
if (EconHandler.manager == null) { if (EconHandler.manager == null) {
@ -252,8 +252,8 @@ public class ListCmd extends SubCommand {
} }
break; break;
case "unowned": case "unowned":
if (!Permissions.hasPermission(player, "plots.list.unowned")) { if (!Permissions.hasPermission(player, C.PERMISSION_LIST_UNOWNED)) {
MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.list.unowned"); MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_LIST_UNOWNED);
return false; return false;
} }
plots = new ArrayList<>(); plots = new ArrayList<>();
@ -264,8 +264,8 @@ public class ListCmd extends SubCommand {
} }
break; break;
case "unknown": case "unknown":
if (!Permissions.hasPermission(player, "plots.list.unknown")) { if (!Permissions.hasPermission(player, C.PERMISSION_LIST_UNKNOWN)) {
MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.list.unknown"); MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_LIST_UNKNOWN);
return false; return false;
} }
plots = new ArrayList<>(); plots = new ArrayList<>();
@ -279,8 +279,8 @@ public class ListCmd extends SubCommand {
} }
break; break;
case "fuzzy": case "fuzzy":
if (!Permissions.hasPermission(player, "plots.list.fuzzy")) { if (!Permissions.hasPermission(player, C.PERMISSION_LIST_FUZZY)) {
MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.list.fuzzy"); MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_LIST_FUZZY);
return false; return false;
} }
if (args.length < (page == -1 ? 2 : 3)) { if (args.length < (page == -1 ? 2 : 3)) {
@ -298,12 +298,12 @@ public class ListCmd extends SubCommand {
break; break;
default: default:
if (PS.get().hasPlotArea(args[0])) { if (PS.get().hasPlotArea(args[0])) {
if (!Permissions.hasPermission(player, "plots.list.world")) { if (!Permissions.hasPermission(player, C.PERMISSION_LIST_WORLD)) {
MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.list.world"); MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_LIST_WORLD);
return false; return false;
} }
if (!Permissions.hasPermission(player, "plots.list.world." + args[0])) { if (!Permissions.hasPermission(player, C.PERMISSION_LIST_WORLD_NAME.f(args[0]))) {
MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.list.world." + args[0]); MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_LIST_WORLD_NAME.f(args[0]));
return false; return false;
} }
plots = new ArrayList<>(PS.get().getPlots(args[0])); plots = new ArrayList<>(PS.get().getPlots(args[0]));
@ -316,8 +316,8 @@ public class ListCmd extends SubCommand {
} catch (Exception ignored) {} } catch (Exception ignored) {}
} }
if (uuid != null) { if (uuid != null) {
if (!Permissions.hasPermission(player, "plots.list.player")) { if (!Permissions.hasPermission(player, C.PERMISSION_LIST_PLAYER)) {
MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.list.player"); MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_LIST_PLAYER);
return false; return false;
} }
sort = false; sort = false;

View File

@ -47,7 +47,7 @@ public class Load extends SubCommand {
MainUtil.sendMessage(player, C.PLOT_UNOWNED); MainUtil.sendMessage(player, C.PLOT_UNOWNED);
return false; return false;
} }
if (!plot.isOwner(player.getUUID()) && !Permissions.hasPermission(player, "plots.admin.command.load")) { if (!plot.isOwner(player.getUUID()) && !Permissions.hasPermission(player, C.PERMISSION_ADMIN_COMMAND_LOAD)) {
MainUtil.sendMessage(player, C.NO_PLOT_PERMS); MainUtil.sendMessage(player, C.NO_PLOT_PERMS);
return false; return false;
} }

View File

@ -64,7 +64,7 @@ public class Merge extends SubCommand {
} }
UUID uuid = player.getUUID(); UUID uuid = player.getUUID();
if (!plot.isOwner(uuid)) { if (!plot.isOwner(uuid)) {
if (!Permissions.hasPermission(player, "plots.admin.command.merge")) { if (!Permissions.hasPermission(player, C.PERMISSION_ADMIN_COMMAND_MERGE)) {
MainUtil.sendMessage(player, C.NO_PLOT_PERMS); MainUtil.sendMessage(player, C.NO_PLOT_PERMS);
return false; return false;
} else { } else {

View File

@ -59,7 +59,7 @@ public class Owner extends SetCommand {
return false; return false;
} }
final PlotPlayer other = UUIDHandler.getPlayer(uuid); final PlotPlayer other = UUIDHandler.getPlayer(uuid);
if (!Permissions.hasPermission(player, "plots.admin.command.setowner")) { if (!Permissions.hasPermission(player, C.PERMISSION_ADMIN_COMMAND_SETOWNER)) {
if (other == null) { if (other == null) {
C.INVALID_PLAYER_OFFLINE.send(player, value); C.INVALID_PLAYER_OFFLINE.send(player, value);
return false; return false;

View File

@ -17,7 +17,7 @@ public class PluginCmd extends SubCommand {
@Override @Override
public boolean onCommand(PlotPlayer player, String[] args) { public boolean onCommand(PlotPlayer player, String[] args) {
MainUtil.sendMessage(player, String.format("$2>> $1&lPlotSquared $2($1Version$2: $1%s$2)", StringMan.join(PS.get().getVersion(), "."))); MainUtil.sendMessage(player, String.format("$2>> $1&l" + PS.imp().getPluginName() + " $2($1Version$2: $1%s$2)", StringMan.join(PS.get().getVersion(), ".")));
MainUtil.sendMessage(player, "$2>> $1&lAuthors$2: $1Citymonstret $2& $1Empire92 $2& $1MattBDev"); MainUtil.sendMessage(player, "$2>> $1&lAuthors$2: $1Citymonstret $2& $1Empire92 $2& $1MattBDev");
MainUtil.sendMessage(player, "$2>> $1&lWiki$2: $1https://github.com/IntellectualCrafters/PlotSquared/wiki"); MainUtil.sendMessage(player, "$2>> $1&lWiki$2: $1https://github.com/IntellectualCrafters/PlotSquared/wiki");
MainUtil.sendMessage(player, "$2>> $1&lNewest Version$2: $1" + getNewestVersionString()); MainUtil.sendMessage(player, "$2>> $1&lNewest Version$2: $1" + getNewestVersionString());

View File

@ -110,7 +110,7 @@ public class Rate extends SubCommand {
Rating result = EventUtil.manager.callRating(this.player, plot, new Rating(rV)); Rating result = EventUtil.manager.callRating(this.player, plot, new Rating(rV));
plot.addRating(this.player.getUUID(), result); plot.addRating(this.player.getUUID(), result);
sendMessage(this.player, C.RATING_APPLIED, plot.getId().toString()); sendMessage(this.player, C.RATING_APPLIED, plot.getId().toString());
if (Permissions.hasPermission(this.player, "plots.comment")) { if (Permissions.hasPermission(this.player, C.PERMISSION_COMMENT)) {
Command command = MainCommand.getInstance().getCommand(Comment.class); Command command = MainCommand.getInstance().getCommand(Comment.class);
if (command != null) { if (command != null) {
MainUtil.sendMessage(this.player, C.COMMENT_THIS, command.getUsage()); MainUtil.sendMessage(this.player, C.COMMENT_THIS, command.getUsage());

View File

@ -42,7 +42,7 @@ public class Remove extends SubCommand {
MainUtil.sendMessage(player, C.PLOT_UNOWNED); MainUtil.sendMessage(player, C.PLOT_UNOWNED);
return false; return false;
} }
if (!plot.isOwner(player.getUUID()) && !Permissions.hasPermission(player, "plots.admin.command.remove")) { if (!plot.isOwner(player.getUUID()) && !Permissions.hasPermission(player, C.PERMISSION_ADMIN_COMMAND_REMOVE)) {
MainUtil.sendMessage(player, C.NO_PLOT_PERMS); MainUtil.sendMessage(player, C.NO_PLOT_PERMS);
return true; return true;
} }

View File

@ -47,7 +47,7 @@ public class Save extends SubCommand {
MainUtil.sendMessage(player, C.PLOT_UNOWNED); MainUtil.sendMessage(player, C.PLOT_UNOWNED);
return false; return false;
} }
if (!plot.isOwner(player.getUUID()) && !Permissions.hasPermission(player, "plots.admin.command.save")) { if (!plot.isOwner(player.getUUID()) && !Permissions.hasPermission(player, C.PERMISSION_ADMIN_COMMAND_SAVE)) {
MainUtil.sendMessage(player, C.NO_PLOT_PERMS); MainUtil.sendMessage(player, C.NO_PLOT_PERMS);
return false; return false;
} }

View File

@ -41,8 +41,8 @@ public class SchematicCmd extends SubCommand {
String arg = args[0].toLowerCase(); String arg = args[0].toLowerCase();
switch (arg) { switch (arg) {
case "paste": { case "paste": {
if (!Permissions.hasPermission(player, "plots.schematic.paste")) { if (!Permissions.hasPermission(player, C.PERMISSION_SCHEMATIC_PASTE)) {
MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.schematic.paste"); MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_SCHEMATIC_PASTE);
return false; return false;
} }
if (args.length < 2) { if (args.length < 2) {
@ -58,7 +58,7 @@ public class SchematicCmd extends SubCommand {
MainUtil.sendMessage(player, C.PLOT_UNOWNED); MainUtil.sendMessage(player, C.PLOT_UNOWNED);
return false; return false;
} }
if (!plot.isOwner(player.getUUID()) && !Permissions.hasPermission(player, "plots.admin.command.schematic.paste")) { if (!plot.isOwner(player.getUUID()) && !Permissions.hasPermission(player, C.PERMISSION_ADMIN_COMMAND_SCHEMATIC_PASTE)) {
MainUtil.sendMessage(player, C.NO_PLOT_PERMS); MainUtil.sendMessage(player, C.NO_PLOT_PERMS);
return false; return false;
} }
@ -169,15 +169,15 @@ public class SchematicCmd extends SubCommand {
MainUtil.sendMessage(player, "&cTask is already running."); MainUtil.sendMessage(player, "&cTask is already running.");
return false; return false;
} else { } else {
MainUtil.sendMessage(player, "&3PlotSquared&8->&3Schematic&8: &7Mass export has started. This may take a while."); MainUtil.sendMessage(player, "&3Plot&8->&3Schematic&8: &7Mass export has started. This may take a while.");
MainUtil.sendMessage(player, "&3PlotSquared&8->&3Schematic&8: &7Found &c" + plots.size() + "&7 plots..."); MainUtil.sendMessage(player, "&3Plot&8->&3Schematic&8: &7Found &c" + plots.size() + "&7 plots...");
} }
break; break;
} }
case "export": case "export":
case "save": case "save":
if (!Permissions.hasPermission(player, "plots.schematic.save")) { if (!Permissions.hasPermission(player, C.PERMISSION_SCHEMATIC_SAVE)) {
MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.schematic.save"); MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_SCHEMATIC_SAVE);
return false; return false;
} }
if (this.running) { if (this.running) {
@ -193,7 +193,7 @@ public class SchematicCmd extends SubCommand {
MainUtil.sendMessage(player, C.PLOT_UNOWNED); MainUtil.sendMessage(player, C.PLOT_UNOWNED);
return false; return false;
} }
if (!plot.isOwner(player.getUUID()) && !Permissions.hasPermission(player, "plots.admin.command.schematic.save")) { if (!plot.isOwner(player.getUUID()) && !Permissions.hasPermission(player, C.PERMISSION_ADMIN_COMMAND_SCHEMATIC_SAVE)) {
MainUtil.sendMessage(player, C.NO_PLOT_PERMS); MainUtil.sendMessage(player, C.NO_PLOT_PERMS);
return false; return false;
} }

View File

@ -58,8 +58,8 @@ public class Set extends SubCommand {
for (String component : components) { for (String component : components) {
if (component.equalsIgnoreCase(args[0])) { if (component.equalsIgnoreCase(args[0])) {
if (!Permissions.hasPermission(player, "plots.set." + component)) { if (!Permissions.hasPermission(player, C.PERMISSION_SET_COMPONENT.f(component))) {
MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.set." + component); MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_SET_COMPONENT.f(component));
return false; return false;
} }
PlotBlock[] blocks; PlotBlock[] blocks;

View File

@ -18,15 +18,15 @@ public abstract class SetCommand extends SubCommand {
return !sendMessage(player, C.NOT_IN_PLOT); return !sendMessage(player, C.NOT_IN_PLOT);
} }
if (!plot.hasOwner()) { if (!plot.hasOwner()) {
if (!Permissions.hasPermission(player, "plots.admin.command." + getFullId())) { if (!Permissions.hasPermission(player, C.PERMISSION_ADMIN_COMMAND.f(getFullId()))) {
MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.admin.command." + getFullId()); MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_ADMIN_COMMAND.f(getFullId()));
MainUtil.sendMessage(player, C.PLOT_NOT_CLAIMED); MainUtil.sendMessage(player, C.PLOT_NOT_CLAIMED);
return false; return false;
} }
} }
if (!plot.isOwner(player.getUUID())) { if (!plot.isOwner(player.getUUID())) {
if (!Permissions.hasPermission(player, "plots.admin.command." + getFullId())) { if (!Permissions.hasPermission(player, C.PERMISSION_ADMIN_COMMAND.f(getFullId()))) {
MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.admin.command." + getFullId()); MainUtil.sendMessage(player, C.NO_PERMISSION, C.PERMISSION_ADMIN_COMMAND.f(getFullId()));
MainUtil.sendMessage(player, C.NO_PLOT_PERMS); MainUtil.sendMessage(player, C.NO_PLOT_PERMS);
return false; return false;
} }

View File

@ -32,7 +32,7 @@ public class Setup extends SubCommand {
StringBuilder message = new StringBuilder(); StringBuilder message = new StringBuilder();
message.append("&6What generator do you want?"); message.append("&6What generator do you want?");
for (Entry<String, GeneratorWrapper<?>> entry : SetupUtils.generators.entrySet()) { for (Entry<String, GeneratorWrapper<?>> entry : SetupUtils.generators.entrySet()) {
if (entry.getKey().equals("PlotSquared")) { if (entry.getKey().equals(PS.imp().getPluginName())) {
message.append("\n&8 - &2").append(entry.getKey()).append(" (Default Generator)"); message.append("\n&8 - &2").append(entry.getKey()).append(" (Default Generator)");
} else if (entry.getValue().isFull()) { } else if (entry.getValue().isFull()) {
message.append("\n&8 - &7").append(entry.getKey()).append(" (Plot Generator)"); message.append("\n&8 - &7").append(entry.getKey()).append(" (Plot Generator)");
@ -79,7 +79,7 @@ public class Setup extends SubCommand {
if (args.length != 1 || !SetupUtils.generators.containsKey(args[0])) { if (args.length != 1 || !SetupUtils.generators.containsKey(args[0])) {
String prefix = "\n&8 - &7"; String prefix = "\n&8 - &7";
MainUtil.sendMessage(player, "&cYou must choose a generator!" + prefix + StringMan.join(SetupUtils.generators.keySet(), prefix) MainUtil.sendMessage(player, "&cYou must choose a generator!" + prefix + StringMan.join(SetupUtils.generators.keySet(), prefix)
.replaceAll("PlotSquared", "&2PlotSquared")); .replaceAll(PS.imp().getPluginName(), "&2" + PS.imp().getPluginName()));
sendMessage(player, C.SETUP_INIT); sendMessage(player, C.SETUP_INIT);
return false; return false;
} }
@ -137,7 +137,7 @@ public class Setup extends SubCommand {
.getNewPlotArea("CheckingPlotSquaredGenerator", null, null, null).getSettingNodes(); .getNewPlotArea("CheckingPlotSquaredGenerator", null, null, null).getSettingNodes();
SetupUtils.generators.get(object.plotManager).getPlotGenerator().processSetup(object); SetupUtils.generators.get(object.plotManager).getPlotGenerator().processSetup(object);
} else { } else {
object.plotManager = "PlotSquared"; object.plotManager = PS.imp().getPluginName();
MainUtil.sendMessage(player, "&c[WARNING] The specified generator does not identify as BukkitPlotGenerator"); MainUtil.sendMessage(player, "&c[WARNING] The specified generator does not identify as BukkitPlotGenerator");
MainUtil.sendMessage(player, "&7 - You may need to manually configure the other plugin"); MainUtil.sendMessage(player, "&7 - You may need to manually configure the other plugin");
object.step = SetupUtils.generators.get(object.plotManager).getPlotGenerator() object.step = SetupUtils.generators.get(object.plotManager).getPlotGenerator()
@ -263,7 +263,7 @@ public class Setup extends SubCommand {
return false; return false;
} }
MainUtil.sendMessage(player, MainUtil.sendMessage(player,
"&cThe world you specified already exists. After restarting, new terrain will use PlotSquared, however you may need to " "&cThe world you specified already exists. After restarting, new terrain will use " + PS.imp().getPluginName() + ", however you may need to "
+ "reset the world for it to generate correctly!"); + "reset the world for it to generate correctly!");
} }
object.world = args[0]; object.world = args[0];

View File

@ -147,7 +147,7 @@ public class Template extends SubCommand {
} catch (InvalidConfigurationException | IOException e) { } catch (InvalidConfigurationException | IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
String manager = worldConfig.getString("generator.plugin", "PlotSquared"); String manager = worldConfig.getString("generator.plugin", PS.imp().getPluginName());
String generator = worldConfig.getString("generator.init", manager); String generator = worldConfig.getString("generator.init", manager);
int type = worldConfig.getInt("generator.type"); int type = worldConfig.getInt("generator.type");
int terrain = worldConfig.getInt("generator.terrain"); int terrain = worldConfig.getInt("generator.terrain");

View File

@ -33,7 +33,7 @@ public class Trust extends Command {
public void execute(final PlotPlayer player, String[] args, RunnableVal3<Command, Runnable, Runnable> confirm, RunnableVal2<Command, CommandResult> whenDone) throws CommandException { public void execute(final PlotPlayer player, String[] args, RunnableVal3<Command, Runnable, Runnable> confirm, RunnableVal2<Command, CommandResult> whenDone) throws CommandException {
final Plot plot = check(player.getCurrentPlot(), C.NOT_IN_PLOT); final Plot plot = check(player.getCurrentPlot(), C.NOT_IN_PLOT);
checkTrue(plot.hasOwner(), C.PLOT_UNOWNED); checkTrue(plot.hasOwner(), C.PLOT_UNOWNED);
checkTrue(plot.isOwner(player.getUUID()) || Permissions.hasPermission(player, "plots.admin.command.trust"), C.NO_PLOT_PERMS); checkTrue(plot.isOwner(player.getUUID()) || Permissions.hasPermission(player, C.PERMISSION_ADMIN_COMMAND_TRUST), C.NO_PLOT_PERMS);
checkTrue(args.length == 1, C.COMMAND_SYNTAX, getUsage()); checkTrue(args.length == 1, C.COMMAND_SYNTAX, getUsage());
final Set<UUID> uuids = MainUtil.getUUIDsFromString(args[0]); final Set<UUID> uuids = MainUtil.getUUIDsFromString(args[0]);
checkTrue(!uuids.isEmpty(), C.INVALID_PLAYER, args[0]); checkTrue(!uuids.isEmpty(), C.INVALID_PLAYER, args[0]);
@ -41,7 +41,7 @@ public class Trust extends Command {
int size = plot.getTrusted().size() + plot.getMembers().size(); int size = plot.getTrusted().size() + plot.getMembers().size();
while (iter.hasNext()) { while (iter.hasNext()) {
UUID uuid = iter.next(); UUID uuid = iter.next();
if (uuid == DBFunc.everyone && !(Permissions.hasPermission(player, "plots.trust.everyone") || Permissions.hasPermission(player, "plots.admin.command.trust"))) { if (uuid == DBFunc.everyone && !(Permissions.hasPermission(player, C.PERMISSION_TRUST_EVERYONE) || Permissions.hasPermission(player, C.PERMISSION_ADMIN_COMMAND_TRUST))) {
MainUtil.sendMessage(player, C.INVALID_PLAYER, MainUtil.getName(uuid)); MainUtil.sendMessage(player, C.INVALID_PLAYER, MainUtil.getName(uuid));
iter.remove(); iter.remove();
continue; continue;
@ -59,7 +59,7 @@ public class Trust extends Command {
size += plot.getMembers().contains(uuid) ? 0 : 1; size += plot.getMembers().contains(uuid) ? 0 : 1;
} }
checkTrue(!uuids.isEmpty(), null); checkTrue(!uuids.isEmpty(), null);
checkTrue(size <= plot.getArea().MAX_PLOT_MEMBERS || Permissions.hasPermission(player, "plots.admin.command.trust"), C.PLOT_MAX_MEMBERS); checkTrue(size <= plot.getArea().MAX_PLOT_MEMBERS || Permissions.hasPermission(player, C.PERMISSION_ADMIN_COMMAND_TRUST), C.PLOT_MAX_MEMBERS);
confirm.run(this, new Runnable() { confirm.run(this, new Runnable() {
@Override // Success @Override // Success
public void run() { public void run() {

View File

@ -31,7 +31,7 @@ public class Unlink extends SubCommand {
if (!plot.hasOwner()) { if (!plot.hasOwner()) {
return !sendMessage(player, C.PLOT_UNOWNED); return !sendMessage(player, C.PLOT_UNOWNED);
} }
if (!plot.isOwner(player.getUUID()) && !Permissions.hasPermission(player, "plots.admin.command.unlink")) { if (!plot.isOwner(player.getUUID()) && !Permissions.hasPermission(player, C.PERMISSION_ADMIN_COMMAND_UNLINK)) {
return sendMessage(player, C.NO_PLOT_PERMS); return sendMessage(player, C.NO_PLOT_PERMS);
} }
if (!plot.isMerged()) { if (!plot.isMerged()) {

View File

@ -13,7 +13,7 @@ import java.net.URL;
@CommandDeclaration( @CommandDeclaration(
command = "update", command = "update",
permission = "plots.admin.command.update", permission = "plots.admin.command.update",
description = "Update PlotSquared", description = "Update the plugin",
usage = "/plot update", usage = "/plot update",
requiredType = RequiredType.NONE, requiredType = RequiredType.NONE,
aliases = {"updateplugin"}, aliases = {"updateplugin"},

View File

@ -96,23 +96,23 @@ public class Visit extends Command {
List<Plot> plots = PS.get().sortPlotsByTemp(unsorted); List<Plot> plots = PS.get().sortPlotsByTemp(unsorted);
final Plot plot = plots.get(page - 1); final Plot plot = plots.get(page - 1);
if (!plot.hasOwner()) { if (!plot.hasOwner()) {
if (!Permissions.hasPermission(player, "plots.visit.unowned")) { if (!Permissions.hasPermission(player, C.PERMISSION_VISIT_UNOWNED)) {
C.NO_PERMISSION.send(player, "plots.visit.unowned"); C.NO_PERMISSION.send(player, C.PERMISSION_VISIT_UNOWNED);
return; return;
} }
} else if (plot.isOwner(player.getUUID())) { } else if (plot.isOwner(player.getUUID())) {
if (!Permissions.hasPermission(player, "plots.visit.owned") && !Permissions.hasPermission(player, "plots.home")) { if (!Permissions.hasPermission(player, C.PERMISSION_VISIT_OWNED) && !Permissions.hasPermission(player, C.PERMISSION_HOME)) {
C.NO_PERMISSION.send(player, "plots.visit.owned, plots.home"); C.NO_PERMISSION.send(player, C.PERMISSION_VISIT_OWNED);
return; return;
} }
} else if (plot.isAdded(player.getUUID())) { } else if (plot.isAdded(player.getUUID())) {
if (!Permissions.hasPermission(player, "plots.visit.shared")) { if (!Permissions.hasPermission(player, C.PERMISSION_SHARED)) {
C.NO_PERMISSION.send(player, "plots.visit.shared"); C.NO_PERMISSION.send(player, C.PERMISSION_SHARED);
return; return;
} }
} else { } else {
if (!Permissions.hasPermission(player, "plots.visit.other")) { if (!Permissions.hasPermission(player, C.PERMISSION_VISIT_OTHER)) {
C.NO_PERMISSION.send(player, "plots.visit.other"); C.NO_PERMISSION.send(player, C.PERMISSION_VISIT_OTHER);
return; return;
} }
} }

View File

@ -70,12 +70,97 @@ public enum C {
PERMISSION_ADMIN_INTERACT_OTHER("plots.admin.interact.other", "static.permissions"), PERMISSION_ADMIN_INTERACT_OTHER("plots.admin.interact.other", "static.permissions"),
PERMISSION_ADMIN_BUILD_HEIGHTLIMIT("plots.admin.build.heightlimit", "static.permissions"), PERMISSION_ADMIN_BUILD_HEIGHTLIMIT("plots.admin.build.heightlimit", "static.permissions"),
PERMISSION_ADMIN_UPDATE("plots.admin.command.update", "static.permissions"), PERMISSION_ADMIN_UPDATE("plots.admin.command.update", "static.permissions"),
PERMISSION_ADMIN_COMMAND_TRUST("plots.admin.command.trust", "static.permissions"),
PERMISSION_TRUST_EVERYONE("plots.trust.everyone", "static.permissions"),
PERMISSION_AREA_CREATE("plots.area.create", "static.permissions"),
PERMISSION_AREA_INFO("plots.area.info", "static.permissions"),
PERMISSION_AREA_LIST("plots.area.list", "static.permissions"),
PERMISSION_AREA_REGEN("plots.area.regen", "static.permissions"),
PERMISSION_AREA_TP("plots.area.tp", "static.permissions"),
PERMISSION_AUTO_MEGA("plots.atuo.mega", "static.permissions"),
PERMISSION_CLAIM_SCHEMATIC("plots.claim.%s0", "static.permissions"),
PERMISSION_ADMIN_COMMAND_SCHEMATIC("plots.admin.command.schematic", "static.permissions"),
PERMISSION_ADMIN_COMMAND_BO3("plots.admin.command.bo3", "static.permissions"),
PERMISSION_ADMIN_COMMAND_CLEAR("plots.admin.command.clear", "static.permissions"),
PERMISSION_CONTINUE("plots.continue", "static.permissions"),
PERMISSION_CLUSTER_LIST("plots.cluster.list", "static.permissions"),
PERMISSION_CLUSTER_CREATE("plots.cluster.create", "static.permissions"),
PERMISSION_CLUSTER_CREATE_OTHER("plots.cluster.create.other", "static.permissions"),
PERMISSION_CLUSTER_SIZE("plots.cluster.size", "static.permissions"),
PERMISSION_CLUSTER_DELETE("plots.cluster.delete", "static.permissions"),
PERMISSION_CLUSTER_DELETE_OTHER("plots.cluster.delete.other", "static.permissions"),
PERMISSION_CLUSTER_RESIZE("plots.cluster.resize", "static.permissions"),
PERMISSION_CLUSTER_RESIZE_OTHER("plots.cluster.resize.other", "static.permissions"),
PERMISSION_CLUSTER_RESIZE_SHRINK("plots.cluster.resize.shrink", "static.permissions"),
PERMISSION_CLUSTER_RESIZE_EXPAND("plots.cluster.resize.expand", "static.permissions"),
PERMISSION_CLUSTER("plots.cluster", "static.permissions"),
PERMISSION_CLUSTER_INVITE("plots.cluster.invite", "static.permissions"),
PERMISSION_CLUSTER_INVITE_OTHER("plots.cluster.invite.other", "static.permissions"),
PERMISSION_CLUSTER_KICK("plots.cluster.kick", "static.permissions"),
PERMISSION_CLUSTER_KICK_OTHER("plots.cluster.kick.other", "static.permissions"),
PERMISSION_CLUSTER_LEAVE("plots.cluster.leave", "static.permissions"),
PERMISSION_CLUSTER_HELPERS("plots.cluster.helpers", "static.permissions"),
PERMISSION_CLUSTER_TP("plots.cluster.tp", "static.permissions"),
PERMISSION_CLUSTER_TP_OTHER("plots.cluster.tp.other", "static.permissions"),
PERMISSION_CLUSTER_INFO("plots.cluster.info", "static.permissions"),
PERMISSION_CLUSTER_SETHOME("plots.cluster.sethome", "static.permissions"),
PERMISSION_CLUSTER_SETHOME_OTHER("plots.cluster.sethome.other", "static.permissions"),
PERMISSION_ADMIN_COMMAND_CONTINUE("plots.admin.command.continue", "static.permissions"),
PERMISSION_ADMIN_COMMAND_DELETE("plots.admin.command.delete", "static.permissions"),
PERMISSION_ADMIN_COMMAND_DENY("plots.admin.command.deny", "static.permissions"),
PERMISSION_DENY_EVERYONE("plots.deny.everyone", "static.permissions"),
PERMISSION_ADMIN_COMMAND_DONE("plots.admin.command.done", "static.permissions"),
PERMISSION_ADMIN_COMMAND_DOWNLOAD("plots.admin.command.download", "static.permissions"),
PERMISSION_DOWNLOAD_BO3("plots.download.bo3", "static.permissions"),
PERMISSION_DOWNLOAD_WORLD("plots.download.world", "static.permissions"),
PERMISSION_SET_FLAG_OTHER("plots.set.flag.other", "static.permissions"),
PERMISSION_SET_FLAG("plots.set.flag", "static.permissions"),
PERMISSION_SET_FLAG_KEY("plots.set.flag.%s0", "static.permissions"),
PERMISSION_SET_FLAG_KEY_VALUE("plots.set.flag.%s0.%s1", "static.permissions"),
PERMISSION_FLAG_REMOVE("plots.flag.remove", "static.permissions"),
PERMISSION_FLAG_ADD("plots.flag.add", "static.permissions"),
PERMISSION_FLAG_LIST("plots.flag.list", "static.permissions"),
PERMISSION_ADMIN_COMMAND_KICK("plots.admin.command.kick", "static.permissions"),
PERMISSION_GRANT("plots.grant.%s0", "static.permissions"),
PERMISSION_LIST_FORSALE("plots.list.forsale", "static.permissions"),
PERMISSION_LIST_MINE("plots.list.mine", "static.permissions"),
PERMISSION_LIST_SHARED("plots.list.shared", "static.permissions"),
PERMISSION_LIST_WORLD("plots.list.world", "static.permissions"),
PERMISSION_LIST_WORLD_NAME("plots.list.world.%s0", "static.permissions"),
PERMISSION_LIST_TOP("plots.list.top", "static.permissions"),
PERMISSION_LIST_ALL("plots.list.all", "static.permissions"),
PERMISSION_LIST_UNOWNED("plots.list.unowned", "static.permissions"),
PERMISSION_LIST_UNKNOWN("plots.list.unknown", "static.permissions"),
PERMISSION_LIST_PLAYER("plots.list.player", "static.permissions"),
PERMISSION_LIST_DONE("plots.list.done", "static.permissions"),
PERMISSION_LIST_EXPIRED("plots.list.expired", "static.permissions"),
PERMISSION_LIST_FUZZY("plots.list.fuzzy", "static.permissions"),
PERMISSION_LIST_AREA("plots.list.area", "static.permissions"),
PERMISSION_ADMIN_COMMAND_LOAD("plots.admin.command.load", "static.permissions"),
PERMISSION_ADMIN_COMMAND_MERGE("plots.admin.command.merge", "static.permissions"),
PERMISSION_ADMIN_COMMAND_SETOWNER("plots.admin.command.setowner", "static.permissions"),
PERMISSION_COMMENT("plots.comment", "static.permissions"),
PERMISSION_ADMIN_COMMAND_REMOVE("plots.admin.command.remove", "static.permissions"),
PERMISSION_ADMIN_COMMAND_SAVE("plots.admin.command.save", "static.permissions"),
PERMISSION_ADMIN_COMMAND_SCHEMATIC_PASTE("plots.admin.command.schematic.paste", "static.permissions"),
PERMISSION_SCHEMATIC_PASTE("plots.schematic.paste", "static.permissions"),
PERMISSION_SCHEMATIC_SAVE("plots.schematic.save", "static.permissions"),
PERMISSION_ADMIN_COMMAND_SCHEMATIC_SAVE("plots.admin.command.schematic.save", "static.permissions"),
PERMISSION_SET_COMPONENT("plots.set.%s0", "static.permissions"),
PERMISSION_ADMIN_COMMAND("plots.admin.command.%s0", "static.permissions"),
PERMISSION_ADMIN_COMMAND_UNLINK("", "static.permissions"),
PERMISSION_VISIT_UNOWNED("plots.visit.unowned", "static.permissions"),
PERMISSION_VISIT_OWNED("plots.visit.owned", "static.permissions"),
PERMISSION_SHARED("plots.visit.shared", "static.permissions"),
PERMISSION_VISIT_OTHER("plots.visit.other", "static.permissions"),
PERMISSION_HOME("plots.home", "static.permissions"),
/* /*
* Static console * 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 " 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"), + "and security. %s0 will require Java 9 in a future update.", "static.console"),
CONSOLE_PLEASE_ENABLE_METRICS("&dPlease enable metrics for PlotSquared. Using metrics improves plugin stability, performance, and features. " CONSOLE_PLEASE_ENABLE_METRICS("&dPlease enable metrics for %s0. Using metrics improves plugin stability, performance, and features. "
+ "Bug fixes and new features are influenced on metrics.", "static.console"), + "Bug fixes and new features are influenced on metrics.", "static.console"),
/* /*
* Confirm * Confirm
@ -288,7 +373,7 @@ public enum C {
*/ */
TASK_START("Starting task...", "Core"), TASK_START("Starting task...", "Core"),
PREFIX("$3[$1P2$3] $2", "Core"), PREFIX("$3[$1P2$3] $2", "Core"),
ENABLED("$1PlotSquared is now enabled", "Core"), ENABLED("$1%s0 is now enabled", "Core"),
/* /*
* Reload * Reload
*/ */
@ -527,12 +612,6 @@ public enum C {
* Left * Left
*/ */
LEFT_PLOT("$2You left a plot", "Left"), LEFT_PLOT("$2You left a plot", "Left"),
/*
* PlotMe
*/
NOT_USING_PLOTME(
"$2This server uses the far superior $1PlotSquared $2plot management system. Please use the $1/ps $2or $1/p2 $2or $1/plots $2instead",
"Errors"),
/* /*
* Wait * Wait
*/ */

View File

@ -51,7 +51,6 @@ public class Settings extends Config {
Redstone.DISABLE_UNOCCUPIED = config.getBoolean("protection.redstone.disable-unoccupied", Redstone.DISABLE_UNOCCUPIED); Redstone.DISABLE_UNOCCUPIED = config.getBoolean("protection.redstone.disable-unoccupied", Redstone.DISABLE_UNOCCUPIED);
// PlotMe // PlotMe
PlotMe.ALIAS = config.getBoolean("plotme-alias", PlotMe.ALIAS);
Enabled_Components.PLOTME_CONVERTER = config.getBoolean("plotme-convert.enabled", Enabled_Components.PLOTME_CONVERTER); Enabled_Components.PLOTME_CONVERTER = config.getBoolean("plotme-convert.enabled", Enabled_Components.PLOTME_CONVERTER);
PlotMe.CACHE_UUDS = config.getBoolean("plotme-convert.cache-uuids", PlotMe.CACHE_UUDS); PlotMe.CACHE_UUDS = config.getBoolean("plotme-convert.cache-uuids", PlotMe.CACHE_UUDS);
@ -185,9 +184,9 @@ public class Settings extends Config {
} }
public static class UUID { public static class UUID {
@Comment("Force PlotSquared to use offline UUIDs (it usually detects the right mode)") @Comment("Force using offline UUIDs (it usually detects the right mode)")
public static boolean OFFLINE = false; public static boolean OFFLINE = false;
@Comment("Force PlotSquared to use lowercase UUIDs") @Comment("Force using lowercase UUIDs")
public static boolean FORCE_LOWERCASE = false; public static boolean FORCE_LOWERCASE = false;
@Comment("Use a database to store UUID/name info") @Comment("Use a database to store UUID/name info")
public static boolean USE_SQLUUIDHANDLER = false; public static boolean USE_SQLUUIDHANDLER = false;
@ -195,7 +194,7 @@ public class Settings extends Config {
public static boolean NATIVE_UUID_PROVIDER = false; public static boolean NATIVE_UUID_PROVIDER = false;
} }
@Comment("Configure the paths PlotSquared will use") @Comment("Configure the paths that will be used")
public static final class Paths { public static final class Paths {
public static String SCHEMATICS = "schematics"; public static String SCHEMATICS = "schematics";
public static String BO3 = "bo3"; public static String BO3 = "bo3";
@ -241,8 +240,6 @@ public class Settings extends Config {
public static final class PlotMe { public static final class PlotMe {
@Comment("Cache the uuids from the PlotMe database") @Comment("Cache the uuids from the PlotMe database")
public static boolean CACHE_UUDS = false; public static boolean CACHE_UUDS = false;
@Comment("Have `/plotme` as a command alias")
public static boolean ALIAS = false;
} }
public static final class Teleport { public static final class Teleport {

View File

@ -1,6 +1,7 @@
package com.intellectualcrafters.plot.generator; package com.intellectualcrafters.plot.generator;
import com.intellectualcrafters.jnbt.CompoundTag; import com.intellectualcrafters.jnbt.CompoundTag;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.object.Location; import com.intellectualcrafters.plot.object.Location;
import com.intellectualcrafters.plot.object.PlotArea; import com.intellectualcrafters.plot.object.PlotArea;
import com.intellectualcrafters.plot.object.PlotBlock; import com.intellectualcrafters.plot.object.PlotBlock;
@ -19,7 +20,7 @@ public class HybridGen extends IndependentPlotGenerator {
@Override @Override
public String getName() { public String getName() {
return "PlotSquared"; return PS.imp().getPluginName();
} }
@Override @Override

View File

@ -13,7 +13,7 @@ public class PlotMessage {
try { try {
reset(ChatManager.manager); reset(ChatManager.manager);
} catch (Throwable e) { } catch (Throwable e) {
PS.debug("PlotSquared doesn't support fancy chat for " + PS.get().IMP.getServerVersion()); PS.debug(PS.imp().getPluginName() + " doesn't support fancy chat for " + PS.get().IMP.getServerVersion());
ChatManager.manager = new PlainChatManager(); ChatManager.manager = new PlainChatManager();
reset(ChatManager.manager); reset(ChatManager.manager);
} }

View File

@ -68,8 +68,8 @@ public abstract class EventUtil {
} }
} }
if (PS.get().update != null && Permissions.hasPermission(player, C.PERMISSION_ADMIN_UPDATE) && Settings.Enabled_Components.UPDATER) { if (PS.get().update != null && Permissions.hasPermission(player, C.PERMISSION_ADMIN_UPDATE) && Settings.Enabled_Components.UPDATER) {
MainUtil.sendMessage(player,C.CONSOLE_JAVA_OUTDATED_1_8.s()); MainUtil.sendMessage(player,C.CONSOLE_JAVA_OUTDATED_1_8.f(PS.get().IMP.getPluginName()));
MainUtil.sendMessage(player, "&6An update for PlotSquared is available: &7/plot update"); MainUtil.sendMessage(player, "&6An update for " + PS.imp().getPluginName() + " is available: &7/plot update");
} }
final Plot plot = player.getCurrentPlot(); final Plot plot = player.getCurrentPlot();
if (Settings.Teleport.ON_LOGIN && plot != null) { if (Settings.Teleport.ON_LOGIN && plot != null) {

View File

@ -90,6 +90,10 @@ public class Permissions {
return true; return true;
} }
public static int hasPermissionRange(PlotPlayer player, C perm, int range) {
return hasPermissionRange(player, perm.s(), range);
}
/** /**
* Check the the highest permission a PlotPlayer has within a specified range.<br> * Check the the highest permission a PlotPlayer has within a specified range.<br>
* - Excessively high values will lag<br> * - Excessively high values will lag<br>

View File

@ -129,7 +129,7 @@ public abstract class UUIDHandlerImplementation {
DBFunc.replaceUUID(offline, uuid); DBFunc.replaceUUID(offline, uuid);
PS.debug("&cDetected invalid UUID stored for: " + name.value); PS.debug("&cDetected invalid UUID stored for: " + name.value);
PS.debug("&7 - Did you recently switch to online-mode storage without running `uuidconvert`?"); PS.debug("&7 - Did you recently switch to online-mode storage without running `uuidconvert`?");
PS.debug("&6PlotSquared will update incorrect entries when the user logs in, or you can reconstruct your database."); PS.debug("&6" + PS.imp().getPluginName() + " will update incorrect entries when the user logs in, or you can reconstruct your database.");
} }
} }
} }
@ -146,10 +146,7 @@ public abstract class UUIDHandlerImplementation {
for (Plot plot : plots) { for (Plot plot : plots) {
plot.owner = uuid; plot.owner = uuid;
} }
DBFunc.replaceUUID(offlineUpper, uuid); replace(offlineUpper, uuid, name.value);
PS.debug("&cDetected invalid UUID stored for: " + name.value);
PS.debug("&7 - Did you recently switch to online-mode storage without running `uuidconvert`?");
PS.debug("&6PlotSquared will update incorrect entries when the user logs in, or you can reconstruct your database.");
} }
} }
} }
@ -164,10 +161,7 @@ public abstract class UUIDHandlerImplementation {
for (Plot plot : plots) { for (Plot plot : plots) {
plot.owner = uuid; plot.owner = uuid;
} }
DBFunc.replaceUUID(offline, uuid); replace(offline, uuid, name.value);
PS.debug("&cDetected invalid UUID stored for (1): " + name.value);
PS.debug("&7 - Did you recently switch to online-mode storage without running `uuidconvert`?");
PS.debug("&6PlotSquared will update incorrect entries when the user logs in, or you can reconstruct your database.");
} }
return true; return true;
} }
@ -187,6 +181,13 @@ public abstract class UUIDHandlerImplementation {
return true; return true;
} }
private void replace(UUID from, UUID to, String name) {
DBFunc.replaceUUID(from, to);
PS.debug("&cDetected invalid UUID stored for: " + name);
PS.debug("&7 - Did you recently switch to online-mode storage without running `uuidconvert`?");
PS.debug("&6" + PS.imp().getPluginName() + " will update incorrect entries when the user logs in, or you can reconstruct your database.");
}
public boolean uuidExists(UUID uuid) { public boolean uuidExists(UUID uuid) {
return this.uuidMap.containsValue(uuid); return this.uuidMap.containsValue(uuid);
} }

View File

@ -1,6 +1,7 @@
package com.plotsquared.listener; package com.plotsquared.listener;
import com.intellectualcrafters.plot.PS; import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.config.Settings; import com.intellectualcrafters.plot.config.Settings;
import com.intellectualcrafters.plot.object.RegionWrapper; import com.intellectualcrafters.plot.object.RegionWrapper;
import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.Vector;
@ -95,7 +96,7 @@ public class ProcessedWEExtent extends AbstractDelegateExtent {
this.BScount++; this.BScount++;
if (this.BScount > Settings.Chunk_Processor.MAX_TILES) { if (this.BScount > Settings.Chunk_Processor.MAX_TILES) {
this.BSblocked = true; this.BSblocked = true;
PS.debug("&cPlotSquared detected unsafe WorldEdit: " + location.getBlockX() + "," + location.getBlockZ()); PS.debug(C.PREFIX + "&cdetected unsafe WorldEdit: " + location.getBlockX() + "," + location.getBlockZ());
} }
if (WEManager.maskContains(this.mask, location.getBlockX(), location.getBlockY(), location.getBlockZ())) { if (WEManager.maskContains(this.mask, location.getBlockX(), location.getBlockY(), location.getBlockZ())) {
if (this.count++ > this.max) { if (this.count++ > this.max) {
@ -240,7 +241,7 @@ public class ProcessedWEExtent extends AbstractDelegateExtent {
this.Ecount++; this.Ecount++;
if (this.Ecount > Settings.Chunk_Processor.MAX_ENTITIES) { if (this.Ecount > Settings.Chunk_Processor.MAX_ENTITIES) {
this.Eblocked = true; this.Eblocked = true;
PS.debug("&cPlotSquared detected unsafe WorldEdit: " + location.getBlockX() + "," + location.getBlockZ()); PS.debug(C.PREFIX + "&cdetected unsafe WorldEdit: " + location.getBlockX() + "," + location.getBlockZ());
} }
if (WEManager.maskContains(this.mask, location.getBlockX(), location.getBlockY(), location.getBlockZ())) { if (WEManager.maskContains(this.mask, location.getBlockX(), location.getBlockY(), location.getBlockZ())) {
return super.createEntity(location, entity); return super.createEntity(location, entity);

View File

@ -0,0 +1 @@
version=${version}

View File

@ -70,6 +70,7 @@ public final class NukkitMain extends PluginBase implements Listener, IPlotMain
public static WorldEdit worldEdit; public static WorldEdit worldEdit;
private int[] version; private int[] version;
private String name;
@Override @Override
public int[] getServerVersion() { public int[] getServerVersion() {
@ -92,15 +93,16 @@ public final class NukkitMain extends PluginBase implements Listener, IPlotMain
@Override @Override
public void onEnable() { public void onEnable() {
try { try {
this.name = getDescription().getName();
getServer().getName(); getServer().getName();
new PS(this, "Nukkit"); new PS(this, "Nukkit");
if (Settings.Enabled_Components.METRICS) { if (Settings.Enabled_Components.METRICS) {
new Metrics(this).start(); new Metrics(this).start();
PS.log(C.PREFIX + "&6Metrics enabled."); PS.log(C.PREFIX + "&6Metrics enabled.");
} else { } else {
PS.log(C.CONSOLE_PLEASE_ENABLE_METRICS); PS.log(C.CONSOLE_PLEASE_ENABLE_METRICS.f(getPluginName()));
} }
Generator.addGenerator(NukkitHybridGen.class, "PlotSquared", 1); Generator.addGenerator(NukkitHybridGen.class, getPluginName(), 1);
} catch (Throwable e) { } catch (Throwable e) {
e.printStackTrace(); e.printStackTrace();
} }
@ -144,6 +146,11 @@ public final class NukkitMain extends PluginBase implements Listener, IPlotMain
return getDescription().getVersion(); return getDescription().getVersion();
} }
@Override
public String getPluginName() {
return name;
}
@Override @Override
public void registerCommands() { public void registerCommands() {
NukkitCommand bukkitCommand = new NukkitCommand("plot", new String[] {"p","plot","ps","plotsquared","p2","2"}); NukkitCommand bukkitCommand = new NukkitCommand("plot", new String[] {"p","plot","ps","plotsquared","p2","2"});

View File

@ -4,6 +4,7 @@ import cn.nukkit.Player;
import cn.nukkit.event.player.PlayerTeleportEvent; import cn.nukkit.event.player.PlayerTeleportEvent;
import cn.nukkit.plugin.RegisteredListener; import cn.nukkit.plugin.RegisteredListener;
import cn.nukkit.utils.EventException; import cn.nukkit.utils.EventException;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.object.Location; import com.intellectualcrafters.plot.object.Location;
import com.intellectualcrafters.plot.object.PlotPlayer; import com.intellectualcrafters.plot.object.PlotPlayer;
import com.intellectualcrafters.plot.util.EconHandler; import com.intellectualcrafters.plot.util.EconHandler;
@ -62,7 +63,7 @@ public class NukkitPlayer extends PlotPlayer {
PlayerTeleportEvent event = new PlayerTeleportEvent(player, from, to, PlayerTeleportEvent.TeleportCause.PLUGIN); PlayerTeleportEvent event = new PlayerTeleportEvent(player, from, to, PlayerTeleportEvent.TeleportCause.PLUGIN);
RegisteredListener[] listeners = event.getHandlers().getRegisteredListeners(); RegisteredListener[] listeners = event.getHandlers().getRegisteredListeners();
for (RegisteredListener listener : listeners) { for (RegisteredListener listener : listeners) {
if (listener.getPlugin().getName().equals("PlotSquared")) { if (listener.getPlugin().getName().equals(PS.imp().getPluginName())) {
continue; continue;
} }
try { try {
@ -76,7 +77,7 @@ public class NukkitPlayer extends PlotPlayer {
} }
event = new PlayerTeleportEvent(player, to, from, PlayerTeleportEvent.TeleportCause.PLUGIN); event = new PlayerTeleportEvent(player, to, from, PlayerTeleportEvent.TeleportCause.PLUGIN);
for (RegisteredListener listener : listeners) { for (RegisteredListener listener : listeners) {
if (listener.getPlugin().getName().equals("PlotSquared")) { if (listener.getPlugin().getName().equals(PS.imp().getPluginName())) {
continue; continue;
} }
try { try {

View File

@ -11,7 +11,7 @@ import com.intellectualcrafters.plot.object.ConsolePlayer;
public class NukkitCommand extends Command { public class NukkitCommand extends Command {
public NukkitCommand(String cmd, String[] aliases) { public NukkitCommand(String cmd, String[] aliases) {
super(cmd, "PlotSquared command", "/plot", aliases); super(cmd, "Plot command", "/plot", aliases);
} }

View File

@ -7,7 +7,6 @@ import com.intellectualcrafters.configuration.file.YamlConfiguration;
import com.intellectualcrafters.plot.PS; import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.ConfigurationNode; import com.intellectualcrafters.plot.config.ConfigurationNode;
import com.intellectualcrafters.plot.generator.GeneratorWrapper; import com.intellectualcrafters.plot.generator.GeneratorWrapper;
import com.intellectualcrafters.plot.generator.HybridGen;
import com.intellectualcrafters.plot.object.PlotArea; import com.intellectualcrafters.plot.object.PlotArea;
import com.intellectualcrafters.plot.object.SetupObject; import com.intellectualcrafters.plot.object.SetupObject;
import com.intellectualcrafters.plot.util.SetupUtils; import com.intellectualcrafters.plot.util.SetupUtils;
@ -38,7 +37,7 @@ public class NukkitSetupUtils extends SetupUtils {
map.put("world", testWorld); map.put("world", testWorld);
map.put("plot-generator", PS.get().IMP.getDefaultGenerator()); map.put("plot-generator", PS.get().IMP.getDefaultGenerator());
NukkitPlotGenerator gen = new NukkitPlotGenerator(map); NukkitPlotGenerator gen = new NukkitPlotGenerator(map);
SetupUtils.generators.put("PlotSquared", gen); SetupUtils.generators.put(PS.imp().getPluginName(), gen);
} }
@Override @Override
@ -160,7 +159,7 @@ public class NukkitSetupUtils extends SetupUtils {
return entry.getKey(); return entry.getKey();
} }
} }
return "PlotSquared"; return PS.imp().getPluginName();
} catch (Throwable e) { } catch (Throwable e) {
e.printStackTrace(); e.printStackTrace();
} }

View File

@ -179,6 +179,11 @@ public class SpongeMain implements IPlotMain {
return this.plugin.getVersion().orElse(""); return this.plugin.getVersion().orElse("");
} }
@Override
public String getPluginName() {
return "PlotSquared";
}
@Override @Override
public int[] getServerVersion() { public int[] getServerVersion() {
PS.log("Checking minecraft version: Sponge: "); PS.log("Checking minecraft version: Sponge: ");

View File

@ -87,23 +87,6 @@ public class MainListener {
* - enderman harvest * - enderman harvest
*/ */
@Listener
public void onCommand(SendCommandEvent event) {
switch (event.getCommand().toLowerCase()) {
case "plotme":
Player source = SpongeUtil.getCause(event.getCause(), Player.class);
if (source == null) {
return;
}
if (Settings.PlotMe.ALIAS) {
SpongeMain.THIS.getGame().getCommandManager().process(source, ("plots " + event.getArguments()).trim());
} else {
source.sendMessage(SpongeUtil.getText(C.NOT_USING_PLOTME.s()));
}
event.setCancelled(true);
}
}
@Listener @Listener
public void onChat(MessageEvent event) { public void onChat(MessageEvent event) {
// TODO // TODO
@ -295,7 +278,7 @@ public class MainListener {
// return true; // return true;
// } // }
// org.spongepowered.api.world.Location<World> loc = relatives.get(dir); // org.spongepowered.api.world.Location<World> loc = relatives.get(dir);
// com.intellectualcrafters.plot.object.Location plotloc = SpongeUtil.getLocation(loc.getExtent().getName(), loc); // com.intellectualcrafters.plot.object.Location plotloc = SpongeUtil.getLocation(loc.getExtent().getPluginName(), loc);
// if (area == null) { // if (area == null) {
// return true; // return true;
// } // }
@ -310,7 +293,7 @@ public class MainListener {
// return true; // return true;
// } // }
// org.spongepowered.api.world.Location<World> relative = loc.getRelative(dir); // org.spongepowered.api.world.Location<World> relative = loc.getRelative(dir);
// com.intellectualcrafters.plot.object.Location relLoc = SpongeUtil.getLocation(relative.getExtent().getName(), relative); // com.intellectualcrafters.plot.object.Location relLoc = SpongeUtil.getLocation(relative.getExtent().getPluginName(), relative);
// if (plot.equals(MainUtil.getPlot(relLoc))) { // if (plot.equals(MainUtil.getPlot(relLoc))) {
// return true; // return true;
// } // }

View File

@ -4,11 +4,16 @@ import com.intellectualcrafters.configuration.ConfigurationSection;
import com.intellectualcrafters.plot.PS; import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.ConfigurationNode; import com.intellectualcrafters.plot.config.ConfigurationNode;
import com.intellectualcrafters.plot.generator.GeneratorWrapper; import com.intellectualcrafters.plot.generator.GeneratorWrapper;
import com.intellectualcrafters.plot.generator.HybridGen;
import com.intellectualcrafters.plot.object.PlotArea; import com.intellectualcrafters.plot.object.PlotArea;
import com.intellectualcrafters.plot.object.SetupObject; import com.intellectualcrafters.plot.object.SetupObject;
import com.intellectualcrafters.plot.util.SetupUtils; import com.intellectualcrafters.plot.util.SetupUtils;
import com.plotsquared.sponge.generator.SpongePlotGenerator; import com.plotsquared.sponge.generator.SpongePlotGenerator;
import java.io.IOException;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map.Entry;
import java.util.Objects;
import java.util.Optional;
import org.spongepowered.api.Sponge; import org.spongepowered.api.Sponge;
import org.spongepowered.api.world.DimensionTypes; import org.spongepowered.api.world.DimensionTypes;
import org.spongepowered.api.world.GeneratorTypes; import org.spongepowered.api.world.GeneratorTypes;
@ -18,13 +23,6 @@ import org.spongepowered.api.world.gen.WorldGenerator;
import org.spongepowered.api.world.gen.WorldGeneratorModifier; import org.spongepowered.api.world.gen.WorldGeneratorModifier;
import org.spongepowered.api.world.storage.WorldProperties; import org.spongepowered.api.world.storage.WorldProperties;
import java.io.IOException;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map.Entry;
import java.util.Objects;
import java.util.Optional;
public class SpongeSetupUtils extends SetupUtils { public class SpongeSetupUtils extends SetupUtils {
@Override @Override
@ -32,7 +30,7 @@ public class SpongeSetupUtils extends SetupUtils {
if (!SetupUtils.generators.isEmpty()) { if (!SetupUtils.generators.isEmpty()) {
return; return;
} }
SetupUtils.generators.put("PlotSquared", new SpongePlotGenerator(PS.get().IMP.getDefaultGenerator())); SetupUtils.generators.put(PS.imp().getPluginName(), new SpongePlotGenerator(PS.get().IMP.getDefaultGenerator()));
// TODO get external world generators // TODO get external world generators
Collection<WorldGeneratorModifier> wgms = Sponge.getRegistry().getAllOf(WorldGeneratorModifier.class); Collection<WorldGeneratorModifier> wgms = Sponge.getRegistry().getAllOf(WorldGeneratorModifier.class);
for (WorldGeneratorModifier wgm : wgms) { for (WorldGeneratorModifier wgm : wgms) {

View File

@ -19,7 +19,7 @@ ext {
revision = "${git.head().abbreviatedId}" revision = "${git.head().abbreviatedId}"
} }
version = "3.4.6-SNAPSHOT-${revision}" version = "3.4.6-SNAPSHOT-${revision}"
description = """PlotSquared""" description = rootProject.name
subprojects { subprojects {
apply plugin: 'java' apply plugin: 'java'

View File

@ -1,6 +1,6 @@
#Sun Sep 11 16:39:31 EDT 2016 #Mon Sep 26 17:20:41 AEST 2016
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-3.0-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-3.0-all.zip