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. }