From 14fb24a380c88481f537bddeae4a1eeebb778764 Mon Sep 17 00:00:00 2001 From: Telesphoreo Date: Thu, 3 Mar 2022 19:51:07 -0600 Subject: [PATCH] Bump to 0.8-SNAPSHOT --- build.gradle | 2 +- src/main/java/dev/plex/admin/Admin.java | 14 ++++++-------- src/main/java/dev/plex/admin/AdminList.java | 11 +++++------ src/main/java/dev/plex/command/impl/AdminCMD.java | 2 +- 4 files changed, 13 insertions(+), 16 deletions(-) diff --git a/build.gradle b/build.gradle index 9e01637..9af156a 100644 --- a/build.gradle +++ b/build.gradle @@ -38,7 +38,7 @@ dependencies { } group = "dev.plex" -version = "0.7-SNAPSHOT" +version = "0.8-SNAPSHOT" description = "Plex" shadowJar { diff --git a/src/main/java/dev/plex/admin/Admin.java b/src/main/java/dev/plex/admin/Admin.java index a3d0c16..e67b21e 100644 --- a/src/main/java/dev/plex/admin/Admin.java +++ b/src/main/java/dev/plex/admin/Admin.java @@ -29,19 +29,19 @@ public class Admin /** * Returns if the admin has command spy or not *
- * Contains a #isCommandSpy and #setCommandSpy by lombok + * Contains a #isCommandSpy and #setCommandSpy by Lombok */ - private boolean commandSpy = true; + private boolean commandSpy = false; /** - * Returns if the admin has staff chat toggled or not + * Returns if the admin has admin chat toggled or not *
- * Contains a #isStaffChat and #setStaffChat by lombok + * Contains a #isAdminChat and #setAdminChat by Lombok */ - private boolean staffChat = false; + private boolean adminChat = false; /** - * Creates an admin with the startig ADMIN rank + * Creates an admin with the ADMIN rank as the default rank * * @param uuid * @see UUID @@ -52,6 +52,4 @@ public class Admin this.uuid = uuid; this.rank = Rank.ADMIN; } - - } diff --git a/src/main/java/dev/plex/admin/AdminList.java b/src/main/java/dev/plex/admin/AdminList.java index b954716..1224ca3 100644 --- a/src/main/java/dev/plex/admin/AdminList.java +++ b/src/main/java/dev/plex/admin/AdminList.java @@ -5,6 +5,7 @@ import com.google.common.collect.Maps; import dev.morphia.Datastore; import dev.morphia.query.Query; import dev.plex.Plex; +import dev.plex.PlexBase; import dev.plex.player.PlexPlayer; import dev.plex.rank.enums.Rank; import dev.plex.storage.StorageType; @@ -23,7 +24,7 @@ import java.util.stream.Collectors; * @see Admin */ -public class AdminList +public class AdminList extends PlexBase { /** * Key/Value storage, where the key is the unique ID of the admin @@ -59,15 +60,15 @@ public class AdminList public List getAllAdmins() { List admins = Lists.newArrayList(); - if (Plex.get().getStorageType() == StorageType.MONGODB) + if (plugin.getStorageType() == StorageType.MONGODB) { - Datastore store = Plex.get().getMongoConnection().getDatastore(); + Datastore store = plugin.getMongoConnection().getDatastore(); Query query = store.find(PlexPlayer.class); admins.addAll(query.stream().filter(plexPlayer -> plexPlayer.getRankFromString().isAtLeast(Rank.ADMIN)).map(PlexPlayer::getName).collect(Collectors.toList())); } else { - try (Connection con = Plex.get().getSqlConnection().getCon()) + try (Connection con = plugin.getSqlConnection().getCon()) { PreparedStatement statement = con.prepareStatement("SELECT * FROM `players` WHERE rank IN(?, ?, ?)"); statement.setString(1, Rank.ADMIN.name().toLowerCase()); @@ -79,7 +80,6 @@ public class AdminList { admins.add(set.getString("name")); } - } catch (SQLException throwables) { @@ -88,5 +88,4 @@ public class AdminList } return admins; } - } diff --git a/src/main/java/dev/plex/command/impl/AdminCMD.java b/src/main/java/dev/plex/command/impl/AdminCMD.java index 60c3c33..e941a95 100644 --- a/src/main/java/dev/plex/command/impl/AdminCMD.java +++ b/src/main/java/dev/plex/command/impl/AdminCMD.java @@ -26,7 +26,7 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @CommandPermissions(level = Rank.OP, source = RequiredCommandSource.ANY) -@CommandParameters(name = "admin", usage = "/ [player] [rank]", aliases = "saconfig,slconfig,adminconfig,adminmanage", description = "Manage all admins") +@CommandParameters(name = "admin", usage = "/ | remove | setrank | list>", aliases = "saconfig,slconfig,adminconfig,adminmanage", description = "Manage all admins") public class AdminCMD extends PlexCommand { //TODO: Better return messages