当前位置: 首页>>代码示例>>Java>>正文


Java PlayerKickEvent类代码示例

本文整理汇总了Java中org.bukkit.event.player.PlayerKickEvent的典型用法代码示例。如果您正苦于以下问题:Java PlayerKickEvent类的具体用法?Java PlayerKickEvent怎么用?Java PlayerKickEvent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


PlayerKickEvent类属于org.bukkit.event.player包,在下文中一共展示了PlayerKickEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onLeave

import org.bukkit.event.player.PlayerKickEvent; //导入依赖的package包/类
@EventHandler
public void onLeave(PlayerKickEvent event){
	Player p = event.getPlayer();
	SPlayer player = SPlayer.getDPlayer(p);
	Skywars.getStorage().unloadData(player);
	event.setLeaveMessage(null);
	Arena a = new ArenaManager().getArena(p);
	if(a==null){
		return;
	}
	a.leave(p);

	player.removeHolo(player);
	
	
}
 
开发者ID:SpikyBite,项目名称:BiteSkywars,代码行数:17,代码来源:PlayerListener.java

示例2: onPlayerKick

import org.bukkit.event.player.PlayerKickEvent; //导入依赖的package包/类
@EventHandler
public void onPlayerKick(PlayerKickEvent event){
	Player player = event.getPlayer();
	Location location = player.getLocation();
	
	PlayerKickObsel obsel = new PlayerKickObsel(
			new Date().getTime(),
			location.getBlockX(),
			location.getBlockY(),
			location.getBlockZ(),
			location.getWorld().getName(),
			player.getName(),
			event.getReason());
	
	JSONObselManager.getInstance().addObsel(obsel);
}
 
开发者ID:Lyon1-Asterix,项目名称:Minetrace,代码行数:17,代码来源:MinetraceListener.java

示例3: onPlayerKick

import org.bukkit.event.player.PlayerKickEvent; //导入依赖的package包/类
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onPlayerKick(PlayerKickEvent event) {
    Bukkit.getScheduler().scheduleSyncDelayedTask(DiscordSRV.getPlugin(), () -> {
        if (Bukkit.getBannedPlayers().contains(Bukkit.getOfflinePlayer(event.getPlayer().getUniqueId()))) {
            if (event.getPlayer() instanceof OfflinePlayer) {
                if (!DiscordSRV.config().getBoolean("BanSynchronizationMinecraftToDiscord")) {
                    DiscordSRV.debug("Not handling ban for player " + event.getPlayer().getName() + " (" + event.getPlayer().getUniqueId() + ") because doing so is disabled in the config");
                    return;
                }

                DiscordSRV.debug("Handling ban for player " + event.getPlayer().getName() + " (" + event.getPlayer().getUniqueId() + ")");
                DiscordUtil.banMember(DiscordUtil.getMemberById(DiscordSRV.getPlugin().getAccountLinkManager().getDiscordId(event.getPlayer().getUniqueId())));
            }
        }
    }, 20);
}
 
开发者ID:Scarsz,项目名称:DiscordSRV,代码行数:17,代码来源:PlayerBanListener.java

示例4: onKick

import org.bukkit.event.player.PlayerKickEvent; //导入依赖的package包/类
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onKick(final PlayerKickEvent event) {

	final PlayerStat stat = PlayerStat.TIMES_KICKED;

	// Get player
	final Player player = event.getPlayer();

	// Do general check
	if (!plugin.doGeneralCheck(player, stat))
		return;

	// Update value to new stat.
	plugin.getDataManager().setPlayerInfo(player.getUniqueId(), stat, StatzUtil.makeQuery("uuid",
			player.getUniqueId(), "value", 1, "world", player.getWorld().getName(), "reason", event.getReason()));

}
 
开发者ID:Staartvin,项目名称:Statz,代码行数:18,代码来源:TimesKickedListener.java

示例5: disconnect

import org.bukkit.event.player.PlayerKickEvent; //导入依赖的package包/类
public void disconnect(String s) {
    // CraftBukkit start - fire PlayerKickEvent
    String leaveMessage = EnumChatFormat.YELLOW + this.player.getName() + " left the game.";

    PlayerKickEvent event = new PlayerKickEvent(this.server.getPlayer(this.player), s, leaveMessage);

    if (this.server.getServer().isRunning()) {
        this.server.getPluginManager().callEvent(event);
    }

    if (event.isCancelled()) {
        // Do not kick the player
        return;
    }
    // Send the possibly modified leave message
    s = event.getReason();
    // CraftBukkit end
    ChatComponentText chatcomponenttext = new ChatComponentText(s);

    this.networkManager.handle(new PacketPlayOutKickDisconnect(chatcomponenttext), new GenericFutureListener[] { new PlayerConnectionFuture(this, chatcomponenttext)});
    this.a(chatcomponenttext); // CraftBukkit - Process quit immediately
    this.networkManager.g();
}
 
开发者ID:OvercastNetwork,项目名称:CraftBukkit,代码行数:24,代码来源:PlayerConnection.java

示例6: onPlayerKick

import org.bukkit.event.player.PlayerKickEvent; //导入依赖的package包/类
@EventHandler
public void onPlayerKick(PlayerKickEvent event) {
	Player player = event.getPlayer();
	//Retrieves important information about player
	String name = player.getName();
	String uuid = player.getUniqueId().toString();
	String ip = player.getAddress().getAddress().getHostAddress();
	Date time = new Date();
	boolean online = true;
	String world = player.getWorld().getName();
	String location = getLocation(player);
	//Upserts to database unless the player is in the do not track list
	if(!(playerIsIncognito(name))) {
		Bukkit.getScheduler().runTaskAsynchronously(this, new Runnable() {
			public void run() {
				getSQLDatabase().updatePlayerData(name, uuid, ip, time, online, world, location);
			}
		});
	}
}
 
开发者ID:StarQuestMinecraft,项目名称:StarQuestCode,代码行数:21,代码来源:SQGlobalInfo.java

示例7: PlayerKick

import org.bukkit.event.player.PlayerKickEvent; //导入依赖的package包/类
@EventHandler(priority = EventPriority.LOWEST)
public void PlayerKick(final PlayerKickEvent event) {
	final Player player = event.getPlayer();
	if (player.hasMetadata("NPC")) {
		return;
	}
	if (plugin.isUsingCustomJoinQuitMessagesEnabled()) {
		kicked.add(event.getPlayer().getName());
		event.setLeaveMessage("CRAZYLOGIN.KICK");
	}
	if (!plugin.isLoggedIn(player) && plugin.isDelayingJoinQuitMessagesEnabled()) {
		event.setLeaveMessage(null);
	}
	PlayerQuit(player, true);
	Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() {

		@Override
		public void run() {
			plugin.unregisterDynamicHooks();
		}
	}, 5);
}
 
开发者ID:ST-DDT,项目名称:CrazyLogin,代码行数:23,代码来源:PlayerListener.java

示例8: onPlayerKick

import org.bukkit.event.player.PlayerKickEvent; //导入依赖的package包/类
@EventHandler
public void onPlayerKick(PlayerKickEvent e)
{
    Set<ProtectedRegion> regions = playerRegions.remove(e.getPlayer());
    if (regions != null)
    {
        for(ProtectedRegion region : regions)
        {
            RegionLeaveEvent leaveEvent = new RegionLeaveEvent(region, e.getPlayer(), MovementWay.DISCONNECT);
            RegionLeftEvent leftEvent = new RegionLeftEvent(region, e.getPlayer(), MovementWay.DISCONNECT);

            BAMradio.Instance.getServer().getPluginManager().callEvent(leaveEvent);
            BAMradio.Instance.getServer().getPluginManager().callEvent(leftEvent);
        }
    }
}
 
开发者ID:fr34kyn01535,项目名称:BAMradio,代码行数:17,代码来源:WGRegionEventsListener.java

示例9: onPlayerKick

import org.bukkit.event.player.PlayerKickEvent; //导入依赖的package包/类
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onPlayerKick(final PlayerKickEvent event) {
    this.plugin.entering(this.getClass(), "onPlayerKick");

    String msg = this.punishmentDb.getLeaveMessages().remove(event.getPlayer().getUniqueId());
    if (msg != null) {
        if (this.plugin.isDebugEnabled()) {
            this.plugin.debug("Message not null: '" + msg + '\'');
        }
    } else {
        msg = this.plugin.getMessages().get(MessageId.player_standardKickMessage, event.getPlayer().getName())[0];
        if (this.plugin.isDebugEnabled()) {
            this.plugin.debug("Message is null, setting default: '" + msg + '\'');
        }
    }
    event.setLeaveMessage(msg);

    this.plugin.exiting(this.getClass(), "onPlayerKick");
}
 
开发者ID:Ribesg,项目名称:NPlugins,代码行数:20,代码来源:PunishmentListener.java

示例10: onQuit

import org.bukkit.event.player.PlayerKickEvent; //导入依赖的package包/类
@EventHandler
public void onQuit(PlayerKickEvent e) {
	if(pl.getManagers().getPlayerManager().isOnline(e.getPlayer().getName())) {
		final XPlayer xp = pl.getManagers().getPlayerManager().getPlayer(e.getPlayer().getName());
		if(xp.isInArena()) {
			new BukkitRunnable() {

				@Override
				public void run() {
					if(!xp.getBukkitPlayer().isOnline()) {
						xp.getArena().leaveArena(xp);
						xp.setArena(null);
					}
				}
				
			}.runTaskLater(pl, 15L);
		}
	}
}
 
开发者ID:xEssentials,项目名称:xEssentials-deprecated-bukkit,代码行数:20,代码来源:MemorySafetyEvent.java

示例11: onQuit

import org.bukkit.event.player.PlayerKickEvent; //导入依赖的package包/类
@EventHandler
public void onQuit(PlayerKickEvent e) {
	if(essentialsPlayers.containsKey(e.getPlayer().getName())) {
		XPlayer xp = pl.getManagers().getPlayerManager().getPlayer(e.getPlayer().getName());
		if(xp.isVanished()) {
			essentialsPlayers.remove(e.getPlayer().getName());
			return;
		}
		ItemStack[] items = e.getPlayer().getInventory().getContents();
		Skeleton skel = (Skeleton) e.getPlayer().getWorld().spawnEntity(e.getPlayer().getLocation(), EntityType.SKELETON);
		//lets pimp the skeleton a bit!
		turnSkelToNpc(skel, e.getPlayer().getName());
		npcs.put(skel.getUniqueId(), items);
		essentialsPlayers.remove(e.getPlayer().getName());
		NpcDespawn(skel);
	}
}
 
开发者ID:xEssentials,项目名称:xEssentials-deprecated-bukkit,代码行数:18,代码来源:NpcReplacePlayerEvent.java

示例12: onQuit

import org.bukkit.event.player.PlayerKickEvent; //导入依赖的package包/类
@EventHandler
public void onQuit(PlayerKickEvent e) {
	if(pl.getManagers().getPlayerManager().isOnline(e.getPlayer().getName())) {
		if(pl.getConfiguration().getDebugConfig().isEnabled()) {
			xEssentials.log("player "+ e.getPlayer().getName() +" is still online for kick event for potato event and gets removed now.", LogType.DEBUG);
		}
		XPlayer xp = pl.getManagers().getPlayerManager().getPlayer(e.getPlayer().getName());
		if(xp instanceof XPlayer) {	
			if(xp.isPotato()) {
				xp.unvanish();
				xp.getBukkitPlayer().removePotionEffect(PotionEffectType.BLINDNESS);
				xp.getBukkitPlayer().removePotionEffect(PotionEffectType.INVISIBILITY);
				xp.getBukkitPlayer().removePotionEffect(PotionEffectType.SPEED);
				Item potato = xp.getPotato();
				potato.remove();
				xp.removePotato();
			}
		}	
	}
}
 
开发者ID:xEssentials,项目名称:xEssentials-deprecated-bukkit,代码行数:21,代码来源:PotatoMoveEvent.java

示例13: onPlayerKick

import org.bukkit.event.player.PlayerKickEvent; //导入依赖的package包/类
@EventHandler
public void onPlayerKick(PlayerKickEvent event) {
	Player p = event.getPlayer();
	ArenaManager am = SimpleSurvivalGames.instance.getArenaManager();
	
	// Make sure the player is not null
	if(p == null)
		return;
	
	// Make sure the event was not cancelled
	if(event.isCancelled())
		return;
	
	// Is the current in any arena
	if(am.isInArena(p)) {
		Arena arena = am.getPlayer(p).getArena();
		
		// Kick the player out of the arena
		SimpleSurvivalGames.instance.getArenaManager().kick(p);
		
		// Show a message to all players this player died
		arena.sendMessage(ChatColor.GOLD + p.getName() + ChatColor.DARK_RED + " lost connection!");
	}
}
 
开发者ID:timvisee,项目名称:simple-survival-games,代码行数:25,代码来源:SSGPlayerListener.java

示例14: shouldNotCancelKick

import org.bukkit.event.player.PlayerKickEvent; //导入依赖的package包/类
@Test
public void shouldNotCancelKick() {
    // given
    given(settings.getProperty(RestrictionSettings.FORCE_SINGLE_SESSION)).willReturn(false);
    String name = "Bobby";
    Player player = mockPlayerWithName(name);
    PlayerKickEvent event = new PlayerKickEvent(player, "You logged in from another location", "");
    given(antiBotService.wasPlayerKicked(name)).willReturn(false);

    // when
    listener.onPlayerKick(event);

    // then
    assertThat(event.isCancelled(), equalTo(false));
    verify(antiBotService).wasPlayerKicked(name);
    verify(management).performQuit(player);
}
 
开发者ID:AuthMe,项目名称:AuthMeReloaded,代码行数:18,代码来源:PlayerListenerTest.java

示例15: shouldNotCancelOrdinaryKick

import org.bukkit.event.player.PlayerKickEvent; //导入依赖的package包/类
@Test
public void shouldNotCancelOrdinaryKick() {
    // given
    given(settings.getProperty(RestrictionSettings.FORCE_SINGLE_SESSION)).willReturn(true);
    String name = "Bobby";
    Player player = mockPlayerWithName(name);
    PlayerKickEvent event = new PlayerKickEvent(player, "No longer desired here!", "");
    given(antiBotService.wasPlayerKicked(name)).willReturn(true);

    // when
    listener.onPlayerKick(event);

    // then
    assertThat(event.isCancelled(), equalTo(false));
    verify(antiBotService).wasPlayerKicked(name);
    verifyZeroInteractions(management);
}
 
开发者ID:AuthMe,项目名称:AuthMeReloaded,代码行数:18,代码来源:PlayerListenerTest.java


注:本文中的org.bukkit.event.player.PlayerKickEvent类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。