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 {
|
dependencies {
|
||||||
compile project(':Core')
|
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'
|
compile 'net.milkbowl.vault:VaultAPI:1.5'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -223,14 +223,14 @@ public class LikePlotMeConverter {
|
|||||||
PS.get().config.set("worlds." + world + ".road.width", pathwidth);
|
PS.get().config.set("worlds." + world + ".road.width", pathwidth);
|
||||||
|
|
||||||
Integer pathheight = PLOTME_DG_YML.getInt("worlds." + plotMeWorldName + ".RoadHeight"); //
|
Integer pathheight = PLOTME_DG_YML.getInt("worlds." + plotMeWorldName + ".RoadHeight"); //
|
||||||
if ((pathheight == null) || (pathheight == 0)) {
|
if (pathheight == 0) {
|
||||||
pathheight = 64;
|
pathheight = 64;
|
||||||
}
|
}
|
||||||
PS.get().config.set("worlds." + world + ".road.height", pathheight);
|
PS.get().config.set("worlds." + world + ".road.height", pathheight);
|
||||||
PS.get().config.set("worlds." + world + ".wall.height", pathheight);
|
PS.get().config.set("worlds." + world + ".wall.height", pathheight);
|
||||||
PS.get().config.set("worlds." + world + ".plot.height", pathheight);
|
PS.get().config.set("worlds." + world + ".plot.height", pathheight);
|
||||||
Integer plotsize = PLOTME_DG_YML.getInt("worlds." + plotMeWorldName + ".PlotSize"); //
|
Integer plotsize = PLOTME_DG_YML.getInt("worlds." + plotMeWorldName + ".PlotSize"); //
|
||||||
if ((plotsize == null) || (plotsize == 0)) {
|
if (plotsize == 0) {
|
||||||
plotsize = 32;
|
plotsize = 32;
|
||||||
}
|
}
|
||||||
PS.get().config.set("worlds." + world + ".plot.size", plotsize);
|
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 z = Z << 4;
|
||||||
final int x2 = x + 15;
|
final int x2 = x + 15;
|
||||||
final int z2 = z + 15;
|
final int z2 = z + 15;
|
||||||
Thread thread = new Thread();
|
|
||||||
Plot plot = new Location(world, x, 1, z).getOwnedPlotAbs();
|
Plot plot = new Location(world, x, 1, z).getOwnedPlotAbs();
|
||||||
if (plot != null && plot.hasOwner()) {
|
if (plot != null && plot.hasOwner()) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -171,9 +171,6 @@ public class BukkitUtil extends WorldUtil {
|
|||||||
public int getBiomeFromString(final String biomeStr) {
|
public int getBiomeFromString(final String biomeStr) {
|
||||||
try {
|
try {
|
||||||
final Biome biome = Biome.valueOf(biomeStr.toUpperCase());
|
final Biome biome = Biome.valueOf(biomeStr.toUpperCase());
|
||||||
if (biome == null) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
return Arrays.asList(Biome.values()).indexOf(biome);
|
return Arrays.asList(Biome.values()).indexOf(biome);
|
||||||
} catch (final IllegalArgumentException e) {
|
} catch (final IllegalArgumentException e) {
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -246,7 +246,7 @@ public class ConfigurationSerialization {
|
|||||||
|
|
||||||
final SerializableAs alias = clazz.getAnnotation(SerializableAs.class);
|
final SerializableAs alias = clazz.getAnnotation(SerializableAs.class);
|
||||||
|
|
||||||
if ((alias != null) && (alias.value() != null)) {
|
if (alias != null) {
|
||||||
return alias.value();
|
return alias.value();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -92,7 +92,6 @@ public class Claim extends SubCommand {
|
|||||||
return sendMessage(plr, C.NOT_IN_PLOT);
|
return sendMessage(plr, C.NOT_IN_PLOT);
|
||||||
}
|
}
|
||||||
final int currentPlots = Settings.GLOBAL_LIMIT ? plr.getPlotCount() : plr.getPlotCount(loc.getWorld());
|
final int currentPlots = Settings.GLOBAL_LIMIT ? plr.getPlotCount() : plr.getPlotCount(loc.getWorld());
|
||||||
boolean removeGrantedPlot = false;
|
|
||||||
int grants = 0;
|
int grants = 0;
|
||||||
if (currentPlots >= plr.getAllowedPlots()) {
|
if (currentPlots >= plr.getAllowedPlots()) {
|
||||||
if (plr.hasPersistentMeta("grantedPlots")) {
|
if (plr.hasPersistentMeta("grantedPlots")) {
|
||||||
|
@ -65,10 +65,6 @@ public class Condense extends SubCommand {
|
|||||||
MainUtil.sendMessage(plr, "TASK ALREADY STARTED");
|
MainUtil.sendMessage(plr, "TASK ALREADY STARTED");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (args.length == 2) {
|
|
||||||
MainUtil.sendMessage(plr, "/plot condense " + area.toString() + " start <radius>");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (!MathMan.isInteger(args[2])) {
|
if (!MathMan.isInteger(args[2])) {
|
||||||
MainUtil.sendMessage(plr, "INVALID RADIUS");
|
MainUtil.sendMessage(plr, "INVALID RADIUS");
|
||||||
return false;
|
return false;
|
||||||
|
@ -12,6 +12,7 @@ import com.plotsquared.general.commands.CommandDeclaration;
|
|||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
@CommandDeclaration(
|
@CommandDeclaration(
|
||||||
command = "debugpaste",
|
command = "debugpaste",
|
||||||
@ -41,7 +42,7 @@ public class DebugPaste extends SubCommand {
|
|||||||
b.append("links.settings_yml: '").append(settingsYML).append("'\n");
|
b.append("links.settings_yml: '").append(settingsYML).append("'\n");
|
||||||
b.append("links.latest_log: '").append(latestLOG).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("\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("online_mode: ").append(UUIDHandler.getUUIDWrapper() + ";" + !Settings.OFFLINE_MODE).append("\n");
|
||||||
b.append("plugins:");
|
b.append("plugins:");
|
||||||
for (String id : PS.get().IMP.getPluginIds()) {
|
for (String id : PS.get().IMP.getPluginIds()) {
|
||||||
|
@ -464,20 +464,14 @@ public class SQLManager implements AbstractDB {
|
|||||||
final Plot plot = plotMap.get(plotId);
|
final Plot plot = plotMap.get(plotId);
|
||||||
if (plot != null) {
|
if (plot != null) {
|
||||||
settings.add(new SettingsPair(id, plot.getSettings()));
|
settings.add(new SettingsPair(id, plot.getSettings()));
|
||||||
if (plot.getDenied() != null) {
|
for (final UUID uuid : plot.getDenied()) {
|
||||||
for (final UUID uuid : plot.getDenied()) {
|
denied.add(new UUIDPair(id, uuid));
|
||||||
denied.add(new UUIDPair(id, uuid));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (plot.getMembers() != null) {
|
for (final UUID uuid : plot.getMembers()) {
|
||||||
for (final UUID uuid : plot.getMembers()) {
|
trusted.add(new UUIDPair(id, uuid));
|
||||||
trusted.add(new UUIDPair(id, uuid));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (plot.getTrusted() != null) {
|
for (final UUID uuid : plot.getTrusted()) {
|
||||||
for (final UUID uuid : plot.getTrusted()) {
|
helpers.add(new UUIDPair(id, uuid));
|
||||||
helpers.add(new UUIDPair(id, uuid));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -203,9 +203,6 @@ public class Location implements Cloneable, Comparable<Location> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int compareTo(final Location o) {
|
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()) {
|
if (x == o.getX() && y == o.getY() || z == o.getZ()) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -357,7 +357,7 @@ public class Plot {
|
|||||||
*/
|
*/
|
||||||
public HashSet<UUID> getOwners() {
|
public HashSet<UUID> getOwners() {
|
||||||
if (owner == null) {
|
if (owner == null) {
|
||||||
return new HashSet<UUID>();
|
return new HashSet<>();
|
||||||
}
|
}
|
||||||
if (isMerged()) {
|
if (isMerged()) {
|
||||||
HashSet<Plot> plots = getConnectedPlots();
|
HashSet<Plot> plots = getConnectedPlots();
|
||||||
@ -910,16 +910,15 @@ public class Plot {
|
|||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final String rename = name == null ? "unknown" : name;
|
|
||||||
final PlotManager manager = this.area.getPlotManager();
|
final PlotManager manager = this.area.getPlotManager();
|
||||||
if (this.area.ALLOW_SIGNS) {
|
if (this.area.ALLOW_SIGNS) {
|
||||||
final Location loc = manager.getSignLoc(this.area, this);
|
final Location loc = manager.getSignLoc(this.area, this);
|
||||||
final String id = this.id.x + ";" + this.id.y;
|
final String id = this.id.x + ";" + this.id.y;
|
||||||
final String[] lines = new String[] {
|
final String[] lines = new String[] {
|
||||||
C.OWNER_SIGN_LINE_1.formatted().replaceAll("%id%", id),
|
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_2.formatted().replaceAll("%id%", id).replaceAll("%plr%", name),
|
||||||
C.OWNER_SIGN_LINE_3.formatted().replaceAll("%id%", id).replaceAll("%plr%", rename),
|
C.OWNER_SIGN_LINE_3.formatted().replaceAll("%id%", id).replaceAll("%plr%", name),
|
||||||
C.OWNER_SIGN_LINE_4.formatted().replaceAll("%id%", id).replaceAll("%plr%", rename) };
|
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);
|
WorldUtil.IMP.setSign(this.area.worldname, loc.getX(), loc.getY(), loc.getZ(), lines);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1242,7 +1241,7 @@ public class Plot {
|
|||||||
*/
|
*/
|
||||||
public void setSign() {
|
public void setSign() {
|
||||||
if (this.owner == null) {
|
if (this.owner == null) {
|
||||||
this.setSign(null);
|
this.setSign("unknown");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.setSign(UUIDHandler.getName(this.owner));
|
this.setSign(UUIDHandler.getName(this.owner));
|
||||||
|
@ -214,9 +214,7 @@ public class MainListener {
|
|||||||
if (cap == 0) {
|
if (cap == 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (mobs == null) {
|
mobs = plot.countEntities();
|
||||||
mobs = plot.countEntities();
|
|
||||||
}
|
|
||||||
if (mobs[3] >= cap) {
|
if (mobs[3] >= cap) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -260,9 +258,7 @@ public class MainListener {
|
|||||||
if (cap == 0) {
|
if (cap == 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (mobs == null) {
|
mobs = plot.countEntities();
|
||||||
mobs = plot.countEntities();
|
|
||||||
}
|
|
||||||
if (mobs[4] >= cap) {
|
if (mobs[4] >= cap) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,12 @@ import com.intellectualcrafters.plot.object.PlotBlock;
|
|||||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
import com.intellectualcrafters.plot.object.RegionWrapper;
|
import com.intellectualcrafters.plot.object.RegionWrapper;
|
||||||
import com.intellectualcrafters.plot.object.schematic.PlotItem;
|
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.SpongeMain;
|
||||||
import com.plotsquared.sponge.object.SpongePlayer;
|
import com.plotsquared.sponge.object.SpongePlayer;
|
||||||
import net.minecraft.block.Block;
|
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.event.cause.Cause;
|
||||||
import org.spongepowered.api.text.Text;
|
import org.spongepowered.api.text.Text;
|
||||||
import org.spongepowered.api.text.serializer.TextSerializers;
|
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.text.translation.Translation;
|
||||||
import org.spongepowered.api.world.World;
|
import org.spongepowered.api.world.World;
|
||||||
import org.spongepowered.api.world.biome.BiomeType;
|
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.Field;
|
||||||
import java.lang.reflect.Method;
|
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 {
|
public class SpongeUtil extends WorldUtil {
|
||||||
|
|
||||||
@ -103,28 +111,23 @@ public class SpongeUtil extends WorldUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static Translation getTranslation(final String m) {
|
public static Translation getTranslation(final String m) {
|
||||||
return new Translatable() {
|
return new Translation() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Translation getTranslation() {
|
public String getId() {
|
||||||
return new Translation() {
|
return m;
|
||||||
|
|
||||||
@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;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
}.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;
|
private static HashMap<BlockState, PlotBlock> stateMap;
|
||||||
|
2
pom.xml
2
pom.xml
@ -77,7 +77,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.bukkit</groupId>
|
<groupId>org.bukkit</groupId>
|
||||||
<artifactId>bukkit</artifactId>
|
<artifactId>bukkit</artifactId>
|
||||||
<version>1.8.8-R0.1-SNAPSHOT</version>
|
<version>1.9-SNAPSHOT</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.sk89q</groupId>
|
<groupId>com.sk89q</groupId>
|
||||||
|
Loading…
Reference in New Issue
Block a user