suffix added, luckperms rework
This commit is contained in:
parent
73ac5f0fc8
commit
103cac68fb
@ -16,6 +16,8 @@ import net.luckperms.api.LuckPerms;
|
||||
import net.luckperms.api.LuckPermsProvider;
|
||||
import net.luckperms.api.model.user.User;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
|
||||
@ -48,8 +50,7 @@ public final class Listeners {
|
||||
.replace("#message#", m)
|
||||
.replace("#server#", p.getCurrentServer().orElseThrow().getServerInfo().getName());
|
||||
if (luckPermsAPI != null){
|
||||
User user = luckPermsAPI.getPlayerAdapter(Player.class).getUser(p);
|
||||
message = message.replace("#prefix#", Objects.requireNonNull(user.getCachedData().getMetaData().getPrefix()));
|
||||
message = luckperms(message, p);
|
||||
}
|
||||
final String finalMessage = message;
|
||||
proxyServer.getAllServers().forEach(server -> {
|
||||
@ -67,8 +68,7 @@ public final class Listeners {
|
||||
String message = configuration.getLeaveFormat()
|
||||
.replace("#player#", p.getUsername());
|
||||
if (luckPermsAPI != null){
|
||||
User user = luckPermsAPI.getPlayerAdapter(Player.class).getUser(p);
|
||||
message = message.replace("#prefix#", Objects.requireNonNull(user.getCachedData().getMetaData().getPrefix()));
|
||||
message = luckperms(message, p);
|
||||
}
|
||||
proxyServer.sendMessage(SERIALIZER.deserialize(message));
|
||||
}
|
||||
@ -91,8 +91,7 @@ public final class Listeners {
|
||||
.replace("#oldserver#", pre.getServerInfo().getName())
|
||||
.replace("#server#", actual.getServerInfo().getName());
|
||||
if (luckPermsAPI != null){
|
||||
User user = luckPermsAPI.getPlayerAdapter(Player.class).getUser(p);
|
||||
message = message.replace("#prefix#", Objects.requireNonNull(user.getCachedData().getMetaData().getPrefix()));
|
||||
message = luckperms(message, p);
|
||||
}
|
||||
proxyServer.sendMessage(SERIALIZER.deserialize(message));
|
||||
}else{
|
||||
@ -101,10 +100,19 @@ public final class Listeners {
|
||||
}
|
||||
String message = configuration.getJoinFormat().replace("#player#", p.getUsername());
|
||||
if (luckPermsAPI != null){
|
||||
User user = luckPermsAPI.getPlayerAdapter(Player.class).getUser(p);
|
||||
message = message.replace("#prefix#", Objects.requireNonNull(user.getCachedData().getMetaData().getPrefix()));
|
||||
message = luckperms(message, p);
|
||||
}
|
||||
proxyServer.sendMessage(SERIALIZER.deserialize(message));
|
||||
}
|
||||
}
|
||||
private String luckperms(String message, Player p){
|
||||
User user = luckPermsAPI.getPlayerAdapter(Player.class).getUser(p);
|
||||
if(message.contains("#prefix#")){
|
||||
message = message.replace("#prefix#", Objects.requireNonNull(user.getCachedData().getMetaData().getPrefix()));
|
||||
}
|
||||
if(message.contains("#suffix#")){
|
||||
message = message.replace("#suffix#", Objects.requireNonNull(user.getCachedData().getMetaData().getSuffix()));
|
||||
}
|
||||
return message;
|
||||
}
|
||||
}
|
||||
|
@ -1,8 +1,6 @@
|
||||
package me.feusalamander.vmessage;
|
||||
import com.velocitypowered.api.command.CommandSource;
|
||||
import com.velocitypowered.api.command.SimpleCommand;
|
||||
import com.velocitypowered.api.plugin.annotation.DataDirectory;
|
||||
|
||||
import java.nio.file.Path;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.List;
|
||||
@ -17,7 +15,6 @@ public final class ReloadCommand implements SimpleCommand {
|
||||
|
||||
@Override
|
||||
public void execute(final Invocation invocation) {
|
||||
CommandSource source = invocation.source();
|
||||
String[] args = invocation.arguments();
|
||||
if(args.length == 1){
|
||||
return;
|
||||
|
@ -1,7 +1,8 @@
|
||||
[Message]
|
||||
#place holders:
|
||||
#- "#player#" : return the player name
|
||||
#- "#prefix#" : return the player's luckperms prefix (don't place it if you don't have luckperms on your server)
|
||||
#- "#prefix#" : return the player's luckperms prefix
|
||||
#- "#suffix#" : return the player's luckperms suffix
|
||||
#- "#message#" : return the player's message
|
||||
#- "#server#" : return the player's server name
|
||||
format = "&a(#server#) #prefix# #player# &8&l> &r#message#"
|
||||
@ -9,19 +10,22 @@ enabled = true
|
||||
[Join]
|
||||
#place holders:
|
||||
#- "#player#" : return the player name
|
||||
#- "#prefix#" : return the player's luckperms prefix (don't place it if you don't have luckperms on your server)
|
||||
#- "#prefix#" : return the player's luckperms prefix
|
||||
#- "#suffix#" : return the player's luckperms suffix
|
||||
format = "&7#prefix# #player# &ejoined the network"
|
||||
enabled = true
|
||||
[Leave]
|
||||
#place holders:
|
||||
#- "#player#" : return the player name
|
||||
#- "#prefix#" : return the player's luckperms prefix (don't place it if you don't have luckperms on your server)
|
||||
#- "#prefix#" : return the player's luckperms prefix
|
||||
#- "#suffix#" : return the player's luckperms suffix
|
||||
format = "#&7prefix# #player# &eleft the network"
|
||||
enabled = true
|
||||
[Server-change]
|
||||
#place holders:
|
||||
#- "#player#" : return the player name
|
||||
#- "#prefix#" : return the player's luckperms prefix (don't place it if you don't have luckperms on your server)
|
||||
#- "#prefix#" : return the player's luckperms prefix
|
||||
#- "#suffix#" : return the player's luckperms suffix
|
||||
#- "#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#"
|
||||
|
Loading…
Reference in New Issue
Block a user