Fixed isInvulnerability check in PacketsManager

This commit is contained in:
NavidK0 2015-03-28 19:05:53 -04:00
parent 099e9ad5a3
commit cbf4e3fc03
7 changed files with 44 additions and 36 deletions

View File

@ -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;

View File

@ -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;
} }
} }

View File

@ -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;

View File

@ -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;

View File

@ -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();

View File

@ -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:

View File

@ -1,6 +1,6 @@
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]
@ -39,6 +39,9 @@ commands:
permission: libsdisguises.seecmd.disguiseclone permission: libsdisguises.seecmd.disguiseclone
permissions: permissions:
libsdisguises.seethrough:
description: Allows player to see through disguises.
default: false
libsdisguises.seecmd: libsdisguises.seecmd:
description: See all commands in tab-completion description: See all commands in tab-completion
default: true default: true
@ -77,3 +80,4 @@ permissions:
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