Merge branch 'feature/incognito' of https://github.com/Mineplex-LLC/Minecraft-PC into clans/beta

This commit is contained in:
Ben 2016-03-08 20:58:11 +00:00
commit 69091c079f

View File

@ -17,6 +17,8 @@ import mineplex.core.vanish.commands.VanishCommand;
import mineplex.core.vanish.events.PreVanishEvent;
import mineplex.core.vanish.repository.VanishClient;
import mineplex.core.vanish.repository.VanishRepository;
import mineplex.game.clans.tutorials.Tutorial;
import net.md_5.bungee.api.ChatColor;
import net.minecraft.server.v1_8_R3.PacketPlayOutChat;
public class Vanish extends MiniClientPlugin<VanishClient>
@ -31,8 +33,33 @@ public class Vanish extends MiniClientPlugin<VanishClient>
_repository = new VanishRepository(this);
_clientManager = clientManager;
packetHandler.addPacketHandler(packet -> {
packetHandler.addPacketHandler(info -> {
PacketPlayOutChat packet = (PacketPlayOutChat) info.getPacket();
if (packet.getPacket() instanceof PacketPlayOutChat)
{
PacketPlayOutChat chat = (PacketPlayOutChat) packet.getPacket();
if (chat.b == 1)
{
if (chat.a.a().isEmpty())
{
return;
}
if (chat.a.a().get(0).c().equals(ChatColor.stripColor(Tutorial.AllowedMessage)))
{
chat.a.a().remove(0);
}
else if (!chat.a.a().get(0).c().contains(Tutorial.AllowedBypass))
{
if (isInTutorial(packet.getPlayer()))
{
packet.setCancelled(true);
}
}
}
}
}, PacketPlayOutChat.class);
}