mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-25 22:56:45 +01:00
Additions / Fixes
Added `/plot area` command for area info and management Fixed typo for player meta table preventing the plugin from starting / cleanup Moved pagination from list to subcommand Removed default PlotArea values Added pair and tuple RunnableVal classes Tweak pom so that it actually compiles More command categories Removed unclaim and limit command Fixed a few issues with the 2d mapping of plot areas
This commit is contained in:
parent
893c2b3088
commit
b87a886345
23
pom.xml
23
pom.xml
@ -52,7 +52,7 @@
|
|||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
<finalName>${project.name}-Bukkit-${project.version}</finalName>
|
<finalName>${project.name}-Bukkit</finalName>
|
||||||
<sourceDirectory>src/main/java</sourceDirectory>
|
<sourceDirectory>src/main/java</sourceDirectory>
|
||||||
|
|
||||||
<resources>
|
<resources>
|
||||||
@ -144,7 +144,8 @@
|
|||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
||||||
<plugin>
|
<!-- None of these are needed -->
|
||||||
|
<!-- <plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-shade-plugin</artifactId>
|
<artifactId>maven-shade-plugin</artifactId>
|
||||||
<version>2.4.3</version>
|
<version>2.4.3</version>
|
||||||
@ -152,6 +153,7 @@
|
|||||||
<createDependencyReducedPom>false</createDependencyReducedPom>
|
<createDependencyReducedPom>false</createDependencyReducedPom>
|
||||||
<minimizeJar>false</minimizeJar>
|
<minimizeJar>false</minimizeJar>
|
||||||
<relocations>
|
<relocations>
|
||||||
|
|
||||||
<relocation>
|
<relocation>
|
||||||
<pattern>com.google.gson</pattern>
|
<pattern>com.google.gson</pattern>
|
||||||
<shadedPattern>com.plotsquared.libs.gson</shadedPattern>
|
<shadedPattern>com.plotsquared.libs.gson</shadedPattern>
|
||||||
@ -174,7 +176,7 @@
|
|||||||
</goals>
|
</goals>
|
||||||
</execution>
|
</execution>
|
||||||
</executions>
|
</executions>
|
||||||
</plugin>
|
</plugin> -->
|
||||||
|
|
||||||
<!-- Useless ATM
|
<!-- Useless ATM
|
||||||
<plugin>
|
<plugin>
|
||||||
@ -199,7 +201,7 @@
|
|||||||
<url>https://hub.spigotmc.org/nexus/content/groups/public/</url>
|
<url>https://hub.spigotmc.org/nexus/content/groups/public/</url>
|
||||||
</repository>
|
</repository>
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
<repository>
|
<repository>
|
||||||
<id>sponge-maven-repo</id>
|
<id>sponge-maven-repo</id>
|
||||||
<url>http://repo.spongepowered.org/maven</url>
|
<url>http://repo.spongepowered.org/maven</url>
|
||||||
@ -237,10 +239,10 @@
|
|||||||
<artifactId>junit</artifactId>
|
<artifactId>junit</artifactId>
|
||||||
<groupId>junit</groupId>
|
<groupId>junit</groupId>
|
||||||
</exclusion>
|
</exclusion>
|
||||||
<exclusion>
|
<!-- <exclusion>
|
||||||
<artifactId>gson</artifactId>
|
<artifactId>gson</artifactId>
|
||||||
<groupId>com.google.code.gson</groupId>
|
<groupId>com.google.code.gson</groupId>
|
||||||
</exclusion>
|
</exclusion> -->
|
||||||
<exclusion>
|
<exclusion>
|
||||||
<artifactId>persistence-api</artifactId>
|
<artifactId>persistence-api</artifactId>
|
||||||
<groupId>javax.persistence</groupId>
|
<groupId>javax.persistence</groupId>
|
||||||
@ -295,13 +297,13 @@
|
|||||||
</exclusions>
|
</exclusions>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<!-- <dependency>
|
||||||
<groupId>org.apache.commons</groupId>
|
<groupId>org.apache.commons</groupId>
|
||||||
<artifactId>commons-math3</artifactId>
|
<artifactId>commons-math3</artifactId>
|
||||||
<version>3.6</version>
|
<version>3.6</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
<optional>true</optional>
|
<optional>true</optional>
|
||||||
</dependency>
|
</dependency> -->
|
||||||
|
|
||||||
<!-- <dependency>
|
<!-- <dependency>
|
||||||
<groupId>junit</groupId>
|
<groupId>junit</groupId>
|
||||||
@ -327,13 +329,14 @@
|
|||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- GSON (required to provide 1.7.10 and below compatibility) -->
|
<!-- GSON (required to provide 1.7.10 and below compatibility) -->
|
||||||
<dependency>
|
<!-- GSON (except it's only needed in 1.8+) -->
|
||||||
|
<!-- <dependency>
|
||||||
<groupId>com.google.code.gson</groupId>
|
<groupId>com.google.code.gson</groupId>
|
||||||
<artifactId>gson</artifactId>
|
<artifactId>gson</artifactId>
|
||||||
<version>2.5</version>
|
<version>2.5</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
<optional>true</optional>
|
<optional>true</optional>
|
||||||
</dependency>
|
</dependency> -->
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
||||||
|
@ -509,6 +509,7 @@ public class PS {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
if (areas.length == 1) {
|
if (areas.length == 1) {
|
||||||
return areas[0];
|
return areas[0];
|
||||||
@ -1445,16 +1446,15 @@ public class PS {
|
|||||||
if (world.equals("CheckingPlotSquaredGenerator")) {
|
if (world.equals("CheckingPlotSquaredGenerator")) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
PlotArea[] areas = plotareamap.get(world);
|
|
||||||
if (areas != null) {
|
|
||||||
PS.debug("World already loaded: " + world);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
final Set<String> worlds = (config.contains("worlds") ? config.getConfigurationSection("worlds").getKeys(false) : new HashSet<String>());
|
final Set<String> worlds = (config.contains("worlds") ? config.getConfigurationSection("worlds").getKeys(false) : new HashSet<String>());
|
||||||
final String path = "worlds." + world;
|
final String path = "worlds." + world;
|
||||||
ConfigurationSection worldSection = config.getConfigurationSection(path);
|
ConfigurationSection worldSection = config.getConfigurationSection(path);
|
||||||
int type = worldSection != null ? worldSection.getInt("generator.type") : 0;
|
int type = worldSection != null ? worldSection.getInt("generator.type") : 0;
|
||||||
if (type == 0) {
|
if (type == 0) {
|
||||||
|
if (plotareamap.containsKey(world)) {
|
||||||
|
PS.debug("World possibly already loaded: " + world);
|
||||||
|
return;
|
||||||
|
}
|
||||||
IndependentPlotGenerator pg;
|
IndependentPlotGenerator pg;
|
||||||
if (baseGenerator != null && baseGenerator.isFull()) {
|
if (baseGenerator != null && baseGenerator.isFull()) {
|
||||||
pg = baseGenerator.getPlotGenerator();
|
pg = baseGenerator.getPlotGenerator();
|
||||||
@ -1502,13 +1502,16 @@ public class PS {
|
|||||||
pg.initialize(plotArea);
|
pg.initialize(plotArea);
|
||||||
plotArea.setupBorder();
|
plotArea.setupBorder();
|
||||||
} else {
|
} else {
|
||||||
// Augmented / Partial
|
|
||||||
if (!worlds.contains(world)) {
|
if (!worlds.contains(world)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
log(C.PREFIX.s() + "&aDetected world load for '" + world + "'");
|
|
||||||
ConfigurationSection areasSection = worldSection.getConfigurationSection("areas");
|
ConfigurationSection areasSection = worldSection.getConfigurationSection("areas");
|
||||||
if (areasSection == null) {
|
if (areasSection == null) {
|
||||||
|
if (plotareamap.containsKey(world)) {
|
||||||
|
PS.debug("World possibly already loaded: " + world);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
log(C.PREFIX.s() + "&aDetected world load for '" + world + "'");
|
||||||
String gen_string = worldSection.getString("generator.plugin");
|
String gen_string = worldSection.getString("generator.plugin");
|
||||||
if (gen_string == null) {
|
if (gen_string == null) {
|
||||||
gen_string = "PlotSquared";
|
gen_string = "PlotSquared";
|
||||||
@ -1580,6 +1583,9 @@ public class PS {
|
|||||||
if (pos1 == null || pos2 == null || name.length() == 0) {
|
if (pos1 == null || pos2 == null || name.length() == 0) {
|
||||||
throw new IllegalArgumentException("Invalid Area identifier: " + areaId + ". Expected form `<name>-<x1;z1>-<x2;z2>`");
|
throw new IllegalArgumentException("Invalid Area identifier: " + areaId + ". Expected form `<name>-<x1;z1>-<x2;z2>`");
|
||||||
}
|
}
|
||||||
|
if (getPlotArea(world, name) != null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
ConfigurationSection section = areasSection.getConfigurationSection(areaId);
|
ConfigurationSection section = areasSection.getConfigurationSection(areaId);
|
||||||
YamlConfiguration clone = new YamlConfiguration();
|
YamlConfiguration clone = new YamlConfiguration();
|
||||||
for (String key : section.getKeys(true)) {
|
for (String key : section.getKeys(true)) {
|
||||||
@ -1628,6 +1634,7 @@ public class PS {
|
|||||||
} catch (final IOException e) {
|
} catch (final IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
log(C.PREFIX.s() + "&aDetected area load for '" + world + "'");
|
||||||
log(C.PREFIX.s() + "&c | &9generator: &7" + baseGenerator + ">" + areaGen);
|
log(C.PREFIX.s() + "&c | &9generator: &7" + baseGenerator + ">" + areaGen);
|
||||||
log(C.PREFIX.s() + "&c | &9plotworld: &7" + pa);
|
log(C.PREFIX.s() + "&c | &9plotworld: &7" + pa);
|
||||||
log(C.PREFIX.s() + "&c | &9manager: &7" + pa.getPlotManager());
|
log(C.PREFIX.s() + "&c | &9manager: &7" + pa.getPlotManager());
|
||||||
|
@ -39,7 +39,7 @@ command = "add",
|
|||||||
aliases = { "a" },
|
aliases = { "a" },
|
||||||
description = "Allow a user to build while you are online",
|
description = "Allow a user to build while you are online",
|
||||||
usage = "/plot add <player>",
|
usage = "/plot add <player>",
|
||||||
category = CommandCategory.ACTIONS,
|
category = CommandCategory.SETTINGS,
|
||||||
permission = "plots.add",
|
permission = "plots.add",
|
||||||
requiredType = RequiredType.NONE)
|
requiredType = RequiredType.NONE)
|
||||||
public class Add extends SubCommand {
|
public class Add extends SubCommand {
|
||||||
|
@ -36,7 +36,7 @@ permission = "plots.set.alias",
|
|||||||
description = "Set the plot name",
|
description = "Set the plot name",
|
||||||
usage = "/plot alias <alias>",
|
usage = "/plot alias <alias>",
|
||||||
aliases = { "alias", "sa", "name", "rename", "setname", "seta" },
|
aliases = { "alias", "sa", "name", "rename", "setname", "seta" },
|
||||||
category = CommandCategory.ACTIONS,
|
category = CommandCategory.SETTINGS,
|
||||||
requiredType = RequiredType.NONE)
|
requiredType = RequiredType.NONE)
|
||||||
public class Alias extends SetCommand {
|
public class Alias extends SetCommand {
|
||||||
|
|
||||||
|
426
src/main/java/com/intellectualcrafters/plot/commands/Area.java
Normal file
426
src/main/java/com/intellectualcrafters/plot/commands/Area.java
Normal file
@ -0,0 +1,426 @@
|
|||||||
|
package com.intellectualcrafters.plot.commands;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
import com.intellectualcrafters.configuration.ConfigurationSection;
|
||||||
|
import com.intellectualcrafters.plot.PS;
|
||||||
|
import com.intellectualcrafters.plot.config.C;
|
||||||
|
import com.intellectualcrafters.plot.config.Configuration;
|
||||||
|
import com.intellectualcrafters.plot.generator.AugmentedUtils;
|
||||||
|
import com.intellectualcrafters.plot.generator.HybridGen;
|
||||||
|
import com.intellectualcrafters.plot.generator.HybridPlotWorld;
|
||||||
|
import com.intellectualcrafters.plot.object.ChunkLoc;
|
||||||
|
import com.intellectualcrafters.plot.object.Location;
|
||||||
|
import com.intellectualcrafters.plot.object.PlotArea;
|
||||||
|
import com.intellectualcrafters.plot.object.PlotId;
|
||||||
|
import com.intellectualcrafters.plot.object.PlotMessage;
|
||||||
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
|
import com.intellectualcrafters.plot.object.RegionWrapper;
|
||||||
|
import com.intellectualcrafters.plot.object.RunnableVal;
|
||||||
|
import com.intellectualcrafters.plot.object.RunnableVal3;
|
||||||
|
import com.intellectualcrafters.plot.object.SetupObject;
|
||||||
|
import com.intellectualcrafters.plot.util.ChunkManager;
|
||||||
|
import com.intellectualcrafters.plot.util.CmdConfirm;
|
||||||
|
import com.intellectualcrafters.plot.util.MainUtil;
|
||||||
|
import com.intellectualcrafters.plot.util.MathMan;
|
||||||
|
import com.intellectualcrafters.plot.util.Permissions;
|
||||||
|
import com.intellectualcrafters.plot.util.SetupUtils;
|
||||||
|
import com.intellectualcrafters.plot.util.StringMan;
|
||||||
|
import com.intellectualcrafters.plot.util.WorldUtil;
|
||||||
|
import com.plotsquared.general.commands.CommandDeclaration;
|
||||||
|
|
||||||
|
@CommandDeclaration(
|
||||||
|
command = "area",
|
||||||
|
permission = "plots.area",
|
||||||
|
category = CommandCategory.ADMINISTRATION,
|
||||||
|
requiredType = RequiredType.NONE,
|
||||||
|
description = "Create a new PlotArea",
|
||||||
|
aliases = { "world" },
|
||||||
|
usage = "/plot area <create|info|list|tp>")
|
||||||
|
//plot createarea partial
|
||||||
|
public class Area extends SubCommand {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onCommand(final PlotPlayer plr, String[] args) {
|
||||||
|
if (args.length == 0) {
|
||||||
|
C.COMMAND_SYNTAX.send(plr, getUsage());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
switch (args[0].toLowerCase()) {
|
||||||
|
case "c":
|
||||||
|
case "setup":
|
||||||
|
case "create": {
|
||||||
|
if (!Permissions.hasPermission(plr, "plots.area.create")) {
|
||||||
|
C.NO_PERMISSION.send(plr, "plots.area.create");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
switch (args.length) {
|
||||||
|
case 1: {
|
||||||
|
C.COMMAND_SYNTAX.send(plr, "/plot area create [world[:id]] [<modifier>=<value>]...");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
case 2: {
|
||||||
|
switch (args[1].toLowerCase()) {
|
||||||
|
case "pos1": { // Set position 1
|
||||||
|
HybridPlotWorld area = plr.<HybridPlotWorld> getMeta("area_create_area");
|
||||||
|
if (area == null) {
|
||||||
|
C.COMMAND_SYNTAX.send(plr, "/plot area create [world[:id]] [<modifier>=<value>]...");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
Location loc = plr.getLocation();
|
||||||
|
plr.setMeta("area_pos1", loc);
|
||||||
|
C.SET_ATTRIBUTE.send(plr, "area_pos1", loc.getX() + "," + loc.getZ());
|
||||||
|
MainUtil.sendMessage(plr, "You will now set pos2: /plot area create pos2"
|
||||||
|
+ "\nNote: The chosen plot size may result in the created area not exactly matching your second position.");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
case "pos2": { // Set position 2 and finish creation for type=2 (partial)
|
||||||
|
final HybridPlotWorld area = plr.<HybridPlotWorld> getMeta("area_create_area");
|
||||||
|
if (area == null) {
|
||||||
|
C.COMMAND_SYNTAX.send(plr, "/plot area create [world[:id]] [<modifier>=<value>]...");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
Location pos1 = plr.getLocation();
|
||||||
|
Location pos2 = plr.<Location> getMeta("area_pos1");
|
||||||
|
int dx = Math.abs(pos1.getX() - pos2.getX());
|
||||||
|
int dz = Math.abs(pos1.getZ() - pos2.getZ());
|
||||||
|
int numx = Math.max(1, (dx + 1 + area.ROAD_WIDTH + (area.SIZE / 2)) / area.SIZE);
|
||||||
|
int numz = Math.max(1, (dz + 1 + area.ROAD_WIDTH + (area.SIZE / 2)) / area.SIZE);
|
||||||
|
final int ddx = dx - (numx * area.SIZE - area.ROAD_WIDTH);
|
||||||
|
final int ddz = dz - (numz * area.SIZE - area.ROAD_WIDTH);
|
||||||
|
int bx = Math.min(pos1.getX(), pos2.getX()) + ddx;
|
||||||
|
int bz = Math.min(pos1.getZ(), pos2.getZ()) + ddz;
|
||||||
|
int tx = Math.max(pos1.getX(), pos2.getX()) - ddx;
|
||||||
|
int tz = Math.max(pos1.getZ(), pos2.getZ()) - ddz;
|
||||||
|
int lower = (area.ROAD_WIDTH & 1) == 0 ? area.ROAD_WIDTH / 2 - 1 : area.ROAD_WIDTH / 2;
|
||||||
|
final int offsetx = bx - (area.ROAD_WIDTH == 0 ? 0 : lower);
|
||||||
|
final int offsetz = bz - (area.ROAD_WIDTH == 0 ? 0 : lower);
|
||||||
|
final RegionWrapper region = new RegionWrapper(bx, tx, bz, tz);
|
||||||
|
Set<PlotArea> areas = PS.get().getPlotAreas(area.worldname, region);
|
||||||
|
if (areas.size() > 0) {
|
||||||
|
C.CLUSTER_INTERSECTION.send(plr, areas.iterator().next().toString());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
final SetupObject object = new SetupObject();
|
||||||
|
object.world = area.worldname;
|
||||||
|
object.id = area.id;
|
||||||
|
object.terrain = area.TERRAIN;
|
||||||
|
object.type = area.TYPE;
|
||||||
|
object.min = new PlotId(0, 0);
|
||||||
|
object.max = new PlotId(numx - 1, numz - 1);
|
||||||
|
object.plotManager = "PlotSquared";
|
||||||
|
object.setupGenerator = "PlotSquared";
|
||||||
|
object.step = area.getSettingNodes();
|
||||||
|
final String path = "worlds." + area.worldname + ".areas." + area.id + "-" + object.min + "-" + object.max;
|
||||||
|
CmdConfirm.addPending(plr, "/plot area create pos2 (Creates world)", new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
if (offsetx != 0) {
|
||||||
|
PS.get().config.set(path + ".road.offset.x", offsetx);
|
||||||
|
}
|
||||||
|
if (offsetz != 0) {
|
||||||
|
PS.get().config.set(path + ".road.offset.z", offsetz);
|
||||||
|
}
|
||||||
|
final String world = SetupUtils.manager.setupWorld(object);
|
||||||
|
if (WorldUtil.IMP.isWorld(world)) {
|
||||||
|
PS.get().loadWorld(world, null);
|
||||||
|
C.SETUP_FINISHED.send(plr);
|
||||||
|
plr.teleport(WorldUtil.IMP.getSpawn(world));
|
||||||
|
if (area.TERRAIN != 3) {
|
||||||
|
ChunkManager.largeRegionTask(world, region, new RunnableVal<ChunkLoc>() {
|
||||||
|
@Override
|
||||||
|
public void run(ChunkLoc value) {
|
||||||
|
AugmentedUtils.generate(world, value.x, value.z);
|
||||||
|
}
|
||||||
|
}, null);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
MainUtil.sendMessage(plr, "An error occured while creating the world: " + area.worldname);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
default: // Start creation
|
||||||
|
final SetupObject object = new SetupObject();
|
||||||
|
String[] split = args[1].split(":");
|
||||||
|
String id;
|
||||||
|
if (split.length == 2) {
|
||||||
|
id = split[1];
|
||||||
|
} else {
|
||||||
|
id = null;
|
||||||
|
}
|
||||||
|
object.world = split[0];
|
||||||
|
final HybridPlotWorld pa = new HybridPlotWorld(object.world, id, new HybridGen(), null, null);
|
||||||
|
if (PS.get().getPlotArea(pa.worldname, id) != null) {
|
||||||
|
C.SETUP_WORLD_TAKEN.send(plr, pa.worldname);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
Set<PlotArea> areas = PS.get().getPlotAreas(pa.worldname);
|
||||||
|
if (areas.size() > 0) {
|
||||||
|
PlotArea area = areas.iterator().next();
|
||||||
|
pa.TYPE = area.TYPE;
|
||||||
|
}
|
||||||
|
for (int i = 2; i < args.length; i++) {
|
||||||
|
String[] pair = args[i].split("=");
|
||||||
|
if (pair.length != 2) {
|
||||||
|
C.COMMAND_SYNTAX.send(plr, "/plot area create [world[:id]] [<modifier>=<value>]...");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
switch (pair[0].toLowerCase()) {
|
||||||
|
case "s":
|
||||||
|
case "size": {
|
||||||
|
pa.PLOT_WIDTH = Integer.parseInt(pair[1]);
|
||||||
|
pa.SIZE = (short) (pa.PLOT_WIDTH + pa.ROAD_WIDTH);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "g":
|
||||||
|
case "gap": {
|
||||||
|
pa.ROAD_WIDTH = Integer.parseInt(pair[1]);
|
||||||
|
pa.SIZE = (short) (pa.PLOT_WIDTH + pa.ROAD_WIDTH);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "h":
|
||||||
|
case "height": {
|
||||||
|
int value = Integer.parseInt(pair[1]);
|
||||||
|
pa.PLOT_HEIGHT = value;
|
||||||
|
pa.ROAD_HEIGHT = value;
|
||||||
|
pa.WALL_HEIGHT = value;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "f":
|
||||||
|
case "floor": {
|
||||||
|
pa.TOP_BLOCK = Configuration.BLOCKLIST.parseString(pair[1]);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "m":
|
||||||
|
case "main": {
|
||||||
|
pa.MAIN_BLOCK = Configuration.BLOCKLIST.parseString(pair[1]);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "w":
|
||||||
|
case "wall": {
|
||||||
|
pa.WALL_FILLING = Configuration.BLOCK.parseString(pair[1]);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "b":
|
||||||
|
case "border": {
|
||||||
|
pa.WALL_BLOCK = Configuration.BLOCK.parseString(pair[1]);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "terrain": {
|
||||||
|
pa.TERRAIN = Integer.parseInt(pair[1]);
|
||||||
|
object.terrain = pa.TERRAIN;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "type": {
|
||||||
|
pa.TYPE = Integer.parseInt(pair[1]);
|
||||||
|
object.type = pa.TYPE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default: {
|
||||||
|
C.COMMAND_SYNTAX.send(plr, "/plot area create [world[:id]] [<modifier>=<value>]...");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (pa.TYPE != 2) {
|
||||||
|
if (WorldUtil.IMP.isWorld(pa.worldname)) {
|
||||||
|
C.SETUP_WORLD_TAKEN.send(plr, pa.worldname);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
CmdConfirm.addPending(plr, "/plot area " + StringMan.join(args, " "), new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
String path = "worlds." + pa.worldname;
|
||||||
|
if (!PS.get().config.contains(path)) {
|
||||||
|
PS.get().config.createSection(path);
|
||||||
|
}
|
||||||
|
ConfigurationSection section = PS.get().config.getConfigurationSection(path);
|
||||||
|
pa.saveConfiguration(section);
|
||||||
|
pa.loadConfiguration(section);
|
||||||
|
object.plotManager = "PlotSquared";
|
||||||
|
object.setupGenerator = "PlotSquared";
|
||||||
|
String world = SetupUtils.manager.setupWorld(object);
|
||||||
|
if (WorldUtil.IMP.isWorld(world)) {
|
||||||
|
C.SETUP_FINISHED.send(plr);
|
||||||
|
plr.teleport(WorldUtil.IMP.getSpawn(world));
|
||||||
|
} else {
|
||||||
|
MainUtil.sendMessage(plr, "An error occured while creating the world: " + pa.worldname);
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
PS.get().config.save(PS.get().configFile);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (pa.id == null) {
|
||||||
|
C.COMMAND_SYNTAX.send(plr, "/plot area create [world[:id]] [<modifier>=<value>]...");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (WorldUtil.IMP.isWorld(pa.worldname)) {
|
||||||
|
if (!plr.getLocation().getWorld().equals(pa.worldname)) {
|
||||||
|
plr.teleport(WorldUtil.IMP.getSpawn(pa.worldname));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
object.terrain = 0;
|
||||||
|
object.type = 0;
|
||||||
|
SetupUtils.manager.setupWorld(object);
|
||||||
|
plr.teleport(WorldUtil.IMP.getSpawn(pa.worldname));
|
||||||
|
}
|
||||||
|
plr.setMeta("area_create_area", pa);
|
||||||
|
MainUtil.sendMessage(plr, "$1Go to the first corner and use: $2/plot area create pos1");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
case "i":
|
||||||
|
case "info": {
|
||||||
|
if (!Permissions.hasPermission(plr, "plots.area.info")) {
|
||||||
|
C.NO_PERMISSION.send(plr, "plots.area.info");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
PlotArea area;
|
||||||
|
switch (args.length) {
|
||||||
|
case 1:
|
||||||
|
area = plr.getApplicablePlotArea();
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
area = PS.get().getPlotAreaByString(args[1]);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
C.COMMAND_SYNTAX.send(plr, "/plot area info [area]");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (area == null) {
|
||||||
|
if (args.length == 2) {
|
||||||
|
C.NOT_VALID_PLOT_WORLD.send(plr, args[1]);
|
||||||
|
} else {
|
||||||
|
C.NOT_IN_PLOT_WORLD.send(plr);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
String name;
|
||||||
|
double percent;
|
||||||
|
int claimed = area.getPlotCount();
|
||||||
|
int clusters = area.getClusters().size();
|
||||||
|
String region;
|
||||||
|
String generator = area.getGenerator() + "";
|
||||||
|
if (area.TYPE == 2) {
|
||||||
|
PlotId min = area.getMin();
|
||||||
|
PlotId max = area.getMax();
|
||||||
|
name = area.worldname + ";" + area.id + ";" + min + ";" + max;
|
||||||
|
int size = (max.x - min.x + 1) * (max.y - min.y + 1);
|
||||||
|
percent = claimed == 0 ? 0 : size / (double) claimed;
|
||||||
|
region = area.getRegion().toString();
|
||||||
|
} else {
|
||||||
|
name = area.worldname;
|
||||||
|
percent = claimed == 0 ? 0 : Short.MAX_VALUE * Short.MAX_VALUE / (double) claimed;
|
||||||
|
region = "N/A";
|
||||||
|
}
|
||||||
|
String value = "&r$1NAME: " + name
|
||||||
|
+ "\n$1Type: $2" + area.TYPE
|
||||||
|
+ "\n$1Terrain: $2" + area.TERRAIN
|
||||||
|
+ "\n$1Usage: $2" + String.format("%.2f", percent) + "%"
|
||||||
|
+ "\n$1Claimed: $2" + claimed
|
||||||
|
+ "\n$1Clusters: $2" + clusters
|
||||||
|
+ "\n$1Region: $2" + region
|
||||||
|
+ "\n$1Generator: $2" + generator;
|
||||||
|
MainUtil.sendMessage(plr, C.PLOT_INFO_HEADER.s() + '\n' + value + '\n' + C.PLOT_INFO_FOOTER.s(), false);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
case "l":
|
||||||
|
case "list": {
|
||||||
|
if (!Permissions.hasPermission(plr, "plots.area.list")) {
|
||||||
|
C.NO_PERMISSION.send(plr, "plots.area.list");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
int page;
|
||||||
|
switch (args.length) {
|
||||||
|
case 1:
|
||||||
|
page = 0;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
if (MathMan.isInteger(args[1])) {
|
||||||
|
page = Integer.parseInt(args[1]);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
C.COMMAND_SYNTAX.send(plr, "/plot area list [#]");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
ArrayList<PlotArea> areas = new ArrayList<>(PS.get().getPlotAreas());
|
||||||
|
paginate(plr, areas, 8, page, new RunnableVal3<Integer, PlotArea, PlotMessage>() {
|
||||||
|
@Override
|
||||||
|
public void run(Integer i, PlotArea area, PlotMessage message) {
|
||||||
|
String name;
|
||||||
|
double percent;
|
||||||
|
int claimed = area.getPlotCount();
|
||||||
|
int clusters = area.getClusters().size();
|
||||||
|
String region;
|
||||||
|
String generator = area.getGenerator() + "";
|
||||||
|
if (area.TYPE == 2) {
|
||||||
|
PlotId min = area.getMin();
|
||||||
|
PlotId max = area.getMax();
|
||||||
|
name = area.worldname + ";" + area.id + ";" + min + ";" + max;
|
||||||
|
int size = (max.x - min.x + 1) * (max.y - min.y + 1);
|
||||||
|
percent = claimed == 0 ? 0 : size / (double) claimed;
|
||||||
|
region = area.getRegion().toString();
|
||||||
|
} else {
|
||||||
|
name = area.worldname;
|
||||||
|
percent = claimed == 0 ? 0 : Short.MAX_VALUE * Short.MAX_VALUE / (double) claimed;
|
||||||
|
region = "N/A";
|
||||||
|
}
|
||||||
|
PlotMessage tooltip = new PlotMessage()
|
||||||
|
.text("Claimed=").color("$1").text("" + claimed).color("$2")
|
||||||
|
.text("\nUsage=").color("$1").text(String.format("%.2f", percent) + "%").color("$2")
|
||||||
|
.text("\nClusters=").color("$1").text("" + clusters).color("$2")
|
||||||
|
.text("\nRegion=").color("$1").text(region).color("$2")
|
||||||
|
.text("\nGenerator=").color("$1").text(generator).color("$2");
|
||||||
|
|
||||||
|
// type / terrain
|
||||||
|
String visit = "/plot area tp " + area.toString();
|
||||||
|
message.text("[").color("$3")
|
||||||
|
.text(i + "").command(visit).tooltip(visit).color("$1")
|
||||||
|
.text("]").color("$3")
|
||||||
|
.text(" " + name).tooltip(tooltip).command("/plot area info " + area).color("$1").text(" - ").color("$2")
|
||||||
|
.text(area.TYPE + ":" + area.TERRAIN).color("$3");
|
||||||
|
}
|
||||||
|
}, "/plot area list", C.AREA_LIST_HEADER_PAGED.s());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
case "goto":
|
||||||
|
case "v":
|
||||||
|
case "teleport":
|
||||||
|
case "visit":
|
||||||
|
case "tp": {
|
||||||
|
if (!Permissions.hasPermission(plr, "plots.area.tp")) {
|
||||||
|
C.NO_PERMISSION.send(plr, "plots.area.tp");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (args.length != 2) {
|
||||||
|
C.COMMAND_SYNTAX.send(plr, "/plot visit [area]");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
PlotArea area = PS.get().getPlotAreaByString(args[1]);
|
||||||
|
if (area == null) {
|
||||||
|
C.NOT_VALID_PLOT_WORLD.send(plr, args[1]);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
Location spawn = WorldUtil.IMP.getSpawn(area.worldname);
|
||||||
|
plr.teleport(spawn);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
C.COMMAND_SYNTAX.send(plr, getUsage());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -29,7 +29,7 @@ import com.intellectualcrafters.plot.util.MainUtil;
|
|||||||
import com.intellectualcrafters.plot.util.Permissions;
|
import com.intellectualcrafters.plot.util.Permissions;
|
||||||
import com.plotsquared.general.commands.CommandDeclaration;
|
import com.plotsquared.general.commands.CommandDeclaration;
|
||||||
|
|
||||||
@CommandDeclaration(command = "bo3", aliases = { "bo2" }, description = "Mark a plot as done", permission = "plots.bo3", category = CommandCategory.ACTIONS, requiredType = RequiredType.NONE)
|
@CommandDeclaration(command = "bo3", aliases = { "bo2" }, description = "Mark a plot as done", permission = "plots.bo3", category = CommandCategory.SCHEMATIC, requiredType = RequiredType.NONE)
|
||||||
public class BO3 extends SubCommand {
|
public class BO3 extends SubCommand {
|
||||||
|
|
||||||
public void noArgs(final PlotPlayer plr) {
|
public void noArgs(final PlotPlayer plr) {
|
||||||
|
@ -34,7 +34,7 @@ permission = "plots.set.biome",
|
|||||||
description = "Set the plot biome",
|
description = "Set the plot biome",
|
||||||
usage = "/plot biome [biome]",
|
usage = "/plot biome [biome]",
|
||||||
aliases = { "biome", "sb", "setb", "b" },
|
aliases = { "biome", "sb", "setb", "b" },
|
||||||
category = CommandCategory.ACTIONS,
|
category = CommandCategory.APPEARANCE,
|
||||||
requiredType = RequiredType.NONE)
|
requiredType = RequiredType.NONE)
|
||||||
public class Biome extends SetCommand {
|
public class Biome extends SetCommand {
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ command = "chat",
|
|||||||
description = "Toggle plot chat on or off",
|
description = "Toggle plot chat on or off",
|
||||||
usage = "/plot chat [on|off]",
|
usage = "/plot chat [on|off]",
|
||||||
permission = "plots.chat",
|
permission = "plots.chat",
|
||||||
category = CommandCategory.ACTIONS,
|
category = CommandCategory.CHAT,
|
||||||
requiredType = RequiredType.NONE)
|
requiredType = RequiredType.NONE)
|
||||||
public class Chat extends SubCommand {
|
public class Chat extends SubCommand {
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ 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;
|
||||||
|
|
||||||
@CommandDeclaration(command = "clear", description = "Clear a plot", permission = "plots.clear", category = CommandCategory.ACTIONS, usage = "/plot clear [id]")
|
@CommandDeclaration(command = "clear", description = "Clear a plot", permission = "plots.clear", category = CommandCategory.APPEARANCE, usage = "/plot clear [id]")
|
||||||
public class Clear extends SubCommand {
|
public class Clear extends SubCommand {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -46,7 +46,7 @@ import com.plotsquared.general.commands.CommandDeclaration;
|
|||||||
@CommandDeclaration(
|
@CommandDeclaration(
|
||||||
command = "cluster",
|
command = "cluster",
|
||||||
aliases = { "clusters" },
|
aliases = { "clusters" },
|
||||||
category = CommandCategory.ACTIONS,
|
category = CommandCategory.ADMINISTRATION,
|
||||||
requiredType = RequiredType.NONE,
|
requiredType = RequiredType.NONE,
|
||||||
permission = "plots.cluster",
|
permission = "plots.cluster",
|
||||||
description = "Manage a plot cluster")
|
description = "Manage a plot cluster")
|
||||||
|
@ -16,25 +16,40 @@ public enum CommandCategory {
|
|||||||
*
|
*
|
||||||
* Such as: /plot visit
|
* Such as: /plot visit
|
||||||
*/
|
*/
|
||||||
TELEPORT("Teleportation"),
|
TELEPORT("Teleport"),
|
||||||
/**
|
/**
|
||||||
* Action Commands
|
* Protection
|
||||||
*
|
|
||||||
* Such as: /plot clear
|
|
||||||
*/
|
*/
|
||||||
ACTIONS("Actions"),
|
SETTINGS("Protection"),
|
||||||
|
/**
|
||||||
|
* Chat
|
||||||
|
*/
|
||||||
|
CHAT("Chat"),
|
||||||
|
/**
|
||||||
|
* Web
|
||||||
|
*/
|
||||||
|
SCHEMATIC("Web"),
|
||||||
|
/**
|
||||||
|
* Cosmetic
|
||||||
|
*/
|
||||||
|
APPEARANCE("Cosmetic"),
|
||||||
/**
|
/**
|
||||||
* Information Commands
|
* Information Commands
|
||||||
*
|
*
|
||||||
* Such as: /plot info
|
* Such as: /plot info
|
||||||
*/
|
*/
|
||||||
INFO("Information"),
|
INFO("Info"),
|
||||||
/**
|
/**
|
||||||
* Debug Commands
|
* Debug Commands
|
||||||
*
|
*
|
||||||
* Such as: /plot debug
|
* Such as: /plot debug
|
||||||
*/
|
*/
|
||||||
DEBUG("Debug");
|
DEBUG("Debug"),
|
||||||
|
/**
|
||||||
|
* Administration commands
|
||||||
|
*/
|
||||||
|
ADMINISTRATION("Admin");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The category name (Readable)
|
* The category name (Readable)
|
||||||
*/
|
*/
|
||||||
|
@ -36,7 +36,7 @@ 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;
|
||||||
|
|
||||||
@CommandDeclaration(command = "comment", aliases = { "msg" }, description = "Comment on a plot", category = CommandCategory.ACTIONS, requiredType = RequiredType.NONE, permission = "plots.comment")
|
@CommandDeclaration(command = "comment", aliases = { "msg" }, description = "Comment on a plot", category = CommandCategory.CHAT, requiredType = RequiredType.NONE, permission = "plots.comment")
|
||||||
public class Comment extends SubCommand {
|
public class Comment extends SubCommand {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -39,7 +39,7 @@ 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;
|
||||||
|
|
||||||
@CommandDeclaration(command = "condense", permission = "plots.admin", description = "Condense a plotworld", category = CommandCategory.DEBUG, requiredType = RequiredType.CONSOLE)
|
@CommandDeclaration(command = "condense", permission = "plots.admin", description = "Condense a plotworld", category = CommandCategory.ADMINISTRATION, requiredType = RequiredType.CONSOLE)
|
||||||
public class Condense extends SubCommand {
|
public class Condense extends SubCommand {
|
||||||
|
|
||||||
public static boolean TASK = false;
|
public static boolean TASK = false;
|
||||||
|
@ -28,7 +28,7 @@ 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;
|
||||||
|
|
||||||
@CommandDeclaration(command = "confirm", permission = "plots.use", description = "Confirm an action", category = CommandCategory.ACTIONS)
|
@CommandDeclaration(command = "confirm", permission = "plots.use", description = "Confirm an action", category = CommandCategory.INFO)
|
||||||
public class Confirm extends SubCommand {
|
public class Confirm extends SubCommand {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -34,7 +34,7 @@ import com.plotsquared.general.commands.CommandDeclaration;
|
|||||||
command = "continue",
|
command = "continue",
|
||||||
description = "Continue a plot that was previously marked as done",
|
description = "Continue a plot that was previously marked as done",
|
||||||
permission = "plots.continue",
|
permission = "plots.continue",
|
||||||
category = CommandCategory.ACTIONS,
|
category = CommandCategory.SETTINGS,
|
||||||
requiredType = RequiredType.NONE)
|
requiredType = RequiredType.NONE)
|
||||||
public class Continue extends SubCommand {
|
public class Continue extends SubCommand {
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ import com.plotsquared.general.commands.CommandDeclaration;
|
|||||||
command = "copy",
|
command = "copy",
|
||||||
permission = "plots.copy",
|
permission = "plots.copy",
|
||||||
aliases = { "copypaste" },
|
aliases = { "copypaste" },
|
||||||
category = CommandCategory.ACTIONS,
|
category = CommandCategory.CLAIMING,
|
||||||
description = "Copy a plot",
|
description = "Copy a plot",
|
||||||
usage = "/plot copy <X;Z>",
|
usage = "/plot copy <X;Z>",
|
||||||
requiredType = RequiredType.NONE)
|
requiredType = RequiredType.NONE)
|
||||||
|
@ -32,7 +32,7 @@ import com.plotsquared.general.commands.CommandDeclaration;
|
|||||||
@CommandDeclaration(
|
@CommandDeclaration(
|
||||||
command = "createroadschematic",
|
command = "createroadschematic",
|
||||||
aliases = { "crs" },
|
aliases = { "crs" },
|
||||||
category = CommandCategory.DEBUG,
|
category = CommandCategory.ADMINISTRATION,
|
||||||
requiredType = RequiredType.NONE,
|
requiredType = RequiredType.NONE,
|
||||||
permission = "plots.createroadschematic",
|
permission = "plots.createroadschematic",
|
||||||
description = "Add a road schematic to your world using the roads around your current plot",
|
description = "Add a road schematic to your world using the roads around your current plot",
|
||||||
|
@ -22,7 +22,7 @@ import com.plotsquared.general.commands.CommandDeclaration;
|
|||||||
@CommandDeclaration(
|
@CommandDeclaration(
|
||||||
command = "database",
|
command = "database",
|
||||||
aliases = { "convert" },
|
aliases = { "convert" },
|
||||||
category = CommandCategory.DEBUG,
|
category = CommandCategory.ADMINISTRATION,
|
||||||
permission = "plots.database",
|
permission = "plots.database",
|
||||||
description = "Convert/Backup Storage",
|
description = "Convert/Backup Storage",
|
||||||
requiredType = RequiredType.CONSOLE,
|
requiredType = RequiredType.CONSOLE,
|
||||||
|
@ -41,7 +41,7 @@ permission = "plots.delete",
|
|||||||
description = "Delete a plot",
|
description = "Delete a plot",
|
||||||
usage = "/plot delete",
|
usage = "/plot delete",
|
||||||
aliases = { "dispose", "del" },
|
aliases = { "dispose", "del" },
|
||||||
category = CommandCategory.ACTIONS,
|
category = CommandCategory.CLAIMING,
|
||||||
requiredType = RequiredType.NONE)
|
requiredType = RequiredType.NONE)
|
||||||
public class Delete extends SubCommand {
|
public class Delete extends SubCommand {
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ import com.intellectualcrafters.plot.util.WorldUtil;
|
|||||||
import com.plotsquared.general.commands.Argument;
|
import com.plotsquared.general.commands.Argument;
|
||||||
import com.plotsquared.general.commands.CommandDeclaration;
|
import com.plotsquared.general.commands.CommandDeclaration;
|
||||||
|
|
||||||
@CommandDeclaration(command = "deny", aliases = { "d" }, description = "Deny a user from a plot", usage = "/plot deny <player>", category = CommandCategory.ACTIONS, requiredType = RequiredType.NONE)
|
@CommandDeclaration(command = "deny", aliases = { "d" }, description = "Deny a user from a plot", usage = "/plot deny <player>", category = CommandCategory.SETTINGS, requiredType = RequiredType.NONE)
|
||||||
public class Deny extends SubCommand {
|
public class Deny extends SubCommand {
|
||||||
|
|
||||||
public Deny() {
|
public Deny() {
|
||||||
|
@ -34,7 +34,7 @@ permission = "plots.set.desc",
|
|||||||
description = "Set the plot description",
|
description = "Set the plot description",
|
||||||
usage = "/plot desc <description>",
|
usage = "/plot desc <description>",
|
||||||
aliases = { "desc", "setdesc", "setd", "description" },
|
aliases = { "desc", "setdesc", "setd", "description" },
|
||||||
category = CommandCategory.ACTIONS,
|
category = CommandCategory.SETTINGS,
|
||||||
requiredType = RequiredType.NONE)
|
requiredType = RequiredType.NONE)
|
||||||
public class Desc extends SetCommand {
|
public class Desc extends SetCommand {
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ import com.intellectualcrafters.plot.util.MainUtil;
|
|||||||
import com.intellectualcrafters.plot.util.Permissions;
|
import com.intellectualcrafters.plot.util.Permissions;
|
||||||
import com.plotsquared.general.commands.CommandDeclaration;
|
import com.plotsquared.general.commands.CommandDeclaration;
|
||||||
|
|
||||||
@CommandDeclaration(command = "done", aliases = { "submit" }, description = "Mark a plot as done", permission = "plots.done", category = CommandCategory.ACTIONS, requiredType = RequiredType.NONE)
|
@CommandDeclaration(command = "done", aliases = { "submit" }, description = "Mark a plot as done", permission = "plots.done", category = CommandCategory.SETTINGS, requiredType = RequiredType.NONE)
|
||||||
public class Done extends SubCommand {
|
public class Done extends SubCommand {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -16,7 +16,7 @@ import com.intellectualcrafters.plot.util.SchematicHandler;
|
|||||||
import com.intellectualcrafters.plot.util.TaskManager;
|
import com.intellectualcrafters.plot.util.TaskManager;
|
||||||
import com.plotsquared.general.commands.CommandDeclaration;
|
import com.plotsquared.general.commands.CommandDeclaration;
|
||||||
|
|
||||||
@CommandDeclaration(command = "download", aliases = { "dl" }, category = CommandCategory.ACTIONS, requiredType = RequiredType.NONE, description = "Download your plot", permission = "plots.download")
|
@CommandDeclaration(command = "download", aliases = { "dl" }, category = CommandCategory.SCHEMATIC, requiredType = RequiredType.NONE, description = "Download your plot", permission = "plots.download")
|
||||||
public class Download extends SubCommand {
|
public class Download extends SubCommand {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -43,7 +43,7 @@ command = "setflag",
|
|||||||
aliases = { "f", "flag", "setf", "setflag" },
|
aliases = { "f", "flag", "setf", "setflag" },
|
||||||
usage = "/plot flag <set|remove|add|list|info> <flag> <value>",
|
usage = "/plot flag <set|remove|add|list|info> <flag> <value>",
|
||||||
description = "Set plot flags",
|
description = "Set plot flags",
|
||||||
category = CommandCategory.ACTIONS,
|
category = CommandCategory.SETTINGS,
|
||||||
requiredType = RequiredType.NONE,
|
requiredType = RequiredType.NONE,
|
||||||
permission = "plots.flag")
|
permission = "plots.flag")
|
||||||
public class FlagCmd extends SubCommand {
|
public class FlagCmd extends SubCommand {
|
||||||
|
@ -39,7 +39,7 @@ command = "inbox",
|
|||||||
description = "Review the comments for a plot",
|
description = "Review the comments for a plot",
|
||||||
usage = "/plot inbox [inbox] [delete <index>|clear|page]",
|
usage = "/plot inbox [inbox] [delete <index>|clear|page]",
|
||||||
permission = "plots.inbox",
|
permission = "plots.inbox",
|
||||||
category = CommandCategory.ACTIONS,
|
category = CommandCategory.CHAT,
|
||||||
requiredType = RequiredType.NONE)
|
requiredType = RequiredType.NONE)
|
||||||
public class Inbox extends SubCommand {
|
public class Inbox extends SubCommand {
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ import com.intellectualcrafters.plot.util.UUIDHandler;
|
|||||||
import com.intellectualcrafters.plot.util.WorldUtil;
|
import com.intellectualcrafters.plot.util.WorldUtil;
|
||||||
import com.plotsquared.general.commands.CommandDeclaration;
|
import com.plotsquared.general.commands.CommandDeclaration;
|
||||||
|
|
||||||
@CommandDeclaration(command = "kick", aliases = { "k" }, description = "Kick a player from your plot", permission = "plots.kick", category = CommandCategory.ACTIONS, requiredType = RequiredType.NONE)
|
@CommandDeclaration(command = "kick", aliases = { "k" }, description = "Kick a player from your plot", permission = "plots.kick", category = CommandCategory.TELEPORT, requiredType = RequiredType.NONE)
|
||||||
public class Kick extends SubCommand {
|
public class Kick extends SubCommand {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,62 +0,0 @@
|
|||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
||||||
// PlotSquared - A plot manager and world generator for the Bukkit API /
|
|
||||||
// Copyright (c) 2014 IntellectualSites/IntellectualCrafters /
|
|
||||||
// /
|
|
||||||
// This program is free software; you can redistribute it and/or modify /
|
|
||||||
// it under the terms of the GNU General Public License as published by /
|
|
||||||
// the Free Software Foundation; either version 3 of the License, or /
|
|
||||||
// (at your option) any later version. /
|
|
||||||
// /
|
|
||||||
// This program is distributed in the hope that it will be useful, /
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of /
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /
|
|
||||||
// GNU General Public License for more details. /
|
|
||||||
// /
|
|
||||||
// You should have received a copy of the GNU General Public License /
|
|
||||||
// along with this program; if not, write to the Free Software Foundation, /
|
|
||||||
// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA /
|
|
||||||
// /
|
|
||||||
// You can contact us via: support@intellectualsites.com /
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
||||||
package com.intellectualcrafters.plot.commands;
|
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.config.C;
|
|
||||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
|
||||||
import com.intellectualcrafters.plot.util.MainUtil;
|
|
||||||
import com.intellectualcrafters.plot.util.UUIDHandler;
|
|
||||||
import com.plotsquared.general.commands.Argument;
|
|
||||||
import com.plotsquared.general.commands.CommandDeclaration;
|
|
||||||
|
|
||||||
@CommandDeclaration(
|
|
||||||
command = "limit",
|
|
||||||
permission = "plots.limit",
|
|
||||||
description = "Set or increment player plot claim limits",
|
|
||||||
aliases = { "setlimit" },
|
|
||||||
usage = "/plot limit <player> <expression>",
|
|
||||||
category = CommandCategory.DEBUG)
|
|
||||||
public class Limit extends SubCommand {
|
|
||||||
|
|
||||||
public Limit() {
|
|
||||||
requiredArguments = new Argument[] { Argument.String, Argument.String };
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onCommand(final PlotPlayer plr, final String[] args) {
|
|
||||||
final UUID uuid = UUIDHandler.getUUID(args[0], null);
|
|
||||||
if (uuid == null) {
|
|
||||||
MainUtil.sendMessage(plr, C.INVALID_PLAYER, args[0]);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
UUIDHandler.getUUIDWrapper().getOfflinePlayer(uuid);
|
|
||||||
|
|
||||||
// get current plot limit
|
|
||||||
// increase
|
|
||||||
|
|
||||||
// EconHandler.manager.setPermission(op, perm, value);
|
|
||||||
plr.sendMessage("TODO");
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
@ -21,7 +21,7 @@ import com.plotsquared.general.commands.CommandDeclaration;
|
|||||||
@CommandDeclaration(
|
@CommandDeclaration(
|
||||||
command = "load",
|
command = "load",
|
||||||
aliases = { "restore" },
|
aliases = { "restore" },
|
||||||
category = CommandCategory.ACTIONS,
|
category = CommandCategory.SCHEMATIC,
|
||||||
requiredType = RequiredType.NONE,
|
requiredType = RequiredType.NONE,
|
||||||
description = "Load your plot",
|
description = "Load your plot",
|
||||||
permission = "plots.load",
|
permission = "plots.load",
|
||||||
|
@ -68,13 +68,13 @@ public class MainCommand extends CommandManager<PlotPlayer> {
|
|||||||
createCommand(new Buy());
|
createCommand(new Buy());
|
||||||
createCommand(new Save());
|
createCommand(new Save());
|
||||||
createCommand(new Load());
|
createCommand(new Load());
|
||||||
createCommand(new Unclaim());
|
|
||||||
createCommand(new Confirm());
|
createCommand(new Confirm());
|
||||||
createCommand(new Template());
|
createCommand(new Template());
|
||||||
createCommand(new Download());
|
createCommand(new Download());
|
||||||
createCommand(new Update());
|
createCommand(new Update());
|
||||||
createCommand(new Template());
|
createCommand(new Template());
|
||||||
createCommand(new Setup());
|
createCommand(new Setup());
|
||||||
|
createCommand(new Area());
|
||||||
createCommand(new DebugSaveTest());
|
createCommand(new DebugSaveTest());
|
||||||
createCommand(new DebugLoadTest());
|
createCommand(new DebugLoadTest());
|
||||||
createCommand(new CreateRoadSchematic());
|
createCommand(new CreateRoadSchematic());
|
||||||
|
@ -43,7 +43,7 @@ aliases = { "m" },
|
|||||||
description = "Merge the plot you are standing on, with another plot",
|
description = "Merge the plot you are standing on, with another plot",
|
||||||
permission = "plots.merge",
|
permission = "plots.merge",
|
||||||
usage = "/plot merge <all|n|e|s|w> [removeroads]",
|
usage = "/plot merge <all|n|e|s|w> [removeroads]",
|
||||||
category = CommandCategory.ACTIONS,
|
category = CommandCategory.SETTINGS,
|
||||||
requiredType = RequiredType.NONE)
|
requiredType = RequiredType.NONE)
|
||||||
public class Merge extends SubCommand {
|
public class Merge extends SubCommand {
|
||||||
public final static String[] values = new String[] { "north", "east", "south", "west", "auto" };
|
public final static String[] values = new String[] { "north", "east", "south", "west", "auto" };
|
||||||
|
@ -34,7 +34,7 @@ command = "move",
|
|||||||
description = "Move a plot",
|
description = "Move a plot",
|
||||||
aliases = { "debugmove" },
|
aliases = { "debugmove" },
|
||||||
permission = "plots.move",
|
permission = "plots.move",
|
||||||
category = CommandCategory.ACTIONS,
|
category = CommandCategory.CLAIMING,
|
||||||
requiredType = RequiredType.NONE)
|
requiredType = RequiredType.NONE)
|
||||||
public class Move extends SubCommand {
|
public class Move extends SubCommand {
|
||||||
|
|
||||||
|
@ -29,11 +29,16 @@ import com.intellectualcrafters.plot.object.PlotBlock;
|
|||||||
import com.intellectualcrafters.plot.object.PlotInventory;
|
import com.intellectualcrafters.plot.object.PlotInventory;
|
||||||
import com.intellectualcrafters.plot.object.PlotItemStack;
|
import com.intellectualcrafters.plot.object.PlotItemStack;
|
||||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
import com.intellectualcrafters.plot.util.MainUtil;
|
|
||||||
import com.intellectualcrafters.plot.util.WorldUtil;
|
import com.intellectualcrafters.plot.util.WorldUtil;
|
||||||
import com.plotsquared.general.commands.CommandDeclaration;
|
import com.plotsquared.general.commands.CommandDeclaration;
|
||||||
|
|
||||||
@CommandDeclaration(command = "music", permission = "plots.music", description = "Player music in a plot", usage = "/plot music", category = CommandCategory.ACTIONS, requiredType = RequiredType.NONE)
|
@CommandDeclaration(
|
||||||
|
command = "music",
|
||||||
|
permission = "plots.music",
|
||||||
|
description = "Player music in a plot",
|
||||||
|
usage = "/plot music",
|
||||||
|
category = CommandCategory.APPEARANCE,
|
||||||
|
requiredType = RequiredType.NONE)
|
||||||
public class MusicSubcommand extends SubCommand {
|
public class MusicSubcommand extends SubCommand {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -38,7 +38,7 @@ permission = "plots.set.owner",
|
|||||||
description = "Set the plot owner",
|
description = "Set the plot owner",
|
||||||
usage = "/plot setowner <player>",
|
usage = "/plot setowner <player>",
|
||||||
aliases = { "owner", "so", "seto" },
|
aliases = { "owner", "so", "seto" },
|
||||||
category = CommandCategory.ACTIONS,
|
category = CommandCategory.CLAIMING,
|
||||||
requiredType = RequiredType.NONE)
|
requiredType = RequiredType.NONE)
|
||||||
public class Owner extends SetCommand {
|
public class Owner extends SetCommand {
|
||||||
|
|
||||||
@ -58,6 +58,16 @@ public class Owner extends SetCommand {
|
|||||||
name = name == null ? value : name;
|
name = name == null ? value : name;
|
||||||
}
|
}
|
||||||
if (uuid == null) {
|
if (uuid == null) {
|
||||||
|
if (value.equalsIgnoreCase("none")) {
|
||||||
|
HashSet<Plot> connected = plot.getConnectedPlots();
|
||||||
|
plot.unlink();
|
||||||
|
for (Plot current : connected) {
|
||||||
|
current.unclaim();
|
||||||
|
current.removeSign();
|
||||||
|
}
|
||||||
|
MainUtil.sendMessage(plr, C.SET_OWNER);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
C.INVALID_PLAYER.send(plr, value);
|
C.INVALID_PLAYER.send(plr, value);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -43,7 +43,7 @@ usage = "/plot purge world:<world> area:<area> id:<id> owner:<owner> shared:<sha
|
|||||||
command = "purge",
|
command = "purge",
|
||||||
permission = "plots.admin",
|
permission = "plots.admin",
|
||||||
description = "Purge all plots for a world",
|
description = "Purge all plots for a world",
|
||||||
category = CommandCategory.ACTIONS,
|
category = CommandCategory.ADMINISTRATION,
|
||||||
requiredType = RequiredType.CONSOLE)
|
requiredType = RequiredType.CONSOLE)
|
||||||
public class Purge extends SubCommand {
|
public class Purge extends SubCommand {
|
||||||
@Override
|
@Override
|
||||||
|
@ -52,7 +52,7 @@ permission = "plots.rate",
|
|||||||
description = "Rate the plot",
|
description = "Rate the plot",
|
||||||
usage = "/plot rate [#|next]",
|
usage = "/plot rate [#|next]",
|
||||||
aliases = { "rt" },
|
aliases = { "rt" },
|
||||||
category = CommandCategory.ACTIONS,
|
category = CommandCategory.INFO,
|
||||||
requiredType = RequiredType.NONE)
|
requiredType = RequiredType.NONE)
|
||||||
public class Rate extends SubCommand {
|
public class Rate extends SubCommand {
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ command = "regenallroads",
|
|||||||
description = "Regenerate all roads in the map using the set road schematic",
|
description = "Regenerate all roads in the map using the set road schematic",
|
||||||
aliases = { "rgar" },
|
aliases = { "rgar" },
|
||||||
usage = "/plot regenallroads <world> [height]",
|
usage = "/plot regenallroads <world> [height]",
|
||||||
category = CommandCategory.DEBUG,
|
category = CommandCategory.ADMINISTRATION,
|
||||||
requiredType = RequiredType.CONSOLE,
|
requiredType = RequiredType.CONSOLE,
|
||||||
permission = "plots.regenallroads")
|
permission = "plots.regenallroads")
|
||||||
public class RegenAllRoads extends SubCommand {
|
public class RegenAllRoads extends SubCommand {
|
||||||
|
@ -33,7 +33,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;
|
||||||
|
|
||||||
@CommandDeclaration(command = "reload", permission = "plots.admin.command.reload", description = "Reload configurations", usage = "/plot reload", category = CommandCategory.INFO)
|
@CommandDeclaration(command = "reload", permission = "plots.admin.command.reload", description = "Reload configurations", usage = "/plot reload", category = CommandCategory.ADMINISTRATION)
|
||||||
public class Reload extends SubCommand {
|
public class Reload extends SubCommand {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -39,7 +39,7 @@ command = "remove",
|
|||||||
aliases = { "r" },
|
aliases = { "r" },
|
||||||
description = "Remove a player from a plot",
|
description = "Remove a player from a plot",
|
||||||
usage = "/plot remove <player>",
|
usage = "/plot remove <player>",
|
||||||
category = CommandCategory.ACTIONS,
|
category = CommandCategory.SETTINGS,
|
||||||
requiredType = RequiredType.NONE,
|
requiredType = RequiredType.NONE,
|
||||||
permission = "plots.remove")
|
permission = "plots.remove")
|
||||||
public class Remove extends SubCommand {
|
public class Remove extends SubCommand {
|
||||||
|
@ -19,7 +19,7 @@ import com.intellectualcrafters.plot.util.SchematicHandler;
|
|||||||
import com.intellectualcrafters.plot.util.TaskManager;
|
import com.intellectualcrafters.plot.util.TaskManager;
|
||||||
import com.plotsquared.general.commands.CommandDeclaration;
|
import com.plotsquared.general.commands.CommandDeclaration;
|
||||||
|
|
||||||
@CommandDeclaration(command = "save", aliases = { "backup" }, description = "Save your plot", category = CommandCategory.ACTIONS, requiredType = RequiredType.NONE, permission = "plots.save")
|
@CommandDeclaration(command = "save", aliases = { "backup" }, description = "Save your plot", category = CommandCategory.SCHEMATIC, requiredType = RequiredType.NONE, permission = "plots.save")
|
||||||
public class Save extends SubCommand {
|
public class Save extends SubCommand {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -46,7 +46,7 @@ command = "schematic",
|
|||||||
permission = "plots.schematic",
|
permission = "plots.schematic",
|
||||||
description = "Schematic command",
|
description = "Schematic command",
|
||||||
aliases = { "sch" },
|
aliases = { "sch" },
|
||||||
category = CommandCategory.ACTIONS,
|
category = CommandCategory.SCHEMATIC,
|
||||||
usage = "/plot schematic <arg...>")
|
usage = "/plot schematic <arg...>")
|
||||||
public class SchematicCmd extends SubCommand {
|
public class SchematicCmd extends SubCommand {
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ description = "Set a plot value",
|
|||||||
aliases = { "s" },
|
aliases = { "s" },
|
||||||
usage = "/plot set <biome|alias|home|flag> <value...>",
|
usage = "/plot set <biome|alias|home|flag> <value...>",
|
||||||
permission = "plots.set",
|
permission = "plots.set",
|
||||||
category = CommandCategory.ACTIONS,
|
category = CommandCategory.APPEARANCE,
|
||||||
requiredType = RequiredType.NONE)
|
requiredType = RequiredType.NONE)
|
||||||
public class Set extends SubCommand {
|
public class Set extends SubCommand {
|
||||||
public final static String[] values = new String[] { "biome", "alias", "home", "flag" };
|
public final static String[] values = new String[] { "biome", "alias", "home", "flag" };
|
||||||
|
@ -34,7 +34,7 @@ permission = "plots.set.home",
|
|||||||
description = "Set the plot home",
|
description = "Set the plot home",
|
||||||
usage = "/plot sethome [none]",
|
usage = "/plot sethome [none]",
|
||||||
aliases = { "sh", "seth" },
|
aliases = { "sh", "seth" },
|
||||||
category = CommandCategory.ACTIONS,
|
category = CommandCategory.SETTINGS,
|
||||||
requiredType = RequiredType.NONE)
|
requiredType = RequiredType.NONE)
|
||||||
public class SetHome extends SetCommand {
|
public class SetHome extends SetCommand {
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ permission = "plots.admin.command.setup",
|
|||||||
description = "Setup wizard for plot worlds",
|
description = "Setup wizard for plot worlds",
|
||||||
usage = "/plot setup",
|
usage = "/plot setup",
|
||||||
aliases = { "create" },
|
aliases = { "create" },
|
||||||
category = CommandCategory.ACTIONS)
|
category = CommandCategory.ADMINISTRATION)
|
||||||
public class Setup extends SubCommand {
|
public class Setup extends SubCommand {
|
||||||
|
|
||||||
public void displayGenerators(final PlotPlayer plr) {
|
public void displayGenerators(final PlotPlayer plr) {
|
||||||
|
@ -20,8 +20,12 @@
|
|||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
package com.intellectualcrafters.plot.commands;
|
package com.intellectualcrafters.plot.commands;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.config.C;
|
import com.intellectualcrafters.plot.config.C;
|
||||||
|
import com.intellectualcrafters.plot.object.PlotMessage;
|
||||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
|
import com.intellectualcrafters.plot.object.RunnableVal3;
|
||||||
import com.intellectualcrafters.plot.util.MainUtil;
|
import com.intellectualcrafters.plot.util.MainUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -50,4 +54,45 @@ public abstract class SubCommand extends com.plotsquared.general.commands.Comman
|
|||||||
c.send(plr, args);
|
c.send(plr, args);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public <T> void paginate(PlotPlayer player, List<T> c, int size, int page, RunnableVal3<Integer, T, PlotMessage> add, String baseCommand, String header) {
|
||||||
|
// Calculate pages & index
|
||||||
|
if (page < 0) {
|
||||||
|
page = 0;
|
||||||
|
}
|
||||||
|
final int totalPages = (int) Math.ceil(c.size() / size);
|
||||||
|
if (page > totalPages) {
|
||||||
|
page = totalPages;
|
||||||
|
}
|
||||||
|
int max = (page * size) + size;
|
||||||
|
if (max > c.size()) {
|
||||||
|
max = c.size();
|
||||||
|
}
|
||||||
|
// Send the header
|
||||||
|
header = header.replaceAll("%cur", page + 1 + "").replaceAll("%max", totalPages + 1 + "").replaceAll("%amount%", totalPages + "").replaceAll("%word%", "all");
|
||||||
|
MainUtil.sendMessage(player, header);
|
||||||
|
// Send the page content
|
||||||
|
final List<T> subList = c.subList(page * size, max);
|
||||||
|
int i = page * size;
|
||||||
|
for (final T obj : subList) {
|
||||||
|
i++;
|
||||||
|
PlotMessage msg = new PlotMessage();
|
||||||
|
add.run(i, obj, msg);
|
||||||
|
msg.send(player);
|
||||||
|
}
|
||||||
|
// Send the footer
|
||||||
|
if ((page < totalPages) && (page > 0)) { // Back | Next
|
||||||
|
new PlotMessage().text("<-").color("$1").command(baseCommand + " " + (page)).text(" | ").color("$3").text("->").color("$1").command(baseCommand + " " + (page + 2))
|
||||||
|
.text(C.CLICKABLE.s()).color("$2").send(player);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if ((page == 0) && (totalPages != 0)) { // Next
|
||||||
|
new PlotMessage().text("<-").color("$3").text(" | ").color("$3").text("->").color("$1").command(baseCommand + " " + (page + 2)).text(C.CLICKABLE.s()).color("$2").send(player);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if ((page == totalPages) && (totalPages != 0)) { // Back
|
||||||
|
new PlotMessage().text("<-").color("$1").command(baseCommand + " " + (page)).text(" | ").color("$3").text("->").color("$3").text(C.CLICKABLE.s()).color("$2").send(player);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ import com.intellectualcrafters.plot.util.MainUtil;
|
|||||||
import com.intellectualcrafters.plot.util.Permissions;
|
import com.intellectualcrafters.plot.util.Permissions;
|
||||||
import com.plotsquared.general.commands.CommandDeclaration;
|
import com.plotsquared.general.commands.CommandDeclaration;
|
||||||
|
|
||||||
@CommandDeclaration(usage = "/plot swap <X;Z>", command = "swap", description = "Swap two plots", aliases = { "switch" }, category = CommandCategory.ACTIONS, requiredType = RequiredType.NONE)
|
@CommandDeclaration(usage = "/plot swap <X;Z>", command = "swap", description = "Swap two plots", aliases = { "switch" }, category = CommandCategory.CLAIMING, requiredType = RequiredType.NONE)
|
||||||
public class Swap extends SubCommand {
|
public class Swap extends SubCommand {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -35,7 +35,7 @@ usage = "/plot target <<plot>|nearest>",
|
|||||||
description = "Target a plot with your compass",
|
description = "Target a plot with your compass",
|
||||||
permission = "plots.target",
|
permission = "plots.target",
|
||||||
requiredType = RequiredType.NONE,
|
requiredType = RequiredType.NONE,
|
||||||
category = CommandCategory.ACTIONS)
|
category = CommandCategory.INFO)
|
||||||
public class Target extends SubCommand {
|
public class Target extends SubCommand {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -51,7 +51,7 @@ command = "template",
|
|||||||
permission = "plots.admin",
|
permission = "plots.admin",
|
||||||
description = "Create or use a world template",
|
description = "Create or use a world template",
|
||||||
usage = "/plot template [import|export] <world> <template>",
|
usage = "/plot template [import|export] <world> <template>",
|
||||||
category = CommandCategory.DEBUG)
|
category = CommandCategory.ADMINISTRATION)
|
||||||
public class Template extends SubCommand {
|
public class Template extends SubCommand {
|
||||||
|
|
||||||
public static boolean extractAllFiles(final String world, final String template) {
|
public static boolean extractAllFiles(final String world, final String template) {
|
||||||
|
@ -41,7 +41,7 @@ permission = "plots.use",
|
|||||||
description = "Toggle per user settings",
|
description = "Toggle per user settings",
|
||||||
usage = "/plot toggle <setting>",
|
usage = "/plot toggle <setting>",
|
||||||
requiredType = RequiredType.NONE,
|
requiredType = RequiredType.NONE,
|
||||||
category = CommandCategory.ACTIONS)
|
category = CommandCategory.SETTINGS)
|
||||||
public class Toggle extends SubCommand {
|
public class Toggle extends SubCommand {
|
||||||
|
|
||||||
public void noArgs(final PlotPlayer plr) {
|
public void noArgs(final PlotPlayer plr) {
|
||||||
|
@ -49,7 +49,7 @@ permission = "plots.admin",
|
|||||||
description = "Delete unmodified portions of your plotworld",
|
description = "Delete unmodified portions of your plotworld",
|
||||||
usage = "/plot trim",
|
usage = "/plot trim",
|
||||||
requiredType = RequiredType.CONSOLE,
|
requiredType = RequiredType.CONSOLE,
|
||||||
category = CommandCategory.DEBUG)
|
category = CommandCategory.ADMINISTRATION)
|
||||||
public class Trim extends SubCommand {
|
public class Trim extends SubCommand {
|
||||||
|
|
||||||
public static boolean TASK = false;
|
public static boolean TASK = false;
|
||||||
|
@ -40,7 +40,7 @@ aliases = { "t" },
|
|||||||
requiredType = RequiredType.NONE,
|
requiredType = RequiredType.NONE,
|
||||||
usage = "/plot trust <player>",
|
usage = "/plot trust <player>",
|
||||||
description = "Allow a player to build in a plot",
|
description = "Allow a player to build in a plot",
|
||||||
category = CommandCategory.ACTIONS)
|
category = CommandCategory.SETTINGS)
|
||||||
public class Trust extends SubCommand {
|
public class Trust extends SubCommand {
|
||||||
|
|
||||||
public Trust() {
|
public Trust() {
|
||||||
|
@ -1,63 +0,0 @@
|
|||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
||||||
// PlotSquared - A plot manager and world generator for the Bukkit API /
|
|
||||||
// Copyright (c) 2014 IntellectualSites/IntellectualCrafters /
|
|
||||||
// /
|
|
||||||
// This program is free software; you can redistribute it and/or modify /
|
|
||||||
// it under the terms of the GNU General Public License as published by /
|
|
||||||
// the Free Software Foundation; either version 3 of the License, or /
|
|
||||||
// (at your option) any later version. /
|
|
||||||
// /
|
|
||||||
// This program is distributed in the hope that it will be useful, /
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of /
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /
|
|
||||||
// GNU General Public License for more details. /
|
|
||||||
// /
|
|
||||||
// You should have received a copy of the GNU General Public License /
|
|
||||||
// along with this program; if not, write to the Free Software Foundation, /
|
|
||||||
// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA /
|
|
||||||
// /
|
|
||||||
// You can contact us via: support@intellectualsites.com /
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
||||||
package com.intellectualcrafters.plot.commands;
|
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.config.C;
|
|
||||||
import com.intellectualcrafters.plot.object.Location;
|
|
||||||
import com.intellectualcrafters.plot.object.Plot;
|
|
||||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
|
||||||
import com.intellectualcrafters.plot.util.MainUtil;
|
|
||||||
import com.intellectualcrafters.plot.util.Permissions;
|
|
||||||
import com.plotsquared.general.commands.CommandDeclaration;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Unclaiming a plot makes no changes to the terrain or plot border and only removes the owner and should be regarded as an admin command.
|
|
||||||
*/
|
|
||||||
@CommandDeclaration(
|
|
||||||
command = "unclaim",
|
|
||||||
usage = "/plot unclaim",
|
|
||||||
requiredType = RequiredType.NONE,
|
|
||||||
description = "Unclaim a plot (admin command/does not clear plot)",
|
|
||||||
category = CommandCategory.ACTIONS)
|
|
||||||
public class Unclaim extends SubCommand {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onCommand(final PlotPlayer plr, final String[] args) {
|
|
||||||
final Location loc = plr.getLocation();
|
|
||||||
final Plot plot = loc.getPlotAbs();
|
|
||||||
if (plot == null) {
|
|
||||||
return !sendMessage(plr, C.NOT_IN_PLOT);
|
|
||||||
}
|
|
||||||
if (!plot.hasOwner()) {
|
|
||||||
return !sendMessage(plr, C.PLOT_NOT_CLAIMED);
|
|
||||||
}
|
|
||||||
if (((!plot.hasOwner() || !plot.isOwner(plr.getUUID()))) && !Permissions.hasPermission(plr, "plots.admin.command.unclaim")) {
|
|
||||||
return !sendMessage(plr, C.NO_PLOT_PERMS);
|
|
||||||
}
|
|
||||||
if (plot.unclaim()) {
|
|
||||||
plot.removeSign();
|
|
||||||
MainUtil.sendMessage(plr, C.UNCLAIM_SUCCESS);
|
|
||||||
} else {
|
|
||||||
MainUtil.sendMessage(plr, C.UNCLAIM_FAILED);
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
@ -39,7 +39,7 @@ aliases = { "ud" },
|
|||||||
description = "Remove a denied user from a plot",
|
description = "Remove a denied user from a plot",
|
||||||
usage = "/plot undeny <player>",
|
usage = "/plot undeny <player>",
|
||||||
requiredType = RequiredType.NONE,
|
requiredType = RequiredType.NONE,
|
||||||
category = CommandCategory.ACTIONS)
|
category = CommandCategory.SETTINGS)
|
||||||
public class Undeny extends SubCommand {
|
public class Undeny extends SubCommand {
|
||||||
|
|
||||||
public Undeny() {
|
public Undeny() {
|
||||||
|
@ -32,7 +32,7 @@ import com.intellectualcrafters.plot.util.StringMan;
|
|||||||
import com.intellectualcrafters.plot.util.TaskManager;
|
import com.intellectualcrafters.plot.util.TaskManager;
|
||||||
import com.plotsquared.general.commands.CommandDeclaration;
|
import com.plotsquared.general.commands.CommandDeclaration;
|
||||||
|
|
||||||
@CommandDeclaration(command = "unlink", aliases = { "u", "unmerge" }, description = "Unlink a mega-plot", usage = "/plot unlink", requiredType = RequiredType.NONE, category = CommandCategory.ACTIONS)
|
@CommandDeclaration(command = "unlink", aliases = { "u", "unmerge" }, description = "Unlink a mega-plot", usage = "/plot unlink", requiredType = RequiredType.NONE, category = CommandCategory.SETTINGS)
|
||||||
public class Unlink extends SubCommand {
|
public class Unlink extends SubCommand {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -42,7 +42,7 @@ permission = "plots.untrust",
|
|||||||
description = "Remove a trusted user from a plot",
|
description = "Remove a trusted user from a plot",
|
||||||
usage = "/plot untrust <player>",
|
usage = "/plot untrust <player>",
|
||||||
requiredType = RequiredType.NONE,
|
requiredType = RequiredType.NONE,
|
||||||
category = CommandCategory.ACTIONS)
|
category = CommandCategory.SETTINGS)
|
||||||
public class Untrust extends SubCommand {
|
public class Untrust extends SubCommand {
|
||||||
|
|
||||||
public Untrust() {
|
public Untrust() {
|
||||||
|
@ -36,7 +36,7 @@ description = "Update PlotSquared",
|
|||||||
usage = "/plot update",
|
usage = "/plot update",
|
||||||
requiredType = RequiredType.NONE,
|
requiredType = RequiredType.NONE,
|
||||||
aliases = { "updateplugin" },
|
aliases = { "updateplugin" },
|
||||||
category = CommandCategory.DEBUG)
|
category = CommandCategory.ADMINISTRATION)
|
||||||
public class Update extends SubCommand {
|
public class Update extends SubCommand {
|
||||||
|
|
||||||
public static String version;
|
public static String version;
|
||||||
|
@ -30,7 +30,7 @@ description = "Force bypass of WorldEdit",
|
|||||||
aliases = { "wea" },
|
aliases = { "wea" },
|
||||||
usage = "/plot weanywhere",
|
usage = "/plot weanywhere",
|
||||||
requiredType = RequiredType.NONE,
|
requiredType = RequiredType.NONE,
|
||||||
category = CommandCategory.DEBUG)
|
category = CommandCategory.ADMINISTRATION)
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public class WE_Anywhere extends SubCommand {
|
public class WE_Anywhere extends SubCommand {
|
||||||
|
|
||||||
|
@ -39,6 +39,7 @@ import com.intellectualcrafters.plot.object.PlotArea;
|
|||||||
import com.intellectualcrafters.plot.object.PlotMessage;
|
import com.intellectualcrafters.plot.object.PlotMessage;
|
||||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
import com.intellectualcrafters.plot.object.Rating;
|
import com.intellectualcrafters.plot.object.Rating;
|
||||||
|
import com.intellectualcrafters.plot.object.RunnableVal3;
|
||||||
import com.intellectualcrafters.plot.util.EconHandler;
|
import com.intellectualcrafters.plot.util.EconHandler;
|
||||||
import com.intellectualcrafters.plot.util.MainUtil;
|
import com.intellectualcrafters.plot.util.MainUtil;
|
||||||
import com.intellectualcrafters.plot.util.MathMan;
|
import com.intellectualcrafters.plot.util.MathMan;
|
||||||
@ -306,7 +307,6 @@ public class list extends SubCommand {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
String term = StringMan.join(Arrays.copyOfRange(args, 1, args.length - 2), " ");
|
String term = StringMan.join(Arrays.copyOfRange(args, 1, args.length - 2), " ");
|
||||||
//TODO improve search reliability / speed
|
|
||||||
plots = MainUtil.getPlotsBySearch(term);
|
plots = MainUtil.getPlotsBySearch(term);
|
||||||
sort = false;
|
sort = false;
|
||||||
break;
|
break;
|
||||||
@ -356,7 +356,7 @@ public class list extends SubCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void displayPlots(final PlotPlayer player, List<Plot> plots, final int pageSize, int page, final PlotArea area, final String[] args, final boolean sort) {
|
public void displayPlots(final PlotPlayer player, List<Plot> plots, final int pageSize, int page, final PlotArea area, final String[] args, final boolean sort) {
|
||||||
int rawSize = plots.size();
|
// Header
|
||||||
Iterator<Plot> iter = plots.iterator();
|
Iterator<Plot> iter = plots.iterator();
|
||||||
while (iter.hasNext()) {
|
while (iter.hasNext()) {
|
||||||
if (!iter.next().isBasePlot()) {
|
if (!iter.next().isBasePlot()) {
|
||||||
@ -366,93 +366,47 @@ public class list extends SubCommand {
|
|||||||
if (sort) {
|
if (sort) {
|
||||||
plots = PS.get().sortPlots(plots, SortType.CREATION_DATE, area);
|
plots = PS.get().sortPlots(plots, SortType.CREATION_DATE, area);
|
||||||
}
|
}
|
||||||
if (page < 0) {
|
this.<Plot> paginate(player, plots, pageSize, page, new RunnableVal3<Integer, Plot, PlotMessage>() {
|
||||||
page = 0;
|
@Override
|
||||||
}
|
public void run(Integer i, Plot plot, PlotMessage message) {
|
||||||
final int totalPages = (int) Math.ceil(plots.size() / pageSize);
|
String color;
|
||||||
if (page > totalPages) {
|
if (plot.owner == null) {
|
||||||
page = totalPages;
|
color = "$3";
|
||||||
}
|
} else if (plot.isOwner(player.getUUID())) {
|
||||||
// Only display pageSize!
|
color = "$1";
|
||||||
int max = (page * pageSize) + pageSize;
|
} else if (plot.isAdded(player.getUUID())) {
|
||||||
if (max > plots.size()) {
|
color = "$4";
|
||||||
max = plots.size();
|
} else if (plot.isDenied(player.getUUID())) {
|
||||||
}
|
color = "$2";
|
||||||
|
|
||||||
final List<Plot> subList = plots.subList(page * pageSize, max);
|
|
||||||
|
|
||||||
// Header
|
|
||||||
final String header = C.PLOT_LIST_HEADER_PAGED.s().replaceAll("%cur", page + 1 + "").replaceAll("%max", totalPages + 1 + "").replaceAll("%amount%", plots.size() + "/" + rawSize)
|
|
||||||
.replaceAll("%word%", "all");
|
|
||||||
MainUtil.sendMessage(player, header);
|
|
||||||
|
|
||||||
int i = page * pageSize;
|
|
||||||
for (final Plot plot : subList) {
|
|
||||||
i++;
|
|
||||||
String color;
|
|
||||||
if (plot.owner == null) {
|
|
||||||
color = "$3";
|
|
||||||
} else if (plot.isOwner(player.getUUID())) {
|
|
||||||
color = "$1";
|
|
||||||
} else if (plot.isAdded(player.getUUID())) {
|
|
||||||
color = "$4";
|
|
||||||
} else if (plot.isDenied(player.getUUID())) {
|
|
||||||
color = "$2";
|
|
||||||
} else {
|
|
||||||
color = "$1";
|
|
||||||
}
|
|
||||||
final PlotMessage trusted = new PlotMessage().text(C.color(C.PLOT_INFO_TRUSTED.s().replaceAll("%trusted%", MainUtil.getPlayerList(plot.getTrusted())))).color("$1");
|
|
||||||
|
|
||||||
final PlotMessage members = new PlotMessage().text(C.color(C.PLOT_INFO_MEMBERS.s().replaceAll("%members%", MainUtil.getPlayerList(plot.getMembers())))).color("$1");
|
|
||||||
|
|
||||||
String strFlags = StringMan.join(plot.getFlags().values(), ",");
|
|
||||||
if (strFlags.length() == 0) {
|
|
||||||
strFlags = C.NONE.s();
|
|
||||||
}
|
|
||||||
|
|
||||||
final PlotMessage flags = new PlotMessage().text(C.color(C.PLOT_INFO_FLAGS.s().replaceAll("%flags%", strFlags))).color("$1");
|
|
||||||
|
|
||||||
PlotMessage message = new PlotMessage().text("[").color("$3").text(i + "").command("/plot visit " + plot.area + ";" + plot.getId()).tooltip("/plot visit " + plot.area + ";" + plot
|
|
||||||
|
|
||||||
.getId())
|
|
||||||
.color("$1").text("]").color("$3").text(" " + plot.toString())
|
|
||||||
|
|
||||||
.tooltip(trusted, members, flags).command("/plot info " + plot.area + ";" + plot.getId())
|
|
||||||
|
|
||||||
.color(color).text(" - ").color("$2");
|
|
||||||
String prefix = "";
|
|
||||||
for (final UUID uuid : plot.getOwners()) {
|
|
||||||
final String name = UUIDHandler.getName(uuid);
|
|
||||||
if (name == null) {
|
|
||||||
message = message.text(prefix).color("$4").text("unknown").color("$2").tooltip(uuid.toString()).suggest(uuid.toString());
|
|
||||||
} else {
|
} else {
|
||||||
final PlotPlayer pp = UUIDHandler.getPlayer(uuid);
|
color = "$1";
|
||||||
if (pp != null) {
|
}
|
||||||
message = message.text(prefix).color("$4").text(name).color("$1").tooltip(new PlotMessage("Online").color("$4"));
|
final PlotMessage trusted = new PlotMessage().text(C.color(C.PLOT_INFO_TRUSTED.s().replaceAll("%trusted%", MainUtil.getPlayerList(plot.getTrusted())))).color("$1");
|
||||||
} else {
|
final PlotMessage members = new PlotMessage().text(C.color(C.PLOT_INFO_MEMBERS.s().replaceAll("%members%", MainUtil.getPlayerList(plot.getMembers())))).color("$1");
|
||||||
message = message.text(prefix).color("$4").text(name).color("$1").tooltip(new PlotMessage("Offline").color("$3"));
|
String strFlags = StringMan.join(plot.getFlags().values(), ",");
|
||||||
}
|
if (strFlags.length() == 0) {
|
||||||
|
strFlags = C.NONE.s();
|
||||||
|
}
|
||||||
|
final PlotMessage flags = new PlotMessage().text(C.color(C.PLOT_INFO_FLAGS.s().replaceAll("%flags%", strFlags))).color("$1");
|
||||||
|
message.text("[").color("$3").text(i + "").command("/plot visit " + plot.area + ";" + plot.getId()).tooltip("/plot visit " + plot.area + ";" + plot.getId()).color("$1").text("]")
|
||||||
|
.color("$3").text(" " + plot.toString()).tooltip(trusted, members, flags).command("/plot info " + plot.area + ";" + plot.getId()).color(color).text(" - ").color("$2");
|
||||||
|
String prefix = "";
|
||||||
|
for (final UUID uuid : plot.getOwners()) {
|
||||||
|
final String name = UUIDHandler.getName(uuid);
|
||||||
|
if (name == null) {
|
||||||
|
message = message.text(prefix).color("$4").text("unknown").color("$2").tooltip(uuid.toString()).suggest(uuid.toString());
|
||||||
|
} else {
|
||||||
|
final PlotPlayer pp = UUIDHandler.getPlayer(uuid);
|
||||||
|
if (pp != null) {
|
||||||
|
message = message.text(prefix).color("$4").text(name).color("$1").tooltip(new PlotMessage("Online").color("$4"));
|
||||||
|
} else {
|
||||||
|
message = message.text(prefix).color("$4").text(name).color("$1").tooltip(new PlotMessage("Offline").color("$3"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
prefix = ", ";
|
||||||
}
|
}
|
||||||
prefix = ", ";
|
|
||||||
}
|
}
|
||||||
message.send(player);
|
}, "/plot list " + args[0], C.PLOT_LIST_HEADER_PAGED.s());
|
||||||
}
|
|
||||||
if ((page < totalPages) && (page > 0)) {
|
|
||||||
// back | next
|
|
||||||
new PlotMessage().text("<-").color("$1").command("/plot list " + args[0] + " " + (page)).text(" | ").color("$3").text("->").color("$1").command("/plot list " + args[0] + " " + (page + 2))
|
|
||||||
.text(C.CLICKABLE.s()).color("$2").send(player);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if ((page == 0) && (totalPages != 0)) {
|
|
||||||
// next
|
|
||||||
new PlotMessage().text("<-").color("$3").text(" | ").color("$3").text("->").color("$1").command("/plot list " + args[0] + " " + (page + 2)).text(C.CLICKABLE.s()).color("$2").send(player);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if ((page == totalPages) && (totalPages != 0)) {
|
|
||||||
// back
|
|
||||||
new PlotMessage().text("<-").color("$1").command("/plot list " + args[0] + " " + (page)).text(" | ").color("$3").text("->").color("$3").text(C.CLICKABLE.s()).color("$2").send(player);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getArgumentList(final String[] strings) {
|
private String getArgumentList(final String[] strings) {
|
||||||
|
@ -20,6 +20,14 @@
|
|||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
package com.intellectualcrafters.plot.config;
|
package com.intellectualcrafters.plot.config;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.EnumSet;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
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;
|
||||||
@ -27,9 +35,6 @@ import com.intellectualcrafters.plot.util.MainUtil;
|
|||||||
import com.intellectualcrafters.plot.util.StringMan;
|
import com.intellectualcrafters.plot.util.StringMan;
|
||||||
import com.plotsquared.general.commands.CommandCaller;
|
import com.plotsquared.general.commands.CommandCaller;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.util.*;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Captions class.
|
* Captions class.
|
||||||
*
|
*
|
||||||
@ -103,6 +108,10 @@ public enum C {
|
|||||||
MOVE_SUCCESS("$4Successfully moved plot.", "Move"),
|
MOVE_SUCCESS("$4Successfully moved plot.", "Move"),
|
||||||
COPY_SUCCESS("$4Successfully copied plot.", "Move"),
|
COPY_SUCCESS("$4Successfully copied plot.", "Move"),
|
||||||
REQUIRES_UNOWNED("$2The location specified is already occupied.", "Move"),
|
REQUIRES_UNOWNED("$2The location specified is already occupied.", "Move"),
|
||||||
|
/*
|
||||||
|
* Area Create
|
||||||
|
*/
|
||||||
|
SET_ATTRIBUTE("$4Successfully set %s0 set to %s1", "Set"),
|
||||||
/*
|
/*
|
||||||
* Web
|
* Web
|
||||||
*/
|
*/
|
||||||
@ -125,7 +134,7 @@ public enum C {
|
|||||||
"Cluster"),
|
"Cluster"),
|
||||||
CLUSTER_LIST_HEADING("$2There are $1%s$2 clusters in this world", "Cluster"),
|
CLUSTER_LIST_HEADING("$2There are $1%s$2 clusters in this world", "Cluster"),
|
||||||
CLUSTER_LIST_ELEMENT("$2 - $1%s&-", "Cluster"),
|
CLUSTER_LIST_ELEMENT("$2 - $1%s&-", "Cluster"),
|
||||||
CLUSTER_INTERSECTION("$2The proposed area overlaps with an existing cluster: %s0", "Cluster"),
|
CLUSTER_INTERSECTION("$2The proposed area overlaps with: %s0", "Cluster"),
|
||||||
CLUSTER_ADDED("$4Successfully created the cluster.", "Cluster"),
|
CLUSTER_ADDED("$4Successfully created the cluster.", "Cluster"),
|
||||||
CLUSTER_DELETED("$4Successfully deleted the cluster.", "Cluster"),
|
CLUSTER_DELETED("$4Successfully deleted the cluster.", "Cluster"),
|
||||||
CLUSTER_RESIZED("$4Successfully resized the cluster.", "Cluster"),
|
CLUSTER_RESIZED("$4Successfully resized the cluster.", "Cluster"),
|
||||||
@ -218,7 +227,7 @@ public enum C {
|
|||||||
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%id$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_ENABLED("$2Enabled setting: %s", "Toggle"),
|
TOGGLE_ENABLED("$2Enabled setting: %s", "Toggle"),
|
||||||
TOGGLE_DISABLED("$2Disabled setting: %s", "Toggle"),
|
TOGGLE_DISABLED("$2Disabled setting: %s", "Toggle"),
|
||||||
@ -509,6 +518,7 @@ public enum C {
|
|||||||
*/
|
*/
|
||||||
COMMENT_LIST_HEADER_PAGED("$2(Page $1%cur$2/$1%max$2) $1List of %amount% comments", "List"),
|
COMMENT_LIST_HEADER_PAGED("$2(Page $1%cur$2/$1%max$2) $1List of %amount% comments", "List"),
|
||||||
CLICKABLE(" (interactive)", "List"),
|
CLICKABLE(" (interactive)", "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%id$2:$1%world $2- $1%owner", "List"),
|
PLOT_LIST_ITEM("$2>> $1%id$2:$1%world $2- $1%owner", "List"),
|
||||||
|
@ -25,6 +25,7 @@ import java.util.ArrayList;
|
|||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
@ -102,7 +103,7 @@ public interface AbstractDB {
|
|||||||
|
|
||||||
void removePersistentMeta(UUID uuid, String key);
|
void removePersistentMeta(UUID uuid, String key);
|
||||||
|
|
||||||
void getPersistentMeta(PlotPlayer player);
|
void getPersistentMeta(PlotPlayer player, RunnableVal<Map<String, byte[]>> result);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create plot settings
|
* Create plot settings
|
||||||
|
@ -20,7 +20,6 @@
|
|||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
package com.intellectualcrafters.plot.database;
|
package com.intellectualcrafters.plot.database;
|
||||||
|
|
||||||
import java.lang.reflect.Field;
|
|
||||||
import java.sql.Blob;
|
import java.sql.Blob;
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
import java.sql.DatabaseMetaData;
|
import java.sql.DatabaseMetaData;
|
||||||
@ -104,6 +103,11 @@ public class SQLManager implements AbstractDB {
|
|||||||
*/
|
*/
|
||||||
public volatile ConcurrentHashMap<Plot, Queue<UniqueStatement>> plotTasks;
|
public volatile ConcurrentHashMap<Plot, Queue<UniqueStatement>> plotTasks;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* player_meta
|
||||||
|
*/
|
||||||
|
public volatile ConcurrentHashMap<UUID, Queue<UniqueStatement>> playerTasks;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cluster
|
* cluster
|
||||||
* cluster_helpers
|
* cluster_helpers
|
||||||
@ -151,6 +155,37 @@ public class SQLManager implements AbstractDB {
|
|||||||
tasks.add(task);
|
tasks.add(task);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public synchronized void addPlayerTask(UUID uuid, UniqueStatement task) {
|
||||||
|
if (uuid == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Queue<UniqueStatement> tasks = playerTasks.get(uuid);
|
||||||
|
if (tasks == null) {
|
||||||
|
tasks = new ConcurrentLinkedQueue<>();
|
||||||
|
playerTasks.put(uuid, tasks);
|
||||||
|
}
|
||||||
|
if (task == null) {
|
||||||
|
task = new UniqueStatement(uuid.hashCode() + "") {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PreparedStatement get() throws SQLException {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void set(final PreparedStatement stmt) throws SQLException {}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addBatch(final PreparedStatement stmt) throws SQLException {}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void execute(final PreparedStatement stmt) throws SQLException {}
|
||||||
|
|
||||||
|
};
|
||||||
|
}
|
||||||
|
tasks.add(task);
|
||||||
|
}
|
||||||
|
|
||||||
public synchronized void addClusterTask(final PlotCluster cluster, UniqueStatement task) {
|
public synchronized void addClusterTask(final PlotCluster cluster, UniqueStatement task) {
|
||||||
Queue<UniqueStatement> tasks = clusterTasks.get(cluster);
|
Queue<UniqueStatement> tasks = clusterTasks.get(cluster);
|
||||||
if (tasks == null) {
|
if (tasks == null) {
|
||||||
@ -204,6 +239,7 @@ public class SQLManager implements AbstractDB {
|
|||||||
globalTasks = new ConcurrentLinkedQueue<>();
|
globalTasks = new ConcurrentLinkedQueue<>();
|
||||||
notifyTasks = new ConcurrentLinkedQueue<>();
|
notifyTasks = new ConcurrentLinkedQueue<>();
|
||||||
plotTasks = new ConcurrentHashMap<>();
|
plotTasks = new ConcurrentHashMap<>();
|
||||||
|
playerTasks = new ConcurrentHashMap<>();
|
||||||
clusterTasks = new ConcurrentHashMap<>();
|
clusterTasks = new ConcurrentHashMap<>();
|
||||||
TaskManager.runTaskAsync(new Runnable() {
|
TaskManager.runTaskAsync(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
@ -278,7 +314,6 @@ public class SQLManager implements AbstractDB {
|
|||||||
PreparedStatement stmt = null;
|
PreparedStatement stmt = null;
|
||||||
UniqueStatement task = null;
|
UniqueStatement task = null;
|
||||||
UniqueStatement lastTask = null;
|
UniqueStatement lastTask = null;
|
||||||
// ArrayList<Entry<Plot, Queue<UniqueStatement>>> keys = new ArrayList<>(plotTasks.entrySet());
|
|
||||||
for (final Entry<Plot, Queue<UniqueStatement>> entry : plotTasks.entrySet()) {
|
for (final Entry<Plot, Queue<UniqueStatement>> entry : plotTasks.entrySet()) {
|
||||||
final Plot plot = entry.getKey();
|
final Plot plot = entry.getKey();
|
||||||
if (plotTasks.get(plot).size() == 0) {
|
if (plotTasks.get(plot).size() == 0) {
|
||||||
@ -306,6 +341,42 @@ public class SQLManager implements AbstractDB {
|
|||||||
stmt.close();
|
stmt.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (playerTasks.size() > 0) {
|
||||||
|
count = 0;
|
||||||
|
if (connection.getAutoCommit()) {
|
||||||
|
connection.setAutoCommit(false);
|
||||||
|
}
|
||||||
|
String method = null;
|
||||||
|
PreparedStatement stmt = null;
|
||||||
|
UniqueStatement task = null;
|
||||||
|
UniqueStatement lastTask = null;
|
||||||
|
for (final Entry<UUID, Queue<UniqueStatement>> entry : playerTasks.entrySet()) {
|
||||||
|
final UUID uuid = entry.getKey();
|
||||||
|
if (playerTasks.get(uuid).size() == 0) {
|
||||||
|
playerTasks.remove(uuid);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
task = playerTasks.get(uuid).remove();
|
||||||
|
count++;
|
||||||
|
if (task != null) {
|
||||||
|
if ((task._method == null) || !task._method.equals(method)) {
|
||||||
|
if (stmt != null) {
|
||||||
|
lastTask.execute(stmt);
|
||||||
|
stmt.close();
|
||||||
|
}
|
||||||
|
method = task._method;
|
||||||
|
stmt = task.get();
|
||||||
|
}
|
||||||
|
task.set(stmt);
|
||||||
|
task.addBatch(stmt);
|
||||||
|
}
|
||||||
|
lastTask = task;
|
||||||
|
}
|
||||||
|
if ((stmt != null) && (task != null)) {
|
||||||
|
task.execute(stmt);
|
||||||
|
stmt.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
if (clusterTasks.size() > 0) {
|
if (clusterTasks.size() > 0) {
|
||||||
count = 0;
|
count = 0;
|
||||||
if (connection.getAutoCommit()) {
|
if (connection.getAutoCommit()) {
|
||||||
@ -1207,7 +1278,7 @@ public class SQLManager implements AbstractDB {
|
|||||||
+ " `meta_id` INTEGER PRIMARY KEY AUTOINCREMENT,"
|
+ " `meta_id` INTEGER PRIMARY KEY AUTOINCREMENT,"
|
||||||
+ " `uuid` VARCHAR(40) NOT NULL,"
|
+ " `uuid` VARCHAR(40) NOT NULL,"
|
||||||
+ " `key` VARCHAR(32) NOT NULL,"
|
+ " `key` VARCHAR(32) NOT NULL,"
|
||||||
+ " `value` blob NOT NULL,"
|
+ " `value` blob NOT NULL"
|
||||||
+ ")");
|
+ ")");
|
||||||
}
|
}
|
||||||
stmt.executeBatch();
|
stmt.executeBatch();
|
||||||
@ -2380,27 +2451,27 @@ public class SQLManager implements AbstractDB {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addPersistentMeta(final UUID uuid, final String key, final byte[] meta, final boolean delete) {
|
public void addPersistentMeta(final UUID uuid, final String key, final byte[] meta, final boolean delete) {
|
||||||
addGlobalTask(new Runnable() {
|
addPlayerTask(uuid, new UniqueStatement("addPersistentMeta") {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void set(final PreparedStatement stmt) throws SQLException {
|
||||||
try {
|
if (delete) {
|
||||||
if (delete) {
|
stmt.setString(1, uuid.toString());
|
||||||
final PreparedStatement statement = connection.prepareStatement("DELETE FROM `" + prefix + "player_meta` WHERE `uuid` = ? AND `key` = ?");
|
stmt.setString(2, key);
|
||||||
statement.setString(1, uuid.toString());
|
} else {
|
||||||
statement.setString(2, key);
|
Blob blob = connection.createBlob();
|
||||||
statement.executeUpdate();
|
|
||||||
statement.close();
|
|
||||||
}
|
|
||||||
final Blob blob = connection.createBlob();
|
|
||||||
blob.setBytes(1, meta);
|
blob.setBytes(1, meta);
|
||||||
final PreparedStatement statement = connection.prepareStatement("INSERT INTO `" + prefix + "player_meta`(`uuid`, `key`, `value`) VALUES(?, ? ,?)");
|
stmt.setString(1, uuid.toString());
|
||||||
statement.setString(1, uuid.toString());
|
stmt.setString(2, key);
|
||||||
statement.setString(2, key);
|
stmt.setBlob(3, blob);
|
||||||
statement.setBlob(3, blob);
|
}
|
||||||
statement.executeUpdate();
|
}
|
||||||
statement.close();
|
|
||||||
} catch (SQLException e) {
|
@Override
|
||||||
e.printStackTrace();
|
public PreparedStatement get() throws SQLException {
|
||||||
|
if (delete) {
|
||||||
|
return connection.prepareStatement("DELETE FROM `" + prefix + "player_meta` WHERE `uuid` = ? AND `key` = ?");
|
||||||
|
} else {
|
||||||
|
return connection.prepareStatement("INSERT INTO `" + prefix + "player_meta`(`uuid`, `key`, `value`) VALUES(?, ? ,?)");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -2408,52 +2479,55 @@ public class SQLManager implements AbstractDB {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void removePersistentMeta(final UUID uuid, final String key) {
|
public void removePersistentMeta(final UUID uuid, final String key) {
|
||||||
addGlobalTask(new Runnable() {
|
addPlayerTask(uuid, new UniqueStatement("removePersistentMeta") {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void set(final PreparedStatement stmt) throws SQLException {
|
||||||
try {
|
stmt.setString(1, uuid.toString());
|
||||||
final PreparedStatement statement = connection.prepareStatement("DELETE FROM `" + prefix + "player_meta` WHERE `uuid` = ? AND `key` = ?");
|
stmt.setString(2, key);
|
||||||
statement.setString(1, uuid.toString());
|
}
|
||||||
statement.setString(2, key);
|
|
||||||
statement.executeUpdate();
|
@Override
|
||||||
statement.close();
|
public PreparedStatement get() throws SQLException {
|
||||||
} catch (SQLException e) {
|
return connection.prepareStatement("DELETE FROM `" + prefix + "player_meta` WHERE `uuid` = ? AND `key` = ?");
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void getPersistentMeta(final PlotPlayer player) {
|
public void getPersistentMeta(final PlotPlayer player, final RunnableVal<Map<String, byte[]>> result) {
|
||||||
addGlobalTask(new Runnable() {
|
addPlayerTask(player.getUUID(), new UniqueStatement("getPersistentMeta") {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void set(final PreparedStatement stmt) throws SQLException {
|
||||||
try {
|
stmt.setString(1, player.getUUID().toString());
|
||||||
PreparedStatement statement = connection.prepareStatement("SELECT * FROM `" + prefix + "player_meta` WHERE `uuid` = ?");
|
|
||||||
statement.setString(1, player.getUUID().toString());
|
|
||||||
ResultSet resultSet = statement.executeQuery();
|
|
||||||
|
|
||||||
final Map<String, byte[]> metaMap = new HashMap<>();
|
|
||||||
|
|
||||||
while (resultSet.next()) {
|
|
||||||
String key = resultSet.getString("key");
|
|
||||||
Blob rawValue = resultSet.getBlob("value");
|
|
||||||
byte[] bytes = rawValue.getBytes(1, (int) rawValue.length());
|
|
||||||
metaMap.put(key, bytes);
|
|
||||||
}
|
|
||||||
|
|
||||||
resultSet.close();
|
|
||||||
statement.close();
|
|
||||||
|
|
||||||
Field field = PlotPlayer.class.getDeclaredField("metaMap");
|
|
||||||
field.setAccessible(true);
|
|
||||||
field.set(player, metaMap);
|
|
||||||
field.setAccessible(false);
|
|
||||||
} catch(Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PreparedStatement get() throws SQLException {
|
||||||
|
return connection.prepareStatement("SELECT * FROM `" + prefix + "player_meta` WHERE `uuid` = ?");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void execute(PreparedStatement stmt) throws SQLException {}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addBatch(PreparedStatement stmt) throws SQLException {
|
||||||
|
ResultSet resultSet = stmt.executeQuery();
|
||||||
|
|
||||||
|
final Map<String, byte[]> metaMap = new HashMap<>();
|
||||||
|
|
||||||
|
while (resultSet.next()) {
|
||||||
|
String key = resultSet.getString("key");
|
||||||
|
Blob rawValue = resultSet.getBlob("value");
|
||||||
|
byte[] bytes = rawValue.getBytes(1, (int) rawValue.length());
|
||||||
|
metaMap.put(key, bytes);
|
||||||
|
}
|
||||||
|
|
||||||
|
resultSet.close();
|
||||||
|
stmt.close();
|
||||||
|
|
||||||
|
result.run(metaMap);
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,25 +13,16 @@ public abstract class ClassicPlotWorld extends SquarePlotWorld {
|
|||||||
super(worldname, id, generator, min, max);
|
super(worldname, id, generator, min, max);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int ROAD_HEIGHT_DEFAULT = 64;
|
public int ROAD_HEIGHT = 64;
|
||||||
public static int PLOT_HEIGHT_DEFAULT = 64;
|
public int PLOT_HEIGHT = 64;
|
||||||
public static int WALL_HEIGHT_DEFAULT = 64;
|
public int WALL_HEIGHT = 64;
|
||||||
public static PlotBlock[] MAIN_BLOCK_DEFAULT = new PlotBlock[] { new PlotBlock((short) 1, (byte) 0) };
|
public PlotBlock[] MAIN_BLOCK = new PlotBlock[] { new PlotBlock((short) 1, (byte) 0) };
|
||||||
public static PlotBlock[] TOP_BLOCK_DEFAULT = new PlotBlock[] { new PlotBlock((short) 2, (byte) 0) };
|
public PlotBlock[] TOP_BLOCK = new PlotBlock[] { new PlotBlock((short) 2, (byte) 0) };
|
||||||
public static PlotBlock WALL_BLOCK_DEFAULT = new PlotBlock((short) 44, (byte) 0);
|
public PlotBlock WALL_BLOCK = new PlotBlock((short) 44, (byte) 0);
|
||||||
public final static PlotBlock CLAIMED_WALL_BLOCK_DEFAULT = new PlotBlock((short) 44, (byte) 1);
|
public PlotBlock CLAIMED_WALL_BLOCK = new PlotBlock((short) 44, (byte) 1);
|
||||||
public static PlotBlock WALL_FILLING_DEFAULT = new PlotBlock((short) 1, (byte) 0);
|
public PlotBlock WALL_FILLING = new PlotBlock((short) 1, (byte) 0);
|
||||||
public final static PlotBlock ROAD_BLOCK_DEFAULT = new PlotBlock((short) 155, (byte) 0);
|
public PlotBlock ROAD_BLOCK = new PlotBlock((short) 155, (byte) 0);
|
||||||
public int ROAD_HEIGHT;
|
public boolean PLOT_BEDROCK = true;
|
||||||
public int PLOT_HEIGHT;
|
|
||||||
public int WALL_HEIGHT;
|
|
||||||
public PlotBlock[] MAIN_BLOCK;
|
|
||||||
public PlotBlock[] TOP_BLOCK;
|
|
||||||
public PlotBlock WALL_BLOCK;
|
|
||||||
public PlotBlock CLAIMED_WALL_BLOCK;
|
|
||||||
public PlotBlock WALL_FILLING;
|
|
||||||
public PlotBlock ROAD_BLOCK;
|
|
||||||
public boolean PLOT_BEDROCK;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* CONFIG NODE | DEFAULT VALUE | DESCRIPTION | CONFIGURATION TYPE | REQUIRED FOR INITIAL SETUP
|
* CONFIG NODE | DEFAULT VALUE | DESCRIPTION | CONFIGURATION TYPE | REQUIRED FOR INITIAL SETUP
|
||||||
@ -43,18 +34,18 @@ public abstract class ClassicPlotWorld extends SquarePlotWorld {
|
|||||||
@Override
|
@Override
|
||||||
public ConfigurationNode[] getSettingNodes() {
|
public ConfigurationNode[] getSettingNodes() {
|
||||||
return new ConfigurationNode[] {
|
return new ConfigurationNode[] {
|
||||||
new ConfigurationNode("plot.height", ClassicPlotWorld.PLOT_HEIGHT_DEFAULT, "Plot height", Configuration.INTEGER, true),
|
new ConfigurationNode("plot.height", PLOT_HEIGHT, "Plot height", Configuration.INTEGER, true),
|
||||||
new ConfigurationNode("plot.size", SquarePlotWorld.PLOT_WIDTH_DEFAULT, "Plot width", Configuration.INTEGER, true),
|
new ConfigurationNode("plot.size", PLOT_WIDTH, "Plot width", Configuration.INTEGER, true),
|
||||||
new ConfigurationNode("plot.filling", ClassicPlotWorld.MAIN_BLOCK_DEFAULT, "Plot block", Configuration.BLOCKLIST, true),
|
new ConfigurationNode("plot.filling", MAIN_BLOCK, "Plot block", Configuration.BLOCKLIST, true),
|
||||||
new ConfigurationNode("plot.floor", ClassicPlotWorld.TOP_BLOCK_DEFAULT, "Plot floor block", Configuration.BLOCKLIST, true),
|
new ConfigurationNode("plot.floor", TOP_BLOCK, "Plot floor block", Configuration.BLOCKLIST, true),
|
||||||
new ConfigurationNode("wall.block", ClassicPlotWorld.WALL_BLOCK_DEFAULT, "Top wall block", Configuration.BLOCK, true),
|
new ConfigurationNode("wall.block", WALL_BLOCK, "Top wall block", Configuration.BLOCK, true),
|
||||||
new ConfigurationNode("wall.block_claimed", ClassicPlotWorld.CLAIMED_WALL_BLOCK_DEFAULT, "Wall block (claimed)", Configuration.BLOCK, true),
|
new ConfigurationNode("wall.block_claimed", CLAIMED_WALL_BLOCK, "Wall block (claimed)", Configuration.BLOCK, true),
|
||||||
new ConfigurationNode("road.width", SquarePlotWorld.ROAD_WIDTH_DEFAULT, "Road width", Configuration.INTEGER, true),
|
new ConfigurationNode("road.width", ROAD_WIDTH, "Road width", Configuration.INTEGER, true),
|
||||||
new ConfigurationNode("road.height", ClassicPlotWorld.ROAD_HEIGHT_DEFAULT, "Road height", Configuration.INTEGER, true),
|
new ConfigurationNode("road.height", ROAD_HEIGHT, "Road height", Configuration.INTEGER, true),
|
||||||
new ConfigurationNode("road.block", ClassicPlotWorld.ROAD_BLOCK_DEFAULT, "Road block", Configuration.BLOCK, true),
|
new ConfigurationNode("road.block", ROAD_BLOCK, "Road block", Configuration.BLOCK, true),
|
||||||
new ConfigurationNode("wall.filling", ClassicPlotWorld.WALL_FILLING_DEFAULT, "Wall filling block", Configuration.BLOCK, true),
|
new ConfigurationNode("wall.filling", WALL_FILLING, "Wall filling block", Configuration.BLOCK, true),
|
||||||
new ConfigurationNode("wall.height", ClassicPlotWorld.WALL_HEIGHT_DEFAULT, "Wall height", Configuration.INTEGER, true),
|
new ConfigurationNode("wall.height", WALL_HEIGHT, "Wall height", Configuration.INTEGER, true),
|
||||||
new ConfigurationNode("plot.bedrock", true, "Plot bedrock generation", Configuration.BOOLEAN, true) };
|
new ConfigurationNode("plot.bedrock", PLOT_BEDROCK, "Plot bedrock generation", Configuration.BOOLEAN, true) };
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -38,8 +38,8 @@ public class HybridGen extends IndependentPlotGenerator {
|
|||||||
// Coords
|
// Coords
|
||||||
int cx = result.getX();
|
int cx = result.getX();
|
||||||
int cz = result.getZ();
|
int cz = result.getZ();
|
||||||
int bx = cx << 4;
|
int bx = (cx << 4) - hpw.ROAD_OFFSET_X;
|
||||||
int bz = cz << 4;
|
int bz = (cz << 4) - hpw.ROAD_OFFSET_Z;
|
||||||
short rbx = (short) ((bx < 0) ? (hpw.SIZE + (bx % hpw.SIZE)) : bx % hpw.SIZE);
|
short rbx = (short) ((bx < 0) ? (hpw.SIZE + (bx % hpw.SIZE)) : bx % hpw.SIZE);
|
||||||
short rbz = (short) ((bz < 0) ? (hpw.SIZE + (bz % hpw.SIZE)) : bz % hpw.SIZE);
|
short rbz = (short) ((bz < 0) ? (hpw.SIZE + (bz % hpw.SIZE)) : bz % hpw.SIZE);
|
||||||
short[] rx = new short[16];
|
short[] rx = new short[16];
|
||||||
|
@ -62,7 +62,7 @@ public class HybridPlotWorld extends ClassicPlotWorld {
|
|||||||
} else {
|
} else {
|
||||||
PATH_WIDTH_LOWER = (short) (Math.floor(ROAD_WIDTH / 2));
|
PATH_WIDTH_LOWER = (short) (Math.floor(ROAD_WIDTH / 2));
|
||||||
}
|
}
|
||||||
PATH_WIDTH_UPPER = (short) (PATH_WIDTH_LOWER + PLOT_WIDTH + 1);
|
PATH_WIDTH_UPPER = (short) (ROAD_WIDTH == 0 ? SIZE + 1 : PATH_WIDTH_LOWER + PLOT_WIDTH + 1);
|
||||||
try {
|
try {
|
||||||
setupSchematics();
|
setupSchematics();
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
|
@ -10,14 +10,10 @@ public abstract class SquarePlotWorld extends GridPlotWorld {
|
|||||||
super(worldname, id, generator, min, max);
|
super(worldname, id, generator, min, max);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int PLOT_WIDTH_DEFAULT = 42;
|
public int PLOT_WIDTH = 42;
|
||||||
public static int ROAD_WIDTH_DEFAULT = 7;
|
public int ROAD_WIDTH = 7;
|
||||||
public static int ROAD_OFFSET_X_DEFAULT = 0;
|
public int ROAD_OFFSET_X = 0;
|
||||||
public static int ROAD_OFFSET_Z_DEFAULT = 0;
|
public int ROAD_OFFSET_Z = 0;
|
||||||
public int PLOT_WIDTH;
|
|
||||||
public int ROAD_WIDTH;
|
|
||||||
public int ROAD_OFFSET_X;
|
|
||||||
public int ROAD_OFFSET_Z;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void loadConfiguration(final ConfigurationSection config) {
|
public void loadConfiguration(final ConfigurationSection config) {
|
||||||
|
@ -54,53 +54,31 @@ import com.intellectualcrafters.plot.util.area.QuadMap;
|
|||||||
* @author Jesse Boyd
|
* @author Jesse Boyd
|
||||||
*/
|
*/
|
||||||
public abstract class PlotArea {
|
public abstract class PlotArea {
|
||||||
public final static boolean AUTO_MERGE_DEFAULT = false;
|
public int MAX_PLOT_MEMBERS = 128;
|
||||||
public final static boolean ALLOW_SIGNS_DEFAULT = true;
|
public boolean AUTO_MERGE = false;
|
||||||
public final static boolean MOB_SPAWNING_DEFAULT = false;
|
public boolean ALLOW_SIGNS = true;
|
||||||
public final static String PLOT_BIOME_DEFAULT = "FOREST";
|
public boolean MOB_SPAWNING = false;
|
||||||
public final static boolean PLOT_CHAT_DEFAULT = false;
|
public int PLOT_BIOME = 1;
|
||||||
public final static boolean SCHEMATIC_CLAIM_SPECIFY_DEFAULT = false;
|
public boolean PLOT_CHAT = false;
|
||||||
public final static boolean SCHEMATIC_ON_CLAIM_DEFAULT = false;
|
|
||||||
public final static String SCHEMATIC_FILE_DEFAULT = "null";
|
|
||||||
public final static List<String> SCHEMATICS_DEFAULT = null;
|
|
||||||
public final static boolean USE_ECONOMY_DEFAULT = false;
|
|
||||||
public final static double PLOT_PRICE_DEFAULT = 100;
|
|
||||||
public final static double MERGE_PRICE_DEFAULT = 100;
|
|
||||||
public final static double SELL_PRICE_DEFAULT = 75;
|
|
||||||
public final static boolean SPAWN_EGGS_DEFAULT = false;
|
|
||||||
public final static boolean SPAWN_CUSTOM_DEFAULT = true;
|
|
||||||
public final static boolean SPAWN_BREEDING_DEFAULT = false;
|
|
||||||
public final static boolean WORLD_BORDER_DEFAULT = false;
|
|
||||||
public final static int MAX_PLOT_MEMBERS_DEFAULT = 128;
|
|
||||||
public final static int MAX_BUILD_HEIGHT_DEFAULT = 256;
|
|
||||||
public final static int MIN_BUILD_HEIGHT_DEFAULT = 1;
|
|
||||||
public final static PlotGamemode GAMEMODE_DEFAULT = PlotGamemode.CREATIVE;
|
|
||||||
|
|
||||||
public int MAX_PLOT_MEMBERS;
|
|
||||||
public boolean AUTO_MERGE;
|
|
||||||
public boolean ALLOW_SIGNS;
|
|
||||||
public boolean MOB_SPAWNING;
|
|
||||||
public int PLOT_BIOME;
|
|
||||||
public boolean PLOT_CHAT;
|
|
||||||
public boolean SCHEMATIC_CLAIM_SPECIFY = false;
|
public boolean SCHEMATIC_CLAIM_SPECIFY = false;
|
||||||
public boolean SCHEMATIC_ON_CLAIM;
|
public boolean SCHEMATIC_ON_CLAIM = false;
|
||||||
public String SCHEMATIC_FILE;
|
public String SCHEMATIC_FILE = "null";
|
||||||
public List<String> SCHEMATICS;
|
public List<String> SCHEMATICS = null;
|
||||||
public HashMap<String, Flag> DEFAULT_FLAGS;
|
public HashMap<String, Flag> DEFAULT_FLAGS;
|
||||||
public boolean USE_ECONOMY;
|
public boolean USE_ECONOMY = false;
|
||||||
public double PLOT_PRICE;
|
public double PLOT_PRICE = 100;
|
||||||
public double MERGE_PRICE;
|
public double MERGE_PRICE = 100;
|
||||||
public double SELL_PRICE;
|
public double SELL_PRICE = 100;
|
||||||
public boolean SPAWN_EGGS;
|
public boolean SPAWN_EGGS = false;
|
||||||
public boolean SPAWN_CUSTOM;
|
public boolean SPAWN_CUSTOM = true;
|
||||||
public boolean SPAWN_BREEDING;
|
public boolean SPAWN_BREEDING = false;
|
||||||
public boolean WORLD_BORDER;
|
public boolean WORLD_BORDER = false;
|
||||||
public int TYPE = 0;
|
public int TYPE = 0;
|
||||||
public int TERRAIN = 0;
|
public int TERRAIN = 0;
|
||||||
public boolean HOME_ALLOW_NONMEMBER;
|
public boolean HOME_ALLOW_NONMEMBER = false;
|
||||||
public PlotLoc DEFAULT_HOME;
|
public PlotLoc DEFAULT_HOME;
|
||||||
public int MAX_BUILD_HEIGHT;
|
public int MAX_BUILD_HEIGHT = 256;
|
||||||
public int MIN_BUILD_HEIGHT;
|
public int MIN_BUILD_HEIGHT = 1;
|
||||||
public PlotGamemode GAMEMODE = PlotGamemode.CREATIVE;
|
public PlotGamemode GAMEMODE = PlotGamemode.CREATIVE;
|
||||||
|
|
||||||
public final String worldname;
|
public final String worldname;
|
||||||
@ -339,30 +317,30 @@ public abstract class PlotArea {
|
|||||||
*/
|
*/
|
||||||
public void saveConfiguration(final ConfigurationSection config) {
|
public void saveConfiguration(final ConfigurationSection config) {
|
||||||
final HashMap<String, Object> options = new HashMap<>();
|
final HashMap<String, Object> options = new HashMap<>();
|
||||||
options.put("natural_mob_spawning", PlotArea.MOB_SPAWNING_DEFAULT);
|
options.put("natural_mob_spawning", MOB_SPAWNING);
|
||||||
options.put("plot.auto_merge", PlotArea.AUTO_MERGE_DEFAULT);
|
options.put("plot.auto_merge", AUTO_MERGE);
|
||||||
options.put("plot.create_signs", PlotArea.ALLOW_SIGNS_DEFAULT);
|
options.put("plot.create_signs", ALLOW_SIGNS);
|
||||||
options.put("plot.biome", PlotArea.PLOT_BIOME_DEFAULT);
|
options.put("plot.biome", "FOREST");
|
||||||
options.put("schematic.on_claim", PlotArea.SCHEMATIC_ON_CLAIM_DEFAULT);
|
options.put("schematic.on_claim", SCHEMATIC_ON_CLAIM);
|
||||||
options.put("schematic.file", PlotArea.SCHEMATIC_FILE_DEFAULT);
|
options.put("schematic.file", SCHEMATIC_FILE);
|
||||||
options.put("schematic.specify_on_claim", PlotArea.SCHEMATIC_CLAIM_SPECIFY_DEFAULT);
|
options.put("schematic.specify_on_claim", SCHEMATIC_CLAIM_SPECIFY);
|
||||||
options.put("schematic.schematics", PlotArea.SCHEMATICS_DEFAULT);
|
options.put("schematic.schematics", SCHEMATICS);
|
||||||
options.put("economy.use", PlotArea.USE_ECONOMY_DEFAULT);
|
options.put("economy.use", USE_ECONOMY);
|
||||||
options.put("economy.prices.claim", PlotArea.PLOT_PRICE_DEFAULT);
|
options.put("economy.prices.claim", PLOT_PRICE);
|
||||||
options.put("economy.prices.merge", PlotArea.MERGE_PRICE_DEFAULT);
|
options.put("economy.prices.merge", MERGE_PRICE);
|
||||||
options.put("economy.prices.sell", PlotArea.SELL_PRICE_DEFAULT);
|
options.put("economy.prices.sell", SELL_PRICE);
|
||||||
options.put("chat.enabled", PlotArea.PLOT_CHAT_DEFAULT);
|
options.put("chat.enabled", PLOT_CHAT);
|
||||||
options.put("flags.default", null);
|
options.put("flags.default", null);
|
||||||
options.put("event.spawn.egg", PlotArea.SPAWN_EGGS_DEFAULT);
|
options.put("event.spawn.egg", SPAWN_EGGS);
|
||||||
options.put("event.spawn.custom", PlotArea.SPAWN_CUSTOM_DEFAULT);
|
options.put("event.spawn.custom", SPAWN_CUSTOM);
|
||||||
options.put("event.spawn.breeding", PlotArea.SPAWN_BREEDING_DEFAULT);
|
options.put("event.spawn.breeding", SPAWN_BREEDING);
|
||||||
options.put("world.border", PlotArea.WORLD_BORDER_DEFAULT);
|
options.put("world.border", WORLD_BORDER);
|
||||||
options.put("limits.max-members", PlotArea.MAX_PLOT_MEMBERS_DEFAULT);
|
options.put("limits.max-members", MAX_PLOT_MEMBERS);
|
||||||
options.put("home.default", "side");
|
options.put("home.default", "side");
|
||||||
options.put("home.allow-nonmembers", false);
|
options.put("home.allow-nonmembers", false);
|
||||||
options.put("world.max_height", PlotArea.MAX_BUILD_HEIGHT_DEFAULT);
|
options.put("world.max_height", MAX_BUILD_HEIGHT);
|
||||||
options.put("world.min_height", PlotArea.MIN_BUILD_HEIGHT_DEFAULT);
|
options.put("world.min_height", MIN_BUILD_HEIGHT);
|
||||||
options.put("world.gamemode", PlotArea.GAMEMODE_DEFAULT.name().toLowerCase());
|
options.put("world.gamemode", GAMEMODE.name().toLowerCase());
|
||||||
|
|
||||||
if ((TYPE != 0)) {
|
if ((TYPE != 0)) {
|
||||||
options.put("generator.terrain", TERRAIN);
|
options.put("generator.terrain", TERRAIN);
|
||||||
|
@ -27,7 +27,7 @@ import com.plotsquared.general.commands.CommandCaller;
|
|||||||
*/
|
*/
|
||||||
public abstract class PlotPlayer implements CommandCaller {
|
public abstract class PlotPlayer implements CommandCaller {
|
||||||
|
|
||||||
protected final Map<String, byte[]> metaMap = new HashMap<>();
|
private Map<String, byte[]> metaMap = new HashMap<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The metadata map
|
* The metadata map
|
||||||
@ -422,7 +422,12 @@ public abstract class PlotPlayer implements CommandCaller {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void populatePersistentMetaMap() {
|
public void populatePersistentMetaMap() {
|
||||||
DBFunc.dbManager.getPersistentMeta(this);
|
DBFunc.dbManager.getPersistentMeta(this, new RunnableVal<Map<String, byte[]>>() {
|
||||||
|
@Override
|
||||||
|
public void run(Map<String, byte[]> value) {
|
||||||
|
PlotPlayer.this.metaMap = value;
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public byte[] getPersistentMeta(String key) {
|
public byte[] getPersistentMeta(String key) {
|
||||||
|
@ -0,0 +1,20 @@
|
|||||||
|
package com.intellectualcrafters.plot.object;
|
||||||
|
|
||||||
|
public abstract class RunnableVal2<T, U> implements Runnable {
|
||||||
|
public T value1;
|
||||||
|
public U value2;
|
||||||
|
|
||||||
|
public RunnableVal2() {}
|
||||||
|
|
||||||
|
public RunnableVal2(T value1, U value2) {
|
||||||
|
this.value1 = value1;
|
||||||
|
this.value2 = value2;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
run(value1, value2);
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract void run(T value1, U value2);
|
||||||
|
}
|
@ -0,0 +1,22 @@
|
|||||||
|
package com.intellectualcrafters.plot.object;
|
||||||
|
|
||||||
|
public abstract class RunnableVal3<T, U, V> implements Runnable {
|
||||||
|
public T value1;
|
||||||
|
public U value2;
|
||||||
|
public V value3;
|
||||||
|
|
||||||
|
public RunnableVal3() {}
|
||||||
|
|
||||||
|
public RunnableVal3(T value1, U value2, V value3) {
|
||||||
|
this.value1 = value1;
|
||||||
|
this.value2 = value2;
|
||||||
|
this.value3 = value3;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
run(value1, value2, value3);
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract void run(T value1, U value2, V value3);
|
||||||
|
}
|
@ -64,7 +64,7 @@ public abstract class ChunkManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void regenerateLargeRegion(final String world, final RegionWrapper region, final Runnable whenDone) {
|
public static void largeRegionTask(final String world, final RegionWrapper region, final RunnableVal<ChunkLoc> task, final Runnable whenDone) {
|
||||||
TaskManager.runTaskAsync(new Runnable() {
|
TaskManager.runTaskAsync(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
@ -91,12 +91,7 @@ public abstract class ChunkManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
TaskManager.objectTask(chunks, new RunnableVal<ChunkLoc>() {
|
TaskManager.objectTask(chunks, task, whenDone);
|
||||||
@Override
|
|
||||||
public void run(ChunkLoc value) {
|
|
||||||
manager.regenerateChunk(world, value);
|
|
||||||
}
|
|
||||||
}, whenDone);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,6 @@ import java.util.HashMap;
|
|||||||
|
|
||||||
import com.intellectualcrafters.plot.generator.GeneratorWrapper;
|
import com.intellectualcrafters.plot.generator.GeneratorWrapper;
|
||||||
import com.intellectualcrafters.plot.object.PlotArea;
|
import com.intellectualcrafters.plot.object.PlotArea;
|
||||||
import com.intellectualcrafters.plot.object.PlotCluster;
|
|
||||||
import com.intellectualcrafters.plot.object.SetupObject;
|
import com.intellectualcrafters.plot.object.SetupObject;
|
||||||
|
|
||||||
public abstract class SetupUtils {
|
public abstract class SetupUtils {
|
||||||
@ -18,6 +17,4 @@ public abstract class SetupUtils {
|
|||||||
public abstract String getGenerator(final PlotArea plotworld);
|
public abstract String getGenerator(final PlotArea plotworld);
|
||||||
|
|
||||||
public abstract String setupWorld(final SetupObject object);
|
public abstract String setupWorld(final SetupObject object);
|
||||||
|
|
||||||
public abstract void removePopulator(final String world, final PlotCluster cluster);
|
|
||||||
}
|
}
|
||||||
|
@ -104,14 +104,14 @@ public class QuadMap<T> {
|
|||||||
if (region.minX >= x) {
|
if (region.minX >= x) {
|
||||||
if (region.minZ >= z) {
|
if (region.minZ >= z) {
|
||||||
if (one == null) {
|
if (one == null) {
|
||||||
one = newInstance(newsize, x, z, min);
|
one = newInstance(newsize, x + newsize, z + newsize, min);
|
||||||
}
|
}
|
||||||
one.add(area);
|
one.add(area);
|
||||||
recalculateSkip();
|
recalculateSkip();
|
||||||
return;
|
return;
|
||||||
} else if (region.maxZ < z) {
|
} else if (region.maxZ < z) {
|
||||||
if (two == null) {
|
if (two == null) {
|
||||||
two = newInstance(newsize, x, z, min);
|
two = newInstance(newsize, x + newsize, z - newsize, min);
|
||||||
}
|
}
|
||||||
two.add(area);
|
two.add(area);
|
||||||
recalculateSkip();
|
recalculateSkip();
|
||||||
@ -120,14 +120,14 @@ public class QuadMap<T> {
|
|||||||
} else if (region.maxX < x) {
|
} else if (region.maxX < x) {
|
||||||
if (region.minZ >= z) {
|
if (region.minZ >= z) {
|
||||||
if (four == null) {
|
if (four == null) {
|
||||||
four = newInstance(newsize, x, z, min);
|
four = newInstance(newsize, x - newsize, z + newsize, min);
|
||||||
}
|
}
|
||||||
four.add(area);
|
four.add(area);
|
||||||
recalculateSkip();
|
recalculateSkip();
|
||||||
return;
|
return;
|
||||||
} else if (region.maxZ < z) {
|
} else if (region.maxZ < z) {
|
||||||
if (three == null) {
|
if (three == null) {
|
||||||
three = newInstance(newsize, x, z, min);
|
three = newInstance(newsize, x - newsize, z - newsize, min);
|
||||||
}
|
}
|
||||||
three.add(area);
|
three.add(area);
|
||||||
recalculateSkip();
|
recalculateSkip();
|
||||||
@ -252,7 +252,7 @@ public class QuadMap<T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean intersects(RegionWrapper other) {
|
public boolean intersects(RegionWrapper other) {
|
||||||
return (other.minX <= this.x + size) && (other.maxX >= this.x) && (other.minZ <= this.z + size) && (other.maxZ >= this.z);
|
return (other.minX <= this.x + size) && (other.maxX >= this.x - size) && (other.minZ <= this.z + size) && (other.maxZ >= this.z - size);
|
||||||
}
|
}
|
||||||
|
|
||||||
public T get(int x, int z) {
|
public T get(int x, int z) {
|
||||||
|
@ -12,7 +12,7 @@ public class HelpMenu {
|
|||||||
public static final int PER_PAGE = 5;
|
public static final int PER_PAGE = 5;
|
||||||
|
|
||||||
private final PlotPlayer _player;
|
private final PlotPlayer _player;
|
||||||
private HelpPage _page = new HelpPage(CommandCategory.ACTIONS, 0, 0);
|
private HelpPage _page = new HelpPage(CommandCategory.INFO, 0, 0);
|
||||||
private int _maxPage;
|
private int _maxPage;
|
||||||
private CommandCategory _commandCategory;
|
private CommandCategory _commandCategory;
|
||||||
private List<Command<PlotPlayer>> _commands;
|
private List<Command<PlotPlayer>> _commands;
|
||||||
|
@ -19,11 +19,9 @@ import com.intellectualcrafters.plot.PS;
|
|||||||
import com.intellectualcrafters.plot.config.ConfigurationNode;
|
import com.intellectualcrafters.plot.config.ConfigurationNode;
|
||||||
import com.intellectualcrafters.plot.generator.GeneratorWrapper;
|
import com.intellectualcrafters.plot.generator.GeneratorWrapper;
|
||||||
import com.intellectualcrafters.plot.object.PlotArea;
|
import com.intellectualcrafters.plot.object.PlotArea;
|
||||||
import com.intellectualcrafters.plot.object.PlotCluster;
|
|
||||||
import com.intellectualcrafters.plot.object.SetupObject;
|
import com.intellectualcrafters.plot.object.SetupObject;
|
||||||
import com.intellectualcrafters.plot.util.SetupUtils;
|
import com.intellectualcrafters.plot.util.SetupUtils;
|
||||||
import com.plotsquared.bukkit.generator.BukkitPlotGenerator;
|
import com.plotsquared.bukkit.generator.BukkitPlotGenerator;
|
||||||
import com.plotsquared.sponge.generator.AugmentedPopulator;
|
|
||||||
|
|
||||||
public class BukkitSetupUtils extends SetupUtils {
|
public class BukkitSetupUtils extends SetupUtils {
|
||||||
|
|
||||||
@ -54,10 +52,9 @@ public class BukkitSetupUtils extends SetupUtils {
|
|||||||
@Override
|
@Override
|
||||||
public String setupWorld(final SetupObject object) {
|
public String setupWorld(final SetupObject object) {
|
||||||
SetupUtils.manager.updateGenerators();
|
SetupUtils.manager.updateGenerators();
|
||||||
//
|
ConfigurationNode[] steps = object.step == null ? new ConfigurationNode[0] : object.step;
|
||||||
ConfigurationNode[] steps = object.step;
|
|
||||||
final String world = object.world;
|
final String world = object.world;
|
||||||
int type = object.type; // TODO type = 2
|
int type = object.type;
|
||||||
String worldPath = "worlds." + object.world;
|
String worldPath = "worlds." + object.world;
|
||||||
if (!PS.get().config.contains(worldPath)) {
|
if (!PS.get().config.contains(worldPath)) {
|
||||||
PS.get().config.createSection(worldPath);
|
PS.get().config.createSection(worldPath);
|
||||||
@ -202,9 +199,4 @@ public class BukkitSetupUtils extends SetupUtils {
|
|||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void removePopulator(final String world, final PlotCluster cluster) {
|
|
||||||
AugmentedPopulator.removePopulator(world, cluster);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -4,25 +4,16 @@ import java.util.ArrayList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
import org.spongepowered.api.block.BlockState;
|
import org.bukkit.block.BlockState;
|
||||||
import org.spongepowered.api.block.BlockType;
|
|
||||||
import org.spongepowered.api.block.BlockTypes;
|
|
||||||
import org.spongepowered.api.block.tileentity.Sign;
|
|
||||||
import org.spongepowered.api.block.tileentity.TileEntity;
|
|
||||||
import org.spongepowered.api.data.manipulator.mutable.tileentity.SignData;
|
|
||||||
import org.spongepowered.api.data.value.mutable.ListValue;
|
|
||||||
import org.spongepowered.api.text.Text;
|
|
||||||
import org.spongepowered.api.world.World;
|
|
||||||
import org.spongepowered.api.world.biome.BiomeType;
|
|
||||||
import org.spongepowered.api.world.biome.BiomeTypes;
|
|
||||||
|
|
||||||
|
import com.intellectualcrafters.plot.flag.FlagValue.ListValue;
|
||||||
import com.intellectualcrafters.plot.object.Location;
|
import com.intellectualcrafters.plot.object.Location;
|
||||||
import com.intellectualcrafters.plot.object.PlotBlock;
|
import com.intellectualcrafters.plot.object.PlotBlock;
|
||||||
import com.intellectualcrafters.plot.object.schematic.PlotItem;
|
import com.intellectualcrafters.plot.object.schematic.PlotItem;
|
||||||
import com.intellectualcrafters.plot.util.BlockManager;
|
|
||||||
import com.intellectualcrafters.plot.util.MathMan;
|
import com.intellectualcrafters.plot.util.MathMan;
|
||||||
import com.intellectualcrafters.plot.util.StringComparison;
|
import com.intellectualcrafters.plot.util.StringComparison;
|
||||||
import com.plotsquared.sponge.SpongeMain;
|
import com.plotsquared.sponge.SpongeMain;
|
||||||
|
import com.sk89q.worldedit.blocks.BlockType;
|
||||||
|
|
||||||
public class SpongeBlockManager extends BlockManager {
|
public class SpongeBlockManager extends BlockManager {
|
||||||
|
|
||||||
@ -95,7 +86,6 @@ public class SpongeBlockManager extends BlockManager {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PlotBlock getPlotBlockFromString(final String block) {
|
public PlotBlock getPlotBlockFromString(final String block) {
|
||||||
dsa
|
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user