-
Автор темы
- #1
2.15. Запрещено редактировать название темы или своё сообщение на «/del» во всех случаях (продажа аккаунта, получение ответа на свой вопрос и так далее), кроме флуда.
с ластовыми обходами серверов :)
Код:
public final Dragging staffListDrag = FwmProject.getInstance().createDrag(this, "staffListDrag", 5, 60);
private static final Pattern validUserPattern = Pattern.compile("^\\w{3,16}$");
List<String> players = new ArrayList<>();
List<String> notSpec = new ArrayList<>();
private final EventListener<EventUpdate> onUpdate = e -> {
if (mc.player.ticksExisted % 10 == 0) {
players = getVanish();
notSpec = getOnlinePlayerD();
players.sort(String::compareTo);
notSpec.sort(String::compareTo);
}
};
private final EventListener<EventDraw> onDraw = e -> {
if (e.type == EventDraw.RenderType.DISPLAY) {
if (players.isEmpty() && notSpec.isEmpty()) return;
FwmProject.instance.getScaleMath().pushScale();
List<String> all = new ArrayList<>();
all.addAll(players);
all.addAll(notSpec);
float width = all.stream().max(Comparator.comparingDouble(Fonts.verdana14::getStringWidth)).map(Fonts.verdana14::getStringWidth).get().floatValue() + 50;
float height2 = (notSpec.size() + players.size()) * 14;
float x = staffListDrag.getX();
float y = staffListDrag.getY();
int color = FwmProject.getInstance().getModuleManager().arraylist.getColor(5);
staffListDrag.setWidth(width);
staffListDrag.setHeight(height2 + 10);
SmartScissor.push();
SmartScissor.setFromComponentCoordinates((int) x - 3, (int) y - 3, (int) width + 6, (int) height2 + 12);
GlowUtility.drawGlowGradient(x - 1, y - 1, width + 2, height2 + 10, 5, color, color, color, color);
NORMAL_BLUR_RUNNABLES.add(() -> RenderUtility.drawRect(x, y, width, 10, new Color(0, 0, 0, 255).getRGB()));
RenderUtility.drawRect(x, y, width, 10, new Color(0, 0, 0,
255).getRGB());
int y2 = 10;
Fonts.SEMI_BOLD_16.drawCenteredString("Staff stats", x + width / 2, y + 3, ColorUtility.rgba(255, 255, 255, 255));
NORMAL_BLUR_RUNNABLES.add(() -> {
RenderUtility.drawRound(x, y + 10, width, height2,5, new Color(0, 0, 0,255).getRGB());
});
NORMAL_SHADOW_BLACK.add(() -> {
RenderUtility.drawRect(x, y + 10, width, height2, new Color(0, 0, 0,255).getRGB());
RenderUtility.drawRect(x, y, width, 10, new Color(0, 0, 0,255).getRGB());
});
OptimizationModule optimizationModule = (OptimizationModule) FwmProject.getInstance().getModuleManager()
.get(OptimizationModule.class);
if ((optimizationModule != null && optimizationModule.state && optimizationModule.shaders.get()))
RenderUtility.drawRect(x, y + 10, width, height2, new Color(0, 0, 0,255).getRGB());
RenderUtility.horizontalGradient(x, y + 10, width / 2f, 1, new Color(0, 0, 0, 255).getRGB(), new Color(ColorUtility.setAlpha(new Color(255,255,255).getRGB(), 255)).getRGB());
RenderUtility.horizontalGradient(x + width / 2f, y + 10, width / 2f, 1, new Color(ColorUtility.setAlpha(new Color(255,255,255).getRGB(), 255)).getRGB(), new Color(0, 0, 0, 255).getRGB());
if (height2 > 10) {
RenderUtility.verticalGradient(x, y + 10, width, 5, ColorUtility.rgba(0, 0, 0, 50), ColorUtility.rgba(0, 0, 0, 0));
int staffY = 11;
for (String player : all) {
Fonts.MONTSERRAT14.drawStringWithShadow(player.split(":")[0], x + 3, y + 4 + staffY, -1);
Fonts.MONTSERRAT14.drawStringWithShadow(player.split(":")[1].equalsIgnoreCase("vanish")
? ChatFormatting.RED + "VANISH" : player.split(":")[1].equalsIgnoreCase("gm3")
? ChatFormatting.RED + "VANISH " + ChatFormatting.YELLOW + "(GM 3)" : ChatFormatting.GREEN + "ACTIVE", x + width
- Fonts.verdana14.getStringWidth(player.split(":")[1].equalsIgnoreCase("vanish") ?
ChatFormatting.RED + "VANISH" : player.split(":")[1].equalsIgnoreCase("gm3") ?
ChatFormatting.RED + "VANISH " + ChatFormatting.YELLOW + "(GM 3)" : ChatFormatting.GREEN + "ACTIVE") - 2, y + staffY + 4, ColorUtility.rgba(255, 255, 255, 255));
staffY += 13;
}
}
SmartScissor.unset();
SmartScissor.pop();
FwmProject.instance.getScaleMath().popScale();
}
};
public static List<String> getOnlinePlayer() {
return mc.player.connection.getPlayerInfoMap().stream()
.map(NetworkPlayerInfo::getGameProfile)
.map(GameProfile::getName)
.filter(profileName -> validUserPattern.matcher(profileName).matches())
.collect(Collectors.toList());
}
// StaffCommand equals
public static List<String> getOnlinePlayerD() {
List<String> S = new ArrayList<>();
for (NetworkPlayerInfo player : mc.player.connection.getPlayerInfoMap()) {
if (mc.isSingleplayer() || player.getPlayerTeam() == null) break;
String prefix = player.getPlayerTeam().getColorPrefix();
if (check(ChatFormatting.stripFormatting(prefix).toLowerCase())
|| CommandStaff.staffNames.toString().toLowerCase().contains(player.getGameProfile().getName().toLowerCase())
|| player.getGameProfile().getName().toLowerCase().contains("1danil_mansoru1") || player.getPlayerTeam().getColorPrefix().contains("YT")) {
String name = Arrays.asList(player.getPlayerTeam().getMembershipCollection().stream().toArray()).toString().replace("[", "").replace("]", "");
if (player.getGameType() == GameType.SPECTATOR) {
S.add(player.getPlayerTeam().getColorPrefix() + name + ":gm3");
continue;
}
S.add(player.getPlayerTeam().getColorPrefix() + name + ":active");
}
}
return S;
}
public List<String> getVanish() {
List<String> list = new ArrayList<>();
for (ScorePlayerTeam s : mc.world.getScoreboard().getTeams()) {
if (s.getColorPrefix().length() == 0 || mc.isSingleplayer()) continue;
String name = Arrays.asList(s.getMembershipCollection().stream().toArray()).toString().replace("[", "").replace("]", "");
if (getOnlinePlayer().contains(name) || name.isEmpty())
continue;
if (CommandStaff.staffNames.toString().toLowerCase().contains(name.toLowerCase())
&& check(s.getColorPrefix().toLowerCase())
|| check(s.getColorPrefix().toLowerCase())
|| name.toLowerCase().contains("1danil_mansoru1") || s.getColorPrefix().contains("YT"))
list.add(s.getColorPrefix() + name + ":vanish");
}
return list;
}
public static boolean check(String name) {
return name.contains("helper") || name.contains("moder") || name.contains("admin") || name.contains("owner") || name.contains("curator") || name.contains("хелпер") || name.contains("модер") || name.contains("админ") || name.contains("куратор");
}
}