mirror of
https://github.com/geekfrog/PermissionsTime.git
synced 2024-11-21 23:08:48 +00:00
语言支持整理
This commit is contained in:
parent
27f573c26b
commit
76e4e38586
@ -26,8 +26,8 @@
|
||||
- **mysql保存数据**
|
||||
- **支持跨服**
|
||||
- **gui显示自己的权限包**
|
||||
- **语言支持整理**
|
||||
- 手动删除过期的或无效数据
|
||||
- 语言支持整理
|
||||
- 取消前置插件
|
||||
|
||||
|
||||
|
24
packages_zh-cn.yml
Normal file
24
packages_zh-cn.yml
Normal file
@ -0,0 +1,24 @@
|
||||
version: 0.0.1
|
||||
#默认权限组
|
||||
defaultGroup: Default
|
||||
packages:
|
||||
#权限包名称
|
||||
example1:
|
||||
#权限包显示名称
|
||||
displayName: '&4权限包模板1'
|
||||
#显示的物品类型
|
||||
type: NETHER_STAR
|
||||
#标签
|
||||
lores:
|
||||
- '&2这是权限包模板的标签'
|
||||
#是否跨服权限
|
||||
global: false
|
||||
#权限包含有的权限 world1、world2、world3是赋值给玩家permission2权限的世界
|
||||
#如果所有世界都赋值权限则不用注明世界名称如:permission1
|
||||
permissions:
|
||||
- permission1
|
||||
- permission2:world1:world2:world3
|
||||
#权限包含有的权限组
|
||||
groups:
|
||||
- group1
|
||||
- group2:world1
|
12
pom.xml
12
pom.xml
@ -87,18 +87,6 @@
|
||||
<target>1.8</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<version>3.0.2</version>
|
||||
<configuration>
|
||||
<archive>
|
||||
<manifest>
|
||||
<mainClass>gg.frog.mc.permissionstime.Main</mainClass>
|
||||
</manifest>
|
||||
</archive>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<!-- 解决资源文件的编码问题 -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
|
@ -1,8 +0,0 @@
|
||||
package gg.frog.mc.permissionstime;
|
||||
|
||||
public class Main {
|
||||
|
||||
public static void main(String[] args) {
|
||||
System.out.println("Put jar file in 'plugins' folder And Reload / Restart your server");
|
||||
}
|
||||
}
|
@ -62,12 +62,12 @@ public class PluginMain extends JavaPlugin {
|
||||
getServer().getScheduler().runTask(pm, new Runnable() {
|
||||
public void run() {
|
||||
if (!checkPluginDepends()) {
|
||||
getServer().getConsoleSender().sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "启动失败!"));
|
||||
getServer().getConsoleSender().sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "&4Startup failure!"));
|
||||
getServer().getPluginManager().disablePlugin(pm);
|
||||
} else {
|
||||
registerListeners();
|
||||
registerCommands();
|
||||
getServer().getConsoleSender().sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "启动成功!"));
|
||||
getServer().getConsoleSender().sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "&2Startup successful!"));
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -111,16 +111,16 @@ public class PluginMain extends JavaPlugin {
|
||||
boolean needDepend = false;
|
||||
for (String name : DEPEND_PLUGIN.split(",")) {
|
||||
if (getServer().getPluginManager().getPlugin(name) == null) {
|
||||
getServer().getConsoleSender().sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "Need depend plugins : " + name));
|
||||
getServer().getConsoleSender().sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "&4Need depend plugins : " + name));
|
||||
needDepend = true;
|
||||
}
|
||||
}
|
||||
if (!needDepend && !setupPermissions()) {
|
||||
getServer().getConsoleSender().sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "Cann''t hook vault permission"));
|
||||
getServer().getConsoleSender().sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "&4Cann''t hook vault permission"));
|
||||
needDepend = true;
|
||||
}
|
||||
if (!needDepend && !setupDatabase()) {
|
||||
getServer().getConsoleSender().sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "Cann''t setup database"));
|
||||
getServer().getConsoleSender().sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "&4Cann''t setup database"));
|
||||
needDepend = true;
|
||||
}
|
||||
if (needDepend) {
|
||||
|
@ -8,6 +8,7 @@ import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import gg.frog.mc.permissionstime.PluginMain;
|
||||
import gg.frog.mc.permissionstime.config.LangCfg;
|
||||
import gg.frog.mc.permissionstime.config.PackagesCfg;
|
||||
import gg.frog.mc.permissionstime.config.PluginCfg;
|
||||
import gg.frog.mc.permissionstime.database.SqlManager;
|
||||
@ -39,21 +40,21 @@ public class GiveCmd implements Runnable {
|
||||
try {
|
||||
days = Integer.parseInt(time);
|
||||
if (days <= 0) {
|
||||
sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "时间参数不正确,请输入正整数"));
|
||||
sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + LangCfg.MSG_DAYS_PARAMETER_INCORRECT));
|
||||
return;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "时间参数不正确,请输入正整数"));
|
||||
sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + LangCfg.MSG_DAYS_PARAMETER_INCORRECT));
|
||||
return;
|
||||
}
|
||||
PermissionPackageBean pack = PackagesCfg.PACKAGES.get(packageName);
|
||||
if (pack != null) {
|
||||
OfflinePlayer player = pm.getOfflinePlayer(playerName);
|
||||
if (player != null) {
|
||||
sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "执行中,请等待..."));
|
||||
sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + LangCfg.MSG_PROCESSING));
|
||||
UUID uuid = player.getUniqueId();
|
||||
if (PluginCfg.IS_DEBUG) {
|
||||
sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + uuid.toString() + "\n" + pack.toString() + "\n" + time + "天"));
|
||||
sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + uuid.toString() + "\n" + pack.toString() + "\n" + time + " days."));
|
||||
}
|
||||
if (sm.giveTime(((PluginCfg.USE_MYSQL && pack.getGlobal()) ? "g:" : "") + uuid.toString(), packageName, days)) {
|
||||
if (player.isOnline()) {
|
||||
@ -63,28 +64,28 @@ public class GiveCmd implements Runnable {
|
||||
PermissionPackageBean.reloadPlayerPermissions(player, pdbList, pm);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
p.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "修改权限失败, 请重新进入服务器!"));
|
||||
p.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + LangCfg.MSG_FAIL_SET_PERMISSION));
|
||||
}
|
||||
p.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "{0}给予你 {1}天的 {2}", sender.getName(), time, pack.getDisplayName()));
|
||||
p.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + LangCfg.MSG_TELL_GIVE_PACKAGE, sender.getName(), time, pack.getDisplayName()));
|
||||
}
|
||||
sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "给予玩家 {0} {1}天的 {2}", playerName, time, pack.getDisplayName()));
|
||||
sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + LangCfg.MSG_GIVE_PACKAGE, playerName, time, pack.getDisplayName()));
|
||||
} else {
|
||||
pm.getServer().getScheduler().runTask(pm, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
pm.writeFailLog("命令执行失败 给予玩家 {0}({1}) {2}天的 {3} 执行人: {4}", playerName, player.getUniqueId().toString(), time, pack.getDisplayName(), sender.getName());
|
||||
pm.writeFailLog("Command execution failed. Give {0}({1}) {2}days {3} Executor: {4}", playerName, player.getUniqueId().toString(), time, pack.getDisplayName(), sender.getName());
|
||||
}
|
||||
});
|
||||
sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "未给予玩家 {0} {1}天的 {2}", playerName, time, pack.getDisplayName()));
|
||||
sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + LangCfg.MSG_GIVE_PACKAGE_FAIL, playerName, time, pack.getDisplayName()));
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "找不到名为''{0}''的玩家", playerName));
|
||||
sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + LangCfg.MSG_NO_FIND_PLAYER, playerName));
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "找不到名为''{0}''的权限包", packageName));
|
||||
sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + LangCfg.MSG_NO_FIND_PACKAGE, packageName));
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "参数不正确"));
|
||||
sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + LangCfg.MSG_PARAMETER_MISMATCH));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -34,39 +34,39 @@ public class MainCommand implements CommandExecutor {
|
||||
return true;
|
||||
} else {
|
||||
if (args[0].equalsIgnoreCase("reload")) {
|
||||
sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "执行中,请等待..."));
|
||||
sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + LangCfg.MSG_PROCESSING));
|
||||
if (isPlayer) {
|
||||
Player player = (Player) sender;
|
||||
if (sender.isOp() || player.hasPermission("permissionstime.reload")) {
|
||||
for (Player p : pm.getServer().getOnlinePlayers()) {
|
||||
InventoryView inventory = p.getOpenInventory();
|
||||
if (StrUtil.messageFormat("&4===权限仓库===" + "&r&5&9&2&0&r").equals(inventory.getTitle())) {
|
||||
if (StrUtil.messageFormat(LangCfg.INVENTORY_NAME + "&r&5&9&2&0&r").equals(inventory.getTitle())) {
|
||||
inventory.close();
|
||||
}
|
||||
}
|
||||
pm.getConfigManager().reloadConfig();
|
||||
if (!sm.updateDatabase()) {
|
||||
sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "数据库异常"));
|
||||
sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "&4Database exceptions."));
|
||||
}
|
||||
sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + LangCfg.CONFIG_RELOADED));
|
||||
pm.getServer().getConsoleSender().sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + LangCfg.CONFIG_RELOADED));
|
||||
sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + LangCfg.MSG_CONFIG_RELOADED));
|
||||
pm.getServer().getConsoleSender().sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + LangCfg.MSG_CONFIG_RELOADED));
|
||||
} else {
|
||||
sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + LangCfg.NO_PERMISSION));
|
||||
sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + LangCfg.MSG_NO_PERMISSION));
|
||||
}
|
||||
} else {
|
||||
for (Player p : pm.getServer().getOnlinePlayers()) {
|
||||
InventoryView inventory = p.getOpenInventory();
|
||||
if (inventory != null) {
|
||||
if (StrUtil.messageFormat("&4===权限仓库===" + "&r&5&9&2&0&r").equals(inventory.getTitle())) {
|
||||
if (StrUtil.messageFormat(LangCfg.INVENTORY_NAME + "&r&5&9&2&0&r").equals(inventory.getTitle())) {
|
||||
inventory.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
pm.getConfigManager().reloadConfig();
|
||||
if (!sm.updateDatabase()) {
|
||||
sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "数据库异常"));
|
||||
sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "&4Database exceptions."));
|
||||
}
|
||||
sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + LangCfg.CONFIG_RELOADED));
|
||||
sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + LangCfg.MSG_CONFIG_RELOADED));
|
||||
}
|
||||
return true;
|
||||
} else if (args[0].equalsIgnoreCase("me")) {
|
||||
@ -139,7 +139,7 @@ public class MainCommand implements CommandExecutor {
|
||||
Player player = (Player) sender;
|
||||
if (sender.isOp() || player.hasPermission(permissionPath)) {
|
||||
} else {
|
||||
sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + LangCfg.NO_PERMISSION));
|
||||
sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + LangCfg.MSG_NO_PERMISSION));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -6,6 +6,7 @@ import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
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.database.SqlManager;
|
||||
import gg.frog.mc.permissionstime.gui.PlayerPermissionShow;
|
||||
@ -31,21 +32,20 @@ public class MeCmd implements Runnable {
|
||||
@Override
|
||||
public void run() {
|
||||
if (isPlayer) {
|
||||
if (args.length < 2) {
|
||||
sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "执行中,请等待..."));
|
||||
// String page = args[1];
|
||||
if (args.length == 1) {
|
||||
sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + LangCfg.MSG_PROCESSING));
|
||||
Player p = (Player) sender;
|
||||
List<PlayerDataBean> ps = sm.getTime(p.getUniqueId().toString());
|
||||
if (ps.size() > 0) {
|
||||
PlayerPermissionShow.show(p, ps);
|
||||
} else {
|
||||
sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "暂时无数据"));
|
||||
sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + LangCfg.MSG_NO_DATA));
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "参数不正确"));
|
||||
sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + LangCfg.MSG_PARAMETER_MISMATCH));
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "此命令只能玩家执行"));
|
||||
sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "&4Only player can use this command."));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5,6 +5,7 @@ import java.util.Map.Entry;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import gg.frog.mc.permissionstime.PluginMain;
|
||||
import gg.frog.mc.permissionstime.config.LangCfg;
|
||||
import gg.frog.mc.permissionstime.config.PackagesCfg;
|
||||
import gg.frog.mc.permissionstime.config.PluginCfg;
|
||||
import gg.frog.mc.permissionstime.model.cfg.PermissionPackageBean;
|
||||
@ -25,18 +26,18 @@ public class PackagesCmd implements Runnable {
|
||||
@Override
|
||||
public void run() {
|
||||
if (args.length == 1) {
|
||||
sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "共有{0}种权限包", PackagesCfg.PACKAGES.size()));
|
||||
sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + LangCfg.MSG_PACKAGE_NUM, PackagesCfg.PACKAGES.size()));
|
||||
for (Entry<String, PermissionPackageBean> e : PackagesCfg.PACKAGES.entrySet()) {
|
||||
PermissionPackageBean p = e.getValue();
|
||||
sender.sendMessage(StrUtil.messageFormat("{0}PackgeName: {1}, DisplayName: {2}", p.getGlobal() ? "*" : "", e.getKey(), p.getDisplayName()));
|
||||
sender.sendMessage(StrUtil.messageFormat(LangCfg.MSG_PACKAGE_LIST, p.getGlobal() ? "*" : "", e.getKey(), p.getDisplayName()));
|
||||
}
|
||||
} else if (args.length == 2) {
|
||||
String packageName = args[1];
|
||||
if (PackagesCfg.PACKAGES.containsKey(packageName)) {
|
||||
PermissionPackageBean p = PackagesCfg.PACKAGES.get(packageName);
|
||||
sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "PackgeName: {0}, DisplayName: {1}\n" + "Permissions: {2}\n" + "Groups: {3}\n" + "Prefixs: {4}\n" + "Suffixs: {5}\n" + "", packageName, p.getDisplayName(), p.getPermissions(), p.getGroups()));
|
||||
sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + LangCfg.MSG_PACKAGE_DETAIL, packageName, p.getDisplayName(), p.getPermissions(), p.getGroups()));
|
||||
} else {
|
||||
sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "找不到名为''{0}''的权限包", packageName));
|
||||
sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + LangCfg.MSG_NO_FIND_PACKAGE, packageName));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -8,6 +8,7 @@ import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
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.database.SqlManager;
|
||||
import gg.frog.mc.permissionstime.model.cfg.PermissionPackageBean;
|
||||
@ -38,7 +39,7 @@ public class RemoveAllCmd implements Runnable {
|
||||
}
|
||||
OfflinePlayer player = pm.getOfflinePlayer(playerName);
|
||||
if (player != null) {
|
||||
sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "执行中,请等待..."));
|
||||
sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + LangCfg.MSG_PROCESSING));
|
||||
UUID uuid = player.getUniqueId();
|
||||
if (PluginCfg.IS_DEBUG) {
|
||||
sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + uuid.toString()));
|
||||
@ -51,25 +52,25 @@ public class RemoveAllCmd implements Runnable {
|
||||
PermissionPackageBean.reloadPlayerPermissions(player, pdbList, pm);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
p.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "修改权限失败, 请重新进入服务器!"));
|
||||
p.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + LangCfg.MSG_FAIL_SET_PERMISSION));
|
||||
}
|
||||
p.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "{0}删除了你的所有权限包", sender.getName()));
|
||||
p.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + LangCfg.MSG_TELL_DEL_ALL, sender.getName()));
|
||||
}
|
||||
sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "删除玩家 {0} 的所有权限包", playerName));
|
||||
sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + LangCfg.MSG_DEL_ALL, playerName));
|
||||
} else {
|
||||
pm.getServer().getScheduler().runTask(pm, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
pm.writeFailLog("命令执行失败 删除玩家 {0}({1}) 的所有权限包 执行人: {2}", playerName, player.getUniqueId().toString(), sender.getName());
|
||||
pm.writeFailLog("Command execution failed. Delete {0}({1})'s all packages. Executor: {2}", playerName, player.getUniqueId().toString(), sender.getName());
|
||||
}
|
||||
});
|
||||
sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "未删除玩家 {0} 的 {1}", playerName));
|
||||
sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + LangCfg.MSG_DEL_ALL_FAIL, playerName));
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "找不到名为''{0}''的玩家", playerName));
|
||||
sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + LangCfg.MSG_NO_FIND_PLAYER, playerName));
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "参数不正确"));
|
||||
sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + LangCfg.MSG_PARAMETER_MISMATCH));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -8,6 +8,7 @@ import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import gg.frog.mc.permissionstime.PluginMain;
|
||||
import gg.frog.mc.permissionstime.config.LangCfg;
|
||||
import gg.frog.mc.permissionstime.config.PackagesCfg;
|
||||
import gg.frog.mc.permissionstime.config.PluginCfg;
|
||||
import gg.frog.mc.permissionstime.database.SqlManager;
|
||||
@ -42,7 +43,7 @@ public class RemoveCmd implements Runnable {
|
||||
if (pack != null) {
|
||||
OfflinePlayer player = pm.getOfflinePlayer(playerName);
|
||||
if (player != null) {
|
||||
sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "执行中,请等待..."));
|
||||
sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + LangCfg.MSG_PROCESSING));
|
||||
UUID uuid = player.getUniqueId();
|
||||
if (PluginCfg.IS_DEBUG) {
|
||||
sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + uuid.toString() + "\n" + pack.toString()));
|
||||
@ -55,28 +56,28 @@ public class RemoveCmd implements Runnable {
|
||||
PermissionPackageBean.reloadPlayerPermissions(player, pdbList, pm);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
p.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "修改权限失败, 请重新进入服务器!"));
|
||||
p.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + LangCfg.MSG_FAIL_SET_PERMISSION));
|
||||
}
|
||||
p.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "{0}删除了你的 {1}权限包", sender.getName(), pack.getDisplayName()));
|
||||
p.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + LangCfg.MSG_TELL_DEL_PACKAGE, sender.getName(), pack.getDisplayName()));
|
||||
}
|
||||
sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "删除玩家 {0} 的 {1}", playerName, pack.getDisplayName()));
|
||||
sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + LangCfg.MSG_DEL_PACKAGE, playerName, pack.getDisplayName()));
|
||||
} else {
|
||||
pm.getServer().getScheduler().runTask(pm, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
pm.writeFailLog("命令执行失败 删除玩家 {0}({1}) 的 {2} 执行人: {3}", playerName, player.getUniqueId().toString(), pack.getDisplayName(), sender.getName());
|
||||
pm.writeFailLog("Command execution failed. Delete {0}({1})'s packages which be named {2} Executor: {3}", playerName, player.getUniqueId().toString(), pack.getDisplayName(), sender.getName());
|
||||
}
|
||||
});
|
||||
sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "未删除玩家 {0} 的 {1}", playerName, pack.getDisplayName()));
|
||||
sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + LangCfg.MSG_DEL_PACKAGE_FAIL, playerName, pack.getDisplayName()));
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "找不到名为''{0}''的玩家", playerName));
|
||||
sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + LangCfg.MSG_NO_FIND_PLAYER, playerName));
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "找不到名为''{0}''的权限包", packageName));
|
||||
sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + LangCfg.MSG_NO_FIND_PACKAGE, packageName));
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "参数不正确"));
|
||||
sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + LangCfg.MSG_PARAMETER_MISMATCH));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -8,6 +8,7 @@ import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import gg.frog.mc.permissionstime.PluginMain;
|
||||
import gg.frog.mc.permissionstime.config.LangCfg;
|
||||
import gg.frog.mc.permissionstime.config.PackagesCfg;
|
||||
import gg.frog.mc.permissionstime.config.PluginCfg;
|
||||
import gg.frog.mc.permissionstime.database.SqlManager;
|
||||
@ -39,21 +40,21 @@ public class SetCmd implements Runnable {
|
||||
try {
|
||||
days = Integer.parseInt(time);
|
||||
if (days <= 0) {
|
||||
sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "时间参数不正确,请输入正整数"));
|
||||
sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + LangCfg.MSG_DAYS_PARAMETER_INCORRECT));
|
||||
return;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "时间参数不正确,请输入正整数"));
|
||||
sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + LangCfg.MSG_DAYS_PARAMETER_INCORRECT));
|
||||
return;
|
||||
}
|
||||
PermissionPackageBean pack = PackagesCfg.PACKAGES.get(packageName);
|
||||
if (pack != null) {
|
||||
OfflinePlayer player = pm.getOfflinePlayer(playerName);
|
||||
if (player != null) {
|
||||
sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "执行中,请等待..."));
|
||||
sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + LangCfg.MSG_PROCESSING));
|
||||
UUID uuid = player.getUniqueId();
|
||||
if (PluginCfg.IS_DEBUG) {
|
||||
sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + uuid.toString() + "\n" + pack.toString() + "\n" + time + "天"));
|
||||
sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + uuid.toString() + "\n" + pack.toString() + "\n" + time + " days."));
|
||||
}
|
||||
if (sm.setTime(((PluginCfg.USE_MYSQL && pack.getGlobal()) ? "g:" : "") + uuid.toString(), packageName, days)) {
|
||||
if (player.isOnline()) {
|
||||
@ -63,28 +64,28 @@ public class SetCmd implements Runnable {
|
||||
PermissionPackageBean.reloadPlayerPermissions(player, pdbList, pm);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
p.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "修改权限失败, 请重新进入服务器!"));
|
||||
p.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + LangCfg.MSG_FAIL_SET_PERMISSION));
|
||||
}
|
||||
p.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "{0}设置你 {1}天的 {2}", sender.getName(), time, pack.getDisplayName()));
|
||||
p.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + LangCfg.MSG_TELL_SET_PACKAGE, sender.getName(), time, pack.getDisplayName()));
|
||||
}
|
||||
sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "设置玩家 {0} {1}天的 {2}", playerName, time, pack.getDisplayName()));
|
||||
sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + LangCfg.MSG_SET_PACKAGE, playerName, time, pack.getDisplayName()));
|
||||
} else {
|
||||
pm.getServer().getScheduler().runTask(pm, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
pm.writeFailLog("命令执行失败 设置玩家 {0}({1}) {2}天的 {3} 执行人: {4}", playerName, player.getUniqueId().toString(), time, pack.getDisplayName(), sender.getName());
|
||||
pm.writeFailLog("Command execution failed. Set {0}({1}) {2}days {3} Executor: {4}", playerName, player.getUniqueId().toString(), time, pack.getDisplayName(), sender.getName());
|
||||
}
|
||||
});
|
||||
sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "未设置玩家 {0} {1}天的 {2}", playerName, time, pack.getDisplayName()));
|
||||
sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + LangCfg.MSG_SET_PACKAGE_FAIL, playerName, time, pack.getDisplayName()));
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "找不到名为''{0}''的玩家", playerName));
|
||||
sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + LangCfg.MSG_NO_FIND_PLAYER, playerName));
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "找不到名为''{0}''的权限包", packageName));
|
||||
sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + LangCfg.MSG_NO_FIND_PACKAGE, packageName));
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "参数不正确"));
|
||||
sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + LangCfg.MSG_PARAMETER_MISMATCH));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -11,8 +11,32 @@ import gg.frog.mc.permissionstime.utils.config.PluginConfig;
|
||||
*/
|
||||
public class LangCfg extends PluginConfig {
|
||||
|
||||
public static String NO_PERMISSION = null;
|
||||
public static String CONFIG_RELOADED = null;
|
||||
public static String INVENTORY_NAME = null;
|
||||
public static String EXPIRATION_DATE = null;
|
||||
public static String MSG_PARAMETER_MISMATCH = null;
|
||||
public static String MSG_DAYS_PARAMETER_INCORRECT = null;
|
||||
public static String MSG_PROCESSING = null;
|
||||
public static String MSG_NO_DATA = null;
|
||||
public static String MSG_PACKAGE_NUM = null;
|
||||
public static String MSG_PACKAGE_LIST = null;
|
||||
public static String MSG_PACKAGE_DETAIL = null;
|
||||
public static String MSG_NO_PERMISSION = null;
|
||||
public static String MSG_CONFIG_RELOADED = null;
|
||||
public static String MSG_FAIL_SET_PERMISSION = null;
|
||||
public static String MSG_NO_FIND_PLAYER = null;
|
||||
public static String MSG_NO_FIND_PACKAGE = null;
|
||||
public static String MSG_TELL_GIVE_PACKAGE = null;
|
||||
public static String MSG_GIVE_PACKAGE = null;
|
||||
public static String MSG_GIVE_PACKAGE_FAIL = null;
|
||||
public static String MSG_TELL_SET_PACKAGE = null;
|
||||
public static String MSG_SET_PACKAGE = null;
|
||||
public static String MSG_SET_PACKAGE_FAIL = null;
|
||||
public static String MSG_TELL_DEL_PACKAGE = null;
|
||||
public static String MSG_DEL_PACKAGE = null;
|
||||
public static String MSG_DEL_PACKAGE_FAIL = null;
|
||||
public static String MSG_TELL_DEL_ALL = null;
|
||||
public static String MSG_DEL_ALL = null;
|
||||
public static String MSG_DEL_ALL_FAIL = null;
|
||||
|
||||
public LangCfg(String fileName, PluginMain pm) {
|
||||
super(fileName, pm);
|
||||
@ -23,8 +47,32 @@ public class LangCfg extends PluginConfig {
|
||||
|
||||
@Override
|
||||
protected void loadToDo() {
|
||||
NO_PERMISSION = getConfig().getString("nopermission", "&4你没有权限这么做");
|
||||
CONFIG_RELOADED = getConfig().getString("configReloaded", "&a配置重载完成");
|
||||
INVENTORY_NAME = setGetDefault("inventoryName", "&4===Permissions Packages===");
|
||||
EXPIRATION_DATE = setGetDefault("expirationDate", "&4Expiration date: {0}");
|
||||
MSG_PARAMETER_MISMATCH = setGetDefault("msg.parameterMismatch", "&4Parameter mismatch.");
|
||||
MSG_DAYS_PARAMETER_INCORRECT = setGetDefault("msg.daysParameterIncorrect", "&4The number of days is incorrect. Please enter a positive integer.");
|
||||
MSG_PROCESSING = setGetDefault("msg.processing", "&2Please wait for processing...");
|
||||
MSG_NO_DATA = setGetDefault("msg.noData", "&4No data for packages.");
|
||||
MSG_PACKAGE_NUM = setGetDefault("msg.packageNum", "&4There are {0} kinds of permissions packages.");
|
||||
MSG_PACKAGE_LIST = setGetDefault("msg.packageList", "{0}packageName: {1}, displayName: {2}");
|
||||
MSG_PACKAGE_DETAIL = setGetDefault("msg.packageDetail", "packageName: {0}, displayName: {1}&r\\nPermissions: {2}\\nGroups: {3}");
|
||||
MSG_NO_PERMISSION = setGetDefault("msg.nopermission", "&4You do not have permission to do this.");
|
||||
MSG_CONFIG_RELOADED = setGetDefault("msg.configReloaded", "&2Configuration overload is complete.");
|
||||
MSG_FAIL_SET_PERMISSION = setGetDefault("msg.failSetPermission", "&4Failed to modify permissions. Please re-enter the server!");
|
||||
MSG_NO_FIND_PLAYER = setGetDefault("msg.noFindPlayer", "&4Can not find player named &2{0}");
|
||||
MSG_NO_FIND_PACKAGE = setGetDefault("msg.noFindPackage", "&4Can not find package named &2{0}");
|
||||
MSG_TELL_GIVE_PACKAGE = setGetDefault("msg.tellGivePackage", "&2{0} give you {1}days package of {2}");
|
||||
MSG_GIVE_PACKAGE = setGetDefault("msg.givePackage", "&2Give the player {0} {1}days package of {2}");
|
||||
MSG_GIVE_PACKAGE_FAIL = setGetDefault("msg.givePackageFail", "&4Failed to give players {0} {1}days package of {2}");
|
||||
MSG_TELL_SET_PACKAGE = setGetDefault("msg.tellSetPackage", "&2{0} set your package of {2} to {1}days");
|
||||
MSG_SET_PACKAGE = setGetDefault("msg.setPackage", "&2Set the player {0} {1}days package of {2}");
|
||||
MSG_SET_PACKAGE_FAIL = setGetDefault("msg.setPackageFail", "&4Failed to set the player {0} {1}days package of {2}");
|
||||
MSG_TELL_DEL_PACKAGE = setGetDefault("msg.tellDelPackage", "&4{0} deleted your package of {1}");
|
||||
MSG_DEL_PACKAGE = setGetDefault("msg.delPackage", "&2Remove package of {1}&2 for player {0}");
|
||||
MSG_DEL_PACKAGE_FAIL = setGetDefault("msg.delPackageFail", "&4Failed to delete package of {1}&2 for player {0}");
|
||||
MSG_TELL_DEL_ALL = setGetDefault("msg.tellDelAll", "&4{0} remove all your packages");
|
||||
MSG_DEL_ALL = setGetDefault("msg.delAll", "&2Remove all packages for player {0}");
|
||||
MSG_DEL_ALL_FAIL = setGetDefault("msg.delAllFail", "&4Failed to remove all packages for player {0}");
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ public class PackagesCfg extends PluginConfig {
|
||||
|
||||
@Override
|
||||
protected void loadToDo() {
|
||||
PACKAGES_VERSION = setGetDefault("version", "?");
|
||||
PACKAGES_VERSION = setGetDefault("version", "1.00");
|
||||
DEFAULT_GROUP = setGetDefault("defaultGroup", "Default");
|
||||
PACKAGES = getObjMap("packages", PermissionPackageBean.class);
|
||||
saveObj("packages", PACKAGES);
|
||||
|
@ -30,7 +30,7 @@ public class PluginCfg extends PluginConfig {
|
||||
|
||||
@Override
|
||||
protected void init() {
|
||||
getConfig().set("lang", "zh-cn");
|
||||
getConfig().set("lang", "de");
|
||||
getConfig().set("metrics", true);
|
||||
getConfig().set("debug", false);
|
||||
getConfig().set("mysql.enable", false);
|
||||
@ -45,10 +45,10 @@ public class PluginCfg extends PluginConfig {
|
||||
|
||||
@Override
|
||||
protected void loadToDo() {
|
||||
PLUGIN_PREFIX = setGetDefault("pluginPrefix", "&b[" + pm.PLUGIN_NAME + "]&r");
|
||||
PLUGIN_PREFIX = setGetDefault("pluginPrefix", "&b[" + pm.PLUGIN_NAME + "]") + "&r";
|
||||
IS_DEBUG = setGetDefault("debug", false);
|
||||
IS_METRICS = setGetDefault("metrics", true);
|
||||
LANG = setGetDefault("lang", "zh-cn");
|
||||
LANG = setGetDefault("lang", "de");
|
||||
USE_MYSQL = setGetDefault("mysql.enable", false);
|
||||
if (USE_MYSQL) {
|
||||
SQL_SERVER_ID = setGetDefault("mysql.serverId", "default");
|
||||
|
@ -43,13 +43,11 @@ public class SqlManager {
|
||||
if (!pds.tableExist()) {
|
||||
pds.creatTable();
|
||||
}
|
||||
pm.getServer().getConsoleSender().sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX) + "连接数据库成功");
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
pm.getServer().getConsoleSender().sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX) + "连接数据库失败");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -35,7 +35,7 @@ public class MySQLPlayerDataDao extends DatabaseUtil implements IPlayerDataDao {
|
||||
}
|
||||
return false;
|
||||
} catch (Exception e) {
|
||||
pm.getServer().getConsoleSender().sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "无法检查有无数据表"));
|
||||
pm.getServer().getConsoleSender().sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "&4Can't check table is exist."));
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
@ -47,7 +47,7 @@ public class MySQLPlayerDataDao extends DatabaseUtil implements IPlayerDataDao {
|
||||
getDB().query(sql);
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
pm.getServer().getConsoleSender().sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "无法创建数据表"));
|
||||
pm.getServer().getConsoleSender().sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "&4Can't creat table."));
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
@ -69,7 +69,7 @@ public class MySQLPlayerDataDao extends DatabaseUtil implements IPlayerDataDao {
|
||||
getDB().query(sql);
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
pm.getServer().getConsoleSender().sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "无法创建数据: {0}", pdb));
|
||||
pm.getServer().getConsoleSender().sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "&4Can't creat data: {0}", pdb));
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
@ -128,7 +128,7 @@ public class MySQLPlayerDataDao extends DatabaseUtil implements IPlayerDataDao {
|
||||
getDB().query(sql);
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
pm.getServer().getConsoleSender().sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "无法更新数据: {0}", pdb));
|
||||
pm.getServer().getConsoleSender().sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "&4Can't update data: {0}", pdb));
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
@ -155,7 +155,7 @@ public class MySQLPlayerDataDao extends DatabaseUtil implements IPlayerDataDao {
|
||||
}
|
||||
return pdbList;
|
||||
} catch (Exception e) {
|
||||
pm.getServer().getConsoleSender().sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "无法查询UUID: {0} 的数据", uuid));
|
||||
pm.getServer().getConsoleSender().sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "&4Can't find data by UUID: {0}", uuid));
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
@ -183,7 +183,7 @@ public class MySQLPlayerDataDao extends DatabaseUtil implements IPlayerDataDao {
|
||||
}
|
||||
return null;
|
||||
} catch (Exception e) {
|
||||
pm.getServer().getConsoleSender().sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "无法查询UUID: {0}, packageName: {1} 的数据", uuid, packageName));
|
||||
pm.getServer().getConsoleSender().sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "&4Can't find data by UUID: {0}, packageName: {1}", uuid, packageName));
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
@ -211,7 +211,7 @@ public class MySQLPlayerDataDao extends DatabaseUtil implements IPlayerDataDao {
|
||||
}
|
||||
return pdbList;
|
||||
} catch (Exception e) {
|
||||
pm.getServer().getConsoleSender().sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "无法查询UUID: {0} 的数据", uuid));
|
||||
pm.getServer().getConsoleSender().sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "&4Can't find data by UUID: {0}", uuid));
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
@ -227,7 +227,7 @@ public class MySQLPlayerDataDao extends DatabaseUtil implements IPlayerDataDao {
|
||||
getDB().query(sql);
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
pm.getServer().getConsoleSender().sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "无法删除UUID为: {0} 的数据", uuid));
|
||||
pm.getServer().getConsoleSender().sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "&4Can't delete data by UUID: {0}", uuid));
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
@ -243,7 +243,7 @@ public class MySQLPlayerDataDao extends DatabaseUtil implements IPlayerDataDao {
|
||||
getDB().query(sql);
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
pm.getServer().getConsoleSender().sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "无法删除UUID: {0}, packageName: {1} 的数据", uuid, packageName));
|
||||
pm.getServer().getConsoleSender().sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "&4Can't delete data by UUID: {0}, packageName: {1}", uuid, packageName));
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ public class SqlitePlayerDataDao extends DatabaseUtil implements IPlayerDataDao
|
||||
}
|
||||
return false;
|
||||
} catch (Exception e) {
|
||||
pm.getServer().getConsoleSender().sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "无法检查有无数据表"));
|
||||
pm.getServer().getConsoleSender().sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "&4Can't check table is exist."));
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
@ -46,7 +46,7 @@ public class SqlitePlayerDataDao extends DatabaseUtil implements IPlayerDataDao
|
||||
getDB().query(sql);
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
pm.getServer().getConsoleSender().sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "无法创建数据表"));
|
||||
pm.getServer().getConsoleSender().sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "&4Can't creat table."));
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
@ -64,7 +64,7 @@ public class SqlitePlayerDataDao extends DatabaseUtil implements IPlayerDataDao
|
||||
getDB().query(sql);
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
pm.getServer().getConsoleSender().sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "无法创建数据: {0}", pdb));
|
||||
pm.getServer().getConsoleSender().sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "&4Can't creat data: {0}", pdb));
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
@ -103,7 +103,7 @@ public class SqlitePlayerDataDao extends DatabaseUtil implements IPlayerDataDao
|
||||
getDB().query(sql);
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
pm.getServer().getConsoleSender().sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "无法更新数据: {0}", pdb));
|
||||
pm.getServer().getConsoleSender().sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "&4Can't update data: {0}", pdb));
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
@ -126,7 +126,7 @@ public class SqlitePlayerDataDao extends DatabaseUtil implements IPlayerDataDao
|
||||
}
|
||||
return pdbList;
|
||||
} catch (Exception e) {
|
||||
pm.getServer().getConsoleSender().sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "无法查询UUID: {0} 的数据", uuid));
|
||||
pm.getServer().getConsoleSender().sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "&4Can't find data by UUID: {0}", uuid));
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
@ -146,7 +146,7 @@ public class SqlitePlayerDataDao extends DatabaseUtil implements IPlayerDataDao
|
||||
}
|
||||
return null;
|
||||
} catch (Exception e) {
|
||||
pm.getServer().getConsoleSender().sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "无法查询UUID: {0}, packageName: {1} 的数据", uuid, packageName));
|
||||
pm.getServer().getConsoleSender().sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "&4Can't find data by UUID: {0}, packageName: {1}", uuid, packageName));
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
@ -170,7 +170,7 @@ public class SqlitePlayerDataDao extends DatabaseUtil implements IPlayerDataDao
|
||||
}
|
||||
return pdbList;
|
||||
} catch (Exception e) {
|
||||
pm.getServer().getConsoleSender().sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "无法查询UUID: {0} 的数据", uuid));
|
||||
pm.getServer().getConsoleSender().sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "&4Can't find data by UUID: {0}", uuid));
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
@ -182,7 +182,7 @@ public class SqlitePlayerDataDao extends DatabaseUtil implements IPlayerDataDao
|
||||
getDB().query(sql);
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
pm.getServer().getConsoleSender().sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "无法删除UUID为: {0} 的数据", uuid));
|
||||
pm.getServer().getConsoleSender().sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "&4Can't delete data by UUID: {0}", uuid));
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
@ -194,7 +194,7 @@ public class SqlitePlayerDataDao extends DatabaseUtil implements IPlayerDataDao
|
||||
getDB().query(sql);
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
pm.getServer().getConsoleSender().sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "无法删除UUID: {0}, packageName: {1} 的数据", uuid, packageName));
|
||||
pm.getServer().getConsoleSender().sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "&4Can't delete data by UUID: {0}, packageName: {1}", uuid, packageName));
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
@ -8,6 +8,7 @@ import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
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.db.PlayerDataBean;
|
||||
import gg.frog.mc.permissionstime.utils.StrUtil;
|
||||
@ -15,14 +16,14 @@ import gg.frog.mc.permissionstime.utils.StrUtil;
|
||||
public class PlayerPermissionShow {
|
||||
|
||||
public static void show(Player p, List<PlayerDataBean> pdbList) {
|
||||
Inventory inventory = Bukkit.createInventory(null, (pdbList.size() % 9 == 0 ? pdbList.size() : (pdbList.size() / 9 + 1) * 9), StrUtil.messageFormat("&4===权限仓库===" + "&r&5&9&2&0&r"));
|
||||
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) {
|
||||
ItemMeta meta = item.getItemMeta();
|
||||
List<String> lores = meta.getLore();
|
||||
lores.add("");
|
||||
lores.add(StrUtil.messageFormat("&4到期时间: {0}", StrUtil.timestampToString(pdb.getExpire())));
|
||||
lores.add(StrUtil.messageFormat(LangCfg.EXPIRATION_DATE, StrUtil.timestampToString(pdb.getExpire())));
|
||||
meta.setLore(lores);
|
||||
item.setItemMeta(meta);
|
||||
inventory.addItem(item);
|
||||
|
@ -10,6 +10,7 @@ import org.bukkit.event.player.PlayerKickEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
|
||||
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.db.PlayerDataBean;
|
||||
@ -38,7 +39,7 @@ public class MainListener implements Listener {
|
||||
PermissionPackageBean.reloadPlayerPermissions(event.getPlayer(), pdbList, pm);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
event.getPlayer().sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "修改权限失败, 请重新进入服务器!"));
|
||||
event.getPlayer().sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + LangCfg.MSG_FAIL_SET_PERMISSION));
|
||||
}
|
||||
}
|
||||
}).start();
|
||||
@ -74,7 +75,7 @@ public class MainListener implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerClick(InventoryClickEvent event) {
|
||||
if (StrUtil.messageFormat("&4===权限仓库===" + "&r&5&9&2&0&r").equals(event.getInventory().getName())) {
|
||||
if (StrUtil.messageFormat(LangCfg.INVENTORY_NAME + "&r&5&9&2&0&r").equals(event.getInventory().getName())) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
@ -1 +1 @@
|
||||
pluginPrefix: '&4[&b权限限时&4]&r'
|
||||
pluginPrefix: '&4[&bPermissions Time&4]'
|
||||
|
@ -1,2 +1,29 @@
|
||||
nopermission: '&4You do not have permission to that.'
|
||||
configReloaded: '&aComplete configuration reload.'
|
||||
inventoryName: '&4===Permissions Packages==='
|
||||
expirationDate: '&4Expiration date: {0}'
|
||||
msg:
|
||||
parameterMismatch: '&4Parameter mismatch.'
|
||||
daysParameterIncorrect: '&4The number of days is incorrect. Please enter a positive
|
||||
integer.'
|
||||
processing: '&2Please wait for processing...'
|
||||
noData: '&4No data for packages.'
|
||||
packageNum: '&4There are {0} kinds of permissions packages.'
|
||||
packageList: '{0}packageName: {1}, displayName: {2}'
|
||||
packageDetail: 'packageName: {0}, displayName: {1}&r\nPermissions: {2}\nGroups:
|
||||
{3}'
|
||||
nopermission: '&4You do not have permission to do this.'
|
||||
configReloaded: '&2Configuration overload is complete.'
|
||||
failSetPermission: '&4Failed to modify permissions. Please re-enter the server!'
|
||||
noFindPlayer: '&4Can not find player named &2{0}'
|
||||
noFindPackage: '&4Can not find package named &2{0}'
|
||||
tellGivePackage: '&2{0} give you {1}days package of {2}'
|
||||
givePackage: '&2Give the player {0} {1}days package of {2}'
|
||||
givePackageFail: '&4Failed to give players {0} {1}days package of {2}'
|
||||
tellSetPackage: '&2{0} set your package of {2} to {1}days'
|
||||
setPackage: '&2Set the player {0} {1}days package of {2}'
|
||||
setPackageFail: '&4Failed to set the player {0} {1}days package of {2}'
|
||||
tellDelPackage: '&4{0} deleted your package of {1}'
|
||||
delPackage: '&2Remove package of {1}&2 for player {0}'
|
||||
delPackageFail: '&4Failed to delete package of {1}&2 for player {0}'
|
||||
tellDelAll: '&4{0} remove all your packages'
|
||||
delAll: '&2Remove all packages for player {0}'
|
||||
delAllFail: '&4Failed to remove all packages for player {0}'
|
||||
|
@ -1,2 +1,27 @@
|
||||
nopermission: '&4你没有权限这么做'
|
||||
configReloaded: '&a配置重载完成'
|
||||
inventoryName: '&4===权限仓库==='
|
||||
expirationDate: '&4到期时间: {0}.'
|
||||
msg:
|
||||
parameterMismatch: '&4参数不匹配.'
|
||||
daysParameterIncorrect: '&4时间参数不正确,请输入正整数.'
|
||||
processing: '&2执行中,请等待...'
|
||||
noData: '&4暂时无权限包.'
|
||||
packageNum: '&4共有{0}种权限包.'
|
||||
packageList: '{0}权限包名: {1}, 显示名称: {2}'
|
||||
packageDetail: '权限包名: {0}, 显示名称: {1}&r\n权限: {2}\n权限组: {3}'
|
||||
nopermission: '&4你没有权限这么做.'
|
||||
configReloaded: '&2配置重载完成.'
|
||||
failSetPermission: '&4修改权限失败, 请重新进入服务器!'
|
||||
noFindPlayer: '&4找不到名为&2{0}&4的玩家.'
|
||||
noFindPackage: '&4找不到名为&2{0}&4的权限包.'
|
||||
tellGivePackage: '&2{0}给予你 {1}天的 {2}.'
|
||||
givePackage: '&2给予玩家 {0} {1}天的 {2}.'
|
||||
givePackageFail: '&4未给予玩家 {0} {1}天的 {2}.'
|
||||
tellSetPackage: '&2{0}设置你 {1}天的 {2}.'
|
||||
setPackage: '&2设置玩家 {0} {1}天的 {2}.'
|
||||
setPackageFail: '&4未设置玩家 {0} {1}天的 {2}.'
|
||||
tellDelPackage: '&4{0}删除了你的 {1}权限包.'
|
||||
delPackage: '&2删除玩家 {0} 的 {1}.'
|
||||
delPackageFail: '&4未删除玩家 {0} 的 {1}.'
|
||||
tellDelAll: '&4{0}删除了你的所有权限包.'
|
||||
delAll: '&2删除玩家 {0} 的所有权限包.'
|
||||
delAllFail: '&4未删除玩家 {0} 的 所有权限包.'
|
||||
|
@ -1,4 +1,4 @@
|
||||
version: 0.0.1
|
||||
version: 1.00
|
||||
#默认权限组
|
||||
defaultGroup: Default
|
||||
packages:
|
||||
@ -22,11 +22,3 @@ packages:
|
||||
groups:
|
||||
- group1
|
||||
- group2:world1
|
||||
#权限包含有的前缀
|
||||
prefixs:
|
||||
- '&2[Player]&3'
|
||||
- '&2[VIP]&3:world2'
|
||||
#权限包含有的后缀
|
||||
suffixs:
|
||||
- '→❤'
|
||||
- '→★:world2:world3'
|
||||
|
Loading…
Reference in New Issue
Block a user