mirror of
https://github.com/SpigotMC/BungeeCord.git
synced 2024-11-23 18:55:22 +01:00
Add post auth event
This commit is contained in:
parent
5f33136cbf
commit
a6007ec6cf
6
pom.xml
6
pom.xml
@ -100,12 +100,6 @@
|
|||||||
<url>http://repo.md-5.net/content/groups/public</url>
|
<url>http://repo.md-5.net/content/groups/public</url>
|
||||||
</repository>
|
</repository>
|
||||||
</repositories>
|
</repositories>
|
||||||
<pluginRepositories>
|
|
||||||
<pluginRepository>
|
|
||||||
<id>md_5-public</id>
|
|
||||||
<url>http://repo.md-5.net/content/groups/public</url>
|
|
||||||
</pluginRepository>
|
|
||||||
</pluginRepositories>
|
|
||||||
<build>
|
<build>
|
||||||
<finalName>${project.name}</finalName>
|
<finalName>${project.name}</finalName>
|
||||||
<plugins>
|
<plugins>
|
||||||
|
@ -9,7 +9,7 @@ import net.md_5.bungee.packet.PacketFCEncryptionResponse;
|
|||||||
import net.md_5.bungee.packet.PacketFDEncryptionRequest;
|
import net.md_5.bungee.packet.PacketFDEncryptionRequest;
|
||||||
import net.md_5.bungee.packet.PacketFFKick;
|
import net.md_5.bungee.packet.PacketFFKick;
|
||||||
import net.md_5.bungee.packet.PacketInputStream;
|
import net.md_5.bungee.packet.PacketInputStream;
|
||||||
import net.md_5.bungee.plugin.HandshakeEvent;
|
import net.md_5.bungee.plugin.LoginEvent;
|
||||||
import org.bouncycastle.crypto.io.CipherInputStream;
|
import org.bouncycastle.crypto.io.CipherInputStream;
|
||||||
import org.bouncycastle.crypto.io.CipherOutputStream;
|
import org.bouncycastle.crypto.io.CipherOutputStream;
|
||||||
|
|
||||||
@ -39,7 +39,7 @@ public class InitialHandler implements Runnable
|
|||||||
case 0x02:
|
case 0x02:
|
||||||
Packet2Handshake handshake = new Packet2Handshake(packet);
|
Packet2Handshake handshake = new Packet2Handshake(packet);
|
||||||
// fire connect event
|
// fire connect event
|
||||||
HandshakeEvent event = new HandshakeEvent(handshake.username, socket.getInetAddress());
|
LoginEvent event = new LoginEvent(handshake.username, socket.getInetAddress());
|
||||||
BungeeCord.instance.pluginManager.onHandshake(event);
|
BungeeCord.instance.pluginManager.onHandshake(event);
|
||||||
if (event.isCancelled())
|
if (event.isCancelled())
|
||||||
{
|
{
|
||||||
@ -56,6 +56,13 @@ public class InitialHandler implements Runnable
|
|||||||
throw new KickException("Not authenticated with minecraft.net");
|
throw new KickException("Not authenticated with minecraft.net");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// fire post auth event
|
||||||
|
BungeeCord.instance.pluginManager.onHandshake(event);
|
||||||
|
if (event.isCancelled())
|
||||||
|
{
|
||||||
|
throw new KickException(event.getCancelReason());
|
||||||
|
}
|
||||||
|
|
||||||
out.write(new PacketFCEncryptionResponse().getPacket());
|
out.write(new PacketFCEncryptionResponse().getPacket());
|
||||||
in = new PacketInputStream(new CipherInputStream(socket.getInputStream(), EncryptionUtil.getCipher(false, shared)));
|
in = new PacketInputStream(new CipherInputStream(socket.getInputStream(), EncryptionUtil.getCipher(false, shared)));
|
||||||
out = new CipherOutputStream(socket.getOutputStream(), EncryptionUtil.getCipher(true, shared));
|
out = new CipherOutputStream(socket.getOutputStream(), EncryptionUtil.getCipher(true, shared));
|
||||||
|
@ -32,7 +32,15 @@ public abstract class JavaPlugin
|
|||||||
* Called when a user connects with their name and address. To keep things
|
* Called when a user connects with their name and address. To keep things
|
||||||
* simple this name has not been checked with minecraft.net.
|
* simple this name has not been checked with minecraft.net.
|
||||||
*/
|
*/
|
||||||
public void onHandshake(HandshakeEvent event)
|
public void onHandshake(LoginEvent event)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called after a user has been authed with minecraftt.net and is about to
|
||||||
|
* log into the proxy.
|
||||||
|
*/
|
||||||
|
public void onLogin(LoginEvent event)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -81,11 +81,20 @@ public class JavaPluginManager extends JavaPlugin
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onHandshake(HandshakeEvent event)
|
public void onHandshake(LoginEvent event)
|
||||||
{
|
{
|
||||||
for (JavaPlugin p : plugins)
|
for (JavaPlugin p : plugins)
|
||||||
{
|
{
|
||||||
p.onHandshake(event);
|
p.onHandshake(event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onLogin(LoginEvent event)
|
||||||
|
{
|
||||||
|
for (JavaPlugin p : plugins)
|
||||||
|
{
|
||||||
|
p.onLogin(event);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,12 +4,10 @@ import java.net.InetAddress;
|
|||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Event called once a remote connection has begun the login procedure. This
|
* Event called to represent a player logging in.
|
||||||
* event is ideal for IP banning, however must be used with care in other places
|
|
||||||
* such as logging at the username has not yet been verified with Mojang.
|
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
public class HandshakeEvent implements Cancellable
|
public class LoginEvent implements Cancellable
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
Loading…
Reference in New Issue
Block a user