Fixed a few bugs

This commit is contained in:
Telesphoreo 2022-04-05 15:40:25 -05:00
parent 2fcf44c6a8
commit 7ed0549ec6
5 changed files with 11 additions and 9 deletions

View File

@ -1,7 +1,6 @@
package dev.plex.command.impl; package dev.plex.command.impl;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import dev.plex.cache.player.PlayerCache;
import dev.plex.command.PlexCommand; import dev.plex.command.PlexCommand;
import dev.plex.command.annotation.CommandParameters; import dev.plex.command.annotation.CommandParameters;
import dev.plex.command.annotation.CommandPermissions; import dev.plex.command.annotation.CommandPermissions;

View File

@ -56,6 +56,7 @@ public class TagCMD extends PlexCommand
} }
player.setPrefix(MiniMessage.miniMessage().serialize(convertedComponent)); player.setPrefix(MiniMessage.miniMessage().serialize(convertedComponent));
DataUtils.update(player);
return messageComponent("prefixSetTo", MiniMessage.miniMessage().serialize(convertedComponent)); return messageComponent("prefixSetTo", MiniMessage.miniMessage().serialize(convertedComponent));
} }
@ -68,8 +69,14 @@ public class TagCMD extends PlexCommand
return messageComponent("noPermissionConsole"); return messageComponent("noPermissionConsole");
} }
if (playerSender == null)
{
return null;
}
PlexPlayer player = DataUtils.getPlayer(playerSender.getUniqueId()); PlexPlayer player = DataUtils.getPlayer(playerSender.getUniqueId());
player.setPrefix(""); player.setPrefix("");
DataUtils.update(player);
return messageComponent("prefixCleared"); return messageComponent("prefixCleared");
} }
@ -77,6 +84,7 @@ public class TagCMD extends PlexCommand
Player target = getNonNullPlayer(args[1]); Player target = getNonNullPlayer(args[1]);
PlexPlayer plexTarget = DataUtils.getPlayer(target.getUniqueId()); PlexPlayer plexTarget = DataUtils.getPlayer(target.getUniqueId());
plexTarget.setPrefix(""); plexTarget.setPrefix("");
DataUtils.update(plexTarget);
messageComponent("otherPrefixCleared"); messageComponent("otherPrefixCleared");
} }
return usage(); return usage();

View File

@ -2,7 +2,6 @@ package dev.plex.command.impl;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import dev.plex.cache.DataUtils; import dev.plex.cache.DataUtils;
import dev.plex.cache.player.PlayerCache;
import dev.plex.command.PlexCommand; import dev.plex.command.PlexCommand;
import dev.plex.command.annotation.CommandParameters; import dev.plex.command.annotation.CommandParameters;
import dev.plex.command.annotation.CommandPermissions; import dev.plex.command.annotation.CommandPermissions;

View File

@ -1,9 +1,7 @@
package dev.plex.listener.impl; package dev.plex.listener.impl;
import dev.plex.cache.DataUtils; import dev.plex.cache.DataUtils;
import dev.plex.cache.player.MongoPlayerData;
import dev.plex.cache.player.PlayerCache; import dev.plex.cache.player.PlayerCache;
import dev.plex.cache.player.SQLPlayerData;
import dev.plex.listener.PlexListener; import dev.plex.listener.PlexListener;
import dev.plex.player.PlexPlayer; import dev.plex.player.PlexPlayer;
import dev.plex.util.PlexLog; import dev.plex.util.PlexLog;
@ -67,8 +65,8 @@ public class PlayerListener extends PlexListener
plexPlayer.setName(player.getName()); plexPlayer.setName(player.getName());
DataUtils.update(plexPlayer); DataUtils.update(plexPlayer);
} }
PlayerCache.getPlexPlayerMap().put(player.getUniqueId(), plexPlayer);
} }
PlayerCache.getPlexPlayerMap().put(player.getUniqueId(), plexPlayer);
if (plexPlayer.isLockedUp()) if (plexPlayer.isLockedUp())
{ {
player.openInventory(player.getInventory()); player.openInventory(player.getInventory());

View File

@ -4,8 +4,6 @@ import com.zaxxer.hikari.HikariConfig;
import com.zaxxer.hikari.HikariDataSource; import com.zaxxer.hikari.HikariDataSource;
import dev.plex.Plex; import dev.plex.Plex;
import dev.plex.PlexBase; import dev.plex.PlexBase;
import javax.sql.DataSource;
import java.io.File; import java.io.File;
import java.sql.Connection; import java.sql.Connection;
import java.sql.SQLException; import java.sql.SQLException;
@ -59,8 +57,8 @@ public class SQLConnection extends PlexBase
con.prepareStatement("CREATE TABLE IF NOT EXISTS `players` (" + con.prepareStatement("CREATE TABLE IF NOT EXISTS `players` (" +
"`uuid` VARCHAR(46) NOT NULL, " + "`uuid` VARCHAR(46) NOT NULL, " +
"`name` VARCHAR(18), " + "`name` VARCHAR(18), " +
"`login_msg` VARCHAR(70), " + "`login_msg` VARCHAR(2000), " +
"`prefix` VARCHAR(45), " + "`prefix` VARCHAR(2000), " +
"`rank` VARCHAR(20), " + "`rank` VARCHAR(20), " +
"`ips` VARCHAR(2000), " + "`ips` VARCHAR(2000), " +
"`coins` BIGINT, " + "`coins` BIGINT, " +