當前位置: 首頁>>代碼示例>>Java>>正文


Java Statistic類代碼示例

本文整理匯總了Java中org.bukkit.Statistic的典型用法代碼示例。如果您正苦於以下問題:Java Statistic類的具體用法?Java Statistic怎麽用?Java Statistic使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Statistic類屬於org.bukkit包,在下文中一共展示了Statistic類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getBukkitStatisticByName

import org.bukkit.Statistic; //導入依賴的package包/類
public static org.bukkit.Statistic getBukkitStatisticByName(String name) {
    if (name.startsWith("stat.killEntity")) {
        name = "stat.killEntity";
    }
    if (name.startsWith("stat.entityKilledBy")) {
        name = "stat.entityKilledBy";
    }
    if (name.startsWith("stat.breakItem")) {
        name = "stat.breakItem";
    }
    if (name.startsWith("stat.useItem")) {
        name = "stat.useItem";
    }
    if (name.startsWith("stat.mineBlock")) {
        name = "stat.mineBlock";
    }
    if (name.startsWith("stat.craftItem")) {
        name = "stat.craftItem";
    }
    return statistics.get(name);
}
 
開發者ID:UraniumMC,項目名稱:Uranium,代碼行數:22,代碼來源:CraftStatistic.java

示例2: getMaterialStatistic

import org.bukkit.Statistic; //導入依賴的package包/類
public static net.minecraft.stats.StatBase getMaterialStatistic(org.bukkit.Statistic stat, Material material) {
    try {
        if (stat == Statistic.MINE_BLOCK) {
            return StatList.mineBlockStatArray[material.getId()];
        }
        if (stat == Statistic.CRAFT_ITEM) {
            return StatList.objectCraftStats[material.getId()];
        }
        if (stat == Statistic.USE_ITEM) {
            return StatList.objectUseStats[material.getId()];
        }
        if (stat == Statistic.BREAK_ITEM) {
            return StatList.objectBreakStats[material.getId()];
        }
    } catch (ArrayIndexOutOfBoundsException e) {
        return null;
    }
    return null;
}
 
開發者ID:UraniumMC,項目名稱:Uranium,代碼行數:20,代碼來源:CraftStatistic.java

示例3: getStatistic

import org.bukkit.Statistic; //導入依賴的package包/類
@Override
public int getStatistic(Statistic arg0) throws IllegalArgumentException {
	switch (arg0) {
	case PLAY_ONE_TICK:
		long first = nukkit.getFirstPlayed();
		long diff = System.currentTimeMillis() - first; // This is the
														// difference in
														// millis
		int seconds = (int) (diff / 1000) % 60; // And this is the
												// difference in seconds
		return seconds * 20; // And this is in ticks
	default:
		break;
	}
	throw Pokkit.unsupported();
}
 
開發者ID:rutgerkok,項目名稱:Pokkit,代碼行數:17,代碼來源:PokkitPlayer.java

示例4: getMaterialStatistic

import org.bukkit.Statistic; //導入依賴的package包/類
public static net.minecraft.server.Statistic getMaterialStatistic(org.bukkit.Statistic stat, Material material) {
    try {
        if (stat == Statistic.MINE_BLOCK) {
            return StatisticList.MINE_BLOCK_COUNT[material.getId()];
        }
        if (stat == Statistic.CRAFT_ITEM) {
            return StatisticList.CRAFT_BLOCK_COUNT[material.getId()];
        }
        if (stat == Statistic.USE_ITEM) {
            return StatisticList.USE_ITEM_COUNT[material.getId()];
        }
        if (stat == Statistic.BREAK_ITEM) {
            return StatisticList.BREAK_ITEM_COUNT[material.getId()];
        }
    } catch (ArrayIndexOutOfBoundsException e) {
        return null;
    }
    return null;
}
 
開發者ID:OvercastNetwork,項目名稱:CraftBukkit,代碼行數:20,代碼來源:CraftStatistic.java

示例5: putFarming

import org.bukkit.Statistic; //導入依賴的package包/類
public boolean putFarming(String str, Player player){
	UUID uuid = player.getUniqueId();

	//各データをセット : ダイピ・種・ジャガイモ・人參使用數
	sql.setCommands("use_dPickaxe",
			(player).getStatistic(Statistic.USE_ITEM, Material.DIAMOND_PICKAXE));
	sql.setCommands("use_seed",
			(player).getStatistic(Statistic.USE_ITEM, Material.SEEDS));
	sql.setCommands("use_potate",
			(player).getStatistic(Statistic.USE_ITEM, Material.POTATO_ITEM));
	sql.setCommands("use_carrot",
			(player).getStatistic(Statistic.USE_ITEM, Material.CARROT_ITEM));

	//各出力データを送信
	return sql.insertCommands(str, uuid.toString());
}
 
開發者ID:circularmoonray,項目名稱:sqlstat,代碼行數:17,代碼來源:Stat.java

示例6: getEntityStatistic

import org.bukkit.Statistic; //導入依賴的package包/類
public static net.minecraft.stats.StatBase getEntityStatistic(org.bukkit.Statistic stat, EntityType entity) {
    EntityEggInfo entityEggInfo = (EntityEggInfo) EntityList.entityEggs.get(Integer.valueOf(entity.getTypeId()));

    if (entityEggInfo != null) {
        return entityEggInfo.field_151512_d;
    }
    return null;
}
 
開發者ID:UraniumMC,項目名稱:Uranium,代碼行數:9,代碼來源:CraftStatistic.java

示例7: onStatisticIncrement

import org.bukkit.Statistic; //導入依賴的package包/類
@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);
    }
}
 
開發者ID:4a2e532e,項目名稱:RealisticSwimming,代碼行數:8,代碼來源:RSwimListener.java

示例8: PlayerStatisticIncrementEvent

import org.bukkit.Statistic; //導入依賴的package包/類
public PlayerStatisticIncrementEvent(Player player, Statistic statistic, int initialValue, int newValue) {
    super (player);
    this.statistic = statistic;
    this.initialValue = initialValue;
    this.newValue = newValue;
    this.entityType = null;
    this.material = null;
}
 
開發者ID:CyberdyneCC,項目名稱:Thermos-Bukkit,代碼行數:9,代碼來源:PlayerStatisticIncrementEvent.java

示例9: getStatistic

import org.bukkit.Statistic; //導入依賴的package包/類
public long getStatistic(PlayerStat stat) {
	switch (stat) {
		case PLAY_TIME_MS: {
			return Long.valueOf(String.valueOf(Bukkit.getPlayer(uuid).getStatistic(Statistic.PLAY_ONE_TICK) * 50));
		}
		default: {
			if (statistics.containsKey(stat)) return statistics.get(stat);
			else return 0;
		}
	}
}
 
開發者ID:TheBusyBiscuit,項目名稱:CS-CoreLib,代碼行數:12,代碼來源:PlayerStats.java

示例10: getStatisticFromInternalName

import org.bukkit.Statistic; //導入依賴的package包/類
@Override
public Statistic getStatisticFromInternalName(String name) {
	try {
		return Statistic.valueOf(name.toUpperCase().replace("MINECRAFT:", ""));
	} catch (IllegalArgumentException e) {
		return null;
	}
}
 
開發者ID:rutgerkok,項目名稱:Pokkit,代碼行數:9,代碼來源:PokkitUnsafe.java

示例11: get

import org.bukkit.Statistic; //導入依賴的package包/類
@Nullable
protected Number[] get(Event e) {
	Statistic stat = (Statistic) Utils.getEnum(Statistic.class, statistic.getSingle(e));
	if (entity != null) {
		EntityType type = (EntityType) Utils.getEnum(EntityType.class, entity.getSingle(e));
		return new Number[]{player.getSingle(e).getStatistic(stat, type)};
	}
	if (material != null) {
		Material m = (Material) Utils.getEnum(Material.class, material.getSingle(e));
		return new Number[]{player.getSingle(e).getStatistic(stat, m)};
	}
	return new Number[]{player.getSingle(e).getStatistic(stat)};
}
 
開發者ID:TheLimeGlass,項目名稱:Skellett,代碼行數:14,代碼來源:ExprStatistics.java

示例12: setEntity

import org.bukkit.Statistic; //導入依賴的package包/類
private void setEntity(String statistic, Player player, String entity, Integer value) {
	Statistic stat = (Statistic) Utils.getEnum(Statistic.class, statistic);
	if (entity != null) {
		EntityType type = (EntityType) Utils.getEnum(EntityType.class, entity);
		player.setStatistic(stat, type, value);
	}
}
 
開發者ID:TheLimeGlass,項目名稱:Skellett,代碼行數:8,代碼來源:ExprStatistics.java

示例13: setMaterial

import org.bukkit.Statistic; //導入依賴的package包/類
private void setMaterial(String statistic, Player player, String material, Integer value) {
	Statistic stat = (Statistic) Utils.getEnum(Statistic.class, statistic);
	if (material != null) {
		Material m = (Material) Utils.getEnum(Material.class, material);
		player.setStatistic(stat, m, value);
	}
	player.setStatistic(stat, value);
}
 
開發者ID:TheLimeGlass,項目名稱:Skellett,代碼行數:9,代碼來源:ExprStatistics.java

示例14: setStatistic

import org.bukkit.Statistic; //導入依賴的package包/類
@Override
public void setStatistic(Statistic statistic, Material material, int newValue) {
    Validate.notNull(statistic, "Statistic cannot be null");
    Validate.notNull(material, "Material cannot be null");
    Validate.isTrue(newValue >= 0, "Value must be greater than or equal to 0");
    Validate.isTrue(statistic.getType() == Type.BLOCK || statistic.getType() == Type.ITEM, "This statistic does not take a Material parameter");
    net.minecraft.server.Statistic nmsStatistic = CraftStatistic.getMaterialStatistic(statistic, material);
    Validate.notNull(nmsStatistic, "The supplied Material does not have a corresponding statistic");
    getHandle().getStatisticManager().setStatistic(getHandle(), nmsStatistic, newValue);
}
 
開發者ID:OvercastNetwork,項目名稱:CraftBukkit,代碼行數:11,代碼來源:CraftPlayer.java

示例15: getStatistic

import org.bukkit.Statistic; //導入依賴的package包/類
@Override
public int getStatistic(Statistic statistic, EntityType entityType) {
    Validate.notNull(statistic, "Statistic cannot be null");
    Validate.notNull(entityType, "EntityType cannot be null");
    Validate.isTrue(statistic.getType() == Type.ENTITY, "This statistic does not take an EntityType parameter");
    net.minecraft.server.Statistic nmsStatistic = CraftStatistic.getEntityStatistic(statistic, entityType);
    Validate.notNull(nmsStatistic, "The supplied EntityType does not have a corresponding statistic");
    return getHandle().getStatisticManager().getStatisticValue(nmsStatistic);
}
 
開發者ID:OvercastNetwork,項目名稱:CraftBukkit,代碼行數:10,代碼來源:CraftPlayer.java


注:本文中的org.bukkit.Statistic類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。