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

Dieser Commit ist enthalten in:
zml2008 2012-06-14 10:49:38 -07:00
Ursprung 16a90d1b70
Commit 3104b73682
2 geänderte Dateien mit 10 neuen und 9 gelöschten Zeilen

Datei anzeigen

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

Datei anzeigen

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