Fork of Poseidon providing Bukkit #1060 to older Beta versions (b1.0-b1.7.3)
at develop 81 lines 2.3 kB view raw
1package net.minecraft.server; 2 3import com.legacyminecraft.poseidon.PoseidonConfig; 4 5import java.io.IOException; 6 7class NetworkWriterThread extends Thread { 8 private boolean fast; // Poseidon 9 final NetworkManager a; 10 11 NetworkWriterThread(NetworkManager networkmanager, String s) { 12 super(s); 13 this.a = networkmanager; 14 this.fast = PoseidonConfig.getInstance().getBoolean("settings.faster-packets.enabled", true); // Poseidon 15 } 16 17 public void run() { 18 Object object = NetworkManager.a; 19 20 synchronized (NetworkManager.a) { 21 ++NetworkManager.c; 22 } 23 24 while (true) { 25 boolean flag = false; 26 27 try { 28 flag = true; 29 if (!NetworkManager.a(this.a)) { 30 flag = false; 31 break; 32 } 33 34 while (NetworkManager.d(this.a)) { 35 ; 36 } 37 38 if (!this.fast) { // Poseidon 39 try { 40 sleep(100L); 41 } catch (InterruptedException interruptedexception) { 42 ; 43 } 44 } 45 46 try { 47 if (NetworkManager.e(this.a) != null) { 48 NetworkManager.e(this.a).flush(); 49 } 50 } catch (IOException ioexception) { 51 if (!NetworkManager.f(this.a)) { 52 NetworkManager.a(this.a, (Exception) ioexception); 53 } 54 55 //ioexception.printStackTrace(); //Project Poseidon Remove - Credit to Notcz in Modification Station 56 } 57 58 if (this.fast) { // Poseidon 59 try { 60 sleep(2L); 61 } catch (InterruptedException interruptedexception) { 62 ; 63 } 64 } 65 } finally { 66 if (flag) { 67 Object object1 = NetworkManager.a; 68 69 synchronized (NetworkManager.a) { 70 --NetworkManager.c; 71 } 72 } 73 } 74 } 75 76 object = NetworkManager.a; 77 synchronized (NetworkManager.a) { 78 --NetworkManager.c; 79 } 80 } 81}