Java Code Examples for org.bukkit.event.EventPriority#LOW

The following examples show how to use org.bukkit.event.EventPriority#LOW . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: EnchantingListener.java    From MineTinker with GNU General Public License v3.0 6 votes vote down vote up
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOW)
public void onEnchant(PrepareItemEnchantEvent event) {
	if (Lists.WORLDS.contains(event.getEnchanter().getWorld().getName())) {
		return;
	}

	ItemStack tool = event.getItem();

	if (modManager.isToolViable(tool) || modManager.isWandViable(tool) || modManager.isArmorViable(tool)) {
		if (MineTinker.getPlugin().getConfig().getBoolean("AllowEnchanting")) {
			if (MineTinker.getPlugin().getConfig().getBoolean("EnchantingCostsSlots", true) && modManager.getFreeSlots(tool) == 0) {
				event.setCancelled(true);
			}
			return;
		}
		event.setCancelled(true);
	}
}
 
Example 2
Source File: BlockDropsMatchModule.java    From PGM with GNU Affero General Public License v3.0 5 votes vote down vote up
@EventHandler(priority = EventPriority.LOW)
public void initializeDrops(BlockTransformEvent event) {
  if (!causesDrops(event.getCause())) {
    return;
  }

  BlockDrops drops =
      this.ruleSet.getDrops(
          event, event.getOldState(), ParticipantBlockTransformEvent.getPlayerState(event));
  if (drops != null) {
    event.setDrops(drops);
  }
}
 
Example 3
Source File: BleedingSweetsListener.java    From UhcCore with GNU General Public License v3.0 5 votes vote down vote up
@EventHandler (priority = EventPriority.LOW)
public void onPlayerDeath(PlayerDeathEvent e){
    e.getDrops().add(new ItemStack(Material.DIAMOND));
    e.getDrops().add(new ItemStack(Material.BOOK));
    e.getDrops().add(new ItemStack(Material.STRING));
    e.getDrops().add(new ItemStack(Material.GOLD_INGOT,5));
    e.getDrops().add(new ItemStack(Material.ARROW,16));
}
 
Example 4
Source File: SpawnMatchModule.java    From ProjectAres with GNU Affero General Public License v3.0 5 votes vote down vote up
@EventHandler(priority = EventPriority.LOW)
public void playerJoin(final PlayerJoinEvent event) {
    // Add the player to the match if they spawn in this world
    if(match.getWorld().equals(event.getPlayer().getLocation().getWorld())) {
        event.getPlayer().setGliding(true); // Fixes client desync if player joins server while gliding
        match.addPlayer(event.getPlayer());
    }
}
 
Example 5
Source File: KitMatchModule.java    From PGM with GNU Affero General Public License v3.0 5 votes vote down vote up
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void checkItemTransfer(ItemTransferEvent event) {
  if (event.getType() == ItemTransferEvent.Type.PLACE
      && ItemTags.PREVENT_SHARING.has(event.getItemStack())) {
    event.setCancelled(true);
  }
}
 
Example 6
Source File: ItemSharingAndLockingListener.java    From ProjectAres with GNU Affero General Public License v3.0 5 votes vote down vote up
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void onDropItem(PlayerDropItemEvent event) {
    if(isLocked(event.getItemDrop().getItemStack())) {
        event.setCancelled(true);
        sendLockWarning(event.getPlayer());
    } else if(isUnshareable(event.getItemDrop().getItemStack())) {
        event.getItemDrop().remove();
    }
}
 
Example 7
Source File: BloodDiamondsListener.java    From UhcCore with GNU General Public License v3.0 5 votes vote down vote up
@EventHandler (ignoreCancelled = true, priority = EventPriority.LOW)
public void onBlockBreak(BlockBreakEvent e){
    if (e.getBlock().getType() != Material.DIAMOND_ORE){
        return;
    }

    Player p = e.getPlayer();
    p.getWorld().playSound(p.getLocation(), UniversalSound.PLAYER_HURT.getSound(), 1, 1);

    if (p.getHealth() < 1){
        p.setHealth(0);
    }else {
        p.setHealth(p.getHealth() - 1);
    }
}
 
Example 8
Source File: BlockTransformListener.java    From PGM with GNU Affero General Public License v3.0 5 votes vote down vote up
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void onPrimeTNT(ExplosionPrimeEvent event) {
  if (event.getEntity() instanceof TNTPrimed) {
    Block block = event.getEntity().getLocation().getBlock();
    if (block.getType() == Material.TNT) {
      ParticipantState player;
      if (event instanceof ExplosionPrimeByEntityEvent) {
        player = Trackers.getOwner(((ExplosionPrimeByEntityEvent) event).getPrimer());
      } else {
        player = null;
      }
      callEvent(event, block.getState(), BlockStates.toAir(block), player);
    }
  }
}
 
Example 9
Source File: FreezeMatchModule.java    From PGM with GNU Affero General Public License v3.0 4 votes vote down vote up
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void onBucketFill(final PlayerBucketFillEvent event) {
  if (freeze.isFrozen(event.getPlayer())) {
    event.setCancelled(true);
  }
}
 
Example 10
Source File: SilentNightListener.java    From UhcCore with GNU General Public License v3.0 4 votes vote down vote up
@EventHandler (priority = EventPriority.LOW)
public void onPlayerQuit(PlayerQuitEvent e){
    if (nightMode){
        e.setQuitMessage(null);
    }
}
 
Example 11
Source File: FreezeMatchModule.java    From PGM with GNU Affero General Public License v3.0 4 votes vote down vote up
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void onPlayerDropItem(final PlayerDropItemEvent event) {
  if (freeze.isFrozen(event.getPlayer())) {
    event.setCancelled(true);
  }
}
 
Example 12
Source File: PlayerInfo.java    From MineTinker with GNU General Public License v3.0 4 votes vote down vote up
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
private void onCombat(EntityDamageEvent event) {
	if (event.getEntity() instanceof Player) {
		combatTagTracker.put(event.getEntity().getUniqueId().toString(), System.currentTimeMillis());
	}
}
 
Example 13
Source File: PlayerAppearanceListener.java    From ProjectAres with GNU Affero General Public License v3.0 4 votes vote down vote up
@EventHandler(priority = EventPriority.LOW)
public void onIdentityChange(PlayerIdentityChangeEvent event) {
    playerAppearanceChanger.refreshPlayer(event.getPlayer(), event.getNewIdentity());
}
 
Example 14
Source File: FreezeMatchModule.java    From PGM with GNU Affero General Public License v3.0 4 votes vote down vote up
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void onBucketEmpty(final PlayerBucketEmptyEvent event) {
  if (freeze.isFrozen(event.getPlayer())) {
    event.setCancelled(true);
  }
}
 
Example 15
Source File: FreezeMatchModule.java    From PGM with GNU Affero General Public License v3.0 4 votes vote down vote up
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void onBlockBreak(final BlockBreakEvent event) {
  if (freeze.isFrozen(event.getPlayer())) {
    event.setCancelled(true);
  }
}
 
Example 16
Source File: SpawnMatchModule.java    From ProjectAres with GNU Affero General Public License v3.0 4 votes vote down vote up
/** Must run before {@link tc.oc.pgm.tracker.trackers.DeathTracker#onPlayerDeath} */
@EventHandler(priority = EventPriority.LOW)
public void onVanillaDeath(final PlayerDeathEvent event) {
    dispatchEvent(event.getEntity(), (player, state) -> state.onEvent(event));
}
 
Example 17
Source File: FreezeListener.java    From ProjectAres with GNU Affero General Public License v3.0 4 votes vote down vote up
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void onPlayerDropItem(final PlayerDropItemEvent event) {
    if(freeze.isFrozen(event.getPlayer())) {
        event.setCancelled(true);
    }
}
 
Example 18
Source File: ShadowDive.java    From MineTinker with GNU General Public License v3.0 4 votes vote down vote up
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void onLeave(PlayerQuitEvent event) {
	for(Player p : activePlayers) {
		event.getPlayer().showPlayer(MineTinker.getPlugin(), p);
	}
}
 
Example 19
Source File: FreezeListener.java    From ProjectAres with GNU Affero General Public License v3.0 4 votes vote down vote up
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void onVehicleEnter(final VehicleEnterEvent event) {
    if(freeze.isFrozen(event.getEntered())) {
        event.setCancelled(true);
    }
}
 
Example 20
Source File: FreezeListener.java    From ProjectAres with GNU Affero General Public License v3.0 4 votes vote down vote up
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void onBlockBreak(final BlockBreakEvent event) {
    if(freeze.isFrozen(event.getPlayer())) {
        event.setCancelled(true);
    }
}