Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package net.skyburn.global.command;
- import net.skyburn.skyblock.SkyBlock;
- import org.bukkit.Bukkit;
- import org.bukkit.command.Command;
- import org.bukkit.command.CommandExecutor;
- import org.bukkit.command.CommandSender;
- import org.bukkit.entity.Player;
- /**
- * Created by Philipp on 07.10.2015
- */
- public class C_Fliegen implements CommandExecutor {
- private SkyBlock plugin;
- public C_Fliegen(SkyBlock plugin) {
- this.plugin = plugin;
- }
- @Override
- public boolean onCommand(CommandSender sender, Command cmd, String label,
- String[] args) {
- if (cmd.getName().equalsIgnoreCase("fliegen")) {
- if (sender instanceof Player) {
- Player p = (Player) sender;
- if (p.hasPermission("skyblock.fliegen")) {
- if (args.length == 0) {
- if (p.getAllowFlight() == true) {
- p.setFlying(false);
- p.setAllowFlight(false);
- p.sendMessage(plugin.skyburn
- + "Du kannst nun nicht mehr Fliegen.");
- } else if (p.getAllowFlight() == false) {
- p.setAllowFlight(true);
- p.sendMessage(plugin.skyburn
- + "Du kannst nun Fliegen.");
- }
- } else if (args.length == 1) {
- Player target = (Player) Bukkit.getServer().getPlayer(
- args[0]);
- try {
- if (target != null) {
- if (p.hasPermission("skyblock.fliegen.andere")) {
- if (target.getAllowFlight() == true) {
- target.setFlying(false);
- target.setAllowFlight(false);
- target.sendMessage(plugin.skyburn
- + "Du kannst nun nicht mehr Fliegen.");
- p.sendMessage(plugin.skyburn
- + "Der Spieler §c"
- + target.getDisplayName()
- + " §7kann nun nicht mehr Fliegen.");
- } else if (target.getAllowFlight() == false) {
- target.setAllowFlight(true);
- target.sendMessage(plugin.skyburn
- + "Du kannst nun Fliegen.");
- p.sendMessage(plugin.skyburn
- + "Der Spieler §c"
- + target.getDisplayName()
- + " §7kann nun Fliegen.");
- }
- } else {
- p.sendMessage(plugin.no_perm);
- }
- } else {
- p.sendMessage(plugin.no_target);
- }
- } catch (NullPointerException ex) {
- ex.printStackTrace();
- }
- } else {
- p.sendMessage(plugin.wrong_syntax);
- }
- } else {
- p.sendMessage(plugin.no_perm);
- }
- }
- return true;
- }
- return false;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement