qa changes to pvp safety

This commit is contained in:
NewGarbo 2015-12-16 22:48:55 +00:00
parent d619a9644b
commit 2ee1ccbcf9
4 changed files with 58 additions and 8 deletions

View File

@ -65,7 +65,9 @@ public class ClansDisplay extends MiniPlugin
boolean safe = Clans.getClanUtility().isSafe(player); boolean safe = Clans.getClanUtility().isSafe(player);
UtilServer.getServer().getPluginManager().callEvent(new PlayerEnterTerritoryEvent(player, client.getOwner(), owner, owner.equals("Wilderness") ? false : Clans.getClanUtility().getClaim(player.getLocation()).isSafe(player.getLocation()))); PlayerEnterTerritoryEvent event = new PlayerEnterTerritoryEvent(player, client.getOwner(), owner, owner.equals("Wilderness") ? false : Clans.getClanUtility().getClaim(player.getLocation()).isSafe(player.getLocation()), true);
UtilServer.getServer().getPluginManager().callEvent(event);
if (!client.isMapOn()) if (!client.isMapOn())
{ {
@ -87,13 +89,13 @@ public class ClansDisplay extends MiniPlugin
if (showChange) if (showChange)
{ {
displayOwner(player); if (event.willSendMessage()) displayOwner(player);
// Event
} }
} }
else else
{ {
displayOwner(player); if (event.willSendMessage()) displayOwner(player);
displayMap(player); displayMap(player);
} }
} }

View File

@ -12,9 +12,11 @@ public class PlayerEnterTerritoryEvent extends Event
private String _lastTerritory; private String _lastTerritory;
private Player _player; private Player _player;
private boolean _sendMessage;
private boolean _safe; private boolean _safe;
public PlayerEnterTerritoryEvent(Player player, String lastTerritory, String newTerritory, boolean safe) public PlayerEnterTerritoryEvent(Player player, String lastTerritory, String newTerritory, boolean safe, boolean sendMessage)
{ {
_player = player; _player = player;
_lastTerritory = lastTerritory; _lastTerritory = lastTerritory;
@ -27,6 +29,16 @@ public class PlayerEnterTerritoryEvent extends Event
return _player; return _player;
} }
public boolean willSendMessage()
{
return _sendMessage;
}
public void setSendMessage(boolean flag)
{
_sendMessage = flag;
}
public String getLastTerritory() public String getLastTerritory()
{ {
return _lastTerritory; return _lastTerritory;

View File

@ -11,6 +11,8 @@ import org.bukkit.event.EventPriority;
import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerJoinEvent;
import mineplex.core.MiniClientPlugin; import mineplex.core.MiniClientPlugin;
import mineplex.core.common.jsonchat.ClickEvent;
import mineplex.core.common.jsonchat.JsonMessage;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.common.util.Callback; import mineplex.core.common.util.Callback;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
@ -26,6 +28,7 @@ import mineplex.core.updater.event.UpdateEvent;
import mineplex.game.clans.clans.ClanTips.TipType; import mineplex.game.clans.clans.ClanTips.TipType;
import mineplex.game.clans.clans.ClansManager; import mineplex.game.clans.clans.ClansManager;
import mineplex.game.clans.clans.event.ClanTipEvent; import mineplex.game.clans.clans.event.ClanTipEvent;
import mineplex.game.clans.clans.event.PlayerEnterTerritoryEvent;
import mineplex.game.clans.clans.playtime.Playtime; import mineplex.game.clans.clans.playtime.Playtime;
import mineplex.game.clans.clans.playtime.command.cemde; import mineplex.game.clans.clans.playtime.command.cemde;
import mineplex.game.clans.clans.pvptimer.command.PvPTimerCommand; import mineplex.game.clans.clans.pvptimer.command.PvPTimerCommand;
@ -85,14 +88,46 @@ public class PvpTimer extends MiniClientPlugin<PvpTimerClient>
if (territory != null && territory.Owner.equals("Borderlands")) if (territory != null && territory.Owner.equals("Borderlands"))
{ {
UtilAction.velocity(player, UtilAlg.getTrajectory2d(player.getLocation(), Spawn.ORIGIN), 2.6, true, 0.5, 1, 1.35, true);
player.playSound(player.getLocation(), Sound.NOTE_BASS, 1.0f, 1.0f); player.playSound(player.getLocation(), Sound.NOTE_BASS, 1.0f, 1.0f);
UtilAction.velocity(player, UtilAlg.getTrajectory2d(player.getLocation(), Spawn.ORIGIN), 2.6, true, 1, 1.5, 999, true);
UtilPlayer.message(player, C.cDRedB + "Clans>" + C.cRed + " You are not permitted to enter the Borderlands while safe from PvP. To disable, type " + F.elem("/pvp") + "."); UtilPlayer.message(player, " ");
UtilPlayer.message(player, C.cDRedB + ">>" + C.cRed + " You are not permitted to enter the Borderlands while under PvP Safety.");
// UtilPlayer.jsonMessage(player,
//
// C.cGoldB + "> " + C.cGold + "To permanently disable PvP Safety, click [['" + C.cYellow + "here'],['click',['/pvptimer yesiconfirmthatiwouldliketodisablemypvptimerforever']]] " + C.cGold + "."
//
// );
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, " ");
} }
} }
} }
} }
@EventHandler
public void territoryEnter(PlayerEnterTerritoryEvent event)
{
String from = event.getLastTerritory();
String to = event.getNewTerritory();
if (from == null && "Borderlands".equals(to)
|| to == null && "Borderlands".equals(from))
{
event.setSendMessage(false);
}
}
@EventHandler @EventHandler
public void clanTip(ClanTipEvent event) public void clanTip(ClanTipEvent event)
{ {

View File

@ -54,6 +54,7 @@ public class PvPTimerCommand extends CommandBase<PvpTimer>
{ {
Plugin.disableFor(caller); Plugin.disableFor(caller);
UtilPlayer.message(caller, F.main("Clans", "You have disabled PvP Safety.")); UtilPlayer.message(caller, F.main("Clans", "You have disabled PvP Safety."));
UtilPlayer.message(caller, F.main("Clans", "You are now completely open to attacks, and you can also attack others."));
} }
} }
} }