当前位置: 首页>>代码示例>>Java>>正文


Java Player类代码示例

本文整理汇总了Java中net.canarymod.api.entity.living.humanoid.Player的典型用法代码示例。如果您正苦于以下问题:Java Player类的具体用法?Java Player怎么用?Java Player使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Player类属于net.canarymod.api.entity.living.humanoid包,在下文中一共展示了Player类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onHangingEntityDestroy

import net.canarymod.api.entity.living.humanoid.Player; //导入依赖的package包/类
@HookHandler(priority = Priority.CRITICAL)
public void onHangingEntityDestroy(final HangingEntityDestroyHook hook) {
    final Player player = hook.getPlayer();
    final HangingEntity entity = hook.getPainting();

    if (player == null || !player.isOperator()) {
        final Tree<? extends IZown> zownTree = zownManager.getZown(entity.getLocation());
        if (player == null || !zownTree.getData().isOwnerOrMember(player)) {
            final Boolean flag = zownTree.getData().getConfiguration().getFlag(Flag.build.name());
            if (flag != null) {
                final boolean excluded = zownTree.getData().getConfiguration()
                        .hasEntityCreateExclusion(entity.getClass());
                if (flag) {
                    if (excluded) {
                        hook.setCanceled();
                    }
                } else {
                    if (!excluded) {
                        hook.setCanceled();
                    }
                }
            }
        }
    }
}
 
开发者ID:toddharrison,项目名称:Zown,代码行数:26,代码来源:ModifyWorldListener.java

示例2: onItemUse

import net.canarymod.api.entity.living.humanoid.Player; //导入依赖的package包/类
@HookHandler(priority = Priority.CRITICAL)
public void onItemUse(final ItemUseHook hook) {
    final Player player = hook.getPlayer();
    final Block block = hook.getBlockClicked();

    if (!player.isOperator()) {
        final Tree<? extends IZown> zownTree = zownManager.getZown(block.getLocation());
        if (!zownTree.getData().isOwnerOrMember(player)) {
            final Boolean flag = zownTree.getData().getConfiguration().getFlag(Flag.build.name());
            if (flag != null && !flag) {
                final ItemType type = hook.getItem().getType();
                if (type == ItemType.FlintAndSteel || type == ItemType.WaterBucket
                        || type == ItemType.LavaBucket || type == ItemType.Bonemeal) {
                    hook.setCanceled();
                }
            }
        }
    }
}
 
开发者ID:toddharrison,项目名称:Zown,代码行数:20,代码来源:ModifyWorldListener.java

示例3: onItemFrameSetItem

import net.canarymod.api.entity.living.humanoid.Player; //导入依赖的package包/类
@HookHandler(priority = Priority.CRITICAL)
public void onItemFrameSetItem(final ItemFrameSetItemHook hook) {
    final Player player = hook.getPlayer();
    final Entity entity = hook.getItemFrame();

    if (!player.isOperator()) {
        final Tree<? extends IZown> zownTree = zownManager.getZown(entity.getLocation());
        if (!zownTree.getData().isOwnerOrMember(player)) {
            final Boolean flag = zownTree.getData().getConfiguration().getFlag(Flag.interact.name());
            if (flag != null) {
                final boolean excluded = zownTree.getData().getConfiguration()
                        .hasEntityInteractExclusion(entity.getClass());
                if (flag) {
                    if (excluded) {
                        hook.setCanceled();
                    }
                } else {
                    if (!excluded) {
                        hook.setCanceled();
                    }
                }
            }
        }
    }
}
 
开发者ID:toddharrison,项目名称:Zown,代码行数:26,代码来源:ModifyWorldListener.java

示例4: onEntityRightClick

import net.canarymod.api.entity.living.humanoid.Player; //导入依赖的package包/类
@HookHandler(priority = Priority.CRITICAL)
public void onEntityRightClick(final EntityRightClickHook hook) {
    final Player player = hook.getPlayer();
    final Entity entity = hook.getEntity();

    if (!player.isOperator()) {
        final Tree<? extends IZown> zownTree = zownManager.getZown(entity.getLocation());
        if (!zownTree.getData().isOwnerOrMember(player)) {
            final Boolean flag = zownTree.getData().getConfiguration().getFlag(Flag.interact.name());
            if (flag != null) {
                final boolean excluded = zownTree.getData().getConfiguration()
                        .hasEntityInteractExclusion(entity.getClass());
                if (flag) {
                    if (excluded) {
                        hook.setCanceled();
                    }
                } else {
                    if (!excluded) {
                        hook.setCanceled();
                    }
                }
            }
        }
    }
}
 
开发者ID:toddharrison,项目名称:Zown,代码行数:26,代码来源:ModifyWorldListener.java

示例5: firePlayerListData

import net.canarymod.api.entity.living.humanoid.Player; //导入依赖的package包/类
@Redirect(method = "playerLoggedOut",
        at = @At(value = "INVOKE", target = "Lnet/minecraft/server/management/ServerConfigurationManager;"
                + "sendPacketToAllPlayers(Lnet/minecraft/network/Packet;)V"))
public void firePlayerListData(ServerConfigurationManager manager, net.minecraft.network.Packet packetIn, EntityPlayerMP playerIn) {
    PlayerListData playerListData = ((Player) playerIn).getPlayerListData(PlayerListAction.REMOVE_PLAYER);
    for (EntityPlayerMP playerMP : manager.playerEntityList) {
        PlayerListHook playerListHook = new PlayerListHook(playerListData.copy(), (Player) playerMP);
        if (!playerListHook.call().isCanceled()) {
            S38PacketPlayerListItem packet = new S38PacketPlayerListItem();
            packet.action = S38PacketPlayerListItem.Action.valueOf(PlayerListAction.REMOVE_PLAYER.name());
            WorldSettings.GameType gameType =
                    WorldSettings.GameType.getByID(playerListHook.getData().getMode().getId());
            IChatComponent iChatComponent = playerListHook.getData().displayNameSet() ?
                    (IChatComponent) playerListHook.getData().getDisplayName() : null;
            packet.players.add(packet.new AddPlayerData(playerListHook.getData()
                    .getProfile(), playerListHook.getData().getPing(), gameType, iChatComponent));
            playerMP.playerNetServerHandler.sendPacket(packet);
        }
    }
}
 
开发者ID:NeptunePowered,项目名称:NeptuneMod,代码行数:21,代码来源:MixinServerConfigurationManager.java

示例6: pairPlayer

import net.canarymod.api.entity.living.humanoid.Player; //导入依赖的package包/类
/**
 *
 * @param player     A Minecraft account
 * @param token      A latch token the user received in her phone
 */
public void pairPlayer(Player player, String token) {
    String pName = player.getName();
    plugin.getLogman().info("Pairing " + pName + "using token " + token);
    LatchResponse response = latch.pair(token);
    if (response.getError() == null) {
        JsonObject data = response.getData();
        String latchAccount = data.get("accountId").getAsString();
        plugin.getLogman().info("Account " + latchAccount + " retrieved.");
        setLatchAccount(player, latchAccount);
    }
    else {
        // TODO: manage error
        plugin.getLogman().info("Fail pairing account.");
    }
}
 
开发者ID:escueladebits,项目名称:canary_latch,代码行数:21,代码来源:LatchManager.java

示例7: getPlayerName

import net.canarymod.api.entity.living.humanoid.Player; //导入依赖的package包/类
private String getPlayerName(final String uuid) {
    String name = null;
    final Player player = Canary.getServer().getPlayerFromUUID(uuid);
    if (player != null) {
        // Player online
        ZownPlugin.LOG.debug("Found online Player");
        name = player.getName();
    } else {
        // Player offline
        final OfflinePlayer oPlayer = Canary.getServer().getOfflinePlayer(UUID.fromString(uuid));
        if (oPlayer != null) {
            ZownPlugin.LOG.debug("Found offline Player");
            name = oPlayer.getName();
        }
    }
    return name;
}
 
开发者ID:toddharrison,项目名称:Zown,代码行数:18,代码来源:Zown.java

示例8: renameZown

import net.canarymod.api.entity.living.humanoid.Player; //导入依赖的package包/类
@Override
public boolean renameZown(final World world, final String oldName, final String newName,
                          final Player player) {
    boolean renamed = false;
    final Map<String, Tree<Zown>> zownMap = zownMaps.get(world);
    if (zownMap != null && zownMap.containsKey(oldName) && !zownMap.containsKey(newName)) {
        final Tree<Zown> zownTree = zownMap.get(oldName);
        if (zownTree != null
                && player == null
                || player != null
                && (player.isOperator() || player.safeHasPermission("zown.admin.manage.rename") || zownTree
                .getData().isOwner(player))) {
            zownMap.remove(oldName);
            zownTree.getData().setName(newName);
            zownMap.put(newName, zownTree);
            renamed = true;

            try {
                dataManager.saveZown(world, zownTree, oldName);
            } catch (final Exception e) {
                ZownPlugin.LOG.error("Error saving zown", e);
            }
        }
    }
    return renamed;
}
 
开发者ID:toddharrison,项目名称:Zown,代码行数:27,代码来源:ZownManager.java

示例9: matchPlayer

import net.canarymod.api.entity.living.humanoid.Player; //导入依赖的package包/类
@Override
public Player matchPlayer(String player) {
    player = player.toLowerCase();

    Player lastPlayer = null;
    for (Player cPlayer : getConfigurationManager().getAllPlayers()) {
        if (cPlayer.getName().toLowerCase().equals(player)) {
            // Perfect match found
            lastPlayer = cPlayer;
            break;
        }
        if (cPlayer.getName().toLowerCase().contains(player)) {
            // Partial match
            if (lastPlayer != null) {
                // Found multiple
                return null;
            }
            lastPlayer = cPlayer;
        }
    }

    return lastPlayer;
}
 
开发者ID:NeptunePowered,项目名称:NeptuneMod,代码行数:24,代码来源:MixinMinecraftServer.java

示例10: consoleCommand

import net.canarymod.api.entity.living.humanoid.Player; //导入依赖的package包/类
@Override
public boolean consoleCommand(String command, Player player) {
    final ConsoleCommandHook commandHook = (ConsoleCommandHook) new ConsoleCommandHook(player, command).call();
    if (commandHook.isCanceled()) {
        return true;
    }

    final String[] args = command.split(" ");

    String commandName = args[0];
    if (commandName.startsWith("/")) {
        commandName = commandName.substring(1);
    }

    if (!Canary.commands().parseCommand(player, commandName, args)) {
        if (Canary.ops().isOpped(player) || player.hasPermission("canary.vanilla." + commandName)) {
            return this.getCommandManager().executeCommand((ICommandSender) player, command) > 0;
        }
        return false;
    }

    return true;
}
 
开发者ID:NeptunePowered,项目名称:NeptuneMod,代码行数:24,代码来源:MixinMinecraftServer.java

示例11: getOnlinePlayers

import net.canarymod.api.entity.living.humanoid.Player; //导入依赖的package包/类
@Override
public DynmapPlayer[] getOnlinePlayers() {
    List<Player> players = Canary.getServer().getPlayerList();
    DynmapPlayer[] dplay = new DynmapPlayer[players.size()];
    for(int i = 0; i < dplay.length; i++)
        dplay[i] = new BukkitPlayer(players.get(i));
    return dplay;
}
 
开发者ID:webbukkit,项目名称:DynmapCanary,代码行数:9,代码来源:DynmapPlugin.java

示例12: getDisplayName

import net.canarymod.api.entity.living.humanoid.Player; //导入依赖的package包/类
@Override
public String getDisplayName() {
    if (player instanceof Player) {
        ChatComponent dname = ((Player)player).getDisplayNameComponent();
        if (dname != null) {
            return dname.getText();
        }
    }
    return player.getName();
}
 
开发者ID:webbukkit,项目名称:DynmapCanary,代码行数:11,代码来源:DynmapPlugin.java

示例13: getPlayerFromUUID

import net.canarymod.api.entity.living.humanoid.Player; //导入依赖的package包/类
@Override
public Player getPlayerFromUUID(UUID uuid) {
    Player player = null;

    for (Player p : this.getConfigurationManager().getAllPlayers()) {
        if (p.getUUID().equals(uuid)) {
            player = p;
            break;
        }
    }

    return player;
}
 
开发者ID:NeptunePowered,项目名称:NeptuneMod,代码行数:14,代码来源:MixinMinecraftServer.java

示例14: isOp

import net.canarymod.api.entity.living.humanoid.Player; //导入依赖的package包/类
@Override
public boolean isOp() {
    if(sender != null) {
        return (sender.getReceiverType() == ReceiverType.SERVER) || ((sender instanceof Player) && ((Player)sender).isOperator());
    }
    else
        return false;
}
 
开发者ID:webbukkit,项目名称:DynmapCanary,代码行数:9,代码来源:DynmapPlugin.java

示例15: dynmapCommand

import net.canarymod.api.entity.living.humanoid.Player; //导入依赖的package包/类
@Command(aliases = { "dynmap" },
        description = "Dynmap commands", permissions = { "" }, toolTip = "")
public void dynmapCommand(MessageReceiver sender, String[] parameters) {
    DynmapCommandSender dsender;
    if(sender instanceof Player) {
        dsender = new BukkitPlayer((Player)sender);
    }
    else {
        dsender = new CanaryCommandSender(sender);
    }
    core.processCommand(dsender, "dynmap", parameters[0], Arrays.copyOfRange(parameters, 1, parameters.length));
}
 
开发者ID:webbukkit,项目名称:DynmapCanary,代码行数:13,代码来源:DynmapPlugin.java


注:本文中的net.canarymod.api.entity.living.humanoid.Player类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。