Fixed road issue

This commit is contained in:
boy0001 2014-12-07 01:19:35 +11:00
parent eeb2e90042
commit 7c35150e12
6 changed files with 56 additions and 16 deletions

View File

@ -6,7 +6,7 @@
<groupId>com.intellectualcrafters</groupId> <groupId>com.intellectualcrafters</groupId>
<artifactId>PlotSquared</artifactId> <artifactId>PlotSquared</artifactId>
<version>2.3.6</version> <version>2.3.7</version>
<name>PlotSquared</name> <name>PlotSquared</name>
<packaging>jar</packaging> <packaging>jar</packaging>
<build> <build>

View File

@ -662,13 +662,13 @@ public class DefaultPlotManager extends PlotManager {
PlotHelper.setSimpleCuboid(w, new Location(w, sx, Math.min(dpw.WALL_HEIGHT, dpw.ROAD_HEIGHT) + 1, sz + 1), new Location(w, ex + 1, 257 + 1, ez), new PlotBlock((short) 0, (byte) 0)); PlotHelper.setSimpleCuboid(w, new Location(w, sx, Math.min(dpw.WALL_HEIGHT, dpw.ROAD_HEIGHT) + 1, sz + 1), new Location(w, ex + 1, 257 + 1, ez), new PlotBlock((short) 0, (byte) 0));
PlotHelper.setSimpleCuboid(w, new Location(w, sx, 1, sz + 1), new Location(w, sx + 1, dpw.WALL_HEIGHT + 1, ez), dpw.WALL_FILLING); PlotHelper.setCuboid(w, new Location(w, sx, 1, sz + 1), new Location(w, sx + 1, dpw.WALL_HEIGHT + 1, ez), dpw.WALL_FILLING);
PlotHelper.setSimpleCuboid(w, new Location(w, sx, dpw.WALL_HEIGHT + 1, sz + 1), new Location(w, sx + 1, dpw.WALL_HEIGHT + 2, ez), dpw.WALL_BLOCK); PlotHelper.setCuboid(w, new Location(w, sx, dpw.WALL_HEIGHT + 1, sz + 1), new Location(w, sx + 1, dpw.WALL_HEIGHT + 2, ez), dpw.WALL_BLOCK);
PlotHelper.setSimpleCuboid(w, new Location(w, ex, 1, sz + 1), new Location(w, ex + 1, dpw.WALL_HEIGHT + 1, ez), dpw.WALL_FILLING); PlotHelper.setCuboid(w, new Location(w, ex, 1, sz + 1), new Location(w, ex + 1, dpw.WALL_HEIGHT + 1, ez), dpw.WALL_FILLING);
PlotHelper.setSimpleCuboid(w, new Location(w, ex, dpw.WALL_HEIGHT + 1, sz + 1), new Location(w, ex + 1, dpw.WALL_HEIGHT + 2, ez), dpw.WALL_BLOCK); PlotHelper.setCuboid(w, new Location(w, ex, dpw.WALL_HEIGHT + 1, sz + 1), new Location(w, ex + 1, dpw.WALL_HEIGHT + 2, ez), dpw.WALL_BLOCK);
PlotHelper.setSimpleCuboid(w, new Location(w, sx + 1, 1, sz + 1), new Location(w, ex, dpw.ROAD_HEIGHT + 1, ez), dpw.ROAD_BLOCK); PlotHelper.setCuboid(w, new Location(w, sx + 1, 1, sz + 1), new Location(w, ex, dpw.ROAD_HEIGHT + 1, ez), dpw.ROAD_BLOCK);
return true; return true;
} }
@ -688,13 +688,13 @@ public class DefaultPlotManager extends PlotManager {
PlotHelper.setSimpleCuboid(w, new Location(w, sx, Math.min(dpw.WALL_HEIGHT, dpw.ROAD_HEIGHT) + 1, sz + 1), new Location(w, ex + 1, 257, ez), new PlotBlock((short) 0, (byte) 0)); PlotHelper.setSimpleCuboid(w, new Location(w, sx, Math.min(dpw.WALL_HEIGHT, dpw.ROAD_HEIGHT) + 1, sz + 1), new Location(w, ex + 1, 257, ez), new PlotBlock((short) 0, (byte) 0));
PlotHelper.setSimpleCuboid(w, new Location(w, sx + 1, 1, sz), new Location(w, ex, dpw.WALL_HEIGHT + 1, sz + 1), dpw.WALL_FILLING); PlotHelper.setCuboid(w, new Location(w, sx + 1, 1, sz), new Location(w, ex, dpw.WALL_HEIGHT + 1, sz + 1), dpw.WALL_FILLING);
PlotHelper.setSimpleCuboid(w, new Location(w, sx + 1, dpw.WALL_HEIGHT + 1, sz), new Location(w, ex, dpw.WALL_HEIGHT + 2, sz + 1), dpw.WALL_BLOCK); PlotHelper.setCuboid(w, new Location(w, sx + 1, dpw.WALL_HEIGHT + 1, sz), new Location(w, ex, dpw.WALL_HEIGHT + 2, sz + 1), dpw.WALL_BLOCK);
PlotHelper.setSimpleCuboid(w, new Location(w, sx + 1, 1, ez), new Location(w, ex, dpw.WALL_HEIGHT + 1, ez + 1), dpw.WALL_FILLING); PlotHelper.setCuboid(w, new Location(w, sx + 1, 1, ez), new Location(w, ex, dpw.WALL_HEIGHT + 1, ez + 1), dpw.WALL_FILLING);
PlotHelper.setSimpleCuboid(w, new Location(w, sx + 1, dpw.WALL_HEIGHT + 1, ez), new Location(w, ex, dpw.WALL_HEIGHT + 2, ez + 1), dpw.WALL_BLOCK); PlotHelper.setCuboid(w, new Location(w, sx + 1, dpw.WALL_HEIGHT + 1, ez), new Location(w, ex, dpw.WALL_HEIGHT + 2, ez + 1), dpw.WALL_BLOCK);
PlotHelper.setSimpleCuboid(w, new Location(w, sx + 1, 1, sz + 1), new Location(w, ex, dpw.ROAD_HEIGHT + 1, ez), dpw.ROAD_BLOCK); PlotHelper.setCuboid(w, new Location(w, sx + 1, 1, sz + 1), new Location(w, ex, dpw.ROAD_HEIGHT + 1, ez), dpw.ROAD_BLOCK);
return true; return true;
} }
@ -712,7 +712,7 @@ public class DefaultPlotManager extends PlotManager {
final int ez = (sz + dpw.ROAD_WIDTH) - 1; final int ez = (sz + dpw.ROAD_WIDTH) - 1;
PlotHelper.setSimpleCuboid(w, new Location(w, sx, dpw.ROAD_HEIGHT + 1, sz + 1), new Location(w, ex + 1, 257, ez), new PlotBlock((short) 0, (byte) 0)); PlotHelper.setSimpleCuboid(w, new Location(w, sx, dpw.ROAD_HEIGHT + 1, sz + 1), new Location(w, ex + 1, 257, ez), new PlotBlock((short) 0, (byte) 0));
PlotHelper.setSimpleCuboid(w, new Location(w, sx + 1, 1, sz + 1), new Location(w, ex, dpw.ROAD_HEIGHT + 1, ez), dpw.ROAD_BLOCK); PlotHelper.setCuboid(w, new Location(w, sx + 1, 1, sz + 1), new Location(w, ex, dpw.ROAD_HEIGHT + 1, ez), dpw.ROAD_BLOCK);
return true; return true;
} }

View File

@ -23,11 +23,13 @@ package com.intellectualcrafters.plot.object;
import com.intellectualcrafters.plot.config.Configuration; import com.intellectualcrafters.plot.config.Configuration;
import com.intellectualcrafters.plot.config.ConfigurationNode; import com.intellectualcrafters.plot.config.ConfigurationNode;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.block.Biome; import org.bukkit.block.Biome;
import org.bukkit.configuration.ConfigurationSection; import org.bukkit.configuration.ConfigurationSection;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
@ -44,7 +46,7 @@ public abstract class PlotWorld {
public final static boolean SCHEMATIC_ON_CLAIM_DEFAULT = false; public final static boolean SCHEMATIC_ON_CLAIM_DEFAULT = false;
public final static String SCHEMATIC_FILE_DEFAULT = "null"; public final static String SCHEMATIC_FILE_DEFAULT = "null";
public final static List<String> SCHEMATICS_DEFAULT = null; public final static List<String> SCHEMATICS_DEFAULT = null;
public final static List<String> DEFAULT_FLAGS_DEFAULT = new ArrayList<>(); public final static List<String> DEFAULT_FLAGS_DEFAULT = Arrays.asList();
public final static boolean USE_ECONOMY_DEFAULT = false; public final static boolean USE_ECONOMY_DEFAULT = false;
public final static double PLOT_PRICE_DEFAULT = 100; public final static double PLOT_PRICE_DEFAULT = 100;
public final static double MERGE_PRICE_DEFAULT = 100; public final static double MERGE_PRICE_DEFAULT = 100;
@ -193,7 +195,6 @@ public abstract class PlotWorld {
options.put("event.spawn.custom", PlotWorld.SPAWN_CUSTOM_DEFAULT); options.put("event.spawn.custom", PlotWorld.SPAWN_CUSTOM_DEFAULT);
options.put("event.spawn.breeding", PlotWorld.SPAWN_BREEDING_DEFAULT); options.put("event.spawn.breeding", PlotWorld.SPAWN_BREEDING_DEFAULT);
final ConfigurationNode[] settings = getSettingNodes(); final ConfigurationNode[] settings = getSettingNodes();
/* /*
* Saving generator specific settings * Saving generator specific settings
*/ */

View File

@ -74,6 +74,9 @@ public class StringWrapper {
*/ */
@Override @Override
public int hashCode() { public int hashCode() {
if (this.value == null) {
return 0;
}
return this.value.toLowerCase().hashCode(); return this.value.toLowerCase().hashCode();
} }
} }

View File

@ -249,7 +249,7 @@ public class PlotHelper {
} }
public static void setSign(final Player player, final Plot p) { public static void setSign(final Player player, final Plot p) {
setSign(player.getWorld(), player.getName(), p); setSign(Bukkit.getWorld(p.world), player.getName(), p);
} }
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
@ -737,7 +737,41 @@ public class PlotHelper {
} }
public static void setCuboid(final World world, final Location pos1, final Location pos2, final PlotBlock newblock) {
if (!canSetFast) {
for (int y = pos1.getBlockY(); y < pos2.getBlockY(); y++) {
for (int x = pos1.getBlockX(); x < pos2.getBlockX(); x++) {
for (int z = pos1.getBlockZ(); z < pos2.getBlockZ(); z++) {
final Block block = world.getBlockAt(x, y, z);
if (!((block.getTypeId() == newblock.id) && (block.getData() == newblock.data))) {
block.setTypeIdAndData(newblock.id, newblock.data, false);
}
}
}
}
} else {
try {
for (int y = pos1.getBlockY(); y < pos2.getBlockY(); y++) {
for (int x = pos1.getBlockX(); x < pos2.getBlockX(); x++) {
for (int z = pos1.getBlockZ(); z < pos2.getBlockZ(); z++) {
final Block block = world.getBlockAt(x, y, z);
if (!((block.getTypeId() == newblock.id) && (block.getData() == newblock.data))) {
SetBlockFast.set(world, x, y, z, newblock.id, newblock.data);
}
}
}
}
} catch (final Exception e) {
//
}
}
}
public static void setCuboid(final World world, final Location pos1, final Location pos2, final PlotBlock[] blocks) { public static void setCuboid(final World world, final Location pos1, final Location pos2, final PlotBlock[] blocks) {
if (blocks.length == 1) {
setCuboid(world, pos1, pos2, blocks[0]);
return;
}
if (!canSetFast) { if (!canSetFast) {
for (int y = pos1.getBlockY(); y < pos2.getBlockY(); y++) { for (int y = pos1.getBlockY(); y < pos2.getBlockY(); y++) {
for (int x = pos1.getBlockX(); x < pos2.getBlockX(); x++) { for (int x = pos1.getBlockX(); x < pos2.getBlockX(); x++) {

View File

@ -59,7 +59,9 @@ public class PlotUUIDSaver implements UUIDSaver {
uuid = player.getUniqueId(); uuid = player.getUniqueId();
if (!UUIDHandler.uuidExists(uuid)) { if (!UUIDHandler.uuidExists(uuid)) {
name = player.getName(); name = player.getName();
UUIDHandler.add(new StringWrapper(name), uuid); if (name != null) {
UUIDHandler.add(new StringWrapper(name), uuid);
}
} }
} }