thebmanswan541

Commands - Bukkit Coding Episode 2

Mar 9th, 2015
265
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.14 KB | None | 0 0
  1. package me.TheBmanSwan.Commands;
  2.  
  3. import org.bukkit.ChatColor;
  4. import org.bukkit.command.Command;
  5. import org.bukkit.command.CommandSender;
  6. import org.bukkit.entity.Player;
  7. import org.bukkit.plugin.java.JavaPlugin;
  8.  
  9. /**
  10.  * **********************************************************
  11.  * Project: BukkitTutorials
  12.  * Copyright TheBmanSwan (c) 2015. All Rights Reserved.
  13.  * Upon using this for commercial use, the user must give
  14.  * credit to TheBmanSwan. Distribution of the code is allowed
  15.  * Claiming this project to be created by you is strictly prohibited.
  16.  * **********************************************************
  17.  */
  18. public class Main extends JavaPlugin {
  19.  
  20.     @Override
  21.     public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
  22.         if (!(sender instanceof Player)) {
  23.             sender.sendMessage(ChatColor.GREEN+"You ran the command in the console!");
  24.             return true;
  25.         }
  26.  
  27.         Player p = (Player) sender;
  28.  
  29.         if (label.equalsIgnoreCase("command")) {
  30.             p.sendMessage(ChatColor.GREEN+"You ran the command in-game!");
  31.         }
  32.  
  33.         return true;
  34.     }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment