Skip to content

Commit

Permalink
[v1.2.5] 版本更新
Browse files Browse the repository at this point in the history
- [A] 针对物品能否出售的状态提供额外的配置。
- [A] 添加ActionBar提示(如需关掉仅需将消息设为"")
- [A] 添加取回物品到背包的声音。
- [F] 修复SellGUI数量重调回0后(虽然不可能发生)物品仍然显示的问题
- [F] 修复SellGUI中可能存在的精度显示异常的问题。
  • Loading branch information
CarmJos committed Jan 14, 2022
1 parent 23e900c commit 379068b
Show file tree
Hide file tree
Showing 13 changed files with 392 additions and 153 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
本插件由 [墨豆Mordo](https://www.mordo.cn)[子墨Zimrs](https://www.zimrs.cn) 资助本人开发,经过授权后开源。

> 本插件已发布于 [MCBBS](https://www.mcbbs.net/forum.php?mod=viewthread&tid=1292631)[SpigotMC]()
## 功能介绍

本插件允许配置多个不同功能的仓库,玩家通过 击杀生物/挖掘方块/捡起收集 获得的原版物品可以自动被放入仓库中。
Expand Down Expand Up @@ -173,13 +174,9 @@
<summary>展开查看所有权限</summary>

```text
# UltraDepository.use
- 超级仓库的基本使用权限 (默认所有人都有)
# UltraDepository.silent
- 拥有该权限将不再接收到放入背包的提示。
# UltraDepository.Command.Sell
- 玩家使用Sell指令的权限
Expand All @@ -195,9 +192,12 @@
- 若玩家缺失该权限或“UltraDepository.auto”权限,则自动收集物品功能不会启用。
- 您可以自己使用GUI创建一个按钮,后通过给玩家添加/删除该权限决定玩家是否开启自动收集。
# UltraDepository.silent
- 拥有该权限将不再接收到放入背包的提示。
- 您可以自己使用GUI创建一个按钮,后通过给玩家添加/删除该权限决定玩家是否开启收集提示。
# UltraDepository.admin
- "超级仓库的管理权限"
```

</details>
Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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.3.4</easyplugin.version>
<easyplugin.version>1.3.5</easyplugin.version>
</properties>

<groupId>cc.carm.plugin</groupId>
<artifactId>ultradepository</artifactId>
<packaging>jar</packaging>
<version>1.2.4</version>
<version>1.2.5</version>

<name>UltraDepository</name>
<description>超级仓库插件,支持设定不同物品的存储仓库。</description>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ public static class Collect {
public static class Sounds {

public static final ConfigSound COLLECT = new ConfigSound("sounds.collect", Sound.ENTITY_VILLAGER_CELEBRATE);
public static final ConfigSound TAKEOUT = new ConfigSound("sounds.collect");
public static final ConfigSound SELL_SUCCESS = new ConfigSound("sounds.sell-success");
public static final ConfigSound SELL_FAIL = new ConfigSound("sounds.sell-fail");
public static final ConfigSound GUI_CLICK = new ConfigSound("sounds.gui-click");
Expand All @@ -56,20 +57,49 @@ public static class Sounds {
* 通用配置
*/
public static class General {

/**
* 针对每一件物品的额外介绍
* 将添加到背包界面内的物品上,避免重复配置
*/
public static final ConfigMessageList ADDITIONAL_LORE = new ConfigMessageList(
ConfigManager::getPluginConfig, "general.additional-lore", new String[]{},
new String[]{
"%(item_name)", "%(amount)", "%(price)", "%(sold)", "%(remain)", "%(limit)"
});
public static class AdditionalLore {

public static final ConfigMessageList AVAILABLE_FOR_SALE = new ConfigMessageList(
ConfigManager::getPluginConfig, "general.additional-lore.available-for-sale",
new String[]{},
new String[]{
"%(item_name)", "%(amount)", "%(price)", "%(sold)", "%(remain)", "%(limit)"
});

public static final ConfigMessageList NOT_FOR_SALE = new ConfigMessageList(
ConfigManager::getPluginConfig, "general.additional-lore.not-for-sale",
new String[]{}, new String[]{
"%(item_name)", "%(amount)"
});

}

/**
* 提示玩家点击行为的介绍
* 将添加到背包界面内的物品上,避免重复配置
*/
public static class ClickLore {
public static final ConfigMessageList AVAILABLE_FOR_SALE = new ConfigMessageList(
ConfigManager::getPluginConfig,
"general.click-lore.available-for-sale",
new String[]{}, new String[]{
"%(item_name)", "%(amount)", "%(price)"
});

public static final ConfigMessageList NOT_FOR_SALE = new ConfigMessageList(
ConfigManager::getPluginConfig, "general.click-lore.not-for-sale",
new String[]{},
new String[]{
"%(item_name)", "%(amount)"
});
}


public static final ConfigMessageList CLICK_LORE = new ConfigMessageList(
ConfigManager::getPluginConfig,
"general.click-lore",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,88 +1,98 @@
package cc.carm.plugin.ultradepository.configuration;


import cc.carm.lib.easyplugin.configuration.language.EasyMessage;
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 extends MessagesRoot {

@MessagesSection("help")
public static class Usages {

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数目输入错误,请输入正确的数字!"
);
@MessagesSection("help")
public static class Usages {

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_TAKEOUT = 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 EasyMessage ITEM_COLLECT_ACTIONBAR = new EasyMessage(
"&r%(item)&7x%(amount) &f-> &6%(depository)",
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数目输入错误,请输入正确的数字!"
);

}
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,8 @@ public static DepositoryItem readFrom(Depository depository, String typeID, Conf
return new DepositoryItem(
depository, material, data,
section.getInt("slot", 0),
section.getDouble("price", 0),
section.getInt("limit", 0),
section.getDouble("price", -1),
section.getInt("limit", -1),
section.getString("name", material.name()),
section.getStringList("lore")
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,12 @@ public boolean collectItem(Player player, ItemStack item) {
finalAmount, depository.getName()
});
PluginConfig.Sounds.COLLECT.play(player);

PluginMessages.ITEM_COLLECT_ACTIONBAR.sendBar(player, new Object[]{
depository.getItems().get(typeID).getName(),
finalAmount, depository.getName()
}); // Support action bar

}
UltraDepository.getInstance().debug("Item collected successfully.");
return true;
Expand Down
Loading

0 comments on commit 379068b

Please sign in to comment.