From 7ed0549ec6121be5c4404fc4e60bacd283533c12 Mon Sep 17 00:00:00 2001 From: Telesphoreo Date: Tue, 5 Apr 2022 15:40:25 -0500 Subject: [PATCH] Fixed a few bugs --- src/main/java/dev/plex/command/impl/MuteCMD.java | 1 - src/main/java/dev/plex/command/impl/TagCMD.java | 8 ++++++++ src/main/java/dev/plex/command/impl/TempbanCMD.java | 1 - src/main/java/dev/plex/listener/impl/PlayerListener.java | 4 +--- src/main/java/dev/plex/storage/SQLConnection.java | 6 ++---- 5 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/main/java/dev/plex/command/impl/MuteCMD.java b/src/main/java/dev/plex/command/impl/MuteCMD.java index 6e7e72f..429466c 100644 --- a/src/main/java/dev/plex/command/impl/MuteCMD.java +++ b/src/main/java/dev/plex/command/impl/MuteCMD.java @@ -1,7 +1,6 @@ package dev.plex.command.impl; import com.google.common.collect.ImmutableList; -import dev.plex.cache.player.PlayerCache; import dev.plex.command.PlexCommand; import dev.plex.command.annotation.CommandParameters; import dev.plex.command.annotation.CommandPermissions; diff --git a/src/main/java/dev/plex/command/impl/TagCMD.java b/src/main/java/dev/plex/command/impl/TagCMD.java index badad7a..deff701 100644 --- a/src/main/java/dev/plex/command/impl/TagCMD.java +++ b/src/main/java/dev/plex/command/impl/TagCMD.java @@ -56,6 +56,7 @@ public class TagCMD extends PlexCommand } player.setPrefix(MiniMessage.miniMessage().serialize(convertedComponent)); + DataUtils.update(player); return messageComponent("prefixSetTo", MiniMessage.miniMessage().serialize(convertedComponent)); } @@ -68,8 +69,14 @@ public class TagCMD extends PlexCommand return messageComponent("noPermissionConsole"); } + if (playerSender == null) + { + return null; + } + PlexPlayer player = DataUtils.getPlayer(playerSender.getUniqueId()); player.setPrefix(""); + DataUtils.update(player); return messageComponent("prefixCleared"); } @@ -77,6 +84,7 @@ public class TagCMD extends PlexCommand Player target = getNonNullPlayer(args[1]); PlexPlayer plexTarget = DataUtils.getPlayer(target.getUniqueId()); plexTarget.setPrefix(""); + DataUtils.update(plexTarget); messageComponent("otherPrefixCleared"); } return usage(); diff --git a/src/main/java/dev/plex/command/impl/TempbanCMD.java b/src/main/java/dev/plex/command/impl/TempbanCMD.java index 31716fb..e69498a 100644 --- a/src/main/java/dev/plex/command/impl/TempbanCMD.java +++ b/src/main/java/dev/plex/command/impl/TempbanCMD.java @@ -2,7 +2,6 @@ package dev.plex.command.impl; import com.google.common.collect.ImmutableList; import dev.plex.cache.DataUtils; -import dev.plex.cache.player.PlayerCache; import dev.plex.command.PlexCommand; import dev.plex.command.annotation.CommandParameters; import dev.plex.command.annotation.CommandPermissions; diff --git a/src/main/java/dev/plex/listener/impl/PlayerListener.java b/src/main/java/dev/plex/listener/impl/PlayerListener.java index a5c638b..16ab66b 100644 --- a/src/main/java/dev/plex/listener/impl/PlayerListener.java +++ b/src/main/java/dev/plex/listener/impl/PlayerListener.java @@ -1,9 +1,7 @@ package dev.plex.listener.impl; import dev.plex.cache.DataUtils; -import dev.plex.cache.player.MongoPlayerData; import dev.plex.cache.player.PlayerCache; -import dev.plex.cache.player.SQLPlayerData; import dev.plex.listener.PlexListener; import dev.plex.player.PlexPlayer; import dev.plex.util.PlexLog; @@ -67,8 +65,8 @@ public class PlayerListener extends PlexListener plexPlayer.setName(player.getName()); DataUtils.update(plexPlayer); } - PlayerCache.getPlexPlayerMap().put(player.getUniqueId(), plexPlayer); } + PlayerCache.getPlexPlayerMap().put(player.getUniqueId(), plexPlayer); if (plexPlayer.isLockedUp()) { player.openInventory(player.getInventory()); diff --git a/src/main/java/dev/plex/storage/SQLConnection.java b/src/main/java/dev/plex/storage/SQLConnection.java index b499377..79e0d26 100644 --- a/src/main/java/dev/plex/storage/SQLConnection.java +++ b/src/main/java/dev/plex/storage/SQLConnection.java @@ -4,8 +4,6 @@ import com.zaxxer.hikari.HikariConfig; import com.zaxxer.hikari.HikariDataSource; import dev.plex.Plex; import dev.plex.PlexBase; - -import javax.sql.DataSource; import java.io.File; import java.sql.Connection; import java.sql.SQLException; @@ -59,8 +57,8 @@ public class SQLConnection extends PlexBase con.prepareStatement("CREATE TABLE IF NOT EXISTS `players` (" + "`uuid` VARCHAR(46) NOT NULL, " + "`name` VARCHAR(18), " + - "`login_msg` VARCHAR(70), " + - "`prefix` VARCHAR(45), " + + "`login_msg` VARCHAR(2000), " + + "`prefix` VARCHAR(2000), " + "`rank` VARCHAR(20), " + "`ips` VARCHAR(2000), " + "`coins` BIGINT, " +