Java 类org.bukkit.event.player.PlayerEvent 实例源码

项目:GenericTools    文件:FuncCooldown.java   
@Override
public WrappedEvent<?> accept(WrappedEvent<?> we) {
    long cdEndTime = 0;
    if (we.wis.hasKey("giSection.cooldown-" + cooldownId))
        cdEndTime = Long.parseLong(we.wis.getString("giSection.cooldown-" + cooldownId));
    long sysTime = System.currentTimeMillis();
    long delta = sysTime - cdEndTime;
    if (delta < 0) {
        if (we.event instanceof PlayerEvent) {
            ((PlayerEvent) we.event).getPlayer().sendMessage(I18n.format("function_help.cooldown.cd_not_end", -delta/1000.0));
        }
        we.cancelled = true;
    } else {
        we.wis.setString("giSection.cooldown-" + cooldownId, Long.toString(sysTime + cooldown * 1000));
    }
    return we;
}
项目:RPGInventory    文件:InventoryListener.java   
private void onItemDisappeared(PlayerEvent event, ItemStack item) {
    final Player player = event.getPlayer();
    final PlayerInventory inventory = player.getInventory();
    final int slotId = inventory.getHeldItemSlot();

    if (!InventoryManager.playerIsLoaded(player)) {
        return;
    }

    if (ItemUtils.isEmpty(inventory.getItemInMainHand()) || item.equals(inventory.getItemInMainHand())) {
        final Slot slot = InventoryManager.getQuickSlot(slotId);
        if (slot != null) {
            new BukkitRunnable() {
                @Override
                public void run() {
                    InventoryUtils.heldFreeSlot(player, slotId, InventoryUtils.SearchType.NEXT);
                    inventory.setItem(slotId, slot.getCup());
                }
            }.runTaskLater(RPGInventory.getInstance(), 1);
        }
    }
}
项目:PV-Star    文件:ArenaEventForwarder.java   
@Override
protected void onPlayerEvent(PlayerEvent event) {

    if (event instanceof PlayerInteractEvent) {
        PlayerInteractEvent interactEvent = (PlayerInteractEvent) event;

        if (interactEvent.hasBlock()) {
            callEvent(interactEvent.getClickedBlock(), event);
        } else {
            callEvent(interactEvent.getPlayer(), event);
        }
    }
    else {
        callEvent(event.getPlayer(), event);
    }
}
项目:AuthMeReloaded    文件:ListenerServiceTest.java   
@Test
// This simply forwards to shouldCancelEvent(Player), so the rest is already tested
public void shouldHandlePlayerEvent() {
    // given
    String playerName = "example";
    Player player = mockPlayerWithName(playerName);
    PlayerEvent event = new TestPlayerEvent(player);
    given(playerCache.isAuthenticated(playerName)).willReturn(true);

    // when
    boolean result = listenerService.shouldCancelEvent(event);

    // then
    assertThat(result, equalTo(false));
    verify(playerCache).isAuthenticated(playerName);
    verifyZeroInteractions(dataSource);
}
项目:Lukkit    文件:EventAttachment.java   
public void call(Event event) {
    for (Map.Entry<Class<?>, LuaValue> entry : eventListeners.entrySet()) {
        if (entry.getKey() == event.getClass()) {
            if (event instanceof PlayerEvent) {
                entry.getValue().call(new PlayerEventType((PlayerEvent) event));
            } else {
                entry.getValue().call(new EventType(event));
            }
        }
    }
}
项目:Chambers    文件:ProfileListener.java   
private void removeProfile(PlayerEvent event) {
    Player player = event.getPlayer();
    Game game = plugin.getGameManager().getGame();
    Profile profile = plugin.getProfileManager().getProfileByUuid(player.getUniqueId());
    if (profile != null && profile.getTeam() != null) {
        if (game.hasStarted()) {
            plugin.getGameManager().getGame().getOffline().add(player.getName());
            profile.getTeam().getOffline().add(player.getName());
        }
        profile.getTeam().removeMember(profile);
    }
    plugin.getProfileManager().removeProfile(profile);
}
项目:Minecordbot    文件:UserQuitJoinListener.java   
private boolean check(PlayerEvent e) {
    boolean allowIncog = configsManager.getBroadcastConfig().getBoolean("Hide_Incognito_Player");
    if (isVanished(e.getPlayer())) {
        return false;
    } else if (allowIncog) {
        if (e.getPlayer().hasPermission("minecordbot.incognito")) {
            return false;
        }
    }
    return true;
}
项目:Minecordbot    文件:UserQuitJoinListener.java   
private boolean safeToProceed(PlayerEvent event) {
    boolean safe = true;
    if (event instanceof PlayerJoinEvent) {
        if (((PlayerJoinEvent) event).getJoinMessage() == null && ((PlayerJoinEvent) event).getJoinMessage().isEmpty()) {
            safe = false;
            Logger.warn("The previous PlayerJoinEvent message was missing!");
        }
    } else if (event instanceof PlayerQuitEvent) {
        if (((PlayerQuitEvent) event).getQuitMessage() == null && ((PlayerQuitEvent) event).getQuitMessage().isEmpty()) {
            safe = false;
            Logger.warn("The previous PlayerQuitEvent message was missing!");
        }
    }
    return safe;
}
项目:BeeLogin    文件:EventCanceler.java   
@EventHandler(priority = EventPriority.LOWEST)
public void anyPlayerEvent(PlayerEvent event){
    if(!(event instanceof Cancellable))
        return;
    if (!usingBeeLoginMod)
        return;
    Player player = event.getPlayer();
    if (!loginStatus.get(player.getName().toLowerCase())) {
        ((Cancellable) event).setCancelled(true);
    }
}
项目:Spigot-Plus    文件:GamemodeManager.java   
private void forceGamemode(PlayerEvent evt) {
    if (!evt.getPlayer().hasPermission("spigotplus.gamemode.exempt")) {
        GameMode gamemode = getWorldGamemode(evt.getPlayer().getWorld().getName());
        if (!evt.getPlayer().getGameMode().equals(gamemode)) {
            evt.getPlayer().setGameMode(gamemode);
        }
    }
}
项目:NucleusFramework    文件:BukkitEventForwarder.java   
public void on(Object e) {

            if (!(e instanceof Event))
                return;

            Event event = (Event) e;

            onEvent(event);

            if (event instanceof PlayerEvent) {
                onPlayerEvent((PlayerEvent)event);
            }
            else if (event instanceof BlockEvent) {
                onBlockEvent((BlockEvent)event);
            }
            else if (event instanceof HangingEvent) {
                onHangingEvent((HangingEvent)event);
            }
            else if (event instanceof InventoryEvent) {
                onInventoryEvent((InventoryEvent) event);
            }
            else if (event instanceof VehicleEvent) {
                onVehicleEvent((VehicleEvent) event);
            }
            else if (event instanceof EntityEvent) {
                onEntityEvent((EntityEvent) event);
            }
        }
项目:HeavySpleef    文件:JoinRequester.java   
private void handleQuit(PlayerEvent event) {
    SpleefPlayer player = heavySpleef.getSpleefPlayer(event.getPlayer());
    if (!checking.containsKey(player)) {
        return;
    }

    handleFail(player, FailCause.QUIT, null);
}
项目:ScoreboardStats    文件:EventReplacer.java   
private void executeUnsafe(ReplacerAPI replaceManager, T event) {
    String variable = replacer.getVariable();
    for (Function<T, Integer> function : scoreFunctions) {
        int newScore = function.apply(event);
        if (replacer.isGlobal()) {
            for (Player player : Bukkit.getOnlinePlayers()) {
                replaceManager.forceUpdate(player, variable, newScore);
            }
        } else if (event instanceof PlayerEvent) {
            replaceManager.forceUpdate(((PlayerEvent) event).getPlayer(), variable, newScore);
        }
    }
}
项目:SpectatorPlus    文件:SpectatorsInteractionsListener.java   
@FutureEventHandler(event = "player.PlayerSwapHandItemsEvent", priority = EventPriority.HIGHEST)
public void onPlayerSwapHandItems(WrappedEvent ev)
{
    if(SpectatorPlus.get().getPlayerData(((PlayerEvent) ev.getEvent()).getPlayer()).isSpectating())
    {
        ev.setCancelled(true);
    }
}
项目:AuthMeReloaded    文件:EventCancelVerifier.java   
/**
 * Mocks, based on the given event, the correct method in {@link ListenerService} to return
 * the provided {@code result}.
 *
 * @param result the result the service should return
 * @param listenerService the service to mock
 * @param event the event
 */
private static void mockShouldCancel(boolean result, ListenerService listenerService, Event event) {
    if (event instanceof PlayerEvent) {
        given(listenerService.shouldCancelEvent((PlayerEvent) event)).willReturn(result);
    } else if (event instanceof EntityEvent) {
        given(listenerService.shouldCancelEvent((EntityEvent) event)).willReturn(result);
    } else {
        throw new IllegalStateException("Found event with unsupported type: " + event.getClass());
    }
}
项目:AuthMeReloaded    文件:ListenerServiceTest.java   
@Test
public void shouldHandlePlayerEventWithNullPlayer() {
    // given
    PlayerEvent event = new TestPlayerEvent(null);

    // when
    boolean result = listenerService.shouldCancelEvent(event);

    // then
    assertThat(result, equalTo(false));
}
项目:Core-Bukkit    文件:BukkitGroupManager.java   
private synchronized void processEvent(PlayerEvent event) {

    MQPlayer player = Managers.getPlatform().toPlayer(event.getPlayer());

    long team = indexOf(player);
    if (team != -1) {
        try {
            groups.get(team).remove(player);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }
}
项目:Lukkit    文件:PlayerEventType.java   
public PlayerEventType(PlayerEvent e) {
    super(e);
    set("player", new PlayerType(new LuaAccessor(e.getPlayer())));
}
项目:ProjectAres    文件:MatchPlayerEventRouter.java   
protected Stream<? extends BukkitFacetContext<?>> contexts(Object event) {
    // Try to get some online players from the event, either directly
    // through MatchPlayerEvent, or indirectly through entities.
    final Set<MatchPlayer> players;
    if(event instanceof MatchPlayerEvent) {
        players = ((MatchPlayerEvent) event).players().collect(Collectors.toImmutableSet());
    } else {
        final Set<Entity> entities = new HashSet<>();
        if(event instanceof EntityAction) entities.add(((EntityAction) event).getActor());
        if(event instanceof EntityEvent) entities.add(((EntityEvent) event).getEntity());
        if(event instanceof PlayerAction) entities.add(((PlayerAction) event).getActor());
        if(event instanceof PlayerEvent) entities.add(((PlayerEvent) event).getPlayer());

        players = entities.stream()
                          .flatMap(entity -> Streams.ofNullable(finder.getPlayer(entity)))
                          .collect(Collectors.toImmutableSet());
    }

    // If we have one or more MatchPlayers, return them along with their user contexts
    if(!players.isEmpty()) {
        return Stream.concat(
            players.stream(),
            players.stream().map(player -> player.userContext)
        );
    }

    // If we couldn't derive any online players from the event, try for offline player UUIDs
    final Set<UUID> uuids;
    if(event instanceof MatchUserEvent) {
        uuids = ((MatchUserEvent) event).users().collect(Collectors.toImmutableSet());
    } else if(event instanceof UserEvent) {
        uuids = ImmutableSet.of(((UserEvent) event).getUser().uuid());
    } else {
        return Stream.empty();
    }

    // Restrict to a specific match, if possible
    final Stream<Match> matches = finder.match((Event) event)
                                        .map(Stream::of)
                                        .orElseGet(() -> finder.currentMatches().stream());

    // Search the selected matches for both users and players
    // with the selected UUIDs.
    return matches.flatMap(
        match -> uuids.stream().flatMap(
            uuid -> Stream.concat(
                Optionals.stream(match.player(uuid)),
                Optionals.stream(match.userContext(uuid))
            )
        )
    );
}
项目:Chambers    文件:ClaimProfileListener.java   
public void removeClaimProfile(PlayerEvent event) {
    Profile profile = Chambers.getInstance().getProfileManager().getProfileByUuid(event.getPlayer().getUniqueId());
    if (Chambers.getInstance().getClaimManager().isClaiming(profile)) {
        Chambers.getInstance().getClaimManager().removeClaimProfile(profile);
    }
}
项目:Blur    文件:SessionHelperInterface.java   
default boolean isSession(@Nonnull PlayerEvent playerEvent) {
    Preconditions.checkNotNull(playerEvent, "playerEvent cannot be null.");
    return isSession(getPlayer(playerEvent.getPlayer()).getSession());
}
项目:ConditionalPerms    文件:InPlot.java   
@Override
public void setup(TerminableConsumer consumer) {
    Events.merge(PlayerEvent.class, PlayerEnterPlotEvent.class, PlayerLeavePlotEvent.class)
            .handler(e -> getPlugin().refreshPlayer(e.getPlayer(), 5L))
            .bindWith(consumer);
}
项目:ConditionalPerms    文件:InOwnPlot.java   
@Override
public void setup(TerminableConsumer consumer) {
    Events.merge(PlayerEvent.class, PlayerEnterPlotEvent.class, PlayerLeavePlotEvent.class)
            .handler(e -> getPlugin().refreshPlayer(e.getPlayer(), 5L))
            .bindWith(consumer);
}
项目:ConditionalPerms    文件:InRegion.java   
@Override
public void setup(TerminableConsumer consumer) {
    Events.merge(PlayerEvent.class, PlayerEnterRegionEvent.class, PlayerLeaveRegionEvent.class)
            .handler(e -> getPlugin().refreshPlayer(e.getPlayer(), 1L))
            .bindWith(consumer);
}
项目:Cardinal    文件:CauseFilter.java   
@Override
public Boolean evaluate(Event event) {
  if (!(event instanceof EntityDamageEvent)) {
    switch (cause) {
      /* Actor Type */
      case WORLD:
        return event instanceof WorldEvent;
      case LIVING:
        return event instanceof EntityEvent && ((EntityEvent) event).getEntity() instanceof LivingEntity;
      case MOB:
        return event instanceof EntityEvent && ((EntityEvent) event).getEntity() instanceof Creature;
      case PLAYER:
        return event instanceof PlayerEvent;
      /* Block action */
      case PUNCH:
        return event instanceof BlockDamageEvent;
      case TRAMPLE:
        return event instanceof PlayerMoveEvent;
      case MINE:
        return event instanceof BlockBreakEvent;

      case EXPLOSION:
        return event instanceof EntityExplodeEvent;

      default:
        return null;
    }
  } else {
    /* Damage Type */
    EntityDamageEvent.DamageCause damageCause = ((EntityDamageEvent) event).getCause();
    switch (cause) {
      case MELEE:
        return damageCause.equals(EntityDamageEvent.DamageCause.ENTITY_ATTACK);
      case PROJECTILE:
        return damageCause.equals(EntityDamageEvent.DamageCause.PROJECTILE);
      case POTION:
        return damageCause.equals(EntityDamageEvent.DamageCause.MAGIC)
            || damageCause.equals(EntityDamageEvent.DamageCause.POISON)
            || damageCause.equals(EntityDamageEvent.DamageCause.WITHER)
            || damageCause.equals(EntityDamageEvent.DamageCause.DRAGON_BREATH);
      case EXPLOSION:
        return damageCause.equals(EntityDamageEvent.DamageCause.BLOCK_EXPLOSION)
            || damageCause.equals(EntityDamageEvent.DamageCause.ENTITY_EXPLOSION);
      case COMBUSTION:
        return damageCause.equals(EntityDamageEvent.DamageCause.FIRE)
            || damageCause.equals(EntityDamageEvent.DamageCause.FIRE_TICK)
            || damageCause.equals(EntityDamageEvent.DamageCause.MELTING)
            || damageCause.equals(EntityDamageEvent.DamageCause.LAVA)
            || damageCause.equals(EntityDamageEvent.DamageCause.HOT_FLOOR);
      case FALL:
        return damageCause.equals(EntityDamageEvent.DamageCause.FALL);
      case GRAVITY:
        return damageCause.equals(EntityDamageEvent.DamageCause.FALL)
            || damageCause.equals(EntityDamageEvent.DamageCause.VOID);
      case VOID:
        return damageCause.equals(EntityDamageEvent.DamageCause.VOID);
      case SQUASH:
        return damageCause.equals(EntityDamageEvent.DamageCause.FALLING_BLOCK);
      case SUFFOCATION:
        return damageCause.equals(EntityDamageEvent.DamageCause.SUFFOCATION);
      case DROWNING:
        return damageCause.equals(EntityDamageEvent.DamageCause.DROWNING);
      case STARVATION:
        return damageCause.equals(EntityDamageEvent.DamageCause.STARVATION);
      case LIGHTNING:
        return damageCause.equals(EntityDamageEvent.DamageCause.LIGHTNING);
      case CACTUS:
        return damageCause.equals(EntityDamageEvent.DamageCause.CONTACT);
      case THORNS:
        return damageCause.equals(EntityDamageEvent.DamageCause.THORNS);

      default:
        return null;
    }
  }
}
项目:Minecordbot-v0-obsolete    文件:Messenger.java   
public void relayToDiscord(Event e, String msg) {
    String author = ((PlayerEvent) e).getPlayer().getName();
    for (String s : instance.getBotConfig().BINDED_CHANNELS)
        instance.getJda().getTextChannelById(s).sendMessage("**" + instance.getBotConfig().MESSAGE_PREFIX_DISCORD + " ~ " + "[" + author + "]:**  " + msg).queue();
    instance.getLogger().info(author + " > discord: " + msg);
}
项目:Blur    文件:SessionHelperInterface.java   
default boolean isSession(@Nonnull PlayerEvent playerEvent) {
    Preconditions.checkNotNull(playerEvent, "playerEvent cannot be null.");
    return isSession(getPlayer(playerEvent.getPlayer()).getSession());
}
项目:FastAsyncWorldedit    文件:BukkitImageListener.java   
private void handleInteract(PlayerEvent event, Entity entity, boolean primary) {
    handleInteract(event, event.getPlayer(), entity, primary);
}
项目:quick-game-framework    文件:ArenaBase.java   
@EventHandler(priority = EventPriority.MONITOR)
public void onPlayerEvent(PlayerEvent evt) {
    checkLocation(evt.getPlayer().getLocation(), evt);
}
项目:CardinalPGM    文件:CauseFilter.java   
private Boolean evaluate(Event event) {
    if (!(event instanceof EntityDamageEvent)) {
        switch (cause) {
            case WORLD:
                return event instanceof WorldEvent;
            case LIVING:
                return event instanceof EntityEvent && ((EntityEvent) event).getEntity() instanceof LivingEntity;
            case MOB:
                return event instanceof EntityEvent && ((EntityEvent) event).getEntity() instanceof Creature;
            case PLAYER:
                return event instanceof PlayerEvent || event instanceof BlockPlaceEvent || event instanceof BlockBreakEvent;

            case PUNCH:
                return event instanceof PlayerInteractEvent
                        && ((PlayerInteractEvent) event).getAction().equals(Action.LEFT_CLICK_BLOCK);
            case TRAMPLE:
                return event instanceof PlayerMoveEvent;
            case MINE:
                return event instanceof BlockBreakEvent;

            case EXPLOSION:
                return event instanceof EntityExplodeEvent;
        }
    } else {
        EntityDamageEvent.DamageCause damageCause = ((EntityDamageEvent) event).getCause();
        switch (cause) {
            case MELEE:
                return damageCause.equals(EntityDamageEvent.DamageCause.ENTITY_ATTACK);
            case PROJECTILE:
                return damageCause.equals(EntityDamageEvent.DamageCause.PROJECTILE);
            case POTION:
                return damageCause.equals(EntityDamageEvent.DamageCause.MAGIC)
                        || damageCause.equals(EntityDamageEvent.DamageCause.POISON)
                        || damageCause.equals(EntityDamageEvent.DamageCause.WITHER)
                        || damageCause.equals(EntityDamageEvent.DamageCause.DRAGON_BREATH);
            case EXPLOSION:
                return damageCause.equals(EntityDamageEvent.DamageCause.BLOCK_EXPLOSION)
                        || damageCause.equals(EntityDamageEvent.DamageCause.ENTITY_EXPLOSION);
            case COMBUSTION:
                return damageCause.equals(EntityDamageEvent.DamageCause.FIRE)
                        || damageCause.equals(EntityDamageEvent.DamageCause.FIRE_TICK)
                        || damageCause.equals(EntityDamageEvent.DamageCause.MELTING)
                        || damageCause.equals(EntityDamageEvent.DamageCause.LAVA)
                        || damageCause.equals(EntityDamageEvent.DamageCause.HOT_FLOOR);
            case FALL:
                return damageCause.equals(EntityDamageEvent.DamageCause.FALL);
            case GRAVITY:
                return damageCause.equals(EntityDamageEvent.DamageCause.FALL)
                        || damageCause.equals(EntityDamageEvent.DamageCause.VOID);
            case VOID:
                return damageCause.equals(EntityDamageEvent.DamageCause.VOID);
            case SQUASH:
                return damageCause.equals(EntityDamageEvent.DamageCause.FALLING_BLOCK);
            case SUFFOCATION:
                return damageCause.equals(EntityDamageEvent.DamageCause.SUFFOCATION);
            case DROWNING:
                return damageCause.equals(EntityDamageEvent.DamageCause.DROWNING);
            case STARVATION:
                return damageCause.equals(EntityDamageEvent.DamageCause.STARVATION);
            case LIGHTNING:
                return damageCause.equals(EntityDamageEvent.DamageCause.LIGHTNING);
            case CACTUS:
                return damageCause.equals(EntityDamageEvent.DamageCause.CONTACT);
            case THORNS:
                return damageCause.equals(EntityDamageEvent.DamageCause.THORNS);
        }
    }
    return null;
}
项目:RoyalIRC    文件:BChatListener.java   
private String replaceVars(PlayerEvent e, String s) {
    s = s.replace("{name}", e.getPlayer().getName());
    return s;
}
项目:HeavySpleef    文件:FlagAntiCamping.java   
private void handlePlayerLeave(PlayerEvent event) {
    SpleefPlayer player = heavySpleef.getSpleefPlayer(event.getPlayer());
    resetPlayerData(player);
}
项目:LogToSplunk    文件:PlayerEventLogger.java   
private LoggablePlayerEvent getLoggablePlayerEvent(PlayerEventAction action, PlayerEvent event) {

        final Player player = event.getPlayer();
        final Location location = player.getLocation();
        final World world = player.getWorld();

        Point3d coordinates = new Point3d(location.getX(), location.getY(), location.getZ());

        LoggablePlayerEvent playerEvent = new LoggablePlayerEvent(world.getFullTime(), minecraft_server, world.getName(), action);

        LivingEntity eventPlayer = new LivingEntity("player", player.getDisplayName());

        eventPlayer.setMaxHealth(player.getMaxHealth());
        eventPlayer.setCurrentHealth(player.getHealth());


        for (PotionEffect potion : player.getActivePotionEffects()) {
            eventPlayer.addPotions(potion.getType().getName() + ":" + potion.getAmplifier());
        }
        playerEvent.setPlayer(eventPlayer);

        if (event instanceof PlayerMoveEvent) {

            // Teleport is a child class so this is to allow us to identify the child class
            if (event instanceof PlayerTeleportEvent)
                playerEvent.setAction("Teleport"); // Should use the action enum instead of the string.

            // The coordinates from the event and the destination of the move event are slightly different so this corrects that.
            Point3d destination = new Point3d(((PlayerMoveEvent) event).getTo().getX(), ((PlayerMoveEvent) event).getTo().getY(), ((PlayerMoveEvent) event).getTo().getZ());
            playerEvent.setDest(destination);

            Point3d source = new Point3d(((PlayerMoveEvent) event).getFrom().getX(), ((PlayerMoveEvent) event).getFrom().getY(), ((PlayerMoveEvent) event).getFrom().getZ());
            playerEvent.setSrc(source);


        }
        return playerEvent;

    }
项目:helper    文件:EventFilters.java   
/**
 * Returns a predicate which only returns true if the player has a given metadata key
 *
 * @param key the metadata key
 * @param <T> the event type
 * @return a predicate which only returns true if the player has a given metadata key
 */
@Nonnull
public static <T extends PlayerEvent> Predicate<T> playerHasMetadata(MetadataKey<?> key) {
    return e -> Metadata.provideForPlayer(e.getPlayer()).has(key);
}
项目:helper    文件:EventFilters.java   
/**
 * Returns a predicate which only returns true if the player has the given permission
 *
 * @param permission the permission
 * @param <T> the event type
 * @return a predicate which only returns true if the player has the given permission
 */
@Nonnull
public static <T extends PlayerEvent> Predicate<T> playerHasPermission(String permission) {
    return e -> e.getPlayer().hasPermission(permission);
}
项目:NucleusFramework    文件:BukkitEventForwarder.java   
/**
 * Invoked whenever a registered player event is called.
 *
 * <p>Intended for optional override.</p>
 *
 * @param event  The called event.
 */
protected void onPlayerEvent(PlayerEvent event) {}
项目:AuthMeReloaded    文件:ListenerService.java   
/**
 * Returns whether an event should be canceled (for unauthenticated, non-NPC players).
 *
 * @param event the event to process
 * @return true if the event should be canceled, false otherwise
 */
public boolean shouldCancelEvent(PlayerEvent event) {
    Player player = event.getPlayer();
    return shouldCancelEvent(player);
}