mirror of
https://github.com/Xiao-MoMi/Custom-Nameplates.git
synced 2025-12-26 10:29:09 +00:00
BUG FIX
This commit is contained in:
@@ -38,6 +38,7 @@ public final class CustomNameplates extends JavaPlugin {
|
||||
public void onEnable() {
|
||||
instance = this;
|
||||
adventure = BukkitAudiences.create(this);
|
||||
AdventureManager.consoleMessage("<gradient:#2E8B57:#48D1CC>[CustomNameplates] </gradient><color:#baffd1>Running on " + Bukkit.getVersion());
|
||||
//重载插件
|
||||
ConfigManager.MainConfig.ReloadConfig();
|
||||
ConfigManager.Message.ReloadConfig();
|
||||
@@ -61,7 +62,7 @@ public final class CustomNameplates extends JavaPlugin {
|
||||
return;
|
||||
}
|
||||
//启动完成
|
||||
AdventureManager.consoleMessage("<gradient:#DDE4FF:#8DA2EE>[CustomNameplates]</gradient> <color:#F5F5F5>Plugin has been enabled! Author: XiaoMoMi");
|
||||
AdventureManager.consoleMessage("<gradient:#2E8B57:#48D1CC>[CustomNameplates]</gradient> <color:#baffd1>插件已启用! 作者: 小默米 QQ:3266959688");
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -71,7 +72,7 @@ public final class CustomNameplates extends JavaPlugin {
|
||||
//清除缓存实体
|
||||
Execute.pCache.forEach(Entity::remove);
|
||||
//卸载完成
|
||||
AdventureManager.consoleMessage("<gradient:#DDE4FF:#8DA2EE>[CustomNameplates]</gradient> <color:#F5F5F5>Plugin has been disabled! Author: XiaoMoMi");
|
||||
AdventureManager.consoleMessage("<gradient:#2E8B57:#48D1CC>[CustomNameplates]</gradient> <color:#baffd1>插件已卸载! 作者: 小默米 QQ:3266959688");
|
||||
//关闭adventure
|
||||
if(adventure != null) {
|
||||
adventure.close();
|
||||
|
||||
@@ -38,14 +38,8 @@ import java.util.Optional;
|
||||
public class Execute implements CommandExecutor {
|
||||
|
||||
private final CustomNameplates plugin;
|
||||
private final HashMap<Player, Long> coolDown;
|
||||
{
|
||||
coolDown = new HashMap<>();
|
||||
}
|
||||
public static List<Entity> pCache;
|
||||
{
|
||||
pCache = new ArrayList<>();
|
||||
}
|
||||
private final HashMap<Player, Long> coolDown = new HashMap<>();
|
||||
public static List<Entity> pCache = new ArrayList<>();
|
||||
|
||||
public Execute(CustomNameplates plugin) {
|
||||
this.plugin = plugin;
|
||||
|
||||
@@ -20,7 +20,7 @@ public class DataManager {
|
||||
}
|
||||
PlayerData playerData = SqlHandler.getPlayerData(uuid);
|
||||
if (playerData == null) {
|
||||
playerData = PlayerData.EMPTY;
|
||||
playerData = new PlayerData(ConfigManager.MainConfig.default_nameplate, 0);
|
||||
}
|
||||
cache.put(uuid, playerData);
|
||||
return playerData;
|
||||
@@ -40,9 +40,9 @@ public class DataManager {
|
||||
|
||||
public static boolean create() {
|
||||
if(ConfigManager.DatabaseConfig.use_mysql){
|
||||
AdventureManager.consoleMessage("<gradient:#DDE4FF:#8DA2EE>[CustomNameplates]</gradient> <color:#00CED1>Storage Mode - MYSQL");
|
||||
AdventureManager.consoleMessage("<gradient:#2E8B57:#48D1CC>[CustomNameplates]</gradient> <color:#22e281>存储模式 - MYSQL");
|
||||
}else {
|
||||
AdventureManager.consoleMessage("<gradient:#DDE4FF:#8DA2EE>[CustomNameplates]</gradient> <color:#00CED1>Storage Mode - SQLite");
|
||||
AdventureManager.consoleMessage("<gradient:#2E8B57:#48D1CC>[CustomNameplates]</gradient> <color:#22e281>存储模式 - SQLite");
|
||||
}
|
||||
if (SqlHandler.connect()) {
|
||||
if (ConfigManager.DatabaseConfig.use_mysql) {
|
||||
|
||||
@@ -1,14 +1,7 @@
|
||||
package net.momirealms.customnameplates.data;
|
||||
|
||||
import net.momirealms.customnameplates.ConfigManager;
|
||||
|
||||
public class PlayerData {
|
||||
|
||||
public static PlayerData EMPTY;
|
||||
static {
|
||||
EMPTY = new PlayerData(ConfigManager.MainConfig.default_nameplate, 0);
|
||||
}
|
||||
|
||||
private String equipped;
|
||||
private int accepted;
|
||||
|
||||
|
||||
@@ -79,7 +79,7 @@ public class SqlHandler {
|
||||
if (rs.next()) {
|
||||
playerData = new PlayerData(rs.getString(2), rs.getInt(3));
|
||||
}else {
|
||||
sql = "INSERT INTO nameplates(player,equipped,accepted) values(?,?,?)";
|
||||
sql = "INSERT INTO " + tableName + "(player,equipped,accepted) values(?,?,?)";
|
||||
statement = connection.prepareStatement(sql);
|
||||
statement.setString(1, uuid.toString());
|
||||
statement.setString(2, "none");
|
||||
|
||||
@@ -26,14 +26,15 @@ public class HookManager {
|
||||
}
|
||||
|
||||
//Papi Hook检测
|
||||
//其实是一段问题代码,但基本人人都装了PAPI,更改意义不大
|
||||
private void initializePlaceholderAPI() {
|
||||
if(!ConfigManager.MainConfig.placeholderAPI){
|
||||
this.placeholderAPI = false;
|
||||
return;
|
||||
}
|
||||
if(CustomNameplates.instance.getServer().getPluginManager().getPlugin("PlaceholderAPI") != null){
|
||||
AdventureManager.consoleMessage("<gradient:#2E8B57:#48D1CC>[CustomNameplates]</gradient> <color:#baffd1>已启用 PlaceholderAPI 变量解析!");
|
||||
this.placeholderAPI = true;
|
||||
AdventureManager.consoleMessage("<gradient:#DDE4FF:#8DA2EE>[CustomNameplates]</gradient> " + "<color:#F5F5F5>PlaceholderAPI Hooked!");
|
||||
}
|
||||
}
|
||||
//ItemsAdder Hook检测
|
||||
@@ -43,7 +44,6 @@ public class HookManager {
|
||||
}
|
||||
if(CustomNameplates.instance.getServer().getPluginManager().getPlugin("ItemsAdder") != null){
|
||||
this.itemsAdder = true;
|
||||
AdventureManager.consoleMessage("<gradient:#DDE4FF:#8DA2EE>[CustomNameplates]</gradient> " + "<color:#F5F5F5>ItemsAdder Hooked!");
|
||||
}
|
||||
}
|
||||
/*
|
||||
|
||||
@@ -111,10 +111,11 @@ public class ResourceManager {
|
||||
return;
|
||||
}
|
||||
//资源包生成成功提示
|
||||
AdventureManager.consoleMessage("<gradient:#DDE4FF:#8DA2EE>[CustomNameplates]</gradient> <color:#F5F5F5>Resource pack has been successfully generated! <color:#3CB371>" + (this.caches.size() -1) + " <color:#F5F5F5>nameplates Loaded.");
|
||||
AdventureManager.consoleMessage("<gradient:#2E8B57:#48D1CC>[CustomNameplates]</gradient> <color:#baffd1>资源包已成功生成! 已载入 <white>" + (this.caches.size() -1) + " <color:#baffd1>个铭牌!");
|
||||
if (this.plugin.getHookManager().hasItemsAdder()){
|
||||
try{
|
||||
FileUtils.copyDirectory(g_file, new File(Bukkit.getPluginManager().getPlugin("ItemsAdder").getDataFolder() + File.separator + "data"+ File.separator + "resource_pack" + File.separator + "assets") );
|
||||
AdventureManager.consoleMessage("<gradient:#2E8B57:#48D1CC>[CustomNameplates]</gradient> <color:#baffd1>检测到 <color:#90EE90>ItemsAdder <color:#baffd1>已自动转移生成的资源包!");
|
||||
}catch (IOException e){
|
||||
e.printStackTrace();
|
||||
AdventureManager.consoleMessage("<red>[CustomNameplates] Error! Failed to copy files to ItemsAdder...</red>");
|
||||
@@ -137,7 +138,6 @@ public class ResourceManager {
|
||||
if(file.exists()){
|
||||
try{
|
||||
FileUtils.deleteDirectory(file);
|
||||
AdventureManager.consoleMessage("<gradient:#DDE4FF:#8DA2EE>[CustomNameplates]</gradient> <color:#F5F5F5>Successfully copy files to ItemsAdder...");
|
||||
}catch (IOException e){
|
||||
e.printStackTrace();
|
||||
AdventureManager.consoleMessage("<red>[CustomNameplates] Error! Failed to delete generated folder...</red>" );
|
||||
|
||||
@@ -4,7 +4,6 @@ settings:
|
||||
# Restart is a must when you change database configuration.
|
||||
storage-mode: SQLite
|
||||
use-pool: false
|
||||
disable-async: false
|
||||
|
||||
# MySQL settings
|
||||
MySQL:
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
messages:
|
||||
prefix: '<gradient:#DDE4FF:#8DA2EE>[CustomNameplates] </gradient>'
|
||||
prefix: '<gradient:#2E8B57:#48D1CC>[CustomNameplates] </gradient>'
|
||||
no-perm: '<red>你没有权限!</red>'
|
||||
lack-args: '<white>参数不足!</white>'
|
||||
reload: '<white>插件已重载!</white>'
|
||||
equip: '<white>你已佩戴铭牌 {Nameplate}</white> <yellow><click:run_command:nameplates preview>[点击预览]'
|
||||
equip: '<white>你已佩戴铭牌 {Nameplate}</white> <yellow><click:run_command:/nameplates preview>[点击预览]'
|
||||
force-equip: '<white>你已为玩家 {Player} 强制佩戴了铭牌 {Nameplate}</white>'
|
||||
unequip: '<white>你已卸下铭牌!</white>'
|
||||
force-unequip: '<white>你已强制卸下玩家 {Player} 的铭牌!</white>'
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
messages:
|
||||
prefix: '<gradient:#DDE4FF:#8DA2EE>[CustomNameplates] </gradient>'
|
||||
prefix: '<gradient:#2E8B57:#48D1CC>[CustomNameplates] </gradient>'
|
||||
no-perm: '<red>No Permission!</red>'
|
||||
lack-args: '<white>Insufficient parameters!</white>'
|
||||
reload: '<white>Reloaded!</white>'
|
||||
|
||||
Reference in New Issue
Block a user