#61: Some fixes

This commit is contained in:
Daniel Saukel 2016-05-11 15:11:42 +02:00
parent a4f04ab92b
commit 70b4d16be5
3 changed files with 25 additions and 23 deletions

View File

@ -195,7 +195,7 @@ public class Game {
finalRules.apply(type); finalRules.apply(type);
} }
if (dungeonConfig != null) { if (dungeonConfig != null && dungeonConfig.getOverrideValues() != null) {
finalRules.apply(dungeonConfig.getOverrideValues()); finalRules.apply(dungeonConfig.getOverrideValues());
} }
@ -203,7 +203,7 @@ public class Game {
finalRules.apply(floorConfig); finalRules.apply(floorConfig);
} }
if (dungeonConfig != null) { if (dungeonConfig != null && dungeonConfig.getDefaultValues() != null) {
finalRules.apply(dungeonConfig.getDefaultValues()); finalRules.apply(dungeonConfig.getDefaultValues());
} }

View File

@ -520,7 +520,9 @@ public class DGamePlayer extends DInstancePlayer {
} }
// Respawn Items // Respawn Items
if (Game.getByWorld(getWorld()).getRules().getKeepInventoryOnDeath()) { Game game = Game.getByWorld(getWorld());
if (game != null && game.getRules().getKeepInventoryOnDeath()) {
applyRespawnInventory(); applyRespawnInventory();
} }
} }

View File

@ -464,6 +464,7 @@ public class DGroup {
if (game == null) { if (game == null) {
return; return;
} }
game.fetchRules();
for (DGroup dGroup : game.getDGroups()) { for (DGroup dGroup : game.getDGroups()) {
if (dGroup == null) { if (dGroup == null) {
@ -521,31 +522,30 @@ public class DGroup {
} }
} }
GameRules rules = gameWorld.getGame().getRules(); GameRules rules = game.getRules();
if (rules != null) {
for (Requirement requirement : rules.getRequirements()) {
RequirementDemandEvent requirementDemandEvent = new RequirementDemandEvent(requirement, player);
plugin.getServer().getPluginManager().callEvent(event);
if (requirementDemandEvent.isCancelled()) { for (Requirement requirement : rules.getRequirements()) {
continue; RequirementDemandEvent requirementDemandEvent = new RequirementDemandEvent(requirement, player);
} plugin.getServer().getPluginManager().callEvent(event);
requirement.demand(player); if (requirementDemandEvent.isCancelled()) {
continue;
} }
GameType gameType = game.getType(); requirement.demand(player);
if (gameType == GameTypeDefault.DEFAULT) { }
player.setGameMode(rules.getGameMode());
if (rules.isTimeIsRunning()) {
timeIsRunningTask = new TimeIsRunningTask(this, rules.getTimeToFinish()).runTaskTimer(plugin, 20, 20);
}
} else { GameType gameType = game.getType();
player.setGameMode(gameType.getGameMode()); if (gameType == GameTypeDefault.DEFAULT) {
if (gameType.getShowTime()) { player.setGameMode(rules.getGameMode());
timeIsRunningTask = new TimeIsRunningTask(this, rules.getTimeToFinish()).runTaskTimer(plugin, 20, 20); if (rules.isTimeIsRunning()) {
} timeIsRunningTask = new TimeIsRunningTask(this, rules.getTimeToFinish()).runTaskTimer(plugin, 20, 20);
}
} else {
player.setGameMode(gameType.getGameMode());
if (gameType.getShowTime()) {
timeIsRunningTask = new TimeIsRunningTask(this, rules.getTimeToFinish()).runTaskTimer(plugin, 20, 20);
} }
} }