use of net.md_5.bungee.event.EventHandler in project LuckPerms by lucko.
the class BungeePermissionCheckListener method onOtherTristateCheck.
@EventHandler(priority = EventPriority.HIGHEST)
public void onOtherTristateCheck(TristateCheckEvent e) {
if (e.getSender() instanceof ProxiedPlayer) {
return;
}
Objects.requireNonNull(e.getPermission(), "permission");
Objects.requireNonNull(e.getSender(), "sender");
String permission = e.getPermission();
Tristate result = e.getResult();
String name = "internal/" + e.getSender().getName();
this.plugin.getVerboseHandler().offerCheckData(CheckOrigin.PLATFORM_LOOKUP_CHECK, name, ContextSet.empty(), permission, result);
this.plugin.getPermissionVault().offer(permission);
}
use of net.md_5.bungee.event.EventHandler in project Parties by AlessioDP.
the class BungeeListener method onConnect.
@EventHandler
public void onConnect(ServerConnectEvent event) {
/*
* Connect chain starts here,
* this method will sent a PartiesPacket to the player server
*/
if (event.isCancelled())
return;
ProxiedPlayer proxyPlayer = event.getPlayer();
// Return if its not a player
if (proxyPlayer.getServer() == null)
return;
// Return if the player is already in the server
if (proxyPlayer.getServer().getInfo().equals(event.getTarget()))
return;
// Return if the server is not into the follow list
if (!listContains(ConfigMain.follow_listserver, proxyPlayer.getServer().getInfo().getName()))
return;
/*
*
*/
try {
ByteArrayOutputStream stream = new ByteArrayOutputStream();
DataOutputStream out = new DataOutputStream(stream);
// Initialize packet
Packet packet = new Packet(plugin.getDescription().getVersion(), event.getTarget().getName(), ConfigMain.follow_neededrank, ConfigMain.follow_minimumrank);
// Write to the DataOutputStream the data
packet.write(out);
if (proxyPlayer.getServer() != null) {
PartiesBungee.debugLog("Parties packet sent to " + proxyPlayer.getServer().getInfo().getName());
proxyPlayer.getServer().sendData(partiesChannel, stream.toByteArray());
}
} catch (IOException e) {
e.printStackTrace();
}
}
use of net.md_5.bungee.event.EventHandler in project DragonProxy by DragonetMC.
the class DPAddonBungee method onServerConnected.
@EventHandler
public void onServerConnected(ServerConnectedEvent event) {
if (!bedrockPlayers.contains(event.getPlayer().getUniqueId()))
return;
// forward the DragonProxy Notification message!
getProxy().getScheduler().schedule(this, () -> {
BinaryStream bis = new BinaryStream();
bis.putString("Notification");
event.getPlayer().sendData("DragonProxy", bis.getBuffer());
}, 2000L, TimeUnit.MILLISECONDS);
}
use of net.md_5.bungee.event.EventHandler in project DragonProxy by DragonetMC.
the class DPAddonBungee method onServerSwitch.
@EventHandler
public void onServerSwitch(ServerSwitchEvent event) {
if (!bedrockPlayers.contains(event.getPlayer().getUniqueId()))
return;
// We don't know that another server supports forwarding or not so we disable forwarding for now!
BinaryStream bis = new BinaryStream();
bis.putString("PacketFoward");
bis.putBoolean(false);
event.getPlayer().sendData("DragonProxy", bis.getBuffer());
}
use of net.md_5.bungee.event.EventHandler in project DragonProxy by DragonetMC.
the class DPAddonBungee method onPlayerPreLogin.
@EventHandler(priority = EventPriority.LOW)
public void onPlayerPreLogin(PreLoginEvent event) {
if (ProxyServer.getInstance().getConfig().isOnlineMode()) {
event.registerIntent(this);
ProxyServer.getInstance().getScheduler().runAsync(this, new Runnable() {
@Override
public void run() {
String extraDataInHandshake = ((InitialHandler) event.getConnection()).getExtraDataInHandshake();
List<String> bypassIPs = config.getConfiguration().getStringList("auth_bypass_ip");
if (!bypassIPs.isEmpty() && bypassIPs.contains(event.getConnection().getAddress().getHostString())) {
// check if IP
String[] xboxliveProfileParts = extraDataInHandshake.split("\0");
if (xboxliveProfileParts.length == 2) {
LoginChainDecoder decoder = new LoginChainDecoder(xboxliveProfileParts[1].getBytes(), null);
try {
// verify login chain, extract players UUID and name
decoder.decode();
} catch (NullPointerException ex) {
}
if (decoder.isLoginVerified()) {
ReflectedClass initialHandler = new ReflectedClass(event.getConnection());
initialHandler.setField("name", decoder.username);
initialHandler.setField("uniqueId", decoder.clientUniqueId);
event.getConnection().setOnlineMode(false);
getLogger().info("Bedrock player " + decoder.username + " uuid : " + decoder.clientUniqueId + " injected in InitialHandler !");
bedrockPlayers.add(event.getConnection().getUniqueId());
} else {
getLogger().info("Bedrock player Fail to verify XBox Identity " + decoder.username);
event.getConnection().disconnect(TextComponent.fromLegacyText("Fail to verify XBox Identity, please login to XboxLive and retry."));
}
}
}
event.completeIntent(instance);
}
});
}
}
Aggregations