本文整理匯總了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);
}
示例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;
}
示例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();
}
示例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;
}
示例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());
}
示例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;
}
示例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);
}
}
示例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;
}
示例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;
}
}
}
示例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;
}
}
示例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)};
}
示例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);
}
}
示例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);
}
示例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);
}
示例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);
}