Fixes NPE on Saving Task onDisable MPlugin, removed Async Throw for 1.15 in F Show
This commit is contained in:
@@ -8,11 +8,9 @@ import com.massivecraft.factions.zcore.util.TL;
|
||||
import com.massivecraft.factions.zcore.util.TagReplacer;
|
||||
import com.massivecraft.factions.zcore.util.TagUtil;
|
||||
import mkremins.fanciful.FancyMessage;
|
||||
import org.bukkit.scheduler.BukkitScheduler;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
public class CmdShow extends FCommand {
|
||||
|
||||
@@ -85,42 +83,38 @@ public class CmdShow extends FCommand {
|
||||
return; // we only show header for non-normal factions
|
||||
}
|
||||
|
||||
List<String> finalShow = show;
|
||||
Faction finalFaction = faction;
|
||||
List<FancyMessage> fancy = new ArrayList<>();
|
||||
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.
|
||||
}
|
||||
|
||||
if (context.fPlayer != null) {
|
||||
parsed = TagUtil.parsePlaceholders(context.fPlayer.getPlayer(), parsed);
|
||||
}
|
||||
|
||||
if (TagUtil.hasFancy(parsed)) {
|
||||
List<FancyMessage> localFancy = TagUtil.parseFancy(finalFaction, context.fPlayer, parsed);
|
||||
if (localFancy != null)
|
||||
fancy.addAll(localFancy);
|
||||
|
||||
continue;
|
||||
}
|
||||
if (!parsed.contains("{notFrozen}") && !parsed.contains("{notPermanent}")) {
|
||||
if (parsed.contains("{ig}")) {
|
||||
// replaces all variables with no home TL
|
||||
parsed = parsed.substring(0, parsed.indexOf("{ig}")) + TL.COMMAND_SHOW_NOHOME.toString();
|
||||
}
|
||||
if (parsed.contains("%")) {
|
||||
parsed = parsed.replaceAll("%", ""); // Just in case it got in there before we disallowed it.
|
||||
}
|
||||
parsed = FactionsPlugin.getInstance().txt.parse(parsed);
|
||||
FancyMessage localFancy = instance.txt.parseFancy(parsed);
|
||||
fancy.add(localFancy);
|
||||
}
|
||||
for (String raw : show) {
|
||||
String parsed = TagUtil.parsePlain(faction, context.fPlayer, raw); // use relations
|
||||
if (parsed == null) {
|
||||
continue; // Due to minimal f show.
|
||||
}
|
||||
instance.getServer().getScheduler().runTask(instance, () -> context.sendFancyMessage(fancy));
|
||||
});
|
||||
|
||||
if (context.fPlayer != null) {
|
||||
parsed = TagUtil.parsePlaceholders(context.fPlayer.getPlayer(), parsed);
|
||||
}
|
||||
|
||||
if (TagUtil.hasFancy(parsed)) {
|
||||
List<FancyMessage> localFancy = TagUtil.parseFancy(faction, context.fPlayer, parsed);
|
||||
if (localFancy != null)
|
||||
fancy.addAll(localFancy);
|
||||
|
||||
continue;
|
||||
}
|
||||
if (!parsed.contains("{notFrozen}") && !parsed.contains("{notPermanent}")) {
|
||||
if (parsed.contains("{ig}")) {
|
||||
// replaces all variables with no home TL
|
||||
parsed = parsed.substring(0, parsed.indexOf("{ig}")) + TL.COMMAND_SHOW_NOHOME.toString();
|
||||
}
|
||||
if (parsed.contains("%")) {
|
||||
parsed = parsed.replaceAll("%", ""); // Just in case it got in there before we disallowed it.
|
||||
}
|
||||
parsed = FactionsPlugin.getInstance().txt.parse(parsed);
|
||||
FancyMessage localFancy = instance.txt.parseFancy(parsed);
|
||||
fancy.add(localFancy);
|
||||
}
|
||||
}
|
||||
instance.getServer().getScheduler().runTask(instance, () -> context.sendFancyMessage(fancy));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user