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


Java Difficulty類代碼示例

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


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

示例1: testDifficulty

import org.bukkit.Difficulty; //導入依賴的package包/類
@Test
public void testDifficulty() throws InputException {
    Class[] inputTypes = {Difficulty.class, Difficulty.class};
    String[] input = {"3", "peaceful"};

    Object[] output = InputFormatter.getTypesFromInput(inputTypes, Arrays.asList(input), null);

    // First let's make sure we didn't lose anything, or get anything
    assertEquals(inputTypes.length, output.length);

    // Next let's make sure everything is the right type
    for (Object object : output) {
        assertTrue(object instanceof Difficulty);
    }

    // Finally, let's make sure the values are correct
    assertSame(output[0], Difficulty.HARD);
    assertSame(output[1], Difficulty.PEACEFUL);
}
 
開發者ID:zachbr,項目名稱:Debuggery,代碼行數:20,代碼來源:InputFormatterTest.java

示例2: load

import org.bukkit.Difficulty; //導入依賴的package包/類
@Override
public ModuleCollection load(Match match) {
    ModuleCollection<MapDifficulty> results = new ModuleCollection<>();
    try {
        switch (NumUtils.parseInt(match.getDocument().getRootElement().getChildText("difficulty"))) {
            case 0:
                results.add(new MapDifficulty(Difficulty.PEACEFUL));
                break;
            case 1:
                results.add(new MapDifficulty(Difficulty.EASY));
                break;
            case 2:
                results.add(new MapDifficulty(Difficulty.NORMAL));
                break;
            case 3:
                results.add(new MapDifficulty(Difficulty.HARD));
                break;
        }
    } catch (NumberFormatException | NullPointerException e) {
    }
    return results;
}
 
開發者ID:dentmaged,項目名稱:Cardinal-Plus,代碼行數:23,代碼來源:MapDifficultyBuilder.java

示例3: createWorld

import org.bukkit.Difficulty; //導入依賴的package包/類
public void createWorld(String name, long seed, String generator, Environment env, WorldType type, boolean genStructures, boolean providedSeed) {
    name = name.toLowerCase();
    World w = this.createBukkitWorld(name, seed, generator, env, type, genStructures, providedSeed);
    this.database.setValue("worlds." + name + ".seed", seed);
    if(generator != null) {
        this.database.setValue("worlds." + name + ".generator", generator);
    }

    this.database.setValue("worlds." + name + ".environment", env.name());
    this.database.setValue("worlds." + name + ".type", type.name());
    this.database.setValue("worlds." + name + ".generateStructures", genStructures);
    this.database.setValue("worlds." + name + ".pvp", false);
    this.database.setValue("worlds." + name + ".difficulty", Difficulty.EASY.name());
    this.database.setValue("worlds." + name + ".gamemode", GameMode.SURVIVAL.name());
    WorldData world = new WorldData(this.module, this, name);
    world.setWorld(w);
    this.worlds.put(name, world);
}
 
開發者ID:Steveice10,項目名稱:Peacecraft,代碼行數:19,代碼來源:WorldManager.java

示例4: onEnable

import org.bukkit.Difficulty; //導入依賴的package包/類
public void onEnable() {
	if(plugin.getConfig().getInt("endPortalLocationEpisodeAnnounce") == 0) {
		String msg = "No value found for 'endPortalLocationEpisodeAnnounce', disabling end portal announce";
		RftdLogger.log(Level.WARN, msg);

		endPortalLocationAnnounced = true;
	}

	Scoreboard scoreboard = Bukkit.getScoreboardManager().getMainScoreboard();
	Objective objective = scoreboard.getObjective(DisplaySlot.SIDEBAR);
	if(objective != null)
		objective.unregister();

	String eggLocationString = plugin.getConfig().getString("egg");
	if(eggLocationString != null) {
		Location eggLocation = RftdHelper.stringToBlockLocation(eggLocationString);
		setEggLocation(eggLocation);
	}

	for(World world : Bukkit.getWorlds()) {
		world.setDifficulty(Difficulty.PEACEFUL);
		world.setFullTime(6000);
		world.setGameRuleValue("doDaylightCycle", "false");
	}
}
 
開發者ID:kyriog,項目名稱:rftd,代碼行數:26,代碼來源:RftdController.java

示例5: load

import org.bukkit.Difficulty; //導入依賴的package包/類
@Override
public ModuleCollection<MapDifficulty> load(Match match) {
    ModuleCollection<MapDifficulty> results = new ModuleCollection<>();
    try {
        switch (Numbers.parseInt(match.getDocument().getRootElement().getChildText("difficulty"))) {
            case 0:
                results.add(new MapDifficulty(Difficulty.PEACEFUL));
                break;
            case 1:
                results.add(new MapDifficulty(Difficulty.EASY));
                break;
            case 2:
                results.add(new MapDifficulty(Difficulty.NORMAL));
                break;
            case 3:
                results.add(new MapDifficulty(Difficulty.HARD));
                break;
        }
    } catch (NumberFormatException | NullPointerException e) {
    }
    return results;
}
 
開發者ID:twizmwazin,項目名稱:CardinalPGM,代碼行數:23,代碼來源:MapDifficultyBuilder.java

示例6: apply

import org.bukkit.Difficulty; //導入依賴的package包/類
public static void apply(World world) {

        world.setKeepSpawnInMemory(true);

        world.setDifficulty(Difficulty.HARD);

        world.setStorm(false);
        world.setThundering(false);
        world.setWeatherDuration(9999999);
        world.setTime(6000);
        if (SkyApi.getSm().isDedicated()) {

            Bukkit.getServer().setDefaultGameMode(GameMode.ADVENTURE);
        }
        world.setGameRuleValue("doDaylightCycle", "false");
        world.setGameRuleValue("doFireTick", "false");
        world.setGameRuleValue("doMobSpawning", "false");
        world.setGameRuleValue("mobGriefing", "false");
        world.save();
        world.setAutoSave(true);
    }
 
開發者ID:Relicum,項目名稱:SuperSkyBros,代碼行數:22,代碼來源:ApplyWorldSettings.java

示例7: PortalPair

import org.bukkit.Difficulty; //導入依賴的package包/類
public PortalPair(String name, InstanceEntrancePortal enter, InstanceDestinationPortal destination, double entryPrice, double createPrice, ItemStack entryItem, ItemStack createItem, int unloadTime, int recreateTime, World.Environment environment, Difficulty difficulty, String defaultParty, Facing entranceFacing, Facing destinationFacing, int maxPlayers, int maxInstances) {
    this.name = name;
    this.enter = enter;
    this.destination = destination;
    this.entryPrice = entryPrice;
    this.entryItem = entryItem;
    this.createPrice = createPrice;
    this.createItem = createItem;
    this.unloadTime = unloadTime;
    this.recreateTime = recreateTime;
    this.environment = environment;
    this.difficulty = difficulty;
    this.defaultParty = defaultParty;
    this.maxPlayers = maxPlayers;
    this.maxInstances = maxInstances;
    enter.setFacing(entranceFacing);
    destination.setFacing(destinationFacing);
    enter.setPortalPair(this);
    destination.setPortalPair(this);
}
 
開發者ID:cybertiger,項目名稱:Bukkit-Instances,代碼行數:21,代碼來源:PortalPair.java

示例8: execute

import org.bukkit.Difficulty; //導入依賴的package包/類
@Override
public List<String> execute(Instances instances, Player player, String[] args) {
    if (args.length != 1) {
        return null;
    }
    Session session = instances.getSession(player);

    if (session.getEntrance() == null) {
        throw new InvocationException("You have not set the entrance portal location.");
    }
    if (session.getDestination() == null) {
        throw new InvocationException("You have not set the destination portal location.");
    }
    if (instances.getPortalPair(args[0]) != null) {
        throw new InvocationException("That portal pair already exists.");
    }
    InstanceEntrancePortal entrance = new InstanceEntrancePortal(session.getEntrance());
    InstanceDestinationPortal destination = new InstanceDestinationPortal(session.getDestination());
    World instanceWorld = instances.getServer().getWorld(destination.getCuboid().getWorld());
    World.Environment environment = instanceWorld.getEnvironment();
    Difficulty difficulty = instanceWorld.getDifficulty();
    PortalPair pair = new PortalPair(args[0], entrance, destination, environment, difficulty);
    instances.addPortalPair(pair);
    session.clear();
    return msg("Portal " + args[0] + " created.");
}
 
開發者ID:cybertiger,項目名稱:Bukkit-Instances,代碼行數:27,代碼來源:CreatePortal.java

示例9: MapInfo

import org.bukkit.Difficulty; //導入依賴的package包/類
public MapInfo(SemanticVersion proto,
               @Nullable String slug,
               String name,
               SemanticVersion version,
               MapDoc.Edition edition,
               MapDoc.Phase phase,
               @Nullable BaseComponent game,
               MapDoc.Genre genre,
               Set<MapDoc.Gamemode> gamemodes,
               BaseComponent objective,
               List<Contributor> authors,
               List<Contributor> contributors,
               List<String> rules,
               @Nullable Difficulty difficulty,
               Environment dimension,
               boolean friendlyFire) {

    this.id = new MapId(slug != null ? slug : MapId.slugifyName(name), edition, phase);

    this.proto = checkNotNull(proto);
    this.name = checkNotNull(name);
    this.version = checkNotNull(version);
    this.game = game;
    this.genre = checkNotNull(genre);
    this.gamemodes = checkNotNull(gamemodes);
    this.objective = checkNotNull(objective);
    this.authors = checkNotNull(authors);
    this.contributors = checkNotNull(contributors);
    this.rules = checkNotNull(rules);
    this.difficulty = difficulty;
    this.dimension = checkNotNull(dimension);
    this.friendlyFire = friendlyFire;

}
 
開發者ID:OvercastNetwork,項目名稱:ProjectAres,代碼行數:35,代碼來源:MapInfo.java

示例10: loadMap

import org.bukkit.Difficulty; //導入依賴的package包/類
public boolean loadMap(int gNumber) {
	WorldController wc = SkyWarsReloaded.getWC();
	String mapName = name + "_" + gNumber;
	boolean mapExists = false;
	File target = new File(rootDirectory, mapName);
	if(target.isDirectory()) {			 
		if(target.list().length > 0) {
 			mapExists = true;
		}	 
	}
	if (mapExists) {
		SkyWarsReloaded.getWC().deleteWorld(mapName);
	}
	
	wc.copyWorld(source, target);
	
	boolean loaded = SkyWarsReloaded.getWC().loadWorld(mapName);
	if (loaded) {
		World world = SkyWarsReloaded.get().getServer().getWorld(mapName);
	    world.setAutoSave(false);
	    world.setThundering(false);
	    world.setStorm(false);
	    world.setDifficulty(Difficulty.NORMAL);
	    world.setSpawnLocation(2000, 0, 2000);
	    world.setTicksPerAnimalSpawns(1);
	    world.setTicksPerMonsterSpawns(1);
        world.setGameRuleValue("doMobSpawning", "false");
        world.setGameRuleValue("mobGriefing", "false");
        world.setGameRuleValue("doFireTick", "false");
        world.setGameRuleValue("showDeathMessages", "false");
	}
	return loaded;
}
 
開發者ID:smessie,項目名稱:SkyWarsReloaded,代碼行數:34,代碼來源:GameMap.java

示例11: prepareWorld

import org.bukkit.Difficulty; //導入依賴的package包/類
public void prepareWorld(World w) {
    w.setPVP(true);
    w.setGameRuleValue("doDaylightCycle", "false");
    w.setStorm(false);
    w.setDifficulty(Difficulty.PEACEFUL);
    w.setTime(14000);
    w.getLivingEntities().stream().filter(e -> !e.getType().equals(EntityType.PLAYER)).forEach(Entity::remove);
    initArena();
    w.setAutoSave(false);
}
 
開發者ID:cadox8,項目名稱:PA,代碼行數:11,代碼來源:ArenaManager.java

示例12: onLoad

import org.bukkit.Difficulty; //導入依賴的package包/類
@Override
public void onLoad() {
    add(Difficulty.PEACEFUL, "Peaceful", "0", "P", "Pe");
    add(Difficulty.EASY, "Easy", "1", "E", "Ez", "Es");
    add(Difficulty.NORMAL, "Normal", "2", "N", "No", "Norm", "Default", "Def");
    add(Difficulty.HARD, "Hard", "3", "H", "Ha");
}
 
開發者ID:GameBoxx,項目名稱:GameBoxx,代碼行數:8,代碼來源:Difficulties.java

示例13: getDifficulty

import org.bukkit.Difficulty; //導入依賴的package包/類
public Difficulty getDifficulty() {
    if (this.hasDifficulty()) {
        return this.difficulty;
    }

    return DEFAULT_DIFFICULTY;
}
 
開發者ID:ShootGame,項目名稱:Arcade2,代碼行數:8,代碼來源:ArcadeMap.java

示例14: parseDifficulty

import org.bukkit.Difficulty; //導入依賴的package包/類
private Difficulty parseDifficulty(Element parent) {
    if (parent != null) {
        return XMLDifficulty.parse(parent, Difficulty.PEACEFUL);
    }

    return null;
}
 
開發者ID:ShootGame,項目名稱:Arcade2,代碼行數:8,代碼來源:XMLMapParser.java

示例15: parse

import org.bukkit.Difficulty; //導入依賴的package包/類
public static Difficulty parse(Element xml, Difficulty def) {
    Difficulty difficulty = parse(xml);
    if (difficulty != null) {
        return difficulty;
    }

    return def;
}
 
開發者ID:ShootGame,項目名稱:Arcade2,代碼行數:9,代碼來源:XMLDifficulty.java


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