mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-26 07:06:45 +01:00
It's now possible to run away from the Kraken.
This commit is contained in:
parent
7ed218ee7f
commit
b07cf6bdde
@ -289,6 +289,8 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
|
||||
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 String getPlayerDefeatMessage() { return config.getString("Kraken.Defeated_Message.Killed", "You have slain the kraken!"); }
|
||||
public String getPlayerEscapeMessage() { return config.getString("Kraken.Defeated_Message.Escape", "You have escaped from the kraken!"); }
|
||||
public int getKrakenAttackInterval() { return config.getInt("Kraken.Attack_Interval_Seconds", 1); }
|
||||
public int getKrakenAttackDamage() { return config.getInt("Kraken.Attack_Damage", 1); }
|
||||
}
|
||||
|
@ -13,6 +13,7 @@ import com.gmail.nossr50.util.Misc;
|
||||
public class KrakenAttackTask extends BukkitRunnable {
|
||||
private Squid kraken;
|
||||
private Player player;
|
||||
private Location location;
|
||||
private final boolean GLOBAL_SOUNDS = AdvancedConfig.getInstance().getKrakenGlobalSoundsEnabled();
|
||||
|
||||
public KrakenAttackTask(Squid kraken, Player player) {
|
||||
@ -20,15 +21,57 @@ public class KrakenAttackTask extends BukkitRunnable {
|
||||
this.player = player;
|
||||
}
|
||||
|
||||
public KrakenAttackTask(Squid kraken, Player player, Location location) {
|
||||
this.kraken = kraken;
|
||||
this.player = player;
|
||||
this.location = location;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
if (location != null) {
|
||||
Location playerLocation = player.getLocation();
|
||||
|
||||
if (player.isValid() && playerLocation.getBlock().isLiquid()) {
|
||||
World world = player.getWorld();
|
||||
|
||||
player.damage(AdvancedConfig.getInstance().getKrakenAttackDamage(), kraken);
|
||||
|
||||
if (GLOBAL_SOUNDS) {
|
||||
world.playSound(playerLocation, Sound.GHAST_SCREAM, Misc.GHAST_VOLUME, Misc.getGhastPitch());
|
||||
}
|
||||
else {
|
||||
player.playSound(playerLocation, Sound.GHAST_SCREAM, Misc.GHAST_VOLUME, Misc.getGhastPitch());
|
||||
}
|
||||
|
||||
world.strikeLightningEffect(playerLocation);
|
||||
}
|
||||
else {
|
||||
player.sendMessage(AdvancedConfig.getInstance().getPlayerEscapeMessage());
|
||||
player.resetPlayerWeather();
|
||||
cancel();
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (!kraken.isValid()) {
|
||||
player.sendMessage(AdvancedConfig.getInstance().getPlayerDefeatMessage());
|
||||
player.resetPlayerWeather();
|
||||
this.cancel();
|
||||
cancel();
|
||||
}
|
||||
|
||||
if (player.isValid()) {
|
||||
Location location = player.getLocation();
|
||||
|
||||
if (!location.getBlock().isLiquid()) {
|
||||
player.sendMessage(AdvancedConfig.getInstance().getPlayerEscapeMessage());
|
||||
kraken.remove();
|
||||
player.resetPlayerWeather();
|
||||
cancel();
|
||||
return;
|
||||
}
|
||||
|
||||
World world = player.getWorld();
|
||||
|
||||
kraken.teleport(player);
|
||||
@ -41,12 +84,11 @@ public class KrakenAttackTask extends BukkitRunnable {
|
||||
player.playSound(location, Sound.GHAST_SCREAM, Misc.GHAST_VOLUME, Misc.getGhastPitch());
|
||||
}
|
||||
|
||||
world.playSound(location, Sound.GHAST_SCREAM, Misc.GHAST_VOLUME, Misc.getGhastPitch());
|
||||
world.strikeLightningEffect(location);
|
||||
}
|
||||
else {
|
||||
kraken.remove();
|
||||
this.cancel();
|
||||
cancel();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,6 @@ import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Effect;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
@ -66,6 +65,10 @@ public class FishingManager extends SkillManager {
|
||||
return Permissions.masterAngler(getPlayer());
|
||||
}
|
||||
|
||||
// public boolean unleashTheKraken() {
|
||||
//
|
||||
// }
|
||||
|
||||
private boolean unleashTheKraken() {
|
||||
if (fishingTries < AdvancedConfig.getInstance().getKrakenTriesBeforeRelease() || fishingTries <= Misc.getRandom().nextInt(200)) {
|
||||
return false;
|
||||
@ -102,14 +105,25 @@ public class FishingManager extends SkillManager {
|
||||
String globalMessage = AdvancedConfig.getInstance().getServerUnleashMessage();
|
||||
|
||||
if (!globalMessage.isEmpty()) {
|
||||
mcMMO.p.getServer().broadcastMessage(AdvancedConfig.getInstance().getServerUnleashMessage().replace("(PLAYER)", player.getDisplayName() + ChatColor.RED));
|
||||
mcMMO.p.getServer().broadcastMessage(ChatColor.RED + AdvancedConfig.getInstance().getServerUnleashMessage().replace("(PLAYER)", player.getDisplayName()));
|
||||
}
|
||||
|
||||
player.setItemInHand(null);
|
||||
|
||||
Squid kraken = (Squid) world.spawnEntity(player.getEyeLocation(), EntityType.SQUID);
|
||||
kraken.setCustomName(AdvancedConfig.getInstance().getKrakenName());
|
||||
kraken.remove();
|
||||
|
||||
if (!kraken.isValid()) {
|
||||
int attackInterval = AdvancedConfig.getInstance().getKrakenAttackInterval() * 20;
|
||||
new KrakenAttackTask(kraken, player, player.getLocation()).runTaskTimer(mcMMO.p, attackInterval, attackInterval);
|
||||
|
||||
fishingTries = 1;
|
||||
return true;
|
||||
}
|
||||
|
||||
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);
|
||||
|
@ -425,4 +425,7 @@ Kraken:
|
||||
Global_Sounds: true
|
||||
Unleashed_Message:
|
||||
Server: (PLAYER) has unleashed the kraken!
|
||||
Player: THE KRAKEN HAS BEEN UNLEASHED!
|
||||
Player: THE KRAKEN HAS BEEN UNLEASHED!
|
||||
Defeated_Message:
|
||||
Escape: You have escaped from the kraken!
|
||||
Killed: You have slain the kraken!
|
Loading…
Reference in New Issue
Block a user