org.bukkit.World#setGameRuleValue ( )源码实例Demo

下面列出了org.bukkit.World#setGameRuleValue ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: UHC   文件: HealthRegenerationModule.java
@Override
public void onEnable() {
    for (final World world : Bukkit.getWorlds()) {
        if (worlds.worldMatches(world)) {
            world.setGameRuleValue(GAME_RULE, "true");
        }
    }
}
 
源代码2 项目: UHC   文件: HealthRegenerationModule.java
@Override
public void onDisable() {
    for (final World world : Bukkit.getWorlds()) {
        if (worlds.worldMatches(world)) {
            world.setGameRuleValue(GAME_RULE, "false");
        }
    }
}
 
源代码3 项目: UHC   文件: PermadayCommand.java
@Override
protected boolean runCommand(CommandSender sender, OptionSet options) {
    List<World> worlds = worldsSpec.values(options);

    if (worlds.size() == 0) {
        if (!(sender instanceof Player)) {
            sender.sendMessage(messages.getRaw("provide world"));
            return true;
        }

        worlds = Lists.newArrayList(((Player) sender).getWorld());
    }

    final boolean on = !options.has(turnOff);

    for (final World world : worlds) {
        if (on) {
            world.setGameRuleValue(DO_DAYLIGHT_CYCLE_GAMERULE, "false");
            world.setTime(SUN_OVERHEAD_TIME);
        } else {
            world.setGameRuleValue(DO_DAYLIGHT_CYCLE_GAMERULE, "true");
        }

        final String message = messages.evalTemplate(
                on ? "on notification" : "off notification",
                ImmutableMap.of("world", world.getName())
        );

        for (final Player player : world.getPlayers()) {
            player.sendMessage(message);
        }
    }

    sender.sendMessage(messages.evalTemplate(
            on ? "on completed" : "off completed",
            ImmutableMap.of("count", worlds.size())
    ));

    return true;
}
 
源代码4 项目: ZombieEscape   文件: ZombieEscape.java
@Override
public void onEnable() {
    configuration = new Configuration(this);
    configuration.setupHikari(hikari, configuration.getSettingsConfig());

    gameArena = new GameArena(this);
    menuManager = new MenuManager(this);

    serverSpawn = configuration.getSpawn();

    Bukkit.setSpawnRadius(0);

    World world = Bukkit.getWorlds().get(0);
    world.setSpawnFlags(false, false);
    world.setGameRuleValue("doMobSpawning", "false");

    for (Entity entity : world.getEntities()) {
        if (!(entity instanceof Player) && entity instanceof LivingEntity) {
            entity.remove();
        }
    }

    registerListeners();
    getCommand("game").setExecutor(new Game());
    getCommand("setlobbyspawn").setExecutor(new SetLobbySpawn(this));
    getCommand("ztele").setExecutor(new Ztele(this));

    menuManager.addMenu("hkits", new HumanKitMenu("Human Kit Menu", 9, this));
    menuManager.addMenu("zkits", new ZombieKitMenu("Zombie Kit Menu", 9, this));
    menuManager.addMenu("vote", new VoteMenu(Utils.color("&8Vote"), 9, gameArena));
}
 
源代码5 项目: VoxelGamesLibv2   文件: TimeFeature.java
@Override
public void enable() {
    World world = getPhase().getFeature(MapFeature.class).getWorld();
    world.setGameRuleValue("doDaylightCycle", shouldChange + "");
    world.setTime(time);
}
 
源代码6 项目: VoxelGamesLibv2   文件: NoTimeChangeFeature.java
@Override
public void enable() {
    World w = getPhase().getFeature(MapFeature.class).getWorld();
    w.setTime(time);
    w.setGameRuleValue("doDaylightCycle", "false");
}
 
源代码7 项目: AnnihilationPro   文件: Game.java
public static boolean loadGameMap(File worldFolder)
	{
//		if(tempWorldDirec == null)
//		{
//			tempWorldDirec = new File(AnnihilationMain.getInstance().getDataFolder()+"/TempWorld");
//			if(!tempWorldDirec.exists())
//				tempWorldDirec.mkdirs();
//		}
		
		if(worldFolder.exists() && worldFolder.isDirectory())
		{
			File[] files = worldFolder.listFiles(new FilenameFilter()
			{
				public boolean accept(File file, String name)
				{
					return name.equalsIgnoreCase("level.dat");
				}
			});
			
			if ((files != null) && (files.length == 1))
			{
				try
				{
					//We have confirmed that the folder has a level.dat
					//Now we should copy all the files into the temp world folder
					
					//worldDirec = worldFolder;
					
					//FileUtils.copyDirectory(worldDirec, tempWorldDirec);
					
					String path = worldFolder.getPath();
					if(path.contains("plugins"))
						path = path.substring(path.indexOf("plugins"));
					WorldCreator cr = new WorldCreator(path);
					//WorldCreator cr = new WorldCreator(new File(worldFolder,"level.dat").toString());
					cr.environment(Environment.NORMAL);
					World mapWorld = Bukkit.createWorld(cr);
					if(mapWorld != null)
					{
						if(GameMap != null)
						{
							GameMap.unLoadMap();
							GameMap = null;
						}
						mapWorld.setAutoSave(false);
						mapWorld.setGameRuleValue("doMobSpawning", "false");
						mapWorld.setGameRuleValue("doFireTick", "false");	
//						File anniConfig = new File(worldFolder,"AnniMapConfig.yml");
//						if(!anniConfig.exists())
//								anniConfig.createNewFile();
						//YamlConfiguration mapconfig = ConfigManager.loadMapConfig(anniConfig);
						Game.GameMap = new GameMap(mapWorld.getName(),worldFolder);
						GameMap.registerListeners(AnnihilationMain.getInstance());
						Game.worldNames.put(worldFolder.getName().toLowerCase(), mapWorld.getName());
						Game.niceNames.put(mapWorld.getName().toLowerCase(),worldFolder.getName());
						return true;
					}
				}
				catch(Exception e)
				{
					e.printStackTrace();
					GameMap = null;
					return false;
				}
			}
		}
		return false;
	}
 
源代码8 项目: SkyWarsReloaded   文件: NMSHandler.java
@Override
public void setGameRule(World world, String rule, String bool) {
	world.setGameRuleValue(rule, bool);
}
 
源代码9 项目: SkyWarsReloaded   文件: NMSHandler.java
@Override
public void setGameRule(World world, String rule, String bool) {
	world.setGameRuleValue(rule, bool);
}
 
源代码10 项目: SkyWarsReloaded   文件: NMSHandler.java
@Override
public void setGameRule(World world, String rule, String bool) {
	world.setGameRuleValue(rule, bool);
}
 
源代码11 项目: SkyWarsReloaded   文件: NMSHandler.java
@Override
public void setGameRule(World world, String rule, String bool) {
	world.setGameRuleValue(rule, bool);
}
 
源代码12 项目: SkyWarsReloaded   文件: NMSHandler.java
@Override
public void setGameRule(World world, String rule, String bool) {world.setGameRuleValue(rule, bool);
}
 
源代码13 项目: SkyWarsReloaded   文件: NMSHandler.java
@Override
public void setGameRule(World world, String rule, String bool) {
	world.setGameRuleValue(rule, bool);
}
 
源代码14 项目: SkyWarsReloaded   文件: NMSHandler.java
@Override
public void setGameRule(World world, String rule, String bool) {
	world.setGameRuleValue(rule, bool);
}
 
源代码15 项目: SkyWarsReloaded   文件: NMSHandler.java
@Override
public void setGameRule(World world, String rule, String bool) {
	world.setGameRuleValue(rule, bool);
}