This commit is contained in:
Butzlabben 2019-02-25 17:53:17 +01:00
parent 4c96334d15
commit 92a99e53da
2 changed files with 12 additions and 0 deletions

View File

@ -13,6 +13,7 @@ import java.util.List;
import java.util.UUID; import java.util.UUID;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Difficulty;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.configuration.file.YamlConfiguration;
@ -70,6 +71,15 @@ public class SettingsConfig {
} }
} }
// Fix for #17
String diff = cfg.getString("difficulty");
try {
Difficulty difficulty = Difficulty.valueOf(diff.toUpperCase());
w.setDifficulty(difficulty);
} catch (IllegalArgumentException e) {
Bukkit.getConsoleSender().sendMessage(PluginConfig.getPrefix() + "§cUnknown difficulty \"" + diff + "\" in settings.yml");
}
if (w.isGameRule("announceAdvancements")) if (w.isGameRule("announceAdvancements"))
w.setGameRuleValue("announceAdvancements", cfg.getString("announceAdvancements")); w.setGameRuleValue("announceAdvancements", cfg.getString("announceAdvancements"));

View File

@ -20,6 +20,8 @@ worldborder:
y: 20 y: 20
z: 0 z: 0
difficulty: EASY
# Commands that should be executed on /ws get when it is ready # Commands that should be executed on /ws get when it is ready
# Placeholders: %player: Name of player, %world: Name of world, %uuid: UUID of player # Placeholders: %player: Name of player, %world: Name of world, %uuid: UUID of player