Merge pull request #119 from SaberLLC/beta

F Show Async Calling
This commit is contained in:
Driftay 2020-05-19 06:24:02 -04:00 committed by GitHub
commit 30d6b3c248
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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<>();
for (String raw : show) {
String parsed = TagUtil.parsePlain(faction, context.fPlayer, raw); // use relations
List<String> finalShow = show;
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) {
continue; // Due to minimal f show.
}
@ -95,7 +98,7 @@ public class CmdShow extends FCommand {
}
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)
fancy.addAll(localFancy);
@ -115,6 +118,7 @@ public class CmdShow extends FCommand {
}
}
instance.getServer().getScheduler().runTask(instance, () -> context.sendFancyMessage(fancy));
});
}
@Override

View File

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