mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-30 02:05:41 +00:00
Kuper forgot db stuff
This commit is contained in:
parent
d92f661f12
commit
75e50582e9
@ -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)
|
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||||
{
|
{
|
||||||
PlayerData data = plugin.pl.getData(playerSender);
|
PlayerData data = plugin.pl.getData(playerSender);
|
||||||
data.setDiscordDisplay(!data.isDiscordDisplay());
|
data.setDisplayDiscord(!data.doesDisplayDiscord());
|
||||||
plugin.pl.save(data);
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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());
|
message += " " + ChatColor.RED + ChatColor.stripColor(member.getEffectiveName()) + ChatColor.DARK_GRAY + ": " + ChatColor.RESET + ChatColor.stripColor(event.getMessage().getContentDisplay());
|
||||||
for (Player player : Bukkit.getOnlinePlayers())
|
for (Player player : Bukkit.getOnlinePlayers())
|
||||||
{
|
{
|
||||||
if (TotalFreedomMod.getPlugin().pl.getData(player).isDiscordDisplay())
|
if (TotalFreedomMod.getPlugin().pl.getData(player).doesDisplayDiscord())
|
||||||
{
|
{
|
||||||
player.sendMessage(message);
|
player.sendMessage(message);
|
||||||
}
|
}
|
||||||
|
@ -48,9 +48,8 @@ public class PlayerData
|
|||||||
@Getter
|
@Getter
|
||||||
@Setter
|
@Setter
|
||||||
private int totalVotes;
|
private int totalVotes;
|
||||||
@Getter
|
|
||||||
@Setter
|
@Setter
|
||||||
private boolean discordDisplay = true;
|
private boolean displayDiscord = true;
|
||||||
|
|
||||||
public PlayerData(ResultSet resultSet)
|
public PlayerData(ResultSet resultSet)
|
||||||
{
|
{
|
||||||
@ -73,7 +72,7 @@ public class PlayerData
|
|||||||
items.clear();
|
items.clear();
|
||||||
items.addAll(FUtil.stringToList(resultSet.getString("items")));
|
items.addAll(FUtil.stringToList(resultSet.getString("items")));
|
||||||
totalVotes = resultSet.getInt("total_votes");
|
totalVotes = resultSet.getInt("total_votes");
|
||||||
discordDisplay = resultSet.getBoolean("discord_display");
|
displayDiscord = resultSet.getBoolean("display_discord");
|
||||||
}
|
}
|
||||||
catch (SQLException e)
|
catch (SQLException e)
|
||||||
{
|
{
|
||||||
@ -106,7 +105,7 @@ public class PlayerData
|
|||||||
.append("- Has Verification: ").append(verification).append("\n")
|
.append("- Has Verification: ").append(verification).append("\n")
|
||||||
.append("- Coins: ").append(coins).append("\n")
|
.append("- Coins: ").append(coins).append("\n")
|
||||||
.append("- Total Votes: ").append(totalVotes).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("- Tag: ").append(FUtil.colorize(tag)).append(ChatColor.GRAY).append("\n")
|
||||||
.append("- Ride Mode: ").append(rideMode).append("\n")
|
.append("- Ride Mode: ").append(rideMode).append("\n")
|
||||||
.append("- Backup Codes: ").append(backupCodes.size()).append("/10").append("\n");
|
.append("- Backup Codes: ").append(backupCodes.size()).append("/10").append("\n");
|
||||||
@ -244,8 +243,13 @@ public class PlayerData
|
|||||||
put("coins", coins);
|
put("coins", coins);
|
||||||
put("items", FUtil.listToString(items));
|
put("items", FUtil.listToString(items));
|
||||||
put("total_votes", totalVotes);
|
put("total_votes", totalVotes);
|
||||||
put("discord_display", discordDisplay);
|
put("display_discord", displayDiscord);
|
||||||
}};
|
}};
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean doesDisplayDiscord()
|
||||||
|
{
|
||||||
|
return displayDiscord;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -84,7 +84,7 @@ public class SQLite extends FreedomService
|
|||||||
{
|
{
|
||||||
try
|
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)
|
catch (SQLException e)
|
||||||
{
|
{
|
||||||
@ -286,6 +286,7 @@ public class SQLite extends FreedomService
|
|||||||
statement.setInt(11, player.getCoins());
|
statement.setInt(11, player.getCoins());
|
||||||
statement.setString(12, FUtil.listToString(player.getItems()));
|
statement.setString(12, FUtil.listToString(player.getItems()));
|
||||||
statement.setInt(13, player.getTotalVotes());
|
statement.setInt(13, player.getTotalVotes());
|
||||||
|
statement.setBoolean(14, player.doesDisplayDiscord());
|
||||||
statement.executeUpdate();
|
statement.executeUpdate();
|
||||||
}
|
}
|
||||||
catch (SQLException e)
|
catch (SQLException e)
|
||||||
|
Loading…
Reference in New Issue
Block a user