Skip to content
This repository has been archived by the owner on Mar 15, 2024. It is now read-only.

Commit

Permalink
Fix bug in MobileEventHandler with blocking of nummer command
Browse files Browse the repository at this point in the history
  • Loading branch information
rettichlp committed Aug 4, 2022
1 parent 98e4073 commit c938f89
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
public class ACallCommand extends CommandBase {

final Timer timer = new Timer();
public static boolean isActive;

@Override @Nonnull public String getName() {
return "acall";
Expand All @@ -47,6 +48,7 @@ public class ACallCommand extends CommandBase {
.of("Syntax: " + getUsage(sender)).color(ColorCode.GRAY).advance()
.createComponent());

isActive = true;
p.sendChatMessage("/nummer " + args[0]);

timer.schedule(new TimerTask() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
public class ASMSCommand extends CommandBase {

final Timer timer = new Timer();
public static boolean isActive;

@Override @Nonnull public String getName() {
return "asms";
Expand All @@ -48,6 +49,7 @@ public class ASMSCommand extends CommandBase {
.of("Syntax: " + getUsage(sender)).color(ColorCode.GRAY).advance()
.createComponent());

isActive = true;
p.sendChatMessage("/nummer " + args[0]);

timer.schedule(new TimerTask() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import com.rettichlp.UnicacityAddon.base.abstraction.AbstractionLayer;
import com.rettichlp.UnicacityAddon.base.text.PatternHandler;
import com.rettichlp.UnicacityAddon.commands.ACallCommand;
import com.rettichlp.UnicacityAddon.commands.ASMSCommand;
import net.minecraft.client.Minecraft;
import net.minecraft.inventory.ContainerChest;
import net.minecraftforge.client.event.ClientChatReceivedEvent;
Expand Down Expand Up @@ -57,7 +59,10 @@ public void onClientChatReceived(ClientChatReceivedEvent e) {
Matcher numberMatcher = PatternHandler.NUMBER_PATTERN.matcher(msg);
if (numberMatcher.find()) {
lastCheckedNumber = Integer.parseInt(numberMatcher.group(1));
e.setCanceled(true);
if (ACallCommand.isActive || ASMSCommand.isActive) {
e.setCanceled(true);
ACallCommand.isActive = ASMSCommand.isActive = false;
}
}
}

Expand Down

0 comments on commit c938f89

Please sign in to comment.