Guest User

Untitled

a guest
Jul 23rd, 2018
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.20 KB | None | 0 0
  1. package me.highquality.ArenaPlugin;
  2. import org.bukkit.ChatColor;
  3. import org.bukkit.Location;
  4. import org.bukkit.Material;
  5. import org.bukkit.World;
  6. import org.bukkit.block.Block;
  7. import org.bukkit.block.Chest;
  8. import org.bukkit.command.Command;
  9. import org.bukkit.command.CommandSender;
  10. import org.bukkit.entity.EntityType;
  11. import org.bukkit.entity.Player;
  12. import org.bukkit.inventory.Inventory;
  13. import org.bukkit.inventory.ItemStack;
  14. import org.bukkit.plugin.java.JavaPlugin;
  15.  
  16.  
  17. import java.util.logging.Logger;
  18.  
  19.  
  20. public class ArenaPlugin extends JavaPlugin {
  21.      public final Logger logger = Logger.getLogger("Minecraft");
  22.      
  23.         Logger log;
  24.      
  25.         public void onEnable(){
  26.             log = this.getLogger();
  27.            
  28.             log.info("Your plugin has been enabled!");
  29.    
  30.            
  31.         }
  32.      
  33.         public void onDisable(){
  34.             log.info("Your plugin has been disabled.");
  35.  
  36.            
  37.         }
  38.        
  39.         public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args){
  40.             if(commandLabel.equalsIgnoreCase("test")) {
  41.                 Player p = (Player) sender;
  42.                 log.info("This command worked");
  43.                 World w = p.getWorld();
  44.                 Block c = w.getBlockAt(55, 69, 216);
  45.                 //Location bloc;
  46.                 //bloc = new Location(w, 55, 70, 216);
  47.                                
  48.                
  49.                 //Block c = bloc.getBlock();
  50.                
  51.                 //Block c = p.getTargetBlock(null, 50);
  52.                 Chest b = null;
  53.                 int n = c.getTypeId();
  54.                 if (c.getState() instanceof Chest){
  55.                     b = (Chest)c.getState();
  56.                     Inventory a = b.getInventory();
  57.                      ItemStack diamondstack = new ItemStack(Material.DIAMOND, 64);
  58.                      a.addItem(diamondstack);
  59.                      p.sendMessage(ChatColor.GOLD + "I believe this worked.. atleast we got here");
  60.                      Location blockloc = c.getLocation();
  61.                      log.info("The block location is " + blockloc);
  62.                     }
  63.                 else {
  64.                     log.info("The returned date ID is " + n);
  65.                     log.info("The returned block was not a chest");
  66.                 }
  67.                 //Location loc = p.getLocation();
  68.                 Location loc;
  69.                 loc = new Location(w, 50, 70, 218);
  70.                
  71.                
  72.                 //55,70,218
  73.                 w.spawnCreature(loc, EntityType.SKELETON);
  74.                    
  75.                 //Inventory invv = Chest.getInventory();
  76.                 //Inventory inv = c.getBlockInventory();
  77.                
  78.                
  79.  
  80.             }
  81.            
  82.             return false;
  83.         }
  84.        
  85.        
  86.            
  87.        
  88. }
Add Comment
Please, Sign In to add comment