diff --git a/dependency-reduced-pom.xml b/dependency-reduced-pom.xml index 45aa93c..2d3d2bc 100644 --- a/dependency-reduced-pom.xml +++ b/dependency-reduced-pom.xml @@ -3,7 +3,7 @@ 4.0.0 FPChat FPChat - 1.1 + 1.1.1 src/main/java diff --git a/pom.xml b/pom.xml index 0709dc3..73360b9 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ 4.0.0 FPChat FPChat - 1.1 + 1.1.1 spigot-repo diff --git a/src/main/java/com/fpghoti/fpchatx/FPChat.java b/src/main/java/com/fpghoti/fpchatx/FPChat.java index 80477fc..ed5f323 100644 --- a/src/main/java/com/fpghoti/fpchatx/FPChat.java +++ b/src/main/java/com/fpghoti/fpchatx/FPChat.java @@ -58,6 +58,7 @@ public class FPChat extends JavaPlugin { private MainConfig config; private MySQLConnection sql; private static FPChat plugin; + private String pluginTag; private int mysqlTimer = 1140; private BukkitTask refresh = null; private PlayerListener listener = null; @@ -70,6 +71,7 @@ public class FPChat extends JavaPlugin { vault.setupEconomy(); vault.setupPermissions(); config = new MainConfig(this); + pluginTag = config.getPluginTag(); if(config.mySQLEnabled()) { sql = new MySQLConnection(this); sql.generate(); @@ -91,7 +93,7 @@ public class FPChat extends JavaPlugin { } log(Level.INFO, desc.getName() + " version " + desc.getVersion() + " enabled."); } - + public void onDisable() { for(FPlayer p : FPlayer.getPlayers()) { p.cleanup(); @@ -113,12 +115,13 @@ public class FPChat extends JavaPlugin { if(config.mySQLEnabled()) { sql.disconnect(); } - + for(FPlayer p : FPlayer.getPlayers()) { p.cleanup(); } FPlayer.purge(); config = new MainConfig(this); + pluginTag = config.getPluginTag(); if(config.mySQLEnabled()) { sql = new MySQLConnection(this); sql.generate(); @@ -137,7 +140,7 @@ public class FPChat extends JavaPlugin { listener.enable(); } Commands.allowCommands(); - log(Level.INFO, "FPChatX reloaded."); + log(Level.INFO, "FPChat reloaded."); } private void registerEvents() { @@ -200,10 +203,17 @@ public class FPChat extends JavaPlugin { public static FPChat getPlugin(){ return plugin; } + + public String getPluginTag() { + return pluginTag; + } public static String logo() { - return "" + ChatColor.DARK_RED + "[" + ChatColor.GREEN + ChatColor.BOLD + "FPChat" + ChatColor.RESET + ChatColor.DARK_RED + "]" + ChatColor.RESET ; - + String pluginTag = FPChat.getPlugin().getPluginTag(); + if(pluginTag == null) { + return "" + ChatColor.DARK_RED + "[" + ChatColor.GREEN + ChatColor.BOLD + "FPChat" + ChatColor.RESET + ChatColor.DARK_RED + "]" + ChatColor.RESET ; + } + return "" + ChatColor.DARK_RED + "[" + pluginTag + ChatColor.RESET + ChatColor.DARK_RED + "]" + ChatColor.RESET ; } @Override diff --git a/src/main/java/com/fpghoti/fpchatx/badge/Badge.java b/src/main/java/com/fpghoti/fpchatx/badge/Badge.java index d7a2ca5..2c17fa9 100644 --- a/src/main/java/com/fpghoti/fpchatx/badge/Badge.java +++ b/src/main/java/com/fpghoti/fpchatx/badge/Badge.java @@ -2,6 +2,7 @@ package com.fpghoti.fpchatx.badge; import com.fpghoti.fpchatx.FPChat; import com.fpghoti.fpchatx.config.BadgeConfig; +import com.fpghoti.fpchatx.player.FPlayer; public class Badge { @@ -60,7 +61,7 @@ public class Badge { public String getPerm() { return "fpchat.badge." + perm; } - + public String getRawPerm() { return perm; } diff --git a/src/main/java/com/fpghoti/fpchatx/command/commands/BadgeClearCommand.java b/src/main/java/com/fpghoti/fpchatx/command/commands/BadgeClearCommand.java index 97a5d5b..ec2f196 100644 --- a/src/main/java/com/fpghoti/fpchatx/command/commands/BadgeClearCommand.java +++ b/src/main/java/com/fpghoti/fpchatx/command/commands/BadgeClearCommand.java @@ -39,8 +39,11 @@ public class BadgeClearCommand extends Commands { FPlayer p = FPlayer.getPlayer((Player)sender); p.setBadge(1, 0); + p.updateBadges(1, 0); p.setBadge(2, 0); + p.updateBadges(2, 0); p.setBadge(3, 0); + p.updateBadges(3, 0); p.sendMessage(FPChat.logo() + ChatColor.YELLOW + " Unequipped all badges!"); } diff --git a/src/main/java/com/fpghoti/fpchatx/command/commands/BadgeEquipCommand.java b/src/main/java/com/fpghoti/fpchatx/command/commands/BadgeEquipCommand.java index b2ab8f2..f0708c9 100644 --- a/src/main/java/com/fpghoti/fpchatx/command/commands/BadgeEquipCommand.java +++ b/src/main/java/com/fpghoti/fpchatx/command/commands/BadgeEquipCommand.java @@ -43,7 +43,7 @@ public class BadgeEquipCommand extends Commands { Integer slot = Integer.parseInt(args[0]), badgeId = Integer.parseInt(args[1]); if(p.canUseSlot(slot)){ - if(Badge.getList().containsId(badgeId) && Badge.getList().get(badgeId).isEnabled() && p.hasBadge(badgeId)){ + if(badgeId == 0 || (Badge.getList().containsId(badgeId) && Badge.getList().get(badgeId).isEnabled() && p.hasBadge(badgeId))){ p.setBadge(slot, badgeId); p.updateBadges(slot, badgeId); p.sendMessage( FPChat.logo() + ChatColor.YELLOW + " You have equipped a badge!"); diff --git a/src/main/java/com/fpghoti/fpchatx/command/commands/HelpCommand.java b/src/main/java/com/fpghoti/fpchatx/command/commands/HelpCommand.java index 27299f3..34e11e9 100644 --- a/src/main/java/com/fpghoti/fpchatx/command/commands/HelpCommand.java +++ b/src/main/java/com/fpghoti/fpchatx/command/commands/HelpCommand.java @@ -72,7 +72,7 @@ public class HelpCommand extends Commands { ctype = ChatColor.DARK_AQUA + "Channel Type: " + ChatColor.GREEN + ctype; String online = ChatColor.DARK_AQUA + "Members Online: " + ChatColor.GREEN + ccount; if(args.length == 0) { - FPlayer.plainMsg(p, ChatColor.GOLD + "[INFO] " + ChatColor.YELLOW + "FPChat:"); + FPlayer.plainMsg(p, ChatColor.GOLD + "[INFO] " + plugin.getPluginTag() + ChatColor.YELLOW + ":"); FPlayer.plainMsg(p,name); FPlayer.plainMsg(p,primary); FPlayer.plainMsg(p,ctype); diff --git a/src/main/java/com/fpghoti/fpchatx/config/MainConfig.java b/src/main/java/com/fpghoti/fpchatx/config/MainConfig.java index 5c8f226..830d9ed 100644 --- a/src/main/java/com/fpghoti/fpchatx/config/MainConfig.java +++ b/src/main/java/com/fpghoti/fpchatx/config/MainConfig.java @@ -116,7 +116,11 @@ public class MainConfig { if (config.get("DefaultChannel")==null){ config.createSection("DefaultChannel"); config.set("DefaultChannel", "Default"); - } + } + if (config.get("PluginTag")==null){ + config.createSection("PluginTag"); + config.set("PluginTag", "&a&lFPChat&r"); + } try { config.save(configFile); } catch (IOException e) { @@ -254,5 +258,9 @@ public class MainConfig { public String getDistinguishedShout() { return config.getString("DistinguishedShout"); } + + public String getPluginTag() { + return ChatColor.translateAlternateColorCodes('&',config.getString("PluginTag")); + } } diff --git a/src/main/java/com/fpghoti/fpchatx/player/FPlayer.java b/src/main/java/com/fpghoti/fpchatx/player/FPlayer.java index a325c8d..66f853c 100644 --- a/src/main/java/com/fpghoti/fpchatx/player/FPlayer.java +++ b/src/main/java/com/fpghoti/fpchatx/player/FPlayer.java @@ -237,7 +237,7 @@ public class FPlayer { } public void setBadge(int slot, int badgeId){ - if(!Badge.getList().get(badgeId).isEnabled()) { + if(!Badge.getList().get(badgeId).isEnabled() && badgeId != 0) { return; } if(slot > 3){ @@ -250,7 +250,7 @@ public class FPlayer { createPlayer(); } FPChat.getPlugin().getMySQLConnection().set("badge_slot" + String.valueOf(slot), badgeId, "player_uuid", "=", uuid.toString(), FPChat.getPlugin().getMainConfig().getChatFeatureTable()); - getBadges(); + getSQLBadges(); } public void createPlayer(){