当前位置: 首页>>代码示例>>Java>>正文


Java CraftStatistic.getMaterialFromStatistic方法代码示例

本文整理汇总了Java中org.bukkit.craftbukkit.CraftStatistic.getMaterialFromStatistic方法的典型用法代码示例。如果您正苦于以下问题:Java CraftStatistic.getMaterialFromStatistic方法的具体用法?Java CraftStatistic.getMaterialFromStatistic怎么用?Java CraftStatistic.getMaterialFromStatistic使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.bukkit.craftbukkit.CraftStatistic的用法示例。


在下文中一共展示了CraftStatistic.getMaterialFromStatistic方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: handleStatisticsIncrease

import org.bukkit.craftbukkit.CraftStatistic; //导入方法依赖的package包/类
public static Cancellable handleStatisticsIncrease(EntityPlayer entityHuman, net.minecraft.stats.StatBase statistic, int current, int incrementation) {
    Player player = ((EntityPlayerMP) entityHuman).getBukkitEntity();
    Event event;
    if (statistic instanceof net.minecraft.stats.Achievement) {
        if (current != 0) {
            return null;
        }
        event = new PlayerAchievementAwardedEvent(player, CraftStatistic.getBukkitAchievement((net.minecraft.stats.Achievement) statistic));
    } else {
        org.bukkit.Statistic stat = CraftStatistic.getBukkitStatistic(statistic);
        switch (stat) {
            case FALL_ONE_CM:
            case BOAT_ONE_CM:
            case CLIMB_ONE_CM:
            case DIVE_ONE_CM:
            case FLY_ONE_CM:
            case HORSE_ONE_CM:
            case MINECART_ONE_CM:
            case PIG_ONE_CM:
            case PLAY_ONE_TICK:
            case SWIM_ONE_CM:
            case WALK_ONE_CM:
                // Do not process event for these - too spammy
                return null;
            default:
        }
        if (stat.getType() == Type.UNTYPED) {
            event = new PlayerStatisticIncrementEvent(player, stat, current, current + incrementation);
        } else if (stat.getType() == Type.ENTITY) {
            EntityType entityType = CraftStatistic.getEntityTypeFromStatistic(statistic);
            event = new PlayerStatisticIncrementEvent(player, stat, current, current + incrementation, entityType);
        } else {
            Material material = CraftStatistic.getMaterialFromStatistic(statistic);
            event = new PlayerStatisticIncrementEvent(player, stat, current, current + incrementation, material);
        }
    }
    entityHuman.worldObj.getServer().getPluginManager().callEvent(event);
    return (Cancellable) event;
}
 
开发者ID:alexandrage,项目名称:CauldronGit,代码行数:40,代码来源:CraftEventFactory.java

示例2: handleStatisticsIncrease

import org.bukkit.craftbukkit.CraftStatistic; //导入方法依赖的package包/类
public static Cancellable handleStatisticsIncrease(EntityHuman entityHuman, net.minecraft.server.Statistic statistic, int current, int incrementation) {
    Player player = ((EntityPlayer) entityHuman).getBukkitEntity();
    Event event;
    if (statistic instanceof net.minecraft.server.Achievement) {
        if (current != 0) {
            return null;
        }
        event = new PlayerAchievementAwardedEvent(player, CraftStatistic.getBukkitAchievement((net.minecraft.server.Achievement) statistic));
    } else {
        org.bukkit.Statistic stat = CraftStatistic.getBukkitStatistic(statistic);
        switch (stat) {
            case FALL_ONE_CM:
            case BOAT_ONE_CM:
            case CLIMB_ONE_CM:
            case DIVE_ONE_CM:
            case FLY_ONE_CM:
            case HORSE_ONE_CM:
            case MINECART_ONE_CM:
            case PIG_ONE_CM:
            case PLAY_ONE_TICK:
            case SWIM_ONE_CM:
            case WALK_ONE_CM:
                // Do not process event for these - too spammy
                return null;
            default:
        }
        if (stat.getType() == Type.UNTYPED) {
            event = new PlayerStatisticIncrementEvent(player, stat, current, current + incrementation);
        } else if (stat.getType() == Type.ENTITY) {
            EntityType entityType = CraftStatistic.getEntityTypeFromStatistic(statistic);
            event = new PlayerStatisticIncrementEvent(player, stat, current, current + incrementation, entityType);
        } else {
            Material material = CraftStatistic.getMaterialFromStatistic(statistic);
            event = new PlayerStatisticIncrementEvent(player, stat, current, current + incrementation, material);
        }
    }
    entityHuman.world.getServer().getPluginManager().callEvent(event);
    return (Cancellable) event;
}
 
开发者ID:OvercastNetwork,项目名称:CraftBukkit,代码行数:40,代码来源:CraftEventFactory.java

示例3: handleStatisticsIncrease

import org.bukkit.craftbukkit.CraftStatistic; //导入方法依赖的package包/类
public static Cancellable handleStatisticsIncrease(EntityPlayer entityHuman, net.minecraft.stats.StatBase statistic, int current, int incrementation) {
    Player player = ((EntityPlayerMP) entityHuman).getBukkitEntity();
    Event event;
    if (statistic instanceof net.minecraft.stats.Achievement) {
        if (current != 0) {
            return null;
        }
        event = new PlayerAchievementAwardedEvent(player, CraftStatistic.getBukkitAchievement((net.minecraft.stats.Achievement) statistic));
    } else {
        org.bukkit.Statistic stat = CraftStatistic.getBukkitStatistic(statistic);
        if (stat == null)
        {
            return null;
        }
        switch (stat) {
            case FALL_ONE_CM:
            case BOAT_ONE_CM:
            case CLIMB_ONE_CM:
            case DIVE_ONE_CM:
            case FLY_ONE_CM:
            case HORSE_ONE_CM:
            case MINECART_ONE_CM:
            case PIG_ONE_CM:
            case PLAY_ONE_TICK:
            case SWIM_ONE_CM:
            case WALK_ONE_CM:
                // Do not process event for these - too spammy
                return null;
            default:
        }
        if (stat.getType() == Type.UNTYPED) {
            event = new PlayerStatisticIncrementEvent(player, stat, current, current + incrementation);
        } else if (stat.getType() == Type.ENTITY) {
            EntityType entityType = CraftStatistic.getEntityTypeFromStatistic(statistic);
            event = new PlayerStatisticIncrementEvent(player, stat, current, current + incrementation, entityType);
        } else {
            Material material = CraftStatistic.getMaterialFromStatistic(statistic);
            event = new PlayerStatisticIncrementEvent(player, stat, current, current + incrementation, material);
        }
    }
    entityHuman.worldObj.getServer().getPluginManager().callEvent(event);
    return (Cancellable) event;
}
 
开发者ID:UraniumMC,项目名称:Uranium,代码行数:44,代码来源:CraftEventFactory.java

示例4: handleStatisticsIncrease

import org.bukkit.craftbukkit.CraftStatistic; //导入方法依赖的package包/类
public static Cancellable handleStatisticsIncrease(EntityHuman entityHuman, net.minecraft.server.Statistic statistic, int current, int incrementation) {
    Player player = ((EntityPlayer) entityHuman).getBukkitEntity();
    Event event;
    if (statistic instanceof net.minecraft.server.Achievement) {
        if (current != 0) {
            return null;
        }
        event = new PlayerAchievementAwardedEvent(player, CraftStatistic.getBukkitAchievement((net.minecraft.server.Achievement) statistic));
    } else {
        org.bukkit.Statistic stat = CraftStatistic.getBukkitStatistic(statistic);
        if (stat == null) {
            System.err.println("Unhandled statistic: " + statistic);
            return null;
        }
        switch (stat) {
            case FALL_ONE_CM:
            case BOAT_ONE_CM:
            case CLIMB_ONE_CM:
            case DIVE_ONE_CM:
            case FLY_ONE_CM:
            case HORSE_ONE_CM:
            case MINECART_ONE_CM:
            case PIG_ONE_CM:
            case PLAY_ONE_TICK:
            case SWIM_ONE_CM:
            case WALK_ONE_CM:
            case SPRINT_ONE_CM:
            case CROUCH_ONE_CM:
            case TIME_SINCE_DEATH:
                // Do not process event for these - too spammy
                return null;
            default:
        }
        if (stat.getType() == Type.UNTYPED) {
            event = new PlayerStatisticIncrementEvent(player, stat, current, current + incrementation);
        } else if (stat.getType() == Type.ENTITY) {
            EntityType entityType = CraftStatistic.getEntityTypeFromStatistic(statistic);
            event = new PlayerStatisticIncrementEvent(player, stat, current, current + incrementation, entityType);
        } else {
            Material material = CraftStatistic.getMaterialFromStatistic(statistic);
            event = new PlayerStatisticIncrementEvent(player, stat, current, current + incrementation, material);
        }
    }
    entityHuman.world.getServer().getPluginManager().callEvent(event);
    return (Cancellable) event;
}
 
开发者ID:tgnmc,项目名称:Craftbukkit,代码行数:47,代码来源:CraftEventFactory.java

示例5: handleStatisticsIncrease

import org.bukkit.craftbukkit.CraftStatistic; //导入方法依赖的package包/类
public static Cancellable handleStatisticsIncrease(EntityHuman entityHuman, net.minecraft.server.Statistic statistic, int current, int incrementation) {
    Player player = ((EntityPlayer) entityHuman).getBukkitEntity();
    Event event;
    if (statistic instanceof net.minecraft.server.Achievement) {
        if (current != 0) {
            return null;
        }
        event = new PlayerAchievementAwardedEvent(player, CraftStatistic.getBukkitAchievement((net.minecraft.server.Achievement) statistic));
    } else {
        org.bukkit.Statistic stat = CraftStatistic.getBukkitStatistic(statistic);
        if (stat == null) {
            System.err.println("Unhandled statistic: " + statistic);
            return null;
        }
        switch (stat) {
            case FALL_ONE_CM:
            case BOAT_ONE_CM:
            case CLIMB_ONE_CM:
            case DIVE_ONE_CM:
            case FLY_ONE_CM:
            case HORSE_ONE_CM:
            case MINECART_ONE_CM:
            case PIG_ONE_CM:
            case PLAY_ONE_TICK:
            case SWIM_ONE_CM:
            case WALK_ONE_CM:
            case SPRINT_ONE_CM:
            case CROUCH_ONE_CM:
            case TIME_SINCE_DEATH:
            case SNEAK_TIME:
                // Do not process event for these - too spammy
                return null;
            default:
        }
        if (stat.getType() == Type.UNTYPED) {
            event = new PlayerStatisticIncrementEvent(player, stat, current, current + incrementation);
        } else if (stat.getType() == Type.ENTITY) {
            EntityType entityType = CraftStatistic.getEntityTypeFromStatistic(statistic);
            event = new PlayerStatisticIncrementEvent(player, stat, current, current + incrementation, entityType);
        } else {
            Material material = CraftStatistic.getMaterialFromStatistic(statistic);
            event = new PlayerStatisticIncrementEvent(player, stat, current, current + incrementation, material);
        }
    }
    entityHuman.world.getServer().getPluginManager().callEvent(event);
    return (Cancellable) event;
}
 
开发者ID:bergerkiller,项目名称:SpigotSource,代码行数:48,代码来源:CraftEventFactory.java


注:本文中的org.bukkit.craftbukkit.CraftStatistic.getMaterialFromStatistic方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。