ReturnComponent.java 文件源码

java
阅读 17 收藏 0 点赞 0 评论 0

项目:CraftoPlugin 作者:
@CommandHandler("return")
@Permission("craftoplugin.teleport.return")
public void returnCommand(final CommandSender cs, final String[] args) {
    if (!(cs instanceof Player)) { CraftoMessenger.sendFailure(cs, Messages.PLAYERS_ONLY); return; }
    Player sender = (Player)cs;
    Location destination = null;

    if (args.length > 0 && cs.hasPermission("craftoplugin.teleport.return.other")) {
        Optional<CraftoPlayer> target = CraftoPlayer.getPlayer(args[0]);
        if (target.isPresent()) { destination = this.returnLocationMap.get(target.get().getUniqueId()); }
    }
    else { destination = this.returnLocationMap.get(sender.getUniqueId()); }

    if (destination == null) { CraftoMessenger.sendFailure(cs, "Es konnte keine Returnposition gefunden werden!"); return; }

    final Location loc = this.returnLocationMap.get(sender.getUniqueId());
    this.module.teleport(sender, loc, TeleportCause.COMMAND, true);
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号