Пример #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, Command cmd, String cmdLbl, String[] args) {
        if (args.length < 1) { return; }
/*
        if (args[0].equals("hide")) {
            Bukkit.getPlayer("Tester").hidePlayer(p);
        } else if (args[0].equals("show")) {
            Bukkit.getPlayer("Tester").showPlayer(p);
        } else if (args[0].equalsIgnoreCase("dragon")) {
            World world = ((CraftWorld)p.getWorld()).getHandle();
            CustomEntityEnderDragon ed = new CustomEntityEnderDragon(world);
            ed.setLocation(p.getLocation().getBlockX(), p.getLocation().getBlockY(), p.getLocation().getBlockZ(), p.getLocation().getPitch(), p.getLocation().getYaw());
            ed.world.addEntity(ed);
            return;
        } else 
*/
        if (args[0].equalsIgnoreCase("sound")) {
            StringBuilder argz = new StringBuilder();
            
            if (Util.isDouble(args[args.length-1])) {
                if (Util.isDouble(args[args.length-2])) {
                    for (int i = 1; i < args.length-2; i++) {
                        argz.append(args[i] + " ");
                    }
                    
                    argz.setLength(argz.length()-1);
                    
                    SoundEffects.getByName(argz.toString()).playGlobal(p.getLocation(), Float.parseFloat(args[args.length-1]), Float.parseFloat(args[args.length-2]));
                } else {
                    for (int i = 1; i < args.length-1; i++) {
                        argz.append(args[i] + " ");
                    }
                    
                    argz.setLength(argz.length()-1);
                    
                    SoundEffects.getByName(argz.toString()).playGlobal(p.getLocation(), 1.0f, Float.parseFloat(args[args.length-1]));
                }
            } else {
                for (int i = 1; i < args.length; i++) {
                    argz.append(args[i] + " ");
                }
                
                argz.setLength(argz.length()-1);
                
                SoundEffects.getByName(argz.toString()).playGlobal(p.getLocation());
            }
        } else if (args[0].equalsIgnoreCase("soundloop")) {
            if (args.length > 1) {
                final StringBuilder argz = new StringBuilder();
                final Player pF = p;
                
                for (int i = 2; i < args.length; i++) {
                    argz.append(args[i] + " ");
                }
                
                argz.setLength(argz.length()-1);
                
                if (args[1].equalsIgnoreCase("up")) {
                    for (int i = 5; i <= 20; i++) {
                        final float count = (float)i/10;
                        Bukkit.getScheduler().scheduleSyncDelayedTask(MMOCraft.plugin, new Runnable() {
                            public void run() {
                                SoundEffects.getByName(argz.toString()).playGlobal(pF.getLocation(), 1.0f, count);
                            }
                        }, (long)i);
                    }
                } else if (args[1].equalsIgnoreCase("down")) {
                    for (int i = 5; i <= 20; i++) {
                        final float count = (float)i/10;
                        Bukkit.getScheduler().scheduleSyncDelayedTask(MMOCraft.plugin, new Runnable() {
                            public void run() {
                                SoundEffects.getByName(argz.toString()).playGlobal(pF.getLocation(), 1.0f, 2.5f-count);
                            }
                        }, (long)i);
                    }
                } else if (args[1].equalsIgnoreCase("both")) {
                    for (int i = 5; i <= 20; i++) {
                        final float count = (float)i/10;
                        Bukkit.getScheduler().scheduleSyncDelayedTask(MMOCraft.plugin, new Runnable() {
                            public void run() {
                                SoundEffects.getByName(argz.toString()).playGlobal(pF.getLocation(), 1.0f, count);
                            }
                        }, (long)i);
                    }
                    for (int i = 5; i <= 20; i++) {
                        final float count = (float)i/10;
                        Bukkit.getScheduler().scheduleSyncDelayedTask(MMOCraft.plugin, new Runnable() {
                            public void run() {
                                SoundEffects.getByName(argz.toString()).playGlobal(pF.getLocation(), 1.0f, 2.5f-count);
                            }
                        }, (long)i+(15));
                    }
                }
            }
        }
    }
Пример #3
0
 public void removeAid(Aid aid) {
   Util.ListRemove(aids, aid);
 }
Пример #4
0
 public void removePet(Pet pet) {
   Util.ListRemove(pets, pet);
 }