packet hnadler beginning, switching to clans to fix errors
This commit is contained in:
parent
f24e196efd
commit
86ef10456c
@ -87,7 +87,8 @@ public class PacketHandler extends MiniPlugin
|
||||
return _playerVerifierMap.get(player);
|
||||
}
|
||||
|
||||
public void addPacketHandler(IPacketHandler packetHandler, Class<? extends Packet>... packetsToListen)
|
||||
@SafeVarargs
|
||||
public final void addPacketHandler(IPacketHandler packetHandler, Class<? extends Packet>... packetsToListen)
|
||||
{
|
||||
if (packetsToListen.length == 0)
|
||||
{
|
||||
|
@ -1,8 +1,5 @@
|
||||
package mineplex.core.vanish;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
@ -12,23 +9,31 @@ import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import mineplex.core.MiniClientPlugin;
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.packethandler.PacketHandler;
|
||||
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 net.minecraft.server.v1_8_R3.PacketPlayOutChat;
|
||||
|
||||
public class Vanish extends MiniClientPlugin<VanishClient>
|
||||
{
|
||||
private CoreClientManager _clientManager;
|
||||
private VanishRepository _repository;
|
||||
|
||||
public Vanish(JavaPlugin plugin, CoreClientManager clientManager)
|
||||
public Vanish(JavaPlugin plugin, CoreClientManager clientManager, PacketHandler packetHandler)
|
||||
{
|
||||
super("Vanish", plugin);
|
||||
|
||||
_repository = new VanishRepository(this);
|
||||
_clientManager = clientManager;
|
||||
|
||||
packetHandler.addPacketHandler(packet -> {
|
||||
|
||||
}, PacketPlayOutChat.class);
|
||||
}
|
||||
|
||||
public void addCommands()
|
||||
@ -54,18 +59,30 @@ public class Vanish extends MiniClientPlugin<VanishClient>
|
||||
return enabled;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void join
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void ClientLoad(AsyncPlayerPreLoginEvent event)
|
||||
{
|
||||
_clientManager.getRepository().getAccountId(event.getUniqueId(), accountId -> {
|
||||
Get(event.getName()).State = _repository.getStatus(accountId);
|
||||
Get(event.getName()).State = _repository.getStatus(accountId.intValue());
|
||||
});
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void ClientLoad(PlayerJoinEvent event)
|
||||
{
|
||||
Get(
|
||||
if (Get(event.getPlayer()).State)
|
||||
{
|
||||
event.setJoinMessage(null);
|
||||
informVanished(event.getPlayer());
|
||||
}
|
||||
}
|
||||
|
||||
private void informVanished(Player player)
|
||||
{
|
||||
UtilPlayer.message(player, C.cGold + "");
|
||||
}
|
||||
|
||||
public String getQuery(int accountId, String uuid, String name)
|
||||
@ -73,15 +90,8 @@ public class Vanish extends MiniClientPlugin<VanishClient>
|
||||
return "CREATE TABLE IF NOT EXISTS incognitoStaff (accountId INT NOT NULL, enabled TINYINT(1) NOT NULL, enabledTime BIGINT)";
|
||||
}
|
||||
|
||||
public void processLoginResultSet(String playerName, int accountId, ResultSet resultSet) throws SQLException
|
||||
{
|
||||
int accountId = resultSet.getInt("accountId");
|
||||
boolean enabled = resultSet.getBoolean("enabled");
|
||||
}
|
||||
|
||||
protected VanishClient AddPlayer(String player)
|
||||
{
|
||||
return new VanishClient();
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user