Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package me.highquality.ArenaPlugin;
- import org.bukkit.ChatColor;
- import org.bukkit.Location;
- import org.bukkit.Material;
- import org.bukkit.World;
- import org.bukkit.block.Block;
- import org.bukkit.block.Chest;
- import org.bukkit.command.Command;
- import org.bukkit.command.CommandSender;
- import org.bukkit.entity.EntityType;
- import org.bukkit.entity.Player;
- import org.bukkit.inventory.Inventory;
- import org.bukkit.inventory.ItemStack;
- import org.bukkit.plugin.java.JavaPlugin;
- import java.util.logging.Logger;
- public class ArenaPlugin extends JavaPlugin {
- public final Logger logger = Logger.getLogger("Minecraft");
- Logger log;
- public void onEnable(){
- log = this.getLogger();
- log.info("Your plugin has been enabled!");
- }
- public void onDisable(){
- log.info("Your plugin has been disabled.");
- }
- public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args){
- if(commandLabel.equalsIgnoreCase("test")) {
- Player p = (Player) sender;
- log.info("This command worked");
- World w = p.getWorld();
- Block c = w.getBlockAt(55, 69, 216);
- //Location bloc;
- //bloc = new Location(w, 55, 70, 216);
- //Block c = bloc.getBlock();
- //Block c = p.getTargetBlock(null, 50);
- Chest b = null;
- int n = c.getTypeId();
- if (c.getState() instanceof Chest){
- b = (Chest)c.getState();
- Inventory a = b.getInventory();
- ItemStack diamondstack = new ItemStack(Material.DIAMOND, 64);
- a.addItem(diamondstack);
- p.sendMessage(ChatColor.GOLD + "I believe this worked.. atleast we got here");
- Location blockloc = c.getLocation();
- log.info("The block location is " + blockloc);
- }
- else {
- log.info("The returned date ID is " + n);
- log.info("The returned block was not a chest");
- }
- //Location loc = p.getLocation();
- Location loc;
- loc = new Location(w, 50, 70, 218);
- //55,70,218
- w.spawnCreature(loc, EntityType.SKELETON);
- //Inventory invv = Chest.getInventory();
- //Inventory inv = c.getBlockInventory();
- }
- return false;
- }
- }
Add Comment
Please, Sign In to add comment