Added macro and colour support to deny-message

This commit is contained in:
Matthew Miller 2019-01-19 21:51:52 +10:00
parent 60731f9836
commit 84017bffc4

View File

@ -39,6 +39,7 @@
import com.sk89q.worldguard.bukkit.util.Events;
import com.sk89q.worldguard.bukkit.util.InteropUtils;
import com.sk89q.worldguard.bukkit.util.Materials;
import com.sk89q.worldguard.commands.CommandUtils;
import com.sk89q.worldguard.config.WorldConfiguration;
import com.sk89q.worldguard.domains.Association;
import com.sk89q.worldguard.internal.permission.RegionPermissionModel;
@ -111,6 +112,8 @@ private void tellErrorMessage(DelegateEvent event, Cause cause, Location locatio
if (lastTime == null || now - lastTime >= LAST_MESSAGE_DELAY) {
RegionQuery query = WorldGuard.getInstance().getPlatform().getRegionContainer().createQuery();
String message = query.queryValue(BukkitAdapter.adapt(location), localPlayer, Flags.DENY_MESSAGE);
message = WorldGuard.getInstance().getPlatform().getMatcher().replaceMacros(localPlayer, message);
message = CommandUtils.replaceColorMacros(message);
if (message != null && !message.isEmpty()) {
player.sendMessage(message.replace("%what%", what));
}