Hey guys, I wanted to make a mini gun plugin where when you have a special bow (shaped recipe) or just normal bow but for that eye of enter in inventory that you can shoot arrows 10 times as fast All help apreciated!
You could make a special bow from a recipe and make the new bow have a different name. So no i dont think you do need spout.
You could create a new ItemStack that would represent the minigun, create a custom crafting recipe to craft this new itemstack, then using an Event (PlayerInteractEvent perhaps?), check to see if the ItemInHand corresponds to your custom item stack, and if it does, run a bit of code that will shoot out arrows to your liking. Edit: I should add that spout would not be needed
You could also rename it by getting the itemStack's ItemMeta and doing meta.setDisplayName("minigun")
Thx guys I have already done some private plugins with recipes - I knew that - I was actioally just interested for the fast arrow shooting - thx though - could you pls explain it a bit more detailed pls?
Check out my Github account, it contains a project called 'MoarStuff' that achieves this. :3 Edit: Also, remember that copying is illegal under my license.
Just the arrow shooting I though the plugin moat stuff is by this zombie guy? Ok I'll check it out EDIT by Moderator: merged posts, please use the edit button instead of double posting.
How can you shoot arrows so fast? Sry - never knew it was yours - wow you have sorted it very good EDIT by Moderator: merged posts, please use the edit button instead of double posting.
I ment that you should use it as the trigger of the minigun instead of PlayerInteractEvent. This gives you the LivingEntity that shoots, the ItemStack which shoots, the Projectile, and even the force (which you could use for a variable effect like amount or spread)
http://jd.bukkit.org/dev/apidocs/or....html#setProjectile(org.bukkit.entity.Entity) Yep I would say so. But when checking Craftbukkit, it would contradict me. You should try it out, but expect a no
Here is the way that I would do it. It probably isn't the best way, but oh well. Make an ArrayList<String>. Use that to store which players (stored by name) have a minigun turned on. Every time a player right-clicks with a minigun, remove them from the list if they were in it already, and add them if they weren't in it before. Start a synchronous repeating task that runs every tick or two that checks if each player in the list has the minigun in their hand and at least 1 arrow in their inventory. If they don't have one of those things, remove them from the list. Otherwise, remove one of the arrows, and fire an arrow in front of the player.
Ok But with this i still can't change the amount of arrows per sercond (or is that the force)? Wait sry - I Didn't read right - but how can you change the amount of arrows because in the bukkit API setforce sais nothing EDIT by Moderator: merged posts, please use the edit button instead of double posting.
you cannot set the amount of arrows per second. But you can do several shots when firing once (including a small delay between the shots), using a BukkitRunnable (scheduler)
ok and how does that work (bukkitrunnable does not tell me something)? how can you call the itemstackĀ“s itemmeta? I tried launchprojectile 10 times in a listener but they all shot at once - how can I set a small delay in bukkit? EDIT by Moderator: merged posts, please use the edit button instead of double posting.
Code: final Player player = (Player)event.getEntity(); new BukkitRunnable() { int amount = 5; @Override public void run() { if(amount > 0) { player.launchProjectile(Arrow.class); amount--; } else { this.cancel(); } } }.runTaskTimer(<plugin instance>, 0L, 5L); This code launches an arrow each 0.25 seconds, up to 5 arrows. I leave the rest of the checks to you.
All you need to do is listen to the PlayerInteractEvent and shoot an arrow if the player is holding a minigun. Here's some code that does that.
thx thx allot guys umm runTaskTimer(<plugin instance> dosent work it says its wrong EDIT by Moderator: merged posts, please use the edit button instead of double posting.
I would recommend using something like this: Code: _plugin.getServer().getScheduler() .scheduleSyncRepeatingTask(_plugin, new Runnable() { @Override public void run() { teleportQue(); updateArenasPlayers(); updateSigns(); } }, 40, 160); _plugin equals the plugin instance
thx but what do you really mean by plugin instance - i thought it is if you do a seperate listener class then public goetterlistener(goetterschwert plugin) { plugin.getServer().getPluginManager().registerEvents(this, plugin); } but that would mean you have to make a seperate class - im a bit confiused
once you have the ItemStack, do item.getItemMeta() to get an object representing the meta. Then once you have modified the meta how you want it, do item.setItemMeta(meta)
goodstuff20 Because you do not seem to understand anything that anyone is saying of you, you are just copy and pasting!
goodstuff20 Replace <plugin instance> with an instance of your plugin (and do not make a new one here, that is wrong). The instance of the plugin in the main class is 'this', otherwise you need to pass the 'this' along with the constructor (main class is the class that extends JavaPlugin) MCForger that code is the same as mine ;3 , yet I can cancel the task from the inside, and you cannot