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


Java Difficulty.getByValue方法代碼示例

本文整理匯總了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;
}
 
開發者ID:ShootGame,項目名稱:Arcade2,代碼行數:16,代碼來源:XMLDifficulty.java

示例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;
}
 
開發者ID:CyberdyneCC,項目名稱:Thermos-Bukkit,代碼行數:30,代碼來源:DifficultyCommand.java

示例3: getDifficulty

import org.bukkit.Difficulty; //導入方法依賴的package包/類
public Difficulty getDifficulty() {
    return Difficulty.getByValue(this.getHandle().difficultySetting.ordinal());
}
 
開發者ID:UraniumMC,項目名稱:Uranium,代碼行數:4,代碼來源:CraftWorld.java

示例4: getDifficulty

import org.bukkit.Difficulty; //導入方法依賴的package包/類
public Difficulty getDifficulty() {
    return Difficulty.getByValue(this.getHandle().difficulty.ordinal());
}
 
開發者ID:OvercastNetwork,項目名稱:CraftBukkit,代碼行數:4,代碼來源:CraftWorld.java

示例5: getDifficulty

import org.bukkit.Difficulty; //導入方法依賴的package包/類
public Difficulty getDifficulty() {
    return Difficulty.getByValue(this.getHandle().getDifficulty().ordinal());
}
 
開發者ID:tgnmc,項目名稱:Craftbukkit,代碼行數:4,代碼來源:CraftWorld.java

示例6: getDifficulty

import org.bukkit.Difficulty; //導入方法依賴的package包/類
public Difficulty getDifficulty() {
    return Difficulty.getByValue(this.getHandle().difficulty);
}
 
開發者ID:AlmuraDev,項目名稱:Almura-Server,代碼行數:4,代碼來源:CraftWorld.java

示例7: getDifficulty

import org.bukkit.Difficulty; //導入方法依賴的package包/類
public Difficulty getDifficulty() {
    return Difficulty.getByValue(this.getHandle().field_73013_u);
}
 
開發者ID:agaricusb,項目名稱:MCPBukkit,代碼行數:4,代碼來源:CraftWorld.java


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