mirror of
https://github.com/Brettflan/WorldBorder.git
synced 2024-11-22 18:16:24 +01:00
Changed existing "deny-enderpearl" config setting to only deny ender pearls which are thrown past the border, and switched it to be enabled by default. Added new command /wb denypearl <on/off> to toggle the option on or off, which requires the new permission worldborder.denypearl to use.
This commit is contained in:
parent
cfaf955e9a
commit
fd161533d0
@ -27,7 +27,8 @@ public class BorderCheckTask implements Runnable
|
||||
|
||||
Player[] players = Bukkit.getServer().getOnlinePlayers();
|
||||
|
||||
for (int i = 0; i < players.length; i++){
|
||||
for (int i = 0; i < players.length; i++)
|
||||
{
|
||||
checkPlayer(players[i], null, false, true);
|
||||
}
|
||||
}
|
||||
|
@ -238,13 +238,7 @@ public class Config
|
||||
{
|
||||
return whooshEffect;
|
||||
}
|
||||
public static boolean getIfPlayerKill(){
|
||||
return killPlayer;
|
||||
}
|
||||
public static boolean getDenyEnderpearl()
|
||||
{
|
||||
return denyEnderpearl;
|
||||
}
|
||||
|
||||
public static void showWhooshEffect(Location loc)
|
||||
{
|
||||
if (!whooshEffect())
|
||||
@ -259,6 +253,23 @@ public class Config
|
||||
world.playEffect(loc, Effect.GHAST_SHOOT, 0);
|
||||
}
|
||||
|
||||
public static boolean getIfPlayerKill()
|
||||
{
|
||||
return killPlayer;
|
||||
}
|
||||
|
||||
public static boolean getDenyEnderpearl()
|
||||
{
|
||||
return denyEnderpearl;
|
||||
}
|
||||
|
||||
public static void setDenyEnderpearl(boolean enable)
|
||||
{
|
||||
denyEnderpearl = enable;
|
||||
Log("Direct cancellation of ender pearls thrown past the border " + (enable ? "enabled" : "disabled") + ".");
|
||||
save(true);
|
||||
}
|
||||
|
||||
public static void setPortalRedirection(boolean enable)
|
||||
{
|
||||
portalRedirection = enable;
|
||||
@ -532,7 +543,7 @@ public class Config
|
||||
dynmapMessage = cfg.getString("dynmap-border-message", "The border of the world.");
|
||||
LogConfig("Using " + (ShapeName()) + " border, knockback of " + knockBack + " blocks, and timer delay of " + timerTicks + ".");
|
||||
killPlayer = cfg.getBoolean("player-killed-bad-spawn", false);
|
||||
denyEnderpearl = cfg.getBoolean("deny-enderpearl", false);
|
||||
denyEnderpearl = cfg.getBoolean("deny-enderpearl", true);
|
||||
fillAutosaveFrequency = cfg.getInt("fill-autosave-frequency", 30);
|
||||
bypassPlayers = Collections.synchronizedSet(new LinkedHashSet<String>(cfg.getStringList("bypass-list")));
|
||||
fillMemoryTolerance = cfg.getInt("fill-memory-tolerance", 500);
|
||||
|
@ -405,6 +405,20 @@ public class WBCommand implements CommandExecutor
|
||||
}
|
||||
}
|
||||
|
||||
// "denypearl" command from player or console
|
||||
else if (split.length == 2 && split[0].equalsIgnoreCase("denypearl"))
|
||||
{
|
||||
if (!Config.HasPermission(player, "denypearl")) return true;
|
||||
|
||||
Config.setDenyEnderpearl(strAsBool(split[1]));
|
||||
|
||||
if (player != null)
|
||||
{
|
||||
Config.Log((Config.whooshEffect() ? "Enabling" : "Disabling") + " direct cancellation of ender pearls thrown past the border at the command of player \"" + player.getName() + "\".");
|
||||
sender.sendMessage("Direct cancellation of ender pearls thrown past the border " + enabledColored(Config.whooshEffect()) + ".");
|
||||
}
|
||||
}
|
||||
|
||||
// "knockback" command from player or console
|
||||
else if (split.length == 2 && split[0].equalsIgnoreCase("knockback"))
|
||||
{
|
||||
@ -889,6 +903,7 @@ public class WBCommand implements CommandExecutor
|
||||
sender.sendMessage(cmd+" bypasslist " + clrDesc + " - list players with border bypass enabled.");
|
||||
sender.sendMessage(cmd+" fillautosave " + clrReq + "<seconds>" + clrDesc + " - world save interval for Fill.");
|
||||
sender.sendMessage(cmd+" portal " + clrReq + "<on|off>" + clrDesc + " - turn portal redirection on or off.");
|
||||
sender.sendMessage(cmd+" denypearl " + clrReq + "<on|off>" + clrDesc + " - stop ender pearls thrown past the border.");
|
||||
sender.sendMessage(cmd+" reload" + clrDesc + " - re-load data from config.yml.");
|
||||
sender.sendMessage(cmd+" debug " + clrReq + "<on|off>" + clrDesc + " - turn console debug output on or off.");
|
||||
if (page == 4)
|
||||
|
@ -22,16 +22,18 @@ public class WBListener implements Listener
|
||||
if (Config.Debug())
|
||||
Config.Log("Teleport cause: "+event.getCause().toString());
|
||||
|
||||
if(event.getCause() == PlayerTeleportEvent.TeleportCause.ENDER_PEARL && Config.getDenyEnderpearl())
|
||||
{
|
||||
event.getPlayer().sendMessage(Config.Message());
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
Location newLoc = BorderCheckTask.checkPlayer(event.getPlayer(), event.getTo(), true, true);
|
||||
if (newLoc != null)
|
||||
{
|
||||
if(event.getCause() == PlayerTeleportEvent.TeleportCause.ENDER_PEARL && Config.getDenyEnderpearl())
|
||||
{
|
||||
event.getPlayer().sendMessage(Config.Message());
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
event.setTo(newLoc);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
|
||||
|
@ -37,6 +37,7 @@ commands:
|
||||
/<command> bypasslist - list players with border bypass enabled.
|
||||
/<command> remount <amount> - delay before remounting after knockback.
|
||||
/<command> fillautosave <seconds> - world save interval for Fill process.
|
||||
/<command> denypearl <on/off> - stop ender pearls thrown past the border.
|
||||
/<command> dynmap <on/off> - turn DynMap border display on or off.
|
||||
/<command> dynmapmsg <text> - DynMap border labels will show this.
|
||||
/<command> debug <on/off> - turn debug mode on or off.
|
||||
@ -68,6 +69,7 @@ permissions:
|
||||
worldborder.portal: true
|
||||
worldborder.remount: true
|
||||
worldborder.fillautosave: true
|
||||
worldborder.denypearl: true
|
||||
worldborder.set:
|
||||
description: Can set borders for any world
|
||||
default: op
|
||||
@ -140,3 +142,6 @@ permissions:
|
||||
worldborder.bypasslist:
|
||||
description: Can get list of players with border bypass enabled
|
||||
default: op
|
||||
worldborder.denypearl:
|
||||
description: Can enable/disable direct cancellation of ender pearls thrown past border
|
||||
default: op
|
||||
|
Loading…
Reference in New Issue
Block a user