mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-04 09:10:17 +01:00
Cleanup Code
I also updated the build.gradle and pom to 1.9 bukkit
This commit is contained in:
parent
5079361fbf
commit
9596544f97
@ -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'
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
|
@ -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")) {
|
||||
|
@ -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;
|
||||
|
@ -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()) {
|
||||
|
@ -464,20 +464,14 @@ 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));
|
||||
}
|
||||
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));
|
||||
}
|
||||
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));
|
||||
}
|
||||
for (final UUID uuid : plot.getTrusted()) {
|
||||
helpers.add(new UUIDPair(id, uuid));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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));
|
||||
|
@ -214,9 +214,7 @@ public class MainListener {
|
||||
if (cap == 0) {
|
||||
return false;
|
||||
}
|
||||
if (mobs == null) {
|
||||
mobs = plot.countEntities();
|
||||
}
|
||||
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();
|
||||
}
|
||||
mobs = plot.countEntities();
|
||||
if (mobs[4] >= cap) {
|
||||
return false;
|
||||
}
|
||||
|
@ -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,28 +111,23 @@ public class SpongeUtil extends WorldUtil {
|
||||
}
|
||||
|
||||
public static Translation getTranslation(final String m) {
|
||||
return new Translatable() {
|
||||
return new Translation() {
|
||||
|
||||
@Override
|
||||
public Translation getTranslation() {
|
||||
return new Translation() {
|
||||
|
||||
@Override
|
||||
public String getId() {
|
||||
return m;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String get(final Locale l, final Object... args) {
|
||||
return m;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String get(final Locale l) {
|
||||
return m;
|
||||
}
|
||||
};
|
||||
public String getId() {
|
||||
return m;
|
||||
}
|
||||
}.getTranslation();
|
||||
|
||||
@Override
|
||||
public String get(final Locale l, final Object... args) {
|
||||
return m;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String get(final Locale l) {
|
||||
return m;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private static HashMap<BlockState, PlotBlock> stateMap;
|
||||
|
Loading…
Reference in New Issue
Block a user