本文整理汇总了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);
}
}
示例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");
}
示例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;
}
示例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;
}
示例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);
}
示例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);
}