disallow players on pvp timer to use bows

This commit is contained in:
NewGarbo 2016-02-23 16:14:56 +00:00
parent 41e140d5ca
commit 205e3885b8

View File

@ -8,6 +8,7 @@ import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.EntityShootBowEvent;
import org.bukkit.event.player.PlayerJoinEvent;
import mineplex.core.MiniClientPlugin;
@ -75,6 +76,23 @@ public class PvpTimer extends MiniClientPlugin<PvpTimerClient>
}, caller, "PvpTimer.Skipped");
}
@EventHandler
public void fireBow(EntityShootBowEvent event)
{
if (!(event.getEntity() instanceof Player))
{
return;
}
if (hasTimer((Player) event.getEntity()))
{
UtilPlayer.message(event.getEntity(), F.main("Clans", "You may not fire bows while on a PvP timer."));
UtilPlayer.message(event.getEntity(), C.cGoldB + "> " + C.cGold + "To permanently disable PvP Safety, type " + C.cGreen + "/pvp" + C.cGold + ".");
event.setCancelled(true);
}
}
@EventHandler
public void outYouGo(UpdateEvent event)
{
@ -94,14 +112,7 @@ public class PvpTimer extends MiniClientPlugin<PvpTimerClient>
UtilPlayer.message(player, " ");
UtilPlayer.message(player, C.cDRedB + ">>" + C.cRed + " You are not permitted to enter the Borderlands while under PvP Safety.");
new JsonMessage(C.cGoldB + "> " + C.cGold + "To permanently disable PvP Safety, click ")
.extra("here")
.color("yellow")
.click(ClickEvent.RUN_COMMAND, "/pvptimer yesiconfirmthatiwouldliketodisablemypvptimerforever")
.extra(".")
.color("gray")
.sendToPlayer(player);
UtilPlayer.message(player, C.cGoldB + "> " + C.cGold + "To permanently disable PvP Safety, type " + C.cGreen + "/pvp" + C.cGold + ".");
UtilPlayer.message(player, " ");
}