Skip to content

Commit

Permalink
fixed vanish
Browse files Browse the repository at this point in the history
  • Loading branch information
czQery committed Aug 17, 2024
1 parent a36239b commit db6af53
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 21 deletions.
2 changes: 1 addition & 1 deletion src/main/java/cz/qery/toolkit/Vnsh.java
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public static void Hide(Player p, boolean init) {
p.setSleepingIgnored(true);
p.setAllowFlight(true);
for (Entity e : p.getWorld().getEntities()) {
if (e instanceof Creature && ((Creature) e).getTarget() != null && ((Creature) e).getTarget().getUniqueId() == p.getUniqueId()) {
if (e instanceof Creature && ((Creature) e).getTarget() != null && ((Creature) e).getTarget().getUniqueId().compareTo(p.getUniqueId()) == 0) {
((Creature) e).setTarget(null);
}
}
Expand Down
4 changes: 1 addition & 3 deletions src/main/java/cz/qery/toolkit/commands/Cmdblock.java
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,7 @@ public List<String> onTabComplete(@NotNull CommandSender sender, @NotNull Comman
list.add("remove");
list.add("list");
}
case 2 -> {
list.add("name");
}
case 2 -> list.add("name");
}

if (!list.isEmpty()) {
Expand Down
4 changes: 1 addition & 3 deletions src/main/java/cz/qery/toolkit/commands/Lunar.java
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,7 @@ public List<String> onTabComplete(@NotNull CommandSender sender, @NotNull Comman
list.add("remove");
list.add("list");
}
case 3 -> {
list.add("name");
}
case 3 -> list.add("name");
case 4 -> {
list.add("#ffffff");
list.add("#ff0000");
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/cz/qery/toolkit/events/Join.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public void onJoin(PlayerJoinEvent e) {

// vanish
for (Map.Entry<UUID, String> pl : Vnsh.players.entrySet()) {
if (p.getUniqueId() == pl.getKey()) {
if (p.getUniqueId().compareTo(pl.getKey()) == 0) {
Vnsh.Hide(p, false);
} else {
Player target = Bukkit.getServer().getPlayer(pl.getKey());
Expand Down
13 changes: 0 additions & 13 deletions src/main/java/cz/qery/toolkit/events/Silent.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@
import org.bukkit.event.entity.*;
import org.bukkit.event.player.PlayerAdvancementDoneEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.server.ServerListPingEvent;

import java.util.Iterator;
import java.util.Objects;

public class Silent implements Listener {
Expand Down Expand Up @@ -76,15 +74,4 @@ public void onItemPickup(EntityPickupItemEvent e) {
e.setCancelled(true);
}
}

@EventHandler
public void onServerListPing(ServerListPingEvent e) {
Iterator<Player> iterator = e.iterator();
while (iterator.hasNext()) {
Player p = iterator.next();
if (Vnsh.players.get(p.getUniqueId()) != null) {
iterator.remove();
}
}
}
}

0 comments on commit db6af53

Please sign in to comment.