mirror of
https://github.com/plexusorg/Plex.git
synced 2025-07-01 15:46:42 +00:00
- Add the ability to customize game rules per world in config
- Add gamerules argument to /debug
This commit is contained in:
@ -1,11 +1,18 @@
|
||||
package dev.plex.services.impl;
|
||||
|
||||
import dev.plex.Plex;
|
||||
import dev.plex.services.AbstractService;
|
||||
import dev.plex.util.PlexLog;
|
||||
import dev.plex.util.PlexUtils;
|
||||
import org.apache.commons.lang.BooleanUtils;
|
||||
import org.apache.commons.lang.math.NumberUtils;
|
||||
import org.apache.commons.lang3.EnumUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.GameRule;
|
||||
import org.bukkit.World;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
public class GameRuleService extends AbstractService
|
||||
{
|
||||
public GameRuleService()
|
||||
@ -18,28 +25,12 @@ public class GameRuleService extends AbstractService
|
||||
{
|
||||
for (World world : Bukkit.getWorlds())
|
||||
{
|
||||
commitGameRules(world);
|
||||
PlexUtils.commitGameRules(world);
|
||||
PlexLog.debug("Set gamerules for world: " + world.getName());
|
||||
}
|
||||
}
|
||||
|
||||
private void commitGameRules(World world)
|
||||
{
|
||||
world.setGameRule(GameRule.DO_MOB_SPAWNING, false);
|
||||
world.setGameRule(GameRule.DO_FIRE_TICK, false);
|
||||
world.setGameRule(GameRule.KEEP_INVENTORY, true);
|
||||
world.setGameRule(GameRule.DO_MOB_LOOT, false);
|
||||
world.setGameRule(GameRule.MOB_GRIEFING, false);
|
||||
world.setGameRule(GameRule.DO_TILE_DROPS, false);
|
||||
world.setGameRule(GameRule.COMMAND_BLOCK_OUTPUT, false);
|
||||
world.setGameRule(GameRule.NATURAL_REGENERATION, true);
|
||||
world.setGameRule(GameRule.DO_DAYLIGHT_CYCLE, false);
|
||||
world.setGameRule(GameRule.DO_WEATHER_CYCLE, false);
|
||||
world.setGameRule(GameRule.ANNOUNCE_ADVANCEMENTS, false);
|
||||
world.setGameRule(GameRule.SHOW_DEATH_MESSAGES, false);
|
||||
world.setGameRule(GameRule.SEND_COMMAND_FEEDBACK, false);
|
||||
world.setGameRule(GameRule.DO_WEATHER_CYCLE, false);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int repeatInSeconds()
|
||||
|
Reference in New Issue
Block a user