@Override public void incrementStatistic(Statistic statistic, EntityType entityType, int amount) throws IllegalArgumentException { int initialAmount = stats.get(statistic); PlayerStatisticIncrementEvent event = EventFactory.getInstance().callEvent( new PlayerStatisticIncrementEvent(this, statistic, initialAmount, initialAmount + amount, entityType)); if (!event.isCancelled()) { stats.add(statistic, entityType, amount); } }
@Override public void incrementStatistic(Statistic statistic, int amount) { int initialAmount = stats.get(statistic); PlayerStatisticIncrementEvent event = EventFactory.getInstance().callEvent( new PlayerStatisticIncrementEvent(this, statistic, initialAmount, initialAmount + amount)); if (!event.isCancelled()) { stats.add(statistic, amount); } }
@Override public void incrementStatistic(Statistic statistic, Material material, int amount) { int initialAmount = stats.get(statistic); PlayerStatisticIncrementEvent event = EventFactory.getInstance().callEvent( new PlayerStatisticIncrementEvent(this, statistic, initialAmount, initialAmount + amount, material)); if (!event.isCancelled()) { stats.add(statistic, material, amount); } }
PlayerStatisticIncrementEvent event = new PlayerStatisticIncrementEvent(player, statistic, player.getStatistic(statistic), player.getStatistic(statistic) + 1); Bukkit.getServer().getPluginManager().callEvent(event); if (event.isCancelled()) { sender.sendMessage(String.format("Unable to increment %s for %s", statisticString, player.getName())); return true; if (event.isCancelled()) { sender.sendMessage(String.format("Unable to increment %s for %s", statisticString, player.getName())); return true; if (event.isCancelled()) { sender.sendMessage(String.format("Unable to increment %s for %s", statisticString, player.getName())); return true;
PlayerStatisticIncrementEvent event = new PlayerStatisticIncrementEvent(player, statistic, player.getStatistic(statistic), player.getStatistic(statistic) + 1); Bukkit.getServer().getPluginManager().callEvent(event); if (event.isCancelled()) { sender.sendMessage(String.format("Unable to increment %s for %s", statisticString, player.getName())); return true; if (event.isCancelled()) { sender.sendMessage(String.format("Unable to increment %s for %s", statisticString, player.getName())); return true; if (event.isCancelled()) { sender.sendMessage(String.format("Unable to increment %s for %s", statisticString, player.getName())); return true;