mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-23 05:36:45 +01:00
Various
Fix sethome/home for mega plots Minor tweaks
This commit is contained in:
parent
dd4a1faede
commit
c32cfc62fa
2
pom.xml
2
pom.xml
@ -8,7 +8,7 @@
|
|||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
</properties>
|
</properties>
|
||||||
<artifactId>PlotSquared</artifactId>
|
<artifactId>PlotSquared</artifactId>
|
||||||
<version>3.2.23</version>
|
<version>3.2.24</version>
|
||||||
<name>PlotSquared</name>
|
<name>PlotSquared</name>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
<build>
|
<build>
|
||||||
|
@ -1841,6 +1841,7 @@ public class PS {
|
|||||||
options.put("metrics", true);
|
options.put("metrics", true);
|
||||||
options.put("debug", true);
|
options.put("debug", true);
|
||||||
options.put("update-notifications", Settings.UPDATE_NOTIFICATIONS);
|
options.put("update-notifications", Settings.UPDATE_NOTIFICATIONS);
|
||||||
|
options.put("merge.remove-terrain", Settings.MERGE_REMOVES_ROADS);
|
||||||
|
|
||||||
for (final Entry<String, Object> node : options.entrySet()) {
|
for (final Entry<String, Object> node : options.entrySet()) {
|
||||||
if (!config.contains(node.getKey())) {
|
if (!config.contains(node.getKey())) {
|
||||||
@ -1966,6 +1967,7 @@ public class PS {
|
|||||||
}
|
}
|
||||||
Settings.METRICS = config.getBoolean("metrics");
|
Settings.METRICS = config.getBoolean("metrics");
|
||||||
Settings.UPDATE_NOTIFICATIONS = config.getBoolean("update-notifications");
|
Settings.UPDATE_NOTIFICATIONS = config.getBoolean("update-notifications");
|
||||||
|
Settings.MERGE_REMOVES_ROADS = config.getBoolean("merge.remove-terrain");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -20,7 +20,6 @@
|
|||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
package com.intellectualcrafters.plot.commands;
|
package com.intellectualcrafters.plot.commands;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
@ -29,12 +28,10 @@ import com.intellectualcrafters.plot.config.C;
|
|||||||
import com.intellectualcrafters.plot.config.Settings;
|
import com.intellectualcrafters.plot.config.Settings;
|
||||||
import com.intellectualcrafters.plot.object.Location;
|
import com.intellectualcrafters.plot.object.Location;
|
||||||
import com.intellectualcrafters.plot.object.Plot;
|
import com.intellectualcrafters.plot.object.Plot;
|
||||||
import com.intellectualcrafters.plot.object.PlotId;
|
|
||||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
import com.intellectualcrafters.plot.object.PlotWorld;
|
import com.intellectualcrafters.plot.object.PlotWorld;
|
||||||
import com.intellectualcrafters.plot.util.CmdConfirm;
|
import com.intellectualcrafters.plot.util.CmdConfirm;
|
||||||
import com.intellectualcrafters.plot.util.EconHandler;
|
import com.intellectualcrafters.plot.util.EconHandler;
|
||||||
import com.intellectualcrafters.plot.util.EventUtil;
|
|
||||||
import com.intellectualcrafters.plot.util.MainUtil;
|
import com.intellectualcrafters.plot.util.MainUtil;
|
||||||
import com.intellectualcrafters.plot.util.Permissions;
|
import com.intellectualcrafters.plot.util.Permissions;
|
||||||
import com.intellectualcrafters.plot.util.StringMan;
|
import com.intellectualcrafters.plot.util.StringMan;
|
||||||
@ -46,7 +43,7 @@ command = "merge",
|
|||||||
aliases = { "m" },
|
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 [direction]",
|
usage = "/plot merge <all|n|e|s|w> [removeroads]",
|
||||||
category = CommandCategory.ACTIONS,
|
category = CommandCategory.ACTIONS,
|
||||||
requiredType = RequiredType.NONE)
|
requiredType = RequiredType.NONE)
|
||||||
public class Merge extends SubCommand {
|
public class Merge extends SubCommand {
|
||||||
@ -125,7 +122,11 @@ public class Merge extends SubCommand {
|
|||||||
// }
|
// }
|
||||||
} else {
|
} else {
|
||||||
if (args[0].equalsIgnoreCase("all") || args[0].equalsIgnoreCase("auto")) {
|
if (args[0].equalsIgnoreCase("all") || args[0].equalsIgnoreCase("auto")) {
|
||||||
if (MainUtil.autoMerge(plot, -1, maxSize - size, uuid, (args.length != 2) || !args[1].equalsIgnoreCase("false"))) {
|
boolean terrain = Settings.MERGE_REMOVES_ROADS;
|
||||||
|
if (args.length == 2) {
|
||||||
|
terrain = args[1].equalsIgnoreCase("true");
|
||||||
|
}
|
||||||
|
if (MainUtil.autoMerge(plot, -1, maxSize - size, uuid, terrain)) {
|
||||||
if ((EconHandler.manager != null) && plotworld.USE_ECONOMY && plotworld.MERGE_PRICE > 0d) {
|
if ((EconHandler.manager != null) && plotworld.USE_ECONOMY && plotworld.MERGE_PRICE > 0d) {
|
||||||
EconHandler.manager.withdrawMoney(plr, plotworld.MERGE_PRICE);
|
EconHandler.manager.withdrawMoney(plr, plotworld.MERGE_PRICE);
|
||||||
sendMessage(plr, C.REMOVED_BALANCE, plotworld.MERGE_PRICE + "");
|
sendMessage(plr, C.REMOVED_BALANCE, plotworld.MERGE_PRICE + "");
|
||||||
@ -145,11 +146,17 @@ public class Merge extends SubCommand {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (direction == -1) {
|
if (direction == -1) {
|
||||||
MainUtil.sendMessage(plr, C.COMMAND_SYNTAX, "/plot merge <" + StringMan.join(values, "|") + ">");
|
MainUtil.sendMessage(plr, C.COMMAND_SYNTAX, "/plot merge <" + StringMan.join(values, "|") + "> [removeroads]");
|
||||||
MainUtil.sendMessage(plr, C.DIRECTION.s().replaceAll("%dir%", direction(loc.getYaw())));
|
MainUtil.sendMessage(plr, C.DIRECTION.s().replaceAll("%dir%", direction(loc.getYaw())));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (MainUtil.autoMerge(plot, direction, maxSize - size, uuid, (args.length != 2) || !args[1].equalsIgnoreCase("false"))) {
|
final boolean terrain;
|
||||||
|
if (args.length == 2) {
|
||||||
|
terrain = args[1].equalsIgnoreCase("true");
|
||||||
|
} else {
|
||||||
|
terrain = Settings.MERGE_REMOVES_ROADS;
|
||||||
|
}
|
||||||
|
if (MainUtil.autoMerge(plot, direction, maxSize - size, uuid, terrain)) {
|
||||||
if ((EconHandler.manager != null) && plotworld.USE_ECONOMY && plotworld.MERGE_PRICE > 0d) {
|
if ((EconHandler.manager != null) && plotworld.USE_ECONOMY && plotworld.MERGE_PRICE > 0d) {
|
||||||
EconHandler.manager.withdrawMoney(plr, plotworld.MERGE_PRICE);
|
EconHandler.manager.withdrawMoney(plr, plotworld.MERGE_PRICE);
|
||||||
sendMessage(plr, C.REMOVED_BALANCE, plotworld.MERGE_PRICE + "");
|
sendMessage(plr, C.REMOVED_BALANCE, plotworld.MERGE_PRICE + "");
|
||||||
@ -179,7 +186,7 @@ public class Merge extends SubCommand {
|
|||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
MainUtil.sendMessage(accepter, C.MERGE_ACCEPTED);
|
MainUtil.sendMessage(accepter, C.MERGE_ACCEPTED);
|
||||||
MainUtil.autoMerge(plot, dir, maxSize - size, owner, true);
|
MainUtil.autoMerge(plot, dir, maxSize - size, owner, terrain);
|
||||||
final PlotPlayer pp = UUIDHandler.getPlayer(plr.getUUID());
|
final PlotPlayer pp = UUIDHandler.getPlayer(plr.getUUID());
|
||||||
if (pp == null) {
|
if (pp == null) {
|
||||||
sendMessage(accepter, C.MERGE_NOT_VALID);
|
sendMessage(accepter, C.MERGE_NOT_VALID);
|
||||||
|
@ -44,17 +44,16 @@ public class SetHome extends SetCommand {
|
|||||||
case "unset":
|
case "unset":
|
||||||
case "remove":
|
case "remove":
|
||||||
case "none": {
|
case "none": {
|
||||||
plot.setHome(null);
|
plot.getBasePlot(false).setHome(null);
|
||||||
MainUtil.sendMessage(plr, C.POSITION_UNSET);
|
MainUtil.sendMessage(plr, C.POSITION_UNSET);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
case "": {
|
case "": {
|
||||||
final String world = plr.getLocation().getWorld();
|
Plot base = plot.getBasePlot(false);
|
||||||
final Location base = MainUtil.getPlotBottomLocAbs(world, plot.id).subtract(1, 0, 1);
|
Location bot = base.getBottomAbs();
|
||||||
base.setY(0);
|
Location loc = plr.getLocationFull();
|
||||||
final Location relative = plr.getLocation().subtract(base.getX(), base.getY(), base.getZ());
|
BlockLoc rel = new BlockLoc(loc.getX() - bot.getX(), loc.getY(), loc.getZ() - bot.getZ(), loc.getYaw(), loc.getPitch());;
|
||||||
final BlockLoc blockloc = new BlockLoc(relative.getX(), relative.getY(), relative.getZ(), relative.getYaw(), relative.getPitch());
|
base.setHome(rel);
|
||||||
plot.setHome(blockloc);
|
|
||||||
return MainUtil.sendMessage(plr, C.POSITION_SET);
|
return MainUtil.sendMessage(plr, C.POSITION_SET);
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
|
@ -37,6 +37,7 @@ public class Settings {
|
|||||||
|
|
||||||
public static boolean ENABLE_CLUSTERS = false;
|
public static boolean ENABLE_CLUSTERS = false;
|
||||||
public static boolean FAST_CLEAR = false;
|
public static boolean FAST_CLEAR = false;
|
||||||
|
public static boolean MERGE_REMOVES_ROADS = true;
|
||||||
/**
|
/**
|
||||||
* Default UUID_FECTHING: false
|
* Default UUID_FECTHING: false
|
||||||
*/
|
*/
|
||||||
|
@ -2375,8 +2375,7 @@ public class SQLManager implements AbstractDB {
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
try {
|
try {
|
||||||
final String[] split = pos.split(",");
|
BlockLoc loc = BlockLoc.fromString(pos);
|
||||||
final BlockLoc loc = new BlockLoc(Integer.parseInt(split[0]), Integer.parseInt(split[1]), Integer.parseInt(split[2]));
|
|
||||||
cluster.settings.setPosition(loc);
|
cluster.settings.setPosition(loc);
|
||||||
} catch (final Exception e) {}
|
} catch (final Exception e) {}
|
||||||
}
|
}
|
||||||
|
@ -817,16 +817,17 @@ public class Plot {
|
|||||||
* Set the home location
|
* Set the home location
|
||||||
* @param loc
|
* @param loc
|
||||||
*/
|
*/
|
||||||
public void setHome(final BlockLoc loc) {
|
public void setHome(BlockLoc loc) {
|
||||||
final BlockLoc pos = getSettings().getPosition();
|
final BlockLoc pos = getSettings().getPosition();
|
||||||
if (((pos == null || pos.equals(new BlockLoc(0, 0, 0))) && (loc == null)) || ((pos != null) && pos.equals(loc))) {
|
if (((pos == null || pos.equals(new BlockLoc(0, 0, 0))) && (loc == null)) || ((pos != null) && pos.equals(loc))) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
getSettings().setPosition(loc);
|
Plot plot = getBasePlot(false);
|
||||||
if (getSettings().getPosition() == null) {
|
plot.getSettings().setPosition(loc);
|
||||||
DBFunc.setPosition(this, "");
|
if (plot.getSettings().getPosition() == null) {
|
||||||
|
DBFunc.setPosition(plot, "");
|
||||||
} else {
|
} else {
|
||||||
DBFunc.setPosition(this, getSettings().getPosition().toString());
|
DBFunc.setPosition(plot, getSettings().getPosition().toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1616,14 +1616,14 @@ public class MainUtil {
|
|||||||
* @return Home Location
|
* @return Home Location
|
||||||
*/
|
*/
|
||||||
public static Location getPlotHome(final String w, final PlotId plotid) {
|
public static Location getPlotHome(final String w, final PlotId plotid) {
|
||||||
final Plot plot = getPlot(w, plotid);
|
final Plot plot = getPlot(w, plotid).getBasePlot(false);
|
||||||
final BlockLoc home = plot.getPosition();
|
final BlockLoc home = plot.getPosition();
|
||||||
PS.get().getPlotManager(w);
|
PS.get().getPlotManager(w);
|
||||||
if ((home == null) || ((home.x == 0) && (home.z == 0))) {
|
if ((home == null) || ((home.x == 0) && (home.z == 0))) {
|
||||||
return getDefaultHome(plot);
|
return getDefaultHome(plot);
|
||||||
} else {
|
} else {
|
||||||
Location bot = plot.getBottomAbs();
|
Location bot = plot.getBottomAbs();
|
||||||
final Location loc = new Location(bot.getWorld(), bot.getX() + home.x, bot.getY() + home.y, bot.getZ() + home.z);
|
final Location loc = new Location(bot.getWorld(), bot.getX() + home.x, bot.getY() + home.y, bot.getZ() + home.z, home.yaw, home.pitch);
|
||||||
if (BlockManager.manager.getBlock(loc).id != 0) {
|
if (BlockManager.manager.getBlock(loc).id != 0) {
|
||||||
loc.setY(Math.max(getHeighestBlock(w, loc.getX(), loc.getZ()), bot.getY()));
|
loc.setY(Math.max(getHeighestBlock(w, loc.getX(), loc.getZ()), bot.getY()));
|
||||||
}
|
}
|
||||||
|
@ -485,7 +485,6 @@ public abstract class SchematicHandler {
|
|||||||
*/
|
*/
|
||||||
public Schematic getSchematic(final File file) {
|
public Schematic getSchematic(final File file) {
|
||||||
if (!file.exists()) {
|
if (!file.exists()) {
|
||||||
PS.debug(file.toString() + " doesn't exist");
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user