diff --git a/src/main/java/dev/plex/Plex.java b/src/main/java/dev/plex/Plex.java index 1576d5f..a70233e 100644 --- a/src/main/java/dev/plex/Plex.java +++ b/src/main/java/dev/plex/Plex.java @@ -109,7 +109,7 @@ public class Plex extends JavaPlugin system = config.getString("system"); - PlexLog.log("Attempting to connect to DB: {0}", plugin.config.getString("data.central.storage")); + PlexLog.log("Attempting to connect to DB: {0}", plugin.config.getString("data.central.db")); try { PlexUtils.testConnections(); diff --git a/src/main/java/dev/plex/cache/DataUtils.java b/src/main/java/dev/plex/cache/DataUtils.java index b86e73e..156f291 100644 --- a/src/main/java/dev/plex/cache/DataUtils.java +++ b/src/main/java/dev/plex/cache/DataUtils.java @@ -44,7 +44,6 @@ public class DataUtils return PlayerCache.getPlexPlayerMap().get(uuid); } - if (Plex.get().getStorageType() == StorageType.MONGODB) { return Plex.get().getMongoPlayerData().getByUUID(uuid); diff --git a/src/main/java/dev/plex/command/impl/CommandSpyCMD.java b/src/main/java/dev/plex/command/impl/CommandSpyCMD.java index 461e055..652fad3 100644 --- a/src/main/java/dev/plex/command/impl/CommandSpyCMD.java +++ b/src/main/java/dev/plex/command/impl/CommandSpyCMD.java @@ -27,9 +27,9 @@ public class CommandSpyCMD extends PlexCommand PlexPlayer plexPlayer = DataUtils.getPlayer(playerSender.getUniqueId()); plexPlayer.setCommandSpy(!plexPlayer.isCommandSpy()); DataUtils.update(plexPlayer); - return Component.text(PlexUtils.messageString("toggleCommandSpy")).color(NamedTextColor.GRAY) + send(sender, messageComponent("toggleCommandSpy") .append(Component.space()) - .append(Component.text(plexPlayer.isCommandSpy() ? PlexUtils.messageString("enabled") : PlexUtils.messageString("disabled")).color(NamedTextColor.GRAY)); + .append(plexPlayer.isCommandSpy() ? messageComponent("enabled") : messageComponent("disabled"))); } return null; } diff --git a/src/main/java/dev/plex/command/impl/EntityWipeCMD.java b/src/main/java/dev/plex/command/impl/EntityWipeCMD.java index fbc2812..a31a625 100644 --- a/src/main/java/dev/plex/command/impl/EntityWipeCMD.java +++ b/src/main/java/dev/plex/command/impl/EntityWipeCMD.java @@ -1,11 +1,14 @@ package dev.plex.command.impl; +import com.google.common.collect.ImmutableList; import dev.plex.command.PlexCommand; import dev.plex.command.annotation.CommandParameters; import dev.plex.command.annotation.CommandPermissions; import dev.plex.command.source.RequiredCommandSource; import dev.plex.rank.enums.Rank; import dev.plex.util.PlexUtils; +import java.util.ArrayList; +import java.util.Collections; import net.kyori.adventure.text.Component; import org.bukkit.Bukkit; import org.bukkit.Location; @@ -34,7 +37,8 @@ public class EntityWipeCMD extends PlexCommand List entityWhitelist = new LinkedList<>(Arrays.asList(args)); EntityType[] entityTypes = EntityType.values(); - entityWhitelist.removeIf(name -> { + entityWhitelist.removeIf(name -> + { boolean res = Arrays.stream(entityTypes).noneMatch(entityType -> name.equalsIgnoreCase(entityType.name())); if (res) { @@ -53,18 +57,13 @@ public class EntityWipeCMD extends PlexCommand { if (entity.getType() != EntityType.PLAYER) { - String type = entity.getType().name(); + String type = entity.getName(); if (useBlacklist ? entityBlacklist.stream().noneMatch(entityName -> entityName.equalsIgnoreCase(type)) : entityWhitelist.stream().anyMatch(entityName -> entityName.equalsIgnoreCase(type))) { - /* - Location loc = entity.getLocation(); - loc.setY(-500); - entity.teleportAsync(loc); - */ entity.remove(); - entityCounts.put(type,entityCounts.getOrDefault(type, 0) + 1); + entityCounts.put(type, entityCounts.getOrDefault(type, 0) + 1); } } } @@ -88,9 +87,25 @@ public class EntityWipeCMD extends PlexCommand PlexUtils.broadcast(messageComponent("removedEntitiesOfTypes", sender.getName(), entityCount, list)); } - entityCounts.forEach((entityName, numRemoved) -> { + /*entityCounts.forEach((entityName, numRemoved) -> { sender.sendMessage(messageComponent("removedEntitiesOfType", sender.getName(), numRemoved, entityName)); - }); + });*/ return null; } + + public @NotNull List tabComplete(@NotNull CommandSender sender, @NotNull String alias, @NotNull String[] args) throws IllegalArgumentException + { + List entities = new ArrayList<>(); + for (World world : Bukkit.getWorlds()) + { + for (Entity entity : world.getEntities()) + { + if (entity.getType() != EntityType.PLAYER) + { + entities.add(entity.getName()); + } + } + } + return entities.stream().toList(); + } } \ No newline at end of file diff --git a/src/main/java/dev/plex/command/impl/MobPurgeCMD.java b/src/main/java/dev/plex/command/impl/MobPurgeCMD.java index 3f9c362..9c6ec34 100644 --- a/src/main/java/dev/plex/command/impl/MobPurgeCMD.java +++ b/src/main/java/dev/plex/command/impl/MobPurgeCMD.java @@ -33,15 +33,9 @@ public class MobPurgeCMD extends PlexCommand if (entity instanceof Mob) { String type = entity.getType().name(); - - /* - Location loc = entity.getLocation(); - loc.setY(-500); - entity.teleportAsync(loc); - */ entity.remove(); - entityCounts.put(type,entityCounts.getOrDefault(type, 0) + 1); + entityCounts.put(type, entityCounts.getOrDefault(type, 0) + 1); } } } @@ -50,9 +44,9 @@ public class MobPurgeCMD extends PlexCommand PlexUtils.broadcast(messageComponent("removedMobs", sender.getName(), entityCount)); - entityCounts.forEach((entityName, numRemoved) -> { + /*entityCounts.forEach((entityName, numRemoved) -> { sender.sendMessage(messageComponent("removedEntitiesOfType", sender.getName(), numRemoved, entityName)); - }); + });*/ return null; } } \ No newline at end of file diff --git a/src/main/java/dev/plex/command/impl/NotesCMD.java b/src/main/java/dev/plex/command/impl/NotesCMD.java index 7c37a50..475f7b8 100644 --- a/src/main/java/dev/plex/command/impl/NotesCMD.java +++ b/src/main/java/dev/plex/command/impl/NotesCMD.java @@ -56,32 +56,17 @@ public class NotesCMD extends PlexCommand send(sender, mmString("This player has no notes!")); return; } - AtomicReference noteList = new AtomicReference<>(Component.text("Player notes for: " + plexPlayer.getName()).color(NamedTextColor.GREEN)); - for (Note note : notes) - { - Component noteLine = Component.text(note.getId() + " - Written by: " + DataUtils.getPlayer(note.getWrittenBy()).getName() + " on " + DATE_FORMAT.format(note.getTimestamp())).color(NamedTextColor.YELLOW).decoration(TextDecoration.ITALIC, false); - noteLine = noteLine.append(Component.text(note.getNote())).color(NamedTextColor.GOLD).decoration(TextDecoration.ITALIC, true); - noteList.set(noteList.get().append(Component.newline())); - noteList.set(noteList.get().append(noteLine)); - } - send(sender, noteList.get()); + readNotes(sender, plexPlayer, notes); }); - } else + } + else { List notes = plexPlayer.getNotes(); if (notes.size() == 0) { return mmString("This player has no notes!"); } - AtomicReference noteList = new AtomicReference<>(Component.text("Player notes for: " + plexPlayer.getName()).color(NamedTextColor.GREEN)); - for (Note note : notes) - { - Component noteLine = Component.text(note.getId() + " - Written by: " + DataUtils.getPlayer(note.getWrittenBy()).getName() + " on " + DATE_FORMAT.format(note.getTimestamp())).color(NamedTextColor.YELLOW).decoration(TextDecoration.ITALIC, false); - noteLine = noteLine.append(Component.text(note.getNote())).color(NamedTextColor.GOLD).decoration(TextDecoration.ITALIC, true); - noteList.set(noteList.get().append(Component.newline())); - noteList.set(noteList.get().append(noteLine)); - } - send(sender, noteList.get()); + readNotes(sender, plexPlayer, notes); } return null; } @@ -99,7 +84,8 @@ public class NotesCMD extends PlexCommand if (plugin.getStorageType() != StorageType.MONGODB) { plugin.getSqlNotes().addNote(note); - } else + } + else { DataUtils.update(plexPlayer); } @@ -112,7 +98,8 @@ public class NotesCMD extends PlexCommand try { id = Integer.parseInt(args[2]); - } catch (NumberFormatException ignored) + } + catch (NumberFormatException ignored) { return Component.text("Invalid number: " + args[2]).color(NamedTextColor.RED); } @@ -126,14 +113,16 @@ public class NotesCMD extends PlexCommand { plugin.getSqlNotes().deleteNote(id, plexPlayer.getUuid()).whenComplete((notes1, ex1) -> send(sender, Component.text("Removed note with ID: " + id).color(NamedTextColor.GREEN))); - } else + } + else { send(sender, mmString("A note with this ID could not be found")); } } plexPlayer.getNotes().removeIf(note -> note.getId() == id); }); - } else + } + else { if (plexPlayer.getNotes().removeIf(note -> note.getId() == id)) { @@ -155,7 +144,9 @@ public class NotesCMD extends PlexCommand plexPlayer.getNotes().clear(); send(sender, Component.text("Cleared " + notes.size() + " note(s).").color(NamedTextColor.GREEN)); }); - } else { + } + else + { int count = plexPlayer.getNotes().size(); plexPlayer.getNotes().clear(); DataUtils.update(plexPlayer); @@ -170,6 +161,19 @@ public class NotesCMD extends PlexCommand } } + private void readNotes(@NotNull CommandSender sender, PlexPlayer plexPlayer, List notes) + { + AtomicReference noteList = new AtomicReference<>(Component.text("Player notes for: " + plexPlayer.getName()).color(NamedTextColor.GREEN)); + for (Note note : notes) + { + Component noteLine = Component.text(note.getId() + " - Written by: " + DataUtils.getPlayer(note.getWrittenBy()).getName() + " on " + DATE_FORMAT.format(note.getTimestamp())).color(NamedTextColor.YELLOW).decoration(TextDecoration.ITALIC, false); + noteLine = noteLine.append(Component.text(note.getNote())).color(NamedTextColor.GOLD).decoration(TextDecoration.ITALIC, true); + noteList.set(noteList.get().append(Component.newline())); + noteList.set(noteList.get().append(noteLine)); + } + send(sender, noteList.get()); + } + @Override public @NotNull List tabComplete(@NotNull CommandSender sender, @NotNull String alias, @NotNull String[] args) throws IllegalArgumentException { diff --git a/src/main/java/dev/plex/command/impl/RankCMD.java b/src/main/java/dev/plex/command/impl/RankCMD.java index f0fdc63..8e8b362 100644 --- a/src/main/java/dev/plex/command/impl/RankCMD.java +++ b/src/main/java/dev/plex/command/impl/RankCMD.java @@ -7,6 +7,9 @@ import dev.plex.command.annotation.System; import dev.plex.command.exception.CommandFailException; import dev.plex.command.source.RequiredCommandSource; import dev.plex.rank.enums.Rank; +import dev.plex.util.PlexUtils; +import java.util.Collections; +import java.util.List; import net.kyori.adventure.text.Component; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; @@ -41,4 +44,14 @@ public class RankCMD extends PlexCommand } return null; } + + @Override + public @NotNull List tabComplete(@NotNull CommandSender sender, @NotNull String alias, @NotNull String[] args) throws IllegalArgumentException + { + if (args.length == 1) + { + return PlexUtils.getPlayerNameList(); + } + return Collections.emptyList(); + } } \ No newline at end of file diff --git a/src/main/java/dev/plex/command/impl/SmiteCMD.java b/src/main/java/dev/plex/command/impl/SmiteCMD.java new file mode 100644 index 0000000..e3d3480 --- /dev/null +++ b/src/main/java/dev/plex/command/impl/SmiteCMD.java @@ -0,0 +1,150 @@ +package dev.plex.command.impl; + +import dev.plex.command.PlexCommand; +import dev.plex.command.annotation.CommandParameters; +import dev.plex.command.annotation.CommandPermissions; +import dev.plex.command.source.RequiredCommandSource; +import dev.plex.player.PlexPlayer; +import dev.plex.punishment.Punishment; +import dev.plex.punishment.PunishmentType; +import dev.plex.rank.enums.Rank; +import dev.plex.util.PlexUtils; +import java.time.LocalDateTime; +import java.util.Collections; +import java.util.List; +import net.kyori.adventure.text.Component; +import net.kyori.adventure.text.format.NamedTextColor; +import net.kyori.adventure.title.Title; +import org.apache.commons.lang.StringUtils; +import org.apache.commons.lang3.ArrayUtils; +import org.bukkit.GameMode; +import org.bukkit.Location; +import org.bukkit.World; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +@CommandPermissions(level = Rank.ADMIN, permission = "plex.smite", source = RequiredCommandSource.ANY) +@CommandParameters(name = "smite", usage = "/ [reason] [-ci | -q]", description = "Someone being a little bitch? Smite them down...") +public class SmiteCMD extends PlexCommand +{ + @Override + protected Component execute(@NotNull CommandSender sender, @Nullable Player playerSender, String[] args) + { + if (args.length < 1) + { + return usage(); + } + + String reason = null; + boolean silent = false; + boolean clearinv = false; + + if (args.length >= 2) + { + if (args[args.length - 1].equalsIgnoreCase("-q")) + { + if (args[args.length - 1].equalsIgnoreCase("-q")) + { + silent = true; + } + + if (args.length >= 3) + { + reason = StringUtils.join(ArrayUtils.subarray(args, 1, args.length - 1), " "); + } + } + else if (args[args.length - 1].equalsIgnoreCase("-ci")) + { + if (args[args.length - 1].equalsIgnoreCase("-ci")) + { + clearinv = true; + } + + if (args.length >= 3) + { + reason = StringUtils.join(ArrayUtils.subarray(args, 1, args.length - 1), " "); + } + } + else + { + reason = StringUtils.join(ArrayUtils.subarray(args, 1, args.length), " "); + } + } + + final Player player = getNonNullPlayer(args[0]); + final PlexPlayer plexPlayer = getPlexPlayer(player); + + Title title = Title.title(Component.text("You've been smitten.").color(NamedTextColor.RED), Component.text("Be sure to follow the rules!").color(NamedTextColor.YELLOW)); + player.showTitle(title); + + if (!silent) + { + PlexUtils.broadcast(mmString("" + player.getName() + " has been a naughty, naughty boy.")); + if (reason != null) + { + PlexUtils.broadcast(mmString(" Reason: " + "" + reason)); + } + PlexUtils.broadcast(mmString(" Smitten by: " + "" + sender.getName())); + } + else + { + send(sender, "Smitten " + player.getName() + " quietly."); + } + + // Deop + if (plugin.getSystem().equalsIgnoreCase("ranks")) + { + player.setOp(false); + } + + // Set gamemode to survival + player.setGameMode(GameMode.SURVIVAL); + + // Clear inventory + if (clearinv) + { + player.getInventory().clear(); + } + + // Strike with lightning effect + final Location targetPos = player.getLocation(); + final World world = player.getWorld(); + for (int x = -1; x <= 1; x++) + { + for (int z = -1; z <= 1; z++) + { + final Location strike_pos = new Location(world, targetPos.getBlockX() + x, targetPos.getBlockY(), targetPos.getBlockZ() + z); + world.strikeLightning(strike_pos); + } + } + + // Kill + player.setHealth(0.0); + + Punishment punishment = new Punishment(plexPlayer.getUuid(), getUUID(sender)); + punishment.setCustomTime(false); + punishment.setEndDate(LocalDateTime.now()); + punishment.setType(PunishmentType.SMITE); + punishment.setPunishedUsername(player.getName()); + punishment.setIp(player.getAddress().getAddress().getHostAddress().trim()); + + if (reason != null) + { + punishment.setReason(reason); + send(player, mmString("You've been smitten. Reason: " + reason)); + } + return null; + } + + @Override + public @NotNull List tabComplete(@NotNull CommandSender sender, @NotNull String alias, @NotNull String[] args) throws IllegalArgumentException + { + if (checkTab(sender, Rank.ADMIN, "plex.smite") && args.length == 1) + { + return PlexUtils.getPlayerNameList(); + } + return Collections.emptyList(); + } +} \ No newline at end of file diff --git a/src/main/java/dev/plex/listener/impl/PlayerListener.java b/src/main/java/dev/plex/listener/impl/PlayerListener.java index b7cd794..7ab342c 100644 --- a/src/main/java/dev/plex/listener/impl/PlayerListener.java +++ b/src/main/java/dev/plex/listener/impl/PlayerListener.java @@ -33,7 +33,8 @@ public class PlayerListener extends PlexListener { player.setOp(true); PlexLog.debug("Automatically opped " + player.getName() + " since ranks are enabled."); - } else if (plugin.getSystem().equalsIgnoreCase("permissions")) + } + else if (plugin.getSystem().equalsIgnoreCase("permissions")) { player.setOp(false); PlexLog.debug("Automatically deopped " + player.getName() + " since ranks are disabled."); @@ -46,7 +47,8 @@ public class PlayerListener extends PlexListener plexPlayer.setName(player.getName()); // set the name of the player plexPlayer.setIps(Arrays.asList(player.getAddress().getAddress().getHostAddress().trim())); // set the arraylist of ips DataUtils.insert(plexPlayer); // insert data in some wack db - } else + } + else { plexPlayer = DataUtils.getPlayer(player.getUniqueId()); List ips = plexPlayer.getIps(); diff --git a/src/main/java/dev/plex/punishment/PunishmentManager.java b/src/main/java/dev/plex/punishment/PunishmentManager.java index b16235d..e31c28e 100644 --- a/src/main/java/dev/plex/punishment/PunishmentManager.java +++ b/src/main/java/dev/plex/punishment/PunishmentManager.java @@ -135,6 +135,10 @@ public class PunishmentManager extends PlexBase public boolean isBanned(UUID uuid) { + /*if (!DataUtils.hasPlayedBefore(uuid)) + { + return false; + }*/ return DataUtils.getPlayer(uuid).getPunishments().stream().anyMatch(punishment -> punishment.getType() == PunishmentType.BAN && punishment.isActive()); } diff --git a/src/main/java/dev/plex/punishment/PunishmentType.java b/src/main/java/dev/plex/punishment/PunishmentType.java index f16c9f9..7d2c814 100644 --- a/src/main/java/dev/plex/punishment/PunishmentType.java +++ b/src/main/java/dev/plex/punishment/PunishmentType.java @@ -2,5 +2,5 @@ package dev.plex.punishment; public enum PunishmentType { - MUTE, FREEZE, BAN, KICK + MUTE, FREEZE, BAN, KICK, SMITE } diff --git a/src/main/java/dev/plex/util/PlexUtils.java b/src/main/java/dev/plex/util/PlexUtils.java index 04d3360..aa05653 100644 --- a/src/main/java/dev/plex/util/PlexUtils.java +++ b/src/main/java/dev/plex/util/PlexUtils.java @@ -68,17 +68,17 @@ public class PlexUtils extends PlexBase public static void disabledEffect(Player player, Location location) { - Particle.CLOUD.builder().location(location).receivers(player).extra(0).offset(0.5,0.5,0.5).count(5).spawn(); - Particle.FLAME.builder().location(location).receivers(player).extra(0).offset(0.5,0.5,0.5).count(3).spawn(); - Particle.SOUL_FIRE_FLAME.builder().location(location).receivers(player).offset(0.5,0.5,0.5).extra(0).count(2).spawn(); + Particle.CLOUD.builder().location(location).receivers(player).extra(0).offset(0.5, 0.5, 0.5).count(5).spawn(); + Particle.FLAME.builder().location(location).receivers(player).extra(0).offset(0.5, 0.5, 0.5).count(3).spawn(); + Particle.SOUL_FIRE_FLAME.builder().location(location).receivers(player).offset(0.5, 0.5, 0.5).extra(0).count(2).spawn(); player.playSound(location, org.bukkit.Sound.BLOCK_FIRE_EXTINGUISH, 0.5f, 0.5f); } public static void disabledEffectMultiple(Player[] players, Location location) { - Particle.CLOUD.builder().location(location).receivers(players).extra(0).offset(0.5,0.5,0.5).count(5).spawn(); - Particle.FLAME.builder().location(location).receivers(players).extra(0).offset(0.5,0.5,0.5).count(3).spawn(); - Particle.SOUL_FIRE_FLAME.builder().location(location).receivers(players).offset(0.5,0.5,0.5).extra(0).count(2).spawn(); + Particle.CLOUD.builder().location(location).receivers(players).extra(0).offset(0.5, 0.5, 0.5).count(5).spawn(); + Particle.FLAME.builder().location(location).receivers(players).extra(0).offset(0.5, 0.5, 0.5).count(3).spawn(); + Particle.SOUL_FIRE_FLAME.builder().location(location).receivers(players).offset(0.5, 0.5, 0.5).extra(0).count(2).spawn(); // note that the sound is played to everyone who is close enough to hear it players[0].getWorld().playSound(location, org.bukkit.Sound.BLOCK_FIRE_EXTINGUISH, 0.5f, 0.5f); } @@ -97,18 +97,21 @@ public class PlexUtils extends PlexBase if (Plex.get().getStorageType() == StorageType.MARIADB) { PlexLog.log("Successfully enabled MySQL!"); - } else if (Plex.get().getStorageType() == StorageType.SQLITE) + } + else if (Plex.get().getStorageType() == StorageType.SQLITE) { PlexLog.log("Successfully enabled SQLite!"); } - } catch (SQLException e) + } + catch (SQLException e) { if (Plex.get().getMongoConnection().getDatastore() != null) { PlexLog.log("Successfully enabled MongoDB!"); } } - } else + } + else { if (Plex.get().getMongoConnection().getDatastore() != null) { @@ -154,13 +157,9 @@ public class PlexUtils extends PlexBase { throw new NullPointerException(); } - /*for (Object object : objects) - { - f = f.replaceFirst("", String.valueOf(object)); - }*/ for (int i = 0; i < objects.length; i++) { - f = f.replace("{" + i + "}", PlainTextComponentSerializer.plainText().serialize(MiniMessage.miniMessage().deserialize(String.valueOf(objects[i])))); + f = f.replace("{" + i + "}", String.valueOf(objects[i])); } return f; } @@ -219,10 +218,12 @@ public class PlexUtils extends PlexBase if (config.getString(path) == null) { color = def; - } else if (ChatColor.getByChar(config.getString(path)) == null) + } + else if (ChatColor.getByChar(config.getString(path)) == null) { color = def; - } else + } + else { color = ChatColor.getByChar(config.getString(path)); } @@ -268,13 +269,14 @@ public class PlexUtils extends PlexBase private static void readGameRules(World world, String s) { String gameRule = s.split(";")[0]; - T value = (T) s.split(";")[1]; - GameRule rule = (GameRule) GameRule.getByName(gameRule); + T value = (T)s.split(";")[1]; + GameRule rule = (GameRule)GameRule.getByName(gameRule); if (rule != null && check(value).getClass().equals(rule.getType())) { world.setGameRule(rule, value); PlexLog.debug("Setting game rule " + gameRule + " for world " + world.getName() + " with value " + value); - } else + } + else { PlexLog.error(String.format("Failed to set game rule %s for world %s with value %s!", gameRule, world.getName().toLowerCase(Locale.ROOT), value)); } @@ -314,7 +316,7 @@ public class PlexUtils extends PlexBase try { URL u = new URL(url); - HttpURLConnection connection = (HttpURLConnection) u.openConnection(); + HttpURLConnection connection = (HttpURLConnection)u.openConnection(); connection.setRequestMethod("GET"); BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream())); String line; @@ -326,7 +328,8 @@ public class PlexUtils extends PlexBase in.close(); connection.disconnect(); return new JSONParser().parse(content.toString()); - } catch (IOException | ParseException ex) + } + catch (IOException | ParseException ex) { return null; } @@ -335,13 +338,13 @@ public class PlexUtils extends PlexBase public static UUID getFromName(String name) { JSONObject profile; - profile = (JSONObject) simpleGET("https://api.ashcon.app/mojang/v2/user/" + name); + profile = (JSONObject)simpleGET("https://api.ashcon.app/mojang/v2/user/" + name); if (profile == null) { PlexLog.error("Profile from Ashcon API returned null!"); return null; } - String uuidString = (String) profile.get("uuid"); + String uuidString = (String)profile.get("uuid"); return UUID.fromString(uuidString); } @@ -359,12 +362,14 @@ public class PlexUtils extends PlexBase { Class clazz = Class.forName(info.getName()); classes.add(clazz); - } catch (ClassNotFoundException ex) + } + catch (ClassNotFoundException ex) { PlexLog.error("Unable to find class " + info.getName() + " in " + packageName); } }); - } catch (IOException ex) + } + catch (IOException ex) { PlexLog.error("Something went wrong while fetching classes from " + packageName); throw new RuntimeException(ex); @@ -381,7 +386,7 @@ public class PlexUtils extends PlexBase { if (clazz.getSuperclass() == subType || Arrays.asList(clazz.getInterfaces()).contains(subType)) { - classes.add((Class) clazz); + classes.add((Class)clazz); } }); return Collections.unmodifiableSet(classes); diff --git a/src/main/resources/messages.yml b/src/main/resources/messages.yml index 5f51211..275138d 100644 --- a/src/main/resources/messages.yml +++ b/src/main/resources/messages.yml @@ -78,6 +78,7 @@ consoleMustDefinePlayer: "You must define a player since you are running th newAdminAdded: "{0} - Adding {1} to the admin list" # 0 - The command sender # 1 - The player +# 2 - The rank name adminReadded: "{0} - Re-adding {1} to the admin list as rank: {2}" # 0 - The command sender # 1 - The player