Compare commits

..

2 commits

22 changed files with 72 additions and 39 deletions

View file

@ -16,8 +16,9 @@
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.pickshadow.plugin;
package de.pickshadow.plugin.base;
import de.pickshadow.plugin.BuildConfiguration;
import de.pickshadow.plugin.classes.logger.LoggerInstanceImpl;
import de.pickshadow.plugin.classes.logger.implementations.ExtendedBukkitLogger;
import de.pickshadow.plugin.loaders.ConfigLoader;

View file

@ -16,7 +16,7 @@
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.pickshadow.plugin;
package de.pickshadow.plugin.base;
import de.pickshadow.plugin.classes.logger.LoggerImpl;
import de.pickshadow.plugin.loaders.ConfigLoader;

View file

@ -16,7 +16,7 @@
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.pickshadow.plugin;
package de.pickshadow.plugin.base;
import de.pickshadow.plugin.classes.logger.LoggerInstanceImpl;
import de.pickshadow.plugin.commands.*;

View file

@ -16,8 +16,9 @@
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.pickshadow.plugin;
package de.pickshadow.plugin.base;
import de.pickshadow.plugin.BuildConfiguration;
import de.pickshadow.plugin.classes.Configuration;
import de.pickshadow.plugin.classes.logger.LoggerInstanceImpl;
import de.pickshadow.plugin.utils.Miscellaneous;

View file

@ -16,11 +16,10 @@
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.pickshadow.plugin.classes;
package de.pickshadow.plugin.base;
import de.pickshadow.plugin.BuildConfiguration;
import de.pickshadow.plugin.GitHead;
import de.pickshadow.plugin.ObjHolder;
import java.util.Arrays;
@ -53,6 +52,9 @@ public class Translation {
public static String PLUGINCOMMAND_RELOAD_DATA_SUCCESS = "Alle Spielerdaten wurden erfolgreich neugeladen.";
public static String PLUGINCOMMAND_RELOAD_DATA_FAIL = "Nicht alle Spielerdaten konnten erfolgreich neugeladen werden, folgende UUIDs sind betroffen:\n%uuids%";
public static String PLUGINCOMMAND_GARBAGECOLLECT = "Starte Garbage Collector, der Server könnte für ein paar Millisekunden einfrieren.";
public static String PLUGINCOMMAND_GARBAGECOLLECT_FINISHED = "Der Garbage Collector wurde gestartet und hat erfolgreich den Arbeitsspeicher entleert.";
public static String PLUGINCOMMAND_SCHEDULER = "Der Scheduler \"%timeframe%\" wurde gestartet und führt seine Hintergrundaufgaben aus, bitte warten.";
public static String PLUGINCOMMAND_SCHEDULER_DONE = "Der Scheduler \"%timeframe%\" wurde ausgeführt. Für eventuelle Fehler gucken sie sich bitte die Serverkonsole an.";
public static String PLUGINCOMMAND_PLAYERINFO = "Deine Spielerinformationen:\n%playerdata%";
// Command: /sysinfo

View file

@ -18,7 +18,7 @@
*/
package de.pickshadow.plugin.classes;
import de.pickshadow.plugin.ObjHolder;
import de.pickshadow.plugin.base.ObjHolder;
import de.pickshadow.plugin.classes.logger.LoggerInstanceImpl;
import org.bukkit.Bukkit;
import org.bukkit.command.*;

View file

@ -18,7 +18,7 @@
*/
package de.pickshadow.plugin.classes;
import de.pickshadow.plugin.ObjHolder;
import de.pickshadow.plugin.base.ObjHolder;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.ApiStatus;

View file

@ -19,7 +19,7 @@
package de.pickshadow.plugin.classes.logger;
import de.pickshadow.plugin.BuildConfiguration;
import de.pickshadow.plugin.ObjHolder;
import de.pickshadow.plugin.base.ObjHolder;
import de.pickshadow.plugin.classes.Types;
import de.pickshadow.plugin.utils.Miscellaneous;
import org.bukkit.Bukkit;

View file

@ -18,7 +18,7 @@
*/
package de.pickshadow.plugin.classes.logger.implementations;
import de.pickshadow.plugin.ObjHolder;
import de.pickshadow.plugin.base.ObjHolder;
import de.pickshadow.plugin.classes.Types;
import de.pickshadow.plugin.classes.logger.LoggerImpl;
import org.bukkit.Bukkit;

View file

@ -18,7 +18,7 @@
*/
package de.pickshadow.plugin.commands;
import de.pickshadow.plugin.ObjHolder;
import de.pickshadow.plugin.base.ObjHolder;
import de.pickshadow.plugin.classes.CommandBase;
import de.pickshadow.plugin.classes.Types;
import de.pickshadow.plugin.utils.Miscellaneous;

View file

@ -19,8 +19,8 @@
package de.pickshadow.plugin.commands;
import de.pickshadow.plugin.classes.CommandBase;
import de.pickshadow.plugin.classes.Translation;
import de.pickshadow.plugin.ObjHolder;
import de.pickshadow.plugin.base.Translation;
import de.pickshadow.plugin.base.ObjHolder;
import de.pickshadow.plugin.classes.Types;
import de.pickshadow.plugin.utils.Miscellaneous;
import de.pickshadow.plugin.utils.TabCompletionHelper;

View file

@ -19,7 +19,7 @@
package de.pickshadow.plugin.commands;
import de.pickshadow.plugin.classes.CommandBase;
import de.pickshadow.plugin.classes.Translation;
import de.pickshadow.plugin.base.Translation;
import de.pickshadow.plugin.classes.Types;
import de.pickshadow.plugin.utils.Miscellaneous;
import de.pickshadow.plugin.utils.TabCompletionHelper;

View file

@ -19,10 +19,10 @@
package de.pickshadow.plugin.commands;
import de.pickshadow.plugin.BuildConfiguration;
import de.pickshadow.plugin.ObjHolder;
import de.pickshadow.plugin.base.ObjHolder;
import de.pickshadow.plugin.classes.CommandBase;
import de.pickshadow.plugin.classes.PlayerData;
import de.pickshadow.plugin.classes.Translation;
import de.pickshadow.plugin.base.Translation;
import de.pickshadow.plugin.classes.Types;
import de.pickshadow.plugin.utils.Miscellaneous;
import de.pickshadow.plugin.utils.TabCompletionHelper;

View file

@ -19,8 +19,8 @@
package de.pickshadow.plugin.commands;
import de.pickshadow.plugin.classes.CommandBase;
import de.pickshadow.plugin.classes.Translation;
import de.pickshadow.plugin.ObjHolder;
import de.pickshadow.plugin.base.Translation;
import de.pickshadow.plugin.base.ObjHolder;
import de.pickshadow.plugin.classes.Types;
import de.pickshadow.plugin.classes.Configuration;
import de.pickshadow.plugin.utils.Miscellaneous;
@ -47,6 +47,7 @@ public class PluginCommand extends CommandBase {
sender.sendMessage(Miscellaneous.format(Translation.PLUGINCOMMAND_INFO));
return true;
}
switch (args[0]) {
case "reloadconfig":
sender.sendMessage(Miscellaneous.format(Translation.PLUGINCOMMAND_RELOAD_CONFIG));
@ -68,19 +69,45 @@ public class PluginCommand extends CommandBase {
}
break;
case "gc":
sender.sendMessage(Miscellaneous.format(Translation.PLUGINCOMMAND_GARBAGECOLLECT));
Miscellaneous.gc();
Thread gcThread = new Thread(() -> {
sender.sendMessage(Miscellaneous.format(Translation.PLUGINCOMMAND_GARBAGECOLLECT));
Miscellaneous.gc();
sender.sendMessage(Miscellaneous.format(Translation.PLUGINCOMMAND_GARBAGECOLLECT_FINISHED));
});
gcThread.start();
break;
case "playerinfo":
if (sender instanceof ConsoleCommandSender) {
sender.sendMessage(Miscellaneous.format(Translation.GLOBAL_NOT_A_PLAYER, Types.FormatType.ERROR));
break;
}
Player player = (Player) sender;
sender.sendMessage(Miscellaneous.format(Translation.PLUGINCOMMAND_PLAYERINFO.replace("%playerdata%", ObjHolder.playerDataLoader.getPlayerData(player.getUniqueId()).convertToString())));
break;
default:
sender.sendMessage(Miscellaneous.format(Translation.GLOBAL_INVALID_ARGUMENT.replace("%usage%", command.getUsage()), Types.FormatType.ERROR));
case "scheduler":
if (args.length < 2) {
sender.sendMessage(Miscellaneous.format(Translation.GLOBAL_NOT_ENOUGH_ARGUMENTS.replace("%usage%", command.getUsage()), Types.FormatType.ERROR));
return true;
}
switch (args[1]) {
case "minutely":
case "minute":
sender.sendMessage(Miscellaneous.format(Translation.PLUGINCOMMAND_SCHEDULER.replace("%timeframe%", "minutely")));
ObjHolder.scheduler.runMinuteTasks(ObjHolder.scheduler.execsMinutely);
sender.sendMessage(Miscellaneous.format(Translation.PLUGINCOMMAND_SCHEDULER_DONE.replace("%timeframe%", "minutely")));
break;
case "hourly":
case "hour":
sender.sendMessage(Miscellaneous.format(Translation.PLUGINCOMMAND_SCHEDULER.replace("%timeframe%", "hourly")));
ObjHolder.scheduler.runHourTasks(ObjHolder.scheduler.execsHourly);
sender.sendMessage(Miscellaneous.format(Translation.PLUGINCOMMAND_SCHEDULER_DONE.replace("%timeframe%", "hourly")));
break;
default: sender.sendMessage(Miscellaneous.format(Translation.GLOBAL_INVALID_ARGUMENT.replace("%usage%", command.getUsage()), Types.FormatType.ERROR));
}
break;
default: sender.sendMessage(Miscellaneous.format(Translation.GLOBAL_INVALID_ARGUMENT.replace("%usage%", command.getUsage()), Types.FormatType.ERROR));
}
return true;
}
@ -89,7 +116,12 @@ public class PluginCommand extends CommandBase {
return (commandSender, command, name, args) -> {
if (commandSender.hasPermission("atc.commands.pickshadow")) {
ArrayList<String[]> completion = new ArrayList<>();
completion.add(new String[]{ "reloadconfig", "reloaddata", "gc", "playerinfo" });
completion.add(new String[]{ "reloadconfig", "reloaddata", "gc", "scheduler", "playerinfo" });
if (args.length > 2) {
if (args[0].equals("scheduler")) {
completion.add(new String[]{"minutely", "hourly"});
}
}
return TabCompletionHelper.processDynamicCompletion(completion, args);
} else {
return TabCompletionHelper.processEmptyCompletion(args);

View file

@ -19,7 +19,7 @@
package de.pickshadow.plugin.commands;
import de.pickshadow.plugin.classes.CommandBase;
import de.pickshadow.plugin.classes.Translation;
import de.pickshadow.plugin.base.Translation;
import de.pickshadow.plugin.utils.Miscellaneous;
import de.pickshadow.plugin.utils.TabCompletionHelper;
import net.kyori.adventure.text.Component;

View file

@ -18,9 +18,9 @@
*/
package de.pickshadow.plugin.commands;
import de.pickshadow.plugin.ObjHolder;
import de.pickshadow.plugin.base.ObjHolder;
import de.pickshadow.plugin.classes.CommandBase;
import de.pickshadow.plugin.classes.Translation;
import de.pickshadow.plugin.base.Translation;
import de.pickshadow.plugin.classes.Types;
import de.pickshadow.plugin.utils.Miscellaneous;
import de.pickshadow.plugin.utils.TabCompletionHelper;

View file

@ -18,8 +18,8 @@
*/
package de.pickshadow.plugin.listeners;
import de.pickshadow.plugin.ObjHolder;
import de.pickshadow.plugin.classes.Translation;
import de.pickshadow.plugin.base.ObjHolder;
import de.pickshadow.plugin.base.Translation;
import de.pickshadow.plugin.utils.Miscellaneous;
import net.kyori.adventure.text.Component;
import org.bukkit.Bukkit;

View file

@ -18,13 +18,10 @@
*/
package de.pickshadow.plugin.loaders;
import de.pickshadow.plugin.Main;
import de.pickshadow.plugin.ObjHolder;
import de.pickshadow.plugin.base.ObjHolder;
import de.pickshadow.plugin.classes.Configuration;
import de.pickshadow.plugin.classes.logger.LoggerImpl;
import de.pickshadow.plugin.classes.logger.LoggerInstanceImpl;
import de.pickshadow.plugin.utils.FileOperations;
import org.jetbrains.annotations.NotNull;
import org.yaml.snakeyaml.LoaderOptions;
import org.yaml.snakeyaml.Yaml;
import org.yaml.snakeyaml.composer.ComposerException;

View file

@ -18,9 +18,9 @@
*/
package de.pickshadow.plugin.loaders;
import de.pickshadow.plugin.ObjHolder;
import de.pickshadow.plugin.base.ObjHolder;
import de.pickshadow.plugin.classes.PlayerData;
import de.pickshadow.plugin.classes.Translation;
import de.pickshadow.plugin.base.Translation;
import de.pickshadow.plugin.classes.Types;
import de.pickshadow.plugin.classes.logger.LoggerInstanceImpl;
import de.pickshadow.plugin.utils.FileOperations;

View file

@ -18,8 +18,8 @@
*/
package de.pickshadow.plugin.utils;
import de.pickshadow.plugin.classes.Translation;
import de.pickshadow.plugin.ObjHolder;
import de.pickshadow.plugin.base.Translation;
import de.pickshadow.plugin.base.ObjHolder;
import de.pickshadow.plugin.classes.Types;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.minimessage.MiniMessage;

View file

@ -20,7 +20,7 @@ package de.pickshadow.plugin.utils;
import com.nikialeksey.hunspell.Hunspell;
import de.pickshadow.plugin.BuildConfiguration;
import de.pickshadow.plugin.ObjHolder;
import de.pickshadow.plugin.base.ObjHolder;
import de.pickshadow.plugin.classes.logger.LoggerInstanceImpl;
import org.bukkit.command.CommandSender;
import org.bukkit.command.TabCompleter;

View file

@ -16,7 +16,7 @@
# along with this program. If not, see <https://www.gnu.org/licenses/>.
name: PSSP
version: '${version}'
main: de.pickshadow.plugin.Main
main: de.pickshadow.plugin.base.Main
api-version: '1.20'
prefix: PSSP
depend: [ FreedomChat ]
@ -35,7 +35,7 @@ commands:
permission: pickshadow.commands.home
pssp:
description: Verwaltet das PickShadow Server Plugin.
usage: /pssp <reloadconfig|reloaddata|gc|playerinfo>
usage: /pssp <reloadconfig|reloaddata|gc <minutely|hourly>|playerinfo>
aliases: [ "pickshadow" ]
sysinfo:
description: Zeigt Informationen zum Server an.