make the RemoteEventManager actually tick
This commit is contained in:
parent
b94cddf64c
commit
3933a89608
3 changed files with 9 additions and 4 deletions
|
@ -66,6 +66,7 @@ public class FMLEventHandler {
|
|||
return;
|
||||
playerLastTick = mc.player;
|
||||
BaseBand.updateKeyBinds();
|
||||
BaseBand.remoteEventManager.onTick();
|
||||
for(Feature feature : features) {
|
||||
feature.onEveryTick();
|
||||
if(feature.enabled) {
|
||||
|
|
|
@ -10,7 +10,6 @@ import de.tudbut.parsing.JSON;
|
|||
import de.tudbut.parsing.TCN;
|
||||
import de.tudbut.tools.ConfigSaverTCN2;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InterruptedIOException;
|
||||
|
@ -33,7 +32,7 @@ public class RemoteEventManager {
|
|||
private final Queue<RemoteEvent> toSend = new LinkedList<>();
|
||||
private final Queue<RemoteEvent> toProcess = new LinkedList<>();
|
||||
|
||||
public void connect(@Nullable String ip) {
|
||||
public void connect(String ip) {
|
||||
try {
|
||||
if(isConnected())
|
||||
end();
|
||||
|
@ -92,6 +91,7 @@ public class RemoteEventManager {
|
|||
s.setSoTimeout(1);
|
||||
clients.add(s);
|
||||
publish(new RemoteInitEvent(++maxID));
|
||||
BaseBand.notify("[Remote] Client connected.");
|
||||
} else {
|
||||
s.close();
|
||||
}
|
||||
|
@ -144,6 +144,7 @@ public class RemoteEventManager {
|
|||
end();
|
||||
return;
|
||||
}
|
||||
BaseBand.notify("[Remote] Connected.");
|
||||
while(head != null) {
|
||||
while(!toSend.isEmpty()) {
|
||||
o.write(0);
|
||||
|
@ -182,9 +183,11 @@ public class RemoteEventManager {
|
|||
if(event instanceof RemoteInitEvent) {
|
||||
if(id == -1) {
|
||||
id = ((RemoteInitEvent) event).id;
|
||||
BaseBand.notify("[Remote] Received ID: " + id + ".");
|
||||
}
|
||||
else {
|
||||
maxID = ((RemoteInitEvent) event).id;
|
||||
BaseBand.notify("[Remote] Someone connected with ID " + id + ".");
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@ -200,7 +203,7 @@ public class RemoteEventManager {
|
|||
}
|
||||
|
||||
public int getPeers() {
|
||||
return maxID;
|
||||
return maxID + 1;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -35,6 +35,7 @@ public class AltControl extends Feature {
|
|||
}
|
||||
|
||||
public void onRemoteSendChat(RemoteSendMessageEvent event) {
|
||||
BaseBand.notify("[AltControl] Received a message to send.");
|
||||
ChatUtil.simulateSend(event.message, false);
|
||||
}
|
||||
|
||||
|
@ -46,7 +47,7 @@ public class AltControl extends Feature {
|
|||
ChatUtil.print("syntax: " + Client.prefix + this + " <message...>");
|
||||
return;
|
||||
}
|
||||
BaseBand.remoteEventManager.publish(new RemoteSendMessageEvent(String.join(" ", args)));
|
||||
BaseBand.publish(new RemoteSendMessageEvent(String.join(" ", args)));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Add table
Reference in a new issue