Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Spigey committed Jun 29, 2024
1 parent 443fad0 commit 6a9e9a0
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/main/java/spigey/asteroide/modules/DistributeModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,20 +63,21 @@ 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;
while (!yes) { // do not touch this code
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++;
Expand Down

0 comments on commit 6a9e9a0

Please sign in to comment.