From 230da410c8000f53b4d6fab1fc768cc4234adf51 Mon Sep 17 00:00:00 2001 From: Alisolarflare Date: Fri, 4 Sep 2020 17:31:58 -0400 Subject: [PATCH 1/2] Remove ChunkArchiveComponent --- pom.xml | 18 +++-- .../presents/ButtonPresents.java | 8 +-- .../chunkarchive/ChunkArchiveComponent.java | 65 ------------------- .../dictionary/spawning/SetBlock.java | 2 +- 4 files changed, 14 insertions(+), 79 deletions(-) delete mode 100644 src/main/java/buttondevteam/presents/components/chunkarchive/ChunkArchiveComponent.java diff --git a/pom.xml b/pom.xml index 3f47f65..ac5e942 100644 --- a/pom.xml +++ b/pom.xml @@ -32,7 +32,7 @@ org.apache.maven.plugins maven-compiler-plugin - 3.0 + 3.8.1 1.8 1.8 @@ -47,7 +47,7 @@ jcenter - http://jcenter.bintray.com + https://jcenter.bintray.com jitpack.io @@ -55,7 +55,11 @@ Factions - http://ci.ender.zone/plugin/repository/everything/ + https://ci.ender.zone/plugin/repository/everything/ + + + TownyAdvanced + https://github.com/TownyAdvanced/Towny/ @@ -67,8 +71,9 @@ org.spigotmc - spigot - 1.12.2-R0.1-SNAPSHOT + spigot-api + 1.16.2-R0.1-SNAPSHOT + provided com.github.TBMCPlugins.ChromaCore @@ -86,8 +91,9 @@ 1.6.9.5-U0.5.16 - com.palmergames.bukkit.towny + com.github.TownyAdvanced Towny + 0.96.2.0 provided diff --git a/src/main/java/buttondevteam/presents/ButtonPresents.java b/src/main/java/buttondevteam/presents/ButtonPresents.java index 715dad9..05894fd 100644 --- a/src/main/java/buttondevteam/presents/ButtonPresents.java +++ b/src/main/java/buttondevteam/presents/ButtonPresents.java @@ -1,7 +1,6 @@ package buttondevteam.presents; import buttondevteam.lib.architecture.Component; -import buttondevteam.presents.components.chunkarchive.ChunkArchiveComponent; import buttondevteam.presents.components.magic.MagicComponent; import buttondevteam.presents.components.portals.PortalLimitComponent; import buttondevteam.presents.components.research.ResearchComponent; @@ -14,7 +13,7 @@ import org.bukkit.plugin.java.JavaPlugin; import java.util.logging.Logger; public class ButtonPresents extends JavaPlugin{ - + //Hello Norbs public void onEnable(){ PluginDescriptionFile pdfFile = getDescription(); @@ -26,11 +25,6 @@ public class ButtonPresents extends JavaPlugin{ Component.registerComponent(this, new SpawnComponent()); Component.registerComponent(this, new MagicComponent()); Component.registerComponent(this, new ResearchComponent()); - try { - Component.registerComponent(this, new ChunkArchiveComponent()); - } catch (NoClassDefFoundError e) { - getLogger().warning("ChunkArchive compatibility error, not registering it."); - } Component.registerComponent(this, new TownyFactionsComponent()); Component.registerComponent(this, new PortalLimitComponent()); diff --git a/src/main/java/buttondevteam/presents/components/chunkarchive/ChunkArchiveComponent.java b/src/main/java/buttondevteam/presents/components/chunkarchive/ChunkArchiveComponent.java deleted file mode 100644 index 8755edd..0000000 --- a/src/main/java/buttondevteam/presents/components/chunkarchive/ChunkArchiveComponent.java +++ /dev/null @@ -1,65 +0,0 @@ -package buttondevteam.presents.components.chunkarchive; - -import buttondevteam.lib.TBMCCoreAPI; -import buttondevteam.lib.architecture.Component; -import buttondevteam.lib.architecture.ComponentMetadata; -import buttondevteam.presents.ButtonPresents; -import net.minecraft.server.v1_12_R1.ChunkRegionLoader; -import net.minecraft.server.v1_12_R1.ExceptionWorldConflict; -import org.bukkit.Bukkit; -import org.bukkit.craftbukkit.v1_12_R1.CraftChunk; -import org.bukkit.craftbukkit.v1_12_R1.CraftServer; -import org.bukkit.craftbukkit.v1_12_R1.CraftWorld; -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; -import org.bukkit.event.world.ChunkPopulateEvent; - -import java.io.File; -import java.io.IOException; -import java.util.logging.Logger; - -// @formatter:off -@ComponentMetadata(enabledByDefault = false) -public class ChunkArchiveComponent extends Component implements Listener { - private final File dataFolder = new File("plugins", "ChunkArchive"); - @Override - public void enable() { - try { - this.registerListener(this); - File testFolder = new File(dataFolder, "test"); - testFolder.mkdirs(); - Logger logger = getPlugin().getLogger(); - logger.info("Starting chunk save test..."); - ChunkRegionLoader testcrl = new ChunkRegionLoader(testFolder, - ((CraftServer) Bukkit.getServer()).getServer().dataConverterManager); - CraftWorld mainWorld=(CraftWorld) Bukkit.getWorlds().get(0); - testcrl.saveChunk(mainWorld.getHandle(), - ((CraftChunk) mainWorld.getLoadedChunks()[0]).getHandle(), false); - logger.info("Test complete"); - } - catch(Exception e) { - TBMCCoreAPI.SendException("ChunkArchive loading/testing failed!", e); - } - } - - @Override - protected void disable() { - - } - /*------------------------------------------------------------*/ - - private final ChunkRegionLoader chunkRegionLoader = - - new ChunkRegionLoader(dataFolder, - ((CraftServer) Bukkit.getServer()).getServer().dataConverterManager); - - /*------------------------------------------------------------*/ - - @EventHandler - public void onChunkPopulate(ChunkPopulateEvent event) throws IOException, ExceptionWorldConflict - { - if (event.getWorld().getName().equals("world")) - chunkRegionLoader.saveChunk(((CraftWorld) event.getWorld()).getHandle(), - ((CraftChunk) event.getChunk()).getHandle(), false); - } -} diff --git a/src/main/java/buttondevteam/presents/components/research/dictionary/spawning/SetBlock.java b/src/main/java/buttondevteam/presents/components/research/dictionary/spawning/SetBlock.java index f788f60..2769157 100644 --- a/src/main/java/buttondevteam/presents/components/research/dictionary/spawning/SetBlock.java +++ b/src/main/java/buttondevteam/presents/components/research/dictionary/spawning/SetBlock.java @@ -14,7 +14,7 @@ public class SetBlock extends UniversalCommand { public boolean def(Player player) { Block blockAtPlayer = player.getWorld().getBlockAt(player.getLocation()); - blockAtPlayer.setType(Material.CAKE_BLOCK); + blockAtPlayer.setType(Material.CAKE); return true; } From 3c01859ec658505f2e970906d4b4dfe4e0df6384 Mon Sep 17 00:00:00 2001 From: Ali Date: Sun, 6 Sep 2020 09:01:04 -0400 Subject: [PATCH 2/2] Implement Blue Bed Safety --- ButtonPresents.iml | 44 +++++++++++++++++++ .../dictionary/effects/Bedsplode.java | 3 +- 2 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 ButtonPresents.iml diff --git a/ButtonPresents.iml b/ButtonPresents.iml new file mode 100644 index 0000000..e979477 --- /dev/null +++ b/ButtonPresents.iml @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/java/buttondevteam/presents/components/research/dictionary/effects/Bedsplode.java b/src/main/java/buttondevteam/presents/components/research/dictionary/effects/Bedsplode.java index 8b5a301..7889371 100644 --- a/src/main/java/buttondevteam/presents/components/research/dictionary/effects/Bedsplode.java +++ b/src/main/java/buttondevteam/presents/components/research/dictionary/effects/Bedsplode.java @@ -1,5 +1,6 @@ package buttondevteam.presents.components.research.dictionary.effects; +import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; @@ -11,7 +12,7 @@ public class Bedsplode implements Listener { Player player = event.getPlayer(); player.sendMessage("[ButtonPresents] Nighty night " + player.getName().toLowerCase()); if (!player.getName().toLowerCase().equalsIgnoreCase("alisolarflare")) return; - + if (event.getBed().getType() == Material.BLUE_BED) return; player.getWorld().createExplosion( player.getLocation().getBlockX(), player.getLocation().getBlockY(),