本文整理汇总了Java中org.bukkit.event.player.PlayerLoginEvent.Result类的典型用法代码示例。如果您正苦于以下问题:Java Result类的具体用法?Java Result怎么用?Java Result使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Result类属于org.bukkit.event.player.PlayerLoginEvent包,在下文中一共展示了Result类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: playerLogin
import org.bukkit.event.player.PlayerLoginEvent.Result; //导入依赖的package包/类
@EventHandler
public void playerLogin(PlayerLoginEvent event){
VPPlayer player = preLoad(event.getPlayer());
if(player == null){
ErrorLogger.addError("Couldn't preload " + event.getPlayer());
event.setResult(Result.KICK_OTHER);
return;
}
if(player.isOnline()){
event.setResult(Result.KICK_OTHER);
//player.setOffline();
return;
}
VanillaPlusCore.getChannelManager().init(player);
VPPLoginEvent e = new VPPLoginEvent(player);
e.setResult(Result.ALLOWED);
Bukkit.getServer().getPluginManager().callEvent(e);
event.setResult(e.getResult());
}
示例2: onJoin
import org.bukkit.event.player.PlayerLoginEvent.Result; //导入依赖的package包/类
@EventHandler
void onJoin(PlayerLoginEvent e) {
if (BanManager.isBanido(e.getPlayer().getName())) {
String[] ban = BanManager.getBan(e.getPlayer().getName()).split(";");
String motivo = ban[2], admin = ban[3];
int tempo = Integer.parseInt(ban[1]);
if (tempo == 0) {
e.disallow(Result.KICK_OTHER, MensagensManager.getMensagem("Ban.Join.Permanente").replace("<admin>", admin).replace("<motivo>", motivo));
return;
}
if (Utils.getTempoRestante(e.getPlayer().getName()) >= tempo) {
BanManager.unbanPlayer(e.getPlayer().getName());
return;
}
long tempoRestante = (tempo - Utils.getTempoRestante(e.getPlayer().getName()));
e.disallow(Result.KICK_OTHER, MensagensManager.getMensagem("Ban.Join.Temporario").replace("<tempo>", Long.toString(tempoRestante)).replace("<admin>", admin).replace("<motivo>", motivo));
} else if (BanManager.isIpBanido(e.getAddress().getHostName())) {
e.disallow(Result.KICK_OTHER, MensagensManager.getMensagem("Ban.Join.Ip_Banido"));
}
}
示例3: onPlayerLogin
import org.bukkit.event.player.PlayerLoginEvent.Result; //导入依赖的package包/类
@EventHandler(ignoreCancelled = false)
public void onPlayerLogin(cn.nukkit.event.player.PlayerLoginEvent event) {
if (canIgnore(PlayerLoginEvent.getHandlerList())) {
return;
}
Player bukkitPlayer = PokkitPlayer.toBukkit(event.getPlayer());
InetAddress address = bukkitPlayer.getAddress().getAddress();
PlayerLoginEvent bukkitEvent = new PlayerLoginEvent(bukkitPlayer, bukkitPlayer.getAddress().getHostName(),
address, event.isCancelled() ? Result.KICK_OTHER : Result.ALLOWED, event.getKickMessage(), address);
Bukkit.getPluginManager().callEvent(bukkitEvent);
event.setCancelled(bukkitEvent.getResult() != Result.ALLOWED);
event.setKickMessage(bukkitEvent.getKickMessage());
}
示例4: onPlayerLogin
import org.bukkit.event.player.PlayerLoginEvent.Result; //导入依赖的package包/类
/**
* Triggered when a player TRIES to join the server.
* @param e
*/
@EventHandler
public void onPlayerLogin(PlayerLoginEvent e)
{
Player p = e.getPlayer();
if (plugin.isInMaintenanceMode() && !p.isOp())
{
e.disallow(Result.KICK_OTHER,
ChatColor.YELLOW + plugin.getMaintenanceMessage());
}
else if (SGOnline.getPlayerCount() >= plugin.getMaxPlayers())
{
e.disallow(Result.KICK_FULL, ChatColor.YELLOW
+ "Le serveur est plein !");
}
}
示例5: onPlayerLogin
import org.bukkit.event.player.PlayerLoginEvent.Result; //导入依赖的package包/类
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void onPlayerLogin(final PlayerLoginEvent event) {
final Optional<CraftoPlayer> player = CraftoPlayer.getPlayer(event.getPlayer());
if (!player.isPresent()) { CraftoMessenger.warnStaff("Cant find craftoplayer instance of " + event.getPlayer().getName() + "!"); return; }
final Collection<Ban> bans = this.module.getBans(player.get());
if (!bans.isEmpty()) {
for (final Ban ban : bans) {
if (!ban.hasExpired()) {
if (ban.isKick()) {
event.disallow(Result.KICK_BANNED, this.module.kick.getKickMessage(ban));
}
else {
CraftoMessenger.warnStaff(player.get().getName() + " versucht zu connecten obwohl er noch gebannt ist.");
event.disallow(Result.KICK_BANNED, this.module.ban.getKickMessage(ban));
}
}
}
}
}
示例6: tooManyLoggedInAccounts
import org.bukkit.event.player.PlayerLoginEvent.Result; //导入依赖的package包/类
@EventHandler(priority = EventPriority.LOWEST)
public void tooManyLoggedInAccounts(PlayerLoginEvent event){ // Set to join because if kicked on login ip info isnt tracked.
UUID name = event.getPlayer().getUniqueId();
int count = 0;
int allowed = plugin.getConfig().getInt("banmanager.set.altlimit");
if (allowed == 0) return;
List<UUID> alts = am.getAltsListUUID(name);
Player[] players = Bukkit.getOnlinePlayers();
for (Player p: players)
if(alts.contains(p.getUniqueId())) count++;
if (count > allowed){
String reason = plugin.getConfig().getString("banmanager.set.altlimitreason");
event.setKickMessage(reason);
event.setResult(Result.KICK_BANNED);
}
}
示例7: PlayerLoginSessionCheck
import org.bukkit.event.player.PlayerLoginEvent.Result; //导入依赖的package包/类
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGH)
@Permission("crazylogin.warnsession")
@Localized({ "CRAZYLOGIN.KICKED.SESSION.DUPLICATE", "CRAZYLOGIN.SESSION.DUPLICATEWARN $Name$ $IP$" })
public void PlayerLoginSessionCheck(final AsyncPlayerPreLoginEvent event) {
if (plugin.isForceSingleSessionEnabled()) {
final Player player = Bukkit.getPlayerExact(event.getName());
if (player != null) {
if (plugin.isForceSingleSessionSameIPBypassEnabled()) {
final LoginPlayerData data = plugin.getPlayerData(player);
if (data != null) {
if (event.getAddress().getHostAddress().equals(data.getLatestIP())) {
return;
}
}
}
event.setLoginResult(AsyncPlayerPreLoginEvent.Result.KICK_OTHER);
event.setKickMessage(plugin.getLocale().getLocaleMessage(player, "KICKED.SESSION.DUPLICATE"));
plugin.broadcastLocaleMessage(true, "crazylogin.warnsession", true, "SESSION.DUPLICATEWARN", player.getName(), event.getAddress().getHostAddress());
plugin.sendLocaleMessage("SESSION.DUPLICATEWARN", player, event.getAddress().getHostAddress(), player.getName());
plugin.getCrazyLogger().log("AccessDenied", "Denied access for player " + player.getName() + " @ " + event.getAddress().getHostAddress() + " because of a player with this name being already online");
return;
}
}
}
示例8: onPlayerLogin
import org.bukkit.event.player.PlayerLoginEvent.Result; //导入依赖的package包/类
@EventHandler(priority = EventPriority.NORMAL)
public void onPlayerLogin(final PlayerLoginEvent event) {
if (event.getResult() == Result.ALLOWED) {
final UUID id = event.getPlayer().getUniqueId();
final String playerIp = event.getAddress().getHostAddress();
if (this.punishmentDb.isIdBanned(id)) {
final Punishment ban = this.punishmentDb.get(id.toString(), PunishmentType.BAN);
final String playerBannedMessage;
if (ban.isPermanent()) {
playerBannedMessage = this.plugin.getMessages().get(MessageId.player_deniedPermBanned, ban.getReason())[0];
} else {
playerBannedMessage = this.plugin.getMessages().get(MessageId.player_deniedTempBanned, ban.getReason(), TimeUtil.toString((ban.getEndDate() - System.currentTimeMillis()) / 1000))[0];
}
event.disallow(PlayerLoginEvent.Result.KICK_BANNED, playerBannedMessage);
} else if (this.punishmentDb.isIpBanned(playerIp)) {
final Punishment ipBan = this.punishmentDb.get(playerIp, PunishmentType.IPBAN);
final String ipBannedMessage;
if (ipBan.isPermanent()) {
ipBannedMessage = this.plugin.getMessages().get(MessageId.player_deniedPermIpBanned, ipBan.getReason())[0];
} else {
ipBannedMessage = this.plugin.getMessages().get(MessageId.player_deniedTempIpBanned, ipBan.getReason(), TimeUtil.toString((ipBan.getEndDate() - System.currentTimeMillis()) / 1000))[0];
}
event.disallow(PlayerLoginEvent.Result.KICK_BANNED, ipBannedMessage);
}
}
}
示例9: operatorFullJoin
import org.bukkit.event.player.PlayerLoginEvent.Result; //导入依赖的package包/类
@EventHandler(
ignoreCancelled = false,
priority = EventPriority.HIGH)
public void operatorFullJoin(PlayerLoginEvent e) {
Player player = e.getPlayer();// Caches players into a local UUID map
if(!Bssentials.uuid_map.containsKey(player.getName())) {
Bssentials.uuid_map.put(player.getName(), player.getUniqueId());
}
if(player.isOp() && e.getResult() == Result.KICK_FULL && !player.isBanned()) {
e.allow();
}
}
示例10: allowNewPlayer
import org.bukkit.event.player.PlayerLoginEvent.Result; //导入依赖的package包/类
@EventHandler(
ignoreCancelled = false,
priority = EventPriority.HIGH)
public void allowNewPlayer(PlayerLoginEvent event) {
Player player = event.getPlayer();
if(!player.hasPlayedBefore() && event.getResult() == Result.KICK_FULL && !player.isBanned()) {
if(!inst.getConfig().getBoolean("new-players-kick-if-full")) {
event.allow();
}
}
}
示例11: onJoin
import org.bukkit.event.player.PlayerLoginEvent.Result; //导入依赖的package包/类
@EventHandler
public void onJoin(PlayerLoginEvent e) {
DeathBan ban = DeathBanModule.getInstance().getBan(e.getPlayer().getUniqueId());
if(ban == null){
return;
}
if(ban.handleBan()) {
e.disallow(Result.KICK_OTHER, ban.getMessage());
}
}
示例12: onLogin
import org.bukkit.event.player.PlayerLoginEvent.Result; //导入依赖的package包/类
@EventHandler
public void onLogin(PlayerLoginEvent e) {
KingdomFactionsPlayer p = PlayerModule.getInstance().getPlayer(e.getPlayer());
if(!p.hasPermission(ServerModule.getInstance().getServerMode().getPermission())) {
e.disallow(Result.KICK_OTHER, ChatColor.translateAlternateColorCodes('&', ServerModule.getInstance().getServerMode().getMessage()));
}
}
示例13: onLogin
import org.bukkit.event.player.PlayerLoginEvent.Result; //导入依赖的package包/类
@EventHandler
private void onLogin(PlayerLoginEvent event) {
if (Game.getState() == State.INVINCIBILITY) {
if (!event.getPlayer().hasPermission(Permissions.JOIN_INVINCIBILITY)) {
event.disallow(Result.KICK_OTHER, Messages.DENY_JOIN_INVINCIBILITY);
return;
}
}
else if (Game.getState() == State.GAME) {
if (!event.getPlayer().hasPermission(Permissions.JOIN_GAME)) {
event.disallow(Result.KICK_OTHER, Messages.DENY_JOIN_INVINCIBILITY);
return;
}
}
}
示例14: execute
import org.bukkit.event.player.PlayerLoginEvent.Result; //导入依赖的package包/类
@Override
protected void execute(final Event e) {
final String r = reason != null ? reason.getSingle(e) : "";
if (r == null)
return;
for (final Player p : players.getArray(e)) {
if (e instanceof PlayerLoginEvent && p.equals(((PlayerLoginEvent) e).getPlayer()) && !Delay.isDelayed(e)) {
((PlayerLoginEvent) e).disallow(Result.KICK_OTHER, r);
} else if (e instanceof PlayerKickEvent && p.equals(((PlayerKickEvent) e).getPlayer()) && !Delay.isDelayed(e)) {
((PlayerKickEvent) e).setLeaveMessage(r);
} else {
p.kickPlayer(r);
}
}
}
示例15: onLogin
import org.bukkit.event.player.PlayerLoginEvent.Result; //导入依赖的package包/类
@EventHandler(priority = EventPriority.HIGHEST)
public void onLogin(PlayerLoginEvent event) {
Player player = event.getPlayer();
String ipAddress = event.getAddress().toString().replace("/", "");
if(plugin.file.isInWhitelistCache(ipAddress))
return;
if(plugin.file.isInBlacklistCache(ipAddress)) {
if(this.canBypass(player))
return;
plugin.getLogger().info(PluginMessages.CONSOLE_BLOCKEDLOGIN.replace("%name%", player.getName()).replace("%ip%", ipAddress));
event.setKickMessage(plugin.config.kickMessage.replace("%name%", player.getName()).replace("%ip%", ipAddress).replace("&", "§"));
event.setResult(Result.KICK_OTHER);
return;
}
if(!plugin.file.isInBlacklistCache(ipAddress) && plugin.web.isVPN(ipAddress)) {
plugin.file.addIPToBlacklist(ipAddress);
if(this.canBypass(player))
return;
plugin.getLogger().info(PluginMessages.CONSOLE_BLOCKEDLOGIN.replace("%name%", player.getName()).replace("%ip%", ipAddress));
event.setKickMessage(plugin.config.kickMessage.replace("%name%", player.getName()).replace("%ip%", ipAddress).replace("&", "§"));
event.setResult(Result.KICK_OTHER);
return;
}
plugin.file.addIPToWhitelist(ipAddress);
}