added the "all" option

This commit is contained in:
FeuSalamander 2023-03-13 10:37:12 +01:00
parent 06691820c0
commit 58de2ea259
4 changed files with 18 additions and 6 deletions

View File

@ -18,6 +18,7 @@ public final class Configuration {
private boolean leaveEnabled;
private boolean changeEnabled;
private boolean minimessage;
private boolean all;
private Toml config;
private static File file;
@ -33,6 +34,7 @@ public final class Configuration {
changeEnabled = config.getBoolean("Server-change.enabled", false);
minimessage = config.getBoolean("Message-format.minimessage");
all = config.getBoolean("Message.all", false);
this.config = config;
}
@ -98,6 +100,9 @@ public final class Configuration {
public boolean isMinimessageEnabled(){
return this.minimessage;
}
public boolean isAllEnabled(){
return this.all;
}
void reload(){
config = config.read(file);
this.messageFormat = config.getString("Message.format");
@ -111,5 +116,6 @@ public final class Configuration {
this.changeEnabled = config.getBoolean("Server-change.enabled");
this.minimessage = config.getBoolean("Message-format.minimessage");
all = config.getBoolean("Message.all", false);
}
}

View File

@ -132,10 +132,15 @@ public final class Listeners {
} else {
finalMessage = SERIALIZER.deserialize(message);
}
proxyServer.getAllServers().forEach(server -> {
if (!Objects.equals(p.getCurrentServer().map(ServerConnection::getServerInfo).orElse(null), server.getServerInfo())) {
server.sendMessage(finalMessage);
}
});
if(configuration.isAllEnabled()){
proxyServer.getAllServers().forEach(server -> server.sendMessage(finalMessage));
}else {
proxyServer.getAllServers().forEach(server -> {
if (!Objects.equals(p.getCurrentServer().map(ServerConnection::getServerInfo).orElse(null), server.getServerInfo())) {
server.sendMessage(finalMessage);
}
});
}
}
}

View File

@ -16,7 +16,7 @@ import java.nio.file.Path;
@Plugin(
id = "vmessage",
name = "Vmessage",
version = "1.5.1",
version = "1.5.2",
description = "A velocity plugin that creates a multi server chat for the network",
authors = {"FeuSalamander"},
dependencies = { @Dependency(id = "luckperms", optional = true) }

View File

@ -9,6 +9,7 @@ minimessage = false
#- "#message#" : return the player's message
#- "#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)
enabled = true
[Join]
#place holders: