cn.nukkit.network.SourceInterface Java Examples
The following examples show how to use
cn.nukkit.network.SourceInterface.
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: Player.java From Nukkit with GNU General Public License v3.0 | 6 votes |
public Player(SourceInterface interfaz, Long clientID, String ip, int port) { super(null, new CompoundTag()); this.interfaz = interfaz; this.perm = new PermissibleBase(this); this.server = Server.getInstance(); this.lastBreak = -1; this.ip = ip; this.port = port; this.clientID = clientID; this.loaderId = Level.generateChunkLoaderId(this); this.chunksPerTick = this.server.getConfig("chunk-sending.per-tick", 4); this.spawnThreshold = this.server.getConfig("chunk-sending.spawn-threshold", 56); this.spawnPosition = null; this.gamemode = this.server.getGamemode(); this.setLevel(this.server.getDefaultLevel()); this.viewDistance = this.server.getViewDistance(); this.chunkRadius = viewDistance; //this.newPosition = new Vector3(0, 0, 0); this.boundingBox = new SimpleAxisAlignedBB(0, 0, 0, 0, 0, 0); this.lastSkinChange = -1; this.uuid = null; this.rawUUID = null; this.creationTime = System.currentTimeMillis(); }
Example #2
Source File: Player.java From Nukkit with GNU General Public License v3.0 | 6 votes |
public Player(SourceInterface interfaz, Long clientID, String ip, int port) { super(null, new CompoundTag()); this.interfaz = interfaz; this.windows = new HashMap<>(); this.perm = new PermissibleBase(this); this.server = Server.getInstance(); this.lastBreak = Long.MAX_VALUE; this.ip = ip; this.port = port; this.clientID = clientID; this.loaderId = Level.generateChunkLoaderId(this); this.chunksPerTick = (int) this.server.getConfig("chunk-sending.per-tick", 4); this.spawnThreshold = (int) this.server.getConfig("chunk-sending.spawn-threshold", 56); this.spawnPosition = null; this.gamemode = this.server.getGamemode(); this.setLevel(this.server.getDefaultLevel()); this.viewDistance = this.server.getViewDistance(); this.chunkRadius = viewDistance; //this.newPosition = new Vector3(0, 0, 0); this.boundingBox = new SimpleAxisAlignedBB(0, 0, 0, 0, 0, 0); this.uuid = null; this.rawUUID = null; this.creationTime = System.currentTimeMillis(); }
Example #3
Source File: PlayerCreationEvent.java From Jupiter with GNU General Public License v3.0 | 5 votes |
public PlayerCreationEvent(SourceInterface interfaz, Class<? extends Player> baseClass, Class<? extends Player> playerClass, Long clientId, String address, int port) { this.interfaz = interfaz; this.clientId = clientId; this.address = address; this.port = port; this.baseClass = baseClass; this.playerClass = playerClass; }
Example #4
Source File: PlayerCreationEvent.java From Nukkit with GNU General Public License v3.0 | 5 votes |
public PlayerCreationEvent(SourceInterface interfaz, Class<? extends Player> baseClass, Class<? extends Player> playerClass, Long clientId, String address, int port) { this.interfaz = interfaz; this.clientId = clientId; this.address = address; this.port = port; this.baseClass = baseClass; this.playerClass = playerClass; }
Example #5
Source File: SynapseAPI.java From SynapseAPI with GNU General Public License v3.0 | 5 votes |
private void loadEntries() { this.saveDefaultConfig(); enable = this.getConfig().getBoolean("enable", true); if (!enable) { this.getLogger().warning("The SynapseAPI is not be enabled!"); } else { if (this.getConfig().getBoolean("disable-rak")) { for (SourceInterface sourceInterface : this.getServer().getNetwork().getInterfaces()) { if (sourceInterface instanceof RakNetInterface) { sourceInterface.shutdown(); } } } List entries = this.getConfig().getList("entries"); for (Object entry : entries) { @SuppressWarnings("unchecked") ConfigSection section = new ConfigSection((LinkedHashMap) entry); String serverIp = section.getString("server-ip", "127.0.0.1"); int port = section.getInt("server-port", 10305); boolean isMainServer = section.getBoolean("isMainServer"); boolean isLobbyServer = section.getBoolean("isLobbyServer"); boolean transfer = section.getBoolean("transferOnShutdown", true); String password = section.getString("password"); String serverDescription = section.getString("description"); this.autoConnect = section.getBoolean("autoConnect", true); if (this.autoConnect) { this.addSynapseAPI(new SynapseEntry(this, serverIp, port, isMainServer, isLobbyServer, transfer, password, serverDescription)); } } } }
Example #6
Source File: SynapsePlayerCreationEvent.java From SynapseAPI with GNU General Public License v3.0 | 5 votes |
public SynapsePlayerCreationEvent(SourceInterface interfaz, Class<? extends SynapsePlayer> baseClass, Class<? extends SynapsePlayer> playerClass, Long clientId, String address, int port) { this.interfaz = interfaz; this.clientId = clientId; this.address = address; this.port = port; this.baseClass = baseClass; this.playerClass = playerClass; }
Example #7
Source File: PlayerCreationEvent.java From Nukkit with GNU General Public License v3.0 | 5 votes |
public PlayerCreationEvent(SourceInterface interfaz, Class<? extends Player> baseClass, Class<? extends Player> playerClass, Long clientId, String address, int port) { this.interfaz = interfaz; this.clientId = clientId; this.address = address; this.port = port; this.baseClass = baseClass; this.playerClass = playerClass; }
Example #8
Source File: Server.java From Jupiter with GNU General Public License v3.0 | 4 votes |
public void forceShutdown() { if (this.hasStopped) { return; } try { if (!this.isRunning) { //todo sendUsage } // clean shutdown of console thread asap this.console.shutdown(); this.hasStopped = true; this.shutdown(); if (this.rcon != null) { this.rcon.close(); } this.getLogger().debug("Disabling all plugins"); this.pluginManager.disablePlugins(); for (Player player : new ArrayList<>(this.players.values())) { player.close(player.getLeaveMessage(), (String) this.getConfig("settings.shutdown-message", "Server closed")); } this.getLogger().debug("Unloading all levels"); for (Level level : new ArrayList<>(this.getLevels().values())) { this.unloadLevel(level, true); } this.getLogger().debug("Removing event handlers"); HandlerList.unregisterAll(); this.getLogger().debug("Stopping all tasks"); this.scheduler.cancelAllTasks(); this.scheduler.mainThreadHeartbeat(Integer.MAX_VALUE); this.getLogger().debug("Closing console"); this.console.interrupt(); this.getLogger().debug("Stopping network interfaces"); for (SourceInterface interfaz : this.network.getInterfaces()) { interfaz.shutdown(); this.network.unregisterInterface(interfaz); } this.getLogger().debug("Disabling timings"); Timings.stopServer(); //todo other things } catch (Exception e) { this.logger.logException(e); //todo remove this? this.logger.emergency("Exception happened while shutting down, exit the process"); System.exit(1); } }
Example #9
Source File: PlayerCreationEvent.java From Jupiter with GNU General Public License v3.0 | 4 votes |
public SourceInterface getInterface() { return interfaz; }
Example #10
Source File: Server.java From Nukkit with GNU General Public License v3.0 | 4 votes |
public void forceShutdown() { if (this.hasStopped) { return; } try { isRunning.compareAndSet(true, false); this.hasStopped = true; if (this.rcon != null) { this.rcon.close(); } for (Player player : new ArrayList<>(this.players.values())) { player.close(player.getLeaveMessage(), this.getConfig("settings.shutdown-message", "Server closed")); } this.getLogger().debug("Disabling all plugins"); this.pluginManager.disablePlugins(); this.getLogger().debug("Removing event handlers"); HandlerList.unregisterAll(); this.getLogger().debug("Stopping all tasks"); this.scheduler.cancelAllTasks(); this.scheduler.mainThreadHeartbeat(Integer.MAX_VALUE); this.getLogger().debug("Unloading all levels"); for (Level level : this.levelArray) { this.unloadLevel(level, true); } this.getLogger().debug("Closing console"); this.consoleThread.interrupt(); this.getLogger().debug("Stopping network interfaces"); for (SourceInterface interfaz : this.network.getInterfaces()) { interfaz.shutdown(); this.network.unregisterInterface(interfaz); } if (nameLookup != null) { nameLookup.close(); } this.getLogger().debug("Disabling timings"); Timings.stopServer(); if (this.watchdog != null) { this.watchdog.kill(); } //todo other things } catch (Exception e) { log.fatal("Exception happened while shutting down, exiting the process", e); System.exit(1); } }
Example #11
Source File: PlayerCreationEvent.java From Nukkit with GNU General Public License v3.0 | 4 votes |
public SourceInterface getInterface() { return interfaz; }
Example #12
Source File: SynapsePlayer.java From SynapseAPI with GNU General Public License v3.0 | 4 votes |
public SynapsePlayer(SourceInterface interfaz, SynapseEntry synapseEntry, Long clientID, String ip, int port) { super(interfaz, clientID, ip, port); this.synapseEntry = synapseEntry; this.isSynapseLogin = this.synapseEntry != null; }
Example #13
Source File: SynapsePlayerCreationEvent.java From SynapseAPI with GNU General Public License v3.0 | 4 votes |
public SourceInterface getInterface() { return interfaz; }
Example #14
Source File: Server.java From Nukkit with GNU General Public License v3.0 | 4 votes |
public void forceShutdown() { if (this.hasStopped) { return; } try { if (!this.isRunning) { //todo sendUsage } // clean shutdown of console thread asap this.console.shutdown(); this.hasStopped = true; this.shutdown(); if (this.rcon != null) { this.rcon.close(); } this.getLogger().debug("Disabling all plugins"); this.pluginManager.disablePlugins(); for (Player player : new ArrayList<>(this.players.values())) { player.close(player.getLeaveMessage(), (String) this.getConfig("settings.shutdown-message", "Server closed")); } this.getLogger().debug("Unloading all levels"); for (Level level : this.levelArray) { this.unloadLevel(level, true); } this.getLogger().debug("Removing event handlers"); HandlerList.unregisterAll(); this.getLogger().debug("Stopping all tasks"); this.scheduler.cancelAllTasks(); this.scheduler.mainThreadHeartbeat(Integer.MAX_VALUE); this.getLogger().debug("Closing console"); this.console.interrupt(); this.getLogger().debug("Stopping network interfaces"); for (SourceInterface interfaz : this.network.getInterfaces()) { interfaz.shutdown(); this.network.unregisterInterface(interfaz); } this.getLogger().debug("Disabling timings"); Timings.stopServer(); //todo other things } catch (Exception e) { this.logger.logException(e); //todo remove this? this.logger.emergency("Exception happened while shutting down, exit the process"); System.exit(1); } }
Example #15
Source File: PlayerCreationEvent.java From Nukkit with GNU General Public License v3.0 | 4 votes |
public SourceInterface getInterface() { return interfaz; }