Exemplo n.º 1
0
    public void execute(final Player p, Entity unused, float f) {
        if (isCooldown(p)) { return; } else { SkillMgr.addCooldown(p, getName(), cooldown); }
        if (!isLevel(p)) { return; }
        
        if (RaceMgr.getRace(p.getName()).hasData("invis")) { return; }
        
        for (Player other : Bukkit.getOnlinePlayers()) {
            other.hidePlayer(p);
        }
        
        Bukkit.getScheduler().scheduleSyncDelayedTask(MMOCraft.plugin, new Runnable() {
            public void run() {
                RaceMgr.getRace(p.getName()).setData("invis", null);
                
                for (final Player other : Bukkit.getOnlinePlayers()) {
                    Player hide = EntityMgr.getOnlinePlayer(other.getName());
                    Player look = EntityMgr.getOnlinePlayer(p.getName());
                    if (hide != null && look != null) {
                        if (look.equals(hide)) { continue; }
                        if (look.getWorld() == hide.getWorld()) {
                            if (HookVanish.canSee(other, p)) {
                                other.showPlayer(p);
                            }
                        }
                    }
                }
            }
        }, lasts);
        
//XXX: Config - Notify when they go invisible and visible
        //if () { //invis
            p.sendMessage(MMOCraft.prefix + I18n._("skillinvison", new Object[] {}));
            SoundEffects.PORTAL_TRAVEL.play(p, p.getLocation(), 0.3f, 2.0f);
        //}
        //if () { //vis
            int tid = Bukkit.getScheduler().scheduleSyncDelayedTask(MMOCraft.plugin, new Runnable() {
                public void run() {
                    if (p != null) {
                        p.sendMessage(MMOCraft.prefix + I18n._("skillinvisoff", new Object[] {}));
                        SoundEffects.PORTAL_TRIGGER.play(p, p.getLocation(), 25f, 2.5f);
                    }
                }
            }, lasts);
            
            RaceMgr.getRace(p.getName()).setData("invis", tid);
            
        //}
//XXX
    }
Exemplo n.º 2
0
 public boolean isLevel(Player p) {
     Race race = RaceMgr.getRace(p.getName());
     if (race != null) {
         int exp = race.getExp();
         int lvl = RaceMgr.getLevel(exp);
         if (lvl >= lvlReq) {
             return true;
         }
     }
     return false;
 }