heal pool (not tested; however, this should be working)
This commit is contained in:
parent
9b061317a7
commit
c2376ffb5c
@ -21,6 +21,7 @@ import rip.tilly.bedwars.generators.GeneratorType;
|
||||
import rip.tilly.bedwars.playerdata.PlayerData;
|
||||
import rip.tilly.bedwars.utils.CC;
|
||||
import rip.tilly.bedwars.utils.CustomLocation;
|
||||
import rip.tilly.bedwars.utils.LocationUtils;
|
||||
import rip.tilly.bedwars.utils.TimeUtils;
|
||||
|
||||
import java.util.*;
|
||||
|
@ -6,6 +6,8 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerMoveEvent;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
import rip.tilly.bedwars.BedWars;
|
||||
import rip.tilly.bedwars.events.PlayerKillEvent;
|
||||
import rip.tilly.bedwars.game.Game;
|
||||
@ -15,6 +17,7 @@ import rip.tilly.bedwars.playerdata.PlayerData;
|
||||
import rip.tilly.bedwars.playerdata.PlayerState;
|
||||
import rip.tilly.bedwars.upgrades.Upgrade;
|
||||
import rip.tilly.bedwars.utils.CC;
|
||||
import rip.tilly.bedwars.utils.LocationUtils;
|
||||
|
||||
public class MovementListener implements Listener {
|
||||
|
||||
@ -36,6 +39,7 @@ public class MovementListener implements Listener {
|
||||
|
||||
if (playerData == null) {
|
||||
this.plugin.getLogger().warning(player.getName() + "'s player data is null");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@ -48,29 +52,48 @@ public class MovementListener implements Listener {
|
||||
}
|
||||
|
||||
Game game = this.plugin.getGameManager().getGame(player.getUniqueId());
|
||||
|
||||
if (game == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
Location to = event.getTo();
|
||||
Location from = event.getFrom();
|
||||
|
||||
if (game.getGameState() == GameState.STARTING) {
|
||||
if (to.getX() != from.getX() || to.getZ() != from.getZ()) {
|
||||
player.teleport(from);
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
GameTeam playerTeam = game.getTeams().get(playerData.getTeamId() == 0 ? 0 : 1);
|
||||
GameTeam opposingTeam = game.getTeams().get(playerData.getTeamId() == 0 ? 1 : 0);
|
||||
|
||||
if (game.getGameState() != GameState.ENDING) {
|
||||
if (playerTeam.getPlayerTeam().getTeamUpgrades().getLevelForUpgrade(Upgrade.HEAL_POOL) != 0) {
|
||||
if (game.isInside(player.getLocation(), game)) {
|
||||
if (!player.getActivePotionEffects().contains(PotionEffectType.REGENERATION)) {
|
||||
player.addPotionEffect(new PotionEffect(PotionEffectType.REGENERATION, 1000000, 0));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (opposingTeam.getPlayerTeam().getTeamUpgrades().getLevelForUpgrade(Upgrade.TRAP) != 0) {
|
||||
if (player.getLocation().distance((playerData.getTeamId() == 0 ? game.getCopiedArena().getA().toBukkitLocation() : game.getCopiedArena().getB().toBukkitLocation())) < 15) {
|
||||
opposingTeam.getPlayerTeam().getTeamUpgrades().getUpgrades().remove(Upgrade.TRAP);
|
||||
|
||||
opposingTeam.playingPlayers().forEach(enemyPlayer -> enemyPlayer.sendMessage(CC.translate("&cYour trap has been activated")));
|
||||
player.addPotionEffect(new PotionEffect(PotionEffectType.SLOW_DIGGING, 100, 5));
|
||||
|
||||
opposingTeam.playingPlayers().forEach(enemyPlayer -> {
|
||||
enemyPlayer.sendMessage(CC.translate("&cYour trap has been activated"));
|
||||
});
|
||||
|
||||
game.broadcastTitleToOneTeam("&cTRAP ACTIVATED", "&eYour trap has been activated", opposingTeam);
|
||||
}
|
||||
}
|
||||
|
||||
if (player.getLocation().getY() <= game.getArena().getDeadZone()) {
|
||||
Player killer = playerData.getLastDamager();
|
||||
if (killer != null) {
|
||||
|
Loading…
Reference in New Issue
Block a user