@EventHandler
public void onStatisticIncrement(PlayerStatisticIncrementEvent event){
//Don't increment elytra statistic if the player is swimming.
if(event.getStatistic() == Statistic.AVIATE_ONE_CM && event.getPlayer().hasMetadata("swimming")){
event.setCancelled(true);
}
}
java类org.bukkit.event.player.PlayerStatisticIncrementEvent的实例源码
RSwimListener.java 文件源码
项目:RealisticSwimming
阅读 24
收藏 0
点赞 0
评论 0
HolidayManager.java 文件源码
项目:McMMOPlus
阅读 23
收藏 0
点赞 0
评论 0
public void handleStatisticEvent(PlayerStatisticIncrementEvent event) {
Player player = event.getPlayer();
Statistic statistic = event.getStatistic();
int newValue = event.getNewValue();
int modifier;
switch (statistic) {
case DAMAGE_TAKEN:
modifier = 500;
break;
case JUMP:
modifier = 500;
break;
case DROP:
modifier = 200;
break;
case MINE_BLOCK:
case BREAK_ITEM:
modifier = 500;
break;
case CRAFT_ITEM:
modifier = 100;
break;
default:
return;
}
if (newValue % modifier == 0) {
mcMMO.getHolidayManager().levelUpApril(player, FakeSkillType.getByStatistic(statistic));
}
}
PlayerListener.java 文件源码
项目:McMMOPlus
阅读 25
收藏 0
点赞 0
评论 0
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onPlayerStatisticIncrementEvent(PlayerStatisticIncrementEvent event) {
if (!mcMMO.getHolidayManager().isAprilFirst()) {
return;
}
mcMMO.getHolidayManager().handleStatisticEvent(event);
}
OMGJumpEvent.java 文件源码
项目:OMGPI
阅读 27
收藏 0
点赞 0
评论 0
public OMGJumpEvent(PlayerStatisticIncrementEvent e, OMGPlayer p) {
super(e);
OMGPI.g.event_player_jump(this);
}
RegionBoardEventListener.java 文件源码
项目:regionboard
阅读 21
收藏 0
点赞 0
评论 0
@EventHandler(priority=EventPriority.MONITOR, ignoreCancelled=true)
public void onPlayerStatisticIncrementEvent(PlayerStatisticIncrementEvent event) {
Statistic stat = event.getStatistic();
if (! RegionBoardPlugin.isStatTracked(stat)) {
return;
}
Player player = event.getPlayer();
if (! plugin.getPlayerPositionMonitor().isPlayerInAnyRegion(player)) {
return;
}
List<Region> regions;
try {
regions = plugin.getRegionMap().getRegionsByLocation(player.getLocation());
if (! regions.isEmpty()) {
Region firstRegion = regions.get(0);
boolean isMatched = firstRegion.matchStatistic(stat, event.getMaterial(), event.getEntityType());
if (isMatched) {
ScoreboardController scoreboardController = plugin.getScoreboardController();
scoreboardController.updateScoreForPlayer(player, firstRegion, event.getNewValue() - event.getPreviousValue());
}
}
} catch (MissingDBService e) {
e.printStackTrace();
}
}