Skip to content

Instantly share code, notes, and snippets.

@konsolas
Last active November 1, 2015 21:07
Show Gist options
  • Save konsolas/e013cedc78bdf44d829a to your computer and use it in GitHub Desktop.
Save konsolas/e013cedc78bdf44d829a to your computer and use it in GitHub Desktop.
-_-
public class AACWrapper implements Listener {
private final Set<UUID> exempt = new HashSet<>();
public AACWrapper(JavaPlugin plugin) {
plugin.getServer().getPluginManager().registerEvents(this, plugin);
}
public void exemptPlayer(Player player) {
exempt.add(player.getUniqueId());
}
public boolean isExempt(Player player) {
return exempt.contains(player.getUniqueId());
}
public boolean unexempt(Player player) {
exempt.remove(player.getUniqueId());
}
@EventHandler
public void onPlayerViolation(PlayerViolationEvent event) {
if(isExempt(event.getPlayer())) {
event.setCancelled(true);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment