From 8ecc1d2fce209179376878c85f293a18fa958d08 Mon Sep 17 00:00:00 2001 From: spacerocket62 Date: Mon, 9 Nov 2020 20:53:45 -0800 Subject: [PATCH] Fix SQL Syntax --- .../plex/command/impl/AdventureCMD.java | 2 +- .../plex/command/impl/CreativeCMD.java | 2 +- .../plex/command/impl/SpectatorCMD.java | 2 +- .../plex/command/impl/SurvivalCMD.java | 2 +- .../plex/player/PunishedPlayer.java | 1 - .../plex/storage/SQLConnection.java | 39 +++++++++---------- 6 files changed, 23 insertions(+), 25 deletions(-) diff --git a/src/main/java/me/totalfreedom/plex/command/impl/AdventureCMD.java b/src/main/java/me/totalfreedom/plex/command/impl/AdventureCMD.java index 0801df2..46568a7 100644 --- a/src/main/java/me/totalfreedom/plex/command/impl/AdventureCMD.java +++ b/src/main/java/me/totalfreedom/plex/command/impl/AdventureCMD.java @@ -31,7 +31,7 @@ public class AdventureCMD extends PlexCommand if (args.length == 0) { // doesn't work - if (isConsole()) + if (sender.isConsoleSender()) { throw new CommandFailException("You must define a player when using the console!"); } diff --git a/src/main/java/me/totalfreedom/plex/command/impl/CreativeCMD.java b/src/main/java/me/totalfreedom/plex/command/impl/CreativeCMD.java index ac719b5..875b0ab 100644 --- a/src/main/java/me/totalfreedom/plex/command/impl/CreativeCMD.java +++ b/src/main/java/me/totalfreedom/plex/command/impl/CreativeCMD.java @@ -31,7 +31,7 @@ public class CreativeCMD extends PlexCommand if (args.length == 0) { // doesn't work - if (isConsole()) + if (sender.isConsoleSender()) { throw new CommandFailException("You must define a player when using the console!"); } diff --git a/src/main/java/me/totalfreedom/plex/command/impl/SpectatorCMD.java b/src/main/java/me/totalfreedom/plex/command/impl/SpectatorCMD.java index 06eb272..c38b5b4 100644 --- a/src/main/java/me/totalfreedom/plex/command/impl/SpectatorCMD.java +++ b/src/main/java/me/totalfreedom/plex/command/impl/SpectatorCMD.java @@ -31,7 +31,7 @@ public class SpectatorCMD extends PlexCommand if (args.length == 0) { // doesn't work - if (isConsole()) + if (sender.isConsoleSender()) { throw new CommandFailException("You must define a player when using the console!"); } diff --git a/src/main/java/me/totalfreedom/plex/command/impl/SurvivalCMD.java b/src/main/java/me/totalfreedom/plex/command/impl/SurvivalCMD.java index 72fae82..7baed4b 100644 --- a/src/main/java/me/totalfreedom/plex/command/impl/SurvivalCMD.java +++ b/src/main/java/me/totalfreedom/plex/command/impl/SurvivalCMD.java @@ -31,7 +31,7 @@ public class SurvivalCMD extends PlexCommand if (args.length == 0) { // doesn't work - if (isConsole()) + if (sender.isConsoleSender()) { throw new CommandFailException("You must define a player when using the console!"); } diff --git a/src/main/java/me/totalfreedom/plex/player/PunishedPlayer.java b/src/main/java/me/totalfreedom/plex/player/PunishedPlayer.java index ec5a866..1af9389 100644 --- a/src/main/java/me/totalfreedom/plex/player/PunishedPlayer.java +++ b/src/main/java/me/totalfreedom/plex/player/PunishedPlayer.java @@ -76,7 +76,6 @@ public class PunishedPlayer } catch (IOException e) { e.printStackTrace(); } - PlexLog.log("Created new punishment file for " + getUuid() + " (" + DataUtils.getPlayer(getUuid()).getName() + ")"); } return file; diff --git a/src/main/java/me/totalfreedom/plex/storage/SQLConnection.java b/src/main/java/me/totalfreedom/plex/storage/SQLConnection.java index 68d4ce0..32fa7f1 100644 --- a/src/main/java/me/totalfreedom/plex/storage/SQLConnection.java +++ b/src/main/java/me/totalfreedom/plex/storage/SQLConnection.java @@ -41,26 +41,25 @@ public class SQLConnection extends PlexBase { if (connection != null) { - connection.prepareStatement("CREATE TABLE IF NOT EXISTS `players` (\n" + - "\t`uuid` VARCHAR(46) NOT NULL,\n" + - "\t`name` VARCHAR(18),\n" + - "\t`login_msg` VARCHAR,\n" + - "\t`prefix` VARCHAR,\n" + - "\t`rank` VARCHAR,\n" + - "\t`ips` VARCHAR,\n" + - "\t`coins` BIGINT,\n" + - "\t`vanished` BOOLEAN,\n" + - "\tPRIMARY KEY (`uuid`)\n" + - ");").execute(); - connection.prepareStatement("CREATE TABLE IF NOT EXISTS `bans` (\n" + - "\t`banID` VARCHAR,\n" + - "\t`uuid` VARCHAR(46) NOT NULL,\n" + - "\t`banner` VARCHAR(46),\n" + - "\t`ip` VARCHAR,\n" + - "\t`reason` VARCHAR,\n" + - "\t`enddate` BIGINT,\n" + - "\t`active` BOOLEAN,\n" + - "\tPRIMARY KEY (`banID`)\n" + + connection.prepareStatement("CREATE TABLE IF NOT EXISTS `players` (" + + "`uuid` VARCHAR(46) NOT NULL, " + + "`name` VARCHAR(18), " + + "`login_msg` VARCHAR(70), " + + "`prefix` VARCHAR(45), " + + "`rank` VARCHAR(20), " + + "`ips` VARCHAR(2000), " + + "`coins` BIGINT, " + + "`vanished` BOOLEAN, " + + "PRIMARY KEY (`uuid`));").execute(); + connection.prepareStatement("CREATE TABLE IF NOT EXISTS `bans` (" + + "`banID` VARCHAR(46)," + + " `uuid` VARCHAR(46) NOT NULL," + + " `banner` VARCHAR(46)," + + "`ip` VARCHAR(2000)," + + " `reason` VARCHAR(256)," + + " `enddate` BIGINT," + + " `active` BOOLEAN," + + " PRIMARY KEY (`banID`)" + ");").execute(); } }