Archiviert
1
0

Adding mod type only usable by YouTubers (and Teammembers)

Dieser Commit ist enthalten in:
Lixfel 2020-01-03 17:09:58 +01:00
Ursprung 9e09ed089e
Commit 767e4a24f3
3 geänderte Dateien mit 15 neuen und 4 gelöschten Zeilen

Datei anzeigen

@ -26,6 +26,7 @@ public class ConnectionListener extends BasicListener {
private static final String ADMIN_GROUP = "admin";
private static final String TEAM_GROUP = "team";
private static final String YOUTUBER_MODS = "bungeecore.youtubermods";
@EventHandler
public void onPostLogin(PostLoginEvent event) {
@ -36,30 +37,36 @@ public class ConnectionListener extends BasicListener {
case "Admin":
player.addGroups(ADMIN_GROUP, TEAM_GROUP);
player.setPermission("bungeecore.group.admin", true);
player.setPermission(YOUTUBER_MODS, true);
player.setDisplayName("§4Admin " + player.getName() + "§r");
break;
case "Developer":
player.addGroups(ADMIN_GROUP, TEAM_GROUP);
player.setPermission("bungeecore.group.developer", true);
player.setPermission(YOUTUBER_MODS, true);
player.setDisplayName("§3Developer " + player.getName() + "§r");
break;
case "Moderator":
player.addGroups(ADMIN_GROUP, TEAM_GROUP);
player.setPermission("bungeecore.group.moderator", true);
player.setPermission(YOUTUBER_MODS, true);
player.setDisplayName("§bModerator " + player.getName() + "§r");
break;
case "Supporter":
player.addGroups(TEAM_GROUP);
player.setPermission("bungeecore.group.supporter", true);
player.setPermission(YOUTUBER_MODS, true);
player.setDisplayName("§1Supporter " + player.getName() + "§r");
break;
case "Builder":
player.addGroups(TEAM_GROUP);
player.setPermission("bungeecore.group.builder", true);
player.setPermission(YOUTUBER_MODS, true);
player.setDisplayName("§2Architekt " + player.getName() + "§r");
break;
case "Youtuber":
player.setPermission("bungeecore.group.youtuber", true);
player.setPermission(YOUTUBER_MODS, true);
player.setDisplayName("§5Youtuber " + player.getName() + "§r");
break;
case "Member":

Datei anzeigen

@ -35,11 +35,14 @@ class Utils {
}
static boolean handleMods(ProxiedPlayer player, List<Mod> mods){
SteamwarUser user = SteamwarUser.get(player.getUniqueId());
boolean privileged = player.hasPermission("bungeecore.youtubermods");
ModType max = ModType.YELLOW;
Iterator<Mod> it = mods.iterator();
while(it.hasNext()){
Mod mod = it.next();
if(mod.getModType() == ModType.UNKLASSIFIED || mod.getModType() == ModType.GREEN)
if(mod.getModType() == ModType.UNKLASSIFIED || mod.getModType() == ModType.GREEN || (mod.getModType() == ModType.YOUTUBER_ONLY && privileged))
it.remove();
else if(mod.getModType() == ModType.RED)
max = ModType.RED;
@ -52,7 +55,7 @@ class Utils {
if(max == ModType.YELLOW)
player.disconnect(BungeeCore.stringToText("§7Deaktiviere den Mod §e" + mods.get(0).getModName() + "§7, um weiter auf §eSteam§8War §7spielen zu können."));
else
SteamwarUser.get(player.getUniqueId()).ban(Timestamp.from(Instant.now().plus(1, ChronoUnit.DAYS)), "Versuchte Benutzung des Mods " + mods.get(0).getModName());
user.ban(Timestamp.from(Instant.now().plus(1, ChronoUnit.DAYS)), "Versuchte Benutzung des Mods " + mods.get(0).getModName());
}else{
StringBuilder sb = new StringBuilder();
mods.forEach(mod -> sb.append(mod.getModName()).append('\n'));
@ -60,7 +63,7 @@ class Utils {
if(max == ModType.YELLOW)
player.disconnect(BungeeCore.stringToText("§7Deaktiviere die Mods\n§e" + sb.toString() + "§7um weiter auf §eSteam§8War §7spielen zu können."));
else
SteamwarUser.get(player.getUniqueId()).ban(Timestamp.from(Instant.now().plus(1, ChronoUnit.DAYS)), "Versuchte Benutzung der Mods\n" + sb.toString());
user.ban(Timestamp.from(Instant.now().plus(1, ChronoUnit.DAYS)), "Versuchte Benutzung der Mods\n" + sb.toString());
}
return false;

Datei anzeigen

@ -59,7 +59,8 @@ public class Mod {
UNKLASSIFIED(0),
GREEN(1),
YELLOW(2),
RED(3);
RED(3),
YOUTUBER_ONLY(4);
static ModType valueOf(int value){
for(ModType mt : values()){