Java Code Examples for org.bukkit.event.player.PlayerExpChangeEvent#getPlayer()
The following examples show how to use
org.bukkit.event.player.PlayerExpChangeEvent#getPlayer() .
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: PlayerExpChangeListener.java From IridiumSkyblock with GNU General Public License v2.0 | 6 votes |
@EventHandler public void onPlayerExpChange(PlayerExpChangeEvent event) { try { final Player player = event.getPlayer(); final Location location = player.getLocation(); final IslandManager islandManager = IridiumSkyblock.getIslandManager(); if (!islandManager.isIslandWorld(location)) return; final User user = User.getUser(player); final Island island = user.getIsland(); if (island == null) return; for (Mission mission : IridiumSkyblock.getMissions().missions) { final Map<String, Integer> levels = island.getMissionLevels(); levels.putIfAbsent(mission.name, 1); final MissionData level = mission.levels.get(levels.get(mission.name)); if (level.type == MissionType.EXPERIENCE) island.addMission(mission.name, event.getAmount()); } } catch (Exception e) { IridiumSkyblock.getInstance().sendErrorMessage(e); } }
Example 2
Source File: XPGainedListener.java From Statz with GNU General Public License v3.0 | 6 votes |
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) public void onXPGain(final PlayerExpChangeEvent event) { final PlayerStat stat = PlayerStat.XP_GAINED; // Get player final Player player = event.getPlayer(); // Do general check if (!plugin.doGeneralCheck(player, stat)) return; // Update value to new stat. plugin.getDataManager().setPlayerInfo(player.getUniqueId(), stat, new XPGainedSpecification(player.getUniqueId(), event.getAmount(), player.getWorld().getName()) .constructQuery()); }