Package org.bukkit

Examples of org.bukkit.Statistic


        dB.report(scriptEntry, getName(), action.debug() + statistic.debug() + amount.debug() + players.debug()
                + (material != null ? material.debug() : entity != null ? entity.debug() : ""));

        Action act = Action.valueOf(action.asString().toUpperCase());
        Statistic stat = Statistic.valueOf(statistic.asString().toUpperCase());
        int amt = amount.asInt();
        switch (stat.getType()) {

            case BLOCK:
            case ITEM:
                Material mat = material.getMaterial();
                switch (act) {
View Full Code Here


        return mcMMO.getHolidayManager().getDateRange(day.getTime(), start.getTime(), end.getTime());
    }

    public void handleStatisticEvent(PlayerStatisticIncrementEvent event) {
        Player player = event.getPlayer();
        Statistic statistic = event.getStatistic();
        int newValue = event.getNewValue();

        int modifier;
        switch (statistic) {
            case DAMAGE_TAKEN:
View Full Code Here

            Command.broadcastCommandMessage(sender, String.format("Successfully given all achievements to %s", player.getName()));
            return true;
        }

        Achievement achievement = Bukkit.getUnsafe().getAchievementFromInternalName(statisticString);
        Statistic statistic = Bukkit.getUnsafe().getStatisticFromInternalName(statisticString);

        if (achievement != null) {
            if (player.hasAchievement(achievement)) {
                sender.sendMessage(String.format("%s already has achievement %s", player.getName(), statisticString));
                return true;
            }

            PlayerAchievementAwardedEvent event = new PlayerAchievementAwardedEvent(player, achievement);
            Bukkit.getServer().getPluginManager().callEvent(event);
            if (event.isCancelled()) {
                sender.sendMessage(String.format("Unable to award %s the achievement %s", player.getName(), statisticString));
                return true;
            }
            player.awardAchievement(achievement);
               
            Command.broadcastCommandMessage(sender, String.format("Successfully given %s the stat %s", player.getName(), statisticString));
            return true;
        }

        if (statistic == null) {
            sender.sendMessage(String.format("Unknown achievement or statistic '%s'", statisticString));
            return true;
        }

        if (statistic.getType() == Type.UNTYPED) {
            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;
            }
            player.incrementStatistic(statistic);
            Command.broadcastCommandMessage(sender, String.format("Successfully given %s the stat %s", player.getName(), statisticString));
            return true;
        }

        if (statistic.getType() == Type.ENTITY) {
            EntityType entityType = EntityType.fromName(statisticString.substring(statisticString.lastIndexOf(".") + 1));

            if (entityType == null) {
                sender.sendMessage(String.format("Unknown achievement or statistic '%s'", statisticString));
                return true;
View Full Code Here

TOP

Related Classes of org.bukkit.Statistic

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.