本文整理汇总了Java中org.bukkit.event.EventPriority.LOWEST属性的典型用法代码示例。如果您正苦于以下问题:Java EventPriority.LOWEST属性的具体用法?Java EventPriority.LOWEST怎么用?Java EventPriority.LOWEST使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.bukkit.event.EventPriority
的用法示例。
在下文中一共展示了EventPriority.LOWEST属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onPlayerChatEvent4
@EventHandler(priority = EventPriority.LOWEST)
public void onPlayerChatEvent4(AsyncPlayerChatEvent event) {
if (!Config.getInstance().isHighpriority() && Config.getInstance().isAsyncChat()) {
final String message = ChatColor.stripColor(event.getMessage());
final Player player = event.getPlayer();
if (this.controller.getGameFromPlayer(player) != null) {
final Game game = this.controller.getGameFromPlayer(player);
if (message.equalsIgnoreCase(ChatColor.stripColor(game.getArena().getTeamMeta().getRedTeamName())) || message.equalsIgnoreCase(ChatColor.stripColor(game.getArena().getTeamMeta().getBlueTeamName()))) {
this.connectedGames.put(player, game);
}
}
if (this.connectedGames.containsKey(player)) {
event.setCancelled(true);
}
this.plugin.getServer().getScheduler().runTaskLater(this.plugin, () -> GameListener.this.handleChatMessage(player, message), 1L);
}
}
示例2: onPlayerLogin
@EventHandler(priority = EventPriority.LOWEST)
public void onPlayerLogin(UserLoginEvent event) {
TeamManager teamManager = teamManagerProvider.get();
Entrant participation = teamManager.getEntrant(event.getUser());
if(participation == null) return;
final int playerCount = (int) onlinePlayers.all()
.stream()
.filter(player -> !player.equals(event.getPlayer()) &&
participation.members().contains(userStore.playerId(player)))
.count();
int maxPlayers = tournament.max_players_per_match();
if(playerCount >= maxPlayers) {
event.disallow(PlayerLoginEvent.Result.KICK_WHITELIST, new Component(new TranslatableComponent("tourney.kick.maxPlayers", String.valueOf(maxPlayers)), ChatColor.RED));
} else {
if(event.getResult().equals(PlayerLoginEvent.Result.KICK_WHITELIST)) {
event.allow(); // explicitly allow players on teams but not whitelist
}
}
}
示例3: onInventoryClick
@EventHandler(priority = EventPriority.LOWEST)
public void onInventoryClick(InventoryClickEvent event) {
Player player = (Player) event.getWhoClicked(); // The player that
// clicked the item
//UUID playerUUID = player.getUniqueId();
Inventory inventory = event.getInventory(); // The inventory that was
if (openPanels.containsKey(player.getUniqueId())) {
if (inventory.getName().equals(openPanels.get(player.getUniqueId()).getInventory().getName())) {
Panel panel = openPanels.get(player.getUniqueId());
for (int slot : panel.getItems().keySet()) {
if (slot == event.getRawSlot()) {
if(!panel.getItems().get(slot).getClickHandler().onClick(player, ClickType.LEFT)) {
event.setCancelled(true);
}
}
}
}
}
}
示例4: onQuit
@EventHandler(priority = EventPriority.LOWEST)
public void onQuit(PlayerQuitEvent event) {
Player player = event.getPlayer();
if (this.profiles.containsKey(player.getUniqueId())) {
this.profiles.get(player.getUniqueId()).save(new GenericCallback() {
@Override
public void call(boolean result) {
profiles.remove(player.getUniqueId());
}
});
}
}
示例5: NoSkullCrash
@EventHandler(priority = EventPriority.LOWEST)
public void NoSkullCrash(BlockFromToEvent evt) {
if (noSkullCrash) {
if(evt.isCancelled()) {
return;
}
if (evt.getToBlock().getType() == Material.SKULL) {
evt.setCancelled(true);
}
}
}
示例6: onChat
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
public void onChat(AsyncPlayerChatEvent e) {
if (cm.isAntiChatCrash && VersionUtils.isLowerThan(VersionUtils.V1_8)) {
String chatMessage = e.getMessage();
if (chatMessage != null && chatMessage.contains("İ")) {
e.setCancelled(true);
}
}
}
示例7: prePlayerRespawn
@EventHandler(priority = EventPriority.LOWEST)
public void prePlayerRespawn(PlayerRespawnEvent event) {
Player player = event.getPlayer();
if (!InventoryManager.playerIsLoaded(player)) {
return;
}
InventoryLocker.lockSlots(player);
}
示例8: onPlayerDropItem
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
public void onPlayerDropItem(final PlayerDropItemEvent event) {
match.player(event.getPlayer()).ifPresent(player -> {
if(!player.canInteract()) {
if(player.isSpawned()) {
// If player is spawned (but frozen), force them to keep the item
event.setCancelled(true);
} else {
// If player is observing, just destroy the item
event.getItemDrop().remove();
}
}
});
}
示例9: onDamage
/**
* Fire player on damage
* @param event Event
*/
@EventHandler(priority = EventPriority.LOWEST)
public void onDamage(EntityDamageEvent event)
{
if (((SurvivalGame) SamaGamesAPI.get().getGameManager().getGame()).isDamagesActivated()
&& event.getEntityType() == EntityType.PLAYER
&& event.getCause() != EntityDamageEvent.DamageCause.FIRE
&& event.getCause() != EntityDamageEvent.DamageCause.FIRE_TICK
&& event.getDamage() > 0
&& !event.isCancelled())
event.getEntity().setFireTicks((int) this.moduleConfiguration.get("fire-time") * 20);
}
示例10: onPlayerChat
@SuppressWarnings("deprecation")
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
public void onPlayerChat(final PlayerChatEvent event) {
Zone chatZone = this.getZoneManager().getZone(ZoneType.CHAT);
if (!(chatZone.isEnabled()) || event.getPlayer() == null) {
return;
}
String message = Preconditions.checkNotNull(event, "Event").getMessage();
Player player = event.getPlayer();
FixedMessage fixedMessage = new FixedMessage(message, Instant.now());
for (Filter filter : this.getFilterManager().getFiltersForZone(chatZone)) {
if (fixedMessage.getFixed() == null || fixedMessage.getFixed().equals("")) {
break;
}
filter.filter(fixedMessage, player, ZoneType.CHAT, event);
}
this.plugin.getPlayerManager().getViolationSet(player).setLastMessage(fixedMessage);
event.setMessage(fixedMessage.getOriginal());
for (Violation v : plugin.getPlayerManager().getViolationSet(player).getViolationsForTime(fixedMessage.getTimeSent())) {
if (v.isCancelled()) {
event.setMessage(null);
event.setCancelled(true);
break;
}
if (v.isFixed()) {
event.setMessage(fixedMessage.getFixed());
}
}
if (event.getMessage() == null) {
event.setCancelled(true);
}
}
示例11: onInteract
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
public void onInteract(PlayerInteractAtEntityEvent evt) {
evt.setCancelled(accept(evt.getPlayer(), ListenerType.ENTITY, evt.getRightClicked())); // Handles entity click callbacks.
}
示例12: onEntityDamage
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
public void onEntityDamage(EntityDamageEvent e) {
e.setCancelled(true);
}
示例13: onBedEnter
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
public void onBedEnter(final PlayerBedEnterEvent event) {
cancel(event, true, event.getPlayer().getWorld(), getMatch().getPlayer(event.getPlayer()), new TranslatableComponent("match.bed.disabled"));
}
示例14: onPlayerQuit
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
public void onPlayerQuit(PlayerKickEvent event) {
event.setLeaveMessage(null);
}
示例15: onEntityTrack
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
public void onEntityTrack(final EntityTargetEvent event) {
// Handles mobs and XP orbs
if(event.getTarget() != null) cancelUnlessInteracting(event, event.getTarget());
}