Development Assistance Wither help

Discussion in 'Plugin Help/Development/Requests' started by Rapid!, Jan 12, 2015.

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

    Rapid!

    So I'm working on a plugin for my friend, and we're using some cool effects and stuff to scare players. One of the idea's I had was to create a wither that spawns with the victims name, but there is a number of things I can't work out, list below is what I'd like some help with
    -Wither is stable (cant move basically)
    -Wither can't do damage
    -Wither name (FIXED)
    -The wither goes away after 30 seconds

    The code I'm using below

    Code:
        if (args.length == 2) {
                                        if (args[0].equalsIgnoreCase("wither")) {
                                            Player victim = this.getServer().getPlayer(args[1]);
                                            Location loc = victim.getLocation();
                                          
                              
                                            Wither wither = (Wither) victim.getLocation().getWorld().spawn(victim.getLocation(), Wither.class);
                                                wither.setCustomName(ChatColor.RED + victim.getName());
                                                wither.setCustomNameVisible(true);
                                                wither.damage(0);
                                              
                                                if (args[0].equalsIgnoreCase("witheremove")) {
                                                    wither.remove();
    
     
  2. Offline

    pie_flavor

    @Rapid!
    Code:java
    1. public class Stabilizer extends BukkitRunnable {
    2. Wither wither;
    3. Location home;
    4. public Stabilizer(Wither wither, Location home) {
    5. this.home = home;
    6. this.wither = wither;
    7. }
    8. public void run() {
    9. wither.teleport(home);
    10. }
    11. }

    Code:java
    1. public class WitherDeleter extends BukkitRunnable {
    2. Wither wither;
    3. Stabilizer stabilizer;
    4. public WitherDeleter(Wither wither, Stabilizer stabilizer) {
    5. this.wither = wither;
    6. this.stabilizer = stabilizer;
    7. }
    8. public void run() {
    9. wither.remove();
    10. stabilizer.cancel();
    11. }
    12. }

    Add this to your onCommand:
    Code:java
    1. Stabilizer stabilizer = new Stabilizer(wither, loc).runTaskTimer(plugin, 10, 10);
    2. new WitherDeleter(wither, stabilizer).runTaskLater(plugin, 600)

    Make sure plugin refers to your plugin's instance, usually gotten during the constructor.
     
  3. Offline

    xMakerx

Thread Status:
Not open for further replies.

Share This Page