本文整理汇总了Java中org.spigotmc.event.player.PlayerSpawnLocationEvent类的典型用法代码示例。如果您正苦于以下问题:Java PlayerSpawnLocationEvent类的具体用法?Java PlayerSpawnLocationEvent怎么用?Java PlayerSpawnLocationEvent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PlayerSpawnLocationEvent类属于org.spigotmc.event.player包,在下文中一共展示了PlayerSpawnLocationEvent类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: onPlayerSpawnLocation
import org.spigotmc.event.player.PlayerSpawnLocationEvent; //导入依赖的package包/类
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onPlayerSpawnLocation(PlayerSpawnLocationEvent event) {
Player player = event.getPlayer();
if (!player.hasPlayedBefore()) {
if (this.canApply() && this.setCooldown(player, player.getUniqueId(), this.defaultCooldown, true)) {
this.setPaused(player.getUniqueId(), true);
player.sendMessage(ChatColor.GREEN + "You now have your " + getDisplayName() + ChatColor.GREEN + " timer.");
}
} else {
// If a player has their timer paused and they are not in a safezone, un-pause for them.
// We do this because disconnection pauses PVP Protection.
if (this.isPaused(player) && getRemaining(player) > 0L && !plugin.getFactionManager().getFactionAt(event.getSpawnLocation()).isSafezone()) {
this.setPaused(player.getUniqueId(), false);
}
}
}
开发者ID:funkemunky,项目名称:HCFCore,代码行数:17,代码来源:InvincibilityTimer.java
示例2: onPlayerSpawn
import org.spigotmc.event.player.PlayerSpawnLocationEvent; //导入依赖的package包/类
@EventHandler(priority = EventPriority.MONITOR)
public void onPlayerSpawn(PlayerSpawnLocationEvent event) {
if (!settings.getProperty(PwiProperties.LOAD_DATA_ON_JOIN))
return;
Player player = event.getPlayer();
String spawnWorld = event.getSpawnLocation().getWorld().getName();
ConsoleLogger.debug("Player '" + player.getName() + "' joining! Spawning in world '" + spawnWorld + "'. Getting last logout location");
Location lastLogout = dataSource.getLogoutData(player);
if (lastLogout != null) {
ConsoleLogger.debug("Logout location found for player '" + player.getName() + "'!");
if (!lastLogout.getWorld().getName().equals(spawnWorld)) {
Group spawnGroup = groupManager.getGroupFromWorld(spawnWorld);
Group logoutGroup = groupManager.getGroupFromWorld(lastLogout.getWorld().getName());
process.processWorldChangeOnSpawn(player, logoutGroup, spawnGroup);
}
}
}
开发者ID:Gnat008,项目名称:PerWorldInventory,代码行数:23,代码来源:PlayerSpawnLocationListener.java
示例3: shouldDoNothingNoDataFound
import org.spigotmc.event.player.PlayerSpawnLocationEvent; //导入依赖的package包/类
@Test
public void shouldDoNothingNoDataFound() {
// given
Player player = mock(Player.class);
World world = mock(World.class);
given(world.getName()).willReturn("world");
Location spawnLocation = new Location(world, 1, 2, 3);
PlayerSpawnLocationEvent event = new PlayerSpawnLocationEvent(player, spawnLocation);
given(settings.getProperty(PwiProperties.LOAD_DATA_ON_JOIN)).willReturn(true);
given(dataSource.getLogoutData(player)).willReturn(null);
// when
listener.onPlayerSpawn(event);
// then
verifyZeroInteractions(groupManager);
verifyZeroInteractions(process);
}
开发者ID:Gnat008,项目名称:PerWorldInventory,代码行数:19,代码来源:PlayerSpawnLocationListenerTest.java
示例4: shouldDoNothingSameWorld
import org.spigotmc.event.player.PlayerSpawnLocationEvent; //导入依赖的package包/类
@Test
public void shouldDoNothingSameWorld() {
// given
Player player = mock(Player.class);
World world = mock(World.class);
given(world.getName()).willReturn("world");
Location spawnLocation = new Location(world, 1, 2, 3);
PlayerSpawnLocationEvent event = new PlayerSpawnLocationEvent(player, spawnLocation);
given(settings.getProperty(PwiProperties.LOAD_DATA_ON_JOIN)).willReturn(true);
World oldWorld = mock(World.class);
given(oldWorld.getName()).willReturn("world");
Location lastLocation = new Location(oldWorld, 4, 5, 6);
given(dataSource.getLogoutData(player)).willReturn(lastLocation);
// when
listener.onPlayerSpawn(event);
// then
verifyZeroInteractions(groupManager);
verifyZeroInteractions(process);
}
开发者ID:Gnat008,项目名称:PerWorldInventory,代码行数:23,代码来源:PlayerSpawnLocationListenerTest.java
示例5: onPlayerSpawn
import org.spigotmc.event.player.PlayerSpawnLocationEvent; //导入依赖的package包/类
@EventHandler(ignoreCancelled = true, priority = EventPriority.NORMAL)
public void onPlayerSpawn(PlayerSpawnLocationEvent event) {
Player player = event.getPlayer();
if (!player.hasPlayedBefore()) {
plugin.getEconomyManager().addBalance(player.getUniqueId(), 250); // give player some starting money
event.setSpawnLocation(Bukkit.getWorld(DEFAULT_WORLD_NAME).getSpawnLocation().add(0.5, 0, 0.5));
}
}
开发者ID:funkemunky,项目名称:HCFCore,代码行数:9,代码来源:WorldListener.java
示例6: onPlayerSpawn
import org.spigotmc.event.player.PlayerSpawnLocationEvent; //导入依赖的package包/类
@EventHandler(ignoreCancelled = true, priority = EventPriority.NORMAL)
public void onPlayerSpawn(PlayerSpawnLocationEvent event) {
Player player = event.getPlayer();
if (!player.hasPlayedBefore()) {
plugin.getEconomyManager().addBalance(player.getUniqueId(), 250); // give player some starting money
event.setSpawnLocation(Bukkit.getWorld(DEFAULT_WORLD_NAME).getSpawnLocation().add(-3.5, 76, 6.5));
}
}
开发者ID:funkemunky,项目名称:HCFCore,代码行数:9,代码来源:WorldListener.java
示例7: onPlayerSpawnLocationEvent
import org.spigotmc.event.player.PlayerSpawnLocationEvent; //导入依赖的package包/类
@EventHandler(priority = EventPriority.HIGHEST)
public void onPlayerSpawnLocationEvent(PlayerSpawnLocationEvent event)
{
Player player = event.getPlayer();
ApplicableRegionSet regions = WorldGuardExtraFlagsPlugin.getWorldGuardPlugin().getRegionContainer().createQuery().getApplicableRegions(player.getLocation());
Location location = regions.queryValue(WorldGuardUtils.wrapPlayer(player), FlagUtils.JOIN_LOCATION); //Not sure should we add bypass for this
if (location != null)
{
event.setSpawnLocation(BukkitUtil.toLocation(location));
}
}
开发者ID:isokissa3,项目名称:WorldGuardExtraFlagsPlugin,代码行数:14,代码来源:PlayerListener.java
示例8: onPlayerSpawnLocation
import org.spigotmc.event.player.PlayerSpawnLocationEvent; //导入依赖的package包/类
@EventHandler(priority = EventPriority.HIGH)
public void onPlayerSpawnLocation(PlayerSpawnLocationEvent event) {
if (BedwarsRel.getInstance().isBungee()) {
Player player = event.getPlayer();
ArrayList<Game> games = BedwarsRel.getInstance().getGameManager().getGames();
if (games.size() == 0) {
return;
}
Game firstGame = games.get(0);
event.setSpawnLocation(firstGame.getPlayerTeleportLocation(player));
}
}
开发者ID:BedwarsRel,项目名称:BedwarsRel,代码行数:16,代码来源:PlayerSpigotListener.java
示例9: shouldNotCheckDisabled
import org.spigotmc.event.player.PlayerSpawnLocationEvent; //导入依赖的package包/类
@Test
public void shouldNotCheckDisabled() {
// given
PlayerSpawnLocationEvent event = mock(PlayerSpawnLocationEvent.class);
given(settings.getProperty(PwiProperties.LOAD_DATA_ON_JOIN)).willReturn(false);
// when
listener.onPlayerSpawn(event);
// then
verifyZeroInteractions(dataSource);
verifyZeroInteractions(groupManager);
verifyZeroInteractions(process);
}
开发者ID:Gnat008,项目名称:PerWorldInventory,代码行数:15,代码来源:PlayerSpawnLocationListenerTest.java
示例10: shouldProcessChange
import org.spigotmc.event.player.PlayerSpawnLocationEvent; //导入依赖的package包/类
@Test
public void shouldProcessChange() {
// given
Player player = mock(Player.class);
World world = mock(World.class);
given(world.getName()).willReturn("world");
Set<String> worlds = new HashSet<>();
Group spawnWorldGroup = mockGroup("spawn", Arrays.asList("otherWorld", world.getName()), GameMode.SURVIVAL);
given(groupManager.getGroupFromWorld(world.getName())).willReturn(spawnWorldGroup);
Location spawnLocation = new Location(world, 1, 2, 3);
PlayerSpawnLocationEvent event = new PlayerSpawnLocationEvent(player, spawnLocation);
given(settings.getProperty(PwiProperties.LOAD_DATA_ON_JOIN)).willReturn(true);
World oldWorld = mock(World.class);
given(oldWorld.getName()).willReturn("other_world");
Location lastLocation = new Location(oldWorld, 4, 5, 6);
given(dataSource.getLogoutData(player)).willReturn(lastLocation);
Group oldWorldGroup = mockGroup("oldWorldGroup", Collections.singletonList(oldWorld.getName()), GameMode.SURVIVAL);
given(groupManager.getGroupFromWorld(oldWorld.getName())).willReturn(oldWorldGroup);
// when
listener.onPlayerSpawn(event);
// then
verify(process, only()).processWorldChangeOnSpawn(player, oldWorldGroup, spawnWorldGroup);
}
开发者ID:Gnat008,项目名称:PerWorldInventory,代码行数:30,代码来源:PlayerSpawnLocationListenerTest.java
示例11: onPlayerSpawn
import org.spigotmc.event.player.PlayerSpawnLocationEvent; //导入依赖的package包/类
@EventHandler(priority = EventPriority.HIGH)
public void onPlayerSpawn(PlayerSpawnLocationEvent event) {
isPlayerSpawnLocationEventCalled = true;
final Player player = event.getPlayer();
Location customSpawnLocation = teleportationService.prepareOnJoinSpawnLocation(player);
if (customSpawnLocation != null) {
event.setSpawnLocation(customSpawnLocation);
}
}
开发者ID:AuthMe,项目名称:AuthMeReloaded,代码行数:11,代码来源:PlayerListener19Spigot.java
注:本文中的org.spigotmc.event.player.PlayerSpawnLocationEvent类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论