1
mirror of https://github.com/CarmJos/MoeTeleport.git synced 2026-06-04 16:46:10 +08:00

62 Commits

Author SHA1 Message Date
renovate[bot] 3ebd583fad chore(deps): update dependency org.apache.maven.plugins:maven-surefire-plugin to v3.5.6 2026-05-27 22:03:28 +00:00
renovate[bot] 6019410f0c chore(deps): update dependency org.apache.maven.plugins:maven-surefire-plugin to v3.5.5 2026-03-10 08:06:00 +08:00
renovate[bot] 03346ecfcd chore(deps): update dependency org.bstats:bstats-bukkit to v3.2.1 2026-03-10 08:05:53 +08:00
renovate[bot] 1720572f4d chore(deps): update actions/upload-artifact action to v7 2026-03-10 08:05:44 +08:00
renovate[bot] 81d0b8869d chore(deps): update dependency org.apache.maven.plugins:maven-shade-plugin to v3.6.2 2026-03-10 08:05:35 +08:00
renovate[bot] d620109904 chore(deps): update actions/upload-artifact action to v6 2026-02-21 00:57:39 +08:00
renovate[bot] d11e5a44b8 chore(deps): update dependency org.apache.maven.plugins:maven-compiler-plugin to v3.15.0 2026-02-21 00:57:33 +08:00
renovate[bot] d404e36805 fix(deps): update dependency me.clip:placeholderapi to v2.12.2 2026-02-21 00:57:27 +08:00
renovate[bot] 0d9f34c135 fix(deps): update dependency org.jetbrains:annotations to v26.1.0 2026-02-21 00:57:21 +08:00
renovate[bot] 1b6bd72570 chore(deps): update actions/upload-artifact action to v5 2025-12-01 09:32:26 +08:00
renovate[bot] e148747a0b fix(deps): update dependency me.clip:placeholderapi to v2.11.7 2025-12-01 09:32:20 +08:00
renovate[bot] 2d55ac35f8 fix(deps): update dependency org.spigotmc:spigot-api to v1.19-r0.1-20220725.090125-47 2025-12-01 09:32:14 +08:00
renovate[bot] d826abdecc chore(deps): update dependency org.apache.maven.plugins:maven-jar-plugin to v3.5.0 2025-12-01 09:32:07 +08:00
renovate[bot] b63e130b15 chore(deps): update actions/checkout action to v6 2025-12-01 09:32:00 +08:00
renovate[bot] 8f8d5c7016 chore(deps): update dependency org.apache.maven.plugins:maven-source-plugin to v3.4.0 2025-12-01 09:31:53 +08:00
renovate[bot] 813dbd8b83 chore(deps): update dependency org.apache.maven.plugins:maven-compiler-plugin to v3.14.1 2025-09-24 09:19:31 +08:00
renovate[bot] 0db564c027 chore(deps): update dependency org.apache.maven.plugins:maven-shade-plugin to v3.6.1 2025-09-14 16:56:47 +08:00
renovate[bot] b50d2f216d chore(deps): update dependency org.apache.maven.plugins:maven-surefire-plugin to v3.5.4 2025-09-14 16:56:41 +08:00
renovate[bot] 8d0cb0365a fix(deps): update dependency org.jetbrains:annotations to v26.0.2-1 2025-09-12 08:52:20 +08:00
renovate[bot] 0a3b1c0017 chore(deps): update dependency cc.carm.lib:mineconfiguration-bukkit to v3.1.3 2025-08-21 23:44:22 +08:00
renovate[bot] c8b2e03efe chore(deps): update dependency org.apache.maven.plugins:maven-surefire-plugin to v3.5.3 2025-08-21 23:44:13 +08:00
renovate[bot] e917d2a5b3 chore(deps): update deps.easyplugin.version to v1.5.14 2025-08-21 23:44:06 +08:00
renovate[bot] c6fec42aa4 fix(deps): update dependency net.essentialsx:essentialsx to v2.21.2 2025-08-21 23:44:00 +08:00
renovate[bot] 73489054a1 chore(deps): update dependency org.apache.maven.plugins:maven-clean-plugin to v3.5.0 2025-08-21 23:43:52 +08:00
renovate[bot] 6344dfe2d9 fix(deps): update dependency com.comphenix.protocol:protocollib to v5 2025-08-21 23:43:45 +08:00
renovate[bot] 3d7bb0292a chore(deps): update actions/checkout action to v5 2025-08-21 23:43:40 +08:00
renovate[bot] 52d806f5d4 chore(deps): update actions/setup-java action to v5 2025-08-21 23:43:33 +08:00
renovate[bot] 3f2713389b chore(deps): update dependency cc.carm.lib:mineconfiguration-bukkit to v3.1.1 2025-04-18 10:56:06 +08:00
renovate[bot] 97781fc1aa fix(deps): update dependency net.essentialsx:essentialsx to v2.21.0 2025-04-18 10:56:01 +08:00
renovate[bot] 74d083f51f chore(deps): update dependency org.apache.maven.plugins:maven-clean-plugin to v3.4.1 2025-03-12 04:38:20 +08:00
renovate[bot] a073ebf34c chore(deps): update dependency org.apache.maven.plugins:maven-compiler-plugin to v3.14.0 2025-03-12 04:38:17 +08:00
renovate[bot] 1a8fb8459e chore(deps): update dependency cc.carm.lib:mineconfiguration-bukkit to v3 2025-03-12 04:38:13 +08:00
renovate[bot] db53b416c7 fix(deps): update dependency org.jetbrains:annotations to v26.0.2 2025-02-06 16:37:03 +08:00
renovate[bot] ef56193d7f fix(deps): update dependency org.jetbrains:annotations to v26 2025-01-18 02:24:27 +08:00
renovate[bot] 103b4bb734 chore(deps): update dependency org.apache.maven.plugins:maven-surefire-plugin to v3 2025-01-18 02:22:50 +08:00
renovate[bot] c4adadf24f chore(deps): update dependency org.apache.maven.plugins:maven-clean-plugin to v3 2025-01-18 02:22:47 +08:00
renovate[bot] 61c7e4e7da chore(deps): update actions/upload-artifact action to v4 2025-01-18 02:22:44 +08:00
renovate[bot] 17d8e6847b chore(deps): update actions/setup-java action to v4 2025-01-18 02:22:41 +08:00
renovate[bot] eaff4d066c chore(deps): update actions/checkout action to v4 2025-01-18 02:22:38 +08:00
renovate[bot] 3cc6485d3d fix(deps): update dependency org.jetbrains:annotations to v23.1.0 2025-01-18 02:22:35 +08:00
renovate[bot] 665fa3f53d fix(deps): update dependency net.essentialsx:essentialsx to v2.20.1 2025-01-18 02:22:31 +08:00
renovate[bot] c481db7827 chore(deps): update dependency org.bstats:bstats-bukkit to v3.1.0 2025-01-18 02:21:54 +08:00
renovate[bot] 08a308c88d chore(deps): update dependency org.apache.maven.plugins:maven-source-plugin to v3.3.1 2025-01-18 02:21:51 +08:00
renovate[bot] 6b0c9e2a2c chore(deps): update dependency org.apache.maven.plugins:maven-jar-plugin to v3.4.2 2025-01-18 02:21:36 +08:00
renovate[bot] a01746348e chore(deps): update dependency org.apache.maven.plugins:maven-compiler-plugin to v3.13.0 2025-01-18 02:21:33 +08:00
renovate[bot] 104e9ae4ce chore(deps): update dependency org.apache.maven.plugins:maven-clean-plugin to v2.6.1 2025-01-18 02:21:30 +08:00
renovate[bot] 979417cc2a chore(deps): update dependency cc.carm.lib:mineconfiguration-bukkit to v2.9.3 2025-01-18 02:21:27 +08:00
renovate[bot] dba6eb9af5 chore(deps): update deps.easyplugin.version to v1.5.12 2025-01-18 02:21:23 +08:00
renovate[bot] 743cca2238 chore(deps): update dependency xyz.xenondevs:particle to v1.8.4 2025-01-18 02:21:20 +08:00
renovate[bot] eb9f5bd4ad chore(deps): update dependency org.apache.maven.plugins:maven-shade-plugin to v3.6.0 2025-01-18 02:10:09 +08:00
renovate[bot] 7515e7e271 fix(deps): update dependency me.clip:placeholderapi to v2.11.6 2025-01-18 01:06:59 +08:00
renovate[bot] 3f0a47d5cd chore(deps): update dependency cc.carm.lib:easysql-beecp to v0.4.7 2025-01-18 00:10:22 +08:00
renovate[bot] d896be6f98 chore(deps): update dependency org.apache.maven.plugins:maven-surefire-plugin to v2.22.2 2025-01-18 00:10:10 +08:00
renovate[bot] 392e16c165 Add renovate.json 2025-01-18 00:01:06 +08:00
carm f4e3dabb29 fix(cancel): 修复取消传送功能异常的问题 (#13) 2023-04-03 17:10:07 +08:00
carm 4393cc9ce2 feat(command): 为各个指令的功能添加单独权限,修复接受指令错误的问题 2023-03-17 22:36:14 +08:00
carm 8c1a4530c0 feat(deps): 适配上游依赖库更新。 2023-03-17 18:05:23 +08:00
carm 21e3fc1674 fix(papi): 消息文件不在强制要求依赖PlaceholderAPI 2023-03-17 18:02:20 +08:00
carm b35ac8e4c4 feat(rename): 支持地标点与家传送点的重命名功能 2023-02-19 04:56:28 +08:00
carm 0d1fdccb79 feat(rename): 支持地标点与家传送点的重命名功能 2023-02-19 04:52:24 +08:00
carm f728d1f7e6 docs(en): 提供英文版本的介绍,并发布于SpigotMC 2023-02-16 21:05:21 +08:00
Maverical cb76e86b80 docs(en): Supply the English version of README documentation (#12) 2023-02-16 00:08:25 +08:00
37 changed files with 496 additions and 257 deletions
+3 -3
View File
@@ -14,9 +14,9 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v6
- name: "Set up JDK" - name: "Set up JDK"
uses: actions/setup-java@v2 uses: actions/setup-java@v5
with: with:
java-version: '11' java-version: '11'
distribution: 'adopt' distribution: 'adopt'
@@ -37,7 +37,7 @@ jobs:
cp -vrf asset/*.jar artifacts cp -vrf asset/*.jar artifacts
- name: "Upload artifact" - name: "Upload artifact"
uses: actions/upload-artifact@v2 uses: actions/upload-artifact@v7
with: with:
name: Artifact name: Artifact
path: artifacts path: artifacts
+2 -2
View File
@@ -11,9 +11,9 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v6
- name: "Set up JDK" - name: "Set up JDK"
uses: actions/setup-java@v2 uses: actions/setup-java@v5
with: with:
java-version: '11' java-version: '11'
distribution: 'adopt' distribution: 'adopt'
+155
View File
@@ -0,0 +1,155 @@
```text
__ ___ ______ __ __
/ |/ /__ __/_ __/__ / /__ ___ ___ ____/ /_
/ /|_/ / _ \/ -_) / / -_) / -_) _ \/ _ \/ __/ __/
/_/ /_/\___/\__/_/ \__/_/\__/ .__/\___/_/ \__/
/_/
```
README LANGUAGES [ [中文](README.md) | [**English**](README-EN.md) ]
# MoeTeleport
[![CodeFactor](https://www.codefactor.io/repository/github/CarmJos/MoeTeleport/badge?s=b76fec1f64726b5f19989aace6adb5f85fdab840)](https://www.codefactor.io/repository/github/CarmJos/MoeTeleport)
![CodeSize](https://img.shields.io/github/languages/code-size/CarmJos/MoeTeleport)
[![Download](https://img.shields.io/github/downloads/CarmJos/MoeTeleport/total)](https://github.com/CarmJos/MoeTeleport/releases)
[![Java CI with Maven](https://github.com/CarmJos/MoeTeleport/actions/workflows/maven.yml/badge.svg?branch=master)](https://github.com/CarmJos/MoeTeleport/actions/workflows/maven.yml)
![Support](https://img.shields.io/badge/Minecraft-Java%201.13--Latest-blue)
![](https://visitor-badge.glitch.me/badge?page_id=moeteleport.readme)
MoeTeleport is an open source delivery plugin that contains several features and will be always updated to add new features based on users' requirements.
The project code conforms to the development specifications and is suitable for new developers to learn Bukkit and make their own plugins.
## Functions and advantages
### Current functions
- Multiple storage formats, select on demand.
- Support YAML, JSON and MySQL/MariaDB storage
- Support direct call [EssentialsX] (https://github.com/EssentialsX/Essentials)/CMI data, Seamless switching
- Clickable messages (such as "Click-Agree")
- Based on the MineDown syntax, Customizable configuration
- Teleport requests between players
- Support to specify handling a player's request
- Set warp locations
- Support to set a different number of warp locations as VIP add-on content based on permissions
- Set home locations (understood as private warps)
- Support setting different number of homes according to permissions as VIP add-on content
- Return to the place of death and the last location
### Advantages
- ** Lightweight plugin. ** Suitable for small servers, simple and convenient configuration.
- ** Specification development. ** Plugin architecture conforms to development specifications, suitable for new developers to learn.
- EasyPlugin has been used since [3.0.0]() and may be somewhat different from other mainstream plugin structures.
- ** Continuous maintenance. ** All new functional requirements can be submitted, which is likely to be supported in the subsequent development.
- Functional requirements please [submit Issues] (HTTP: / / https://github.com/CarmJos/MoeTeleport/issues/new?assignees=&labels=enhancement&template=feature issues.md&title=), do not submit in the post!
- Submitting requests associated with "teleport" will most likely be updated and supported.
## [Dependencies](https://github.com/CarmJos/MoeTeleport/network/dependencies)
- **[Necessary]** The plugin is based on [Spigot-API](https://hub.spigotmc.org/stash/projects/SPIGOT) 、[BukkitAPI](http://bukkit.org/).
- **[Included]** Message format is based on [MineDown](https://github.com/Phoenix616/MineDown).
- All messages.yml support MineDown syntax。
- **[Recommended]** The variable part is based on [PlaceholderAPI](https://www.spigotmc.org/resources/6245/).
Read this if you need more details. [Dependencies](https://github.com/CarmJos/MoeTeleport/network/dependencies).
## [Commands](src/main/resources/plugin.yml)
The main command is `/MoeTeleport` or `/mt`.
All commands in this plugin support configuration of "simplified commands",
such as allowing the player to directly input '/back' and execute '/MoeTeleport back', see [configuration](#Config) related content.
- Required parameter '< Parameter >'
- Optional parameter '[parameter]'
```text
# reload
@ Admin command (MoeTeleport.admin)
- Reload the plugin configuration file.
# back
- Return to the last location.
----- [Teleport commands] -----
# teleport to <target player>
- Request to teleport to target player's location.
# teleport here <target player>
- Request the target player to teleport to their location.
# teleport accept [target player]
- Grant a teleport request (player requests can be specified).
# teleport deny [target player].
- Reject a teleport request (player requests can be specified).
----- [Home commands] -----
# home to [home name]
- Send to the specified home.
- If you do not fill in the specific home, return to the first set of home.
- If there is a home named "home", return to "home" preferentially.
# home list
- List all the home names.
# home set [home name]
- Set a home location.
- If you do not specify the name of home, the default value is "home".
# home delete [home name]
-Delete a home location
----- [Warp commands] -----
# warp to <warp name>
- Teleport to the specified location.
# warp list
- List all current warp locations.
# warp set <warp name>
- Set a warp location.
- If the warp already exists and you are the owner (or the server administrator) of the warp,
- the old warp point will be overwritten.
# warp delete <Warp name>
- Delete one of your own warps
```
## Config
### Plugin configuration file ([config.yml]())
Read source file for more details.
### Message configuration file ([messages.yml]())
Support [MineDown syntax](https://wiki.phoenix616.dev/library:minedown:syntax)
Read source file for more details.
## Usage statistics
[![bStats](https://bstats.org/signatures/bukkit/MoeTeleport.svg)](https://bstats.org/plugin/bukkit/MoeTeleport/14459)
## Support and donate
If you find this plugin helps, you can donate to support me. Thank you for being a supporter of this open source project!
Sincere thanks to the following friends who support the development of this project:
- This plugin is entrusted by [**璎珞 **](https://www.yingluo.world/) server , authorized already.
- Thank you to [**XingMC**(MagicMC server developer)](https://www.mcbbs.net/?4816320) for funding the subsequent development of this plugin.
Many thanks to Jetbrains for kindly providing a license for me to work on this and other open-source projects.
[![](https://resources.jetbrains.com/storage/products/company/brand/logos/jb_beam.svg)](https://www.jetbrains.com/?from=https://github.com/CarmJos/UserPrefix)
## Open source agreement
The source code of this project uses [GNU General Public License v3.0](https://opensource.org/licenses/GPL-3.0) License.
+10 -6
View File
@@ -5,13 +5,14 @@
/_/ /_/\___/\__/_/ \__/_/\__/ .__/\___/_/ \__/ /_/ /_/\___/\__/_/ \__/_/\__/ .__/\___/_/ \__/
/_/ /_/
``` ```
README LANGUAGES [ [**中文**](README.md) | [English](README-EN.md) ]
# MoeTeleport 喵喵传送 # MoeTeleport 喵喵传送
[![CodeFactor](https://www.codefactor.io/repository/github/carm-outsource/MoeTeleport/badge?s=b76fec1f64726b5f19989aace6adb5f85fdab840)](https://www.codefactor.io/repository/github/carm-outsource/MoeTeleport) [![CodeFactor](https://www.codefactor.io/repository/github/CarmJos/MoeTeleport/badge?s=b76fec1f64726b5f19989aace6adb5f85fdab840)](https://www.codefactor.io/repository/github/CarmJos/MoeTeleport)
![CodeSize](https://img.shields.io/github/languages/code-size/carm-outsource/MoeTeleport) ![CodeSize](https://img.shields.io/github/languages/code-size/CarmJos/MoeTeleport)
[![Download](https://img.shields.io/github/downloads/carm-outsource/MoeTeleport/total)](https://github.com/carm-outsource/MoeTeleport/releases) [![Download](https://img.shields.io/github/downloads/CarmJos/MoeTeleport/total)](https://github.com/CarmJos/MoeTeleport/releases)
[![Java CI with Maven](https://github.com/carm-outsource/MoeTeleport/actions/workflows/maven.yml/badge.svg?branch=master)](https://github.com/carm-outsource/MoeTeleport/actions/workflows/maven.yml) [![Java CI with Maven](https://github.com/CarmJos/MoeTeleport/actions/workflows/maven.yml/badge.svg?branch=master)](https://github.com/CarmJos/MoeTeleport/actions/workflows/maven.yml)
![Support](https://img.shields.io/badge/Minecraft-Java%201.13--Latest-blue) ![Support](https://img.shields.io/badge/Minecraft-Java%201.13--Latest-blue)
![](https://visitor-badge.glitch.me/badge?page_id=moeteleport.readme) ![](https://visitor-badge.glitch.me/badge?page_id=moeteleport.readme)
@@ -124,11 +125,11 @@
## 配置 ## 配置
### 插件配置文件 ([config.yml](src/main/resources/config.yml)) ### 插件配置文件 ([config.yml]())
详见源文件。 详见源文件。
### 消息配置文件 ([messages.yml](src/main/resources/messages.yml)) ### 消息配置文件 ([messages.yml]())
支持 [MineDown 语法](https://wiki.phoenix616.dev/library:minedown:syntax),详见源文件。 支持 [MineDown 语法](https://wiki.phoenix616.dev/library:minedown:syntax),详见源文件。
@@ -144,6 +145,9 @@
- 本插件由 [**璎珞**服务器](https://www.yingluo.world/) 委托本人开发,经过授权后开源。 - 本插件由 [**璎珞**服务器](https://www.yingluo.world/) 委托本人开发,经过授权后开源。
- 感谢 [**XingMC**(MagicMC服务器开发者)](https://www.mcbbs.net/?4816320) 为本插件提供后续开发的资金赞助。 - 感谢 [**XingMC**(MagicMC服务器开发者)](https://www.mcbbs.net/?4816320) 为本插件提供后续开发的资金赞助。
Many thanks to Jetbrains for kindly providing a license for me to work on this and other open-source projects.
[![](https://resources.jetbrains.com/storage/products/company/brand/logos/jb_beam.svg)](https://www.jetbrains.com/?from=https://github.com/CarmJos/UserPrefix)
## 开源协议 ## 开源协议
本项目源码采用 [GNU General Public License v3.0](https://opensource.org/licenses/GPL-3.0) 开源协议。 本项目源码采用 [GNU General Public License v3.0](https://opensource.org/licenses/GPL-3.0) 开源协议。
+31 -29
View File
@@ -11,14 +11,14 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.encoding>UTF-8</maven.compiler.encoding> <maven.compiler.encoding>UTF-8</maven.compiler.encoding>
<deps.easyplugin.version>1.4.19</deps.easyplugin.version> <deps.easyplugin.version>1.5.14</deps.easyplugin.version>
<deps.easysql.version>0.4.6</deps.easysql.version> <deps.easysql.version>0.4.7</deps.easysql.version>
<deps.mineconfig.version>2.3.1</deps.mineconfig.version> <deps.mineconfig.version>3.1.3</deps.mineconfig.version>
</properties> </properties>
<groupId>cc.carm.plugin</groupId> <groupId>cc.carm.plugin</groupId>
<artifactId>moeteleport</artifactId> <artifactId>moeteleport</artifactId>
<version>4.0.0</version> <version>4.0.3</version>
<name>MoeTeleport</name> <name>MoeTeleport</name>
<description>喵喵传送,简单的传送、设置家的插件。</description> <description>喵喵传送,简单的传送、设置家的插件。</description>
@@ -44,13 +44,6 @@
</developers> </developers>
<repositories> <repositories>
<repository>
<id>carm-repo</id>
<name>Carm's Repo</name>
<url>https://repo.carm.cc/repository/maven-public/</url>
</repository>
<repository> <repository>
<id>spigot-repo</id> <id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url> <url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
@@ -87,10 +80,11 @@
</repository> </repository>
<repository> <repository>
<id>github</id> <id>carm-repo</id>
<name>GitHub Packages</name> <name>Carm's Repo</name>
<url>https://maven.pkg.github.com/CarmJos/${project.name}</url> <url>https://repo.carm.cc/repository/maven-public/</url>
</repository> </repository>
</repositories> </repositories>
<distributionManagement> <distributionManagement>
@@ -98,7 +92,7 @@
<repository> <repository>
<id>github</id> <id>github</id>
<name>GitHub Packages</name> <name>GitHub Packages</name>
<url>https://maven.pkg.github.com/CarmJos/${project.name}</url> <url>https://maven.pkg.github.com/CarmJos/MoeTeleport</url>
</repository> </repository>
</distributionManagement> </distributionManagement>
@@ -128,6 +122,14 @@
<optional>true</optional> <optional>true</optional>
</dependency> </dependency>
<dependency>
<groupId>cc.carm.lib</groupId>
<artifactId>easyplugin-command-alias</artifactId>
<version>${deps.easyplugin.version}</version>
<scope>compile</scope>
<optional>true</optional>
</dependency>
<dependency> <dependency>
<groupId>cc.carm.lib</groupId> <groupId>cc.carm.lib</groupId>
<artifactId>easyplugin-githubchecker</artifactId> <artifactId>easyplugin-githubchecker</artifactId>
@@ -139,7 +141,7 @@
<dependency> <dependency>
<groupId>net.essentialsx</groupId> <groupId>net.essentialsx</groupId>
<artifactId>EssentialsX</artifactId> <artifactId>EssentialsX</artifactId>
<version>2.19.2</version> <version>2.21.2</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
@@ -178,7 +180,7 @@
<dependency> <dependency>
<groupId>xyz.xenondevs</groupId> <groupId>xyz.xenondevs</groupId>
<artifactId>particle</artifactId> <artifactId>particle</artifactId>
<version>1.8.3</version> <version>1.8.4</version>
<scope>compile</scope> <scope>compile</scope>
<optional>true</optional> <optional>true</optional>
</dependency> </dependency>
@@ -186,21 +188,21 @@
<dependency> <dependency>
<groupId>org.spigotmc</groupId> <groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId> <artifactId>spigot-api</artifactId>
<version>1.17-R0.1-SNAPSHOT</version> <version>1.19-R0.1-20220725.090125-47</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.comphenix.protocol</groupId> <groupId>com.comphenix.protocol</groupId>
<artifactId>ProtocolLib</artifactId> <artifactId>ProtocolLib</artifactId>
<version>4.8.0</version> <version>5.3.0</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.bstats</groupId> <groupId>org.bstats</groupId>
<artifactId>bstats-bukkit</artifactId> <artifactId>bstats-bukkit</artifactId>
<version>3.0.0</version> <version>3.2.1</version>
<scope>compile</scope> <scope>compile</scope>
<optional>true</optional> <optional>true</optional>
</dependency> </dependency>
@@ -208,7 +210,7 @@
<dependency> <dependency>
<groupId>me.clip</groupId> <groupId>me.clip</groupId>
<artifactId>placeholderapi</artifactId> <artifactId>placeholderapi</artifactId>
<version>2.10.9</version> <version>2.12.2</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
@@ -222,7 +224,7 @@
<dependency> <dependency>
<groupId>org.jetbrains</groupId> <groupId>org.jetbrains</groupId>
<artifactId>annotations</artifactId> <artifactId>annotations</artifactId>
<version>23.0.0</version> <version>26.1.0</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
@@ -233,7 +235,7 @@
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId> <artifactId>maven-clean-plugin</artifactId>
<version>2.5</version> <version>3.5.0</version>
<configuration> <configuration>
<filesets> <filesets>
<fileset> <fileset>
@@ -256,7 +258,7 @@
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId> <artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version> <version>3.15.0</version>
<configuration> <configuration>
<source>${project.jdk.version}</source> <source>${project.jdk.version}</source>
<target>${project.jdk.version}</target> <target>${project.jdk.version}</target>
@@ -267,12 +269,12 @@
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId> <artifactId>maven-jar-plugin</artifactId>
<version>3.2.0</version> <version>3.5.0</version>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId> <artifactId>maven-source-plugin</artifactId>
<version>3.2.0</version> <version>3.4.0</version>
<executions> <executions>
<execution> <execution>
<phase>package</phase> <phase>package</phase>
@@ -285,7 +287,7 @@
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId> <artifactId>maven-shade-plugin</artifactId>
<version>3.2.3</version> <version>3.6.2</version>
<executions> <executions>
<execution> <execution>
<phase>package</phase> <phase>package</phase>
@@ -295,7 +297,7 @@
</execution> </execution>
</executions> </executions>
<configuration> <configuration>
<finalName>${project.name}-${project.version}</finalName> <finalName>MoeTeleport-${project.version}</finalName>
<outputDirectory>${project.basedir}/asset/</outputDirectory> <outputDirectory>${project.basedir}/asset/</outputDirectory>
<createDependencyReducedPom>false</createDependencyReducedPom> <createDependencyReducedPom>false</createDependencyReducedPom>
<filters> <filters>
@@ -334,7 +336,7 @@
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId> <artifactId>maven-surefire-plugin</artifactId>
<version>2.22.1</version> <version>3.5.6</version>
<configuration> <configuration>
<useSystemClassLoader>false</useSystemClassLoader> <useSystemClassLoader>false</useSystemClassLoader>
</configuration> </configuration>
+6
View File
@@ -0,0 +1,6 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"config:recommended"
]
}
@@ -2,6 +2,7 @@ package cc.carm.plugin.moeteleport;
import cc.carm.lib.configuration.core.source.ConfigurationProvider; import cc.carm.lib.configuration.core.source.ConfigurationProvider;
import cc.carm.lib.easyplugin.EasyPlugin; import cc.carm.lib.easyplugin.EasyPlugin;
import cc.carm.lib.easyplugin.command.alias.AliasCommandManager;
import cc.carm.lib.easyplugin.updatechecker.GHUpdateChecker; import cc.carm.lib.easyplugin.updatechecker.GHUpdateChecker;
import cc.carm.lib.mineconfiguration.bukkit.MineConfiguration; import cc.carm.lib.mineconfiguration.bukkit.MineConfiguration;
import cc.carm.plugin.moeteleport.command.MainCommands; import cc.carm.plugin.moeteleport.command.MainCommands;
@@ -15,6 +16,7 @@ import cc.carm.plugin.moeteleport.storage.StorageMethod;
import org.bstats.bukkit.Metrics; import org.bstats.bukkit.Metrics;
import org.bstats.charts.SimplePie; import org.bstats.charts.SimplePie;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.jetbrains.annotations.NotNull;
import xyz.xenondevs.particle.utils.ReflectionUtils; import xyz.xenondevs.particle.utils.ReflectionUtils;
public class Main extends EasyPlugin { public class Main extends EasyPlugin {
@@ -28,7 +30,7 @@ public class Main extends EasyPlugin {
protected UserManager userManager; protected UserManager userManager;
protected RequestManager requestManager; protected RequestManager requestManager;
protected TeleportManager teleportManager; protected TeleportManager teleportManager;
protected CommandManager commandManager; protected AliasCommandManager commandManager;
public Main() { public Main() {
instance = this; instance = this;
@@ -85,15 +87,16 @@ public class Main extends EasyPlugin {
log("注册指令..."); log("注册指令...");
registerCommand("MoeTeleport", new MainCommands(this)); registerCommand("MoeTeleport", new MainCommands(this));
try {
this.commandManager = new CommandManager(this);
if (PluginConfig.COMMAND.ENABLE.getNotNull()) { if (PluginConfig.COMMAND.ENABLE.getNotNull()) {
log("注册简化指令映射...");
try {
this.commandManager = new AliasCommandManager(this);
PluginConfig.COMMAND.ALIAS.getNotNull().forEach(commandManager::register); PluginConfig.COMMAND.ALIAS.getNotNull().forEach(commandManager::register);
}
} catch (Exception e) { } catch (Exception e) {
log("注册简化指令失败: " + e.getMessage()); log("注册简化指令失败: " + e.getMessage());
e.printStackTrace(); e.printStackTrace();
} }
}
if (PluginConfig.METRICS.getNotNull()) { if (PluginConfig.METRICS.getNotNull()) {
log("启用统计数据..."); log("启用统计数据...");
@@ -116,8 +119,8 @@ public class Main extends EasyPlugin {
@Override @Override
protected void shutdown() { protected void shutdown() {
if (PluginConfig.COMMAND.ENABLE.getNotNull() && this.commandManager != null) {
log("清空简化指令..."); log("清空简化指令...");
if (this.commandManager != null) {
this.commandManager.unregisterAll(); this.commandManager.unregisterAll();
} }
@@ -1,7 +1,7 @@
package cc.carm.plugin.moeteleport.command; package cc.carm.plugin.moeteleport.command;
import cc.carm.lib.easyplugin.command.CommandHandler; import cc.carm.lib.easyplugin.command.CommandHandler;
import cc.carm.plugin.moeteleport.command.parent.*; import cc.carm.plugin.moeteleport.command.sub.*;
import cc.carm.plugin.moeteleport.conf.PluginMessages; import cc.carm.plugin.moeteleport.conf.PluginMessages;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
@@ -1,8 +1,8 @@
package cc.carm.plugin.moeteleport.command.sub; package cc.carm.plugin.moeteleport.command.base;
import cc.carm.lib.easyplugin.command.SubCommand; import cc.carm.lib.easyplugin.command.SubCommand;
import cc.carm.plugin.moeteleport.MoeTeleport; import cc.carm.plugin.moeteleport.MoeTeleport;
import cc.carm.plugin.moeteleport.command.parent.HomeCommands; import cc.carm.plugin.moeteleport.command.sub.HomeCommands;
import cc.carm.plugin.moeteleport.storage.UserData; import cc.carm.plugin.moeteleport.storage.UserData;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@@ -1,8 +1,8 @@
package cc.carm.plugin.moeteleport.command.sub; package cc.carm.plugin.moeteleport.command.base;
import cc.carm.lib.easyplugin.command.SubCommand; import cc.carm.lib.easyplugin.command.SubCommand;
import cc.carm.plugin.moeteleport.MoeTeleport; import cc.carm.plugin.moeteleport.MoeTeleport;
import cc.carm.plugin.moeteleport.command.parent.TeleportCommands; import cc.carm.plugin.moeteleport.command.sub.TeleportCommands;
import cc.carm.plugin.moeteleport.storage.UserData; import cc.carm.plugin.moeteleport.storage.UserData;
import cc.carm.plugin.moeteleport.teleport.TeleportRequest; import cc.carm.plugin.moeteleport.teleport.TeleportRequest;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
@@ -1,8 +1,8 @@
package cc.carm.plugin.moeteleport.command.sub; package cc.carm.plugin.moeteleport.command.base;
import cc.carm.lib.easyplugin.command.SubCommand; import cc.carm.lib.easyplugin.command.SubCommand;
import cc.carm.plugin.moeteleport.MoeTeleport; import cc.carm.plugin.moeteleport.MoeTeleport;
import cc.carm.plugin.moeteleport.command.parent.WarpCommands; import cc.carm.plugin.moeteleport.command.sub.WarpCommands;
import cc.carm.plugin.moeteleport.manager.WarpManager; import cc.carm.plugin.moeteleport.manager.WarpManager;
import cc.carm.plugin.moeteleport.model.WarpInfo; import cc.carm.plugin.moeteleport.model.WarpInfo;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
@@ -1,4 +1,4 @@
package cc.carm.plugin.moeteleport.command.parent; package cc.carm.plugin.moeteleport.command.sub;
import cc.carm.lib.easyplugin.command.SubCommand; import cc.carm.lib.easyplugin.command.SubCommand;
import cc.carm.plugin.moeteleport.MoeTeleport; import cc.carm.plugin.moeteleport.MoeTeleport;
@@ -39,4 +39,9 @@ public class BackCommand extends SubCommand<MainCommands> {
return null; return null;
} }
@Override
public boolean hasPermission(CommandSender sender) {
return sender.hasPermission("MoeTeleport.back");
}
} }
@@ -1,11 +1,8 @@
package cc.carm.plugin.moeteleport.command.parent; package cc.carm.plugin.moeteleport.command.sub;
import cc.carm.lib.easyplugin.command.CommandHandler; import cc.carm.lib.easyplugin.command.CommandHandler;
import cc.carm.plugin.moeteleport.command.MainCommands; import cc.carm.plugin.moeteleport.command.MainCommands;
import cc.carm.plugin.moeteleport.command.home.HomeCreateCommand; import cc.carm.plugin.moeteleport.command.sub.home.*;
import cc.carm.plugin.moeteleport.command.home.HomeDeleteCommand;
import cc.carm.plugin.moeteleport.command.home.HomeListCommand;
import cc.carm.plugin.moeteleport.command.home.HomeTeleportCommand;
import cc.carm.plugin.moeteleport.conf.PluginConfig; import cc.carm.plugin.moeteleport.conf.PluginConfig;
import cc.carm.plugin.moeteleport.conf.PluginMessages; import cc.carm.plugin.moeteleport.conf.PluginMessages;
import org.bukkit.command.Command; import org.bukkit.command.Command;
@@ -26,6 +23,7 @@ public class HomeCommands extends CommandHandler {
registerSubCommand(new HomeListCommand(this, "list", "ls")); registerSubCommand(new HomeListCommand(this, "list", "ls"));
registerSubCommand(new HomeCreateCommand(this, "set", "create")); registerSubCommand(new HomeCreateCommand(this, "set", "create"));
registerSubCommand(new HomeDeleteCommand(this, "delete", "remove", "del")); registerSubCommand(new HomeDeleteCommand(this, "delete", "remove", "del"));
registerSubCommand(new HomeRenameCommand(this, "rename", "rn"));
} }
@@ -50,4 +48,9 @@ public class HomeCommands extends CommandHandler {
return main.noPermission(sender); return main.noPermission(sender);
} }
@Override
public boolean hasPermission(CommandSender sender) {
return sender.hasPermission("MoeTeleport.home");
}
} }
@@ -1,4 +1,4 @@
package cc.carm.plugin.moeteleport.command.parent; package cc.carm.plugin.moeteleport.command.sub;
import cc.carm.lib.easyplugin.command.SubCommand; import cc.carm.lib.easyplugin.command.SubCommand;
import cc.carm.plugin.moeteleport.Main; import cc.carm.plugin.moeteleport.Main;
@@ -35,7 +35,7 @@ public class ReloadCommand extends SubCommand<MainCommands> {
@Override @Override
public boolean hasPermission(CommandSender sender) { public boolean hasPermission(CommandSender sender) {
return sender.hasPermission("moeteleport.reload"); return sender.hasPermission("MoeTeleport.admin");
} }
} }
@@ -1,10 +1,10 @@
package cc.carm.plugin.moeteleport.command.parent; package cc.carm.plugin.moeteleport.command.sub;
import cc.carm.lib.easyplugin.command.CommandHandler; import cc.carm.lib.easyplugin.command.CommandHandler;
import cc.carm.plugin.moeteleport.command.MainCommands; import cc.carm.plugin.moeteleport.command.MainCommands;
import cc.carm.plugin.moeteleport.command.teleport.TeleportCancelCommand; import cc.carm.plugin.moeteleport.command.sub.teleport.TeleportCancelCommand;
import cc.carm.plugin.moeteleport.command.teleport.TeleportHandleCommand; import cc.carm.plugin.moeteleport.command.sub.teleport.TeleportHandleCommand;
import cc.carm.plugin.moeteleport.command.teleport.TeleportRequestCommand; import cc.carm.plugin.moeteleport.command.sub.teleport.TeleportRequestCommand;
import cc.carm.plugin.moeteleport.conf.PluginMessages; import cc.carm.plugin.moeteleport.conf.PluginMessages;
import cc.carm.plugin.moeteleport.teleport.TeleportRequest; import cc.carm.plugin.moeteleport.teleport.TeleportRequest;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
@@ -22,7 +22,7 @@ public class TeleportCommands extends CommandHandler {
registerSubCommand(new TeleportRequestCommand(this, TeleportRequest.Type.TPA_TO, "to")); registerSubCommand(new TeleportRequestCommand(this, TeleportRequest.Type.TPA_TO, "to"));
registerSubCommand(new TeleportRequestCommand(this, TeleportRequest.Type.TPA_HERE, "here")); registerSubCommand(new TeleportRequestCommand(this, TeleportRequest.Type.TPA_HERE, "here"));
registerSubCommand(new TeleportHandleCommand(this, true, "cancel")); registerSubCommand(new TeleportHandleCommand(this, true, "accept", "agree"));
registerSubCommand(new TeleportHandleCommand(this, false, "deny", "refuse")); registerSubCommand(new TeleportHandleCommand(this, false, "deny", "refuse"));
registerSubCommand(new TeleportCancelCommand(this, "cancel")); registerSubCommand(new TeleportCancelCommand(this, "cancel"));
} }
@@ -38,4 +38,9 @@ public class TeleportCommands extends CommandHandler {
return main.noPermission(sender); return main.noPermission(sender);
} }
@Override
public boolean hasPermission(CommandSender sender) {
return sender.hasPermission("MoeTeleport.teleport");
}
} }
@@ -1,8 +1,8 @@
package cc.carm.plugin.moeteleport.command.parent; package cc.carm.plugin.moeteleport.command.sub;
import cc.carm.lib.easyplugin.command.CommandHandler; import cc.carm.lib.easyplugin.command.CommandHandler;
import cc.carm.plugin.moeteleport.command.MainCommands; import cc.carm.plugin.moeteleport.command.MainCommands;
import cc.carm.plugin.moeteleport.command.warp.*; import cc.carm.plugin.moeteleport.command.sub.warp.*;
import cc.carm.plugin.moeteleport.conf.PluginConfig; import cc.carm.plugin.moeteleport.conf.PluginConfig;
import cc.carm.plugin.moeteleport.conf.PluginMessages; import cc.carm.plugin.moeteleport.conf.PluginMessages;
import org.bukkit.command.Command; import org.bukkit.command.Command;
@@ -24,6 +24,7 @@ public class WarpCommands extends CommandHandler {
registerSubCommand(new WarpInfoCommand(this, "info", "i")); registerSubCommand(new WarpInfoCommand(this, "info", "i"));
registerSubCommand(new WarpCreateCommand(this, "set", "create")); registerSubCommand(new WarpCreateCommand(this, "set", "create"));
registerSubCommand(new WarpDeleteCommand(this, "delete", "remove", "del")); registerSubCommand(new WarpDeleteCommand(this, "delete", "remove", "del"));
registerSubCommand(new WarpRenameCommand(this, "rename", "rn"));
} }
@@ -48,4 +49,10 @@ public class WarpCommands extends CommandHandler {
return main.noPermission(sender); return main.noPermission(sender);
} }
@Override
public boolean hasPermission(CommandSender sender) {
return sender.hasPermission("MoeTeleport.warp");
}
} }
@@ -1,9 +1,9 @@
package cc.carm.plugin.moeteleport.command.home; package cc.carm.plugin.moeteleport.command.sub.home;
import cc.carm.lib.easyplugin.command.SimpleCompleter; import cc.carm.lib.easyplugin.command.SimpleCompleter;
import cc.carm.plugin.moeteleport.MoeTeleport; import cc.carm.plugin.moeteleport.MoeTeleport;
import cc.carm.plugin.moeteleport.command.parent.HomeCommands; import cc.carm.plugin.moeteleport.command.sub.HomeCommands;
import cc.carm.plugin.moeteleport.command.sub.HomeSubCommand; import cc.carm.plugin.moeteleport.command.base.HomeSubCommand;
import cc.carm.plugin.moeteleport.conf.PluginMessages; import cc.carm.plugin.moeteleport.conf.PluginMessages;
import cc.carm.plugin.moeteleport.conf.location.DataLocation; import cc.carm.plugin.moeteleport.conf.location.DataLocation;
import cc.carm.plugin.moeteleport.storage.UserData; import cc.carm.plugin.moeteleport.storage.UserData;
@@ -1,7 +1,7 @@
package cc.carm.plugin.moeteleport.command.home; package cc.carm.plugin.moeteleport.command.sub.home;
import cc.carm.plugin.moeteleport.command.parent.HomeCommands; import cc.carm.plugin.moeteleport.command.sub.HomeCommands;
import cc.carm.plugin.moeteleport.command.sub.HomeSubCommand; import cc.carm.plugin.moeteleport.command.base.HomeSubCommand;
import cc.carm.plugin.moeteleport.conf.PluginMessages; import cc.carm.plugin.moeteleport.conf.PluginMessages;
import cc.carm.plugin.moeteleport.conf.location.DataLocation; import cc.carm.plugin.moeteleport.conf.location.DataLocation;
import cc.carm.plugin.moeteleport.storage.UserData; import cc.carm.plugin.moeteleport.storage.UserData;
@@ -1,7 +1,7 @@
package cc.carm.plugin.moeteleport.command.home; package cc.carm.plugin.moeteleport.command.sub.home;
import cc.carm.plugin.moeteleport.command.parent.HomeCommands; import cc.carm.plugin.moeteleport.command.sub.HomeCommands;
import cc.carm.plugin.moeteleport.command.sub.HomeSubCommand; import cc.carm.plugin.moeteleport.command.base.HomeSubCommand;
import cc.carm.plugin.moeteleport.conf.PluginMessages; import cc.carm.plugin.moeteleport.conf.PluginMessages;
import cc.carm.plugin.moeteleport.storage.UserData; import cc.carm.plugin.moeteleport.storage.UserData;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
@@ -0,0 +1,71 @@
package cc.carm.plugin.moeteleport.command.sub.home;
import cc.carm.plugin.moeteleport.command.sub.HomeCommands;
import cc.carm.plugin.moeteleport.command.base.HomeSubCommand;
import cc.carm.plugin.moeteleport.conf.PluginMessages;
import cc.carm.plugin.moeteleport.conf.location.DataLocation;
import cc.carm.plugin.moeteleport.storage.UserData;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
import org.jetbrains.annotations.NotNull;
import java.util.Collections;
import java.util.List;
import java.util.Map;
public class HomeRenameCommand extends HomeSubCommand {
public HomeRenameCommand(@NotNull HomeCommands parent, String name, String... aliases) {
super(parent, name, aliases);
}
@Override
public Void execute(JavaPlugin plugin, CommandSender sender, String[] args) throws Exception {
if (!(sender instanceof Player)) {
PluginMessages.NOT_PLAYER.send(sender);
return null;
}
if (args.length < 2) return getParent().noArgs(sender);
String homeName = args[0];
String newName = args[1];
if (homeName.equals(newName)) return getParent().noArgs(sender);
if (newName.length() > 32) { // 超过家的名字长度限定
PluginMessages.HOME.NAME_TOO_LONG.send(sender);
return null;
}
Player player = (Player) sender;
UserData data = getData(player);
Map.Entry<String, DataLocation> locationInfo = data.getHomeLocation(homeName);
if (locationInfo == null) {
PluginMessages.HOME.NOT_FOUND.send(player);
return null;
}
Map.Entry<String, DataLocation> newInfo = data.getHomeLocation(newName);
if (newInfo != null) {
PluginMessages.HOME.ALREADY_EXITS.send(player);
return null;
}
PluginMessages.HOME.RENAMED.send(player, newName, locationInfo.getKey());
data.setHomeLocation(newName, locationInfo.getValue().getBukkitLocation());
data.delHomeLocation(homeName);
return null;
}
@Override
public List<String> tabComplete(JavaPlugin plugin, CommandSender sender, String[] args) {
if (args.length == 1) {
return listHomes(sender, args[args.length - 1]);
} else return Collections.emptyList();
}
}
@@ -1,8 +1,8 @@
package cc.carm.plugin.moeteleport.command.home; package cc.carm.plugin.moeteleport.command.sub.home;
import cc.carm.plugin.moeteleport.MoeTeleport; import cc.carm.plugin.moeteleport.MoeTeleport;
import cc.carm.plugin.moeteleport.command.parent.HomeCommands; import cc.carm.plugin.moeteleport.command.sub.HomeCommands;
import cc.carm.plugin.moeteleport.command.sub.HomeSubCommand; import cc.carm.plugin.moeteleport.command.base.HomeSubCommand;
import cc.carm.plugin.moeteleport.conf.PluginMessages; import cc.carm.plugin.moeteleport.conf.PluginMessages;
import cc.carm.plugin.moeteleport.conf.location.DataLocation; import cc.carm.plugin.moeteleport.conf.location.DataLocation;
import cc.carm.plugin.moeteleport.storage.UserData; import cc.carm.plugin.moeteleport.storage.UserData;
@@ -1,8 +1,8 @@
package cc.carm.plugin.moeteleport.command.teleport; package cc.carm.plugin.moeteleport.command.sub.teleport;
import cc.carm.plugin.moeteleport.MoeTeleport; import cc.carm.plugin.moeteleport.MoeTeleport;
import cc.carm.plugin.moeteleport.command.parent.TeleportCommands; import cc.carm.plugin.moeteleport.command.sub.TeleportCommands;
import cc.carm.plugin.moeteleport.command.sub.TeleportSubCommand; import cc.carm.plugin.moeteleport.command.base.TeleportSubCommand;
import cc.carm.plugin.moeteleport.conf.PluginMessages; import cc.carm.plugin.moeteleport.conf.PluginMessages;
import cc.carm.plugin.moeteleport.teleport.TeleportRequest; import cc.carm.plugin.moeteleport.teleport.TeleportRequest;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
@@ -1,8 +1,8 @@
package cc.carm.plugin.moeteleport.command.teleport; package cc.carm.plugin.moeteleport.command.sub.teleport;
import cc.carm.plugin.moeteleport.MoeTeleport; import cc.carm.plugin.moeteleport.MoeTeleport;
import cc.carm.plugin.moeteleport.command.parent.TeleportCommands; import cc.carm.plugin.moeteleport.command.sub.TeleportCommands;
import cc.carm.plugin.moeteleport.command.sub.TeleportSubCommand; import cc.carm.plugin.moeteleport.command.base.TeleportSubCommand;
import cc.carm.plugin.moeteleport.conf.PluginMessages; import cc.carm.plugin.moeteleport.conf.PluginMessages;
import cc.carm.plugin.moeteleport.storage.UserData; import cc.carm.plugin.moeteleport.storage.UserData;
import cc.carm.plugin.moeteleport.teleport.TeleportRequest; import cc.carm.plugin.moeteleport.teleport.TeleportRequest;
@@ -1,7 +1,7 @@
package cc.carm.plugin.moeteleport.command.teleport; package cc.carm.plugin.moeteleport.command.sub.teleport;
import cc.carm.plugin.moeteleport.command.parent.TeleportCommands; import cc.carm.plugin.moeteleport.command.sub.TeleportCommands;
import cc.carm.plugin.moeteleport.command.sub.TeleportSubCommand; import cc.carm.plugin.moeteleport.command.base.TeleportSubCommand;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
@@ -1,9 +1,9 @@
package cc.carm.plugin.moeteleport.command.teleport; package cc.carm.plugin.moeteleport.command.sub.teleport;
import cc.carm.lib.easyplugin.command.SimpleCompleter; import cc.carm.lib.easyplugin.command.SimpleCompleter;
import cc.carm.plugin.moeteleport.MoeTeleport; import cc.carm.plugin.moeteleport.MoeTeleport;
import cc.carm.plugin.moeteleport.command.parent.TeleportCommands; import cc.carm.plugin.moeteleport.command.sub.TeleportCommands;
import cc.carm.plugin.moeteleport.command.sub.TeleportSubCommand; import cc.carm.plugin.moeteleport.command.base.TeleportSubCommand;
import cc.carm.plugin.moeteleport.conf.PluginMessages; import cc.carm.plugin.moeteleport.conf.PluginMessages;
import cc.carm.plugin.moeteleport.teleport.TeleportRequest; import cc.carm.plugin.moeteleport.teleport.TeleportRequest;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
@@ -1,9 +1,9 @@
package cc.carm.plugin.moeteleport.command.warp; package cc.carm.plugin.moeteleport.command.sub.warp;
import cc.carm.lib.easyplugin.command.SimpleCompleter; import cc.carm.lib.easyplugin.command.SimpleCompleter;
import cc.carm.plugin.moeteleport.MoeTeleport; import cc.carm.plugin.moeteleport.MoeTeleport;
import cc.carm.plugin.moeteleport.command.parent.WarpCommands; import cc.carm.plugin.moeteleport.command.sub.WarpCommands;
import cc.carm.plugin.moeteleport.command.sub.WarpSubCommand; import cc.carm.plugin.moeteleport.command.base.WarpSubCommand;
import cc.carm.plugin.moeteleport.conf.PluginMessages; import cc.carm.plugin.moeteleport.conf.PluginMessages;
import cc.carm.plugin.moeteleport.model.WarpInfo; import cc.carm.plugin.moeteleport.model.WarpInfo;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
@@ -1,7 +1,7 @@
package cc.carm.plugin.moeteleport.command.warp; package cc.carm.plugin.moeteleport.command.sub.warp;
import cc.carm.plugin.moeteleport.command.parent.WarpCommands; import cc.carm.plugin.moeteleport.command.sub.WarpCommands;
import cc.carm.plugin.moeteleport.command.sub.WarpSubCommand; import cc.carm.plugin.moeteleport.command.base.WarpSubCommand;
import cc.carm.plugin.moeteleport.conf.PluginMessages; import cc.carm.plugin.moeteleport.conf.PluginMessages;
import cc.carm.plugin.moeteleport.model.WarpInfo; import cc.carm.plugin.moeteleport.model.WarpInfo;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
@@ -1,7 +1,7 @@
package cc.carm.plugin.moeteleport.command.warp; package cc.carm.plugin.moeteleport.command.sub.warp;
import cc.carm.plugin.moeteleport.command.parent.WarpCommands; import cc.carm.plugin.moeteleport.command.sub.WarpCommands;
import cc.carm.plugin.moeteleport.command.sub.WarpSubCommand; import cc.carm.plugin.moeteleport.command.base.WarpSubCommand;
import cc.carm.plugin.moeteleport.conf.PluginMessages; import cc.carm.plugin.moeteleport.conf.PluginMessages;
import cc.carm.plugin.moeteleport.model.WarpInfo; import cc.carm.plugin.moeteleport.model.WarpInfo;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
@@ -1,8 +1,8 @@
package cc.carm.plugin.moeteleport.command.warp; package cc.carm.plugin.moeteleport.command.sub.warp;
import cc.carm.lib.easyplugin.command.SimpleCompleter; import cc.carm.lib.easyplugin.command.SimpleCompleter;
import cc.carm.plugin.moeteleport.command.parent.WarpCommands; import cc.carm.plugin.moeteleport.command.sub.WarpCommands;
import cc.carm.plugin.moeteleport.command.sub.WarpSubCommand; import cc.carm.plugin.moeteleport.command.base.WarpSubCommand;
import cc.carm.plugin.moeteleport.conf.PluginMessages; import cc.carm.plugin.moeteleport.conf.PluginMessages;
import cc.carm.plugin.moeteleport.model.WarpInfo; import cc.carm.plugin.moeteleport.model.WarpInfo;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
@@ -0,0 +1,71 @@
package cc.carm.plugin.moeteleport.command.sub.warp;
import cc.carm.plugin.moeteleport.Main;
import cc.carm.plugin.moeteleport.command.sub.WarpCommands;
import cc.carm.plugin.moeteleport.command.base.WarpSubCommand;
import cc.carm.plugin.moeteleport.conf.PluginMessages;
import cc.carm.plugin.moeteleport.model.WarpInfo;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
import org.jetbrains.annotations.NotNull;
import java.util.Collections;
import java.util.List;
public class WarpRenameCommand extends WarpSubCommand {
public WarpRenameCommand(@NotNull WarpCommands parent, String name, String... aliases) {
super(parent, name, aliases);
}
@Override
public Void execute(JavaPlugin plugin, CommandSender sender, String[] args) throws Exception {
if (!(sender instanceof Player)) {
PluginMessages.NOT_PLAYER.send(sender);
return null;
}
if (args.length < 2) return getParent().noArgs(sender);
String oldName = args[0];
String newName = args[1];
if (oldName.equals(newName)) return getParent().noArgs(sender);
if (newName.length() > 16) { // 超过地标的名字长度限定
PluginMessages.WARP.NAME_TOO_LONG.send(sender);
return null;
}
Player player = (Player) sender;
WarpInfo info = getWarp(oldName);
if (info == null) {
PluginMessages.WARP.NOT_FOUND.send(player);
return null;
}
WarpInfo newInfo = getWarp(oldName);
if (newInfo != null) {
PluginMessages.WARP.ALREADY_EXITS.send(player);
return null;
}
PluginMessages.WARP.RENAMED.send(player, newName, info.getLocation());
Main.getInstance().getScheduler().runAsync(() -> {
getManager().setWarp(newName, player.getUniqueId(), info.getLocation());
getManager().delWarp(oldName);
});
return null;
}
@Override
public List<String> tabComplete(JavaPlugin plugin, CommandSender sender, String[] args) {
if (args.length == 1) {
return listWarpNames(sender, args[args.length - 1], true);
} else return Collections.emptyList();
}
}
@@ -1,10 +1,9 @@
package cc.carm.plugin.moeteleport.command.warp; package cc.carm.plugin.moeteleport.command.sub.warp;
import cc.carm.plugin.moeteleport.MoeTeleport; import cc.carm.plugin.moeteleport.MoeTeleport;
import cc.carm.plugin.moeteleport.command.parent.WarpCommands; import cc.carm.plugin.moeteleport.command.sub.WarpCommands;
import cc.carm.plugin.moeteleport.command.sub.WarpSubCommand; import cc.carm.plugin.moeteleport.command.base.WarpSubCommand;
import cc.carm.plugin.moeteleport.conf.PluginMessages; import cc.carm.plugin.moeteleport.conf.PluginMessages;
import cc.carm.plugin.moeteleport.manager.TeleportManager;
import cc.carm.plugin.moeteleport.model.WarpInfo; import cc.carm.plugin.moeteleport.model.WarpInfo;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@@ -54,6 +54,7 @@ public class PluginConfig extends ConfigurationRoot {
map.put("delHome", "home delete"); map.put("delHome", "home delete");
map.put("listHomes", "home list"); map.put("listHomes", "home list");
map.put("listHome", "home list"); map.put("listHome", "home list");
map.put("renameHome", "home rename");
map.put("warp", "warp to"); map.put("warp", "warp to");
map.put("setWarp", "warp set"); map.put("setWarp", "warp set");
@@ -61,6 +62,7 @@ public class PluginConfig extends ConfigurationRoot {
map.put("warpInfo", "warp info"); map.put("warpInfo", "warp info");
map.put("listWarps", "warp list"); map.put("listWarps", "warp list");
map.put("listWarp", "warp list"); map.put("listWarp", "warp list");
map.put("renameWarp", "warp rename");
}).build(); }).build();
} }
@@ -1,7 +1,9 @@
package cc.carm.plugin.moeteleport.conf; package cc.carm.plugin.moeteleport.conf;
import cc.carm.lib.configuration.core.ConfigurationRoot; import cc.carm.lib.configuration.core.ConfigurationRoot;
import cc.carm.lib.configuration.core.annotation.HeaderComment;
import cc.carm.lib.easyplugin.utils.ColorParser; import cc.carm.lib.easyplugin.utils.ColorParser;
import cc.carm.lib.easyplugin.utils.MessageUtils;
import cc.carm.lib.mineconfiguration.bukkit.builder.message.CraftMessageListBuilder; import cc.carm.lib.mineconfiguration.bukkit.builder.message.CraftMessageListBuilder;
import cc.carm.lib.mineconfiguration.bukkit.builder.message.CraftMessageValueBuilder; import cc.carm.lib.mineconfiguration.bukkit.builder.message.CraftMessageValueBuilder;
import cc.carm.lib.mineconfiguration.bukkit.builder.title.TitleConfigBuilder; import cc.carm.lib.mineconfiguration.bukkit.builder.title.TitleConfigBuilder;
@@ -9,14 +11,19 @@ import cc.carm.lib.mineconfiguration.bukkit.value.ConfiguredMessage;
import cc.carm.lib.mineconfiguration.bukkit.value.ConfiguredMessageList; import cc.carm.lib.mineconfiguration.bukkit.value.ConfiguredMessageList;
import cc.carm.lib.mineconfiguration.bukkit.value.ConfiguredTitle; import cc.carm.lib.mineconfiguration.bukkit.value.ConfiguredTitle;
import de.themoep.minedown.MineDown; import de.themoep.minedown.MineDown;
import me.clip.placeholderapi.PlaceholderAPI;
import net.md_5.bungee.api.chat.BaseComponent; import net.md_5.bungee.api.chat.BaseComponent;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import java.util.function.BiFunction; import java.util.function.BiFunction;
@HeaderComment({
"MoeTeleport 传送插件的消息配置文件",
"如特定的消息不需要任何提示,可直接留下单行空内容消息。",
"支持 支持 &+颜色代码(原版颜色)、§(#XXXXXX)(RGB颜色) 与 &<#XXXXXX>(前后标注RGB颜色渐变)。",
" "
})
public class PluginMessages extends ConfigurationRoot { public class PluginMessages extends ConfigurationRoot {
public static @NotNull CraftMessageListBuilder<BaseComponent[]> list() { public static @NotNull CraftMessageListBuilder<BaseComponent[]> list() {
@@ -34,10 +41,7 @@ public class PluginMessages extends ConfigurationRoot {
} }
public static @NotNull BiFunction<CommandSender, String, BaseComponent[]> getParser() { public static @NotNull BiFunction<CommandSender, String, BaseComponent[]> getParser() {
return (sender, message) -> { return (sender, message) -> MineDown.parse(ColorParser.parse(MessageUtils.setPlaceholders(sender, message)));
if (sender instanceof Player) message = PlaceholderAPI.setPlaceholders((Player) sender, message);
return MineDown.parse(ColorParser.parse(message));
};
} }
public static final ConfiguredMessageList<BaseComponent[]> NO_PERMISSION = list().defaults( public static final ConfiguredMessageList<BaseComponent[]> NO_PERMISSION = list().defaults(
@@ -95,7 +99,9 @@ public class PluginMessages extends ConfigurationRoot {
"&8-&7&o 若地标点已存在,且您是地标点的设立者,", "&8-&7&o 若地标点已存在,且您是地标点的设立者,",
"&8-&7&o 则会覆盖原有的地标点位置。", "&8-&7&o 则会覆盖原有的地标点位置。",
"&8#&f warp delete &d[地标名]", "&8#&f warp delete &d[地标名]",
"&8-&7 删除一个自己设立的地标点。" "&8-&7 删除一个自己设立的地标点。",
"&8#&f warp rename &d<原地标名> &d<新地标名>",
"&8-&7 重命名一个自己设立的地标点。"
).build(); ).build();
public static final ConfiguredMessageList<BaseComponent[]> HOMES = list().defaults( public static final ConfiguredMessageList<BaseComponent[]> HOMES = list().defaults(
@@ -110,7 +116,9 @@ public class PluginMessages extends ConfigurationRoot {
"&8-&7 设定一个家的位置。", "&8-&7 设定一个家的位置。",
"&8-&7&o 若不填写家的名称则默认为“home”", "&8-&7&o 若不填写家的名称则默认为“home”",
"&8#&f home delete &d[家名]", "&8#&f home delete &d[家名]",
"&8-&7 删除一个家的位置。" "&8-&7 删除一个家的位置。",
"&8#&f home rename &d<原家名> &d<新家名>",
"&8-&7 重命名一个家传送点的名称。"
).build(); ).build();
} }
@@ -257,6 +265,11 @@ public class PluginMessages extends ConfigurationRoot {
"&7或输入 &5/setHome <家名称> &7覆盖之前的家传送点。" "&7或输入 &5/setHome <家名称> &7覆盖之前的家传送点。"
).params("max").build(); ).params("max").build();
public static final ConfiguredMessageList<BaseComponent[]> ALREADY_EXITS = list()
.defaults("&f您已存在名为 &d%(name) &f的家传送点,换个名字叭~")
.params("name")
.build();
public static final ConfiguredMessageList<BaseComponent[]> NOT_FOUND = list() public static final ConfiguredMessageList<BaseComponent[]> NOT_FOUND = list()
.defaults("&f您还没有设置这个家,请先输入 &5/setHome <家名称> &f设置一个吧!") .defaults("&f您还没有设置这个家,请先输入 &5/setHome <家名称> &f设置一个吧!")
.build(); .build();
@@ -275,6 +288,10 @@ public class PluginMessages extends ConfigurationRoot {
"&8原先位置为 &5%(location) &8。" "&8原先位置为 &5%(location) &8。"
).params("name", "location").build(); ).params("name", "location").build();
public static final ConfiguredMessageList<BaseComponent[]> RENAMED = list().defaults(
"&f成功以 &d%(newName) 重命名原先的家传送点 &d&o%(oldName) &f。"
).params("newName", "oldName").build();
public static class LIST extends ConfigurationRoot { public static class LIST extends ConfigurationRoot {
public static final ConfiguredMessageList<BaseComponent[]> HEADER = list().defaults( public static final ConfiguredMessageList<BaseComponent[]> HEADER = list().defaults(
@@ -336,6 +353,14 @@ public class PluginMessages extends ConfigurationRoot {
"&8原先位置为 &5%(location) &8。" "&8原先位置为 &5%(location) &8。"
).params("name", "location").build(); ).params("name", "location").build();
public static final ConfiguredMessageList<BaseComponent[]> ALREADY_EXITS = list()
.defaults("&f已存在名为 &d%(name) &f的地标点,换个名字叭~")
.params("name")
.build();
public static final ConfiguredMessageList<BaseComponent[]> RENAMED = list().defaults(
"&f成功以 &d%(newName) 重命名原先的地标点 &d&o%(oldName) &f。"
).params("newName", "oldName").build();
public static class LIST extends ConfigurationRoot { public static class LIST extends ConfigurationRoot {
@@ -1,8 +0,0 @@
package cc.carm.plugin.moeteleport.effect;
public class TeleportEffect {
}
@@ -1,122 +0,0 @@
package cc.carm.plugin.moeteleport.manager;
import cc.carm.plugin.moeteleport.Main;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.command.SimpleCommandMap;
import org.bukkit.plugin.SimplePluginManager;
import org.bukkit.plugin.java.JavaPlugin;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.lang.reflect.Field;
import java.util.*;
public class CommandManager {
protected final JavaPlugin plugin;
protected final SimpleCommandMap commandMap;
protected final Field knownCommandsFiled;
protected final Map<String, AliasCommand> registeredCommands = new HashMap<>();
public CommandManager(JavaPlugin plugin) throws Exception {
this.plugin = plugin;
SimplePluginManager manager = (SimplePluginManager) Bukkit.getPluginManager();
Field commandMapField = SimplePluginManager.class.getDeclaredField("commandMap");
commandMapField.setAccessible(true);
this.commandMap = (SimpleCommandMap) commandMapField.get(manager);
this.knownCommandsFiled = SimpleCommandMap.class.getDeclaredField("knownCommands");
this.knownCommandsFiled.setAccessible(true);
}
@SuppressWarnings("unchecked")
protected Map<String, Command> getKnownCommands() {
try {
return (Map<String, Command>) knownCommandsFiled.get(commandMap);
} catch (IllegalAccessException e) {
e.printStackTrace();
}
return new HashMap<>();
}
public String getPrefix() {
return this.plugin.getName().toLowerCase() + " ";
}
protected SimpleCommandMap getCommandMap() {
return commandMap;
}
public void register(String alias, String target) {
AliasCommand current = this.registeredCommands.get(alias);
if (current != null) current.unregister(getCommandMap());
AliasCommand cmd = new AliasCommand(alias, this, getPrefix() + target);
this.registeredCommands.put(alias, cmd);
getCommandMap().register(Main.getInstance().getName(), cmd);
}
public void unregister(String alias) {
AliasCommand current = this.registeredCommands.remove(alias);
if (current != null) {
getKnownCommands().remove(alias);
current.unregister(getCommandMap());
}
}
public void unregisterAll() {
registeredCommands.forEach((k, v) -> {
getKnownCommands().remove(k);
v.unregister(getCommandMap());
});
registeredCommands.clear();
}
public static class AliasCommand extends Command {
protected final CommandManager commandManager;
protected final String targetCommand;
public AliasCommand(String name, CommandManager commandManager, String targetCommand) {
super(name);
this.commandManager = commandManager;
this.targetCommand = targetCommand;
}
protected SimpleCommandMap getCommandMap() {
return this.commandManager.getCommandMap();
}
protected String buildCommand(String[] args) {
return this.targetCommand + " " + String.join(" ", args);
}
@Override
public boolean execute(@NotNull CommandSender sender, @NotNull String commandLabel, @NotNull String[] args) {
return getCommandMap().dispatch(sender, buildCommand(args));
}
@NotNull
@Override
public List<String> tabComplete(@NotNull CommandSender sender, @NotNull String alias,
@NotNull String[] args, @Nullable Location location) throws IllegalArgumentException {
return Optional.ofNullable(getCommandMap().tabComplete(sender, buildCommand(args))).orElse(Collections.emptyList());
}
@NotNull
@Override
public List<String> tabComplete(@NotNull CommandSender sender, @NotNull String alias, @NotNull String[] args) throws IllegalArgumentException {
return tabComplete(sender, alias, args, null);
}
}
}
@@ -104,12 +104,11 @@ public class RequestManager {
} }
public void cancelRequest(TeleportRequest request) { public void cancelRequest(TeleportRequest request) {
PluginMessages.REQUESTS.WAS_ACCEPTED.send(request.getSender(), request.getReceiver().getName()); PluginMessages.REQUESTS.SENT_CANCELLED.send(request.getSender(), request.getReceiver().getName());
PluginMessages.REQUESTS.ACCEPTED.send(request.getReceiver(), request.getSender().getName()); PluginMessages.REQUESTS.RECEIVED_CANCELLED.send(request.getReceiver(), request.getSender().getName());
PluginConfig.REQUEST.SOUND.CANCELLED.playTo(request.getSender()); PluginConfig.REQUEST.SOUND.CANCELLED.playTo(request.getSender());
PluginConfig.REQUEST.SOUND.CANCELLED.playTo(request.getReceiver()); PluginConfig.REQUEST.SOUND.CANCELLED.playTo(request.getReceiver());
removeRequests(request); removeRequests(request);
MoeTeleport.getTeleportManager().queueTeleport(request);
} }
public void denyRequest(TeleportRequest request) { public void denyRequest(TeleportRequest request) {
+17 -5
View File
@@ -13,18 +13,30 @@ softdepend:
- CMI - CMI
permissions: permissions:
"MoeTeleport":
description: "插件的主权限节点"
default: false
"MoeTeleport.admin": "MoeTeleport.admin":
description: "插件的管理员权限节点" description: "插件的管理员权限节点"
default: op default: op
"MoeTeleport.teleport":
description: "使用传送请求相关指令的权限。"
default: true
"MoeTeleport.home":
description: "使用家相关指令的权限。"
default: true
"MoeTeleport.warp":
description: "使用传送请求相关指令的权限。"
default: true
"MoeTeleport.back":
description: "使用返回相关指令的权限。"
default: true
commands: commands:
"MoeTeleport": "MoeTeleport":
description: "插件的主命令,用于重载插件或查看插件信息。" description: "插件的主命令,用于重载插件或查看插件信息。"
permission: "MoeTeleport.admin" usage: "您可以输入 /MoeTeleport help 查看插件的相关帮助。"
usage: "/MoeTeleport reload"
aliases: aliases:
- mt - mt