diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_togglediscord.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_togglediscord.java index 4ebfc2f9..69397339 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_togglediscord.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_togglediscord.java @@ -14,9 +14,9 @@ public class Command_togglediscord extends FreedomCommand public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) { PlayerData data = plugin.pl.getData(playerSender); - data.setDiscordDisplay(!data.isDiscordDisplay()); + data.setDisplayDiscord(!data.doesDisplayDiscord()); plugin.pl.save(data); - msg("Discord messages will " + (data.isDiscordDisplay() ? "now" : "no longer") + " be shown."); + msg("Discord messages will " + (data.doesDisplayDiscord() ? "now" : "no longer") + " be shown."); return true; } } diff --git a/src/main/java/me/totalfreedom/totalfreedommod/discord/DiscordToMinecraftListener.java b/src/main/java/me/totalfreedom/totalfreedommod/discord/DiscordToMinecraftListener.java index cc31bc73..cd2c60af 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/discord/DiscordToMinecraftListener.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/discord/DiscordToMinecraftListener.java @@ -32,7 +32,7 @@ public class DiscordToMinecraftListener extends ListenerAdapter message += " " + ChatColor.RED + ChatColor.stripColor(member.getEffectiveName()) + ChatColor.DARK_GRAY + ": " + ChatColor.RESET + ChatColor.stripColor(event.getMessage().getContentDisplay()); for (Player player : Bukkit.getOnlinePlayers()) { - if (TotalFreedomMod.getPlugin().pl.getData(player).isDiscordDisplay()) + if (TotalFreedomMod.getPlugin().pl.getData(player).doesDisplayDiscord()) { player.sendMessage(message); } diff --git a/src/main/java/me/totalfreedom/totalfreedommod/player/PlayerData.java b/src/main/java/me/totalfreedom/totalfreedommod/player/PlayerData.java index 81eaf65d..60db7987 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/player/PlayerData.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/player/PlayerData.java @@ -48,9 +48,8 @@ public class PlayerData @Getter @Setter private int totalVotes; - @Getter @Setter - private boolean discordDisplay = true; + private boolean displayDiscord = true; public PlayerData(ResultSet resultSet) { @@ -73,7 +72,7 @@ public class PlayerData items.clear(); items.addAll(FUtil.stringToList(resultSet.getString("items"))); totalVotes = resultSet.getInt("total_votes"); - discordDisplay = resultSet.getBoolean("discord_display"); + displayDiscord = resultSet.getBoolean("display_discord"); } catch (SQLException e) { @@ -106,7 +105,7 @@ public class PlayerData .append("- Has Verification: ").append(verification).append("\n") .append("- Coins: ").append(coins).append("\n") .append("- Total Votes: ").append(totalVotes).append("\n") - .append("- Discord Display: ").append(discordDisplay).append("\n") + .append("- Display Discord: ").append(displayDiscord).append("\n") .append("- Tag: ").append(FUtil.colorize(tag)).append(ChatColor.GRAY).append("\n") .append("- Ride Mode: ").append(rideMode).append("\n") .append("- Backup Codes: ").append(backupCodes.size()).append("/10").append("\n"); @@ -244,8 +243,13 @@ public class PlayerData put("coins", coins); put("items", FUtil.listToString(items)); put("total_votes", totalVotes); - put("discord_display", discordDisplay); + put("display_discord", displayDiscord); }}; return map; } + + public boolean doesDisplayDiscord() + { + return displayDiscord; + } } diff --git a/src/main/java/me/totalfreedom/totalfreedommod/sql/SQLite.java b/src/main/java/me/totalfreedom/totalfreedommod/sql/SQLite.java index b6d91415..11f0114b 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/sql/SQLite.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/sql/SQLite.java @@ -84,7 +84,7 @@ public class SQLite extends FreedomService { try { - connection.createStatement().execute("CREATE TABLE `admins` (`username` VARCHAR NOT NULL, `ips` VARCHAR NOT NULL, `rank` VARCHAR NOT NULL, `active` BOOLEAN NOT NULL, `last_login` LONG NOT NULL, `login_message` VARCHAR, `command_spy` BOOLEAN NOT NULL, `potion_spy` BOOLEAN NOT NULL, `ac_format` VARCHAR, `old_tags` BOOLEAN NOT NULL, `log_stick` BOOLEAN NOT NULL);"); + connection.createStatement().execute("CREATE TABLE `admins` (`username` VARCHAR NOT NULL, `ips` VARCHAR NOT NULL, `rank` VARCHAR NOT NULL, `active` BOOLEAN NOT NULL, `last_login` LONG NOT NULL, `login_message` VARCHAR, `command_spy` BOOLEAN NOT NULL, `potion_spy` BOOLEAN NOT NULL, `ac_format` VARCHAR, `old_tags` BOOLEAN NOT NULL, `log_stick` BOOLEAN NOT NULL, `display_discord` BOOLEAN NOT NULL,);"); } catch (SQLException e) { @@ -286,6 +286,7 @@ public class SQLite extends FreedomService statement.setInt(11, player.getCoins()); statement.setString(12, FUtil.listToString(player.getItems())); statement.setInt(13, player.getTotalVotes()); + statement.setBoolean(14, player.doesDisplayDiscord()); statement.executeUpdate(); } catch (SQLException e)