Fixes unlink failing if a parameter is provided
Fix plot unlinking not resetting the road biome
Fixes #888
This commit is contained in:
Jesse Boyd 2016-02-27 16:05:21 +11:00
parent c7870b617c
commit f68042bc11
10 changed files with 50 additions and 59 deletions

View File

@ -18,14 +18,14 @@ processResources {
} }
apply plugin: 'com.github.johnrengelman.shadow' apply plugin: 'com.github.johnrengelman.shadow'
// We only want the shadow jar produced
jar.enabled = false
shadowJar { shadowJar {
dependencies { dependencies {
include(dependency(':Core')) include(dependency(':Core'))
} }
archiveName = "${parent.name}-${project.name}-${parent.version}.jar" archiveName = "${parent.name}-${project.name}-${parent.version}.jar"
} }
shadowJar.doLast { shadowJar.doLast {
task -> task ->
ant.checksum file: task.archivePath ant.checksum file: task.archivePath

View File

@ -1,3 +1,4 @@
dependencies { dependencies {
compile 'org.yaml:snakeyaml:1.16' compile 'org.yaml:snakeyaml:1.16'
} }
jar.archiveName="PlotSquared-API-${parent.version}.jar"

View File

@ -1352,9 +1352,7 @@ public class PS {
* @param baseGenerator The generator for that world, or null if no generator * @param baseGenerator The generator for that world, or null if no generator
*/ */
public void loadWorld(final String world, final GeneratorWrapper<?> baseGenerator) { public void loadWorld(final String world, final GeneratorWrapper<?> baseGenerator) {
System.out.println("LOADING WORLD!? " + world);
if (world.equals("CheckingPlotSquaredGenerator")) { if (world.equals("CheckingPlotSquaredGenerator")) {
System.out.println("IS CHECK" + world);
return; 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>());
@ -1383,13 +1381,11 @@ public class PS {
pg = primaryGenerator.getPlotGenerator(); pg = primaryGenerator.getPlotGenerator();
} }
else { else {
System.out.println("NO GENERATOR?! " + world);
return; return;
} }
} }
} }
else { else {
System.out.println("NO WORLD SECTION?! " + world);
return; return;
} }
// Conventional plot generator // Conventional plot generator
@ -1415,9 +1411,7 @@ public class PS {
pg.initialize(plotArea); pg.initialize(plotArea);
plotArea.setupBorder(); plotArea.setupBorder();
} else { } else {
System.out.println("NOT TYPE 0 " + world);
if (!worlds.contains(world)) { if (!worlds.contains(world)) {
System.out.println("WORLD DOESN'T EXIST " + world);
return; return;
} }
ConfigurationSection areasSection = worldSection.getConfigurationSection("areas"); ConfigurationSection areasSection = worldSection.getConfigurationSection("areas");
@ -1469,7 +1463,6 @@ public class PS {
for (PlotArea area : toLoad) { for (PlotArea area : toLoad) {
addPlotArea(area); addPlotArea(area);
} }
System.out.println("ADDED BY CLUSTER! " + world);
return; return;
} }
GeneratorWrapper<?> areaGen = IMP.getGenerator(world, gen_string); GeneratorWrapper<?> areaGen = IMP.getGenerator(world, gen_string);
@ -1490,7 +1483,6 @@ public class PS {
areaGen.getPlotGenerator().initialize(pa); areaGen.getPlotGenerator().initialize(pa);
areaGen.augment(pa); areaGen.augment(pa);
addPlotArea(pa); addPlotArea(pa);
System.out.println("ADDED BY AUG! " + world);
return; return;
} }
if (type == 1) { if (type == 1) {
@ -1566,7 +1558,6 @@ public class PS {
areaGen.getPlotGenerator().initialize(pa); areaGen.getPlotGenerator().initialize(pa);
areaGen.augment(pa); areaGen.augment(pa);
addPlotArea(pa); addPlotArea(pa);
System.out.println("ADDED BY PART! " + world);
} }
} }
} }

View File

@ -54,7 +54,7 @@ public class Unlink extends SubCommand {
} }
final boolean createRoad; final boolean createRoad;
if (args.length != 0) { if (args.length != 0) {
if (args.length != 1 || StringMan.isEqualIgnoreCaseToAny(args[1], "true", "false")) { if (args.length != 1 || StringMan.isEqualIgnoreCaseToAny(args[0], "true", "false")) {
C.COMMAND_SYNTAX.send(plr, getUsage()); C.COMMAND_SYNTAX.send(plr, getUsage());
return false; return false;
} }

View File

@ -30,11 +30,7 @@ import com.intellectualcrafters.plot.object.PlotArea;
import com.intellectualcrafters.plot.object.PlotBlock; import com.intellectualcrafters.plot.object.PlotBlock;
import com.intellectualcrafters.plot.object.PlotId; import com.intellectualcrafters.plot.object.PlotId;
import com.intellectualcrafters.plot.object.RunnableVal; import com.intellectualcrafters.plot.object.RunnableVal;
import com.intellectualcrafters.plot.util.ChunkManager; import com.intellectualcrafters.plot.util.*;
import com.intellectualcrafters.plot.util.MainUtil;
import com.intellectualcrafters.plot.util.MathMan;
import com.intellectualcrafters.plot.util.SetQueue;
import com.intellectualcrafters.plot.util.WorldUtil;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
@ -76,20 +72,21 @@ public class HybridPlotManager extends ClassicPlotManager {
public boolean createRoadEast(final PlotArea plotworld, final Plot plot) { public boolean createRoadEast(final PlotArea plotworld, final Plot plot) {
super.createRoadEast(plotworld, plot); super.createRoadEast(plotworld, plot);
final HybridPlotWorld hpw = (HybridPlotWorld) plotworld; final HybridPlotWorld hpw = (HybridPlotWorld) plotworld;
if (!hpw.ROAD_SCHEMATIC_ENABLED) {
return true;
}
final PlotId id = plot.getId(); final PlotId id = plot.getId();
final PlotId id2 = new PlotId(id.x + 1, id.y); final PlotId id2 = new PlotId(id.x + 1, id.y);
final Location bot = getPlotBottomLocAbs(hpw, id2); final Location bot = getPlotBottomLocAbs(hpw, id2);
final Location top = getPlotTopLocAbs(hpw, id); final Location top = getPlotTopLocAbs(hpw, id);
final Location pos1 = new Location(plotworld.worldname, top.getX() + 1, 0, bot.getZ() - 1); final Location pos1 = new Location(plotworld.worldname, top.getX() + 1, 0, bot.getZ() - 1);
final Location pos2 = new Location(plotworld.worldname, bot.getX(), 255, top.getZ() + 1); final Location pos2 = new Location(plotworld.worldname, bot.getX(), 255, top.getZ() + 1);
MainUtil.resetBiome(plotworld, pos1, pos2);
if (!hpw.ROAD_SCHEMATIC_ENABLED) {
return true;
}
createSchemAbs(hpw, pos1, pos2, 0, true); createSchemAbs(hpw, pos1, pos2, 0, true);
return true; return true;
} }
public void createSchemAbs(final HybridPlotWorld hpw, final Location pos1, final Location pos2, final int height, final boolean clear) { private void createSchemAbs(final HybridPlotWorld hpw, final Location pos1, final Location pos2, final int height, final boolean clear) {
final int size = hpw.SIZE; final int size = hpw.SIZE;
for (int x = pos1.getX(); x <= pos2.getX(); x++) { for (int x = pos1.getX(); x <= pos2.getX(); x++) {
short absX = (short) ((x - hpw.ROAD_OFFSET_X) % (size)); short absX = (short) ((x - hpw.ROAD_OFFSET_X) % (size));
@ -120,15 +117,16 @@ public class HybridPlotManager extends ClassicPlotManager {
public boolean createRoadSouth(final PlotArea plotworld, final Plot plot) { public boolean createRoadSouth(final PlotArea plotworld, final Plot plot) {
super.createRoadSouth(plotworld, plot); super.createRoadSouth(plotworld, plot);
final HybridPlotWorld hpw = (HybridPlotWorld) plotworld; final HybridPlotWorld hpw = (HybridPlotWorld) plotworld;
if (!hpw.ROAD_SCHEMATIC_ENABLED) {
return true;
}
final PlotId id = plot.getId(); final PlotId id = plot.getId();
final PlotId id2 = new PlotId(id.x, id.y + 1); final PlotId id2 = new PlotId(id.x, id.y + 1);
final Location bot = getPlotBottomLocAbs(hpw, id2); final Location bot = getPlotBottomLocAbs(hpw, id2);
final Location top = getPlotTopLocAbs(hpw, id); final Location top = getPlotTopLocAbs(hpw, id);
final Location pos1 = new Location(plotworld.worldname, bot.getX() - 1, 0, top.getZ() + 1); final Location pos1 = new Location(plotworld.worldname, bot.getX() - 1, 0, top.getZ() + 1);
final Location pos2 = new Location(plotworld.worldname, top.getX() + 1, 255, bot.getZ()); final Location pos2 = new Location(plotworld.worldname, top.getX() + 1, 255, bot.getZ());
MainUtil.resetBiome(plotworld, pos1, pos2);
if (!hpw.ROAD_SCHEMATIC_ENABLED) {
return true;
}
createSchemAbs(hpw, pos1, pos2, 0, true); createSchemAbs(hpw, pos1, pos2, 0, true);
return true; return true;
} }
@ -137,9 +135,6 @@ public class HybridPlotManager extends ClassicPlotManager {
public boolean createRoadSouthEast(final PlotArea plotworld, final Plot plot) { public boolean createRoadSouthEast(final PlotArea plotworld, final Plot plot) {
super.createRoadSouthEast(plotworld, plot); super.createRoadSouthEast(plotworld, plot);
final HybridPlotWorld hpw = (HybridPlotWorld) plotworld; final HybridPlotWorld hpw = (HybridPlotWorld) plotworld;
if (!hpw.ROAD_SCHEMATIC_ENABLED) {
return true;
}
final PlotId id = plot.getId(); final PlotId id = plot.getId();
final PlotId id2 = new PlotId(id.x + 1, id.y + 1); final PlotId id2 = new PlotId(id.x + 1, id.y + 1);
final Location pos1 = getPlotTopLocAbs(hpw, id).add(1, 0, 1); final Location pos1 = getPlotTopLocAbs(hpw, id).add(1, 0, 1);
@ -147,6 +142,10 @@ public class HybridPlotManager extends ClassicPlotManager {
pos1.setY(0); pos1.setY(0);
pos2.setY(256); pos2.setY(256);
createSchemAbs(hpw, pos1, pos2, 0, true); createSchemAbs(hpw, pos1, pos2, 0, true);
if (!hpw.ROAD_SCHEMATIC_ENABLED) {
return true;
}
createSchemAbs(hpw, pos1, pos2, 0, true);
return true; return true;
} }

View File

@ -1056,9 +1056,12 @@ public class Plot {
} }
public Location getCenter() { public Location getCenter() {
final Location top = this.getTop(); Location[] corners = getCorners();
final Location bot = this.getBottom(); final Location top = corners[0];
return new Location(this.area.worldname, (top.getX() + bot.getX()) / 2, (top.getY() + bot.getY()) / 2, (top.getZ() + bot.getZ()) / 2); final Location bot = corners[1];
Location loc = new Location(this.area.worldname, (top.getX() + bot.getX()) / 2, (top.getY() + bot.getY()) / 2, (top.getZ() + bot.getZ()) / 2);
loc.setY(WorldUtil.IMP.getHighestBlock(top.getWorld(), loc.getX(), loc.getY()));
return loc;
} }
/** /**
@ -1510,7 +1513,7 @@ public class Plot {
*/ */
@Deprecated @Deprecated
public Location getTop() { public Location getTop() {
return this.getCorners()[0]; return this.getCorners()[1];
} }
/** /**

View File

@ -20,33 +20,17 @@
//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.util; package com.intellectualcrafters.plot.util;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.UUID;
import java.util.regex.Matcher;
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.config.Settings; import com.intellectualcrafters.plot.config.Settings;
import com.intellectualcrafters.plot.database.DBFunc; import com.intellectualcrafters.plot.database.DBFunc;
import com.intellectualcrafters.plot.flag.Flag; import com.intellectualcrafters.plot.flag.Flag;
import com.intellectualcrafters.plot.flag.FlagManager; import com.intellectualcrafters.plot.flag.FlagManager;
import com.intellectualcrafters.plot.object.ChunkLoc; import com.intellectualcrafters.plot.object.*;
import com.intellectualcrafters.plot.object.ConsolePlayer;
import com.intellectualcrafters.plot.object.Location; import java.util.*;
import com.intellectualcrafters.plot.object.Plot; import java.util.Map.Entry;
import com.intellectualcrafters.plot.object.PlotArea; import java.util.regex.Matcher;
import com.intellectualcrafters.plot.object.PlotBlock;
import com.intellectualcrafters.plot.object.PlotId;
import com.intellectualcrafters.plot.object.PlotPlayer;
import com.intellectualcrafters.plot.object.PseudoRandom;
import com.intellectualcrafters.plot.object.RegionWrapper;
import com.intellectualcrafters.plot.object.RunnableVal;
/** /**
* plot functions * plot functions
@ -120,6 +104,22 @@ public class MainUtil {
} }
} }
/**
* Resets the biome if it was modified
* @param area
* @param pos1
* @param pos2
* @return true if any changes were made
*/
public static boolean resetBiome(PlotArea area, Location pos1, Location pos2) {
String biome = WorldUtil.IMP.getBiomeList()[area.PLOT_BIOME];
if (!StringMan.isEqual(WorldUtil.IMP.getBiome(area.worldname, (pos1.getX() + pos2.getX()) / 2, (pos1.getZ() + pos2.getZ()) / 2), biome)) {
MainUtil.setBiome(area.worldname, pos1.getX(), pos1.getZ(), pos2.getX(), pos2.getZ(), biome);
return true;
}
return false;
}
/** /**
* Hashcode of a boolean array.<br> * Hashcode of a boolean array.<br>
* - Used for traversing mega plots quickly. * - Used for traversing mega plots quickly.

View File

@ -51,7 +51,6 @@ import java.util.UUID;
public class PlotListener { public class PlotListener {
public static boolean plotEntry(final PlotPlayer pp, final Plot plot) { public static boolean plotEntry(final PlotPlayer pp, final Plot plot) {
System.out.println("POLOT ENTRY");
if (plot.isDenied(pp.getUUID()) && !Permissions.hasPermission(pp, "plots.admin.entry.denied")) { if (plot.isDenied(pp.getUUID()) && !Permissions.hasPermission(pp, "plots.admin.entry.denied")) {
return false; return false;
} }

View File

@ -46,14 +46,14 @@ processResources {
'mcVersion': project.minecraft.version 'mcVersion': project.minecraft.version
} }
} }
// We only want the shadow jar produced
jar.enabled = false
shadowJar { shadowJar {
dependencies { dependencies {
include(dependency(':Core')) include(dependency(':Core'))
} }
archiveName = "${parent.name}-${project.name}-${parent.version}.jar" archiveName = "${parent.name}-${project.name}-${parent.version}.jar"
} }
shadowJar.doLast { shadowJar.doLast {
task -> task ->
ant.checksum file: task.archivePath ant.checksum file: task.archivePath

View File

@ -19,8 +19,6 @@ subprojects {
apply plugin: 'eclipse' apply plugin: 'eclipse'
apply plugin: 'idea' apply plugin: 'idea'
jar.enabled = false;
dependencies { dependencies {
compile(group: 'com.sk89q', name: 'worldedit', version:'6.0.0-SNAPSHOT') { compile(group: 'com.sk89q', name: 'worldedit', version:'6.0.0-SNAPSHOT') {
exclude(module: 'bukkit-classloader-check') exclude(module: 'bukkit-classloader-check')