75 lines
2.1 KiB
Java
75 lines
2.1 KiB
Java
package eu.univento.core.commands;
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.List;
|
|
|
|
import org.bukkit.Bukkit;
|
|
import org.bukkit.command.CommandSender;
|
|
import org.bukkit.entity.Player;
|
|
|
|
import eu.univento.core.Core;
|
|
import eu.univento.core.api.AutoCommand;
|
|
import eu.univento.core.api.Messages;
|
|
import eu.univento.core.api.player.CustomPlayer;
|
|
|
|
/**
|
|
* fixes players
|
|
* @author joethei
|
|
* @version 1.0
|
|
*/
|
|
public class Fix extends AutoCommand<Core>{
|
|
|
|
/**
|
|
* @param plugin main class
|
|
* @param command command to execute
|
|
* @param description describes the command
|
|
* @param aliases aliases of command
|
|
*/
|
|
public Fix(Core plugin, String command, String description, String[] aliases) {
|
|
super(plugin, command, description, aliases);
|
|
}
|
|
|
|
@Override
|
|
public boolean execute(CommandSender sender, String label, String[] args) {
|
|
if(sender instanceof Player) {
|
|
CustomPlayer p = CustomPlayer.getPlayer(sender.getName());
|
|
if(args.length == 0) {
|
|
for(Player player : Bukkit.getOnlinePlayers()) {
|
|
player.hidePlayer(p);
|
|
player.showPlayer(p);
|
|
}
|
|
p.teleport(p.getLocation());
|
|
p.sendMessage("§6Du hast dich gefixt");
|
|
}
|
|
if(args.length == 1) {
|
|
if(Bukkit.getPlayer(args[0]) != null) {
|
|
CustomPlayer t = CustomPlayer.getPlayer(Bukkit.getPlayer(args[0]).getName());
|
|
if(t != p) {
|
|
p.hidePlayer(t);
|
|
p.showPlayer(t);
|
|
p.teleport(p.getLocation());
|
|
p.sendMessage("§6Du hast den Spieler " + t.getDisplayName() + " gefixt");
|
|
t.sendMessage("§6Du wurdest von " + p.getDisplayName() + " gefixt");
|
|
}else {
|
|
p.chat("/fix");
|
|
}
|
|
}else {
|
|
p.sendMessage("§cDieser Spieler ist nicht online");
|
|
}
|
|
}
|
|
}else {
|
|
sender.sendMessage(Messages.NOT_A_PLAYER);
|
|
}
|
|
return true;
|
|
}
|
|
|
|
@Override
|
|
public List<String> tabComplete(CommandSender sender, String label, String[] args) {
|
|
List<String> list = new ArrayList<String>();
|
|
|
|
for(Player players : Bukkit.getOnlinePlayers()) {
|
|
list.add(players.getDisplayName());
|
|
}
|
|
return list;
|
|
}
|
|
} |