mirror of
https://github.com/plexusorg/Plex.git
synced 2024-11-16 16:46:11 +00:00
commit
0a3594370a
12
build.gradle
12
build.gradle
@ -19,10 +19,6 @@ repositories {
|
|||||||
url = uri("https://repo.maven.apache.org/maven2/")
|
url = uri("https://repo.maven.apache.org/maven2/")
|
||||||
}
|
}
|
||||||
|
|
||||||
maven {
|
|
||||||
name = "sonatype-oss-snapshots"
|
|
||||||
url = uri("https://oss.sonatype.org/content/repositories/snapshots/")
|
|
||||||
}
|
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -36,17 +32,13 @@ dependencies {
|
|||||||
library "org.mariadb.jdbc:mariadb-java-client:3.0.3"
|
library "org.mariadb.jdbc:mariadb-java-client:3.0.3"
|
||||||
library "org.apache.httpcomponents:httpclient:4.5.13"
|
library "org.apache.httpcomponents:httpclient:4.5.13"
|
||||||
library "org.apache.commons:commons-lang3:3.12.0"
|
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-base:3.0.0"
|
||||||
implementation "org.bstats:bstats-bukkit: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"
|
group = "dev.plex"
|
||||||
version = "0.7"
|
version = "0.8-SNAPSHOT"
|
||||||
description = "Plex"
|
description = "Plex"
|
||||||
|
|
||||||
shadowJar {
|
shadowJar {
|
||||||
|
@ -123,7 +123,6 @@ public class Plex extends JavaPlugin
|
|||||||
new ListenerHandler();
|
new ListenerHandler();
|
||||||
new CommandHandler();
|
new CommandHandler();
|
||||||
|
|
||||||
|
|
||||||
rankManager = new RankManager();
|
rankManager = new RankManager();
|
||||||
rankManager.generateDefaultRanks();
|
rankManager.generateDefaultRanks();
|
||||||
rankManager.importDefaultRanks();
|
rankManager.importDefaultRanks();
|
||||||
|
@ -29,19 +29,19 @@ public class Admin
|
|||||||
/**
|
/**
|
||||||
* Returns if the admin has command spy or not
|
* Returns if the admin has command spy or not
|
||||||
* <br>
|
* <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>
|
* <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
|
* @param uuid
|
||||||
* @see UUID
|
* @see UUID
|
||||||
@ -52,6 +52,4 @@ public class Admin
|
|||||||
this.uuid = uuid;
|
this.uuid = uuid;
|
||||||
this.rank = Rank.ADMIN;
|
this.rank = Rank.ADMIN;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,7 @@ import com.google.common.collect.Maps;
|
|||||||
import dev.morphia.Datastore;
|
import dev.morphia.Datastore;
|
||||||
import dev.morphia.query.Query;
|
import dev.morphia.query.Query;
|
||||||
import dev.plex.Plex;
|
import dev.plex.Plex;
|
||||||
|
import dev.plex.PlexBase;
|
||||||
import dev.plex.player.PlexPlayer;
|
import dev.plex.player.PlexPlayer;
|
||||||
import dev.plex.rank.enums.Rank;
|
import dev.plex.rank.enums.Rank;
|
||||||
import dev.plex.storage.StorageType;
|
import dev.plex.storage.StorageType;
|
||||||
@ -23,7 +24,7 @@ import java.util.stream.Collectors;
|
|||||||
* @see Admin
|
* @see Admin
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class AdminList
|
public class AdminList extends PlexBase
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Key/Value storage, where the key is the unique ID of the admin
|
* Key/Value storage, where the key is the unique ID of the admin
|
||||||
@ -59,15 +60,15 @@ public class AdminList
|
|||||||
public List<String> getAllAdmins()
|
public List<String> getAllAdmins()
|
||||||
{
|
{
|
||||||
List<String> admins = Lists.newArrayList();
|
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);
|
Query<PlexPlayer> query = store.find(PlexPlayer.class);
|
||||||
admins.addAll(query.stream().filter(plexPlayer -> plexPlayer.getRankFromString().isAtLeast(Rank.ADMIN)).map(PlexPlayer::getName).collect(Collectors.toList()));
|
admins.addAll(query.stream().filter(plexPlayer -> plexPlayer.getRankFromString().isAtLeast(Rank.ADMIN)).map(PlexPlayer::getName).collect(Collectors.toList()));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
try (Connection con = Plex.get().getSqlConnection().getCon())
|
try (Connection con = plugin.getSqlConnection().getCon())
|
||||||
{
|
{
|
||||||
PreparedStatement statement = con.prepareStatement("SELECT * FROM `players` WHERE rank IN(?, ?, ?)");
|
PreparedStatement statement = con.prepareStatement("SELECT * FROM `players` WHERE rank IN(?, ?, ?)");
|
||||||
statement.setString(1, Rank.ADMIN.name().toLowerCase());
|
statement.setString(1, Rank.ADMIN.name().toLowerCase());
|
||||||
@ -79,7 +80,6 @@ public class AdminList
|
|||||||
{
|
{
|
||||||
admins.add(set.getString("name"));
|
admins.add(set.getString("name"));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (SQLException throwables)
|
catch (SQLException throwables)
|
||||||
{
|
{
|
||||||
@ -88,5 +88,4 @@ public class AdminList
|
|||||||
}
|
}
|
||||||
return admins;
|
return admins;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -516,7 +516,7 @@ public abstract class PlexCommand extends Command implements PluginIdentifiableC
|
|||||||
*/
|
*/
|
||||||
protected Component mmString(String s)
|
protected Component mmString(String s)
|
||||||
{
|
{
|
||||||
return MiniMessage.miniMessage().parse(s);
|
return MiniMessage.miniMessage().deserialize(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Rank getLevel()
|
public Rank getLevel()
|
||||||
|
@ -26,7 +26,7 @@ import org.jetbrains.annotations.NotNull;
|
|||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
@CommandPermissions(level = Rank.OP, source = RequiredCommandSource.ANY)
|
@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
|
public class AdminCMD extends PlexCommand
|
||||||
{
|
{
|
||||||
//TODO: Better return messages
|
//TODO: Better return messages
|
||||||
|
@ -49,7 +49,7 @@ public class LockupCMD extends PlexCommand
|
|||||||
}
|
}
|
||||||
|
|
||||||
punishedPlayer.setLockedUp(!punishedPlayer.isLockedUp());
|
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;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,11 +49,9 @@ public class NameHistoryCMD extends PlexCommand
|
|||||||
if (history.getLocalDateTime() != null)
|
if (history.getLocalDateTime() != null)
|
||||||
{
|
{
|
||||||
historyList.add(
|
historyList.add(
|
||||||
Component.text(history.getUsername()).color(NamedTextColor.GOLD)
|
messageComponent("nameHistoryBody",
|
||||||
.append(Component.space())
|
history.getUsername(),
|
||||||
.append(Component.text("-").color(NamedTextColor.DARK_GRAY))
|
DATE_FORMAT.format(history.getLocalDateTime())));
|
||||||
.append(Component.space())
|
|
||||||
.append(Component.text(DATE_FORMAT.format(history.getLocalDateTime())).color(NamedTextColor.GOLD)));
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -62,8 +60,8 @@ public class NameHistoryCMD extends PlexCommand
|
|||||||
.append(Component.space()));
|
.append(Component.space()));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
send(sender, Component.text("Name History (" + username + ")").color(NamedTextColor.GOLD));
|
send(sender, messageComponent("nameHistoryTitle", username));
|
||||||
send(sender, Component.text("-----------------------------").color(NamedTextColor.GOLD).decoration(TextDecoration.STRIKETHROUGH, true));
|
send(sender, messageComponent("nameHistorySeparator"));
|
||||||
historyList.forEach(component -> send(sender, component));
|
historyList.forEach(component -> send(sender, component));
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -131,7 +131,7 @@ public class PlexUtils extends PlexBase
|
|||||||
|
|
||||||
public static Component messageComponent(String entry, Object... objects)
|
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)
|
public static String messageString(String entry, Object... objects)
|
||||||
|
@ -38,14 +38,14 @@ public class CustomWorld extends WorldCreator
|
|||||||
{
|
{
|
||||||
boolean existed = new File(name).exists();
|
boolean existed = new File(name).exists();
|
||||||
World world = super.generate();
|
World world = super.generate();
|
||||||
|
|
||||||
if (!existed)
|
if (!existed)
|
||||||
{
|
{
|
||||||
Block block = world.getBlockAt(0, world.getHighestBlockYAt(0, 0) + 1, 0);
|
Block block = world.getBlockAt(0, world.getHighestBlockYAt(0, 0) + 1, 0);
|
||||||
block.setType(Material.OAK_SIGN);
|
block.setType(Material.OAK_SIGN);
|
||||||
BlockState state = block.getState();
|
BlockState state = block.getState();
|
||||||
if (state instanceof Sign)
|
if (state instanceof Sign sign)
|
||||||
{
|
{
|
||||||
Sign sign = (Sign)state;
|
|
||||||
sign.line(1, Component.text(
|
sign.line(1, Component.text(
|
||||||
Objects.requireNonNull(plugin.config.getString("worlds." + name + ".name"))));
|
Objects.requireNonNull(plugin.config.getString("worlds." + name + ".name"))));
|
||||||
sign.line(2, Component.text("- 0, 0 -"));
|
sign.line(2, Component.text("- 0, 0 -"));
|
||||||
|
@ -15,14 +15,13 @@
|
|||||||
# 3. Expiry
|
# 3. Expiry
|
||||||
# 4. Punisher
|
# 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>"
|
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>."
|
# The type of indefinite ban
|
||||||
test: "this is a test message!"
|
# Appeal URL
|
||||||
# 1. The command sender's username
|
indefBanMessage: "<red>Your <v> is indefinitely banned! You may appeal at <gold><v>."
|
||||||
variableTest: "variable test with <v>!"
|
playerNotFound: "<red>Player not found!"
|
||||||
playerNotFound: "Player not found!"
|
worldNotFound: "<red>World not found!"
|
||||||
worldNotFound: "World not found!"
|
|
||||||
# 1. The world you have been teleported to
|
# 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
|
# 1. The sender who opped everyone
|
||||||
oppedAllPlayers: "<aqua><v> - Opped all players on the server"
|
oppedAllPlayers: "<aqua><v> - Opped all players on the server"
|
||||||
# 1. The sender who de-opped everyone
|
# 1. The sender who de-opped everyone
|
||||||
@ -50,8 +49,7 @@ unmutedPlayer: "<aqua><v> - Unmuted <v>"
|
|||||||
lockedUpPlayer: "<aqua><v> - Locking up <v>"
|
lockedUpPlayer: "<aqua><v> - Locking up <v>"
|
||||||
# 1. The person who is unlocking
|
# 1. The person who is unlocking
|
||||||
# 2. The person who has been unlocked
|
# 2. The person who has been unlocked
|
||||||
unlockedUpPlayer: "<aqua><v> - Unlocking <v>"
|
unlockedPlayer: "<aqua><v> - Unlocking <v>"
|
||||||
noPermission: "<red>You cannot use this command!"
|
|
||||||
# 1. The rank required to use the command
|
# 1. The rank required to use the command
|
||||||
noPermissionRank: "<red>You must be at least <v> to use this command!"
|
noPermissionRank: "<red>You must be at least <v> to use this command!"
|
||||||
# 1. The permission node required to use the 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!"
|
noPermissionInGame: "<red>You must be in console to use this command!"
|
||||||
noPermissionConsole: "<red>You must be in-game to use this command!"
|
noPermissionConsole: "<red>You must be in-game to use this command!"
|
||||||
# 1. The username of the name history
|
# 1. The username of the name history
|
||||||
nameHistoryTitle: "Name History of <v>"
|
nameHistoryTitle: "<gold>Name History of <v>"
|
||||||
# 1. A username of the found user
|
nameHistorySeparator: "<gold><strikethrough>-----------------------------"
|
||||||
# 2. When the user changed to that username
|
# 1. The name
|
||||||
nameHistoryBody: " - <v> (<v>)"
|
# 2. The date and time of the name change
|
||||||
# 1. The username that failed
|
nameHistoryBody: "<gold><v> <dark_gray>- <gold><v>"
|
||||||
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"
|
|
||||||
# 1. The gamemode
|
# 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
|
# 1. The player's name
|
||||||
# 2. The gamemode
|
# 2. The gamemode
|
||||||
setOtherPlayerGameModeTo: "You set <v>'s gamemode to <v>."
|
setOtherPlayerGameModeTo: "<gray>You set <v>'s gamemode to <v>."
|
||||||
# 1. The command sender
|
# 1. The command sender
|
||||||
# 2. The gamemode
|
# 2. The gamemode
|
||||||
playerSetOtherGameMode: "<v> set your gamemode to <v>."
|
playerSetOtherGameMode: "<gray><v> set your gamemode to <v>."
|
||||||
# 1. The command sender
|
# 1. The command sender
|
||||||
# 2. The gamemode
|
# 2. The gamemode
|
||||||
setEveryoneGameMode: "<aqua><v> - Changing everyone's gamemode to <v>"
|
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
|
# 1. The command sender
|
||||||
# 2. The player
|
# 2. The player
|
||||||
newAdminAdded: "<aqua><v> - Adding <v> to the admin list"
|
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!"
|
muted: "<red>You are currently muted - STFU!"
|
||||||
kickedPlayer: "<red><v> - Kicking <v>"
|
kickedPlayer: "<red><v> - Kicking <v>"
|
||||||
teleportedToWorldSpawn: "<aqua>Teleporting to the local spawn"
|
teleportedToWorldSpawn: "<aqua>Teleporting to the local spawn"
|
||||||
toggleCommandSpy: "CommandSpy has been"
|
toggleCommandSpy: "<gray>CommandSpy has been"
|
||||||
enabled: "enabled."
|
enabled: "<gray>enabled."
|
||||||
disabled: "disabled."
|
disabled: "<gray>disabled."
|
||||||
adminChatFormat: '<dark_gray>[<blue>AdminChat<dark_gray>] <dark_red><v> <gray>» <gold><v>'
|
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>."
|
maximumPrefixLength: "<red>The maximum length for a tag may only be <v>."
|
||||||
prefixCleared: "<aqua>Your prefix has been cleared."
|
prefixCleared: "<aqua>Your prefix has been cleared."
|
||||||
|
Loading…
Reference in New Issue
Block a user