9
0
mirror of https://github.com/Xiao-MoMi/Custom-Fishing.git synced 2025-12-29 03:49:07 +00:00
This commit is contained in:
Xiao-MoMi
2023-03-24 13:36:08 +08:00
parent 71b60ac0e2
commit e8718e62d1
26 changed files with 246 additions and 291 deletions

View File

@@ -17,10 +17,13 @@
package net.momirealms.customfishing.manager;
import net.momirealms.customfishing.CustomFishing;
import net.momirealms.customfishing.util.ConfigUtil;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.configuration.file.YamlConfiguration;
import java.io.File;
import java.io.IOException;
public class MessageManager {
@@ -38,11 +41,9 @@ public class MessageManager {
public static String notOnline;
public static String giveItem;
public static String getItem;
public static String coolDown;
public static String possibleLoots;
public static String splitChar;
public static String noLoot;
public static String notOpenWater;
public static String competitionOn;
public static String notEnoughPlayers;
public static String noRank;
@@ -62,40 +63,50 @@ public class MessageManager {
public static void load() {
YamlConfiguration config = ConfigUtil.getConfig("messages" + File.separator + "messages_" + ConfigManager.lang +".yml");
prefix = config.getString("messages.prefix", "messages.prefix is missing");
reload = config.getString("messages.reload", "messages.reload is missing");
nonArgs = config.getString("messages.none-args", "messages.none-args is missing");
unavailableArgs = config.getString("messages.invalid-args", "messages.invalid-args is missing");
escape = config.getString("messages.escape", "messages.escape is missing");
noPerm = config.getString("messages.no-perm", "messages.no-perm is missing");
itemNotExist = config.getString("messages.item-not-exist", "messages.item-not-exist is missing");
playerNotExist = config.getString("messages.player-not-exist", "messages.player-not-exist is missing");
noConsole = config.getString("messages.no-console", "messages.no-console is missing");
wrongAmount = config.getString("messages.wrong-amount", "messages.wrong-amount is missing");
lackArgs = config.getString("messages.lack-args", "messages.lack-args is missing");
notOnline = config.getString("messages.not-online", "messages.not-online is missing");
giveItem = config.getString("messages.give-item", "messages.give-item is missing");
getItem = config.getString("messages.get-item", "messages.get-item is missing");
coolDown = config.getString("messages.cooldown", "messages.cooldown is missing");
possibleLoots = config.getString("messages.possible-loots", "messages.possible-loots is missing");
splitChar = config.getString("messages.split-char", "messages.split-char is missing");
noLoot = config.getString("messages.no-loot", "messages.no-loot is missing");
notOpenWater = config.getString("messages.not-open-water", "messages.not-open-water is missing");
competitionOn = config.getString("messages.competition-ongoing", "messages.competition-ongoing is missing");
notEnoughPlayers = config.getString("messages.players-not-enough", "messages.players-not-enough is missing");
noRank = config.getString("messages.no-rank", "messages.no-rank is missing");
forceSuccess = config.getString("messages.force-competition-success", "messages.force-competition-success is missing");
forceFailure = config.getString("messages.force-competition-failure", "messages.force-competition-failure is missing");
forceEnd = config.getString("messages.force-competition-end", "messages.force-competition-end is missing");
forceCancel = config.getString("messages.force-competition-cancel","messages.force-competition-cancel is messing");
noPlayer = config.getString("messages.no-player", "messages.no-player is missing");
noScore = config.getString("messages.no-score", "messages.no-score is missing");
noRod = config.getString("messages.no-rod", "messages.no-rod is missing");
hookOther = config.getString("messages.hook-other-entity","messages.hook-other-entity is missing");
reachSellLimit = config.getString("messages.reach-sell-limit","messages.reach-sell-limit is missing");
setStatistics = config.getString("messages.set-statistics","messages.set-statistics is missing");
resetStatistics = config.getString("messages.reset-statistics","messages.reset-statistics is missing");
negativeStatistics = config.getString("messages.negative-statistics","messages.negative-statistics is missing");
statisticsNotExists = config.getString("messages.statistics-not-exist","messages.statistics-not-exist is missing");
prefix = getOrSet(config, "prefix", "<gradient:#0070B3:#A0EACF>[CustomFishing] </gradient>");
reload = getOrSet(config, "reload", "<white>Reloaded. Took <green>{time}ms.");
nonArgs = getOrSet(config, "none-args", "Arguments cannot be none.");
unavailableArgs = getOrSet(config, "invalid-args", "Invalid arguments.");
escape = getOrSet(config, "escape", "It has been too long since the fish is hooked. Oh my god, it escaped.");
noPerm = getOrSet(config, "no-perm", "You don''t have permission.");
itemNotExist = getOrSet(config, "item-not-exist", "That item does not exist.");
playerNotExist = getOrSet(config, "player-not-exist", "That player does not exist.");
noConsole = getOrSet(config, "no-console", "This command cannot be executed from the console.");
wrongAmount = getOrSet(config, "wrong-amount", "You can''t set an negative amount of items.");
lackArgs = getOrSet(config, "lack-args", "Insufficient arguments.");
notOnline = getOrSet(config, "not-online", "That player is not online.");
giveItem = getOrSet(config, "give-item", "Successfully given player {Player} {Amount}x {Item}.");
getItem = getOrSet(config, "get-item", "Successfully got {Amount}x {Item}.");
possibleLoots = getOrSet(config, "possible-loots", "Possible loots here: ");
splitChar = getOrSet(config, "split-char", ", ");
noLoot = getOrSet(config, "no-loot", "There''s no fish in this place.");
competitionOn = getOrSet(config, "competition-ongoing", "There is currently a fishing competition in progress! Start fishing to join the competition for a prize.");
notEnoughPlayers = getOrSet(config, "players-not-enough", "The number of players is not enough for the fishing competition to be started as scheduled.");
noRank = getOrSet(config, "no-rank", "No Rank");
forceSuccess = getOrSet(config, "force-competition-success", "Forced to start a fishing competition.");
forceFailure = getOrSet(config, "force-competition-failure", "The competition does not exist.");
forceEnd = getOrSet(config, "force-competition-end", "Forced to end the current competition.");
forceCancel = getOrSet(config, "force-competition-cancel", "Forced to cancel the competition");
noPlayer = getOrSet(config, "no-player", "No player");
noScore = getOrSet(config, "no-score", "No score");
noRod = getOrSet(config, "no-rod", "You have to fish with a special rod to get loots.");
hookOther = getOrSet(config, "hook-other-entity", "The hook is hooked on another entity.");
reachSellLimit = getOrSet(config, "reach-sell-limit", "You have earned too much from selling fish! Come tomorrow.");
setStatistics = getOrSet(config, "set-statistics", "Successfully set {Player}''s {Loot} statistics to {Amount}.");
resetStatistics = getOrSet(config, "reset-statistics", "Successfully reset {Player}''s statistics.");
negativeStatistics = getOrSet(config, "negative-statistics", "Amount should be a value no lower than zero.");
statisticsNotExists = getOrSet(config, "statistics-not-exist", "The statistics does not exist.");
try {
config.save(new File(CustomFishing.getInstance().getDataFolder(), "messages" + File.separator + "messages_" + ConfigManager.lang +".yml"));
} catch (IOException ignore) {
}
}
private static String getOrSet(ConfigurationSection section, String path, String defaultValue) {
path = "messages." + path;
if (!section.contains(path)) {
section.set(path, defaultValue);
}
return section.getString(path);
}
}