From 790e925e5c83aca92d385161b79429ae3931d111 Mon Sep 17 00:00:00 2001 From: Daniel Saukel Date: Thu, 16 Apr 2020 22:17:16 +0200 Subject: [PATCH] Add fireTick game rule --- .../main/java/de/erethon/dungeonsxl/api/dungeon/GameRule.java | 4 ++++ .../src/main/java/de/erethon/dungeonsxl/world/DGameWorld.java | 1 + .../main/java/de/erethon/dungeonsxl/world/DResourceWorld.java | 2 ++ 3 files changed, 7 insertions(+) diff --git a/api/src/main/java/de/erethon/dungeonsxl/api/dungeon/GameRule.java b/api/src/main/java/de/erethon/dungeonsxl/api/dungeon/GameRule.java index 3fb0abce..b3249d07 100644 --- a/api/src/main/java/de/erethon/dungeonsxl/api/dungeon/GameRule.java +++ b/api/src/main/java/de/erethon/dungeonsxl/api/dungeon/GameRule.java @@ -151,6 +151,10 @@ public class GameRule { * A whitelist of placeable blocks. placeBlocks is supposed to be set to "true" if this should be used. */ public static final GameRule> PLACE_WHITELIST = new CollectionGameRule<>("placeWhitelist", null, ConfigReader.EX_ITEM_SET_READER, HashSet::new); + /** + * This does what the doFireTick Vanilla game rule does. + */ + public static final GameRule FIRE_TICK = new GameRule<>(Boolean.class, "fireTick", false); /** * If it should rain permanently in the dungeon. *

diff --git a/core/src/main/java/de/erethon/dungeonsxl/world/DGameWorld.java b/core/src/main/java/de/erethon/dungeonsxl/world/DGameWorld.java index 603723bc..81041f38 100644 --- a/core/src/main/java/de/erethon/dungeonsxl/world/DGameWorld.java +++ b/core/src/main/java/de/erethon/dungeonsxl/world/DGameWorld.java @@ -411,6 +411,7 @@ public class DGameWorld extends DInstanceWorld implements GameWorld { } world.setDifficulty(getRules().getState(GameRule.DIFFICULTY)); + world.setGameRule(org.bukkit.GameRule.DO_FIRE_TICK, getRules().getState(GameRule.FIRE_TICK)); isPlaying = true; diff --git a/core/src/main/java/de/erethon/dungeonsxl/world/DResourceWorld.java b/core/src/main/java/de/erethon/dungeonsxl/world/DResourceWorld.java index 081fd142..c2ed35c6 100644 --- a/core/src/main/java/de/erethon/dungeonsxl/world/DResourceWorld.java +++ b/core/src/main/java/de/erethon/dungeonsxl/world/DResourceWorld.java @@ -30,6 +30,7 @@ import de.erethon.dungeonsxl.event.editworld.EditWorldGenerateEvent; import java.io.File; import java.io.IOException; import org.bukkit.Bukkit; +import org.bukkit.GameRule; import org.bukkit.OfflinePlayer; import org.bukkit.World; import org.bukkit.World.Environment; @@ -200,6 +201,7 @@ public class DResourceWorld implements ResourceWorld { FileUtil.copyDir(folder, instanceFolder, DungeonsXL.EXCLUDED_FILES); instance.world = Bukkit.createWorld(WorldCreator.name(name).environment(getWorldEnvironment())); + instance.world.setGameRule(GameRule.DO_FIRE_TICK, false); if (Bukkit.getPluginManager().isPluginEnabled("dynmap")) { Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "dynmap pause all"); Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "dmap worldset " + name + " enabled:false");