From 2ed92dafadb67b2dd2a207a9085769359974993c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jim=20Nordb=C3=B8?= Date: Sat, 7 Apr 2012 12:15:42 +0200 Subject: [PATCH] Added WECUI handshake option --- src/main/java/com/sk89q/worldedit/LocalConfiguration.java | 1 + src/main/java/com/sk89q/worldedit/bukkit/BukkitPlayer.java | 6 ++++-- .../com/sk89q/worldedit/util/PropertiesConfiguration.java | 1 + .../java/com/sk89q/worldedit/util/YAMLConfiguration.java | 1 + src/main/resources/config.yml | 3 ++- 5 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/sk89q/worldedit/LocalConfiguration.java b/src/main/java/com/sk89q/worldedit/LocalConfiguration.java index b1cac8eb8..d10ed86ec 100644 --- a/src/main/java/com/sk89q/worldedit/LocalConfiguration.java +++ b/src/main/java/com/sk89q/worldedit/LocalConfiguration.java @@ -78,6 +78,7 @@ public abstract class LocalConfiguration { }; public boolean profile = false; + public boolean enableWECUI = true; public Set disallowedBlocks = new HashSet(); public int defaultChangeLimit = -1; public int maxChangeLimit = -1; diff --git a/src/main/java/com/sk89q/worldedit/bukkit/BukkitPlayer.java b/src/main/java/com/sk89q/worldedit/bukkit/BukkitPlayer.java index 22307800f..503bf2b45 100644 --- a/src/main/java/com/sk89q/worldedit/bukkit/BukkitPlayer.java +++ b/src/main/java/com/sk89q/worldedit/bukkit/BukkitPlayer.java @@ -137,13 +137,15 @@ public class BukkitPlayer extends LocalPlayer { if (plugin.hasPluginChannelCUI(getName())) { player.sendPluginMessage(plugin, WorldEditPlugin.CUI_PLUGIN_CHANNEL, send.getBytes(CUIChannelListener.UTF_8_CHARSET)); } else { - player.sendRawMessage("\u00A75\u00A76\u00A74\u00A75" + send); + if (plugin.getLocalConfiguration().enableWECUI) { + player.sendRawMessage("\u00A75\u00A76\u00A74\u00A75" + send); + } } } @Override public void dispatchCUIHandshake() { - if (!plugin.hasPluginChannelCUI(getName())) { + if (!plugin.hasPluginChannelCUI(getName()) && plugin.getLocalConfiguration().enableWECUI) { player.sendRawMessage("\u00A75\u00A76\u00A74\u00A75"); player.sendRawMessage("\u00A74\u00A75\u00A73\u00A74"); } diff --git a/src/main/java/com/sk89q/worldedit/util/PropertiesConfiguration.java b/src/main/java/com/sk89q/worldedit/util/PropertiesConfiguration.java index 50a173868..2a662c7b8 100644 --- a/src/main/java/com/sk89q/worldedit/util/PropertiesConfiguration.java +++ b/src/main/java/com/sk89q/worldedit/util/PropertiesConfiguration.java @@ -77,6 +77,7 @@ public class PropertiesConfiguration extends LocalConfiguration { } profile = getBool("profile", profile); + enableWECUI = getBool("enable-wecui-handshake", enableWECUI); disallowedBlocks = getIntSet("disallowed-blocks", defaultDisallowedBlocks); defaultChangeLimit = getInt("default-max-changed-blocks", defaultChangeLimit); maxChangeLimit = getInt("max-changed-blocks", maxChangeLimit); diff --git a/src/main/java/com/sk89q/worldedit/util/YAMLConfiguration.java b/src/main/java/com/sk89q/worldedit/util/YAMLConfiguration.java index f1a9fcfe7..95846d5f3 100644 --- a/src/main/java/com/sk89q/worldedit/util/YAMLConfiguration.java +++ b/src/main/java/com/sk89q/worldedit/util/YAMLConfiguration.java @@ -59,6 +59,7 @@ public class YAMLConfiguration extends LocalConfiguration { showFirstUseVersion = false; profile = config.getBoolean("debug", profile); + enableWECUI = config.getBoolean("enable-wecui-handshake", enableWECUI); wandItem = config.getInt("wand-item", wandItem); defaultChangeLimit = Math.max(-1, config.getInt( "limits.max-blocks-changed.default", defaultChangeLimit)); diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index 42c6f11f2..c8f550fb2 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -61,4 +61,5 @@ wand-item: 271 shell-save-type: no-double-slash: false no-op-permissions: false -debug: false \ No newline at end of file +debug: false +enable-wecui-handshake: true \ No newline at end of file