Fix WECUI not working for players when rejoining the server. Closes #196.

This commit is contained in:
zml2008 2012-06-14 10:49:38 -07:00
parent 16a90d1b70
commit 3104b73682
2 changed files with 10 additions and 9 deletions

View File

@ -39,7 +39,7 @@ public CUIChannelListener(WorldEditPlugin plugin) {
@Override
public void onPluginMessageReceived(String channel, Player player, byte[] message) {
LocalSession session = plugin.getSession(player);
if (session.hasCUISupport()) { // Already initialized
if (session.hasCUISupport() && plugin.hasPluginChannelCUI(player.getName())) { // Already initialized
return;
}

View File

@ -25,7 +25,9 @@
import java.io.IOException;
import java.io.InputStream;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import java.util.jar.JarFile;
import java.util.zip.ZipEntry;
@ -73,7 +75,7 @@ public class WorldEditPlugin extends JavaPlugin {
/**
* Stores players who are using plugin channels for the cui
*/
private final Map<String, Boolean> pluginChannelCui = new HashMap<String, Boolean>();
private final Set<String> pluginChannelCui = new HashSet<String>();
/**
* Called on plugin enable.
@ -391,15 +393,14 @@ public void setSelection(Player player, Selection selection) {
}
public void setPluginChannelCUI(String name, boolean value) {
pluginChannelCui.put(name, value);
if (value) {
pluginChannelCui.add(name);
} else {
pluginChannelCui.remove(name);
}
}
public boolean hasPluginChannelCUI(String name) {
Boolean val = pluginChannelCui.get(name);
if (val == null) {
return false;
} else {
return val;
}
return pluginChannelCui.contains(name);
}
}