Пример #1
0
    public void execute(Player p, Command cmd, String cmdLbl, String[] args) {
        if (args.length == 1) {
            if (args[0].startsWith("help")) {
                p.sendMessage(MMOCraft.prefix + head);
                p.sendMessage(MMOCraft.prefix + "");
                p.sendMessage(MMOCraft.prefix + foot);
                return;
            } else if (args[0].startsWith("ver")) {
                p.sendMessage(MMOCraft.prefix + I18n._("", new Object[] {MMOCraft.info.getVersion(), MMOCraft.osN}));
                return;
            } else if (args[0].startsWith("stat")) {
                int xp = RaceMgr.getExp(p.getName());
                p.sendMessage(MMOCraft.prefix + I18n._("statsA", new Object[] {RaceMgr.getRaceNameColored(p.getName())}));
                p.sendMessage(MMOCraft.prefix + I18n._("statsB", new Object[] {ChatColor.GRAY + "" + RaceMgr.getLevel(xp) + ChatColor.RESET, I18n._("exp", new Object[] {}), ChatColor.GRAY + "" + xp + ChatColor.RESET}));
                p.sendMessage(MMOCraft.prefix + I18n._("statsC", new Object[] {ChatColor.GRAY + "" + RaceMgr.getNextLevel(xp) + ChatColor.RESET, ChatColor.GRAY + "" + RaceMgr.getNextExp(xp) + ChatColor.RESET, I18n._("exp", new Object[] {})}));
                return;
            }
        } else if (args.length == 2) {
            if (args[0].equalsIgnoreCase("setexp")) {
                if (Util.isInt(args[1])) {
                    RaceMgr.setExp(p.getName(), Integer.parseInt(args[1]));
                    p.chat("/mmo stats");
                } else { p.sendMessage(MMOCraft.prefix + I18n._("expinvalid", new Object[] {I18n._("exp", new Object[] {})})); }
                return;
            } else if (args[0].equalsIgnoreCase("reload")) {
//TODO : Permission
                if (args[1].equalsIgnoreCase("config")) {
                    ConfigMain.main();
//TODO : Localization
                    p.sendMessage(MMOCraft.prefix + "Config reloaded.");
                    return;
                } else if (args[1].equalsIgnoreCase("data")) {
//TODO : Permission
                    Data.load();
//TODO : Localization
                    p.sendMessage(MMOCraft.prefix + "Data reloaded.");
                    return;
                }
            }
        } else if (args.length == 3) {
            if (args[0].equalsIgnoreCase("setexp")) {
                OfflinePlayer ofp = EntityMgr.getOfflinePlayer(args[1]);
                if (ofp != null) {
                    if (Util.isInt(args[2])) {
                        RaceMgr.setExp(ofp.getName(), Integer.parseInt(args[2]));
                        if (ofp.isOnline()) { EntityMgr.getOnlinePlayer(ofp.getName()).chat("/mmo stats"); }
                        return;
                    } else { p.sendMessage(MMOCraft.prefix + I18n._("expinvalid", new Object[] {})); }
                    return;
                } else { p.sendMessage(MMOCraft.prefix + I18n._("playernotexist", new Object[] {})); }
                return;
            }
        }
        p.chat("/mmo help");
    }
Пример #2
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
    }
Пример #3
0
 public void execute(CommandSender s, Command cmd, String cmdLbl, String[] args) {
     s.sendMessage(MMOCraft.prefix + I18n._("playersonly", new Object[] {}));
 }