Revert to old socket, fix NPE

This commit is contained in:
fullwall 2012-02-04 22:49:16 +08:00
parent 1626b13d69
commit 1e3d3e5754
2 changed files with 7 additions and 12 deletions

View File

@ -24,6 +24,8 @@ public class CitizensHumanNPC extends CitizensNPC {
@Override
public void update() {
super.update();
if (mcEntity == null)
return;
if (mcEntity.noDamageTicks > 0)
mcEntity.noDamageTicks--;
if (mcEntity.attackTicks > 0)

View File

@ -1,27 +1,20 @@
package net.citizensnpcs.resource.lib;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.Socket;
public class NPCSocket extends Socket {
@Override
public InputStream getInputStream() {
return new InputStream() {
@Override
public int read() {
return 0; // NOP
}
};
return new ByteArrayInputStream(new byte[10]);
}
@Override
public OutputStream getOutputStream() {
return new OutputStream() {
@Override
public void write(int b) {
// NOP
}
};
return new ByteArrayOutputStream();
}
}