Update 1.2.2
Fixed vanish-damage not working.
This commit is contained in:
parent
9fcbee447d
commit
e0ea516a1d
6 changed files with 27 additions and 20 deletions
2
pom.xml
2
pom.xml
|
@ -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>
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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,11 +22,14 @@ public class onJoinEvent implements Listener {
|
|||
public void PlayerJoin(PlayerJoinEvent e){
|
||||
Player player = e.getPlayer();
|
||||
|
||||
for(Player vanished : plugin.inVanishList){
|
||||
if(!player.hasPermission("sloudpl.vanish.see")){
|
||||
player.hidePlayer(vanished);
|
||||
} else {
|
||||
player.showPlayer(vanished);
|
||||
for(UUID uuid : plugin.inVanishList){
|
||||
Player vanished = Bukkit.getPlayer(uuid);
|
||||
if(vanished != null){
|
||||
if(!player.hasPermission("sloudpl.vanish.see")){
|
||||
player.hidePlayer(vanished);
|
||||
} else {
|
||||
player.showPlayer(vanished);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue