sql fixes & more

fixes slconfig sql error
fixes nickclean npe
fixes a few command inconsistensies
This commit is contained in:
speed 2020-11-24 11:53:37 -05:00
parent 495133da1a
commit 6cd995ff52
5 changed files with 71 additions and 69 deletions

View File

@ -79,7 +79,7 @@ public class Command_modifyitem extends FreedomCommand
Enchantment enchantment = Enchantment.getByName(args[1].toUpperCase()); Enchantment enchantment = Enchantment.getByName(args[1].toUpperCase());
if (enchantment == null) if (enchantment == null)
{ {
msg("Invalid enchantment. Please run /enchantments for a list of valid enchantments."); msg("Invalid enchantment. Please run /enchant list for a list of valid enchantments.");
return true; return true;
} }

View File

@ -17,7 +17,7 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@CommandPermissions(level = Rank.ADMIN, source = SourceType.ONLY_IN_GAME) @CommandPermissions(level = Rank.ADMIN, source = SourceType.ONLY_IN_GAME)
@CommandParameters(description = "Manage your admin entry.", usage = "/<command> [-o <admin name>] <clearips | clearip <ip> | setlogin <message> | clearlogin | setscformat <format> | clearscformat> | oldtags | logstick | syncroles>") @CommandParameters(description = "Manage your admin entry.", usage = "/<command> [-o <admin name>] <clearips | clearip <ip> | setscformat <format> | clearscformat> | syncroles>")
public class Command_myadmin extends FreedomCommand public class Command_myadmin extends FreedomCommand
{ {
@Override @Override
@ -76,7 +76,7 @@ public class Command_myadmin extends FreedomCommand
} }
else else
{ {
FUtil.staffAction(sender.getName(), "Clearing " + target.getName() + "' IPs", true); FUtil.staffAction(sender.getName(), "Clearing " + target.getName() + "'s IPs", true);
} }
int counter = target.getIps().size() - 1; int counter = target.getIps().size() - 1;

View File

@ -72,7 +72,8 @@ public class Command_nickclean extends FreedomCommand
final String nickName = plugin.esb.getNickname(playerName); final String nickName = plugin.esb.getNickname(playerName);
StringBuilder newNick = new StringBuilder(); StringBuilder newNick = new StringBuilder();
boolean nickChanged = false; boolean nickChanged = false;
if (nickName != null)
{
if (nickName.contains("§x")) if (nickName.contains("§x"))
{ {
// Detects colors that are similar to blocked codes. // Detects colors that are similar to blocked codes.
@ -140,6 +141,7 @@ public class Command_nickclean extends FreedomCommand
} }
} }
} }
}
if (nickChanged) if (nickChanged)
{ {

View File

@ -112,7 +112,7 @@ public class PlayerData
.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")
.append("- Reddit Username: ").append(redditUsername) .append("- Reddit Username: ").append(redditUsername).append("\n")
.append("- Login Message: ").append(loginMessage); .append("- Login Message: ").append(loginMessage);
return output.toString(); return output.toString();

View File

@ -247,16 +247,16 @@ public class SQLite extends FreedomService
{ {
try try
{ {
PreparedStatement statement = connection.prepareStatement("INSERT INTO staff VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"); PreparedStatement statement = connection.prepareStatement("INSERT INTO staff VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)");
statement.setString(1, staffMember.getName()); statement.setString(1, staffMember.getName());
statement.setString(2, FUtil.listToString(staffMember.getIps())); statement.setString(2, FUtil.listToString(staffMember.getIps()));
statement.setString(3, staffMember.getRank().toString()); statement.setString(3, staffMember.getRank().toString());
statement.setBoolean(4, staffMember.isActive()); statement.setBoolean(4, staffMember.isActive());
statement.setLong(5, staffMember.getLastLogin().getTime()); statement.setLong(5, staffMember.getLastLogin().getTime());
statement.setBoolean(7, staffMember.getCommandSpy()); statement.setBoolean(6, staffMember.getCommandSpy());
statement.setBoolean(8, staffMember.getPotionSpy()); statement.setBoolean(7, staffMember.getPotionSpy());
statement.setString(9, staffMember.getAcFormat()); statement.setString(8, staffMember.getAcFormat());
statement.setString(10, staffMember.getPteroID()); statement.setString(9, staffMember.getPteroID());
statement.executeUpdate(); statement.executeUpdate();
} }
catch (SQLException e) catch (SQLException e)
@ -270,7 +270,7 @@ public class SQLite extends FreedomService
{ {
try try
{ {
PreparedStatement statement = connection.prepareStatement("INSERT INTO players VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"); PreparedStatement statement = connection.prepareStatement("INSERT INTO players VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
statement.setString(1, player.getName()); statement.setString(1, player.getName());
statement.setString(2, FUtil.listToString(player.getIps())); statement.setString(2, FUtil.listToString(player.getIps()));
statement.setString(3, FUtil.listToString(player.getNotes())); statement.setString(3, FUtil.listToString(player.getNotes()));
@ -281,11 +281,11 @@ public class SQLite extends FreedomService
statement.setBoolean(8, player.hasVerification()); statement.setBoolean(8, player.hasVerification());
statement.setString(9, player.getRideMode()); statement.setString(9, player.getRideMode());
statement.setInt(10, player.getCoins()); statement.setInt(10, player.getCoins());
statement.setString(12, FUtil.listToString(player.getItems())); statement.setString(11, FUtil.listToString(player.getItems()));
statement.setInt(13, player.getTotalVotes()); statement.setInt(12, player.getTotalVotes());
statement.setBoolean(14, player.doesDisplayDiscord()); statement.setBoolean(13, player.doesDisplayDiscord());
statement.setString(15, player.getRedditUsername()); statement.setString(14, player.getRedditUsername());
statement.setString(16, player.getLoginMessage()); statement.setString(15, player.getLoginMessage());
statement.executeUpdate(); statement.executeUpdate();
} }
catch (SQLException e) catch (SQLException e)