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


Java PlayerTeleportEvent.getPlayer方法代码示例

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


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

示例1: onPlayerTeleport

import org.bukkit.event.player.PlayerTeleportEvent; //导入方法依赖的package包/类
@EventHandler
public void onPlayerTeleport(PlayerTeleportEvent e) { // ����Ҵ��ͺ���¾�����
	final Game bw = io.github.bedwarsrel.BedwarsRel.Main.getInstance()
			.getGameManager().getGameOfPlayer(e.getPlayer());
	if (bw == null) {
		return;
	}
	if (!Config.isGameEnabledXP(bw.getName())) {
		return;
	}
	final Player p = e.getPlayer();
	Bukkit.getScheduler().runTaskLater(Main.plugin, new Runnable() {

		@Override
		public void run() {
			XPManager.updateXPBar(bw.getName(), p);
		}
	}, 5);

}
 
开发者ID:Ldcr993519867,项目名称:BedwarsXP,代码行数:21,代码来源:NewEventListeners.java

示例2: onPlayerTeleport

import org.bukkit.event.player.PlayerTeleportEvent; //导入方法依赖的package包/类
@EventHandler
public void onPlayerTeleport(PlayerTeleportEvent e) { // ����Ҵ��ͺ���¾�����
	final Game bw = io.github.yannici.bedwars.Main.getInstance()
			.getGameManager().getGameOfPlayer(e.getPlayer());
	if (bw == null) {
		return;
	}
	if (!Config.isGameEnabledXP(bw.getName())) {
		return;
	}
	final Player p = e.getPlayer();
	Bukkit.getScheduler().runTaskLater(Main.plugin, new Runnable() {

		@Override
		public void run() {
			XPManager.updateXPBar(bw.getName(), p);
		}
	}, 5);

}
 
开发者ID:Ldcr993519867,项目名称:BedwarsXP,代码行数:21,代码来源:OldEventListeners.java

示例3: onPlayerTeleport

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

	final Player player = event.getPlayer();
	final int visibleDistance = server.getViewDistance() * 16;
	
	// Fix the visibility issue one tick later
	server.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() {
		@Override
		public void run() {
			// Refresh nearby clients
			
			String version;

	        version = Bukkit.getServer().getClass().getPackage().getName();
	        if (version.contains("v1_11")) {
	        	TeleportFix_1_11.updateEntities(getPlayersWithin(player, visibleDistance));

	        } else if (version.contains("v1_12")) {
	        	TeleportFix_1_12.updateEntities(getPlayersWithin(player, visibleDistance));
	        }
			
			//System.out.println("Applying fix ... " + visibleDistance);
		}
	}, TELEPORT_FIX_DELAY);
}
 
开发者ID:Maximuspayne,项目名称:NavyCraft2-Lite,代码行数:27,代码来源:TeleportFix.java

示例4: onTeleportEvent

import org.bukkit.event.player.PlayerTeleportEvent; //导入方法依赖的package包/类
@EventHandler
public void onTeleportEvent(PlayerTeleportEvent e) {
	final Player player = e.getPlayer();
	if (teleportBetweenWorlds(e.getTo().getWorld(), e.getFrom().getWorld()) && teleportToLobby(e.getTo().getWorld())) {
		SkyWarsReloaded.get().getServer().getScheduler().scheduleSyncDelayedTask(SkyWarsReloaded.get(), new Runnable() {
			public void run() {
				if (player != null) {
					givePlayerItems(player);
				}
			}
		}, 8);
	} else if (teleportBetweenWorlds(e.getTo().getWorld(), e.getFrom().getWorld()) && !teleportToLobby(e.getTo().getWorld())) {
		SkyWarsReloaded.get().getServer().getScheduler().scheduleSyncDelayedTask(SkyWarsReloaded.get(), new Runnable() {
			public void run() {
				if (player != null) {
					removePlayerItems(player);
				}
			}
		}, 8);
	}
}
 
开发者ID:smessie,项目名称:SkyWarsReloaded,代码行数:22,代码来源:LobbyListener.java

示例5: teleport

import org.bukkit.event.player.PlayerTeleportEvent; //导入方法依赖的package包/类
@EventHandler
public void teleport(PlayerTeleportEvent e){
	if(e.getPlayer().hasMetadata("NPC"))return;
	if(!rs.worldExists(e.getTo().getWorld().getName())){
		if(rs.getPlayerData(e.getPlayer())==null)return;
		rs.deletePlayer(e.getPlayer());
		return;
	}
	if(rs.getPlayerData(e.getPlayer())!=null)return;
	Player p=e.getPlayer();
	File data=new File(rs.getDataFolder()+File.separator+"PlayerDatas"+File.separator+p.getUniqueId().toString()+".yml");
	if(!data.exists()){//�������ļ��Ƿ����,������������ʼ��һ���ļ�
		try {data.createNewFile();} catch (IOException e1) {}
		PlayerData pd=new PlayerData(p.getUniqueId(),p.getWorld().getName(), rs.getSleepMax(), rs.getThirstMax(), 0, 37, 0, rs.getPhysical_strength());
		pd.savaData();
	}
	rs.addPlayerData(p, Utils.getPlayerData(p));
}
 
开发者ID:SchoolUniform,项目名称:RealSurvival,代码行数:19,代码来源:BasicEvent.java

示例6: onPearlClip

import org.bukkit.event.player.PlayerTeleportEvent; //导入方法依赖的package包/类
@EventHandler(ignoreCancelled = true, priority = EventPriority.NORMAL)
public void onPearlClip(PlayerTeleportEvent event) {
    if (event.getCause() == PlayerTeleportEvent.TeleportCause.ENDER_PEARL) {
        Location to = event.getTo();
        if (blockedPearlTypes.contains(to.getBlock().getType())) {
            Player player = event.getPlayer();
            player.sendMessage(ChatColor.YELLOW + "You have been detected trying to pearl glitch, your pearl has been refunded and cooldown wiped.");
            plugin.getTimerManager().getEnderPearlTimer().refund(player);

            event.setCancelled(true);
            return;
        }

        to.setX(to.getBlockX() + 0.5);
        to.setZ(to.getBlockZ() + 0.5);
        event.setTo(to);
    }
}
 
开发者ID:funkemunky,项目名称:HCFCore,代码行数:19,代码来源:PearlGlitchListener.java

示例7: onPearlClip

import org.bukkit.event.player.PlayerTeleportEvent; //导入方法依赖的package包/类
@EventHandler(ignoreCancelled = true, priority = EventPriority.NORMAL)
public void onPearlClip(PlayerTeleportEvent event) {
	if (event.getCause() == PlayerTeleportEvent.TeleportCause.ENDER_PEARL) {
		Location to = event.getTo();
		if (blockedPearlTypes.contains(to.getBlock().getType())) {
			Player player = event.getPlayer();
			player.sendMessage(ChatColor.RED + "You cannot pearl there.");
			removeCooldown(player);
			event.setCancelled(true);

			return;
		}
		to.setX(to.getBlockX() + 0.5D);
		to.setZ(to.getBlockZ() + 0.5D);
		event.setTo(to);

	}
}
 
开发者ID:HuliPvP,项目名称:Chambers,代码行数:19,代码来源:EnderpearlListener.java

示例8: onPlayerSwitch

import org.bukkit.event.player.PlayerTeleportEvent; //导入方法依赖的package包/类
@EventHandler
public void onPlayerSwitch(final PlayerTeleportEvent e) {
    if(RandomCoords.getPlugin().config.getStringList("OnJoinWorlds") == null )  { return; }
    if(e.getCause() == PlayerTeleportEvent.TeleportCause.NETHER_PORTAL || e.getCause() == PlayerTeleportEvent.TeleportCause.END_PORTAL) {
        return;
    }
    final List<String> list = RandomCoords.getPlugin().config.getStringList("OnJoinWorlds");
    if(list.isEmpty()) { return; }
    if(e.getTo().getWorld() == e.getFrom().getWorld()) { return; }
    if(list.contains(e.getTo().getWorld().getName())) {
        if(e.getTo().getWorld().getPlayers().contains(e.getPlayer())) { return; }
        final Player p = e.getPlayer();
        //coordinates.finalCoordinates(p, 574272099, 574272099, e.getTo().getWorld(), CoordType.JOINWORLD, 0);
        coordinatesManager.randomlyTeleportPlayer(p, e.getTo().getWorld(), coordinatesManager.key, coordinatesManager.key, CoordType.JOINWORLD, 0);

    }


}
 
开发者ID:jolbol1,项目名称:RandomCoordinatesV2,代码行数:20,代码来源:PlayerSwitchWorld.java

示例9: playerTeleportEvent

import org.bukkit.event.player.PlayerTeleportEvent; //导入方法依赖的package包/类
@EventHandler
public void playerTeleportEvent(PlayerTeleportEvent event)
{
	Player player = event.getPlayer();
	
	PlayerGUIPage playerGUIContainer = PlayerData.getPlayerData(player).getPlayerGUIPage();
	if(playerGUIContainer != null)
	{
		if(event.getCause() != PlayerTeleportEvent.TeleportCause.UNKNOWN)
		{
			playerGUIContainer.destroy();
			PlayerData.getPlayerData(player).setPlayerGUIPage(null);
			PlayerData.getPlayerData(player).setPlayerPreviousGUIPage(null);
		}
	}
}
 
开发者ID:Kloudy,项目名称:HoloGUIApi,代码行数:17,代码来源:PlayerTeleportEventListener.java

示例10: onTeleport

import org.bukkit.event.player.PlayerTeleportEvent; //导入方法依赖的package包/类
@EventHandler
public void onTeleport(final PlayerTeleportEvent e) {
	final Player p = e.getPlayer();
	if (e.getCause().equals(TeleportCause.SPECTATE)
			&& !(p.hasPermission("essentials.tp"))){ 
		e.setCancelled(true);
		p.sendMessage(ChatColor.RED + "You do not have permission to /tp");
	}
	
	if (!e.getFrom().getWorld().equals(e.getTo().getWorld())) {
		MultiverseCore mv = (MultiverseCore) Bukkit.getServer()
				.getPluginManager().getPlugin("Multiverse-Core");
		MVWorldManager wm = mv.getMVWorldManager();
		MultiverseWorld toWorld = wm.getMVWorld(e.getTo().getWorld()
				.getName());
		MultiverseWorld fromWorld = wm.getMVWorld(e.getFrom().getWorld()
				.getName());
		if (toWorld != fromWorld
				&& !p.getGameMode().equals(toWorld.getGameMode())) {
			p.setGameMode(toWorld.getGameMode());
		}
	}
}
 
开发者ID:bobmandude9889,项目名称:iZenith-PVP,代码行数:24,代码来源:TeleportListener.java

示例11: onTeleport

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

	final PlayerStat stat = PlayerStat.TELEPORTS;

	// 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().toString(), "value", 1, "world",
					event.getFrom().getWorld().getName(), "destWorld", event.getTo().getWorld().getName(), "cause", event.getCause().toString()));

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

示例12: onPlayerTeleport

import org.bukkit.event.player.PlayerTeleportEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onPlayerTeleport(final PlayerTeleportEvent event) {
    final Player p = event.getPlayer();
    final IPet pi = EchoPet.getManager().getPet(p);
    Iterator<IPet> i = EchoPet.getManager().getPets().iterator();
    while (i.hasNext()) {
        IPet pet = i.next();
        if (pet.getEntityPet() instanceof IEntityPacketPet && ((IEntityPacketPet) pet.getEntityPet()).hasInititiated()) {
            if (GeometryUtil.getNearbyEntities(event.getTo(), 50).contains(pet)) {
                ((IEntityPacketPet) pet.getEntityPet()).updatePosition();
            }
        }
    }
    if (pi != null) {
        if (!WorldUtil.allowPets(event.getTo())) {
            Lang.sendTo(p, Lang.PETS_DISABLED_HERE.toString().replace("%world%", WordUtils.capitalizeFully(event.getTo().getWorld().getName())));
            EchoPet.getManager().saveFileData("autosave", pi);
            EchoPet.getSqlManager().saveToDatabase(pi, false);
            EchoPet.getManager().removePet(pi, false);
        }
    }
}
 
开发者ID:TechzoneMC,项目名称:SonarPet,代码行数:23,代码来源:PetOwnerListener.java

示例13: on

import org.bukkit.event.player.PlayerTeleportEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void on(PlayerTeleportEvent event) {
    if (!isCurrentlyFrozen(event.getPlayer().getUniqueId())) return;

    Player player = event.getPlayer();

    switch (event.getCause()) {
        case PLUGIN:
            // skip if it was to the same location as currently set, stops
            // resetting particles/metadata on border knockback
            if (event.getTo().equals(getFreezeLocation(player).get())) return;
        case COMMAND:
        case UNKNOWN:
            // set new location and reset particles
            setFreezeLocation(player, event.getTo());
            startParticleSpawning(player, event.getTo());
            potionApplier.addPotions(player);
    }
}
 
开发者ID:Eluinhost,项目名称:FancyFreeze,代码行数:20,代码来源:DefaultFreezer.java

示例14: onPlayerChangedWorld

import org.bukkit.event.player.PlayerTeleportEvent; //导入方法依赖的package包/类
@EventHandler
public void onPlayerChangedWorld(PlayerTeleportEvent event){
	World from = event.getFrom().getWorld();
	World to = event.getTo().getWorld();
	
	if(!from.getUID().equals(to.getUID())){
		Player player = event.getPlayer();
		
		if(player.hasPermission("spigotplus.multiworld.leave." + from.getName())){
			if(player.hasPermission("spigotplus.multiworld.enter." + to.getName())){
				// We don't set the event to be "uncanceled" to avoid interfering with
				// the work of other plugins, as we don't care what happens to the event
				// provided that by our books it is allowed.
				return;
			} else {
				player.sendMessage(ChatColor.RED + "You are not permitted to enter this world.");
			}
		} else {
			player.sendMessage(ChatColor.RED + "You are not permitted to leave this world.");
		}
		//event.setTo(event.getFrom());
		event.setCancelled(true);
	}
}
 
开发者ID:robotman3000,项目名称:Spigot-Plus,代码行数:25,代码来源:WorldManager.java

示例15: onPlayerTeleport

import org.bukkit.event.player.PlayerTeleportEvent; //导入方法依赖的package包/类
@EventHandler
   public void onPlayerTeleport(PlayerTeleportEvent e){
   	if (e.isCancelled()) {
           return;
       }
   	
   	final Player p = e.getPlayer();
   	Location lfrom = e.getFrom();
   	Location lto = e.getTo();    	
   	
   	if (e.getCause().equals(PlayerTeleportEvent.TeleportCause.CHORUS_FRUIT)){
   		final Region rfrom = RedProtect.get().rm.getTopRegion(lfrom);
       	final Region rto = RedProtect.get().rm.getTopRegion(lto);
       	
   		if (rfrom != null && !rfrom.canTeleport(p)){
       		RPLang.sendMessage(p, "playerlistener.region.cantuse");
               e.setCancelled(true);    		
       	}
       	if (rto != null && !rto.canTeleport(p)){
       		RPLang.sendMessage(p, "playerlistener.region.cantuse");
               e.setCancelled(true);    		
       	}
   	}
}
 
开发者ID:FabioZumbi12,项目名称:RedProtect,代码行数:25,代码来源:RPMine19.java


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