geforkt von SteamWar/BungeeCore
Add Chatcolor to UserGroup
Dieser Commit ist enthalten in:
Ursprung
f1bac4c9d2
Commit
edd81c6ca6
@ -27,6 +27,7 @@ import de.steamwar.bungeecore.commands.TpCommand;
|
||||
import de.steamwar.bungeecore.comms.packets.PingPacket;
|
||||
import de.steamwar.bungeecore.sql.SteamwarUser;
|
||||
import de.steamwar.bungeecore.sql.Team;
|
||||
import de.steamwar.bungeecore.sql.UserGroup;
|
||||
import net.md_5.bungee.api.ChatColor;
|
||||
import net.md_5.bungee.api.ChatMessageType;
|
||||
import net.md_5.bungee.api.ProxyServer;
|
||||
@ -158,22 +159,10 @@ public class ChatListener extends BasicListener {
|
||||
|
||||
private void publicChat(SteamwarUser user, ProxiedPlayer sender, String message){
|
||||
String name = sender.getDisplayName();
|
||||
String chatcolor = "§7";
|
||||
String chatcolor = user.getUserGroup().getChatColorCode();
|
||||
|
||||
message = message.replace('§', '&');
|
||||
if(sender.hasPermission("bungeecore.group.admin")){
|
||||
chatcolor = "§e";
|
||||
if(user.getUserGroup() != UserGroup.Member)
|
||||
message = ChatColor.translateAlternateColorCodes('&', message);
|
||||
}else if(
|
||||
sender.hasPermission("bungeecore.group.developer") ||
|
||||
sender.hasPermission("bungeecore.group.moderator") ||
|
||||
sender.hasPermission("bungeecore.group.supporter") ||
|
||||
sender.hasPermission("bungeecore.group.builder")){
|
||||
chatcolor = "§r";
|
||||
message = ChatColor.translateAlternateColorCodes('&', message);
|
||||
}else if(sender.hasPermission("bungeecore.group.youtuber")){
|
||||
message = ChatColor.translateAlternateColorCodes('&', message);
|
||||
}
|
||||
|
||||
String msg = name + "§7»" + chatcolor + " " + message;
|
||||
if(user.getTeam() != 0){
|
||||
|
@ -68,7 +68,7 @@ public class SteamwarUser {
|
||||
id = rs.getInt("id");
|
||||
uuid = UUID.fromString(rs.getString("UUID"));
|
||||
userName = rs.getString("UserName");
|
||||
userGroup = UserGroup.valueOf(rs.getString("UserGroup").toUpperCase());
|
||||
userGroup = UserGroup.getUsergroup(rs.getString("UserGroup"));
|
||||
banTime = rs.getTimestamp("BanTime");
|
||||
banReason = rs.getString("BanReason");
|
||||
team = rs.getInt("Team");
|
||||
@ -90,7 +90,7 @@ public class SteamwarUser {
|
||||
user.userName = userName;
|
||||
}
|
||||
}else{
|
||||
SQL.update("INSERT INTO UserData (UUID, UserName, UserGroup) VALUES (?, ?, ?)", connection.getUniqueId().toString(), connection.getName(), UserGroup.Member.name());
|
||||
SQL.update("INSERT INTO UserData (UUID, UserName, UserGroup) VALUES (?, ?, 'Member')", connection.getUniqueId().toString(), connection.getName());
|
||||
user = dbInit(SQL.select("SELECT * FROM UserData WHERE UUID = ?", connection.getUniqueId().toString()));
|
||||
if(user == null)
|
||||
throw new SecurityException("user == null");
|
||||
|
@ -19,23 +19,28 @@
|
||||
|
||||
package de.steamwar.bungeecore.sql;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public enum UserGroup {
|
||||
|
||||
Admin("§4", true, true, true),
|
||||
Developer("§3", true, true, true),
|
||||
Moderator("§c", true, true, true),
|
||||
Supporter("§6", false, true, true),
|
||||
Builder("§2", false, true, false),
|
||||
Youtuber("§5", false, false, false),
|
||||
Member("§7", false, false, false);
|
||||
Admin("§4", "§e", true, true, true),
|
||||
Developer("§3", "§f", true, true, true),
|
||||
Moderator("§c", "§f", true, true, true),
|
||||
Supporter("§6", "§f", false, true, true),
|
||||
Builder("§2", "§f", false, true, false),
|
||||
Youtuber("§5", "§7", false, false, false),
|
||||
Member("§7", "§7", false, false, false);
|
||||
|
||||
private final String colorCode;
|
||||
private final String chatColorCode;
|
||||
private final boolean adminGroup;
|
||||
private final boolean teamGroup;
|
||||
private final boolean checkSchematics;
|
||||
|
||||
UserGroup(String colorCode, boolean adminGroup, boolean teamGroup, boolean checkSchematics) {
|
||||
UserGroup(String colorCode, String chatColorCode, boolean adminGroup, boolean teamGroup, boolean checkSchematics) {
|
||||
this.colorCode = colorCode;
|
||||
this.chatColorCode = chatColorCode;
|
||||
this.adminGroup = adminGroup;
|
||||
this.teamGroup = teamGroup;
|
||||
this.checkSchematics = checkSchematics;
|
||||
@ -56,4 +61,12 @@ public enum UserGroup {
|
||||
public boolean isCheckSchematics() {
|
||||
return checkSchematics;
|
||||
}
|
||||
|
||||
public String getChatColorCode() {
|
||||
return chatColorCode;
|
||||
}
|
||||
|
||||
public static UserGroup getUsergroup(String name) {
|
||||
return Arrays.stream(UserGroup.values()).filter(userGroup -> userGroup.name().equalsIgnoreCase(name)).collect(Collectors.toList()).get(0);
|
||||
}
|
||||
}
|
In neuem Issue referenzieren
Einen Benutzer sperren