diff --git a/src/main/java/com/gmail/nossr50/config/AdvancedConfig.java b/src/main/java/com/gmail/nossr50/config/AdvancedConfig.java index 0d23c70dd..42ca3f3bc 100644 --- a/src/main/java/com/gmail/nossr50/config/AdvancedConfig.java +++ b/src/main/java/com/gmail/nossr50/config/AdvancedConfig.java @@ -280,4 +280,14 @@ public class AdvancedConfig extends AutoUpdateConfigLoader { public int getSpoutNotificationTier2() { return config.getInt("Spout.Notifications.Tier2", 400); } public int getSpoutNotificationTier3() { return config.getInt("Spout.Notifications.Tier3", 600); } 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); } } diff --git a/src/main/java/com/gmail/nossr50/runnables/skills/KrakenAttackTask.java b/src/main/java/com/gmail/nossr50/runnables/skills/KrakenAttackTask.java index 80ee3a9ce..7b3876991 100644 --- a/src/main/java/com/gmail/nossr50/runnables/skills/KrakenAttackTask.java +++ b/src/main/java/com/gmail/nossr50/runnables/skills/KrakenAttackTask.java @@ -7,6 +7,7 @@ import org.bukkit.entity.Player; import org.bukkit.entity.Squid; import org.bukkit.scheduler.BukkitRunnable; +import com.gmail.nossr50.config.AdvancedConfig; import com.gmail.nossr50.util.Misc; public class KrakenAttackTask extends BukkitRunnable { @@ -29,7 +30,7 @@ public class KrakenAttackTask extends BukkitRunnable { World world = player.getWorld(); 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.strikeLightningEffect(location); } diff --git a/src/main/java/com/gmail/nossr50/skills/fishing/FishingManager.java b/src/main/java/com/gmail/nossr50/skills/fishing/FishingManager.java index 7bd2f9abe..19d3049f9 100644 --- a/src/main/java/com/gmail/nossr50/skills/fishing/FishingManager.java +++ b/src/main/java/com/gmail/nossr50/skills/fishing/FishingManager.java @@ -66,7 +66,7 @@ public class FishingManager extends SkillManager { } private boolean unleashTheKraken() { - if (fishingTries < 50 || fishingTries <= Misc.getRandom().nextInt(200)) { + if (fishingTries < AdvancedConfig.getInstance().getKrakenTriesBeforeRelease() || fishingTries <= Misc.getRandom().nextInt(200)) { return false; } @@ -89,24 +89,28 @@ public class FishingManager extends SkillManager { 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()); - 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); - kraken.setCustomName("The Kraken"); - kraken.setMaxHealth(kraken.getMaxHealth() * 5); + kraken.setCustomName(AdvancedConfig.getInstance().getKrakenName()); + kraken.setMaxHealth(AdvancedConfig.getInstance().getKrakenHealth()); kraken.setHealth(kraken.getMaxHealth()); 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; return true; } public boolean exploitPrevention() { + if (!AdvancedConfig.getInstance().getKrakenEnabled()) { + return false; + } + long currentTime = System.currentTimeMillis(); boolean hasFished = currentTime < fishingTimestamp + FISHING_COOLDOWN_SECONDS; diff --git a/src/main/java/com/gmail/nossr50/util/MobHealthbarUtils.java b/src/main/java/com/gmail/nossr50/util/MobHealthbarUtils.java index e22eec8d3..6bf871710 100644 --- a/src/main/java/com/gmail/nossr50/util/MobHealthbarUtils.java +++ b/src/main/java/com/gmail/nossr50/util/MobHealthbarUtils.java @@ -8,6 +8,7 @@ import org.bukkit.event.entity.EntityDamageEvent; import org.bukkit.metadata.FixedMetadataValue; import com.gmail.nossr50.mcMMO; +import com.gmail.nossr50.config.AdvancedConfig; import com.gmail.nossr50.config.Config; import com.gmail.nossr50.datatypes.MobHealthbarType; import com.gmail.nossr50.datatypes.player.PlayerProfile; @@ -54,7 +55,7 @@ public final class MobHealthbarUtils { if (oldName == null) { oldName = ""; } - else if (oldName.equalsIgnoreCase("The Kraken")) { + else if (oldName.equalsIgnoreCase(AdvancedConfig.getInstance().getKrakenName())) { return; } diff --git a/src/main/resources/advanced.yml b/src/main/resources/advanced.yml index 5294edec9..7cb51e4b8 100644 --- a/src/main/resources/advanced.yml +++ b/src/main/resources/advanced.yml @@ -1,9 +1,9 @@ # # 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" # Configure at what level you get better with certain abilities. # @@ -411,4 +411,17 @@ Spout: Tier1: 200 Tier2: 400 Tier3: 600 - Tier4: 800 \ No newline at end of file + 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! \ No newline at end of file