Cleanup
This commit is contained in:
parent
56b12224a6
commit
c9a22d3c0e
35 changed files with 270 additions and 356 deletions
|
|
@ -0,0 +1,13 @@
|
|||
package org.gsdistance.grimmsServer.Commands.GLevelCommand;
|
||||
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class GLevelBaseCommand implements CommandExecutor {
|
||||
@Override
|
||||
public boolean onCommand(@NotNull CommandSender commandSender, @NotNull Command command, @NotNull String s, @NotNull String[] strings) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
package org.gsdistance.grimmsServer.Commands.GLevelCommand;
|
||||
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.TabCompleter;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class GLevelTabCompleter implements TabCompleter {
|
||||
@Nullable
|
||||
@Override
|
||||
public List<String> onTabComplete(@NotNull CommandSender commandSender, @NotNull Command command, @NotNull String s, @NotNull String[] strings) {
|
||||
return List.of();
|
||||
}
|
||||
}
|
||||
|
|
@ -3,12 +3,36 @@ package org.gsdistance.grimmsServer.Commands.GLogCommand;
|
|||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.gsdistance.grimmsServer.Commands.HomeCommand.DelHome;
|
||||
import org.gsdistance.grimmsServer.Commands.HomeCommand.Homes;
|
||||
import org.gsdistance.grimmsServer.Commands.HomeCommand.Sethome;
|
||||
import org.gsdistance.grimmsServer.Commands.HomeCommand.TpHome;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.function.Function;
|
||||
|
||||
public class GLogBaseCommand implements CommandExecutor {
|
||||
|
||||
@Override
|
||||
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
|
||||
return false;
|
||||
if (!(sender instanceof Player player)) {
|
||||
sender.sendMessage("Only players can use this command.");
|
||||
return true;
|
||||
}
|
||||
if (args.length == 0) {
|
||||
return false;
|
||||
}
|
||||
String sub = args[0].toLowerCase();
|
||||
return switch (sub) {
|
||||
case "self_stats" -> LogSelfStats.subCommand(player);
|
||||
case "other_stats" -> LogPlayerStats.subCommand(player, args);
|
||||
case "self_titles" -> LogSelfTitles.subCommand(player);
|
||||
case "other_titles" -> LogPlayerTitles.subCommand(player, args);
|
||||
case "world" -> LogWorldStats.subCommand(player);
|
||||
case "leaderboard" -> LogLeaderboard.subCommand(player);
|
||||
case "commands" -> player.performCommand("grimmsserver:grimmsServerCommands");
|
||||
default -> false;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,13 +6,36 @@ import org.bukkit.command.TabCompleter;
|
|||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class GLogTabCompleter implements TabCompleter {
|
||||
|
||||
private static final List<String> SUBCOMMANDS = Arrays.asList(
|
||||
"self_stats",
|
||||
"other_stats",
|
||||
"self_titles",
|
||||
"other_titles",
|
||||
"world",
|
||||
"leaderboard",
|
||||
"commands"
|
||||
);
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public List<String> onTabComplete(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
|
||||
if (args.length == 1) {
|
||||
// Suggest subcommands based on the current input
|
||||
String partial = args[0].toLowerCase();
|
||||
List<String> suggestions = new ArrayList<>();
|
||||
for (String subcommand : SUBCOMMANDS) {
|
||||
if (subcommand.startsWith(partial)) {
|
||||
suggestions.add(subcommand);
|
||||
}
|
||||
}
|
||||
return suggestions;
|
||||
}
|
||||
return List.of();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,17 @@
|
|||
package org.gsdistance.grimmsServer.Commands.GLogCommand;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.gsdistance.grimmsServer.Stats.PlayerStatLeaderBoard;
|
||||
import org.gsdistance.grimmsServer.Stats.PlayerStats;
|
||||
|
||||
public class LogLeaderboard {
|
||||
public static boolean subCommand(Player player){
|
||||
PlayerStatLeaderBoard leaderBoard = PlayerStatLeaderBoard.getPlayerStatLeaderBoard();
|
||||
leaderBoard.checkPlayer(player);
|
||||
player.sendMessage("__Leaderboard:");
|
||||
for (String stat : leaderBoard.leaderboard.keySet()) {
|
||||
player.sendMessage("|Leader of stat " + PlayerStats.StatNames.get(stat) + " is " + leaderBoard.leaderboard.get(stat).getPlayerName() + " with " + leaderBoard.leaderboard.get(stat).getStatValue());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
package org.gsdistance.grimmsServer.Commands.GLogCommand;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.gsdistance.grimmsServer.GrimmsServer;
|
||||
import org.gsdistance.grimmsServer.Stats.PlayerStats;
|
||||
|
||||
import static org.gsdistance.grimmsServer.Shared.formatNumber;
|
||||
|
||||
public class LogPlayerStats {
|
||||
public static boolean subCommand(Player player, String[] args){
|
||||
if(!player.hasPermission("grimmsserver.log.other")) {
|
||||
return false;
|
||||
}
|
||||
if (args.length < 2) {
|
||||
player.sendMessage("Please specify a player name.");
|
||||
return false;
|
||||
}
|
||||
Player tplayer = GrimmsServer.instance.getServer().getPlayer(args[1]);
|
||||
if (tplayer == null) {
|
||||
player.sendMessage("Player not found.");
|
||||
return false;
|
||||
}
|
||||
PlayerStats stats = PlayerStats.getPlayerStats(tplayer);
|
||||
player.sendMessage("__" + tplayer.getDisplayName() + "'s stats:");
|
||||
for (String stat : PlayerStats.StatOrder) {
|
||||
Object value = stats.getStat(stat);
|
||||
if (value instanceof Double) {
|
||||
player.sendMessage("|" + PlayerStats.StatNames.get(stat) + ": " + formatNumber((Double) value));
|
||||
} else {
|
||||
player.sendMessage("|" + PlayerStats.StatNames.get(stat) + ": " + value.toString());
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
package org.gsdistance.grimmsServer.Commands.GLogCommand;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.gsdistance.grimmsServer.GrimmsServer;
|
||||
import org.gsdistance.grimmsServer.Stats.PlayerTitles;
|
||||
|
||||
public class LogPlayerTitles {
|
||||
public static boolean subCommand(Player player, String[] args){
|
||||
if(!player.hasPermission("grimmsserver.log.other")) {
|
||||
return false;
|
||||
}
|
||||
if (args.length < 2) {
|
||||
return false;
|
||||
}
|
||||
Player tplayer = GrimmsServer.instance.getServer().getPlayer(args[1]);
|
||||
if (tplayer == null) {
|
||||
player.sendMessage("Player not found.");
|
||||
return false;
|
||||
}
|
||||
PlayerTitles playerTitles = PlayerTitles.getPlayerTitles(tplayer);
|
||||
player.sendMessage("__Your Titles:");
|
||||
for (String title : playerTitles.getTitles()) {
|
||||
player.sendMessage("|" + title + ": " + PlayerTitles.titles.get(title));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
package org.gsdistance.grimmsServer.Commands.GLogCommand;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.gsdistance.grimmsServer.Stats.PlayerStats;
|
||||
|
||||
import static org.gsdistance.grimmsServer.Shared.formatNumber;
|
||||
|
||||
public class LogSelfStats {
|
||||
public static boolean subCommand(Player player) {
|
||||
if(!player.hasPermission("grimmsserver.log.self")) {
|
||||
return false;
|
||||
}
|
||||
PlayerStats stats = PlayerStats.getPlayerStats(player);
|
||||
player.sendMessage("__Your stats:");
|
||||
for (String stat : PlayerStats.StatOrder) {
|
||||
Object value = stats.getStat(stat);
|
||||
if (value instanceof Double) {
|
||||
player.sendMessage("|" + PlayerStats.StatNames.get(stat) + ": " + formatNumber((Double) value));
|
||||
} else {
|
||||
player.sendMessage("|" + PlayerStats.StatNames.get(stat) + ": " + value.toString());
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
package org.gsdistance.grimmsServer.Commands.GLogCommand;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.gsdistance.grimmsServer.Stats.PlayerTitles;
|
||||
|
||||
public class LogSelfTitles {
|
||||
public static boolean subCommand(Player player){
|
||||
if(!player.hasPermission("grimmsserver.log.self")) {
|
||||
return false;
|
||||
}
|
||||
PlayerTitles playerTitles = PlayerTitles.getPlayerTitles(player);
|
||||
player.sendMessage("__Your Titles:");
|
||||
for (String title : playerTitles.getTitles()) {
|
||||
player.sendMessage("|" + title + ": " + PlayerTitles.titles.get(title));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
package org.gsdistance.grimmsServer.Commands.GLogCommand;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.gsdistance.grimmsServer.Stats.WorldStats;
|
||||
|
||||
import java.util.Enumeration;
|
||||
|
||||
public class LogWorldStats {
|
||||
public static boolean subCommand(Player player){
|
||||
WorldStats stats = WorldStats.getWorldStats((player).getWorld());
|
||||
player.sendMessage("__World stats:");
|
||||
for (Enumeration<String> keys = WorldStats.Stats.keys(); keys.hasMoreElements(); ) {
|
||||
String stat = keys.nextElement();
|
||||
Object value = stats.getStat(stat);
|
||||
player.sendMessage("|" + WorldStats.StatNames.get(stat) + ": " + value.toString());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -13,8 +13,7 @@ public class HomeBaseCommand implements CommandExecutor {
|
|||
return true;
|
||||
}
|
||||
if (args.length == 0) {
|
||||
player.sendMessage("Usage: /home <sethome|tp|homes|delhome> [name]");
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
String sub = args[0].toLowerCase();
|
||||
return switch (sub) {
|
||||
|
|
@ -22,10 +21,7 @@ public class HomeBaseCommand implements CommandExecutor {
|
|||
case "tp" -> TpHome.SubCommand(player, args);
|
||||
case "homes" -> Homes.SubCommand(player, args);
|
||||
case "delhome" -> DelHome.SubCommand(player, args);
|
||||
default -> {
|
||||
player.sendMessage("Unknown subcommand. Use /home <sethome|tp|homes|delhome> [name]");
|
||||
yield true;
|
||||
}
|
||||
default -> false;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
package org.gsdistance.grimmsServer.Commands;
|
||||
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.gsdistance.grimmsServer.Stats.PlayerStatLeaderBoard;
|
||||
import org.gsdistance.grimmsServer.Stats.PlayerStats;
|
||||
|
||||
public class LogLeaderBoard implements CommandExecutor {
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
PlayerStatLeaderBoard leaderBoard = PlayerStatLeaderBoard.getPlayerStatLeaderBoard();
|
||||
leaderBoard.checkPlayer((Player) sender);
|
||||
sender.sendMessage("__Leaderboard:");
|
||||
for (String stat : leaderBoard.leaderboard.keySet()) {
|
||||
sender.sendMessage("|Leader of stat " + PlayerStats.StatNames.get(stat) + " is " + leaderBoard.leaderboard.get(stat).getPlayerName() + " with " + leaderBoard.leaderboard.get(stat).getStatValue());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,42 +0,0 @@
|
|||
package org.gsdistance.grimmsServer.Commands;
|
||||
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.gsdistance.grimmsServer.GrimmsServer;
|
||||
import org.gsdistance.grimmsServer.Stats.PlayerStats;
|
||||
|
||||
import static org.gsdistance.grimmsServer.Shared.formatNumber;
|
||||
|
||||
public class LogPlayerStats implements CommandExecutor {
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if (sender instanceof Player) {
|
||||
if (args.length == 0) {
|
||||
sender.sendMessage("Please specify a player name.");
|
||||
return false;
|
||||
}
|
||||
Player player = GrimmsServer.instance.getServer().getPlayer(args[0]);
|
||||
if (player == null) {
|
||||
sender.sendMessage("Player not found.");
|
||||
return false;
|
||||
}
|
||||
PlayerStats stats = PlayerStats.getPlayerStats(player);
|
||||
sender.sendMessage("__" + player.getDisplayName() + "'s stats:");
|
||||
for (String stat : PlayerStats.StatOrder) {
|
||||
Object value = stats.getStat(stat);
|
||||
if (value instanceof Double) {
|
||||
sender.sendMessage("|" + PlayerStats.StatNames.get(stat) + ": " + formatNumber((Double) value));
|
||||
} else {
|
||||
sender.sendMessage("|" + PlayerStats.StatNames.get(stat) + ": " + value.toString());
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
} else {
|
||||
sender.sendMessage("This command can only be run by a player.");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,33 +0,0 @@
|
|||
package org.gsdistance.grimmsServer.Commands;
|
||||
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.gsdistance.grimmsServer.GrimmsServer;
|
||||
import org.gsdistance.grimmsServer.Stats.PlayerTitles;
|
||||
|
||||
public class LogPlayerTitles implements CommandExecutor {
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if (sender instanceof Player) {
|
||||
if (args.length == 0) {
|
||||
return false;
|
||||
}
|
||||
Player player = GrimmsServer.instance.getServer().getPlayer(args[0]);
|
||||
if (player == null) {
|
||||
sender.sendMessage("Player not found.");
|
||||
return false;
|
||||
}
|
||||
PlayerTitles playerTitles = PlayerTitles.getPlayerTitles(player);
|
||||
sender.sendMessage("__Your Titles:");
|
||||
for (String title : playerTitles.getTitles()) {
|
||||
sender.sendMessage("|" + title + ": " + PlayerTitles.titles.get(title));
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
sender.sendMessage("This command can only be run by a player.");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,32 +0,0 @@
|
|||
package org.gsdistance.grimmsServer.Commands;
|
||||
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.gsdistance.grimmsServer.Stats.PlayerStats;
|
||||
|
||||
import static org.gsdistance.grimmsServer.Shared.formatNumber;
|
||||
|
||||
public class LogSelfStats implements CommandExecutor {
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if (sender instanceof Player player) {
|
||||
PlayerStats stats = PlayerStats.getPlayerStats(player);
|
||||
player.sendMessage("__Your stats:");
|
||||
for (String stat : PlayerStats.StatOrder) {
|
||||
Object value = stats.getStat(stat);
|
||||
if (value instanceof Double) {
|
||||
player.sendMessage("|" + PlayerStats.StatNames.get(stat) + ": " + formatNumber((Double) value));
|
||||
} else {
|
||||
player.sendMessage("|" + PlayerStats.StatNames.get(stat) + ": " + value.toString());
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
} else {
|
||||
sender.sendMessage("This command can only be run by a player.");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
package org.gsdistance.grimmsServer.Commands;
|
||||
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.gsdistance.grimmsServer.Stats.PlayerTitles;
|
||||
|
||||
public class LogSelfTitles implements CommandExecutor {
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if (sender instanceof Player player) {
|
||||
PlayerTitles playerTitles = PlayerTitles.getPlayerTitles(player);
|
||||
sender.sendMessage("__Your Titles:");
|
||||
for (String title : playerTitles.getTitles()) {
|
||||
sender.sendMessage("|" + title + ": " + PlayerTitles.titles.get(title));
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
sender.sendMessage("This command can only be run by a player.");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,29 +0,0 @@
|
|||
package org.gsdistance.grimmsServer.Commands;
|
||||
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.gsdistance.grimmsServer.Stats.WorldStats;
|
||||
|
||||
import java.util.Enumeration;
|
||||
|
||||
public class LogWorldStats implements CommandExecutor {
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if (sender instanceof Player) {
|
||||
WorldStats stats = WorldStats.getWorldStats(((Player) sender).getWorld());
|
||||
sender.sendMessage("__World stats:");
|
||||
for (Enumeration<String> keys = WorldStats.Stats.keys(); keys.hasMoreElements(); ) {
|
||||
String stat = keys.nextElement();
|
||||
Object value = stats.getStat(stat);
|
||||
sender.sendMessage("|" + WorldStats.StatNames.get(stat) + ": " + value.toString());
|
||||
}
|
||||
|
||||
return true;
|
||||
} else {
|
||||
sender.sendMessage("This command can only be run by a player.");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -8,7 +8,6 @@ public class MarketBaseCommand implements CommandExecutor {
|
|||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if (args.length == 0) {
|
||||
sender.sendMessage("Usage: /market <get|stock|ripoff|enchant|tp|sell|buy> [args]");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -20,10 +19,7 @@ public class MarketBaseCommand implements CommandExecutor {
|
|||
case "tp" -> BuyTp.SubCommand(sender, args);
|
||||
case "sell" -> SellItem.SubCommand(sender, args);
|
||||
case "buy" -> BuyItem.SubCommand(sender, args);
|
||||
default -> {
|
||||
sender.sendMessage("Unknown subcommand. Usage: /market <get|stock|ripoff|enchant|tp|sell|buy> [args]");
|
||||
yield false;
|
||||
}
|
||||
default -> false;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
@ -11,8 +11,10 @@ import java.util.logging.Level;
|
|||
public class ReloadConfig implements CommandExecutor {
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
sender.sendMessage("Reloading config...");
|
||||
ConfigLoader.loadConfigFromFile();
|
||||
GrimmsServer.logger.log(Level.INFO, "Config reloaded.");
|
||||
sender.sendMessage("Config reloaded successfully.");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,8 +18,10 @@ public class ActiveConfig {
|
|||
public static boolean module_Events = true;
|
||||
public static boolean module_Utils = true;
|
||||
public static boolean module_Ranks = true;
|
||||
public static boolean joinMessage = true;
|
||||
public static boolean module_Dimensions = true;
|
||||
|
||||
public static void updateConfig(boolean module_Jobs, boolean module_Factions, boolean module_Market, boolean module_Leaderboard, List<String> disabledCommands, boolean module_Chat, boolean module_Homes, boolean module_Leveling, boolean module_Titles, boolean module_Relics, boolean module_Events, boolean module_Utils, boolean module_Ranks) {
|
||||
public static void updateConfig(boolean module_Jobs, boolean module_Factions, boolean module_Market, boolean module_Leaderboard, List<String> disabledCommands, boolean module_Chat, boolean module_Homes, boolean module_Leveling, boolean module_Titles, boolean module_Relics, boolean module_Events, boolean module_Utils, boolean module_Ranks, boolean joinMessage, boolean module_Dimensions) {
|
||||
ActiveConfig.module_Jobs = module_Jobs;
|
||||
ActiveConfig.module_Factions = module_Factions;
|
||||
ActiveConfig.module_Market = module_Market;
|
||||
|
|
@ -33,6 +35,8 @@ public class ActiveConfig {
|
|||
ActiveConfig.module_Events = module_Events;
|
||||
ActiveConfig.module_Utils = module_Utils;
|
||||
ActiveConfig.module_Ranks = module_Ranks;
|
||||
ActiveConfig.joinMessage = joinMessage;
|
||||
ActiveConfig.module_Dimensions = module_Dimensions;
|
||||
|
||||
// Log the status of each module
|
||||
if (!module_Jobs) {
|
||||
|
|
@ -76,5 +80,11 @@ public class ActiveConfig {
|
|||
if (!module_Ranks) {
|
||||
GrimmsServer.logger.info("Ranks module is disabled by config.");
|
||||
}
|
||||
if (!joinMessage) {
|
||||
GrimmsServer.logger.info("Join message is disabled by config.");
|
||||
}
|
||||
if (!module_Dimensions) {
|
||||
GrimmsServer.logger.info("Dimensions module is disabled by config.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,22 +25,23 @@ public class ConfigLoader {
|
|||
GrimmsServer.logger.warning("Config somehow not initialized.");
|
||||
return;
|
||||
}
|
||||
|
||||
boolean module_Jobs = config.getBoolean("module_Jobs", true);
|
||||
boolean module_Factions = config.getBoolean("module_Factions", true);
|
||||
boolean module_Market = config.getBoolean("module_Market", true);
|
||||
boolean module_Leaderboard = config.getBoolean("module_Leaderboard", true);
|
||||
List<String> disabledCommands = config.getStringList("disabledCommands");
|
||||
boolean module_Chat = config.getBoolean("module_Chat", true);
|
||||
boolean module_Homes = config.getBoolean("module_Homes", true);
|
||||
boolean module_Leveling = config.getBoolean("module_Leveling", true);
|
||||
boolean module_Titles = config.getBoolean("module_Titles", true);
|
||||
boolean module_Relics = config.getBoolean("module_Relics", true);
|
||||
boolean module_Events = config.getBoolean("module_Events", true);
|
||||
boolean module_Utils = config.getBoolean("module_Utils", true);
|
||||
boolean module_Ranks = config.getBoolean("module_Ranks", true);
|
||||
|
||||
ActiveConfig.updateConfig(module_Jobs, module_Factions, module_Market, module_Leaderboard, disabledCommands, module_Chat, module_Homes, module_Leveling, module_Titles, module_Relics, module_Events, module_Utils, module_Ranks);
|
||||
ActiveConfig.updateConfig(
|
||||
config.getBoolean("module_Jobs", true),
|
||||
config.getBoolean("module_Factions", true),
|
||||
config.getBoolean("module_Market", true),
|
||||
config.getBoolean("module_Leaderboard", true),
|
||||
config.getStringList("disabledCommands"),
|
||||
config.getBoolean("module_Chat", true),
|
||||
config.getBoolean("module_Homes", true),
|
||||
config.getBoolean("module_Leveling", true),
|
||||
config.getBoolean("module_Titles", true),
|
||||
config.getBoolean("module_Relics", true),
|
||||
config.getBoolean("module_Events", true),
|
||||
config.getBoolean("module_Utils", true),
|
||||
config.getBoolean("module_Ranks", true),
|
||||
config.getBoolean("joinMessage", true),
|
||||
config.getBoolean("module_Dimensions", true)
|
||||
);
|
||||
GrimmsServer.logger.info("GrimmsServer config loaded successfully.");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,19 +6,13 @@ import java.util.Map;
|
|||
|
||||
public class ConfigRequirements {
|
||||
public static final Map<String, String> CommandRequirements = Map.ofEntries(
|
||||
Map.entry("sellItem", "market"),
|
||||
Map.entry("buyItem", "market"),
|
||||
Map.entry("getMarketStock", "market"),
|
||||
Map.entry("getMarket", "market"),
|
||||
Map.entry("logLeaderboard", "leaderboard"),
|
||||
Map.entry("sendMoney", "market"),
|
||||
Map.entry("buyRipoff", "market"),
|
||||
Map.entry("makeItemLevelable", "leveling"),
|
||||
Map.entry("setPlayerStat", "stats"),
|
||||
Map.entry("logPlayerStats", "stats"),
|
||||
Map.entry("logSelfStats", "stats"),
|
||||
Map.entry("logWorldStats", "stats"),
|
||||
Map.entry("buyEnchantment", "market"),
|
||||
Map.entry("logEnchantmentCosts", "market"),
|
||||
Map.entry("logJobs", "job"),
|
||||
Map.entry("takeJob", "job"),
|
||||
|
|
@ -27,15 +21,12 @@ public class ConfigRequirements {
|
|||
Map.entry("addTitle", "titles"),
|
||||
Map.entry("removeTitle", "titles"),
|
||||
Map.entry("executePlayer", "titles"),
|
||||
Map.entry("grimmsServerCommands", "default"),
|
||||
Map.entry("withdrawMoney", "market"),
|
||||
Map.entry("depositMoney", "market"),
|
||||
Map.entry("acceptRequest", "default"),
|
||||
Map.entry("buyTp", "market"),
|
||||
Map.entry("reloadGrimmsConfig", "default"),
|
||||
Map.entry("home", "homes"),
|
||||
Map.entry("nick", "chat"),
|
||||
Map.entry("market", "market")
|
||||
Map.entry("market", "market"),
|
||||
Map.entry("gDim", "dimensions")
|
||||
);
|
||||
|
||||
public static boolean isCommandEnabled(String command) {
|
||||
|
|
@ -52,6 +43,7 @@ public class ConfigRequirements {
|
|||
case "factions" -> ActiveConfig.module_Factions;
|
||||
case "relics" -> ActiveConfig.module_Relics;
|
||||
case "events" -> ActiveConfig.module_Events;
|
||||
case "dimensions" -> ActiveConfig.module_Dimensions;
|
||||
case "default" -> true; // Default commands are always enabled
|
||||
default -> true; // Unknown command category
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,6 +1,12 @@
|
|||
package org.gsdistance.grimmsServer.Manage;
|
||||
|
||||
import org.gsdistance.grimmsServer.Commands.*;
|
||||
import org.gsdistance.grimmsServer.Commands.GDimensionCommand.GDimBaseCommand;
|
||||
import org.gsdistance.grimmsServer.Commands.GDimensionCommand.GDimTabCompleter;
|
||||
import org.gsdistance.grimmsServer.Commands.GLogCommand.GLogBaseCommand;
|
||||
import org.gsdistance.grimmsServer.Commands.GLogCommand.GLogTabCompleter;
|
||||
import org.gsdistance.grimmsServer.Commands.GUtilCommand.GUtilBaseCommand;
|
||||
import org.gsdistance.grimmsServer.Commands.GUtilCommand.GUtilTabCompleter;
|
||||
import org.gsdistance.grimmsServer.Commands.HomeCommand.HomeBaseCommand;
|
||||
import org.gsdistance.grimmsServer.Commands.HomeCommand.HomeTabCompleter;
|
||||
import org.gsdistance.grimmsServer.Commands.MarketComand.MarketBaseCommand;
|
||||
|
|
@ -15,15 +21,9 @@ public class CommandRegistry {
|
|||
@SuppressWarnings("DataFlowIssue")
|
||||
public static void registerCommands() {
|
||||
// Register all commands here
|
||||
GrimmsServer.instance.getCommand("logSelfStats").setExecutor(new LogSelfStats());
|
||||
GrimmsServer.instance.getCommand("logWorldStats").setExecutor(new LogWorldStats());
|
||||
GrimmsServer.instance.getCommand("logLeaderboard").setExecutor(new LogLeaderBoard());
|
||||
GrimmsServer.instance.getCommand("sendMoney").setExecutor(new SendMoney());
|
||||
GrimmsServer.instance.getCommand("makeItemLevelable").setExecutor(new MakeItemLevelable());
|
||||
GrimmsServer.instance.getCommand("setPlayerStat").setExecutor(new SetPlayerStat());
|
||||
GrimmsServer.instance.getCommand("logPlayerStats").setExecutor(new LogPlayerStats());
|
||||
GrimmsServer.instance.getCommand("logSelfTitles").setExecutor(new LogSelfTitles());
|
||||
GrimmsServer.instance.getCommand("logPlayerTitles").setExecutor(new LogPlayerTitles());
|
||||
GrimmsServer.instance.getCommand("addTitle").setExecutor(new AddTitle());
|
||||
GrimmsServer.instance.getCommand("executePlayer").setExecutor(new ExecutePlayer());
|
||||
GrimmsServer.instance.getCommand("logEnchantmentCosts").setExecutor(new LogEnchantmentCosts());
|
||||
|
|
@ -41,8 +41,12 @@ public class CommandRegistry {
|
|||
GrimmsServer.instance.getCommand("nick").setExecutor(new Nick());
|
||||
GrimmsServer.instance.getCommand("market").setExecutor(new MarketBaseCommand());
|
||||
GrimmsServer.instance.getCommand("market").setTabCompleter(new MarketTabCompleter());
|
||||
//GrimmsServer.instance.getCommand("gUtil").setExecutor(new GUtilBaseCommand());
|
||||
//GrimmsServer.instance.getCommand("gUtil").setTabCompleter(new GUtilTabCompleter());
|
||||
GrimmsServer.instance.getCommand("gUtil").setExecutor(new GUtilBaseCommand());
|
||||
GrimmsServer.instance.getCommand("gUtil").setTabCompleter(new GUtilTabCompleter());
|
||||
GrimmsServer.instance.getCommand("gLog").setExecutor(new GLogBaseCommand());
|
||||
GrimmsServer.instance.getCommand("gLog").setTabCompleter(new GLogTabCompleter());
|
||||
GrimmsServer.instance.getCommand("gDim").setExecutor(new GDimBaseCommand());
|
||||
GrimmsServer.instance.getCommand("gDim").setTabCompleter(new GDimTabCompleter());
|
||||
}
|
||||
|
||||
public static boolean CanExecute(String command) {
|
||||
|
|
|
|||
|
|
@ -11,4 +11,6 @@ module_Titles: true
|
|||
module_Relics: true
|
||||
module_Events: true
|
||||
module_Utils: true
|
||||
module_Ranks: true
|
||||
module_Ranks: true
|
||||
joinMessage: true
|
||||
module_Dimensions: true
|
||||
|
|
@ -8,18 +8,6 @@ version: ${version}
|
|||
api-version: 1.20
|
||||
load: STARTUP
|
||||
commands:
|
||||
logSelfStats:
|
||||
description: Displays the player's own stats including death count, money, and total kills.
|
||||
usage: /logSelfStats
|
||||
permission: grimmsserver.logSelfStats
|
||||
logWorldStats:
|
||||
description: Displays the world stats including total deaths, total kills, and total money.
|
||||
usage: /logWorldStats
|
||||
permission: grimmsserver.logWorldStats
|
||||
logLeaderboard:
|
||||
description: Displays the leaderboard of players with the most kills.
|
||||
usage: /logLeaderboard
|
||||
permission: grimmsserver.logLeaderboard
|
||||
sendMoney:
|
||||
description: Sends money to another player.
|
||||
usage: /sendMoney <player> <amount>
|
||||
|
|
@ -32,18 +20,6 @@ commands:
|
|||
description: Set a player's stats.
|
||||
usage: /setPlayerStat <player> <statId> <value>
|
||||
permission: grimmsserver.setPlayerStat
|
||||
logPlayerStats:
|
||||
description: Displays the stats of a specified player.
|
||||
usage: /logPlayerStats <player>
|
||||
permission: grimmsserver.logPlayerStats
|
||||
logSelfTitles:
|
||||
description: Displays the titles of the player.
|
||||
usage: /logSelfTitles
|
||||
permission: grimmsserver.logSelfTitles
|
||||
logPlayerTitles:
|
||||
description: Displays the titles of a specified player.
|
||||
usage: /logPlayerTitles <player>
|
||||
permission: grimmsserver.logPlayerTitles
|
||||
addTitle:
|
||||
description: Adds a title to a player.
|
||||
usage: /addTitle <player> <title>
|
||||
|
|
@ -116,57 +92,21 @@ commands:
|
|||
usage: /gUtil <command> [args]
|
||||
permission: grimmsserver.util
|
||||
permissions:
|
||||
grimmsserver.logSelfStats:
|
||||
description: Allows a player to log their own stats
|
||||
default: true
|
||||
grimmsserver.logWorldStats:
|
||||
description: Allows a player to log world stats
|
||||
default: true
|
||||
grimmsserver.sellItem:
|
||||
description: Allows a player to sell an item
|
||||
default: true
|
||||
grimmsserver.buyItem:
|
||||
description: Allows a player to buy an item
|
||||
default: true
|
||||
grimmsserver.getMarketStock:
|
||||
description: Allows a player to get market stock
|
||||
default: true
|
||||
grimmsserver.getMarket:
|
||||
description: Allows a player to get market information
|
||||
default: true
|
||||
grimmsserver.logLeaderboard:
|
||||
description: Allows a player to log the leaderboard
|
||||
default: true
|
||||
grimmsserver.sendMoney:
|
||||
description: Allows a player to send money to another player
|
||||
default: true
|
||||
grimmsserver.buyRipoff:
|
||||
description: Allows a player to buy an item at a higher price
|
||||
default: true
|
||||
grimmsserver.makeItemLevelable:
|
||||
description: Allows a player to make an item levelable
|
||||
default: true
|
||||
grimmsserver.setPlayerStat:
|
||||
description: Allows a player to set another player's stats
|
||||
default: op
|
||||
grimmsserver.logPlayerStats:
|
||||
description: Allows a player to log another player's stats
|
||||
default: op
|
||||
grimmsserver.logSelfTitles:
|
||||
description: Allows a player to log their own titles
|
||||
default: true
|
||||
grimmsserver.logPlayerTitles:
|
||||
description: Allows a player to log another player's titles
|
||||
default: true
|
||||
grimmsserver.addTitle:
|
||||
description: Allows a player to add a title to another player
|
||||
default: op
|
||||
grimmsserver.executePlayer:
|
||||
description: Allows a player to execute another player
|
||||
default: true
|
||||
grimmsserver.buyEnchantment:
|
||||
description: Allows a player to buy an enchantment
|
||||
default: true
|
||||
grimmsserver.logEnchantmentCosts:
|
||||
description: Allows a player to log enchantment costs
|
||||
default: true
|
||||
|
|
@ -191,9 +131,6 @@ permissions:
|
|||
grimmsserver.acceptRequest:
|
||||
description: Allows a player to accept a request
|
||||
default: true
|
||||
grimmsserver.buyTp:
|
||||
description: Allows a player to buy a teleport request
|
||||
default: true
|
||||
grimmsserver.removeTitle:
|
||||
description: Allows a player to remove a title from another player
|
||||
default: op
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue