mirror of
https://github.com/CarmJos/UltraDepository.git
synced 2024-09-19 19:55:45 +00:00
[v1.2.4] 依赖更新
- [U] 采用EasyPlugin的EasyMessages实现消息配置文件
This commit is contained in:
parent
8538aa2be8
commit
c2eeddedcb
@ -207,9 +207,9 @@
|
||||
|
||||
详见源文件。
|
||||
|
||||
### 消息配置文件 ([messages.yml](src/main/resources/messages.yml))
|
||||
### 消息配置文件 ([messages.yml](src/main/java/cc/carm/plugin/ultradepository/configuration/PluginMessages.java))
|
||||
|
||||
详见源文件。
|
||||
详见代码文件中默认值,相关文件将在首次运行时创建。
|
||||
|
||||
### 仓库配置文件 ([depositories/<仓库ID>.yml](.examples/depositories/full-example.yml))
|
||||
|
||||
|
4
pom.xml
4
pom.xml
@ -9,13 +9,13 @@
|
||||
<maven.compiler.target>11</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<maven.compiler.encoding>UTF-8</maven.compiler.encoding>
|
||||
<easyplugin.version>1.2.0</easyplugin.version>
|
||||
<easyplugin.version>1.3.0</easyplugin.version>
|
||||
</properties>
|
||||
|
||||
<groupId>cc.carm.plugin</groupId>
|
||||
<artifactId>ultradepository</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<version>1.2.3</version>
|
||||
<version>1.2.4</version>
|
||||
|
||||
<name>UltraDepository</name>
|
||||
<description>超级仓库插件,支持设定不同物品的存储仓库。</description>
|
||||
|
@ -30,12 +30,12 @@ public class DepositoryCommand implements CommandExecutor, TabCompleter {
|
||||
|
||||
|
||||
private boolean helpConsole(CommandSender sender) {
|
||||
PluginMessages.HELP_CONSOLE.send(sender);
|
||||
PluginMessages.Usages.CONSOLE.send(sender);
|
||||
return true;
|
||||
}
|
||||
|
||||
private boolean helpPlayer(Player player) {
|
||||
PluginMessages.HELP_PLAYER.send(player);
|
||||
PluginMessages.Usages.PLAYER.send(player);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -1,46 +1,88 @@
|
||||
package cc.carm.plugin.ultradepository.configuration;
|
||||
|
||||
|
||||
import cc.carm.lib.easyplugin.configuration.message.ConfigMessageList;
|
||||
import cc.carm.lib.easyplugin.configuration.language.EasyMessageList;
|
||||
import cc.carm.lib.easyplugin.configuration.language.MessagesRoot;
|
||||
import cc.carm.lib.easyplugin.configuration.language.MessagesSection;
|
||||
|
||||
public class PluginMessages {
|
||||
public class PluginMessages extends MessagesRoot {
|
||||
|
||||
public static final ConfigMessageList HELP_CONSOLE = new ConfigMessageList("help.console");
|
||||
@MessagesSection("help")
|
||||
public static class Usages {
|
||||
|
||||
public static final ConfigMessageList HELP_PLAYER = new ConfigMessageList("help.player");
|
||||
public static final EasyMessageList CONSOLE = new EasyMessageList(
|
||||
"&6&l超级仓库 &f后台指令帮助",
|
||||
"&8#&f info &6<玩家> &e[仓库ID] &e[物品ID]",
|
||||
"&8-&7 得到玩家的相关物品信息。",
|
||||
"&8#&f add &6<玩家> &6<仓库ID> &6<物品ID> &6<数量>",
|
||||
"&8-&7 为玩家添加对应仓库中对于物品的数量。",
|
||||
"&8#&f remove &6<玩家> &6<仓库ID> &6<物品ID> &e[数量]",
|
||||
"&8-&7 为玩家减少对应仓库中对于物品的数量。",
|
||||
"&8-&7 若不填写数量,则清空对应仓库的对应物品。",
|
||||
"&8#&f sell &6<玩家> &e[仓库ID] &e[物品ID] &e[数量]",
|
||||
"&8-&7 为玩家售出相关物品。",
|
||||
"&8-&7 若不填写数量,则售出所有对应仓库的对应物品。",
|
||||
"&8-&7 若不填写物品,则售出对应仓库内所有物品。",
|
||||
"&8-&7 若不填写仓库,则售出所有仓库内所有物品。",
|
||||
"&8-&7 该指令受到玩家每日售出数量的限制。"
|
||||
);
|
||||
|
||||
public static final EasyMessageList PLAYER = new EasyMessageList(
|
||||
"&6&l超级仓库 &f玩家指令帮助",
|
||||
"&8#&f open &e[仓库ID]",
|
||||
"&8-&7 打开对应仓库的界面。",
|
||||
"&8#&f sell &6<仓库ID> &6<物品ID> &6<数量>",
|
||||
"&8-&7 售出对应数量的对应物品。",
|
||||
"&8-&7 该指令受到玩家每日售出数量的限制。",
|
||||
"&8#&f sellAll &e[仓库ID] &e[物品ID]",
|
||||
"&8-&7 该指令受到玩家每日售出数量的限制。"
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
public static final EasyMessageList ITEM_SOLD = new EasyMessageList(
|
||||
new String[]{"&f您出售了 &r%(item)&7x%(amount) &f,共赚取 &6%(money) &f元。"},
|
||||
new String[]{"%(item)", "%(amount)", "%(money)"}
|
||||
);
|
||||
|
||||
public static final EasyMessageList ITEM_SOLD_LIMIT = new EasyMessageList(
|
||||
new String[]{"&f该物品今日剩余可出售额度为 &a%(amount)&8/%(limit) &f个。"},
|
||||
new String[]{"%(amount)", "%(limit)"}
|
||||
);
|
||||
|
||||
public static final EasyMessageList ITEM_PICKUP = new EasyMessageList(
|
||||
new String[]{"&f您拾取了 &r%(item)&7x%(amount) &f,已自动放入到您的仓库中。"},
|
||||
new String[]{"%(item)", "%(amount)"}
|
||||
);
|
||||
|
||||
public static final EasyMessageList ITEM_COLLECT = new EasyMessageList(
|
||||
new String[]{"&f您收集了 &r%(item)&7x%(amount) &f,已自动放入到您的 &6%(depository) &f中。"},
|
||||
new String[]{"%(item)", "%(amount)", "%(depository)"}
|
||||
);
|
||||
|
||||
|
||||
public static final EasyMessageList NO_SPACE = new EasyMessageList(
|
||||
"&f您仓库内没有足够的空间取出物品!"
|
||||
);
|
||||
|
||||
public static final EasyMessageList NO_ECONOMY = new EasyMessageList(
|
||||
"&f本服务器暂未启用出售功能。"
|
||||
);
|
||||
|
||||
public static final EasyMessageList NO_DEPOSITORY = new EasyMessageList(
|
||||
"&f不存在该仓库,请检查仓库ID是否正确。"
|
||||
);
|
||||
|
||||
public static final EasyMessageList NO_ITEM = new EasyMessageList(
|
||||
"&f仓库中不存在该物品,请检查物品ID是否正确。"
|
||||
);
|
||||
|
||||
public static final EasyMessageList NO_ENOUGH_ITEM = new EasyMessageList(
|
||||
"&f仓库中不存在足够的物品。"
|
||||
);
|
||||
|
||||
public static final EasyMessageList WRONG_NUMBER = new EasyMessageList(
|
||||
"&f数目输入错误,请输入正确的数字!"
|
||||
);
|
||||
|
||||
public static final ConfigMessageList SOLD = new ConfigMessageList(
|
||||
"item-sold", new String[0], new String[]{
|
||||
"%(item)", "%(amount)", "%(money)"
|
||||
});
|
||||
|
||||
public static final ConfigMessageList PICKUP = new ConfigMessageList(
|
||||
"item-pickup", new String[0], new String[]{
|
||||
"%(item)", "%(amount)"
|
||||
});
|
||||
|
||||
public static final ConfigMessageList COLLECTED = new ConfigMessageList(
|
||||
"item-collected", new String[0], new String[]{
|
||||
"%(item)", "%(amount)", "%(depository)"
|
||||
});
|
||||
|
||||
|
||||
public static final ConfigMessageList NO_ECONOMY = new ConfigMessageList("no-economy");
|
||||
|
||||
public static final ConfigMessageList NO_SPACE = new ConfigMessageList("no-space");
|
||||
|
||||
public static final ConfigMessageList NO_DEPOSITORY = new ConfigMessageList("no-depository");
|
||||
|
||||
public static final ConfigMessageList NO_ITEM = new ConfigMessageList("no-item");
|
||||
|
||||
public static final ConfigMessageList NO_ENOUGH_ITEM = new ConfigMessageList("no-enough-item");
|
||||
|
||||
|
||||
public static final ConfigMessageList ITEM_SOLD_LIMIT = new ConfigMessageList(
|
||||
"item-sold-limit", new String[0], new String[]{
|
||||
"%(amount)", "%(limit)"
|
||||
});
|
||||
|
||||
public static final ConfigMessageList WRONG_NUMBER = new ConfigMessageList("wrong-number");
|
||||
}
|
||||
|
@ -2,22 +2,29 @@ package cc.carm.plugin.ultradepository.manager;
|
||||
|
||||
|
||||
import cc.carm.lib.easyplugin.configuration.file.FileConfig;
|
||||
import cc.carm.lib.easyplugin.configuration.language.MessagesConfig;
|
||||
import cc.carm.lib.easyplugin.configuration.language.MessagesInitializer;
|
||||
import cc.carm.plugin.ultradepository.UltraDepository;
|
||||
import cc.carm.plugin.ultradepository.configuration.PluginMessages;
|
||||
|
||||
public class ConfigManager {
|
||||
|
||||
private static FileConfig pluginConfiguration;
|
||||
private static FileConfig messageConfiguration;
|
||||
private static MessagesConfig messageConfiguration;
|
||||
|
||||
public static boolean initialize() {
|
||||
try {
|
||||
pluginConfiguration = new FileConfig(UltraDepository.getInstance(), "config.yml");
|
||||
messageConfiguration = new FileConfig(UltraDepository.getInstance(), "messages.yml");
|
||||
messageConfiguration = new MessagesConfig(UltraDepository.getInstance(), "messages.yml");
|
||||
|
||||
FileConfig.pluginConfiguration = () -> pluginConfiguration;
|
||||
FileConfig.messageConfiguration = () -> messageConfiguration;
|
||||
|
||||
MessagesInitializer.initialize(messageConfiguration, PluginMessages.class);
|
||||
|
||||
return true;
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -26,7 +33,7 @@ public class ConfigManager {
|
||||
return pluginConfiguration;
|
||||
}
|
||||
|
||||
public static FileConfig getMessageConfig() {
|
||||
public static MessagesConfig getMessageConfig() {
|
||||
return messageConfiguration;
|
||||
}
|
||||
|
||||
|
@ -166,7 +166,7 @@ public class DepositoryManager {
|
||||
|
||||
collectItemEvent.getUserData().addItemAmount(depository.getIdentifier(), typeID, finalAmount);
|
||||
if (!player.hasPermission("UltraDepository.silent")) {
|
||||
PluginMessages.COLLECTED.send(player, new Object[]{
|
||||
PluginMessages.ITEM_COLLECT.send(player, new Object[]{
|
||||
depository.getItems().get(typeID).getName(),
|
||||
finalAmount, depository.getName()
|
||||
});
|
||||
|
@ -89,7 +89,7 @@ public class EconomyManager {
|
||||
player, depositoryItem, changes[0] + amount, changes[0], money
|
||||
));
|
||||
|
||||
PluginMessages.SOLD.send(player, new Object[]{depositoryItem.getName(), amount, money});
|
||||
PluginMessages.ITEM_SOLD.send(player, new Object[]{depositoryItem.getName(), amount, money});
|
||||
if (playSound) PluginConfig.Sounds.SELL_SUCCESS.play(player);
|
||||
}
|
||||
|
||||
|
@ -78,7 +78,7 @@ public class DepositoryGUI extends GUI {
|
||||
int pickupAmount = Math.min(itemData.getAmount(), item.getMaterial().getMaxStackSize());
|
||||
userData.removeItemAmount(item.getDepository().getIdentifier(), item.getTypeID(), pickupAmount);
|
||||
player.getInventory().addItem(item.getRawItem(pickupAmount));
|
||||
PluginMessages.PICKUP.send(player, new Object[]{
|
||||
PluginMessages.ITEM_PICKUP.send(player, new Object[]{
|
||||
item.getName(), pickupAmount
|
||||
});
|
||||
setupItems(); //刷新GUI
|
||||
|
@ -1,58 +0,0 @@
|
||||
help:
|
||||
|
||||
player:
|
||||
- "&6&l超级仓库 &f玩家指令帮助"
|
||||
- "&8#&f open &e[仓库ID]"
|
||||
- "&8-&7 打开对应仓库的界面。"
|
||||
- "&8#&f sell &6<仓库ID> &6<物品ID> &6<数量>"
|
||||
- "&8-&7 售出对应数量的对应物品。"
|
||||
- "&8-&7 该指令受到玩家每日售出数量的限制。"
|
||||
- "&8#&f sellAll &e[仓库ID] &e[物品ID]"
|
||||
- "&8-&7 该指令受到玩家每日售出数量的限制。"
|
||||
console:
|
||||
- "&6&l超级仓库 &f后台指令帮助"
|
||||
- "&8#&f info &6<玩家> &e[仓库ID] &e[物品ID]"
|
||||
- "&8-&7 得到玩家的相关物品信息。"
|
||||
- "&8#&f add &6<玩家> &6<仓库ID> &6<物品ID> &6<数量>"
|
||||
- "&8-&7 为玩家添加对应仓库中对于物品的数量。"
|
||||
- "&8#&f remove &6<玩家> &6<仓库ID> &6<物品ID> &e[数量]"
|
||||
- "&8-&7 为玩家减少对应仓库中对于物品的数量。"
|
||||
- "&8-&7 若不填写数量,则清空对应仓库的对应物品。"
|
||||
- "&8#&f sell &6<玩家> &e[仓库ID] &e[物品ID] &e[数量]"
|
||||
- "&8-&7 为玩家售出相关物品。"
|
||||
- "&8-&7 若不填写数量,则售出所有对应仓库的对应物品。"
|
||||
- "&8-&7 若不填写物品,则售出对应仓库内所有物品。"
|
||||
- "&8-&7 若不填写仓库,则售出所有仓库内所有物品。"
|
||||
- "&8-&7 该指令受到玩家每日售出数量的限制。"
|
||||
|
||||
item-collected:
|
||||
- "&f您收集了 &r%(item)&7x%(amount) &f,已自动放入到您的 &6%(depository) &f中。"
|
||||
|
||||
item-pickup:
|
||||
- "&f您取出了 &r%(item)&7x%(amount) &f,已自动放入到您的仓库中。"
|
||||
|
||||
item-sold:
|
||||
- "&f您出售了 &r%(item)&7x%(amount) &f,共赚取 &6%(money) &f元。"
|
||||
|
||||
item-sold-limit:
|
||||
- "&f该物品今日剩余可出售额度为 &a%(amount)&8/%(limit) &f个。"
|
||||
|
||||
|
||||
no-economy:
|
||||
- "&f本服务器暂未启用出售功能。"
|
||||
|
||||
no-space:
|
||||
- "&f您仓库内没有足够的空间取出物品!"
|
||||
|
||||
no-depository:
|
||||
- "&f不存在该仓库,请检查仓库ID是否正确。"
|
||||
|
||||
no-item:
|
||||
- "&f仓库中不存在该物品,请检查物品ID是否正确。"
|
||||
|
||||
no-enough-item:
|
||||
- "&f仓库中不存在足够的物品。"
|
||||
|
||||
|
||||
wrong-number:
|
||||
- "&f数目输入错误,请输入正确的数字!"
|
Loading…
Reference in New Issue
Block a user