Changing Color on Bauservers
Dieser Commit ist enthalten in:
Ursprung
6bdb25a3c1
Commit
9bdc4b2f1d
@ -20,6 +20,7 @@
|
|||||||
package de.steamwar.core.events;
|
package de.steamwar.core.events;
|
||||||
|
|
||||||
import de.steamwar.sql.SteamwarUser;
|
import de.steamwar.sql.SteamwarUser;
|
||||||
|
import de.steamwar.sql.UserGroup;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
@ -34,33 +35,11 @@ public class PlayerJoinedEvent implements Listener{
|
|||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
SteamwarUser user = SteamwarUser.get(player.getUniqueId());
|
SteamwarUser user = SteamwarUser.get(player.getUniqueId());
|
||||||
|
|
||||||
switch(user.getUserGroup()){
|
if(user.getUserGroup() != UserGroup.Member) {
|
||||||
case Admin:
|
UserGroup group = user.getUserGroup();
|
||||||
player.setDisplayName("§4Admin " + player.getName() + "§r");
|
player.setDisplayName(group.getColorCode() + group.name() + " " + player.getName() + "§r");
|
||||||
break;
|
} else
|
||||||
case Developer:
|
player.setDisplayName(user.getUserGroup().getColorCode() + player.getName() + "§r");
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
event.setJoinMessage("§a§l» §r" + player.getDisplayName());
|
event.setJoinMessage("§a§l» §r" + player.getDisplayName());
|
||||||
}
|
}
|
||||||
|
@ -52,7 +52,7 @@ public class SteamwarUser {
|
|||||||
id = rs.getInt("id");
|
id = rs.getInt("id");
|
||||||
uuid = java.util.UUID.fromString(rs.getString("UUID"));
|
uuid = java.util.UUID.fromString(rs.getString("UUID"));
|
||||||
userName = rs.getString("UserName");
|
userName = rs.getString("UserName");
|
||||||
userGroup = UserGroup.valueOf(rs.getString("UserGroup"));
|
userGroup = UserGroup.getUsergroup(rs.getString("UserGroup"));
|
||||||
team = rs.getInt("Team");
|
team = rs.getInt("Team");
|
||||||
bedrock = rs.getBoolean("Bedrock");
|
bedrock = rs.getBoolean("Bedrock");
|
||||||
|
|
||||||
|
@ -19,13 +19,54 @@
|
|||||||
|
|
||||||
package de.steamwar.sql;
|
package de.steamwar.sql;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
public enum UserGroup {
|
public enum UserGroup {
|
||||||
Admin,
|
|
||||||
Developer,
|
Admin("§4", "§e", true, true, true),
|
||||||
Moderator,
|
Developer("§3", "§f", true, true, true),
|
||||||
Supporter,
|
Moderator("§c", "§f", true, true, true),
|
||||||
Builder,
|
Supporter("§9", "§f", false, true, true),
|
||||||
Youtuber,
|
Builder("§2", "§f", false, true, false),
|
||||||
Premium,
|
YouTuber("§5", "§f", false, false, false),
|
||||||
Member
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
In neuem Issue referenzieren
Einen Benutzer sperren