Fixed isInvulnerability check in PacketsManager
This commit is contained in:
		| @@ -42,9 +42,9 @@ import com.comphenix.protocol.events.PacketContainer; | |||||||
| public class DisguiseListener implements Listener { | public class DisguiseListener implements Listener { | ||||||
|  |  | ||||||
|     private String currentVersion; |     private String currentVersion; | ||||||
|     private HashMap<String, Boolean[]> disguiseClone = new HashMap<String, Boolean[]>(); |     private HashMap<String, Boolean[]> disguiseClone = new HashMap<>(); | ||||||
|     private HashMap<String, Disguise> disguiseEntity = new HashMap<String, Disguise>(); |     private HashMap<String, Disguise> disguiseEntity = new HashMap<>(); | ||||||
|     private HashMap<String, BukkitRunnable> disguiseRunnable = new HashMap<String, BukkitRunnable>(); |     private HashMap<String, BukkitRunnable> disguiseRunnable = new HashMap<>(); | ||||||
|     private String latestVersion; |     private String latestVersion; | ||||||
|     private LibsDisguises plugin; |     private LibsDisguises plugin; | ||||||
|  |  | ||||||
|   | |||||||
| @@ -12,10 +12,9 @@ public class LibsDisguisesCommand implements CommandExecutor { | |||||||
|     public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { |     public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { | ||||||
|         sender.sendMessage(ChatColor.DARK_GREEN |         sender.sendMessage(ChatColor.DARK_GREEN | ||||||
|                 + "This server is running " |                 + "This server is running " | ||||||
|                 + "Lib's Disguises " |                 + "Lib's Disguises v." | ||||||
|                 + (sender.getName().equals("libraryaddict") ? "v" |                 + Bukkit.getPluginManager().getPlugin("LibsDisguises").getDescription().getVersion() | ||||||
|                         + Bukkit.getPluginManager().getPlugin("LibsDisguises").getDescription().getVersion() + " " : "") |                 + "by libraryaddict, maintained by NavidK0"); | ||||||
|                 + "by libraryaddict"); |  | ||||||
|         return true; |         return true; | ||||||
|     } |     } | ||||||
| } | } | ||||||
|   | |||||||
| @@ -10,7 +10,6 @@ import me.libraryaddict.disguise.disguisetypes.watchers.PlayerWatcher; | |||||||
| import me.libraryaddict.disguise.utilities.DisguiseUtilities; | import me.libraryaddict.disguise.utilities.DisguiseUtilities; | ||||||
| import me.libraryaddict.disguise.utilities.LibsProfileLookup; | import me.libraryaddict.disguise.utilities.LibsProfileLookup; | ||||||
| import me.libraryaddict.disguise.utilities.ReflectionManager; | import me.libraryaddict.disguise.utilities.ReflectionManager; | ||||||
| import me.libraryaddict.disguise.utilities.ReflectionManager.LibVersion; |  | ||||||
|  |  | ||||||
| public class PlayerDisguise extends TargetedDisguise { | public class PlayerDisguise extends TargetedDisguise { | ||||||
|     private LibsProfileLookup currentLookup; |     private LibsProfileLookup currentLookup; | ||||||
| @@ -221,4 +220,4 @@ public class PlayerDisguise extends TargetedDisguise { | |||||||
|     public PlayerDisguise silentlyRemovePlayer(String playername) { |     public PlayerDisguise silentlyRemovePlayer(String playername) { | ||||||
|         return (PlayerDisguise) super.silentlyRemovePlayer(playername); |         return (PlayerDisguise) super.silentlyRemovePlayer(playername); | ||||||
|     } |     } | ||||||
| } | } | ||||||
|   | |||||||
| @@ -16,7 +16,6 @@ import me.libraryaddict.disguise.disguisetypes.MiscDisguise; | |||||||
| import me.libraryaddict.disguise.disguisetypes.MobDisguise; | import me.libraryaddict.disguise.disguisetypes.MobDisguise; | ||||||
| import me.libraryaddict.disguise.disguisetypes.PlayerDisguise; | import me.libraryaddict.disguise.disguisetypes.PlayerDisguise; | ||||||
| import me.libraryaddict.disguise.disguisetypes.RabbitType; | import me.libraryaddict.disguise.disguisetypes.RabbitType; | ||||||
| import me.libraryaddict.disguise.utilities.ReflectionManager.LibVersion; |  | ||||||
|  |  | ||||||
| import org.bukkit.ChatColor; | import org.bukkit.ChatColor; | ||||||
| import org.bukkit.Material; | import org.bukkit.Material; | ||||||
|   | |||||||
| @@ -54,6 +54,7 @@ import com.comphenix.protocol.wrappers.WrappedAttribute.Builder; | |||||||
| import com.comphenix.protocol.wrappers.WrappedDataWatcher; | import com.comphenix.protocol.wrappers.WrappedDataWatcher; | ||||||
| import com.comphenix.protocol.wrappers.WrappedGameProfile; | import com.comphenix.protocol.wrappers.WrappedGameProfile; | ||||||
| import com.comphenix.protocol.wrappers.WrappedWatchableObject; | import com.comphenix.protocol.wrappers.WrappedWatchableObject; | ||||||
|  | import net.minecraft.server.v1_8_R2.DamageSource; | ||||||
|  |  | ||||||
| public class PacketsManager { | public class PacketsManager { | ||||||
|     /** |     /** | ||||||
| @@ -583,7 +584,7 @@ public class PacketsManager { | |||||||
|                                                         "maxNoDamageTicks").getInt(nmsEntity); |                                                         "maxNoDamageTicks").getInt(nmsEntity); | ||||||
|                                             } else { |                                             } else { | ||||||
|                                                 hasInvun = (Boolean) ReflectionManager.getNmsMethod("Entity", "isInvulnerable") |                                                 hasInvun = (Boolean) ReflectionManager.getNmsMethod("Entity", "isInvulnerable") | ||||||
|                                                         .invoke(nmsEntity); |                                                         .invoke(nmsEntity, DamageSource.GENERIC); | ||||||
|                                             } |                                             } | ||||||
|                                         } catch (Exception ex) { |                                         } catch (Exception ex) { | ||||||
|                                             ex.printStackTrace(); |                                             ex.printStackTrace(); | ||||||
|   | |||||||
| @@ -91,6 +91,12 @@ MiscDisguisesForLiving: true | |||||||
| # Turn this to true to have players undisguised when switching worlds | # Turn this to true to have players undisguised when switching worlds | ||||||
| UndisguiseOnWorldChange: false | UndisguiseOnWorldChange: false | ||||||
|  |  | ||||||
|  | # Should players with the proper permission be able to see through disguises? | ||||||
|  | SeeThroughDisguises: true | ||||||
|  |  | ||||||
|  | # Should the disguised entity's name go through disguises? (Not including players) | ||||||
|  | EntityNameThroughDisguise: false | ||||||
|  |  | ||||||
| # This will help performance, especially with CPU | # This will help performance, especially with CPU | ||||||
| # Due to safety reasons, self disguises can never have their packets disabled. | # Due to safety reasons, self disguises can never have their packets disabled. | ||||||
| PacketsEnabled: | PacketsEnabled: | ||||||
| @@ -121,4 +127,4 @@ PacketsEnabled: | |||||||
|   # Disable this if you don't mind crashing everytime you see someone riding something disguised as a non-living entity |   # Disable this if you don't mind crashing everytime you see someone riding something disguised as a non-living entity | ||||||
|   Riding: true |   Riding: true | ||||||
|   # When disguised as a wither skull, it sends a look packet every tick so that the wither skull is facing the right way. |   # When disguised as a wither skull, it sends a look packet every tick so that the wither skull is facing the right way. | ||||||
|   WitherSkull: true |   WitherSkull: true | ||||||
|   | |||||||
| @@ -1,45 +1,48 @@ | |||||||
| name: LibsDisguises | name: LibsDisguises | ||||||
| main: me.libraryaddict.disguise.LibsDisguises | main: me.libraryaddict.disguise.LibsDisguises | ||||||
| version: 8.3 | version: 8.4 | ||||||
| author: libraryaddict | author: libraryaddict | ||||||
| authors: [Byteflux, Navid K.] | authors: [Byteflux, Navid K.] | ||||||
| depend: [ProtocolLib] | depend: [ProtocolLib] | ||||||
| commands: | commands: | ||||||
|    libsdisguises: |     libsdisguises: | ||||||
|       permission: libsdisguises.seecmd.libsdisguises |       permission: libsdisguises.seecmd.libsdisguises | ||||||
|    disguise: |     disguise: | ||||||
|       aliases: [d, dis] |       aliases: [d, dis] | ||||||
|       permission: libsdisguises.seecmd.disguise |       permission: libsdisguises.seecmd.disguise | ||||||
|    disguiseentity: |     disguiseentity: | ||||||
|       aliases: [dentity, disentity] |       aliases: [dentity, disentity] | ||||||
|       permission: libsdisguises.seecmd.disguiseentity |       permission: libsdisguises.seecmd.disguiseentity | ||||||
|    disguisehelp: |     disguisehelp: | ||||||
|       aliases: [dhelp, dishelp] |       aliases: [dhelp, dishelp] | ||||||
|       permission: libsdisguises.seecmd.disguisehelp |       permission: libsdisguises.seecmd.disguisehelp | ||||||
|    disguiseplayer: |     disguiseplayer: | ||||||
|       aliases: [dplayer, displayer] |       aliases: [dplayer, displayer] | ||||||
|       permission: libsdisguises.seecmd.disguiseplayer |       permission: libsdisguises.seecmd.disguiseplayer | ||||||
|    disguiseradius: |     disguiseradius: | ||||||
|       aliases: [disradius, dradius] |       aliases: [disradius, dradius] | ||||||
|       permission: libsdisguises.seecmd.disguiseradius |       permission: libsdisguises.seecmd.disguiseradius | ||||||
|    undisguise: |     undisguise: | ||||||
|       aliases: [u, und, undis] |       aliases: [u, und, undis] | ||||||
|       permission: libsdisguises.seecmd.undisguise |       permission: libsdisguises.seecmd.undisguise | ||||||
|    undisguiseentity: |     undisguiseentity: | ||||||
|       aliases: [undisentity, undentity] |       aliases: [undisentity, undentity] | ||||||
|       permission: libsdisguises.seecmd.undisguiseentity |       permission: libsdisguises.seecmd.undisguiseentity | ||||||
|    undisguiseplayer: |     undisguiseplayer: | ||||||
|       aliases: [undisplayer, undplayer] |       aliases: [undisplayer, undplayer] | ||||||
|       permission: libsdisguises.seecmd.undisguiseplayer |       permission: libsdisguises.seecmd.undisguiseplayer | ||||||
|    undisguiseradius: |     undisguiseradius: | ||||||
|       aliases: [undisradius, undradius] |       aliases: [undisradius, undradius] | ||||||
|       permission: libsdisguises.seecmd.undisguiseradius |       permission: libsdisguises.seecmd.undisguiseradius | ||||||
|    disguiseclone: |     disguiseclone: | ||||||
|       aliases: [disguisec, disc, disclone, dclone, clonedisguise, clonedis, cdisguise, cdis] |       aliases: [disguisec, disc, disclone, dclone, clonedisguise, clonedis, cdisguise, cdis] | ||||||
|       permission: libsdisguises.seecmd.disguiseclone |       permission: libsdisguises.seecmd.disguiseclone | ||||||
|  |  | ||||||
| permissions: | permissions: | ||||||
|    libsdisguises.seecmd: |     libsdisguises.seethrough: | ||||||
|  |         description: Allows player to see through disguises. | ||||||
|  |         default: false | ||||||
|  |     libsdisguises.seecmd: | ||||||
|       description: See all commands in tab-completion |       description: See all commands in tab-completion | ||||||
|       default: true |       default: true | ||||||
|       children: |       children: | ||||||
| @@ -55,25 +58,26 @@ permissions: | |||||||
|          libsdisguises.seecmd.undisguiseradius: true |          libsdisguises.seecmd.undisguiseradius: true | ||||||
|          libsdisguises.seecmd.disguiseclone: true |          libsdisguises.seecmd.disguiseclone: true | ||||||
|  |  | ||||||
|    libsdisguises.seecmd.libsdisguises: |     libsdisguises.seecmd.libsdisguises: | ||||||
|       description: See the /libsdisguises command in tab-completion |       description: See the /libsdisguises command in tab-completion | ||||||
|    libsdisguises.seecmd.disguise: |     libsdisguises.seecmd.disguise: | ||||||
|       description: See the /disguise command in tab-completion |       description: See the /disguise command in tab-completion | ||||||
|    libsdisguises.seecmd.disguiseentity: |     libsdisguises.seecmd.disguiseentity: | ||||||
|       description: See the /disguiseentity command in tab-completion |       description: See the /disguiseentity command in tab-completion | ||||||
|    libsdisguises.seecmd.disguisehelp: |     libsdisguises.seecmd.disguisehelp: | ||||||
|       description: See the /disguisehelp command in tab-completion |       description: See the /disguisehelp command in tab-completion | ||||||
|    libsdisguises.seecmd.disguiseplayer: |     libsdisguises.seecmd.disguiseplayer: | ||||||
|       description: See the /disguiseplayer command in tab-completion |       description: See the /disguiseplayer command in tab-completion | ||||||
|    libsdisguises.seecmd.disguiseradius: |     libsdisguises.seecmd.disguiseradius: | ||||||
|       description: See the /disguiseradius command in tab-completion |       description: See the /disguiseradius command in tab-completion | ||||||
|    libsdisguises.seecmd.undisguise: |     libsdisguises.seecmd.undisguise: | ||||||
|       description: See the /undisguise command in tab-completion |       description: See the /undisguise command in tab-completion | ||||||
|    libsdisguises.seecmd.undisguiseentity: |     libsdisguises.seecmd.undisguiseentity: | ||||||
|       description: See the /undisguiseentity command in tab-completion |       description: See the /undisguiseentity command in tab-completion | ||||||
|    libsdisguises.seecmd.undisguiseplayer: |     libsdisguises.seecmd.undisguiseplayer: | ||||||
|       description: See the /undisguiseplayer command in tab-completion |       description: See the /undisguiseplayer command in tab-completion | ||||||
|    libsdisguises.seecmd.undisguiseradius: |     libsdisguises.seecmd.undisguiseradius: | ||||||
|       description: See the /undisguiseradius command in tab-completion |       description: See the /undisguiseradius command in tab-completion | ||||||
|    libsdisguises.seecmd.disguiseclone: |     libsdisguises.seecmd.disguiseclone: | ||||||
|       description: See the /disguiseclone command in tab-completion |       description: See the /disguiseclone command in tab-completion | ||||||
|  |     | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user