From 6a9e9a04112e11bd884012f209b3b54b055944ae Mon Sep 17 00:00:00 2001 From: Spigey <101280395+Spigey@users.noreply.github.com> Date: Sat, 29 Jun 2024 17:44:50 +0200 Subject: [PATCH] fix --- .../spigey/asteroide/modules/DistributeModule.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/main/java/spigey/asteroide/modules/DistributeModule.java b/src/main/java/spigey/asteroide/modules/DistributeModule.java index 5f3c311..b8df37f 100644 --- a/src/main/java/spigey/asteroide/modules/DistributeModule.java +++ b/src/main/java/spigey/asteroide/modules/DistributeModule.java @@ -63,11 +63,11 @@ public void onActivate() { private void onTick(TickEvent.Post event){ if(tick > 0){tick--; return;} if(tick < 0) return; - if(display.isEmpty() || user.isEmpty()){ - for (PlayerListEntry player : mc.getNetworkHandler().getPlayerList()) display.add(player.getDisplayName() == null ? player.getProfile().getName() : player.getDisplayName().getString()); - for (PlayerListEntry player : mc.getNetworkHandler().getPlayerList()) user.add(player.getProfile().getName()); - if(display.isEmpty() || user.isEmpty()) return; - } + user = new ArrayList<>(); + display = new ArrayList<>(); + for (PlayerListEntry player : mc.getNetworkHandler().getPlayerList()) display.add(player.getDisplayName() == null ? player.getProfile().getName() : player.getDisplayName().getString()); + for (PlayerListEntry player : mc.getNetworkHandler().getPlayerList()) user.add(player.getProfile().getName()); + if(display.isEmpty() || user.isEmpty()) return; if(idx >= display.size()) idx = 0; String gift = display.get(idx).toLowerCase(); boolean yes = false; @@ -75,8 +75,9 @@ private void onTick(TickEvent.Post event){ yes = true; for (String s : ranks.get()) {if (gift.toLowerCase().contains(s.toLowerCase())) yes = false;} for (String s : users.get()) {if (user.get(idx).toLowerCase().contains(s.toLowerCase())) yes = false;} + if(user.get(idx).contains("ยง")) yes = false; if(!yes) {if(idx >= display.size()){idx = 0;}else{idx++;} return;} - if(display.isEmpty() || user.isEmpty()){ toggle(); return;} + if(display.isEmpty()){ toggle(); return;} } ChatUtils.sendPlayerMsg(String.format("/%s", command.get().get(new Random().nextInt(command.get().size())).replace("{name}", user.get(idx)).replace("/", ""))); idx++;