Skip to content

Instantly share code, notes, and snippets.

@whilb
Last active January 3, 2016 18:09
Show Gist options
  • Save whilb/8500779 to your computer and use it in GitHub Desktop.
Save whilb/8500779 to your computer and use it in GitHub Desktop.
Example flight toggle command for bukkit
public boolean onCommand(CommandSender sender1, Command cmd1, String label, String[] args) {
if(sender1 instanceof Player) {
Player p = (Player)sender;
if (CommandLabel.equalsIgnoreCase("fly")) {
if (!p.isFlying()) {
p.setFlying(true);
p.sendMessage(ChatColor.DARK_AQUA + "[Fly] " + ChatColor.YELLOW + "Flight mode enabled!");
} else {
p.setFlying(false);
p.sendMessage(ChatColor.DARK_AQUA + "[Fly] " + ChatColor.YELLOW + "Flight mode disabled!");
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment