Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @EventHandler
- public void onSignChange(SignChangeEvent event) // Skapar skylten
- {
- ConfigurationSection sectionA = this.getConfig().getConfigurationSection( "root.lobbies" );
- ConfigurationSection sectionB = this.getConfig().getConfigurationSection( "root.arenor" );
- String rad1 = event.getLine(1);
- Player player = event.getPlayer();
- String[] lines = event.getLines();
- if( player.hasPermission("event.sign.join") )
- {
- if(( event.getLine(0).contains("[join]")
- ||event.getLine(0).contains("[Join]")))
- {
- if(( sectionA.contains( rad1 )
- ||sectionB.contains( rad1 )))
- {
- if( !lines[1].isEmpty() )
- {
- event.setLine(0, "§a[Join]");
- event.setLine(2, "" + playerCount + "/" + maxPlayers );
- player.sendMessage(ChatColor.GREEN + "Join sign created!");
- }
- else
- {
- player.sendMessage(ChatColor.RED + "Please set a valid lobby name on line 2");
- event.setCancelled(true);
- }
- }
- else
- {
- player.sendMessage(ChatColor.RED + "Please set a valid lobby name on line 2");
- }
- }
- }
- }
- @EventHandler
- public void onPlayerInteract(PlayerInteractEvent event) // Klickar på skylten
- {
- Player player = event.getPlayer();
- Block block = event.getClickedBlock();
- Action action = event.getAction();
- if(action == Action.RIGHT_CLICK_BLOCK)
- {
- if(((block.getType() == Material.SIGN)
- || (block.getType() == Material.SIGN_POST)
- || (block.getType() == Material.WALL_SIGN)))
- {
- Sign sign = (Sign) block.getState();
- if( sign.getLine( 0 ).contains( "[Join]" ) )
- {
- String name = sign.getLine( 1 );
- TeleportToLobby( player, name );
- playerCount++;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment