- 69
- 1
- 2
Зделал фильтрацию ников от привилегей а она просто скипаетса и виводит в else
Java:
@SubscribeEvent
public static void onLivingUpdate(LivingEvent.LivingUpdateEvent event) {
if (event.getEntityLiving() instanceof PlayerEntity) {
PlayerEntity player = (PlayerEntity) event.getEntityLiving();
String input = player.getDisplayName().getString();
Pattern pattern = Pattern.compile("§c\\? §f(.*?) §r");
Matcher matcher = pattern.matcher(input);
Pattern pattern2 = Pattern.compile("\\? Герцог (.*?) §");
Matcher matcher2 = pattern2.matcher(input);
Pattern pattern3 = Pattern.compile("\\? Барон (.*?) §");
Matcher matcher3 = pattern3.matcher(input);
Pattern pattern4 = Pattern.compile("\\? Элита (.*?) §");
Matcher matcher4 = pattern4.matcher(input);
Pattern pattern5 = Pattern.compile("\\? Принц (.*?) §");
Matcher matcher5 = pattern5.matcher(input);
Pattern pattern6 = Pattern.compile("\\? Аспид (.*?) §");
Matcher matcher6 = pattern6.matcher(input);
Pattern pattern7 = Pattern.compile("\\? Титан (.*?) §");
Matcher matcher7 = pattern7.matcher(input);
if (matcher.find()) {
String nickname = matcher.group(1);
System.out.println(nickname);
}
else if (matcher2.find()) {
String nickname = matcher2.group(1);
System.out.println(nickname);
}
else if (matcher3.find()) {
String nickname = matcher3.group(1);
System.out.println(nickname);
}
else if (matcher4.find()) {
String nickname = matcher4.group(1);
System.out.println(nickname);
}
else if (matcher5.find()) {
String nickname = matcher5.group(1);
System.out.println(nickname);
}
else if (matcher6.find()) {
String nickname = matcher6.group(1);
System.out.println(nickname);
}
else if (matcher7.find()) {
String nickname = matcher7.group(1);
System.out.println(nickname);
}
else {System.out.println(input)}
} else if (event.getEntityLiving() instanceof MobEntity) {
MobEntity mob = (MobEntity) event.getEntityLiving();
System.out.println();
}
}