mirror of
https://github.com/DRE2N/DungeonsXL.git
synced 2025-02-17 21:02:12 +01:00
Add difficulty game rule; resolves #621
This commit is contained in:
parent
38700a3c62
commit
12408d1e62
@ -33,6 +33,7 @@ import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import org.bukkit.Difficulty;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
|
||||
@ -69,9 +70,13 @@ public class GameRule<V> {
|
||||
*/
|
||||
public static final GameRule<GameGoal> GAME_GOAL = new GameRule<>(GameGoal.class, "gameGoal", GameGoal.END);
|
||||
/**
|
||||
* The game mode.
|
||||
* The Vanilla game mode.
|
||||
*/
|
||||
public static final GameRule<GameMode> GAME_MODE = new GameRule<>(GameMode.class, "gameMode", GameMode.SURVIVAL);
|
||||
/**
|
||||
* The Vanilla difficulty.
|
||||
*/
|
||||
public static final GameRule<Difficulty> DIFFICULTY = new GameRule<>(Difficulty.class, "difficulty", Difficulty.NORMAL);
|
||||
/**
|
||||
* If players may fly.
|
||||
*/
|
||||
|
@ -405,11 +405,12 @@ public class DGameWorld extends DInstanceWorld implements GameWorld {
|
||||
public void startGame() {
|
||||
GameWorldStartGameEvent event = new GameWorldStartGameEvent(this, (DGame) getGame());
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
|
||||
if (event.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
world.setDifficulty(getRules().getState(GameRule.DIFFICULTY));
|
||||
|
||||
isPlaying = true;
|
||||
|
||||
for (DungeonSign sign : getDungeonSigns()) {
|
||||
|
Loading…
Reference in New Issue
Block a user