Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package de.nxtmaster.commands;
- import de.nxtmaster.main.Main;
- import org.bukkit.Bukkit;
- import org.bukkit.command.Command;
- import org.bukkit.command.CommandExecutor;
- import org.bukkit.command.CommandSender;
- import org.bukkit.entity.Player;
- public class Fly implements CommandExecutor {
- @Override
- public boolean onCommand(CommandSender sender, Command command, String s, String[] args) {
- if (command.getName().equalsIgnoreCase("gm") || command.getName().equalsIgnoreCase("gamemode"))
- if (sender.hasPermission("nxtmaster.fly")) {
- Player p = (Player) sender;
- if (args.length == 1) {
- Player target = Bukkit.getPlayer(args[0]);
- if (target != null) {
- if (target.getAllowFlight()) {
- target.setFlying(false);
- target.setAllowFlight(false);
- sender.sendMessage(Main.prefix+"§aFlugmodus für §6" + target.getDisplayName() + " §adeaktiviert!");
- } else {
- target.setAllowFlight(true);
- sender.sendMessage(Main.prefix+"§aFlugmodus für §6" + target.getDisplayName() + " §aaktiviert!");
- }
- }
- } else if (args.length == 0 && p instanceof Player) {
- if (p != null) {
- if (p.getAllowFlight()) {
- p.setFlying(false);
- p.setAllowFlight(false);
- p.sendMessage(Main.prefix+"§aFlugmodus für §6" + p.getDisplayName() + " §adeaktiviert!");
- } else {
- p.setAllowFlight(true);
- p.sendMessage(Main.prefix+"§aFlugmodus für §6" + p.getDisplayName() + " §aaktiviert!");
- }
- }
- }
- }
- return false;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement