Cleanup Code

I also updated the build.gradle and pom to 1.9 bukkit
This commit is contained in:
Matt 2016-02-29 20:13:18 -05:00
parent 5079361fbf
commit 9596544f97
14 changed files with 46 additions and 65 deletions

View File

@ -1,6 +1,6 @@
dependencies {
compile project(':Core')
compile 'org.bukkit:bukkit:1.8.8-R0.1-SNAPSHOT'
compile 'org.bukkit:bukkit:1.9-R0.1-SNAPSHOT'
compile 'net.milkbowl.vault:VaultAPI:1.5'
}

View File

@ -223,14 +223,14 @@ public class LikePlotMeConverter {
PS.get().config.set("worlds." + world + ".road.width", pathwidth);
Integer pathheight = PLOTME_DG_YML.getInt("worlds." + plotMeWorldName + ".RoadHeight"); //
if ((pathheight == null) || (pathheight == 0)) {
if (pathheight == 0) {
pathheight = 64;
}
PS.get().config.set("worlds." + world + ".road.height", pathheight);
PS.get().config.set("worlds." + world + ".wall.height", pathheight);
PS.get().config.set("worlds." + world + ".plot.height", pathheight);
Integer plotsize = PLOTME_DG_YML.getInt("worlds." + plotMeWorldName + ".PlotSize"); //
if ((plotsize == null) || (plotsize == 0)) {
if (plotsize == 0) {
plotsize = 32;
}
PS.get().config.set("worlds." + world + ".plot.size", plotsize);

View File

@ -157,7 +157,6 @@ public class ChunkListener implements Listener {
final int z = Z << 4;
final int x2 = x + 15;
final int z2 = z + 15;
Thread thread = new Thread();
Plot plot = new Location(world, x, 1, z).getOwnedPlotAbs();
if (plot != null && plot.hasOwner()) {
return false;

View File

@ -171,9 +171,6 @@ public class BukkitUtil extends WorldUtil {
public int getBiomeFromString(final String biomeStr) {
try {
final Biome biome = Biome.valueOf(biomeStr.toUpperCase());
if (biome == null) {
return -1;
}
return Arrays.asList(Biome.values()).indexOf(biome);
} catch (final IllegalArgumentException e) {
return -1;

View File

@ -246,7 +246,7 @@ public class ConfigurationSerialization {
final SerializableAs alias = clazz.getAnnotation(SerializableAs.class);
if ((alias != null) && (alias.value() != null)) {
if (alias != null) {
return alias.value();
}

View File

@ -92,7 +92,6 @@ public class Claim extends SubCommand {
return sendMessage(plr, C.NOT_IN_PLOT);
}
final int currentPlots = Settings.GLOBAL_LIMIT ? plr.getPlotCount() : plr.getPlotCount(loc.getWorld());
boolean removeGrantedPlot = false;
int grants = 0;
if (currentPlots >= plr.getAllowedPlots()) {
if (plr.hasPersistentMeta("grantedPlots")) {

View File

@ -65,10 +65,6 @@ public class Condense extends SubCommand {
MainUtil.sendMessage(plr, "TASK ALREADY STARTED");
return false;
}
if (args.length == 2) {
MainUtil.sendMessage(plr, "/plot condense " + area.toString() + " start <radius>");
return false;
}
if (!MathMan.isInteger(args[2])) {
MainUtil.sendMessage(plr, "INVALID RADIUS");
return false;

View File

@ -12,6 +12,7 @@ import com.plotsquared.general.commands.CommandDeclaration;
import java.io.File;
import java.io.IOException;
import java.util.Arrays;
@CommandDeclaration(
command = "debugpaste",
@ -41,7 +42,7 @@ public class DebugPaste extends SubCommand {
b.append("links.settings_yml: '").append(settingsYML).append("'\n");
b.append("links.latest_log: '").append(latestLOG).append("'\n");
b.append("\n# YAAAS! Now let us move on to the server info\n");
b.append("version.server: '").append(PS.get().IMP.getServerVersion()).append("'\n");
b.append("version.server: '").append(Arrays.toString(PS.get().IMP.getServerVersion())).append("'\n");
b.append("online_mode: ").append(UUIDHandler.getUUIDWrapper() + ";" + !Settings.OFFLINE_MODE).append("\n");
b.append("plugins:");
for (String id : PS.get().IMP.getPluginIds()) {

View File

@ -464,24 +464,18 @@ public class SQLManager implements AbstractDB {
final Plot plot = plotMap.get(plotId);
if (plot != null) {
settings.add(new SettingsPair(id, plot.getSettings()));
if (plot.getDenied() != null) {
for (final UUID uuid : plot.getDenied()) {
denied.add(new UUIDPair(id, uuid));
}
}
if (plot.getMembers() != null) {
for (final UUID uuid : plot.getMembers()) {
trusted.add(new UUIDPair(id, uuid));
}
}
if (plot.getTrusted() != null) {
for (final UUID uuid : plot.getTrusted()) {
helpers.add(new UUIDPair(id, uuid));
}
}
}
}
}
createSettings(settings, new Runnable() {
@Override
public void run() {

View File

@ -203,9 +203,6 @@ public class Location implements Cloneable, Comparable<Location> {
@Override
public int compareTo(final Location o) {
if (o == null) {
throw new NullPointerException("Specified object was null");
}
if (x == o.getX() && y == o.getY() || z == o.getZ()) {
return 0;
}

View File

@ -357,7 +357,7 @@ public class Plot {
*/
public HashSet<UUID> getOwners() {
if (owner == null) {
return new HashSet<UUID>();
return new HashSet<>();
}
if (isMerged()) {
HashSet<Plot> plots = getConnectedPlots();
@ -910,16 +910,15 @@ public class Plot {
});
return;
}
final String rename = name == null ? "unknown" : name;
final PlotManager manager = this.area.getPlotManager();
if (this.area.ALLOW_SIGNS) {
final Location loc = manager.getSignLoc(this.area, this);
final String id = this.id.x + ";" + this.id.y;
final String[] lines = new String[] {
C.OWNER_SIGN_LINE_1.formatted().replaceAll("%id%", id),
C.OWNER_SIGN_LINE_2.formatted().replaceAll("%id%", id).replaceAll("%plr%", rename),
C.OWNER_SIGN_LINE_3.formatted().replaceAll("%id%", id).replaceAll("%plr%", rename),
C.OWNER_SIGN_LINE_4.formatted().replaceAll("%id%", id).replaceAll("%plr%", rename) };
C.OWNER_SIGN_LINE_2.formatted().replaceAll("%id%", id).replaceAll("%plr%", name),
C.OWNER_SIGN_LINE_3.formatted().replaceAll("%id%", id).replaceAll("%plr%", name),
C.OWNER_SIGN_LINE_4.formatted().replaceAll("%id%", id).replaceAll("%plr%", name) };
WorldUtil.IMP.setSign(this.area.worldname, loc.getX(), loc.getY(), loc.getZ(), lines);
}
}
@ -1242,7 +1241,7 @@ public class Plot {
*/
public void setSign() {
if (this.owner == null) {
this.setSign(null);
this.setSign("unknown");
return;
}
this.setSign(UUIDHandler.getName(this.owner));

View File

@ -214,9 +214,7 @@ public class MainListener {
if (cap == 0) {
return false;
}
if (mobs == null) {
mobs = plot.countEntities();
}
if (mobs[3] >= cap) {
return false;
}
@ -260,9 +258,7 @@ public class MainListener {
if (cap == 0) {
return false;
}
if (mobs == null) {
mobs = plot.countEntities();
}
if (mobs[4] >= cap) {
return false;
}

View File

@ -9,7 +9,12 @@ import com.intellectualcrafters.plot.object.PlotBlock;
import com.intellectualcrafters.plot.object.PlotPlayer;
import com.intellectualcrafters.plot.object.RegionWrapper;
import com.intellectualcrafters.plot.object.schematic.PlotItem;
import com.intellectualcrafters.plot.util.*;
import com.intellectualcrafters.plot.util.MathMan;
import com.intellectualcrafters.plot.util.ReflectionUtils;
import com.intellectualcrafters.plot.util.StringComparison;
import com.intellectualcrafters.plot.util.StringMan;
import com.intellectualcrafters.plot.util.UUIDHandler;
import com.intellectualcrafters.plot.util.WorldUtil;
import com.plotsquared.sponge.SpongeMain;
import com.plotsquared.sponge.object.SpongePlayer;
import net.minecraft.block.Block;
@ -29,7 +34,6 @@ import org.spongepowered.api.entity.living.player.Player;
import org.spongepowered.api.event.cause.Cause;
import org.spongepowered.api.text.Text;
import org.spongepowered.api.text.serializer.TextSerializers;
import org.spongepowered.api.text.translation.Translatable;
import org.spongepowered.api.text.translation.Translation;
import org.spongepowered.api.world.World;
import org.spongepowered.api.world.biome.BiomeType;
@ -38,7 +42,11 @@ import org.spongepowered.api.world.extent.Extent;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Optional;
public class SpongeUtil extends WorldUtil {
@ -103,9 +111,6 @@ public class SpongeUtil extends WorldUtil {
}
public static Translation getTranslation(final String m) {
return new Translatable() {
@Override
public Translation getTranslation() {
return new Translation() {
@Override
@ -124,8 +129,6 @@ public class SpongeUtil extends WorldUtil {
}
};
}
}.getTranslation();
}
private static HashMap<BlockState, PlotBlock> stateMap;
private static BlockState[] stateArray;

View File

@ -77,7 +77,7 @@
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>bukkit</artifactId>
<version>1.8.8-R0.1-SNAPSHOT</version>
<version>1.9-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.sk89q</groupId>