Skip to content

Instantly share code, notes, and snippets.

@SuperSpyTX
Created December 5, 2012 23:07
Show Gist options
  • Save SuperSpyTX/4220350 to your computer and use it in GitHub Desktop.
Save SuperSpyTX/4220350 to your computer and use it in GitHub Desktop.
Yeah...whatever
public class Manager {
private Map<String, Boolean> yourmap = new HashMap<String, Boolean>();
// Some dummy function.
public void addToMap(String str, Boolean bool) {
yourmap.put(str, bool);
}
}
public class Listener {
private Manager varmanager; // This part.
// This part is important.
public Listener(Manager inst) {
manager = inst;
}
@EventHandler
public void onPlayerLogin(PlayerLoginEvent e) {
varmanager.addToMap(e.getPlayer().getName(), true); // See how varmanager is referenced instead of the class?
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment