Inactive [MECH/FUN/RPG] EffectiveArrows v2.5.3 - Arrows are now Effective![SPOUT] [1060]

Discussion in 'Inactive/Unsupported Plugins' started by skeletonofchaos, Jul 14, 2011.

  1. Offline

    skeletonofchaos

    EffectiveArrows -the bow is now an effective weapon!
    PluginVersion 2.5.3
    ServerVersion /version: git-Bukkit-0.0.0-905-g9277096-b1000jnks (MC: 1.7.2)
    Download EffectiveArrowsv2.5.3

    Requirements:
    • Spout

    Features:
    • Toggle between arrow types by left clicking or if you are using the SpoutCraft launcher you can use the , and . keys to cycle forward and backwards through arrow types.
    • GUI for users using the SpoutCraft launcher.
    • Seven unique arrow types:
    1. Normal: Just the standard arrow, uses one arrow per shot.​
    2. TNT: Explodes on contact, by default uses one arrow and one tnt per shot.​
    3. Lightning: Strikes area with lightning on contact, by default uses one arrow and one diamond per shot.​
    4. Fire: Lights hit area on fire, by default uses one arrow and one wool per shot. Now emits smoke when flying!
    5. Iron: does four damage instead of two, by default uses one iron ingot and one arrow per shot.​
    6. Diamond A.K.A Razor: does six damage, by default uses one diamond and one arrow per shot. They are razor sharp!​
    7. Smoke: Releases a cloud of smoke upon hitting something, by default uses one gunpowder.​

    Permissions (These are super perms):
    The use of permissions can be toggled on/off in the config file if off it will allow players to use allowed arrow types (specified in config) while ops can use all. If permissions are enabled the use of arrows is based on the following nodes, note these are the Bukkit-integrated super perms so you cannot use third party permission plugins like permissions:​
    EffectiveArrow.use.explosive
    EffectiveArrow.use.lightning
    EffectiveArrow.use.flaming
    EffectiveArrow.use.iron
    EffectiveArrow.use.razor
    EffectiveArrow.use.smoke
    Or use EffectiveArrow.use.* to use all arrows!
    I highly recommend using bpermissions for managing super perms.​

    Notes:
    1. The arrow effect works both on contact with entity and blocks; however with blocks there is a small delay.
    2. I would be more than happy to implement new features/arrow types if they are well balanced and the requests are well thought out and politely phrased.
    Upcoming features! (open)
    Eventually custom arrow looks for each arrow type A.K.A. You will be able to see the wool on the fire arrow, the tnt on the explosive arrow and so on. Exciting stuff!

    Features/Tutorial (open)

    Before reporting that you can't switch arrows while using permissions look here:
    Installation (open)

    Remember this plugin uses super-perms which are built into Bukkit not third party applications such as Permissions. To use this you must use a permission handler that directly effects Bukkit permissions (I recommend bPermissions). I understand this is a little hard to grasp seeing that they both do the same thing.



    Changelog:
    v2.5.3:
    Fixed for Spout update! Sorry guys.​
    v2.5.2:
    Fixed for RB 1060!​

    Previous Versions (open)

    v2.5.1:
    Explosive arrows can now be effected by world guard and other such plugins that effect explosions.​
    v2.5:
    Gave the ability to toggle whether or not to use the old method of banning individual arrows while ops can use all. The banned arrows and whether or not to use permissions can all be found and changed in the config file. Rewrote some sections of code. PLEASE DELETE CONFIG FILE UPON UPDATING!
    v2.4:
    You no longer have to give permission for normal arrows. Stopped the plugin from crashing the server if setup incorrectly :). Removed old code. Improved efficiency due to removal of repeated checks of the same condition. Added hidden feature.​
    v2.3:
    Completely implemented the * node. Explosive arrows remove themselves now so no more lag in blown up areas. Fixed a bug where you could switch arrow types in chat. Fixed a bug do to two Runnables conflicting (resulting in an ArrayIndexOutOfBounds exception). Improved code efficiency. Removed the timer setting in the config file due to the new changes. PLEASE DELETE CONFIG FILE UPON UPDATING!
    v2.2:
    GUI now only shows when a player is interacting with a bow and arrow (note: this means it enables and disables on left and right clicks, the item held change event cannot handle scrolling well). Customizable GUI location! Removed redundant code.Added EffectiveArrow.use.* permission node. PLEASE DELETE CONFIG FILE UPON UPDATING!
    v2.1:
    Added smoke arrows! PLEASE DELETE CONFIG FILE UPON UPDATING!
    v2.0:
    Added the ability to customize the size of the explosion for the explosive arrow. Added config file to change the item needed to shoot the arrow. Added GUI for users running the SpoutCraft launcher. Added the ability to cycle through the arrows if using the SpoutCraft launcher using the , and . keys. Fire arrows now emit smoke while flying. Made some code more efficient. PLEASE DELETE CONFIG FILE UPON UPDATING!

    v1.7:
    You can now customize the blast radius of the ExplosiveArrow and we now have Bukkit integrated permission support. PLEASE DELETE CONFIG FILE UPON UPDATING!
    v1.6:
    Emergency fix for a weird bug. You can now adjust how long it takes arrows to activate after hitting blocks. Ops can still use banned arrows so if you want this to be op only just set all arrows to banned. PLEASE DELETE CONFIG FILE UPON UPDATING!
    v1.5:
    Added config file now you can have only the arrows you want to have! Added two new​
    arrow types iron tipped and diamond tipped which do 4 and 6 damage respectively.​
    v1.4:
    Did a rewrite of code. Each arrow type is now it's own class! What does this mean for you? Config file will be coming shortly and more arrows will be added! Also players now can only switch to arrows they have materials for.​
    v1.3:
    released plugin!​


     
  2. Offline

    skeletonofchaos

    Set it to repeat every 5 ticks which would be a quarter of a second.
     
  3. Offline

    xmagicx60

    Uhh, how does that change the plugin code though? I'd just be using a different thing in the same manner....
     
  4. Offline

    skeletonofchaos

    Have a asynchronous runnable cycle thru all of the arrows in air with a while loop. It will run every quarter second making a nice smoke effect. Just have it add the arrow to an array list of arrows in the runnable when it is fired.
     
  5. Offline

    xmagicx60

    Woah, I don't understand that....

    can you like put up an outline of that? Don't do it for me, just an example.
     
  6. Offline

    skeletonofchaos

    ArrayList arrows=new ArrayList();
    onArrowFired(){
    arrows.add(thisarrow)
    }
    run{
    for(int i=0; i<arrows.size(); i++){
    World w=arrow.getWorld();
    w.playEffect(arrow.getLocation(), Effect.SMOKE, 3);
    }
    }
    P.S. How old are you/ where are you from?
    This only adds smoke fyi

    For the whole rapid fire thing it would be like this:
    Code:
    ArrayList players=new ArrayList();
    onRapidFireToggle(Player p){
    if(players.contains(p){
    players.remove(p);
    }
    else{
     player.add(p);
    }
    }
    run{
    for(int i=0;i<players.size();i++){
    onArrowFired(p.shootArrow());
    }
    }
    then just schedule both runnable to be asynchronous and to repeat and you'll be fine

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 17, 2016
  7. Offline

    xmagicx60

    Thanks! will do when I have time.

    So why arent there any plugins like this that I have found?

    Oh, just saw the post before that, I'm 20.
     
  8. Offline

    skeletonofchaos

    Guess there just aren't many people who want them. I'm 15 fyi.
     
  9. Offline

    xmagicx60

    Ok, nice to meet you! Also, all the people on my server have been waiting for it to be released, they've suggested a few things, and seem generally excited to have it, as its the closest thing they have to guns. I've added snowballs, but still only using the old way, ran into a bit of a problem with the inventory, and added -pistol and -burst for slower and faster fire.

    Also, what is p in your script? I can't figure it out, for me, p = chat.getPlayer()

    Oh and is that Bukkit.getScheduler().scheduleAsyncRepeatingTask for the runnable?
    Got it :D But just one problem, I can't get it to stop take items from the inventory, it will only remove one, even when its in the same section as the arrows and is still repeating.

    Code:
    public void run() {
                        ItemStack snowballs = new ItemStack(Material.SNOW_BALL, 1); // A stack of snowballs
    
                        if(inventory.contains(Material.SNOW_BALL)) {
                            p.throwSnowball();
                            inventory.remove(snowballs);
    
                        } else {
                            firing = 0;
                            ammo = 0;
                            Bukkit.getServer().getScheduler().cancelTask(tid);
                            snowball = false;
     
  10. Offline

    skeletonofchaos

    For removing items it is somewhat of a pain:
    Code:
    ItemStack is=player.getInventory().getItem(player.getInventory().first(this.neededToFire()));
                if(is.getAmount()>1){
                    is.setAmount(is.getAmount()-1);
                } else{
                    player.getInventory().clear(player.getInventory().first(this.neededToFire()));
                }
    }
    This will remove 1 of the Material every time(needed to fire is a material so in this case it should be material.snowball). This seems to be a bug in how the methods are structured with respect to the inventory. Removing one snowball with only remove instances of a snowball stack of 1. p would be whatever player you want the toggle to take place on.

    P.S. I'm only 50% sure that these actually work I am not testing any of the code I post here. I'm only posting what I think will work (and most likely will).

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 17, 2016
  11. Offline

    xmagicx60

    Wow, ok, it didn't work for me.

    Also, removing items was my mistake, its not inventory.remove(arrows), its inventory.removeItem(arrows);

    Way simpler than what you posted XD

    Tada,
    Code:
                tid = Bukkit.getScheduler().scheduleAsyncRepeatingTask(this, new Runnable() {
                    public void run() {
                        ItemStack arrows = new ItemStack(Material.ARROW, 1); // A stack of arrows
                        inventory.removeItem(arrows);
                        if(inventory.contains(Material.ARROW)) {
                            p.shootArrow();
    
                        } else {
                            firing = 0;
                            //ammo = 0;
                            Bukkit.getServer().getScheduler().cancelTask(tid);
                            snowball = false;
                        }
    
                    }
    
                }, 0, interval);
    
                }
    Thats the whole firing system and inventory system.

    Its pretty much complete, All I have to do is add file-based configuration and make it so that more than one player can use it at a time.
    not quite sure how to do the player thing though....

    Is there a reason your code seems so complicated for a simple task? Or am I missing something important?
     
  12. Offline

    skeletonofchaos

    No I learned how to do it before the removeItem()...

    Also why do you implement a new runnable for each player? Seems like unnecessary tasks. May lag when a lot of people use it.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 17, 2016
  13. Offline

    xmagicx60

    Hmm, I don't really know how to fix that.
    Also, only one person can use it at a time ATM, I'm going to limit it to 5 until I figure out what you mean by that. How might you make only one runnable for it? Also, this:
    Code:
    11:00:43 [SEVERE] Nag author: '<NoAuthorGiven>' of 'Anvils' about the following: This plugin is not properly shutting down its async tasks when it is being reloaded.  This may cause conflicts with the newly loaded version of the plugin
    11:00:43 [SEVERE] Nag author: '<NoAuthorGiven>' of 'Anvils' about the following: This plugin is not properly shutting down its async tasks when it is being reloaded.  This may cause conflicts with the newly loaded version of the plugin
    11:00:43 [SEVERE] Nag author: '<NoAuthorGiven>' of 'EffectiveArrows' about the following: This plugin is not properly shutting down its async tasks when it is being reloaded.  This may cause conflicts with the newly loaded version of the plugin
    
    That dosn't happen all the time, but it is frequent. I don't get the error with my plugin, idk why, but I think It can be fixed using:

    @Override
    public void onDisable() {
    Bukkit.getServer().getScheduler().cancelTask([taskname]);

    }
     
  14. Offline

    skeletonofchaos

    Yeah I know it's stupidity on Bukkit though it's not an issue.

    You need to have an array list of players not just one player that the effect toggles on... post code will try to fix.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 17, 2016
  15. Offline

    Huene

    Is this 1.8 compatible yet? I havn't seen a version change
     
  16. Offline

    xmagicx60

    Sorry for taking so long to reply, had some major server problems to sort out this past week.

    anyways:
    Code:
    package me.xmagicx60.SmgArrows;
    import java.io.File;
    import java.util.ArrayList;
    
    import org.bukkit.Bukkit;
    import org.bukkit.ChatColor;
    import org.bukkit.Material;
    import org.bukkit.Server;
    import org.bukkit.command.Command;
    import org.bukkit.command.CommandSender;
    import org.bukkit.entity.Player;
    
    import org.bukkit.event.player.PlayerChatEvent;
    import org.bukkit.event.player.PlayerListener;
    import org.bukkit.generator.ChunkGenerator;
    import org.bukkit.inventory.ItemStack;
    import org.bukkit.inventory.PlayerInventory;
    import org.bukkit.plugin.Plugin;
    import org.bukkit.plugin.PluginDescriptionFile;
    import org.bukkit.plugin.PluginLoader;
    import org.bukkit.util.config.Configuration;
    
    import com.avaje.ebean.EbeanServer;
    
    public class SmgArrows extends PlayerListener implements Plugin {
        public static MyPlugin plugin;
        public static int firing = 0;
        public static int tid = 20;
        public static long interval = 2;
        public static boolean snowball = false;
        int ammo = 0;
        public SmgArrows(MyPlugin instance) {
            plugin = instance;
    
        }
    
        public void onPlayerChat(PlayerChatEvent chat) {
            final Player p = chat.getPlayer();
            String message = chat.getMessage();
            String message_lower = message.toLowerCase();
            final PlayerInventory inventory = p.getInventory(); // The player's inventory
    
            if(message_lower.startsWith("-smg") && firing == 0){
                interval = 2;
            if(! p.isOp() && snowball == false){
                snowball = true;
            }else if(message_lower.contains("-b")) {
                    snowball = true;
    
                } if(!inventory.contains(Material.ARROW) && snowball == false){
                    p.sendMessage("You do not have any arrows to load your" + ChatColor.DARK_RED + " SMG" + ChatColor.WHITE + "with.");
                    firing = 0;
                } if(!inventory.contains(Material.SNOW_BALL) && snowball == true){
                    p.sendMessage("You do not have any arrows to load your" + ChatColor.DARK_RED + " SMG" + ChatColor.WHITE + "with.");
                    firing = 0;
                } else if(message_lower.contains("-pistol")) {
                    interval = 4;
                    firing = 1;
                } else if(message_lower.contains("-rapid")) {
                    interval = 1;
                    firing = 1;
                } else if(message_lower.startsWith("-smg")) {
                    interval = 2;
                    firing = 1;
                } else if(message_lower.contains("-help")) {
                    firing = 0;
                    p.sendMessage("use -smg to fire your Machinegun Op's will default to arrows, while non-Op's will default to snowballs.");
                    p.sendMessage("-pistol for slower firing, -rapid for faster, -burst for extra-rapid fire, and use -help to bring up this dialouge.");
                }
    
                if(firing == 1 && snowball == false) {
                    p.chat(ChatColor.LIGHT_PURPLE + p.getName() + ChatColor.WHITE + " has turned" + ChatColor.RED + " ON" + ChatColor.WHITE + " his/her" + ChatColor.DARK_RED + " SMG");
                tid = Bukkit.getScheduler().scheduleAsyncRepeatingTask(this, new Runnable() {
                    public void run() {
                        ItemStack arrows = new ItemStack(Material.ARROW, 1); // A stack of arrows
                        inventory.removeItem(arrows);
                        if(inventory.contains(Material.ARROW)) {
                            p.shootArrow();
    
                        } else {
                            firing = 0;
                            ammo = 0;
                            Bukkit.getServer().getScheduler().cancelTask(tid);
                            snowball = false;
                        }
    
                    }
    
                }, 0, interval);
    
                }
                if(firing == 1 && snowball == true) {
                    p.chat(ChatColor.LIGHT_PURPLE + p.getName() + ChatColor.WHITE + " has turned" + ChatColor.RED + " ON" + ChatColor.WHITE + " his/her" + ChatColor.DARK_RED + " SMG");
                tid = Bukkit.getScheduler().scheduleAsyncRepeatingTask(this, new Runnable() {
                    public void run() {
                        ItemStack snowballs = new ItemStack(Material.SNOW_BALL, 1); // A stack of snowballs
    
                        if(inventory.contains(Material.SNOW_BALL)) {
                            p.throwSnowball();
                            inventory.removeItem(snowballs);
    
                        } else {
                            firing = 0;
                            ammo = 0;
                            Bukkit.getServer().getScheduler().cancelTask(tid);
                            snowball = false;
                        }
                    }
    
                }, 0, interval);
    
                }
                }
        }
    
        @Override
        public boolean onCommand(CommandSender arg0, Command arg1, String arg2,
                String[] arg3) {
            // TODO Auto-generated method stub
            return false;
        }
    
        @Override
        public Configuration getConfiguration() {
            // TODO Auto-generated method stub
            return null;
        }
    
        @Override
        public File getDataFolder() {
            // TODO Auto-generated method stub
            return null;
        }
    
        @Override
        public EbeanServer getDatabase() {
            // TODO Auto-generated method stub
            return null;
        }
    
        @Override
        public ChunkGenerator getDefaultWorldGenerator(String arg0, String arg1) {
            // TODO Auto-generated method stub
            return null;
        }
    
        @Override
        public PluginDescriptionFile getDescription() {
            // TODO Auto-generated method stub
            return null;
        }
    
        @Override
        public PluginLoader getPluginLoader() {
            // TODO Auto-generated method stub
            return null;
        }
    
        @Override
        public Server getServer() {
            // TODO Auto-generated method stub
            return null;
        }
    
        @Override
        public boolean isEnabled() {
            // TODO Auto-generated method stub
            return false;
        }
    
        @Override
        public boolean isNaggable() {
            // TODO Auto-generated method stub
            return false;
        }
    
        @Override
        public void onDisable() {
    
        }
    
        @Override
        public void onEnable() {
            // TODO Auto-generated method stub
    
        }
    
        @Override
        public void onLoad() {
            // TODO Auto-generated method stub
    
        }
    
        @Override
        public void setNaggable(boolean arg0) {
            // TODO Auto-generated method stub
    
        }
    }
    Thats pretty much the whole plugin.... any copiers?
     
  17. Offline

    kris76

    Hello,
    Your project is in status inactive in BukkitDev. I posted a comment on it but I just discover it is still alive there.
    Your plugin is great and WE NEED IT, when do you plan to make it compatible with 1.8 bow ?
    Any donation could help ?
     
  18. Offline

    skeletonofchaos

    I CANNOT make it compatible for the existing API does not permit it to be. YES I want to get this plugin compatible but i CAN'T. Read the posts I said before about this issue.
     
  19. Offline

    kris76

    1. Sorry to bother you
    2. Perhaps you should take a look at this
     
  20. Offline

    skeletonofchaos

    It's not a problem and hmm very interesting work around may be a little laggy though. Implementing new version will probably be up this week.
     
  21. Offline

    Liger_XT5

    @skeletonofchaos
    Any thoughts for updates, or are you just waiting for Rb of spout and CB to come out?
     
  22. Offline

    skeletonofchaos

    waiting
     
  23. Offline

    Liger_XT5

    That's what I thought. I'll let the archer fans on my server that they'll have to just wait it out and stock up on supplies. :p
     
  24. Offline

    skeletonofchaos

    I still need an onArrowFired event to detect the arrows being fired.
     
  25. Offline

    Danelli

    To bad this is not going to be updated, it was my favorite plugin:)
     
  26. Offline

    skeletonofchaos

    I wish I could update it but the mechanics to update it simply arent there to make it function the way it is supposed to...
     
  27. Offline

    xsolar66

    bukkit is seriously lacking in arrow-related events at the moment
     
  28. Offline

    skeletonofchaos

    Your telling me :/
     
  29. Offline

    ArrowToTheKnee

    Not to bump an "old" thread but, does this plugin work for the latest spoutcraft?
     
  30. Offline

    EMOberger

    @skeletonofchaos
    Going to be updating this? D:
    Or can anyone fork this? >.>
     
  31. Offline

    dra6o0n

    Hmm why not tweak the effects a little. Add 'passive' arrow uses so not all of them require command lines and can be triggered from certain conditions while playing with the bow and arrow ingame.

    Like adding detection on the arrows when they are lit on fire, and adding a 'flint and steel burn' effect and a 'flame' effect to whatever the arrow hits, be it blocks or entities.

    Shooting through a block of fire or lava will engulf the arrow in flames, and light weak or combustible materials or mobs, with a explosion caused instantly if it hits a creeper or tnt.

    I prefer that effects are universal in that they are useful if you bring the right strategy to the right environment, because you can't typically 'create' new items in bukkit unless you have SpoutCraft or something to enable downloads between clients and servers.
     

Share This Page