Skip to content

Commit

Permalink
Fix gamejointext with server commands
Browse files Browse the repository at this point in the history
  • Loading branch information
buthed010203 committed Jan 19, 2024
1 parent fde1f5a commit a5f3438
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
11 changes: 7 additions & 4 deletions core/src/mindustry/ui/fragments/ChatFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -424,17 +424,20 @@ public static CommandHandler.CommandResponse handleClientCommand(String message)
return handleClientCommand(message, true);
}

/** If send is false, only commands will be sent to the server */
public static CommandHandler.CommandResponse handleClientCommand(String message, boolean send){
//check if it's a command
CommandHandler.CommandResponse response = ClientVars.clientCommandHandler.handleMessage(message, player);
if(response.type == CommandHandler.ResponseType.noCommand){ //no command to handle
String msg = Main.INSTANCE.sign(message);
Events.fire(new ClientChatEvent(message));
if (send) Call.sendChatMessage(msg);
if (message.startsWith(netServer.clientCommands.getPrefix() + "sync")) { // /sync
ClientVars.syncing = true;
var prefix = netServer.clientCommands.getPrefix();
if(send || message.startsWith(prefix)){
Call.sendChatMessage(msg);
}
if (!message.startsWith(netServer.clientCommands.getPrefix())) { // Only fire when not running any command
if(message.startsWith(prefix + "sync")){ // /sync
ClientVars.syncing = true;
}else if (!message.startsWith(prefix)){ // Only fire when not running any command
Events.fire(new EventType.SendChatMessageEvent(msg));
}
}else{
Expand Down
2 changes: 1 addition & 1 deletion core/src/mindustry/world/blocks/logic/LogicBlock.java
Original file line number Diff line number Diff line change
Expand Up @@ -645,7 +645,7 @@ public void drawSelect(){
Groups.unit.each(u -> u.controller() instanceof LogicAI ai && ai.controller == this && !ClientVars.hidingUnits && !(ClientVars.hidingAirUnits && u.isFlying()), unit -> {
Drawf.square(unit.x, unit.y, unit.hitSize, unit.rotation + 45);
if (Core.settings.getBool("tracelogicunits")) {
Draw.draw((float) (Layer.overlayUI+0.01), () -> { // Taken from extended-UI
Draw.draw(Layer.overlayUI + 0.01f, () -> { // Taken from extended-UI
Lines.stroke(2, Color.purple);
Draw.alpha(0.7f);
Lines.line(unit.x, unit.y, this.x, this.y);
Expand Down

0 comments on commit a5f3438

Please sign in to comment.