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) {
|
if (args.length==2) {
|
||||||
boolean a = has_perm(account.getUniqueId(), Setup.get_perm(args[1]));
|
boolean a = has_perm(account.getUniqueId(), Setup.get_perm(args[1]));
|
||||||
boolean b = has_perm(account.getUniqueId(), "setup.*");
|
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());
|
Setup.cancel(account.getUniqueId());
|
||||||
else if (a || b)
|
else if (a || b)
|
||||||
started = Setup.start(account.getUniqueId(), args[1]);
|
started = Setup.start(account.getUniqueId(), args[1]);
|
||||||
|
|
|
@ -57,15 +57,19 @@ public class MessagePacketMixin {
|
||||||
TextCommands.run(data,identity,ctx);
|
TextCommands.run(data,identity,ctx);
|
||||||
ci.cancel();
|
ci.cancel();
|
||||||
} else if (Setup.setups.containsKey(account.getUniqueId())){
|
} else if (Setup.setups.containsKey(account.getUniqueId())){
|
||||||
Setup setup = Setup.setups.get(account.getUniqueId());
|
if (message.equals("!")) {
|
||||||
if (setup.set_setup_text(message.replace(" ","_"))) {
|
Setup.cancel(account.getUniqueId());
|
||||||
ci.cancel();
|
} 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());
|
MessagePacket packet = new MessagePacket("[Server] " + setup.get_step_hint());
|
||||||
packet.playerUniqueId = account.getUniqueId();
|
packet.playerUniqueId = account.getUniqueId();
|
||||||
packet.setupAndSend(ctx);
|
packet.setupAndSend(ctx);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,10 +27,9 @@ public abstract class Setup {
|
||||||
public static boolean cancel(String playerId){
|
public static boolean cancel(String playerId){
|
||||||
if (!setups.containsKey(playerId))
|
if (!setups.containsKey(playerId))
|
||||||
return false;
|
return false;
|
||||||
Setup setup = setups.get(playerId);
|
Setup setup = setups.getOrDefault(playerId, null);
|
||||||
if (setup==null)
|
if (setup!=null)
|
||||||
return false;
|
setup.run_setup_canceled();
|
||||||
setup.run_setup_canceled();
|
|
||||||
setups.remove(playerId);
|
setups.remove(playerId);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue