Configure the Kraken!

This commit is contained in:
GJ 2013-05-02 07:56:29 -04:00
parent 6d6bc3de76
commit 0574de4a29
5 changed files with 42 additions and 13 deletions

View File

@ -280,4 +280,14 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
public int getSpoutNotificationTier2() { return config.getInt("Spout.Notifications.Tier2", 400); } public int getSpoutNotificationTier2() { return config.getInt("Spout.Notifications.Tier2", 400); }
public int getSpoutNotificationTier3() { return config.getInt("Spout.Notifications.Tier3", 600); } public int getSpoutNotificationTier3() { return config.getInt("Spout.Notifications.Tier3", 600); }
public int getSpoutNotificationTier4() { return config.getInt("Spout.Notifications.Tier4", 800); } public int getSpoutNotificationTier4() { return config.getInt("Spout.Notifications.Tier4", 800); }
/* KRAKEN STUFF */
public boolean getKrakenEnabled() { return config.getBoolean("Kraken.Enabled", true); }
public int getKrakenTriesBeforeRelease() { return config.getInt("Kraken.Tries_Before_Release", 50); }
public int getKrakenHealth() { return config.getInt("Kraken.Health", 50); }
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 getPlayerUnleashMessage() { return config.getString("Kraken.Unleashed_Message.Player", "THE KRAKEN HAS BEEN UNLEASHED!"); }
public int getKrakenAttackInterval() { return config.getInt("Kraken.Attack_Interval_Seconds", 1); }
public int getKrakenAttackDamage() { return config.getInt("Kraken.Attack_Damage", 1); }
} }

View File

@ -7,6 +7,7 @@ import org.bukkit.entity.Player;
import org.bukkit.entity.Squid; import org.bukkit.entity.Squid;
import org.bukkit.scheduler.BukkitRunnable; import org.bukkit.scheduler.BukkitRunnable;
import com.gmail.nossr50.config.AdvancedConfig;
import com.gmail.nossr50.util.Misc; import com.gmail.nossr50.util.Misc;
public class KrakenAttackTask extends BukkitRunnable { public class KrakenAttackTask extends BukkitRunnable {
@ -29,7 +30,7 @@ public class KrakenAttackTask extends BukkitRunnable {
World world = player.getWorld(); World world = player.getWorld();
kraken.teleport(player); kraken.teleport(player);
player.damage(1, kraken); player.damage(AdvancedConfig.getInstance().getKrakenAttackDamage(), kraken);
world.playSound(location, Sound.GHAST_SCREAM, Misc.GHAST_VOLUME, Misc.getGhastPitch()); world.playSound(location, Sound.GHAST_SCREAM, Misc.GHAST_VOLUME, Misc.getGhastPitch());
world.strikeLightningEffect(location); world.strikeLightningEffect(location);
} }

View File

@ -66,7 +66,7 @@ public class FishingManager extends SkillManager {
} }
private boolean unleashTheKraken() { private boolean unleashTheKraken() {
if (fishingTries < 50 || fishingTries <= Misc.getRandom().nextInt(200)) { if (fishingTries < AdvancedConfig.getInstance().getKrakenTriesBeforeRelease() || fishingTries <= Misc.getRandom().nextInt(200)) {
return false; return false;
} }
@ -89,24 +89,28 @@ 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("THE KRAKEN HAS BEEN UNLEASHED!"); player.sendMessage(AdvancedConfig.getInstance().getPlayerUnleashMessage());
world.playSound(location, Sound.GHAST_SCREAM, Misc.GHAST_VOLUME, Misc.getGhastPitch()); world.playSound(location, Sound.GHAST_SCREAM, Misc.GHAST_VOLUME, Misc.getGhastPitch());
mcMMO.p.getServer().broadcastMessage(player.getDisplayName() + ChatColor.RED + " has unleashed the kraken!"); mcMMO.p.getServer().broadcastMessage(AdvancedConfig.getInstance().getServerUnleashMessage().replace("[PLAYER]", player.getDisplayName() + ChatColor.RED));
Squid kraken = (Squid) world.spawnEntity(player.getEyeLocation(), EntityType.SQUID); Squid kraken = (Squid) world.spawnEntity(player.getEyeLocation(), EntityType.SQUID);
kraken.setCustomName("The Kraken"); kraken.setCustomName(AdvancedConfig.getInstance().getKrakenName());
kraken.setMaxHealth(kraken.getMaxHealth() * 5); kraken.setMaxHealth(AdvancedConfig.getInstance().getKrakenHealth());
kraken.setHealth(kraken.getMaxHealth()); kraken.setHealth(kraken.getMaxHealth());
player.setItemInHand(null); player.setItemInHand(null);
int attackInterval = AdvancedConfig.getInstance().getKrakenAttackInterval() * 20;
new KrakenAttackTask(kraken, player).runTaskTimer(mcMMO.p, attackInterval, attackInterval);
new KrakenAttackTask(kraken, player).runTaskTimer(mcMMO.p, 20L, 20L);
fishingTries = 1; fishingTries = 1;
return true; return true;
} }
public boolean exploitPrevention() { public boolean exploitPrevention() {
if (!AdvancedConfig.getInstance().getKrakenEnabled()) {
return false;
}
long currentTime = System.currentTimeMillis(); long currentTime = System.currentTimeMillis();
boolean hasFished = currentTime < fishingTimestamp + FISHING_COOLDOWN_SECONDS; boolean hasFished = currentTime < fishingTimestamp + FISHING_COOLDOWN_SECONDS;

View File

@ -8,6 +8,7 @@ import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.metadata.FixedMetadataValue; import org.bukkit.metadata.FixedMetadataValue;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.config.AdvancedConfig;
import com.gmail.nossr50.config.Config; import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.datatypes.MobHealthbarType; import com.gmail.nossr50.datatypes.MobHealthbarType;
import com.gmail.nossr50.datatypes.player.PlayerProfile; import com.gmail.nossr50.datatypes.player.PlayerProfile;
@ -54,7 +55,7 @@ public final class MobHealthbarUtils {
if (oldName == null) { if (oldName == null) {
oldName = ""; oldName = "";
} }
else if (oldName.equalsIgnoreCase("The Kraken")) { else if (oldName.equalsIgnoreCase(AdvancedConfig.getInstance().getKrakenName())) {
return; return;
} }

View File

@ -1,9 +1,9 @@
# #
# Advanced configuration # Advanced configuration
#
# For advanced users only! There is no need to change anything here.
# #
# You can customize almost every aspect of every skill here. # For advanced users only! There is no need to change anything here.
#
# You can customize almost every aspect of every skill here.
# Its mainly here if you've changed "Experience.Formula.Curve_Modifier" # Its mainly here if you've changed "Experience.Formula.Curve_Modifier"
# Configure at what level you get better with certain abilities. # Configure at what level you get better with certain abilities.
# #
@ -411,4 +411,17 @@ Spout:
Tier1: 200 Tier1: 200
Tier2: 400 Tier2: 400
Tier3: 600 Tier3: 600
Tier4: 800 Tier4: 800
Kraken:
#
# Customize the kraken!
###
Enabled: true
Tries_Before_Release: 50
Health: 50
Name: The Kraken
Attack_Interval_Seconds: 1
Attack_Damage: 1
Unleashed_Message:
Server: [PLAYER] has unleashed the kraken!
Player: THE KRAKEN HAS BEEN UNLEASHED!