Java Code Examples for cn.nukkit.utils.MainLogger#debug()
The following examples show how to use
cn.nukkit.utils.MainLogger#debug() .
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: RakNetInterface.java From Jupiter with GNU General Public License v3.0 | 5 votes |
@Override public void handleEncapsulated(String identifier, EncapsulatedPacket packet, int flags) { if (this.players.containsKey(identifier)) { DataPacket pk = null; try { if (packet.buffer.length > 0) { if (packet.buffer[0] == PING_DataPacket.ID) { PING_DataPacket pingPacket = new PING_DataPacket(); pingPacket.buffer = packet.buffer; pingPacket.decode(); this.networkLatency.put(identifier, (int) pingPacket.pingID); return; } pk = this.getPacket(packet.buffer); if (pk != null) { pk.decode(); this.players.get(identifier).handleDataPacket(pk); } } } catch (Exception e) { this.server.getLogger().logException(e); if (Nukkit.DEBUG > 1 && pk != null) { MainLogger logger = this.server.getLogger(); // if (logger != null) { logger.debug("Packet " + pk.getClass().getName() + " 0x" + Binary.bytesToHexString(packet.buffer)); //logger.logException(e); // } } if (this.players.containsKey(identifier)) { this.handler.blockAddress(this.players.get(identifier).getAddress(), 5); } } } }
Example 2
Source File: RakNetInterface.java From Nukkit with GNU General Public License v3.0 | 5 votes |
@Override public void handleEncapsulated(String identifier, EncapsulatedPacket packet, int flags) { if (this.players.containsKey(identifier)) { DataPacket pk = null; try { if (packet.buffer.length > 0) { if (packet.buffer[0] == PING_DataPacket.ID) { PING_DataPacket pingPacket = new PING_DataPacket(); pingPacket.buffer = packet.buffer; pingPacket.decode(); this.networkLatency.put(identifier, (int) pingPacket.pingID); return; } pk = this.getPacket(packet.buffer); if (pk != null) { pk.decode(); this.players.get(identifier).handleDataPacket(pk); } } } catch (Exception e) { this.server.getLogger().logException(e); if (Nukkit.DEBUG > 1 && pk != null) { MainLogger logger = this.server.getLogger(); // if (logger != null) { logger.debug("Packet " + pk.getClass().getName() + " 0x" + Binary.bytesToHexString(packet.buffer)); //logger.logException(e); // } } if (this.players.containsKey(identifier)) { this.handler.blockAddress(this.players.get(identifier).getAddress(), 5); } } } }
Example 3
Source File: RakNetInterface.java From Nukkit with GNU General Public License v3.0 | 5 votes |
@Override public void handleEncapsulated(String identifier, EncapsulatedPacket packet, int flags) { if (this.players.containsKey(identifier)) { DataPacket pk = null; try { if (packet.buffer.length > 0) { if (packet.buffer[0] == PING_DataPacket.ID) { PING_DataPacket pingPacket = new PING_DataPacket(); pingPacket.buffer = packet.buffer; pingPacket.decode(); this.networkLatency.put(identifier, (int) pingPacket.pingID); return; } pk = this.getPacket(packet.buffer); if (pk != null) { pk.decode(); this.players.get(identifier).handleDataPacket(pk); } } } catch (Exception e) { this.server.getLogger().logException(e); if (Nukkit.DEBUG > 1 && pk != null) { MainLogger logger = this.server.getLogger(); // if (logger != null) { logger.debug("Packet " + pk.getClass().getName() + " 0x" + Binary.bytesToHexString(packet.buffer)); //logger.logException(e); // } } if (this.players.containsKey(identifier)) { this.handler.blockAddress(this.players.get(identifier).getAddress(), 5); } } } }
Example 4
Source File: Nukkit.java From Jupiter with GNU General Public License v3.0 | 4 votes |
public static void main(String[] args) { if(!(JAVA_VERSION.startsWith("1.8"))){ System.out.println("[CRITICAL] This program runs on JRE(JRE) 1.8"); System.out.println("[CRITICAL] You must use JRE(JDK) 1.8."); System.out.println("[CRITICAL] Java version: " + JAVA_VERSION); System.exit(0); } //Shorter title for windows 8/2012 String osName = System.getProperty("os.name").toLowerCase(); if (osName.contains("windows")) { if (osName.contains("windows 8") || osName.contains("2012")) { shortTitle = true; } } //启动参数 for (String arg : args) { switch (arg) { case "disable-ansi": ANSI = false; break; } } MainLogger logger = new MainLogger(DATA_PATH + "server.log"); System.out.println("Minecraft用 Jupiterサーバーを開始しています。"); jobs.add(new Callable<Server>(){ @Override public Server call() throws Exception { return new Server(logger, PATH, DATA_PATH, PLUGIN_PATH); } }); try { threadpool.invokeAll(jobs); threadpool.shutdown(); if(threadpool.awaitTermination(1L,TimeUnit.MINUTES)){// 1 minutes System.out.println("サーバーを停止しています..."); logger.info("スレッドが停止しました。"); for (Thread thread : java.lang.Thread.getAllStackTraces().keySet()) { if (!(thread instanceof InterruptibleThread)) { continue; } logger.debug("Stopping " + thread.getClass().getSimpleName() + " thread"); if (thread.isAlive()) { thread.interrupt(); } } ServerKiller killer = new ServerKiller(8); killer.start(); logger.shutdown(); logger.interrupt(); CommandReader.getInstance().removePromptLine(); System.out.println("サーバーが停止しました。"); System.exit(0); }else{ System.out.println("サーバーの停止に失敗しました。"); } } catch (InterruptedException e) { e.printStackTrace(); threadpool.shutdown(); } }