Guest User

kod

a guest
Feb 3rd, 2015
218
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.26 KB | None | 0 0
  1. package drakegm;
  2.  
  3. import java.util.logging.Logger;
  4.  
  5. import org.bukkit.GameMode;
  6. import org.bukkit.command.Command;
  7. import org.bukkit.command.CommandSender;
  8. import org.bukkit.entity.Player;
  9. import org.bukkit.plugin.PluginDescriptionFile;
  10. import org.bukkit.plugin.java.JavaPlugin;
  11.  
  12. public class Main extends JavaPlugin  {
  13.     public static Main plugin;
  14.     public final Logger logger = Logger.getLogger("Minecraft");
  15.    
  16.     @Override
  17.     public void onEnable() {
  18.         PluginDescriptionFile pdfFile = this.getDescription();
  19.         this.logger.info( pdfFile.getName() + " Zostal Wlaczony :)");
  20.        
  21.     }
  22.    
  23.     @Override
  24.     public void onDisable() {
  25.         PluginDescriptionFile pdfFile = this.getDescription();
  26.         this.logger.info( pdfFile.getName() + " Wylaczyl sie :C");
  27.        
  28.     }
  29.    
  30.     @Override
  31.     public boolean onCommand(CommandSender sender, Command cmd, String commandlabel, String[] args) {
  32.         readCommand((Player) sender, commandlabel);
  33.         return false;
  34.     }
  35.    
  36.     public void readCommand(Player player, String command) {
  37.         if(command.equalsIgnoreCase("gm1")) {
  38.             player.setGameMode(GameMode.CREATIVE);
  39.             player.sendMessage("Wlaczyles gm1");
  40.         }
  41.         else if(command.equalsIgnoreCase("gm0")) {
  42.             player.setGameMode(GameMode.SURVIVAL);
  43.             player.sendMessage("Wlaczyles gm0");
  44.         }
  45.        
  46.     }
  47.  
  48. }
Advertisement
Add Comment
Please, Sign In to add comment