Linkage #20
@ -297,44 +297,44 @@ public class LinkageProcessor extends AbstractProcessor {
|
||||
PluginCheck[] pluginChecks = typeElement.getAnnotationsByType(PluginCheck.class);
|
||||
if (context == LinkageType.Context.SPIGOT) {
|
||||
errorOnNonNull(typeElement, eventMode, discordMode);
|
||||
List<String> checks = new ArrayList<>();
|
||||
if (minVersion != null) {
|
||||
buildPlan.addImport("de.steamwar.core.Core");
|
||||
stringConsumer.accept("if (Core.getVersion() >= " + minVersion.value() + ") {");
|
||||
checks.add("Core.getVersion() >= " + minVersion.value());
|
||||
}
|
||||
if (maxVersion != null) {
|
||||
buildPlan.addImport("de.steamwar.core.Core");
|
||||
stringConsumer.accept("if (Core.getVersion() < " + maxVersion.value() + ") {");
|
||||
checks.add("Core.getVersion() < " + maxVersion.value());
|
||||
}
|
||||
if (pluginChecks.length != 0) {
|
||||
buildPlan.addImport("org.bukkit.Bukkit");
|
||||
stringConsumer.accept(Arrays.stream(pluginChecks).map(pluginCheck -> {
|
||||
Arrays.stream(pluginChecks).map(pluginCheck -> {
|
||||
return "Bukkit.getPluginManager().getPlugin(\"" + pluginCheck.value() + "\") " + (pluginCheck.has() == PluginCheck.Has.THIS ? "=" : "!") + "= null";
|
||||
}).collect(Collectors.joining(" && ", "if (", ") {")));
|
||||
}).forEach(checks::add);
|
||||
}
|
||||
if (!checks.isEmpty()) stringConsumer.accept("if (" + String.join(" && ", checks) + ") {");
|
||||
inner.run();
|
||||
if (pluginChecks.length != 0) stringConsumer.accept("}");
|
||||
if (maxVersion != null) stringConsumer.accept("}");
|
||||
if (minVersion != null) stringConsumer.accept("}");
|
||||
if (!checks.isEmpty()) stringConsumer.accept("}");
|
||||
} else {
|
||||
errorOnNonNull(typeElement, minVersion, maxVersion);
|
||||
List<String> checks = new ArrayList<>();
|
||||
if (eventMode != null) {
|
||||
buildPlan.addImport("de.steamwar.bungeecore.BungeeCore");
|
||||
stringConsumer.accept("if (" + eventMode.value().getPrefix() + "BungeeCore.EVENT_MODE) {");
|
||||
checks.add(eventMode.value().getPrefix() + "BungeeCore.EVENT_MODE");
|
||||
}
|
||||
if (discordMode != null) {
|
||||
buildPlan.addImport("de.steamwar.bungeecore.bot.config.SteamwarDiscordBotConfig");
|
||||
stringConsumer.accept("if (SteamwarDiscordBotConfig.loaded) {");
|
||||
checks.add("SteamwarDiscordBotConfig.loaded");
|
||||
}
|
||||
if (pluginChecks.length != 0) {
|
||||
buildPlan.addImport("net.md_5.bungee.BungeeCord");
|
||||
stringConsumer.accept(Arrays.stream(pluginChecks).map(pluginCheck -> {
|
||||
Arrays.stream(pluginChecks).map(pluginCheck -> {
|
||||
return "BungeeCord.getPluginManager().getPlugin(\"" + pluginCheck.value() + "\") " + (pluginCheck.has() == PluginCheck.Has.THIS ? "=" : "!") + "= null";
|
||||
}).collect(Collectors.joining(" && ", "if (", ") {")));
|
||||
}).forEach(checks::add);
|
||||
}
|
||||
if (!checks.isEmpty()) stringConsumer.accept("if (" + String.join(" && ", checks) + ") {");
|
||||
inner.run();
|
||||
if (pluginChecks.length != 0) stringConsumer.accept("}");
|
||||
if (discordMode != null) stringConsumer.accept("}");
|
||||
if (eventMode != null) stringConsumer.accept("}");
|
||||
if (!checks.isEmpty()) stringConsumer.accept("}");
|
||||
}
|
||||
}
|
||||
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren