mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-26 07:06:44 +01:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
e0c4c944bb
@ -2,6 +2,7 @@ package com.plotsquared.bukkit.listeners;
|
|||||||
|
|
||||||
import com.intellectualcrafters.plot.PS;
|
import com.intellectualcrafters.plot.PS;
|
||||||
import com.intellectualcrafters.plot.config.C;
|
import com.intellectualcrafters.plot.config.C;
|
||||||
|
import com.intellectualcrafters.plot.flag.Flags;
|
||||||
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.PlotArea;
|
import com.intellectualcrafters.plot.object.PlotArea;
|
||||||
@ -10,6 +11,9 @@ import com.intellectualcrafters.plot.util.MainUtil;
|
|||||||
import com.intellectualcrafters.plot.util.Permissions;
|
import com.intellectualcrafters.plot.util.Permissions;
|
||||||
import com.plotsquared.bukkit.util.BukkitUtil;
|
import com.plotsquared.bukkit.util.BukkitUtil;
|
||||||
import com.plotsquared.listener.PlotListener;
|
import com.plotsquared.listener.PlotListener;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.block.BlockState;
|
import org.bukkit.block.BlockState;
|
||||||
import org.bukkit.entity.ArmorStand;
|
import org.bukkit.entity.ArmorStand;
|
||||||
@ -26,10 +30,6 @@ import org.bukkit.inventory.ItemStack;
|
|||||||
import org.bukkit.inventory.PlayerInventory;
|
import org.bukkit.inventory.PlayerInventory;
|
||||||
import org.bukkit.inventory.meta.ItemMeta;
|
import org.bukkit.inventory.meta.ItemMeta;
|
||||||
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
public class PlayerEvents_1_8 extends PlotListener implements Listener {
|
public class PlayerEvents_1_8 extends PlotListener implements Listener {
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
@ -141,6 +141,9 @@ public class PlayerEvents_1_8 extends PlotListener implements Listener {
|
|||||||
} else {
|
} else {
|
||||||
UUID uuid = pp.getUUID();
|
UUID uuid = pp.getUUID();
|
||||||
if (!plot.isAdded(uuid)) {
|
if (!plot.isAdded(uuid)) {
|
||||||
|
if (Flags.MISC_INTERACT.isTrue(plot)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (!Permissions.hasPermission(pp, "plots.admin.interact.other")) {
|
if (!Permissions.hasPermission(pp, "plots.admin.interact.other")) {
|
||||||
MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, "plots.admin.interact.other");
|
MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, "plots.admin.interact.other");
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
|
@ -197,7 +197,7 @@ public class MainCommand extends Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(PlotPlayer player, String[] args, RunnableVal3<Command, Runnable, Runnable> confirm, RunnableVal2<Command, CommandResult> whenDone) {
|
public void execute(final PlotPlayer player, String[] args, RunnableVal3<Command, Runnable, Runnable> confirm, RunnableVal2<Command, CommandResult> whenDone) {
|
||||||
// Clear perm caching //
|
// Clear perm caching //
|
||||||
player.deleteMeta("perm");
|
player.deleteMeta("perm");
|
||||||
// Optional command scope //
|
// Optional command scope //
|
||||||
@ -223,6 +223,37 @@ public class MainCommand extends Command {
|
|||||||
// Trim command
|
// Trim command
|
||||||
args = Arrays.copyOfRange(args, 1, args.length);
|
args = Arrays.copyOfRange(args, 1, args.length);
|
||||||
}
|
}
|
||||||
|
if (args.length >= 2 && args[0].charAt(0) == '-') {
|
||||||
|
switch (args[0].substring(1)) {
|
||||||
|
case "f":
|
||||||
|
confirm = new RunnableVal3<Command, Runnable, Runnable>() {
|
||||||
|
@Override
|
||||||
|
public void run(final Command cmd, final Runnable success, final Runnable failure) {
|
||||||
|
if (EconHandler.manager != null) {
|
||||||
|
PlotArea area = player.getApplicablePlotArea();
|
||||||
|
if (area != null) {
|
||||||
|
Expression<Double> priceEval = area.PRICES.get(cmd.getFullId());
|
||||||
|
Double price = priceEval != null ? priceEval.evaluate(0d) : 0d;
|
||||||
|
if (price != 0d && EconHandler.manager.getMoney(player) < price) {
|
||||||
|
if (failure != null) {
|
||||||
|
failure.run();
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (success != null) {
|
||||||
|
success.run();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
args = Arrays.copyOfRange(args, 1, args.length);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
C.INVALID_COMMAND_FLAG.send(player);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
super.execute(player, args, confirm, whenDone);
|
super.execute(player, args, confirm, whenDone);
|
||||||
|
@ -452,6 +452,10 @@ public enum C {
|
|||||||
INVALID_PLAYER_WAIT("$2Player not found: $1%s$2, fetching it. Try again soon.", "Errors"),
|
INVALID_PLAYER_WAIT("$2Player not found: $1%s$2, fetching it. Try again soon.", "Errors"),
|
||||||
INVALID_PLAYER("$2Player not found: $1%s$2.", "Errors"),
|
INVALID_PLAYER("$2Player not found: $1%s$2.", "Errors"),
|
||||||
INVALID_PLAYER_OFFLINE("$2The player must be online: $1%s.", "Errors"),
|
INVALID_PLAYER_OFFLINE("$2The player must be online: $1%s.", "Errors"),
|
||||||
|
/*
|
||||||
|
* Command flag
|
||||||
|
*/
|
||||||
|
INVALID_COMMAND_FLAG("$2Invalid command flag: %s0", "Errors"),
|
||||||
/*
|
/*
|
||||||
* Unknown Error
|
* Unknown Error
|
||||||
*/
|
*/
|
||||||
|
@ -83,7 +83,7 @@ public class ClassicPlotManager extends SquarePlotManager {
|
|||||||
int maxY = plotArea.getPlotManager().getWorldHeight();
|
int maxY = plotArea.getPlotManager().getWorldHeight();
|
||||||
for (RegionWrapper region : plot.getRegions()) {
|
for (RegionWrapper region : plot.getRegions()) {
|
||||||
Location pos1 = new Location(plotArea.worldname, region.minX, 1, region.minZ);
|
Location pos1 = new Location(plotArea.worldname, region.minX, 1, region.minZ);
|
||||||
Location pos2 = new Location(plotArea.worldname, region.maxX, Math.min(maxY, 255), region.maxZ);
|
Location pos2 = new Location(plotArea.worldname, region.maxX, maxY, region.maxZ);
|
||||||
queue.setCuboid(pos1, pos2, blocks);
|
queue.setCuboid(pos1, pos2, blocks);
|
||||||
}
|
}
|
||||||
queue.enqueue();
|
queue.enqueue();
|
||||||
@ -100,7 +100,7 @@ public class ClassicPlotManager extends SquarePlotManager {
|
|||||||
int maxY = plotArea.getPlotManager().getWorldHeight();
|
int maxY = plotArea.getPlotManager().getWorldHeight();
|
||||||
for (RegionWrapper region : plot.getRegions()) {
|
for (RegionWrapper region : plot.getRegions()) {
|
||||||
Location pos1 = new Location(plotArea.worldname, region.minX, dpw.PLOT_HEIGHT + 1, region.minZ);
|
Location pos1 = new Location(plotArea.worldname, region.minX, dpw.PLOT_HEIGHT + 1, region.minZ);
|
||||||
Location pos2 = new Location(plotArea.worldname, region.maxX, Math.min(maxY, 255), region.maxZ);
|
Location pos2 = new Location(plotArea.worldname, region.maxX,maxY, region.maxZ);
|
||||||
queue.setCuboid(pos1, pos2, blocks);
|
queue.setCuboid(pos1, pos2, blocks);
|
||||||
}
|
}
|
||||||
queue.enqueue();
|
queue.enqueue();
|
||||||
@ -153,7 +153,7 @@ public class ClassicPlotManager extends SquarePlotManager {
|
|||||||
if (!plot.getMerged(0)) {
|
if (!plot.getMerged(0)) {
|
||||||
int z = bottom.getZ();
|
int z = bottom.getZ();
|
||||||
for (int x = bottom.getX(); x <= top.getX(); x++) {
|
for (int x = bottom.getX(); x <= top.getX(); x++) {
|
||||||
for (int y = dpw.PLOT_HEIGHT; y <= Math.min(maxY, 255); y++) {
|
for (int y = dpw.PLOT_HEIGHT; y <= maxY; y++) {
|
||||||
queue.setBlock(x, y, z, blocks[random.random(blocks.length)]);
|
queue.setBlock(x, y, z, blocks[random.random(blocks.length)]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -161,7 +161,7 @@ public class ClassicPlotManager extends SquarePlotManager {
|
|||||||
if (!plot.getMerged(3)) {
|
if (!plot.getMerged(3)) {
|
||||||
int x = bottom.getX();
|
int x = bottom.getX();
|
||||||
for (int z = bottom.getZ(); z <= top.getZ(); z++) {
|
for (int z = bottom.getZ(); z <= top.getZ(); z++) {
|
||||||
for (int y = dpw.PLOT_HEIGHT; y <= Math.min(maxY, 255); y++) {
|
for (int y = dpw.PLOT_HEIGHT; y <= maxY; y++) {
|
||||||
queue.setBlock(x, y, z, blocks[random.random(blocks.length)]);
|
queue.setBlock(x, y, z, blocks[random.random(blocks.length)]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -170,7 +170,7 @@ public class ClassicPlotManager extends SquarePlotManager {
|
|||||||
if (!plot.getMerged(2)) {
|
if (!plot.getMerged(2)) {
|
||||||
int z = top.getZ();
|
int z = top.getZ();
|
||||||
for (int x = bottom.getX(); x <= top.getX(); x++) {
|
for (int x = bottom.getX(); x <= top.getX(); x++) {
|
||||||
for (int y = dpw.PLOT_HEIGHT; y <= Math.min(maxY, 255); y++) {
|
for (int y = dpw.PLOT_HEIGHT; y <= maxY; y++) {
|
||||||
queue.setBlock(x, y, z, blocks[random.random(blocks.length)]);
|
queue.setBlock(x, y, z, blocks[random.random(blocks.length)]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -178,15 +178,15 @@ public class ClassicPlotManager extends SquarePlotManager {
|
|||||||
if (!plot.getMerged(1)) {
|
if (!plot.getMerged(1)) {
|
||||||
int x = top.getX();
|
int x = top.getX();
|
||||||
for (int z = bottom.getZ(); z <= top.getZ(); z++) {
|
for (int z = bottom.getZ(); z <= top.getZ(); z++) {
|
||||||
for (int y = dpw.PLOT_HEIGHT; y <= Math.min(maxY, 255); y++) {
|
for (int y = dpw.PLOT_HEIGHT; y <= maxY; y++) {
|
||||||
queue.setBlock(x, y, z, blocks[random.random(blocks.length)]);
|
queue.setBlock(x, y, z, blocks[random.random(blocks.length)]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (plot.isBasePlot()) {
|
if (plot.isBasePlot()) {
|
||||||
for (RegionWrapper region : plot.getRegions()) {
|
for (RegionWrapper region : plot.getRegions()) {
|
||||||
Location pos1 = new Location(plotArea.worldname, region.minX, Math.min(maxY, 255), region.minZ);
|
Location pos1 = new Location(plotArea.worldname, region.minX, maxY, region.minZ);
|
||||||
Location pos2 = new Location(plotArea.worldname, region.maxX, Math.min(maxY, 255), region.maxZ);
|
Location pos2 = new Location(plotArea.worldname, region.maxX, maxY, region.maxZ);
|
||||||
queue.setCuboid(pos1, pos2, blocks);
|
queue.setCuboid(pos1, pos2, blocks);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -295,7 +295,7 @@ public class ClassicPlotManager extends SquarePlotManager {
|
|||||||
int maxY = plotArea.getPlotManager().getWorldHeight();
|
int maxY = plotArea.getPlotManager().getWorldHeight();
|
||||||
queue.setCuboid(
|
queue.setCuboid(
|
||||||
new Location(plotArea.worldname, sx, Math.min(dpw.WALL_HEIGHT, dpw.ROAD_HEIGHT) + 1, sz + 1),
|
new Location(plotArea.worldname, sx, Math.min(dpw.WALL_HEIGHT, dpw.ROAD_HEIGHT) + 1, sz + 1),
|
||||||
new Location(plotArea.worldname, ex, Math.min(maxY, 255), ez - 1), PlotBlock.get((short) 0, (byte) 0));
|
new Location(plotArea.worldname, ex, maxY, ez - 1), PlotBlock.get((short) 0, (byte) 0));
|
||||||
queue.setCuboid(new Location(plotArea.worldname, sx, 0, sz + 1),
|
queue.setCuboid(new Location(plotArea.worldname, sx, 0, sz + 1),
|
||||||
new Location(plotArea.worldname, ex, 0, ez - 1), PlotBlock.get((short) 7,
|
new Location(plotArea.worldname, ex, 0, ez - 1), PlotBlock.get((short) 7,
|
||||||
(byte) 0));
|
(byte) 0));
|
||||||
@ -325,10 +325,9 @@ public class ClassicPlotManager extends SquarePlotManager {
|
|||||||
int sx = pos1.getX() - 2;
|
int sx = pos1.getX() - 2;
|
||||||
int ex = pos2.getX() + 2;
|
int ex = pos2.getX() + 2;
|
||||||
LocalBlockQueue queue = plotArea.getQueue(false);
|
LocalBlockQueue queue = plotArea.getQueue(false);
|
||||||
int maxY = plotArea.getPlotManager().getWorldHeight();
|
|
||||||
queue.setCuboid(
|
queue.setCuboid(
|
||||||
new Location(plotArea.worldname, sx + 1, Math.min(dpw.WALL_HEIGHT, dpw.ROAD_HEIGHT) + 1, sz),
|
new Location(plotArea.worldname, sx + 1, Math.min(dpw.WALL_HEIGHT, dpw.ROAD_HEIGHT) + 1, sz),
|
||||||
new Location(plotArea.worldname, ex - 1, Math.min(maxY, 255), ez), PlotBlock.get((short) 0, (byte) 0));
|
new Location(plotArea.worldname, ex - 1, plotArea.getPlotManager().getWorldHeight(), ez), PlotBlock.get((short) 0, (byte) 0));
|
||||||
queue.setCuboid(new Location(plotArea.worldname, sx + 1, 0, sz),
|
queue.setCuboid(new Location(plotArea.worldname, sx + 1, 0, sz),
|
||||||
new Location(plotArea.worldname, ex - 1, 0, ez), PlotBlock.get((short) 7, (byte) 0));
|
new Location(plotArea.worldname, ex - 1, 0, ez), PlotBlock.get((short) 7, (byte) 0));
|
||||||
queue.setCuboid(new Location(plotArea.worldname, sx + 1, 1, sz),
|
queue.setCuboid(new Location(plotArea.worldname, sx + 1, 1, sz),
|
||||||
@ -357,7 +356,7 @@ public class ClassicPlotManager extends SquarePlotManager {
|
|||||||
int ez = sz + dpw.ROAD_WIDTH - 1;
|
int ez = sz + dpw.ROAD_WIDTH - 1;
|
||||||
LocalBlockQueue queue = plotArea.getQueue(false);
|
LocalBlockQueue queue = plotArea.getQueue(false);
|
||||||
queue.setCuboid(new Location(plotArea.worldname, sx + 1, dpw.ROAD_HEIGHT + 1, sz + 1),
|
queue.setCuboid(new Location(plotArea.worldname, sx + 1, dpw.ROAD_HEIGHT + 1, sz + 1),
|
||||||
new Location(plotArea.worldname, ex - 1, 255, ez - 1), PlotBlock.get(
|
new Location(plotArea.worldname, ex - 1, dpw.getPlotManager().getWorldHeight(), ez - 1), PlotBlock.get(
|
||||||
(short) 0, (byte) 0));
|
(short) 0, (byte) 0));
|
||||||
queue.setCuboid(new Location(plotArea.worldname, sx + 1, 0, sz + 1),
|
queue.setCuboid(new Location(plotArea.worldname, sx + 1, 0, sz + 1),
|
||||||
new Location(plotArea.worldname, ex - 1, 0, ez - 1), PlotBlock.get((short) 7, (byte) 0));
|
new Location(plotArea.worldname, ex - 1, 0, ez - 1), PlotBlock.get((short) 7, (byte) 0));
|
||||||
@ -377,9 +376,8 @@ public class ClassicPlotManager extends SquarePlotManager {
|
|||||||
int sz = pos1.getZ() - 1;
|
int sz = pos1.getZ() - 1;
|
||||||
int ez = pos2.getZ() + 1;
|
int ez = pos2.getZ() + 1;
|
||||||
LocalBlockQueue queue = plotArea.getQueue(false);
|
LocalBlockQueue queue = plotArea.getQueue(false);
|
||||||
int maxY = plotArea.getPlotManager().getWorldHeight();
|
|
||||||
queue.setCuboid(new Location(plotArea.worldname, sx, Math.min(dpw.PLOT_HEIGHT, dpw.ROAD_HEIGHT) + 1, sz),
|
queue.setCuboid(new Location(plotArea.worldname, sx, Math.min(dpw.PLOT_HEIGHT, dpw.ROAD_HEIGHT) + 1, sz),
|
||||||
new Location(plotArea.worldname, ex, Math.min(maxY, 255), ez), PlotBlock.get((short) 0, (byte) 0));
|
new Location(plotArea.worldname, ex, plotArea.getPlotManager().getWorldHeight(), ez), PlotBlock.get((short) 0, (byte) 0));
|
||||||
queue.setCuboid(new Location(plotArea.worldname, sx, 1, sz + 1),
|
queue.setCuboid(new Location(plotArea.worldname, sx, 1, sz + 1),
|
||||||
new Location(plotArea.worldname, ex, dpw.PLOT_HEIGHT - 1, ez - 1), dpw.MAIN_BLOCK);
|
new Location(plotArea.worldname, ex, dpw.PLOT_HEIGHT - 1, ez - 1), dpw.MAIN_BLOCK);
|
||||||
queue.setCuboid(new Location(plotArea.worldname, sx, dpw.PLOT_HEIGHT, sz + 1),
|
queue.setCuboid(new Location(plotArea.worldname, sx, dpw.PLOT_HEIGHT, sz + 1),
|
||||||
@ -398,9 +396,8 @@ public class ClassicPlotManager extends SquarePlotManager {
|
|||||||
int sx = pos1.getX() - 1;
|
int sx = pos1.getX() - 1;
|
||||||
int ex = pos2.getX() + 1;
|
int ex = pos2.getX() + 1;
|
||||||
LocalBlockQueue queue = plotArea.getQueue(false);
|
LocalBlockQueue queue = plotArea.getQueue(false);
|
||||||
int maxY = plotArea.getPlotManager().getWorldHeight();
|
|
||||||
queue.setCuboid(new Location(plotArea.worldname, sx, Math.min(dpw.PLOT_HEIGHT, dpw.ROAD_HEIGHT) + 1, sz),
|
queue.setCuboid(new Location(plotArea.worldname, sx, Math.min(dpw.PLOT_HEIGHT, dpw.ROAD_HEIGHT) + 1, sz),
|
||||||
new Location(plotArea.worldname, ex, Math.min(maxY, 255), ez), PlotBlock.get((short) 0, (byte) 0));
|
new Location(plotArea.worldname, ex, plotArea.getPlotManager().getWorldHeight(), ez), PlotBlock.get((short) 0, (byte) 0));
|
||||||
queue.setCuboid(new Location(plotArea.worldname, sx + 1, 1, sz),
|
queue.setCuboid(new Location(plotArea.worldname, sx + 1, 1, sz),
|
||||||
new Location(plotArea.worldname, ex - 1, dpw.PLOT_HEIGHT - 1, ez), dpw.MAIN_BLOCK);
|
new Location(plotArea.worldname, ex - 1, dpw.PLOT_HEIGHT - 1, ez), dpw.MAIN_BLOCK);
|
||||||
queue.setCuboid(new Location(plotArea.worldname, sx + 1, dpw.PLOT_HEIGHT, sz),
|
queue.setCuboid(new Location(plotArea.worldname, sx + 1, dpw.PLOT_HEIGHT, sz),
|
||||||
@ -419,7 +416,7 @@ public class ClassicPlotManager extends SquarePlotManager {
|
|||||||
int ez = sz + dpw.ROAD_WIDTH - 1;
|
int ez = sz + dpw.ROAD_WIDTH - 1;
|
||||||
LocalBlockQueue queue = plotArea.getQueue(false);
|
LocalBlockQueue queue = plotArea.getQueue(false);
|
||||||
queue.setCuboid(new Location(plotArea.worldname, sx, dpw.ROAD_HEIGHT + 1, sz),
|
queue.setCuboid(new Location(plotArea.worldname, sx, dpw.ROAD_HEIGHT + 1, sz),
|
||||||
new Location(plotArea.worldname, ex, 255, ez), PlotBlock.get((short) 0, (byte) 0));
|
new Location(plotArea.worldname, ex, plotArea.getPlotManager().getWorldHeight(), ez), PlotBlock.get((short) 0, (byte) 0));
|
||||||
queue.setCuboid(new Location(plotArea.worldname, sx, 1, sz),
|
queue.setCuboid(new Location(plotArea.worldname, sx, 1, sz),
|
||||||
new Location(plotArea.worldname, ex, dpw.ROAD_HEIGHT - 1, ez), dpw.MAIN_BLOCK);
|
new Location(plotArea.worldname, ex, dpw.ROAD_HEIGHT - 1, ez), dpw.MAIN_BLOCK);
|
||||||
queue.setCuboid(new Location(plotArea.worldname, sx, dpw.ROAD_HEIGHT, sz),
|
queue.setCuboid(new Location(plotArea.worldname, sx, dpw.ROAD_HEIGHT, sz),
|
||||||
|
@ -322,15 +322,16 @@ public abstract class HybridUtils {
|
|||||||
Location bot = plot.getBottomAbs().subtract(1, 0, 1);
|
Location bot = plot.getBottomAbs().subtract(1, 0, 1);
|
||||||
Location top = plot.getTopAbs();
|
Location top = plot.getTopAbs();
|
||||||
final HybridPlotWorld plotworld = (HybridPlotWorld) plot.getArea();
|
final HybridPlotWorld plotworld = (HybridPlotWorld) plot.getArea();
|
||||||
|
PlotManager plotManager = plotworld.getPlotManager();
|
||||||
int sx = bot.getX() - plotworld.ROAD_WIDTH + 1;
|
int sx = bot.getX() - plotworld.ROAD_WIDTH + 1;
|
||||||
int sz = bot.getZ() + 1;
|
int sz = bot.getZ() + 1;
|
||||||
int sy = plotworld.ROAD_HEIGHT;
|
int sy = plotworld.ROAD_HEIGHT;
|
||||||
int ex = bot.getX();
|
int ex = bot.getX();
|
||||||
int ez = top.getZ();
|
int ez = top.getZ();
|
||||||
int ey = get_ey(queue, sx, ex, sz, ez, sy);
|
int ey = get_ey(plotManager, queue, sx, ex, sz, ez, sy);
|
||||||
int bz = sz - plotworld.ROAD_WIDTH;
|
int bz = sz - plotworld.ROAD_WIDTH;
|
||||||
int tz = sz - 1;
|
int tz = sz - 1;
|
||||||
int ty = get_ey(queue, sx, ex, bz, tz, sy);
|
int ty = get_ey(plotManager, queue, sx, ex, bz, tz, sy);
|
||||||
|
|
||||||
Set<RegionWrapper> sideRoad = new HashSet<>(Collections.singletonList(new RegionWrapper(sx, ex, sy, ey, sz, ez)));
|
Set<RegionWrapper> sideRoad = new HashSet<>(Collections.singletonList(new RegionWrapper(sx, ex, sy, ey, sz, ez)));
|
||||||
final Set<RegionWrapper> intersection = new HashSet<>(Collections.singletonList(new RegionWrapper(sx, ex, sy, ty, bz, tz)));
|
final Set<RegionWrapper> intersection = new HashSet<>(Collections.singletonList(new RegionWrapper(sx, ex, sy, ty, bz, tz)));
|
||||||
@ -354,11 +355,11 @@ public abstract class HybridUtils {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int get_ey(LocalBlockQueue queue, int sx, int ex, int sz, int ez, int sy) {
|
public int get_ey(final PlotManager pm, LocalBlockQueue queue, int sx, int ex, int sz, int ez, int sy) {
|
||||||
int ey = sy;
|
int ey = sy;
|
||||||
for (int x = sx; x <= ex; x++) {
|
for (int x = sx; x <= ex; x++) {
|
||||||
for (int z = sz; z <= ez; z++) {
|
for (int z = sz; z <= ez; z++) {
|
||||||
for (int y = sy; y < 256; y++) {
|
for (int y = sy; y <= pm.getWorldHeight(); y++) {
|
||||||
if (y > ey) {
|
if (y > ey) {
|
||||||
PlotBlock block = queue.getBlock(x, y, z);
|
PlotBlock block = queue.getBlock(x, y, z);
|
||||||
if (block.id != 0) {
|
if (block.id != 0) {
|
||||||
|
@ -1,13 +1,10 @@
|
|||||||
package com.intellectualcrafters.plot.util;
|
package com.intellectualcrafters.plot.util;
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
import java.io.*;
|
||||||
import java.io.DataOutputStream;
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.FileReader;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.InputStreamReader;
|
|
||||||
import java.net.HttpURLConnection;
|
import java.net.HttpURLConnection;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
@ -49,13 +46,17 @@ public class HastebinUtility {
|
|||||||
|
|
||||||
public static String upload(final File file) throws IOException {
|
public static String upload(final File file) throws IOException {
|
||||||
final StringBuilder content = new StringBuilder();
|
final StringBuilder content = new StringBuilder();
|
||||||
|
List<String> lines = new ArrayList<>();
|
||||||
try (BufferedReader reader = new BufferedReader(new FileReader(file))) {
|
try (BufferedReader reader = new BufferedReader(new FileReader(file))) {
|
||||||
String line;
|
String line;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
while ((line = reader.readLine()) != null && i++ < 1000) {
|
while ((line = reader.readLine()) != null) {
|
||||||
content.append(line).append("\n");
|
lines.add(line);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
for (int i = Math.max(0, lines.size() - 1000); i < lines.size(); i++) {
|
||||||
|
content.append(lines.get(i)).append("\n");
|
||||||
|
}
|
||||||
return upload(content.toString());
|
return upload(content.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@ public class ExpireManager {
|
|||||||
|
|
||||||
public void handleJoin(PlotPlayer pp) {
|
public void handleJoin(PlotPlayer pp) {
|
||||||
storeDate(pp.getUUID(), System.currentTimeMillis());
|
storeDate(pp.getUUID(), System.currentTimeMillis());
|
||||||
if (!plotsToDelete.isEmpty()) {
|
if (plotsToDelete != null && !plotsToDelete.isEmpty()) {
|
||||||
for (Plot plot : pp.getPlots()) {
|
for (Plot plot : pp.getPlots()) {
|
||||||
plotsToDelete.remove(plot);
|
plotsToDelete.remove(plot);
|
||||||
}
|
}
|
||||||
@ -77,7 +77,7 @@ public class ExpireManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void updateExpired(Plot plot) {
|
public void updateExpired(Plot plot) {
|
||||||
if (!plotsToDelete.isEmpty() && plotsToDelete.contains(plot)) {
|
if (plotsToDelete != null && !plotsToDelete.isEmpty() && plotsToDelete.contains(plot)) {
|
||||||
if (isExpired(new ArrayDeque<>(tasks), plot).isEmpty()) {
|
if (isExpired(new ArrayDeque<>(tasks), plot).isEmpty()) {
|
||||||
plotsToDelete.remove(plot);
|
plotsToDelete.remove(plot);
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,6 @@ package com.plotsquared.nukkit.util;
|
|||||||
import cn.nukkit.level.Level;
|
import cn.nukkit.level.Level;
|
||||||
import cn.nukkit.level.generator.Generator;
|
import cn.nukkit.level.generator.Generator;
|
||||||
import com.intellectualcrafters.configuration.ConfigurationSection;
|
import com.intellectualcrafters.configuration.ConfigurationSection;
|
||||||
import com.intellectualcrafters.configuration.file.YamlConfiguration;
|
|
||||||
import com.intellectualcrafters.plot.PS;
|
import com.intellectualcrafters.plot.PS;
|
||||||
import com.intellectualcrafters.plot.config.ConfigurationNode;
|
import com.intellectualcrafters.plot.config.ConfigurationNode;
|
||||||
import com.intellectualcrafters.plot.generator.GeneratorWrapper;
|
import com.intellectualcrafters.plot.generator.GeneratorWrapper;
|
||||||
@ -12,7 +11,7 @@ import com.intellectualcrafters.plot.object.SetupObject;
|
|||||||
import com.intellectualcrafters.plot.util.SetupUtils;
|
import com.intellectualcrafters.plot.util.SetupUtils;
|
||||||
import com.plotsquared.nukkit.NukkitMain;
|
import com.plotsquared.nukkit.NukkitMain;
|
||||||
import com.plotsquared.nukkit.generator.NukkitPlotGenerator;
|
import com.plotsquared.nukkit.generator.NukkitPlotGenerator;
|
||||||
import java.io.File;
|
import com.plotsquared.nukkit.util.block.NukkitHybridGen;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@ -25,6 +24,7 @@ public class NukkitSetupUtils extends SetupUtils {
|
|||||||
|
|
||||||
public NukkitSetupUtils(NukkitMain plugin) {
|
public NukkitSetupUtils(NukkitMain plugin) {
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
|
Generator.addGenerator(NukkitHybridGen.class, "PlotSquared", 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -119,14 +119,16 @@ public class NukkitSetupUtils extends SetupUtils {
|
|||||||
HashMap<String, Object> map = new HashMap<>();
|
HashMap<String, Object> map = new HashMap<>();
|
||||||
map.put("world", object.world);
|
map.put("world", object.world);
|
||||||
map.put("plot-generator", PS.get().IMP.getDefaultGenerator());
|
map.put("plot-generator", PS.get().IMP.getDefaultGenerator());
|
||||||
if (!plugin.getServer().generateLevel(object.world, object.world.hashCode(), NukkitPlotGenerator.class, map)) {
|
if (!plugin.getServer().generateLevel(object.world, object.world.hashCode(), NukkitHybridGen.class, map)) {
|
||||||
plugin.getServer().loadLevel(object.world);
|
plugin.getServer().loadLevel(object.world);
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
File nukkitFile = new File("nukkit.yml");
|
// File nukkitFile = new File("nukkit.yml");
|
||||||
YamlConfiguration nukkitYml = YamlConfiguration.loadConfiguration(nukkitFile);
|
// YamlConfiguration nukkitYml = YamlConfiguration.loadConfiguration(nukkitFile);
|
||||||
nukkitYml.set("worlds." + object.world + ".generator", object.setupGenerator);
|
// if (!nukkitYml.contains("worlds." + object.world + ".generator")) {
|
||||||
nukkitYml.save(nukkitFile);
|
// nukkitYml.set("worlds." + object.world + ".generator", object.setupGenerator);
|
||||||
|
// nukkitYml.save(nukkitFile);
|
||||||
|
// }
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
@ -138,17 +140,6 @@ public class NukkitSetupUtils extends SetupUtils {
|
|||||||
return object.world;
|
return object.world;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setGenerator(String world, String generator) {
|
|
||||||
File file = new File("nukkit.yml").getAbsoluteFile();
|
|
||||||
YamlConfiguration yml = YamlConfiguration.loadConfiguration(file);
|
|
||||||
yml.set("worlds." + world + ".generator", generator);
|
|
||||||
try {
|
|
||||||
yml.save(file);
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getGenerator(PlotArea plotArea) {
|
public String getGenerator(PlotArea plotArea) {
|
||||||
if (SetupUtils.generators.isEmpty()) {
|
if (SetupUtils.generators.isEmpty()) {
|
||||||
|
@ -2,7 +2,6 @@ package com.plotsquared.nukkit.util.block;
|
|||||||
|
|
||||||
import cn.nukkit.level.Level;
|
import cn.nukkit.level.Level;
|
||||||
import com.intellectualcrafters.plot.PS;
|
import com.intellectualcrafters.plot.PS;
|
||||||
import com.intellectualcrafters.plot.generator.HybridGen;
|
|
||||||
import com.plotsquared.nukkit.NukkitMain;
|
import com.plotsquared.nukkit.NukkitMain;
|
||||||
import com.plotsquared.nukkit.generator.NukkitPlotGenerator;
|
import com.plotsquared.nukkit.generator.NukkitPlotGenerator;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
Loading…
Reference in New Issue
Block a user