Update 1.2.2

Fixed vanish-damage not working.
This commit is contained in:
SloudPL 2025-06-20 01:39:25 +02:00
parent 9fcbee447d
commit e0ea516a1d
6 changed files with 27 additions and 20 deletions

View file

@ -6,7 +6,7 @@
<groupId>pl.sloudpl</groupId>
<artifactId>SloudVanish</artifactId>
<version>1.2.1</version>
<version>1.2.2</version>
<packaging>jar</packaging>
<name>SloudVanish</name>

View file

@ -1,6 +1,5 @@
package pl.sloudpl.simplevanish;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
import pl.sloudpl.simplevanish.bstats.Metrics;
import pl.sloudpl.simplevanish.cmds.VanishCommand;
@ -9,11 +8,13 @@ import pl.sloudpl.simplevanish.events.onLeaveEvent;
import pl.sloudpl.simplevanish.events.onPlayerDamage;
import pl.sloudpl.simplevanish.utils.UpdateChecker;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Set;
import java.util.UUID;
public final class SimpleVanish extends JavaPlugin {
public ArrayList<Player> inVanishList = new ArrayList<>();
public Set<UUID> inVanishList = new HashSet<>();
@Override
public void onEnable() {

View file

@ -39,14 +39,14 @@ public class VanishCommand implements CommandExecutor {
return true;
}
if(plugin.inVanishList.contains(player)){
if(plugin.inVanishList.contains(player.getUniqueId())){
for(Player other : Bukkit.getOnlinePlayers()){
other.showPlayer(player);
if(plugin.getConfig().getBoolean("vanish-message-enabled")){
other.sendMessage(ChatColor.translateAlternateColorCodes('&', plugin.getConfig().getString("unvanishmsg").replace("[Player]", player.getName())));
}
}
plugin.inVanishList.remove(player);
plugin.inVanishList.remove(player.getUniqueId());
player.removePotionEffect(PotionEffectType.NIGHT_VISION);
player.sendMessage(ChatColor.translateAlternateColorCodes('&', plugin.getConfig().getString("unvanish")));
@ -59,13 +59,13 @@ public class VanishCommand implements CommandExecutor {
}
}
}
plugin.inVanishList.add(player);
plugin.inVanishList.add(player.getUniqueId());
player.addPotionEffect(new PotionEffect(PotionEffectType.NIGHT_VISION, Integer.MAX_VALUE, 0, false, false));
if(plugin.getConfig().getBoolean("actionbar")) {
new BukkitRunnable() {
@Override
public void run() {
if (!plugin.inVanishList.contains(player)) {
if (!plugin.inVanishList.contains(player.getUniqueId())) {
cancel();
return;
}
@ -92,14 +92,14 @@ public class VanishCommand implements CommandExecutor {
return true;
}
if(plugin.inVanishList.contains(target)){
if(plugin.inVanishList.contains(target.getUniqueId())){
for(Player other : Bukkit.getOnlinePlayers()){
other.showPlayer(target);
if(plugin.getConfig().getBoolean("vanish-message-enabled")){
other.sendMessage(ChatColor.translateAlternateColorCodes('&', plugin.getConfig().getString("unvanishmsg").replace("[Player]", target.getName())));
}
}
plugin.inVanishList.remove(target);
plugin.inVanishList.remove(target.getUniqueId());
target.removePotionEffect(PotionEffectType.NIGHT_VISION);
target.sendMessage(ChatColor.translateAlternateColorCodes('&', plugin.getConfig().getString("unvanish")));
@ -114,13 +114,13 @@ public class VanishCommand implements CommandExecutor {
}
}
}
plugin.inVanishList.add(target);
plugin.inVanishList.add(target.getUniqueId());
target.addPotionEffect(new PotionEffect(PotionEffectType.NIGHT_VISION, Integer.MAX_VALUE, 0, false, false));
if(plugin.getConfig().getBoolean("actionbar")) {
new BukkitRunnable() {
@Override
public void run() {
if (!plugin.inVanishList.contains(target)) {
if (!plugin.inVanishList.contains(target.getUniqueId())) {
cancel();
return;
}

View file

@ -1,11 +1,14 @@
package pl.sloudpl.simplevanish.events;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;
import pl.sloudpl.simplevanish.SimpleVanish;
import java.util.UUID;
public class onJoinEvent implements Listener {
SimpleVanish plugin;
@ -19,7 +22,9 @@ public class onJoinEvent implements Listener {
public void PlayerJoin(PlayerJoinEvent e){
Player player = e.getPlayer();
for(Player vanished : plugin.inVanishList){
for(UUID uuid : plugin.inVanishList){
Player vanished = Bukkit.getPlayer(uuid);
if(vanished != null){
if(!player.hasPermission("sloudpl.vanish.see")){
player.hidePlayer(vanished);
} else {
@ -28,3 +33,4 @@ public class onJoinEvent implements Listener {
}
}
}
}

View file

@ -21,9 +21,9 @@ public class onLeaveEvent implements Listener {
Player player = e.getPlayer();
if(plugin.inVanishList.contains(player)){
if(plugin.inVanishList.contains(player.getUniqueId())){
plugin.inVanishList.remove(player);
plugin.inVanishList.remove(player.getUniqueId());
player.removePotionEffect(PotionEffectType.NIGHT_VISION);
e.setQuitMessage(null);

View file

@ -22,7 +22,7 @@ public class onPlayerDamage implements Listener {
Player damager = (Player) e.getDamager();
if(plugin.inVanishList.contains(damager)){
if(plugin.inVanishList.contains(damager.getUniqueId())){
e.setCancelled(true);