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


Java Priority.CRITICAL属性代码示例

本文整理汇总了Java中net.canarymod.plugin.Priority.CRITICAL属性的典型用法代码示例。如果您正苦于以下问题:Java Priority.CRITICAL属性的具体用法?Java Priority.CRITICAL怎么用?Java Priority.CRITICAL使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在net.canarymod.plugin.Priority的用法示例。


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

示例1: onBlockDestroy

@HookHandler(priority = Priority.CRITICAL)
public void onBlockDestroy(final BlockDestroyHook hook) {
    final Player player = hook.getPlayer();
    final Block block = hook.getBlock();

    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) {
                final boolean excluded = zownTree.getData().getConfiguration()
                        .hasBlockBuildExclusion(block.getType());
                if (flag) {
                    if (excluded) {
                        hook.setCanceled();
                    }
                } else {
                    if (!excluded) {
                        hook.setCanceled();
                    }
                }
            }
        }
    }
}
 
开发者ID:toddharrison,项目名称:Zown,代码行数:25,代码来源:ModifyWorldListener.java

示例2: onServerListPing

@HookHandler(priority = Priority.CRITICAL)
public void onServerListPing(final ServerListPingHook hook) {
    server.getPluginManager().callEvent(
            new ServerListPingEvent(hook.getRequesterAddress(), hook.getMotd().getFullText(), hook
                    .getCurrentPlayers(), hook.getMaxPlayers()) {
                @Override
                public void setMotd(String motd) {
                    super.setMotd(motd);
                    hook.setMotd(motd);
                }

                @Override
                public void setMaxPlayers(int maxPlayers) {
                    super.setMaxPlayers(maxPlayers);
                    hook.setMaxPlayers(maxPlayers);
                }

                @Override
                public void setServerIcon(CachedServerIcon icon) throws IllegalArgumentException,
                        UnsupportedOperationException {
                    super.setServerIcon(icon);
                }
            });
}
 
开发者ID:CanaryBukkitTeam,项目名称:CanaryBukkit,代码行数:24,代码来源:CanaryServerListener.java

示例3: onItemUse

@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,代码行数:19,代码来源:ModifyWorldListener.java

示例4: onTeleportation

@HookHandler(priority = Priority.CRITICAL, ignoreCanceled = true)
public void onTeleportation(final TeleportHook hook) {
    PlayerTeleportEvent event =
            new PlayerTeleportEvent(new CanaryPlayer(hook.getPlayer()), new CanaryLocation(hook.getPlayer()
                    .getLocation(), new CanaryWorld(hook.getDestination().getWorld())), new CanaryLocation(hook
                    .getDestination(), new CanaryWorld(hook.getDestination().getWorld())),
                    TeleportCauseConverter.of(hook.getTeleportReason())) {
                @Override
                public void setFrom(Location from) {
                    super.setFrom(from);
                    // How can you do this in Canary?
                }

                @Override
                public void setTo(Location to) {
                    super.setTo(to);
                    // How can you do this in Canary?
                }
            };
    event.setCancelled(hook.isCanceled());
    server.getPluginManager().callEvent(event);
    if (event.isCancelled()) {
        hook.setCanceled();
    }
}
 
开发者ID:CanaryBukkitTeam,项目名称:CanaryBukkit,代码行数:25,代码来源:CanaryPlayerListener.java

示例5: onItemFrameRotate

@HookHandler(priority = Priority.CRITICAL)
public void onItemFrameRotate(final ItemFrameRotateHook 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,代码行数:25,代码来源:ModifyWorldListener.java

示例6: onHangingEntityDestroy

@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,代码行数:25,代码来源:ModifyWorldListener.java

示例7: onEntityLightningStruck

@HookHandler(priority = Priority.CRITICAL)
public void onEntityLightningStruck(final EntityLightningStruckHook hook) {
    final Entity target = hook.getStruckEntity();

    if (target.isPlayer()) {
        final Tree<? extends IZown> zownTree = zownManager.getZown(target.getLocation());
        final Boolean flag = zownTree.getData().getConfiguration().getFlag(Flag.playerimmune.name());
        if (flag != null && flag) {
            hook.setCanceled();
        }
    }
}
 
开发者ID:toddharrison,项目名称:Zown,代码行数:12,代码来源:PlayerListener.java

示例8: onPlayerCommand

@HookHandler(priority = Priority.CRITICAL)
public void onPlayerCommand(final PlayerCommandHook hook) {
    final Player player = hook.getPlayer();
    final String[] command = hook.getCommand();

    if (!player.isOperator()) {
        final Tree<? extends IZown> zownTree = zownManager.getZown(player.getLocation());
        if (zownTree.getData().getConfiguration().hasCommandRestriction(command[0])) {
            hook.setCanceled();
            player.message(ChatFormat.GOLD + "That command has been restricted.");
        }
    }
}
 
开发者ID:toddharrison,项目名称:Zown,代码行数:13,代码来源:CommandListener.java

示例9: onPlayerChat

@HookHandler(priority = Priority.CRITICAL, ignoreCanceled = true)
public void onPlayerChat(final ChatHook hook) {
    Set<org.bukkit.entity.Player> recievers = new HashSet<org.bukkit.entity.Player>();
    for (Player p : hook.getReceiverList()) {
        recievers.add(new CanaryPlayer(p));
    }
    AsyncPlayerChatEvent event =
            new AsyncPlayerChatEvent(false, new CanaryPlayer(hook.getPlayer()), hook.getMessage(), recievers) {
                @Override
                public void setMessage(String message) {
                    super.setMessage(message);
                    hook.setMessage(message);
                }

                @Override
                public void setFormat(final String format) throws IllegalFormatException, NullPointerException {
                    super.setFormat(format);
                    hook.setFormat(format);
                }
            };
    event.setCancelled(hook.isCanceled());
    server.getPluginManager().callEvent(event);
    if (event.isCancelled()) {
        hook.setCanceled();
    }
    // TODO: Fill in
}
 
开发者ID:CanaryBukkitTeam,项目名称:CanaryBukkit,代码行数:27,代码来源:CanaryPlayerListener.java

示例10: onPlayerJoin

@HookHandler(priority = Priority.CRITICAL)
public void onPlayerJoin(final ConnectionHook hook) {
    server.getPluginManager().callEvent(new PlayerJoinEvent(new CanaryPlayer(hook.getPlayer()), hook.getMessage()) {
        @Override
        public void setJoinMessage(String joinMessage) {
            super.setJoinMessage(joinMessage);
            hook.setMessage(joinMessage);
        }
    });
}
 
开发者ID:CanaryBukkitTeam,项目名称:CanaryBukkit,代码行数:10,代码来源:CanaryPlayerListener.java

示例11: onEnderDropBlock

@HookHandler(priority = Priority.CRITICAL)
public void onEnderDropBlock(final EndermanDropBlockHook hook) {
    final Location location = hook.getEnderman().getLocation();

    final Tree<? extends IZown> zownTree = zownManager.getZown(location);
    final Boolean flag = zownTree.getData().getConfiguration().getFlag(Flag.mobgrief.name());
    if (flag != null && !flag) {
        hook.setCanceled();
    }
}
 
开发者ID:toddharrison,项目名称:Zown,代码行数:10,代码来源:ModifyWorldListener.java

示例12: onLiquidDestroy

@HookHandler(priority = Priority.CRITICAL)
public void onLiquidDestroy(final LiquidDestroyHook hook) {
    final Block block = hook.getBlock();

    final Tree<? extends IZown> zownTree = zownManager.getZown(block.getLocation());
    final Boolean flag = zownTree.getData().getConfiguration().getFlag(Flag.flow.name());
    if (flag != null && !flag) {
        hook.setCanceled();
    }
}
 
开发者ID:toddharrison,项目名称:Zown,代码行数:10,代码来源:ModifyWorldListener.java

示例13: onArmorStandModify

@HookHandler(priority = Priority.CRITICAL)
public void onArmorStandModify(final ArmorStandModifyHook hook) {
    final Player player = hook.getPlayer();
    // TODO need access to the armor stand being modified
    // final Entity entity = hook.getArmorStand();
    final Entity armorStand = player;

    if (!player.isOperator()) {
        final Tree<? extends IZown> zownTree = zownManager.getZown(armorStand.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(ArmorStand.class);
                if (flag) {
                    if (excluded) {
                        hook.setCanceled();
                    }
                } else {
                    if (!excluded) {
                        hook.setCanceled();
                    }
                }
            }
        }
    }
}
 
开发者ID:toddharrison,项目名称:Zown,代码行数:27,代码来源:ModifyWorldListener.java

示例14: onWorldUnload

@HookHandler(priority = Priority.CRITICAL)
public void onWorldUnload(final UnloadWorldHook hook) {
    server.getPluginManager().callEvent(new WorldUnloadEvent(new CanaryWorld(hook.getWorld())) {
        @Override
        public void setCancelled(boolean cancelled) {
            super.setCancelled(cancelled);
            //UnloadWorldHook isn't a CancelableHook :(
        }
    });
}
 
开发者ID:CanaryBukkitTeam,项目名称:CanaryBukkit,代码行数:10,代码来源:CanaryWorldListener.java

示例15: onBlockDestroy

@HookHandler(priority = Priority.CRITICAL, ignoreCanceled = true)
public void onBlockDestroy(final BlockDestroyHook hook) {
    BlockBreakEvent event =
            new BlockBreakEvent(new CanaryBlock(hook.getBlock()), new CanaryPlayer(hook.getPlayer()));
    event.setCancelled(hook.isCanceled());
    server.getPluginManager().callEvent(event);
    if (event.isCancelled()) {
        hook.setCanceled();
    }
}
 
开发者ID:CanaryBukkitTeam,项目名称:CanaryBukkit,代码行数:10,代码来源:CanaryBlockListener.java


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