Hello, can anyone write (and mostly important compile, because I can't do it, otherwise I would have also written the plugin itself) a simple plugin which listens for block breaking and block placing events and cancels them if the Player is not OP? I need it because of the fact that a player in adventure mode is still able to break transparent blocks, and allowing a Player in my server to do this means that he can break vital parts of the map I know I could do this with existing plugin, but I'm doing this request because a simple ad-hoc plugin would be much much faster. I need it for Bukkit-1.4.6-R0.3. Thank you very much! EDIT: and maybe a /food command which gives the player 5 red apples? (in the same plugin) Thanks EDIT 2: I've written the plugin, can anyone compile it for me? plugin.yml: Code: name: TFHelper main: eu.th3game.tfhelper.TFHelperMainClass version: 0.0.1 commands: food: description: This command give 3 apples. usage: /food TFHelperMainClass.java: PHP: package eu.th3game.tfhelper; import org.bukkit.plugin.java.JavaPlugin;import org.bukkit.event.Listener;import org.bukkit.command.CommandSender;import org.bukkit.command.Command;import org.bukkit.entity.Player;import org.bukkit.event.EventHandler;import org.bukkit.event.EventPriority;import org.bukkit.event.block.BlockBreakEvent;import org.bukkit.event.block.BlockPlaceEvent; public final class TFHelperMainClass extends JavaPlugin implements Listener { @Override public void onEnable() { getServer().getPluginManager().registerEvents(this, this); } public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { if (cmd.getName().equalsIgnoreCase("food")) { if (sender instanceof Player) { ((Player)sender).getInventory().addItem(new ItemStack(260, 3)); } return true; } return false; } @EventHandler(priority = EventPriority.MONITOR) public void onBlockBreakEvent(BlockBreakEvent e) { if (!e.getPlayer().isOp()) { e.setCancelled(true); } } @EventHandler(priority = EventPriority.MONITOR) public void onBlockPlaceEvent(BlockPlaceEvent e) { if (!e.getPlayer().isOp()) { e.setCancelled(true); } }} I've written the code with Notepad, so if I've forgot to import anything, please do it for me
I don't have permissionsEX, and it couldn't help me with the food thing anyway. I've written the plugin by myself, now I only need someone who can compile it for me, because I don't have my PC at the moment and I can't install anything on this one... Sorry if I bump this, but I need is urgently EDIT by Moderator: merged posts, please use the edit button instead of double posting.
Nice code, you only missed the itemstack import https://dl.dropbox.com/s/y0rqjenqw6r9zvs/TFHelper.jar?dl=1