From ffddf5c18790f63a39fa9fa0d685ff5eb0bf3720 Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Fri, 29 Jul 2016 12:12:28 +1000 Subject: [PATCH] Fix sponge generator cast --- .../bukkit/listeners/PlayerEvents.java | 3 + .../bukkit/uuid/FileUUIDHandler.java | 2 +- .../plot/commands/FlagCmd.java | 3 + .../plotsquared/sponge/SpongeSetupUtils.java | 81 ------------------- .../sponge/util/SpongeSetupUtils.java | 2 +- build.gradle | 2 +- pom.xml | 2 +- 7 files changed, 10 insertions(+), 85 deletions(-) delete mode 100644 Sponge/src/main/java/com/plotsquared/sponge/SpongeSetupUtils.java diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/listeners/PlayerEvents.java b/Bukkit/src/main/java/com/plotsquared/bukkit/listeners/PlayerEvents.java index 3cecf4b40..2f673a3b8 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/listeners/PlayerEvents.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/listeners/PlayerEvents.java @@ -1375,6 +1375,9 @@ public class PlayerEvents extends PlotListener implements Listener { } public static boolean checkEntity(Plot plot, IntegerFlag... flags) { + if (Settings.Done.RESTRICT_BUILDING && Flags.DONE.isSet(plot)) { + return true; + } int[] mobs = null; for (IntegerFlag flag : flags) { int i; diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/uuid/FileUUIDHandler.java b/Bukkit/src/main/java/com/plotsquared/bukkit/uuid/FileUUIDHandler.java index a7c048572..fdd8a9816 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/uuid/FileUUIDHandler.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/uuid/FileUUIDHandler.java @@ -97,7 +97,7 @@ public class FileUUIDHandler extends UUIDHandlerImplementation { ByteSource is = com.google.common.io.Files.asByteSource(file); NbtFactory.NbtCompound compound = NbtFactory.fromStream(is, NbtFactory.StreamOptions.GZIP_COMPRESSION); if (!compound.containsKey("bukkit")) { - PS.debug("ERROR: Player data does not contain the the key \"bukkit\""); + PS.debug("ERROR: Player data (" + uuid.toString() + ".dat) does not contain the the key \"bukkit\""); } else { NbtFactory.NbtCompound bukkit = (NbtFactory.NbtCompound) compound.get("bukkit"); String name = (String) bukkit.get("lastKnownName"); diff --git a/Core/src/main/java/com/intellectualcrafters/plot/commands/FlagCmd.java b/Core/src/main/java/com/intellectualcrafters/plot/commands/FlagCmd.java index a75cbff63..a2f127a71 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/commands/FlagCmd.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/commands/FlagCmd.java @@ -166,6 +166,9 @@ public class FlagCmd extends SubCommand { return false; } } + if(flag == Flags.TIME) { + player.setTime(Long.MAX_VALUE); + } MainUtil.sendMessage(player, C.FLAG_REMOVED); return true; } diff --git a/Sponge/src/main/java/com/plotsquared/sponge/SpongeSetupUtils.java b/Sponge/src/main/java/com/plotsquared/sponge/SpongeSetupUtils.java deleted file mode 100644 index b5b33e7a8..000000000 --- a/Sponge/src/main/java/com/plotsquared/sponge/SpongeSetupUtils.java +++ /dev/null @@ -1,81 +0,0 @@ -package com.plotsquared.sponge; - -import com.intellectualcrafters.plot.PS; -import com.intellectualcrafters.plot.config.ConfigurationNode; -import com.intellectualcrafters.plot.generator.GeneratorWrapper; -import com.intellectualcrafters.plot.generator.HybridGen; -import com.intellectualcrafters.plot.generator.PlotGenerator; -import com.intellectualcrafters.plot.object.PlotArea; -import com.intellectualcrafters.plot.object.SetupObject; -import com.intellectualcrafters.plot.util.SetupUtils; -import com.plotsquared.sponge.generator.SpongePlotGenerator; -import com.plotsquared.sponge.util.SpongeUtil; -import org.spongepowered.api.world.World; -import org.spongepowered.api.world.gen.WorldGenerator; - -import java.io.IOException; -import java.util.Map; - -public class SpongeSetupUtils extends SetupUtils { - - @Override - public void updateGenerators() { - if (!SetupUtils.generators.isEmpty()) { - return; - } - SetupUtils.generators.put("PlotSquared", new SpongePlotGenerator(new HybridGen())); - throw new UnsupportedOperationException("TODO FETCH EXTERNAL WorldGenerationModifiers"); - } - - @Override - public String getGenerator(final PlotArea plotArea) { - if (SetupUtils.generators.isEmpty()) { - updateGenerators(); - } - final World world = SpongeUtil.getWorld(plotArea.worldname); - if (world == null) { - return null; - } - final WorldGenerator generator = world.getWorldGenerator(); - if (!(generator instanceof SpongePlotGenerator)) { - return null; - } - for (final Map.Entry> entry : generators.entrySet()) { - GeneratorWrapper current = entry.getValue(); - if (current.equals(generator)) { - return entry.getKey(); - } - } - return null; - } - - @Override - public String setupWorld(final SetupObject object) { - SetupUtils.manager.updateGenerators(); - final ConfigurationNode[] steps = object.step; - final String world = object.world; - for (final ConfigurationNode step : steps) { - PS.get().worlds.set("worlds." + world + "." + step.getConstant(), step.getValue()); - } - if (object.type != 0) { - PS.get().worlds.set("worlds." + world + ".generator.type", object.type); - PS.get().worlds.set("worlds." + world + ".generator.terrain", object.terrain); - PS.get().worlds.set("worlds." + world + ".generator.plugin", object.plotManager); - if ((object.setupGenerator != null) && !object.setupGenerator.equals(object.plotManager)) { - PS.get().worlds.set("worlds." + world + ".generator.init", object.setupGenerator); - } - final PlotGenerator gen = (PlotGenerator) generators.get(object.setupGenerator); - if ((gen != null) && (gen.generator instanceof SpongePlotGenerator)) { - object.setupGenerator = null; - } - } - try { - PS.get().worlds.save(PS.get().worldsFile); - } catch (final IOException e) { - e.printStackTrace(); - } - // TODO FIXME - throw new UnsupportedOperationException("NOT IMPLEMENTED YET: Create a new world here"); - // return object.world; - } -} diff --git a/Sponge/src/main/java/com/plotsquared/sponge/util/SpongeSetupUtils.java b/Sponge/src/main/java/com/plotsquared/sponge/util/SpongeSetupUtils.java index a72b6574e..cea7fa5a3 100644 --- a/Sponge/src/main/java/com/plotsquared/sponge/util/SpongeSetupUtils.java +++ b/Sponge/src/main/java/com/plotsquared/sponge/util/SpongeSetupUtils.java @@ -140,7 +140,7 @@ public class SpongeSetupUtils extends SetupUtils { if (object.setupGenerator != null) { // create world with generator GeneratorWrapper gw = SetupUtils.generators.get(object.setupGenerator); - WorldArchetype wgm = (WorldArchetype) gw.getPlatformGenerator(); + WorldGeneratorModifier wgm = (WorldGeneratorModifier) gw.getPlatformGenerator(); WorldArchetype settings = WorldArchetype.builder() .loadsOnStartup(true) diff --git a/build.gradle b/build.gradle index f8e70859e..c547fa0da 100644 --- a/build.gradle +++ b/build.gradle @@ -18,7 +18,7 @@ ext { git = Grgit.open() revision = "-${git.head().abbreviatedId}" } -version = "3.4.4-SNAPSHOT${revision}" +version = "3.4.5-SNAPSHOT${revision}" description = """PlotSquared""" subprojects { diff --git a/pom.xml b/pom.xml index a043d4ad1..789f1edb6 100644 --- a/pom.xml +++ b/pom.xml @@ -7,7 +7,7 @@ UTF-8 PlotSquared - 3.4.4-SNAPSHOT + 3.4.5-SNAPSHOT PlotSquared jar