this isnt working

This commit is contained in:
Telesphoreo 2022-04-06 21:39:45 -05:00
parent 21bef1280d
commit b22a36948a
4 changed files with 18 additions and 25 deletions

View File

@ -19,7 +19,6 @@ import java.util.concurrent.CompletableFuture;
public class SQLNotes
{
private static final String SELECT = "SELECT * FROM `notes` WHERE uuid=?";
private static final String INSERT = "INSERT INTO `notes` (`id`, `uuid`, `written_by`, `note`, `timestamp`) VALUES(?, ?, ?, ?, ?)";
private static final String DELETE = "DELETE FROM `notes` WHERE uuid=? AND id=?";
@ -44,7 +43,8 @@ public class SQLNotes
note.setId(set.getInt("id"));
notes.add(note);
}
} catch (SQLException e)
}
catch (SQLException e)
{
e.printStackTrace();
}
@ -62,7 +62,8 @@ public class SQLNotes
statement.setString(1, uuid.toString());
statement.setInt(2, id);
statement.execute();
} catch (SQLException e)
}
catch (SQLException e)
{
e.printStackTrace();
}
@ -85,13 +86,12 @@ public class SQLNotes
statement.setLong(5, note.getTimestamp().toInstant(ZoneOffset.UTC).toEpochMilli());
statement.execute();
note.setId(notes.size());
} catch (SQLException e)
}
catch (SQLException e)
{
e.printStackTrace();
}
});
});
}
}

View File

@ -9,6 +9,7 @@ import dev.plex.command.annotation.System;
import dev.plex.player.PlexPlayer;
import dev.plex.punishment.extra.Note;
import dev.plex.rank.enums.Rank;
import dev.plex.util.PlexLog;
import dev.plex.util.PlexUtils;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
@ -16,6 +17,7 @@ import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.UUID;
import java.util.concurrent.CompletableFuture;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.format.NamedTextColor;
import org.apache.commons.lang3.ArrayUtils;
@ -48,13 +50,13 @@ public class NotesCMD extends PlexCommand
case "list":
{
Component noteList = Component.text("Player notes for: " + plexPlayer.getName()).color(NamedTextColor.GREEN);
int id = 1;
for (Note note : plexPlayer.getNotes())
/*for (Note note : plugin.getSqlNotes().getNotes(UUID.fromString(plexPlayer.getUuid())))
{
Component noteLine = Component.text(id + ". " + note.getWrittenBy() + ": " + note.getNote()).color(NamedTextColor.GOLD);
noteList.append(Component.empty()).append(noteLine);
id++;
}
PlexLog.debug("We got here");
Component noteLine = Component.text(note.getId() + ". " + note.getWrittenBy() + ": " + note.getNote()).color(NamedTextColor.GOLD);
noteList.append(Component.empty());
noteList.append(noteLine);
}*/
send(sender, noteList);
return null;
}

View File

@ -30,18 +30,9 @@ public class ToggleDropsCMD extends PlexCommand
@Override
protected Component execute(@NotNull CommandSender sender, @Nullable Player playerSender, @NotNull String[] args)
{
if (plugin.config.getBoolean("allowdrops"))
{
plugin.config.set("allowdrops", false);
plugin.config.save();
sender.sendMessage(messageComponent("allowDropsDisabled"));
}
else
{
plugin.config.set("allowdrops", true);
plugin.config.save();
sender.sendMessage(messageComponent("allowDropsEnabled"));
}
plugin.config.set("allowdrops", !plugin.config.getBoolean("allowdrops"));
plugin.config.save();
send(sender, plugin.config.getBoolean("allowdrops") ? messageComponent("allowDropsEnabled") : messageComponent("allowDropsDisabled"));
return null;
}
}

View File

@ -79,7 +79,7 @@ public class SQLConnection extends PlexBase
con.prepareStatement("CREATE TABLE IF NOT EXISTS `notes` (" +
"`id` INT NOT NULL, " +
"`uuid` VARCHAR(46) NOT NULL, " +
"`written_by` VARCHAR(16), " +
"`written_by` VARCHAR(46), " +
"`note` VARCHAR(2000), " +
"`timestamp` BIGINT" +
");").execute();