Fix badge removing and make plugin tag configurable
This commit is contained in:
parent
21fb971a40
commit
11bb1e903b
|
@ -3,7 +3,7 @@
|
|||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>FPChat</groupId>
|
||||
<artifactId>FPChat</artifactId>
|
||||
<version>1.1</version>
|
||||
<version>1.1.1</version>
|
||||
<build>
|
||||
<sourceDirectory>src/main/java</sourceDirectory>
|
||||
<resources>
|
||||
|
|
2
pom.xml
2
pom.xml
|
@ -4,7 +4,7 @@
|
|||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>FPChat</groupId>
|
||||
<artifactId>FPChat</artifactId>
|
||||
<version>1.1</version>
|
||||
<version>1.1.1</version>
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>spigot-repo</id>
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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!");
|
||||
}
|
||||
|
||||
|
|
|
@ -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!");
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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"));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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(){
|
||||
|
|
Loading…
Reference in New Issue