52 lines
1.7 KiB
Java
52 lines
1.7 KiB
Java
/*
|
|
* Copyright (c) 2017 univento.eu - All rights reserved
|
|
* You are not allowed to use, distribute or modify this code
|
|
*/
|
|
|
|
package eu.univento.core.commands;
|
|
|
|
import eu.univento.commons.player.language.MessageConstant;
|
|
import eu.univento.core.Core;
|
|
import eu.univento.core.api.command.Command;
|
|
import eu.univento.core.api.command.CommandArgs;
|
|
import eu.univento.core.api.command.Completer;
|
|
import eu.univento.core.api.player.CustomPlayer;
|
|
|
|
import java.util.List;
|
|
import java.util.stream.Collectors;
|
|
|
|
/**
|
|
* @author joethei
|
|
* @version 1.0
|
|
*/
|
|
public class PlayerCommands {
|
|
|
|
@Command(name = "fix", usage = "/fix", inGameOnly = true)
|
|
public void fix(CommandArgs args) {
|
|
if(args.length() == 0) {
|
|
for(CustomPlayer player : Core.getOnlinePlayers()) {
|
|
player.hidePlayer(args.getPlayer());
|
|
player.showPlayer(args.getPlayer());
|
|
}
|
|
args.getPlayer().teleport(args.getPlayer().getLocation());
|
|
|
|
} if(args.length() == 1) {
|
|
CustomPlayer t = CustomPlayer.getPlayer(args.getArg(0));
|
|
if(t != null) {
|
|
if(t != args.getPlayer()) {
|
|
args.getPlayer().hidePlayer(t);
|
|
args.getPlayer().showPlayer(t);
|
|
t.teleport(t.getLocation());
|
|
}else args.getPlayer().chat("/fix");
|
|
|
|
}else args.getPlayer().sendMessage(args.getPlayer().getDatabasePlayer().getLanguage().getMessage(MessageConstant.COMMAND_NOT_ONLINE));
|
|
}else {
|
|
args.getPlayer().chat("/fix");
|
|
}
|
|
}
|
|
|
|
@Completer(name = "fix")
|
|
public List<String> fixCompleter(CommandArgs args) {
|
|
return Core.getOnlinePlayers().stream().map(CustomPlayer::getDisplayName).collect(Collectors.toList());
|
|
}
|
|
} |