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'
// We only want the shadow jar produced
jar.enabled = false
shadowJar {
dependencies {
include(dependency(':Core'))
}
archiveName = "${parent.name}-${project.name}-${parent.version}.jar"
}
shadowJar.doLast {
task ->
ant.checksum file: task.archivePath

View file

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

View file

@ -54,7 +54,7 @@ public class Unlink extends SubCommand {
}
final boolean createRoad;
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());
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.PlotId;
import com.intellectualcrafters.plot.object.RunnableVal;
import com.intellectualcrafters.plot.util.ChunkManager;
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 com.intellectualcrafters.plot.util.*;
import java.io.File;
import java.io.IOException;
@ -76,20 +72,21 @@ public class HybridPlotManager extends ClassicPlotManager {
public boolean createRoadEast(final PlotArea plotworld, final Plot plot) {
super.createRoadEast(plotworld, plot);
final HybridPlotWorld hpw = (HybridPlotWorld) plotworld;
if (!hpw.ROAD_SCHEMATIC_ENABLED) {
return true;
}
final PlotId id = plot.getId();
final PlotId id2 = new PlotId(id.x + 1, id.y);
final Location bot = getPlotBottomLocAbs(hpw, id2);
final Location top = getPlotTopLocAbs(hpw, id);
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);
MainUtil.resetBiome(plotworld, pos1, pos2);
if (!hpw.ROAD_SCHEMATIC_ENABLED) {
return true;
}
createSchemAbs(hpw, pos1, pos2, 0, 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;
for (int x = pos1.getX(); x <= pos2.getX(); x++) {
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) {
super.createRoadSouth(plotworld, plot);
final HybridPlotWorld hpw = (HybridPlotWorld) plotworld;
if (!hpw.ROAD_SCHEMATIC_ENABLED) {
return true;
}
final PlotId id = plot.getId();
final PlotId id2 = new PlotId(id.x, id.y + 1);
final Location bot = getPlotBottomLocAbs(hpw, id2);
final Location top = getPlotTopLocAbs(hpw, id);
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());
MainUtil.resetBiome(plotworld, pos1, pos2);
if (!hpw.ROAD_SCHEMATIC_ENABLED) {
return true;
}
createSchemAbs(hpw, pos1, pos2, 0, true);
return true;
}
@ -137,9 +135,6 @@ public class HybridPlotManager extends ClassicPlotManager {
public boolean createRoadSouthEast(final PlotArea plotworld, final Plot plot) {
super.createRoadSouthEast(plotworld, plot);
final HybridPlotWorld hpw = (HybridPlotWorld) plotworld;
if (!hpw.ROAD_SCHEMATIC_ENABLED) {
return true;
}
final PlotId id = plot.getId();
final PlotId id2 = new PlotId(id.x + 1, id.y + 1);
final Location pos1 = getPlotTopLocAbs(hpw, id).add(1, 0, 1);
@ -147,6 +142,10 @@ public class HybridPlotManager extends ClassicPlotManager {
pos1.setY(0);
pos2.setY(256);
createSchemAbs(hpw, pos1, pos2, 0, true);
if (!hpw.ROAD_SCHEMATIC_ENABLED) {
return true;
}
createSchemAbs(hpw, pos1, pos2, 0, true);
return true;
}

View file

@ -1056,9 +1056,12 @@ public class Plot {
}
public Location getCenter() {
final Location top = this.getTop();
final Location bot = this.getBottom();
return new Location(this.area.worldname, (top.getX() + bot.getX()) / 2, (top.getY() + bot.getY()) / 2, (top.getZ() + bot.getZ()) / 2);
Location[] corners = getCorners();
final Location top = corners[0];
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
public Location getTop() {
return this.getCorners()[0];
return this.getCorners()[1];
}
/**

View file

@ -20,33 +20,17 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
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.config.C;
import com.intellectualcrafters.plot.config.Settings;
import com.intellectualcrafters.plot.database.DBFunc;
import com.intellectualcrafters.plot.flag.Flag;
import com.intellectualcrafters.plot.flag.FlagManager;
import com.intellectualcrafters.plot.object.ChunkLoc;
import com.intellectualcrafters.plot.object.ConsolePlayer;
import com.intellectualcrafters.plot.object.Location;
import com.intellectualcrafters.plot.object.Plot;
import com.intellectualcrafters.plot.object.PlotArea;
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;
import com.intellectualcrafters.plot.object.*;
import java.util.*;
import java.util.Map.Entry;
import java.util.regex.Matcher;
/**
* 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>
* - Used for traversing mega plots quickly.

View file

@ -51,7 +51,6 @@ import java.util.UUID;
public class PlotListener {
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")) {
return false;
}

View file

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

View file

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