Phantom

Discussion in 'Archived: Plugin Requests' started by Keyboard, Mar 17, 2013.

  1. Offline

    Keyboard

    Suggested name: Phantom

    What I want: I would like it to have a feather and when you right click the feather you get fly for 5 seconds, but it has a 60 second cooldown.

    Ideas for commands: No commands needed for this plugin.

    Ideas for permissions: Phantom.fly

    When I'd like it by: Soon as possible
     
  2. Offline

    zta192

    Would the fly just be the same flying you get with creative mode?
     
  3. Offline

    Keyboard

    Yes but without actual creative.
     
  4. Offline

    iPadHD

    I like this idea, the amount of time you should be able to fly and cooldown should be changeable in the config.
     
  5. Offline

    Atakyn

    I'm working on this plugin, however I would like to know if you use Java 6 or Java 7.
     
  6. Offline

    Greennose120

    easy:
    Code:
    public Map<Player, Long> flycd = new HashMap<Player, Long>();
     
    public void onPlayerInteractBlock(PlayerInteractEvent event){
    if(event.getPlayer().getItemInHand().getTypeId() == Material._FEATHER.getId()){
     
    final Player player = event.getPlayer();
         
         
         
         
            long temp = System.currentTimeMillis();
            if(flycd.containsKey(event.getPlayer())){
                if (((this.plugin.getConfig().getInt("Fly-Cooldown"))*1000)<(temp-(flycd.get(event.getPlayer())))) {
                    player.setAllowFlight(true);
                    player.setFlying(true);
               
               
                 
                    Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() {
                        @Override
                        public void run() {
                            player.setFlying(false);
                            player.setAllowFlight(false);
                        }
                    }, 60*20);
                 
                    flycd.put(event.getPlayer(), temp);
                }
                else {
                    if (!player.isFlying()||!player.getAllowFlight()){
                    event.getPlayer().sendMessage(ChatColor.DARK_RED+"Fly is not ready");
                    }
                }
             
            }
            else {
             
                player.setAllowFlight(true);
                    player.setFlying(true);
                 
               
                    player.sendMessage(ChatColor.GOLD+"Fly is activated");
               
                  Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() {
                        @Override
                        public void run() {
                         
                            player.setFlying(false);
                            player.setAllowFlight(false);
                        }
                    }, 60*20);
               
                  Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() {
                      @Override
                      public void run() {
                          player.sendMessage(ChatColor.GOLD+"Remaining time to fly: 10 seconds");
                      }
                  }, (60*20)-200);
                 
                 
                flycd.put(event.getPlayer(), temp);
                       
            }           
            } 
    }
    }
    }
    }
    
    Feel free to compile i
    t
     
  7. Offline

    iPadHD

    Can you please make it a .jar... I have no idea hooowww tooo...
     
  8. Offline

    Atakyn

Share This Page