mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-26 07:06:45 +01:00
Configure the Kraken!
This commit is contained in:
parent
6d6bc3de76
commit
0574de4a29
@ -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); }
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -412,3 +412,16 @@ Spout:
|
||||
Tier2: 400
|
||||
Tier3: 600
|
||||
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!
|
Loading…
Reference in New Issue
Block a user