Created
December 5, 2014 22:25
-
-
Save Romain-P/3eb88cddacce0431e4ee to your computer and use it in GitHub Desktop.
example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package org.rushland.plugin.listeners; | |
| import com.google.inject.Inject; | |
| import org.bukkit.Material; | |
| import org.bukkit.block.Block; | |
| import org.bukkit.block.Sign; | |
| import org.bukkit.event.EventHandler; | |
| import org.bukkit.event.block.Action; | |
| import org.bukkit.event.player.PlayerInteractEvent; | |
| import org.rushland.api.interfaces.bukkit.ImprovedListener; | |
| import org.rushland.plugin.PluginFactory; | |
| import org.rushland.plugin.entities.Client; | |
| import org.rushland.plugin.enums.PluginType; | |
| import org.rushland.plugin.games.GameManager; | |
| /** | |
| * Managed by romain on 31/10/2014. | |
| */ | |
| public class BoardGameListener extends ImprovedListener{ | |
| @Inject | |
| PluginFactory factory; | |
| @Inject | |
| GameManager gameManager; | |
| @EventHandler | |
| public void onInteract(PlayerInteractEvent event) { | |
| if(factory.getType() != PluginType.MAIN || event.getAction() != Action.RIGHT_CLICK_BLOCK) return; | |
| Block block = event.getClickedBlock(); | |
| if(block.getType() != Material.WALL_SIGN && block.getType() != Material.SIGN_POST) return; | |
| Sign sign = (Sign) block.getState(); //block instanceof Sign ? (Sign) block.getState() : null; | |
| Client client = factory.getClients().get(event.getPlayer().getUniqueId().toString()); | |
| gameManager.askJoin(client, sign); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment