Skip to content

Instantly share code, notes, and snippets.

@aikar
Last active January 9, 2018 15:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aikar/420fbb563685580c643f4df35b562f9a to your computer and use it in GitHub Desktop.
Save aikar/420fbb563685580c643f4df35b562f9a to your computer and use it in GitHub Desktop.
this.getCommandConditions().addCondition(Residence.class, "serverowned", (contexts, execContext, res) -> {
if (res == null || !res.isServerOwned()) {
throw new ConditionFailedException("Must be server owned");
}
});
this.getCommandConditions().addCondition("creative", c -> {
Player player = c.getIssuer().getPlayer();
if (player == null || player.getGameMode() != GameMode.CREATIVE) {
throw new ConditionFailedException("Must be in Creative Mode");
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment