Java Code Examples for org.bukkit.World#setGameRuleValue()
The following examples show how to use
org.bukkit.World#setGameRuleValue() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: HealthRegenerationModule.java From UHC with MIT License | 5 votes |
@Override public void onEnable() { for (final World world : Bukkit.getWorlds()) { if (worlds.worldMatches(world)) { world.setGameRuleValue(GAME_RULE, "true"); } } }
Example 2
Source File: HealthRegenerationModule.java From UHC with MIT License | 5 votes |
@Override public void onDisable() { for (final World world : Bukkit.getWorlds()) { if (worlds.worldMatches(world)) { world.setGameRuleValue(GAME_RULE, "false"); } } }
Example 3
Source File: PermadayCommand.java From UHC with MIT License | 5 votes |
@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; }
Example 4
Source File: ZombieEscape.java From ZombieEscape with GNU General Public License v2.0 | 5 votes |
@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)); }
Example 5
Source File: TimeFeature.java From VoxelGamesLibv2 with MIT License | 4 votes |
@Override public void enable() { World world = getPhase().getFeature(MapFeature.class).getWorld(); world.setGameRuleValue("doDaylightCycle", shouldChange + ""); world.setTime(time); }
Example 6
Source File: NoTimeChangeFeature.java From VoxelGamesLibv2 with MIT License | 4 votes |
@Override public void enable() { World w = getPhase().getFeature(MapFeature.class).getWorld(); w.setTime(time); w.setGameRuleValue("doDaylightCycle", "false"); }
Example 7
Source File: Game.java From AnnihilationPro with MIT License | 4 votes |
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; }
Example 8
Source File: NMSHandler.java From SkyWarsReloaded with GNU General Public License v3.0 | 4 votes |
@Override public void setGameRule(World world, String rule, String bool) { world.setGameRuleValue(rule, bool); }
Example 9
Source File: NMSHandler.java From SkyWarsReloaded with GNU General Public License v3.0 | 4 votes |
@Override public void setGameRule(World world, String rule, String bool) { world.setGameRuleValue(rule, bool); }
Example 10
Source File: NMSHandler.java From SkyWarsReloaded with GNU General Public License v3.0 | 4 votes |
@Override public void setGameRule(World world, String rule, String bool) { world.setGameRuleValue(rule, bool); }
Example 11
Source File: NMSHandler.java From SkyWarsReloaded with GNU General Public License v3.0 | 4 votes |
@Override public void setGameRule(World world, String rule, String bool) { world.setGameRuleValue(rule, bool); }
Example 12
Source File: NMSHandler.java From SkyWarsReloaded with GNU General Public License v3.0 | 4 votes |
@Override public void setGameRule(World world, String rule, String bool) {world.setGameRuleValue(rule, bool); }
Example 13
Source File: NMSHandler.java From SkyWarsReloaded with GNU General Public License v3.0 | 4 votes |
@Override public void setGameRule(World world, String rule, String bool) { world.setGameRuleValue(rule, bool); }
Example 14
Source File: NMSHandler.java From SkyWarsReloaded with GNU General Public License v3.0 | 4 votes |
@Override public void setGameRule(World world, String rule, String bool) { world.setGameRuleValue(rule, bool); }
Example 15
Source File: NMSHandler.java From SkyWarsReloaded with GNU General Public License v3.0 | 4 votes |
@Override public void setGameRule(World world, String rule, String bool) { world.setGameRuleValue(rule, bool); }