This commit is contained in:
parent
a351fea4f1
commit
896dd49fd2
3 changed files with 15 additions and 12 deletions
|
@ -100,7 +100,7 @@ public class TextCommands {
|
|||
if (args.length==2) {
|
||||
boolean a = has_perm(account.getUniqueId(), Setup.get_perm(args[1]));
|
||||
boolean b = has_perm(account.getUniqueId(), "setup.*");
|
||||
if (args[1].equals("cancel"))
|
||||
if (args[1].equalsIgnoreCase("cancel") || args[1].equalsIgnoreCase("c"))
|
||||
Setup.cancel(account.getUniqueId());
|
||||
else if (a || b)
|
||||
started = Setup.start(account.getUniqueId(), args[1]);
|
||||
|
|
|
@ -57,15 +57,19 @@ public class MessagePacketMixin {
|
|||
TextCommands.run(data,identity,ctx);
|
||||
ci.cancel();
|
||||
} else if (Setup.setups.containsKey(account.getUniqueId())){
|
||||
Setup setup = Setup.setups.get(account.getUniqueId());
|
||||
if (setup.set_setup_text(message.replace(" ","_"))) {
|
||||
ci.cancel();
|
||||
if (message.equals("!")) {
|
||||
Setup.cancel(account.getUniqueId());
|
||||
} else {
|
||||
Setup setup = Setup.setups.get(account.getUniqueId());
|
||||
if (setup.set_setup_text(message.replace(" ", "_"))) {
|
||||
ci.cancel();
|
||||
|
||||
setup.run_step();
|
||||
setup.run_step();
|
||||
|
||||
MessagePacket packet = new MessagePacket("[Server] " + setup.get_step_hint());
|
||||
packet.playerUniqueId = account.getUniqueId();
|
||||
packet.setupAndSend(ctx);
|
||||
MessagePacket packet = new MessagePacket("[Server] " + setup.get_step_hint());
|
||||
packet.playerUniqueId = account.getUniqueId();
|
||||
packet.setupAndSend(ctx);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,10 +27,9 @@ public abstract class Setup {
|
|||
public static boolean cancel(String playerId){
|
||||
if (!setups.containsKey(playerId))
|
||||
return false;
|
||||
Setup setup = setups.get(playerId);
|
||||
if (setup==null)
|
||||
return false;
|
||||
setup.run_setup_canceled();
|
||||
Setup setup = setups.getOrDefault(playerId, null);
|
||||
if (setup!=null)
|
||||
setup.run_setup_canceled();
|
||||
setups.remove(playerId);
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue