diff --git a/pom.xml b/pom.xml
index b1c5d69..6a961d6 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
Vmessage
Vmessage
- 1.5.3
+ 1.5.4
jar
Vmessage
@@ -25,7 +25,7 @@
org.apache.maven.plugins
maven-source-plugin
- 3.2.1
+ 3.2.0
attach-sources
@@ -38,7 +38,7 @@
org.apache.maven.plugins
maven-javadoc-plugin
- 3.2.1
+ 3.2.0
attach-javadocs
@@ -141,7 +141,7 @@
org.apache.maven.plugins
maven-javadoc-plugin
- 3.5.0
+ 3.2.0
@@ -151,10 +151,6 @@
papermc-repo
https://repo.papermc.io/repository/maven-public/
-
- jitpack.io
- https://jitpack.io
-
@@ -170,11 +166,5 @@
5.4
provided
-
- net.william278
- PAPIProxyBridge
- 1.0
- provided
-
diff --git a/src/main/java/me/feusalamander/vmessage/Configuration.java b/src/main/java/me/feusalamander/vmessage/Configuration.java
index 576d0cb..c5bf700 100644
--- a/src/main/java/me/feusalamander/vmessage/Configuration.java
+++ b/src/main/java/me/feusalamander/vmessage/Configuration.java
@@ -6,6 +6,7 @@ import java.io.File;
import java.io.InputStream;
import java.nio.file.Files;
import java.nio.file.Path;
+import java.util.List;
import java.util.Objects;
public final class Configuration {
@@ -21,6 +22,10 @@ public final class Configuration {
private boolean all;
private Toml config;
private static File file;
+ private List messagecmd;
+ private List joincmd;
+ private List leavecmd;
+ private List changecmd;
Configuration(Toml config) {
messageFormat = config.getString("Message.format", "");
@@ -33,6 +38,11 @@ public final class Configuration {
leaveEnabled = config.getBoolean("Leave.enabled", false);
changeEnabled = config.getBoolean("Server-change.enabled", false);
+ messagecmd = config.getList("Message.commands");
+ joincmd = config.getList("Join.commands");
+ leavecmd = config.getList("Leave.commands");
+ changecmd = config.getList("Server-change.commands");
+
minimessage = config.getBoolean("Message-format.minimessage");
all = config.getBoolean("Message.all", false);
this.config = config;
@@ -103,6 +113,18 @@ public final class Configuration {
public boolean isAllEnabled(){
return this.all;
}
+ public List getMessagecmd(){
+ return this.messagecmd;
+ }
+ public List getJoincmd(){
+ return this.joincmd;
+ }
+ public List getLeavecmd(){
+ return this.leavecmd;
+ }
+ public List getChangecmd(){
+ return this.changecmd;
+ }
void reload(){
config = config.read(file);
this.messageFormat = config.getString("Message.format");
@@ -115,6 +137,11 @@ public final class Configuration {
this.leaveEnabled = config.getBoolean("Leave.enabled");
this.changeEnabled = config.getBoolean("Server-change.enabled");
+ messagecmd = config.getList("Message.commands");
+ joincmd = config.getList("Join.commands");
+ leavecmd = config.getList("Leave.commands");
+ changecmd = config.getList("Server-change.commands");
+
this.minimessage = config.getBoolean("Message-format.minimessage");
all = config.getBoolean("Message.all", false);
}
diff --git a/src/main/java/me/feusalamander/vmessage/Listeners.java b/src/main/java/me/feusalamander/vmessage/Listeners.java
index 613e0f2..5ce039c 100644
--- a/src/main/java/me/feusalamander/vmessage/Listeners.java
+++ b/src/main/java/me/feusalamander/vmessage/Listeners.java
@@ -14,13 +14,9 @@ import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
import net.luckperms.api.LuckPerms;
import net.luckperms.api.LuckPermsProvider;
import net.luckperms.api.cacheddata.CachedMetaData;
-import net.william278.papiproxybridge.api.PlaceholderAPI;
-import net.william278.papiproxybridge.user.OnlineUser;
import java.util.Objects;
import java.util.Optional;
-import java.util.UUID;
-import java.util.concurrent.atomic.AtomicReference;
@SuppressWarnings({"UnstableApiUsage", "deprecation"})
public final class Listeners {
@@ -30,7 +26,6 @@ public final class Listeners {
.build();
public static final MiniMessage mm = MiniMessage.miniMessage();
private LuckPerms luckPermsAPI;
- private PlaceholderAPI placeholderAPI;
private final Configuration configuration;
private final ProxyServer proxyServer;
@@ -38,9 +33,6 @@ public final class Listeners {
if (proxyServer.getPluginManager().getPlugin("luckperms").isPresent()) {
this.luckPermsAPI = LuckPermsProvider.get();
}
- if (proxyServer.getPluginManager().getPlugin("papiproxybridge").isPresent()) {
- this.placeholderAPI = PlaceholderAPI.getInstance();
- }
this.configuration = configuration;
this.proxyServer = proxyServer;
}
@@ -59,13 +51,13 @@ public final class Listeners {
if (!configuration.isLeaveEnabled()) {
return;
}
+ if(!configuration.getLeavecmd().isEmpty())for(String s : configuration.getLeavecmd()){proxyServer.getCommandManager().executeAsync(proxyServer.getConsoleCommandSource(), s);}
final Player p = e.getPlayer();
final Optional server = p.getCurrentServer();
if (server.isEmpty()) {
return;
}
String message = configuration.getLeaveFormat();
- message = placeholder(message, p);
message = message
.replace("#player#", p.getUsername())
.replace("#oldserver#", server.get().getServerInfo().getName());
@@ -91,9 +83,9 @@ public final class Listeners {
if (!configuration.isChangeEnabled()) {
return;
}
+ if(!configuration.getChangecmd().isEmpty())for(String s : configuration.getChangecmd()){proxyServer.getCommandManager().executeAsync(proxyServer.getConsoleCommandSource(), s);}
final ServerConnection actual = serverConnection.get();
String message = configuration.getChangeFormat();
- message = placeholder(message, p);
message = message
.replace("#player#", p.getUsername())
.replace("#oldserver#", pre.getServerInfo().getName())
@@ -110,8 +102,8 @@ public final class Listeners {
if (!configuration.isJoinEnabled()) {
return;
}
+ if(!configuration.getJoincmd().isEmpty())for(String s : configuration.getJoincmd()){proxyServer.getCommandManager().executeAsync(proxyServer.getConsoleCommandSource(), s);}
String message = configuration.getJoinFormat();
- message = placeholder(message, p);
message = message
.replace("#player#", p.getUsername())
.replace("#server#", serverConnection.get().getServerInfo().getName());
@@ -138,16 +130,10 @@ public final class Listeners {
message = message.replace("#prefix#", "").replace("#suffix#", "");
return message;
}
- private String placeholder(String message, final Player player){
- if(placeholderAPI == null)return message;
- UUID p = player.getUniqueId();
- placeholderAPI.formatPlaceholders("Hello %player_name%!", p).thenAccept(formatedd -> {proxyServer.sendMessage(Component.text("test: "+formatedd));});
- return message;
- }
public void message(final Player p, final String m) {
+ if(!configuration.getMessagecmd().isEmpty())for(String s : configuration.getMessagecmd()){proxyServer.getCommandManager().executeAsync(proxyServer.getConsoleCommandSource(), s);}
final boolean permission = p.hasPermission("vmessage.minimessage");
String message = configuration.getMessageFormat();
- message = placeholder(message, p);
message = message
.replace("#player#", p.getUsername())
.replace("#server#", p.getCurrentServer().orElseThrow().getServerInfo().getName());
diff --git a/src/main/java/me/feusalamander/vmessage/VMessage.java b/src/main/java/me/feusalamander/vmessage/VMessage.java
index bc9d145..96d3305 100644
--- a/src/main/java/me/feusalamander/vmessage/VMessage.java
+++ b/src/main/java/me/feusalamander/vmessage/VMessage.java
@@ -17,7 +17,7 @@ import java.nio.file.Path;
@Plugin(
id = "vmessage",
name = "Vmessage",
- version = "1.5.3",
+ version = "1.5.4",
description = "A velocity plugin that creates a multi server chat for the network",
authors = {"FeuSalamander"},
dependencies = {
diff --git a/src/main/resources/config.toml b/src/main/resources/config.toml
index dfa6f67..1972786 100644
--- a/src/main/resources/config.toml
+++ b/src/main/resources/config.toml
@@ -11,6 +11,7 @@ minimessage = false
#- "#server#" : return the player's server name
format = "&a(#server#) #prefix# #player# &8&l> &r#message#"
all = false #if the formated message is sent even in the server where the player is located (can cause some issues with other plugins)
+commands = []
enabled = true
[Join]
#place holders:
@@ -19,6 +20,7 @@ enabled = true
#- "#prefix#" : return the player's luckperms prefix
#- "#suffix#" : return the player's luckperms suffix
format = "&7#prefix# #player# &ejoined &7#server#"
+commands = [] #The proxy commands which are executed (no / in the commands)
enabled = true
[Leave]
#place holders:
@@ -27,6 +29,7 @@ enabled = true
#- "#prefix#" : return the player's luckperms prefix
#- "#suffix#" : return the player's luckperms suffix
format = "#&7prefix# #player# &eleft &7#oldserver#"
+commands = []
enabled = true
[Server-change]
#place holders:
@@ -36,4 +39,5 @@ enabled = true
#- "#oldserver#" : return the previous player's server name
#- "#server#" : return the new player's server name
format = "&7#prefix# #player# &eleft &c#oldserver# &eto join &a#server#"
+commands = []
enabled = true