world.setTime(value);
@Override public void setTime(long time) { w.setTime(time); }
@Override public void set(Long newValue) { final World world = getCBWorld(); if (world != null) { world.setTime(newValue); } }
public void run_season_events() { java.util.Date date = new Date(); Calendar cal = Calendar.getInstance(); cal.setTime(date); int month = cal.get(Calendar.MONTH); if (month == 9) { World world = this.getServer().getWorld("world"); world.setTime(20000); world.setStorm(false); spookyMode = true; } else { spookyMode = false; } }
public void setWorldToTime(World world) { long time = world.getTime(); time -= time % 24000; world.setTime(time + 24000 + getTimeTicks()); }
public void commitGameRules() { List<World> worlds = Bukkit.getWorlds(); Iterator<Map.Entry<GameRule, Boolean>> it = rules.entrySet().iterator(); while (it.hasNext()) { Map.Entry<GameRule, Boolean> gameRuleEntry = it.next(); String gameRuleName = gameRuleEntry.getKey().getGameRuleName(); String gameRuleValue = gameRuleEntry.getValue().toString(); for (World world : worlds) { world.setGameRuleValue(gameRuleName, gameRuleValue); if (gameRuleEntry.getKey() == GameRule.DO_DAYLIGHT_CYCLE && !gameRuleEntry.getValue()) { long time = world.getTime(); time -= time % 24000; world.setTime(time + 24000 + 6000); } } } }
@Override public void run(String playerID) { World world = PlayerConverter.getPlayer(playerID).getWorld(); long time = amount; if (add) { time += world.getTime(); } world.setTime(time % 24000); }
private void configureWorldLocks() { if (config.timeLocks != null) { for (Map.Entry<String, Object> entry : config.timeLocks.entrySet()) { int time = 0; try { time = InputUtil.TimeParser.matchMCWorldTime(String.valueOf(entry.getValue())); } catch (CommandException e) { CommandBook.logger().warning("Time lock: Failed to parse time '" + entry.getValue() + "'"); continue; } lockedTimes.put(entry.getKey(), time); World world = CommandBook.server().getWorld(entry.getKey()); if (world == null) { CommandBook.logger().info("Could not time-lock unknown world '" + entry.getKey() + "'"); continue; } world.setTime(time); lock(world); CommandBook.logger().info("Time locked to '" + ChatUtil.getTimeString(time) + "' for world '" + world.getName() + "'"); } } }
private void timechk() { List<World> serverWorlds = plugin.getServer().getWorlds(); serverWorlds.forEach((w) -> { if (w.getName().contains("TARDIS_") && w.getEnvironment().equals(Environment.NORMAL)) { Long now = w.getTime(); Long dawn = 14000L; Long dusk = 21000L; if (now < dawn || now > dusk) { // set the time to dawn w.setTime(dawn); } } }); }
/** * Called when a World is loaded. */ @EventHandler public void onWorldLoad(WorldLoadEvent event) { World world = event.getWorld(); Integer lockedTime = getLockedTimes().get(world.getName()); if (lockedTime != null) { world.setTime(lockedTime); lock(world); CommandBook.logger().info("Time locked to '" + ChatUtil.getTimeString(lockedTime) + "' for world '" + world.getName() + "'"); } }
return SpellResult.CAST; world.setTime(targetTime); return SpellResult.CAST;
@Override public void run() { for (Game g : BedwarsRel.getInstance().getGameManager().getGames()) { if (g.getState() == GameState.RUNNING) { g.getRegion().getWorld().setTime(g.getTime()); } } } }, (long) 5 * 20, (long) 5 * 20);
@Override public void run() { for (Game g : BedwarsRel.getInstance().getGameManager().getGames()) { if (g.getState() == GameState.RUNNING) { g.getRegion().getWorld().setTime(g.getTime()); } } } }, (long) 5 * 20, (long) 5 * 20);
public void create() { arenaWorld = plugin.getServer().getWorld(Statics.ARENA_WORLD_NAME); if (arenaWorld == null) { plugin.getLogger().info("Loading world '" + Statics.ARENA_WORLD_NAME + "'."); WorldCreator arenaWorldCreator = new WorldCreator(Statics.ARENA_WORLD_NAME); arenaWorldCreator.generateStructures(false); arenaWorldCreator.generator(new VoidGenerator()); arenaWorldCreator.type(WorldType.FLAT); arenaWorldCreator.seed(0); arenaWorld = arenaWorldCreator.createWorld(); plugin.getLogger().info("Done loading world '" + Statics.ARENA_WORLD_NAME + "'."); } else { plugin.getLogger().info("The world '" + Statics.ARENA_WORLD_NAME + "' was already loaded."); } arenaWorld.setAutoSave(false); arenaWorld.getBlockAt(-5000, 45, -5000).setType(Material.STONE); arenaWorld.setSpawnLocation(-5000, 50, -5000); for (Map.Entry<String, String> entry : plugin.getConfiguration().getArenaGamerules().entrySet()) { arenaWorld.setGameRuleValue(entry.getKey(), entry.getValue()); } arenaWorld.setTime(4000); }
world.setTime(value);
/** * @param rules sets up the time and weather to match the rules */ public void setWeather(GameRuleProvider rules) { if (world == null) { return; } if (rules.isThundering() != null) { if (rules.isThundering()) { world.setThundering(true); world.setStorm(true); world.setThunderDuration(Integer.MAX_VALUE); } else { world.setThundering(false); world.setStorm(false); } } if (rules.getTime() != null) { world.setTime(rules.getTime()); } }
world.setTime(InputUtil.TimeParser.matchMCWorldTime(timeStr));
this.getRegion().getWorld().setTime(this.time);
this.getRegion().getWorld().setTime(this.time);
tardisWorld.setTime(14000L);