mirror of
https://github.com/plexusorg/Plex.git
synced 2024-12-23 09:37:37 +00:00
this isnt working
This commit is contained in:
parent
21bef1280d
commit
b22a36948a
12
src/main/java/dev/plex/cache/sql/SQLNotes.java
vendored
12
src/main/java/dev/plex/cache/sql/SQLNotes.java
vendored
@ -19,7 +19,6 @@ import java.util.concurrent.CompletableFuture;
|
|||||||
public class SQLNotes
|
public class SQLNotes
|
||||||
{
|
{
|
||||||
private static final String SELECT = "SELECT * FROM `notes` WHERE uuid=?";
|
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 INSERT = "INSERT INTO `notes` (`id`, `uuid`, `written_by`, `note`, `timestamp`) VALUES(?, ?, ?, ?, ?)";
|
||||||
private static final String DELETE = "DELETE FROM `notes` WHERE uuid=? AND id=?";
|
private static final String DELETE = "DELETE FROM `notes` WHERE uuid=? AND id=?";
|
||||||
|
|
||||||
@ -44,7 +43,8 @@ public class SQLNotes
|
|||||||
note.setId(set.getInt("id"));
|
note.setId(set.getInt("id"));
|
||||||
notes.add(note);
|
notes.add(note);
|
||||||
}
|
}
|
||||||
} catch (SQLException e)
|
}
|
||||||
|
catch (SQLException e)
|
||||||
{
|
{
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
@ -62,7 +62,8 @@ public class SQLNotes
|
|||||||
statement.setString(1, uuid.toString());
|
statement.setString(1, uuid.toString());
|
||||||
statement.setInt(2, id);
|
statement.setInt(2, id);
|
||||||
statement.execute();
|
statement.execute();
|
||||||
} catch (SQLException e)
|
}
|
||||||
|
catch (SQLException e)
|
||||||
{
|
{
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
@ -85,13 +86,12 @@ public class SQLNotes
|
|||||||
statement.setLong(5, note.getTimestamp().toInstant(ZoneOffset.UTC).toEpochMilli());
|
statement.setLong(5, note.getTimestamp().toInstant(ZoneOffset.UTC).toEpochMilli());
|
||||||
statement.execute();
|
statement.execute();
|
||||||
note.setId(notes.size());
|
note.setId(notes.size());
|
||||||
} catch (SQLException e)
|
}
|
||||||
|
catch (SQLException e)
|
||||||
{
|
{
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,7 @@ import dev.plex.command.annotation.System;
|
|||||||
import dev.plex.player.PlexPlayer;
|
import dev.plex.player.PlexPlayer;
|
||||||
import dev.plex.punishment.extra.Note;
|
import dev.plex.punishment.extra.Note;
|
||||||
import dev.plex.rank.enums.Rank;
|
import dev.plex.rank.enums.Rank;
|
||||||
|
import dev.plex.util.PlexLog;
|
||||||
import dev.plex.util.PlexUtils;
|
import dev.plex.util.PlexUtils;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
@ -16,6 +17,7 @@ import java.util.Arrays;
|
|||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
import java.util.concurrent.CompletableFuture;
|
||||||
import net.kyori.adventure.text.Component;
|
import net.kyori.adventure.text.Component;
|
||||||
import net.kyori.adventure.text.format.NamedTextColor;
|
import net.kyori.adventure.text.format.NamedTextColor;
|
||||||
import org.apache.commons.lang3.ArrayUtils;
|
import org.apache.commons.lang3.ArrayUtils;
|
||||||
@ -48,13 +50,13 @@ public class NotesCMD extends PlexCommand
|
|||||||
case "list":
|
case "list":
|
||||||
{
|
{
|
||||||
Component noteList = Component.text("Player notes for: " + plexPlayer.getName()).color(NamedTextColor.GREEN);
|
Component noteList = Component.text("Player notes for: " + plexPlayer.getName()).color(NamedTextColor.GREEN);
|
||||||
int id = 1;
|
/*for (Note note : plugin.getSqlNotes().getNotes(UUID.fromString(plexPlayer.getUuid())))
|
||||||
for (Note note : plexPlayer.getNotes())
|
|
||||||
{
|
{
|
||||||
Component noteLine = Component.text(id + ". " + note.getWrittenBy() + ": " + note.getNote()).color(NamedTextColor.GOLD);
|
PlexLog.debug("We got here");
|
||||||
noteList.append(Component.empty()).append(noteLine);
|
Component noteLine = Component.text(note.getId() + ". " + note.getWrittenBy() + ": " + note.getNote()).color(NamedTextColor.GOLD);
|
||||||
id++;
|
noteList.append(Component.empty());
|
||||||
}
|
noteList.append(noteLine);
|
||||||
|
}*/
|
||||||
send(sender, noteList);
|
send(sender, noteList);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -30,18 +30,9 @@ public class ToggleDropsCMD extends PlexCommand
|
|||||||
@Override
|
@Override
|
||||||
protected Component execute(@NotNull CommandSender sender, @Nullable Player playerSender, @NotNull String[] args)
|
protected Component execute(@NotNull CommandSender sender, @Nullable Player playerSender, @NotNull String[] args)
|
||||||
{
|
{
|
||||||
if (plugin.config.getBoolean("allowdrops"))
|
plugin.config.set("allowdrops", !plugin.config.getBoolean("allowdrops"));
|
||||||
{
|
plugin.config.save();
|
||||||
plugin.config.set("allowdrops", false);
|
send(sender, plugin.config.getBoolean("allowdrops") ? messageComponent("allowDropsEnabled") : messageComponent("allowDropsDisabled"));
|
||||||
plugin.config.save();
|
|
||||||
sender.sendMessage(messageComponent("allowDropsDisabled"));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
plugin.config.set("allowdrops", true);
|
|
||||||
plugin.config.save();
|
|
||||||
sender.sendMessage(messageComponent("allowDropsEnabled"));
|
|
||||||
}
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -79,7 +79,7 @@ public class SQLConnection extends PlexBase
|
|||||||
con.prepareStatement("CREATE TABLE IF NOT EXISTS `notes` (" +
|
con.prepareStatement("CREATE TABLE IF NOT EXISTS `notes` (" +
|
||||||
"`id` INT NOT NULL, " +
|
"`id` INT NOT NULL, " +
|
||||||
"`uuid` VARCHAR(46) NOT NULL, " +
|
"`uuid` VARCHAR(46) NOT NULL, " +
|
||||||
"`written_by` VARCHAR(16), " +
|
"`written_by` VARCHAR(46), " +
|
||||||
"`note` VARCHAR(2000), " +
|
"`note` VARCHAR(2000), " +
|
||||||
"`timestamp` BIGINT" +
|
"`timestamp` BIGINT" +
|
||||||
");").execute();
|
");").execute();
|
||||||
|
Loading…
Reference in New Issue
Block a user