mirror of
https://github.com/plexusorg/Plex.git
synced 2024-12-22 17:17:37 +00:00
commit
0a3594370a
12
build.gradle
12
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 {
|
||||
|
@ -123,7 +123,6 @@ public class Plex extends JavaPlugin
|
||||
new ListenerHandler();
|
||||
new CommandHandler();
|
||||
|
||||
|
||||
rankManager = new RankManager();
|
||||
rankManager.generateDefaultRanks();
|
||||
rankManager.importDefaultRanks();
|
||||
|
@ -29,19 +29,19 @@ public class Admin
|
||||
/**
|
||||
* Returns if the admin has command spy or not
|
||||
* <br>
|
||||
* 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
|
||||
* <br>
|
||||
* 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;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -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<String> getAllAdmins()
|
||||
{
|
||||
List<String> 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<PlexPlayer> 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;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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()
|
||||
|
@ -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 = "/<command> <add | remove | setrank | list> [player] [rank]", aliases = "saconfig,slconfig,adminconfig,adminmanage", description = "Manage all admins")
|
||||
@CommandParameters(name = "admin", usage = "/<command> <add <player> | remove <player> | setrank <player> <rank> | list>", aliases = "saconfig,slconfig,adminconfig,adminmanage", description = "Manage all admins")
|
||||
public class AdminCMD extends PlexCommand
|
||||
{
|
||||
//TODO: Better return messages
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -29,4 +29,4 @@ public class UpdateCheckerService extends AbstractService
|
||||
// Every 30 minutes
|
||||
return 1800;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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)
|
||||
|
@ -44,4 +44,4 @@ public class UpdateChecker extends PlexBase
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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 -"));
|
||||
|
@ -15,14 +15,13 @@
|
||||
# 3. Expiry
|
||||
# 4. Punisher
|
||||
banMessage: "<red>You have been banned! You may appeal at <gold><v>.\n<red>Reason: <gold><v>\n<red>End date: <gold><v>\n<red>Banned by: <gold><v>"
|
||||
indefBanMessage: "<red>Your <v> is currently banned! You may appeal at <gold><v>."
|
||||
test: "this is a test message!"
|
||||
# 1. The command sender's username
|
||||
variableTest: "variable test with <v>!"
|
||||
playerNotFound: "Player not found!"
|
||||
worldNotFound: "World not found!"
|
||||
# The type of indefinite ban
|
||||
# Appeal URL
|
||||
indefBanMessage: "<red>Your <v> is indefinitely banned! You may appeal at <gold><v>."
|
||||
playerNotFound: "<red>Player not found!"
|
||||
worldNotFound: "<red>World not found!"
|
||||
# 1. The world you have been teleported to
|
||||
playerWorldTeleport: "You have been teleported to <v>."
|
||||
playerWorldTeleport: "<aqua>You have been teleported to <v>."
|
||||
# 1. The sender who opped everyone
|
||||
oppedAllPlayers: "<aqua><v> - Opped all players on the server"
|
||||
# 1. The sender who de-opped everyone
|
||||
@ -50,8 +49,7 @@ unmutedPlayer: "<aqua><v> - Unmuted <v>"
|
||||
lockedUpPlayer: "<aqua><v> - Locking up <v>"
|
||||
# 1. The person who is unlocking
|
||||
# 2. The person who has been unlocked
|
||||
unlockedUpPlayer: "<aqua><v> - Unlocking <v>"
|
||||
noPermission: "<red>You cannot use this command!"
|
||||
unlockedPlayer: "<aqua><v> - Unlocking <v>"
|
||||
# 1. The rank required to use the command
|
||||
noPermissionRank: "<red>You must be at least <v> to use this command!"
|
||||
# 1. The permission node required to use the command
|
||||
@ -59,25 +57,23 @@ noPermissionNode: "<red>You must have the permission: <v> to use this command!"
|
||||
noPermissionInGame: "<red>You must be in console to use this command!"
|
||||
noPermissionConsole: "<red>You must be in-game to use this command!"
|
||||
# 1. The username of the name history
|
||||
nameHistoryTitle: "Name History of <v>"
|
||||
# 1. A username of the found user
|
||||
# 2. When the user changed to that username
|
||||
nameHistoryBody: " - <v> (<v>)"
|
||||
# 1. The username that failed
|
||||
nameHistoryFail: "<red>Something went wrong while trying to retrieve name history of <v>! Try again later!"
|
||||
nameHistoryDoesntExist: "<red>Couldn't find this user! Please check if your spelling was correct and this player exists"
|
||||
nameHistoryTitle: "<gold>Name History of <v>"
|
||||
nameHistorySeparator: "<gold><strikethrough>-----------------------------"
|
||||
# 1. The name
|
||||
# 2. The date and time of the name change
|
||||
nameHistoryBody: "<gold><v> <dark_gray>- <gold><v>"
|
||||
# 1. The gamemode
|
||||
gameModeSetTo: "Your gamemode has been set to <v>."
|
||||
gameModeSetTo: "<gray>Your gamemode has been set to <v>."
|
||||
# 1. The player's name
|
||||
# 2. The gamemode
|
||||
setOtherPlayerGameModeTo: "You set <v>'s gamemode to <v>."
|
||||
setOtherPlayerGameModeTo: "<gray>You set <v>'s gamemode to <v>."
|
||||
# 1. The command sender
|
||||
# 2. The gamemode
|
||||
playerSetOtherGameMode: "<v> set your gamemode to <v>."
|
||||
playerSetOtherGameMode: "<gray><v> set your gamemode to <v>."
|
||||
# 1. The command sender
|
||||
# 2. The gamemode
|
||||
setEveryoneGameMode: "<aqua><v> - Changing everyone's gamemode to <v>"
|
||||
consoleMustDefinePlayer: "You must define a player since you are running this command from console."
|
||||
consoleMustDefinePlayer: "<red>You must define a player since you are running this command from console."
|
||||
# 1. The command sender
|
||||
# 2. The player
|
||||
newAdminAdded: "<aqua><v> - Adding <v> to the admin list"
|
||||
@ -116,9 +112,9 @@ playerLockedUp: "<red>That player is already locked up!"
|
||||
muted: "<red>You are currently muted - STFU!"
|
||||
kickedPlayer: "<red><v> - Kicking <v>"
|
||||
teleportedToWorldSpawn: "<aqua>Teleporting to the local spawn"
|
||||
toggleCommandSpy: "CommandSpy has been"
|
||||
enabled: "enabled."
|
||||
disabled: "disabled."
|
||||
toggleCommandSpy: "<gray>CommandSpy has been"
|
||||
enabled: "<gray>enabled."
|
||||
disabled: "<gray>disabled."
|
||||
adminChatFormat: '<dark_gray>[<blue>AdminChat<dark_gray>] <dark_red><v> <gray>» <gold><v>'
|
||||
maximumPrefixLength: "<red>The maximum length for a tag may only be <v>."
|
||||
prefixCleared: "<aqua>Your prefix has been cleared."
|
||||
|
Loading…
Reference in New Issue
Block a user