Fixed a bug where Kraken messages couldn't be disabled.

Fixes #1174
This commit is contained in:
GJ 2013-09-12 15:53:43 -04:00
parent a49d373af0
commit de42063171
3 changed files with 20 additions and 7 deletions

View File

@ -1052,10 +1052,10 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
public int getKrakenTriesBeforeRelease() { return config.getInt("Kraken.Tries_Before_Release", 50); } public int getKrakenTriesBeforeRelease() { return config.getInt("Kraken.Tries_Before_Release", 50); }
public double getKrakenHealth() { return config.getDouble("Kraken.Health", 50.0D); } public double getKrakenHealth() { return config.getDouble("Kraken.Health", 50.0D); }
public String getKrakenName() { return config.getString("Kraken.Name", "The Kraken"); } public String getKrakenName() { return config.getString("Kraken.Name", "The Kraken"); }
public String getServerUnleashMessage() { return config.getString("Kraken.Unleashed_Message.Server", "(PLAYER) has unleashed the kraken!"); } public String getServerUnleashMessage() { return config.getString("Kraken.Unleashed_Message.Server", ""); }
public String getPlayerUnleashMessage() { return config.getString("Kraken.Unleashed_Message.Player", "THE KRAKEN HAS BEEN UNLEASHED!"); } public String getPlayerUnleashMessage() { return config.getString("Kraken.Unleashed_Message.Player", ""); }
public String getPlayerDefeatMessage() { return config.getString("Kraken.Defeated_Message.Killed", "You have slain the kraken!"); } public String getPlayerDefeatMessage() { return config.getString("Kraken.Defeated_Message.Killed", ""); }
public String getPlayerEscapeMessage() { return config.getString("Kraken.Defeated_Message.Escape", "You have escaped from the kraken!"); } public String getPlayerEscapeMessage() { return config.getString("Kraken.Defeated_Message.Escape", ""); }
public int getKrakenAttackInterval() { return config.getInt("Kraken.Attack_Interval_Seconds", 1); } public int getKrakenAttackInterval() { return config.getInt("Kraken.Attack_Interval_Seconds", 1); }
public double getKrakenAttackDamage() { return config.getDouble("Kraken.Attack_Damage", 1.0D); } public double getKrakenAttackDamage() { return config.getDouble("Kraken.Attack_Damage", 1.0D); }
} }

View File

@ -15,6 +15,8 @@ public class KrakenAttackTask extends BukkitRunnable {
private Player player; private Player player;
private Location location; private Location location;
private final boolean GLOBAL_SOUNDS = AdvancedConfig.getInstance().getKrakenGlobalSoundsEnabled(); private final boolean GLOBAL_SOUNDS = AdvancedConfig.getInstance().getKrakenGlobalSoundsEnabled();
private final String DEFEAT_MESSAGE = AdvancedConfig.getInstance().getPlayerDefeatMessage();
private final String ESCAPE_MESSAGE = AdvancedConfig.getInstance().getPlayerEscapeMessage();
public KrakenAttackTask(Creature kraken, Player player) { public KrakenAttackTask(Creature kraken, Player player) {
this.kraken = kraken; this.kraken = kraken;
@ -56,7 +58,10 @@ public class KrakenAttackTask extends BukkitRunnable {
} }
if (!kraken.isValid()) { if (!kraken.isValid()) {
player.sendMessage(AdvancedConfig.getInstance().getPlayerDefeatMessage()); if (!DEFEAT_MESSAGE.isEmpty()) {
player.sendMessage(DEFEAT_MESSAGE);
}
player.resetPlayerWeather(); player.resetPlayerWeather();
cancel(); cancel();
} }
@ -65,7 +70,10 @@ public class KrakenAttackTask extends BukkitRunnable {
Location location = player.getLocation(); Location location = player.getLocation();
if (!location.getBlock().isLiquid() && AdvancedConfig.getInstance().getKrakenEscapeAllowed()) { if (!location.getBlock().isLiquid() && AdvancedConfig.getInstance().getKrakenEscapeAllowed()) {
if (!ESCAPE_MESSAGE.isEmpty()) {
player.sendMessage(AdvancedConfig.getInstance().getPlayerEscapeMessage()); player.sendMessage(AdvancedConfig.getInstance().getPlayerEscapeMessage());
}
kraken.remove(); kraken.remove();
player.resetPlayerWeather(); player.resetPlayerWeather();
cancel(); cancel();

View File

@ -103,7 +103,12 @@ public class FishingManager extends SkillManager {
world.strikeLightningEffect(location); world.strikeLightningEffect(location);
world.strikeLightningEffect(location); world.strikeLightningEffect(location);
world.strikeLightningEffect(location); world.strikeLightningEffect(location);
player.sendMessage(AdvancedConfig.getInstance().getPlayerUnleashMessage());
String unleashMessage = AdvancedConfig.getInstance().getPlayerUnleashMessage();
if (!unleashMessage.isEmpty()) {
player.sendMessage(unleashMessage);
}
if (AdvancedConfig.getInstance().getKrakenGlobalSoundsEnabled()) { if (AdvancedConfig.getInstance().getKrakenGlobalSoundsEnabled()) {
world.playSound(location, Sound.GHAST_SCREAM, Misc.GHAST_VOLUME, Misc.getGhastPitch()); world.playSound(location, Sound.GHAST_SCREAM, Misc.GHAST_VOLUME, Misc.getGhastPitch());