use of net.md_5.bungee.api.connection.ProxiedPlayer in project FireAPI by FireBlade-Serv.
the class StaffChatCommand method send.
public void send(ProxiedPlayer p, String message) {
String pname = this.api.getChatUtils().getStringRank(p.getName()) + " " + this.api.getChatUtils().getRankColor(p.getName()) + p.getName();
Iterator<ProxiedPlayer> it = this.players.keySet().iterator();
while (it.hasNext()) {
ProxiedPlayer next = it.next();
if (this.players.get(next)) {
next.sendMessage(new TextComponent(this.pre + pname + "§r§o : " + message));
}
}
}
use of net.md_5.bungee.api.connection.ProxiedPlayer in project LuckPerms by lucko.
the class BungeeConnectionListener method onPlayerPostLogin.
@EventHandler
public void onPlayerPostLogin(PostLoginEvent e) {
final ProxiedPlayer player = e.getPlayer();
final User user = this.plugin.getUserManager().getIfLoaded(e.getPlayer().getUniqueId());
if (this.plugin.getConfiguration().get(ConfigKeys.DEBUG_LOGINS)) {
this.plugin.getLogger().info("Processing post-login for " + player.getUniqueId() + " - " + player.getName());
}
if (user == null) {
if (this.plugin.getConfiguration().get(ConfigKeys.CANCEL_FAILED_LOGINS)) {
// disconnect the user
this.plugin.getLogger().warn("User " + player.getUniqueId() + " - " + player.getName() + " doesn't have data pre-loaded - cancelling login.");
e.getPlayer().disconnect(TextComponent.fromLegacyText(Message.LOADING_ERROR.asString(this.plugin.getLocaleManager())));
} else {
// just send a message
this.plugin.getBootstrap().getProxy().getScheduler().schedule(this.plugin.getBootstrap(), () -> {
if (!player.isConnected()) {
return;
}
player.sendMessage(TextComponent.fromLegacyText(Message.LOADING_ERROR.asString(this.plugin.getLocaleManager())));
}, 1, TimeUnit.SECONDS);
}
}
}
use of net.md_5.bungee.api.connection.ProxiedPlayer in project LuckPerms by lucko.
the class BungeeConnectionListener method onPlayerQuit.
// Wait until the last priority to unload, so plugins can still perform permission checks on this event
@EventHandler(priority = EventPriority.HIGHEST)
public void onPlayerQuit(PlayerDisconnectEvent e) {
ProxiedPlayer player = e.getPlayer();
// Register with the housekeeper, so the User's instance will stick
// around for a bit after they disconnect
this.plugin.getUserManager().getHouseKeeper().registerUsage(player.getUniqueId());
// force a clear of transient nodes
this.plugin.getBootstrap().getScheduler().doAsync(() -> {
User user = this.plugin.getUserManager().getIfLoaded(player.getUniqueId());
if (user != null) {
user.clearTransientNodes();
}
});
}
use of net.md_5.bungee.api.connection.ProxiedPlayer in project LuckPerms by lucko.
the class BungeePermissionCheckListener method onOtherPermissionCheck.
@EventHandler(priority = EventPriority.HIGHEST)
public void onOtherPermissionCheck(PermissionCheckEvent e) {
if (e.getSender() instanceof ProxiedPlayer) {
return;
}
Objects.requireNonNull(e.getPermission(), "permission");
Objects.requireNonNull(e.getSender(), "sender");
String permission = e.getPermission();
Tristate result = Tristate.fromBoolean(e.hasPermission());
String name = "internal/" + e.getSender().getName();
this.plugin.getVerboseHandler().offerCheckData(CheckOrigin.PLATFORM_PERMISSION_CHECK, name, ContextSet.empty(), permission, result);
this.plugin.getPermissionVault().offer(permission);
}
use of net.md_5.bungee.api.connection.ProxiedPlayer in project LuckPerms by lucko.
the class BungeePermissionCheckListener method onPlayerTristateCheck.
@EventHandler
public void onPlayerTristateCheck(TristateCheckEvent e) {
if (!(e.getSender() instanceof ProxiedPlayer)) {
return;
}
Objects.requireNonNull(e.getPermission(), "permission");
Objects.requireNonNull(e.getSender(), "sender");
ProxiedPlayer player = ((ProxiedPlayer) e.getSender());
User user = this.plugin.getUserManager().getIfLoaded(player.getUniqueId());
if (user == null) {
e.setResult(Tristate.UNDEFINED);
return;
}
Contexts contexts = this.plugin.getContextManager().getApplicableContexts(player);
Tristate result = user.getCachedData().getPermissionData(contexts).getPermissionValue(e.getPermission(), CheckOrigin.PLATFORM_LOOKUP_CHECK);
if (result == Tristate.UNDEFINED && this.plugin.getConfiguration().get(ConfigKeys.APPLY_BUNGEE_CONFIG_PERMISSIONS)) {
// just use the result provided by the proxy when the event was created
return;
}
e.setResult(result);
}
Aggregations