mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 13:16:45 +01:00
parent
87d4ecb1f1
commit
eda4575dd6
@ -1,5 +1,36 @@
|
|||||||
package com.intellectualcrafters.plot;
|
package com.intellectualcrafters.plot;
|
||||||
|
|
||||||
|
import java.io.BufferedReader;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileInputStream;
|
||||||
|
import java.io.FileOutputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
|
import java.net.MalformedURLException;
|
||||||
|
import java.net.URISyntaxException;
|
||||||
|
import java.net.URL;
|
||||||
|
import java.net.URLConnection;
|
||||||
|
import java.nio.file.Files;
|
||||||
|
import java.sql.Connection;
|
||||||
|
import java.sql.SQLException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Comparator;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Map.Entry;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.UUID;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
import java.util.zip.ZipEntry;
|
||||||
|
import java.util.zip.ZipInputStream;
|
||||||
|
|
||||||
import com.intellectualcrafters.configuration.ConfigurationSection;
|
import com.intellectualcrafters.configuration.ConfigurationSection;
|
||||||
import com.intellectualcrafters.configuration.MemorySection;
|
import com.intellectualcrafters.configuration.MemorySection;
|
||||||
import com.intellectualcrafters.configuration.file.YamlConfiguration;
|
import com.intellectualcrafters.configuration.file.YamlConfiguration;
|
||||||
@ -56,37 +87,6 @@ import com.intellectualcrafters.plot.util.area.QuadMap;
|
|||||||
import com.plotsquared.listener.WESubscriber;
|
import com.plotsquared.listener.WESubscriber;
|
||||||
import com.sk89q.worldedit.WorldEdit;
|
import com.sk89q.worldedit.WorldEdit;
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.FileInputStream;
|
|
||||||
import java.io.FileOutputStream;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.InputStream;
|
|
||||||
import java.io.InputStreamReader;
|
|
||||||
import java.net.MalformedURLException;
|
|
||||||
import java.net.URISyntaxException;
|
|
||||||
import java.net.URL;
|
|
||||||
import java.net.URLConnection;
|
|
||||||
import java.nio.file.Files;
|
|
||||||
import java.sql.Connection;
|
|
||||||
import java.sql.SQLException;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.Comparator;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Map.Entry;
|
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.Set;
|
|
||||||
import java.util.UUID;
|
|
||||||
import java.util.regex.Pattern;
|
|
||||||
import java.util.zip.ZipEntry;
|
|
||||||
import java.util.zip.ZipInputStream;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An implementation of the core,
|
* An implementation of the core,
|
||||||
* with a static getter for easy access
|
* with a static getter for easy access
|
||||||
@ -147,7 +147,7 @@ public class PS {
|
|||||||
try {
|
try {
|
||||||
URL url = PS.class.getProtectionDomain().getCodeSource().getLocation();
|
URL url = PS.class.getProtectionDomain().getCodeSource().getLocation();
|
||||||
FILE = new File(new URL(url.toURI().toString().split("\\!")[0].replaceAll("jar:file", "file")).toURI().getPath());
|
FILE = new File(new URL(url.toURI().toString().split("\\!")[0].replaceAll("jar:file", "file")).toURI().getPath());
|
||||||
} catch (MalformedURLException | URISyntaxException e) {
|
} catch (MalformedURLException | URISyntaxException | SecurityException | NullPointerException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
FILE = new File(IMP.getDirectory().getParentFile(), "PlotSquared.jar");
|
FILE = new File(IMP.getDirectory().getParentFile(), "PlotSquared.jar");
|
||||||
if (!FILE.exists()) {
|
if (!FILE.exists()) {
|
||||||
|
@ -1,5 +1,10 @@
|
|||||||
package com.intellectualcrafters.plot.commands;
|
package com.intellectualcrafters.plot.commands;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import com.intellectualcrafters.configuration.ConfigurationSection;
|
import com.intellectualcrafters.configuration.ConfigurationSection;
|
||||||
import com.intellectualcrafters.plot.PS;
|
import com.intellectualcrafters.plot.PS;
|
||||||
import com.intellectualcrafters.plot.config.C;
|
import com.intellectualcrafters.plot.config.C;
|
||||||
@ -27,11 +32,6 @@ 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.util.ArrayList;
|
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
@CommandDeclaration(
|
@CommandDeclaration(
|
||||||
command = "area",
|
command = "area",
|
||||||
permission = "plots.area",
|
permission = "plots.area",
|
||||||
@ -40,7 +40,6 @@ requiredType = RequiredType.NONE,
|
|||||||
description = "Create a new PlotArea",
|
description = "Create a new PlotArea",
|
||||||
aliases = { "world" },
|
aliases = { "world" },
|
||||||
usage = "/plot area <create|info|list|tp|regen>")
|
usage = "/plot area <create|info|list|tp|regen>")
|
||||||
//plot createarea partial
|
|
||||||
public class Area extends SubCommand {
|
public class Area extends SubCommand {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -59,7 +58,7 @@ public class Area extends SubCommand {
|
|||||||
}
|
}
|
||||||
switch (args.length) {
|
switch (args.length) {
|
||||||
case 1: {
|
case 1: {
|
||||||
C.COMMAND_SYNTAX.send(plr, "/plot area create [world[:type]] [<modifier>=<value>]...");
|
C.COMMAND_SYNTAX.send(plr, "/plot area create [world[:id]] [<modifier>=<value>]...");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
case 2: {
|
case 2: {
|
||||||
@ -67,7 +66,7 @@ public class Area extends SubCommand {
|
|||||||
case "pos1": { // Set position 1
|
case "pos1": { // Set position 1
|
||||||
HybridPlotWorld area = plr.<HybridPlotWorld> getMeta("area_create_area");
|
HybridPlotWorld area = plr.<HybridPlotWorld> getMeta("area_create_area");
|
||||||
if (area == null) {
|
if (area == null) {
|
||||||
C.COMMAND_SYNTAX.send(plr, "/plot area create [world[:type]] [<modifier>=<value>]...");
|
C.COMMAND_SYNTAX.send(plr, "/plot area create [world[:id]] [<modifier>=<value>]...");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Location loc = plr.getLocation();
|
Location loc = plr.getLocation();
|
||||||
@ -80,7 +79,7 @@ public class Area extends SubCommand {
|
|||||||
case "pos2": { // Set position 2 and finish creation for type=2 (partial)
|
case "pos2": { // Set position 2 and finish creation for type=2 (partial)
|
||||||
final HybridPlotWorld area = plr.<HybridPlotWorld> getMeta("area_create_area");
|
final HybridPlotWorld area = plr.<HybridPlotWorld> getMeta("area_create_area");
|
||||||
if (area == null) {
|
if (area == null) {
|
||||||
C.COMMAND_SYNTAX.send(plr, "/plot area create [world[:type]] [<modifier>=<value>]...");
|
C.COMMAND_SYNTAX.send(plr, "/plot area create [world[:id]] [<modifier>=<value>]...");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Location pos1 = plr.getLocation();
|
Location pos1 = plr.getLocation();
|
||||||
@ -170,7 +169,7 @@ public class Area extends SubCommand {
|
|||||||
for (int i = 2; i < args.length; i++) {
|
for (int i = 2; i < args.length; i++) {
|
||||||
String[] pair = args[i].split("=");
|
String[] pair = args[i].split("=");
|
||||||
if (pair.length != 2) {
|
if (pair.length != 2) {
|
||||||
C.COMMAND_SYNTAX.send(plr, "/plot area create [world[:type]] [<modifier>=<value>]...");
|
C.COMMAND_SYNTAX.send(plr, "/plot area create [world[:id]] [<modifier>=<value>]...");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
switch (pair[0].toLowerCase()) {
|
switch (pair[0].toLowerCase()) {
|
||||||
@ -225,7 +224,7 @@ public class Area extends SubCommand {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
C.COMMAND_SYNTAX.send(plr, "/plot area create [world[:type]] [<modifier>=<value>]...");
|
C.COMMAND_SYNTAX.send(plr, "/plot area create [world[:id]] [<modifier>=<value>]...");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -264,7 +263,7 @@ public class Area extends SubCommand {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (pa.id == null) {
|
if (pa.id == null) {
|
||||||
C.COMMAND_SYNTAX.send(plr, "/plot area create [world[:type]] [<modifier>=<value>]...");
|
C.COMMAND_SYNTAX.send(plr, "/plot area create [world[:id]] [<modifier>=<value>]...");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (WorldUtil.IMP.isWorld(pa.worldname)) {
|
if (WorldUtil.IMP.isWorld(pa.worldname)) {
|
||||||
|
@ -20,6 +20,8 @@
|
|||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
package com.intellectualcrafters.plot.commands;
|
package com.intellectualcrafters.plot.commands;
|
||||||
|
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.config.C;
|
import com.intellectualcrafters.plot.config.C;
|
||||||
import com.intellectualcrafters.plot.config.Settings;
|
import com.intellectualcrafters.plot.config.Settings;
|
||||||
import com.intellectualcrafters.plot.flag.FlagManager;
|
import com.intellectualcrafters.plot.flag.FlagManager;
|
||||||
@ -33,10 +35,8 @@ import com.intellectualcrafters.plot.util.SetQueue;
|
|||||||
import com.intellectualcrafters.plot.util.TaskManager;
|
import com.intellectualcrafters.plot.util.TaskManager;
|
||||||
import com.plotsquared.general.commands.CommandDeclaration;
|
import com.plotsquared.general.commands.CommandDeclaration;
|
||||||
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
@CommandDeclaration(command = "clear", description = "Clear a plot", permission = "plots.clear", category = CommandCategory.APPEARANCE,
|
@CommandDeclaration(command = "clear", description = "Clear a plot", permission = "plots.clear", category = CommandCategory.APPEARANCE,
|
||||||
usage = "/plot clear [type]")
|
usage = "/plot clear [id]")
|
||||||
public class Clear extends SubCommand {
|
public class Clear extends SubCommand {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -20,6 +20,11 @@
|
|||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
package com.intellectualcrafters.plot.commands;
|
package com.intellectualcrafters.plot.commands;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.PS;
|
import com.intellectualcrafters.plot.PS;
|
||||||
import com.intellectualcrafters.plot.config.C;
|
import com.intellectualcrafters.plot.config.C;
|
||||||
import com.intellectualcrafters.plot.config.Settings;
|
import com.intellectualcrafters.plot.config.Settings;
|
||||||
@ -38,11 +43,6 @@ import com.intellectualcrafters.plot.util.Permissions;
|
|||||||
import com.intellectualcrafters.plot.util.UUIDHandler;
|
import com.intellectualcrafters.plot.util.UUIDHandler;
|
||||||
import com.plotsquared.general.commands.CommandDeclaration;
|
import com.plotsquared.general.commands.CommandDeclaration;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.Set;
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
@CommandDeclaration(
|
@CommandDeclaration(
|
||||||
command = "cluster",
|
command = "cluster",
|
||||||
aliases = { "clusters" },
|
aliases = { "clusters" },
|
||||||
@ -103,7 +103,7 @@ public class Cluster extends SubCommand {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (args.length != 4) {
|
if (args.length != 4) {
|
||||||
MainUtil.sendMessage(plr, C.COMMAND_SYNTAX, "/plot cluster create <name> <type-bot> <type-top>");
|
MainUtil.sendMessage(plr, C.COMMAND_SYNTAX, "/plot cluster create <name> <id-bot> <id-top>");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// check pos1 / pos2
|
// check pos1 / pos2
|
||||||
|
@ -1,5 +1,11 @@
|
|||||||
package com.intellectualcrafters.plot.commands;
|
package com.intellectualcrafters.plot.commands;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.PS;
|
import com.intellectualcrafters.plot.PS;
|
||||||
import com.intellectualcrafters.plot.database.DBFunc;
|
import com.intellectualcrafters.plot.database.DBFunc;
|
||||||
import com.intellectualcrafters.plot.database.MySQL;
|
import com.intellectualcrafters.plot.database.MySQL;
|
||||||
@ -13,12 +19,6 @@ import com.intellectualcrafters.plot.util.MainUtil;
|
|||||||
import com.intellectualcrafters.plot.util.TaskManager;
|
import com.intellectualcrafters.plot.util.TaskManager;
|
||||||
import com.plotsquared.general.commands.CommandDeclaration;
|
import com.plotsquared.general.commands.CommandDeclaration;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map.Entry;
|
|
||||||
|
|
||||||
@CommandDeclaration(
|
@CommandDeclaration(
|
||||||
command = "database",
|
command = "database",
|
||||||
aliases = { "convert" },
|
aliases = { "convert" },
|
||||||
@ -101,7 +101,7 @@ public class Database extends SubCommand {
|
|||||||
for (final Entry<PlotId, Plot> entry2 : entry.getValue().entrySet()) {
|
for (final Entry<PlotId, Plot> entry2 : entry.getValue().entrySet()) {
|
||||||
final Plot plot = entry2.getValue();
|
final Plot plot = entry2.getValue();
|
||||||
if (pa.getOwnedPlotAbs(plot.getId()) != null) {
|
if (pa.getOwnedPlotAbs(plot.getId()) != null) {
|
||||||
MainUtil.sendMessage(player, "Skipping duplicate plot: " + plot + " | type=" + plot.temp);
|
MainUtil.sendMessage(player, "Skipping duplicate plot: " + plot + " | id=" + plot.temp);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
PS.get().updatePlot(plot);
|
PS.get().updatePlot(plot);
|
||||||
|
@ -20,6 +20,26 @@
|
|||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
package com.intellectualcrafters.plot.commands;
|
package com.intellectualcrafters.plot.commands;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileNotFoundException;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.PrintWriter;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
|
import java.sql.Timestamp;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import javax.script.Bindings;
|
||||||
|
import javax.script.ScriptContext;
|
||||||
|
import javax.script.ScriptEngine;
|
||||||
|
import javax.script.ScriptEngineManager;
|
||||||
|
import javax.script.ScriptException;
|
||||||
|
import javax.script.SimpleScriptContext;
|
||||||
|
|
||||||
import com.google.common.io.Files;
|
import com.google.common.io.Files;
|
||||||
import com.intellectualcrafters.plot.PS;
|
import com.intellectualcrafters.plot.PS;
|
||||||
import com.intellectualcrafters.plot.config.C;
|
import com.intellectualcrafters.plot.config.C;
|
||||||
@ -54,26 +74,6 @@ import com.intellectualcrafters.plot.util.WorldUtil;
|
|||||||
import com.plotsquared.general.commands.Command;
|
import com.plotsquared.general.commands.Command;
|
||||||
import com.plotsquared.general.commands.CommandDeclaration;
|
import com.plotsquared.general.commands.CommandDeclaration;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.FileNotFoundException;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.PrintWriter;
|
|
||||||
import java.nio.charset.StandardCharsets;
|
|
||||||
import java.sql.Timestamp;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
import javax.script.Bindings;
|
|
||||||
import javax.script.ScriptContext;
|
|
||||||
import javax.script.ScriptEngine;
|
|
||||||
import javax.script.ScriptEngineManager;
|
|
||||||
import javax.script.ScriptException;
|
|
||||||
import javax.script.SimpleScriptContext;
|
|
||||||
|
|
||||||
@CommandDeclaration(command = "debugexec", permission = "plots.admin", description = "Mutli-purpose debug command", aliases = "exec",
|
@CommandDeclaration(command = "debugexec", permission = "plots.admin", description = "Mutli-purpose debug command", aliases = "exec",
|
||||||
category = CommandCategory.DEBUG)
|
category = CommandCategory.DEBUG)
|
||||||
public class DebugExec extends SubCommand {
|
public class DebugExec extends SubCommand {
|
||||||
@ -83,19 +83,20 @@ public class DebugExec extends SubCommand {
|
|||||||
|
|
||||||
public DebugExec() {
|
public DebugExec() {
|
||||||
try {
|
try {
|
||||||
final File file = new File(PS.get().IMP.getDirectory(), "scripts" + File.separator + "start.js");
|
if (PS.get() != null) {
|
||||||
if (file.exists()) {
|
final File file = new File(PS.get().IMP.getDirectory(), "scripts" + File.separator + "start.js");
|
||||||
init();
|
if (file.exists()) {
|
||||||
final String script = StringMan.join(Files
|
init();
|
||||||
.readLines(new File(new File(PS.get().IMP.getDirectory() + File.separator + "scripts"), "start.js"),
|
final String script = StringMan.join(Files
|
||||||
StandardCharsets.UTF_8),
|
.readLines(new File(new File(PS.get().IMP.getDirectory() + File.separator + "scripts"), "start.js"),
|
||||||
System.getProperty("line.separator"));
|
StandardCharsets.UTF_8),
|
||||||
scope.put("THIS", this);
|
System.getProperty("line.separator"));
|
||||||
scope.put("PlotPlayer", ConsolePlayer.getConsole());
|
scope.put("THIS", this);
|
||||||
engine.eval(script, scope);
|
scope.put("PlotPlayer", ConsolePlayer.getConsole());
|
||||||
|
engine.eval(script, scope);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch (IOException | ScriptException e) {
|
} catch (IOException | ScriptException e) {}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ScriptEngine getEngine() {
|
public ScriptEngine getEngine() {
|
||||||
|
@ -1,10 +1,5 @@
|
|||||||
package com.intellectualcrafters.plot.commands;
|
package com.intellectualcrafters.plot.commands;
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.config.C;
|
|
||||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
|
||||||
import com.intellectualcrafters.plot.util.StringMan;
|
|
||||||
import com.plotsquared.general.commands.Command;
|
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
@ -16,6 +11,11 @@ import java.util.Set;
|
|||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
import com.intellectualcrafters.plot.config.C;
|
||||||
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
|
import com.intellectualcrafters.plot.util.StringMan;
|
||||||
|
import com.plotsquared.general.commands.Command;
|
||||||
|
|
||||||
public class GenerateDocs {
|
public class GenerateDocs {
|
||||||
public static void main(final String[] args) {
|
public static void main(final String[] args) {
|
||||||
MainCommand.getInstance().addCommand(new WE_Anywhere());
|
MainCommand.getInstance().addCommand(new WE_Anywhere());
|
||||||
@ -52,6 +52,7 @@ public class GenerateDocs {
|
|||||||
final File file = new File("src/main/java/com/intellectualcrafters/plot/commands/" + clazz + ".java");
|
final File file = new File("src/main/java/com/intellectualcrafters/plot/commands/" + clazz + ".java");
|
||||||
final List<String> lines = Files.readAllLines(file.toPath(), StandardCharsets.UTF_8);
|
final List<String> lines = Files.readAllLines(file.toPath(), StandardCharsets.UTF_8);
|
||||||
final List<String> perms = getPerms(name, lines);
|
final List<String> perms = getPerms(name, lines);
|
||||||
|
final List<String> usages = getUsage(name, lines);
|
||||||
final String comment = getComments(lines);
|
final String comment = getComments(lines);
|
||||||
|
|
||||||
log("#### Description");
|
log("#### Description");
|
||||||
@ -63,8 +64,20 @@ public class GenerateDocs {
|
|||||||
log("```");
|
log("```");
|
||||||
}
|
}
|
||||||
|
|
||||||
log("#### Usage");
|
log("#### Usage ");
|
||||||
log("`" + command.getUsage().replaceAll("\\{label\\}", "plot") + "`");
|
{
|
||||||
|
String mainUsage = command.getUsage().replaceAll("\\{label\\}", "plot");
|
||||||
|
if (!usages.isEmpty() && !usages.get(0).equalsIgnoreCase(mainUsage)) {
|
||||||
|
log("##### Primary ");
|
||||||
|
log(" - `" + mainUsage + "` ");
|
||||||
|
log("");
|
||||||
|
log("##### Other ");
|
||||||
|
log(" - `" + StringMan.join(usages, "`\n - `") + "` ");
|
||||||
|
log("");
|
||||||
|
} else {
|
||||||
|
log("`" + mainUsage + "` ");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (command.getRequiredType() != RequiredType.NONE) {
|
if (command.getRequiredType() != RequiredType.NONE) {
|
||||||
log("#### Required callers");
|
log("#### Required callers");
|
||||||
@ -78,14 +91,16 @@ public class GenerateDocs {
|
|||||||
}
|
}
|
||||||
|
|
||||||
log("#### Permissions");
|
log("#### Permissions");
|
||||||
log("##### Primary");
|
|
||||||
log(" - `" + command.getPermission() + "` ");
|
|
||||||
if (!perms.isEmpty()) {
|
if (!perms.isEmpty()) {
|
||||||
|
log("##### Primary");
|
||||||
|
log(" - `" + command.getPermission() + "` ");
|
||||||
log("");
|
log("");
|
||||||
log("##### Other");
|
log("##### Other");
|
||||||
log(" - `" + StringMan.join(perms, "`\n - `") + "`");
|
log(" - `" + StringMan.join(perms, "`\n - `") + "`");
|
||||||
|
log("");
|
||||||
|
} else {
|
||||||
|
log("`" + command.getPermission() + "` ");
|
||||||
}
|
}
|
||||||
log("");
|
|
||||||
log("***");
|
log("***");
|
||||||
log("");
|
log("");
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
@ -93,6 +108,27 @@ public class GenerateDocs {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static List<String> getUsage(String cmd, List<String> lines) {
|
||||||
|
final Pattern p = Pattern.compile("\"([^\"]*)\"");
|
||||||
|
HashSet<String> usages = new HashSet<String>();
|
||||||
|
for (final String line : lines) {
|
||||||
|
if (line.contains("COMMAND_SYNTAX") && !line.contains("getUsage()")) {
|
||||||
|
final Matcher m = p.matcher(line);
|
||||||
|
String prefix = "";
|
||||||
|
StringBuilder usage = new StringBuilder();
|
||||||
|
while (m.find()) {
|
||||||
|
String match = m.group(1);
|
||||||
|
usage.append(prefix).append(match);
|
||||||
|
prefix = " <arg> ";
|
||||||
|
}
|
||||||
|
if (usage.length() != 0) {
|
||||||
|
usages.add(usage.toString().trim().replaceAll(" ", " ").replaceAll("\\{label\\}", "plot"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return new ArrayList<>(usages);
|
||||||
|
}
|
||||||
|
|
||||||
public static List<String> getPerms(final String cmd, final List<String> lines) {
|
public static List<String> getPerms(final String cmd, final List<String> lines) {
|
||||||
final HashSet<String> perms = new HashSet<String>();
|
final HashSet<String> perms = new HashSet<String>();
|
||||||
final Pattern p = Pattern.compile("\"([^\"]*)\"");
|
final Pattern p = Pattern.compile("\"([^\"]*)\"");
|
||||||
@ -104,7 +140,6 @@ public class GenerateDocs {
|
|||||||
while (m2.find()) {
|
while (m2.find()) {
|
||||||
perms.add(C.valueOf("PERMISSION_" + m2.group(1)).s());
|
perms.add(C.valueOf("PERMISSION_" + m2.group(1)).s());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (line.contains("Permissions.hasPermission(")) {
|
if (line.contains("Permissions.hasPermission(")) {
|
||||||
String[] split = line.split("Permissions.hasPermission");
|
String[] split = line.split("Permissions.hasPermission");
|
||||||
split = Arrays.copyOfRange(split, 1, split.length);
|
split = Arrays.copyOfRange(split, 1, split.length);
|
||||||
|
@ -23,7 +23,7 @@ package com.intellectualcrafters.plot.commands;
|
|||||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
import com.plotsquared.general.commands.CommandDeclaration;
|
import com.plotsquared.general.commands.CommandDeclaration;
|
||||||
|
|
||||||
@CommandDeclaration(command = "home", aliases = {"h"}, description = "Go to your plot", usage = "/plot home [type|alias]",
|
@CommandDeclaration(command = "home", aliases = { "h" }, description = "Go to your plot", usage = "/plot home [id|alias]",
|
||||||
category = CommandCategory.TELEPORT, requiredType = RequiredType.NONE)
|
category = CommandCategory.TELEPORT, requiredType = RequiredType.NONE)
|
||||||
public class Home extends SubCommand {
|
public class Home extends SubCommand {
|
||||||
|
|
||||||
|
@ -20,6 +20,8 @@
|
|||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
package com.intellectualcrafters.plot.commands;
|
package com.intellectualcrafters.plot.commands;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.config.C;
|
import com.intellectualcrafters.plot.config.C;
|
||||||
import com.intellectualcrafters.plot.database.DBFunc;
|
import com.intellectualcrafters.plot.database.DBFunc;
|
||||||
import com.intellectualcrafters.plot.object.Plot;
|
import com.intellectualcrafters.plot.object.Plot;
|
||||||
@ -30,9 +32,7 @@ import com.intellectualcrafters.plot.object.RunnableVal;
|
|||||||
import com.intellectualcrafters.plot.util.MainUtil;
|
import com.intellectualcrafters.plot.util.MainUtil;
|
||||||
import com.plotsquared.general.commands.CommandDeclaration;
|
import com.plotsquared.general.commands.CommandDeclaration;
|
||||||
|
|
||||||
import java.util.UUID;
|
@CommandDeclaration(command = "info", aliases = { "i" }, description = "Display plot info", usage = "/plot info <id>",
|
||||||
|
|
||||||
@CommandDeclaration(command = "info", aliases = {"i"}, description = "Display plot info", usage = "/plot info <type>",
|
|
||||||
category = CommandCategory.INFO)
|
category = CommandCategory.INFO)
|
||||||
public class Info extends SubCommand {
|
public class Info extends SubCommand {
|
||||||
|
|
||||||
@ -49,7 +49,7 @@ public class Info extends SubCommand {
|
|||||||
case "biome":
|
case "biome":
|
||||||
case "denied":
|
case "denied":
|
||||||
case "flags":
|
case "flags":
|
||||||
case "type":
|
case "id":
|
||||||
case "size":
|
case "size":
|
||||||
case "members":
|
case "members":
|
||||||
case "owner":
|
case "owner":
|
||||||
@ -157,7 +157,7 @@ public class Info extends SubCommand {
|
|||||||
return C.PLOT_INFO_DENIED.s();
|
return C.PLOT_INFO_DENIED.s();
|
||||||
case "flags":
|
case "flags":
|
||||||
return C.PLOT_INFO_FLAGS.s();
|
return C.PLOT_INFO_FLAGS.s();
|
||||||
case "type":
|
case "id":
|
||||||
return C.PLOT_INFO_ID.s();
|
return C.PLOT_INFO_ID.s();
|
||||||
case "size":
|
case "size":
|
||||||
return C.PLOT_INFO_SIZE.s();
|
return C.PLOT_INFO_SIZE.s();
|
||||||
|
@ -20,6 +20,12 @@
|
|||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
package com.intellectualcrafters.plot.commands;
|
package com.intellectualcrafters.plot.commands;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Map.Entry;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.PS;
|
import com.intellectualcrafters.plot.PS;
|
||||||
import com.intellectualcrafters.plot.config.C;
|
import com.intellectualcrafters.plot.config.C;
|
||||||
import com.intellectualcrafters.plot.database.DBFunc;
|
import com.intellectualcrafters.plot.database.DBFunc;
|
||||||
@ -32,14 +38,8 @@ import com.intellectualcrafters.plot.util.StringMan;
|
|||||||
import com.intellectualcrafters.plot.util.UUIDHandler;
|
import com.intellectualcrafters.plot.util.UUIDHandler;
|
||||||
import com.plotsquared.general.commands.CommandDeclaration;
|
import com.plotsquared.general.commands.CommandDeclaration;
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.Map.Entry;
|
|
||||||
import java.util.Set;
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
@CommandDeclaration(
|
@CommandDeclaration(
|
||||||
usage = "/plot purge world:<world> area:<area> type:<type> owner:<owner> shared:<shared> unknown:[true|false]",
|
usage = "/plot purge world:<world> area:<area> id:<id> owner:<owner> shared:<shared> unknown:[true|false]",
|
||||||
command = "purge",
|
command = "purge",
|
||||||
permission = "plots.admin",
|
permission = "plots.admin",
|
||||||
description = "Purge all plots for a world",
|
description = "Purge all plots for a world",
|
||||||
@ -80,7 +80,7 @@ public class Purge extends SubCommand {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case "plotid":
|
case "plotid":
|
||||||
case "type": {
|
case "id": {
|
||||||
id = PlotId.fromString(split[1]);
|
id = PlotId.fromString(split[1]);
|
||||||
if (id == null) {
|
if (id == null) {
|
||||||
C.NOT_VALID_PLOT_ID.send(plr, split[1]);
|
C.NOT_VALID_PLOT_ID.send(plr, split[1]);
|
||||||
|
@ -20,6 +20,11 @@
|
|||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
package com.intellectualcrafters.plot.commands;
|
package com.intellectualcrafters.plot.commands;
|
||||||
|
|
||||||
|
import java.net.URL;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.PS;
|
import com.intellectualcrafters.plot.PS;
|
||||||
import com.intellectualcrafters.plot.config.C;
|
import com.intellectualcrafters.plot.config.C;
|
||||||
import com.intellectualcrafters.plot.config.Settings;
|
import com.intellectualcrafters.plot.config.Settings;
|
||||||
@ -36,11 +41,6 @@ import com.intellectualcrafters.plot.util.SchematicHandler.Schematic;
|
|||||||
import com.intellectualcrafters.plot.util.TaskManager;
|
import com.intellectualcrafters.plot.util.TaskManager;
|
||||||
import com.plotsquared.general.commands.CommandDeclaration;
|
import com.plotsquared.general.commands.CommandDeclaration;
|
||||||
|
|
||||||
import java.net.URL;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
@CommandDeclaration(
|
@CommandDeclaration(
|
||||||
command = "schematic",
|
command = "schematic",
|
||||||
permission = "plots.schematic",
|
permission = "plots.schematic",
|
||||||
@ -153,7 +153,7 @@ public class SchematicCmd extends SubCommand {
|
|||||||
// }
|
// }
|
||||||
// final int l1 = schematic.getSchematicDimension().getX();
|
// final int l1 = schematic.getSchematicDimension().getX();
|
||||||
// final int l2 = schematic.getSchematicDimension().getZ();
|
// final int l2 = schematic.getSchematicDimension().getZ();
|
||||||
// final int length = MainUtil.getPlotWidth(loc.getWorld(), plot.type);
|
// final int length = MainUtil.getPlotWidth(loc.getWorld(), plot.id);
|
||||||
// if ((l1 < length) || (l2 < length)) {
|
// if ((l1 < length) || (l2 < length)) {
|
||||||
// sendMessage(plr, C.SCHEMATIC_INVALID, String.format("Wrong size (x: %s, z: %d) vs %d ", l1, l2, length));
|
// sendMessage(plr, C.SCHEMATIC_INVALID, String.format("Wrong size (x: %s, z: %d) vs %d ", l1, l2, length));
|
||||||
// break;
|
// break;
|
||||||
|
@ -20,6 +20,11 @@
|
|||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
package com.intellectualcrafters.plot.commands;
|
package com.intellectualcrafters.plot.commands;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.PS;
|
import com.intellectualcrafters.plot.PS;
|
||||||
import com.intellectualcrafters.plot.config.C;
|
import com.intellectualcrafters.plot.config.C;
|
||||||
import com.intellectualcrafters.plot.config.ConfigurationNode;
|
import com.intellectualcrafters.plot.config.ConfigurationNode;
|
||||||
@ -34,11 +39,6 @@ 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.util.ArrayList;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map.Entry;
|
|
||||||
|
|
||||||
@CommandDeclaration(
|
@CommandDeclaration(
|
||||||
command = "setup",
|
command = "setup",
|
||||||
permission = "plots.admin.command.setup",
|
permission = "plots.admin.command.setup",
|
||||||
@ -172,14 +172,14 @@ public class Setup extends SubCommand {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 2: { // area type
|
case 2: { // area id
|
||||||
if (!StringMan.isAlphanumericUnd(args[0])) {
|
if (!StringMan.isAlphanumericUnd(args[0])) {
|
||||||
MainUtil.sendMessage(plr, "&cThe area type must be alphanumerical!");
|
MainUtil.sendMessage(plr, "&cThe area id must be alphanumerical!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
for (PlotArea area : PS.get().getPlotAreas()) {
|
for (PlotArea area : PS.get().getPlotAreas()) {
|
||||||
if (area.id != null && area.id.equalsIgnoreCase(args[0])) {
|
if (area.id != null && area.id.equalsIgnoreCase(args[0])) {
|
||||||
MainUtil.sendMessage(plr, "&cYou must choose an area type that is not in use!");
|
MainUtil.sendMessage(plr, "&cYou must choose an area id that is not in use!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,6 +20,16 @@
|
|||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
package com.intellectualcrafters.plot.commands;
|
package com.intellectualcrafters.plot.commands;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileInputStream;
|
||||||
|
import java.io.FileNotFoundException;
|
||||||
|
import java.io.FileOutputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.zip.ZipEntry;
|
||||||
|
import java.util.zip.ZipInputStream;
|
||||||
|
import java.util.zip.ZipOutputStream;
|
||||||
|
|
||||||
import com.intellectualcrafters.configuration.ConfigurationSection;
|
import com.intellectualcrafters.configuration.ConfigurationSection;
|
||||||
import com.intellectualcrafters.configuration.file.YamlConfiguration;
|
import com.intellectualcrafters.configuration.file.YamlConfiguration;
|
||||||
import com.intellectualcrafters.plot.PS;
|
import com.intellectualcrafters.plot.PS;
|
||||||
@ -37,16 +47,6 @@ import com.intellectualcrafters.plot.util.TaskManager;
|
|||||||
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.File;
|
|
||||||
import java.io.FileInputStream;
|
|
||||||
import java.io.FileNotFoundException;
|
|
||||||
import java.io.FileOutputStream;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.Set;
|
|
||||||
import java.util.zip.ZipEntry;
|
|
||||||
import java.util.zip.ZipInputStream;
|
|
||||||
import java.util.zip.ZipOutputStream;
|
|
||||||
|
|
||||||
@CommandDeclaration(
|
@CommandDeclaration(
|
||||||
command = "template",
|
command = "template",
|
||||||
permission = "plots.admin",
|
permission = "plots.admin",
|
||||||
@ -206,7 +206,7 @@ public class Template extends SubCommand {
|
|||||||
public void run() {
|
public void run() {
|
||||||
try {
|
try {
|
||||||
manager.exportTemplate(area);
|
manager.exportTemplate(area);
|
||||||
} catch (IOException e) {
|
} catch (Exception e) { // Must recover from any exception thrown a third party template manager
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
MainUtil.sendMessage(plr, "Failed: " + e.getMessage());
|
MainUtil.sendMessage(plr, "Failed: " + e.getMessage());
|
||||||
return;
|
return;
|
||||||
|
@ -20,6 +20,14 @@
|
|||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
package com.intellectualcrafters.plot.commands;
|
package com.intellectualcrafters.plot.commands;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.PS;
|
import com.intellectualcrafters.plot.PS;
|
||||||
import com.intellectualcrafters.plot.config.C;
|
import com.intellectualcrafters.plot.config.C;
|
||||||
import com.intellectualcrafters.plot.object.Plot;
|
import com.intellectualcrafters.plot.object.Plot;
|
||||||
@ -31,19 +39,11 @@ import com.intellectualcrafters.plot.util.UUIDHandler;
|
|||||||
import com.plotsquared.general.commands.Argument;
|
import com.plotsquared.general.commands.Argument;
|
||||||
import com.plotsquared.general.commands.CommandDeclaration;
|
import com.plotsquared.general.commands.CommandDeclaration;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
@CommandDeclaration(
|
@CommandDeclaration(
|
||||||
command = "visit",
|
command = "visit",
|
||||||
permission = "plots.visit",
|
permission = "plots.visit",
|
||||||
description = "Visit someones plot",
|
description = "Visit someones plot",
|
||||||
usage = "/plot visit [player|alias|world|type] [#]",
|
usage = "/plot visit [player|alias|world|id] [#]",
|
||||||
aliases = { "v", "tp", "teleport", "goto" },
|
aliases = { "v", "tp", "teleport", "goto" },
|
||||||
requiredType = RequiredType.NONE,
|
requiredType = RequiredType.NONE,
|
||||||
category = CommandCategory.TELEPORT)
|
category = CommandCategory.TELEPORT)
|
||||||
|
@ -20,13 +20,6 @@
|
|||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
package com.intellectualcrafters.plot.config;
|
package com.intellectualcrafters.plot.config;
|
||||||
|
|
||||||
import com.intellectualcrafters.configuration.ConfigurationSection;
|
|
||||||
import com.intellectualcrafters.configuration.file.YamlConfiguration;
|
|
||||||
import com.intellectualcrafters.plot.PS;
|
|
||||||
import com.intellectualcrafters.plot.util.MainUtil;
|
|
||||||
import com.intellectualcrafters.plot.util.StringMan;
|
|
||||||
import com.plotsquared.general.commands.CommandCaller;
|
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.EnumSet;
|
import java.util.EnumSet;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@ -35,6 +28,13 @@ import java.util.LinkedHashMap;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
import com.intellectualcrafters.configuration.ConfigurationSection;
|
||||||
|
import com.intellectualcrafters.configuration.file.YamlConfiguration;
|
||||||
|
import com.intellectualcrafters.plot.PS;
|
||||||
|
import com.intellectualcrafters.plot.util.MainUtil;
|
||||||
|
import com.intellectualcrafters.plot.util.StringMan;
|
||||||
|
import com.plotsquared.general.commands.CommandCaller;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Captions class.
|
* Captions class.
|
||||||
*
|
*
|
||||||
@ -150,7 +150,7 @@ public enum C {
|
|||||||
CLUSTER_REMOVED_HELPER("$4Successfully removed a helper from the cluster", "Cluster"),
|
CLUSTER_REMOVED_HELPER("$4Successfully removed a helper from the cluster", "Cluster"),
|
||||||
CLUSTER_REGENERATED("$4Successfully started cluster regeneration", "Cluster"),
|
CLUSTER_REGENERATED("$4Successfully started cluster regeneration", "Cluster"),
|
||||||
CLUSTER_TELEPORTING("$4Teleporting...", "Cluster"),
|
CLUSTER_TELEPORTING("$4Teleporting...", "Cluster"),
|
||||||
CLUSTER_INFO("$1Current cluster: $2%type%&-$1Name: $2%name%&-$1Owner: $2%owner%&-$1Size: $2%size%&-$1Rights: $2%rights%", "Cluster"),
|
CLUSTER_INFO("$1Current cluster: $2%id%&-$1Name: $2%name%&-$1Owner: $2%owner%&-$1Size: $2%size%&-$1Rights: $2%rights%", "Cluster"),
|
||||||
/*
|
/*
|
||||||
* Border
|
* Border
|
||||||
*/
|
*/
|
||||||
@ -187,7 +187,7 @@ public enum C {
|
|||||||
*/
|
*/
|
||||||
SWAP_OVERLAP("$2The proposed areas are not allowed to overlap", "Swap"),
|
SWAP_OVERLAP("$2The proposed areas are not allowed to overlap", "Swap"),
|
||||||
SWAP_DIMENSIONS("$2The proposed areas must have comparable dimensions", "Swap"),
|
SWAP_DIMENSIONS("$2The proposed areas must have comparable dimensions", "Swap"),
|
||||||
SWAP_SYNTAX("$2/plots swap <plot type>", "Swap"),
|
SWAP_SYNTAX("$2/plots swap <id>", "Swap"),
|
||||||
SWAP_SUCCESS("$4Successfully swapped plots", "Swap"),
|
SWAP_SUCCESS("$4Successfully swapped plots", "Swap"),
|
||||||
STARTED_SWAP("$2Started plot swap task. You will be notified when it finishes", "Swap"),
|
STARTED_SWAP("$2Started plot swap task. You will be notified when it finishes", "Swap"),
|
||||||
/*
|
/*
|
||||||
@ -225,7 +225,7 @@ public enum C {
|
|||||||
PASTED("$4The plot selection was successfully pasted. It has been cleared from your clipboard.", "Clipboard"),
|
PASTED("$4The plot selection was successfully pasted. It has been cleared from your clipboard.", "Clipboard"),
|
||||||
PASTE_FAILED("$2Failed to paste the selection. Reason: $2%s", "Clipboard"),
|
PASTE_FAILED("$2Failed to paste the selection. Reason: $2%s", "Clipboard"),
|
||||||
NO_CLIPBOARD("$2You don't have a selection in your clipboard", "Clipboard"),
|
NO_CLIPBOARD("$2You don't have a selection in your clipboard", "Clipboard"),
|
||||||
CLIPBOARD_INFO("$2Current Selection - Plot ID: $1%type$2, Width: $1%width$2, Total Blocks: $1%total$2", "Clipboard"),
|
CLIPBOARD_INFO("$2Current Selection - Plot ID: $1%id$2, Width: $1%width$2, Total Blocks: $1%total$2", "Clipboard"),
|
||||||
/*
|
/*
|
||||||
* Toggle
|
* Toggle
|
||||||
*/
|
*/
|
||||||
@ -298,8 +298,8 @@ public enum C {
|
|||||||
*/
|
*/
|
||||||
TITLE_ENTERED_PLOT("$1Plot: %world%;%x%;%z%", "Titles"),
|
TITLE_ENTERED_PLOT("$1Plot: %world%;%x%;%z%", "Titles"),
|
||||||
TITLE_ENTERED_PLOT_SUB("$4Owned by %s", "Titles"),
|
TITLE_ENTERED_PLOT_SUB("$4Owned by %s", "Titles"),
|
||||||
PREFIX_GREETING("$1%type%$2> ", "Titles"),
|
PREFIX_GREETING("$1%id%$2> ", "Titles"),
|
||||||
PREFIX_FAREWELL("$1%type%$2> ", "Titles"),
|
PREFIX_FAREWELL("$1%id%$2> ", "Titles"),
|
||||||
/*
|
/*
|
||||||
* Core Stuff
|
* Core Stuff
|
||||||
*/
|
*/
|
||||||
@ -315,7 +315,6 @@ public enum C {
|
|||||||
/*
|
/*
|
||||||
* BarAPI
|
* BarAPI
|
||||||
*/
|
*/
|
||||||
BOSSBAR_CLEARING("$2Clearing plot: $1%type%", "Bar API"),
|
|
||||||
|
|
||||||
DESC_SET("$2Plot description set", "Desc"),
|
DESC_SET("$2Plot description set", "Desc"),
|
||||||
DESC_UNSET("$2Plot description unset", "Desc"),
|
DESC_UNSET("$2Plot description unset", "Desc"),
|
||||||
@ -443,12 +442,12 @@ public enum C {
|
|||||||
/*
|
/*
|
||||||
* Invalid
|
* Invalid
|
||||||
*/
|
*/
|
||||||
NOT_VALID_DATA("$2That's not a valid data type.", "Invalid"),
|
NOT_VALID_DATA("$2That's not a valid data id.", "Invalid"),
|
||||||
NOT_VALID_BLOCK("$2That's not a valid block: %s", "Invalid"),
|
NOT_VALID_BLOCK("$2That's not a valid block: %s", "Invalid"),
|
||||||
NOT_ALLOWED_BLOCK("$2That block is not allowed: %s", "Invalid"),
|
NOT_ALLOWED_BLOCK("$2That block is not allowed: %s", "Invalid"),
|
||||||
NOT_VALID_NUMBER("$2That's not a valid number within the range: %s", "Invalid"),
|
NOT_VALID_NUMBER("$2That's not a valid number within the range: %s", "Invalid"),
|
||||||
NOT_VALID_PLOT_ID("$2That's not a valid plot type.", "Invalid"),
|
NOT_VALID_PLOT_ID("$2That's not a valid plot id.", "Invalid"),
|
||||||
PLOT_ID_FORM("$2The plot type must be in the form: $1X;Y $2e.g. $1-5;7", "Invalid"),
|
PLOT_ID_FORM("$2The plot id must be in the form: $1X;Y $2e.g. $1-5;7", "Invalid"),
|
||||||
NOT_YOUR_PLOT("$2That is not your plot.", "Invalid"),
|
NOT_YOUR_PLOT("$2That is not your plot.", "Invalid"),
|
||||||
NO_SUCH_PLOT("$2There is no such plot", "Invalid"),
|
NO_SUCH_PLOT("$2There is no such plot", "Invalid"),
|
||||||
PLAYER_HAS_NOT_BEEN_ON("$2That player hasn't been in the plotworld", "Invalid"),
|
PLAYER_HAS_NOT_BEEN_ON("$2That player hasn't been in the plotworld", "Invalid"),
|
||||||
@ -463,7 +462,7 @@ public enum C {
|
|||||||
*/
|
*/
|
||||||
NEED_PLOT_NUMBER("$2You've got to specify a plot number or alias", "Need"),
|
NEED_PLOT_NUMBER("$2You've got to specify a plot number or alias", "Need"),
|
||||||
NEED_BLOCK("$2You've got to specify a block", "Need"),
|
NEED_BLOCK("$2You've got to specify a block", "Need"),
|
||||||
NEED_PLOT_ID("$2You've got to specify a plot type.", "Need"),
|
NEED_PLOT_ID("$2You've got to specify a plot id.", "Need"),
|
||||||
NEED_PLOT_WORLD("$2You've got to specify a plot area.", "Need"),
|
NEED_PLOT_WORLD("$2You've got to specify a plot area.", "Need"),
|
||||||
NEED_USER("$2You need to specify a username", "Need"),
|
NEED_USER("$2You need to specify a username", "Need"),
|
||||||
/*
|
/*
|
||||||
@ -475,7 +474,7 @@ public enum C {
|
|||||||
PLOT_UNOWNED("$2The current plot must have an owner to perform this action", "Info"),
|
PLOT_UNOWNED("$2The current plot must have an owner to perform this action", "Info"),
|
||||||
PLOT_INFO_UNCLAIMED("$2Plot $1%s$2 is not yet claimed", "Info"),
|
PLOT_INFO_UNCLAIMED("$2Plot $1%s$2 is not yet claimed", "Info"),
|
||||||
PLOT_INFO_HEADER("$3&m---------&r $1INFO $3&m---------", false, "Info"),
|
PLOT_INFO_HEADER("$3&m---------&r $1INFO $3&m---------", false, "Info"),
|
||||||
PLOT_INFO("$1ID: $2%type%$1&-"
|
PLOT_INFO("$1ID: $2%id%$1&-"
|
||||||
+ "$1Alias: $2%alias%$1&-"
|
+ "$1Alias: $2%alias%$1&-"
|
||||||
+ "$1Owner: $2%owner%$1&-"
|
+ "$1Owner: $2%owner%$1&-"
|
||||||
+ "$1Biome: $2%biome%$1&-"
|
+ "$1Biome: $2%biome%$1&-"
|
||||||
@ -493,7 +492,7 @@ public enum C {
|
|||||||
PLOT_INFO_BIOME("$1Biome:$2 %biome%", "Info"),
|
PLOT_INFO_BIOME("$1Biome:$2 %biome%", "Info"),
|
||||||
PLOT_INFO_RATING("$1Rating:$2 %rating%", "Info"),
|
PLOT_INFO_RATING("$1Rating:$2 %rating%", "Info"),
|
||||||
PLOT_INFO_OWNER("$1Owner:$2 %owner%", "Info"),
|
PLOT_INFO_OWNER("$1Owner:$2 %owner%", "Info"),
|
||||||
PLOT_INFO_ID("$1ID:$2 %type%", "Info"),
|
PLOT_INFO_ID("$1ID:$2 %id%", "Info"),
|
||||||
PLOT_INFO_ALIAS("$1Alias:$2 %alias%", "Info"),
|
PLOT_INFO_ALIAS("$1Alias:$2 %alias%", "Info"),
|
||||||
PLOT_INFO_SIZE("$1Size:$2 %size%", "Info"),
|
PLOT_INFO_SIZE("$1Size:$2 %size%", "Info"),
|
||||||
PLOT_USER_LIST(" $1%user%$2,", "Info"),
|
PLOT_USER_LIST(" $1%user%$2,", "Info"),
|
||||||
@ -521,8 +520,8 @@ public enum C {
|
|||||||
AREA_LIST_HEADER_PAGED("$2(Page $1%cur$2/$1%max$2) $1List of %amount% areas", "List"),
|
AREA_LIST_HEADER_PAGED("$2(Page $1%cur$2/$1%max$2) $1List of %amount% areas", "List"),
|
||||||
PLOT_LIST_HEADER_PAGED("$2(Page $1%cur$2/$1%max$2) $1List of %amount% plots", "List"),
|
PLOT_LIST_HEADER_PAGED("$2(Page $1%cur$2/$1%max$2) $1List of %amount% plots", "List"),
|
||||||
PLOT_LIST_HEADER("$1List of %word% plots", "List"),
|
PLOT_LIST_HEADER("$1List of %word% plots", "List"),
|
||||||
PLOT_LIST_ITEM("$2>> $1%type$2:$1%world $2- $1%owner", "List"),
|
PLOT_LIST_ITEM("$2>> $1%id$2:$1%world $2- $1%owner", "List"),
|
||||||
PLOT_LIST_ITEM_ORDERED("$2[$1%in$2] >> $1%type$2:$1%world $2- $1%owner", "List"),
|
PLOT_LIST_ITEM_ORDERED("$2[$1%in$2] >> $1%id$2:$1%world $2- $1%owner", "List"),
|
||||||
PLOT_LIST_FOOTER("$2>> $1%word% a total of $2%num% $1claimed %plot%.", "List"),
|
PLOT_LIST_FOOTER("$2>> $1%word% a total of $2%num% $1claimed %plot%.", "List"),
|
||||||
/*
|
/*
|
||||||
* Left
|
* Left
|
||||||
@ -595,7 +594,7 @@ public enum C {
|
|||||||
/*
|
/*
|
||||||
* Signs
|
* Signs
|
||||||
*/
|
*/
|
||||||
OWNER_SIGN_LINE_1("$1ID: $1%type%", "Signs"),
|
OWNER_SIGN_LINE_1("$1ID: $1%id%", "Signs"),
|
||||||
OWNER_SIGN_LINE_2("$1Owner:", "Signs"),
|
OWNER_SIGN_LINE_2("$1Owner:", "Signs"),
|
||||||
OWNER_SIGN_LINE_3("$2%plr%", "Signs"),
|
OWNER_SIGN_LINE_3("$2%plr%", "Signs"),
|
||||||
OWNER_SIGN_LINE_4("$3Claimed", "Signs"),
|
OWNER_SIGN_LINE_4("$3Claimed", "Signs"),
|
||||||
|
@ -20,15 +20,6 @@
|
|||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
package com.intellectualcrafters.plot.database;
|
package com.intellectualcrafters.plot.database;
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.flag.Flag;
|
|
||||||
import com.intellectualcrafters.plot.object.Plot;
|
|
||||||
import com.intellectualcrafters.plot.object.PlotArea;
|
|
||||||
import com.intellectualcrafters.plot.object.PlotCluster;
|
|
||||||
import com.intellectualcrafters.plot.object.PlotId;
|
|
||||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
|
||||||
import com.intellectualcrafters.plot.object.RunnableVal;
|
|
||||||
import com.intellectualcrafters.plot.object.comment.PlotComment;
|
|
||||||
|
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
@ -38,6 +29,15 @@ import java.util.Map;
|
|||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import com.intellectualcrafters.plot.flag.Flag;
|
||||||
|
import com.intellectualcrafters.plot.object.Plot;
|
||||||
|
import com.intellectualcrafters.plot.object.PlotArea;
|
||||||
|
import com.intellectualcrafters.plot.object.PlotCluster;
|
||||||
|
import com.intellectualcrafters.plot.object.PlotId;
|
||||||
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
|
import com.intellectualcrafters.plot.object.RunnableVal;
|
||||||
|
import com.intellectualcrafters.plot.object.comment.PlotComment;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
||||||
|
|
||||||
@ -123,7 +123,7 @@ public interface AbstractDB {
|
|||||||
int getId(final Plot plot);
|
int getId(final Plot plot);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the type of a given plot cluster
|
* Get the id of a given plot cluster
|
||||||
*
|
*
|
||||||
* @param cluster PlotCluster Object
|
* @param cluster PlotCluster Object
|
||||||
*
|
*
|
||||||
@ -193,7 +193,7 @@ public interface AbstractDB {
|
|||||||
/**
|
/**
|
||||||
* Purgle a plot
|
* Purgle a plot
|
||||||
*
|
*
|
||||||
* @param uniqueIds list of plot type (db) to be purged
|
* @param uniqueIds list of plot id (db) to be purged
|
||||||
*/
|
*/
|
||||||
void purgeIds(final Set<Integer> uniqueIds);
|
void purgeIds(final Set<Integer> uniqueIds);
|
||||||
|
|
||||||
|
@ -20,14 +20,6 @@
|
|||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
package com.intellectualcrafters.plot.database;
|
package com.intellectualcrafters.plot.database;
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.flag.Flag;
|
|
||||||
import com.intellectualcrafters.plot.object.Plot;
|
|
||||||
import com.intellectualcrafters.plot.object.PlotArea;
|
|
||||||
import com.intellectualcrafters.plot.object.PlotCluster;
|
|
||||||
import com.intellectualcrafters.plot.object.PlotId;
|
|
||||||
import com.intellectualcrafters.plot.object.RunnableVal;
|
|
||||||
import com.intellectualcrafters.plot.object.comment.PlotComment;
|
|
||||||
|
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.sql.ResultSetMetaData;
|
import java.sql.ResultSetMetaData;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
@ -38,6 +30,14 @@ import java.util.List;
|
|||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import com.intellectualcrafters.plot.flag.Flag;
|
||||||
|
import com.intellectualcrafters.plot.object.Plot;
|
||||||
|
import com.intellectualcrafters.plot.object.PlotArea;
|
||||||
|
import com.intellectualcrafters.plot.object.PlotCluster;
|
||||||
|
import com.intellectualcrafters.plot.object.PlotId;
|
||||||
|
import com.intellectualcrafters.plot.object.RunnableVal;
|
||||||
|
import com.intellectualcrafters.plot.object.comment.PlotComment;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Database Functions
|
* Database Functions
|
||||||
* - These functions do not update the local plot objects and only make changes to the DB
|
* - These functions do not update the local plot objects and only make changes to the DB
|
||||||
@ -241,22 +241,12 @@ public class DBFunc {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a plot type
|
* Get a plot id
|
||||||
*
|
*
|
||||||
* @param plot Plot Object
|
* @param plot Plot Object
|
||||||
*
|
*
|
||||||
* @return ID
|
* @return ID
|
||||||
*/
|
*/
|
||||||
/*
|
|
||||||
* public static int getId(String plotId id2) { Statement stmt =
|
|
||||||
* null; try { stmt = connection.createStatement(); ResultSet r =
|
|
||||||
* stmt.executeQuery("SELECT `type` FROM `plot` WHERE `plot_id_x` = '" + id2.x
|
|
||||||
* + "' AND `plot_id_z` = '" + id2.y + "' AND `world` = '" + world +
|
|
||||||
* "' ORDER BY `timestamp` ASC"); int type = Integer.MAX_VALUE;
|
|
||||||
* while(r.next()) { type = r.getInt("type"); } stmt.close(); return type; }
|
|
||||||
* catch(SQLException e) { e.printStackTrace(); } return Integer.MAX_VALUE;
|
|
||||||
* }
|
|
||||||
*/
|
|
||||||
public static int getId(final Plot plot) {
|
public static int getId(final Plot plot) {
|
||||||
return dbManager.getId(plot);
|
return dbManager.getId(plot);
|
||||||
}
|
}
|
||||||
|
@ -20,24 +20,6 @@
|
|||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
package com.intellectualcrafters.plot.database;
|
package com.intellectualcrafters.plot.database;
|
||||||
|
|
||||||
import com.intellectualcrafters.configuration.ConfigurationSection;
|
|
||||||
import com.intellectualcrafters.plot.PS;
|
|
||||||
import com.intellectualcrafters.plot.config.Settings;
|
|
||||||
import com.intellectualcrafters.plot.flag.Flag;
|
|
||||||
import com.intellectualcrafters.plot.flag.FlagManager;
|
|
||||||
import com.intellectualcrafters.plot.object.BlockLoc;
|
|
||||||
import com.intellectualcrafters.plot.object.Plot;
|
|
||||||
import com.intellectualcrafters.plot.object.PlotArea;
|
|
||||||
import com.intellectualcrafters.plot.object.PlotCluster;
|
|
||||||
import com.intellectualcrafters.plot.object.PlotId;
|
|
||||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
|
||||||
import com.intellectualcrafters.plot.object.PlotSettings;
|
|
||||||
import com.intellectualcrafters.plot.object.RunnableVal;
|
|
||||||
import com.intellectualcrafters.plot.object.comment.PlotComment;
|
|
||||||
import com.intellectualcrafters.plot.util.MainUtil;
|
|
||||||
import com.intellectualcrafters.plot.util.StringMan;
|
|
||||||
import com.intellectualcrafters.plot.util.TaskManager;
|
|
||||||
|
|
||||||
import java.sql.Blob;
|
import java.sql.Blob;
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
import java.sql.DatabaseMetaData;
|
import java.sql.DatabaseMetaData;
|
||||||
@ -62,6 +44,24 @@ import java.util.concurrent.ConcurrentHashMap;
|
|||||||
import java.util.concurrent.ConcurrentLinkedQueue;
|
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||||
import java.util.concurrent.atomic.AtomicInteger;
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
|
||||||
|
import com.intellectualcrafters.configuration.ConfigurationSection;
|
||||||
|
import com.intellectualcrafters.plot.PS;
|
||||||
|
import com.intellectualcrafters.plot.config.Settings;
|
||||||
|
import com.intellectualcrafters.plot.flag.Flag;
|
||||||
|
import com.intellectualcrafters.plot.flag.FlagManager;
|
||||||
|
import com.intellectualcrafters.plot.object.BlockLoc;
|
||||||
|
import com.intellectualcrafters.plot.object.Plot;
|
||||||
|
import com.intellectualcrafters.plot.object.PlotArea;
|
||||||
|
import com.intellectualcrafters.plot.object.PlotCluster;
|
||||||
|
import com.intellectualcrafters.plot.object.PlotId;
|
||||||
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
|
import com.intellectualcrafters.plot.object.PlotSettings;
|
||||||
|
import com.intellectualcrafters.plot.object.RunnableVal;
|
||||||
|
import com.intellectualcrafters.plot.object.comment.PlotComment;
|
||||||
|
import com.intellectualcrafters.plot.util.MainUtil;
|
||||||
|
import com.intellectualcrafters.plot.util.StringMan;
|
||||||
|
import com.intellectualcrafters.plot.util.TaskManager;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
||||||
*/
|
*/
|
||||||
@ -168,7 +168,7 @@ public class SQLManager implements AbstractDB {
|
|||||||
// setTimout();
|
// setTimout();
|
||||||
// Public final
|
// Public final
|
||||||
SET_OWNER = "UPDATE `" + prefix + "plot` SET `owner` = ? WHERE `plot_id_x` = ? AND `plot_id_z` = ? AND `world` = ?";
|
SET_OWNER = "UPDATE `" + prefix + "plot` SET `owner` = ? WHERE `plot_id_x` = ? AND `plot_id_z` = ? AND `world` = ?";
|
||||||
GET_ALL_PLOTS = "SELECT `type`, `plot_id_x`, `plot_id_z`, `world` FROM `" + prefix + "plot`";
|
GET_ALL_PLOTS = "SELECT `id`, `plot_id_x`, `plot_id_z`, `world` FROM `" + prefix + "plot`";
|
||||||
CREATE_PLOTS = "INSERT INTO `" + prefix + "plot`(`plot_id_x`, `plot_id_z`, `owner`, `world`, `timestamp`) values ";
|
CREATE_PLOTS = "INSERT INTO `" + prefix + "plot`(`plot_id_x`, `plot_id_z`, `owner`, `world`, `timestamp`) values ";
|
||||||
CREATE_SETTINGS = "INSERT INTO `" + prefix + "plot_settings` (`plot_plot_id`) values ";
|
CREATE_SETTINGS = "INSERT INTO `" + prefix + "plot_settings` (`plot_plot_id`) values ";
|
||||||
CREATE_TIERS = "INSERT INTO `" + prefix + "plot_%tier%` (`plot_plot_id`, `user_uuid`) values ";
|
CREATE_TIERS = "INSERT INTO `" + prefix + "plot_%tier%` (`plot_plot_id`, `user_uuid`) values ";
|
||||||
@ -481,7 +481,7 @@ public class SQLManager implements AbstractDB {
|
|||||||
final PreparedStatement stmt = connection.prepareStatement(GET_ALL_PLOTS);
|
final PreparedStatement stmt = connection.prepareStatement(GET_ALL_PLOTS);
|
||||||
try (ResultSet result = stmt.executeQuery()) {
|
try (ResultSet result = stmt.executeQuery()) {
|
||||||
while (result.next()) {
|
while (result.next()) {
|
||||||
final int id = result.getInt("type");
|
final int id = result.getInt("id");
|
||||||
final int x = result.getInt("plot_id_x");
|
final int x = result.getInt("plot_id_x");
|
||||||
final int y = result.getInt("plot_id_z");
|
final int y = result.getInt("plot_id_z");
|
||||||
final PlotId plotId = new PlotId(x, y);
|
final PlotId plotId = new PlotId(x, y);
|
||||||
@ -616,7 +616,7 @@ public class SQLManager implements AbstractDB {
|
|||||||
@Override
|
@Override
|
||||||
public String getCreateSQLite(final int size) {
|
public String getCreateSQLite(final int size) {
|
||||||
return getCreateSQLite(size, "INSERT INTO `" + prefix
|
return getCreateSQLite(size, "INSERT INTO `" + prefix
|
||||||
+ "plot` SELECT ? AS `type`, ? AS `plot_id_x`, ? AS `plot_id_z`, ? AS `owner`, ? AS `world`, ? AS `timestamp` ", 6);
|
+ "plot` SELECT ? AS `id`, ? AS `plot_id_x`, ? AS `plot_id_z`, ? AS `owner`, ? AS `world`, ? AS `timestamp` ", 6);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -808,7 +808,7 @@ public class SQLManager implements AbstractDB {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setMySQL(final PreparedStatement stmt, final int i, final SettingsPair pair) throws SQLException {
|
public void setMySQL(final PreparedStatement stmt, final int i, final SettingsPair pair) throws SQLException {
|
||||||
stmt.setInt((i * 10) + 1, pair.id); // type
|
stmt.setInt((i * 10) + 1, pair.id); // id
|
||||||
stmt.setNull((i * 10) + 2, 4); // biome
|
stmt.setNull((i * 10) + 2, 4); // biome
|
||||||
stmt.setNull((i * 10) + 3, 4); // rain
|
stmt.setNull((i * 10) + 3, 4); // rain
|
||||||
stmt.setNull((i * 10) + 4, 4); // custom_time
|
stmt.setNull((i * 10) + 4, 4); // custom_time
|
||||||
@ -848,7 +848,7 @@ public class SQLManager implements AbstractDB {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setSQLite(final PreparedStatement stmt, final int i, final SettingsPair pair) throws SQLException {
|
public void setSQLite(final PreparedStatement stmt, final int i, final SettingsPair pair) throws SQLException {
|
||||||
stmt.setInt((i * 10) + 1, pair.id); // type
|
stmt.setInt((i * 10) + 1, pair.id); // id
|
||||||
stmt.setNull((i * 10) + 2, 4); // biome
|
stmt.setNull((i * 10) + 2, 4); // biome
|
||||||
stmt.setNull((i * 10) + 3, 4); // rain
|
stmt.setNull((i * 10) + 3, 4); // rain
|
||||||
stmt.setNull((i * 10) + 4, 4); // custom_time
|
stmt.setNull((i * 10) + 4, 4); // custom_time
|
||||||
@ -1434,7 +1434,7 @@ public class SQLManager implements AbstractDB {
|
|||||||
final ResultSet r = stmt.executeQuery();
|
final ResultSet r = stmt.executeQuery();
|
||||||
int c_id = Integer.MAX_VALUE;
|
int c_id = Integer.MAX_VALUE;
|
||||||
while (r.next()) {
|
while (r.next()) {
|
||||||
c_id = r.getInt("type");
|
c_id = r.getInt("id");
|
||||||
}
|
}
|
||||||
stmt.close();
|
stmt.close();
|
||||||
r.close();
|
r.close();
|
||||||
@ -1470,7 +1470,7 @@ public class SQLManager implements AbstractDB {
|
|||||||
final ResultSet r = stmt.executeQuery();
|
final ResultSet r = stmt.executeQuery();
|
||||||
int id = Integer.MAX_VALUE;
|
int id = Integer.MAX_VALUE;
|
||||||
while (r.next()) {
|
while (r.next()) {
|
||||||
id = r.getInt("type");
|
id = r.getInt("id");
|
||||||
}
|
}
|
||||||
r.close();
|
r.close();
|
||||||
stmt.close();
|
stmt.close();
|
||||||
@ -1648,7 +1648,7 @@ public class SQLManager implements AbstractDB {
|
|||||||
ArrayList<Integer> toDelete = new ArrayList<>();
|
ArrayList<Integer> toDelete = new ArrayList<>();
|
||||||
while (r.next()) {
|
while (r.next()) {
|
||||||
PlotId plot_id = new PlotId(r.getInt("plot_id_x"), r.getInt("plot_id_z"));
|
PlotId plot_id = new PlotId(r.getInt("plot_id_x"), r.getInt("plot_id_z"));
|
||||||
id = r.getInt("type");
|
id = r.getInt("id");
|
||||||
final String areaid = r.getString("world");
|
final String areaid = r.getString("world");
|
||||||
if (!areas.contains(areaid)) {
|
if (!areas.contains(areaid)) {
|
||||||
if (Settings.AUTO_PURGE) {
|
if (Settings.AUTO_PURGE) {
|
||||||
@ -1701,7 +1701,7 @@ public class SQLManager implements AbstractDB {
|
|||||||
}
|
}
|
||||||
plots.put(id, p);
|
plots.put(id, p);
|
||||||
}
|
}
|
||||||
deleteRows(toDelete, "plot", "type");
|
deleteRows(toDelete, "plot", "id");
|
||||||
}
|
}
|
||||||
if (Settings.CACHE_RATINGS) {
|
if (Settings.CACHE_RATINGS) {
|
||||||
try (ResultSet r = stmt.executeQuery("SELECT `plot_plot_id`, `player`, `rating` FROM `" + prefix + "plot_rating`")) {
|
try (ResultSet r = stmt.executeQuery("SELECT `plot_plot_id`, `player`, `rating` FROM `" + prefix + "plot_rating`")) {
|
||||||
@ -2031,7 +2031,7 @@ public class SQLManager implements AbstractDB {
|
|||||||
final StringBuilder idstr2 = new StringBuilder("");
|
final StringBuilder idstr2 = new StringBuilder("");
|
||||||
for (final Integer id : uniqueIds) {
|
for (final Integer id : uniqueIds) {
|
||||||
idstr2.append(stmt_prefix).append(id);
|
idstr2.append(stmt_prefix).append(id);
|
||||||
stmt_prefix = " OR `type` = ";
|
stmt_prefix = " OR `id` = ";
|
||||||
}
|
}
|
||||||
stmt_prefix = "";
|
stmt_prefix = "";
|
||||||
final StringBuilder idstr = new StringBuilder("");
|
final StringBuilder idstr = new StringBuilder("");
|
||||||
@ -2079,7 +2079,7 @@ public class SQLManager implements AbstractDB {
|
|||||||
while (r.next()) {
|
while (r.next()) {
|
||||||
PlotId plot_id = new PlotId(r.getInt("plot_id_x"), r.getInt("plot_id_z"));
|
PlotId plot_id = new PlotId(r.getInt("plot_id_x"), r.getInt("plot_id_z"));
|
||||||
if (plots.contains(plot_id)) {
|
if (plots.contains(plot_id)) {
|
||||||
ids.add(r.getInt("type"));
|
ids.add(r.getInt("id"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
purgeIds(ids);
|
purgeIds(ids);
|
||||||
@ -2539,7 +2539,7 @@ public class SQLManager implements AbstractDB {
|
|||||||
while (r.next()) {
|
while (r.next()) {
|
||||||
PlotId pos1 = new PlotId(r.getInt("pos1_x"), r.getInt("pos1_z"));
|
PlotId pos1 = new PlotId(r.getInt("pos1_x"), r.getInt("pos1_z"));
|
||||||
PlotId pos2 = new PlotId(r.getInt("pos2_x"), r.getInt("pos2_z"));
|
PlotId pos2 = new PlotId(r.getInt("pos2_x"), r.getInt("pos2_z"));
|
||||||
id = r.getInt("type");
|
id = r.getInt("id");
|
||||||
String areaid = r.getString("world");
|
String areaid = r.getString("world");
|
||||||
if (!areas.contains(areaid)) {
|
if (!areas.contains(areaid)) {
|
||||||
if (noExist.containsKey(areaid)) {
|
if (noExist.containsKey(areaid)) {
|
||||||
|
@ -20,11 +20,11 @@
|
|||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
package com.intellectualcrafters.plot.flag;
|
package com.intellectualcrafters.plot.flag;
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.util.StringMan;
|
|
||||||
|
|
||||||
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
|
|
||||||
|
import com.intellectualcrafters.plot.util.StringMan;
|
||||||
|
|
||||||
public class Flag implements Cloneable {
|
public class Flag implements Cloneable {
|
||||||
private AbstractFlag key;
|
private AbstractFlag key;
|
||||||
private Object value;
|
private Object value;
|
||||||
@ -140,24 +140,9 @@ public class Flag implements Cloneable {
|
|||||||
return new Flag(key, method.invoke(value));
|
return new Flag(key, method.invoke(value));
|
||||||
}
|
}
|
||||||
return new Flag(key, key.parseValueRaw(value.toString()));
|
return new Flag(key, key.parseValueRaw(value.toString()));
|
||||||
} catch (CloneNotSupportedException e) {
|
} catch (CloneNotSupportedException | IllegalAccessException | IllegalArgumentException | NoSuchMethodException | SecurityException | InvocationTargetException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
return this;
|
|
||||||
} catch (IllegalAccessException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
return this;
|
|
||||||
} catch (IllegalArgumentException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
return this;
|
|
||||||
} catch (NoSuchMethodException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
return this;
|
|
||||||
} catch (SecurityException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
return this;
|
|
||||||
} catch (InvocationTargetException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
return this;
|
|
||||||
}
|
}
|
||||||
|
return this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -29,8 +29,8 @@ public abstract class IndependentPlotGenerator {
|
|||||||
* Return a new PlotArea object
|
* Return a new PlotArea object
|
||||||
* @param world world name
|
* @param world world name
|
||||||
* @param id (May be null) Area name
|
* @param id (May be null) Area name
|
||||||
* @param min Min plot type (may be null)
|
* @param min Min plot id (may be null)
|
||||||
* @param max Max plot type (may be null)
|
* @param max Max plot id (may be null)
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public abstract PlotArea getNewPlotArea(String world, String id, PlotId min, PlotId max);
|
public abstract PlotArea getNewPlotArea(String world, String id, PlotId min, PlotId max);
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.intellectualcrafters.plot.object;
|
package com.intellectualcrafters.plot.object;
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.PS;
|
import com.intellectualcrafters.plot.PS;
|
||||||
|
import com.intellectualcrafters.plot.util.MathMan;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created 2015-02-11 for PlotSquared
|
* Created 2015-02-11 for PlotSquared
|
||||||
@ -162,13 +163,7 @@ public class Location implements Cloneable, Comparable<Location> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
int hash = 127;
|
return MathMan.pair((short) x, (short) z) * 17 + y;
|
||||||
hash = hash * 31 + x;
|
|
||||||
hash = hash * 31 + y;
|
|
||||||
hash = hash * 31 + z;
|
|
||||||
hash = (int) (hash * 31 + getYaw());
|
|
||||||
hash = (int) (hash * 31 + getPitch());
|
|
||||||
return hash * 31 + (world == null ? 127 : world.hashCode());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isInAABB(final Location min, final Location max) {
|
public boolean isInAABB(final Location min, final Location max) {
|
||||||
@ -178,7 +173,7 @@ public class Location implements Cloneable, Comparable<Location> {
|
|||||||
public void lookTowards(final int x, final int y) {
|
public void lookTowards(final int x, final int y) {
|
||||||
final double l = this.x - x;
|
final double l = this.x - x;
|
||||||
final double c = Math.sqrt(l * l + 0.0);
|
final double c = Math.sqrt(l * l + 0.0);
|
||||||
if (Math.asin((double) 0 / c) / Math.PI * 180 > 90) {
|
if (Math.asin(0 / c) / Math.PI * 180 > 90) {
|
||||||
setYaw((float) (180 - -Math.asin(l / c) / Math.PI * 180));
|
setYaw((float) (180 - -Math.asin(l / c) / Math.PI * 180));
|
||||||
} else {
|
} else {
|
||||||
setYaw((float) (-Math.asin(l / c) / Math.PI * 180));
|
setYaw((float) (-Math.asin(l / c) / Math.PI * 180));
|
||||||
|
@ -20,6 +20,25 @@
|
|||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
package com.intellectualcrafters.plot.object;
|
package com.intellectualcrafters.plot.object;
|
||||||
|
|
||||||
|
import java.awt.Rectangle;
|
||||||
|
import java.awt.geom.Area;
|
||||||
|
import java.awt.geom.PathIterator;
|
||||||
|
import java.io.File;
|
||||||
|
import java.net.URL;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
|
import java.util.ArrayDeque;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map.Entry;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.UUID;
|
||||||
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
|
||||||
import com.google.common.collect.BiMap;
|
import com.google.common.collect.BiMap;
|
||||||
import com.intellectualcrafters.jnbt.CompoundTag;
|
import com.intellectualcrafters.jnbt.CompoundTag;
|
||||||
import com.intellectualcrafters.plot.PS;
|
import com.intellectualcrafters.plot.PS;
|
||||||
@ -41,22 +60,6 @@ import com.intellectualcrafters.plot.util.UUIDHandler;
|
|||||||
import com.intellectualcrafters.plot.util.WorldUtil;
|
import com.intellectualcrafters.plot.util.WorldUtil;
|
||||||
import com.plotsquared.listener.PlotListener;
|
import com.plotsquared.listener.PlotListener;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.net.URL;
|
|
||||||
import java.nio.charset.StandardCharsets;
|
|
||||||
import java.util.ArrayDeque;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map.Entry;
|
|
||||||
import java.util.Set;
|
|
||||||
import java.util.UUID;
|
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
|
||||||
import java.util.concurrent.atomic.AtomicInteger;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The plot class
|
* The plot class
|
||||||
*/
|
*/
|
||||||
@ -1353,7 +1356,7 @@ public class Plot {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the top and bottom plot type.<br>
|
* Returns the top and bottom plot id.<br>
|
||||||
* - If the plot is not connected, it will return itself for the top/bottom<br>
|
* - If the plot is not connected, it will return itself for the top/bottom<br>
|
||||||
* - the returned ids will not necessarily correspond to claimed plots if the connected plots do not form a rectangular shape
|
* - the returned ids will not necessarily correspond to claimed plots if the connected plots do not form a rectangular shape
|
||||||
* @deprecated as merged plots no longer need to be rectangular
|
* @deprecated as merged plots no longer need to be rectangular
|
||||||
@ -1427,7 +1430,7 @@ public class Plot {
|
|||||||
/**
|
/**
|
||||||
* Get plot display name
|
* Get plot display name
|
||||||
*
|
*
|
||||||
* @return alias if set, else type
|
* @return alias if set, else id
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
@ -2231,6 +2234,25 @@ public class Plot {
|
|||||||
}, 1);
|
}, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<Location> getAllCorners() {
|
||||||
|
Area area = new Area();
|
||||||
|
for (RegionWrapper region : getRegions()) {
|
||||||
|
Area rectArea = new Area(new Rectangle(region.minX, region.minZ, region.maxX - region.minX, region.maxZ - region.minZ));
|
||||||
|
area.add(rectArea);
|
||||||
|
}
|
||||||
|
PathIterator iter = area.getPathIterator(null);
|
||||||
|
List<Location> locs = new ArrayList<>();
|
||||||
|
while (!iter.isDone()) {
|
||||||
|
iter.next();
|
||||||
|
double[] result = new double[6];
|
||||||
|
iter.currentSegment(result);
|
||||||
|
int x = (int) result[0];
|
||||||
|
int z = (int) result[1];
|
||||||
|
locs.add(new Location(this.area.worldname, x, 0, z));
|
||||||
|
}
|
||||||
|
return locs;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Teleport a player to a plot and send them the teleport message.
|
* Teleport a player to a plot and send them the teleport message.
|
||||||
* @param player
|
* @param player
|
||||||
|
@ -45,7 +45,7 @@ public class PlotId {
|
|||||||
/**
|
/**
|
||||||
* Get a Plot Id based on a string
|
* Get a Plot Id based on a string
|
||||||
*
|
*
|
||||||
* @param string to create type from
|
* @param string to create id from
|
||||||
*
|
*
|
||||||
* @return null if the string is invalid
|
* @return null if the string is invalid
|
||||||
*/
|
*/
|
||||||
|
@ -36,7 +36,7 @@ public class SetupObject {
|
|||||||
public String setupGenerator = null;
|
public String setupGenerator = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The management type
|
* The management type (normal, augmented, partial)
|
||||||
*/
|
*/
|
||||||
public int type;
|
public int type;
|
||||||
|
|
||||||
@ -51,12 +51,12 @@ public class SetupObject {
|
|||||||
public String id;
|
public String id;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Minimum plot type (may be null)
|
* Minimum plot id (may be null)
|
||||||
*/
|
*/
|
||||||
public PlotId min;
|
public PlotId min;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Max plot type (may be null)
|
* Max plot id (may be null)
|
||||||
*/
|
*/
|
||||||
public PlotId max;
|
public PlotId max;
|
||||||
|
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
package com.intellectualcrafters.plot.util;
|
package com.intellectualcrafters.plot.util;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.PS;
|
import com.intellectualcrafters.plot.PS;
|
||||||
import com.intellectualcrafters.plot.config.C;
|
import com.intellectualcrafters.plot.config.C;
|
||||||
import com.intellectualcrafters.plot.flag.Flag;
|
import com.intellectualcrafters.plot.flag.Flag;
|
||||||
@ -15,10 +19,6 @@ import com.intellectualcrafters.plot.object.PlotPlayer;
|
|||||||
import com.intellectualcrafters.plot.object.Rating;
|
import com.intellectualcrafters.plot.object.Rating;
|
||||||
import com.plotsquared.listener.PlayerBlockEventType;
|
import com.plotsquared.listener.PlayerBlockEventType;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
public abstract class EventUtil {
|
public abstract class EventUtil {
|
||||||
|
|
||||||
public static EventUtil manager = null;
|
public static EventUtil manager = null;
|
||||||
@ -250,7 +250,7 @@ public abstract class EventUtil {
|
|||||||
}
|
}
|
||||||
case SPAWN_MOB: {
|
case SPAWN_MOB: {
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_OTHER.s(), notifyPerms);
|
return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_ROAD.s(), notifyPerms);
|
||||||
}
|
}
|
||||||
if (!plot.hasOwner()) {
|
if (!plot.hasOwner()) {
|
||||||
return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_UNOWNED.s(), notifyPerms);
|
return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_UNOWNED.s(), notifyPerms);
|
||||||
@ -269,26 +269,11 @@ public abstract class EventUtil {
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
case PLACE_HANGING:
|
case PLACE_HANGING: // Handled elsewhere
|
||||||
// if (plot == null) {
|
|
||||||
// return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_OTHER.s(), notifyPerms);
|
|
||||||
// }
|
|
||||||
// if (plot.owner == null) {
|
|
||||||
// return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_UNOWNED.s(), notifyPerms);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// if (FlagManager.isPlotFlagTrue(plot, "hanging-place")) {
|
|
||||||
// return true;
|
|
||||||
// }
|
|
||||||
// Flag flag = FlagManager.getPlotFlag(plot, "place");
|
|
||||||
// HashSet<PlotBlock> value = flag == null ? null : (HashSet<PlotBlock>) flag.getValue();
|
|
||||||
// if (value == null || (!value.contains(PlotBlock.EVERYTHING) && !value.contains(block.getPlotBlock()))) {
|
|
||||||
// return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_OTHER.s(), notifyPerms);
|
|
||||||
// }
|
|
||||||
return true;
|
return true;
|
||||||
case PLACE_MISC: {
|
case PLACE_MISC: {
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_OTHER.s(), notifyPerms);
|
return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_ROAD.s(), notifyPerms);
|
||||||
}
|
}
|
||||||
if (!plot.hasOwner()) {
|
if (!plot.hasOwner()) {
|
||||||
return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_UNOWNED.s(), notifyPerms);
|
return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_UNOWNED.s(), notifyPerms);
|
||||||
@ -309,7 +294,7 @@ public abstract class EventUtil {
|
|||||||
}
|
}
|
||||||
case PLACE_VEHICLE:
|
case PLACE_VEHICLE:
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_OTHER.s(), notifyPerms);
|
return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_ROAD.s(), notifyPerms);
|
||||||
}
|
}
|
||||||
if (!plot.hasOwner()) {
|
if (!plot.hasOwner()) {
|
||||||
return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_UNOWNED.s(), notifyPerms);
|
return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_UNOWNED.s(), notifyPerms);
|
||||||
|
@ -20,6 +20,15 @@
|
|||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
package com.intellectualcrafters.plot.util;
|
package com.intellectualcrafters.plot.util;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map.Entry;
|
||||||
|
import java.util.UUID;
|
||||||
|
import java.util.regex.Matcher;
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.PS;
|
import com.intellectualcrafters.plot.PS;
|
||||||
import com.intellectualcrafters.plot.config.C;
|
import com.intellectualcrafters.plot.config.C;
|
||||||
import com.intellectualcrafters.plot.config.Settings;
|
import com.intellectualcrafters.plot.config.Settings;
|
||||||
@ -38,15 +47,6 @@ import com.intellectualcrafters.plot.object.PseudoRandom;
|
|||||||
import com.intellectualcrafters.plot.object.RegionWrapper;
|
import com.intellectualcrafters.plot.object.RegionWrapper;
|
||||||
import com.intellectualcrafters.plot.object.RunnableVal;
|
import com.intellectualcrafters.plot.object.RunnableVal;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map.Entry;
|
|
||||||
import java.util.UUID;
|
|
||||||
import java.util.regex.Matcher;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* plot functions
|
* plot functions
|
||||||
*
|
*
|
||||||
@ -617,7 +617,6 @@ public class MainUtil {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Format a string with plot information:<br>
|
* Format a string with plot information:<br>
|
||||||
* %type%, %alias%, %num%, %desc%, %biome%, %owner%, %members%, %trusted%, %helpers%, %denied%, %flags%, %build%, %desc%, %rating%
|
|
||||||
* @param info
|
* @param info
|
||||||
* @param plot
|
* @param plot
|
||||||
* @param player
|
* @param player
|
||||||
|
@ -1,5 +1,30 @@
|
|||||||
package com.plotsquared.bukkit;
|
package com.plotsquared.bukkit;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.lang.reflect.InvocationTargetException;
|
||||||
|
import java.lang.reflect.Method;
|
||||||
|
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.ChatColor;
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.OfflinePlayer;
|
||||||
|
import org.bukkit.Server;
|
||||||
|
import org.bukkit.World;
|
||||||
|
import org.bukkit.command.PluginCommand;
|
||||||
|
import org.bukkit.entity.Entity;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.Listener;
|
||||||
|
import org.bukkit.generator.ChunkGenerator;
|
||||||
|
import org.bukkit.metadata.MetadataValue;
|
||||||
|
import org.bukkit.plugin.Plugin;
|
||||||
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
import com.intellectualcrafters.configuration.ConfigurationSection;
|
import com.intellectualcrafters.configuration.ConfigurationSection;
|
||||||
import com.intellectualcrafters.plot.IPlotMain;
|
import com.intellectualcrafters.plot.IPlotMain;
|
||||||
import com.intellectualcrafters.plot.PS;
|
import com.intellectualcrafters.plot.PS;
|
||||||
@ -73,30 +98,6 @@ 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.bukkit.WorldEditPlugin;
|
import com.sk89q.worldedit.bukkit.WorldEditPlugin;
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.ChatColor;
|
|
||||||
import org.bukkit.Location;
|
|
||||||
import org.bukkit.OfflinePlayer;
|
|
||||||
import org.bukkit.Server;
|
|
||||||
import org.bukkit.World;
|
|
||||||
import org.bukkit.command.PluginCommand;
|
|
||||||
import org.bukkit.entity.Entity;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.event.Listener;
|
|
||||||
import org.bukkit.generator.ChunkGenerator;
|
|
||||||
import org.bukkit.metadata.MetadataValue;
|
|
||||||
import org.bukkit.plugin.Plugin;
|
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.lang.reflect.InvocationTargetException;
|
|
||||||
import java.lang.reflect.Method;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
|
public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
|
||||||
|
|
||||||
@ -217,7 +218,6 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
|
|||||||
case EGG:
|
case EGG:
|
||||||
case ENDER_CRYSTAL:
|
case ENDER_CRYSTAL:
|
||||||
case COMPLEX_PART:
|
case COMPLEX_PART:
|
||||||
case ARMOR_STAND:
|
|
||||||
case FISHING_HOOK:
|
case FISHING_HOOK:
|
||||||
case ENDER_SIGNAL:
|
case ENDER_SIGNAL:
|
||||||
case EXPERIENCE_ORB:
|
case EXPERIENCE_ORB:
|
||||||
@ -227,8 +227,6 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
|
|||||||
case LIGHTNING:
|
case LIGHTNING:
|
||||||
case WITHER_SKULL:
|
case WITHER_SKULL:
|
||||||
case UNKNOWN:
|
case UNKNOWN:
|
||||||
case ITEM_FRAME:
|
|
||||||
case PAINTING:
|
|
||||||
case PLAYER: {
|
case PLAYER: {
|
||||||
// non moving / unremovable
|
// non moving / unremovable
|
||||||
continue;
|
continue;
|
||||||
@ -241,6 +239,11 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
|
|||||||
// managed elsewhere | projectile
|
// managed elsewhere | projectile
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
case ARMOR_STAND:
|
||||||
|
case ITEM_FRAME:
|
||||||
|
case PAINTING: {
|
||||||
|
// TEMPORARILY CLASSIFY AS VEHICLE
|
||||||
|
}
|
||||||
case MINECART:
|
case MINECART:
|
||||||
case MINECART_CHEST:
|
case MINECART_CHEST:
|
||||||
case MINECART_COMMAND:
|
case MINECART_COMMAND:
|
||||||
@ -429,7 +432,7 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
|
|||||||
if (PS.get().checkVersion(getServerVersion(), 1, 8, 0)) {
|
if (PS.get().checkVersion(getServerVersion(), 1, 8, 0)) {
|
||||||
try {
|
try {
|
||||||
return new FastQueue_1_8_3();
|
return new FastQueue_1_8_3();
|
||||||
} catch (NoSuchMethodException e) {
|
} catch (NoSuchMethodException | RuntimeException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
try {
|
try {
|
||||||
return new FastQueue_1_8();
|
return new FastQueue_1_8();
|
||||||
|
@ -1,33 +1,16 @@
|
|||||||
package com.plotsquared.bukkit.listeners;
|
package com.plotsquared.bukkit.listeners;
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.PS;
|
import java.util.ArrayList;
|
||||||
import com.intellectualcrafters.plot.config.C;
|
import java.util.Arrays;
|
||||||
import com.intellectualcrafters.plot.config.Settings;
|
import java.util.HashSet;
|
||||||
import com.intellectualcrafters.plot.flag.Flag;
|
import java.util.Iterator;
|
||||||
import com.intellectualcrafters.plot.flag.FlagManager;
|
import java.util.List;
|
||||||
import com.intellectualcrafters.plot.object.Location;
|
import java.util.Map.Entry;
|
||||||
import com.intellectualcrafters.plot.object.Plot;
|
import java.util.Objects;
|
||||||
import com.intellectualcrafters.plot.object.PlotArea;
|
import java.util.Set;
|
||||||
import com.intellectualcrafters.plot.object.PlotBlock;
|
import java.util.UUID;
|
||||||
import com.intellectualcrafters.plot.object.PlotHandler;
|
import java.util.regex.Pattern;
|
||||||
import com.intellectualcrafters.plot.object.PlotId;
|
|
||||||
import com.intellectualcrafters.plot.object.PlotInventory;
|
|
||||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
|
||||||
import com.intellectualcrafters.plot.object.StringWrapper;
|
|
||||||
import com.intellectualcrafters.plot.util.EventUtil;
|
|
||||||
import com.intellectualcrafters.plot.util.ExpireManager;
|
|
||||||
import com.intellectualcrafters.plot.util.MainUtil;
|
|
||||||
import com.intellectualcrafters.plot.util.MathMan;
|
|
||||||
import com.intellectualcrafters.plot.util.Permissions;
|
|
||||||
import com.intellectualcrafters.plot.util.RegExUtil;
|
|
||||||
import com.intellectualcrafters.plot.util.StringMan;
|
|
||||||
import com.intellectualcrafters.plot.util.TaskManager;
|
|
||||||
import com.intellectualcrafters.plot.util.UUIDHandler;
|
|
||||||
import com.plotsquared.bukkit.BukkitMain;
|
|
||||||
import com.plotsquared.bukkit.object.BukkitLazyBlock;
|
|
||||||
import com.plotsquared.bukkit.object.BukkitPlayer;
|
|
||||||
import com.plotsquared.bukkit.util.BukkitUtil;
|
|
||||||
import com.plotsquared.listener.PlayerBlockEventType;
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
@ -106,16 +89,34 @@ import org.bukkit.projectiles.BlockProjectileSource;
|
|||||||
import org.bukkit.projectiles.ProjectileSource;
|
import org.bukkit.projectiles.ProjectileSource;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import com.intellectualcrafters.plot.PS;
|
||||||
import java.util.Arrays;
|
import com.intellectualcrafters.plot.config.C;
|
||||||
import java.util.HashSet;
|
import com.intellectualcrafters.plot.config.Settings;
|
||||||
import java.util.Iterator;
|
import com.intellectualcrafters.plot.flag.Flag;
|
||||||
import java.util.List;
|
import com.intellectualcrafters.plot.flag.FlagManager;
|
||||||
import java.util.Map.Entry;
|
import com.intellectualcrafters.plot.object.Location;
|
||||||
import java.util.Objects;
|
import com.intellectualcrafters.plot.object.Plot;
|
||||||
import java.util.Set;
|
import com.intellectualcrafters.plot.object.PlotArea;
|
||||||
import java.util.UUID;
|
import com.intellectualcrafters.plot.object.PlotBlock;
|
||||||
import java.util.regex.Pattern;
|
import com.intellectualcrafters.plot.object.PlotHandler;
|
||||||
|
import com.intellectualcrafters.plot.object.PlotId;
|
||||||
|
import com.intellectualcrafters.plot.object.PlotInventory;
|
||||||
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
|
import com.intellectualcrafters.plot.object.StringWrapper;
|
||||||
|
import com.intellectualcrafters.plot.util.EventUtil;
|
||||||
|
import com.intellectualcrafters.plot.util.ExpireManager;
|
||||||
|
import com.intellectualcrafters.plot.util.MainUtil;
|
||||||
|
import com.intellectualcrafters.plot.util.MathMan;
|
||||||
|
import com.intellectualcrafters.plot.util.Permissions;
|
||||||
|
import com.intellectualcrafters.plot.util.RegExUtil;
|
||||||
|
import com.intellectualcrafters.plot.util.StringMan;
|
||||||
|
import com.intellectualcrafters.plot.util.TaskManager;
|
||||||
|
import com.intellectualcrafters.plot.util.UUIDHandler;
|
||||||
|
import com.plotsquared.bukkit.BukkitMain;
|
||||||
|
import com.plotsquared.bukkit.object.BukkitLazyBlock;
|
||||||
|
import com.plotsquared.bukkit.object.BukkitPlayer;
|
||||||
|
import com.plotsquared.bukkit.util.BukkitUtil;
|
||||||
|
import com.plotsquared.listener.PlayerBlockEventType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Player Events involving plots
|
* Player Events involving plots
|
||||||
@ -1128,6 +1129,7 @@ public class PlayerEvents extends com.plotsquared.listener.PlotListener implemen
|
|||||||
lb = new BukkitLazyBlock(id, block);
|
lb = new BukkitLazyBlock(id, block);
|
||||||
break;
|
break;
|
||||||
} else if (id < 198) {
|
} else if (id < 198) {
|
||||||
|
loc = BukkitUtil.getLocation(block.getRelative(event.getBlockFace()).getLocation());
|
||||||
eventType = PlayerBlockEventType.PLACE_BLOCK;
|
eventType = PlayerBlockEventType.PLACE_BLOCK;
|
||||||
lb = new BukkitLazyBlock(id, block);
|
lb = new BukkitLazyBlock(id, block);
|
||||||
break;
|
break;
|
||||||
@ -1141,6 +1143,7 @@ public class PlayerEvents extends com.plotsquared.listener.PlotListener implemen
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case ARMOR_STAND:
|
case ARMOR_STAND:
|
||||||
|
loc = BukkitUtil.getLocation(block.getRelative(event.getBlockFace()).getLocation());
|
||||||
eventType = PlayerBlockEventType.PLACE_MISC;
|
eventType = PlayerBlockEventType.PLACE_MISC;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -1184,6 +1187,7 @@ public class PlayerEvents extends com.plotsquared.listener.PlotListener implemen
|
|||||||
break;
|
break;
|
||||||
case PAINTING:
|
case PAINTING:
|
||||||
case ITEM_FRAME:
|
case ITEM_FRAME:
|
||||||
|
loc = BukkitUtil.getLocation(block.getRelative(event.getBlockFace()).getLocation());
|
||||||
eventType = PlayerBlockEventType.PLACE_HANGING;
|
eventType = PlayerBlockEventType.PLACE_HANGING;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -1787,7 +1791,7 @@ public class PlayerEvents extends com.plotsquared.listener.PlotListener implemen
|
|||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||||
public void onHangingPlace(final HangingPlaceEvent e) {
|
public void onHangingPlace(final HangingPlaceEvent e) {
|
||||||
final Block b = e.getBlock();
|
final Block b = e.getBlock().getRelative(e.getBlockFace());
|
||||||
final Location loc = BukkitUtil.getLocation(b.getLocation());
|
final Location loc = BukkitUtil.getLocation(b.getLocation());
|
||||||
PlotArea area = loc.getPlotArea();
|
PlotArea area = loc.getPlotArea();
|
||||||
if (area == null) {
|
if (area == null) {
|
||||||
|
@ -1,5 +1,16 @@
|
|||||||
package com.plotsquared.bukkit.object.schematic;
|
package com.plotsquared.bukkit.object.schematic;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
|
import org.bukkit.block.BlockState;
|
||||||
|
import org.bukkit.enchantments.Enchantment;
|
||||||
|
import org.bukkit.inventory.InventoryHolder;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
import com.intellectualcrafters.jnbt.ByteTag;
|
import com.intellectualcrafters.jnbt.ByteTag;
|
||||||
import com.intellectualcrafters.jnbt.CompoundTag;
|
import com.intellectualcrafters.jnbt.CompoundTag;
|
||||||
import com.intellectualcrafters.jnbt.ListTag;
|
import com.intellectualcrafters.jnbt.ListTag;
|
||||||
@ -9,16 +20,6 @@ import com.intellectualcrafters.plot.object.schematic.ItemType;
|
|||||||
import com.intellectualcrafters.plot.object.schematic.PlotItem;
|
import com.intellectualcrafters.plot.object.schematic.PlotItem;
|
||||||
import com.intellectualcrafters.plot.util.MathMan;
|
import com.intellectualcrafters.plot.util.MathMan;
|
||||||
import com.intellectualcrafters.plot.util.SchematicHandler.Schematic;
|
import com.intellectualcrafters.plot.util.SchematicHandler.Schematic;
|
||||||
import org.bukkit.block.BlockState;
|
|
||||||
import org.bukkit.enchantments.Enchantment;
|
|
||||||
import org.bukkit.inventory.InventoryHolder;
|
|
||||||
import org.bukkit.inventory.ItemStack;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Map.Entry;
|
|
||||||
|
|
||||||
public class StateWrapper {
|
public class StateWrapper {
|
||||||
|
|
||||||
@ -45,8 +46,8 @@ public class StateWrapper {
|
|||||||
for (int i = 0; i < length; i++) {
|
for (int i = 0; i < length; i++) {
|
||||||
final Tag itemTag = itemsTag.get(i);
|
final Tag itemTag = itemsTag.get(i);
|
||||||
final CompoundTag itemComp = (CompoundTag) itemTag;
|
final CompoundTag itemComp = (CompoundTag) itemTag;
|
||||||
short id = itemComp.getShort("type");
|
short id = itemComp.getShort("id");
|
||||||
String idStr = itemComp.getString("type");
|
String idStr = itemComp.getString("id");
|
||||||
if (idStr != null && !MathMan.isInteger(idStr)) {
|
if (idStr != null && !MathMan.isInteger(idStr)) {
|
||||||
idStr = idStr.split(":")[0].toLowerCase();
|
idStr = idStr.split(":")[0].toLowerCase();
|
||||||
id = (short) ItemType.getId(idStr);
|
id = (short) ItemType.getId(idStr);
|
||||||
@ -105,14 +106,14 @@ public class StateWrapper {
|
|||||||
|
|
||||||
public Map<String, Tag> serializeItem(final ItemStack item) {
|
public Map<String, Tag> serializeItem(final ItemStack item) {
|
||||||
final Map<String, Tag> data = new HashMap<>();
|
final Map<String, Tag> data = new HashMap<>();
|
||||||
data.put("type", new ShortTag("type", (short) item.getTypeId()));
|
data.put("id", new ShortTag("id", (short) item.getTypeId()));
|
||||||
data.put("Damage", new ShortTag("Damage", item.getDurability()));
|
data.put("Damage", new ShortTag("Damage", item.getDurability()));
|
||||||
data.put("Count", new ByteTag("Count", (byte) item.getAmount()));
|
data.put("Count", new ByteTag("Count", (byte) item.getAmount()));
|
||||||
if (!item.getEnchantments().isEmpty()) {
|
if (!item.getEnchantments().isEmpty()) {
|
||||||
final List<CompoundTag> enchantmentList = new ArrayList<>();
|
final List<CompoundTag> enchantmentList = new ArrayList<>();
|
||||||
for (final Entry<Enchantment, Integer> entry : item.getEnchantments().entrySet()) {
|
for (final Entry<Enchantment, Integer> entry : item.getEnchantments().entrySet()) {
|
||||||
final Map<String, Tag> enchantment = new HashMap<>();
|
final Map<String, Tag> enchantment = new HashMap<>();
|
||||||
enchantment.put("type", new ShortTag("type", (short) entry.getKey().getId()));
|
enchantment.put("id", new ShortTag("id", (short) entry.getKey().getId()));
|
||||||
enchantment.put("lvl", new ShortTag("lvl", entry.getValue().shortValue()));
|
enchantment.put("lvl", new ShortTag("lvl", entry.getValue().shortValue()));
|
||||||
enchantmentList.add(new CompoundTag(enchantment));
|
enchantmentList.add(new CompoundTag(enchantment));
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,18 @@
|
|||||||
package com.plotsquared.bukkit.util;
|
package com.plotsquared.bukkit.util;
|
||||||
|
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.World;
|
||||||
|
import org.bukkit.block.Biome;
|
||||||
|
import org.bukkit.block.Block;
|
||||||
|
import org.bukkit.generator.ChunkGenerator;
|
||||||
|
import org.bukkit.generator.ChunkGenerator.BiomeGrid;
|
||||||
|
import org.bukkit.material.Directional;
|
||||||
|
import org.bukkit.material.MaterialData;
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.generator.HybridUtils;
|
import com.intellectualcrafters.plot.generator.HybridUtils;
|
||||||
import com.intellectualcrafters.plot.object.Location;
|
import com.intellectualcrafters.plot.object.Location;
|
||||||
import com.intellectualcrafters.plot.object.PlotAnalysis;
|
import com.intellectualcrafters.plot.object.PlotAnalysis;
|
||||||
@ -10,18 +23,6 @@ import com.intellectualcrafters.plot.util.ChunkManager;
|
|||||||
import com.intellectualcrafters.plot.util.MainUtil;
|
import com.intellectualcrafters.plot.util.MainUtil;
|
||||||
import com.intellectualcrafters.plot.util.MathMan;
|
import com.intellectualcrafters.plot.util.MathMan;
|
||||||
import com.intellectualcrafters.plot.util.TaskManager;
|
import com.intellectualcrafters.plot.util.TaskManager;
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.World;
|
|
||||||
import org.bukkit.block.Biome;
|
|
||||||
import org.bukkit.block.Block;
|
|
||||||
import org.bukkit.generator.ChunkGenerator;
|
|
||||||
import org.bukkit.generator.ChunkGenerator.BiomeGrid;
|
|
||||||
import org.bukkit.material.Directional;
|
|
||||||
import org.bukkit.material.MaterialData;
|
|
||||||
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
public class BukkitHybridUtils extends HybridUtils {
|
public class BukkitHybridUtils extends HybridUtils {
|
||||||
|
|
||||||
@ -61,9 +62,6 @@ public class BukkitHybridUtils extends HybridUtils {
|
|||||||
final Location bot = new Location(world, region.minX, region.minY, region.minZ);
|
final Location bot = new Location(world, region.minX, region.minY, region.minZ);
|
||||||
final Location top = new Location(world, region.maxX, region.maxY, region.maxZ);
|
final Location top = new Location(world, region.maxX, region.maxY, region.maxZ);
|
||||||
|
|
||||||
// final Location bot = MainUtil.getPlotBottomLoc(plot.world, plot.type).add(1, 0, 1);
|
|
||||||
// final Location top = MainUtil.getPlotTopLoc(plot.world, plot.type);
|
|
||||||
|
|
||||||
final int bx = bot.getX();
|
final int bx = bot.getX();
|
||||||
final int bz = bot.getZ();
|
final int bz = bot.getZ();
|
||||||
final int tx = top.getX();
|
final int tx = top.getX();
|
||||||
|
@ -20,6 +20,20 @@
|
|||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
package com.plotsquared.bukkit.util;
|
package com.plotsquared.bukkit.util;
|
||||||
|
|
||||||
|
import java.util.ArrayDeque;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Map.Entry;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.Chunk;
|
||||||
|
import org.bukkit.World;
|
||||||
|
import org.bukkit.block.Block;
|
||||||
|
import org.bukkit.block.BlockState;
|
||||||
|
|
||||||
import com.intellectualcrafters.jnbt.ByteArrayTag;
|
import com.intellectualcrafters.jnbt.ByteArrayTag;
|
||||||
import com.intellectualcrafters.jnbt.CompoundTag;
|
import com.intellectualcrafters.jnbt.CompoundTag;
|
||||||
import com.intellectualcrafters.jnbt.IntTag;
|
import com.intellectualcrafters.jnbt.IntTag;
|
||||||
@ -35,19 +49,6 @@ import com.intellectualcrafters.plot.util.MainUtil;
|
|||||||
import com.intellectualcrafters.plot.util.SchematicHandler;
|
import com.intellectualcrafters.plot.util.SchematicHandler;
|
||||||
import com.intellectualcrafters.plot.util.TaskManager;
|
import com.intellectualcrafters.plot.util.TaskManager;
|
||||||
import com.plotsquared.bukkit.object.schematic.StateWrapper;
|
import com.plotsquared.bukkit.object.schematic.StateWrapper;
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.Chunk;
|
|
||||||
import org.bukkit.World;
|
|
||||||
import org.bukkit.block.Block;
|
|
||||||
import org.bukkit.block.BlockState;
|
|
||||||
|
|
||||||
import java.util.ArrayDeque;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Map.Entry;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Schematic Handler
|
* Schematic Handler
|
||||||
@ -290,7 +291,7 @@ public class BukkitSchematicHandler extends SchematicHandler {
|
|||||||
for (final Entry<String, Tag> entry : rawTag.getValue().entrySet()) {
|
for (final Entry<String, Tag> entry : rawTag.getValue().entrySet()) {
|
||||||
values.put(entry.getKey(), entry.getValue());
|
values.put(entry.getKey(), entry.getValue());
|
||||||
}
|
}
|
||||||
values.put("type", new StringTag("type", wrapper.getId()));
|
values.put("id", new StringTag("id", wrapper.getId()));
|
||||||
values.put("x", new IntTag("x", x));
|
values.put("x", new IntTag("x", x));
|
||||||
values.put("y", new IntTag("y", y));
|
values.put("y", new IntTag("y", y));
|
||||||
values.put("z", new IntTag("z", z));
|
values.put("z", new IntTag("z", z));
|
||||||
|
@ -20,15 +20,6 @@
|
|||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
package com.plotsquared.bukkit.util;
|
package com.plotsquared.bukkit.util;
|
||||||
|
|
||||||
import com.intellectualcrafters.configuration.InvalidConfigurationException;
|
|
||||||
import com.intellectualcrafters.configuration.file.YamlConfiguration;
|
|
||||||
import com.intellectualcrafters.plot.PS;
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.plugin.Plugin;
|
|
||||||
import org.bukkit.plugin.PluginDescriptionFile;
|
|
||||||
import org.bukkit.scheduler.BukkitTask;
|
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
@ -50,6 +41,16 @@ import java.util.UUID;
|
|||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.zip.GZIPOutputStream;
|
import java.util.zip.GZIPOutputStream;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.plugin.Plugin;
|
||||||
|
import org.bukkit.plugin.PluginDescriptionFile;
|
||||||
|
import org.bukkit.scheduler.BukkitTask;
|
||||||
|
|
||||||
|
import com.intellectualcrafters.configuration.InvalidConfigurationException;
|
||||||
|
import com.intellectualcrafters.configuration.file.YamlConfiguration;
|
||||||
|
import com.intellectualcrafters.plot.PS;
|
||||||
|
|
||||||
public class Metrics {
|
public class Metrics {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -85,7 +86,7 @@ public class Metrics {
|
|||||||
*/
|
*/
|
||||||
private final File configurationFile;
|
private final File configurationFile;
|
||||||
/**
|
/**
|
||||||
* Unique server type
|
* Unique server id
|
||||||
*/
|
*/
|
||||||
private final String guid;
|
private final String guid;
|
||||||
/**
|
/**
|
||||||
|
@ -2,6 +2,16 @@ package com.plotsquared.bukkit.util.block;
|
|||||||
|
|
||||||
import static com.intellectualcrafters.plot.util.ReflectionUtils.getRefClass;
|
import static com.intellectualcrafters.plot.util.ReflectionUtils.getRefClass;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
|
import org.bukkit.Chunk;
|
||||||
|
import org.bukkit.World;
|
||||||
|
import org.bukkit.block.Biome;
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.object.ChunkLoc;
|
import com.intellectualcrafters.plot.object.ChunkLoc;
|
||||||
import com.intellectualcrafters.plot.object.PlotBlock;
|
import com.intellectualcrafters.plot.object.PlotBlock;
|
||||||
import com.intellectualcrafters.plot.util.MainUtil;
|
import com.intellectualcrafters.plot.util.MainUtil;
|
||||||
@ -13,15 +23,6 @@ import com.intellectualcrafters.plot.util.SetQueue.ChunkWrapper;
|
|||||||
import com.intellectualcrafters.plot.util.TaskManager;
|
import com.intellectualcrafters.plot.util.TaskManager;
|
||||||
import com.plotsquared.bukkit.util.BukkitUtil;
|
import com.plotsquared.bukkit.util.BukkitUtil;
|
||||||
import com.plotsquared.bukkit.util.SendChunk;
|
import com.plotsquared.bukkit.util.SendChunk;
|
||||||
import org.bukkit.Chunk;
|
|
||||||
import org.bukkit.World;
|
|
||||||
import org.bukkit.block.Biome;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.Map.Entry;
|
|
||||||
|
|
||||||
public class FastQueue_1_7 extends SlowQueue {
|
public class FastQueue_1_7 extends SlowQueue {
|
||||||
|
|
||||||
@ -39,7 +40,7 @@ public class FastQueue_1_7 extends SlowQueue {
|
|||||||
|
|
||||||
public HashMap<ChunkWrapper, Chunk> toUpdate = new HashMap<>();
|
public HashMap<ChunkWrapper, Chunk> toUpdate = new HashMap<>();
|
||||||
|
|
||||||
public FastQueue_1_7() throws NoSuchMethodException {
|
public FastQueue_1_7() throws NoSuchMethodException, RuntimeException {
|
||||||
methodGetHandle = classCraftWorld.getMethod("getHandle");
|
methodGetHandle = classCraftWorld.getMethod("getHandle");
|
||||||
methodGetChunkAt = classWorld.getMethod("getChunkAt", int.class, int.class);
|
methodGetChunkAt = classWorld.getMethod("getChunkAt", int.class, int.class);
|
||||||
methodA = classChunk.getMethod("a", int.class, int.class, int.class, classBlock, int.class);
|
methodA = classChunk.getMethod("a", int.class, int.class, int.class, classBlock, int.class);
|
||||||
|
@ -2,6 +2,17 @@ package com.plotsquared.bukkit.util.block;
|
|||||||
|
|
||||||
import static com.intellectualcrafters.plot.util.ReflectionUtils.getRefClass;
|
import static com.intellectualcrafters.plot.util.ReflectionUtils.getRefClass;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
|
import org.bukkit.Chunk;
|
||||||
|
import org.bukkit.World;
|
||||||
|
import org.bukkit.block.Biome;
|
||||||
|
import org.bukkit.block.Block;
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.object.ChunkLoc;
|
import com.intellectualcrafters.plot.object.ChunkLoc;
|
||||||
import com.intellectualcrafters.plot.object.PlotBlock;
|
import com.intellectualcrafters.plot.object.PlotBlock;
|
||||||
import com.intellectualcrafters.plot.util.MainUtil;
|
import com.intellectualcrafters.plot.util.MainUtil;
|
||||||
@ -14,16 +25,6 @@ import com.intellectualcrafters.plot.util.SetQueue.ChunkWrapper;
|
|||||||
import com.intellectualcrafters.plot.util.TaskManager;
|
import com.intellectualcrafters.plot.util.TaskManager;
|
||||||
import com.plotsquared.bukkit.util.BukkitUtil;
|
import com.plotsquared.bukkit.util.BukkitUtil;
|
||||||
import com.plotsquared.bukkit.util.SendChunk;
|
import com.plotsquared.bukkit.util.SendChunk;
|
||||||
import org.bukkit.Chunk;
|
|
||||||
import org.bukkit.World;
|
|
||||||
import org.bukkit.block.Biome;
|
|
||||||
import org.bukkit.block.Block;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.Map.Entry;
|
|
||||||
|
|
||||||
public class FastQueue_1_8 extends SlowQueue {
|
public class FastQueue_1_8 extends SlowQueue {
|
||||||
|
|
||||||
@ -42,7 +43,7 @@ public class FastQueue_1_8 extends SlowQueue {
|
|||||||
private RefConstructor constructorBlockPosition;
|
private RefConstructor constructorBlockPosition;
|
||||||
private SendChunk chunksender;
|
private SendChunk chunksender;
|
||||||
|
|
||||||
public FastQueue_1_8() throws NoSuchMethodException {
|
public FastQueue_1_8() throws NoSuchMethodException, RuntimeException {
|
||||||
methodInitLighting = classChunk.getMethod("initLighting");
|
methodInitLighting = classChunk.getMethod("initLighting");
|
||||||
constructorBlockPosition = classBlockPosition.getConstructor(int.class, int.class, int.class);
|
constructorBlockPosition = classBlockPosition.getConstructor(int.class, int.class, int.class);
|
||||||
methodGetByCombinedId = classBlock.getMethod("getByCombinedId", int.class);
|
methodGetByCombinedId = classBlock.getMethod("getByCombinedId", int.class);
|
||||||
|
@ -2,6 +2,23 @@ package com.plotsquared.bukkit.util.block;
|
|||||||
|
|
||||||
import static com.intellectualcrafters.plot.util.ReflectionUtils.getRefClass;
|
import static com.intellectualcrafters.plot.util.ReflectionUtils.getRefClass;
|
||||||
|
|
||||||
|
import java.lang.reflect.Field;
|
||||||
|
import java.lang.reflect.InvocationTargetException;
|
||||||
|
import java.lang.reflect.Method;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map.Entry;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
import org.bukkit.Chunk;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.World;
|
||||||
|
import org.bukkit.World.Environment;
|
||||||
|
import org.bukkit.block.Biome;
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.object.ChunkLoc;
|
import com.intellectualcrafters.plot.object.ChunkLoc;
|
||||||
import com.intellectualcrafters.plot.object.PseudoRandom;
|
import com.intellectualcrafters.plot.object.PseudoRandom;
|
||||||
import com.intellectualcrafters.plot.util.ChunkManager;
|
import com.intellectualcrafters.plot.util.ChunkManager;
|
||||||
@ -17,22 +34,6 @@ import com.intellectualcrafters.plot.util.SetQueue.ChunkWrapper;
|
|||||||
import com.intellectualcrafters.plot.util.TaskManager;
|
import com.intellectualcrafters.plot.util.TaskManager;
|
||||||
import com.plotsquared.bukkit.util.BukkitUtil;
|
import com.plotsquared.bukkit.util.BukkitUtil;
|
||||||
import com.plotsquared.bukkit.util.SendChunk;
|
import com.plotsquared.bukkit.util.SendChunk;
|
||||||
import org.bukkit.Chunk;
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.World;
|
|
||||||
import org.bukkit.World.Environment;
|
|
||||||
import org.bukkit.block.Biome;
|
|
||||||
|
|
||||||
import java.lang.reflect.Field;
|
|
||||||
import java.lang.reflect.InvocationTargetException;
|
|
||||||
import java.lang.reflect.Method;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map.Entry;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
public class FastQueue_1_8_3 extends SlowQueue {
|
public class FastQueue_1_8_3 extends SlowQueue {
|
||||||
|
|
||||||
@ -63,7 +64,7 @@ public class FastQueue_1_8_3 extends SlowQueue {
|
|||||||
private RefField fieldWorld;
|
private RefField fieldWorld;
|
||||||
private RefMethod methodGetIdArray;
|
private RefMethod methodGetIdArray;
|
||||||
|
|
||||||
public FastQueue_1_8_3() throws NoSuchMethodException {
|
public FastQueue_1_8_3() throws NoSuchMethodException, RuntimeException {
|
||||||
methodGetHandlePlayer = classCraftPlayer.getMethod("getHandle");
|
methodGetHandlePlayer = classCraftPlayer.getMethod("getHandle");
|
||||||
methodGetHandleChunk = classCraftChunk.getMethod("getHandle");
|
methodGetHandleChunk = classCraftChunk.getMethod("getHandle");
|
||||||
methodInitLighting = classChunk.getMethod("initLighting");
|
methodInitLighting = classChunk.getMethod("initLighting");
|
||||||
|
@ -1,21 +1,5 @@
|
|||||||
package com.plotsquared.bukkit.uuid;
|
package com.plotsquared.bukkit.uuid;
|
||||||
|
|
||||||
import com.google.common.collect.HashBiMap;
|
|
||||||
import com.intellectualcrafters.plot.PS;
|
|
||||||
import com.intellectualcrafters.plot.config.C;
|
|
||||||
import com.intellectualcrafters.plot.config.Settings;
|
|
||||||
import com.intellectualcrafters.plot.database.DBFunc;
|
|
||||||
import com.intellectualcrafters.plot.database.SQLite;
|
|
||||||
import com.intellectualcrafters.plot.object.RunnableVal;
|
|
||||||
import com.intellectualcrafters.plot.object.StringWrapper;
|
|
||||||
import com.intellectualcrafters.plot.util.TaskManager;
|
|
||||||
import com.intellectualcrafters.plot.util.UUIDHandler;
|
|
||||||
import com.intellectualcrafters.plot.util.UUIDHandlerImplementation;
|
|
||||||
import com.intellectualcrafters.plot.uuid.UUIDWrapper;
|
|
||||||
import org.json.simple.JSONArray;
|
|
||||||
import org.json.simple.JSONObject;
|
|
||||||
import org.json.simple.parser.JSONParser;
|
|
||||||
|
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
import java.net.HttpURLConnection;
|
import java.net.HttpURLConnection;
|
||||||
@ -29,6 +13,23 @@ import java.util.Collections;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import org.json.simple.JSONArray;
|
||||||
|
import org.json.simple.JSONObject;
|
||||||
|
import org.json.simple.parser.JSONParser;
|
||||||
|
|
||||||
|
import com.google.common.collect.HashBiMap;
|
||||||
|
import com.intellectualcrafters.plot.PS;
|
||||||
|
import com.intellectualcrafters.plot.config.C;
|
||||||
|
import com.intellectualcrafters.plot.config.Settings;
|
||||||
|
import com.intellectualcrafters.plot.database.DBFunc;
|
||||||
|
import com.intellectualcrafters.plot.database.SQLite;
|
||||||
|
import com.intellectualcrafters.plot.object.RunnableVal;
|
||||||
|
import com.intellectualcrafters.plot.object.StringWrapper;
|
||||||
|
import com.intellectualcrafters.plot.util.TaskManager;
|
||||||
|
import com.intellectualcrafters.plot.util.UUIDHandler;
|
||||||
|
import com.intellectualcrafters.plot.util.UUIDHandlerImplementation;
|
||||||
|
import com.intellectualcrafters.plot.uuid.UUIDWrapper;
|
||||||
|
|
||||||
public class SQLUUIDHandler extends UUIDHandlerImplementation {
|
public class SQLUUIDHandler extends UUIDHandlerImplementation {
|
||||||
|
|
||||||
final String PROFILE_URL = "https://sessionserver.mojang.com/session/minecraft/profile/";
|
final String PROFILE_URL = "https://sessionserver.mojang.com/session/minecraft/profile/";
|
||||||
@ -219,7 +220,7 @@ public class SQLUUIDHandler extends UUIDHandlerImplementation {
|
|||||||
stream.close();
|
stream.close();
|
||||||
JSONArray array = (JSONArray) jsonParser.parse(new InputStreamReader(connection.getInputStream()));
|
JSONArray array = (JSONArray) jsonParser.parse(new InputStreamReader(connection.getInputStream()));
|
||||||
JSONObject jsonProfile = (JSONObject) array.get(0);
|
JSONObject jsonProfile = (JSONObject) array.get(0);
|
||||||
String id = (String) jsonProfile.get("type");
|
String id = (String) jsonProfile.get("id");
|
||||||
String name = (String) jsonProfile.get("name");
|
String name = (String) jsonProfile.get("name");
|
||||||
ifFetch.value = UUID.fromString(id.substring(0, 8) + "-" + id.substring(8, 12) + "-" + id.substring(12, 16) + "-" + id.substring(16, 20) + "-" + id.substring(20, 32));
|
ifFetch.value = UUID.fromString(id.substring(0, 8) + "-" + id.substring(8, 12) + "-" + id.substring(12, 16) + "-" + id.substring(16, 20) + "-" + id.substring(20, 32));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
package com.plotsquared.listener;
|
package com.plotsquared.listener;
|
||||||
|
|
||||||
|
import java.lang.reflect.Field;
|
||||||
|
import java.util.HashSet;
|
||||||
|
|
||||||
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.object.PlotBlock;
|
import com.intellectualcrafters.plot.object.PlotBlock;
|
||||||
@ -16,9 +19,6 @@ import com.sk89q.worldedit.extent.Extent;
|
|||||||
import com.sk89q.worldedit.util.Location;
|
import com.sk89q.worldedit.util.Location;
|
||||||
import com.sk89q.worldedit.world.biome.BaseBiome;
|
import com.sk89q.worldedit.world.biome.BaseBiome;
|
||||||
|
|
||||||
import java.lang.reflect.Field;
|
|
||||||
import java.util.HashSet;
|
|
||||||
|
|
||||||
public class ProcessedWEExtent extends AbstractDelegateExtent {
|
public class ProcessedWEExtent extends AbstractDelegateExtent {
|
||||||
private final HashSet<RegionWrapper> mask;
|
private final HashSet<RegionWrapper> mask;
|
||||||
private final String world;
|
private final String world;
|
||||||
@ -225,8 +225,6 @@ public class ProcessedWEExtent extends AbstractDelegateExtent {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
// WorldUtil.IMP.functionSetBlock(world, x, y, z, type, data);
|
|
||||||
// return super.setBlock(location, block);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,14 +1,10 @@
|
|||||||
package com.plotsquared.sponge.generator;
|
package com.plotsquared.sponge.generator;
|
||||||
|
|
||||||
import com.flowpowered.math.vector.Vector3i;
|
import org.bukkit.block.BlockState;
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.object.PseudoRandom;
|
import com.intellectualcrafters.plot.object.PseudoRandom;
|
||||||
import com.intellectualcrafters.plot.object.RegionWrapper;
|
import com.intellectualcrafters.plot.object.RegionWrapper;
|
||||||
import com.intellectualcrafters.plot.util.ChunkManager;
|
import com.intellectualcrafters.plot.util.ChunkManager;
|
||||||
import org.spongepowered.api.block.BlockState;
|
|
||||||
import org.spongepowered.api.world.World;
|
|
||||||
import org.spongepowered.api.world.extent.ImmutableBiomeArea;
|
|
||||||
import org.spongepowered.api.world.extent.MutableBlockVolume;
|
|
||||||
import org.spongepowered.api.world.gen.GenerationPopulator;
|
|
||||||
|
|
||||||
public abstract class SpongePlotPopulator<T extends SpongePlotGenerator> implements GenerationPopulator {
|
public abstract class SpongePlotPopulator<T extends SpongePlotGenerator> implements GenerationPopulator {
|
||||||
|
|
||||||
@ -58,7 +54,7 @@ public abstract class SpongePlotPopulator<T extends SpongePlotGenerator> impleme
|
|||||||
public abstract void populate(final World world, final RegionWrapper requiredRegion, final PseudoRandom random, final int cx, final int cz);
|
public abstract void populate(final World world, final RegionWrapper requiredRegion, final PseudoRandom random, final int cx, final int cz);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the type and data at a location. (x, y, z) must be between [0,15], [0,255], [0,15]
|
* Set the id and data at a location. (x, y, z) must be between [0,15], [0,255], [0,15]
|
||||||
* @param x
|
* @param x
|
||||||
* @param y
|
* @param y
|
||||||
* @param z
|
* @param z
|
||||||
|
@ -1,6 +1,22 @@
|
|||||||
package com.plotsquared.sponge.listener;
|
package com.plotsquared.sponge.listener;
|
||||||
|
|
||||||
import com.flowpowered.math.vector.Vector3d;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map.Entry;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.Optional;
|
||||||
|
import java.util.UUID;
|
||||||
|
import java.util.function.Predicate;
|
||||||
|
|
||||||
|
import org.bukkit.block.BlockState;
|
||||||
|
import org.bukkit.entity.Ambient;
|
||||||
|
import org.bukkit.entity.Boat;
|
||||||
|
import org.bukkit.entity.Explosive;
|
||||||
|
import org.bukkit.entity.Minecart;
|
||||||
|
import org.bukkit.entity.Monster;
|
||||||
|
|
||||||
|
import com.avaje.ebean.Transaction;
|
||||||
import com.intellectualcrafters.plot.PS;
|
import com.intellectualcrafters.plot.PS;
|
||||||
import com.intellectualcrafters.plot.config.C;
|
import com.intellectualcrafters.plot.config.C;
|
||||||
import com.intellectualcrafters.plot.config.Settings;
|
import com.intellectualcrafters.plot.config.Settings;
|
||||||
@ -26,48 +42,7 @@ import com.plotsquared.listener.PlotListener;
|
|||||||
import com.plotsquared.sponge.SpongeMain;
|
import com.plotsquared.sponge.SpongeMain;
|
||||||
import com.plotsquared.sponge.object.SpongePlayer;
|
import com.plotsquared.sponge.object.SpongePlayer;
|
||||||
import com.plotsquared.sponge.util.SpongeUtil;
|
import com.plotsquared.sponge.util.SpongeUtil;
|
||||||
import org.spongepowered.api.block.BlockSnapshot;
|
import com.sk89q.worldedit.extent.Extent;
|
||||||
import org.spongepowered.api.block.BlockState;
|
|
||||||
import org.spongepowered.api.data.Transaction;
|
|
||||||
import org.spongepowered.api.entity.Entity;
|
|
||||||
import org.spongepowered.api.entity.EntityTypes;
|
|
||||||
import org.spongepowered.api.entity.Transform;
|
|
||||||
import org.spongepowered.api.entity.explosive.Explosive;
|
|
||||||
import org.spongepowered.api.entity.explosive.PrimedTNT;
|
|
||||||
import org.spongepowered.api.entity.living.Ambient;
|
|
||||||
import org.spongepowered.api.entity.living.Living;
|
|
||||||
import org.spongepowered.api.entity.living.animal.Animal;
|
|
||||||
import org.spongepowered.api.entity.living.monster.Monster;
|
|
||||||
import org.spongepowered.api.entity.living.player.Player;
|
|
||||||
import org.spongepowered.api.entity.vehicle.Boat;
|
|
||||||
import org.spongepowered.api.entity.vehicle.minecart.Minecart;
|
|
||||||
import org.spongepowered.api.event.Listener;
|
|
||||||
import org.spongepowered.api.event.action.LightningEvent;
|
|
||||||
import org.spongepowered.api.event.block.ChangeBlockEvent;
|
|
||||||
import org.spongepowered.api.event.block.GrowBlockEvent;
|
|
||||||
import org.spongepowered.api.event.block.InteractBlockEvent;
|
|
||||||
import org.spongepowered.api.event.block.MoveBlockEvent;
|
|
||||||
import org.spongepowered.api.event.cause.Cause;
|
|
||||||
import org.spongepowered.api.event.command.SendCommandEvent;
|
|
||||||
import org.spongepowered.api.event.entity.BreedEntityEvent;
|
|
||||||
import org.spongepowered.api.event.entity.DisplaceEntityEvent;
|
|
||||||
import org.spongepowered.api.event.entity.SpawnEntityEvent;
|
|
||||||
import org.spongepowered.api.event.message.MessageEvent;
|
|
||||||
import org.spongepowered.api.event.network.ClientConnectionEvent;
|
|
||||||
import org.spongepowered.api.event.world.ExplosionEvent;
|
|
||||||
import org.spongepowered.api.profile.GameProfile;
|
|
||||||
import org.spongepowered.api.text.Text;
|
|
||||||
import org.spongepowered.api.world.World;
|
|
||||||
import org.spongepowered.api.world.extent.Extent;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map.Entry;
|
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.Optional;
|
|
||||||
import java.util.UUID;
|
|
||||||
import java.util.function.Predicate;
|
|
||||||
|
|
||||||
public class MainListener {
|
public class MainListener {
|
||||||
|
|
||||||
@ -400,7 +375,7 @@ public class MainListener {
|
|||||||
final PlotId id = plot.getId();
|
final PlotId id = plot.getId();
|
||||||
final String newMessage = StringMan.replaceAll(C.PLOT_CHAT_FORMAT.s(), "%plot_id%", id.x + ";" + id.y, "%sender%", sender);
|
final String newMessage = StringMan.replaceAll(C.PLOT_CHAT_FORMAT.s(), "%plot_id%", id.x + ";" + id.y, "%sender%", sender);
|
||||||
final Text forcedMessage = event.getMessage();
|
final Text forcedMessage = event.getMessage();
|
||||||
// String forcedMessage = StringMan.replaceAll(C.PLOT_CHAT_FORCED.s(), "%plot_id%", type.x + ";" + type.y, "%sender%", sender);
|
// String forcedMessage = StringMan.replaceAll(C.PLOT_CHAT_FORCED.s(), "%plot_id%", id.x + ";" + id.y, "%sender%", sender);
|
||||||
for (Entry<String, PlotPlayer> entry : UUIDHandler.getPlayers().entrySet()) {
|
for (Entry<String, PlotPlayer> entry : UUIDHandler.getPlayers().entrySet()) {
|
||||||
PlotPlayer user = entry.getValue();
|
PlotPlayer user = entry.getValue();
|
||||||
String toSend;
|
String toSend;
|
||||||
|
@ -28,14 +28,6 @@ package com.plotsquared.sponge.util;
|
|||||||
* either expressed or implied, of anybody else.
|
* either expressed or implied, of anybody else.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.PS;
|
|
||||||
import ninja.leaping.configurate.commented.CommentedConfigurationNode;
|
|
||||||
import ninja.leaping.configurate.hocon.HoconConfigurationLoader;
|
|
||||||
import ninja.leaping.configurate.loader.ConfigurationLoader;
|
|
||||||
import org.spongepowered.api.Game;
|
|
||||||
import org.spongepowered.api.plugin.PluginContainer;
|
|
||||||
import org.spongepowered.api.scheduler.Task;
|
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
@ -51,7 +43,7 @@ import java.util.UUID;
|
|||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
import java.util.zip.GZIPOutputStream;
|
import java.util.zip.GZIPOutputStream;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import com.intellectualcrafters.plot.PS;
|
||||||
|
|
||||||
public class SpongeMetrics {
|
public class SpongeMetrics {
|
||||||
|
|
||||||
@ -101,7 +93,7 @@ public class SpongeMetrics {
|
|||||||
*/
|
*/
|
||||||
private File configurationFile;
|
private File configurationFile;
|
||||||
/**
|
/**
|
||||||
* Unique server type
|
* Unique server id
|
||||||
*/
|
*/
|
||||||
private String guid;
|
private String guid;
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user