mirror of
https://github.com/LuckPerms/LuckPerms.git
synced 2025-02-20 06:21:55 +01:00
Only store prefix in one place
This commit is contained in:
parent
ad9b190a7c
commit
69ab488c47
@ -3,9 +3,9 @@ package me.lucko.luckperms.listeners;
|
||||
import lombok.AllArgsConstructor;
|
||||
import me.lucko.luckperms.LPBukkitPlugin;
|
||||
import me.lucko.luckperms.commands.Util;
|
||||
import me.lucko.luckperms.constants.Message;
|
||||
import me.lucko.luckperms.users.BukkitUser;
|
||||
import me.lucko.luckperms.users.User;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
@ -22,7 +22,7 @@ public class PlayerListener implements Listener {
|
||||
public void onPlayerPreLogin(AsyncPlayerPreLoginEvent e) {
|
||||
if (!plugin.getDatastore().isAcceptingLogins()) {
|
||||
e.disallow(AsyncPlayerPreLoginEvent.Result.KICK_OTHER,
|
||||
color(Util.PREFIX + "Error whilst validating login with the network. \nPlease contact an administrator."));
|
||||
Util.color(Message.PREFIX + "Error whilst validating login with the network. \nPlease contact an administrator."));
|
||||
return;
|
||||
}
|
||||
plugin.getDatastore().loadOrCreateUser(e.getUniqueId(), e.getName());
|
||||
@ -35,7 +35,7 @@ public class PlayerListener implements Listener {
|
||||
|
||||
if (user == null) {
|
||||
e.disallow(PlayerLoginEvent.Result.KICK_OTHER,
|
||||
color(Util.PREFIX + "User data could not be loaded. Please contact an administrator."));
|
||||
Util.color(Message.PREFIX + "User data could not be loaded. Please contact an administrator."));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -69,8 +69,4 @@ public class PlayerListener implements Listener {
|
||||
plugin.getUserManager().unloadUser(user);
|
||||
}
|
||||
|
||||
private static String color(String string) {
|
||||
return ChatColor.translateAlternateColorCodes('&', string);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ package me.lucko.luckperms.listeners;
|
||||
import lombok.AllArgsConstructor;
|
||||
import me.lucko.luckperms.LPBungeePlugin;
|
||||
import me.lucko.luckperms.commands.Util;
|
||||
import me.lucko.luckperms.constants.Message;
|
||||
import me.lucko.luckperms.users.User;
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
||||
@ -29,7 +30,7 @@ public class PlayerListener implements Listener {
|
||||
plugin.getProxy().getScheduler().schedule(plugin, () -> {
|
||||
final ProxiedPlayer pl = p.get();
|
||||
if (pl != null) {
|
||||
pl.sendMessage(new TextComponent(Util.color(Util.PREFIX + "Permissions data could not be loaded. Please contact an administrator.")));
|
||||
pl.sendMessage(new TextComponent(Util.color(Message.PREFIX + "Permissions data could not be loaded. Please contact an administrator.")));
|
||||
}
|
||||
}, 3, TimeUnit.SECONDS);
|
||||
|
||||
|
@ -1,15 +1,17 @@
|
||||
package me.lucko.luckperms.commands;
|
||||
|
||||
import me.lucko.luckperms.constants.Message;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
public class Util {
|
||||
|
||||
public static final String PREFIX = "&7&l[&b&lL&a&lP&7&l] &c";
|
||||
private Util() {}
|
||||
|
||||
public static void sendPluginMessage(Sender sender, String message) {
|
||||
sender.sendMessage(color(PREFIX + message));
|
||||
sender.sendMessage(color(Message.PREFIX + message));
|
||||
}
|
||||
|
||||
public static String color(String s) {
|
||||
|
Loading…
Reference in New Issue
Block a user