@SubscribeEvent public void onServerTick(ServerTickEvent event) { if (event.phase != Phase.END) { return; } // Only doing it once if (event.side == Side.CLIENT) { return; } dayTick += 1; // Ticking up if (dayTick >= Main.getControlRefreshTick()) // A day has passed. Refreshing faction chunk health now { TerritoryHandler.refreshChunkControl(); dayTick = 0; // Reset } saveTick += 1; if (saveTick >= Main.getSaveTick()) // Autosave { SaveHandler.saveFactionsToFile(); saveTick = 0; // Reset } }
@SubscribeEvent public void onServerTick(ServerTickEvent event) { if (event.phase != Phase.END) { return; } // Only doing it once if (event.side == Side.CLIENT) { return; } // Chunk upkeep if (Main.shouldCheckUpkeep()) { TerritoryHandler.checkUpkeep(); } // Chunk control regeneration TerritoryHandler.checkChunkControl(); // Autosave Main.checkAutoSave(); Main.checkDisplayTick(); }
@SubscribeEvent public void onServerTick(ServerTickEvent evt) { if (!isEnabled() || evt.phase != Phase.START) { return; } // server is ready now if (!serverReady.get()) { L.info("Server tick sync ready"); serverReady.set(true); serverTick.set(0); } // wait for client side if (!clientReady.get()) { return; } // now sync with the client waitFor(evt.side, serverTick, clientTick, serverAhead, clientAhead); }
@SubscribeEvent public void onServerTick(ServerTickEvent event) { if (event.phase == TickEvent.Phase.END) { return; } // Once every second if (++this.serverTickCounter >= 20) { this.serverTickCounter = 0; ChunkLoading.getInstance().tickChunkTimeouts(); } // This is currently only used for debug tasks, so let's disable it normally //TaskScheduler.getInstance().runTasks(); this.teleportPlayers(); ++this.playerTickCounter; }
@SubscribeEvent public void onTick(ServerTickEvent event) { if (event.phase == Phase.START) { SessionManager.getInstance().getAllSessions().forEachRemaining(sess -> { sess.taskManager.runTasks(); }); } }
@SubscribeEvent public void serverTick(ServerTickEvent event) { if (event.phase == Phase.START) { WirelessBolt.update(WirelessBolt.serverboltlist); RedstoneEtherAddons.server().processTrackers(); } else { RedstoneEtherAddons.server().tickTriangs(); RedstoneEtherAddons.server().updateREPTimeouts(); } }
@Override protected void onServerTick(ServerTickEvent ev) { if (this.worldCreated && !this.serverStarted) { // The server has started ticking - we can set up its state machine, // and move on to the next state in our own machine. this.serverStarted = true; MalmoMod.instance.initIntegratedServer(currentMissionInit()); // Needs to be done from the server thread. episodeHasCompleted(ClientState.WAITING_FOR_SERVER_READY); } }
@Override protected void onServerTick(TickEvent.ServerTickEvent ev) { try { checkForMissionCommand(); } catch (Exception e) { // TODO: What now? e.printStackTrace(); } }
@Override protected void onServerTick(ServerTickEvent ev) { if (!ServerStateMachine.this.checkWatchList()) { // Something has gone wrong - we've lost a connection. // Need to respond to this, otherwise we'll sit here forever waiting for a client that no longer exists // to tell us it's finished its mission. MalmoMod.safeSendToAll(MalmoMessageType.SERVER_ABORT); episodeHasCompleted(ServerState.ERROR); } }
@SubscribeEvent public void onServerTick(ServerTickEvent e) { if(counter == 1) { MinecraftServer server = FMLCommonHandler.instance().getMinecraftServerInstance(); World world = server.getEntityWorld(); if(world.isRemote == false) { long totalTime = world.getWorldTime(); long currentTime = totalTime % 24000; if(currentTime == 1) { System.out.println("Time is 0"); WorldTurn turn = WorldTurn.get(world); int currentTurn = turn.advanceTurn(); System.out.println("New Turn!! The World Turn is now " + currentTurn); ArrayList<EntityPlayerMP> playerList = (ArrayList<EntityPlayerMP>)(world.getMinecraftServer().getServer().getPlayerList().getPlayers()); for(int i=0; i < playerList.size(); i++) { EntityPlayer player = playerList.get(i); ITurn playerTurn = player.getCapability(CapPlayerTurn.TURN_CAP, null); playerTurn.addTurn(); } } } counter = 0; } else { counter++; } }
/** * Event listener for world tick event. * * This is probably not the optimal solution, but I'm not really sure how * to schedule things in Minecraft other way than timers and ticks. * * This method is responsible for scheduling record unloading and counting * down recording process. */ @SubscribeEvent public void onWorldTick(ServerTickEvent event) { if (!CommonProxy.manager.records.isEmpty() && Blockbuster.proxy.config.record_unload) { this.checkAndUnloadRecords(); } if (!CommonProxy.manager.scheduled.isEmpty()) { this.checkScheduled(); } }
@SubscribeEvent public void tickServer(ServerTickEvent event) { if (event.phase == Phase.START && event.type == net.minecraftforge.fml.common.gameevent.TickEvent.Type.SERVER) { PlayerHandler.update(Phase.START); } else if (event.phase == Phase.END && event.type == net.minecraftforge.fml.common.gameevent.TickEvent.Type.SERVER) { PlayerHandler.update(Phase.END); } }
@SubscribeEvent(priority = EventPriority.HIGH) public static void onServerTick(ServerTickEvent event) { String flag = "20"; if (!System.getProperty("index.alchemy.runtime.debug.server", "").equals(flag)) { // runtime do some thing { //System.out.println(EventHelper.getAllHandler(PlayerDropsEvent.class, 0)); } System.setProperty("index.alchemy.runtime.debug.server", flag); } onRunnableTick(event.side, event.phase); }
@EventHandler public void tickCellSaving(ServerTickEvent event) { if (event.phase != Phase.END) return; if (ticks++ < 5*20) return; ticks = 0; saveCellAllocations(); }
@SubscribeEvent public void updateRecuringNotifications(ServerTickEvent event) { if (event.phase != Phase.END) return; synchronized (recuring_notifications) { Iterator<Notice> iterator = recuring_notifications.iterator(); while (iterator.hasNext()) { Notice rn = iterator.next(); if (rn.isInvalid() || !rn.updateNotice()) { iterator.remove(); } } } }
@SubscribeEvent public void tick(ServerTickEvent event) { if (event.phase == Phase.START) { TileEntityWrathLamp.handleAirUpdates(); } else { worldgenManager.tickRetrogenQueue(); } }
@SubscribeEvent public void onServerTick(ServerTickEvent event) { //System.out.println("---"); for (WorldServer ws : MinecraftServer.getServer().worldServers) { if (ws.getClass() == WorldServer.class) //FIX: WorldServerMulti instance cause lookup loss. //TODO: Investigate why. WiWorldData.get(ws).tick(); } //System.out.println("---"); }
@SubscribeEvent public void onServerTick(ServerTickEvent event) { if (event.phase == TickEvent.Phase.START) { ImageHandler.tickTimeouts(); } }
@SubscribeEvent public static void onServerTick(ServerTickEvent event) { if(event.phase == Phase.START) { CommonProxy.updateCurrentTime(); CommonProxy.refreshWorldInfos(); } else { WorldTaskManager.doServerTick(); // thought it might be more determinism if simulator runs after block/entity ticks Simulator.instance().onServerTick(event); // TODO: remove // Temporary drone service for(Domain domain : DomainManager.instance().getAllDomains()) { try { for(int i = 0; i < 1; i++) { ExcavationTask task = (ExcavationTask) domain.jobManager.claimReadyWork(TaskType.EXCAVATION, null).get(); if(task == null) break; World world = task.job().world(); if(world != null) world.setBlockToAir(task.pos()); task.complete(); } } catch (Exception e) { e.printStackTrace(); } } } }
/** * The Fast Fishing option is implemented on server tick * * @param event */ @SubscribeEvent public void onServerTickEvent(ServerTickEvent event) { /* * Easter Egg: Perform the Fast Fishing on the server tick event and apply to * all players, so that it will also affect all players that join a single player game that has * been opened to LAN play. */ if (ModAutoFish.config_autofish_enable && ModAutoFish.config_autofish_fastFishing && event.phase == Phase.END) { _autoFish.triggerBites(); } }
/** * The server tick just clears out old UUIDs from players who have disconnected. */ @SubscribeEvent public void serverTick(ServerTickEvent event){ for (UUID uuid : tickTimes.keySet()){ if (FMLCommonHandler.instance().getMinecraftServerInstance().getEntityFromUuid(uuid) == null){ purgeUUID(uuid); } } }
@SuppressWarnings("static-method") @SideOnly(Side.SERVER) @SubscribeEvent public void serverTick(ServerTickEvent event) { if (event.phase == Phase.START) { sendAnalyticsActivityEvent(); } }
@SubscribeEvent public void onServerTick(ServerTickEvent event) { if (event.phase == TickEvent.Phase.END) { ServerState.checkIfServerChanged(FMLCommonHandler.instance().getMinecraftServerInstance(), (WorldInfo)null); } }
@Override public void tickEnd(TickEvent.ServerTickEvent evt, Profiler theProfiler) { theProfiler.startSection("ItemCharging"); chargeItems(inventory.getStacks()); theProfiler.endStartSection("EnergyTransmitting"); transmitEnergy(); if (energyStored != prevEnergyStored) { theProfiler.endStartSection("EnergyBalancing"); distributeEnergyToBanks(); } theProfiler.endSection(); powerTrackerIn.tick(energyReceived); powerTrackerOut.tick(energySend); prevEnergyStored = energyStored; energyReceived = 0; energySend = 0; if (firstUpate) { if (!capBanks.isEmpty()) { PacketHandler.sendToAllAround(new PacketNetworkStateResponse(this), capBanks.get(0)); PacketHandler.sendToAllAround(new PacketNetworkEnergyResponse(this), capBanks.get(0)); } firstUpate = false; } }
/** Subclass should overrride this to act on server ticks.*/ protected void onServerTick(ServerTickEvent ev) {}
@SubscribeEvent public void onServerTick(TickEvent.ServerTickEvent ev) { // Use the server tick to ensure we regularly update our state (from the server thread) updateState(); }
@Override protected void onServerTick(ServerTickEvent ev) { // We wait until we start to get server ticks, at which point we assume Minecraft has finished starting up. episodeHasCompleted(ServerState.DORMANT); }
@Override protected void onServerTick(ServerTickEvent ev) { if (!ServerStateMachine.this.checkWatchList()) onError(null); // We've lost a connection - abort the mission. }
@Override protected void onServerTick(ServerTickEvent ev) { if (this.missionHasEnded) return; // In case we get in here after deciding the mission is over. if (!ServerStateMachine.this.checkWatchList()) onError(null); // We've lost a connection - abort the mission. if (ev.phase == Phase.START) { // Measure our performance - especially useful if we've been overclocked. if (this.secondStartTimeMs == 0) this.secondStartTimeMs = System.currentTimeMillis(); long timeNow = System.currentTimeMillis(); if (timeNow - this.secondStartTimeMs > 1000) { long targetTicks = 1000 / TimeHelper.serverTickLength; if (this.tickCount < targetTicks) System.out.println("Warning: managed " + this.tickCount + "/" + targetTicks + " ticks this second."); this.secondStartTimeMs = timeNow; this.tickCount = 0; } this.tickCount++; } if (ev.phase == Phase.END && getHandlers() != null && getHandlers().worldDecorator != null) { MinecraftServer server = MinecraftServer.getServer(); if (server.worldServers != null && server.worldServers.length != 0) { World world = server.getEntityWorld(); getHandlers().worldDecorator.update(world); } } if (ev.phase == Phase.END) { if (getHandlers() != null && getHandlers().quitProducer != null && getHandlers().quitProducer.doIWantToQuit(currentMissionInit())) { ServerStateMachine.this.quitCode = getHandlers().quitProducer.getOutcome(); onMissionEnded(true); } else if (this.runningAgents.isEmpty()) { ServerStateMachine.this.quitCode = "All agents finished"; onMissionEnded(true); } // We need to make sure we keep the weather within mission parameters. // We set the weather just after building the world, but it's not a permanent setting, // and apparently there is a known bug in Minecraft that means the weather sometimes changes early. // To get around this, we reset it periodically. if (MinecraftServer.getServer().getTickCounter() % 500 == 0) { EnvironmentHelper.setMissionWeather(currentMissionInit()); } } }