本文整理匯總了Java中org.bukkit.Difficulty.getByValue方法的典型用法代碼示例。如果您正苦於以下問題:Java Difficulty.getByValue方法的具體用法?Java Difficulty.getByValue怎麽用?Java Difficulty.getByValue使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.bukkit.Difficulty
的用法示例。
在下文中一共展示了Difficulty.getByValue方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: parse
import org.bukkit.Difficulty; //導入方法依賴的package包/類
public static Difficulty parse(String value, Difficulty def) {
Difficulty result = null;
if (value != null) {
try {
result = Difficulty.getByValue(Integer.parseInt(value));
} catch (NumberFormatException ex) {
result = Difficulty.valueOf(parseEnumValue(value));
}
}
if (result != null) {
return result;
}
return def;
}
示例2: execute
import org.bukkit.Difficulty; //導入方法依賴的package包/類
@Override
public boolean execute(CommandSender sender, String currentAlias, String[] args) {
if (!testPermission(sender)) return true;
if (args.length != 1 || args[0].length() == 0) {
sender.sendMessage(ChatColor.RED + "Usage: " + usageMessage);
return false;
}
Difficulty difficulty = Difficulty.getByValue(getDifficultyForString(sender, args[0]));
if (Bukkit.isHardcore()) {
difficulty = Difficulty.HARD;
}
Bukkit.getWorlds().get(0).setDifficulty(difficulty);
int levelCount = 1;
if (Bukkit.getAllowNether()) {
Bukkit.getWorlds().get(levelCount).setDifficulty(difficulty);
levelCount++;
}
if (Bukkit.getAllowEnd()) {
Bukkit.getWorlds().get(levelCount).setDifficulty(difficulty);
}
Command.broadcastCommandMessage(sender, "Set difficulty to " + difficulty.toString());
return true;
}
示例3: getDifficulty
import org.bukkit.Difficulty; //導入方法依賴的package包/類
public Difficulty getDifficulty() {
return Difficulty.getByValue(this.getHandle().difficultySetting.ordinal());
}
示例4: getDifficulty
import org.bukkit.Difficulty; //導入方法依賴的package包/類
public Difficulty getDifficulty() {
return Difficulty.getByValue(this.getHandle().difficulty.ordinal());
}
示例5: getDifficulty
import org.bukkit.Difficulty; //導入方法依賴的package包/類
public Difficulty getDifficulty() {
return Difficulty.getByValue(this.getHandle().getDifficulty().ordinal());
}
示例6: getDifficulty
import org.bukkit.Difficulty; //導入方法依賴的package包/類
public Difficulty getDifficulty() {
return Difficulty.getByValue(this.getHandle().difficulty);
}
示例7: getDifficulty
import org.bukkit.Difficulty; //導入方法依賴的package包/類
public Difficulty getDifficulty() {
return Difficulty.getByValue(this.getHandle().field_73013_u);
}