[SPIGOT-1633] API for Gamerules Created: 20/Feb/16  Updated: 26/Dec/18  Resolved: 26/Dec/18

Status: Resolved
Project: Spigot
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: New Feature Priority: Minor
Reporter: Vinetos Assignee: Unassigned
Resolution: Fixed Votes: 2
Labels: Bukkit, Craftbukkit, JavaPlugin, Spigot


 Description   

Hello,
I want to offer you an improved plugin API by adding a enum for gamerules.
Basically, we do:

Bukkit.getWorlds().get(0).setGameRuleValue("gamerule", "value");

But we could simplify it with a class like this: http://pastebin.com/mbbrePsk
Now we have to do:

Bukkit.getWorlds().get(0).setGameRuleValue(GameRules.DO_DAY_LIGHT_CYCLE, false);

 

Bonjour,
Je souhaite vous proposer une amélioration de l'API de plugin en ajoutant par exemple, une enum pour les gamerules.

De base, nous faisons:

Bukkit.getWorlds().get(0).setGameRuleValue("gamerule", "value");

Mais nous pourrions simplifier ça avec une classe dans ce genre: http://pastebin.com/mbbrePsk

Ainsi, nous aurons:

Bukkit.getWorlds().get(0).setGameRuleValue(GameRules.DO_DAY_LIGHT_CYCLE, false);

Vinetos



 Comments   
Comment by md_5 [ 26/Dec/18 ]

This was added https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/GameRule.html

Comment by Hex [ 15/Jul/18 ]

New PR: https://hub.spigotmc.org/stash/projects/SPIGOT/repos/bukkit/pull-requests/259

Comment by Martin | MiniDigger [ 26/May/17 ]

there is a open PR for this here: https://hub.spigotmc.org/stash/projects/SPIGOT/repos/bukkit/pull-requests/144/overview

Comment by Vinetos [ 20/Feb/16 ]

English:
Hello,
I want to offer you an improved plugin API by adding a enum for gamerules.
Basically, we do:

Bukkit.getWorlds().get(0).setGameRuleValue("gamerule", "value");

But we could simplify it with a class like this: http://pastebin.com/mbbrePsk
Now we have to do:

Bukkit.getWorlds().get(0).setGameRuleValue(GameRules.DO_DAY_LIGHT_CYCLE, false);

Vinetos

Generated at Tue Apr 15 09:26:01 UTC 2025 using Jira 10.3.3#10030003-sha1:d220e3fefc8dfc6d47f522d3b9a20c1455e12b7b.