diff --git a/build.gradle b/build.gradle index a4f786f..9af156a 100644 --- a/build.gradle +++ b/build.gradle @@ -19,10 +19,6 @@ repositories { url = uri("https://repo.maven.apache.org/maven2/") } - maven { - name = "sonatype-oss-snapshots" - url = uri("https://oss.sonatype.org/content/repositories/snapshots/") - } mavenCentral() } @@ -36,17 +32,13 @@ dependencies { library "org.mariadb.jdbc:mariadb-java-client:3.0.3" library "org.apache.httpcomponents:httpclient:4.5.13" library "org.apache.commons:commons-lang3:3.12.0" - compileOnly "io.papermc.paper:paper-api:1.18.1-R0.1-SNAPSHOT" + compileOnly "io.papermc.paper:paper-api:1.18.2-R0.1-SNAPSHOT" implementation "org.bstats:bstats-base:3.0.0" implementation "org.bstats:bstats-bukkit:3.0.0" - implementation("net.kyori:adventure-text-minimessage:4.2.0-SNAPSHOT") { - exclude group: "net.kyori", module: "adventure-api" - exclude group: "org.jetbrains", module: "annotations" - } } group = "dev.plex" -version = "0.7" +version = "0.8-SNAPSHOT" description = "Plex" shadowJar { diff --git a/src/main/java/dev/plex/Plex.java b/src/main/java/dev/plex/Plex.java index 343a36b..bd9a346 100644 --- a/src/main/java/dev/plex/Plex.java +++ b/src/main/java/dev/plex/Plex.java @@ -123,7 +123,6 @@ public class Plex extends JavaPlugin new ListenerHandler(); new CommandHandler(); - rankManager = new RankManager(); rankManager.generateDefaultRanks(); rankManager.importDefaultRanks(); 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/PlexCommand.java b/src/main/java/dev/plex/command/PlexCommand.java index ba29da4..93d92ba 100644 --- a/src/main/java/dev/plex/command/PlexCommand.java +++ b/src/main/java/dev/plex/command/PlexCommand.java @@ -516,7 +516,7 @@ public abstract class PlexCommand extends Command implements PluginIdentifiableC */ protected Component mmString(String s) { - return MiniMessage.miniMessage().parse(s); + return MiniMessage.miniMessage().deserialize(s); } public Rank getLevel() 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 diff --git a/src/main/java/dev/plex/command/impl/LockupCMD.java b/src/main/java/dev/plex/command/impl/LockupCMD.java index 717f71d..5778778 100644 --- a/src/main/java/dev/plex/command/impl/LockupCMD.java +++ b/src/main/java/dev/plex/command/impl/LockupCMD.java @@ -49,7 +49,7 @@ public class LockupCMD extends PlexCommand } punishedPlayer.setLockedUp(!punishedPlayer.isLockedUp()); - PlexUtils.broadcast(messageComponent(punishedPlayer.isLockedUp() ? "lockedUpPlayer" : "unlockedUpPlayer", sender.getName(), player.getName())); + PlexUtils.broadcast(messageComponent(punishedPlayer.isLockedUp() ? "lockedUpPlayer" : "unlockedPlayer", sender.getName(), player.getName())); return null; } diff --git a/src/main/java/dev/plex/command/impl/NameHistoryCMD.java b/src/main/java/dev/plex/command/impl/NameHistoryCMD.java index 6d3d008..adee199 100644 --- a/src/main/java/dev/plex/command/impl/NameHistoryCMD.java +++ b/src/main/java/dev/plex/command/impl/NameHistoryCMD.java @@ -49,11 +49,9 @@ public class NameHistoryCMD extends PlexCommand if (history.getLocalDateTime() != null) { historyList.add( - Component.text(history.getUsername()).color(NamedTextColor.GOLD) - .append(Component.space()) - .append(Component.text("-").color(NamedTextColor.DARK_GRAY)) - .append(Component.space()) - .append(Component.text(DATE_FORMAT.format(history.getLocalDateTime())).color(NamedTextColor.GOLD))); + messageComponent("nameHistoryBody", + history.getUsername(), + DATE_FORMAT.format(history.getLocalDateTime()))); } else { @@ -62,8 +60,8 @@ public class NameHistoryCMD extends PlexCommand .append(Component.space())); } }); - send(sender, Component.text("Name History (" + username + ")").color(NamedTextColor.GOLD)); - send(sender, Component.text("-----------------------------").color(NamedTextColor.GOLD).decoration(TextDecoration.STRIKETHROUGH, true)); + send(sender, messageComponent("nameHistoryTitle", username)); + send(sender, messageComponent("nameHistorySeparator")); historyList.forEach(component -> send(sender, component)); return null; } diff --git a/src/main/java/dev/plex/services/impl/UpdateCheckerService.java b/src/main/java/dev/plex/services/impl/UpdateCheckerService.java index b398ab6..31f7abe 100644 --- a/src/main/java/dev/plex/services/impl/UpdateCheckerService.java +++ b/src/main/java/dev/plex/services/impl/UpdateCheckerService.java @@ -29,4 +29,4 @@ public class UpdateCheckerService extends AbstractService // Every 30 minutes return 1800; } -} \ No newline at end of file +} diff --git a/src/main/java/dev/plex/util/PlexUtils.java b/src/main/java/dev/plex/util/PlexUtils.java index ec1633c..03adb43 100644 --- a/src/main/java/dev/plex/util/PlexUtils.java +++ b/src/main/java/dev/plex/util/PlexUtils.java @@ -131,7 +131,7 @@ public class PlexUtils extends PlexBase public static Component messageComponent(String entry, Object... objects) { - return MiniMessage.miniMessage().parse(LegacyComponentSerializer.legacySection().serialize(LegacyComponentSerializer.legacyAmpersand().deserialize(messageString(entry, objects)))); + return MiniMessage.miniMessage().deserialize(LegacyComponentSerializer.legacySection().serialize(LegacyComponentSerializer.legacyAmpersand().deserialize(messageString(entry, objects)))); } public static String messageString(String entry, Object... objects) diff --git a/src/main/java/dev/plex/util/UpdateChecker.java b/src/main/java/dev/plex/util/UpdateChecker.java index 77d2494..ccc0bb1 100644 --- a/src/main/java/dev/plex/util/UpdateChecker.java +++ b/src/main/java/dev/plex/util/UpdateChecker.java @@ -44,4 +44,4 @@ public class UpdateChecker extends PlexBase return false; } } -} \ No newline at end of file +} diff --git a/src/main/java/dev/plex/world/CustomWorld.java b/src/main/java/dev/plex/world/CustomWorld.java index 355c406..55c8dce 100644 --- a/src/main/java/dev/plex/world/CustomWorld.java +++ b/src/main/java/dev/plex/world/CustomWorld.java @@ -38,14 +38,14 @@ public class CustomWorld extends WorldCreator { boolean existed = new File(name).exists(); World world = super.generate(); + if (!existed) { Block block = world.getBlockAt(0, world.getHighestBlockYAt(0, 0) + 1, 0); block.setType(Material.OAK_SIGN); BlockState state = block.getState(); - if (state instanceof Sign) + if (state instanceof Sign sign) { - Sign sign = (Sign)state; sign.line(1, Component.text( Objects.requireNonNull(plugin.config.getString("worlds." + name + ".name")))); sign.line(2, Component.text("- 0, 0 -")); diff --git a/src/main/resources/messages.yml b/src/main/resources/messages.yml index 49c557e..b0752f8 100644 --- a/src/main/resources/messages.yml +++ b/src/main/resources/messages.yml @@ -15,14 +15,13 @@ # 3. Expiry # 4. Punisher banMessage: "You have been banned! You may appeal at .\nReason: \nEnd date: \nBanned by: " -indefBanMessage: "Your is currently banned! You may appeal at ." -test: "this is a test message!" -# 1. The command sender's username -variableTest: "variable test with !" -playerNotFound: "Player not found!" -worldNotFound: "World not found!" +# The type of indefinite ban +# Appeal URL +indefBanMessage: "Your is indefinitely banned! You may appeal at ." +playerNotFound: "Player not found!" +worldNotFound: "World not found!" # 1. The world you have been teleported to -playerWorldTeleport: "You have been teleported to ." +playerWorldTeleport: "You have been teleported to ." # 1. The sender who opped everyone oppedAllPlayers: " - Opped all players on the server" # 1. The sender who de-opped everyone @@ -50,8 +49,7 @@ unmutedPlayer: " - Unmuted " lockedUpPlayer: " - Locking up " # 1. The person who is unlocking # 2. The person who has been unlocked -unlockedUpPlayer: " - Unlocking " -noPermission: "You cannot use this command!" +unlockedPlayer: " - Unlocking " # 1. The rank required to use the command noPermissionRank: "You must be at least to use this command!" # 1. The permission node required to use the command @@ -59,25 +57,23 @@ noPermissionNode: "You must have the permission: to use this command!" noPermissionInGame: "You must be in console to use this command!" noPermissionConsole: "You must be in-game to use this command!" # 1. The username of the name history -nameHistoryTitle: "Name History of " -# 1. A username of the found user -# 2. When the user changed to that username -nameHistoryBody: " - ()" -# 1. The username that failed -nameHistoryFail: "Something went wrong while trying to retrieve name history of ! Try again later!" -nameHistoryDoesntExist: "Couldn't find this user! Please check if your spelling was correct and this player exists" +nameHistoryTitle: "Name History of " +nameHistorySeparator: "-----------------------------" +# 1. The name +# 2. The date and time of the name change +nameHistoryBody: " - " # 1. The gamemode -gameModeSetTo: "Your gamemode has been set to ." +gameModeSetTo: "Your gamemode has been set to ." # 1. The player's name # 2. The gamemode -setOtherPlayerGameModeTo: "You set 's gamemode to ." +setOtherPlayerGameModeTo: "You set 's gamemode to ." # 1. The command sender # 2. The gamemode -playerSetOtherGameMode: " set your gamemode to ." +playerSetOtherGameMode: " set your gamemode to ." # 1. The command sender # 2. The gamemode setEveryoneGameMode: " - Changing everyone's gamemode to " -consoleMustDefinePlayer: "You must define a player since you are running this command from console." +consoleMustDefinePlayer: "You must define a player since you are running this command from console." # 1. The command sender # 2. The player newAdminAdded: " - Adding to the admin list" @@ -116,9 +112,9 @@ playerLockedUp: "That player is already locked up!" muted: "You are currently muted - STFU!" kickedPlayer: " - Kicking " teleportedToWorldSpawn: "Teleporting to the local spawn" -toggleCommandSpy: "CommandSpy has been" -enabled: "enabled." -disabled: "disabled." +toggleCommandSpy: "CommandSpy has been" +enabled: "enabled." +disabled: "disabled." adminChatFormat: '[AdminChat] ยป ' maximumPrefixLength: "The maximum length for a tag may only be ." prefixCleared: "Your prefix has been cleared."