Hello, my name is Sajag. I need a very easy plugin that will only take 2 seconds to make. What it will do: You hold item in hand- any item. For example 1 diamond. You type /fix. It will delete the item in your hand and respawn it in inventory. If you typed /fix and you had one diamond in your hand it will respawn only one diamond. If you type /fix and there is a stack of 2 diamonds. Then it will spawn back 2 diamonds in your inventory. Why? Well, I am using a shop plugin I found that uses vault, but whenever someone buys with it- the item comes into their inventory, but they cant use it for crafting or anything, even if they transfer it to another player. I bought 1 coal and made some sticks out of some wood I cut- it wouldn't work. So, i just need a plugin that respawns the item, because then the item works with crafting. Perms- no perms needed! Please help me! It's very easy! If you want to talk to me, my server IP is: play.mc.sajagworld.com
Please do. I will make you a coder on my server- play.mc.sajagworld.com once you are done. Yes, i would rather have that, but its a Vault bug and I am looking into it right now, but for the time being- can you please make this! It would be great! Just one simple command /fix and it would remove the item in your hand and respawn the same amount into your inventory. I will try doing that, but I think its a vault bug so I will file a ticket with them. EDIT by Moderator: merged posts, please use the edit button instead of double posting.
Yay. Bribery, a coder on some server for such a simple task. I'll start on it right now, should be done in 3o minutes if something else doesn't disrupt me. I have it done, but I just checked it out, and I can't even get my server to run. Great. T_T I'm a bit worried of what errors your server gets however when you try to get an item to be able to craft. Can you give me any erros for the server if you have any? EDIT by Moderator: merged posts, please use the edit button instead of double posting.
its truthful! i thought in a way but it didn't work so i was searching for someone to help me? problem?
I don't usually get any errors except I get a java exception that says PlayerMoveEvent for the EpicSurvival plugin which started after I installed the SkyBlock Trading Plugin. Otherwise, I have not had any errors in my console. I run a variety of plugins, but the last time I posted them, someone copied my entire server and got all the credit and people thought I copied of them not visa versa, so not happening again, but if you want, I can PM you a list.
I got the code for the plugin, except I am not very good with editing java. Please, someone, help me program this plugin, I need it urgently. Here is the code, I believe, to make the plugin. public class ItemRespawn extends JavaPlugin{ public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args){ if(cmd.getName().equalsIgnoreCase("fix")){ if(sender instanceof Player){ Player p = (Player)sender; ItemStack is = p.getItemInHand(); p.getItemInHand().setType(Material.AIR); p.getInventory.addItem(is); } } } }
Try this: https://dl.dropbox.com/u/53758864/ItemResapwnFix-1.0.jar It's not perfect, as sometimes the items bounce back to the slot they were taken from... Here's the code Code: public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { if (cmd.getName().equalsIgnoreCase("fix")) { if (sender instanceof Player) { Player p = (Player) sender; ItemStack is = p.getItemInHand(); Inventory inv = p.getInventory(); int empty = inv.firstEmpty(); if (empty < 0) { sender.sendMessage("[ItemRespawnFix] You must have an empty inventory slot!"); return false; } p.getInventory().setItemInHand(new ItemStack(Material.AIR)); inv.setItem(empty, is); p.updateInventory(); return true; } } return false; }
When I tried it, it didn't work. It just moved the item to the next free slot. I need it to delete the old item and spawn the same item back. I found this code- will it work? I am not sure. You most likely will have to edit it and add some stuff like p.updateInventory();. Code: [INDENT][FONT=Georgia][I][FONT=Consolas]public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args){ if(cmd.getName().equalsIgnoreCase("fix")){ if(sender instanceof Player){ Player p = (Player)sender; ItemStack is = p.getItemInHand(); p.getItemInHand().setType(Material.AIR); p.getInventory.addItem(is); } } } } [/FONT][/I][/FONT][/INDENT]
Erm... for a easy plugin this is awfully difficult. Eccentric had it basically alright, but all he needed to do is: Code: Itemstack is = new Itemstack(); is=... (Normal) Block block=is[0].getTypeId is."Code for deleting the object" p.getInventory.......block Notice, this isn't the exact coding, but that's all that has to be changed.
Also, I need the plugin not to repair tools and armor so that they can't get free repairs. Please join the server at play.mc.sajagworld.com or reply to this thread. We really need this plugin ASAP. It has already been 2 weeks. Thanks, Sajag **The Coder position on the server is still open**