This week only. Pastebin PRO Accounts Christmas Special! Don't miss out!Want more features on Pastebin? Sign Up, it's FREE!
Guest

com.bukket.samkio.Basic.BasicPlayerListener.java

By: a guest on Jan 20th, 2011  |  syntax: Java  |  size: 0.96 KB  |  views: 2,869  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. //The Package
  2. package com.bukkit.samkio.Basic;
  3. //All the imports
  4. import org.bukkit.entity.Player;
  5. import org.bukkit.event.player.PlayerChatEvent;
  6. import org.bukkit.event.player.PlayerListener;
  7. //Starts the class BasicPlayer listener
  8. public class BasicPlayerListener extends PlayerListener{
  9.          public static Basic plugin;
  10.           public BasicPlayerListener(Basic instance) {
  11.                 plugin = instance;
  12.             }
  13.           //This method is called whenever a player uses a command.
  14.           public void onPlayerCommand(PlayerChatEvent event) {
  15.                   //Make the message a string.
  16.                         String[] split = event.getMessage().split(" ");
  17.                         //Get the player that talked.
  18.                         Player player = event.getPlayer();
  19.                         //If the first part of the string is /basic or /b then do this.
  20.                         if ((split[0].equalsIgnoreCase("/basic"))
  21.                                         || (split[0].equalsIgnoreCase("/b"))) {
  22.                                 //Run the method toggleVision for player
  23.                                 plugin.toggleVision(player);
  24.                                 event.setCancelled(true);
  25.                         }
  26.  
  27.                 }
  28. }
clone this paste RAW Paste Data