mirror of
https://github.com/geekfrog/PermissionsTime.git
synced 2024-11-24 17:11:26 +00:00
分离称号系统
修复bug
This commit is contained in:
parent
8e9989d47c
commit
f169154e40
44
README.md
44
README.md
@ -1,47 +1,30 @@
|
|||||||
# PermissionsTime
|
# PermissionsTime
|
||||||
### 支持跨服的权限限时插件(+称号功能)
|
### 支持跨服的权限限时插件
|
||||||
|
##### PermissionsTime插件下载地址:[https://ci.frog.gg/job/PermissionsTime/](https://ci.frog.gg/job/PermissionsTime/)
|
||||||
|
|
||||||
##### [插件使用说明](https://github.com/geekfrog/PermissionsTime/wiki/PermissionsTime-%E4%BD%BF%E7%94%A8%E8%AF%B4%E6%98%8E)
|
##### [插件使用说明](https://github.com/geekfrog/PermissionsTime/wiki/PermissionsTime-%E4%BD%BF%E7%94%A8%E8%AF%B4%E6%98%8E)
|
||||||
##### 构建地址:[http://ci.frog.gg/](http://ci.frog.gg/)
|
##### 前置插件FrogsPluginLib(宅宅蛙的插件前置库)
|
||||||
##### 前置插件Vault下载地址:[https://dev.bukkit.org/projects/vault/](https://dev.bukkit.org/projects/vault/)
|
下载地址:[https://ci.frog.gg/job/FrogsPluginLib/](https://ci.frog.gg/job/FrogsPluginLib/)
|
||||||
##### 前置插件SQLibrary下载地址:[https://dev.bukkit.org/projects/sqlibrary/](https://dev.bukkit.org/projects/sqlibrary/)
|
|
||||||
|
##### 前置插件Vault
|
||||||
|
下载地址:[https://dev.bukkit.org/projects/vault/](https://dev.bukkit.org/projects/vault/)
|
||||||
|
|
||||||
|
### 可选前置插件:
|
||||||
|
##### 前置插件PlaceholderAPI下载地址:[https://www.spigotmc.org/resources/placeholderapi.6245/](https://www.spigotmc.org/resources/placeholderapi.6245/)
|
||||||
|
|
||||||
本插件并非权限插件, 而是权限扩展插件. 可以限制权限和权限组的使用时间.
|
本插件并非权限插件, 而是权限扩展插件. 可以限制权限和权限组的使用时间.
|
||||||
|
|
||||||
使用时必须同时使用Vault及SQLibrary两个前置插件.
|
使用时必须同时使用FrogsPluginLib及Vault两个前置插件.
|
||||||
|
|
||||||
使用跨服权限, 要在配置文件里开启MySQl功能.
|
使用跨服权限, 要在配置文件里开启MySQl功能.
|
||||||
|
|
||||||
经测试支持大部分1.7.10-1.12的服务器. 其他版本未做测试.
|
经测试支持大部分1.7.10-1.12的服务器. 其他版本未做测试.
|
||||||
|
|
||||||
本插件增加了称号管理功能,默认情况下为关闭状态.(2018-06-15)
|
|
||||||
|
|
||||||
#### 插件截图:
|
#### 插件截图:
|
||||||
![image](http://i.imgur.com/cnnd5hb.jpg)
|
![image](http://i.imgur.com/cnnd5hb.jpg)
|
||||||
![image](http://i.imgur.com/bqvIVvz.jpg)
|
![image](http://i.imgur.com/bqvIVvz.jpg)
|
||||||
![image](http://i.imgur.com/NFK3WKa.jpg)
|
![image](http://i.imgur.com/NFK3WKa.jpg)
|
||||||
|
|
||||||
#### 称号功能:
|
|
||||||
<details>
|
|
||||||
<summary>查看详细</summary></br>
|
|
||||||
1.支持Placeholder变量、HolographicDisplays显示称号(解决称号长度限制问题)</br>
|
|
||||||
2.可以设置称号功能开关、默认称号、是否 修改displayname、是否使用HolographicDisplays、以及称号刷新时间(使用Placeholder变量的话)</br>
|
|
||||||
3.自带Placeholder变量: %pttag_fullname% %pttag_prefix% %pttag_suffix% 来显示displayname、prefix+color、suffix</br>
|
|
||||||
|
|
||||||
![image](http://i.imgur.com/o7tZTQp.jpg)
|
|
||||||
![image](http://i.imgur.com//E3SNYNj.jpg)
|
|
||||||
|
|
||||||
![image](http://i.imgur.com/zRAOpFf.jpg)
|
|
||||||
![image](http://i.imgur.com/tP66jxF.jpg)
|
|
||||||
|
|
||||||
![image](http://i.imgur.com/FGxa96D.jpg)
|
|
||||||
![image](http://i.imgur.com/ovCir3l.jpg)
|
|
||||||
![image](http://i.imgur.com/1oel29B.jpg)
|
|
||||||
|
|
||||||
![image](http://i.imgur.com/w702i9I.jpg)
|
|
||||||
|
|
||||||
</details>
|
|
||||||
|
|
||||||
#### 已知问题(作者提醒):
|
#### 已知问题(作者提醒):
|
||||||
|
|
||||||
- 如果出现问题一般退出服务器重进就能解决。一次不行再来一次。
|
- 如果出现问题一般退出服务器重进就能解决。一次不行再来一次。
|
||||||
@ -74,12 +57,7 @@
|
|||||||
- **玩家登录时删除过期的或无效数据**
|
- **玩家登录时删除过期的或无效数据**
|
||||||
- **提示剩余时间**
|
- **提示剩余时间**
|
||||||
- **权限包到期可执行自定义命令**
|
- **权限包到期可执行自定义命令**
|
||||||
- **增加称号管理功能**
|
|
||||||
- 取消前置插件
|
|
||||||
|
|
||||||
|
|
||||||
- 支持分页?
|
- 支持分页?
|
||||||
- 数据迁移?
|
|
||||||
|
|
||||||
#### 使用统计:
|
#### 使用统计:
|
||||||
[https://bstats.org/plugin/bukkit/PermissionsTime](https://bstats.org/plugin/bukkit/PermissionsTime)
|
[https://bstats.org/plugin/bukkit/PermissionsTime](https://bstats.org/plugin/bukkit/PermissionsTime)
|
||||||
|
@ -1,33 +0,0 @@
|
|||||||
# 插件前缀.
|
|
||||||
# Plugin prefix.
|
|
||||||
pluginPrefix: '&4[&bPermissions Time&4] '
|
|
||||||
# 是否开启DEBUG模式.
|
|
||||||
# Whether to open the DEBUG mode.
|
|
||||||
debug: false
|
|
||||||
# 是否同意插件上传统计信息.
|
|
||||||
# Whether or not you agree with the plugin to upload statistics.
|
|
||||||
metrics: true
|
|
||||||
# 开启称号系统.
|
|
||||||
# Use prefix system.
|
|
||||||
tagSystem: false
|
|
||||||
# 语言文件名称 在'lang'文件夹内.
|
|
||||||
# Language file name.
|
|
||||||
lang: zh-cn
|
|
||||||
# 数据库相关.
|
|
||||||
# Database settings.
|
|
||||||
mysql:
|
|
||||||
# 是否使用MySQL数据库.
|
|
||||||
# Use the MySQL database?
|
|
||||||
enable: false
|
|
||||||
# 服务器唯一标识, 用来区分权限是哪个服务器的.
|
|
||||||
# 想要权限跨服,serverId必须一致.
|
|
||||||
# Server ID.
|
|
||||||
serverId: default
|
|
||||||
hostname: localhost
|
|
||||||
port: 3306
|
|
||||||
database: minecraft
|
|
||||||
username: user
|
|
||||||
password: '123456'
|
|
||||||
# 数据库表前缀
|
|
||||||
# Database table prefix.
|
|
||||||
tablePrefix: pt_
|
|
@ -1,49 +0,0 @@
|
|||||||
# 配置文件版本.
|
|
||||||
# Config version.
|
|
||||||
version: 1.00
|
|
||||||
# 默认权限组.
|
|
||||||
# Default permission group.
|
|
||||||
defaultGroup: Default
|
|
||||||
packages:
|
|
||||||
# 权限包名称.
|
|
||||||
# Permission package name.
|
|
||||||
example1:
|
|
||||||
# 权限包显示名称.
|
|
||||||
# Permission package display name.
|
|
||||||
displayName: '&4Test Package'
|
|
||||||
# 显示的物品类型.
|
|
||||||
# 可以使用id, 但不可与type同时使用.
|
|
||||||
# 可以定义物品的种类, 特殊的如头颅可以指定哪个玩家的头颅.
|
|
||||||
# Show the type of item.
|
|
||||||
# You can use 'id', but you can't use 'type' at the same time.
|
|
||||||
# You can define the type of item, such as skull can set which player's head.
|
|
||||||
#id: 397
|
|
||||||
#type: SKULL_ITEM:5
|
|
||||||
#type: SKULL_ITEM:MHF_Present1
|
|
||||||
type: NETHER_STAR
|
|
||||||
# 是否有附魔发光的特效
|
|
||||||
glowing: false
|
|
||||||
# 标签.
|
|
||||||
# Lores.
|
|
||||||
lores:
|
|
||||||
- '&2This is a test lore.'
|
|
||||||
# 是否跨服权限?
|
|
||||||
# Is multiple server permission?
|
|
||||||
global: false
|
|
||||||
# 权限包含有的权限 world1、world2、world3是赋值给玩家permission2权限的世界.
|
|
||||||
# 如果所有世界都赋值权限则不用注明世界名称如:permission1.
|
|
||||||
# Package contain permissions.
|
|
||||||
# Add ':world1' at the end can restrict permissions used in 'world1'.
|
|
||||||
permissions:
|
|
||||||
- permission1
|
|
||||||
- permission2:world1:world2:world3
|
|
||||||
# 权限包含有的权限组.
|
|
||||||
# Package contain groups.
|
|
||||||
groups:
|
|
||||||
- group1
|
|
||||||
- group2:world1
|
|
||||||
# 权限包过期后执行的控制台命令
|
|
||||||
# Package expire console commands.
|
|
||||||
expireCommands:
|
|
||||||
- 'say %player% 的权限包到期了.'
|
|
||||||
- 'say 请及时续期.'
|
|
@ -1,59 +0,0 @@
|
|||||||
name: ${project.name}
|
|
||||||
version: 0.4.3-SNAPSHOT-b1005
|
|
||||||
main: gg.frog.mc.base.PluginMain
|
|
||||||
author:
|
|
||||||
- GeekFrog
|
|
||||||
description: ${project.description}
|
|
||||||
softdepend:
|
|
||||||
- SQLibrary
|
|
||||||
- Vault
|
|
||||||
- PlaceholderAPI
|
|
||||||
- HolographicDisplays
|
|
||||||
commands:
|
|
||||||
permissionstime:
|
|
||||||
description: Show all commands.
|
|
||||||
usage: /permissionstime [param]
|
|
||||||
pt:
|
|
||||||
description: Aliases commands for permissionstime.
|
|
||||||
usage: /pt [param]
|
|
||||||
permissions:
|
|
||||||
gg.frog.permissionstime.*:
|
|
||||||
description: Gives access to all PermissionsTime commands.
|
|
||||||
default: op
|
|
||||||
children:
|
|
||||||
permissionstime.me: true
|
|
||||||
permissionstime.tag: true
|
|
||||||
permissionstime.reload: true
|
|
||||||
permissionstime.give: true
|
|
||||||
permissionstime.set: true
|
|
||||||
permissionstime.get: true
|
|
||||||
permissionstime.remove: true
|
|
||||||
permissionstime.removeall: true
|
|
||||||
permissionstime.packages: true
|
|
||||||
permissionstime.me:
|
|
||||||
description: View your packages.
|
|
||||||
default: true
|
|
||||||
permissionstime.tag:
|
|
||||||
description: Set your color/prefix/suffix of tags.
|
|
||||||
default: true
|
|
||||||
permissionstime.reload:
|
|
||||||
description: Reloads the config file.
|
|
||||||
default: op
|
|
||||||
permissionstime.give:
|
|
||||||
description: Give player package some time.
|
|
||||||
default: op
|
|
||||||
permissionstime.set:
|
|
||||||
description: Set player package some time.
|
|
||||||
default: op
|
|
||||||
permissionstime.get:
|
|
||||||
description: View player packages.
|
|
||||||
default: op
|
|
||||||
permissionstime.remove:
|
|
||||||
description: Remove player package.
|
|
||||||
default: op
|
|
||||||
permissionstime.removeall:
|
|
||||||
description: Remove player all package.
|
|
||||||
default: op
|
|
||||||
permissionstime.packages:
|
|
||||||
description: View packages.
|
|
||||||
default: op
|
|
@ -1,86 +0,0 @@
|
|||||||
# 默认昵称样式.
|
|
||||||
# Default Name Color.
|
|
||||||
defaultNamecolor: '&6'
|
|
||||||
# 默认前缀.
|
|
||||||
# Default Prefix.
|
|
||||||
defaultPrefix: '&3[player]'
|
|
||||||
# 默认后缀.
|
|
||||||
# Default Suffix.
|
|
||||||
defaultSuffix: ''
|
|
||||||
# 如果你有其他的插件来修改玩家的displayname, 请禁用此项或禁止其他插件修改. 比如Essentials插件.
|
|
||||||
# 如果安装了PlaceholderAPI 可以使用
|
|
||||||
# %pttag_fullname% %pttag_prefix% %pttag_suffix% 来显示displayname prefix+color suffix
|
|
||||||
# If you have other plugin, to modifies player displayname, please disable this.
|
|
||||||
changeDisplayname: true
|
|
||||||
# 使用HolographicDisplays显示称号. 称号可以更长,不会被省略.
|
|
||||||
# use HolographicDisplays to show Tags. The Tag can be more than 16 char
|
|
||||||
useHdPlugin: false
|
|
||||||
# 如果使用了HD, 是否一行显示
|
|
||||||
# One line display the name and tags.
|
|
||||||
oneLineDisplay: true
|
|
||||||
# 称号刷新周期(秒).
|
|
||||||
# 如果你你的称号使用了PlaceholderAPI请设置此项
|
|
||||||
# 推荐600秒以上. 设置-1则禁用刷新.
|
|
||||||
# Title refresh cycle (seconds).
|
|
||||||
# If you use Placeholder, please set.
|
|
||||||
# Recommend more than 600s. Set -1 to disable refresh.
|
|
||||||
refreshTagTime: -1
|
|
||||||
template:
|
|
||||||
lore:
|
|
||||||
- '&1-----------------'
|
|
||||||
- '&2Preview:'
|
|
||||||
- '&3 %displayname%'
|
|
||||||
- '&4-----------------'
|
|
||||||
- '&5 %description%'
|
|
||||||
- '&6-----------------'
|
|
||||||
packages:
|
|
||||||
# 称号包名称.
|
|
||||||
# Tag package name.
|
|
||||||
default:
|
|
||||||
description: '&4The default tag.'
|
|
||||||
permissions: ''
|
|
||||||
namecolor:
|
|
||||||
- '&6'
|
|
||||||
prefix:
|
|
||||||
- '&3[player]'
|
|
||||||
example1:
|
|
||||||
# 称号包描述,可以填写如何获得这些称号.
|
|
||||||
# Tag package describes. You can type how to get these tag.
|
|
||||||
description: '&4Tag package description.'
|
|
||||||
# 称号包所需权限. 不需要权限请留空,输入 ''
|
|
||||||
# Tag package needs permission. Keep null to make no permission.
|
|
||||||
permissions: ''
|
|
||||||
# 称号包所含的昵称样式.
|
|
||||||
# Name Colors.
|
|
||||||
namecolor:
|
|
||||||
- '&3'
|
|
||||||
- '&4:SKULL_ITEM:5'
|
|
||||||
- '&5:SKULL_ITEM:MHF_Present1'
|
|
||||||
# 称号包所含的昵称前缀.
|
|
||||||
# Name prefix.
|
|
||||||
prefix:
|
|
||||||
- '&3[prefix]'
|
|
||||||
- '&4[prefix]:1'
|
|
||||||
# 称号包所含的昵称后缀.
|
|
||||||
# Name suffix.
|
|
||||||
suffix:
|
|
||||||
- '&3[suffix]'
|
|
||||||
- '&4[suffix]:1:6'
|
|
||||||
vip:
|
|
||||||
description: '&4VIP Tags.'
|
|
||||||
permissions: 'player.vip'
|
|
||||||
namecolor:
|
|
||||||
- '&3&l'
|
|
||||||
- '&4&n:SKULL_ITEM:5'
|
|
||||||
- '&5&o:SKULL_ITEM:MHF_Present1'
|
|
||||||
# 称号包所含的昵称前缀.
|
|
||||||
# Name prefix.
|
|
||||||
prefix:
|
|
||||||
- '&3&l[prefix]'
|
|
||||||
- '&4&n[prefix]:1'
|
|
||||||
# 称号包所含的昵称后缀.
|
|
||||||
# Name suffix.
|
|
||||||
suffix:
|
|
||||||
- '&3&o[suffix]'
|
|
||||||
- '&4&l&n[suffix]:1:6'
|
|
||||||
|
|
42
pom.xml
42
pom.xml
@ -5,7 +5,7 @@
|
|||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>gg.frog.mc</groupId>
|
<groupId>gg.frog.mc</groupId>
|
||||||
<artifactId>permissionstime</artifactId>
|
<artifactId>permissionstime</artifactId>
|
||||||
<version>0.4.3-SNAPSHOT-b1005</version>
|
<version>0.4.3-SNAPSHOT-b1006</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
<name>PermissionsTime</name>
|
<name>PermissionsTime</name>
|
||||||
<description>支持跨服的权限限时插件</description>
|
<description>支持跨服的权限限时插件</description>
|
||||||
@ -18,12 +18,16 @@
|
|||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
</properties>
|
</properties>
|
||||||
<repositories>
|
<repositories>
|
||||||
|
<repository>
|
||||||
|
<id>Frog Nexus Repository</id>
|
||||||
|
<url>https://maven.frog.gg/repository/maven-public/</url>
|
||||||
|
</repository>
|
||||||
<repository>
|
<repository>
|
||||||
<id>spigotmc-repo</id>
|
<id>spigotmc-repo</id>
|
||||||
<url>https://hub.spigotmc.org/nexus/content/groups/public/</url>
|
<url>https://hub.spigotmc.org/nexus/content/groups/public/</url>
|
||||||
</repository>
|
</repository>
|
||||||
<repository>
|
<repository>
|
||||||
<id>dakani</id>
|
<id>dakani-repo</id>
|
||||||
<name>Dakani Nexus Repo</name>
|
<name>Dakani Nexus Repo</name>
|
||||||
<url>https://repo.dakanilabs.com/repository/public/</url>
|
<url>https://repo.dakanilabs.com/repository/public/</url>
|
||||||
</repository>
|
</repository>
|
||||||
@ -36,15 +40,20 @@
|
|||||||
<url>http://repo.bstats.org/content/repositories/releases/</url>
|
<url>http://repo.bstats.org/content/repositories/releases/</url>
|
||||||
</repository>
|
</repository>
|
||||||
<repository>
|
<repository>
|
||||||
<id>placeholderapi</id>
|
<id>extendedclip-repo</id>
|
||||||
<url>http://repo.extendedclip.com/content/repositories/placeholderapi/</url>
|
<url>http://repo.extendedclip.com/content/repositories/placeholderapi/</url>
|
||||||
</repository>
|
</repository>
|
||||||
<repository>
|
<repository>
|
||||||
<id>HD</id>
|
<id>filoghost-repo</id>
|
||||||
<url>https://ci.filoghost.me/plugin/repository/everything/</url>
|
<url>https://ci.filoghost.me/plugin/repository/everything/</url>
|
||||||
</repository>
|
</repository>
|
||||||
</repositories>
|
</repositories>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>gg.frog.mc</groupId>
|
||||||
|
<artifactId>base</artifactId>
|
||||||
|
<version>LATEST</version>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.bukkit</groupId>
|
<groupId>org.bukkit</groupId>
|
||||||
<artifactId>bukkit</artifactId>
|
<artifactId>bukkit</artifactId>
|
||||||
@ -87,6 +96,17 @@
|
|||||||
<resource>
|
<resource>
|
||||||
<directory>src/resources</directory>
|
<directory>src/resources</directory>
|
||||||
<filtering>true</filtering>
|
<filtering>true</filtering>
|
||||||
|
<includes>
|
||||||
|
<include>*.yml</include>
|
||||||
|
<include>lang/*.yml</include>
|
||||||
|
</includes>
|
||||||
|
</resource>
|
||||||
|
<resource>
|
||||||
|
<directory>src/resources</directory>
|
||||||
|
<filtering>false</filtering>
|
||||||
|
<includes>
|
||||||
|
<include>lib/*.jar</include>
|
||||||
|
</includes>
|
||||||
</resource>
|
</resource>
|
||||||
<resource>
|
<resource>
|
||||||
<targetPath>.</targetPath>
|
<targetPath>.</targetPath>
|
||||||
@ -137,7 +157,7 @@
|
|||||||
</artifactSet>
|
</artifactSet>
|
||||||
<relocations>
|
<relocations>
|
||||||
<relocation>
|
<relocation>
|
||||||
<pattern>org.bstats</pattern>
|
<pattern>org.bstats.bukkit</pattern>
|
||||||
<!-- Replace this with your package! -->
|
<!-- Replace this with your package! -->
|
||||||
<shadedPattern>gg.frog.mc.permissionstime</shadedPattern>
|
<shadedPattern>gg.frog.mc.permissionstime</shadedPattern>
|
||||||
</relocation>
|
</relocation>
|
||||||
@ -158,4 +178,16 @@
|
|||||||
<system>Jenkins</system>
|
<system>Jenkins</system>
|
||||||
<url>http://ci.frog.gg/</url>
|
<url>http://ci.frog.gg/</url>
|
||||||
</ciManagement>
|
</ciManagement>
|
||||||
|
<distributionManagement>
|
||||||
|
<repository>
|
||||||
|
<id>nexus-releases</id>
|
||||||
|
<name>Frog Release Repository</name>
|
||||||
|
<url>https://maven.frog.gg/repository/maven-releases/</url>
|
||||||
|
</repository>
|
||||||
|
<snapshotRepository>
|
||||||
|
<id>nexus-snapshots</id>
|
||||||
|
<name>Frog Snapshot Repository</name>
|
||||||
|
<url>https://maven.frog.gg/repository/maven-snapshots/</url>
|
||||||
|
</snapshotRepository>
|
||||||
|
</distributionManagement>
|
||||||
</project>
|
</project>
|
||||||
|
@ -1,27 +0,0 @@
|
|||||||
package gg.frog.mc.base.listener;
|
|
||||||
|
|
||||||
import org.bukkit.event.EventHandler;
|
|
||||||
import org.bukkit.event.Listener;
|
|
||||||
import org.bukkit.event.player.PlayerKickEvent;
|
|
||||||
import org.bukkit.event.player.PlayerQuitEvent;
|
|
||||||
|
|
||||||
import gg.frog.mc.base.PluginMain;
|
|
||||||
|
|
||||||
public class BaseListener implements Listener {
|
|
||||||
|
|
||||||
private PluginMain pm;
|
|
||||||
|
|
||||||
public BaseListener(PluginMain pm) {
|
|
||||||
this.pm = pm;
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void onQuit(PlayerQuitEvent event) {
|
|
||||||
pm.getOFFLINE_PLAYER_MAP().remove(event.getPlayer().getName());
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void onKick(PlayerKickEvent event) {
|
|
||||||
pm.getOFFLINE_PLAYER_MAP().remove(event.getPlayer().getName());
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,64 +0,0 @@
|
|||||||
package gg.frog.mc.base.utils;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.FileWriter;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.InputStream;
|
|
||||||
import java.net.URLDecoder;
|
|
||||||
import java.nio.charset.Charset;
|
|
||||||
import java.util.Enumeration;
|
|
||||||
import java.util.jar.JarEntry;
|
|
||||||
import java.util.jar.JarFile;
|
|
||||||
|
|
||||||
public class FileUtil {
|
|
||||||
|
|
||||||
public interface FindFilesDo {
|
|
||||||
boolean isProcess(String fileName);
|
|
||||||
|
|
||||||
void process(String fileName, InputStream is);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void findFilesFromJar(FindFilesDo ffd, Class<?> jarClazz) {
|
|
||||||
JarFile jarFile = null;
|
|
||||||
try {
|
|
||||||
String jarFilePath = jarClazz.getProtectionDomain().getCodeSource().getLocation().getFile();
|
|
||||||
jarFilePath = URLDecoder.decode(jarFilePath, Charset.defaultCharset().name());
|
|
||||||
jarFile = new JarFile(jarFilePath);
|
|
||||||
Enumeration<JarEntry> entries = jarFile.entries();
|
|
||||||
while (entries.hasMoreElements()) {
|
|
||||||
JarEntry e = entries.nextElement();
|
|
||||||
if (ffd.isProcess(e.getName())) {
|
|
||||||
InputStream is = jarFile.getInputStream(e);
|
|
||||||
ffd.process(e.getName(), is);
|
|
||||||
try {
|
|
||||||
is.close();
|
|
||||||
} catch (Exception e1) {
|
|
||||||
e1.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
} finally {
|
|
||||||
if (jarFile != null) {
|
|
||||||
try {
|
|
||||||
jarFile.close();
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void writeOnFile(String fileName, String content) {
|
|
||||||
FileWriter fw;
|
|
||||||
try {
|
|
||||||
File f = new File(fileName);
|
|
||||||
fw = new FileWriter(f, true);
|
|
||||||
fw.write(content + "\r\n");
|
|
||||||
fw.close();
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,55 +0,0 @@
|
|||||||
package gg.frog.mc.base.utils;
|
|
||||||
|
|
||||||
import java.text.MessageFormat;
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
import org.apache.commons.lang.time.DateFormatUtils;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
import gg.frog.mc.base.PluginMain;
|
|
||||||
import gg.frog.mc.base.config.LangCfg;
|
|
||||||
import gg.frog.mc.permissionstime.database.IPlayerDataDao;
|
|
||||||
import me.clip.placeholderapi.PlaceholderAPI;
|
|
||||||
|
|
||||||
public class StrUtil {
|
|
||||||
|
|
||||||
private static final String dfs = "yyyy/MM/dd HH:mm:ss";
|
|
||||||
private static final long dt = 24 * 60 * IPlayerDataDao.TIME_UNIT;
|
|
||||||
private static final long ht = 60 * IPlayerDataDao.TIME_UNIT;
|
|
||||||
private static final long mt = IPlayerDataDao.TIME_UNIT;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public static String messageFormat(String src, Object... args) {
|
|
||||||
return MessageFormat.format(src, args).replaceAll("&", "§").replaceAll("\\\\n", "\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String messageFormat(Player player, String src, Object... args) {
|
|
||||||
String message = MessageFormat.format(src, args).replaceAll("&", "§").replaceAll("\\\\n", "\n").replaceAll("%player%", player.getPlayer().getDisplayName());
|
|
||||||
if (PluginMain.enabledPlaceholder) {
|
|
||||||
message = PlaceholderAPI.setPlaceholders(player, message);
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String timestampToString(long time) {
|
|
||||||
return DateFormatUtils.format(new Date(time), dfs);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String dateToString(Date d) {
|
|
||||||
return DateFormatUtils.format(d, dfs);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String nowTimeString() {
|
|
||||||
return DateFormatUtils.format(new Date(), dfs);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String getLeftTime(long time) {
|
|
||||||
long leftTime = time - new Date().getTime();
|
|
||||||
long d = leftTime / dt;
|
|
||||||
long h = (leftTime % dt) / ht;
|
|
||||||
long m = (leftTime % ht) / mt;
|
|
||||||
return messageFormat(LangCfg.LEFT_TIME, d, LangCfg.TIME_UNIT_D, h, LangCfg.TIME_UNIT_H, m, LangCfg.TIME_UNIT_M);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,40 +0,0 @@
|
|||||||
package gg.frog.mc.base.utils;
|
|
||||||
|
|
||||||
import java.io.InputStreamReader;
|
|
||||||
import java.net.HttpURLConnection;
|
|
||||||
import java.net.URL;
|
|
||||||
|
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
|
||||||
import com.google.common.base.Charsets;
|
|
||||||
|
|
||||||
import gg.frog.mc.base.PluginMain;
|
|
||||||
import gg.frog.mc.base.config.PluginCfg;
|
|
||||||
|
|
||||||
public class UpdateCheck implements Runnable {
|
|
||||||
|
|
||||||
private PluginMain pm;
|
|
||||||
|
|
||||||
public UpdateCheck(PluginMain pm) {
|
|
||||||
this.pm = pm;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
try {
|
|
||||||
String pluginInfoUrl = "https://raw.githubusercontent.com/geekfrog/PermissionsTime/master/src/resources/plugin.yml";
|
|
||||||
URL url = new URL(pluginInfoUrl);
|
|
||||||
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
|
|
||||||
connection.setRequestProperty("User-Agent", "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.4; en-US; rv:1.9.2.2) Gecko/20100316 Firefox/3.6.2");
|
|
||||||
connection.setRequestMethod("GET");
|
|
||||||
YamlConfiguration tempConfig = YamlConfiguration.loadConfiguration(new InputStreamReader(connection.getInputStream(), Charsets.UTF_8));
|
|
||||||
String version = tempConfig.getString("version", pm.PLUGIN_VERSION);
|
|
||||||
if (!pm.PLUGIN_VERSION.equals(version)) {
|
|
||||||
pm.getServer().getConsoleSender().sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "§4There is a new version ''{0}'' of the plugin.", version));
|
|
||||||
} else {
|
|
||||||
pm.getServer().getConsoleSender().sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "§2No new version available."));
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,11 +0,0 @@
|
|||||||
package gg.frog.mc.base.utils.config;
|
|
||||||
|
|
||||||
import org.bukkit.configuration.MemorySection;
|
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
|
||||||
|
|
||||||
public interface IConfigBean {
|
|
||||||
|
|
||||||
YamlConfiguration toConfig();
|
|
||||||
|
|
||||||
void toConfigBean(MemorySection config);
|
|
||||||
}
|
|
@ -1,235 +0,0 @@
|
|||||||
package gg.frog.mc.base.utils.config;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.FileNotFoundException;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.InputStream;
|
|
||||||
import java.io.InputStreamReader;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Map.Entry;
|
|
||||||
import java.util.logging.Level;
|
|
||||||
|
|
||||||
import org.bukkit.command.CommandSender;
|
|
||||||
import org.bukkit.configuration.InvalidConfigurationException;
|
|
||||||
import org.bukkit.configuration.MemorySection;
|
|
||||||
import org.bukkit.configuration.file.FileConfiguration;
|
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
|
||||||
|
|
||||||
import com.google.common.base.Charsets;
|
|
||||||
|
|
||||||
import gg.frog.mc.base.PluginMain;
|
|
||||||
import gg.frog.mc.base.config.PluginCfg;
|
|
||||||
import gg.frog.mc.base.utils.StrUtil;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 配置操作
|
|
||||||
*
|
|
||||||
* @author QiaoPengyu
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public abstract class PluginConfig {
|
|
||||||
|
|
||||||
protected PluginMain pm;
|
|
||||||
private FileConfiguration config = null;
|
|
||||||
private File folder = null;
|
|
||||||
private String fileName = null;
|
|
||||||
private File configFile = null;
|
|
||||||
|
|
||||||
protected PluginConfig(PluginMain pm) {
|
|
||||||
this.pm = pm;
|
|
||||||
initConfig(pm.getDataFolder(), "config.yml");
|
|
||||||
}
|
|
||||||
|
|
||||||
protected PluginConfig(String fileName, PluginMain pm) {
|
|
||||||
this.pm = pm;
|
|
||||||
initConfig(pm.getDataFolder(), fileName);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected PluginConfig(File folder, String fileName, PluginMain pm) {
|
|
||||||
this.pm = pm;
|
|
||||||
initConfig(folder, fileName);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 初始化
|
|
||||||
*
|
|
||||||
* @param folder
|
|
||||||
* @param fileName
|
|
||||||
*/
|
|
||||||
private void initConfig(File folder, String fileName) {
|
|
||||||
this.folder = folder;
|
|
||||||
this.fileName = fileName;
|
|
||||||
configFile = new File(folder, fileName);
|
|
||||||
if (!configFile.exists()) {
|
|
||||||
getConfig(folder, fileName).options().copyDefaults(true);
|
|
||||||
init();
|
|
||||||
saveAndReloadConfig();
|
|
||||||
} else {
|
|
||||||
reloadConfig();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 首次生成文件调用
|
|
||||||
*/
|
|
||||||
protected abstract void init();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 加载配置后调用
|
|
||||||
*/
|
|
||||||
protected abstract void loadToDo(CommandSender sender);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取配置(首次)
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
private FileConfiguration getConfig(File folder, String fileName) {
|
|
||||||
if (config == null) {
|
|
||||||
reloadConfig(folder, fileName, true);
|
|
||||||
}
|
|
||||||
return config;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取配置
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
protected FileConfiguration getConfig() {
|
|
||||||
return config;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 保存配置
|
|
||||||
*/
|
|
||||||
public void saveConfig() {
|
|
||||||
try {
|
|
||||||
getConfig().save(configFile);
|
|
||||||
} catch (IOException ex) {
|
|
||||||
PluginMain.LOG.log(Level.SEVERE, StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "Could not save config to " + configFile), ex);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void saveAndReloadConfig() {
|
|
||||||
try {
|
|
||||||
getConfig().save(configFile);
|
|
||||||
reloadConfig();
|
|
||||||
} catch (IOException ex) {
|
|
||||||
PluginMain.LOG.log(Level.SEVERE, StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "Could not save config to " + configFile), ex);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 配置重载
|
|
||||||
*/
|
|
||||||
public void reloadConfig() {
|
|
||||||
reloadConfig(folder, fileName, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 配置重载
|
|
||||||
*/
|
|
||||||
public void reloadConfig(CommandSender sender) {
|
|
||||||
reloadConfig(folder, fileName, false, sender);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 配置重载
|
|
||||||
*/
|
|
||||||
private void reloadConfig(File folder, String fileName, boolean useRes) {
|
|
||||||
reloadConfig(folder, fileName, useRes, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 配置重载
|
|
||||||
*/
|
|
||||||
private void reloadConfig(File folder, String fileName, boolean useRes, CommandSender sender) {
|
|
||||||
YamlConfiguration tempConfig = new YamlConfiguration();
|
|
||||||
try {
|
|
||||||
tempConfig.load(configFile);
|
|
||||||
config = tempConfig;
|
|
||||||
} catch (FileNotFoundException e) {
|
|
||||||
} catch (IOException | InvalidConfigurationException e1) {
|
|
||||||
tempConfig = null;
|
|
||||||
e1.printStackTrace();
|
|
||||||
}
|
|
||||||
if (config == null) {
|
|
||||||
config = new YamlConfiguration();
|
|
||||||
}
|
|
||||||
if (useRes) {
|
|
||||||
final InputStream defConfigStream = pm.getResource(fileName);
|
|
||||||
if (defConfigStream == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
config.setDefaults(YamlConfiguration.loadConfiguration(new InputStreamReader(defConfigStream, Charsets.UTF_8)));
|
|
||||||
}
|
|
||||||
loadToDo(sender);
|
|
||||||
// if (tempConfig != null) {
|
|
||||||
// saveConfig();
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void setObj(String path, Map<String, ? extends IConfigBean> o) {
|
|
||||||
for (Entry<String, ? extends IConfigBean> configBean : o.entrySet()) {
|
|
||||||
setObj(path + "." + configBean.getKey(), configBean.getValue());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void setObj(String path, IConfigBean o) {
|
|
||||||
getConfig().set(path, o.toConfig());
|
|
||||||
}
|
|
||||||
|
|
||||||
protected <T extends IConfigBean> Map<String, T> getObjMap(String path, Class<T> clazz) {
|
|
||||||
Map<String, T> map = new HashMap<>();
|
|
||||||
MemorySection configMap = (MemorySection) getConfig().get(path);
|
|
||||||
if (configMap != null) {
|
|
||||||
for (String key : configMap.getKeys(false)) {
|
|
||||||
T bean = getObj(path + "." + key, clazz);
|
|
||||||
if (bean != null) {
|
|
||||||
map.put(key, bean);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return map;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected <T extends IConfigBean> T getObj(String path, Class<T> clazz) {
|
|
||||||
Object beanConfig = getConfig().get(path);
|
|
||||||
if (beanConfig != null && beanConfig instanceof MemorySection) {
|
|
||||||
try {
|
|
||||||
T bean = clazz.newInstance();
|
|
||||||
bean.toConfigBean((MemorySection) beanConfig);
|
|
||||||
return bean;
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected String setGetDefault(String path, String def) {
|
|
||||||
if (!getConfig().contains(path)) {
|
|
||||||
getConfig().set(path, def);
|
|
||||||
return def;
|
|
||||||
}
|
|
||||||
return getConfig().getString(path);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected int setGetDefault(String path, int def) {
|
|
||||||
if (!getConfig().contains(path)) {
|
|
||||||
getConfig().set(path, def);
|
|
||||||
return def;
|
|
||||||
}
|
|
||||||
return getConfig().getInt(path);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected boolean setGetDefault(String path, boolean def) {
|
|
||||||
if (!getConfig().contains(path)) {
|
|
||||||
getConfig().set(path, def);
|
|
||||||
return def;
|
|
||||||
}
|
|
||||||
return getConfig().getBoolean(path);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,126 +0,0 @@
|
|||||||
package gg.frog.mc.base.utils.nms;
|
|
||||||
|
|
||||||
import java.lang.reflect.Method;
|
|
||||||
|
|
||||||
import org.bukkit.enchantments.Enchantment;
|
|
||||||
import org.bukkit.inventory.ItemStack;
|
|
||||||
|
|
||||||
import gg.frog.mc.base.PluginMain;
|
|
||||||
import gg.frog.mc.base.config.PluginCfg;
|
|
||||||
import gg.frog.mc.base.utils.StrUtil;
|
|
||||||
|
|
||||||
public class ItemUtil {
|
|
||||||
|
|
||||||
private static Class<?> nbtBaseClass;
|
|
||||||
private static Class<?> nbtTagCompoundClass;
|
|
||||||
private static Class<?> nbtTagStringClass;
|
|
||||||
private static Class<?> nbtTagIntClass;
|
|
||||||
// private static Class<?> nbtTagShortClass;
|
|
||||||
// private static Class<?> nbtTagListClass;
|
|
||||||
private static Class<?> itemstackClass;
|
|
||||||
private static Method asNmsCopyMethod;
|
|
||||||
private static Method asCraftMirrorMethod;
|
|
||||||
private static Method hasTagMethod;
|
|
||||||
private static Method getTagMethod;
|
|
||||||
private static Method setTagMethod;
|
|
||||||
private static Method nbtSetMethod;
|
|
||||||
// private static Method nbtListAddSetMethod;
|
|
||||||
private static boolean setupOk;
|
|
||||||
|
|
||||||
static {
|
|
||||||
try {
|
|
||||||
try {
|
|
||||||
itemstackClass = NMSUtil.getNmsClass("ItemStack");
|
|
||||||
nbtBaseClass = NMSUtil.getNmsClass("NBTBase");
|
|
||||||
nbtTagStringClass = NMSUtil.getNmsClass("NBTTagString");
|
|
||||||
nbtTagIntClass = NMSUtil.getNmsClass("NBTTagInt");
|
|
||||||
nbtTagCompoundClass = NMSUtil.getNmsClass("NBTTagCompound");
|
|
||||||
|
|
||||||
hasTagMethod = itemstackClass.getMethod("hasTag", new Class[0]);
|
|
||||||
getTagMethod = itemstackClass.getMethod("getTag", new Class[0]);
|
|
||||||
setTagMethod = itemstackClass.getMethod("setTag", new Class[] { nbtTagCompoundClass });
|
|
||||||
nbtSetMethod = nbtTagCompoundClass.getMethod("set", new Class[] { String.class, nbtBaseClass });
|
|
||||||
// nbtTagShortClass = NMSUtil.getNmsClass("NBTTagShort");
|
|
||||||
// nbtTagListClass = NMSUtil.getNmsClass("NBTTagList");
|
|
||||||
// nbtListAddSetMethod = nbtTagListClass.getMethod("add", new Class[]
|
|
||||||
// {nbtBaseClass});
|
|
||||||
} catch (Exception e) {
|
|
||||||
if (NMSUtil.getServerVersion().startsWith("v1_7_R4")) {
|
|
||||||
itemstackClass = NMSUtil.getNmClass("item.ItemStack");// add
|
|
||||||
nbtBaseClass = NMSUtil.getNmClass("nbt.NBTBase");// dy
|
|
||||||
nbtTagStringClass = NMSUtil.getNmClass("nbt.NBTTagString");// dx
|
|
||||||
nbtTagIntClass = NMSUtil.getNmClass("nbt.NBTTagInt");// dp
|
|
||||||
nbtTagCompoundClass = NMSUtil.getNmClass("nbt.NBTTagCompound");// dh
|
|
||||||
|
|
||||||
hasTagMethod = itemstackClass.getMethod("func_77942_o", new Class[0]);// hasTagCompound
|
|
||||||
getTagMethod = itemstackClass.getMethod("func_77978_p", new Class[0]);// getTagCompound
|
|
||||||
setTagMethod = itemstackClass.getMethod("func_77982_d", new Class[] { nbtTagCompoundClass });// setTagCompound
|
|
||||||
nbtSetMethod = nbtTagCompoundClass.getMethod("func_74782_a", new Class[] { String.class, nbtBaseClass });// setTag
|
|
||||||
} else {
|
|
||||||
throw new Exception("Nbt edit is not support.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
asNmsCopyMethod = NMSUtil.getObcClass("inventory.CraftItemStack").getMethod("asNMSCopy", new Class[] { ItemStack.class });
|
|
||||||
asCraftMirrorMethod = NMSUtil.getObcClass("inventory.CraftItemStack").getMethod("asCraftMirror", new Class[] { itemstackClass });
|
|
||||||
setupOk = true;
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
PluginMain.LOG.warning(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "ItemUtil setup fail. Some functions are unavailable."));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static ItemStack addEnchantLight(ItemStack item) {
|
|
||||||
item.addUnsafeEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 0);
|
|
||||||
if (!NMSUtil.getServerVersion().startsWith("v1_7_") && setupOk) {
|
|
||||||
try {
|
|
||||||
Object nmsItemstack = asNmsCopyMethod.invoke(null, new Object[] { item });
|
|
||||||
if (nmsItemstack == null) {
|
|
||||||
return item;
|
|
||||||
}
|
|
||||||
Object nbtCompound = null;
|
|
||||||
if (((Boolean) hasTagMethod.invoke(nmsItemstack, new Object[0])).booleanValue()) {
|
|
||||||
nbtCompound = getTagMethod.invoke(nmsItemstack, new Object[0]);
|
|
||||||
} else {
|
|
||||||
nbtCompound = nbtTagCompoundClass.newInstance();
|
|
||||||
setTagMethod.invoke(nmsItemstack, new Object[] { nbtCompound });
|
|
||||||
}
|
|
||||||
if (nbtCompound == null) {
|
|
||||||
return item;
|
|
||||||
}
|
|
||||||
Object nbtHideFlags = nbtTagIntClass.getConstructor(int.class).newInstance(1);
|
|
||||||
nbtSetMethod.invoke(nbtCompound, new Object[] { "HideFlags", nbtHideFlags });
|
|
||||||
return (ItemStack) asCraftMirrorMethod.invoke(null, new Object[] { nmsItemstack });
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return item;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static ItemStack addSkullOwner(ItemStack item, String name) {
|
|
||||||
if (setupOk) {
|
|
||||||
try {
|
|
||||||
Object nmsItemstack = asNmsCopyMethod.invoke(null, new Object[] { item });
|
|
||||||
if (nmsItemstack == null) {
|
|
||||||
return item;
|
|
||||||
}
|
|
||||||
Object nbtCompound = null;
|
|
||||||
if (((Boolean) hasTagMethod.invoke(nmsItemstack, new Object[0])).booleanValue()) {
|
|
||||||
nbtCompound = getTagMethod.invoke(nmsItemstack, new Object[0]);
|
|
||||||
} else {
|
|
||||||
nbtCompound = nbtTagCompoundClass.newInstance();
|
|
||||||
setTagMethod.invoke(nmsItemstack, new Object[] { nbtCompound });
|
|
||||||
}
|
|
||||||
if (nbtCompound == null) {
|
|
||||||
return item;
|
|
||||||
}
|
|
||||||
Object nbtString = nbtTagStringClass.getConstructor(String.class).newInstance(name);
|
|
||||||
nbtSetMethod.invoke(nbtCompound, new Object[] { "SkullOwner", nbtString });
|
|
||||||
return (ItemStack) asCraftMirrorMethod.invoke(null, new Object[] { nmsItemstack });
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return item;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,30 +0,0 @@
|
|||||||
package gg.frog.mc.base.utils.nms;
|
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
|
|
||||||
public class NMSUtil {
|
|
||||||
|
|
||||||
private static String serverVersion;
|
|
||||||
|
|
||||||
static {
|
|
||||||
String packageName = Bukkit.getServer().getClass().getPackage().getName();
|
|
||||||
serverVersion = packageName.substring(packageName.lastIndexOf('.') + 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String getServerVersion() {
|
|
||||||
return serverVersion;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Class<?> getNmsClass(String name) throws ClassNotFoundException {
|
|
||||||
return Class.forName("net.minecraft.server." + getServerVersion() + "." + name);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Class<?> getObcClass(String name) throws ClassNotFoundException {
|
|
||||||
return Class.forName("org.bukkit.craftbukkit." + getServerVersion() + "." + name);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Class<?> getNmClass(String name) throws ClassNotFoundException {
|
|
||||||
return Class.forName("net.minecraft." + name);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,73 +0,0 @@
|
|||||||
package gg.frog.mc.nametags.command;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import org.bukkit.command.CommandSender;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.inventory.ItemStack;
|
|
||||||
|
|
||||||
import gg.frog.mc.base.PluginMain;
|
|
||||||
import gg.frog.mc.base.config.LangCfg;
|
|
||||||
import gg.frog.mc.base.config.PluginCfg;
|
|
||||||
import gg.frog.mc.base.utils.StrUtil;
|
|
||||||
import gg.frog.mc.nametags.config.TagNameCfg;
|
|
||||||
import gg.frog.mc.nametags.config.TagNameCfg.TagType;
|
|
||||||
import gg.frog.mc.nametags.gui.PlayerTagShow;
|
|
||||||
|
|
||||||
public class TagCmd implements Runnable {
|
|
||||||
|
|
||||||
private PluginMain pm;
|
|
||||||
private String[] args;
|
|
||||||
private CommandSender sender;
|
|
||||||
private boolean isPlayer;
|
|
||||||
private TagType type = null;
|
|
||||||
|
|
||||||
public TagCmd(PluginMain pm, CommandSender sender, boolean isPlayer, String[] args) {
|
|
||||||
this.pm = pm;
|
|
||||||
this.sender = sender;
|
|
||||||
this.isPlayer = isPlayer;
|
|
||||||
this.args = args;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
if (isPlayer) {
|
|
||||||
if (args.length == 2) {
|
|
||||||
sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + LangCfg.MSG_PROCESSING));
|
|
||||||
List<ItemStack> itemList = new ArrayList<ItemStack>();
|
|
||||||
List<ItemStack> disItemList = new ArrayList<ItemStack>();
|
|
||||||
|
|
||||||
Map<String, List<ItemStack>> p_i_map;
|
|
||||||
if ("c".equals(args[1])) {
|
|
||||||
type = TagNameCfg.TagType.NAMECOLOR_TYPE;
|
|
||||||
p_i_map = TagNameCfg.NAMECOLOR_ITEMS;
|
|
||||||
} else if ("p".equals(args[1])) {
|
|
||||||
type = TagNameCfg.TagType.PREFIX_TYPE;
|
|
||||||
p_i_map = TagNameCfg.PREFIX_ITEMS;
|
|
||||||
} else if ("s".equals(args[1])) {
|
|
||||||
type = TagNameCfg.TagType.SUFFIX_TYPE;
|
|
||||||
p_i_map = TagNameCfg.SUFFIX_ITEMS;
|
|
||||||
} else {
|
|
||||||
sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + LangCfg.MSG_PARAMETER_MISMATCH));
|
|
||||||
sender.sendMessage(StrUtil.messageFormat(LangCfg.CMD_TAG, pm.PLUGIN_NAME_LOWER_CASE));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
for (String p : p_i_map.keySet()) {
|
|
||||||
if ("".equals(p) || sender.hasPermission(p)) {
|
|
||||||
itemList.addAll(p_i_map.get(p));
|
|
||||||
} else {
|
|
||||||
disItemList.addAll(p_i_map.get(p));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
PlayerTagShow.show(pm, (Player) sender, type, itemList, disItemList);
|
|
||||||
} else {
|
|
||||||
sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + LangCfg.MSG_PARAMETER_MISMATCH));
|
|
||||||
sender.sendMessage(StrUtil.messageFormat(LangCfg.CMD_TAG, pm.PLUGIN_NAME_LOWER_CASE));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "§4Only player can use this command."));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,233 +0,0 @@
|
|||||||
package gg.frog.mc.nametags.config;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Locale;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Map.Entry;
|
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
|
||||||
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.command.CommandSender;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.inventory.ItemStack;
|
|
||||||
import org.bukkit.inventory.meta.ItemMeta;
|
|
||||||
import org.bukkit.inventory.meta.SkullMeta;
|
|
||||||
import org.bukkit.scheduler.BukkitTask;
|
|
||||||
import org.bukkit.scoreboard.Scoreboard;
|
|
||||||
|
|
||||||
import gg.frog.mc.base.PluginMain;
|
|
||||||
import gg.frog.mc.base.config.LangCfg;
|
|
||||||
import gg.frog.mc.base.config.PluginCfg;
|
|
||||||
import gg.frog.mc.base.utils.StrUtil;
|
|
||||||
import gg.frog.mc.base.utils.config.PluginConfig;
|
|
||||||
import gg.frog.mc.base.utils.nms.ItemUtil;
|
|
||||||
import gg.frog.mc.nametags.model.PlayerTagBean;
|
|
||||||
import gg.frog.mc.permissionstime.model.cfg.TagPackageBean;
|
|
||||||
|
|
||||||
public class TagNameCfg extends PluginConfig {
|
|
||||||
|
|
||||||
public static String DEFAULT_NAMECOLOR = null;
|
|
||||||
public static String DEFAULT_PREFIX = null;
|
|
||||||
public static String DEFAULT_SUFFIX = null;
|
|
||||||
public static boolean CHANGE_DISPLAYNAME = true;
|
|
||||||
public static boolean USE_HD_PLUGIN = false;
|
|
||||||
public static boolean ONE_LINE_DISPLAY = false;
|
|
||||||
public static Integer REFRESH_TAG_TIME = null;
|
|
||||||
public static Map<String, TagPackageBean> PACKAGES = new ConcurrentHashMap<>();
|
|
||||||
public static List<String> TEMPLATE_LORE = null;
|
|
||||||
|
|
||||||
public static Map<String, List<ItemStack>> NAMECOLOR_ITEMS = new ConcurrentHashMap<>();
|
|
||||||
public static Map<String, List<ItemStack>> PREFIX_ITEMS = new ConcurrentHashMap<>();
|
|
||||||
public static Map<String, List<ItemStack>> SUFFIX_ITEMS = new ConcurrentHashMap<>();
|
|
||||||
|
|
||||||
public static Map<String, List<String>> NAMECOLOR_PERMISSIONS = new ConcurrentHashMap<>();
|
|
||||||
public static Map<String, List<String>> PREFIX_PERMISSIONS = new ConcurrentHashMap<>();
|
|
||||||
public static Map<String, List<String>> SUFFIX_PERMISSIONS = new ConcurrentHashMap<>();
|
|
||||||
|
|
||||||
public static Map<String, PlayerTagBean> PLAYER_TAG = new ConcurrentHashMap<>();
|
|
||||||
|
|
||||||
public static Scoreboard scoreboard = null;
|
|
||||||
|
|
||||||
private BukkitTask task = null;
|
|
||||||
|
|
||||||
public enum TagType {
|
|
||||||
NAMECOLOR_TYPE, PREFIX_TYPE, SUFFIX_TYPE
|
|
||||||
}
|
|
||||||
|
|
||||||
public TagNameCfg(String fileName, PluginMain pm) {
|
|
||||||
super(fileName, pm);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void init() {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void loadToDo(CommandSender sender) {
|
|
||||||
DEFAULT_NAMECOLOR = setGetDefault("defaultNamecolor", "");
|
|
||||||
DEFAULT_PREFIX = setGetDefault("defaultPrefix", "");
|
|
||||||
DEFAULT_SUFFIX = setGetDefault("defaultSuffix", "");
|
|
||||||
CHANGE_DISPLAYNAME = setGetDefault("changeDisplayname", true);
|
|
||||||
USE_HD_PLUGIN = setGetDefault("useHdPlugin", false);
|
|
||||||
if (USE_HD_PLUGIN && !PluginMain.enabledHdPlugin) {
|
|
||||||
USE_HD_PLUGIN = false;
|
|
||||||
if (sender != null) {
|
|
||||||
sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "§eHolographicDisplays is not installed or not enabled. "));
|
|
||||||
sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "§eBut you enabled some func need HolographicDisplays."));
|
|
||||||
} else {
|
|
||||||
pm.getServer().getConsoleSender().sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "§eHolographicDisplays is not installed or not enabled. "));
|
|
||||||
pm.getServer().getConsoleSender().sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "§eBut you enabled some func need HolographicDisplays."));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ONE_LINE_DISPLAY = setGetDefault("oneLineDisplay", true);
|
|
||||||
REFRESH_TAG_TIME = setGetDefault("refreshTagTime", -1);
|
|
||||||
PACKAGES = getObjMap("packages", TagPackageBean.class);
|
|
||||||
TEMPLATE_LORE = getConfig().getStringList("template.lore");
|
|
||||||
getConfig().set("template.lore", TEMPLATE_LORE);
|
|
||||||
setObj("packages", PACKAGES);
|
|
||||||
if (PluginCfg.IS_DEBUG) {
|
|
||||||
System.out.println("defaultNamecolor:" + DEFAULT_NAMECOLOR);
|
|
||||||
System.out.println("defaultPrefix:" + DEFAULT_PREFIX);
|
|
||||||
System.out.println("defaultSuffix:" + DEFAULT_SUFFIX);
|
|
||||||
System.out.println("useHdPlugin:" + USE_HD_PLUGIN);
|
|
||||||
for (Entry<String, TagPackageBean> p : PACKAGES.entrySet()) {
|
|
||||||
System.out.println(p.getKey() + ":" + p.getValue());
|
|
||||||
}
|
|
||||||
for (String lore : TEMPLATE_LORE) {
|
|
||||||
System.out.println(lore);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
NAMECOLOR_ITEMS.clear();
|
|
||||||
PREFIX_ITEMS.clear();
|
|
||||||
SUFFIX_ITEMS.clear();
|
|
||||||
|
|
||||||
NAMECOLOR_PERMISSIONS.clear();
|
|
||||||
PREFIX_PERMISSIONS.clear();
|
|
||||||
SUFFIX_PERMISSIONS.clear();
|
|
||||||
|
|
||||||
for (Entry<String, TagPackageBean> e : PACKAGES.entrySet()) {
|
|
||||||
List<ItemStack> items = getTagItem(TagType.NAMECOLOR_TYPE, e.getValue());
|
|
||||||
if (NAMECOLOR_ITEMS.containsKey(e.getValue().getPermissions())) {
|
|
||||||
NAMECOLOR_ITEMS.get(e.getValue().getPermissions()).addAll(items);
|
|
||||||
} else {
|
|
||||||
NAMECOLOR_ITEMS.put(e.getValue().getPermissions(), items);
|
|
||||||
}
|
|
||||||
items = getTagItem(TagType.PREFIX_TYPE, e.getValue());
|
|
||||||
if (PREFIX_ITEMS.containsKey(e.getValue().getPermissions())) {
|
|
||||||
PREFIX_ITEMS.get(e.getValue().getPermissions()).addAll(items);
|
|
||||||
} else {
|
|
||||||
PREFIX_ITEMS.put(e.getValue().getPermissions(), items);
|
|
||||||
}
|
|
||||||
items = getTagItem(TagType.SUFFIX_TYPE, e.getValue());
|
|
||||||
if (SUFFIX_ITEMS.containsKey(e.getValue().getPermissions())) {
|
|
||||||
SUFFIX_ITEMS.get(e.getValue().getPermissions()).addAll(items);
|
|
||||||
} else {
|
|
||||||
SUFFIX_ITEMS.put(e.getValue().getPermissions(), items);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (task != null) {
|
|
||||||
task.cancel();
|
|
||||||
}
|
|
||||||
refreshTagTask();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void refreshTagTask() {
|
|
||||||
for (Player player : pm.getServer().getOnlinePlayers()) {
|
|
||||||
PlayerTagBean.initPlayerTag(player, pm);
|
|
||||||
}
|
|
||||||
if (REFRESH_TAG_TIME > 0) {
|
|
||||||
task = pm.getServer().getScheduler().runTaskLaterAsynchronously(pm, new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
refreshTagTask();
|
|
||||||
}
|
|
||||||
}, REFRESH_TAG_TIME * 20);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private List<ItemStack> getTagItem(TagType tagType, TagPackageBean tpb) {
|
|
||||||
List<ItemStack> items = new ArrayList<>();
|
|
||||||
if (tpb != null) {
|
|
||||||
List<String> tags = null;
|
|
||||||
String itemDisplayName = "";
|
|
||||||
Map<String, List<String>> tagPermissions = null;
|
|
||||||
if (tagType == TagType.NAMECOLOR_TYPE) {
|
|
||||||
tags = tpb.getNamecolor();
|
|
||||||
itemDisplayName = LangCfg.TAG_COLOR_ITEM_NAME + "§1§r ";
|
|
||||||
tagPermissions = NAMECOLOR_PERMISSIONS;
|
|
||||||
} else if (tagType == TagType.PREFIX_TYPE) {
|
|
||||||
tags = tpb.getPrefix();
|
|
||||||
itemDisplayName = LangCfg.TAG_PREFIX_ITEM_NAME + "§2§r ";
|
|
||||||
tagPermissions = PREFIX_PERMISSIONS;
|
|
||||||
} else if (tagType == TagType.SUFFIX_TYPE) {
|
|
||||||
tags = tpb.getSuffix();
|
|
||||||
itemDisplayName = LangCfg.TAG_SUFFIX_ITEM_NAME + "§3§r ";
|
|
||||||
tagPermissions = SUFFIX_PERMISSIONS;
|
|
||||||
}
|
|
||||||
if (tags != null) {
|
|
||||||
for (String tag : tags) {
|
|
||||||
String[] args = tag.split(":");
|
|
||||||
tag = args[0];
|
|
||||||
Material type = null;
|
|
||||||
int exid = 0;
|
|
||||||
String skullOwner = null;
|
|
||||||
if (args.length > 1) {
|
|
||||||
type = Material.getMaterial(args[1].toUpperCase(Locale.ENGLISH));
|
|
||||||
if (type == null) {
|
|
||||||
int id = Integer.parseInt(args[1]);
|
|
||||||
type = Material.getMaterial(id);
|
|
||||||
}
|
|
||||||
if (args.length > 2) {
|
|
||||||
try {
|
|
||||||
exid = Integer.parseInt(args[2]);
|
|
||||||
} catch (NumberFormatException e) {
|
|
||||||
if (Material.SKULL_ITEM.equals(type)) {
|
|
||||||
exid = 3;
|
|
||||||
skullOwner = args[2];
|
|
||||||
} else {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
type = Material.getMaterial("NAME_TAG");
|
|
||||||
}
|
|
||||||
if (type != null) {
|
|
||||||
ItemStack item = new ItemStack(type, 1, (short) 0, (byte) exid);
|
|
||||||
ItemMeta meta = item.getItemMeta();
|
|
||||||
meta.setDisplayName(StrUtil.messageFormat(itemDisplayName + tag));
|
|
||||||
List<String> lores = new ArrayList<>(TEMPLATE_LORE);
|
|
||||||
for (int i = 0; i < lores.size(); i++) {
|
|
||||||
if (lores.get(i).contains("%description%")) {
|
|
||||||
lores.set(i, StrUtil.messageFormat(lores.get(i).replaceAll("%description%", tpb.getDescription())));// 描述
|
|
||||||
} else {
|
|
||||||
lores.set(i, StrUtil.messageFormat(lores.get(i)));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
lores.add("§8§k" + tpb.getPermissions());// 权限
|
|
||||||
lores.add("§8" + tag);// 称号
|
|
||||||
meta.setLore(lores);
|
|
||||||
item.setItemMeta(meta);
|
|
||||||
if (skullOwner != null) {
|
|
||||||
try {
|
|
||||||
((SkullMeta) meta).setOwner(skullOwner);
|
|
||||||
item.setItemMeta(meta);
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
item = ItemUtil.addSkullOwner(item, skullOwner);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
items.add(item);
|
|
||||||
}
|
|
||||||
if (!tagPermissions.containsKey(tag)) {
|
|
||||||
tagPermissions.put(tag, new ArrayList<>());
|
|
||||||
}
|
|
||||||
tagPermissions.get(tag).add(tpb.getPermissions());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return items;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,94 +0,0 @@
|
|||||||
package gg.frog.mc.nametags.gui;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.inventory.Inventory;
|
|
||||||
import org.bukkit.inventory.ItemStack;
|
|
||||||
import org.bukkit.inventory.meta.ItemMeta;
|
|
||||||
|
|
||||||
import gg.frog.mc.base.PluginMain;
|
|
||||||
import gg.frog.mc.base.config.LangCfg;
|
|
||||||
import gg.frog.mc.base.config.PluginCfg;
|
|
||||||
import gg.frog.mc.base.utils.StrUtil;
|
|
||||||
import gg.frog.mc.base.utils.nms.ItemUtil;
|
|
||||||
import gg.frog.mc.nametags.config.TagNameCfg;
|
|
||||||
import gg.frog.mc.nametags.config.TagNameCfg.TagType;
|
|
||||||
import gg.frog.mc.nametags.model.PlayerTagBean;
|
|
||||||
|
|
||||||
public class PlayerTagShow {
|
|
||||||
|
|
||||||
public static void show(PluginMain pm, Player p, TagType tagType, List<ItemStack> itemList, List<ItemStack> disItemList) {
|
|
||||||
Inventory inventory = null;
|
|
||||||
int size = 0;
|
|
||||||
if (itemList.size() > 0) {
|
|
||||||
inventory = Bukkit.createInventory(null, ((itemList.size() + disItemList.size()) % 9 == 0 ? (itemList.size() + disItemList.size()) : ((itemList.size() + disItemList.size()) / 9 + 1) * 9), StrUtil.messageFormat(LangCfg.TAG_INVENTORY_NAME + "§r§5§9§2§0§2§r"));
|
|
||||||
String uuid = pm.getPlayerUUIDByName(p);
|
|
||||||
PlayerTagBean playerTag = null;
|
|
||||||
if (uuid != null && TagNameCfg.PLAYER_TAG.containsKey(uuid)) {
|
|
||||||
playerTag = TagNameCfg.PLAYER_TAG.get(uuid);
|
|
||||||
if (playerTag != null) {
|
|
||||||
for (ItemStack item : itemList) {
|
|
||||||
playerTag = playerTag.clone();
|
|
||||||
ItemStack tItem = item.clone();
|
|
||||||
ItemMeta meta = tItem.getItemMeta();
|
|
||||||
List<String> lores = meta.getLore();
|
|
||||||
String tag = lores.get(lores.size() - 1);
|
|
||||||
tag = tag.length() > 2 ? tag.substring(2) : "";
|
|
||||||
if (tagType == TagType.NAMECOLOR_TYPE) {
|
|
||||||
meta.setDisplayName(meta.getDisplayName() + p.getName());
|
|
||||||
playerTag.setNamecolor(tag);
|
|
||||||
} else if (tagType == TagType.PREFIX_TYPE) {
|
|
||||||
playerTag.setPrefix(tag);
|
|
||||||
} else if (tagType == TagType.SUFFIX_TYPE) {
|
|
||||||
playerTag.setSuffix(tag);
|
|
||||||
}
|
|
||||||
for (int i = 0; i < lores.size(); i++) {
|
|
||||||
if (lores.get(i).contains("%displayname%")) {
|
|
||||||
lores.set(i, lores.get(i).replaceAll("%displayname%", playerTag.getDisplayNameStr(p)));// 效果
|
|
||||||
}
|
|
||||||
}
|
|
||||||
meta.setLore(lores);
|
|
||||||
tItem.setItemMeta(meta);
|
|
||||||
inventory.addItem(tItem);
|
|
||||||
size++;
|
|
||||||
}
|
|
||||||
for (ItemStack item : disItemList) {
|
|
||||||
playerTag = playerTag.clone();
|
|
||||||
ItemStack tItem = item.clone();
|
|
||||||
ItemMeta meta = tItem.getItemMeta();
|
|
||||||
List<String> lores = meta.getLore();
|
|
||||||
String tag = lores.get(lores.size() - 1);
|
|
||||||
tag = tag.length() > 2 ? tag.substring(2) : "";
|
|
||||||
if (tagType == TagType.NAMECOLOR_TYPE) {
|
|
||||||
meta.setDisplayName("§6§l§m" + meta.getDisplayName().substring(4) + p.getName());
|
|
||||||
playerTag.setNamecolor(tag);
|
|
||||||
} else if (tagType == TagType.PREFIX_TYPE) {
|
|
||||||
meta.setDisplayName("§6§l§m" + meta.getDisplayName().substring(4));
|
|
||||||
playerTag.setPrefix(tag);
|
|
||||||
} else if (tagType == TagType.SUFFIX_TYPE) {
|
|
||||||
meta.setDisplayName("§6§l§m" + meta.getDisplayName().substring(4));
|
|
||||||
playerTag.setSuffix(tag);
|
|
||||||
}
|
|
||||||
for (int i = 0; i < lores.size(); i++) {
|
|
||||||
if (lores.get(i).contains("%displayname%")) {
|
|
||||||
lores.set(i, lores.get(i).replaceAll("%displayname%", playerTag.getDisplayNameStr(p)));// 效果
|
|
||||||
}
|
|
||||||
}
|
|
||||||
meta.setLore(lores);
|
|
||||||
tItem.setItemMeta(meta);
|
|
||||||
tItem = ItemUtil.addEnchantLight(tItem);
|
|
||||||
inventory.addItem(tItem);
|
|
||||||
size++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (inventory != null && size > 0) {
|
|
||||||
p.openInventory(inventory);
|
|
||||||
} else {
|
|
||||||
p.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + LangCfg.MSG_NO_TAG_DATA));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,120 +0,0 @@
|
|||||||
package gg.frog.mc.nametags.listener;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.event.EventHandler;
|
|
||||||
import org.bukkit.event.EventPriority;
|
|
||||||
import org.bukkit.event.Listener;
|
|
||||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
|
||||||
import org.bukkit.event.player.PlayerChangedWorldEvent;
|
|
||||||
import org.bukkit.event.player.PlayerKickEvent;
|
|
||||||
import org.bukkit.event.player.PlayerLoginEvent;
|
|
||||||
import org.bukkit.event.player.PlayerMoveEvent;
|
|
||||||
import org.bukkit.event.player.PlayerQuitEvent;
|
|
||||||
|
|
||||||
import gg.frog.mc.base.PluginMain;
|
|
||||||
import gg.frog.mc.base.config.LangCfg;
|
|
||||||
import gg.frog.mc.base.config.PluginCfg;
|
|
||||||
import gg.frog.mc.base.utils.StrUtil;
|
|
||||||
import gg.frog.mc.nametags.config.TagNameCfg;
|
|
||||||
import gg.frog.mc.nametags.model.PlayerTagBean;
|
|
||||||
|
|
||||||
public class TagsListener implements Listener {
|
|
||||||
|
|
||||||
private PluginMain pm;
|
|
||||||
|
|
||||||
public TagsListener(PluginMain pm) {
|
|
||||||
this.pm = pm;
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.LOWEST)
|
|
||||||
public void onJoin(PlayerLoginEvent event) {
|
|
||||||
if (PluginCfg.TAG_SYSTEM) {
|
|
||||||
pm.getServer().getScheduler().runTaskLaterAsynchronously(pm, new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
PlayerTagBean.initPlayerTag(event.getPlayer(), pm);
|
|
||||||
}
|
|
||||||
}, 1 * 20);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void onRespawn(PlayerChangedWorldEvent event) {
|
|
||||||
if (PluginCfg.TAG_SYSTEM) {
|
|
||||||
PlayerTagBean.initPlayerTag(event.getPlayer(), pm);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void onQuit(PlayerQuitEvent event) {
|
|
||||||
if (PluginCfg.TAG_SYSTEM && TagNameCfg.USE_HD_PLUGIN) {
|
|
||||||
String uuid = pm.getPlayerUUIDByName(event.getPlayer());
|
|
||||||
PlayerTagBean playerTag = TagNameCfg.PLAYER_TAG.get(uuid);
|
|
||||||
playerTag.delHologramsName();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void onKick(PlayerKickEvent event) {
|
|
||||||
if (PluginCfg.TAG_SYSTEM && TagNameCfg.USE_HD_PLUGIN) {
|
|
||||||
String uuid = pm.getPlayerUUIDByName(event.getPlayer());
|
|
||||||
PlayerTagBean playerTag = TagNameCfg.PLAYER_TAG.get(uuid);
|
|
||||||
playerTag.delHologramsName();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void onMove(PlayerMoveEvent event) {
|
|
||||||
if (PluginCfg.TAG_SYSTEM && TagNameCfg.USE_HD_PLUGIN) {
|
|
||||||
String uuid = this.pm.getPlayerUUIDByName(event.getPlayer());
|
|
||||||
PlayerTagBean playerTag = TagNameCfg.PLAYER_TAG.get(uuid);
|
|
||||||
if (playerTag != null) {
|
|
||||||
playerTag.moveHologramsName(event.getPlayer());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void onPlayerClick(InventoryClickEvent event) {
|
|
||||||
if (StrUtil.messageFormat(LangCfg.TAG_INVENTORY_NAME + "§r§5§9§2§0§2§r").equals(event.getInventory().getName())) {
|
|
||||||
try {
|
|
||||||
if (event.getCurrentItem() != null && event.getCurrentItem().getItemMeta() != null && event.getCurrentItem().getItemMeta().hasLore()) {
|
|
||||||
List<String> lores = event.getCurrentItem().getItemMeta().getLore();
|
|
||||||
if (lores.size() > 1) {
|
|
||||||
String permissions = lores.get(lores.size() - 2);
|
|
||||||
permissions = permissions.startsWith("§8§k") ? permissions.substring(4) : "noPermissions";
|
|
||||||
String uuid = pm.getPlayerUUIDByName((Player) event.getWhoClicked());
|
|
||||||
if (permissions.length() == 0 || event.getWhoClicked().hasPermission(permissions)) {
|
|
||||||
if (TagNameCfg.PLAYER_TAG.containsKey(uuid)) {
|
|
||||||
String itemName = event.getCurrentItem().getItemMeta().getDisplayName();
|
|
||||||
PlayerTagBean playerTag = TagNameCfg.PLAYER_TAG.get(uuid);
|
|
||||||
if (itemName.startsWith(StrUtil.messageFormat(LangCfg.TAG_COLOR_ITEM_NAME + "§1§r "))) {
|
|
||||||
playerTag.setNamecolor(lores.get(lores.size() - 1).substring(2));
|
|
||||||
} else if (itemName.startsWith(StrUtil.messageFormat(LangCfg.TAG_PREFIX_ITEM_NAME + "§2§r "))) {
|
|
||||||
playerTag.setPrefix(lores.get(lores.size() - 1).substring(2));
|
|
||||||
} else if (itemName.startsWith(StrUtil.messageFormat(LangCfg.TAG_SUFFIX_ITEM_NAME + "§3§r "))) {
|
|
||||||
playerTag.setSuffix(lores.get(lores.size() - 1).substring(2));
|
|
||||||
} else {
|
|
||||||
((Player) event.getWhoClicked()).sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + LangCfg.MSG_NO_PERMISSION));
|
|
||||||
event.setCancelled(true);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
playerTag.setPlayerDisplayName((Player) event.getWhoClicked(), true);
|
|
||||||
playerTag.saveConfig();
|
|
||||||
((Player) event.getWhoClicked()).sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + LangCfg.MSG_TAG_SET_SUCCESS));
|
|
||||||
event.setCancelled(true);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
((Player) event.getWhoClicked()).sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + LangCfg.MSG_NO_PERMISSION));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
event.setCancelled(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,290 +0,0 @@
|
|||||||
package gg.frog.mc.nametags.model;
|
|
||||||
|
|
||||||
import org.bukkit.Location;
|
|
||||||
import org.bukkit.command.CommandSender;
|
|
||||||
import org.bukkit.configuration.MemorySection;
|
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.scoreboard.Team;
|
|
||||||
|
|
||||||
import com.gmail.filoghost.holographicdisplays.api.Hologram;
|
|
||||||
import com.gmail.filoghost.holographicdisplays.api.HologramsAPI;
|
|
||||||
|
|
||||||
import gg.frog.mc.base.PluginMain;
|
|
||||||
import gg.frog.mc.base.config.PluginCfg;
|
|
||||||
import gg.frog.mc.base.utils.StrUtil;
|
|
||||||
import gg.frog.mc.base.utils.config.IConfigBean;
|
|
||||||
import gg.frog.mc.base.utils.config.PluginConfig;
|
|
||||||
import gg.frog.mc.base.utils.nms.NMSUtil;
|
|
||||||
import gg.frog.mc.nametags.config.TagNameCfg;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 玩家标签包实体类
|
|
||||||
*
|
|
||||||
* @author QiaoPengyu
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public class PlayerTagBean extends PluginConfig implements IConfigBean, Cloneable {
|
|
||||||
|
|
||||||
// 名称颜色
|
|
||||||
private String namecolor;
|
|
||||||
// 前缀
|
|
||||||
private String prefix;
|
|
||||||
// 后缀
|
|
||||||
private String suffix;
|
|
||||||
// 当前显示的名称
|
|
||||||
private String displayName;
|
|
||||||
// 当前显示的前缀
|
|
||||||
private String displayPrefix;
|
|
||||||
// 当前显示的后缀
|
|
||||||
private String displaySuffix;
|
|
||||||
// 玩家所在队伍
|
|
||||||
private Team team;
|
|
||||||
// 不可见的队伍名
|
|
||||||
private String invisibleName;
|
|
||||||
// hd
|
|
||||||
private Hologram holograms;
|
|
||||||
|
|
||||||
public PlayerTagBean(String fileName, PluginMain pm) {
|
|
||||||
super(fileName, pm);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void init() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void loadToDo(CommandSender sender) {
|
|
||||||
namecolor = getConfig().getString("namecolor", TagNameCfg.DEFAULT_NAMECOLOR);
|
|
||||||
prefix = getConfig().getString("prefix", TagNameCfg.DEFAULT_PREFIX);
|
|
||||||
suffix = getConfig().getString("suffix", TagNameCfg.DEFAULT_SUFFIX);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void saveConfig() {
|
|
||||||
getConfig().set("namecolor", namecolor);
|
|
||||||
getConfig().set("prefix", prefix);
|
|
||||||
getConfig().set("suffix", suffix);
|
|
||||||
super.saveConfig();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void initPlayerTag(Player player, PluginMain pm) {
|
|
||||||
String uuid = pm.getPlayerUUIDByName(player);
|
|
||||||
PlayerTagBean playerTag = null;
|
|
||||||
if (TagNameCfg.PLAYER_TAG.containsKey(uuid)) {
|
|
||||||
playerTag = TagNameCfg.PLAYER_TAG.get(uuid);
|
|
||||||
} else {
|
|
||||||
playerTag = new PlayerTagBean("playerTag/" + uuid + ".yml", pm);
|
|
||||||
TagNameCfg.PLAYER_TAG.put(uuid, playerTag);
|
|
||||||
}
|
|
||||||
playerTag.setPlayerDisplayName(player, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPlayerDisplayName(Player player) {
|
|
||||||
setPlayerDisplayName(player, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPlayerDisplayName(Player player, boolean forceSet) {
|
|
||||||
PlayerTagBean playerTag = this;
|
|
||||||
pm.getServer().getScheduler().runTask(pm, new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
boolean namecolor_flag = true;
|
|
||||||
boolean prefix_flag = true;
|
|
||||||
boolean suffix_flag = true;
|
|
||||||
if (!(namecolor.equals(TagNameCfg.DEFAULT_NAMECOLOR) && prefix.equals(TagNameCfg.DEFAULT_PREFIX) && suffix.equals(TagNameCfg.DEFAULT_SUFFIX))) {
|
|
||||||
if (TagNameCfg.NAMECOLOR_PERMISSIONS.containsKey(namecolor)) {
|
|
||||||
for (String p : TagNameCfg.NAMECOLOR_PERMISSIONS.get(namecolor)) {
|
|
||||||
if (p == null || p.length() == 0 || player.hasPermission(p)) {
|
|
||||||
namecolor_flag = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (namecolor_flag) {
|
|
||||||
namecolor = TagNameCfg.DEFAULT_NAMECOLOR;
|
|
||||||
}
|
|
||||||
if (TagNameCfg.PREFIX_PERMISSIONS.containsKey(prefix)) {
|
|
||||||
for (String p : TagNameCfg.PREFIX_PERMISSIONS.get(prefix)) {
|
|
||||||
if (p == null || p.length() == 0 || player.hasPermission(p)) {
|
|
||||||
prefix_flag = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (prefix_flag) {
|
|
||||||
prefix = TagNameCfg.DEFAULT_PREFIX;
|
|
||||||
}
|
|
||||||
if (TagNameCfg.SUFFIX_PERMISSIONS.containsKey(suffix)) {
|
|
||||||
for (String p : TagNameCfg.SUFFIX_PERMISSIONS.get(suffix)) {
|
|
||||||
if (p == null || p.length() == 0 || player.hasPermission(p)) {
|
|
||||||
suffix_flag = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (suffix_flag) {
|
|
||||||
suffix = TagNameCfg.DEFAULT_SUFFIX;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (forceSet || namecolor_flag || prefix_flag || suffix_flag) {
|
|
||||||
displayPrefix = StrUtil.messageFormat(player, prefix + "§r" + namecolor);
|
|
||||||
displaySuffix = StrUtil.messageFormat(player, "§r" + suffix);
|
|
||||||
displayName = "§r" + displayPrefix + player.getName() + displaySuffix + "§r";
|
|
||||||
if (TagNameCfg.CHANGE_DISPLAYNAME) {
|
|
||||||
player.setDisplayName(displayName);
|
|
||||||
}
|
|
||||||
if (PluginCfg.IS_DEBUG) {
|
|
||||||
System.out.println("PlayerTagBean:" + playerTag);
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
if (TagNameCfg.scoreboard == null) {
|
|
||||||
TagNameCfg.scoreboard = pm.getServer().getScoreboardManager().getNewScoreboard();
|
|
||||||
}
|
|
||||||
if (invisibleName == null) {
|
|
||||||
invisibleName = String.valueOf(TagNameCfg.scoreboard.getTeams().size() + 1).replaceAll("", "§");
|
|
||||||
}
|
|
||||||
if (!TagNameCfg.USE_HD_PLUGIN) {
|
|
||||||
team = TagNameCfg.scoreboard.getTeam(player.getName());
|
|
||||||
if (team == null) {
|
|
||||||
team = TagNameCfg.scoreboard.registerNewTeam(player.getName());
|
|
||||||
}
|
|
||||||
String teamPrefix = displayPrefix.length() > 16 ? (displayPrefix.substring(0, 7) + ".." + displayPrefix.substring(displayPrefix.length() - 7)) : displayPrefix;
|
|
||||||
team.setPrefix(teamPrefix);
|
|
||||||
String teamSuffix = displaySuffix.length() > 16 ? (displaySuffix.substring(0, 7) + ".." + displaySuffix.substring(displaySuffix.length() - 7)) : displaySuffix;
|
|
||||||
team.setSuffix(teamSuffix);
|
|
||||||
if (!(holograms == null || holograms.isDeleted())) {
|
|
||||||
holograms.delete();
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
team = TagNameCfg.scoreboard.getTeam(invisibleName);
|
|
||||||
if (team == null) {
|
|
||||||
team = TagNameCfg.scoreboard.registerNewTeam(invisibleName);
|
|
||||||
}
|
|
||||||
team.setPrefix("");
|
|
||||||
team.setSuffix("");
|
|
||||||
if (NMSUtil.getServerVersion().startsWith("v1_7") || NMSUtil.getServerVersion().startsWith("v1_8")) {
|
|
||||||
} else {
|
|
||||||
team.setOption(Team.Option.NAME_TAG_VISIBILITY, Team.OptionStatus.NEVER);
|
|
||||||
}
|
|
||||||
initHologramsName(player);
|
|
||||||
}
|
|
||||||
team.addPlayer(player);
|
|
||||||
player.setScoreboard(TagNameCfg.scoreboard);
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public void initHologramsName(Player player) {
|
|
||||||
Location loc = player.getLocation();
|
|
||||||
loc = new Location(loc.getWorld(), loc.getX(), loc.getY() + (TagNameCfg.ONE_LINE_DISPLAY ? 2.25 : 2.75), loc.getZ());
|
|
||||||
if (holograms == null || holograms.isDeleted()) {
|
|
||||||
holograms = HologramsAPI.createHologram(pm, loc);
|
|
||||||
} else {
|
|
||||||
holograms.teleport(loc);
|
|
||||||
}
|
|
||||||
holograms.clearLines();
|
|
||||||
if (TagNameCfg.ONE_LINE_DISPLAY) {
|
|
||||||
holograms.appendTextLine(getDisplayNameStr(player));
|
|
||||||
} else {
|
|
||||||
holograms.appendTextLine(StrUtil.messageFormat(player, prefix));
|
|
||||||
holograms.appendTextLine(StrUtil.messageFormat(player, namecolor + player.getName()));
|
|
||||||
holograms.appendTextLine(StrUtil.messageFormat(player, suffix));
|
|
||||||
}
|
|
||||||
holograms.getVisibilityManager().hideTo(player);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void moveHologramsName(Player player) {
|
|
||||||
if (!(holograms == null || holograms.isDeleted())) {
|
|
||||||
Location loc = player.getLocation();
|
|
||||||
loc = new Location(loc.getWorld(), loc.getX(), loc.getY() + (TagNameCfg.ONE_LINE_DISPLAY ? 2.25 : 2.75), loc.getZ());
|
|
||||||
holograms.teleport(loc);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 退出游戏调用
|
|
||||||
*/
|
|
||||||
public void delHologramsName() {
|
|
||||||
if (!(holograms == null || holograms.isDeleted())) {
|
|
||||||
holograms.delete();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDisplayNameStr(Player player) {
|
|
||||||
return StrUtil.messageFormat(player, prefix + "§r" + namecolor + player.getName() + "§r" + suffix);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public PlayerTagBean clone() {
|
|
||||||
PlayerTagBean t = null;
|
|
||||||
try {
|
|
||||||
t = (PlayerTagBean) super.clone();
|
|
||||||
} catch (CloneNotSupportedException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
return t;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getNamecolor() {
|
|
||||||
return namecolor;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setNamecolor(String namecolor) {
|
|
||||||
this.namecolor = namecolor;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getPrefix() {
|
|
||||||
return prefix;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPrefix(String prefix) {
|
|
||||||
this.prefix = prefix;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getSuffix() {
|
|
||||||
return suffix;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSuffix(String suffix) {
|
|
||||||
this.suffix = suffix;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDisplayName() {
|
|
||||||
return displayName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDisplayPrefix() {
|
|
||||||
return displayPrefix;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDisplaySuffix() {
|
|
||||||
return displaySuffix;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public YamlConfiguration toConfig() {
|
|
||||||
YamlConfiguration config = new YamlConfiguration();
|
|
||||||
config.set("namecolor", namecolor);
|
|
||||||
config.set("prefix", prefix);
|
|
||||||
config.set("suffix", suffix);
|
|
||||||
return config;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void toConfigBean(MemorySection config) {
|
|
||||||
namecolor = config.getString("namecolor");
|
|
||||||
prefix = config.getString("prefix");
|
|
||||||
suffix = config.getString("suffix");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return "PlayerTagBean [namecolor=" + namecolor + ", prefix=" + prefix + ", suffix=" + suffix + ", displayName=" + displayName + ", displayPrefix=" + displayPrefix + ", displaySuffix=" + displaySuffix + ", invisibleName=" + invisibleName + "]";
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,55 +0,0 @@
|
|||||||
package gg.frog.mc.nametags.placeholder;
|
|
||||||
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
import gg.frog.mc.base.PluginMain;
|
|
||||||
import gg.frog.mc.base.config.PluginCfg;
|
|
||||||
import gg.frog.mc.nametags.config.TagNameCfg;
|
|
||||||
import gg.frog.mc.nametags.model.PlayerTagBean;
|
|
||||||
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
|
|
||||||
|
|
||||||
public class TagPlaceholder extends PlaceholderExpansion {
|
|
||||||
|
|
||||||
private PluginMain pm;
|
|
||||||
|
|
||||||
public TagPlaceholder(PluginMain pm) {
|
|
||||||
this.pm = pm;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean persist() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getIdentifier() {
|
|
||||||
return "pttag";
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getPlugin() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getAuthor() {
|
|
||||||
return "GeekFrog";
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getVersion() {
|
|
||||||
return pm.PLUGIN_VERSION;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String onPlaceholderRequest(Player player, String identifier) {
|
|
||||||
if (PluginCfg.TAG_SYSTEM && player != null) {
|
|
||||||
String uuid = pm.getPlayerUUIDByName(player);
|
|
||||||
PlayerTagBean playerTag = TagNameCfg.PLAYER_TAG.get(uuid);
|
|
||||||
if (playerTag != null) {
|
|
||||||
if (identifier.equalsIgnoreCase("fullname")) {
|
|
||||||
return playerTag.getDisplayName();
|
|
||||||
} else if (identifier.equalsIgnoreCase("prefix")) {
|
|
||||||
return playerTag.getDisplayPrefix();
|
|
||||||
} else if (identifier.equalsIgnoreCase("suffix")) {
|
|
||||||
return playerTag.getDisplaySuffix();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,47 +1,31 @@
|
|||||||
package gg.frog.mc.base;
|
package gg.frog.mc.permissionstime;
|
||||||
|
|
||||||
import java.text.MessageFormat;
|
import java.text.MessageFormat;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
|
||||||
import java.util.logging.Logger;
|
|
||||||
|
|
||||||
import org.bstats.bukkit.Metrics;
|
import org.bstats.bukkit.Metrics;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.OfflinePlayer;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.plugin.RegisteredServiceProvider;
|
import org.bukkit.plugin.RegisteredServiceProvider;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
|
||||||
|
|
||||||
import gg.frog.mc.base.config.ConfigManager;
|
|
||||||
import gg.frog.mc.base.config.PluginCfg;
|
|
||||||
import gg.frog.mc.base.listener.BaseListener;
|
|
||||||
import gg.frog.mc.base.utils.FileUtil;
|
import gg.frog.mc.base.utils.FileUtil;
|
||||||
import gg.frog.mc.base.utils.StrUtil;
|
import gg.frog.mc.base.utils.StrUtil;
|
||||||
import gg.frog.mc.base.utils.UpdateCheck;
|
import gg.frog.mc.base.utils.UpdateCheck;
|
||||||
import gg.frog.mc.nametags.listener.TagsListener;
|
import gg.frog.mc.base.utils.PluginBase;
|
||||||
import gg.frog.mc.nametags.placeholder.TagPlaceholder;
|
|
||||||
import gg.frog.mc.permissionstime.command.PtCommand;
|
import gg.frog.mc.permissionstime.command.PtCommand;
|
||||||
|
import gg.frog.mc.permissionstime.config.ConfigManager;
|
||||||
|
import gg.frog.mc.permissionstime.config.PluginCfg;
|
||||||
import gg.frog.mc.permissionstime.database.SqlManager;
|
import gg.frog.mc.permissionstime.database.SqlManager;
|
||||||
import gg.frog.mc.permissionstime.listener.PtListener;
|
import gg.frog.mc.permissionstime.listener.PtListener;
|
||||||
import net.milkbowl.vault.permission.Permission;
|
import net.milkbowl.vault.permission.Permission;
|
||||||
|
|
||||||
public class PluginMain extends JavaPlugin {
|
public class PluginMain extends PluginBase {
|
||||||
|
|
||||||
public String PLUGIN_NAME;
|
public static final String DEPEND_PLUGIN = "Vault";
|
||||||
public String PLUGIN_VERSION;
|
|
||||||
public String PLUGIN_NAME_LOWER_CASE;
|
|
||||||
public static final String DEPEND_PLUGIN = "SQLibrary,Vault";
|
|
||||||
public static final Logger LOG = Logger.getLogger("Minecraft");
|
|
||||||
|
|
||||||
private ConfigManager cm = null;
|
private ConfigManager cm = null;
|
||||||
private PluginMain pm = null;
|
private PluginMain pm = null;
|
||||||
private SqlManager sm = null;
|
private SqlManager sm = null;
|
||||||
private Permission permission = null;
|
private Permission permission = null;
|
||||||
public static boolean enabledHdPlugin;
|
|
||||||
public static boolean enabledPlaceholder;
|
|
||||||
private Map<String, String> PLAYER_UUID_MAP = new ConcurrentHashMap<>();
|
|
||||||
private Map<String, OfflinePlayer> OFFLINE_PLAYER_MAP = new ConcurrentHashMap<>();
|
|
||||||
|
|
||||||
public PluginMain() {
|
public PluginMain() {
|
||||||
PLUGIN_NAME = getDescription().getName();
|
PLUGIN_NAME = getDescription().getName();
|
||||||
@ -77,7 +61,7 @@ public class PluginMain extends JavaPlugin {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
getServer().getScheduler().runTaskAsynchronously(pm, new UpdateCheck(pm));
|
getServer().getScheduler().runTaskAsynchronously(pm, new UpdateCheck(pm, "https://raw.githubusercontent.com/geekfrog/PermissionsTime/master/src/resources/plugin.yml"));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -88,9 +72,7 @@ public class PluginMain extends JavaPlugin {
|
|||||||
* 这里可以注册多个
|
* 这里可以注册多个
|
||||||
*/
|
*/
|
||||||
private void registerListeners() {
|
private void registerListeners() {
|
||||||
pm.getServer().getPluginManager().registerEvents(new BaseListener(pm), pm);
|
|
||||||
pm.getServer().getPluginManager().registerEvents(new PtListener(pm), pm);
|
pm.getServer().getPluginManager().registerEvents(new PtListener(pm), pm);
|
||||||
pm.getServer().getPluginManager().registerEvents(new TagsListener(pm), pm);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -118,11 +100,7 @@ public class PluginMain extends JavaPlugin {
|
|||||||
public Permission getPermission() {
|
public Permission getPermission() {
|
||||||
return permission;
|
return permission;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<String, OfflinePlayer> getOFFLINE_PLAYER_MAP() {
|
|
||||||
return OFFLINE_PLAYER_MAP;
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean checkPluginDepends() {
|
private boolean checkPluginDepends() {
|
||||||
boolean needDepend = false;
|
boolean needDepend = false;
|
||||||
for (String name : DEPEND_PLUGIN.split(",")) {
|
for (String name : DEPEND_PLUGIN.split(",")) {
|
||||||
@ -139,28 +117,6 @@ public class PluginMain extends JavaPlugin {
|
|||||||
getServer().getConsoleSender().sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "§4Cann''t setup database."));
|
getServer().getConsoleSender().sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "§4Cann''t setup database."));
|
||||||
needDepend = true;
|
needDepend = true;
|
||||||
}
|
}
|
||||||
enabledPlaceholder = Bukkit.getPluginManager().isPluginEnabled("PlaceholderAPI");
|
|
||||||
if (!enabledPlaceholder) {
|
|
||||||
getServer().getConsoleSender().sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "§ePlaceholder is not installed or not enabled."));
|
|
||||||
getServer().getConsoleSender().sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "§eSome func will be disabled."));
|
|
||||||
} else {
|
|
||||||
boolean placeholdersHook = false;
|
|
||||||
try {
|
|
||||||
placeholdersHook = new TagPlaceholder(pm).register();
|
|
||||||
} catch (Exception e) {
|
|
||||||
|
|
||||||
}
|
|
||||||
if (!placeholdersHook) {
|
|
||||||
getServer().getConsoleSender().sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "§4Cann''t hook placeholders"));
|
|
||||||
getServer().getConsoleSender().sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "§4The placeholders '%permissionstime_displayname%' Cann''t use."));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
enabledHdPlugin = Bukkit.getPluginManager().isPluginEnabled("HolographicDisplays");
|
|
||||||
if (!enabledHdPlugin) {
|
|
||||||
getServer().getConsoleSender().sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "§eHolographicDisplays is not installed or not enabled."));
|
|
||||||
getServer().getConsoleSender().sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "§eSome func will be disabled."));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (needDepend) {
|
if (needDepend) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -190,51 +146,6 @@ public class PluginMain extends JavaPlugin {
|
|||||||
return sm.updateDatabase();
|
return sm.updateDatabase();
|
||||||
}
|
}
|
||||||
|
|
||||||
public OfflinePlayer getOfflinePlayer(String name) {
|
|
||||||
if (name != null) {
|
|
||||||
OfflinePlayer p = OFFLINE_PLAYER_MAP.get(name);
|
|
||||||
if (p != null)
|
|
||||||
return p;
|
|
||||||
for (OfflinePlayer p2 : getServer().getOfflinePlayers()) {
|
|
||||||
if (p2 == null)
|
|
||||||
continue;
|
|
||||||
if (p2.getName().equalsIgnoreCase(name)) {
|
|
||||||
OFFLINE_PLAYER_MAP.put(name, p2);
|
|
||||||
return p2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getPlayerUUIDByName(Player p) {
|
|
||||||
String uuid = getPlayerUUIDByName(p.getName());
|
|
||||||
if (uuid == null) {
|
|
||||||
return p.getUniqueId().toString();
|
|
||||||
}
|
|
||||||
return uuid;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getPlayerUUIDByName(String name) {
|
|
||||||
if (name != null) {
|
|
||||||
String uuid = PLAYER_UUID_MAP.get(name);
|
|
||||||
if (uuid != null) {
|
|
||||||
return uuid;
|
|
||||||
} else {
|
|
||||||
for (OfflinePlayer p : getServer().getOfflinePlayers()) {
|
|
||||||
if (p == null)
|
|
||||||
continue;
|
|
||||||
if (p.getName().equalsIgnoreCase(name)) {
|
|
||||||
uuid = p.getUniqueId().toString();
|
|
||||||
PLAYER_UUID_MAP.put(name, uuid);
|
|
||||||
return uuid;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void writeFailLog(String content, Object... args) {
|
public void writeFailLog(String content, Object... args) {
|
||||||
FileUtil.writeOnFile(getDataFolder() + "/failure.log", "[" + StrUtil.nowTimeString() + "] " + MessageFormat.format(content, args));
|
FileUtil.writeOnFile(getDataFolder() + "/failure.log", "[" + StrUtil.nowTimeString() + "] " + MessageFormat.format(content, args));
|
||||||
}
|
}
|
@ -4,11 +4,12 @@ import java.util.List;
|
|||||||
|
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
|
||||||
import gg.frog.mc.base.PluginMain;
|
import gg.frog.mc.permissionstime.PluginMain;
|
||||||
import gg.frog.mc.base.config.LangCfg;
|
|
||||||
import gg.frog.mc.base.config.PluginCfg;
|
|
||||||
import gg.frog.mc.base.utils.StrUtil;
|
import gg.frog.mc.base.utils.StrUtil;
|
||||||
|
import gg.frog.mc.base.utils.data.PlayerData;
|
||||||
|
import gg.frog.mc.permissionstime.config.LangCfg;
|
||||||
import gg.frog.mc.permissionstime.config.PackagesCfg;
|
import gg.frog.mc.permissionstime.config.PackagesCfg;
|
||||||
|
import gg.frog.mc.permissionstime.config.PluginCfg;
|
||||||
import gg.frog.mc.permissionstime.database.SqlManager;
|
import gg.frog.mc.permissionstime.database.SqlManager;
|
||||||
import gg.frog.mc.permissionstime.model.cfg.PermissionPackageBean;
|
import gg.frog.mc.permissionstime.model.cfg.PermissionPackageBean;
|
||||||
import gg.frog.mc.permissionstime.model.db.PlayerDataBean;
|
import gg.frog.mc.permissionstime.model.db.PlayerDataBean;
|
||||||
@ -31,33 +32,25 @@ public class GetCmd implements Runnable {
|
|||||||
public void run() {
|
public void run() {
|
||||||
if (args.length == 2) {
|
if (args.length == 2) {
|
||||||
sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + LangCfg.MSG_PROCESSING));
|
sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + LangCfg.MSG_PROCESSING));
|
||||||
String uuid = pm.getPlayerUUIDByName(args[1]);
|
String uuid = PlayerData.getPlayerUUIDByName(args[1]);
|
||||||
if (uuid != null) {
|
if (uuid != null) {
|
||||||
List<PlayerDataBean> ps = sm.getTime(uuid);
|
List<PlayerDataBean> ps = sm.getTime(uuid);
|
||||||
if (ps.size() > 0) {
|
if (ps.size() > 0) {
|
||||||
sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + LangCfg.MSG_NUM_OF_PACKAGES,
|
sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + LangCfg.MSG_NUM_OF_PACKAGES, args[1], ps.size()));
|
||||||
args[1], ps.size()));
|
|
||||||
for (PlayerDataBean pdb : ps) {
|
for (PlayerDataBean pdb : ps) {
|
||||||
String expireString = StrUtil.timestampToString(pdb.getExpire());
|
String expireString = StrUtil.timestampToString(pdb.getExpire());
|
||||||
PermissionPackageBean pc = PackagesCfg.PACKAGES.get(pdb.getPackageName());
|
PermissionPackageBean pc = PackagesCfg.PACKAGES.get(pdb.getPackageName());
|
||||||
if (pc != null && pdb.getGlobal() == pc.getGlobal()) {
|
if (pc != null && pdb.getGlobal() == pc.getGlobal()) {
|
||||||
sender.sendMessage(
|
sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + LangCfg.MSG_EXPIRATION_DATE, pdb.getGlobal() ? "*" : "", pc.getDisplayName(), pdb.getPackageName(), expireString, PlayerDataBean.getLeftTime(pdb.getExpire())));
|
||||||
StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + LangCfg.MSG_EXPIRATION_DATE,
|
|
||||||
pdb.getGlobal() ? "*" : "", pc.getDisplayName(), pdb.getPackageName(),
|
|
||||||
expireString, StrUtil.getLeftTime(pdb.getExpire())));
|
|
||||||
} else {
|
} else {
|
||||||
sender.sendMessage(
|
sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + LangCfg.MSG_EXPIRATION_DATE, pdb.getGlobal() ? "*" : "", LangCfg.MSG_UNKNOWN_PACKAGE, pdb.getPackageName(), expireString, PlayerDataBean.getLeftTime(pdb.getExpire())));
|
||||||
StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + LangCfg.MSG_EXPIRATION_DATE,
|
|
||||||
pdb.getGlobal() ? "*" : "", LangCfg.MSG_UNKNOWN_PACKAGE,
|
|
||||||
pdb.getPackageName(), expireString, StrUtil.getLeftTime(pdb.getExpire())));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + LangCfg.MSG_NO_DATA));
|
sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + LangCfg.MSG_NO_DATA));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
sender.sendMessage(
|
sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + LangCfg.MSG_NO_FIND_PLAYER, args[1]));
|
||||||
StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + LangCfg.MSG_NO_FIND_PLAYER, args[1]));
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + LangCfg.MSG_PARAMETER_MISMATCH));
|
sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + LangCfg.MSG_PARAMETER_MISMATCH));
|
||||||
|
@ -6,11 +6,12 @@ import org.bukkit.OfflinePlayer;
|
|||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import gg.frog.mc.base.PluginMain;
|
import gg.frog.mc.permissionstime.PluginMain;
|
||||||
import gg.frog.mc.base.config.LangCfg;
|
|
||||||
import gg.frog.mc.base.config.PluginCfg;
|
|
||||||
import gg.frog.mc.base.utils.StrUtil;
|
import gg.frog.mc.base.utils.StrUtil;
|
||||||
|
import gg.frog.mc.base.utils.data.PlayerData;
|
||||||
|
import gg.frog.mc.permissionstime.config.LangCfg;
|
||||||
import gg.frog.mc.permissionstime.config.PackagesCfg;
|
import gg.frog.mc.permissionstime.config.PackagesCfg;
|
||||||
|
import gg.frog.mc.permissionstime.config.PluginCfg;
|
||||||
import gg.frog.mc.permissionstime.database.SqlManager;
|
import gg.frog.mc.permissionstime.database.SqlManager;
|
||||||
import gg.frog.mc.permissionstime.model.cfg.PermissionPackageBean;
|
import gg.frog.mc.permissionstime.model.cfg.PermissionPackageBean;
|
||||||
import gg.frog.mc.permissionstime.model.db.PlayerDataBean;
|
import gg.frog.mc.permissionstime.model.db.PlayerDataBean;
|
||||||
@ -63,10 +64,10 @@ public class GiveCmd implements Runnable {
|
|||||||
}
|
}
|
||||||
PermissionPackageBean pack = PackagesCfg.PACKAGES.get(packageName);
|
PermissionPackageBean pack = PackagesCfg.PACKAGES.get(packageName);
|
||||||
if (pack != null) {
|
if (pack != null) {
|
||||||
OfflinePlayer player = pm.getOfflinePlayer(playerName);
|
OfflinePlayer player = PlayerData.getOfflinePlayer(playerName);
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + LangCfg.MSG_PROCESSING));
|
sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + LangCfg.MSG_PROCESSING));
|
||||||
String uuid = pm.getPlayerUUIDByName(playerName);
|
String uuid = PlayerData.getPlayerUUIDByName(playerName);
|
||||||
if (PluginCfg.IS_DEBUG) {
|
if (PluginCfg.IS_DEBUG) {
|
||||||
sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + uuid + "\n" + pack.toString() + "\n" + time + unitName + "."));
|
sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + uuid + "\n" + pack.toString() + "\n" + time + unitName + "."));
|
||||||
}
|
}
|
||||||
|
@ -5,10 +5,11 @@ import java.util.List;
|
|||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import gg.frog.mc.base.PluginMain;
|
import gg.frog.mc.permissionstime.PluginMain;
|
||||||
import gg.frog.mc.base.config.LangCfg;
|
|
||||||
import gg.frog.mc.base.config.PluginCfg;
|
|
||||||
import gg.frog.mc.base.utils.StrUtil;
|
import gg.frog.mc.base.utils.StrUtil;
|
||||||
|
import gg.frog.mc.base.utils.data.PlayerData;
|
||||||
|
import gg.frog.mc.permissionstime.config.LangCfg;
|
||||||
|
import gg.frog.mc.permissionstime.config.PluginCfg;
|
||||||
import gg.frog.mc.permissionstime.database.SqlManager;
|
import gg.frog.mc.permissionstime.database.SqlManager;
|
||||||
import gg.frog.mc.permissionstime.gui.PlayerPermissionShow;
|
import gg.frog.mc.permissionstime.gui.PlayerPermissionShow;
|
||||||
import gg.frog.mc.permissionstime.model.db.PlayerDataBean;
|
import gg.frog.mc.permissionstime.model.db.PlayerDataBean;
|
||||||
@ -34,7 +35,7 @@ public class MeCmd implements Runnable {
|
|||||||
if (isPlayer) {
|
if (isPlayer) {
|
||||||
if (args.length == 1) {
|
if (args.length == 1) {
|
||||||
sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + LangCfg.MSG_PROCESSING));
|
sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + LangCfg.MSG_PROCESSING));
|
||||||
String uuid = pm.getPlayerUUIDByName((Player) sender);
|
String uuid = PlayerData.getPlayerUUIDByName((Player) sender);
|
||||||
List<PlayerDataBean> ps = sm.getTime(uuid);
|
List<PlayerDataBean> ps = sm.getTime(uuid);
|
||||||
PlayerPermissionShow.show((Player) sender, ps);
|
PlayerPermissionShow.show((Player) sender, ps);
|
||||||
} else {
|
} else {
|
||||||
|
@ -4,11 +4,11 @@ import java.util.Map.Entry;
|
|||||||
|
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
|
||||||
import gg.frog.mc.base.PluginMain;
|
import gg.frog.mc.permissionstime.PluginMain;
|
||||||
import gg.frog.mc.base.config.LangCfg;
|
|
||||||
import gg.frog.mc.base.config.PluginCfg;
|
|
||||||
import gg.frog.mc.base.utils.StrUtil;
|
import gg.frog.mc.base.utils.StrUtil;
|
||||||
|
import gg.frog.mc.permissionstime.config.LangCfg;
|
||||||
import gg.frog.mc.permissionstime.config.PackagesCfg;
|
import gg.frog.mc.permissionstime.config.PackagesCfg;
|
||||||
|
import gg.frog.mc.permissionstime.config.PluginCfg;
|
||||||
import gg.frog.mc.permissionstime.model.cfg.PermissionPackageBean;
|
import gg.frog.mc.permissionstime.model.cfg.PermissionPackageBean;
|
||||||
|
|
||||||
public class PackagesCmd implements Runnable {
|
public class PackagesCmd implements Runnable {
|
||||||
|
@ -11,11 +11,8 @@ import org.bukkit.command.TabCompleter;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.InventoryView;
|
import org.bukkit.inventory.InventoryView;
|
||||||
|
|
||||||
import gg.frog.mc.base.PluginMain;
|
|
||||||
import gg.frog.mc.base.config.LangCfg;
|
|
||||||
import gg.frog.mc.base.config.PluginCfg;
|
|
||||||
import gg.frog.mc.base.utils.StrUtil;
|
import gg.frog.mc.base.utils.StrUtil;
|
||||||
import gg.frog.mc.nametags.command.TagCmd;
|
import gg.frog.mc.permissionstime.PluginMain;
|
||||||
import gg.frog.mc.permissionstime.command.GetCmd;
|
import gg.frog.mc.permissionstime.command.GetCmd;
|
||||||
import gg.frog.mc.permissionstime.command.GiveCmd;
|
import gg.frog.mc.permissionstime.command.GiveCmd;
|
||||||
import gg.frog.mc.permissionstime.command.MeCmd;
|
import gg.frog.mc.permissionstime.command.MeCmd;
|
||||||
@ -23,7 +20,9 @@ import gg.frog.mc.permissionstime.command.PackagesCmd;
|
|||||||
import gg.frog.mc.permissionstime.command.RemoveAllCmd;
|
import gg.frog.mc.permissionstime.command.RemoveAllCmd;
|
||||||
import gg.frog.mc.permissionstime.command.RemoveCmd;
|
import gg.frog.mc.permissionstime.command.RemoveCmd;
|
||||||
import gg.frog.mc.permissionstime.command.SetCmd;
|
import gg.frog.mc.permissionstime.command.SetCmd;
|
||||||
|
import gg.frog.mc.permissionstime.config.LangCfg;
|
||||||
import gg.frog.mc.permissionstime.config.PackagesCfg;
|
import gg.frog.mc.permissionstime.config.PackagesCfg;
|
||||||
|
import gg.frog.mc.permissionstime.config.PluginCfg;
|
||||||
import gg.frog.mc.permissionstime.database.SqlManager;
|
import gg.frog.mc.permissionstime.database.SqlManager;
|
||||||
|
|
||||||
public class PtCommand implements CommandExecutor, TabCompleter {
|
public class PtCommand implements CommandExecutor, TabCompleter {
|
||||||
@ -54,7 +53,7 @@ public class PtCommand implements CommandExecutor, TabCompleter {
|
|||||||
if (player.hasPermission("permissionstime.reload")) {
|
if (player.hasPermission("permissionstime.reload")) {
|
||||||
for (Player p : pm.getServer().getOnlinePlayers()) {
|
for (Player p : pm.getServer().getOnlinePlayers()) {
|
||||||
InventoryView inventory = p.getOpenInventory();
|
InventoryView inventory = p.getOpenInventory();
|
||||||
if (inventory != null && (StrUtil.messageFormat(LangCfg.INVENTORY_NAME + "§r§5§9§2§0§1§r").equals(inventory.getTitle()) || StrUtil.messageFormat(LangCfg.TAG_INVENTORY_NAME + "§r§5§9§2§0§2§r").equals(inventory.getTitle()))) {
|
if (inventory != null && (StrUtil.messageFormat(LangCfg.INVENTORY_NAME + "§r§5§9§2§0§1§r").equals(inventory.getTitle()))) {
|
||||||
inventory.close();
|
inventory.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -70,7 +69,7 @@ public class PtCommand implements CommandExecutor, TabCompleter {
|
|||||||
} else {
|
} else {
|
||||||
for (Player p : pm.getServer().getOnlinePlayers()) {
|
for (Player p : pm.getServer().getOnlinePlayers()) {
|
||||||
InventoryView inventory = p.getOpenInventory();
|
InventoryView inventory = p.getOpenInventory();
|
||||||
if (inventory != null && (StrUtil.messageFormat(LangCfg.INVENTORY_NAME + "§r§5§9§2§0§1§r").equals(inventory.getTitle()) || StrUtil.messageFormat(LangCfg.TAG_INVENTORY_NAME + "§r§5§9§2§0§2§r").equals(inventory.getTitle()))) {
|
if (inventory != null && (StrUtil.messageFormat(LangCfg.INVENTORY_NAME + "§r§5§9§2§0§1§r").equals(inventory.getTitle()))) {
|
||||||
inventory.close();
|
inventory.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -86,15 +85,6 @@ public class PtCommand implements CommandExecutor, TabCompleter {
|
|||||||
MeCmd meCmd = new MeCmd(pm, sender, isPlayer, args);
|
MeCmd meCmd = new MeCmd(pm, sender, isPlayer, args);
|
||||||
new Thread(meCmd).start();
|
new Thread(meCmd).start();
|
||||||
}
|
}
|
||||||
} else if (args[0].equalsIgnoreCase("tag")) {
|
|
||||||
if (hasPermission(sender, isPlayer, "permissionstime.tag")) {
|
|
||||||
if (PluginCfg.TAG_SYSTEM) {
|
|
||||||
TagCmd tagCmd = new TagCmd(pm, sender, isPlayer, args);
|
|
||||||
new Thread(tagCmd).start();
|
|
||||||
} else {
|
|
||||||
sender.sendMessage(StrUtil.messageFormat(LangCfg.MSG_FUNC_DISABLED, LangCfg.TAG));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if (args[0].equalsIgnoreCase("give")) {
|
} else if (args[0].equalsIgnoreCase("give")) {
|
||||||
if (hasPermission(sender, isPlayer, "permissionstime.give")) {
|
if (hasPermission(sender, isPlayer, "permissionstime.give")) {
|
||||||
GiveCmd giveCmd = new GiveCmd(pm, sender, args);
|
GiveCmd giveCmd = new GiveCmd(pm, sender, args);
|
||||||
@ -139,9 +129,6 @@ public class PtCommand implements CommandExecutor, TabCompleter {
|
|||||||
if (isPlayer && (sender.hasPermission(pm.PLUGIN_NAME_LOWER_CASE + ".me"))) {
|
if (isPlayer && (sender.hasPermission(pm.PLUGIN_NAME_LOWER_CASE + ".me"))) {
|
||||||
sender.sendMessage(StrUtil.messageFormat(LangCfg.CMD_ME, pm.PLUGIN_NAME_LOWER_CASE));
|
sender.sendMessage(StrUtil.messageFormat(LangCfg.CMD_ME, pm.PLUGIN_NAME_LOWER_CASE));
|
||||||
}
|
}
|
||||||
if (isPlayer && (sender.hasPermission(pm.PLUGIN_NAME_LOWER_CASE + ".tag"))) {
|
|
||||||
sender.sendMessage(StrUtil.messageFormat(LangCfg.CMD_TAG, pm.PLUGIN_NAME_LOWER_CASE));
|
|
||||||
}
|
|
||||||
if (!isPlayer || sender.hasPermission(pm.PLUGIN_NAME_LOWER_CASE + ".packages")) {
|
if (!isPlayer || sender.hasPermission(pm.PLUGIN_NAME_LOWER_CASE + ".packages")) {
|
||||||
sender.sendMessage(StrUtil.messageFormat(LangCfg.CMD_PACKAGES, pm.PLUGIN_NAME_LOWER_CASE));
|
sender.sendMessage(StrUtil.messageFormat(LangCfg.CMD_PACKAGES, pm.PLUGIN_NAME_LOWER_CASE));
|
||||||
}
|
}
|
||||||
@ -189,9 +176,6 @@ public class PtCommand implements CommandExecutor, TabCompleter {
|
|||||||
if ("me".startsWith(args[0]) && (!isPlayer || sender.hasPermission(pm.PLUGIN_NAME_LOWER_CASE + ".me"))) {
|
if ("me".startsWith(args[0]) && (!isPlayer || sender.hasPermission(pm.PLUGIN_NAME_LOWER_CASE + ".me"))) {
|
||||||
tipList.add("me");
|
tipList.add("me");
|
||||||
}
|
}
|
||||||
if ("tag".startsWith(args[0]) && (!isPlayer || sender.hasPermission(pm.PLUGIN_NAME_LOWER_CASE + ".tag"))) {
|
|
||||||
tipList.add("tag");
|
|
||||||
}
|
|
||||||
if ("packages".startsWith(args[0]) && (!isPlayer || sender.hasPermission(pm.PLUGIN_NAME_LOWER_CASE + ".packages"))) {
|
if ("packages".startsWith(args[0]) && (!isPlayer || sender.hasPermission(pm.PLUGIN_NAME_LOWER_CASE + ".packages"))) {
|
||||||
tipList.add("packages");
|
tipList.add("packages");
|
||||||
}
|
}
|
||||||
@ -222,10 +206,6 @@ public class PtCommand implements CommandExecutor, TabCompleter {
|
|||||||
tipList.add(name);
|
tipList.add(name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if ("tag".equalsIgnoreCase(args[0]) && (!isPlayer || sender.hasPermission(pm.PLUGIN_NAME_LOWER_CASE + ".tag"))) {
|
|
||||||
tipList.add("c");
|
|
||||||
tipList.add("p");
|
|
||||||
tipList.add("s");
|
|
||||||
}
|
}
|
||||||
} else if (args.length == 3) {
|
} else if (args.length == 3) {
|
||||||
args[0] = args[0].toLowerCase(Locale.ENGLISH);
|
args[0] = args[0].toLowerCase(Locale.ENGLISH);
|
||||||
|
@ -6,10 +6,11 @@ import org.bukkit.OfflinePlayer;
|
|||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import gg.frog.mc.base.PluginMain;
|
import gg.frog.mc.permissionstime.PluginMain;
|
||||||
import gg.frog.mc.base.config.LangCfg;
|
|
||||||
import gg.frog.mc.base.config.PluginCfg;
|
|
||||||
import gg.frog.mc.base.utils.StrUtil;
|
import gg.frog.mc.base.utils.StrUtil;
|
||||||
|
import gg.frog.mc.base.utils.data.PlayerData;
|
||||||
|
import gg.frog.mc.permissionstime.config.LangCfg;
|
||||||
|
import gg.frog.mc.permissionstime.config.PluginCfg;
|
||||||
import gg.frog.mc.permissionstime.database.SqlManager;
|
import gg.frog.mc.permissionstime.database.SqlManager;
|
||||||
import gg.frog.mc.permissionstime.model.cfg.PermissionPackageBean;
|
import gg.frog.mc.permissionstime.model.cfg.PermissionPackageBean;
|
||||||
import gg.frog.mc.permissionstime.model.db.PlayerDataBean;
|
import gg.frog.mc.permissionstime.model.db.PlayerDataBean;
|
||||||
@ -36,10 +37,10 @@ public class RemoveAllCmd implements Runnable {
|
|||||||
if (args.length == 3 && "t".equalsIgnoreCase(args[2]) && PluginCfg.USE_MYSQL) {
|
if (args.length == 3 && "t".equalsIgnoreCase(args[2]) && PluginCfg.USE_MYSQL) {
|
||||||
delGlobal = true;
|
delGlobal = true;
|
||||||
}
|
}
|
||||||
OfflinePlayer player = pm.getOfflinePlayer(playerName);
|
OfflinePlayer player = PlayerData.getOfflinePlayer(playerName);
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + LangCfg.MSG_PROCESSING));
|
sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + LangCfg.MSG_PROCESSING));
|
||||||
String uuid = pm.getPlayerUUIDByName(playerName);
|
String uuid = PlayerData.getPlayerUUIDByName(playerName);
|
||||||
if (PluginCfg.IS_DEBUG) {
|
if (PluginCfg.IS_DEBUG) {
|
||||||
sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + uuid));
|
sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + uuid));
|
||||||
}
|
}
|
||||||
|
@ -6,11 +6,12 @@ import org.bukkit.OfflinePlayer;
|
|||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import gg.frog.mc.base.PluginMain;
|
import gg.frog.mc.permissionstime.PluginMain;
|
||||||
import gg.frog.mc.base.config.LangCfg;
|
|
||||||
import gg.frog.mc.base.config.PluginCfg;
|
|
||||||
import gg.frog.mc.base.utils.StrUtil;
|
import gg.frog.mc.base.utils.StrUtil;
|
||||||
|
import gg.frog.mc.base.utils.data.PlayerData;
|
||||||
|
import gg.frog.mc.permissionstime.config.LangCfg;
|
||||||
import gg.frog.mc.permissionstime.config.PackagesCfg;
|
import gg.frog.mc.permissionstime.config.PackagesCfg;
|
||||||
|
import gg.frog.mc.permissionstime.config.PluginCfg;
|
||||||
import gg.frog.mc.permissionstime.database.SqlManager;
|
import gg.frog.mc.permissionstime.database.SqlManager;
|
||||||
import gg.frog.mc.permissionstime.model.cfg.PermissionPackageBean;
|
import gg.frog.mc.permissionstime.model.cfg.PermissionPackageBean;
|
||||||
import gg.frog.mc.permissionstime.model.db.PlayerDataBean;
|
import gg.frog.mc.permissionstime.model.db.PlayerDataBean;
|
||||||
@ -40,10 +41,10 @@ public class RemoveCmd implements Runnable {
|
|||||||
}
|
}
|
||||||
PermissionPackageBean pack = PackagesCfg.PACKAGES.get(packageName);
|
PermissionPackageBean pack = PackagesCfg.PACKAGES.get(packageName);
|
||||||
if (pack != null) {
|
if (pack != null) {
|
||||||
OfflinePlayer player = pm.getOfflinePlayer(playerName);
|
OfflinePlayer player = PlayerData.getOfflinePlayer(playerName);
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + LangCfg.MSG_PROCESSING));
|
sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + LangCfg.MSG_PROCESSING));
|
||||||
String uuid = pm.getPlayerUUIDByName(playerName);
|
String uuid = PlayerData.getPlayerUUIDByName(playerName);
|
||||||
if (PluginCfg.IS_DEBUG) {
|
if (PluginCfg.IS_DEBUG) {
|
||||||
sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + uuid + "\n" + pack.toString()));
|
sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + uuid + "\n" + pack.toString()));
|
||||||
}
|
}
|
||||||
|
@ -6,11 +6,12 @@ import org.bukkit.OfflinePlayer;
|
|||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import gg.frog.mc.base.PluginMain;
|
import gg.frog.mc.permissionstime.PluginMain;
|
||||||
import gg.frog.mc.base.config.LangCfg;
|
|
||||||
import gg.frog.mc.base.config.PluginCfg;
|
|
||||||
import gg.frog.mc.base.utils.StrUtil;
|
import gg.frog.mc.base.utils.StrUtil;
|
||||||
|
import gg.frog.mc.base.utils.data.PlayerData;
|
||||||
|
import gg.frog.mc.permissionstime.config.LangCfg;
|
||||||
import gg.frog.mc.permissionstime.config.PackagesCfg;
|
import gg.frog.mc.permissionstime.config.PackagesCfg;
|
||||||
|
import gg.frog.mc.permissionstime.config.PluginCfg;
|
||||||
import gg.frog.mc.permissionstime.database.SqlManager;
|
import gg.frog.mc.permissionstime.database.SqlManager;
|
||||||
import gg.frog.mc.permissionstime.model.cfg.PermissionPackageBean;
|
import gg.frog.mc.permissionstime.model.cfg.PermissionPackageBean;
|
||||||
import gg.frog.mc.permissionstime.model.db.PlayerDataBean;
|
import gg.frog.mc.permissionstime.model.db.PlayerDataBean;
|
||||||
@ -63,10 +64,10 @@ public class SetCmd implements Runnable {
|
|||||||
}
|
}
|
||||||
PermissionPackageBean pack = PackagesCfg.PACKAGES.get(packageName);
|
PermissionPackageBean pack = PackagesCfg.PACKAGES.get(packageName);
|
||||||
if (pack != null) {
|
if (pack != null) {
|
||||||
OfflinePlayer player = pm.getOfflinePlayer(playerName);
|
OfflinePlayer player = PlayerData.getOfflinePlayer(playerName);
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + LangCfg.MSG_PROCESSING));
|
sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + LangCfg.MSG_PROCESSING));
|
||||||
String uuid = pm.getPlayerUUIDByName(playerName);
|
String uuid = PlayerData.getPlayerUUIDByName(playerName);
|
||||||
if (PluginCfg.IS_DEBUG) {
|
if (PluginCfg.IS_DEBUG) {
|
||||||
sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + uuid + "\n" + pack.toString() + "\n" + time + unitName + " ."));
|
sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + uuid + "\n" + pack.toString() + "\n" + time + unitName + " ."));
|
||||||
}
|
}
|
||||||
|
@ -1,23 +1,19 @@
|
|||||||
package gg.frog.mc.base.config;
|
package gg.frog.mc.permissionstime.config;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileOutputStream;
|
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.OutputStream;
|
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
|
||||||
import gg.frog.mc.base.PluginMain;
|
|
||||||
import gg.frog.mc.base.config.LangCfg;
|
|
||||||
import gg.frog.mc.base.config.PluginCfg;
|
|
||||||
import gg.frog.mc.base.utils.FileUtil;
|
import gg.frog.mc.base.utils.FileUtil;
|
||||||
import gg.frog.mc.base.utils.FileUtil.FindFilesDo;
|
import gg.frog.mc.base.utils.FileUtil.FindFilesDo;
|
||||||
import gg.frog.mc.base.utils.config.PluginConfig;
|
import gg.frog.mc.base.utils.config.PluginConfig;
|
||||||
import gg.frog.mc.nametags.config.TagNameCfg;
|
import gg.frog.mc.permissionstime.PluginMain;
|
||||||
import gg.frog.mc.permissionstime.config.PackagesCfg;
|
import gg.frog.mc.permissionstime.config.LangCfg;
|
||||||
|
import gg.frog.mc.permissionstime.config.PluginCfg;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 配置文件管理
|
* 配置文件管理
|
||||||
@ -40,7 +36,6 @@ public class ConfigManager {
|
|||||||
public void initConfig() {
|
public void initConfig() {
|
||||||
cfgMap.put("lang", new LangCfg("lang/" + PluginCfg.LANG + ".yml", pm));
|
cfgMap.put("lang", new LangCfg("lang/" + PluginCfg.LANG + ".yml", pm));
|
||||||
cfgMap.put("packages", new PackagesCfg("packages.yml", pm));
|
cfgMap.put("packages", new PackagesCfg("packages.yml", pm));
|
||||||
cfgMap.put("tagNames", new TagNameCfg("tagNames.yml", pm));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void reloadConfig(CommandSender sender) {
|
public void reloadConfig(CommandSender sender) {
|
||||||
@ -62,27 +57,12 @@ public class ConfigManager {
|
|||||||
@Override
|
@Override
|
||||||
public void process(String fileName, InputStream is) {
|
public void process(String fileName, InputStream is) {
|
||||||
File f = new File(pm.getDataFolder(), fileName);
|
File f = new File(pm.getDataFolder(), fileName);
|
||||||
File parentFolder = f.getParentFile();
|
FileUtil.writeFile(f, is);
|
||||||
if (!parentFolder.exists()) {
|
|
||||||
parentFolder.mkdirs();
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
OutputStream os = new FileOutputStream(f);
|
|
||||||
int bytesRead = 0;
|
|
||||||
byte[] buffer = new byte[8192];
|
|
||||||
while ((bytesRead = is.read(buffer, 0, 8192)) != -1) {
|
|
||||||
os.write(buffer, 0, bytesRead);
|
|
||||||
}
|
|
||||||
os.close();
|
|
||||||
is.close();
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isProcess(String fileName) {
|
public boolean isProcess(String fileName) {
|
||||||
if (fileName.matches("lang/.+\\.yml") || "config.yml".equals(fileName) || "packages.yml".equals(fileName) || "tagNames.yml".equals(fileName)) {
|
if (fileName.matches("lang/.+\\.yml") || "config.yml".equals(fileName) || "packages.yml".equals(fileName)) {
|
||||||
File f = new File(pm.getDataFolder(), fileName);
|
File f = new File(pm.getDataFolder(), fileName);
|
||||||
if (!f.exists()) {
|
if (!f.exists()) {
|
||||||
return true;
|
return true;
|
@ -1,8 +1,8 @@
|
|||||||
package gg.frog.mc.base.config;
|
package gg.frog.mc.permissionstime.config;
|
||||||
|
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
|
||||||
import gg.frog.mc.base.PluginMain;
|
import gg.frog.mc.permissionstime.PluginMain;
|
||||||
import gg.frog.mc.base.utils.config.PluginConfig;
|
import gg.frog.mc.base.utils.config.PluginConfig;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -14,24 +14,18 @@ import gg.frog.mc.base.utils.config.PluginConfig;
|
|||||||
public class LangCfg extends PluginConfig {
|
public class LangCfg extends PluginConfig {
|
||||||
|
|
||||||
public static String INVENTORY_NAME = null;
|
public static String INVENTORY_NAME = null;
|
||||||
public static String TAG_INVENTORY_NAME = null;
|
|
||||||
public static String EXPIRATION_TIME = null;
|
public static String EXPIRATION_TIME = null;
|
||||||
public static String LEFT_TIME = null;
|
public static String LEFT_TIME = null;
|
||||||
public static String TIME_UNIT_D = null;
|
public static String TIME_UNIT_D = null;
|
||||||
public static String TIME_UNIT_H = null;
|
public static String TIME_UNIT_H = null;
|
||||||
public static String TIME_UNIT_M = null;
|
public static String TIME_UNIT_M = null;
|
||||||
public static String TIME_FOREVER = null;
|
public static String TIME_FOREVER = null;
|
||||||
public static String TAG = null;
|
|
||||||
public static String TAG_COLOR_ITEM_NAME = null;
|
|
||||||
public static String TAG_PREFIX_ITEM_NAME = null;
|
|
||||||
public static String TAG_SUFFIX_ITEM_NAME = null;
|
|
||||||
|
|
||||||
public static String MSG_PARAMETER_MISMATCH = null;
|
public static String MSG_PARAMETER_MISMATCH = null;
|
||||||
public static String MSG_TIME_PARAMETER_INCORRECT = null;
|
public static String MSG_TIME_PARAMETER_INCORRECT = null;
|
||||||
public static String MSG_TIME_UNIT_PARAMETER_INCORRECT = null;
|
public static String MSG_TIME_UNIT_PARAMETER_INCORRECT = null;
|
||||||
public static String MSG_PROCESSING = null;
|
public static String MSG_PROCESSING = null;
|
||||||
public static String MSG_NO_DATA = null;
|
public static String MSG_NO_DATA = null;
|
||||||
public static String MSG_NO_TAG_DATA = null;
|
|
||||||
public static String MSG_PACKAGE_NUM = null;
|
public static String MSG_PACKAGE_NUM = null;
|
||||||
public static String MSG_PACKAGE_LIST = null;
|
public static String MSG_PACKAGE_LIST = null;
|
||||||
public static String MSG_PACKAGE_DETAIL = null;
|
public static String MSG_PACKAGE_DETAIL = null;
|
||||||
@ -57,11 +51,9 @@ public class LangCfg extends PluginConfig {
|
|||||||
public static String MSG_UNKNOWN_PACKAGE = null;
|
public static String MSG_UNKNOWN_PACKAGE = null;
|
||||||
public static String MSG_IS_EXPIRATION_DATE = null;
|
public static String MSG_IS_EXPIRATION_DATE = null;
|
||||||
public static String MSG_FUNC_DISABLED = null;
|
public static String MSG_FUNC_DISABLED = null;
|
||||||
public static String MSG_TAG_SET_SUCCESS = null;
|
|
||||||
|
|
||||||
public static String CMD_HELP = null;
|
public static String CMD_HELP = null;
|
||||||
public static String CMD_ME = null;
|
public static String CMD_ME = null;
|
||||||
public static String CMD_TAG = null;
|
|
||||||
public static String CMD_PACKAGES = null;
|
public static String CMD_PACKAGES = null;
|
||||||
public static String CMD_GET = null;
|
public static String CMD_GET = null;
|
||||||
public static String CMD_GIVE = null;
|
public static String CMD_GIVE = null;
|
||||||
@ -81,29 +73,23 @@ public class LangCfg extends PluginConfig {
|
|||||||
@Override
|
@Override
|
||||||
protected void loadToDo(CommandSender sender) {
|
protected void loadToDo(CommandSender sender) {
|
||||||
INVENTORY_NAME = getConfig().getString("inventoryName", "&4===Permissions Packages===");
|
INVENTORY_NAME = getConfig().getString("inventoryName", "&4===Permissions Packages===");
|
||||||
TAG_INVENTORY_NAME = getConfig().getString("tagInventoryName", "&4===Tag Packages===");
|
|
||||||
EXPIRATION_TIME = getConfig().getString("expirationTime", "&4Expiration time: {0}");
|
EXPIRATION_TIME = getConfig().getString("expirationTime", "&4Expiration time: {0}");
|
||||||
LEFT_TIME = getConfig().getString("leftTime", "&4Left time: About {0}{1} {2}{3} {4}{5}");
|
LEFT_TIME = getConfig().getString("leftTime", "&4Left time: About {0}{1} {2}{3} {4}{5}");
|
||||||
TIME_UNIT_D = getConfig().getString("timeUnitD", "day(s)");
|
TIME_UNIT_D = getConfig().getString("timeUnitD", "day(s)");
|
||||||
TIME_UNIT_H = getConfig().getString("timeUnitH", "hour(s)");
|
TIME_UNIT_H = getConfig().getString("timeUnitH", "hour(s)");
|
||||||
TIME_UNIT_M = getConfig().getString("timeUnitM", "minute(s)");
|
TIME_UNIT_M = getConfig().getString("timeUnitM", "minute(s)");
|
||||||
TIME_FOREVER = getConfig().getString("timeForever", "Forever");
|
TIME_FOREVER = getConfig().getString("timeForever", "Forever");
|
||||||
TAG = getConfig().getString("tag", "Tag/Prefix");
|
|
||||||
TAG_COLOR_ITEM_NAME = getConfig().getString("tagColorItemName", "&6&lName Style");
|
|
||||||
TAG_PREFIX_ITEM_NAME = getConfig().getString("tagPrefixItemName", "&6&lTag Prefix");
|
|
||||||
TAG_SUFFIX_ITEM_NAME = getConfig().getString("tagSuffixItemName", "&6&lTag Suffix");
|
|
||||||
|
|
||||||
MSG_PARAMETER_MISMATCH = getConfig().getString("msg.parameterMismatch", "&4Parameter mismatch.");
|
MSG_PARAMETER_MISMATCH = getConfig().getString("msg.parameterMismatch", "&4Parameter mismatch.");
|
||||||
MSG_TIME_PARAMETER_INCORRECT = getConfig().getString("msg.timeParameterIncorrect", "&4The number of time is incorrect. Please enter a nonzero integer.");
|
MSG_TIME_PARAMETER_INCORRECT = getConfig().getString("msg.timeParameterIncorrect", "&4The number of time is incorrect. Please enter a nonzero integer.");
|
||||||
MSG_TIME_UNIT_PARAMETER_INCORRECT = getConfig().getString("msg.timeUnitParameterIncorrect", "&4The number of time unit is incorrect. Please use d/h/m. (d=day, h=hour, m=minute)");
|
MSG_TIME_UNIT_PARAMETER_INCORRECT = getConfig().getString("msg.timeUnitParameterIncorrect", "&4The number of time unit is incorrect. Please use d/h/m. (d=day, h=hour, m=minute)");
|
||||||
MSG_PROCESSING = getConfig().getString("msg.processing", "&2Please wait for processing...");
|
MSG_PROCESSING = getConfig().getString("msg.processing", "&2Please wait for processing...");
|
||||||
MSG_NO_DATA = getConfig().getString("msg.noData", "&4No data for packages.");
|
MSG_NO_DATA = getConfig().getString("msg.noData", "&4No data for packages.");
|
||||||
MSG_NO_TAG_DATA = getConfig().getString("msg.noTagData", "&4No data for tag packages.");
|
|
||||||
MSG_PACKAGE_NUM = getConfig().getString("msg.packageNum", "&4There are {0} kinds of permissions packages.");
|
MSG_PACKAGE_NUM = getConfig().getString("msg.packageNum", "&4There are {0} kinds of permissions packages.");
|
||||||
MSG_PACKAGE_LIST = getConfig().getString("msg.packageList", "{0}packageName: {1}, displayName: {2}");
|
MSG_PACKAGE_LIST = getConfig().getString("msg.packageList", "{0}packageName: {1}, displayName: {2}");
|
||||||
MSG_PACKAGE_DETAIL = getConfig().getString("msg.packageDetail", "packageName: {0}, displayName: {1}&r\\nPermissions: {2}\\nGroups: {3}");
|
MSG_PACKAGE_DETAIL = getConfig().getString("msg.packageDetail", "packageName: {0}, displayName: {1}&r\\nPermissions: {2}\\nGroups: {3}");
|
||||||
MSG_NO_PERMISSION = getConfig().getString("msg.nopermission", "&4You do not have permission to do this.");
|
MSG_NO_PERMISSION = getConfig().getString("msg.nopermission", "&4You do not have permission to do this.");
|
||||||
MSG_CONFIG_RELOADED = getConfig().getString("msg.configReloaded", "&2Configuration overload is complete.");
|
MSG_CONFIG_RELOADED = getConfig().getString("msg.configReloaded", "&2Configuration reload is complete.");
|
||||||
MSG_FAIL_SET_PERMISSION = getConfig().getString("msg.failSetPermission", "&4Failed to modify permissions. Please re-enter the server!");
|
MSG_FAIL_SET_PERMISSION = getConfig().getString("msg.failSetPermission", "&4Failed to modify permissions. Please re-enter the server!");
|
||||||
MSG_NO_FIND_PLAYER = getConfig().getString("msg.noFindPlayer", "&4Can not find player named &2{0}");
|
MSG_NO_FIND_PLAYER = getConfig().getString("msg.noFindPlayer", "&4Can not find player named &2{0}");
|
||||||
MSG_NO_FIND_PACKAGE = getConfig().getString("msg.noFindPackage", "&4Can not find package named &2{0}");
|
MSG_NO_FIND_PACKAGE = getConfig().getString("msg.noFindPackage", "&4Can not find package named &2{0}");
|
||||||
@ -124,11 +110,9 @@ public class LangCfg extends PluginConfig {
|
|||||||
MSG_UNKNOWN_PACKAGE = getConfig().getString("msg.unknownPackage", "Unknown Packages");
|
MSG_UNKNOWN_PACKAGE = getConfig().getString("msg.unknownPackage", "Unknown Packages");
|
||||||
MSG_IS_EXPIRATION_DATE = getConfig().getString("msg.isExpirationDate", "Your package: {0}({1})&r has expired.");
|
MSG_IS_EXPIRATION_DATE = getConfig().getString("msg.isExpirationDate", "Your package: {0}({1})&r has expired.");
|
||||||
MSG_FUNC_DISABLED = getConfig().getString("msg.funcDisabled", "{0} functionality disabled.");
|
MSG_FUNC_DISABLED = getConfig().getString("msg.funcDisabled", "{0} functionality disabled.");
|
||||||
MSG_TAG_SET_SUCCESS = getConfig().getString("msg.tagSetSuccess", "&2Tag Set Success.");
|
|
||||||
|
|
||||||
CMD_HELP = getConfig().getString("cmd.help", "/{0} help \\n&7 - Show commands.");
|
CMD_HELP = getConfig().getString("cmd.help", "/{0} help \\n&7 - Show commands.");
|
||||||
CMD_ME = getConfig().getString("cmd.me", "&6/{0} me \\n&7 - View your packages.");
|
CMD_ME = getConfig().getString("cmd.me", "&6/{0} me \\n&7 - View your packages.");
|
||||||
CMD_TAG = getConfig().getString("cmd.tag", "&6/{0} tag <c/p/s> \\n&7 - Set your color/prefix/suffix of tags.");
|
|
||||||
CMD_PACKAGES = getConfig().getString("cmd.packages", "&6/{0} packages [packageName] \\n&7 - View packages.");
|
CMD_PACKAGES = getConfig().getString("cmd.packages", "&6/{0} packages [packageName] \\n&7 - View packages.");
|
||||||
CMD_GET = getConfig().getString("cmd.get", "&6/{0} get <playerName> \\n&7 - View player packages.");
|
CMD_GET = getConfig().getString("cmd.get", "&6/{0} get <playerName> \\n&7 - View player packages.");
|
||||||
CMD_GIVE = getConfig().getString("cmd.give", "&6/{0} give <playerName> <packageName> <time> <timeUnit:d/h/m> \\n&7 - Give player package some time. (Time accumulation.) \\n&7 timeUnit: d=day, h=hour, m=minute");
|
CMD_GIVE = getConfig().getString("cmd.give", "&6/{0} give <playerName> <packageName> <time> <timeUnit:d/h/m> \\n&7 - Give player package some time. (Time accumulation.) \\n&7 timeUnit: d=day, h=hour, m=minute");
|
@ -17,12 +17,11 @@ import org.bukkit.entity.Player;
|
|||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.inventory.meta.ItemMeta;
|
import org.bukkit.inventory.meta.ItemMeta;
|
||||||
|
|
||||||
import gg.frog.mc.base.PluginMain;
|
|
||||||
import gg.frog.mc.base.config.LangCfg;
|
|
||||||
import gg.frog.mc.base.config.PluginCfg;
|
|
||||||
import gg.frog.mc.base.utils.StrUtil;
|
import gg.frog.mc.base.utils.StrUtil;
|
||||||
import gg.frog.mc.base.utils.config.PluginConfig;
|
import gg.frog.mc.base.utils.config.PluginConfig;
|
||||||
|
import gg.frog.mc.base.utils.data.PlayerData;
|
||||||
import gg.frog.mc.base.utils.nms.ItemUtil;
|
import gg.frog.mc.base.utils.nms.ItemUtil;
|
||||||
|
import gg.frog.mc.permissionstime.PluginMain;
|
||||||
import gg.frog.mc.permissionstime.model.cfg.PermissionPackageBean;
|
import gg.frog.mc.permissionstime.model.cfg.PermissionPackageBean;
|
||||||
import gg.frog.mc.permissionstime.model.db.PlayerDataBean;
|
import gg.frog.mc.permissionstime.model.db.PlayerDataBean;
|
||||||
|
|
||||||
@ -70,11 +69,11 @@ public class PackagesCfg extends PluginConfig {
|
|||||||
allPermissions.addAll(e.getValue().getPermissions());
|
allPermissions.addAll(e.getValue().getPermissions());
|
||||||
allGroups.addAll(e.getValue().getGroups());
|
allGroups.addAll(e.getValue().getGroups());
|
||||||
}
|
}
|
||||||
for (Player player : pm.getServer().getOnlinePlayers()) {
|
for (Player player : pb.getServer().getOnlinePlayers()) {
|
||||||
try {
|
try {
|
||||||
String uuid = pm.getPlayerUUIDByName(player);
|
String uuid = PlayerData.getPlayerUUIDByName(player);
|
||||||
List<PlayerDataBean> pdbList = pm.getSqlManager().getTime(uuid);
|
List<PlayerDataBean> pdbList = ((PluginMain)pb).getSqlManager().getTime(uuid);
|
||||||
PermissionPackageBean.reloadPlayerPermissions(player, pdbList, pm, false);
|
PermissionPackageBean.reloadPlayerPermissions(player, pdbList, ((PluginMain)pb), false);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + LangCfg.MSG_FAIL_SET_PERMISSION));
|
sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + LangCfg.MSG_FAIL_SET_PERMISSION));
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
package gg.frog.mc.base.config;
|
package gg.frog.mc.permissionstime.config;
|
||||||
|
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
|
||||||
import gg.frog.mc.base.PluginMain;
|
|
||||||
import gg.frog.mc.base.utils.config.PluginConfig;
|
import gg.frog.mc.base.utils.config.PluginConfig;
|
||||||
|
import gg.frog.mc.permissionstime.PluginMain;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 插件默认配置
|
* 插件默认配置
|
||||||
@ -16,7 +16,6 @@ public class PluginCfg extends PluginConfig {
|
|||||||
public static String PLUGIN_PREFIX;
|
public static String PLUGIN_PREFIX;
|
||||||
public static boolean IS_METRICS = true;
|
public static boolean IS_METRICS = true;
|
||||||
public static boolean IS_DEBUG = false;
|
public static boolean IS_DEBUG = false;
|
||||||
public static boolean TAG_SYSTEM = false;
|
|
||||||
public static String LANG;
|
public static String LANG;
|
||||||
public static boolean USE_MYSQL = false;
|
public static boolean USE_MYSQL = false;
|
||||||
public static String SQL_SERVER_ID;
|
public static String SQL_SERVER_ID;
|
||||||
@ -36,10 +35,9 @@ public class PluginCfg extends PluginConfig {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void loadToDo(CommandSender sender) {
|
protected void loadToDo(CommandSender sender) {
|
||||||
PLUGIN_PREFIX = setGetDefault("pluginPrefix", "§b[" + pm.PLUGIN_NAME + "] ") + "§r";
|
PLUGIN_PREFIX = setGetDefault("pluginPrefix", "§4[§b" + pb.PLUGIN_NAME + "§4] ") + "§r";
|
||||||
IS_DEBUG = setGetDefault("debug", false);
|
IS_DEBUG = setGetDefault("debug", false);
|
||||||
IS_METRICS = setGetDefault("metrics", true);
|
IS_METRICS = setGetDefault("metrics", true);
|
||||||
TAG_SYSTEM = setGetDefault("tagSystem", false);
|
|
||||||
LANG = setGetDefault("lang", "en");
|
LANG = setGetDefault("lang", "en");
|
||||||
USE_MYSQL = setGetDefault("mysql.enable", false);
|
USE_MYSQL = setGetDefault("mysql.enable", false);
|
||||||
SQL_SERVER_ID = setGetDefault("mysql.serverId", "default");
|
SQL_SERVER_ID = setGetDefault("mysql.serverId", "default");
|
@ -1,7 +1,6 @@
|
|||||||
package gg.frog.mc.base.utils.database;
|
package gg.frog.mc.permissionstime.database;
|
||||||
|
|
||||||
import gg.frog.mc.base.config.PluginCfg;
|
import gg.frog.mc.permissionstime.config.PluginCfg;
|
||||||
import gg.frog.mc.permissionstime.database.SqlManager;
|
|
||||||
import lib.PatPeter.SQLibrary.Database;
|
import lib.PatPeter.SQLibrary.Database;
|
||||||
|
|
||||||
public abstract class DatabaseUtil {
|
public abstract class DatabaseUtil {
|
@ -3,8 +3,8 @@ package gg.frog.mc.permissionstime.database;
|
|||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import gg.frog.mc.base.PluginMain;
|
import gg.frog.mc.permissionstime.PluginMain;
|
||||||
import gg.frog.mc.base.config.PluginCfg;
|
import gg.frog.mc.permissionstime.config.PluginCfg;
|
||||||
import gg.frog.mc.permissionstime.database.impl.MySQLPlayerDataDao;
|
import gg.frog.mc.permissionstime.database.impl.MySQLPlayerDataDao;
|
||||||
import gg.frog.mc.permissionstime.database.impl.SqlitePlayerDataDao;
|
import gg.frog.mc.permissionstime.database.impl.SqlitePlayerDataDao;
|
||||||
import gg.frog.mc.permissionstime.model.db.PlayerDataBean;
|
import gg.frog.mc.permissionstime.model.db.PlayerDataBean;
|
||||||
|
@ -5,11 +5,11 @@ import java.util.ArrayList;
|
|||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import gg.frog.mc.base.PluginMain;
|
import gg.frog.mc.permissionstime.PluginMain;
|
||||||
import gg.frog.mc.base.config.PluginCfg;
|
|
||||||
import gg.frog.mc.base.utils.StrUtil;
|
import gg.frog.mc.base.utils.StrUtil;
|
||||||
import gg.frog.mc.base.utils.database.DatabaseUtil;
|
|
||||||
import gg.frog.mc.permissionstime.config.PackagesCfg;
|
import gg.frog.mc.permissionstime.config.PackagesCfg;
|
||||||
|
import gg.frog.mc.permissionstime.config.PluginCfg;
|
||||||
|
import gg.frog.mc.permissionstime.database.DatabaseUtil;
|
||||||
import gg.frog.mc.permissionstime.database.IPlayerDataDao;
|
import gg.frog.mc.permissionstime.database.IPlayerDataDao;
|
||||||
import gg.frog.mc.permissionstime.database.SqlManager;
|
import gg.frog.mc.permissionstime.database.SqlManager;
|
||||||
import gg.frog.mc.permissionstime.model.db.PlayerDataBean;
|
import gg.frog.mc.permissionstime.model.db.PlayerDataBean;
|
||||||
|
@ -5,11 +5,11 @@ import java.util.ArrayList;
|
|||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import gg.frog.mc.base.PluginMain;
|
import gg.frog.mc.permissionstime.PluginMain;
|
||||||
import gg.frog.mc.base.config.PluginCfg;
|
|
||||||
import gg.frog.mc.base.utils.StrUtil;
|
import gg.frog.mc.base.utils.StrUtil;
|
||||||
import gg.frog.mc.base.utils.database.DatabaseUtil;
|
|
||||||
import gg.frog.mc.permissionstime.config.PackagesCfg;
|
import gg.frog.mc.permissionstime.config.PackagesCfg;
|
||||||
|
import gg.frog.mc.permissionstime.config.PluginCfg;
|
||||||
|
import gg.frog.mc.permissionstime.database.DatabaseUtil;
|
||||||
import gg.frog.mc.permissionstime.database.IPlayerDataDao;
|
import gg.frog.mc.permissionstime.database.IPlayerDataDao;
|
||||||
import gg.frog.mc.permissionstime.database.SqlManager;
|
import gg.frog.mc.permissionstime.database.SqlManager;
|
||||||
import gg.frog.mc.permissionstime.model.db.PlayerDataBean;
|
import gg.frog.mc.permissionstime.model.db.PlayerDataBean;
|
||||||
|
@ -8,10 +8,10 @@ import org.bukkit.inventory.Inventory;
|
|||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.inventory.meta.ItemMeta;
|
import org.bukkit.inventory.meta.ItemMeta;
|
||||||
|
|
||||||
import gg.frog.mc.base.config.LangCfg;
|
|
||||||
import gg.frog.mc.base.config.PluginCfg;
|
|
||||||
import gg.frog.mc.base.utils.StrUtil;
|
import gg.frog.mc.base.utils.StrUtil;
|
||||||
|
import gg.frog.mc.permissionstime.config.LangCfg;
|
||||||
import gg.frog.mc.permissionstime.config.PackagesCfg;
|
import gg.frog.mc.permissionstime.config.PackagesCfg;
|
||||||
|
import gg.frog.mc.permissionstime.config.PluginCfg;
|
||||||
import gg.frog.mc.permissionstime.model.cfg.PermissionPackageBean;
|
import gg.frog.mc.permissionstime.model.cfg.PermissionPackageBean;
|
||||||
import gg.frog.mc.permissionstime.model.db.PlayerDataBean;
|
import gg.frog.mc.permissionstime.model.db.PlayerDataBean;
|
||||||
|
|
||||||
@ -30,7 +30,7 @@ public class PlayerPermissionShow {
|
|||||||
ItemMeta meta = tItem.getItemMeta();
|
ItemMeta meta = tItem.getItemMeta();
|
||||||
List<String> lores = meta.getLore();
|
List<String> lores = meta.getLore();
|
||||||
lores.add(StrUtil.messageFormat(LangCfg.EXPIRATION_TIME, StrUtil.timestampToString(pdb.getExpire())));
|
lores.add(StrUtil.messageFormat(LangCfg.EXPIRATION_TIME, StrUtil.timestampToString(pdb.getExpire())));
|
||||||
lores.add(StrUtil.getLeftTime(pdb.getExpire()));
|
lores.add(PlayerDataBean.getLeftTime(pdb.getExpire()));
|
||||||
meta.setLore(lores);
|
meta.setLore(lores);
|
||||||
tItem.setItemMeta(meta);
|
tItem.setItemMeta(meta);
|
||||||
inventory.addItem(tItem);
|
inventory.addItem(tItem);
|
||||||
|
@ -6,14 +6,15 @@ import org.bukkit.event.EventHandler;
|
|||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||||
|
import org.bukkit.event.player.PlayerJoinEvent;
|
||||||
import org.bukkit.event.player.PlayerKickEvent;
|
import org.bukkit.event.player.PlayerKickEvent;
|
||||||
import org.bukkit.event.player.PlayerLoginEvent;
|
|
||||||
import org.bukkit.event.player.PlayerQuitEvent;
|
import org.bukkit.event.player.PlayerQuitEvent;
|
||||||
|
|
||||||
import gg.frog.mc.base.PluginMain;
|
|
||||||
import gg.frog.mc.base.config.LangCfg;
|
|
||||||
import gg.frog.mc.base.config.PluginCfg;
|
|
||||||
import gg.frog.mc.base.utils.StrUtil;
|
import gg.frog.mc.base.utils.StrUtil;
|
||||||
|
import gg.frog.mc.base.utils.data.PlayerData;
|
||||||
|
import gg.frog.mc.permissionstime.PluginMain;
|
||||||
|
import gg.frog.mc.permissionstime.config.LangCfg;
|
||||||
|
import gg.frog.mc.permissionstime.config.PluginCfg;
|
||||||
import gg.frog.mc.permissionstime.model.cfg.PermissionPackageBean;
|
import gg.frog.mc.permissionstime.model.cfg.PermissionPackageBean;
|
||||||
import gg.frog.mc.permissionstime.model.db.PlayerDataBean;
|
import gg.frog.mc.permissionstime.model.db.PlayerDataBean;
|
||||||
|
|
||||||
@ -25,10 +26,10 @@ public class PtListener implements Listener {
|
|||||||
this.pm = pm;
|
this.pm = pm;
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.MONITOR)
|
@EventHandler(priority = EventPriority.LOWEST)
|
||||||
public void onJoin(PlayerLoginEvent event) {
|
public void onJoin(PlayerJoinEvent event) {
|
||||||
try {
|
try {
|
||||||
String uuid = pm.getPlayerUUIDByName(event.getPlayer());
|
String uuid = PlayerData.getPlayerUUIDByName(event.getPlayer());
|
||||||
List<PlayerDataBean> pdbList = pm.getSqlManager().getTime(uuid);
|
List<PlayerDataBean> pdbList = pm.getSqlManager().getTime(uuid);
|
||||||
PermissionPackageBean.reloadPlayerPermissions(event.getPlayer(), pdbList, pm, false);
|
PermissionPackageBean.reloadPlayerPermissions(event.getPlayer(), pdbList, pm, false);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
@ -13,12 +13,13 @@ import org.bukkit.configuration.MemorySection;
|
|||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
import org.bukkit.scheduler.BukkitTask;
|
import org.bukkit.scheduler.BukkitTask;
|
||||||
|
|
||||||
import gg.frog.mc.base.PluginMain;
|
import gg.frog.mc.permissionstime.PluginMain;
|
||||||
import gg.frog.mc.base.config.LangCfg;
|
|
||||||
import gg.frog.mc.base.config.PluginCfg;
|
|
||||||
import gg.frog.mc.base.utils.StrUtil;
|
import gg.frog.mc.base.utils.StrUtil;
|
||||||
import gg.frog.mc.base.utils.config.IConfigBean;
|
import gg.frog.mc.base.utils.config.IConfigBean;
|
||||||
|
import gg.frog.mc.base.utils.data.PlayerData;
|
||||||
|
import gg.frog.mc.permissionstime.config.LangCfg;
|
||||||
import gg.frog.mc.permissionstime.config.PackagesCfg;
|
import gg.frog.mc.permissionstime.config.PackagesCfg;
|
||||||
|
import gg.frog.mc.permissionstime.config.PluginCfg;
|
||||||
import gg.frog.mc.permissionstime.model.db.PlayerDataBean;
|
import gg.frog.mc.permissionstime.model.db.PlayerDataBean;
|
||||||
import net.milkbowl.vault.permission.Permission;
|
import net.milkbowl.vault.permission.Permission;
|
||||||
|
|
||||||
@ -267,7 +268,7 @@ public class PermissionPackageBean implements IConfigBean {
|
|||||||
addPpb.givePlayer(player, pm.getServer(), pm.getPermission());
|
addPpb.givePlayer(player, pm.getServer(), pm.getPermission());
|
||||||
}
|
}
|
||||||
checkExpire(player, pm);
|
checkExpire(player, pm);
|
||||||
String uuid = pm.getPlayerUUIDByName(player.getPlayer());
|
String uuid = PlayerData.getPlayerUUIDByName(player.getPlayer());
|
||||||
BukkitTask task = taskMap.get(uuid);
|
BukkitTask task = taskMap.get(uuid);
|
||||||
if (pdbList.size() > 0) {
|
if (pdbList.size() > 0) {
|
||||||
delay = (delay / 1000 + 1) * 20;// 1秒=20ticks
|
delay = (delay / 1000 + 1) * 20;// 1秒=20ticks
|
||||||
@ -299,7 +300,7 @@ public class PermissionPackageBean implements IConfigBean {
|
|||||||
subPpb.clearPlayer(player, pm.getServer(), pm.getPermission());
|
subPpb.clearPlayer(player, pm.getServer(), pm.getPermission());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
String uuid = pm.getPlayerUUIDByName(player.getPlayer());
|
String uuid = PlayerData.getPlayerUUIDByName(player.getPlayer());
|
||||||
BukkitTask task = taskMap.get(uuid);
|
BukkitTask task = taskMap.get(uuid);
|
||||||
if (task != null) {
|
if (task != null) {
|
||||||
pm.getServer().getScheduler().cancelTask(task.getTaskId());
|
pm.getServer().getScheduler().cancelTask(task.getTaskId());
|
||||||
@ -307,7 +308,7 @@ public class PermissionPackageBean implements IConfigBean {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void checkExpire(OfflinePlayer player, PluginMain pm) {
|
public static void checkExpire(OfflinePlayer player, PluginMain pm) {
|
||||||
String uuid = pm.getPlayerUUIDByName(player.getPlayer());
|
String uuid = PlayerData.getPlayerUUIDByName(player.getPlayer());
|
||||||
List<PlayerDataBean> playerDataList = pm.getSqlManager().getAllTime(uuid);
|
List<PlayerDataBean> playerDataList = pm.getSqlManager().getAllTime(uuid);
|
||||||
long now = new Date().getTime();
|
long now = new Date().getTime();
|
||||||
for (PlayerDataBean playerData : playerDataList) {
|
for (PlayerDataBean playerData : playerDataList) {
|
||||||
|
@ -1,95 +0,0 @@
|
|||||||
package gg.frog.mc.permissionstime.model.cfg;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.bukkit.configuration.MemorySection;
|
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
|
||||||
|
|
||||||
import gg.frog.mc.base.utils.config.IConfigBean;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 标签包实体类
|
|
||||||
*
|
|
||||||
* @author QiaoPengyu
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public class TagPackageBean implements IConfigBean {
|
|
||||||
|
|
||||||
//所需权限
|
|
||||||
private String permissions;
|
|
||||||
//名称颜色
|
|
||||||
private List<String> namecolor = new ArrayList<>();
|
|
||||||
//前缀
|
|
||||||
private List<String> prefix = new ArrayList<>();
|
|
||||||
//后缀
|
|
||||||
private List<String> suffix = new ArrayList<>();
|
|
||||||
//说明
|
|
||||||
private String description;
|
|
||||||
|
|
||||||
public String getPermissions() {
|
|
||||||
return permissions;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPermissions(String permissions) {
|
|
||||||
this.permissions = permissions;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<String> getNamecolor() {
|
|
||||||
return namecolor;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setNamecolor(List<String> namecolor) {
|
|
||||||
this.namecolor = namecolor;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<String> getPrefix() {
|
|
||||||
return prefix;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPrefix(List<String> prefix) {
|
|
||||||
this.prefix = prefix;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<String> getSuffix() {
|
|
||||||
return suffix;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSuffix(List<String> suffix) {
|
|
||||||
this.suffix = suffix;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDescription() {
|
|
||||||
return description;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDescription(String description) {
|
|
||||||
this.description = description;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public YamlConfiguration toConfig() {
|
|
||||||
YamlConfiguration config = new YamlConfiguration();
|
|
||||||
config.set("permissions", permissions);
|
|
||||||
config.set("namecolor", namecolor);
|
|
||||||
config.set("prefix", prefix);
|
|
||||||
config.set("suffix", suffix);
|
|
||||||
config.set("description", description);
|
|
||||||
return config;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void toConfigBean(MemorySection config) {
|
|
||||||
permissions = config.getString("permissions");
|
|
||||||
namecolor = config.getStringList("namecolor");
|
|
||||||
prefix = config.getStringList("prefix");
|
|
||||||
suffix = config.getStringList("suffix");
|
|
||||||
description = config.getString("description");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return "PermissionPackageBean [permissions=" + permissions + ", namecolor=" + namecolor + ", prefix=" + prefix + ", suffix="
|
|
||||||
+ suffix + ", description=" + description + "]";
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,68 +1,86 @@
|
|||||||
package gg.frog.mc.permissionstime.model.db;
|
package gg.frog.mc.permissionstime.model.db;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
import gg.frog.mc.base.utils.StrUtil;
|
||||||
|
import gg.frog.mc.permissionstime.config.LangCfg;
|
||||||
|
import gg.frog.mc.permissionstime.database.IPlayerDataDao;
|
||||||
|
|
||||||
public class PlayerDataBean {
|
public class PlayerDataBean {
|
||||||
|
|
||||||
private Long id;
|
private static final long dt = 24 * 60 * IPlayerDataDao.TIME_UNIT;
|
||||||
private String uuid;
|
private static final long ht = 60 * IPlayerDataDao.TIME_UNIT;
|
||||||
private String packageName;
|
private static final long mt = IPlayerDataDao.TIME_UNIT;
|
||||||
private Boolean global = false;
|
|
||||||
private Long expire;
|
|
||||||
|
|
||||||
public PlayerDataBean() {
|
private Long id;
|
||||||
super();
|
private String uuid;
|
||||||
}
|
private String packageName;
|
||||||
|
private Boolean global = false;
|
||||||
|
private Long expire;
|
||||||
|
|
||||||
public PlayerDataBean(Long id, String uuid, String packageName, Long expire) {
|
public PlayerDataBean() {
|
||||||
super();
|
super();
|
||||||
this.id = id;
|
}
|
||||||
this.uuid = uuid;
|
|
||||||
this.packageName = packageName;
|
|
||||||
this.expire = expire;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Long getId() {
|
public PlayerDataBean(Long id, String uuid, String packageName, Long expire) {
|
||||||
return id;
|
super();
|
||||||
}
|
this.id = id;
|
||||||
|
this.uuid = uuid;
|
||||||
|
this.packageName = packageName;
|
||||||
|
this.expire = expire;
|
||||||
|
}
|
||||||
|
|
||||||
public void setId(Long id) {
|
public Long getId() {
|
||||||
this.id = id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getUuid() {
|
public void setId(Long id) {
|
||||||
return uuid;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUuid(String uuid) {
|
public String getUuid() {
|
||||||
this.uuid = uuid;
|
return uuid;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getPackageName() {
|
public void setUuid(String uuid) {
|
||||||
return packageName;
|
this.uuid = uuid;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPackageName(String packageName) {
|
public String getPackageName() {
|
||||||
this.packageName = packageName;
|
return packageName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Boolean getGlobal() {
|
public void setPackageName(String packageName) {
|
||||||
return global;
|
this.packageName = packageName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setGlobal(Boolean global) {
|
public Boolean getGlobal() {
|
||||||
this.global = global;
|
return global;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Long getExpire() {
|
public void setGlobal(Boolean global) {
|
||||||
return expire;
|
this.global = global;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setExpire(Long expire) {
|
public Long getExpire() {
|
||||||
this.expire = expire;
|
return expire;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public void setExpire(Long expire) {
|
||||||
public String toString() {
|
this.expire = expire;
|
||||||
return "PlayerDataBean [id=" + id + ", uuid=" + uuid + ", packageName=" + packageName + ", global=" + global + ", expire=" + expire + "]";
|
}
|
||||||
}
|
|
||||||
|
public static String getLeftTime(long time) {
|
||||||
|
long leftTime = time - new Date().getTime();
|
||||||
|
long d = leftTime / dt;
|
||||||
|
long h = (leftTime % dt) / ht;
|
||||||
|
long m = (leftTime % ht) / mt;
|
||||||
|
return StrUtil.messageFormat(LangCfg.LEFT_TIME, d, LangCfg.TIME_UNIT_D, h, LangCfg.TIME_UNIT_H, m, LangCfg.TIME_UNIT_M);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "PlayerDataBean [id=" + id + ", uuid=" + uuid + ", packageName=" + packageName + ", global=" + global + ", expire=" + expire + "]";
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -7,9 +7,6 @@ debug: false
|
|||||||
# 是否同意插件上传统计信息.
|
# 是否同意插件上传统计信息.
|
||||||
# Whether or not you agree with the plugin to upload statistics.
|
# Whether or not you agree with the plugin to upload statistics.
|
||||||
metrics: true
|
metrics: true
|
||||||
# 开启称号系统.
|
|
||||||
# Use prefix system.
|
|
||||||
tagSystem: false
|
|
||||||
# 语言文件名称 在'lang'文件夹内.
|
# 语言文件名称 在'lang'文件夹内.
|
||||||
# Language file name.
|
# Language file name.
|
||||||
lang: zh-cn
|
lang: zh-cn
|
||||||
|
@ -1,27 +1,21 @@
|
|||||||
inventoryName: '&4===Permissions Packages==='
|
inventoryName: '&4===Permissions Packages==='
|
||||||
tagInventoryName: '&4===Tag Packages==='
|
|
||||||
expirationTime: '&4Expiration date: {0}'
|
expirationTime: '&4Expiration date: {0}'
|
||||||
leftTime: '&4Left time: About {0}{1} {2}{3} {4}{5}'
|
leftTime: '&4Left time: About {0}{1} {2}{3} {4}{5}'
|
||||||
timeUnitD: 'day(s)'
|
timeUnitD: 'day(s)'
|
||||||
timeUnitH: 'hour(s)'
|
timeUnitH: 'hour(s)'
|
||||||
timeUnitM: 'minute(s)'
|
timeUnitM: 'minute(s)'
|
||||||
timeForever: 'Forever'
|
timeForever: 'Forever'
|
||||||
tag: 'Tag/Prefix'
|
|
||||||
tagColorItemName: '&6&lName Style'
|
|
||||||
tagPrefixItemName: '&6&lTag Prefix'
|
|
||||||
tagSuffixItemName: '&6&lTag Suffix'
|
|
||||||
msg:
|
msg:
|
||||||
parameterMismatch: '&4Parameter mismatch.'
|
parameterMismatch: '&4Parameter mismatch.'
|
||||||
timeParameterIncorrect: '&4The number of time is incorrect. Please enter a nonzero integer.'
|
timeParameterIncorrect: '&4The number of time is incorrect. Please enter a nonzero integer.'
|
||||||
timeUnitParameterIncorrect: '&4The number of time unit is incorrect. Please use d/h/m. (d=day, h=hour, m=minute)'
|
timeUnitParameterIncorrect: '&4The number of time unit is incorrect. Please use d/h/m. (d=day, h=hour, m=minute)'
|
||||||
processing: '&2Please wait for processing...'
|
processing: '&2Please wait for processing...'
|
||||||
noData: '&4No data for packages.'
|
noData: '&4No data for packages.'
|
||||||
noTagData: '&4No data for tag packages.'
|
|
||||||
packageNum: '&4There are {0} kinds of permissions packages.'
|
packageNum: '&4There are {0} kinds of permissions packages.'
|
||||||
packageList: '{0}packageName: {1}, displayName: {2}'
|
packageList: '{0}packageName: {1}, displayName: {2}'
|
||||||
packageDetail: 'packageName: {0}, displayName: {1}&r\nPermissions: {2}\nGroups: {3}'
|
packageDetail: 'packageName: {0}, displayName: {1}&r\nPermissions: {2}\nGroups: {3}'
|
||||||
nopermission: '&4You do not have permission to do this.'
|
nopermission: '&4You do not have permission to do this.'
|
||||||
configReloaded: '&2Configuration overload is complete.'
|
configReloaded: '&2Configuration reload is complete.'
|
||||||
failSetPermission: '&4Failed to modify permissions. Please re-enter the server!'
|
failSetPermission: '&4Failed to modify permissions. Please re-enter the server!'
|
||||||
noFindPlayer: '&4Can not find player named &2{0}'
|
noFindPlayer: '&4Can not find player named &2{0}'
|
||||||
noFindPackage: '&4Can not find package named &2{0}'
|
noFindPackage: '&4Can not find package named &2{0}'
|
||||||
@ -42,11 +36,9 @@ msg:
|
|||||||
unknownPackage: 'Unknown Packages'
|
unknownPackage: 'Unknown Packages'
|
||||||
isExpirationDate: 'Your package: {0}({1})&r has expired.'
|
isExpirationDate: 'Your package: {0}({1})&r has expired.'
|
||||||
funcDisabled: '{0} functionality disabled.'
|
funcDisabled: '{0} functionality disabled.'
|
||||||
tagSetSuccess: '&2Tag Set Success.'
|
|
||||||
cmd:
|
cmd:
|
||||||
help: '&6/{0} help \n&7 - Show commands.'
|
help: '&6/{0} help \n&7 - Show commands.'
|
||||||
me: '&6/{0} me \n&7 - View your packages.'
|
me: '&6/{0} me \n&7 - View your packages.'
|
||||||
tag: '&6/{0} tag <c/p/s>\n&7 - Set your color/prefix/suffix of tags.'
|
|
||||||
packages: '&6/{0} packages [packageName] \n&7 - View server packages.'
|
packages: '&6/{0} packages [packageName] \n&7 - View server packages.'
|
||||||
get: '&6/{0} get <playerName> \n&7 - View player packages.'
|
get: '&6/{0} get <playerName> \n&7 - View player packages.'
|
||||||
give: '&6/{0} give <playerName> <packageName> <time> <timeUnit:d/h/m> \n&7 - Give player package some time. (Time accumulation.) \n&7 timeUnit: d=day, h=hour, m=minute'
|
give: '&6/{0} give <playerName> <packageName> <time> <timeUnit:d/h/m> \n&7 - Give player package some time. (Time accumulation.) \n&7 timeUnit: d=day, h=hour, m=minute'
|
||||||
|
@ -1,22 +1,16 @@
|
|||||||
inventoryName: '&4===权限仓库==='
|
inventoryName: '&4===权限仓库==='
|
||||||
tagInventoryName: '&4===称号仓库==='
|
|
||||||
expirationTime: '&4到期时间: {0}.'
|
expirationTime: '&4到期时间: {0}.'
|
||||||
leftTime: '&4剩余时间: 大约 {0}{1} {2}{3} {4}{5}'
|
leftTime: '&4剩余时间: 大约 {0}{1} {2}{3} {4}{5}'
|
||||||
timeUnitD: '天'
|
timeUnitD: '天'
|
||||||
timeUnitH: '小时'
|
timeUnitH: '小时'
|
||||||
timeUnitM: '分钟'
|
timeUnitM: '分钟'
|
||||||
timeForever: '永久'
|
timeForever: '永久'
|
||||||
tag: '标签/称号'
|
|
||||||
tagColorItemName: '&6&l昵称效果'
|
|
||||||
tagPrefixItemName: '&6&l昵称前缀'
|
|
||||||
tagSuffixItemName: '&6&l昵称后缀'
|
|
||||||
msg:
|
msg:
|
||||||
parameterMismatch: '&4参数不匹配.'
|
parameterMismatch: '&4参数不匹配.'
|
||||||
timeParameterIncorrect: '&4时间参数不正确,请输入非零整数.'
|
timeParameterIncorrect: '&4时间参数不正确,请输入非零整数.'
|
||||||
timeUnitParameterIncorrect: '&4时间单位不正确. 请使用 d或h或m. (d=天, h=小时, m=分钟)'
|
timeUnitParameterIncorrect: '&4时间单位不正确. 请使用 d或h或m. (d=天, h=小时, m=分钟)'
|
||||||
processing: '&2执行中,请等待...'
|
processing: '&2执行中,请等待...'
|
||||||
noData: '&4暂时无权限包.'
|
noData: '&4暂时无权限包.'
|
||||||
noTagData: '&4暂时无称号包.'
|
|
||||||
packageNum: '&4共有{0}种权限包.'
|
packageNum: '&4共有{0}种权限包.'
|
||||||
packageList: '{0}权限包名: {1}, 显示名称: {2}'
|
packageList: '{0}权限包名: {1}, 显示名称: {2}'
|
||||||
packageDetail: '权限包名: {0}, 显示名称: {1}&r\n权限: {2}\n权限组: {3}'
|
packageDetail: '权限包名: {0}, 显示名称: {1}&r\n权限: {2}\n权限组: {3}'
|
||||||
@ -42,11 +36,9 @@ msg:
|
|||||||
unknownPackage: '未知权限包'
|
unknownPackage: '未知权限包'
|
||||||
isExpirationDate: '你的权限包: {0}({1})&r, 已到期.'
|
isExpirationDate: '你的权限包: {0}({1})&r, 已到期.'
|
||||||
funcDisabled: '&4{0} 功能已被禁用.'
|
funcDisabled: '&4{0} 功能已被禁用.'
|
||||||
tagSetSuccess: '&2称号设置成功.'
|
|
||||||
cmd:
|
cmd:
|
||||||
help: '&6/{0} help \n&7 - 显示所有命令.'
|
help: '&6/{0} help \n&7 - 显示所有命令.'
|
||||||
me: '&6/{0} me \n&7 - 显示自己的权限包.'
|
me: '&6/{0} me \n&7 - 显示自己的权限包.'
|
||||||
tag: '&6/{0} tag <c/p/s>\n&7 - 设置你的昵称颜色/称号前缀/称号后缀.'
|
|
||||||
packages: '&6/{0} packages [权限包名] \n&7 - 查看服务器的(某个)权限包.'
|
packages: '&6/{0} packages [权限包名] \n&7 - 查看服务器的(某个)权限包.'
|
||||||
get: '&6/{0} get <玩家> \n&7 - 查看玩家的权限包.'
|
get: '&6/{0} get <玩家> \n&7 - 查看玩家的权限包.'
|
||||||
give: '&6/{0} give <玩家> <权限包名> <时间> <单位:d或h或m> \n&7 - 给玩家一定时间的权限包. (时间累加.) \n&7 时间单位: d=天, h=小时, m=分钟'
|
give: '&6/{0} give <玩家> <权限包名> <时间> <单位:d或h或m> \n&7 - 给玩家一定时间的权限包. (时间累加.) \n&7 时间单位: d=天, h=小时, m=分钟'
|
||||||
|
@ -1,14 +1,15 @@
|
|||||||
name: ${project.name}
|
name: ${project.name}
|
||||||
version: 0.4.3-SNAPSHOT-b1005
|
version: 0.4.3-SNAPSHOT-b1006
|
||||||
main: gg.frog.mc.base.PluginMain
|
main: gg.frog.mc.permissionstime.PluginMain
|
||||||
author:
|
author:
|
||||||
- GeekFrog
|
- GeekFrog
|
||||||
description: ${project.description}
|
description: ${project.description}
|
||||||
|
depend:
|
||||||
|
- FrogsPluginLib
|
||||||
softdepend:
|
softdepend:
|
||||||
|
- PlaceholderAPI
|
||||||
- SQLibrary
|
- SQLibrary
|
||||||
- Vault
|
- Vault
|
||||||
- PlaceholderAPI
|
|
||||||
- HolographicDisplays
|
|
||||||
commands:
|
commands:
|
||||||
permissionstime:
|
permissionstime:
|
||||||
description: Show all commands.
|
description: Show all commands.
|
||||||
@ -22,7 +23,6 @@ permissions:
|
|||||||
default: op
|
default: op
|
||||||
children:
|
children:
|
||||||
permissionstime.me: true
|
permissionstime.me: true
|
||||||
permissionstime.tag: true
|
|
||||||
permissionstime.reload: true
|
permissionstime.reload: true
|
||||||
permissionstime.give: true
|
permissionstime.give: true
|
||||||
permissionstime.set: true
|
permissionstime.set: true
|
||||||
@ -33,9 +33,6 @@ permissions:
|
|||||||
permissionstime.me:
|
permissionstime.me:
|
||||||
description: View your packages.
|
description: View your packages.
|
||||||
default: true
|
default: true
|
||||||
permissionstime.tag:
|
|
||||||
description: Set your color/prefix/suffix of tags.
|
|
||||||
default: true
|
|
||||||
permissionstime.reload:
|
permissionstime.reload:
|
||||||
description: Reloads the config file.
|
description: Reloads the config file.
|
||||||
default: op
|
default: op
|
||||||
|
@ -1,86 +0,0 @@
|
|||||||
# 默认昵称样式.
|
|
||||||
# Default Name Color.
|
|
||||||
defaultNamecolor: '&6'
|
|
||||||
# 默认前缀.
|
|
||||||
# Default Prefix.
|
|
||||||
defaultPrefix: '&3[player]'
|
|
||||||
# 默认后缀.
|
|
||||||
# Default Suffix.
|
|
||||||
defaultSuffix: ''
|
|
||||||
# 如果你有其他的插件来修改玩家的displayname, 请禁用此项或禁止其他插件修改. 比如Essentials插件.
|
|
||||||
# 如果安装了PlaceholderAPI 可以使用
|
|
||||||
# %pttag_fullname% %pttag_prefix% %pttag_suffix% 来显示displayname prefix+color suffix
|
|
||||||
# If you have other plugin, to modifies player displayname, please disable this.
|
|
||||||
changeDisplayname: true
|
|
||||||
# 使用HolographicDisplays显示称号. 称号可以更长,不会被省略.
|
|
||||||
# use HolographicDisplays to show Tags. The Tag can be more than 16 char
|
|
||||||
useHdPlugin: false
|
|
||||||
# 如果使用了HD, 是否一行显示
|
|
||||||
# One line display the name and tags.
|
|
||||||
oneLineDisplay: true
|
|
||||||
# 称号刷新周期(秒).
|
|
||||||
# 如果你你的称号使用了PlaceholderAPI请设置此项
|
|
||||||
# 推荐600秒以上. 设置-1则禁用刷新.
|
|
||||||
# Title refresh cycle (seconds).
|
|
||||||
# If you use Placeholder, please set.
|
|
||||||
# Recommend more than 600s. Set -1 to disable refresh.
|
|
||||||
refreshTagTime: -1
|
|
||||||
template:
|
|
||||||
lore:
|
|
||||||
- '&1-----------------'
|
|
||||||
- '&2Preview:'
|
|
||||||
- '&3 %displayname%'
|
|
||||||
- '&4-----------------'
|
|
||||||
- '&5 %description%'
|
|
||||||
- '&6-----------------'
|
|
||||||
packages:
|
|
||||||
# 称号包名称.
|
|
||||||
# Tag package name.
|
|
||||||
default:
|
|
||||||
description: '&4The default tag.'
|
|
||||||
permissions: ''
|
|
||||||
namecolor:
|
|
||||||
- '&6'
|
|
||||||
prefix:
|
|
||||||
- '&3[player]'
|
|
||||||
example1:
|
|
||||||
# 称号包描述,可以填写如何获得这些称号.
|
|
||||||
# Tag package describes. You can type how to get these tag.
|
|
||||||
description: '&4Tag package description.'
|
|
||||||
# 称号包所需权限. 不需要权限请留空,输入 ''
|
|
||||||
# Tag package needs permission. Keep null to make no permission.
|
|
||||||
permissions: ''
|
|
||||||
# 称号包所含的昵称样式.
|
|
||||||
# Name Colors.
|
|
||||||
namecolor:
|
|
||||||
- '&3'
|
|
||||||
- '&4:SKULL_ITEM:5'
|
|
||||||
- '&5:SKULL_ITEM:MHF_Present1'
|
|
||||||
# 称号包所含的昵称前缀.
|
|
||||||
# Name prefix.
|
|
||||||
prefix:
|
|
||||||
- '&3[prefix]'
|
|
||||||
- '&4[prefix]:1'
|
|
||||||
# 称号包所含的昵称后缀.
|
|
||||||
# Name suffix.
|
|
||||||
suffix:
|
|
||||||
- '&3[suffix]'
|
|
||||||
- '&4[suffix]:1:6'
|
|
||||||
vip:
|
|
||||||
description: '&4VIP Tags.'
|
|
||||||
permissions: 'player.vip'
|
|
||||||
namecolor:
|
|
||||||
- '&3&l'
|
|
||||||
- '&4&n:SKULL_ITEM:5'
|
|
||||||
- '&5&o:SKULL_ITEM:MHF_Present1'
|
|
||||||
# 称号包所含的昵称前缀.
|
|
||||||
# Name prefix.
|
|
||||||
prefix:
|
|
||||||
- '&3&l[prefix]'
|
|
||||||
- '&4&n[prefix]:1'
|
|
||||||
# 称号包所含的昵称后缀.
|
|
||||||
# Name suffix.
|
|
||||||
suffix:
|
|
||||||
- '&3&o[suffix]'
|
|
||||||
- '&4&l&n[suffix]:1:6'
|
|
||||||
|
|
119
帖子代码.txt
119
帖子代码.txt
@ -19,7 +19,6 @@
|
|||||||
[tr][td][align=center][size=6][color=#ffffff][b]功能/特性[/b][/color][/size][/align][/td][/tr]
|
[tr][td][align=center][size=6][color=#ffffff][b]功能/特性[/b][/color][/size][/align][/td][/tr]
|
||||||
[/table][/align][align=center][table=98%,gray]
|
[/table][/align][align=center][table=98%,gray]
|
||||||
[tr][td][size=4][color=#ffffff][b][list]
|
[tr][td][size=4][color=#ffffff][b][list]
|
||||||
[*]称号管理功能, 默认情况下为关闭状态.(2018-06-15增加)
|
|
||||||
[*]可在配置文件中编辑权限包(可含有多个权限组和多个权限)
|
[*]可在配置文件中编辑权限包(可含有多个权限组和多个权限)
|
||||||
[*]时间可以累加
|
[*]时间可以累加
|
||||||
[*]支持UUID
|
[*]支持UUID
|
||||||
@ -40,25 +39,12 @@
|
|||||||
|
|
||||||
[attachimg]1101065[/attachimg][/spoiler][/td][/tr]
|
[attachimg]1101065[/attachimg][/spoiler][/td][/tr]
|
||||||
[/table][/align][align=center][table=98%,#4169e1]
|
[/table][/align][align=center][table=98%,#4169e1]
|
||||||
[tr][td][align=center][size=6][color=#ffffff][b]称号功能展示[/b][/color][/size][/align][/td][/tr]
|
|
||||||
[/table][/align][align=center][table=98%,gray]
|
|
||||||
[tr][td][size=4][color=#ffffff][b][list]
|
|
||||||
[*]支持Placeholder变量、HolographicDisplays显示称号(解决称号长度限制问题)
|
|
||||||
[*]可以设置称号功能开关、默认称号、是否 修改displayname、是否使用HolographicDisplays、以及称号刷新时间(使用Placeholder变量的话)
|
|
||||||
[*]自带Placeholder变量: %pttag_fullname% %pttag_prefix% %pttag_suffix% 来显示displayname、prefix+color、suffix
|
|
||||||
[/list][/b][/color][/size][/td][/tr]
|
|
||||||
[tr][td][spoiler][attachimg]1214151[/attachimg][attachimg]1214150[/attachimg]
|
|
||||||
[attachimg]1214146[/attachimg][attachimg]1214145[/attachimg]
|
|
||||||
[attachimg]1214147[/attachimg][attachimg]1214148[/attachimg][attachimg]1214149[/attachimg]
|
|
||||||
[/spoiler][/td][/tr]
|
|
||||||
[/table][/align][align=center][table=98%,#4169e1]
|
|
||||||
[tr][td][align=center][size=6][color=#ffffff][b]权限[/b][/color][/size][/align][/td][/tr]
|
[tr][td][align=center][size=6][color=#ffffff][b]权限[/b][/color][/size][/align][/td][/tr]
|
||||||
[/table][/align][align=center][table=98%,gray]
|
[/table][/align][align=center][table=98%,gray]
|
||||||
[tr][td][spoiler][b][table=98%]
|
[tr][td][spoiler][b][table=98%]
|
||||||
[tr=#dda0dd][td]权限[/td][td]用途[/td][td]默认权限归属[/td][/tr]
|
[tr=#dda0dd][td]权限[/td][td]用途[/td][td]默认权限归属[/td][/tr]
|
||||||
[tr=#f5deb3][td]permissionstime.*[/td][td]插件的全部权限.[/td][td]op默认拥有.[/td][/tr]
|
[tr=#f5deb3][td]permissionstime.*[/td][td]插件的全部权限.[/td][td]op默认拥有.[/td][/tr]
|
||||||
[tr=#fffacd][td]permissionstime.me[/td][td]查看你自己拥有的权限包.[/td][td]玩家默认拥有.[/td][/tr]
|
[tr=#fffacd][td]permissionstime.me[/td][td]查看你自己拥有的权限包.[/td][td]玩家默认拥有.[/td][/tr]
|
||||||
[tr=#fffacd][td]permissionstime.tag[/td][td]设置你自己拥有的称号.[/td][td]玩家默认拥有.[/td][/tr]
|
|
||||||
[tr=#f5deb3][td]permissionstime.packages[/td][td]查看服务器拥有权限包的权限.[/td][td]op默认拥有.[/td][/tr]
|
[tr=#f5deb3][td]permissionstime.packages[/td][td]查看服务器拥有权限包的权限.[/td][td]op默认拥有.[/td][/tr]
|
||||||
[tr=#fffacd][td]permissionstime.get[/td][td]查看玩家拥有的权限包.[/td][td]op默认拥有.[/td][/tr]
|
[tr=#fffacd][td]permissionstime.get[/td][td]查看玩家拥有的权限包.[/td][td]op默认拥有.[/td][/tr]
|
||||||
[tr=#f5deb3][td]permissionstime.give[/td][td]给予玩家权限包使用时间的权限.[/td][td]op默认拥有.[/td][/tr]
|
[tr=#f5deb3][td]permissionstime.give[/td][td]给予玩家权限包使用时间的权限.[/td][td]op默认拥有.[/td][/tr]
|
||||||
@ -75,7 +61,6 @@
|
|||||||
[tr=#dda0dd][td]命令[/td][td]用途[/td][/tr]
|
[tr=#dda0dd][td]命令[/td][td]用途[/td][/tr]
|
||||||
[tr=#f5deb3][td][i]/permissionstime[/i][/td][td]查看全部命令[/td][/tr]
|
[tr=#f5deb3][td][i]/permissionstime[/i][/td][td]查看全部命令[/td][/tr]
|
||||||
[tr=#fffacd][td][i]/permissionstime me[/i][/td][td]查看你自己拥有的权限包.[/td][/tr]
|
[tr=#fffacd][td][i]/permissionstime me[/i][/td][td]查看你自己拥有的权限包.[/td][/tr]
|
||||||
[tr=#fffacd][td][i]/permissionstime tag [c/p/s][/i][/td][td]设置你的昵称颜色/称号前缀/称号后缀.[/td][/tr]
|
|
||||||
[tr=#f5deb3][td][i]/permissionstime packages [权限包名][/i][/td][td]查看服务器拥有的权限包(输入第二个参数可以查看该权限包的详细信息).[/td][/tr]
|
[tr=#f5deb3][td][i]/permissionstime packages [权限包名][/i][/td][td]查看服务器拥有的权限包(输入第二个参数可以查看该权限包的详细信息).[/td][/tr]
|
||||||
[tr=#fffacd][td][i]/permissionstime get<玩家名>[/i][/td][td]查看玩家拥有的权限包.[/td][/tr]
|
[tr=#fffacd][td][i]/permissionstime get<玩家名>[/i][/td][td]查看玩家拥有的权限包.[/td][/tr]
|
||||||
[tr=#f5deb3][td][i]/permissionstime give <玩家> <权限包名> <时间> <单位:d或h或m>[/i][/td][td]给玩家某个权限包一定时间的使用时间. 时间单位: d=天, h=小时, m=分钟[/td][/tr]
|
[tr=#f5deb3][td][i]/permissionstime give <玩家> <权限包名> <时间> <单位:d或h或m>[/i][/td][td]给玩家某个权限包一定时间的使用时间. 时间单位: d=天, h=小时, m=分钟[/td][/tr]
|
||||||
@ -99,9 +84,6 @@ debug: false
|
|||||||
# 是否同意插件上传统计信息.
|
# 是否同意插件上传统计信息.
|
||||||
# Whether or not you agree with the plugin to upload statistics.
|
# Whether or not you agree with the plugin to upload statistics.
|
||||||
metrics: true
|
metrics: true
|
||||||
# 开启称号系统.
|
|
||||||
# Use prefix system.
|
|
||||||
tagSystem: false
|
|
||||||
# 语言文件名称 在'lang'文件夹内.
|
# 语言文件名称 在'lang'文件夹内.
|
||||||
# Language file name.
|
# Language file name.
|
||||||
lang: zh-cn
|
lang: zh-cn
|
||||||
@ -175,114 +157,21 @@ packages:
|
|||||||
- 'say %player% 的权限包到期了.'
|
- 'say %player% 的权限包到期了.'
|
||||||
- 'say 请及时续期.'
|
- 'say 请及时续期.'
|
||||||
|
|
||||||
[/code]tagNames.yml
|
[/code]
|
||||||
[code]
|
|
||||||
# 默认昵称样式.
|
|
||||||
# Default Name Color.
|
|
||||||
defaultNamecolor: '&6'
|
|
||||||
# 默认前缀.
|
|
||||||
# Default Prefix.
|
|
||||||
defaultPrefix: '&3[player]'
|
|
||||||
# 默认后缀.
|
|
||||||
# Default Suffix.
|
|
||||||
defaultSuffix: ''
|
|
||||||
# 如果你有其他的插件来修改玩家的displayname, 请禁用此项或禁止其他插件修改. 比如Essentials插件.
|
|
||||||
# 如果安装了PlaceholderAPI 可以使用
|
|
||||||
# %pttag_fullname% %pttag_prefix% %pttag_suffix% 来显示displayname prefix+color suffix
|
|
||||||
# If you have other plugin, to modifies player displayname, please disable this.
|
|
||||||
changeDisplayname: true
|
|
||||||
# 使用HolographicDisplays显示称号. 称号可以更长,不会被省略.
|
|
||||||
# use HolographicDisplays to show Tags. The Tag can be more than 16 char
|
|
||||||
useHdPlugin: false
|
|
||||||
# 如果使用了HD, 是否一行显示
|
|
||||||
# One line display the name and tags.
|
|
||||||
oneLineDisplay: true
|
|
||||||
# 称号刷新周期(秒).
|
|
||||||
# 如果你你的称号使用了PlaceholderAPI请设置此项
|
|
||||||
# 推荐600秒以上. 设置-1则禁用刷新.
|
|
||||||
# Title refresh cycle (seconds).
|
|
||||||
# If you use Placeholder, please set.
|
|
||||||
# Recommend more than 600s. Set -1 to disable refresh.
|
|
||||||
refreshTagTime: -1
|
|
||||||
template:
|
|
||||||
lore:
|
|
||||||
- '&1-----------------'
|
|
||||||
- '&2Preview:'
|
|
||||||
- '&3 %displayname%'
|
|
||||||
- '&4-----------------'
|
|
||||||
- '&5 %description%'
|
|
||||||
- '&6-----------------'
|
|
||||||
packages:
|
|
||||||
# 称号包名称.
|
|
||||||
# Tag package name.
|
|
||||||
default:
|
|
||||||
description: '&4The default tag.'
|
|
||||||
permissions: ''
|
|
||||||
namecolor:
|
|
||||||
- '&6'
|
|
||||||
prefix:
|
|
||||||
- '&3[player]'
|
|
||||||
example1:
|
|
||||||
# 称号包描述,可以填写如何获得这些称号.
|
|
||||||
# Tag package describes. You can type how to get these tag.
|
|
||||||
description: '&4Tag package description.'
|
|
||||||
# 称号包所需权限. 不需要权限请留空,输入 ''
|
|
||||||
# Tag package needs permission. Keep null to make no permission.
|
|
||||||
permissions: ''
|
|
||||||
# 称号包所含的昵称样式.
|
|
||||||
# Name Colors.
|
|
||||||
namecolor:
|
|
||||||
- '&3'
|
|
||||||
- '&4:SKULL_ITEM:5'
|
|
||||||
- '&5:SKULL_ITEM:MHF_Present1'
|
|
||||||
# 称号包所含的昵称前缀.
|
|
||||||
# Name prefix.
|
|
||||||
prefix:
|
|
||||||
- '&3[prefix]'
|
|
||||||
- '&4[prefix]:1'
|
|
||||||
# 称号包所含的昵称后缀.
|
|
||||||
# Name suffix.
|
|
||||||
suffix:
|
|
||||||
- '&3[suffix]'
|
|
||||||
- '&4[suffix]:1:6'
|
|
||||||
vip:
|
|
||||||
description: '&4VIP Tags.'
|
|
||||||
permissions: 'player.vip'
|
|
||||||
namecolor:
|
|
||||||
- '&3&l'
|
|
||||||
- '&4&n:SKULL_ITEM:5'
|
|
||||||
- '&5&o:SKULL_ITEM:MHF_Present1'
|
|
||||||
# 称号包所含的昵称前缀.
|
|
||||||
# Name prefix.
|
|
||||||
prefix:
|
|
||||||
- '&3&l[prefix]'
|
|
||||||
- '&4&n[prefix]:1'
|
|
||||||
# 称号包所含的昵称后缀.
|
|
||||||
# Name suffix.
|
|
||||||
suffix:
|
|
||||||
- '&3&o[suffix]'
|
|
||||||
- '&4&l&n[suffix]:1:6'
|
|
||||||
[/code]
|
|
||||||
[font=-apple-system, BlinkMacSystemFont,][color=#000000]简体中文 zh-cn.yml[/color][/font][code]
|
[font=-apple-system, BlinkMacSystemFont,][color=#000000]简体中文 zh-cn.yml[/color][/font][code]
|
||||||
inventoryName: '&4===权限仓库==='
|
inventoryName: '&4===权限仓库==='
|
||||||
tagInventoryName: '&4===称号仓库==='
|
|
||||||
expirationTime: '&4到期时间: {0}.'
|
expirationTime: '&4到期时间: {0}.'
|
||||||
leftTime: '&4剩余时间: 大约 {0}{1} {2}{3} {4}{5}'
|
leftTime: '&4剩余时间: 大约 {0}{1} {2}{3} {4}{5}'
|
||||||
timeUnitD: '天'
|
timeUnitD: '天'
|
||||||
timeUnitH: '小时'
|
timeUnitH: '小时'
|
||||||
timeUnitM: '分钟'
|
timeUnitM: '分钟'
|
||||||
timeForever: '永久'
|
timeForever: '永久'
|
||||||
tag: '标签/称号'
|
|
||||||
tagColorItemName: '&6&l昵称效果'
|
|
||||||
tagPrefixItemName: '&6&l昵称前缀'
|
|
||||||
tagSuffixItemName: '&6&l昵称后缀'
|
|
||||||
msg:
|
msg:
|
||||||
parameterMismatch: '&4参数不匹配.'
|
parameterMismatch: '&4参数不匹配.'
|
||||||
timeParameterIncorrect: '&4时间参数不正确,请输入非零整数.'
|
timeParameterIncorrect: '&4时间参数不正确,请输入非零整数.'
|
||||||
timeUnitParameterIncorrect: '&4时间单位不正确. 请使用 d或h或m. (d=天, h=小时, m=分钟)'
|
timeUnitParameterIncorrect: '&4时间单位不正确. 请使用 d或h或m. (d=天, h=小时, m=分钟)'
|
||||||
processing: '&2执行中,请等待...'
|
processing: '&2执行中,请等待...'
|
||||||
noData: '&4暂时无权限包.'
|
noData: '&4暂时无权限包.'
|
||||||
noTagData: '&4暂时无称号包.'
|
|
||||||
packageNum: '&4共有{0}种权限包.'
|
packageNum: '&4共有{0}种权限包.'
|
||||||
packageList: '{0}权限包名: {1}, 显示名称: {2}'
|
packageList: '{0}权限包名: {1}, 显示名称: {2}'
|
||||||
packageDetail: '权限包名: {0}, 显示名称: {1}&r\n权限: {2}\n权限组: {3}'
|
packageDetail: '权限包名: {0}, 显示名称: {1}&r\n权限: {2}\n权限组: {3}'
|
||||||
@ -308,11 +197,9 @@ msg:
|
|||||||
unknownPackage: '未知权限包'
|
unknownPackage: '未知权限包'
|
||||||
isExpirationDate: '你的权限包: {0}({1})&r, 已到期.'
|
isExpirationDate: '你的权限包: {0}({1})&r, 已到期.'
|
||||||
funcDisabled: '&4{0} 功能已被禁用.'
|
funcDisabled: '&4{0} 功能已被禁用.'
|
||||||
tagSetSuccess: '&2称号设置成功.'
|
|
||||||
cmd:
|
cmd:
|
||||||
help: '&6/{0} help \n&7 - 显示所有命令.'
|
help: '&6/{0} help \n&7 - 显示所有命令.'
|
||||||
me: '&6/{0} me \n&7 - 显示自己的权限包.'
|
me: '&6/{0} me \n&7 - 显示自己的权限包.'
|
||||||
tag: '&6/{0} tag <c/p/s>\n&7 - 设置你的昵称颜色/称号前缀/称号后缀.'
|
|
||||||
packages: '&6/{0} packages [权限包名] \n&7 - 查看服务器的(某个)权限包.'
|
packages: '&6/{0} packages [权限包名] \n&7 - 查看服务器的(某个)权限包.'
|
||||||
get: '&6/{0} get <玩家> \n&7 - 查看玩家的权限包.'
|
get: '&6/{0} get <玩家> \n&7 - 查看玩家的权限包.'
|
||||||
give: '&6/{0} give <玩家> <权限包名> <时间> <单位:d或h或m> \n&7 - 给玩家一定时间的权限包. (时间累加.) \n&7 时间单位: d=天, h=小时, m=分钟'
|
give: '&6/{0} give <玩家> <权限包名> <时间> <单位:d或h或m> \n&7 - 给玩家一定时间的权限包. (时间累加.) \n&7 时间单位: d=天, h=小时, m=分钟'
|
||||||
@ -374,6 +261,8 @@ cmd:
|
|||||||
[/table][/align][align=center][table=98%,#4169e1]
|
[/table][/align][align=center][table=98%,#4169e1]
|
||||||
[tr][td][align=center][size=6][color=#ffffff][b]使用统计[/b][/color][/size][/align][/td][/tr]
|
[tr][td][align=center][size=6][color=#ffffff][b]使用统计[/b][/color][/size][/align][/td][/tr]
|
||||||
[/table][/align][align=center][table=98%,gray]
|
[/table][/align][align=center][table=98%,gray]
|
||||||
[tr][td][align=center][url=https://bstats.org/plugin/bukkit/PermissionsTime][size=4][b]https://bstats.org/plugin/bukkit/PermissionsTime[/b][/size][/url][/align][/td][/tr]
|
[tr][td][align=center][url=https://bstats.org/plugin/bukkit/PermissionsTime][size=4][b]https://bstats.org/plugin/bukkit/PermissionsTime[/b][/size][/url]
|
||||||
|
本插件所用所有代码均为原创,不存在借用/抄袭等行为
|
||||||
|
[/align][/td][/tr]
|
||||||
[/table][/align][/td][/tr]
|
[/table][/align][/td][/tr]
|
||||||
[/table][/font][/align]
|
[/table][/font][/align]
|
Loading…
Reference in New Issue
Block a user