diff --git a/config/config.yml b/config/config.yml
index be1f97c..8188c90 100644
--- a/config/config.yml
+++ b/config/config.yml
@@ -12,7 +12,7 @@ metrics: true
tagSystem: false
# 语言文件名称 在'lang'文件夹内.
# Language file name.
-lang: en
+lang: zh-cn
# 数据库相关.
# Database settings.
mysql:
diff --git a/config/plugin.yml b/config/plugin.yml
index 8db4180..fc5d445 100644
--- a/config/plugin.yml
+++ b/config/plugin.yml
@@ -1,6 +1,6 @@
name: ${project.name}
version: ${project.version}
-main: gg.frog.mc.permissionstime.PluginMain
+main: gg.frog.mc.base.PluginMain
author:
- GeekFrog
description: ${project.description}
@@ -17,7 +17,7 @@ commands:
description: Aliases commands for permissionstime.
usage: /pt [param]
permissions:
- permissionstime.*:
+ gg.frog.permissionstime.*:
description: Gives access to all PermissionsTime commands.
default: op
children:
diff --git a/config/tagNames.yml b/config/tagNames.yml
index 9d74327..63ee761 100644
--- a/config/tagNames.yml
+++ b/config/tagNames.yml
@@ -15,6 +15,9 @@ 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则禁用刷新.
@@ -25,7 +28,7 @@ refreshTagTime: -1
template:
lore:
- '&1-----------------'
- - '&2效果展示:'
+ - '&2Preview:'
- '&3 %displayname%'
- '&4-----------------'
- '&5 %description%'
diff --git a/pom.xml b/pom.xml
index 965eba9..d9da593 100644
--- a/pom.xml
+++ b/pom.xml
@@ -39,7 +39,7 @@
http://repo.extendedclip.com/content/repositories/placeholderapi/
- filoghost-repo
+ HD
https://ci.filoghost.me/plugin/repository/everything/
diff --git a/src/main/gg/frog/mc/permissionstime/PluginMain.java b/src/main/gg/frog/mc/base/PluginMain.java
similarity index 80%
rename from src/main/gg/frog/mc/permissionstime/PluginMain.java
rename to src/main/gg/frog/mc/base/PluginMain.java
index 7aaffbf..8ee9b87 100644
--- a/src/main/gg/frog/mc/permissionstime/PluginMain.java
+++ b/src/main/gg/frog/mc/base/PluginMain.java
@@ -1,4 +1,4 @@
-package gg.frog.mc.permissionstime;
+package gg.frog.mc.base;
import java.text.MessageFormat;
import java.util.Locale;
@@ -12,15 +12,16 @@ import org.bukkit.OfflinePlayer;
import org.bukkit.plugin.RegisteredServiceProvider;
import org.bukkit.plugin.java.JavaPlugin;
-import gg.frog.mc.permissionstime.command.MainCommand;
-import gg.frog.mc.permissionstime.config.ConfigManager;
-import gg.frog.mc.permissionstime.config.PluginCfg;
+import gg.frog.mc.base.config.ConfigManager;
+import gg.frog.mc.base.config.PluginCfg;
+import gg.frog.mc.base.utils.FileUtil;
+import gg.frog.mc.base.utils.StrUtil;
+import gg.frog.mc.base.utils.UpdateCheck;
+import gg.frog.mc.nametags.listener.TagsListener;
+import gg.frog.mc.nametags.placeholder.TagPlaceholder;
+import gg.frog.mc.permissionstime.command.PtCommand;
import gg.frog.mc.permissionstime.database.SqlManager;
import gg.frog.mc.permissionstime.listener.MainListener;
-import gg.frog.mc.permissionstime.placeholder.TagPlaceholder;
-import gg.frog.mc.permissionstime.utils.FileUtil;
-import gg.frog.mc.permissionstime.utils.StrUtil;
-import gg.frog.mc.permissionstime.utils.UpdateCheck;
import net.milkbowl.vault.permission.Permission;
public class PluginMain extends JavaPlugin {
@@ -60,12 +61,12 @@ public class PluginMain extends JavaPlugin {
public void run() {
if (!checkPluginDepends()) {
- getServer().getConsoleSender().sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "&4Startup failure!"));
+ 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 + "&2Startup successful!"));
+ getServer().getConsoleSender().sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "§2Startup successful!"));
}
if (PluginCfg.IS_METRICS) {
try {
@@ -85,6 +86,7 @@ public class PluginMain extends JavaPlugin {
*/
private void registerListeners() {
pm.getServer().getPluginManager().registerEvents(new MainListener(pm), pm);
+ pm.getServer().getPluginManager().registerEvents(new TagsListener(pm), pm);
}
/**
@@ -92,12 +94,12 @@ public class PluginMain extends JavaPlugin {
* 这里可以注册多个,一般注册一个就够用
*/
private void registerCommands() {
- MainCommand mcmd = new MainCommand(pm);
- if (getDescription().getCommands().containsKey(PLUGIN_NAME_LOWER_CASE)) {
- getCommand(PLUGIN_NAME_LOWER_CASE).setExecutor(mcmd);
+ PtCommand ptCmd = new PtCommand(pm);
+ if (getDescription().getCommands().containsKey("permissionstime")) {
+ getCommand(PLUGIN_NAME_LOWER_CASE).setExecutor(ptCmd);
}
if (getDescription().getCommands().containsKey("pt")) {
- getCommand("pt").setExecutor(mcmd);
+ getCommand("pt").setExecutor(ptCmd);
}
}
@@ -121,22 +123,22 @@ public class PluginMain extends JavaPlugin {
boolean needDepend = false;
for (String name : DEPEND_PLUGIN.split(",")) {
if (!getServer().getPluginManager().isPluginEnabled(name)) {
- getServer().getConsoleSender().sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "&4Need 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 + "&4Cann''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 + "&4Cann''t setup database."));
+ getServer().getConsoleSender().sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "§4Cann''t setup database."));
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."));
+ 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 {
@@ -145,14 +147,14 @@ public class PluginMain extends JavaPlugin {
}
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."));
+ 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."));
+ 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) {
diff --git a/src/main/gg/frog/mc/permissionstime/config/ConfigManager.java b/src/main/gg/frog/mc/base/config/ConfigManager.java
similarity index 87%
rename from src/main/gg/frog/mc/permissionstime/config/ConfigManager.java
rename to src/main/gg/frog/mc/base/config/ConfigManager.java
index 76e613c..5ef5778 100644
--- a/src/main/gg/frog/mc/permissionstime/config/ConfigManager.java
+++ b/src/main/gg/frog/mc/base/config/ConfigManager.java
@@ -1,4 +1,4 @@
-package gg.frog.mc.permissionstime.config;
+package gg.frog.mc.base.config;
import java.io.File;
import java.io.FileOutputStream;
@@ -8,12 +8,14 @@ import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Map.Entry;
-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.utils.FileUtil;
-import gg.frog.mc.permissionstime.utils.FileUtil.FindFilesDo;
-import gg.frog.mc.permissionstime.utils.config.PluginConfig;
+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.FindFilesDo;
+import gg.frog.mc.base.utils.config.PluginConfig;
+import gg.frog.mc.nametags.config.TagNameCfg;
+import gg.frog.mc.permissionstime.config.PackagesCfg;
/**
* 配置文件管理
diff --git a/src/main/gg/frog/mc/permissionstime/config/LangCfg.java b/src/main/gg/frog/mc/base/config/LangCfg.java
similarity index 94%
rename from src/main/gg/frog/mc/permissionstime/config/LangCfg.java
rename to src/main/gg/frog/mc/base/config/LangCfg.java
index 4828bdc..25c1120 100644
--- a/src/main/gg/frog/mc/permissionstime/config/LangCfg.java
+++ b/src/main/gg/frog/mc/base/config/LangCfg.java
@@ -1,7 +1,7 @@
-package gg.frog.mc.permissionstime.config;
+package gg.frog.mc.base.config;
-import gg.frog.mc.permissionstime.PluginMain;
-import gg.frog.mc.permissionstime.utils.config.PluginConfig;
+import gg.frog.mc.base.PluginMain;
+import gg.frog.mc.base.utils.config.PluginConfig;
/**
* 语言支持
@@ -20,6 +20,9 @@ public class LangCfg extends PluginConfig {
public static String TIME_UNIT_M = 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_TIME_PARAMETER_INCORRECT = null;
@@ -84,6 +87,9 @@ public class LangCfg extends PluginConfig {
TIME_UNIT_M = getConfig().getString("timeUnitM", "minute(s)");
TIME_FOREVER = getConfig().getString("timeForever", "Forever");
TAG = getConfig().getString("tag", "Tag/Prefix");
+ TAG_COLOR_ITEM_NAME = getConfig().getString("tag", "&6&lName Style");
+ TAG_PREFIX_ITEM_NAME = getConfig().getString("tag", "&6&lTag Prefix");
+ TAG_SUFFIX_ITEM_NAME = getConfig().getString("tag", "&6&lTag Suffix");
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.");
diff --git a/src/main/gg/frog/mc/permissionstime/config/PluginCfg.java b/src/main/gg/frog/mc/base/config/PluginCfg.java
similarity index 86%
rename from src/main/gg/frog/mc/permissionstime/config/PluginCfg.java
rename to src/main/gg/frog/mc/base/config/PluginCfg.java
index 436b144..337354a 100644
--- a/src/main/gg/frog/mc/permissionstime/config/PluginCfg.java
+++ b/src/main/gg/frog/mc/base/config/PluginCfg.java
@@ -1,7 +1,7 @@
-package gg.frog.mc.permissionstime.config;
+package gg.frog.mc.base.config;
-import gg.frog.mc.permissionstime.PluginMain;
-import gg.frog.mc.permissionstime.utils.config.PluginConfig;
+import gg.frog.mc.base.PluginMain;
+import gg.frog.mc.base.utils.config.PluginConfig;
/**
* 插件默认配置
@@ -34,7 +34,7 @@ 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);
TAG_SYSTEM = setGetDefault("tagSystem", false);
diff --git a/src/main/gg/frog/mc/permissionstime/utils/FileUtil.java b/src/main/gg/frog/mc/base/utils/FileUtil.java
similarity index 97%
rename from src/main/gg/frog/mc/permissionstime/utils/FileUtil.java
rename to src/main/gg/frog/mc/base/utils/FileUtil.java
index 2447ee8..971d1e0 100644
--- a/src/main/gg/frog/mc/permissionstime/utils/FileUtil.java
+++ b/src/main/gg/frog/mc/base/utils/FileUtil.java
@@ -1,4 +1,4 @@
-package gg.frog.mc.permissionstime.utils;
+package gg.frog.mc.base.utils;
import java.io.File;
import java.io.FileWriter;
diff --git a/src/main/gg/frog/mc/permissionstime/utils/StrUtil.java b/src/main/gg/frog/mc/base/utils/StrUtil.java
similarity index 85%
rename from src/main/gg/frog/mc/permissionstime/utils/StrUtil.java
rename to src/main/gg/frog/mc/base/utils/StrUtil.java
index 557d564..a6f7d65 100644
--- a/src/main/gg/frog/mc/permissionstime/utils/StrUtil.java
+++ b/src/main/gg/frog/mc/base/utils/StrUtil.java
@@ -1,4 +1,4 @@
-package gg.frog.mc.permissionstime.utils;
+package gg.frog.mc.base.utils;
import java.text.MessageFormat;
import java.util.Date;
@@ -6,8 +6,8 @@ import java.util.Date;
import org.apache.commons.lang.time.DateFormatUtils;
import org.bukkit.entity.Player;
-import gg.frog.mc.permissionstime.PluginMain;
-import gg.frog.mc.permissionstime.config.LangCfg;
+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;
@@ -18,12 +18,14 @@ public class StrUtil {
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");
+ 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());
+ String message = MessageFormat.format(src, args).replaceAll("&", "§").replaceAll("\\\\n", "\n").replaceAll("%player%", player.getPlayer().getDisplayName());
if (PluginMain.enabledPlaceholder) {
message = PlaceholderAPI.setPlaceholders(player, message);
}
diff --git a/src/main/gg/frog/mc/permissionstime/utils/UpdateCheck.java b/src/main/gg/frog/mc/base/utils/UpdateCheck.java
similarity index 80%
rename from src/main/gg/frog/mc/permissionstime/utils/UpdateCheck.java
rename to src/main/gg/frog/mc/base/utils/UpdateCheck.java
index 3131d8e..fd001e3 100644
--- a/src/main/gg/frog/mc/permissionstime/utils/UpdateCheck.java
+++ b/src/main/gg/frog/mc/base/utils/UpdateCheck.java
@@ -1,4 +1,4 @@
-package gg.frog.mc.permissionstime.utils;
+package gg.frog.mc.base.utils;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
@@ -7,8 +7,8 @@ import java.net.URL;
import org.bukkit.configuration.file.YamlConfiguration;
import com.google.common.base.Charsets;
-import gg.frog.mc.permissionstime.PluginMain;
-import gg.frog.mc.permissionstime.config.PluginCfg;
+import gg.frog.mc.base.PluginMain;
+import gg.frog.mc.base.config.PluginCfg;
public class UpdateCheck implements Runnable {
@@ -29,9 +29,9 @@ public class UpdateCheck implements Runnable {
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));
+ 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."));
+ pm.getServer().getConsoleSender().sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "§2No new version available."));
}
} catch (Exception e) {
e.printStackTrace();
diff --git a/src/main/gg/frog/mc/permissionstime/utils/config/IConfigBean.java b/src/main/gg/frog/mc/base/utils/config/IConfigBean.java
similarity index 82%
rename from src/main/gg/frog/mc/permissionstime/utils/config/IConfigBean.java
rename to src/main/gg/frog/mc/base/utils/config/IConfigBean.java
index 18b9e94..fe54a39 100644
--- a/src/main/gg/frog/mc/permissionstime/utils/config/IConfigBean.java
+++ b/src/main/gg/frog/mc/base/utils/config/IConfigBean.java
@@ -1,4 +1,4 @@
-package gg.frog.mc.permissionstime.utils.config;
+package gg.frog.mc.base.utils.config;
import org.bukkit.configuration.MemorySection;
import org.bukkit.configuration.file.YamlConfiguration;
diff --git a/src/main/gg/frog/mc/permissionstime/utils/config/PluginConfig.java b/src/main/gg/frog/mc/base/utils/config/PluginConfig.java
similarity index 96%
rename from src/main/gg/frog/mc/permissionstime/utils/config/PluginConfig.java
rename to src/main/gg/frog/mc/base/utils/config/PluginConfig.java
index e003d70..07b9a6a 100644
--- a/src/main/gg/frog/mc/permissionstime/utils/config/PluginConfig.java
+++ b/src/main/gg/frog/mc/base/utils/config/PluginConfig.java
@@ -1,4 +1,4 @@
-package gg.frog.mc.permissionstime.utils.config;
+package gg.frog.mc.base.utils.config;
import java.io.File;
import java.io.FileNotFoundException;
@@ -17,9 +17,9 @@ import org.bukkit.configuration.file.YamlConfiguration;
import com.google.common.base.Charsets;
-import gg.frog.mc.permissionstime.PluginMain;
-import gg.frog.mc.permissionstime.config.PluginCfg;
-import gg.frog.mc.permissionstime.utils.StrUtil;
+import gg.frog.mc.base.PluginMain;
+import gg.frog.mc.base.config.PluginCfg;
+import gg.frog.mc.base.utils.StrUtil;
/**
* 配置操作
diff --git a/src/main/gg/frog/mc/permissionstime/utils/database/DatabaseUtil.java b/src/main/gg/frog/mc/base/utils/database/DatabaseUtil.java
similarity index 85%
rename from src/main/gg/frog/mc/permissionstime/utils/database/DatabaseUtil.java
rename to src/main/gg/frog/mc/base/utils/database/DatabaseUtil.java
index 5261471..33222f6 100644
--- a/src/main/gg/frog/mc/permissionstime/utils/database/DatabaseUtil.java
+++ b/src/main/gg/frog/mc/base/utils/database/DatabaseUtil.java
@@ -1,6 +1,6 @@
-package gg.frog.mc.permissionstime.utils.database;
+package gg.frog.mc.base.utils.database;
-import gg.frog.mc.permissionstime.config.PluginCfg;
+import gg.frog.mc.base.config.PluginCfg;
import gg.frog.mc.permissionstime.database.SqlManager;
import lib.PatPeter.SQLibrary.Database;
diff --git a/src/main/gg/frog/mc/permissionstime/utils/nms/ItemUtil.java b/src/main/gg/frog/mc/base/utils/nms/ItemUtil.java
similarity index 96%
rename from src/main/gg/frog/mc/permissionstime/utils/nms/ItemUtil.java
rename to src/main/gg/frog/mc/base/utils/nms/ItemUtil.java
index 4875cf7..f693e43 100644
--- a/src/main/gg/frog/mc/permissionstime/utils/nms/ItemUtil.java
+++ b/src/main/gg/frog/mc/base/utils/nms/ItemUtil.java
@@ -1,13 +1,13 @@
-package gg.frog.mc.permissionstime.utils.nms;
+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.permissionstime.PluginMain;
-import gg.frog.mc.permissionstime.config.PluginCfg;
-import gg.frog.mc.permissionstime.utils.StrUtil;
+import gg.frog.mc.base.PluginMain;
+import gg.frog.mc.base.config.PluginCfg;
+import gg.frog.mc.base.utils.StrUtil;
public class ItemUtil {
diff --git a/src/main/gg/frog/mc/permissionstime/utils/nms/NMSUtil.java b/src/main/gg/frog/mc/base/utils/nms/NMSUtil.java
similarity index 94%
rename from src/main/gg/frog/mc/permissionstime/utils/nms/NMSUtil.java
rename to src/main/gg/frog/mc/base/utils/nms/NMSUtil.java
index acf354c..3474476 100644
--- a/src/main/gg/frog/mc/permissionstime/utils/nms/NMSUtil.java
+++ b/src/main/gg/frog/mc/base/utils/nms/NMSUtil.java
@@ -1,4 +1,4 @@
-package gg.frog.mc.permissionstime.utils.nms;
+package gg.frog.mc.base.utils.nms;
import org.bukkit.Bukkit;
diff --git a/src/main/gg/frog/mc/permissionstime/command/TagCmd.java b/src/main/gg/frog/mc/nametags/command/TagCmd.java
similarity index 82%
rename from src/main/gg/frog/mc/permissionstime/command/TagCmd.java
rename to src/main/gg/frog/mc/nametags/command/TagCmd.java
index 1bf7e7e..c1c1372 100644
--- a/src/main/gg/frog/mc/permissionstime/command/TagCmd.java
+++ b/src/main/gg/frog/mc/nametags/command/TagCmd.java
@@ -1,4 +1,4 @@
-package gg.frog.mc.permissionstime.command;
+package gg.frog.mc.nametags.command;
import java.util.ArrayList;
import java.util.List;
@@ -8,13 +8,13 @@ import org.bukkit.OfflinePlayer;
import org.bukkit.command.CommandSender;
import org.bukkit.inventory.ItemStack;
-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.config.TagNameCfg;
-import gg.frog.mc.permissionstime.config.TagNameCfg.TagType;
-import gg.frog.mc.permissionstime.gui.PlayerTagShow;
-import gg.frog.mc.permissionstime.utils.StrUtil;
+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 {
@@ -67,7 +67,7 @@ public class TagCmd implements Runnable {
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."));
+ sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "§4Only player can use this command."));
}
}
}
diff --git a/src/main/gg/frog/mc/permissionstime/config/TagNameCfg.java b/src/main/gg/frog/mc/nametags/config/TagNameCfg.java
similarity index 91%
rename from src/main/gg/frog/mc/permissionstime/config/TagNameCfg.java
rename to src/main/gg/frog/mc/nametags/config/TagNameCfg.java
index 374e84f..8599d39 100644
--- a/src/main/gg/frog/mc/permissionstime/config/TagNameCfg.java
+++ b/src/main/gg/frog/mc/nametags/config/TagNameCfg.java
@@ -1,4 +1,4 @@
-package gg.frog.mc.permissionstime.config;
+package gg.frog.mc.nametags.config;
import java.util.ArrayList;
import java.util.List;
@@ -14,12 +14,14 @@ import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.scheduler.BukkitTask;
import org.bukkit.scoreboard.Scoreboard;
-import gg.frog.mc.permissionstime.PluginMain;
-import gg.frog.mc.permissionstime.model.PlayerTagBean;
+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;
-import gg.frog.mc.permissionstime.utils.StrUtil;
-import gg.frog.mc.permissionstime.utils.config.PluginConfig;
-import gg.frog.mc.permissionstime.utils.nms.ItemUtil;
public class TagNameCfg extends PluginConfig {
@@ -28,6 +30,7 @@ public class TagNameCfg extends PluginConfig {
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 PACKAGES = new ConcurrentHashMap<>();
public static List TEMPLATE_LORE = null;
@@ -65,6 +68,7 @@ public class TagNameCfg extends PluginConfig {
DEFAULT_SUFFIX = setGetDefault("defaultSuffix", "");
CHANGE_DISPLAYNAME = setGetDefault("changeDisplayname", true);
USE_HD_PLUGIN = setGetDefault("useHdPlugin", false);
+ ONE_LINE_DISPLAY = setGetDefault("oneLineDisplay", true);
REFRESH_TAG_TIME = setGetDefault("refreshTagTime", -1);
PACKAGES = getObjMap("packages", TagPackageBean.class);
TEMPLATE_LORE = getConfig().getStringList("template.lore");
@@ -110,6 +114,7 @@ public class TagNameCfg extends PluginConfig {
SUFFIX_ITEMS.put(e.getValue().getPermissions(), items);
}
}
+
if (task != null) {
task.cancel();
}
@@ -138,15 +143,15 @@ public class TagNameCfg extends PluginConfig {
Map> tagPermissions = null;
if (tagType == TagType.NAMECOLOR_TYPE) {
tags = tpb.getNamecolor();
- itemDisplayName = "&6&l昵称效果&r ";
+ itemDisplayName = LangCfg.TAG_COLOR_ITEM_NAME + "§1§r ";
tagPermissions = NAMECOLOR_PERMISSIONS;
} else if (tagType == TagType.PREFIX_TYPE) {
tags = tpb.getPrefix();
- itemDisplayName = "&6&l昵称前缀&r ";
+ itemDisplayName = LangCfg.TAG_PREFIX_ITEM_NAME + "§2§r ";
tagPermissions = PREFIX_PERMISSIONS;
} else if (tagType == TagType.SUFFIX_TYPE) {
tags = tpb.getSuffix();
- itemDisplayName = "&6&l昵称后缀&r ";
+ itemDisplayName = LangCfg.TAG_SUFFIX_ITEM_NAME + "§3§r ";
tagPermissions = SUFFIX_PERMISSIONS;
}
if (tags != null) {
diff --git a/src/main/gg/frog/mc/permissionstime/gui/PlayerTagShow.java b/src/main/gg/frog/mc/nametags/gui/PlayerTagShow.java
similarity index 87%
rename from src/main/gg/frog/mc/permissionstime/gui/PlayerTagShow.java
rename to src/main/gg/frog/mc/nametags/gui/PlayerTagShow.java
index d2687f2..a4ffdc5 100644
--- a/src/main/gg/frog/mc/permissionstime/gui/PlayerTagShow.java
+++ b/src/main/gg/frog/mc/nametags/gui/PlayerTagShow.java
@@ -1,4 +1,4 @@
-package gg.frog.mc.permissionstime.gui;
+package gg.frog.mc.nametags.gui;
import java.util.List;
@@ -8,13 +8,13 @@ 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.PluginCfg;
-import gg.frog.mc.permissionstime.config.TagNameCfg;
-import gg.frog.mc.permissionstime.config.TagNameCfg.TagType;
-import gg.frog.mc.permissionstime.model.PlayerTagBean;
-import gg.frog.mc.permissionstime.utils.StrUtil;
-import gg.frog.mc.permissionstime.utils.nms.ItemUtil;
+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 {
@@ -22,7 +22,7 @@ public class PlayerTagShow {
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&r"));
+ 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§r"));
String uuid = player.getUniqueId().toString();
PlayerTagBean playerTag = null;
if (TagNameCfg.PLAYER_TAG.containsKey(uuid)) {
diff --git a/src/main/gg/frog/mc/nametags/listener/TagsListener.java b/src/main/gg/frog/mc/nametags/listener/TagsListener.java
new file mode 100644
index 0000000..dad3253
--- /dev/null
+++ b/src/main/gg/frog/mc/nametags/listener/TagsListener.java
@@ -0,0 +1,102 @@
+package gg.frog.mc.nametags.listener;
+
+import java.util.List;
+
+import org.bukkit.OfflinePlayer;
+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.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) {
+ 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().getName());
+ 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().getName());
+ 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().getName());
+ 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§r").equals(event.getInventory().getName())) {
+ if (event.getCurrentItem() != null && event.getCurrentItem().getItemMeta() != null && event.getCurrentItem().getItemMeta().hasLore()) {
+ List lores = event.getCurrentItem().getItemMeta().getLore();
+ if (lores.size() > 1) {
+ String permissions = lores.get(lores.size() - 2);
+ permissions = permissions.length() > 4 ? permissions.substring(4) : "";
+ OfflinePlayer player = this.pm.getOfflinePlayer(event.getWhoClicked().getName());
+ String uuid = player.getUniqueId().toString();
+ if (permissions.length() == 0 || player.getPlayer().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 {
+ event.setCancelled(true);
+ return;
+ }
+ playerTag.setPlayerDisplayName(player.getPlayer(), true);
+ playerTag.saveConfig();
+ player.getPlayer().sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + LangCfg.MSG_TAG_SET_SUCCESS));
+ }
+ } else {
+ player.getPlayer().sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + LangCfg.MSG_NO_PERMISSION));
+ }
+ }
+ }
+ event.setCancelled(true);
+ }
+ }
+}
diff --git a/src/main/gg/frog/mc/permissionstime/model/PlayerTagBean.java b/src/main/gg/frog/mc/nametags/model/PlayerTagBean.java
similarity index 84%
rename from src/main/gg/frog/mc/permissionstime/model/PlayerTagBean.java
rename to src/main/gg/frog/mc/nametags/model/PlayerTagBean.java
index dee1c8e..91895aa 100644
--- a/src/main/gg/frog/mc/permissionstime/model/PlayerTagBean.java
+++ b/src/main/gg/frog/mc/nametags/model/PlayerTagBean.java
@@ -1,4 +1,4 @@
-package gg.frog.mc.permissionstime.model;
+package gg.frog.mc.nametags.model;
import org.bukkit.Location;
import org.bukkit.configuration.MemorySection;
@@ -9,13 +9,13 @@ import org.bukkit.scoreboard.Team;
import com.gmail.filoghost.holographicdisplays.api.Hologram;
import com.gmail.filoghost.holographicdisplays.api.HologramsAPI;
-import gg.frog.mc.permissionstime.PluginMain;
-import gg.frog.mc.permissionstime.config.PluginCfg;
-import gg.frog.mc.permissionstime.config.TagNameCfg;
-import gg.frog.mc.permissionstime.utils.StrUtil;
-import gg.frog.mc.permissionstime.utils.config.IConfigBean;
-import gg.frog.mc.permissionstime.utils.config.PluginConfig;
-import gg.frog.mc.permissionstime.utils.nms.NMSUtil;
+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;
/**
* 玩家标签包实体类
@@ -127,8 +127,8 @@ public class PlayerTagBean extends PluginConfig implements IConfigBean, Cloneabl
}
}
if (forceSet || namecolor_flag || prefix_flag || suffix_flag) {
- displayPrefix = StrUtil.messageFormat(player, prefix + "&r" + namecolor);
- displaySuffix = StrUtil.messageFormat(player, "&r" + suffix);
+ 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);
@@ -180,25 +180,35 @@ public class PlayerTagBean extends PluginConfig implements IConfigBean, Cloneabl
}
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()) {
- Location loc = player.getLocation();
- loc = new Location(loc.getWorld(), loc.getX(), loc.getY() + 2.75, loc.getZ());
holograms = HologramsAPI.createHologram(pm, loc);
- holograms.getVisibilityManager().hideTo(player);
+ } else {
+ holograms.teleport(loc);
}
holograms.clearLines();
- holograms.appendTextLine(StrUtil.messageFormat(player, prefix));
- holograms.appendTextLine(StrUtil.messageFormat(player, namecolor + player.getName()));
- holograms.appendTextLine(StrUtil.messageFormat(player, suffix));
+ 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();
- holograms.teleport(loc.getWorld(), loc.getX(), loc.getY() + 2.75, loc.getZ());
+ 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();
@@ -206,7 +216,7 @@ public class PlayerTagBean extends PluginConfig implements IConfigBean, Cloneabl
}
public String getDisplayNameStr(Player player) {
- return StrUtil.messageFormat(prefix + "&r" + namecolor + player.getName() + "&r" + suffix);
+ return StrUtil.messageFormat(prefix + "§r" + namecolor + player.getName() + "§r" + suffix);
}
@Override
diff --git a/src/main/gg/frog/mc/permissionstime/placeholder/TagPlaceholder.java b/src/main/gg/frog/mc/nametags/placeholder/TagPlaceholder.java
similarity index 81%
rename from src/main/gg/frog/mc/permissionstime/placeholder/TagPlaceholder.java
rename to src/main/gg/frog/mc/nametags/placeholder/TagPlaceholder.java
index 944ed0c..b736813 100644
--- a/src/main/gg/frog/mc/permissionstime/placeholder/TagPlaceholder.java
+++ b/src/main/gg/frog/mc/nametags/placeholder/TagPlaceholder.java
@@ -1,11 +1,11 @@
-package gg.frog.mc.permissionstime.placeholder;
+package gg.frog.mc.nametags.placeholder;
import org.bukkit.entity.Player;
-import gg.frog.mc.permissionstime.PluginMain;
-import gg.frog.mc.permissionstime.config.PluginCfg;
-import gg.frog.mc.permissionstime.config.TagNameCfg;
-import gg.frog.mc.permissionstime.model.PlayerTagBean;
+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 {
diff --git a/src/main/gg/frog/mc/permissionstime/command/GetCmd.java b/src/main/gg/frog/mc/permissionstime/command/GetCmd.java
index ce8ef0b..d03415c 100644
--- a/src/main/gg/frog/mc/permissionstime/command/GetCmd.java
+++ b/src/main/gg/frog/mc/permissionstime/command/GetCmd.java
@@ -4,14 +4,14 @@ import java.util.List;
import org.bukkit.command.CommandSender;
-import gg.frog.mc.permissionstime.PluginMain;
-import gg.frog.mc.permissionstime.config.LangCfg;
+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.permissionstime.config.PackagesCfg;
-import gg.frog.mc.permissionstime.config.PluginCfg;
import gg.frog.mc.permissionstime.database.SqlManager;
import gg.frog.mc.permissionstime.model.cfg.PermissionPackageBean;
import gg.frog.mc.permissionstime.model.db.PlayerDataBean;
-import gg.frog.mc.permissionstime.utils.StrUtil;
public class GetCmd implements Runnable {
diff --git a/src/main/gg/frog/mc/permissionstime/command/GiveCmd.java b/src/main/gg/frog/mc/permissionstime/command/GiveCmd.java
index e210d2f..1812e49 100644
--- a/src/main/gg/frog/mc/permissionstime/command/GiveCmd.java
+++ b/src/main/gg/frog/mc/permissionstime/command/GiveCmd.java
@@ -6,14 +6,14 @@ import org.bukkit.OfflinePlayer;
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.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.permissionstime.config.PackagesCfg;
-import gg.frog.mc.permissionstime.config.PluginCfg;
import gg.frog.mc.permissionstime.database.SqlManager;
import gg.frog.mc.permissionstime.model.cfg.PermissionPackageBean;
import gg.frog.mc.permissionstime.model.db.PlayerDataBean;
-import gg.frog.mc.permissionstime.utils.StrUtil;
public class GiveCmd implements Runnable {
diff --git a/src/main/gg/frog/mc/permissionstime/command/MeCmd.java b/src/main/gg/frog/mc/permissionstime/command/MeCmd.java
index b4b97a8..f4b7b38 100644
--- a/src/main/gg/frog/mc/permissionstime/command/MeCmd.java
+++ b/src/main/gg/frog/mc/permissionstime/command/MeCmd.java
@@ -5,13 +5,13 @@ import java.util.List;
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.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.permissionstime.database.SqlManager;
import gg.frog.mc.permissionstime.gui.PlayerPermissionShow;
import gg.frog.mc.permissionstime.model.db.PlayerDataBean;
-import gg.frog.mc.permissionstime.utils.StrUtil;
public class MeCmd implements Runnable {
@@ -42,7 +42,7 @@ public class MeCmd implements Runnable {
sender.sendMessage(StrUtil.messageFormat(LangCfg.CMD_ME, pm.PLUGIN_NAME_LOWER_CASE));
}
} else {
- sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "&4Only player can use this command."));
+ sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "§4Only player can use this command."));
}
}
}
diff --git a/src/main/gg/frog/mc/permissionstime/command/PackagesCmd.java b/src/main/gg/frog/mc/permissionstime/command/PackagesCmd.java
index 3a60779..ea36724 100644
--- a/src/main/gg/frog/mc/permissionstime/command/PackagesCmd.java
+++ b/src/main/gg/frog/mc/permissionstime/command/PackagesCmd.java
@@ -4,12 +4,12 @@ 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.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.permissionstime.config.PackagesCfg;
-import gg.frog.mc.permissionstime.config.PluginCfg;
import gg.frog.mc.permissionstime.model.cfg.PermissionPackageBean;
-import gg.frog.mc.permissionstime.utils.StrUtil;
public class PackagesCmd implements Runnable {
diff --git a/src/main/gg/frog/mc/permissionstime/command/MainCommand.java b/src/main/gg/frog/mc/permissionstime/command/PtCommand.java
similarity index 87%
rename from src/main/gg/frog/mc/permissionstime/command/MainCommand.java
rename to src/main/gg/frog/mc/permissionstime/command/PtCommand.java
index 0fbf69c..f67e7ad 100644
--- a/src/main/gg/frog/mc/permissionstime/command/MainCommand.java
+++ b/src/main/gg/frog/mc/permissionstime/command/PtCommand.java
@@ -11,26 +11,34 @@ import org.bukkit.command.TabCompleter;
import org.bukkit.entity.Player;
import org.bukkit.inventory.InventoryView;
-import gg.frog.mc.permissionstime.PluginMain;
-import gg.frog.mc.permissionstime.config.LangCfg;
+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.command.TagCmd;
+import gg.frog.mc.permissionstime.command.GetCmd;
+import gg.frog.mc.permissionstime.command.GiveCmd;
+import gg.frog.mc.permissionstime.command.MeCmd;
+import gg.frog.mc.permissionstime.command.PackagesCmd;
+import gg.frog.mc.permissionstime.command.RemoveAllCmd;
+import gg.frog.mc.permissionstime.command.RemoveCmd;
+import gg.frog.mc.permissionstime.command.SetCmd;
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.utils.StrUtil;
-public class MainCommand implements CommandExecutor, TabCompleter {
+public class PtCommand implements CommandExecutor, TabCompleter {
private PluginMain pm;
private SqlManager sm;
- public MainCommand(PluginMain pm) {
+ public PtCommand(PluginMain pm) {
this.pm = pm;
this.sm = pm.getSqlManager();
}
@Override
public boolean onCommand(CommandSender sender, Command command, String commandLabel, String[] args) {
- if (commandLabel.equalsIgnoreCase(pm.PLUGIN_NAME_LOWER_CASE) || commandLabel.equalsIgnoreCase("pt")) {
+ if (commandLabel.equalsIgnoreCase("permissionstime") || commandLabel.equalsIgnoreCase("pt")) {
boolean isPlayer = false;
if (sender instanceof Player) {
isPlayer = true;
@@ -46,13 +54,13 @@ public class MainCommand implements CommandExecutor, TabCompleter {
if (player.hasPermission("permissionstime.reload")) {
for (Player p : pm.getServer().getOnlinePlayers()) {
InventoryView inventory = p.getOpenInventory();
- if (inventory != null && (StrUtil.messageFormat(LangCfg.INVENTORY_NAME + "&r&5&9&2&0&r").equals(inventory.getTitle()) || StrUtil.messageFormat(LangCfg.TAG_INVENTORY_NAME + "&r&5&9&2&0&r").equals(inventory.getTitle()))) {
+ if (inventory != null && (StrUtil.messageFormat(LangCfg.INVENTORY_NAME + "§r§5§9§2§0§r").equals(inventory.getTitle()) || StrUtil.messageFormat(LangCfg.TAG_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 + "&4Database exceptions."));
+ sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "§4Database exceptions."));
}
sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + LangCfg.MSG_CONFIG_RELOADED));
pm.getServer().getConsoleSender().sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + LangCfg.MSG_CONFIG_RELOADED));
@@ -62,13 +70,13 @@ public class MainCommand implements CommandExecutor, TabCompleter {
} else {
for (Player p : pm.getServer().getOnlinePlayers()) {
InventoryView inventory = p.getOpenInventory();
- if (inventory != null && (StrUtil.messageFormat(LangCfg.INVENTORY_NAME + "&r&5&9&2&0&r").equals(inventory.getTitle()) || StrUtil.messageFormat(LangCfg.TAG_INVENTORY_NAME + "&r&5&9&2&0&r").equals(inventory.getTitle()))) {
+ if (inventory != null && (StrUtil.messageFormat(LangCfg.INVENTORY_NAME + "§r§5§9§2§0§r").equals(inventory.getTitle()) || StrUtil.messageFormat(LangCfg.TAG_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 + "&4Database exceptions."));
+ sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "§4Database exceptions."));
}
sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + LangCfg.MSG_CONFIG_RELOADED));
}
@@ -127,7 +135,7 @@ public class MainCommand implements CommandExecutor, TabCompleter {
}
private void getHelp(CommandSender sender, boolean isPlayer) {
- sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "\n&a===== " + pm.PLUGIN_NAME + " Version:" + pm.PLUGIN_VERSION + (pm.getDescription().getCommands().containsKey("pt") ? " Aliases:/pt" : "") + " ====="));
+ sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "\n§a===== " + pm.PLUGIN_NAME + " Version:" + pm.PLUGIN_VERSION + (pm.getDescription().getCommands().containsKey("pt") ? " Aliases:/pt" : "") + " ====="));
if (isPlayer && (sender.hasPermission(pm.PLUGIN_NAME_LOWER_CASE + ".me"))) {
sender.sendMessage(StrUtil.messageFormat(LangCfg.CMD_ME, pm.PLUGIN_NAME_LOWER_CASE));
}
diff --git a/src/main/gg/frog/mc/permissionstime/command/RemoveAllCmd.java b/src/main/gg/frog/mc/permissionstime/command/RemoveAllCmd.java
index 46375ef..c4bc250 100644
--- a/src/main/gg/frog/mc/permissionstime/command/RemoveAllCmd.java
+++ b/src/main/gg/frog/mc/permissionstime/command/RemoveAllCmd.java
@@ -6,13 +6,13 @@ import org.bukkit.OfflinePlayer;
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.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.permissionstime.database.SqlManager;
import gg.frog.mc.permissionstime.model.cfg.PermissionPackageBean;
import gg.frog.mc.permissionstime.model.db.PlayerDataBean;
-import gg.frog.mc.permissionstime.utils.StrUtil;
public class RemoveAllCmd implements Runnable {
diff --git a/src/main/gg/frog/mc/permissionstime/command/RemoveCmd.java b/src/main/gg/frog/mc/permissionstime/command/RemoveCmd.java
index 4f71eb8..3cd4456 100644
--- a/src/main/gg/frog/mc/permissionstime/command/RemoveCmd.java
+++ b/src/main/gg/frog/mc/permissionstime/command/RemoveCmd.java
@@ -6,14 +6,14 @@ import org.bukkit.OfflinePlayer;
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.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.permissionstime.config.PackagesCfg;
-import gg.frog.mc.permissionstime.config.PluginCfg;
import gg.frog.mc.permissionstime.database.SqlManager;
import gg.frog.mc.permissionstime.model.cfg.PermissionPackageBean;
import gg.frog.mc.permissionstime.model.db.PlayerDataBean;
-import gg.frog.mc.permissionstime.utils.StrUtil;
public class RemoveCmd implements Runnable {
diff --git a/src/main/gg/frog/mc/permissionstime/command/SetCmd.java b/src/main/gg/frog/mc/permissionstime/command/SetCmd.java
index ff1dcd4..1103065 100644
--- a/src/main/gg/frog/mc/permissionstime/command/SetCmd.java
+++ b/src/main/gg/frog/mc/permissionstime/command/SetCmd.java
@@ -6,14 +6,14 @@ import org.bukkit.OfflinePlayer;
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.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.permissionstime.config.PackagesCfg;
-import gg.frog.mc.permissionstime.config.PluginCfg;
import gg.frog.mc.permissionstime.database.SqlManager;
import gg.frog.mc.permissionstime.model.cfg.PermissionPackageBean;
import gg.frog.mc.permissionstime.model.db.PlayerDataBean;
-import gg.frog.mc.permissionstime.utils.StrUtil;
public class SetCmd implements Runnable {
diff --git a/src/main/gg/frog/mc/permissionstime/config/PackagesCfg.java b/src/main/gg/frog/mc/permissionstime/config/PackagesCfg.java
index da4d859..272411e 100644
--- a/src/main/gg/frog/mc/permissionstime/config/PackagesCfg.java
+++ b/src/main/gg/frog/mc/permissionstime/config/PackagesCfg.java
@@ -15,11 +15,12 @@ import org.bukkit.Material;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
-import gg.frog.mc.permissionstime.PluginMain;
+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.PluginConfig;
+import gg.frog.mc.base.utils.nms.ItemUtil;
import gg.frog.mc.permissionstime.model.cfg.PermissionPackageBean;
-import gg.frog.mc.permissionstime.utils.StrUtil;
-import gg.frog.mc.permissionstime.utils.config.PluginConfig;
-import gg.frog.mc.permissionstime.utils.nms.ItemUtil;
public class PackagesCfg extends PluginConfig {
@@ -103,7 +104,7 @@ public class PackagesCfg extends PluginConfig {
if (type != null) {
ItemStack item = new ItemStack(type, 1, (short) 0, (byte) exid);
ItemMeta meta = item.getItemMeta();
- meta.setDisplayName(StrUtil.messageFormat(ppb.getDisplayName() + "&r(" + name + ")"));
+ meta.setDisplayName(StrUtil.messageFormat(ppb.getDisplayName() + "§r(" + name + ")"));
List lores = new ArrayList();
for (String lore : ppb.getLores()) {
lores.add(StrUtil.messageFormat(lore));
diff --git a/src/main/gg/frog/mc/permissionstime/database/SqlManager.java b/src/main/gg/frog/mc/permissionstime/database/SqlManager.java
index 22a6721..2681167 100644
--- a/src/main/gg/frog/mc/permissionstime/database/SqlManager.java
+++ b/src/main/gg/frog/mc/permissionstime/database/SqlManager.java
@@ -3,8 +3,8 @@ package gg.frog.mc.permissionstime.database;
import java.util.Collections;
import java.util.List;
-import gg.frog.mc.permissionstime.PluginMain;
-import gg.frog.mc.permissionstime.config.PluginCfg;
+import gg.frog.mc.base.PluginMain;
+import gg.frog.mc.base.config.PluginCfg;
import gg.frog.mc.permissionstime.database.impl.MySQLPlayerDataDao;
import gg.frog.mc.permissionstime.database.impl.SqlitePlayerDataDao;
import gg.frog.mc.permissionstime.model.db.PlayerDataBean;
diff --git a/src/main/gg/frog/mc/permissionstime/database/impl/MySQLPlayerDataDao.java b/src/main/gg/frog/mc/permissionstime/database/impl/MySQLPlayerDataDao.java
index 316ca8c..1a1ca4b 100644
--- a/src/main/gg/frog/mc/permissionstime/database/impl/MySQLPlayerDataDao.java
+++ b/src/main/gg/frog/mc/permissionstime/database/impl/MySQLPlayerDataDao.java
@@ -5,14 +5,14 @@ import java.util.ArrayList;
import java.util.Date;
import java.util.List;
-import gg.frog.mc.permissionstime.PluginMain;
+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.database.DatabaseUtil;
import gg.frog.mc.permissionstime.config.PackagesCfg;
-import gg.frog.mc.permissionstime.config.PluginCfg;
import gg.frog.mc.permissionstime.database.IPlayerDataDao;
import gg.frog.mc.permissionstime.database.SqlManager;
import gg.frog.mc.permissionstime.model.db.PlayerDataBean;
-import gg.frog.mc.permissionstime.utils.StrUtil;
-import gg.frog.mc.permissionstime.utils.database.DatabaseUtil;
public class MySQLPlayerDataDao extends DatabaseUtil implements IPlayerDataDao {
@@ -37,7 +37,7 @@ public class MySQLPlayerDataDao extends DatabaseUtil implements IPlayerDataDao {
return false;
} catch (Exception e) {
pm.getServer().getConsoleSender()
- .sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "&4Can't check table is exist."));
+ .sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "§4Can't check table is exist."));
throw e;
}
}
@@ -51,7 +51,7 @@ public class MySQLPlayerDataDao extends DatabaseUtil implements IPlayerDataDao {
return true;
} catch (Exception e) {
pm.getServer().getConsoleSender()
- .sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "&4Can't creat table."));
+ .sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "§4Can't creat table."));
throw e;
}
}
@@ -80,7 +80,7 @@ public class MySQLPlayerDataDao extends DatabaseUtil implements IPlayerDataDao {
return true;
} catch (Exception e) {
pm.getServer().getConsoleSender()
- .sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "&4Can't creat data: {0}", pdb));
+ .sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "§4Can't creat data: {0}", pdb));
throw e;
}
}
@@ -141,7 +141,7 @@ public class MySQLPlayerDataDao extends DatabaseUtil implements IPlayerDataDao {
return true;
} catch (Exception e) {
pm.getServer().getConsoleSender().sendMessage(
- StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "&4Can't update data: {0}", pdb));
+ StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "§4Can't update data: {0}", pdb));
throw e;
}
}
@@ -170,7 +170,7 @@ public class MySQLPlayerDataDao extends DatabaseUtil implements IPlayerDataDao {
return pdbList;
} catch (Exception e) {
pm.getServer().getConsoleSender().sendMessage(
- StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "&4Can't find data by UUID: {0}", uuid));
+ StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "§4Can't find data by UUID: {0}", uuid));
throw e;
}
}
@@ -201,7 +201,7 @@ public class MySQLPlayerDataDao extends DatabaseUtil implements IPlayerDataDao {
return null;
} catch (Exception e) {
pm.getServer().getConsoleSender().sendMessage(StrUtil.messageFormat(
- PluginCfg.PLUGIN_PREFIX + "&4Can't find data by UUID: {0}, packageName: {1}", uuid, packageName));
+ PluginCfg.PLUGIN_PREFIX + "§4Can't find data by UUID: {0}, packageName: {1}", uuid, packageName));
throw e;
}
}
@@ -232,7 +232,7 @@ public class MySQLPlayerDataDao extends DatabaseUtil implements IPlayerDataDao {
return pdbList;
} catch (Exception e) {
pm.getServer().getConsoleSender().sendMessage(
- StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "&4Can't find data by UUID: {0}", uuid));
+ StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "§4Can't find data by UUID: {0}", uuid));
throw e;
}
}
@@ -246,7 +246,7 @@ public class MySQLPlayerDataDao extends DatabaseUtil implements IPlayerDataDao {
return true;
} catch (Exception e) {
pm.getServer().getConsoleSender()
- .sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "&4Can't delete data by ID: {0}", id));
+ .sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "§4Can't delete data by ID: {0}", id));
throw e;
}
}
@@ -265,7 +265,7 @@ public class MySQLPlayerDataDao extends DatabaseUtil implements IPlayerDataDao {
return true;
} catch (Exception e) {
pm.getServer().getConsoleSender().sendMessage(
- StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "&4Can't delete data by UUID: {0}", uuid));
+ StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "§4Can't delete data by UUID: {0}", uuid));
throw e;
}
}
@@ -284,7 +284,7 @@ public class MySQLPlayerDataDao extends DatabaseUtil implements IPlayerDataDao {
return true;
} catch (Exception e) {
pm.getServer().getConsoleSender().sendMessage(StrUtil.messageFormat(
- PluginCfg.PLUGIN_PREFIX + "&4Can't delete data by UUID: {0}, packageName: {1}", uuid, packageName));
+ PluginCfg.PLUGIN_PREFIX + "§4Can't delete data by UUID: {0}, packageName: {1}", uuid, packageName));
throw e;
}
}
diff --git a/src/main/gg/frog/mc/permissionstime/database/impl/SqlitePlayerDataDao.java b/src/main/gg/frog/mc/permissionstime/database/impl/SqlitePlayerDataDao.java
index 8990f75..1b4573f 100644
--- a/src/main/gg/frog/mc/permissionstime/database/impl/SqlitePlayerDataDao.java
+++ b/src/main/gg/frog/mc/permissionstime/database/impl/SqlitePlayerDataDao.java
@@ -5,14 +5,14 @@ import java.util.ArrayList;
import java.util.Date;
import java.util.List;
-import gg.frog.mc.permissionstime.PluginMain;
+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.database.DatabaseUtil;
import gg.frog.mc.permissionstime.config.PackagesCfg;
-import gg.frog.mc.permissionstime.config.PluginCfg;
import gg.frog.mc.permissionstime.database.IPlayerDataDao;
import gg.frog.mc.permissionstime.database.SqlManager;
import gg.frog.mc.permissionstime.model.db.PlayerDataBean;
-import gg.frog.mc.permissionstime.utils.StrUtil;
-import gg.frog.mc.permissionstime.utils.database.DatabaseUtil;
public class SqlitePlayerDataDao extends DatabaseUtil implements IPlayerDataDao {
@@ -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 + "&4Can't check table is exist."));
+ 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 + "&4Can't creat table."));
+ 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 + "&4Can't creat data: {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 + "&4Can't update data: {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 + "&4Can't find data by 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 + "&4Can't find data by 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 + "&4Can't find data by 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 + "&4Can't delete data by ID: {0}", id));
+ pm.getServer().getConsoleSender().sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "§4Can't delete data by ID: {0}", id));
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 + "&4Can't delete data by UUID: {0}", uuid));
+ pm.getServer().getConsoleSender().sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "§4Can't delete data by UUID: {0}", uuid));
throw e;
}
}
@@ -206,7 +206,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 + "&4Can't delete data by 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;
}
}
diff --git a/src/main/gg/frog/mc/permissionstime/gui/PlayerPermissionShow.java b/src/main/gg/frog/mc/permissionstime/gui/PlayerPermissionShow.java
index 0c62db8..b17e68d 100644
--- a/src/main/gg/frog/mc/permissionstime/gui/PlayerPermissionShow.java
+++ b/src/main/gg/frog/mc/permissionstime/gui/PlayerPermissionShow.java
@@ -8,12 +8,12 @@ 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.base.config.LangCfg;
+import gg.frog.mc.base.config.PluginCfg;
+import gg.frog.mc.base.utils.StrUtil;
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.db.PlayerDataBean;
-import gg.frog.mc.permissionstime.utils.StrUtil;
public class PlayerPermissionShow {
@@ -21,7 +21,7 @@ public class PlayerPermissionShow {
Inventory inventory = null;
int size = 0;
if (pdbList.size() > 0) {
- inventory = Bukkit.createInventory(null, (pdbList.size() % 9 == 0 ? pdbList.size() : (pdbList.size() / 9 + 1) * 9), StrUtil.messageFormat(LangCfg.TAG_INVENTORY_NAME + "&r&5&9&2&0&r"));
+ inventory = Bukkit.createInventory(null, (pdbList.size() % 9 == 0 ? pdbList.size() : (pdbList.size() / 9 + 1) * 9), StrUtil.messageFormat(LangCfg.TAG_INVENTORY_NAME + "§r§5§9§2§0§r"));
for (PlayerDataBean pdb : pdbList) {
PermissionPackageBean ppb = PackagesCfg.PACKAGES.get(pdb.getPackageName());
if (ppb != null && pdb.getGlobal() == ppb.getGlobal()) {
diff --git a/src/main/gg/frog/mc/permissionstime/listener/MainListener.java b/src/main/gg/frog/mc/permissionstime/listener/MainListener.java
index 5479e1f..38c43b4 100644
--- a/src/main/gg/frog/mc/permissionstime/listener/MainListener.java
+++ b/src/main/gg/frog/mc/permissionstime/listener/MainListener.java
@@ -2,24 +2,20 @@ package gg.frog.mc.permissionstime.listener;
import java.util.List;
-import org.bukkit.OfflinePlayer;
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.PlayerKickEvent;
import org.bukkit.event.player.PlayerLoginEvent;
-import org.bukkit.event.player.PlayerMoveEvent;
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.config.TagNameCfg;
-import gg.frog.mc.permissionstime.model.PlayerTagBean;
+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.permissionstime.model.cfg.PermissionPackageBean;
import gg.frog.mc.permissionstime.model.db.PlayerDataBean;
-import gg.frog.mc.permissionstime.utils.StrUtil;
public class MainListener implements Listener {
@@ -42,9 +38,6 @@ public class MainListener implements Listener {
e.printStackTrace();
event.getPlayer().sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + LangCfg.MSG_FAIL_SET_PERMISSION));
}
- if (PluginCfg.TAG_SYSTEM) {
- PlayerTagBean.initPlayerTag(event.getPlayer(), pm);
- }
}
}).start();
}
@@ -56,11 +49,6 @@ public class MainListener implements Listener {
public void run() {
try {
PermissionPackageBean.delPlayerAllPermissions(event.getPlayer(), pm);
- if (PluginCfg.TAG_SYSTEM && TagNameCfg.USE_HD_PLUGIN) {
- String uuid = pm.getPlayerUUIDByName(event.getPlayer().getName());
- PlayerTagBean playerTag = TagNameCfg.PLAYER_TAG.get(uuid);
- playerTag.delHologramsName();
- }
} catch (Exception e) {
e.printStackTrace();
}
@@ -84,53 +72,9 @@ public class MainListener implements Listener {
pm.getPlayerMap().remove(event.getPlayer().getName());
}
- @EventHandler
- public void onMove(PlayerMoveEvent event) {
- if (PluginCfg.TAG_SYSTEM && TagNameCfg.USE_HD_PLUGIN) {
- String uuid = this.pm.getPlayerUUIDByName(event.getPlayer().getName());
- PlayerTagBean playerTag = TagNameCfg.PLAYER_TAG.get(uuid);
- if (playerTag != null) {
- playerTag.moveHologramsName(event.getPlayer());
- }
- }
- }
-
@EventHandler
public void onPlayerClick(InventoryClickEvent event) {
- if (StrUtil.messageFormat(LangCfg.INVENTORY_NAME + "&r&5&9&2&0&r").equals(event.getInventory().getName())) {
- event.setCancelled(true);
- }
- if (StrUtil.messageFormat(LangCfg.TAG_INVENTORY_NAME + "&r&5&9&2&0&r").equals(event.getInventory().getName())) {
- if (event.getCurrentItem() != null && event.getCurrentItem().getItemMeta() != null && event.getCurrentItem().getItemMeta().hasLore()) {
- List lores = event.getCurrentItem().getItemMeta().getLore();
- if (lores.size() > 1) {
- String permissions = lores.get(lores.size() - 2);
- permissions = permissions.length() > 4 ? permissions.substring(4) : "";
- OfflinePlayer player = this.pm.getOfflinePlayer(event.getWhoClicked().getName());
- String uuid = player.getUniqueId().toString();
- if (permissions.length() == 0 || player.getPlayer().hasPermission(permissions)) {
- if (TagNameCfg.PLAYER_TAG.containsKey(uuid)) {
- String itemName = event.getCurrentItem().getItemMeta().getDisplayName();
- PlayerTagBean playerTag = TagNameCfg.PLAYER_TAG.get(uuid);
- if (itemName.startsWith("§6§l昵称效果§r ")) {
- playerTag.setNamecolor(lores.get(lores.size() - 1).substring(2));
- } else if (itemName.startsWith("§6§l昵称前缀§r ")) {
- playerTag.setPrefix(lores.get(lores.size() - 1).substring(2));
- } else if (itemName.startsWith("§6§l昵称后缀§r ")) {
- playerTag.setSuffix(lores.get(lores.size() - 1).substring(2));
- } else {
- event.setCancelled(true);
- return;
- }
- playerTag.setPlayerDisplayName(player.getPlayer(), true);
- playerTag.saveConfig();
- player.getPlayer().sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + LangCfg.MSG_TAG_SET_SUCCESS));
- }
- } else {
- player.getPlayer().sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + LangCfg.MSG_NO_PERMISSION));
- }
- }
- }
+ if (StrUtil.messageFormat(LangCfg.INVENTORY_NAME + "§r§5§9§2§0§r").equals(event.getInventory().getName())) {
event.setCancelled(true);
}
}
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 03f80f6..2fa5283 100644
--- a/src/main/gg/frog/mc/permissionstime/model/cfg/PermissionPackageBean.java
+++ b/src/main/gg/frog/mc/permissionstime/model/cfg/PermissionPackageBean.java
@@ -13,13 +13,13 @@ import org.bukkit.configuration.MemorySection;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.scheduler.BukkitTask;
-import gg.frog.mc.permissionstime.PluginMain;
-import gg.frog.mc.permissionstime.config.LangCfg;
+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.IConfigBean;
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.utils.StrUtil;
-import gg.frog.mc.permissionstime.utils.config.IConfigBean;
import net.milkbowl.vault.permission.Permission;
/**
diff --git a/src/main/gg/frog/mc/permissionstime/model/cfg/TagPackageBean.java b/src/main/gg/frog/mc/permissionstime/model/cfg/TagPackageBean.java
index 24afd45..1a0b9bf 100644
--- a/src/main/gg/frog/mc/permissionstime/model/cfg/TagPackageBean.java
+++ b/src/main/gg/frog/mc/permissionstime/model/cfg/TagPackageBean.java
@@ -6,7 +6,7 @@ import java.util.List;
import org.bukkit.configuration.MemorySection;
import org.bukkit.configuration.file.YamlConfiguration;
-import gg.frog.mc.permissionstime.utils.config.IConfigBean;
+import gg.frog.mc.base.utils.config.IConfigBean;
/**
* 标签包实体类
diff --git a/src/resources/config.yml b/src/resources/config.yml
index be1f97c..8188c90 100644
--- a/src/resources/config.yml
+++ b/src/resources/config.yml
@@ -12,7 +12,7 @@ metrics: true
tagSystem: false
# 语言文件名称 在'lang'文件夹内.
# Language file name.
-lang: en
+lang: zh-cn
# 数据库相关.
# Database settings.
mysql:
diff --git a/src/resources/lang/en.yml b/src/resources/lang/en.yml
index d0228ed..a98d093 100644
--- a/src/resources/lang/en.yml
+++ b/src/resources/lang/en.yml
@@ -7,6 +7,9 @@ timeUnitH: 'hour(s)'
timeUnitM: 'minute(s)'
timeForever: 'Forever'
tag: 'Tag/Prefix'
+tagColorItemName: '&6&lName Style'
+tagPrefixItemName: '&6&lTag Prefix'
+tagSuffixItemName: '&6&lTag Suffix'
msg:
parameterMismatch: '&4Parameter mismatch.'
timeParameterIncorrect: '&4The number of time is incorrect. Please enter a nonzero integer.'
diff --git a/src/resources/lang/zh-cn.yml b/src/resources/lang/zh-cn.yml
index c90a189..65248b8 100644
--- a/src/resources/lang/zh-cn.yml
+++ b/src/resources/lang/zh-cn.yml
@@ -7,6 +7,9 @@ timeUnitH: '小时'
timeUnitM: '分钟'
timeForever: '永久'
tag: '标签/称号'
+tagColorItemName: '&6&l昵称效果'
+tagPrefixItemName: '&6&l昵称前缀'
+tagSuffixItemName: '&6&l昵称后缀'
msg:
parameterMismatch: '&4参数不匹配.'
timeParameterIncorrect: '&4时间参数不正确,请输入非零整数.'
diff --git a/src/resources/plugin.yml b/src/resources/plugin.yml
index 8db4180..c05df13 100644
--- a/src/resources/plugin.yml
+++ b/src/resources/plugin.yml
@@ -1,6 +1,6 @@
name: ${project.name}
-version: ${project.version}
-main: gg.frog.mc.permissionstime.PluginMain
+version: 0.4.1-SNAPSHOT
+main: gg.frog.mc.base.PluginMain
author:
- GeekFrog
description: ${project.description}
@@ -17,7 +17,7 @@ commands:
description: Aliases commands for permissionstime.
usage: /pt [param]
permissions:
- permissionstime.*:
+ gg.frog.permissionstime.*:
description: Gives access to all PermissionsTime commands.
default: op
children:
diff --git a/src/resources/tagNames.yml b/src/resources/tagNames.yml
index 9d74327..63ee761 100644
--- a/src/resources/tagNames.yml
+++ b/src/resources/tagNames.yml
@@ -15,6 +15,9 @@ 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则禁用刷新.
@@ -25,7 +28,7 @@ refreshTagTime: -1
template:
lore:
- '&1-----------------'
- - '&2效果展示:'
+ - '&2Preview:'
- '&3 %displayname%'
- '&4-----------------'
- '&5 %description%'