From 5ab70b7cb9304c62e40382c569af3e08864436fa Mon Sep 17 00:00:00 2001 From: Simon Date: Thu, 7 May 2020 17:11:13 +0200 Subject: [PATCH] feat: add all gamerules --- .vscode/settings.json | 1 + .../main/java/de/cliffbreak/varo/Varo.java | 35 ++++++++- .../listeners/PlayerJoinQuitListener.java | 71 ++++++++++--------- 3 files changed, 71 insertions(+), 36 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 557e1ce..a2f107b 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -4,6 +4,7 @@ "java.jdt.ls.vmargs": "-Dfile.encoding=UTF-8", "java.configuration.updateBuildConfiguration": "automatic", "cSpell.words": [ + "Aragur", "Gamemode", "Gamerules", "Minecraft", diff --git a/varo/src/main/java/de/cliffbreak/varo/Varo.java b/varo/src/main/java/de/cliffbreak/varo/Varo.java index 58bd0d6..50f1098 100644 --- a/varo/src/main/java/de/cliffbreak/varo/Varo.java +++ b/varo/src/main/java/de/cliffbreak/varo/Varo.java @@ -66,10 +66,41 @@ public class Varo extends JavaPlugin { getCommand("varo").setExecutor(new VaroCommand(this)); for (World world : getServer().getWorlds()) { - // world.setDifficulty(Difficulty.HARD); - world.setDifficulty(Difficulty.PEACEFUL); // TODO: REMOVE AFTER DEBUG!! + world.setDifficulty(Difficulty.HARD); world.setGameRule(GameRule.ANNOUNCE_ADVANCEMENTS, false); + world.setGameRule(GameRule.COMMAND_BLOCK_OUTPUT, true); + world.setGameRule(GameRule.DISABLE_ELYTRA_MOVEMENT_CHECK, false); + world.setGameRule(GameRule.DISABLE_RAIDS, false); + world.setGameRule(GameRule.DO_DAYLIGHT_CYCLE, true); + world.setGameRule(GameRule.DO_ENTITY_DROPS, true); + world.setGameRule(GameRule.DO_FIRE_TICK, true); + world.setGameRule(GameRule.DO_INSOMNIA, false); + world.setGameRule(GameRule.DO_IMMEDIATE_RESPAWN, false); + world.setGameRule(GameRule.DO_LIMITED_CRAFTING, false); + world.setGameRule(GameRule.DO_MOB_LOOT, true); + world.setGameRule(GameRule.DO_MOB_SPAWNING, true); + world.setGameRule(GameRule.DO_PATROL_SPAWNING, true); + world.setGameRule(GameRule.DO_TILE_DROPS, true); + world.setGameRule(GameRule.DO_TRADER_SPAWNING, false); + world.setGameRule(GameRule.DO_WEATHER_CYCLE, true); + world.setGameRule(GameRule.DROWNING_DAMAGE, true); + world.setGameRule(GameRule.FALL_DAMAGE, true); + world.setGameRule(GameRule.FIRE_DAMAGE, true); + world.setGameRule(GameRule.KEEP_INVENTORY, false); + world.setGameRule(GameRule.LOG_ADMIN_COMMANDS, true); + world.setGameRule(GameRule.MOB_GRIEFING, true); + world.setGameRule(GameRule.NATURAL_REGENERATION, true); world.setGameRule(GameRule.REDUCED_DEBUG_INFO, true); + world.setGameRule(GameRule.SEND_COMMAND_FEEDBACK, true); + world.setGameRule(GameRule.SHOW_DEATH_MESSAGES, true); + world.setGameRule(GameRule.SPECTATORS_GENERATE_CHUNKS, false); + + // DEBUG specific Settings + if (this.config.getBoolean("Varo.Debug")) { + world.setDifficulty(Difficulty.PEACEFUL); + world.setGameRule(GameRule.DO_DAYLIGHT_CYCLE, false); + world.setGameRule(GameRule.DO_WEATHER_CYCLE, false); + } } getServer().removeRecipe(NamespacedKey.minecraft("fishing_rod")); } diff --git a/varo/src/main/java/de/cliffbreak/varo/listeners/PlayerJoinQuitListener.java b/varo/src/main/java/de/cliffbreak/varo/listeners/PlayerJoinQuitListener.java index 72c9970..2ec9875 100644 --- a/varo/src/main/java/de/cliffbreak/varo/listeners/PlayerJoinQuitListener.java +++ b/varo/src/main/java/de/cliffbreak/varo/listeners/PlayerJoinQuitListener.java @@ -50,43 +50,46 @@ public class PlayerJoinQuitListener implements Listener { e.getPlayer().sendMessage("\n§7§l#### §9Cliffbreak.de - §lVaro §r§9Changelog §7§l####\n \n" + " §cWarning: §r§c Plugin is running in DEBUG mode!\n "); - final Stack changes = new Stack(); + if (!(e.getPlayer().getName().equals("AragurLP") || e.getPlayer().getName().equals("AragurTV"))) { - changes.push(" §7• §r§lADD: §rAdd /varo portal to allow Operators to create a Portal"); - changes.push(" §7• §r§lADD: §rPlayers can't create Portals"); - changes.push(" §7• §r§lADD: §rFakePlayer now drops his items and gets real player banned on death"); - changes.push(" §7• §r§lADD: §rFakePlayer is no attackable (can also be killed)"); - changes.push(" §7• §r§lADD: §rAdd a FakePlayer if Player is logged out"); - changes.push(" §7• §r§lADD: §rAdd /varo test && /varo testremove"); - changes.push(" §7• §r§lFIX: §r/varo Command is only usable by Server Operators now"); - changes.push( - " §7• §r§lADD: §rDisallow special Items (Enchanted Golden Apple, Fishing Rod, Totem of Undying)"); - changes.push(" §7• §r§lADD: §rUse Vanilla Hearts"); - changes.push(" §7• §r§lADD: §rDisable Fishing Rod Crafting Recipe"); - changes.push(" §7• §r§lFIX: §rCheck for Ban in AsyncPreLoginEvent"); - changes.push(" §7• §r§lFIX: §rOnly kick player after Entity isn't ticking anymore"); - changes.push(" §7• §r§lADD: §r/varo Command for Admins"); - changes.push(" §7• §r§lADD: §rBan Player on Death"); - changes.push(" §7• §r§lADD: §r1.8 Health Regeneration"); - changes.push(" §7• §r§lADD: §rCustom Dynamic ServerListEntry"); - changes.push(" §7• §r§lADD: §rControl Difficulty and Gamerules by the Plugin"); - changes.push(" §7• §r§lADD: §rHover over Playername for Details (Team)"); - changes.push(" §7• §r§lADD: §rRedesigned Chat with Timestamp"); + final Stack changes = new Stack(); - new BukkitRunnable() { - @Override - public void run() { - if (!e.getPlayer().isOnline()) { - this.cancel(); - return; + changes.push(" §7• §r§lADD: §rAdd /varo portal to allow Operators to create a Portal"); + changes.push(" §7• §r§lADD: §rPlayers can't create Portals"); + changes.push(" §7• §r§lADD: §rFakePlayer now drops his items and gets real player banned on death"); + changes.push(" §7• §r§lADD: §rFakePlayer is no attackable (can also be killed)"); + changes.push(" §7• §r§lADD: §rAdd a FakePlayer if Player is logged out"); + changes.push(" §7• §r§lADD: §rAdd /varo test && /varo testremove"); + changes.push(" §7• §r§lFIX: §r/varo Command is only usable by Server Operators now"); + changes.push( + " §7• §r§lADD: §rDisallow special Items (Enchanted Golden Apple, Fishing Rod, Totem of Undying)"); + changes.push(" §7• §r§lADD: §rUse Vanilla Hearts"); + changes.push(" §7• §r§lADD: §rDisable Fishing Rod Crafting Recipe"); + changes.push(" §7• §r§lFIX: §rCheck for Ban in AsyncPreLoginEvent"); + changes.push(" §7• §r§lFIX: §rOnly kick player after Entity isn't ticking anymore"); + changes.push(" §7• §r§lADD: §r/varo Command for Admins"); + changes.push(" §7• §r§lADD: §rBan Player on Death"); + changes.push(" §7• §r§lADD: §r1.8 Health Regeneration"); + changes.push(" §7• §r§lADD: §rCustom Dynamic ServerListEntry"); + changes.push(" §7• §r§lADD: §rControl Difficulty and Gamerules by the Plugin"); + changes.push(" §7• §r§lADD: §rHover over Playername for Details (Team)"); + changes.push(" §7• §r§lADD: §rRedesigned Chat with Timestamp"); + + new BukkitRunnable() { + @Override + public void run() { + if (!e.getPlayer().isOnline()) { + this.cancel(); + return; + } + if (changes.empty()) { + this.cancel(); + return; + } + e.getPlayer().sendMessage(changes.pop()); } - if (changes.empty()) { - this.cancel(); - return; - } - e.getPlayer().sendMessage(changes.pop()); - } - }.runTaskTimer(plugin, 20, 20); + }.runTaskTimer(plugin, 20, 20); + } } }