diff --git a/pom.xml b/pom.xml
index 81b8dfd..77cc828 100644
--- a/pom.xml
+++ b/pom.xml
@@ -4,7 +4,7 @@
4.0.0
gg.frog.mc
permissionstime
- 0.3.0-SNAPSHOT
+ 0.3.1-SNAPSHOT
jar
PermissionsTime
支持跨服的权限限时插件
diff --git a/src/main/gg/frog/mc/permissionstime/command/GetCmd.java b/src/main/gg/frog/mc/permissionstime/command/GetCmd.java
index c486bc2..7c6313e 100644
--- a/src/main/gg/frog/mc/permissionstime/command/GetCmd.java
+++ b/src/main/gg/frog/mc/permissionstime/command/GetCmd.java
@@ -16,45 +16,53 @@ import gg.frog.mc.permissionstime.utils.StrUtil;
public class GetCmd implements Runnable {
- private PluginMain pm;
- private SqlManager sm;
- private String[] args;
- private CommandSender sender;
+ private PluginMain pm;
+ private SqlManager sm;
+ private String[] args;
+ private CommandSender sender;
- public GetCmd(PluginMain pm, CommandSender sender, String[] args) {
- this.pm = pm;
- this.sm = pm.getSqlManager();
- this.sender = sender;
- this.args = args;
- }
+ public GetCmd(PluginMain pm, CommandSender sender, String[] args) {
+ this.pm = pm;
+ this.sm = pm.getSqlManager();
+ this.sender = sender;
+ this.args = args;
+ }
- @Override
- public void run() {
- if (args.length == 2) {
- sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + LangCfg.MSG_PROCESSING));
- OfflinePlayer p = pm.getOfflinePlayer(args[1]);
- if (p != null) {
- List ps = sm.getTime(p.getUniqueId().toString());
- if (ps.size() > 0) {
- sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + LangCfg.MSG_NUM_OF_PACKAGES, args[1], ps.size()));
- for (PlayerDataBean pdb : ps) {
- String expireString = StrUtil.timestampToString(pdb.getExpire());
- PermissionPackageBean pc = PackagesCfg.PACKAGES.get(pdb.getPackageName());
- if (pc != null) {
- sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + LangCfg.MSG_EXPIRATION_DATE, pdb.getGlobal() ? "*" : "", pc.getDisplayName(), pdb.getPackageName(), expireString, StrUtil.getLeftTime(pdb.getExpire())));
- } else {
- sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + LangCfg.MSG_EXPIRATION_DATE, pdb.getGlobal() ? "*" : "", LangCfg.MSG_UNKNOWN_PACKAGE, pdb.getPackageName(), expireString, StrUtil.getLeftTime(pdb.getExpire())));
- }
- }
- } else {
- sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + LangCfg.MSG_NO_DATA));
- }
- } else {
- sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + LangCfg.MSG_NO_FIND_PLAYER, args[1]));
- }
- } else {
- sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + LangCfg.MSG_PARAMETER_MISMATCH));
- sender.sendMessage(StrUtil.messageFormat(LangCfg.CMD_GET, pm.PLUGIN_NAME_LOWER_CASE));
- }
- }
+ @Override
+ public void run() {
+ if (args.length == 2) {
+ sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + LangCfg.MSG_PROCESSING));
+ OfflinePlayer p = pm.getOfflinePlayer(args[1]);
+ if (p != null) {
+ List ps = sm.getTime(p.getUniqueId().toString());
+ if (ps.size() > 0) {
+ sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + LangCfg.MSG_NUM_OF_PACKAGES,
+ args[1], ps.size()));
+ for (PlayerDataBean pdb : ps) {
+ String expireString = StrUtil.timestampToString(pdb.getExpire());
+ PermissionPackageBean pc = PackagesCfg.PACKAGES.get(pdb.getPackageName());
+ if (!pdb.getGlobal() || pc != null) {
+ sender.sendMessage(StrUtil.messageFormat(
+ PluginCfg.PLUGIN_PREFIX + LangCfg.MSG_EXPIRATION_DATE, pdb.getGlobal() ? "*" : "",
+ pc != null ? pc.getDisplayName() : LangCfg.MSG_UNKNOWN_PACKAGE,
+ pdb.getPackageName(), expireString, StrUtil.getLeftTime(pdb.getExpire())));
+ } else {
+ sender.sendMessage(
+ StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + LangCfg.MSG_EXPIRATION_DATE,
+ pdb.getGlobal() ? "*" : "", LangCfg.MSG_UNKNOWN_PACKAGE,
+ pdb.getPackageName(), expireString, StrUtil.getLeftTime(pdb.getExpire())));
+ }
+ }
+ } else {
+ sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + LangCfg.MSG_NO_DATA));
+ }
+ } else {
+ sender.sendMessage(
+ StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + LangCfg.MSG_NO_FIND_PLAYER, args[1]));
+ }
+ } else {
+ sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + LangCfg.MSG_PARAMETER_MISMATCH));
+ sender.sendMessage(StrUtil.messageFormat(LangCfg.CMD_GET, pm.PLUGIN_NAME_LOWER_CASE));
+ }
+ }
}
diff --git a/src/main/gg/frog/mc/permissionstime/gui/PlayerPermissionShow.java b/src/main/gg/frog/mc/permissionstime/gui/PlayerPermissionShow.java
index d0e82ff..4a51ab7 100644
--- a/src/main/gg/frog/mc/permissionstime/gui/PlayerPermissionShow.java
+++ b/src/main/gg/frog/mc/permissionstime/gui/PlayerPermissionShow.java
@@ -10,6 +10,7 @@ import org.bukkit.inventory.meta.ItemMeta;
import gg.frog.mc.permissionstime.config.LangCfg;
import gg.frog.mc.permissionstime.config.PackagesCfg;
+import gg.frog.mc.permissionstime.model.cfg.PermissionPackageBean;
import gg.frog.mc.permissionstime.model.db.PlayerDataBean;
import gg.frog.mc.permissionstime.utils.StrUtil;
@@ -18,8 +19,9 @@ public class PlayerPermissionShow {
public static void show(Player p, List pdbList) {
Inventory inventory = Bukkit.createInventory(null, (pdbList.size() % 9 == 0 ? pdbList.size() : (pdbList.size() / 9 + 1) * 9), StrUtil.messageFormat(LangCfg.INVENTORY_NAME + "&r&5&9&2&0&r"));
for (PlayerDataBean pdb : pdbList) {
- ItemStack item = PackagesCfg.PACKAGE_ITEMS.get(pdb.getPackageName());
- if (item != null) {
+ PermissionPackageBean ppb = PackagesCfg.PACKAGES.get(pdb.getPackageName());
+ if (ppb != null && pdb.getGlobal() == ppb.getGlobal()) {
+ ItemStack item = PackagesCfg.PACKAGE_ITEMS.get(pdb.getPackageName());
ItemStack tItem = item.clone();
ItemMeta meta = tItem.getItemMeta();
List lores = meta.getLore();
diff --git a/src/main/gg/frog/mc/permissionstime/model/cfg/PermissionPackageBean.java b/src/main/gg/frog/mc/permissionstime/model/cfg/PermissionPackageBean.java
index 6d877af..66f2760 100644
--- a/src/main/gg/frog/mc/permissionstime/model/cfg/PermissionPackageBean.java
+++ b/src/main/gg/frog/mc/permissionstime/model/cfg/PermissionPackageBean.java
@@ -246,7 +246,7 @@ public class PermissionPackageBean implements IConfigBean {
}
}
PermissionPackageBean p = PackagesCfg.PACKAGES.get(pdb.getPackageName());
- if (p != null) {
+ if (p != null && pdb.getGlobal() == p.getGlobal()) {
addPpb.getPermissions().addAll(p.getPermissions());
subPpb.getPermissions().removeAll(p.getPermissions());
addPpb.getGroups().addAll(p.getGroups());
@@ -308,27 +308,32 @@ public class PermissionPackageBean implements IConfigBean {
for (PlayerDataBean playerData : playerDataList) {
if (playerData.getExpire() < now) {
PermissionPackageBean packageBean = PackagesCfg.PACKAGES.get(playerData.getPackageName());
- plugin.getServer().getScheduler().runTask(plugin, new Runnable() {
- @Override
- public void run() {
- Player p = player.getPlayer();
- if (p != null) {
- p.sendMessage(StrUtil.messageFormat(
- PluginCfg.PLUGIN_PREFIX + LangCfg.MSG_IS_EXPIRATION_DATE,
- packageBean != null ? packageBean.getDisplayName() : LangCfg.MSG_UNKNOWN_PACKAGE,
- playerData.getPackageName()));
- for (String commands : packageBean.getExpireCommands()) {
- try {
- commands = StrUtil.messageFormat(player.getPlayer(), commands);
- plugin.getServer().dispatchCommand(plugin.getServer().getConsoleSender(), commands);
- } catch (Exception e) {
- e.printStackTrace();
+ if ((packageBean == null && !playerData.getGlobal())
+ || (packageBean != null && playerData.getGlobal() == packageBean.getGlobal())) {
+ plugin.getServer().getScheduler().runTask(plugin, new Runnable() {
+ @Override
+ public void run() {
+ Player p = player.getPlayer();
+ if (p != null) {
+ p.sendMessage(
+ StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + LangCfg.MSG_IS_EXPIRATION_DATE,
+ packageBean != null ? packageBean.getDisplayName()
+ : LangCfg.MSG_UNKNOWN_PACKAGE,
+ playerData.getPackageName()));
+ for (String commands : packageBean.getExpireCommands()) {
+ try {
+ commands = StrUtil.messageFormat(player.getPlayer(), commands);
+ plugin.getServer().dispatchCommand(plugin.getServer().getConsoleSender(),
+ commands);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
}
}
}
- }
- });
- plugin.getSqlManager().delById(playerData.getId());
+ });
+ plugin.getSqlManager().delById(playerData.getId());
+ }
}
}
}
diff --git a/src/resources/plugin.yml b/src/resources/plugin.yml
index 2b556fc..e9d9bc9 100644
--- a/src/resources/plugin.yml
+++ b/src/resources/plugin.yml
@@ -1,5 +1,5 @@
name: PermissionsTime
-version: 0.3.0-SNAPSHOT
+version: 0.3.1-SNAPSHOT
main: gg.frog.mc.permissionstime.PluginMain
author: GeekFrog
softdepend:
diff --git a/帖子代码.txt b/帖子代码.txt
index 404e1c2..cc71f7c 100644
--- a/帖子代码.txt
+++ b/帖子代码.txt
@@ -3,7 +3,7 @@
[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][align=center][size=4][color=#ffa500][b]这是本人第一个发布的插件, 希望能让大家满意![/b][/color][/size][/align][align=center][size=4][color=#dda0dd][b]本插件需要JAVA8!!![/b][/color][/size][/align][align=center][size=4][color=#98fb98][b]下载地址在最下面![/b][/color][/size][/align][align=center][size=4][color=#c0c0c0][b]最新版本: [/b][/color][b][color=#8b0000]0.3.0[/color][color=#c0c0c0],推荐大家使用新版本,只需替换插件的jar包和语言文件即可![/color][/b][/size][/align][/td][/tr]
+[tr][td][align=center][size=4][color=#ffa500][b]这是本人第一个发布的插件, 希望能让大家满意![/b][/color][/size][/align][align=center][size=4][color=#dda0dd][b]本插件需要JAVA8!!![/b][/color][/size][/align][align=center][size=4][color=#98fb98][b]下载地址在最下面![/b][/color][/size][/align][align=center][size=4][color=#c0c0c0][b]最新版本: [/b][/color][b][color=#8b0000]0.3.1[/color][color=#c0c0c0],推荐大家使用新版本,只需替换插件的jar包和语言文件即可![/color][/b][/size][/align][/td][/tr]
[/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]
@@ -136,6 +136,11 @@ packages:
groups:
- group1
- group2:world1
+ # 权限包过期后执行的控制台命令
+ # Package expire console commands.
+ expireCommands:
+ - 'say %player% 的权限包到期了.'
+ - 'say 请及时续期.'
[/code]
[font=-apple-system, BlinkMacSystemFont,][color=#000000]简体中文 zh-cn.yml[/color][/font][code]
@@ -198,6 +203,8 @@ cmd:
[tr][td][align=center][size=6][color=#ffffff][b]更新日志[/b][/color][/size][/align][/td][/tr]
[/table][/align][align=center][table=98%,gray]
[tr][td][spoiler][size=4][b][url=http://ci.frog.gg/jenkins/job/PermissionsTime/changes]详细的更新记录[/url]
+[color=#ffffff]2017年8月2日 V0.3.1[/color][quote][color=#000000]
+1.跨服与非跨服权限包同名兼容处理[/color][/quote]
[color=#ffffff]2017年8月1日 V0.3.0[/color][quote][color=#000000]
1.权限包到期可执行自定义命令[/color][/quote]
[color=#ffffff]2017年7月31日 V0.2.4[/color][quote][color=#000000]
@@ -227,7 +234,7 @@ cmd:
[/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][b][align=center][color=#000] [url=http://ci.frog.gg/jenkins/job/PermissionsTime/64/]V0.3.0版下载地址[/url][/color][/align][align=center][color=#ffffff]前置插件:[/color][color=#000][url=https://dev.bukkit.org/projects/vault/files]vault[/url][/color][color=#000000] , [/color][color=#000][url=https://dev.bukkit.org/projects/sqlibrary/files]sqlibrary[/url][/color][/align][align=center][color=#ffffff]前置插件最好去原站下载适合的版本, 如果无法下载可以在帖内下载。[/color][/align]
+[tr][td][size=4][b][align=center][color=#000] [url=http://ci.frog.gg/jenkins/job/PermissionsTime/65/]V0.3.1版下载地址[/url][/color][/align][align=center][color=#ffffff]前置插件:[/color][color=#000][url=https://dev.bukkit.org/projects/vault/files]vault[/url][/color][color=#000000] , [/color][color=#000][url=https://dev.bukkit.org/projects/sqlibrary/files]sqlibrary[/url][/color][/align][align=center][color=#ffffff]前置插件最好去原站下载适合的版本, 如果无法下载可以在帖内下载。[/color][/align]
[align=center][b][color=#ffffff]帖内下载:[/color][/b][/align][align=center][color=#000][attach]1101088[/attach][/color][/align][align=center][color=#000][b][color=#ff0000]前置插件必须安装[/color][/b][/color][/align][align=center][color=#000][attach]1101089[/attach][/color][/align][align=center][color=#000][attach]1101090[/attach][/color][/align][align=center][color=#000][attach]1101110[/attach][/color][/align]
[align=center][color=#000][color=#ff0000][b]如果大家觉得好用就给点金粒吧,如果不好请告诉我,帮助我改进。[/b][/color][/color][/align][align=center][color=#000][b]BUG可以在帖内回复我。[/b][/color][/align][/b][/size][/td][/tr]
[/table][/align][align=center][table=98%,#4169e1]