SteamWar/SpigotCore
Archiviert
13
0

Changing Color on Bauserver #68

Manuell gemergt
Lixfel hat 1 Commits von farb-aendern nach master 2020-11-18 09:51:59 +01:00 zusammengeführt
3 geänderte Dateien mit 57 neuen und 37 gelöschten Zeilen

Datei anzeigen

@ -20,6 +20,7 @@
package de.steamwar.core.events;
import de.steamwar.sql.SteamwarUser;
import de.steamwar.sql.UserGroup;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
@ -34,33 +35,11 @@ public class PlayerJoinedEvent implements Listener{
Player player = event.getPlayer();
SteamwarUser user = SteamwarUser.get(player.getUniqueId());
switch(user.getUserGroup()){
case Admin:
player.setDisplayName("§4Admin " + player.getName() + "§r");
break;
case Developer:
player.setDisplayName("§3Developer " + player.getName() + "§r");
break;
case Moderator:
player.setDisplayName("§bModerator " + player.getName() + "§r");
break;
case Supporter:
player.setDisplayName("§1Supporter " + player.getName() + "§r");
break;
case Builder:
player.setDisplayName("§2Architekt " + player.getName() + "§r");
break;
case Youtuber:
player.setDisplayName("§5Youtuber " + player.getName() + "§r");
break;
case Premium:
player.setDisplayName("§6Premium " + player.getName() + "§r");
break;
case Member:
default:
player.setDisplayName("§7" + player.getName() + "§r");
break;
}
if(user.getUserGroup() != UserGroup.Member) {
UserGroup group = user.getUserGroup();
player.setDisplayName(group.getColorCode() + group.name() + " " + player.getName() + "§r");
} else
player.setDisplayName(user.getUserGroup().getColorCode() + player.getName() + "§r");
event.setJoinMessage("§a§l» §r" + player.getDisplayName());
}

Datei anzeigen

@ -52,7 +52,7 @@ public class SteamwarUser {
id = rs.getInt("id");
uuid = java.util.UUID.fromString(rs.getString("UUID"));
userName = rs.getString("UserName");
userGroup = UserGroup.valueOf(rs.getString("UserGroup"));
userGroup = UserGroup.getUsergroup(rs.getString("UserGroup"));
team = rs.getInt("Team");
bedrock = rs.getBoolean("Bedrock");

Datei anzeigen

@ -19,13 +19,54 @@
package de.steamwar.sql;
import java.util.Arrays;
import java.util.stream.Collectors;
public enum UserGroup {
Admin,
Developer,
Moderator,
Supporter,
Builder,
Youtuber,
Premium,
Member
}
Admin("§4", "§e", true, true, true),
Developer("§3", "§f", true, true, true),
Moderator("§c", "§f", true, true, true),
Supporter("§9", "§f", false, true, true),
Builder("§2", "§f", false, true, false),
YouTuber("§5", "§f", 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, String chatColorCode, boolean adminGroup, boolean teamGroup, boolean checkSchematics) {
this.colorCode = colorCode;
this.chatColorCode = chatColorCode;
this.adminGroup = adminGroup;
this.teamGroup = teamGroup;
this.checkSchematics = checkSchematics;
}
public String getColorCode() {
return colorCode;
}
public boolean isAdminGroup() {
return adminGroup;
}
public boolean isTeamGroup() {
return teamGroup;
}
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);
}
}