mirror of
https://github.com/Grasscutters/Grasscutter.git
synced 2025-12-19 10:24:47 +01:00
Enable script in big world (#884)
* add docs for tower * fix: LEAK: ByteBuf.release() was not called * enableScriptInBigWorld * not print log when loaded scripts from cache * revert the change of server tick * revert the change of server tick * fix * optimize the performance: lazy load & cache * fix the refresh group * fix NPE Co-authored-by: Melledy <52122272+Melledy@users.noreply.github.com>
This commit is contained in:
@@ -57,7 +57,6 @@ public final class GameServer extends KcpServer {
|
||||
|
||||
private final CombineManger combineManger;
|
||||
private final TowerScheduleManager towerScheduleManager;
|
||||
|
||||
public GameServer() {
|
||||
this(new InetSocketAddress(
|
||||
GAME_INFO.bindAddress,
|
||||
@@ -205,23 +204,23 @@ public final class GameServer extends KcpServer {
|
||||
}
|
||||
return DatabaseHelper.getAccountByName(username);
|
||||
}
|
||||
|
||||
public void onTick() throws Exception {
|
||||
|
||||
public synchronized void onTick(){
|
||||
Iterator<World> it = this.getWorlds().iterator();
|
||||
while (it.hasNext()) {
|
||||
World world = it.next();
|
||||
|
||||
|
||||
if (world.getPlayerCount() == 0) {
|
||||
it.remove();
|
||||
}
|
||||
|
||||
|
||||
world.onTick();
|
||||
}
|
||||
|
||||
|
||||
for (Player player : this.getPlayers().values()) {
|
||||
player.onTick();
|
||||
}
|
||||
|
||||
|
||||
ServerTickEvent event = new ServerTickEvent(); event.call();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,10 +1,5 @@
|
||||
package emu.grasscutter.server.game;
|
||||
|
||||
import java.io.File;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.Set;
|
||||
|
||||
import emu.grasscutter.Grasscutter;
|
||||
import emu.grasscutter.Grasscutter.ServerDebugMode;
|
||||
import emu.grasscutter.game.Account;
|
||||
@@ -21,6 +16,11 @@ import io.netty.buffer.ByteBuf;
|
||||
import io.netty.buffer.Unpooled;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
|
||||
import java.io.File;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.Set;
|
||||
|
||||
import static emu.grasscutter.utils.Language.translate;
|
||||
import static emu.grasscutter.Configuration.*;
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ public class PacketSceneEntityAppearNotify extends BasePacket {
|
||||
this(player.getTeamManager().getCurrentAvatarEntity());
|
||||
}
|
||||
|
||||
public PacketSceneEntityAppearNotify(Collection<GameEntity> entities, VisionType visionType) {
|
||||
public PacketSceneEntityAppearNotify(Collection<? extends GameEntity> entities, VisionType visionType) {
|
||||
super(PacketOpcodes.SceneEntityAppearNotify, true);
|
||||
|
||||
SceneEntityAppearNotify.Builder proto = SceneEntityAppearNotify.newBuilder()
|
||||
|
||||
Reference in New Issue
Block a user