замена переменной INSTANCE на метод getInstance() в EventBusGetter
This commit is contained in:
@@ -76,7 +76,7 @@ public class GameLoop extends Thread {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!eventChunkLoad.getNeedLoadChunks().isEmpty()) {
|
if (!eventChunkLoad.getNeedLoadChunks().isEmpty()) {
|
||||||
EventBusGetter.INSTANCE.post(eventChunkLoad);
|
EventBusGetter.getInstance().post(eventChunkLoad);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -90,7 +90,7 @@ public class GameLoop extends Thread {
|
|||||||
public void run() {
|
public void run() {
|
||||||
TPS_WATCHER.startWatch();
|
TPS_WATCHER.startWatch();
|
||||||
|
|
||||||
EventBusGetter.INSTANCE.register(this);
|
EventBusGetter.getInstance().register(this);
|
||||||
|
|
||||||
while (!isInterrupted()) {
|
while (!isInterrupted()) {
|
||||||
TPS_WATCHER.check();
|
TPS_WATCHER.check();
|
||||||
|
|||||||
@@ -5,9 +5,11 @@
|
|||||||
package mc.core.eventbus;
|
package mc.core.eventbus;
|
||||||
|
|
||||||
import com.google.common.eventbus.EventBus;
|
import com.google.common.eventbus.EventBus;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
public final class EventBusGetter {
|
public final class EventBusGetter {
|
||||||
public static final EventBus INSTANCE = new EventBus();
|
@Getter
|
||||||
|
private static final EventBus instance = new EventBus();
|
||||||
|
|
||||||
private EventBusGetter() {
|
private EventBusGetter() {
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ public class NettyServer implements Server {
|
|||||||
public void start() throws StartServerException {
|
public void start() throws StartServerException {
|
||||||
log.info("Use protocol {}", StatusResponsePacket.NAME);
|
log.info("Use protocol {}", StatusResponsePacket.NAME);
|
||||||
|
|
||||||
EventBusGetter.INSTANCE.register(new PlayerEventListener());
|
EventBusGetter.getInstance().register(new PlayerEventListener());
|
||||||
|
|
||||||
bossGroup = new NioEventLoopGroup(1);
|
bossGroup = new NioEventLoopGroup(1);
|
||||||
workerGroup = new NioEventLoopGroup(workerGroupCount);
|
workerGroup = new NioEventLoopGroup(workerGroupCount);
|
||||||
|
|||||||
@@ -140,7 +140,7 @@ public class LoginHandler extends AbstractStateHandler implements LoginStateHand
|
|||||||
CS_PlayerMoveEvent event = new CS_PlayerMoveEvent(player, player.getLocation());
|
CS_PlayerMoveEvent event = new CS_PlayerMoveEvent(player, player.getLocation());
|
||||||
event.setNewLocation(player.getLocation());
|
event.setNewLocation(player.getLocation());
|
||||||
event.setRecalcChunk(true);
|
event.setRecalcChunk(true);
|
||||||
EventBusGetter.INSTANCE.post(event);
|
EventBusGetter.getInstance().post(event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ public class PlayHandler extends AbstractStateHandler implements PlayStateHandle
|
|||||||
player.getLocation().getPitch(),
|
player.getLocation().getPitch(),
|
||||||
player.getLocation().getWorld()
|
player.getLocation().getWorld()
|
||||||
));
|
));
|
||||||
EventBusGetter.INSTANCE.post(event);
|
EventBusGetter.getInstance().post(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Handler
|
@Handler
|
||||||
|
|||||||
Reference in New Issue
Block a user