mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 21:26:45 +01:00
Fixes
Fixes #701 Fixes set components for other plots Add setowner uuid. Probably some other stuff
This commit is contained in:
parent
7ed693dfc8
commit
7db30590c6
@ -46,18 +46,29 @@ public class Owner extends SetCommand {
|
|||||||
public boolean set(PlotPlayer plr, Plot plot, String value) {
|
public boolean set(PlotPlayer plr, Plot plot, String value) {
|
||||||
HashSet<Plot> plots = MainUtil.getConnectedPlots(plot);
|
HashSet<Plot> plots = MainUtil.getConnectedPlots(plot);
|
||||||
final PlotPlayer other = UUIDHandler.getPlayer(value);
|
final PlotPlayer other = UUIDHandler.getPlayer(value);
|
||||||
UUID uuid;
|
UUID uuid = null;
|
||||||
uuid = other == null ? (Permissions.hasPermission(plr, "plots.admin.command.setowner") ? UUIDHandler.getUUID(value, null) : null) : other.getUUID();
|
if (other == null) {
|
||||||
|
if (Permissions.hasPermission(plr, "plots.admin.command.setowner")) {
|
||||||
|
if ((uuid = UUIDHandler.getUUID(value, null)) == null) {
|
||||||
|
try {
|
||||||
|
uuid = UUID.fromString(value);
|
||||||
|
} catch (Exception e) {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
other.getUUID();
|
||||||
|
}
|
||||||
if (uuid == null) {
|
if (uuid == null) {
|
||||||
MainUtil.sendMessage(plr, C.INVALID_PLAYER, value);
|
MainUtil.sendMessage(plr, C.INVALID_PLAYER, value);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
String name = other == null ? UUIDHandler.getName(uuid) : other.getName();
|
String name = other == null ? MainUtil.getName(uuid) : other.getName();
|
||||||
if (plot.isOwner(uuid)) {
|
if (plot.isOwner(uuid)) {
|
||||||
C.ALREADY_OWNER.send(plr);
|
C.ALREADY_OWNER.send(plr);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!Permissions.hasPermission(plr, "plots.admin.command.setowner")) {
|
if (other != null && !Permissions.hasPermission(plr, "plots.admin.command.setowner")) {
|
||||||
final int size = plots.size();
|
final int size = plots.size();
|
||||||
final int currentPlots = (Settings.GLOBAL_LIMIT ? MainUtil.getPlayerPlotCount(other) : MainUtil.getPlayerPlotCount(plot.world, other)) + size;
|
final int currentPlots = (Settings.GLOBAL_LIMIT ? MainUtil.getPlayerPlotCount(other) : MainUtil.getPlayerPlotCount(plot.world, other)) + size;
|
||||||
if (currentPlots > MainUtil.getAllowedPlots(other)) {
|
if (currentPlots > MainUtil.getAllowedPlots(other)) {
|
||||||
|
@ -177,7 +177,7 @@ public class Set extends SubCommand {
|
|||||||
// components
|
// components
|
||||||
HashSet<String> components = new HashSet<String>(Arrays.asList(plot.getManager().getPlotComponents(plot.getWorld(), plot.id)));
|
HashSet<String> components = new HashSet<String>(Arrays.asList(plot.getManager().getPlotComponents(plot.getWorld(), plot.id)));
|
||||||
if (components.contains(args[0].toLowerCase())) {
|
if (components.contains(args[0].toLowerCase())) {
|
||||||
return component.onCommand(plr, Arrays.copyOfRange(args, 1, args.length));
|
return component.onCommand(plr, Arrays.copyOfRange(args, 0, args.length));
|
||||||
}
|
}
|
||||||
// flag
|
// flag
|
||||||
{
|
{
|
||||||
|
@ -227,7 +227,7 @@ public class ClassicPlotManager extends SquarePlotManager {
|
|||||||
final int sz = pos1.getZ() - 2;
|
final int sz = pos1.getZ() - 2;
|
||||||
final int ez = pos2.getZ() + 2;
|
final int ez = pos2.getZ() + 2;
|
||||||
MainUtil.setSimpleCuboidAsync(plotworld.worldname, new Location(plotworld.worldname, sx, Math.min(dpw.WALL_HEIGHT, dpw.ROAD_HEIGHT) + 1, sz + 1), new Location(plotworld.worldname, ex, 255, ez - 1), new PlotBlock((short) 0, (byte) 0));
|
MainUtil.setSimpleCuboidAsync(plotworld.worldname, new Location(plotworld.worldname, sx, Math.min(dpw.WALL_HEIGHT, dpw.ROAD_HEIGHT) + 1, sz + 1), new Location(plotworld.worldname, ex, 255, ez - 1), new PlotBlock((short) 0, (byte) 0));
|
||||||
MainUtil.setSimpleCuboidAsync(plotworld.worldname, new Location(plotworld.worldname, sx, 1, sz + 1), new Location(plotworld.worldname, ex, dpw.PLOT_HEIGHT, ez - 1), new PlotBlock((short) 7,
|
MainUtil.setSimpleCuboidAsync(plotworld.worldname, new Location(plotworld.worldname, sx, 0, sz + 1), new Location(plotworld.worldname, ex, 0, ez - 1), new PlotBlock((short) 7,
|
||||||
(byte) 0));
|
(byte) 0));
|
||||||
MainUtil.setSimpleCuboidAsync(plotworld.worldname, new Location(plotworld.worldname, sx, 1, sz + 1), new Location(plotworld.worldname, sx, dpw.WALL_HEIGHT, ez - 1), dpw.WALL_FILLING);
|
MainUtil.setSimpleCuboidAsync(plotworld.worldname, new Location(plotworld.worldname, sx, 1, sz + 1), new Location(plotworld.worldname, sx, dpw.WALL_HEIGHT, ez - 1), dpw.WALL_FILLING);
|
||||||
MainUtil.setSimpleCuboidAsync(plotworld.worldname, new Location(plotworld.worldname, sx, dpw.WALL_HEIGHT + 1, sz + 1), new Location(plotworld.worldname, sx, dpw.WALL_HEIGHT + 1, ez - 1),
|
MainUtil.setSimpleCuboidAsync(plotworld.worldname, new Location(plotworld.worldname, sx, dpw.WALL_HEIGHT + 1, sz + 1), new Location(plotworld.worldname, sx, dpw.WALL_HEIGHT + 1, ez - 1),
|
||||||
|
@ -519,6 +519,7 @@ public abstract class SchematicHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public List<String> getSaves(final UUID uuid) {
|
public List<String> getSaves(final UUID uuid) {
|
||||||
|
final StringBuilder rawJSON = new StringBuilder();
|
||||||
try {
|
try {
|
||||||
final String website = Settings.WEB_URL + "list.php?" + uuid.toString();
|
final String website = Settings.WEB_URL + "list.php?" + uuid.toString();
|
||||||
final URL url = new URL(website);
|
final URL url = new URL(website);
|
||||||
@ -526,7 +527,6 @@ public abstract class SchematicHandler {
|
|||||||
connection.setRequestProperty("User-Agent", "Mozilla/5.0");
|
connection.setRequestProperty("User-Agent", "Mozilla/5.0");
|
||||||
final BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
|
final BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
|
||||||
String line;
|
String line;
|
||||||
final StringBuilder rawJSON = new StringBuilder();
|
|
||||||
while ((line = reader.readLine()) != null) {
|
while ((line = reader.readLine()) != null) {
|
||||||
rawJSON.append(line);
|
rawJSON.append(line);
|
||||||
}
|
}
|
||||||
@ -540,6 +540,7 @@ public abstract class SchematicHandler {
|
|||||||
return Lists.reverse(schematics);
|
return Lists.reverse(schematics);
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
PS.debug("ERROR PARSING: " + rawJSON);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user