本文整理汇总了Java中org.bukkit.event.player.PlayerJoinEvent类的典型用法代码示例。如果您正苦于以下问题:Java PlayerJoinEvent类的具体用法?Java PlayerJoinEvent怎么用?Java PlayerJoinEvent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PlayerJoinEvent类属于org.bukkit.event.player包,在下文中一共展示了PlayerJoinEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onJoin
import org.bukkit.event.player.PlayerJoinEvent; //导入依赖的package包/类
@EventHandler
public void onJoin(PlayerJoinEvent event) {
Player player = event.getPlayer();
event.setJoinMessage(null);
if (!Skywars.getInstance().isSingleServerMode()) {
player.setGameMode(GameMode.ADVENTURE);
player.getInventory().clear();
player.setMaxHealth(20);
player.setHealth(player.getMaxHealth());
player.setFoodLevel(25);
player.teleport(Skywars.getInstance().getLobbyPoint());
}
}
示例2: onPlayerJoin
import org.bukkit.event.player.PlayerJoinEvent; //导入依赖的package包/类
public void onPlayerJoin(PlayerJoinEvent event) {
Player player = event.getPlayer();
if (hasPermission(player)) {
/*
if (Uranium.isLegacy()) {
player.sendMessage(ChatColor.YELLOW + "We're running on legacy version on Uranium, please update your version");
}
if (!Uranium.isOfficial()) {
player.sendMessage(ChatColor.YELLOW + "We're running on non-official version on Uranium, please update your version");
}
if (mHasUpdate) {
sendUpdate(player);
}
*/
}
}
示例3: onPlayerJoin
import org.bukkit.event.player.PlayerJoinEvent; //导入依赖的package包/类
public void onPlayerJoin(PlayerJoinEvent event) {
// When a player joins, add their correct values to the `playerVals` hashmap
plugin.getServer().getScheduler().runTaskAsynchronously(plugin, new Runnable() { // Run the database functions async
public void run() {
Player p = event.getPlayer();
UUID id = p.getUniqueId();
String uuid = id.toString();
PreparedStatement stmt = null;
try {
stmt = plugin.getDb().getConnection().prepareStatement("SELECT tse FROM life_system WHERE uuid = " + uuid + " LIMIT 1");
ResultSet set = stmt.executeQuery(); // Get the player with the UUID `uuid`'s life levels from the database
set.next(); // Get the first matching row
playerVals.put(id, set.getString("tse")); // Add the player's values to `playerVals`
} catch (SQLException e) {
e.printStackTrace();
}
}
;
});
}
示例4: onPlayerJoin
import org.bukkit.event.player.PlayerJoinEvent; //导入依赖的package包/类
@EventHandler
public void onPlayerJoin(PlayerJoinEvent event) {
if (onJoinActions.containsKey(event.getPlayer().getUniqueId())) {
ProxyBlacklist blacklist = finders.get(event.getPlayer().getUniqueId());
plugin.getLogger().info("Player " + event.getPlayer().getName() + " connected with an open proxy at " + event.getPlayer().getAddress().getAddress().getHostAddress() + " as detected by " + blacklist.getName());
if (event.getPlayer().hasPermission("mopm.bypass")) {
plugin.getLogger().info("Player " + event.getPlayer().getName() + " bypassed open proxy detection by permission");
}
for (Predicate<Player> p : onJoinActions.get(event.getPlayer().getUniqueId())) {
if (p.test(event.getPlayer())) {
return;
}
}
plugin.getServer().dispatchCommand(plugin.getServer().getConsoleSender(), blacklist.getDefaultCommand()
.replace("%player%", event.getPlayer().getName())
.replace("%bl%", blacklist.getName()));
}
}
示例5: onJoin
import org.bukkit.event.player.PlayerJoinEvent; //导入依赖的package包/类
@EventHandler
public void onJoin(PlayerJoinEvent event) {
plugin.getPlayerManager().loadData(event.getPlayer());
if(event.getPlayer().hasPermission("asgardascension.staff")) {
event.getPlayer().setPlayerListName(ChatColor.YELLOW + event.getPlayer().getDisplayName());
}
// Restoring location, level and experience in case server crashed
plugin.getPlayerFile().createConfig(event.getPlayer());
if(plugin.getPlayerFile().isInChallenge()) {
Player player = event.getPlayer();
player.teleport(plugin.getPlayerFile().getChallengeLocation());
player.setLevel(plugin.getPlayerFile().getChallengeLevel());
player.setExp(plugin.getPlayerFile().getChallengeExperience());
plugin.getEconomy().depositPlayer(player, plugin.getPlayerFile().getChallengePrice());
plugin.getPlayerFile().removeChallenge();
plugin.getPlayerFile().saveConfig();
}
}
示例6: onPlayerJoin
import org.bukkit.event.player.PlayerJoinEvent; //导入依赖的package包/类
@EventHandler(priority = EventPriority.HIGH)
public void onPlayerJoin(PlayerJoinEvent event) {
Player player = event.getPlayer();
if (Craft.reboardNames.containsKey(player.getName())) {
if ((Craft.reboardNames.get(player.getName()) != null)
&& Craft.reboardNames.get(player.getName()).crewNames.contains(player.getName())) {
Craft c = Craft.reboardNames.get(player.getName());
Location loc = new Location(c.world, c.minX + (c.sizeX / 2), c.maxY, c.minZ + (c.sizeZ / 2));
player.teleport(loc);
}
Craft.reboardNames.remove(player.getName());
}
syp = (Shipyard)plugin.getServer().getPluginManager().getPlugin("NavyCraft-Shipyard");
if( syp != null )
{
syp.playerJoin(player);
}
}
示例7: handlePlayerJoin
import org.bukkit.event.player.PlayerJoinEvent; //导入依赖的package包/类
public void handlePlayerJoin( FlexPlayer player ) {
this.players.put( player.getUuid(), player );
List<MessageS2EPlayerList.PlayerItem> items = new ArrayList<>();
for ( FlexPlayer target : this.getOnlinePlayers() ) {
if( !target.equals( player ) ) {
target.getConnectionHandler().sendMessage( new MessageS2EPlayerList( MessageS2EPlayerList.Action.ADD_PLAYER,
Collections.singletonList( new MessageS2EPlayerList.PlayerItem().setUuid( player.getUuid() ).setName( player.getName() ).setGameMode( player.getGameMode() ).setPing( player.getLatency() ) ) ) );
}
items.add( new MessageS2EPlayerList.PlayerItem().setName( target.getName() ).setUuid( target.getUuid() ).setGameMode( target.getGameMode() ).setPing( target.getLatency() ) );
}
player.getConnectionHandler().sendMessage( new MessageS2EPlayerList( MessageS2EPlayerList.Action.ADD_PLAYER, items ) );
System.out.println( player.getName() + " (" + player.getUuid().toString() + ") logged in from " + player.getIpAddress() );
player.spawnPlayer();
player.getWorld().addEntity( player, true );
String joinMessage = EventFactory.call( new PlayerJoinEvent( player, "§e" + player.getName() + " joined the game." ) ).getJoinMessage();
if( joinMessage != null && !joinMessage.isEmpty() ) {
Bukkit.broadcastMessage( joinMessage );
}
}
示例8: onJoin
import org.bukkit.event.player.PlayerJoinEvent; //导入依赖的package包/类
@EventHandler(priority = EventPriority.HIGHEST)
public void onJoin(PlayerJoinEvent e) {
RagePlayer u = RageGames.getPlayer(e.getPlayer());
e.setJoinMessage(null);
u.getPlayer().setFlySpeed(0.2f);
u.getPlayer().setWalkSpeed(0.2f);
if (plugin.getGm().isInLobby()) {
u.getPlayer().getInventory().clear();
plugin.getGm().addPlayerToGame(u);
plugin.getServer().getOnlinePlayers().forEach(p -> u.getPlayer().showPlayer(p));
plugin.getServer().getOnlinePlayers().forEach(p -> p.showPlayer(u.getPlayer()));
u.setLobby();
Utils.broadcastMsg("&7Ha entrado al juego &e" + u.getName() + " &3(&b" + plugin.getGm().getPlaying().size() + "&d/&b" + plugin.getAm().getMaxPlayers() + "&3)");
plugin.getGm().checkStart();
plugin.getServer().getScheduler().runTaskLater(plugin, () -> u.sendToLobby(), 20);
} else {
new SpectatorTask(plugin, u).runTaskTimer(plugin, 0, 20);
}
}
示例9: registerPlayer
import org.bukkit.event.player.PlayerJoinEvent; //导入依赖的package包/类
private Player registerPlayer() {
Player player = mock(Player.class);
when(player.getUniqueId()).thenReturn(UUID.randomUUID());
PlayerJoinEvent event = mock(PlayerJoinEvent.class);
when(event.getPlayer()).thenReturn(player);
this.manager.registerPlayer(event);
return player;
}
示例10: onPlayerJoin
import org.bukkit.event.player.PlayerJoinEvent; //导入依赖的package包/类
@EventHandler(priority = EventPriority.MONITOR)
public void onPlayerJoin(PlayerJoinEvent event)
{
Player player = event.getPlayer();
if (api.getGameManager().isLegacyPvP())
{
AttributeInstance genericAttackSpeedAttribute = player.getAttribute(Attribute.GENERIC_ATTACK_SPEED);
if (genericAttackSpeedAttribute != null)
genericAttackSpeedAttribute.setBaseValue(1024.0D);
}
}
示例11: onPlayerJoin
import org.bukkit.event.player.PlayerJoinEvent; //导入依赖的package包/类
@EventHandler(priority = EventPriority.MONITOR)
public void onPlayerJoin(PlayerJoinEvent e){
if (!e.getPlayer().hasPlayedBefore()){
karmaUserManager.addNewKarmaUser(e.getPlayer());
} else {
karmaUserManager.addKarmaUser(e.getPlayer());
}
}
示例12: onPlayerJoin
import org.bukkit.event.player.PlayerJoinEvent; //导入依赖的package包/类
@EventHandler(ignoreCancelled=true, priority=EventPriority.LOWEST)
public void onPlayerJoin(PlayerJoinEvent event)
{
Player player = event.getPlayer();
UUID uuid = player.getUniqueId();
for (PlayerBoard board : this.playerBoards.values()) {
board.addUpdate(player);
}
PlayerBoard board2 = new PlayerBoard(this.plugin, player);
Object c = Arrays.asList(Bukkit.getOnlinePlayers());
board2.addUpdates((Collection)c);
setPlayerBoard(uuid, board2);
}
示例13: onJoin
import org.bukkit.event.player.PlayerJoinEvent; //导入依赖的package包/类
@EventHandler
//Join
public void onJoin(PlayerJoinEvent e) {
Player player = e.getPlayer();
if(Teams.getPlayerInWhereArea().containsKey(player)){
Teams.QuitTeam(player);
}
}
示例14:
import org.bukkit.event.player.PlayerJoinEvent; //导入依赖的package包/类
@EventHandler(ignoreCancelled=true, priority= EventPriority.MONITOR)
/* */ public void onPlayerJoin(PlayerJoinEvent event)
/* */ {
/* 77 */ EntityPlayer entityPlayer = ((CraftPlayer)event.getPlayer()).getHandle();
/* 78 */ entityPlayer.knockbackReductionX = 0.6F;
/* 79 */ entityPlayer.knockbackReductionY = 0.55F;
/* 80 */ entityPlayer.knockbackReductionZ = 0.6F;
/* */ }
示例15: onJoin
import org.bukkit.event.player.PlayerJoinEvent; //导入依赖的package包/类
@EventHandler
public void onJoin(PlayerJoinEvent e){
/*
CAVECLOUD API
*/
CaveCloud.gameAPI
.setPlayers(Bukkit.getOnlinePlayers().size())
.update();
}