1
mirror of https://github.com/CarmJos/UltraDepository.git synced 2026-06-04 16:48:21 +08:00

[v1.2.0] 版本更新

- `[U]` 采用最新版本 EasyPlugin
- `[U]` 令安静模式的权限默认不生效。
This commit is contained in:
2022-01-06 14:22:42 +08:00
parent dd5793427a
commit 123ae0b039
6 changed files with 20 additions and 18 deletions
@@ -36,7 +36,7 @@ public class UltraDepository extends EasyPlugin {
}
@Override
public void load() {
protected void load() {
instance = this;
log("加载配置文件...");
@@ -46,7 +46,7 @@ public class UltraDepository extends EasyPlugin {
}
@Override
public boolean initialize() {
protected boolean initialize() {
log("初始化存储方式...");
StorageMethod storageMethod = PluginConfig.STORAGE_METHOD.get();
@@ -113,7 +113,7 @@ public class UltraDepository extends EasyPlugin {
}
@Override
public void shutdown() {
protected void shutdown() {
if (!isInitialized()) return;
log("保存现有用户数据...");
@@ -1,13 +1,14 @@
package cc.carm.plugin.ultradepository.configuration;
import cc.carm.lib.easyplugin.configuration.cast.ConfigStringCast;
import cc.carm.lib.easyplugin.configuration.impl.ConfigSound;
import cc.carm.lib.easyplugin.configuration.impl.ConfigStringCast;
import cc.carm.lib.easyplugin.configuration.message.ConfigMessage;
import cc.carm.lib.easyplugin.configuration.message.ConfigMessageList;
import cc.carm.lib.easyplugin.configuration.values.ConfigValue;
import cc.carm.plugin.ultradepository.manager.ConfigManager;
import cc.carm.plugin.ultradepository.storage.StorageMethod;
import org.bukkit.Material;
import org.bukkit.Sound;
public class PluginConfig {
@@ -44,7 +45,7 @@ public class PluginConfig {
public static class Sounds {
public static final ConfigSound COLLECT = new ConfigSound("sounds.collect");
public static final ConfigSound COLLECT = new ConfigSound("sounds.collect", Sound.ENTITY_VILLAGER_CELEBRATE);
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");
@@ -42,12 +42,12 @@ public class DepositoryGUI extends GUI {
private GUIItem createGUIItem(DepositoryItem item) {
DepositoryItemData itemData = userData.getItemData(item);
int remain = item.getLimit() - itemData.getSold();
int canSell = item.getLimit() - itemData.getSold();
ItemStackFactory factory = new ItemStackFactory(item.getDisplayItem());
List<String> additionalLore = PluginConfig.General.ADDITIONAL_LORE.get(player, new Object[]{
item.getName(), itemData.getAmount(), item.getPrice(),
itemData.getSold(), remain, item.getLimit()
itemData.getSold(), canSell, item.getLimit()
});
additionalLore.forEach(factory::addLore);
@@ -65,10 +65,12 @@ public class DepositoryGUI extends GUI {
}
if (type == ClickType.LEFT) {
if (remain >= 1) {
if (canSell >= 1) {
SellItemGUI.open(player, userData, itemData, depository, item);
} else {
PluginMessages.ITEM_SOLD_LIMIT.send(player, new Object[]{remain, item.getLimit()});
PluginConfig.Sounds.SELL_FAIL.play(player);
PluginMessages.ITEM_SOLD_LIMIT.send(player, new Object[]{canSell, item.getLimit()});
player.closeInventory();
}
} else if (type == ClickType.RIGHT) {
@@ -11,6 +11,7 @@ import cc.carm.plugin.ultradepository.configuration.depository.Depository;
import cc.carm.plugin.ultradepository.configuration.depository.DepositoryItem;
import cc.carm.plugin.ultradepository.data.DepositoryItemData;
import cc.carm.plugin.ultradepository.data.UserData;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import org.bukkit.inventory.ItemStack;
@@ -73,7 +74,7 @@ public class SellItemGUI extends GUI {
}
private GUIItem getAddItem(int amount) {
ItemStackFactory factory = new ItemStackFactory(Add.TYPE.get());
ItemStackFactory factory = new ItemStackFactory(Add.TYPE.getOptional().orElse(Material.STONE));
factory.setDurability(Add.DATA.get());
factory.setDisplayName(Add.NAME.get(player, new Object[]{
getItemName(), amount
@@ -93,7 +94,7 @@ public class SellItemGUI extends GUI {
}
private GUIItem getRemoveItem(int amount) {
ItemStackFactory factory = new ItemStackFactory(Remove.TYPE.get());
ItemStackFactory factory = new ItemStackFactory(Remove.TYPE.getOptional().orElse(Material.STONE));
factory.setDurability(Remove.DATA.get());
factory.setDisplayName(Remove.NAME.get(player, new Object[]{
getItemName(), amount
@@ -112,7 +113,7 @@ public class SellItemGUI extends GUI {
}
private GUIItem getConfirmItem() {
ItemStackFactory factory = new ItemStackFactory(Confirm.TYPE.get());
ItemStackFactory factory = new ItemStackFactory(Confirm.TYPE.getOptional().orElse(Material.STONE));
factory.setDurability(Confirm.DATA.get());
factory.setDisplayName(Confirm.NAME.get(player, new Object[]{
getItemName(), getCurrentAmount(), getTotalMoney()
@@ -131,7 +132,7 @@ public class SellItemGUI extends GUI {
}
private GUIItem getCancelItem() {
ItemStackFactory factory = new ItemStackFactory(Cancel.TYPE.get());
ItemStackFactory factory = new ItemStackFactory(Cancel.TYPE.getOptional().orElse(Material.STONE));
factory.setDurability(Cancel.DATA.get());
factory.setDisplayName(Cancel.NAME.get());
factory.setLore(Cancel.LORE.get());
+1
View File
@@ -32,6 +32,7 @@ permissions:
"UltraDepository.silent":
description: "超级仓库的安静模式权限,拥有该权限将不再接收到放入背包的提示。"
default: false
"UltraDepository.auto":
description: "超级仓库的自动收集权限"