GunsAPI
GunsAPI
About
This is an API that allows developers to easily create gun plugins. It comes with several methods that you can call to shoot a gun, shoot a RPG, throw a grenade, or shoot a shotgun. There are 4 bullet types that you can choose from.
- Ender pearl
- Snowball
- Egg
- Arrow This plugin does not have any config, Permissions, or commands.
How to use
For server owners: You would only need this plugin if another plugin told you that it is needed. To install:
- Download
- Place in your plugins folder
- Reload or start your server.
- Done
For developers:
Methods
- setExplosionCancel(boolean cancel)
- setEnderPearlTeleportCancel(boolean cancel)
- shootGun(double Damage, Player shooter, Vector volocity, BulletType bulletType, boolean sound)
- shootRPG(double Damage, Player shooter, Vector volocity, BulletType bulletType, double Explosion, boolean sound)
- shootGrenade(double Damage, Player shooter, Vector volocity, BulletType bulletType, double Explosion, boolean sound)
- shootShootgun(double Damage, Player shooter, Vector volocity, BulletType bulletType, int Shells, boolean sound)
Events
- GunHitEvent - This is called when a bullet, grenade, or RPG hits something. (Ground or entity) This event is cancellable. GunHitEvent's methods:
- getGun() - returns Gun
- getVelocity() - returns vector
- getShooter() - returns Player
- getDamage() - returns double
- getBulletType() - returns BulletType
- getExplosion() - returns double
- getBullet() - returns Entity
- isCancelled() - returns if it is canceled
- setCancelled(boolean cancel) - sets if it is canceled
- setGun(Gun gun) - sets Gun
- setVelocity(Vector velocity) - set velocity
- setDamage(double Damage) - set damage
- setBulletType(BulletType bullet) - set BulletType
- setExplosion(double explosion) - set explosion __________
- GunHitEntityEvent - This is called when a bullet, grenade, or RPG hits an entity. This event is cancellable. GunHitEntityEvent's methods:
- getEntity() - returns Entity (The one it hit)
- getGun() - returns Gun
- getVelocity() - returns vector
- getShooter() - returns Player
- getDamage() - returns double
- getBulletType() - returns BulletType
- getExplosion() - returns double
- getBullet() - returns Entity
- isCancelled() - returns if it is canceled
- setCancelled(boolean cancel) - sets if it is canceled
- setGun(Gun gun) - sets Gun
- setVelocity(Vector velocity) - set velocity
- setDamage(double Damage) - set damage
- setBulletType(BulletType bullet) - set BulletType
- setExplosion(double explosion) - set explosion
@HurricaneLuke
Yeah, i'm reviving an old post/comment. You probably already figured this out but, for other developers I want to tell you how to do it. The simple answer is ITEM DURABILITY I might in the future make a post or even an API for "gun magazines" that will work/incorporate this one. It's pretty easy and basic:
This is the rough beat up code, you should be able to interpret it, if your using this API. I will be making a post with these methods or be posting an API(hopefully with source) with them, to make it easier for you, guys. Thanks for your time, - Pop EDIT: Visit the post here
This API helps a ton when coding plugins with a gun feature of some sort. But i do have a few questions and suggestions: Are there clips? Or ammunition for the guns? Like have to have snowballs for the gun to shoot? Also i think an automatic gun should be added, would be sweet!
@HurricaneLuke
Im Wondering the same thing.
This is a very awesome plugin! I have one question: When adding the damage of shotguns, does each shell deal the same damage or is it spread out amongst the shells? (I.E., if I shoot a shotgun with 3 shells with a setting of 3 damage will each shell deal 3 damage each or will they all deal 1 damage each?)
Thanks!
Love it! I have wanted to get a easy way to make my own guns. I am going to try this, looks great!
This is probably a stupid question but then again i am a noob with java at the moment
how do you set ammo mags, and reload time?
Thanks!
Awesome plugin!!!