SteamWar/BungeeCore
Archiviert
13
2

discord-bot #230

Manuell gemergt
YoyoNow hat 38 Commits von discord-bot nach master 2021-07-28 23:59:27 +02:00 zusammengeführt
2 geänderte Dateien mit 12 neuen und 9 gelöschten Zeilen
Nur Änderungen aus Commit 398b3e9b5a werden angezeigt - Alle Commits anzeigen

Datei anzeigen

@ -19,6 +19,7 @@
package de.steamwar.bungeecore.bot.config;
import de.steamwar.bungeecore.sql.UserGroup;
import net.md_5.bungee.config.Configuration;
import java.util.ArrayList;
@ -47,7 +48,7 @@ public class SteamwarDiscordBotConfig {
public static String TICKET_CREATED;
public static String TICKET_LOG;
public static Map<String, DiscordTicketType> TICKET_TYPES;
public static Map<String, String> RANKS;
public static Map<UserGroup, String> RANKS;
public static void loadConfig(Configuration config) {
TOKEN = config.getString("token");
@ -101,7 +102,7 @@ public class SteamwarDiscordBotConfig {
RANKS = new HashMap<>();
Configuration ranksSections = config.getSection("ranks");
for (String type : ranksSections.getKeys()) {
RANKS.put(type, ranksSections.getString(type));
RANKS.put(UserGroup.getUsergroup(type), ranksSections.getString(type));
}
}
}

Datei anzeigen

@ -43,16 +43,18 @@ public class DiscordRanks {
if (member == null) {
return;
}
Set<String> toRemove = new HashSet<>(SteamwarDiscordBotConfig.RANKS.keySet());
if (steamwarUser.getUserGroup() != UserGroup.Member) {
toRemove.remove(steamwarUser.getUserGroup().name().toLowerCase());
}
for (String s : toRemove) {
String roleId = SteamwarDiscordBotConfig.RANKS.get(s);
Set<UserGroup> toRemove = new HashSet<>(SteamwarDiscordBotConfig.RANKS.keySet());
toRemove.remove(steamwarUser.getUserGroup());
for (UserGroup userGroup : toRemove) {
System.out.println(steamwarUser + " REMOVING");
String roleId = SteamwarDiscordBotConfig.RANKS.get(userGroup);
guild.removeRoleFromMember(member, guild.getRoleById(roleId)).complete();
}
if (steamwarUser.getUserGroup() != UserGroup.Member) {
guild.addRoleToMember(member, guild.getRoleById(SteamwarDiscordBotConfig.RANKS.get(steamwarUser.getUserGroup().name())));
System.out.println(steamwarUser + " ADDING");
guild.addRoleToMember(member, guild.getRoleById(SteamwarDiscordBotConfig.RANKS.get(steamwarUser.getUserGroup())));
}
}
}