F Show Async Calling

This commit is contained in:
Driftay 2020-05-19 06:22:09 -04:00
parent 7d3c4d6e33
commit c22e3a5227
2 changed files with 35 additions and 31 deletions

View File

@ -84,8 +84,11 @@ public class CmdShow extends FCommand {
} }
List<FancyMessage> fancy = new ArrayList<>(); List<FancyMessage> fancy = new ArrayList<>();
for (String raw : show) { List<String> finalShow = show;
String parsed = TagUtil.parsePlain(faction, context.fPlayer, raw); // use relations Faction finalFaction = faction;
instance.getServer().getScheduler().runTaskAsynchronously(instance, () -> {
for (String raw : finalShow) {
String parsed = TagUtil.parsePlain(finalFaction, context.fPlayer, raw); // use relations
if (parsed == null) { if (parsed == null) {
continue; // Due to minimal f show. continue; // Due to minimal f show.
} }
@ -95,7 +98,7 @@ public class CmdShow extends FCommand {
} }
if (TagUtil.hasFancy(parsed)) { if (TagUtil.hasFancy(parsed)) {
List<FancyMessage> localFancy = TagUtil.parseFancy(faction, context.fPlayer, parsed); List<FancyMessage> localFancy = TagUtil.parseFancy(finalFaction, context.fPlayer, parsed);
if (localFancy != null) if (localFancy != null)
fancy.addAll(localFancy); fancy.addAll(localFancy);
@ -115,6 +118,7 @@ public class CmdShow extends FCommand {
} }
} }
instance.getServer().getScheduler().runTask(instance, () -> context.sendFancyMessage(fancy)); instance.getServer().getScheduler().runTask(instance, () -> context.sendFancyMessage(fancy));
});
} }
@Override @Override

View File

@ -39,9 +39,9 @@ public abstract class FRelationCommand extends FCommand {
@Override @Override
public void perform(CommandContext context) { public void perform(CommandContext context) {
Faction them = context.argAsFaction(0); Faction them = context.argAsFaction(0);
if (them == null) { if (them == null) return;
return;
} if(!context.faction.isNormal()) return;
if (!them.isNormal()) { if (!them.isNormal()) {
context.msg(TL.COMMAND_RELATIONS_ALLTHENOPE); context.msg(TL.COMMAND_RELATIONS_ALLTHENOPE);