mirror of
https://github.com/EngineHub/WorldEdit.git
synced 2024-12-21 04:49:51 +08:00
Fix WECUI not working for players when rejoining the server. Closes #196.
This commit is contained in:
parent
16a90d1b70
commit
3104b73682
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user