Moves all config related code from Stargate to StargateConfig

This commit is contained in:
2021-10-23 18:34:31 +02:00
parent b7998023f5
commit 2541391d3e
12 changed files with 545 additions and 368 deletions

View File

@ -22,7 +22,7 @@ public class CommandAbout implements CommandExecutor {
"Drakia" + textColor + ", and revived by " + highlightColor + "EpicKnarvik97");
commandSender.sendMessage(textColor + "Go to " + highlightColor +
"https://git.knarcraft.net/EpicKnarvik97/Stargate " + textColor + "for the official repository");
String author = Stargate.languageLoader.getString("author");
String author = Stargate.getStargateConfig().getLanguageLoader().getString("author");
if (!author.isEmpty())
commandSender.sendMessage(textColor + "Language created by " + highlightColor + author);
return true;

View File

@ -12,17 +12,6 @@ import org.jetbrains.annotations.NotNull;
*/
public class CommandReload implements CommandExecutor {
private final Stargate plugin;
/**
* Instantiates the reload command
*
* @param plugin <p>A reference to the calling plugin object</p>
*/
public CommandReload(Stargate plugin) {
this.plugin = plugin;
}
@Override
public boolean onCommand(@NotNull CommandSender commandSender, @NotNull Command command, @NotNull String s,
@NotNull String[] args) {
@ -32,7 +21,7 @@ public class CommandReload implements CommandExecutor {
return true;
}
}
plugin.reload(commandSender);
Stargate.getStargateConfig().reload(commandSender);
return true;
}

View File

@ -15,17 +15,6 @@ import org.jetbrains.annotations.NotNull;
*/
public class CommandStarGate implements CommandExecutor {
private final Stargate plugin;
/**
* Instantiates the stargate command
*
* @param plugin <p>A reference to the calling plugin object</p>
*/
public CommandStarGate(Stargate plugin) {
this.plugin = plugin;
}
@Override
public boolean onCommand(@NotNull CommandSender commandSender, @NotNull Command command, @NotNull String s,
@NotNull String[] args) {
@ -33,7 +22,7 @@ public class CommandStarGate implements CommandExecutor {
if (args[0].equalsIgnoreCase("about")) {
return new CommandAbout().onCommand(commandSender, command, s, args);
} else if (args[0].equalsIgnoreCase("reload")) {
return new CommandReload(plugin).onCommand(commandSender, command, s, args);
return new CommandReload().onCommand(commandSender, command, s, args);
}
return false;
} else {