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


Java World.setGameRuleValue方法代碼示例

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


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

示例1: onGameStart

import org.bukkit.World; //導入方法依賴的package包/類
/**
 * Set always night
 * @param game Game instance
 */
@Override
public void onGameStart(SurvivalGame game)
{
    World world = this.plugin.getServer().getWorlds().get(0);
    world.setGameRuleValue("doDaylightCycle", "false");
    world.setTime(15000);

    for (GamePlayer player : (Collection<GamePlayer>) game.getInGamePlayers().values())
    {
        Player p = player.getPlayerIfOnline();

        if (p == null)
            continue;

        p.playSound(p.getLocation(), Sound.WITHER_SPAWN, 0.9F, 1F);
    }
}
 
開發者ID:SamaGames,項目名稱:SurvivalAPI,代碼行數:22,代碼來源:NightmareModule.java

示例2: setGameRules

import org.bukkit.World; //導入方法依賴的package包/類
public static void setGameRules(World world) {
    world.setGameRuleValue("keepInventory", "true");
    world.setGameRuleValue("doMobSpawning", "false");
    world.setGameRuleValue("doDaylightCycle", "false");
    world.setGameRuleValue("commandBlockOutput", "false");
    world.setGameRuleValue("logAdminCommands", "false");
    world.setGameRuleValue("doWeatherCycle", "false");
    world.setGameRuleValue("disableElytraMovementCheck", "true");
    world.setGameRuleValue("announceAdvancements", "false");
}
 
開發者ID:WarzoneMC,項目名稱:Warzone,代碼行數:11,代碼來源:GameRuleModule.java

示例3: loadMap

import org.bukkit.World; //導入方法依賴的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

示例4: KillToToggleTimeModule

import org.bukkit.World; //導入方法依賴的package包/類
/**
 * Constructor
 *
 * @param plugin Parent plugin
 * @param api API instance
 * @param moduleConfiguration Module configuration
 */
public KillToToggleTimeModule(SurvivalPlugin plugin, SurvivalAPI api, Map<String, Object> moduleConfiguration)
{
    super(plugin, api, moduleConfiguration);

    for (World world : plugin.getServer().getWorlds())
    {
        world.setTime(DAY);
        world.setGameRuleValue("doDaylightCycle", "false");
    }

    this.isDay = true;
}
 
開發者ID:SamaGames,項目名稱:SurvivalAPI,代碼行數:20,代碼來源:KillToToggleTimeModule.java

示例5: prepareWorld

import org.bukkit.World; //導入方法依賴的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

示例6: start

import org.bukkit.World; //導入方法依賴的package包/類
@Override
public void start() {
    World world = getPhase().getFeature(MapFeature.class).getWorld();
    world.setGameRuleValue("doDaylightCycle", shouldChange + "");
    world.setTime(time);
}
 
開發者ID:VoxelGamesLib,項目名稱:VoxelGamesLibv2,代碼行數:7,代碼來源:TimeFeature.java


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