mirror of
https://github.com/EngineHub/WorldGuard.git
synced 2024-12-25 10:37:41 +01:00
Added administrator notification functionality and flag for greets and farewells
This commit is contained in:
parent
79b937e8d2
commit
df7409607f
@ -20,6 +20,7 @@
|
||||
package com.sk89q.worldguard.protection;
|
||||
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import com.sk89q.worldguard.LocalPlayer;
|
||||
import com.sk89q.worldguard.bukkit.BukkitPlayer;
|
||||
@ -112,6 +113,9 @@ public void run() {
|
||||
if (newGreetMsg != null) {
|
||||
player.sendMessage(newGreetMsg);
|
||||
}
|
||||
if (regions.getBooleanFlag(FlagType.NOTIFY_GREET, false).getValue(false)) {
|
||||
broadcastNotification(ChatColor.YELLOW + "Player " + player.getName() + " entered region " + newRegionName);
|
||||
}
|
||||
nfo.lastFarewellMsg = farewellMsg;
|
||||
nfo.lastRegion = newRegionName;
|
||||
}
|
||||
@ -121,6 +125,9 @@ public void run() {
|
||||
player.sendMessage(nfo.lastFarewellMsg);
|
||||
nfo.lastFarewellMsg = null;
|
||||
}
|
||||
if (regions.getBooleanFlag(FlagType.NOTIFY_FAREWELL, false).getValue(false)) {
|
||||
broadcastNotification(ChatColor.YELLOW + "Player " + player.getName() + " left region " + nfo.lastRegion);
|
||||
}
|
||||
nfo.lastRegion = null;
|
||||
}
|
||||
}
|
||||
@ -134,6 +141,15 @@ public void run() {
|
||||
newLoc.setY(newLoc.getWorld().getHighestBlockYAt(newLoc) + 1);
|
||||
player.teleportTo(newLoc);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void broadcastNotification(String msg) {
|
||||
for (Player player : wg.getServer().getOnlinePlayers()) {
|
||||
if (wg.getWgConfiguration().hasPermission(player, "notify_onenter")) {
|
||||
player.sendMessage(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -38,9 +38,9 @@ public enum FlagType {
|
||||
|
||||
PASSTHROUGH, BUILD, PVP, MOB_DAMAGE, CREEPER_EXPLOSION,
|
||||
TNT, LIGHTER, FIRE_SPREAD, LAVA_FIRE, CHEST_ACCESS, WATER_FLOW,
|
||||
LEVER_AND_BUTTON, PLACE_VEHICLE, GREET_MESSAGE, FAREWELL_MESSAGE, DENY_SPAWN,
|
||||
HEAL_DELAY, HEAL_AMOUNT, TELE_LOC, TELE_PERM, SPAWN_LOC, SPAWN_PERM,
|
||||
BUYABLE, PRICE
|
||||
LEVER_AND_BUTTON, PLACE_VEHICLE, GREET_MESSAGE, FAREWELL_MESSAGE,
|
||||
NOTIFY_GREET, NOTIFY_FAREWELL, DENY_SPAWN, HEAL_DELAY, HEAL_AMOUNT,
|
||||
TELE_LOC, TELE_PERM, SPAWN_LOC, SPAWN_PERM, BUYABLE, PRICE
|
||||
|
||||
};
|
||||
|
||||
@ -72,6 +72,8 @@ public enum FlagType {
|
||||
registerFlag("gmsg", FlagType.GREET_MESSAGE, FlagDataType.STRING);
|
||||
registerFlag("fmsg", FlagType.FAREWELL_MESSAGE, FlagDataType.STRING);
|
||||
registerFlag("denyspawn", FlagType.DENY_SPAWN, FlagDataType.STRING);
|
||||
registerFlag("notifygreet", FlagType.NOTIFY_GREET, FlagDataType.BOOLEAN);
|
||||
registerFlag("notifyfarewell", FlagType.NOTIFY_GREET, FlagDataType.BOOLEAN);
|
||||
|
||||
registerFlag("teleloc", FlagType.TELE_LOC, FlagDataType.LOCATION);
|
||||
registerFlag("spawnloc", FlagType.SPAWN_LOC, FlagDataType.LOCATION);
|
||||
|
Loading…
Reference in New Issue
Block a user