added silent permission, added server aliases
This commit is contained in:
parent
68f4824593
commit
fbb1d57d54
@ -12,4 +12,5 @@
|
|||||||
- **MiniMessage support**
|
- **MiniMessage support**
|
||||||
![](https://github.com/FeuSalamander/Vmessage/blob/main/src/main/resources/permissions.png?raw=true)
|
![](https://github.com/FeuSalamander/Vmessage/blob/main/src/main/resources/permissions.png?raw=true)
|
||||||
- **"vmessage.reload" to access to the reload command**
|
- **"vmessage.reload" to access to the reload command**
|
||||||
- **"vmessage.minimessage" the player need to have it to use MiniMessage in his messages**
|
- **"vmessage.minimessage" the player needs to have it to use MiniMessage in his messages**
|
||||||
|
- **"vmessage.silent. leave,change, join" if the player have it/them, no message will be sent**
|
||||||
|
2
pom.xml
2
pom.xml
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
<groupId>Vmessage</groupId>
|
<groupId>Vmessage</groupId>
|
||||||
<artifactId>Vmessage</artifactId>
|
<artifactId>Vmessage</artifactId>
|
||||||
<version>1.5.5Pre</version>
|
<version>1.5.6</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<name>Vmessage</name>
|
<name>Vmessage</name>
|
||||||
|
@ -26,6 +26,7 @@ public final class Configuration {
|
|||||||
private List<String> joincmd;
|
private List<String> joincmd;
|
||||||
private List<String> leavecmd;
|
private List<String> leavecmd;
|
||||||
private List<String> changecmd;
|
private List<String> changecmd;
|
||||||
|
private Toml aliases;
|
||||||
|
|
||||||
Configuration(Toml config) {
|
Configuration(Toml config) {
|
||||||
messageFormat = config.getString("Message.format", "");
|
messageFormat = config.getString("Message.format", "");
|
||||||
@ -38,11 +39,12 @@ public final class Configuration {
|
|||||||
leaveEnabled = config.getBoolean("Leave.enabled", false);
|
leaveEnabled = config.getBoolean("Leave.enabled", false);
|
||||||
changeEnabled = config.getBoolean("Server-change.enabled", false);
|
changeEnabled = config.getBoolean("Server-change.enabled", false);
|
||||||
|
|
||||||
|
aliases = config.getTable("Aliases");
|
||||||
|
|
||||||
messagecmd = config.getList("Message.commands");
|
messagecmd = config.getList("Message.commands");
|
||||||
joincmd = config.getList("Join.commands");
|
joincmd = config.getList("Join.commands");
|
||||||
leavecmd = config.getList("Leave.commands");
|
leavecmd = config.getList("Leave.commands");
|
||||||
changecmd = config.getList("Server-change.commands");
|
changecmd = config.getList("Server-change.commands");
|
||||||
|
|
||||||
minimessage = config.getBoolean("Message-format.minimessage");
|
minimessage = config.getBoolean("Message-format.minimessage");
|
||||||
all = config.getBoolean("Message.all", false);
|
all = config.getBoolean("Message.all", false);
|
||||||
this.config = config;
|
this.config = config;
|
||||||
@ -125,6 +127,9 @@ public final class Configuration {
|
|||||||
public List<String> getChangecmd(){
|
public List<String> getChangecmd(){
|
||||||
return this.changecmd;
|
return this.changecmd;
|
||||||
}
|
}
|
||||||
|
public Toml getAliases() {
|
||||||
|
return aliases;
|
||||||
|
}
|
||||||
void reload(){
|
void reload(){
|
||||||
config = config.read(file);
|
config = config.read(file);
|
||||||
this.messageFormat = config.getString("Message.format");
|
this.messageFormat = config.getString("Message.format");
|
||||||
@ -137,12 +142,14 @@ public final class Configuration {
|
|||||||
this.leaveEnabled = config.getBoolean("Leave.enabled");
|
this.leaveEnabled = config.getBoolean("Leave.enabled");
|
||||||
this.changeEnabled = config.getBoolean("Server-change.enabled");
|
this.changeEnabled = config.getBoolean("Server-change.enabled");
|
||||||
|
|
||||||
messagecmd = config.getList("Message.commands");
|
this.aliases = config.getTable("Aliases");
|
||||||
joincmd = config.getList("Join.commands");
|
|
||||||
leavecmd = config.getList("Leave.commands");
|
this.messagecmd = config.getList("Message.commands");
|
||||||
changecmd = config.getList("Server-change.commands");
|
this.joincmd = config.getList("Join.commands");
|
||||||
|
this.leavecmd = config.getList("Leave.commands");
|
||||||
|
this.changecmd = config.getList("Server-change.commands");
|
||||||
|
|
||||||
this.minimessage = config.getBoolean("Message-format.minimessage");
|
this.minimessage = config.getBoolean("Message-format.minimessage");
|
||||||
all = config.getBoolean("Message.all", false);
|
this.all = config.getBoolean("Message.all", false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -55,18 +55,24 @@ public final class Listeners {
|
|||||||
if (!e.getLoginStatus().equals(DisconnectEvent.LoginStatus.SUCCESSFUL_LOGIN)){
|
if (!e.getLoginStatus().equals(DisconnectEvent.LoginStatus.SUCCESSFUL_LOGIN)){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if(e.getPlayer().hasPermission("vmessage.silent.leave")){
|
||||||
|
return;
|
||||||
|
}
|
||||||
final Player p = e.getPlayer();
|
final Player p = e.getPlayer();
|
||||||
final Optional<ServerConnection> server = p.getCurrentServer();
|
final Optional<ServerConnection> server = p.getCurrentServer();
|
||||||
if (server.isEmpty()) {
|
if (server.isEmpty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
String message = configuration.getLeaveFormat();
|
String message = configuration.getLeaveFormat();
|
||||||
|
String servername = server.get().getServerInfo().getName();
|
||||||
|
if(configuration.getAliases().contains(servername)){
|
||||||
|
servername = configuration.getAliases().getString(servername);
|
||||||
|
}
|
||||||
if(configuration.getLeavecmd() != null&&!configuration.getLeavecmd().isEmpty())
|
if(configuration.getLeavecmd() != null&&!configuration.getLeavecmd().isEmpty())
|
||||||
for(String s : configuration.getLeavecmd()){
|
for(String s : configuration.getLeavecmd()){
|
||||||
s = s
|
s = s
|
||||||
.replace("#player#", p.getUsername())
|
.replace("#player#", p.getUsername())
|
||||||
.replace("#oldserver#", server.get().getServerInfo().getName());
|
.replace("#oldserver#", servername);
|
||||||
if (luckPermsAPI != null) {
|
if (luckPermsAPI != null) {
|
||||||
s = luckperms(s, p);
|
s = luckperms(s, p);
|
||||||
}
|
}
|
||||||
@ -75,7 +81,7 @@ public final class Listeners {
|
|||||||
if(message.isEmpty())return;
|
if(message.isEmpty())return;
|
||||||
message = message
|
message = message
|
||||||
.replace("#player#", p.getUsername())
|
.replace("#player#", p.getUsername())
|
||||||
.replace("#oldserver#", server.get().getServerInfo().getName());
|
.replace("#oldserver#", servername);
|
||||||
if (luckPermsAPI != null) {
|
if (luckPermsAPI != null) {
|
||||||
message = luckperms(message, p);
|
message = luckperms(message, p);
|
||||||
}
|
}
|
||||||
@ -98,14 +104,25 @@ public final class Listeners {
|
|||||||
if (!configuration.isChangeEnabled()) {
|
if (!configuration.isChangeEnabled()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if(e.getPlayer().hasPermission("vmessage.silent.change")){
|
||||||
|
return;
|
||||||
|
}
|
||||||
final ServerConnection actual = serverConnection.get();
|
final ServerConnection actual = serverConnection.get();
|
||||||
String message = configuration.getChangeFormat();
|
String message = configuration.getChangeFormat();
|
||||||
|
String actualservername = actual.getServerInfo().getName();
|
||||||
|
if(configuration.getAliases().contains(actualservername)){
|
||||||
|
actualservername = configuration.getAliases().getString(actualservername);
|
||||||
|
}
|
||||||
|
String oldservername = pre.getServerInfo().getName();
|
||||||
|
if(configuration.getAliases().containsTable(oldservername)){
|
||||||
|
oldservername = configuration.getAliases().getString(oldservername);
|
||||||
|
}
|
||||||
if(configuration.getChangecmd() != null&&!configuration.getChangecmd().isEmpty())
|
if(configuration.getChangecmd() != null&&!configuration.getChangecmd().isEmpty())
|
||||||
for(String s : configuration.getChangecmd()){
|
for(String s : configuration.getChangecmd()){
|
||||||
s = s
|
s = s
|
||||||
.replace("#player#", p.getUsername())
|
.replace("#player#", p.getUsername())
|
||||||
.replace("#oldserver#", pre.getServerInfo().getName())
|
.replace("#oldserver#", oldservername)
|
||||||
.replace("#server#", actual.getServerInfo().getName());
|
.replace("#server#", actualservername);
|
||||||
if (luckPermsAPI != null) {
|
if (luckPermsAPI != null) {
|
||||||
s = luckperms(s, p);
|
s = luckperms(s, p);
|
||||||
}
|
}
|
||||||
@ -114,8 +131,8 @@ public final class Listeners {
|
|||||||
if(message.isEmpty())return;
|
if(message.isEmpty())return;
|
||||||
message = message
|
message = message
|
||||||
.replace("#player#", p.getUsername())
|
.replace("#player#", p.getUsername())
|
||||||
.replace("#oldserver#", pre.getServerInfo().getName())
|
.replace("#oldserver#", oldservername)
|
||||||
.replace("#server#", actual.getServerInfo().getName());
|
.replace("#server#", actualservername);
|
||||||
if (luckPermsAPI != null) {
|
if (luckPermsAPI != null) {
|
||||||
message = luckperms(message, p);
|
message = luckperms(message, p);
|
||||||
}
|
}
|
||||||
@ -128,11 +145,18 @@ public final class Listeners {
|
|||||||
if (!configuration.isJoinEnabled()) {
|
if (!configuration.isJoinEnabled()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if(e.getPlayer().hasPermission("vmessage.silent.join")){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
String actualservername = serverConnection.get().getServerInfo().getName();
|
||||||
|
if(configuration.getAliases().contains(actualservername)){
|
||||||
|
actualservername = configuration.getAliases().getString(actualservername);
|
||||||
|
}
|
||||||
if(configuration.getJoincmd() != null&&!configuration.getJoincmd().isEmpty())
|
if(configuration.getJoincmd() != null&&!configuration.getJoincmd().isEmpty())
|
||||||
for(String s : configuration.getJoincmd()){
|
for(String s : configuration.getJoincmd()){
|
||||||
s = s
|
s = s
|
||||||
.replace("#player#", p.getUsername())
|
.replace("#player#", p.getUsername())
|
||||||
.replace("#server#", serverConnection.get().getServerInfo().getName());
|
.replace("#server#", actualservername);
|
||||||
if (luckPermsAPI != null) {
|
if (luckPermsAPI != null) {
|
||||||
s = luckperms(s, p);
|
s = luckperms(s, p);
|
||||||
}
|
}
|
||||||
@ -142,7 +166,7 @@ public final class Listeners {
|
|||||||
if(message.isEmpty())return;
|
if(message.isEmpty())return;
|
||||||
message = message
|
message = message
|
||||||
.replace("#player#", p.getUsername())
|
.replace("#player#", p.getUsername())
|
||||||
.replace("#server#", serverConnection.get().getServerInfo().getName());
|
.replace("#server#", actualservername);
|
||||||
if (luckPermsAPI != null) {
|
if (luckPermsAPI != null) {
|
||||||
message = luckperms(message, p);
|
message = luckperms(message, p);
|
||||||
}
|
}
|
||||||
@ -167,11 +191,15 @@ public final class Listeners {
|
|||||||
return message;
|
return message;
|
||||||
}
|
}
|
||||||
public void message(final Player p, final String m) {
|
public void message(final Player p, final String m) {
|
||||||
|
String actualservername = p.getCurrentServer().orElseThrow().getServerInfo().getName();
|
||||||
|
if(configuration.getAliases().contains(actualservername)){
|
||||||
|
actualservername = configuration.getAliases().getString(actualservername);
|
||||||
|
}
|
||||||
if(configuration.getMessagecmd() != null&&!configuration.getMessagecmd().isEmpty())
|
if(configuration.getMessagecmd() != null&&!configuration.getMessagecmd().isEmpty())
|
||||||
for(String s : configuration.getMessagecmd()){
|
for(String s : configuration.getMessagecmd()){
|
||||||
s = s
|
s = s
|
||||||
.replace("#player#", p.getUsername())
|
.replace("#player#", p.getUsername())
|
||||||
.replace("#server#", p.getCurrentServer().orElseThrow().getServerInfo().getName());
|
.replace("#server#", actualservername);
|
||||||
if (luckPermsAPI != null) {
|
if (luckPermsAPI != null) {
|
||||||
s = luckperms(s, p);
|
s = luckperms(s, p);
|
||||||
}
|
}
|
||||||
@ -182,7 +210,7 @@ public final class Listeners {
|
|||||||
final boolean permission = p.hasPermission("vmessage.minimessage");
|
final boolean permission = p.hasPermission("vmessage.minimessage");
|
||||||
message = message
|
message = message
|
||||||
.replace("#player#", p.getUsername())
|
.replace("#player#", p.getUsername())
|
||||||
.replace("#server#", p.getCurrentServer().orElseThrow().getServerInfo().getName());
|
.replace("#server#", actualservername);
|
||||||
if (luckPermsAPI != null) {
|
if (luckPermsAPI != null) {
|
||||||
message = luckperms(message, p);
|
message = luckperms(message, p);
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,7 @@ import java.nio.file.Path;
|
|||||||
@Plugin(
|
@Plugin(
|
||||||
id = "vmessage",
|
id = "vmessage",
|
||||||
name = "Vmessage",
|
name = "Vmessage",
|
||||||
version = "1.5.5Pre",
|
version = "1.6.0",
|
||||||
description = "A velocity plugin that creates a multi server chat for the network",
|
description = "A velocity plugin that creates a multi server chat for the network",
|
||||||
authors = {"FeuSalamander"},
|
authors = {"FeuSalamander"},
|
||||||
dependencies = {
|
dependencies = {
|
||||||
|
@ -41,3 +41,5 @@ enabled = true
|
|||||||
format = "&7#prefix# #player# &eleft &c#oldserver# &eto join &a#server#"
|
format = "&7#prefix# #player# &eleft &c#oldserver# &eto join &a#server#"
|
||||||
commands = []
|
commands = []
|
||||||
enabled = true
|
enabled = true
|
||||||
|
[Aliases]
|
||||||
|
servername = "Server Name"
|
||||||
|
Loading…
Reference in New Issue
Block a user