mirror of
https://github.com/CarmJos/UltraDepository.git
synced 2026-06-04 16:48:21 +08:00
Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 7138d20357 | |||
| 379068b440 | |||
| 23e900cf3f | |||
| 9b25c8574e | |||
| 23161a48bd | |||
| 7153661f86 | |||
| 19a26cb9b8 | |||
| c2eeddedcb | |||
| 8538aa2be8 | |||
| f001ac0010 | |||
| 988fe600ce |
@@ -2,11 +2,11 @@
|
||||
|
||||
## 详细示例
|
||||
|
||||
您可以 [点击这里](full-example.yml) 查看一份详细的示例。
|
||||
您可以 [点击这里](../../src/main/resources/depositories/.example-depository.yml) 查看一份详细的示例。
|
||||
|
||||
## 使用须知
|
||||
|
||||
预设配置基于 MineCraft 1.16 实现,更低版本可能无法使用。
|
||||
预设配置基于 MineCraft 1.16 实现,理论上支持更高版本使用。
|
||||
|
||||
## 如何使用?
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
# the `language` matrix defined below to confirm you have the correct set of
|
||||
# supported CodeQL languages.
|
||||
#
|
||||
name: "CodeQL"
|
||||
name: "CodeQL Analysis"
|
||||
|
||||
on:
|
||||
push:
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time
|
||||
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
|
||||
|
||||
name: Deploy
|
||||
name: Deploy & Upload
|
||||
|
||||
on:
|
||||
# 支持手动触发构建
|
||||
@@ -26,8 +26,65 @@ jobs:
|
||||
server-id: github
|
||||
server-username: MAVEN_USERNAME
|
||||
server-password: MAVEN_TOKEN
|
||||
- name: "Deploy"
|
||||
|
||||
- name: "Maven Deploy"
|
||||
run: mvn -B deploy --file pom.xml -DskipTests
|
||||
env:
|
||||
MAVEN_USERNAME: ${{ github.repository_owner }}
|
||||
MAVEN_TOKEN: ${{secrets.GITHUB_TOKEN}}
|
||||
|
||||
- name: "Release Asset Upload"
|
||||
id: upload-release-asset
|
||||
uses: shogo82148/actions-upload-release-asset@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
upload_url: ${{ github.event.release.upload_url }}
|
||||
asset_path: asset/*.jar
|
||||
asset_content_type: application/java-archive
|
||||
|
||||
- name: "Javadoc Deploy Staging"
|
||||
run: |
|
||||
rm -rf docs
|
||||
mkdir -vp docs
|
||||
cp -vrf target/apidocs/* docs/
|
||||
cp -vrf .documentation/JAVADOC-README.md docs/README.md
|
||||
|
||||
- name: "Generate the Javadoc sitemap"
|
||||
id: sitemap
|
||||
uses: cicirello/generate-sitemap@v1
|
||||
with:
|
||||
base-url-path: https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }}
|
||||
path-to-root: docs
|
||||
|
||||
- name: "Output Javadoc stats"
|
||||
run: |
|
||||
echo "sitemap-path = ${{ steps.sitemap.outputs.sitemap-path }}"
|
||||
echo "url-count = ${{ steps.sitemap.outputs.url-count }}"
|
||||
echo "excluded-count = ${{ steps.sitemap.outputs.excluded-count }}"
|
||||
|
||||
- name: "Configure Git"
|
||||
env:
|
||||
DEPLOY_PRI: ${{secrets.DEPLOY_PRI}}
|
||||
run: |
|
||||
sudo timedatectl set-timezone "Asia/Shanghai"
|
||||
mkdir -p ~/.ssh/
|
||||
echo "$DEPLOY_PRI" > ~/.ssh/id_rsa
|
||||
chmod 600 ~/.ssh/id_rsa
|
||||
ssh-keyscan github.com >> ~/.ssh/known_hosts
|
||||
git config --global user.name 'CarmJos'
|
||||
git config --global user.email 'carm@carm.cc'
|
||||
|
||||
- name: "Commit Javadocs"
|
||||
run: |
|
||||
cd docs
|
||||
git init
|
||||
git remote add origin git@github.com:${{ github.repository }}.git
|
||||
git checkout -b gh-pages
|
||||
git add -A
|
||||
git commit -m "API Document generated."
|
||||
|
||||
- name: "Push javadocs"
|
||||
run: |
|
||||
cd docs
|
||||
git push origin HEAD:gh-pages --force
|
||||
@@ -1,77 +0,0 @@
|
||||
# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time
|
||||
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
|
||||
|
||||
name: Javadoc
|
||||
|
||||
on:
|
||||
# 支持手动触发构建
|
||||
workflow_dispatch:
|
||||
release:
|
||||
# 创建release的时候触发
|
||||
types: [ published ]
|
||||
|
||||
jobs:
|
||||
api-website:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout the repo
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Set up the Java JDK
|
||||
uses: actions/setup-java@v2
|
||||
with:
|
||||
java-version: '11'
|
||||
distribution: 'adopt'
|
||||
cache: maven
|
||||
server-id: github
|
||||
server-username: MAVEN_USERNAME
|
||||
server-password: MAVEN_TOKEN
|
||||
|
||||
- name: Generate docs
|
||||
run: mvn clean package -DskipTests
|
||||
|
||||
- name: Copy to Location
|
||||
run: |
|
||||
rm -rf docs
|
||||
mkdir -vp docs
|
||||
cp -vrf target/apidocs/* docs/
|
||||
cp -vrf .documentation/JAVADOC-README.md docs/README.md
|
||||
|
||||
- name: Generate the sitemap
|
||||
id: sitemap
|
||||
uses: cicirello/generate-sitemap@v1
|
||||
with:
|
||||
base-url-path: https://carmjos.github.io/UltraDepository
|
||||
path-to-root: docs
|
||||
|
||||
- name: Output stats
|
||||
run: |
|
||||
echo "sitemap-path = ${{ steps.sitemap.outputs.sitemap-path }}"
|
||||
echo "url-count = ${{ steps.sitemap.outputs.url-count }}"
|
||||
echo "excluded-count = ${{ steps.sitemap.outputs.excluded-count }}"
|
||||
|
||||
- name: Configure Git
|
||||
env:
|
||||
DEPLOY_PRI: ${{secrets.DEPLOY_PRI}}
|
||||
run: |
|
||||
sudo timedatectl set-timezone "Asia/Shanghai"
|
||||
mkdir -p ~/.ssh/
|
||||
echo "$DEPLOY_PRI" > ~/.ssh/id_rsa
|
||||
chmod 600 ~/.ssh/id_rsa
|
||||
ssh-keyscan github.com >> ~/.ssh/known_hosts
|
||||
git config --global user.name 'CarmJos'
|
||||
git config --global user.email 'carm@carm.cc'
|
||||
|
||||
- name: Commit documentation changes
|
||||
run: |
|
||||
cd docs
|
||||
git init
|
||||
git remote add origin git@github.com:CarmJos/UltraDepository.git
|
||||
git checkout -b gh-pages
|
||||
git add -A
|
||||
git commit -m "API Document generated."
|
||||
- name: Push javadocs
|
||||
run: |
|
||||
cd docs
|
||||
git push origin HEAD:gh-pages --force
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time
|
||||
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
|
||||
|
||||
name: Build
|
||||
name: Project Build & Tests
|
||||
|
||||
on:
|
||||
# 支持手动触发构建
|
||||
|
||||
@@ -2,3 +2,4 @@
|
||||
/target/
|
||||
./*.iml
|
||||
*.iml
|
||||
asset/
|
||||
@@ -15,15 +15,17 @@
|
||||
[](https://opensource.org/licenses/GPL-3.0)
|
||||
[](https://github.com/CarmJos/UltraDepository/actions/workflows/maven.yml)
|
||||

|
||||

|
||||

|
||||

|
||||
|
||||
超级仓库插件,支持设定不同物品的存储仓库。
|
||||
|
||||
本插件基于Spigot实现,**理论上支持全版本**。
|
||||
本插件基于 Spigot(1.16.3) 实现,**理论上支持1.16后的全部版本**。
|
||||
|
||||
本插件由 [墨豆Mordo](https://www.mordo.cn)、[子墨Zimrs](https://www.zimrs.cn) 资助本人开发,经过授权后开源。
|
||||
|
||||
> 本插件已发布于 [MCBBS](https://www.mcbbs.net/forum.php?mod=viewthread&tid=1292631) 和 [SpigotMC]() 。
|
||||
|
||||
## 功能介绍
|
||||
|
||||
本插件允许配置多个不同功能的仓库,玩家通过 击杀生物/挖掘方块/捡起收集 获得的原版物品可以自动被放入仓库中。
|
||||
@@ -172,13 +174,9 @@
|
||||
<summary>展开查看所有权限</summary>
|
||||
|
||||
```text
|
||||
|
||||
# UltraDepository.use
|
||||
- 超级仓库的基本使用权限 (默认所有人都有)
|
||||
|
||||
# UltraDepository.silent
|
||||
- 拥有该权限将不再接收到放入背包的提示。
|
||||
|
||||
# UltraDepository.Command.Sell
|
||||
- 玩家使用Sell指令的权限
|
||||
|
||||
@@ -194,9 +192,12 @@
|
||||
- 若玩家缺失该权限或“UltraDepository.auto”权限,则自动收集物品功能不会启用。
|
||||
- 您可以自己使用GUI创建一个按钮,后通过给玩家添加/删除该权限决定玩家是否开启自动收集。
|
||||
|
||||
# UltraDepository.silent
|
||||
- 拥有该权限将不再接收到放入背包的提示。
|
||||
- 您可以自己使用GUI创建一个按钮,后通过给玩家添加/删除该权限决定玩家是否开启收集提示。
|
||||
|
||||
# UltraDepository.admin
|
||||
- "超级仓库的管理权限"
|
||||
|
||||
```
|
||||
|
||||
</details>
|
||||
@@ -207,19 +208,19 @@
|
||||
|
||||
详见源文件。
|
||||
|
||||
### 消息配置文件 ([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))
|
||||
### 仓库配置文件 ([depositories/<仓库ID>.yml](src/main/resources/depositories/.example-depository.yml))
|
||||
|
||||
所有仓库配置均为单独的配置文件,存放于 `插件配置目录/depositories` 下,便于管理。
|
||||
|
||||
文件名即仓库的ID,**强烈推荐使用纯英文**,部分符号可能会影响正常读取,请避免使用。
|
||||
文件名即仓库的ID,**强烈推荐使用纯英文**。以`.`开头的仓库配置不会被加载。部分符号可能会影响正常读取,请避免使用。
|
||||
|
||||
随本项目预设了几个常用的仓库类型,可以 [在这里](.examples/depositories) 找到您需要的仓库配置加以修改后使用。
|
||||
|
||||
您也可以 [点击这里](.examples/depositories/full-example.yml) 查看一份*详细的仓库配置示例*,以制作您自己的仓库。
|
||||
您也可以 [点击这里](src/main/resources/depositories/.example-depository.yml) 查看一份*详细的仓库配置示例*,以制作您自己的仓库。
|
||||
|
||||
## 开发
|
||||
|
||||
|
||||
@@ -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.1.3</easyplugin.version>
|
||||
<easyplugin.version>1.3.5</easyplugin.version>
|
||||
</properties>
|
||||
|
||||
<groupId>cc.carm.plugin</groupId>
|
||||
<artifactId>ultradepository</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<version>1.2.1</version>
|
||||
<version>1.2.6</version>
|
||||
|
||||
<name>UltraDepository</name>
|
||||
<description>超级仓库插件,支持设定不同物品的存储仓库。</description>
|
||||
@@ -85,52 +85,41 @@
|
||||
<repository>
|
||||
<id>github</id>
|
||||
<name>GitHub Packages</name>
|
||||
<url>https://maven.pkg.github.com/CarmJos/UltraDepository</url>
|
||||
<url>https://maven.pkg.github.com/CarmJos/*</url>
|
||||
</repository>
|
||||
|
||||
</repositories>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.bstats</groupId>
|
||||
<artifactId>bstats-bukkit</artifactId>
|
||||
<version>2.2.1</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>cc.carm.lib</groupId>
|
||||
<artifactId>easyplugin-main</artifactId>
|
||||
<version>${easyplugin.version}</version>
|
||||
<scope>compile</scope>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>cc.carm.lib</groupId>
|
||||
<artifactId>easyplugin-configuration</artifactId>
|
||||
<version>${easyplugin.version}</version>
|
||||
<scope>compile</scope>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>cc.carm.lib</groupId>
|
||||
<artifactId>easyplugin-gui</artifactId>
|
||||
<version>${easyplugin.version}</version>
|
||||
<scope>compile</scope>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>cc.carm.lib</groupId>
|
||||
<artifactId>easyplugin-database</artifactId>
|
||||
<version>${easyplugin.version}</version>
|
||||
<scope>compile</scope>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot-api</artifactId>
|
||||
<version>1.17-R0.1-SNAPSHOT</version>
|
||||
<version>1.16.3-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
@@ -141,6 +130,13 @@
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.bstats</groupId>
|
||||
<artifactId>bstats-bukkit</artifactId>
|
||||
<version>2.2.1</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.github.MilkBowl</groupId>
|
||||
<artifactId>VaultAPI</artifactId>
|
||||
@@ -157,6 +153,20 @@
|
||||
|
||||
</dependencies>
|
||||
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
|
||||
<dependency>
|
||||
<groupId>cc.carm.lib</groupId>
|
||||
<artifactId>easyplugin-bom</artifactId>
|
||||
<version>${easyplugin.version}</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
@@ -234,6 +244,8 @@
|
||||
</executions>
|
||||
|
||||
<configuration>
|
||||
<finalName>${project.name}-${project.version}</finalName>
|
||||
<outputDirectory>${project.basedir}/asset/</outputDirectory>
|
||||
<createDependencyReducedPom>false</createDependencyReducedPom>
|
||||
<relocations>
|
||||
<relocation>
|
||||
|
||||
@@ -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,6 +1,7 @@
|
||||
package cc.carm.plugin.ultradepository.configuration;
|
||||
|
||||
import cc.carm.lib.easyplugin.configuration.cast.ConfigStringCast;
|
||||
import cc.carm.lib.easyplugin.configuration.impl.ConfigItem;
|
||||
import cc.carm.lib.easyplugin.configuration.impl.ConfigSound;
|
||||
import cc.carm.lib.easyplugin.configuration.message.ConfigMessage;
|
||||
import cc.carm.lib.easyplugin.configuration.message.ConfigMessageList;
|
||||
@@ -46,6 +47,7 @@ public class PluginConfig {
|
||||
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");
|
||||
@@ -55,22 +57,53 @@ public class PluginConfig {
|
||||
* 通用配置
|
||||
*/
|
||||
public static class General {
|
||||
|
||||
/**
|
||||
* 针对每一件物品的额外介绍
|
||||
* 将添加到背包界面内的物品上,避免重复配置
|
||||
*/
|
||||
public static final ConfigMessageList ADDITIONAL_LORE = new ConfigMessageList(
|
||||
ConfigManager.getPluginConfig(), "general.additional-lore", new String[]{},
|
||||
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", new String[]{}, new String[]{
|
||||
ConfigManager::getPluginConfig,
|
||||
"general.click-lore",
|
||||
new String[]{}, new String[]{
|
||||
"%(item_name)", "%(amount)", "%(price)"
|
||||
});
|
||||
|
||||
@@ -81,7 +114,8 @@ public class PluginConfig {
|
||||
|
||||
|
||||
public static final ConfigMessage TITLE = new ConfigMessage(
|
||||
ConfigManager.getPluginConfig(), "general.sell-gui.title",
|
||||
ConfigManager::getPluginConfig,
|
||||
"general.sell-gui.title",
|
||||
"&a&l出售", new String[]{
|
||||
"%(item_name)", "%(backpack_name)"
|
||||
}
|
||||
@@ -89,116 +123,27 @@ public class PluginConfig {
|
||||
|
||||
public static class Items {
|
||||
|
||||
public static class Add {
|
||||
|
||||
public static final ConfigStringCast<Material> TYPE = new ConfigStringCast<>(
|
||||
"general.sell-gui.items.add.type",
|
||||
Material::matchMaterial, Material.STONE
|
||||
public static final ConfigItem ADD = new ConfigItem(
|
||||
"general.sell-gui.items.add",
|
||||
new String[]{"%(item_name)", "%(amount)"},
|
||||
ConfigItem.create(Material.GREEN_STAINED_GLASS_PANE, "&a添加物品 %(amount) 个")
|
||||
);
|
||||
|
||||
|
||||
public static final ConfigValue<Integer> DATA = new ConfigValue<>(
|
||||
"general.sell-gui.items.add.data", Integer.class, 0
|
||||
public static final ConfigItem REMOVE = new ConfigItem(
|
||||
"general.sell-gui.items.remove",
|
||||
new String[]{"%(item_name)", "%(amount)"},
|
||||
ConfigItem.create(Material.RED_STAINED_GLASS_PANE, "&c減少物品 %(amount) 个")
|
||||
);
|
||||
|
||||
|
||||
public static final ConfigMessage NAME = new ConfigMessage(
|
||||
ConfigManager.getPluginConfig(), "general.sell-gui.items.add.name",
|
||||
"&a添加物品 %(amount) 个", new String[]{
|
||||
"%(item_name)", "%(amount)"
|
||||
}
|
||||
public static final ConfigItem CONFIRM = new ConfigItem(
|
||||
"general.sell-gui.items.confirm",
|
||||
new String[]{"%(item_name)", "%(amount)", "%(money)"},
|
||||
ConfigItem.create(Material.EMERALD, "&2确认售出")
|
||||
);
|
||||
|
||||
|
||||
public static final ConfigMessageList LORE = new ConfigMessageList(
|
||||
ConfigManager.getPluginConfig(), "general.sell-gui.items.add.lore",
|
||||
new String[]{}, new String[]{
|
||||
"%(item_name)", "%(amount)"
|
||||
}
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
public static class Remove {
|
||||
|
||||
public static final ConfigStringCast<Material> TYPE = new ConfigStringCast<>(
|
||||
"general.sell-gui.items.remove.type",
|
||||
Material::matchMaterial, Material.STONE
|
||||
);
|
||||
|
||||
|
||||
public static final ConfigValue<Integer> DATA = new ConfigValue<>(
|
||||
"general.sell-gui.items.remove.data", Integer.class, 0
|
||||
);
|
||||
|
||||
|
||||
public static final ConfigMessage NAME = new ConfigMessage(
|
||||
ConfigManager.getPluginConfig(), "general.sell-gui.items.remove.name",
|
||||
"&c減少物品 %(amount) 个", new String[]{
|
||||
"%(item_name)", "%(amount)"
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
public static final ConfigMessageList LORE = new ConfigMessageList(
|
||||
ConfigManager.getPluginConfig(), "general.sell-gui.items.remove.lore",
|
||||
new String[]{}, new String[]{
|
||||
"%(item_name)", "%(amount)"
|
||||
}
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
public static class Confirm {
|
||||
|
||||
public static final ConfigStringCast<Material> TYPE = new ConfigStringCast<>(
|
||||
"general.sell-gui.items.confirm.type",
|
||||
Material::matchMaterial, Material.EMERALD
|
||||
);
|
||||
|
||||
|
||||
public static final ConfigValue<Integer> DATA = new ConfigValue<>(
|
||||
"general.sell-gui.items.confirm.data", Integer.class, 0
|
||||
);
|
||||
|
||||
|
||||
public static final ConfigMessage NAME = new ConfigMessage(
|
||||
ConfigManager.getPluginConfig(), "general.sell-gui.items.confirm.name",
|
||||
"&2确认售出", new String[]{
|
||||
"%(item_name)", "%(amount)", "%(money)"
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
public static final ConfigMessageList LORE = new ConfigMessageList(
|
||||
ConfigManager.getPluginConfig(), "general.sell-gui.items.confirm.lore",
|
||||
new String[]{}, new String[]{
|
||||
"%(item_name)", "%(amount)", "%(money)"
|
||||
}
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
public static class Cancel {
|
||||
|
||||
public static final ConfigStringCast<Material> TYPE = new ConfigStringCast<>(
|
||||
"general.sell-gui.items.cancel.type",
|
||||
Material::matchMaterial, Material.REDSTONE
|
||||
);
|
||||
|
||||
|
||||
public static final ConfigValue<Integer> DATA = new ConfigValue<>(
|
||||
"general.sell-gui.items.cancel.data", Integer.class, 0
|
||||
);
|
||||
|
||||
|
||||
public static final ConfigMessage NAME = new ConfigMessage(
|
||||
ConfigManager.getPluginConfig(), "general.sell-gui.items.cancel.name",
|
||||
"&4取消售出", null
|
||||
);
|
||||
|
||||
public static final ConfigMessageList LORE = new ConfigMessageList(
|
||||
ConfigManager.getPluginConfig(), "general.sell-gui.items.cancel.lore", new String[0], new String[0]
|
||||
public static final ConfigItem CANCEL = new ConfigItem(
|
||||
"general.sell-gui.items.cancel",
|
||||
ConfigItem.create(Material.REDSTONE, "&4取消售出")
|
||||
);
|
||||
|
||||
}
|
||||
@@ -206,7 +151,4 @@ public class PluginConfig {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,46 +1,98 @@
|
||||
package cc.carm.plugin.ultradepository.configuration;
|
||||
|
||||
|
||||
import cc.carm.lib.easyplugin.configuration.message.ConfigMessageList;
|
||||
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 {
|
||||
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_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数目输入错误,请输入正确的数字!"
|
||||
);
|
||||
|
||||
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
-2
@@ -116,8 +116,8 @@ public class DepositoryItem {
|
||||
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")
|
||||
);
|
||||
|
||||
@@ -117,7 +117,7 @@ public class UserData {
|
||||
|
||||
|
||||
public Date getDate() {
|
||||
return new Date(DateIntUtil.getDateMillis(getDateInt()));
|
||||
return DateIntUtil.getDate(getDateInt());
|
||||
}
|
||||
|
||||
public int getDateInt() {
|
||||
|
||||
@@ -2,22 +2,47 @@ 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;
|
||||
import cc.carm.plugin.ultradepository.util.JarUtil;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
public class ConfigManager {
|
||||
|
||||
private static FileConfig pluginConfiguration;
|
||||
private static FileConfig messageConfiguration;
|
||||
private static MessagesConfig messageConfiguration;
|
||||
|
||||
public static boolean initialize() {
|
||||
UltraDepository udPlugin = UltraDepository.getInstance();
|
||||
|
||||
|
||||
try {
|
||||
pluginConfiguration = new FileConfig(UltraDepository.getInstance(), "config.yml");
|
||||
messageConfiguration = new FileConfig(UltraDepository.getInstance(), "messages.yml");
|
||||
File configFile = new File(udPlugin.getDataFolder(), "config.yml");
|
||||
if (!configFile.exists()) {
|
||||
//没找到配置文件,可能是第一次加载此插件
|
||||
//把一些英文版的东西复制出来,方便英文用户使用。
|
||||
UltraDepository.getInstance().log(" 未找到配置文件,生成默认配置...");
|
||||
JarUtil.copyFolderFromJar(
|
||||
"i18n", udPlugin.getDataFolder(),
|
||||
JarUtil.CopyOption.COPY_IF_NOT_EXIST
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
pluginConfiguration = new FileConfig(udPlugin, "config.yml");
|
||||
messageConfiguration = new MessagesConfig(udPlugin, "messages.yml");
|
||||
|
||||
FileConfig.pluginConfiguration = () -> pluginConfiguration;
|
||||
FileConfig.messageConfiguration = () -> messageConfiguration;
|
||||
|
||||
MessagesInitializer.initialize(messageConfiguration, PluginMessages.class);
|
||||
|
||||
return true;
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -26,7 +51,7 @@ public class ConfigManager {
|
||||
return pluginConfiguration;
|
||||
}
|
||||
|
||||
public static FileConfig getMessageConfig() {
|
||||
public static MessagesConfig getMessageConfig() {
|
||||
return messageConfiguration;
|
||||
}
|
||||
|
||||
|
||||
@@ -45,6 +45,11 @@ public class DepositoryManager {
|
||||
File folder = new File(UltraDepository.getInstance().getDataFolder(), "depositories");
|
||||
if (!folder.exists()) {
|
||||
folder.mkdir();
|
||||
|
||||
UltraDepository.getInstance().saveResource(
|
||||
"depositories/.example-depository.yml", false
|
||||
);
|
||||
|
||||
} else if (folder.isDirectory()) {
|
||||
folder.delete();
|
||||
folder.mkdir();
|
||||
@@ -56,7 +61,8 @@ public class DepositoryManager {
|
||||
HashMap<@NotNull String, @NotNull Depository> data = new HashMap<>();
|
||||
for (File file : files) {
|
||||
String fileName = file.getName();
|
||||
if (!file.isFile() || !fileName.toLowerCase().endsWith(".yml")) continue;
|
||||
if (!file.isFile() || fileName.startsWith(".")) continue;
|
||||
if (!fileName.toLowerCase().endsWith(".yml")) continue;
|
||||
String identifier = fileName.substring(0, fileName.lastIndexOf("."));
|
||||
FileConfiguration configuration = YamlConfiguration.loadConfiguration(file);
|
||||
Depository depository = Depository.loadFrom(identifier, configuration);
|
||||
@@ -101,6 +107,7 @@ public class DepositoryManager {
|
||||
return getDepositories().get(depositoryID);
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public Set<Depository> getItemDepositories(ItemStack itemStack) {
|
||||
return getItemDepositories(itemStack.getType(), itemStack.getDurability());
|
||||
}
|
||||
@@ -124,6 +131,7 @@ public class DepositoryManager {
|
||||
else return material.name() + ":" + data;
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public @NotNull String getItemTypeID(ItemStack itemStack) {
|
||||
return getItemTypeID(itemStack.getType(), itemStack.getDurability());
|
||||
}
|
||||
@@ -166,11 +174,17 @@ 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()
|
||||
});
|
||||
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;
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ public interface DataStorage {
|
||||
* @return 正确ID数据
|
||||
* @since v1.1.6
|
||||
*/
|
||||
default String getFixedTypeID(String typeID) {
|
||||
static String getFixedTypeID(String typeID) {
|
||||
String trueID = typeID;
|
||||
if (typeID.contains(":")) {
|
||||
try {
|
||||
|
||||
@@ -30,8 +30,8 @@ public class JSONStorage implements DataStorage {
|
||||
|
||||
private File dataContainer;
|
||||
|
||||
public static final Gson GSON = new Gson();
|
||||
public static final JsonParser PARSER = new JsonParser();
|
||||
protected static final Gson GSON = new Gson();
|
||||
protected static final JsonParser PARSER = new JsonParser();
|
||||
|
||||
@Override
|
||||
public boolean initialize() {
|
||||
@@ -66,18 +66,9 @@ public class JSONStorage implements DataStorage {
|
||||
JsonObject dataObject = dataElement.getAsJsonObject();
|
||||
|
||||
int dateInt = dataObject.get("date").getAsInt();
|
||||
JsonObject repositoriesObject = dataObject.getAsJsonObject("depositories");
|
||||
|
||||
UserData userData = new UserData(uuid, new HashMap<>(), dateInt);
|
||||
|
||||
for (Map.Entry<String, JsonElement> entry : repositoriesObject.entrySet()) {
|
||||
Depository depository = UltraDepository.getDepositoryManager().getDepository(entry.getKey());
|
||||
if (depository == null) continue;
|
||||
|
||||
DepositoryData contentsData = parseContentsData(depository, userData, entry.getValue());
|
||||
if (contentsData != null) userData.setDepository(contentsData);
|
||||
|
||||
}
|
||||
loadDepositoriesInto(userData, dataObject.getAsJsonObject("depositories"));
|
||||
|
||||
return userData;
|
||||
}
|
||||
@@ -86,7 +77,7 @@ public class JSONStorage implements DataStorage {
|
||||
public void saveUserData(@NotNull UserData data) throws Exception {
|
||||
JsonObject dataObject = new JsonObject();
|
||||
dataObject.addProperty("date", data.getDateInt());
|
||||
dataObject.add("depositories", GSON.toJsonTree(data.serializeToMap()));
|
||||
dataObject.add("depositories", saveDepositoriesToJson(data));
|
||||
|
||||
FileWriter writer = new FileWriter(new File(getDataContainer(), data.getUserUUID() + ".json"));
|
||||
writer.write(GSON.toJson(dataObject));
|
||||
@@ -94,18 +85,36 @@ public class JSONStorage implements DataStorage {
|
||||
writer.close();
|
||||
}
|
||||
|
||||
protected DepositoryData parseContentsData(@NotNull Depository source,
|
||||
@NotNull UserData owner,
|
||||
@NotNull JsonElement contentsElement) {
|
||||
return contentsElement.isJsonObject() ? parseContentsData(source, owner, contentsElement.getAsJsonObject()) : null;
|
||||
public static JsonElement saveDepositoriesToJson(UserData data) {
|
||||
return GSON.toJsonTree(data.serializeToMap());
|
||||
}
|
||||
|
||||
protected DepositoryData parseContentsData(@NotNull Depository source,
|
||||
public static String serializeDepositories(UserData data) {
|
||||
return GSON.toJson(saveDepositoriesToJson(data));
|
||||
}
|
||||
|
||||
public static void loadDepositoriesInto(UserData data, JsonElement depositoriesElement) {
|
||||
if (depositoriesElement == null || !depositoriesElement.isJsonObject()) return;
|
||||
|
||||
for (Map.Entry<String, JsonElement> entry : depositoriesElement.getAsJsonObject().entrySet()) {
|
||||
Depository depository = UltraDepository.getDepositoryManager().getDepository(entry.getKey());
|
||||
if (depository == null) continue;
|
||||
|
||||
DepositoryData contentsData = parseContentsData(depository, data, entry.getValue());
|
||||
if (contentsData != null) data.setDepository(contentsData);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public static DepositoryData parseContentsData(@NotNull Depository source,
|
||||
@NotNull UserData owner,
|
||||
@NotNull JsonObject contentsObject) {
|
||||
@NotNull JsonElement contentsElement) {
|
||||
if (!contentsElement.isJsonObject()) return null;
|
||||
JsonObject contentsObject = contentsElement.getAsJsonObject();
|
||||
|
||||
DepositoryData data = DepositoryData.emptyContents(source, owner);
|
||||
for (Map.Entry<String, JsonElement> entry : contentsObject.entrySet()) {
|
||||
DepositoryItem item = source.getItems().get(getFixedTypeID(entry.getKey()));
|
||||
DepositoryItem item = source.getItems().get(DataStorage.getFixedTypeID(entry.getKey()));
|
||||
if (item == null) continue;
|
||||
|
||||
DepositoryItemData itemData = parseItemData(item, data, entry.getValue());
|
||||
@@ -115,15 +124,13 @@ public class JSONStorage implements DataStorage {
|
||||
return data;
|
||||
}
|
||||
|
||||
protected DepositoryItemData parseItemData(@NotNull DepositoryItem source,
|
||||
|
||||
public static DepositoryItemData parseItemData(@NotNull DepositoryItem source,
|
||||
@NotNull DepositoryData owner,
|
||||
@NotNull JsonElement itemElement) {
|
||||
return itemElement.isJsonObject() ? parseItemData(source, owner, itemElement.getAsJsonObject()) : null;
|
||||
}
|
||||
if (!itemElement.isJsonObject()) return null;
|
||||
JsonObject itemObject = itemElement.getAsJsonObject();
|
||||
|
||||
protected DepositoryItemData parseItemData(@NotNull DepositoryItem source,
|
||||
@NotNull DepositoryData owner,
|
||||
@NotNull JsonObject itemObject) {
|
||||
int amount = itemObject.has("amount") ? itemObject.get("amount").getAsInt() : 0;
|
||||
int sold = itemObject.has("sold") ? itemObject.get("sold").getAsInt() : 0;
|
||||
if (amount == 0 && sold == 0) return null;
|
||||
|
||||
@@ -5,15 +5,9 @@ import cc.carm.lib.easyplugin.database.DatabaseTable;
|
||||
import cc.carm.lib.easyplugin.database.EasySQL;
|
||||
import cc.carm.lib.easyplugin.database.api.SQLManager;
|
||||
import cc.carm.lib.easyplugin.database.api.action.query.PreparedQueryAction;
|
||||
import cc.carm.lib.easyplugin.database.api.action.query.SQLQuery;
|
||||
import cc.carm.plugin.ultradepository.UltraDepository;
|
||||
import cc.carm.plugin.ultradepository.configuration.depository.Depository;
|
||||
import cc.carm.plugin.ultradepository.data.DepositoryData;
|
||||
import cc.carm.plugin.ultradepository.data.UserData;
|
||||
import cc.carm.plugin.ultradepository.util.DateIntUtil;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonParser;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -21,39 +15,37 @@ import java.sql.Date;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
public class MySQLStorage extends JSONStorage {
|
||||
|
||||
private static final ConfigValue<String> DRIVER_NAME = new ConfigValue<>(
|
||||
"storage.mysql.driver", String.class, "com.mysql.jdbc.Driver"
|
||||
"storage.mysql.driver", String.class,
|
||||
"com.mysql.jdbc.Driver"
|
||||
);
|
||||
|
||||
private static final ConfigValue<String> URL = new ConfigValue<>(
|
||||
"storage.mysql.url", String.class, "jdbc:mysql://127.0.0.1:3306/minecraft"
|
||||
"storage.mysql.url", String.class,
|
||||
"jdbc:mysql://127.0.0.1:3306/minecraft"
|
||||
);
|
||||
|
||||
private static final ConfigValue<String> USERNAME = new ConfigValue<>(
|
||||
"storage.mysql.username", String.class, "username"
|
||||
"storage.mysql.username", String.class,
|
||||
"root"
|
||||
);
|
||||
|
||||
private static final ConfigValue<String> PASSWORD = new ConfigValue<>(
|
||||
"storage.mysql.password", String.class, "password"
|
||||
"storage.mysql.password", String.class,
|
||||
"password"
|
||||
);
|
||||
|
||||
private static final DatabaseTable USER_TABLE = new DatabaseTable(
|
||||
"ub_data",
|
||||
new String[]{
|
||||
"`uuid` VARCHAR(36) NOT NULL PRIMARY KEY", // 用户的UUID
|
||||
"`data` MEDIUMTEXT NOT NULL",// 背包内具体物品
|
||||
"`day` DATE NOT NULL", // 记录卖出数量的所在天
|
||||
});
|
||||
|
||||
|
||||
public static final Gson GSON = new Gson();
|
||||
public static final JsonParser PARSER = new JsonParser();
|
||||
private static final ConfigValue<String> TABLE_NAME = new ConfigValue<>(
|
||||
"storage.mysql.table", String.class,
|
||||
"ud_data"
|
||||
);
|
||||
|
||||
SQLManager sqlManager;
|
||||
DatabaseTable userDataTable;
|
||||
|
||||
@Override
|
||||
public boolean initialize() {
|
||||
@@ -71,7 +63,17 @@ public class MySQLStorage extends JSONStorage {
|
||||
|
||||
try {
|
||||
UltraDepository.getInstance().log(" 创建插件所需表...");
|
||||
USER_TABLE.createTable(sqlManager);
|
||||
|
||||
this.userDataTable = new DatabaseTable(
|
||||
TABLE_NAME.getOptional().orElse("ud_data"),
|
||||
new String[]{
|
||||
"`uuid` VARCHAR(36) NOT NULL PRIMARY KEY", // 用户的UUID
|
||||
"`data` MEDIUMTEXT NOT NULL",// 背包内具体物品
|
||||
"`day` DATE NOT NULL", // 记录卖出数量的所在天
|
||||
});
|
||||
|
||||
getUserDataTable().createTable(sqlManager);
|
||||
|
||||
} catch (SQLException exception) {
|
||||
UltraDepository.getInstance().error("无法创建插件所需的表,请检查数据库权限。");
|
||||
UltraDepository.getInstance().error("Could not create necessary tables, please check the database privileges.");
|
||||
@@ -90,38 +92,25 @@ public class MySQLStorage extends JSONStorage {
|
||||
|
||||
@Override
|
||||
public @Nullable UserData loadData(@NotNull UUID uuid) throws Exception {
|
||||
try (SQLQuery query = createAction(uuid).execute()) {
|
||||
return createAction(uuid).executeFunction((query) -> {
|
||||
ResultSet resultSet = query.getResultSet();
|
||||
|
||||
if (resultSet == null || !resultSet.next()) return null;
|
||||
|
||||
String dataJSON = resultSet.getString("data");
|
||||
Date date = resultSet.getDate("day");
|
||||
UserData data = new UserData(uuid, new HashMap<>(), DateIntUtil.getDateInt(date));
|
||||
|
||||
JsonElement dataElement = PARSER.parse(dataJSON);
|
||||
if (dataElement.isJsonObject()) {
|
||||
for (Map.Entry<String, JsonElement> entry : dataElement.getAsJsonObject().entrySet()) {
|
||||
Depository depository = UltraDepository.getDepositoryManager().getDepository(entry.getKey());
|
||||
if (depository == null) continue;
|
||||
loadDepositoriesInto(data, PARSER.parse(resultSet.getString("data")));
|
||||
|
||||
DepositoryData contentsData = parseContentsData(depository, data, entry.getValue());
|
||||
if (contentsData != null) data.setDepository(contentsData);
|
||||
|
||||
}
|
||||
}
|
||||
return data;
|
||||
|
||||
} catch (Exception exception) {
|
||||
throw new Exception(exception);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveUserData(@NotNull UserData data) throws Exception {
|
||||
getSQLManager().createReplace(USER_TABLE.getTableName())
|
||||
getSQLManager().createReplace(getUserDataTable().getTableName())
|
||||
.setColumnNames("uuid", "data", "day")
|
||||
.setParams(data.getUserUUID(), GSON.toJson(data.serializeToMap()), data.getDate())
|
||||
.setParams(data.getUserUUID(), serializeDepositories(data), data.getDate())
|
||||
.execute();
|
||||
}
|
||||
|
||||
@@ -129,8 +118,12 @@ public class MySQLStorage extends JSONStorage {
|
||||
return sqlManager;
|
||||
}
|
||||
|
||||
public DatabaseTable getUserDataTable() {
|
||||
return userDataTable;
|
||||
}
|
||||
|
||||
private PreparedQueryAction createAction(UUID uuid) {
|
||||
return USER_TABLE.createQuery(sqlManager)
|
||||
return getUserDataTable().createQuery(getSQLManager())
|
||||
.addCondition("uuid", uuid.toString())
|
||||
.setLimit(1).build();
|
||||
}
|
||||
|
||||
@@ -73,7 +73,7 @@ public class YAMLStorage implements DataStorage {
|
||||
|
||||
for (String itemTypeID : depositorySection.getKeys(false)) {
|
||||
|
||||
DepositoryItem item = depository.getItems().get(getFixedTypeID(itemTypeID));
|
||||
DepositoryItem item = depository.getItems().get(DataStorage.getFixedTypeID(itemTypeID));
|
||||
if (item == null) continue;
|
||||
|
||||
ConfigurationSection itemSection = depositorySection.getConfigurationSection(itemTypeID);
|
||||
|
||||
@@ -13,8 +13,10 @@ 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;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.IntStream;
|
||||
|
||||
@@ -24,7 +26,7 @@ public class DepositoryGUI extends GUI {
|
||||
UserData userData;
|
||||
Depository depository;
|
||||
|
||||
public DepositoryGUI(Player player, Depository depository) {
|
||||
private DepositoryGUI(Player player, Depository depository) {
|
||||
super(depository.getGUIConfiguration().getGUIType(), depository.getGUIConfiguration().getTitle());
|
||||
|
||||
this.player = player;
|
||||
@@ -35,53 +37,53 @@ public class DepositoryGUI extends GUI {
|
||||
}
|
||||
|
||||
public void setupItems() {
|
||||
loadConfigItems();
|
||||
loadDepositoryItems();
|
||||
}
|
||||
|
||||
public void loadConfigItems() {
|
||||
depository.getGUIConfiguration().setupItems(player, this);
|
||||
}
|
||||
|
||||
public void loadDepositoryItems() {
|
||||
depository.getItems().values().forEach(depositoryItem -> setItem(depositoryItem.getSlot(), createGUIItem(depositoryItem)));
|
||||
}
|
||||
|
||||
|
||||
private GUIItem createGUIItem(DepositoryItem item) {
|
||||
DepositoryItemData itemData = userData.getItemData(item);
|
||||
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(), canSell, item.getLimit()
|
||||
});
|
||||
|
||||
additionalLore.forEach(factory::addLore);
|
||||
List<String> clickLore = PluginConfig.General.CLICK_LORE.get(player, new Object[]{
|
||||
item.getName(), itemData.getAmount(), item.getPrice()
|
||||
});
|
||||
clickLore.forEach(factory::addLore);
|
||||
|
||||
return new GUIItem(factory.toItemStack()) {
|
||||
return new GUIItem(getItemIcon(player, userData, item)) {
|
||||
@Override
|
||||
public void onClick(ClickType type) {
|
||||
DepositoryItemData itemData = userData.getItemData(item);
|
||||
if (itemData.getAmount() < 1) {
|
||||
PluginConfig.Sounds.SELL_FAIL.play(player);
|
||||
PluginMessages.NO_ENOUGH_ITEM.send(player);
|
||||
return;
|
||||
}
|
||||
|
||||
if (type == ClickType.LEFT) {
|
||||
if (canSell >= 1) {
|
||||
if (canSell(item) && type == ClickType.LEFT) {
|
||||
int sellableAmount = item.getLimit() - itemData.getSold();
|
||||
if (sellableAmount >= 1) {
|
||||
SellItemGUI.open(player, userData, itemData, depository, item);
|
||||
} else {
|
||||
PluginConfig.Sounds.SELL_FAIL.play(player);
|
||||
PluginMessages.ITEM_SOLD_LIMIT.send(player, new Object[]{canSell, item.getLimit()});
|
||||
PluginMessages.ITEM_SOLD_LIMIT.send(player, new Object[]{sellableAmount, item.getLimit()});
|
||||
player.closeInventory();
|
||||
}
|
||||
} else if (type == ClickType.RIGHT) {
|
||||
|
||||
if (hasEmptySlot(player)) {
|
||||
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[]{
|
||||
item.getName(), pickupAmount
|
||||
int takeoutAmount = Math.min(itemData.getAmount(), item.getMaterial().getMaxStackSize());
|
||||
userData.removeItemAmount(
|
||||
item.getDepository().getIdentifier(), item.getTypeID(), takeoutAmount
|
||||
);
|
||||
player.getInventory().addItem(item.getRawItem(takeoutAmount));
|
||||
PluginMessages.ITEM_TAKEOUT.send(player, new Object[]{
|
||||
item.getName(), takeoutAmount
|
||||
});
|
||||
setupItems(); //刷新GUI
|
||||
PluginConfig.Sounds.TAKEOUT.play(player);
|
||||
|
||||
setDisplay(getItemIcon(player, userData, item)); // 刷新物品显示
|
||||
loadConfigItems(); // 更新配置中的其他物品
|
||||
updateView();
|
||||
} else {
|
||||
PluginMessages.NO_SPACE.send(player);
|
||||
@@ -92,12 +94,51 @@ public class DepositoryGUI extends GUI {
|
||||
};
|
||||
}
|
||||
|
||||
private boolean hasEmptySlot(Player player) {
|
||||
public static boolean hasEmptySlot(Player player) {
|
||||
return IntStream.range(0, 36)
|
||||
.mapToObj(i -> player.getInventory().getItem(i))
|
||||
.anyMatch(i -> i == null || i.getType() == Material.AIR);
|
||||
}
|
||||
|
||||
public static ItemStack getItemIcon(@NotNull Player player,
|
||||
@NotNull UserData userData,
|
||||
@NotNull DepositoryItem item) {
|
||||
DepositoryItemData itemData = userData.getItemData(item);
|
||||
ItemStackFactory factory = new ItemStackFactory(item.getDisplayItem());
|
||||
getExtraLore(player, itemData).forEach(factory::addLore);
|
||||
return factory.toItemStack();
|
||||
}
|
||||
|
||||
public static List<String> getExtraLore(@NotNull Player player,
|
||||
@NotNull DepositoryItemData itemData) {
|
||||
DepositoryItem item = itemData.getSource();
|
||||
int canSell = item.getLimit() - itemData.getSold();
|
||||
|
||||
List<String> lore = new ArrayList<>();
|
||||
if (canSell(item)) {
|
||||
lore.addAll(PluginConfig.General.AdditionalLore.AVAILABLE_FOR_SALE.get(player, new Object[]{
|
||||
item.getName(), itemData.getAmount(), item.getPrice(),
|
||||
itemData.getSold(), canSell, item.getLimit()
|
||||
}));
|
||||
lore.addAll(PluginConfig.General.ClickLore.AVAILABLE_FOR_SALE.get(player, new Object[]{
|
||||
item.getName(), itemData.getAmount(), item.getPrice()
|
||||
}));
|
||||
} else {
|
||||
lore.addAll(PluginConfig.General.AdditionalLore.NOT_FOR_SALE.get(player, new Object[]{
|
||||
item.getName(), itemData.getAmount()
|
||||
}));
|
||||
lore.addAll(PluginConfig.General.ClickLore.NOT_FOR_SALE.get(player, new Object[]{
|
||||
item.getName(), itemData.getAmount()
|
||||
}));
|
||||
}
|
||||
return lore;
|
||||
}
|
||||
|
||||
public static boolean canSell(DepositoryItem item) {
|
||||
return UltraDepository.getEconomyManager().isInitialized()
|
||||
&& item.getLimit() > 0 && item.getPrice() > 0;
|
||||
}
|
||||
|
||||
public static void open(@NotNull Player player, @NotNull Depository depository) {
|
||||
player.closeInventory();
|
||||
DepositoryGUI gui = new DepositoryGUI(player, depository);
|
||||
|
||||
@@ -11,11 +11,12 @@ 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;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.List;
|
||||
|
||||
import static cc.carm.plugin.ultradepository.configuration.PluginConfig.General.SellGUI.Items.*;
|
||||
@@ -52,8 +53,9 @@ public class SellItemGUI extends GUI {
|
||||
private void load(int amount) {
|
||||
this.currentAmount = Math.max(1, amount); // 不可小于1
|
||||
ItemStackFactory factory = new ItemStackFactory(this.itemDisplay);
|
||||
List<String> additionalLore = PluginConfig.General.ADDITIONAL_LORE.get(player, new Object[]{
|
||||
getItemName(), getReUltraDepositoryAmount(), getItemPrice(),
|
||||
List<String> additionalLore = PluginConfig.General.AdditionalLore.AVAILABLE_FOR_SALE
|
||||
.get(player, new Object[]{
|
||||
getItemName(), getDepositoryAmount(), getItemPrice(),
|
||||
getSoldAmount(), (getSellLimit() - getSoldAmount()), getSellLimit()
|
||||
});
|
||||
additionalLore.forEach(factory::addLore);
|
||||
@@ -68,22 +70,15 @@ public class SellItemGUI extends GUI {
|
||||
setItem(16, getAddableAmount() >= 100 ? getAddItem(100) : null);
|
||||
setItem(17, getAddableAmount() >= 1000 ? getAddItem(1000) : null);
|
||||
|
||||
if (getCurrentAmount() >= 1) setItem(getConfirmItem(), 27, 28, 29, 30);
|
||||
setItem(getCurrentAmount() >= 1 ? getConfirmItem() : null, 27, 28, 29, 30);
|
||||
setItem(getCancelItem(), 32, 33, 34, 35);
|
||||
|
||||
}
|
||||
|
||||
private GUIItem getAddItem(int amount) {
|
||||
ItemStackFactory factory = new ItemStackFactory(Add.TYPE.getOptional().orElse(Material.STONE));
|
||||
factory.setDurability(Add.DATA.get());
|
||||
factory.setDisplayName(Add.NAME.get(player, new Object[]{
|
||||
return new GUIItem(ADD.getItem(player, new Object[]{
|
||||
getItemName(), amount
|
||||
}));
|
||||
factory.setLore(Add.LORE.get(player, new Object[]{
|
||||
getItemName(), amount
|
||||
}));
|
||||
|
||||
return new GUIItem(factory.toItemStack()) {
|
||||
})) {
|
||||
@Override
|
||||
public void onClick(ClickType type) {
|
||||
PluginConfig.Sounds.GUI_CLICK.play(player);
|
||||
@@ -94,15 +89,9 @@ public class SellItemGUI extends GUI {
|
||||
}
|
||||
|
||||
private GUIItem getRemoveItem(int amount) {
|
||||
ItemStackFactory factory = new ItemStackFactory(Remove.TYPE.getOptional().orElse(Material.STONE));
|
||||
factory.setDurability(Remove.DATA.get());
|
||||
factory.setDisplayName(Remove.NAME.get(player, new Object[]{
|
||||
return new GUIItem(REMOVE.getItem(player, new Object[]{
|
||||
getItemName(), amount
|
||||
}));
|
||||
factory.setLore(Remove.LORE.get(player, new Object[]{
|
||||
getItemName(), amount
|
||||
}));
|
||||
return new GUIItem(factory.toItemStack()) {
|
||||
})) {
|
||||
@Override
|
||||
public void onClick(ClickType type) {
|
||||
PluginConfig.Sounds.GUI_CLICK.play(player);
|
||||
@@ -113,18 +102,12 @@ public class SellItemGUI extends GUI {
|
||||
}
|
||||
|
||||
private GUIItem getConfirmItem() {
|
||||
ItemStackFactory factory = new ItemStackFactory(Confirm.TYPE.getOptional().orElse(Material.STONE));
|
||||
factory.setDurability(Confirm.DATA.get());
|
||||
factory.setDisplayName(Confirm.NAME.get(player, new Object[]{
|
||||
return new GUIItem(CONFIRM.getItem(player, new Object[]{
|
||||
getItemName(), getCurrentAmount(), getTotalMoney()
|
||||
}));
|
||||
factory.setLore(Confirm.LORE.get(player, new Object[]{
|
||||
getItemName(), getCurrentAmount(), getTotalMoney()
|
||||
}));
|
||||
return new GUIItem(factory.toItemStack()) {
|
||||
})) {
|
||||
@Override
|
||||
public void onClick(ClickType type) {
|
||||
int amount = Math.min(getCurrentAmount(), Math.min(getReUltraDepositoryAmount(), getSellLimit() - getSoldAmount()));
|
||||
int amount = Math.min(getCurrentAmount(), Math.min(getDepositoryAmount(), getSellLimit() - getSoldAmount()));
|
||||
if (amount > 0) UltraDepository.getEconomyManager().sellItem(player, userData, item, amount);
|
||||
player.closeInventory();
|
||||
}
|
||||
@@ -132,11 +115,7 @@ public class SellItemGUI extends GUI {
|
||||
}
|
||||
|
||||
private GUIItem getCancelItem() {
|
||||
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());
|
||||
return new GUIItem(factory.toItemStack()) {
|
||||
return new GUIItem(CANCEL.getItem(player)) {
|
||||
@Override
|
||||
public void onClick(ClickType type) {
|
||||
PluginConfig.Sounds.SELL_FAIL.play(player);
|
||||
@@ -162,10 +141,11 @@ public class SellItemGUI extends GUI {
|
||||
}
|
||||
|
||||
private double getTotalMoney() {
|
||||
return getCurrentAmount() * getItemPrice();
|
||||
BigDecimal money = BigDecimal.valueOf(getCurrentAmount() * getItemPrice()).setScale(2, RoundingMode.DOWN);
|
||||
return money.doubleValue();
|
||||
}
|
||||
|
||||
private int getReUltraDepositoryAmount() {
|
||||
private int getDepositoryAmount() {
|
||||
return userData.getItemData(this.item).getAmount();
|
||||
}
|
||||
|
||||
@@ -174,7 +154,7 @@ public class SellItemGUI extends GUI {
|
||||
}
|
||||
|
||||
private int getAddableAmount() {
|
||||
return Math.min(getReUltraDepositoryAmount(), getSellLimit() - getSoldAmount()) - getCurrentAmount();
|
||||
return Math.min(getDepositoryAmount(), getSellLimit() - getSoldAmount()) - getCurrentAmount();
|
||||
}
|
||||
|
||||
public static void open(Player player, UserData userData, DepositoryItemData itemData,
|
||||
|
||||
@@ -22,10 +22,15 @@ public class DateIntUtil {
|
||||
}
|
||||
|
||||
public static long getDateMillis(int dateInt) {
|
||||
return getDate(dateInt).getTime();
|
||||
}
|
||||
|
||||
public static Date getDate(int dateInt) {
|
||||
try {
|
||||
return getFormat().parse(Integer.toString(dateInt)).getTime();
|
||||
} catch (ParseException e) {
|
||||
return System.currentTimeMillis();
|
||||
long millis = getFormat().parse(Integer.toString(dateInt)).getTime();
|
||||
return new java.sql.Date(millis);
|
||||
} catch (ParseException | NumberFormatException e) {
|
||||
return new Date(System.currentTimeMillis());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,90 @@
|
||||
package cc.carm.plugin.ultradepository.util;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipInputStream;
|
||||
|
||||
@SuppressWarnings("ResultOfMethodCallIgnored")
|
||||
public class JarUtil {
|
||||
public static final char JAR_SEPARATOR = '/';
|
||||
|
||||
public static void copyFolderFromJar(String folderName, File destFolder, CopyOption option)
|
||||
throws IOException {
|
||||
copyFolderFromJar(folderName, destFolder, option, null);
|
||||
}
|
||||
|
||||
public static void copyFolderFromJar(String folderName, File destFolder,
|
||||
CopyOption option, PathTrimmer trimmer) throws IOException {
|
||||
if (!destFolder.exists())
|
||||
destFolder.mkdirs();
|
||||
|
||||
byte[] buffer = new byte[1024];
|
||||
|
||||
File fullPath;
|
||||
String path = JarUtil.class.getProtectionDomain().getCodeSource().getLocation().getPath();
|
||||
if (trimmer != null)
|
||||
path = trimmer.trim(path);
|
||||
try {
|
||||
if (!path.startsWith("file"))
|
||||
path = "file://" + path;
|
||||
|
||||
fullPath = new File(new URI(path));
|
||||
} catch (URISyntaxException e) {
|
||||
e.printStackTrace();
|
||||
return;
|
||||
}
|
||||
|
||||
ZipInputStream zis = new ZipInputStream(new FileInputStream(fullPath));
|
||||
|
||||
ZipEntry entry;
|
||||
while ((entry = zis.getNextEntry()) != null) {
|
||||
if (!entry.getName().startsWith(folderName + JAR_SEPARATOR))
|
||||
continue;
|
||||
|
||||
String fileName = entry.getName();
|
||||
|
||||
if (fileName.charAt(fileName.length() - 1) == JAR_SEPARATOR) {
|
||||
File file = new File(destFolder + File.separator + fileName);
|
||||
if (file.isFile()) {
|
||||
file.delete();
|
||||
}
|
||||
file.mkdirs();
|
||||
continue;
|
||||
}
|
||||
|
||||
File file = new File(destFolder + File.separator + fileName);
|
||||
if (option == CopyOption.COPY_IF_NOT_EXIST && file.exists())
|
||||
continue;
|
||||
|
||||
if (!file.getParentFile().exists())
|
||||
file.getParentFile().mkdirs();
|
||||
|
||||
if (!file.exists())
|
||||
file.createNewFile();
|
||||
FileOutputStream fos = new FileOutputStream(file);
|
||||
|
||||
int len;
|
||||
while ((len = zis.read(buffer)) > 0) {
|
||||
fos.write(buffer, 0, len);
|
||||
}
|
||||
fos.close();
|
||||
}
|
||||
|
||||
zis.closeEntry();
|
||||
zis.close();
|
||||
}
|
||||
|
||||
public enum CopyOption {
|
||||
COPY_IF_NOT_EXIST, REPLACE_IF_EXIST
|
||||
}
|
||||
|
||||
@FunctionalInterface
|
||||
public interface PathTrimmer {
|
||||
String trim(String original);
|
||||
}
|
||||
}
|
||||
@@ -7,7 +7,7 @@ version: ${project.version}
|
||||
debug: false
|
||||
|
||||
# 统计数据设定
|
||||
# 改选项用于帮助开发者统计插件版本与使用情况,且绝不会影响性能与使用体验。
|
||||
# 该选项用于帮助开发者统计插件版本与使用情况,且绝不会影响性能与使用体验。
|
||||
# 当然,您也可以选择在这里关闭,或在plugins/bStats下的配置文件中关闭。
|
||||
metrics: true
|
||||
|
||||
@@ -20,7 +20,7 @@ storage:
|
||||
|
||||
# 选择 yaml/json 存储方式时的存储路径
|
||||
# 默认为相对路径,相对于插件生成的配置文件夹下的路径
|
||||
# 支持绝对路径,如 “/var/data/ub/"(linux) 或 "D:\data\ub\"(windows)
|
||||
# 支持绝对路径,如 “/var/data/ud/"(linux) 或 "D:\data\ud\"(windows)
|
||||
# 使用绝对路径时请注意权限问题
|
||||
file-path: data
|
||||
|
||||
@@ -29,6 +29,7 @@ storage:
|
||||
# 数据库驱动路径
|
||||
driver: "com.mysql.jdbc.Driver"
|
||||
url: "jdbc:mysql://127.0.0.1:3306/<db-name>"
|
||||
table: "ud_data" # 插件表名,允许自定义
|
||||
username: "username"
|
||||
password: "password"
|
||||
|
||||
@@ -43,6 +44,7 @@ collect:
|
||||
|
||||
sounds:
|
||||
collect: "ENTITY_EXPERIENCE_ORB_PICKUP:0.5"
|
||||
takeout: "ENTITY_HORSE_ARMOR:0.5"
|
||||
sell-success: "ENTITY_VILLAGER_CELEBRATE"
|
||||
sell-fail: "ENTITY_VILLAGER_NO"
|
||||
gui-click: "UI_BUTTON_CLICK"
|
||||
@@ -50,20 +52,34 @@ sounds:
|
||||
# 通用配置
|
||||
general:
|
||||
|
||||
# 针对每一件物品的额外介绍
|
||||
# 针对可出售物品的额外介绍
|
||||
# 将添加到背包界面内的物品上,避免重复配置
|
||||
additional-lore:
|
||||
available-for-sale:
|
||||
# 可出售物品的介绍
|
||||
- " "
|
||||
- "&f仓库内数量 &a%(amount)"
|
||||
- "&f该物品单价 &a%(price)"
|
||||
- "&f今日可出售 &a%(remain)&8/%(limit)"
|
||||
not-for-sale:
|
||||
# 针对不可出售的物品的额外介绍
|
||||
# (当 未安装经济插件 或 每日可售出数量<=0 或 单价<=0 时判断为不可出售)
|
||||
- " "
|
||||
- "&f仓库内数量 &a%(amount)"
|
||||
|
||||
|
||||
# 提示玩家点击行为的介绍
|
||||
# 将添加到背包界面内的物品上,避免重复配置
|
||||
click-lore:
|
||||
available-for-sale:
|
||||
- " "
|
||||
- "&a&l左键点击 &8| &f按量售出该物品"
|
||||
- "&a&l右键点击 &8| &f取出一组该物品"
|
||||
not-for-sale:
|
||||
# 针对不可出售的物品的额外介绍
|
||||
# (当 未安装经济插件 或 每日可售出数量<=0 或 单价<=0 时判断为不可出售)
|
||||
- " "
|
||||
- "&a&l右键点击 &8| &f取出一组该物品"
|
||||
|
||||
# 售出界面的配置
|
||||
sell-gui:
|
||||
@@ -77,7 +93,6 @@ general:
|
||||
name: "&c减少 %(amount) 个"
|
||||
confirm:
|
||||
type: EMERALD
|
||||
data: 0
|
||||
name: "&a确认售出"
|
||||
lore:
|
||||
- " "
|
||||
@@ -87,7 +102,6 @@ general:
|
||||
- "&a&l点击确认售出"
|
||||
cancel:
|
||||
type: REDSTONE
|
||||
data: 0
|
||||
name: "&c取消售出"
|
||||
lore:
|
||||
- " "
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
name: "&b&lExample Depository" # 仓库名,用于消息显示
|
||||
|
||||
capacity: # 容量配置
|
||||
default: 500 # 若为0则默认不可以使用该仓库
|
||||
permissions: # 特殊权限对应的仓库容量,格式为 "权限:容量
|
||||
- "UltraDepository.vip:1000"
|
||||
- "UltraDepository.mvp:1500"
|
||||
|
||||
gui: # GUI额外配置
|
||||
title: "&b&l示例仓库 &7| 界面" #示例仓库的GUI标题
|
||||
lines: 4 # GUI的行数,支持 1-6行。
|
||||
items:
|
||||
"TEST":
|
||||
material: CHEST # 物品图标的类型
|
||||
data: 0 # 物品图标的数据值
|
||||
slot: 31 # 在GUI中显示的格子
|
||||
name: "&9&l测试图标"
|
||||
lore:
|
||||
# 支持使用变量
|
||||
- "你好 %player_name% !"
|
||||
actions: # 物品点击操作
|
||||
- "[CHAT] Hello!" #以玩家身份发送Hello,支持PlaceholderAPI变量
|
||||
- "[CHAT] /help" #若内容以"/"开头,则会以玩家身份执行指令,支持PlaceholderAPI变量
|
||||
- "[CONSOLE] say HELLO WORLD" #以后台身份执行指令,不需要加"/",支持PlaceholderAPI变量
|
||||
- "[MESSAGE] &(#FFBBBBB)Test %player_name%" # 向玩家发送消息,支持PlaceholderAPI变量和RGB颜色
|
||||
- "[SOUND] ENTITY_EXPERIENCE_ORB_PICKUP:0.5" # 向玩家发送声音,可以规定音量大小和音调,格式为 <声音>:[音量]:[音调]
|
||||
- "[CLOSE]" # 为玩家关闭界面
|
||||
|
||||
- "[LEFT:CLOSE]" #限制只有 鼠标左键 才触发CLOSE
|
||||
- "[SHIFT_LEFT:CLOSE]" #限制只有 按住Shift+鼠标左键 才触发CLOSE
|
||||
- "[RIGHT:CLOSE]" #限制只有 鼠标右键 才触发CLOSE
|
||||
- "[SHIFT_RIGHT:CLOSE]" #限制只有 按住Shift+鼠标右键 才触发CLOSE
|
||||
- "[MIDDLE:CLOSE]" #限制只有 鼠标中键 才触发CLOSE
|
||||
- "[DROP:CLOSE]" #限制只有 丢弃建 才触发CLOSE
|
||||
- "[CONTROL_DROP:CLOSE]" #限制只有 按住Ctrl+丢弃键 才触发CLOSE
|
||||
- "[DOUBLE_CLICK:CLOSE]" #限制只有 鼠标双击物品 才触发CLOSE
|
||||
- "[NUMBER_KEY:CLOSE]" #限制只有 数字键切换 才触发CLOSE
|
||||
|
||||
items:
|
||||
"INK_SAC": #物品ID,若需要限制数据ID则可以加“:”,如 "INK_SANK:4"
|
||||
slot: 11 # 物品在GUI中显示的槽位
|
||||
price: 0.1 # 物品单价
|
||||
limit: 500 # 物品每日售出限制
|
||||
name: "&8&l墨囊" # 物品显示的名字
|
||||
lore: # 物品的lore
|
||||
- " "
|
||||
- "&f抓住墨鱼!"
|
||||
@@ -0,0 +1,110 @@
|
||||
# ${project.name} - ${project.description}
|
||||
# Source url: ${project.url}
|
||||
# Download URL: ${project.distributionManagement.downloadUrl}
|
||||
|
||||
version: ${project.version}
|
||||
|
||||
debug: false
|
||||
|
||||
# bStats Metrics
|
||||
# This option is used to help developers analysis plugin stats,
|
||||
# and will never affect performance and user experience.
|
||||
# You can choose to turn it off here.
|
||||
metrics: true
|
||||
|
||||
# Storage Configuration
|
||||
storage:
|
||||
|
||||
# Storage method
|
||||
# You can choose [ yaml | json | mysql ]
|
||||
method: yaml
|
||||
|
||||
# The storage file path when choosing "yaml"/"json" method.
|
||||
# Support absolute paths, e.g. “/var/data/ud/"(linux) or "D:\data\ud\"(windows)
|
||||
# **Be aware of permission issues when using absolute paths!**
|
||||
file-path: data
|
||||
|
||||
# The Database configuration when choosing "mysql" method.
|
||||
mysql:
|
||||
driver: "com.mysql.jdbc.Driver"
|
||||
url: "jdbc:mysql://127.0.0.1:3306/<db-name>"
|
||||
table: "ud_data" # Plugin data table name, allowing customization
|
||||
username: "username"
|
||||
password: "password"
|
||||
|
||||
|
||||
# Player Collect Configuration
|
||||
# Used to determine when put the player's item into the backpack automatically
|
||||
collect:
|
||||
pickup: true # Pickup Items
|
||||
kill: true # Kill Entities (Animals/Monsters)
|
||||
break: true # Break Blocks
|
||||
|
||||
sounds:
|
||||
collect: "ENTITY_EXPERIENCE_ORB_PICKUP:0.5"
|
||||
sell-success: "ENTITY_VILLAGER_CELEBRATE"
|
||||
sell-fail: "ENTITY_VILLAGER_NO"
|
||||
gui-click: "UI_BUTTON_CLICK"
|
||||
|
||||
# General Configuration
|
||||
general:
|
||||
|
||||
# Hints lore for the item's information
|
||||
# Will add to items in BackpackGUI and SellGUI.
|
||||
additional-lore:
|
||||
available-for-sale:
|
||||
- " "
|
||||
- "&fAmount &a%(amount)"
|
||||
- "&fPrice &a%(price)"
|
||||
- "&fSold &a%(remain)&8/%(limit)"
|
||||
not-for-sale:
|
||||
# Display when :
|
||||
# 1. Vault not installed
|
||||
# 2. No economy plugins
|
||||
# 3. daily sell limit <= 0
|
||||
# 4. item price <=0
|
||||
- " "
|
||||
- "&fAmount &a%(amount)"
|
||||
|
||||
# Hints lore for the player's click
|
||||
# Will add to items in BackpackGUI.
|
||||
click-lore:
|
||||
available-for-sale:
|
||||
- " "
|
||||
- "&a&lLEFT-CLICK &8| &fSell items"
|
||||
- "&a&lRIGHT-CLICK &8| &fTake one Stack"
|
||||
not-for-sale:
|
||||
# Display when :
|
||||
# 1. Vault not installed
|
||||
# 2. No economy plugins
|
||||
# 3. daily sell limit <= 0
|
||||
# 4. item price <=0
|
||||
- " "
|
||||
- "&a&lRIGHT-CLICK &8| &fTake one Stack"
|
||||
|
||||
|
||||
# Configuration of the SellGUI
|
||||
sell-gui:
|
||||
title: "&8Selling %(item_name)"
|
||||
items:
|
||||
add:
|
||||
type: GREEN_STAINED_GLASS_PANE
|
||||
name: "&aAdd %(amount)"
|
||||
remove:
|
||||
type: RED_STAINED_GLASS_PANE
|
||||
name: "&cReduce %(amount)"
|
||||
confirm:
|
||||
type: EMERALD
|
||||
name: "&a&lConfirm"
|
||||
lore:
|
||||
- " "
|
||||
- "&7You will sell &r%(item_name) &8x &f%(amount)"
|
||||
- "&7and will get $&e%(money) &7."
|
||||
- " "
|
||||
- "&a&lClick to confirm"
|
||||
cancel:
|
||||
type: REDSTONE
|
||||
name: "&c&lCancel"
|
||||
lore:
|
||||
- " "
|
||||
- "&cClick to cancel"
|
||||
@@ -0,0 +1,48 @@
|
||||
help:
|
||||
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 该指令受到玩家每日售出数量的限制。'
|
||||
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 该指令受到玩家每日售出数量的限制。'
|
||||
item-sold:
|
||||
- '&f您出售了 &r%(item)&7x%(amount) &f,共赚取 &6%(money) &f元。'
|
||||
item-sold-limit:
|
||||
- '&f该物品今日剩余可出售额度为 &a%(amount)&8/%(limit) &f个。'
|
||||
item-pickup:
|
||||
- '&f您拾取了 &r%(item)&7x%(amount) &f,已自动放入到您的仓库中。'
|
||||
item-takeout:
|
||||
- '&f您从仓库中拿取了 &r%(item)&7x%(amount) &f放入到您的背包中。'
|
||||
item-collect:
|
||||
- '&f您收集了 &r%(item)&7x%(amount) &f,已自动放入到您的 &6%(depository) &f中。'
|
||||
item-collect-actionbar: '&r%(item)&7x%(amount) &f-> &6%(depository)'
|
||||
no-space:
|
||||
- '&f您背包内没有足够的空间取出物品!'
|
||||
no-economy:
|
||||
- '&f本服务器暂未启用出售功能。'
|
||||
no-depository:
|
||||
- '&f不存在该仓库,请检查仓库ID是否正确。'
|
||||
no-item:
|
||||
- '&f仓库中不存在该物品,请检查物品ID是否正确。'
|
||||
no-enough-item:
|
||||
- '&f仓库中不存在足够的物品。'
|
||||
wrong-number:
|
||||
- '&f数目输入错误,请输入正确的数字!'
|
||||
@@ -0,0 +1,48 @@
|
||||
|
||||
name: "&b&l示例仓库" # 仓库名,用于消息显示
|
||||
|
||||
capacity: # 容量配置
|
||||
default: 500 # 若为0则默认不可以使用该仓库
|
||||
permissions: # 特殊权限对应的仓库容量,格式为 "权限:容量
|
||||
- "UltraDepository.vip:1000"
|
||||
- "UltraDepository.mvp:1500"
|
||||
|
||||
gui: # GUI额外配置
|
||||
title: "&b&l示例仓库 &7| 界面" #示例仓库的GUI标题
|
||||
lines: 4 # GUI的行数,支持 1-6行。
|
||||
items:
|
||||
"TEST":
|
||||
material: CHEST # 物品图标的类型
|
||||
data: 0 # 物品图标的数据值
|
||||
slot: 31 # 在GUI中显示的格子
|
||||
name: "&9&l测试图标"
|
||||
lore:
|
||||
# 支持使用变量
|
||||
- "你好 %player_name% !"
|
||||
actions: # 物品点击操作
|
||||
- "[CHAT] Hello!" #以玩家身份发送Hello,支持PlaceholderAPI变量
|
||||
- "[CHAT] /help" #若内容以"/"开头,则会以玩家身份执行指令,支持PlaceholderAPI变量
|
||||
- "[CONSOLE] say HELLO WORLD" #以后台身份执行指令,不需要加"/",支持PlaceholderAPI变量
|
||||
- "[MESSAGE] &(#FFBBBBB)Test %player_name%" # 向玩家发送消息,支持PlaceholderAPI变量和RGB颜色
|
||||
- "[SOUND] ENTITY_EXPERIENCE_ORB_PICKUP:0.5" # 向玩家发送声音,可以规定音量大小和音调,格式为 <声音>:[音量]:[音调]
|
||||
- "[CLOSE]" # 为玩家关闭界面
|
||||
|
||||
- "[LEFT:CLOSE]" #限制只有 鼠标左键 才触发CLOSE
|
||||
- "[SHIFT_LEFT:CLOSE]" #限制只有 按住Shift+鼠标左键 才触发CLOSE
|
||||
- "[RIGHT:CLOSE]" #限制只有 鼠标右键 才触发CLOSE
|
||||
- "[SHIFT_RIGHT:CLOSE]" #限制只有 按住Shift+鼠标右键 才触发CLOSE
|
||||
- "[MIDDLE:CLOSE]" #限制只有 鼠标中键 才触发CLOSE
|
||||
- "[DROP:CLOSE]" #限制只有 丢弃建 才触发CLOSE
|
||||
- "[CONTROL_DROP:CLOSE]" #限制只有 按住Ctrl+丢弃键 才触发CLOSE
|
||||
- "[DOUBLE_CLICK:CLOSE]" #限制只有 鼠标双击物品 才触发CLOSE
|
||||
- "[NUMBER_KEY:CLOSE]" #限制只有 数字键切换 才触发CLOSE
|
||||
|
||||
items:
|
||||
"INK_SAC": #物品ID,若需要限制数据ID则可以加“:”,如 "INK_SANK:4"
|
||||
slot: 11 # 物品在GUI中显示的槽位
|
||||
price: 0.1 # 物品单价
|
||||
limit: 500 # 物品每日售出限制
|
||||
name: "&8&l墨囊" # 物品显示的名字
|
||||
lore: # 物品的lore
|
||||
- " "
|
||||
- "&f抓住墨鱼!"
|
||||
@@ -0,0 +1,109 @@
|
||||
# ${project.name} - ${project.description}
|
||||
# Source url: ${project.url}
|
||||
# Download URL: ${project.distributionManagement.downloadUrl}
|
||||
|
||||
version: ${project.version}
|
||||
|
||||
debug: false
|
||||
|
||||
# bStats Metrics
|
||||
# This option is used to help developers analysis plugin stats,
|
||||
# and will never affect performance and user experience.
|
||||
# You can choose to turn it off here.
|
||||
metrics: true
|
||||
|
||||
# Storage Configuration
|
||||
storage:
|
||||
|
||||
# Storage method
|
||||
# You can choose [ yaml | json | mysql ]
|
||||
method: yaml
|
||||
|
||||
# The storage file path when choosing "yaml"/"json" method.
|
||||
# Support absolute paths, e.g. “/var/data/ud/"(linux) or "D:\data\ud\"(windows)
|
||||
# **Be aware of permission issues when using absolute paths!**
|
||||
file-path: data
|
||||
|
||||
# The Database configuration when choosing "mysql" method.
|
||||
mysql:
|
||||
driver: "com.mysql.jdbc.Driver"
|
||||
url: "jdbc:mysql://127.0.0.1:3306/<db-name>"
|
||||
table: "ud_data" # Plugin data table name, allowing customization
|
||||
username: "username"
|
||||
password: "password"
|
||||
|
||||
|
||||
# Player Collect Configuration
|
||||
# Used to determine when put the player's item into the backpack automatically
|
||||
collect:
|
||||
pickup: true # Pickup Items
|
||||
kill: true # Kill Entities (Animals/Monsters)
|
||||
break: true # Break Blocks
|
||||
|
||||
sounds:
|
||||
collect: "ENTITY_EXPERIENCE_ORB_PICKUP:0.5"
|
||||
sell-success: "ENTITY_VILLAGER_CELEBRATE"
|
||||
sell-fail: "ENTITY_VILLAGER_NO"
|
||||
gui-click: "UI_BUTTON_CLICK"
|
||||
|
||||
# General Configuration
|
||||
general:
|
||||
|
||||
# Hints lore for the item's information
|
||||
# Will add to items in BackpackGUI and SellGUI.
|
||||
additional-lore:
|
||||
available-for-sale:
|
||||
- " "
|
||||
- "&fAmount &a%(amount)"
|
||||
- "&fPrice &a%(price)"
|
||||
- "&fSold &a%(remain)&8/%(limit)"
|
||||
not-for-sale:
|
||||
# Display when :
|
||||
# 1. Vault not installed
|
||||
# 2. No economy plugins
|
||||
# 3. daily sell limit <= 0
|
||||
# 4. item price <=0
|
||||
- " "
|
||||
- "&fAmount &a%(amount)"
|
||||
|
||||
# Hints lore for the player's click
|
||||
# Will add to items in BackpackGUI.
|
||||
click-lore:
|
||||
available-for-sale:
|
||||
- " "
|
||||
- "&a&lLEFT-CLICK &8| &fSell items"
|
||||
- "&a&lRIGHT-CLICK &8| &fTake one Stack"
|
||||
not-for-sale:
|
||||
# Display when :
|
||||
# 1. Vault not installed
|
||||
# 2. No economy plugins
|
||||
# 3. daily sell limit <= 0
|
||||
# 4. item price <=0
|
||||
- " "
|
||||
- "&a&lRIGHT-CLICK &8| &fTake one Stack"
|
||||
|
||||
# Configuration of the SellGUI
|
||||
sell-gui:
|
||||
title: "&8Selling %(item_name)"
|
||||
items:
|
||||
add:
|
||||
type: GREEN_STAINED_GLASS_PANE
|
||||
name: "&aAdd %(amount)"
|
||||
remove:
|
||||
type: RED_STAINED_GLASS_PANE
|
||||
name: "&cReduce %(amount)"
|
||||
confirm:
|
||||
type: EMERALD
|
||||
name: "&a&lConfirm"
|
||||
lore:
|
||||
- " "
|
||||
- "&7You will sell &r%(item_name) &8x &f%(amount)"
|
||||
- "&7and will get $&e%(money) &7."
|
||||
- " "
|
||||
- "&a&lClick to confirm"
|
||||
cancel:
|
||||
type: REDSTONE
|
||||
name: "&c&lCancel"
|
||||
lore:
|
||||
- " "
|
||||
- "&cClick to cancel"
|
||||
@@ -0,0 +1,48 @@
|
||||
help:
|
||||
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 该指令受到玩家每日售出数量的限制。'
|
||||
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 该指令受到玩家每日售出数量的限制。'
|
||||
item-sold:
|
||||
- '&f您出售了 &r%(item)&7x%(amount) &f,共赚取 &6%(money) &f元。'
|
||||
item-sold-limit:
|
||||
- '&f该物品今日剩余可出售额度为 &a%(amount)&8/%(limit) &f个。'
|
||||
item-pickup:
|
||||
- '&f您拾取了 &r%(item)&7x%(amount) &f,已自动放入到您的仓库中。'
|
||||
item-takeout:
|
||||
- '&f您从仓库中拿取了 &r%(item)&7x%(amount) &f放入到您的背包中。'
|
||||
item-collect:
|
||||
- '&f您收集了 &r%(item)&7x%(amount) &f,已自动放入到您的 &6%(depository) &f中。'
|
||||
item-collect-actionbar: '&r%(item)&7x%(amount) &f-> &6%(depository)'
|
||||
no-space:
|
||||
- '&f您背包内没有足够的空间取出物品!'
|
||||
no-economy:
|
||||
- '&f本服务器暂未启用出售功能。'
|
||||
no-depository:
|
||||
- '&f不存在该仓库,请检查仓库ID是否正确。'
|
||||
no-item:
|
||||
- '&f仓库中不存在该物品,请检查物品ID是否正确。'
|
||||
no-enough-item:
|
||||
- '&f仓库中不存在足够的物品。'
|
||||
wrong-number:
|
||||
- '&f数目输入错误,请输入正确的数字!'
|
||||
@@ -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数目输入错误,请输入正确的数字!"
|
||||
@@ -9,7 +9,7 @@ authors:
|
||||
- CarmJos
|
||||
- Zimrs
|
||||
|
||||
api-version: 1.13
|
||||
api-version: 1.16
|
||||
|
||||
softdepend:
|
||||
- PlaceholderAPI
|
||||
|
||||
Reference in New Issue
Block a user