Add global gamerules

This commit is contained in:
2022-03-20 20:05:50 -05:00
parent 580f87f28b
commit d0b89d995c
4 changed files with 67 additions and 51 deletions

View File

@ -3,6 +3,7 @@ package dev.plex.services.impl;
import dev.plex.services.AbstractService;
import dev.plex.util.PlexLog;
import dev.plex.util.PlexUtils;
import java.util.Locale;
import org.bukkit.Bukkit;
import org.bukkit.World;
@ -18,8 +19,17 @@ public class GameRuleService extends AbstractService
{
for (World world : Bukkit.getWorlds())
{
PlexUtils.commitGameRules(world);
PlexLog.debug("Set gamerules for world: " + world.getName());
PlexUtils.commitGlobalGameRules(world);
PlexLog.log("Set global gamerules for world: " + world.getName());
}
for (String world : plugin.config.getConfigurationSection("worlds").getKeys(false))
{
World bukkitWorld = Bukkit.getWorld(world);
if (bukkitWorld != null)
{
PlexUtils.commitSpecificGameRules(bukkitWorld);
PlexLog.log("Set specific gamerules for world: " + world.toLowerCase(Locale.ROOT));
}
}
}