Update and enable Clans Freezing
This commit is contained in:
parent
f0db20dbc2
commit
2034b5536e
@ -19,6 +19,8 @@ import mineplex.core.recharge.Recharge;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.game.clans.clans.ban.commands.ClansBanCommand;
|
||||
import mineplex.game.clans.clans.ban.commands.FreezeCommand;
|
||||
import mineplex.game.clans.clans.ban.commands.UnfreezeCommand;
|
||||
import mineplex.game.clans.clans.event.ClansCommandExecutedEvent;
|
||||
import mineplex.minecraft.game.classcombat.Skill.event.SkillTriggerEvent;
|
||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
@ -35,6 +37,8 @@ import org.bukkit.event.player.AsyncPlayerPreLoginEvent;
|
||||
import org.bukkit.event.player.PlayerMoveEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
public class ClansBanManager extends MiniPlugin
|
||||
{
|
||||
@ -59,6 +63,8 @@ public class ClansBanManager extends MiniPlugin
|
||||
public void addCommands()
|
||||
{
|
||||
addCommand(new ClansBanCommand(this));
|
||||
addCommand(new FreezeCommand(this));
|
||||
addCommand(new UnfreezeCommand(this));
|
||||
}
|
||||
|
||||
public CoreClientManager getClientManager()
|
||||
@ -107,6 +113,7 @@ public class ClansBanManager extends MiniPlugin
|
||||
if (walkSpeed != null)
|
||||
{
|
||||
event.getPlayer().setWalkSpeed(walkSpeed);
|
||||
event.getPlayer().removePotionEffect(PotionEffectType.JUMP);
|
||||
for (Player staff : UtilServer.GetPlayers())
|
||||
{
|
||||
if (_clientManager.hasRank(staff, Rank.HELPER))
|
||||
@ -120,9 +127,10 @@ public class ClansBanManager extends MiniPlugin
|
||||
@EventHandler
|
||||
public void onMove(PlayerMoveEvent event)
|
||||
{
|
||||
if (isFrozen(event.getPlayer()) && UtilMath.offset2d(event.getFrom(), event.getTo()) >= 1)
|
||||
if (isFrozen(event.getPlayer()) && UtilMath.offset2d(event.getFrom().getBlock().getLocation(), event.getTo().getBlock().getLocation()) >= 1)
|
||||
{
|
||||
event.setCancelled(true);
|
||||
event.getPlayer().teleport(event.getFrom().getBlock().getLocation().add(0, 1, 0));
|
||||
}
|
||||
}
|
||||
|
||||
@ -167,12 +175,10 @@ public class ClansBanManager extends MiniPlugin
|
||||
if (event.getTarget() instanceof Player)
|
||||
{
|
||||
Player player = (Player) event.getTarget();
|
||||
if (!isFrozen(player))
|
||||
if (isFrozen(player))
|
||||
{
|
||||
return;
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@ -203,7 +209,7 @@ public class ClansBanManager extends MiniPlugin
|
||||
if (isFrozen(event.GetPlayer()))
|
||||
{
|
||||
event.SetCancelled(true);
|
||||
UtilPlayer.message(event.GetPlayer(), "You cannot use " + F.skill(event.GetSkillName()) + " while frozen!");
|
||||
UtilPlayer.message(event.GetPlayer(), F.main(getName(), "You cannot use " + F.skill(event.GetSkillName()) + " while frozen!"));
|
||||
}
|
||||
}
|
||||
|
||||
@ -249,6 +255,7 @@ public class ClansBanManager extends MiniPlugin
|
||||
{
|
||||
_frozen.put(player.getUniqueId(), player.getWalkSpeed());
|
||||
player.setWalkSpeed(0);
|
||||
player.addPotionEffect(new PotionEffect(PotionEffectType.JUMP, 999999, -10));
|
||||
for (Player alert : UtilServer.GetPlayers())
|
||||
{
|
||||
if (_clientManager.hasRank(alert, Rank.HELPER))
|
||||
@ -264,11 +271,17 @@ public class ClansBanManager extends MiniPlugin
|
||||
if (walkSpeed != null)
|
||||
{
|
||||
player.setWalkSpeed(walkSpeed);
|
||||
player.removePotionEffect(PotionEffectType.JUMP);
|
||||
for (Player alert : UtilServer.GetPlayers())
|
||||
{
|
||||
if (_clientManager.hasRank(alert, Rank.HELPER))
|
||||
{
|
||||
UtilPlayer.message(alert, F.main(getName(), F.elem(player.getName()) + " has been unfrozen by " + F.elem(staff.getName()) + "!"));
|
||||
continue;
|
||||
}
|
||||
if (alert.getName().equals(player.getName()))
|
||||
{
|
||||
UtilPlayer.message(alert, F.main(getName(), "You have been unfrozen!"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user