Update to 1.2
Added 2 new options in config for disabling vanish and unvanish chat messages to all players and also added option to disable pvp for vanished players.
This commit is contained in:
parent
6195ee98b8
commit
e75f952733
5 changed files with 59 additions and 5 deletions
2
pom.xml
2
pom.xml
|
@ -6,7 +6,7 @@
|
|||
|
||||
<groupId>pl.sloudpl</groupId>
|
||||
<artifactId>SloudVanish</artifactId>
|
||||
<version>1.1.1</version>
|
||||
<version>1.2</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>SloudVanish</name>
|
||||
|
|
|
@ -6,6 +6,7 @@ import pl.sloudpl.simplevanish.bstats.Metrics;
|
|||
import pl.sloudpl.simplevanish.cmds.VanishCommand;
|
||||
import pl.sloudpl.simplevanish.events.onJoinEvent;
|
||||
import pl.sloudpl.simplevanish.events.onLeaveEvent;
|
||||
import pl.sloudpl.simplevanish.events.onPlayerDamage;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
|
@ -22,9 +23,14 @@ public final class SimpleVanish extends JavaPlugin {
|
|||
saveDefaultConfig();
|
||||
|
||||
new VanishCommand(this);
|
||||
|
||||
new onJoinEvent(this);
|
||||
new onLeaveEvent(this);
|
||||
|
||||
if(getConfig().getBoolean("vanish-damage")){
|
||||
new onPlayerDamage(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -42,7 +42,9 @@ public class VanishCommand implements CommandExecutor {
|
|||
if(plugin.inVanishList.contains(player)){
|
||||
for(Player other : Bukkit.getOnlinePlayers()){
|
||||
other.showPlayer(player);
|
||||
other.sendMessage(ChatColor.translateAlternateColorCodes('&', plugin.getConfig().getString("unvanishmsg").replace("[Player]", player.getName())));
|
||||
if(plugin.getConfig().getBoolean("vanish-message-enabled")){
|
||||
other.sendMessage(ChatColor.translateAlternateColorCodes('&', plugin.getConfig().getString("unvanishmsg").replace("[Player]", player.getName())));
|
||||
}
|
||||
}
|
||||
plugin.inVanishList.remove(player);
|
||||
player.removePotionEffect(PotionEffectType.NIGHT_VISION);
|
||||
|
@ -52,7 +54,9 @@ public class VanishCommand implements CommandExecutor {
|
|||
for(Player other : Bukkit.getOnlinePlayers()){
|
||||
if(!other.hasPermission("sloudpl.vanish.see")){
|
||||
other.hidePlayer(player);
|
||||
other.sendMessage(ChatColor.translateAlternateColorCodes('&', plugin.getConfig().getString("vanishmsg").replace("[Player]", player.getName())));
|
||||
if(plugin.getConfig().getBoolean("vanish-message-enabled")){
|
||||
other.sendMessage(ChatColor.translateAlternateColorCodes('&', plugin.getConfig().getString("vanishmsg").replace("[Player]", player.getName())));
|
||||
}
|
||||
}
|
||||
}
|
||||
plugin.inVanishList.add(player);
|
||||
|
@ -91,7 +95,9 @@ public class VanishCommand implements CommandExecutor {
|
|||
if(plugin.inVanishList.contains(target)){
|
||||
for(Player other : Bukkit.getOnlinePlayers()){
|
||||
other.showPlayer(target);
|
||||
other.sendMessage(ChatColor.translateAlternateColorCodes('&', plugin.getConfig().getString("unvanishmsg").replace("[Player]", target.getName())));
|
||||
if(plugin.getConfig().getBoolean("vanish-message-enabled")){
|
||||
other.sendMessage(ChatColor.translateAlternateColorCodes('&', plugin.getConfig().getString("unvanishmsg").replace("[Player]", target.getName())));
|
||||
}
|
||||
}
|
||||
plugin.inVanishList.remove(target);
|
||||
target.removePotionEffect(PotionEffectType.NIGHT_VISION);
|
||||
|
@ -103,7 +109,9 @@ public class VanishCommand implements CommandExecutor {
|
|||
for(Player other : Bukkit.getOnlinePlayers()){
|
||||
if(!other.hasPermission("sloudpl.vanish.see")){
|
||||
other.hidePlayer(target);
|
||||
other.sendMessage(ChatColor.translateAlternateColorCodes('&', plugin.getConfig().getString("vanishmsg").replace("[Player]", target.getName())));
|
||||
if(plugin.getConfig().getBoolean("vanish-message-enabled")){
|
||||
other.sendMessage(ChatColor.translateAlternateColorCodes('&', plugin.getConfig().getString("vanishmsg").replace("[Player]", target.getName())));
|
||||
}
|
||||
}
|
||||
}
|
||||
plugin.inVanishList.add(target);
|
||||
|
|
|
@ -0,0 +1,35 @@
|
|||
package pl.sloudpl.simplevanish.events;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
import pl.sloudpl.simplevanish.SimpleVanish;
|
||||
|
||||
public class onPlayerDamage implements Listener {
|
||||
|
||||
SimpleVanish plugin;
|
||||
|
||||
public onPlayerDamage(SimpleVanish plugin){
|
||||
this.plugin = plugin;
|
||||
plugin.getServer().getPluginManager().registerEvents(this, plugin);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void PlayerDamage(EntityDamageByEntityEvent e){
|
||||
|
||||
if(e.getDamager() instanceof Player){
|
||||
|
||||
Player damager = (Player) e.getDamager();
|
||||
|
||||
if(plugin.inVanishList.contains(damager)){
|
||||
|
||||
e.setCancelled(true);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -2,6 +2,11 @@
|
|||
actionbar: false
|
||||
# ActionBar text
|
||||
actionbarmsg: '&cVANISH &aON'
|
||||
# Enable/Disable damaging players when in vanish
|
||||
vanish-damage: true
|
||||
# If the player goes into vanish there is a message that the player left the game when true it will show up when false it will not show up.
|
||||
# It also works for when player disables vanish and there is the message that the player joined the game.
|
||||
vanish-message-enabled: true
|
||||
# When player vanishes
|
||||
vanish: '&aYou are now invisibile!'
|
||||
# When player unvanishes
|
||||
|
|
Loading…
Add table
Reference in a new issue