Skip to content

Commit

Permalink
Update to v4.27.1 and fix integrations not working
Browse files Browse the repository at this point in the history
  • Loading branch information
AlessioGr committed Jul 2, 2022
1 parent 4d26bdb commit 646b6fa
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 11 deletions.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ plugins {


group = "rocks.gravili.notquests"
version = "4.27.0"
version = "4.27.1"


repositories {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,8 @@ public static NotQuests getInstance() {
return instance;
}

public Configuration getConfiguration() {
return dataManager.getConfiguration();
public final Configuration getConfiguration() {
return dataManager != null ? dataManager.getConfiguration() : null;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import java.util.ArrayList;
import java.util.logging.Level;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.format.NamedTextColor;
import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer;
import org.bukkit.Bukkit;
import org.bukkit.command.ConsoleCommandSender;
Expand Down Expand Up @@ -49,9 +48,9 @@ public LogManager(final NotQuests main) {
public void lateInit() {
prefix =
main.parse(
main.getConfiguration().getColorsConsolePrefixPrefix()
(main.getConfiguration() != null ? main.getConfiguration().getColorsConsolePrefixPrefix() : "")
+ "NotQuests"
+ main.getConfiguration().getColorsConsolePrefixSuffix()
+ (main.getConfiguration() != null ? main.getConfiguration().getColorsConsolePrefixSuffix() : "")
);
}

Expand All @@ -69,8 +68,8 @@ private void log(final Level level, final String color, final String message) {

private void log(
final Level level, final LogCategory logCategory, final String color, final String message) {
if (main.getConfiguration().isConsoleColorsEnabled()) {
if (!main.getConfiguration().isConsoleColorsDownsampleColors()) {
if (main.getConfiguration() == null || main.getConfiguration().isConsoleColorsEnabled()) {
if (main.getConfiguration() != null && !main.getConfiguration().isConsoleColorsDownsampleColors()) {
consoleSender.sendMessage( prefix.append(main.parse(color + message)));
} else {
final Component component = main.parse(message);
Expand Down Expand Up @@ -120,7 +119,7 @@ public void severe(final LogCategory logCategory, final String message) {
log(
Level.SEVERE,
logCategory,
main.getConfiguration().isConsoleColorsDownsampleColors() ? main.getConfiguration().getColorsConsoleSevereDefaultDownsampled() : main.getConfiguration().getColorsConsoleSevereDefault(),
main.getConfiguration() != null ? (main.getConfiguration().isConsoleColorsDownsampleColors() ? main.getConfiguration().getColorsConsoleSevereDefaultDownsampled() : main.getConfiguration().getColorsConsoleSevereDefault()) : "",
message);
severeLogs.add(message);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ public EnabledIntegration(final NotQuests main, final String exactName, final Pl
this.versionString = plugin.getDescription().getVersion();
}

public EnabledIntegration(final NotQuests main, final String exactName, final Plugin plugin, final Integration integration) {
super(main, exactName, integration);
this.versionString = plugin.getDescription().getVersion();
}

public final String getVersionString() {
return versionString;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

public class Integration {

private final NotQuests main;
protected final NotQuests main;
private final String exactName;

private Supplier<Boolean> runWhenEnabled; //Return false -> cancel the enabling
Expand All @@ -29,6 +29,18 @@ public Integration(final NotQuests main, final String exactName) {
this.exactName = exactName;
}

public Integration(NotQuests main, String exactName, final Integration integration) {
this.main = main;
this.exactName = exactName;
this.runWhenEnabled = integration.runWhenEnabled;
this.runWhenEnabledLate = integration.runWhenEnabledLate;
this.runAfterDataLoad = integration.runAfterDataLoad;
this.runWhenRegisteringEventsOnTime = integration.runWhenRegisteringEventsOnTime;
this.enableCondition = integration.enableCondition;
this.runWhenEnableConditionFalse = integration.runWhenEnableConditionFalse;
this.runWhenEnablingFailed = integration.runWhenEnablingFailed;
}

public final String getExactName() {
return exactName;
}
Expand Down Expand Up @@ -133,7 +145,7 @@ public final boolean checkEnableCondition() {
main.getLogManager().info( getExactName() + " found. Enabled " + getExactName() + " support!");
}

return new EnabledIntegration(main, exactName, plugin);
return new EnabledIntegration(main, exactName, plugin, this);
} else {
if (runWhenEnableConditionFalse != null) {
runWhenEnableConditionFalse.run();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,8 @@ private void handleEscortNPCObjectiveForActiveObjectiveSynchronous(

public void registerAnyCitizensCommands() {

main.getLogManager().info("Registering Citizens commands...");

final PaperCommandManager<CommandSender> manager =
main.getCommandManager().getPaperCommandManager();

Expand Down

0 comments on commit 646b6fa

Please sign in to comment.