mirror of
https://github.com/DRE2N/DungeonsXL.git
synced 2024-09-16 01:57:14 +02:00
Add foodLevel game rule
This commit is contained in:
parent
dfda93f664
commit
1928fafdfe
@ -77,6 +77,10 @@ public class GameRule<V> {
|
||||
* The Vanilla difficulty.
|
||||
*/
|
||||
public static final GameRule<Difficulty> DIFFICULTY = new GameRule<>(Difficulty.class, "difficulty", Difficulty.NORMAL);
|
||||
/**
|
||||
* If the food levels of the players change.
|
||||
*/
|
||||
public static final GameRule<Boolean> FOOD_LEVEL = new GameRule<>(Boolean.class, "foodLevel", true);
|
||||
/**
|
||||
* If players may fly.
|
||||
*/
|
||||
|
@ -217,7 +217,7 @@ public class DPlayerListener implements Listener {
|
||||
public void onFoodLevelChange(FoodLevelChangeEvent event) {
|
||||
GameWorld gameWorld = plugin.getGameWorld(event.getEntity().getWorld());
|
||||
if (gameWorld != null) {
|
||||
if (!gameWorld.isPlaying()) {
|
||||
if (!gameWorld.isPlaying() || !gameWorld.getDungeon().getRules().getState(GameRule.FOOD_LEVEL)) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user