Fixes hunger, sounds listener now sync again, fixed checks. Fixes #384

This commit is contained in:
libraryaddict 2019-07-25 15:06:01 +12:00
parent 658c3f0602
commit 887181e6e9
6 changed files with 25 additions and 11 deletions

View File

@ -245,7 +245,8 @@ public class LibsDisguises extends JavaPlugin {
// Invalidate invalid distribution
if (LibsPremium.isPremium() && LibsPremium.getPaidInformation() != null &&
LibsPremium.getPaidInformation().getDownloadID().equals("-1895736039")) {
(!LibsPremium.getPaidInformation().isLegit() ||
LibsPremium.getPaidInformation().getDownloadID().equals("-1895736039"))) {
throw new IllegalStateException(
"Error while checking pi rate on startup! Please re-download the jar from SpigotMC before " +
"reporting this error!");

View File

@ -917,7 +917,8 @@ public class DisguiseUtilities {
Field cSection = chunkClass.getDeclaredField("sections");
cSection.setAccessible(true);
Object chunkSection = ReflectionManager.getNmsClass("ChunkSection").getConstructor(int.class).newInstance(0);
Object chunkSection = ReflectionManager.getNmsClass("ChunkSection").getConstructor(int.class)
.newInstance(0);
Class blockClass = ReflectionManager.getNmsClass("Block");
Object REGISTRY = ReflectionManager.getNmsField("IRegistry", "BLOCK").get(null);
@ -1032,7 +1033,8 @@ public class DisguiseUtilities {
Set trackedPlayers = (Set) ReflectionManager.getNmsField("EntityTrackerEntry", "trackedPlayers")
.get(entityTrackerEntry);
Method clear = ReflectionManager.getNmsMethod("EntityTrackerEntry", "a", ReflectionManager.getNmsClass("EntityPlayer"));
Method clear = ReflectionManager
.getNmsMethod("EntityTrackerEntry", "a", ReflectionManager.getNmsClass("EntityPlayer"));
final Method updatePlayer = ReflectionManager
.getNmsMethod("EntityTrackerEntry", "b", ReflectionManager.getNmsClass("EntityPlayer"));
@ -1339,6 +1341,10 @@ public class DisguiseUtilities {
return;
}
if (LibsPremium.getPaidInformation() != null && !LibsPremium.getPaidInformation().isLegit()) {
return;
}
DisguisePushing pOption = DisguiseConfig.getPushingOption();
if (pOption == DisguisePushing.IGNORE_SCOREBOARD) {

View File

@ -77,10 +77,9 @@ public class PacketsManager {
soundsListenerEnabled = enabled;
if (soundsListenerEnabled) {
ProtocolLibrary.getProtocolManager().getAsynchronousManager().registerAsyncHandler(soundsListener)
.syncStart();
ProtocolLibrary.getProtocolManager().addPacketListener(soundsListener);
} else {
ProtocolLibrary.getProtocolManager().getAsynchronousManager().unregisterAsyncHandler(soundsListener);
ProtocolLibrary.getProtocolManager().removePacketListener(soundsListener);
}
}
}
@ -92,7 +91,7 @@ public class PacketsManager {
if (inventoryModifierEnabled) {
ProtocolLibrary.getProtocolManager().addPacketListener(inventoryListener);
} else {
ProtocolLibrary.getProtocolManager().addPacketListener(inventoryListener);
ProtocolLibrary.getProtocolManager().removePacketListener(inventoryListener);
}
for (Player player : Bukkit.getOnlinePlayers()) {

View File

@ -8,11 +8,13 @@ import com.comphenix.protocol.wrappers.WrappedAttribute;
import com.comphenix.protocol.wrappers.WrappedDataWatcher;
import com.comphenix.protocol.wrappers.WrappedGameProfile;
import me.libraryaddict.disguise.DisguiseConfig;
import me.libraryaddict.disguise.LibsDisguises;
import me.libraryaddict.disguise.disguisetypes.*;
import me.libraryaddict.disguise.disguisetypes.watchers.FallingBlockWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.LivingWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.PlayerWatcher;
import me.libraryaddict.disguise.utilities.DisguiseUtilities;
import me.libraryaddict.disguise.utilities.LibsPremium;
import me.libraryaddict.disguise.utilities.packets.IPacketHandler;
import me.libraryaddict.disguise.utilities.packets.LibsPackets;
import me.libraryaddict.disguise.utilities.packets.PacketsHandler;
@ -281,8 +283,11 @@ public class PacketHandlerSpawn implements IPacketHandler {
deleteTab.getModifier().write(0, ReflectionManager.getEnumPlayerInfoAction(4));
if (!((PlayerDisguise) disguise).isDisplayedInTab()) {
if (LibsPremium.getPaidInformation() == null ||
LibsPremium.getPaidInformation().getVersion().matches("[0-9]+")) {
packets.addDelayedPacket(deleteTab, DisguiseConfig.getPlayerDisguisesTablistExpires());
}
}
} else if (disguise.getType().isMob() || disguise.getType() == DisguiseType.ARMOR_STAND) {
Vector vec = disguisedEntity.getVelocity();

View File

@ -14,6 +14,7 @@ import me.libraryaddict.disguise.LibsDisguises;
import me.libraryaddict.disguise.disguisetypes.Disguise;
import me.libraryaddict.disguise.disguisetypes.MetaIndex;
import me.libraryaddict.disguise.utilities.DisguiseUtilities;
import me.libraryaddict.disguise.utilities.LibsPremium;
import me.libraryaddict.disguise.utilities.packets.LibsPackets;
import me.libraryaddict.disguise.utilities.packets.PacketsManager;
import me.libraryaddict.disguise.utilities.reflection.ReflectionManager;
@ -112,7 +113,10 @@ public class PacketListenerViewSelfDisguise extends PacketAdapter {
transformed.sendDelayed(observer);
if (event.getPacketType() == Server.ENTITY_METADATA) {
if (!LibsPremium.getPluginInformation().isPremium() || LibsPremium.getPaidInformation() != null ||
LibsPremium.getPluginInformation().getBuildNumber().matches("[0-9]+")) {
event.setPacket(packet = packet.deepClone());
}
for (WrappedWatchableObject watch : packet.getWatchableCollectionModifier().read(0)) {
if (watch.getIndex() == 0) {

View File

@ -54,7 +54,6 @@ public class PluginInformation {
}
public boolean isLegit() {
return getUserID().matches("[0-9]+") && LibsPremium.getResourceID().equals("32453") &&
getDownloadID().matches("-?[0-9]+");
return getUserID().matches("[0-9]+") && getResourceID().equals("32453") && getDownloadID().matches("-?[0-9]+");
}
}