#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);
}
if (dungeonConfig != null) {
if (dungeonConfig != null && dungeonConfig.getOverrideValues() != null) {
finalRules.apply(dungeonConfig.getOverrideValues());
}
@ -203,7 +203,7 @@ public class Game {
finalRules.apply(floorConfig);
}
if (dungeonConfig != null) {
if (dungeonConfig != null && dungeonConfig.getDefaultValues() != null) {
finalRules.apply(dungeonConfig.getDefaultValues());
}

View File

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

View File

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