Filled Taser Plugin

Discussion in 'Plugin Requests' started by BananaBiscuits, Sep 15, 2017.

Thread Status:
Not open for further replies.
  1. Offline

    BananaBiscuits

    Plugin category: Misc

    Minecraft version: 1.12

    Suggested name: ArieraTaser

    What I want: I want a plugin where some people (cops) if they have the permission, can do the command /taser which gives them a taser.
    and with a taser you can shoot criminals, and when they're shot they have blindness and cant move, which lasts for 5 minutes.
    I also want the taser to be a stone_hoe with durability 1

    Ideas for commands: /taser, /ArieraTaserReload

    Ideas for permissions: taser.police - allows them to get the taser

    When I'd like it by: ASAP
     
  2. Offline

    SneakyBruh

    I will attempt this plugin.

    Finished:
    https://www.dropbox.com/s/joyoxx0qgt6678c/ArieraTaser.jar?dl=0
    Permission: taser.police
    Commands: /taser
    How To Use: Person with the taser has to punch the other play and with the taser in hand and he will receive blindness 5 for 5 minutes and slowness 100 for 5 minutes. Also the taser will break
    Let me know if I should change anything!

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited: Sep 15, 2017
    BananaBiscuits likes this.
  3. Offline

    BananaBiscuits

    thanks it works great, but do you think you could make it so you can shoot it? but it has a very small range, like only 10 blocks.
    other than that it works great

    *edit* removed
     
    Last edited: Sep 15, 2017
  4. Offline

    SneakyBruh

    I will give it a try!

    @BananaBiscuits I couldn't do it :(. If you can find someone else who can you can decompile the plugin.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Sep 15, 2017
    BananaBiscuits likes this.
  5. Offline

    nahkd123

    @SneakyBruh Well I decompile the plugin using Jd-Gui, so I think I can edit it.

    Edit: Well you can only use it in small range, so extend it is extremely hard.
     
  6. Offline

    SneakyBruh

    it might be a bit messy.
    I didnt bother cleaning up the code XD
     
  7. Offline

    BananaBiscuits

    so are you two going to be making this?
     
  8. Offline

    nahkd123

    @BananaBiscuits Well maybe, but I found a solution to extend the range:
    - Summon the armor stand at player (if player is holding the taser)
    - When player hit the armor stand with taser:
    + Teleport the armor stand (Like you look up, the armor stand will teleport up)
    + When the armor stand is out of range then kill it and repeat the process
    + When the armor stand is touch to player then give it effect then repeat the process (also kill armor stand)
     
  9. Offline

    BananaBiscuits

    you mean extend the range of the taser? because i said i didnt want it to have much range, like only 10 blocks
     
  10. Offline

    nahkd123

    @BananaBiscuits Ah ok, so you just make the range much more lower, like 5 for example. Well I think you can do this with command blocks.
     
  11. Offline

    BananaBiscuits

    i'm not sure i really understand whats the problem right now, are you guys able to make it?
    all i want is something that can shoot like arrows or something (but faster than a regular bow) and the arrows blind and stun someone.
     
  12. Offline

    BananaBiscuits

  13. Offline

    BananaBiscuits

  14. Offline

    Minesuchtiiii

    I'll give it a try.

    //EDIT
    Finished the plugin and sent it via pm.
    For any developers, here is how I did the part with the shooting (only 10 blocks)

    First I created a method to check the distance between 2 locations:
    Code:
        public int getDistance(Location one, Location two) {
    
            int dis = (int) one.distance(two);
    
            return dis;
    
        }
    Then I created a PlayerInteractEvent:
    Code:
                        Snowball f = p.launchProjectile(Snowball.class);
                        f.setShooter(p);
                        f.setVelocity(p.getEyeLocation().getDirection().normalize().multiply(2.0D));
    
                        Bukkit.getScheduler().scheduleSyncDelayedTask(this.plugin, new Runnable() {
    
                            public void run() {
    
                                if (!(f.isOnGround())) {
    
                                    int dis = TaserListener.this.plugin.getDistance(p.getLocation(), f.getLocation());
    
                                    if (dis >= 8) { //distance is set to 8 but because the scheduler runs after 0,25 seconds the snowball travelled about 10 blocks
    
                                        f.remove();
    
                                    } else {
                                        return;
                                    }
    
                                }
    
                            }
    
                        }, 5L);
    And the final part to check whether the player has been hit or not:
    Code:
        @EventHandler
        public void onHit(EntityDamageByEntityEvent e) {
    
                if(e.getEntity() instanceof Player) {
                    Player p = (Player) e.getEntity();
    
                    if(e.getDamager() instanceof Snowball) {
                        Snowball d = (Snowball) e.getDamager();
                      
                        if(d.getShooter() instanceof Player) {
                      
                    Player shooter = (Player) d.getShooter();
                  
                    if(shooter.getItemInHand().hasItemMeta() && shooter.getItemInHand().getItemMeta().getDisplayName().equals("§aTaser")) {
                    this.plugin.addEffects(p);
                    shooter.setItemInHand(new ItemStack(Material.AIR));
                    shooter.playSound(shooter.getLocation(), Sound.BLOCK_ANVIL_BREAK, 1.0F, 1.0F);
                      
                      
                    }
                  
                        }
                }
    
                }
    
          
        }
    addEffects(); is a method in the main class to add the effects to the player. I also created an ArrayList where the players name get put when he gets hit, while he is in the list the PlayerMoveEvent is cancelled. After 5 minutes he gets removed from the list. If he dies he also gets removed from the list, that's it :)
    If anyone else wants the plugin feel free to send me a pm!
     
    Last edited: Sep 21, 2017
    BananaBiscuits likes this.
Thread Status:
Not open for further replies.

Share This Page