Problem with "BarAPI.setMessage"

Discussion in 'Plugin Development' started by maxmar628, Mar 7, 2015.

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

    maxmar628

    Hi guys, i have a problem with the lines "128" and "635" the problem is on ".replace" can help me?

    Code:
    import java.util.ArrayList;
    import java.util.HashMap;
    import java.util.Map;
    import java.util.Random;
    import java.util.concurrent.ConcurrentHashMap;
    import java.util.concurrent.CopyOnWriteArrayList;
    import me.confuser.barapi.BarAPI;
    import me.libraryaddict.disguise.DisguiseAPI;
    import me.libraryaddict.disguise.disguisetypes.DisguiseType;
    import me.libraryaddict.disguise.disguisetypes.MobDisguise;
    import me.libraryaddict.disguise.disguisetypes.watchers.LivingWatcher;
    import org.bukkit.Bukkit;
    import org.bukkit.Location;
    import org.bukkit.Material;
    import org.bukkit.World;
    import org.bukkit.configuration.file.FileConfiguration;
    import org.bukkit.entity.Player;
    import org.bukkit.inventory.ItemStack;
    import org.bukkit.inventory.PlayerInventory;
    import org.bukkit.inventory.meta.ItemMeta;
    import org.bukkit.potion.PotionEffect;
    import org.bukkit.scheduler.BukkitScheduler;
    import org.bukkit.scoreboard.DisplaySlot;
    import org.bukkit.scoreboard.Objective;
    import org.bukkit.scoreboard.Score;
    import org.bukkit.scoreboard.Scoreboard;
    import org.bukkit.scoreboard.ScoreboardManager;
    
    public class ArenaManager
    {
      public ConcurrentHashMap<String, Location> locs = new ConcurrentHashMap();
      public ConcurrentHashMap<String, Location> checkpoint = new ConcurrentHashMap();
      Map<String, ItemStack[]> inv = new HashMap();
      Map<String, ItemStack[]> armor = new HashMap();
      CopyOnWriteArrayList<Arena> arenas = new CopyOnWriteArrayList();
      int arenaSize = 0;
      RFTB plugin;
      public String SB_Runners = null;
      public String SB_Left = null;
      public String SB_Map = null;
      public String SB_Coins = null;
      public String SB_Beast = null;
      public String SB_Kitr = null;
      public String SB_Server = null;
      public String Server = null;
      public ArenaManager(RFTB pl)
      {
        this.plugin = pl;
        this.SB_Runners = ("§a§l" + pl.readConfig.get("sb_runners"));
        this.SB_Left = ("§c§l" + pl.readConfig.get("sb_left"));
        this.SB_Map = ("§b§l" + pl.readConfig.get("sb_map"));
        this.SB_Coins = ("§e§l" + pl.readConfig.get("sb_coins"));
        this.SB_Beast = ("§d§l" + pl.readConfig.get("sb_beast"));
        this.SB_Kitr = ("§a§l" + pl.readConfig.get("sb_kitr"));
        this.SB_Server = ("§b§l" + pl.readConfig.get("sb_server"));
        this.Server = ("§b" + pl.readConfig.get("server"));
      }
      public Arena getArena(int i)
      {
        for (Arena a : this.arenas) {
          if (a.getId() == i) {
            return a;
          }
        }
        return null;
      }
      public ArrayList<Player> getPlayersInArena(Arena a)
      {
        ArrayList pls = new ArrayList();
        for (String s : a.players) {
          pls.add(Bukkit.getPlayer(s));
        }
        for (String s : a.beasts) {
          pls.add(Bukkit.getPlayer(s));
        }
        return pls;
      }
      public void addPlayer(Player p, int i)
      {
        if (!this.plugin.readConfig.cu) {
          return;
        }
        if ((!p.isOnline()) || (p.isDead())) {
          return;
        }
        Arena a = getArena(i);
        if (a == null)
        {
          p.sendMessage("Arena invalida!");
          return;
        }
        if (!a.YouCanJoin)
        {
          this.plugin.s(p, this.plugin.readConfig.get("arena_started").replace("&", "§"));
          return;
        }
        if (a.getPlayers().contains(p.getName())) {
          return;
        }
        if (a.getPlayers().size() >= a.maxplayers)
        {
          this.plugin.s(p, this.plugin.readConfig.get("arena_full").replace("&", "§"));
          return;
        }
        a.getPlayers().add(p.getName());
        this.inv.put(p.getName(), p.getInventory().getContents());
        this.armor.put(p.getName(), p.getInventory().getArmorContents());
       
        p.getInventory().setArmorContents(null);
        p.getInventory().clear();
        p.setFoodLevel(20);
        p.setHealth(20);
       
        this.locs.put(p.getName(), p.getLocation());
       
        p.teleport(a.waitp);
       
        p.updateInventory();
       
        createScoreboard(p, a);
        for (Player pl : getPlayersInArena(a))
        {
          removeScoreboard(pl);
          createScoreboard(pl, a);
          int v = a.maxplayers;
          float percent = a.getPlayers().size() * 100.0F / v;
          BarAPI.setMessage(pl, this.plugin.readConfig.get("bar_waiting_for_players").replace("&", "§").replace("$1", a.pav).replace("$2", a.getPlayers().size()).replace("$3", a.maxplayers), percent);
        }
        if ((!a.HasNotStarted) && (a.getPlayers().size() >= a.maxplayers))
        {
          a.HasNotStarted = true;
          a.mount = false;
          a.exit = 15;
          for (Player pl : getPlayersInArena(a)) {
            this.plugin.s(pl, this.plugin.readConfig.get("starting_in").replace("$1", Integer.toString(a.counter)).replace("&", "§"));
          }
        }
        this.plugin.updateSign(a);
       
        RFTB._log("Add " + p.getName() + " to arena " + a.getId() + " (" + a.pav + ").");
       
        updateSc(a);
      }
      public void removePlayer(final Player p)
      {
        if (p.isDead()) {
          Bukkit.getScheduler().scheduleSyncDelayedTask(this.plugin, new Runnable()
          {
            public void run()
            {
              ArenaManager.this.removePlayerA(p);
            }
          }, 1L);
        } else {
          removePlayerA(p);
        }
      }
      public void removePlayerDeath(final Player p)
      {
        if (p.isDead()) {
          Bukkit.getScheduler().scheduleSyncDelayedTask(this.plugin, new Runnable()
          {
            public void run()
            {
              ArenaManager.this.removePlayerADeath(p);
            }
          }, 1L);
        } else {
          removePlayerADeath(p);
        }
      }
      public void removePlayerADeath(final Player p)
      {
        if (!this.plugin.readConfig.cu) {
          return;
        }
        if (!p.isOnline()) {
          return;
        }
        Arena a = null;
        for (Arena arena : this.arenas)
        {
          if (arena.getPlayers().contains(p.getName())) {
            a = arena;
          }
          if (arena.getbeasts().contains(p.getName())) {
            a = arena;
          }
        }
        if (a == null)
        {
            RFTB._logE("Something went wrong wibeastsplayer " + p.getName());
          p.kickPlayer("Something went wrong...\nFor security reasons you will be expelled.\nInforms an admin.");
          return;
        }
        a.getPlayers().remove(p.getName());
        a.getbeasts().remove(p.getName());
        this.plugin.playingop.remove(p.getName());
        this.plugin.chest.remove(p.getName());
        if (DisguiseAPI.isDisguised(p)) {
          DisguiseAPI.undisguiseToAll(p);
        }
        p.setExp(1.0F);
        p.getInventory().clear();
        p.getInventory().setArmorContents(null);
       
        p.getInventory().setContents((ItemStack[])this.inv.get(p.getName()));
        p.getInventory().setArmorContents((ItemStack[])this.armor.get(p.getName()));
       
        this.inv.remove(p.getName());
        this.armor.remove(p.getName());
       
        Location loc = (Location)this.locs.get(p.getName());
        Bukkit.getScheduler().scheduleSyncDelayedTask(this.plugin, new Runnable()
        {
          public void run()
          {
            p.teleport(ArenaManager.this.deserializeLoc(ArenaManager.this.plugin.getConfig().getString("config.spawn")));
          }
        }, 10L);
       
        this.locs.remove(p.getName());
       
        p.setFireTicks(0);
        for (PotionEffect pe : p.getActivePotionEffects()) {
          p.removePotionEffect(pe.getType());
        }
        removeScoreboard(p);
        createScoreboardJoin(p);
       
        p.setAllowFlight(false);
        p.setFlying(false);
       
        this.plugin.updateSign(a);
       
        RFTB._log("Removed player " + p.getName() + " of arena " + a.getId() + " (" + a.pav + ").");
      }
      public void removePlayerA(final Player p)
      {
        if (!this.plugin.readConfig.cu) {
          return;
        }
        if (!p.isOnline()) {
          return;
        }
        Arena a = null;
        for (Arena arena : this.arenas)
        {
          if (arena.getPlayers().contains(p.getName())) {
            a = arena;
          }
          if (arena.getbeasts().contains(p.getName())) {
            a = arena;
          }
        }
        if (a == null)
        {
            RFTB._logE("Something went wrong with the player " + p.getName());
          p.kickPlayer("Something went wrong...\nFor security reasons I cast out.\nTell a admin.");
          return;
        }
        a.getPlayers().remove(p.getName());
        a.getbeasts().remove(p.getName());
        this.plugin.playingop.remove(p.getName());
        this.plugin.chest.remove(p.getName());
        if (DisguiseAPI.isDisguised(p)) {
          DisguiseAPI.undisguiseToAll(p);
        }
        p.setExp(1.0F);
        p.getInventory().clear();
        p.getInventory().setArmorContents(null);
       
        p.getInventory().setContents((ItemStack[])this.inv.get(p.getName()));
        p.getInventory().setArmorContents((ItemStack[])this.armor.get(p.getName()));
       
        this.inv.remove(p.getName());
        this.armor.remove(p.getName());
       
        Location loc = (Location)this.locs.get(p.getName());
        Bukkit.getScheduler().scheduleSyncDelayedTask(this.plugin, new Runnable()
        {
          public void run()
          {
            p.teleport(ArenaManager.this.deserializeLoc(ArenaManager.this.plugin.getConfig().getString("config.spawn")));
          }
        }, 10L);
       
        this.locs.remove(p.getName());
       
        p.setFireTicks(0);
        for (PotionEffect pe : p.getActivePotionEffects()) {
          p.removePotionEffect(pe.getType());
        }
        removeScoreboard(p);
        createScoreboardJoin(p);
       
        p.setAllowFlight(false);
        p.setFlying(false);
        for (Player pl : getPlayersInArena(a)) {
          this.plugin.s(pl, this.plugin.readConfig.get("left_arena").replace("$1", p.getName()).replace("&", "§"));
        }
        this.plugin.updateSign(a);
       
        RFTB._log("Removing player " + p.getName() + " to arena " + a.getId() + " (" + a.pav + ").");
        if (a.players.size() == 0) {
          this.plugin.reloadArena(a.id);
        }
      }
      public void addBest(Arena a)
      {
        int random = new Random().nextInt(a.players.size());
        String playerbes = (String)a.players.get(random);
        a.getbeasts().add(Bukkit.getPlayer(playerbes).getName());
        a.namebeast = Bukkit.getPlayer(playerbes).getName();
        if (!this.plugin.getSkin(Bukkit.getPlayer(playerbes)).contains("empty")) {
            addskin(Bukkit.getPlayer(playerbes));
        }
        for (String s : a.players) {
          this.plugin.s(Bukkit.getPlayer(s), this.plugin.readConfig.get("choosen_beast").replace("&", "§").replace("$1", Bukkit.getPlayer(playerbes).getName()));
        }
        for (String best : a.getbeasts())
        {
          Player playerbes1 = Bukkit.getPlayer(best);
          playerbes1.teleport(a.waitb);
          ItemStack helm = new ItemStack(Material.DIAMOND_HELMET);
          ItemStack hel = new ItemStack(Material.DIAMOND_CHESTPLATE);
          ItemStack he = new ItemStack(Material.DIAMOND_LEGGINGS);
          ItemStack h = new ItemStack(Material.DIAMOND_BOOTS);
          playerbes1.getInventory().setHelmet(helm);
          playerbes1.getInventory().setChestplate(hel);
          playerbes1.getInventory().setLeggings(he);
          playerbes1.getInventory().setBoots(h);
          addZapper(playerbes1);
          playerbes1.getInventory().setItem(0, new ItemStack(Material.DIAMOND_SWORD, 1));
        }
      }
      public Arena createArena(Location waitb, Location waitp, Location start, String pav, int id, int mp)
      {
        if (!this.plugin.readConfig.cu) {
          return null;
        }
        this.plugin.getConfig().set("arenas." + id + ".name", pav);
        this.plugin.getConfig().set("arenas." + id + ".waitb", serializeLoc(waitb));
        this.plugin.getConfig().set("arenas." + id + ".waitp", serializeLoc(waitp));
        this.plugin.getConfig().set("arenas." + id + ".start", serializeLoc(start));
        this.plugin.getConfig().set("arenas." + id + ".maxplayers", Integer.valueOf(mp));
        Arena a = new Arena(waitb, waitp, start, pav, id, mp);
        this.plugin.saveConfig();
        RFTB._log("Created arena " + a.getId() + " (" + a.pav + ")");
        return a;
      }
      public void setArenaSetup(int id, String setup, Object var)
      {
        if (!this.plugin.readConfig.cu) {
          return;
        }
        this.plugin.getConfig().set("arenas." + id + "." + setup, var);
        this.plugin.saveConfig();
        RFTB._log("Config " + setup + "=" + var + " with the arena " + id + ".");
      }
      public void setSpawn(Object var)
      {
        if (!this.plugin.readConfig.cu) {
          return;
        }
        this.plugin.getConfig().set("config.spawn", var);
        this.plugin.saveConfig();
        RFTB._log("Configurado el spawn");
      }
      public boolean isInGame(Player p)
      {
        for (Arena a : this.arenas)
        {
          if (a.getPlayers().contains(p.getName())) {
            return true;
          }
          if (a.getbeasts().contains(p.getName())) {
            return true;
          }
        }
        return false;
      }
      public String serializeLoc(Location l)
      {
        return l.getWorld().getName() + "," + l.getX() + "," + l.getY() + "," + l.getZ() + "," + l.getYaw() + "," + l.getPitch();
      }
      public Location deserializeLoc(String s)
      {
        String[] st = s.split(",");
        return new Location(Bukkit.getWorld(st[0]), Double.parseDouble(st[1]), Double.parseDouble(st[2]), Double.parseDouble(st[3]), Float.parseFloat(st[4]), Float.parseFloat(st[5]));
      }
      public void start(final Arena a)
      {
         RFTB._log("Starting Arena" + a.getId() + " (" + a.pav + ").");
        a.YouCanJoin = false;
        a.timerest = true;
        a.check = true;
        this.plugin.updateSign(a);
        for (String s : a.players) {
          if (Bukkit.getPlayer(s) == null)
          {
            a.players.remove(s);
          }
          else
          {
            a.beast = true;
            removeScoreboard(Bukkit.getPlayer(s));
            createScoreboard(Bukkit.getPlayer(s), a);
            if (a.getbeasts().contains(Bukkit.getPlayer(s).getName()))
            {
              Bukkit.getScheduler().scheduleSyncDelayedTask(this.plugin, new Runnable()
              {
                public void run()
                {
                  for (String best : a.getbeasts())
                  {
                    a.players.remove(Bukkit.getPlayer(best).getName());
                    Bukkit.getPlayer(best).teleport(a.start);
                    ArenaManager.this.plugin.s(Bukkit.getPlayer(best), ArenaManager.this.plugin.readConfig.get("beast_free_mb").replace("&", "§"));
                  }
                }
              }, 300L);
            }
            else
            {
              this.plugin.playingop.add(Bukkit.getPlayer(s).getName());
              Bukkit.getPlayer(s).teleport(a.start);
              Bukkit.getPlayer(s).getInventory().setItem(0, this.plugin.createItem(Material.BEACON, this.plugin.readConfig.get("checkpoint_item").replace("&", "§"), 0, 1));
              a.mount = true;
              this.plugin.s(Bukkit.getPlayer(s), this.plugin.readConfig.get("run").replace("&", "§"));
            }
          }
        }
        updateSc(a);
      }
      public void checkPlayers(Arena a)
      {
         RFTB._log("Checking players in the arena " + a.getId() + "(" + a.pav + ").");
        if ((a.players.size() == 0) && (a.check))
        {
            RFTB._log("All players have died!");
          for (String s : a.players) {
            this.plugin.s(Bukkit.getPlayer(s), this.plugin.readConfig.get("p_dead"));
          }
          this.plugin.reloadArena(a.id);
        }
      }
      public void checkbeasts(Arena a)
      {
         RFTB._log("Checking beasts in the arena" + a.getId() + "(" + a.pav + ").");
        if ((a.beasts.size() == 0) && (a.check))
        {
            RFTB._log("No beast to start!");
          for (String s : a.players) {
            this.plugin.s(Bukkit.getPlayer(s), this.plugin.readConfig.get("p_dead"));
          }
          this.plugin.reloadArena(a.id);
        }
      }
      public void updateSc(Arena a)
      {
        for (String s : a.getPlayers())
        {
          Objective o = Bukkit.getPlayer(s).getScoreboard().getObjective(DisplaySlot.SIDEBAR);
          o.getScore(Bukkit.getOfflinePlayer(" ")).setScore(10);
          o.getScore(Bukkit.getOfflinePlayer(this.SB_Runners)).setScore(9);
          int cant = a.getPlayers().size();
          o.getScore(Bukkit.getOfflinePlayer("§a" + cant)).setScore(8);
          o.getScore(Bukkit.getOfflinePlayer("  ")).setScore(7);
          o.getScore(Bukkit.getOfflinePlayer(this.SB_Left)).setScore(6);
          o.getScore(Bukkit.getOfflinePlayer("§c" + a.remaining)).setScore(5);
          o.getScore(Bukkit.getOfflinePlayer("   ")).setScore(4);
          o.getScore(Bukkit.getOfflinePlayer(this.SB_Map)).setScore(3);
          o.getScore(Bukkit.getOfflinePlayer("§b" + a.pav)).setScore(2);
          o.getScore(Bukkit.getOfflinePlayer("    ")).setScore(1);
        }
      }
      public void createScoreboard(Player pl, Arena a)
      {
        if (!pl.isOnline()) {
          return;
        }
        Objective objective = Bukkit.getScoreboardManager().getNewScoreboard().registerNewObjective("Escbeast", "dummy");
        String nombre = pl.getName();
        objective.setDisplayName("§6§l" + (nombre.length() > 12 ? nombre.substring(0, 12) : nombre));
        objective.setDisplaySlot(DisplaySlot.SIDEBAR);
        pl.setScoreboard(objective.getScoreboard());
       
        Score vers = objective.getScore(Bukkit.getOfflinePlayer(" "));
        vers.setScore(10);
       
        vers = objective.getScore(Bukkit.getOfflinePlayer(this.SB_Runners));
        vers.setScore(9);
       
        int cant = a.getPlayers().size();
        vers = objective.getScore(Bukkit.getOfflinePlayer("§a" + cant));
        vers.setScore(8);
       
        vers = objective.getScore(Bukkit.getOfflinePlayer("  "));
        vers.setScore(7);
       
        vers = objective.getScore(Bukkit.getOfflinePlayer(this.SB_Left));
        vers.setScore(6);
       
        vers = objective.getScore(Bukkit.getOfflinePlayer("§c" + a.remaining));
        vers.setScore(5);
       
        vers = objective.getScore(Bukkit.getOfflinePlayer("   "));
        vers.setScore(4);
       
        vers = objective.getScore(Bukkit.getOfflinePlayer(this.SB_Map));
        vers.setScore(3);
       
        vers = objective.getScore(Bukkit.getOfflinePlayer("§b" + a.pav));
        vers.setScore(2);
       
        vers = objective.getScore(Bukkit.getOfflinePlayer("    "));
        vers.setScore(1);
      }
      public void createScoreboardJoin(Player pl)
      {
        if (!pl.isOnline()) {
          return;
        }
        Objective objective = Bukkit.getScoreboardManager().getNewScoreboard().registerNewObjective("EscbeastJoin", "dummy");
        String nombre = pl.getName();
        objective.setDisplayName("§6§l" + (nombre.length() > 12 ? nombre.substring(0, 12) : nombre));
        objective.setDisplaySlot(DisplaySlot.SIDEBAR);
        pl.setScoreboard(objective.getScoreboard());
       
        Score vers = objective.getScore(Bukkit.getOfflinePlayer(" "));
        vers.setScore(12);
       
        vers = objective.getScore(Bukkit.getOfflinePlayer(this.SB_Coins));
        vers.setScore(11);
       
        int necroins = this.plugin.LastGem(pl);
        vers = objective.getScore(Bukkit.getOfflinePlayer("§e" + necroins));
        vers.setScore(10);
       
        vers = objective.getScore(Bukkit.getOfflinePlayer("  "));
        vers.setScore(10);
       
        vers = objective.getScore(Bukkit.getOfflinePlayer(this.SB_Beast));
        vers.setScore(9);
        if (!this.plugin.getSkin(pl).contains("empty"))
        {
          vers = objective.getScore(Bukkit.getOfflinePlayer("§d" + this.plugin.getSkin(pl)));
          vers.setScore(8);
        }
        else
        {
          vers = objective.getScore(Bukkit.getOfflinePlayer("§d" + this.plugin.readConfig.get("sb_none")));
          vers.setScore(8);
        }
        vers = objective.getScore(Bukkit.getOfflinePlayer("   "));
        vers.setScore(7);
       
        vers = objective.getScore(Bukkit.getOfflinePlayer(this.SB_Kitr));
        vers.setScore(6);
       
        vers = objective.getScore(Bukkit.getOfflinePlayer("§a" + this.plugin.readConfig.get("sb_none")));
        vers.setScore(5);
       
        vers = objective.getScore(Bukkit.getOfflinePlayer("    "));
        vers.setScore(4);
       
        vers = objective.getScore(Bukkit.getOfflinePlayer(this.SB_Server));
        vers.setScore(3);
       
        vers = objective.getScore(Bukkit.getOfflinePlayer(this.Server));
        vers.setScore(2);
       
        vers = objective.getScore(Bukkit.getOfflinePlayer("     "));
        vers.setScore(1);
      }
      public void removeScoreboard(Player pl)
      {
        if ((pl.getScoreboard() != null) && (pl.getScoreboard().getObjective(DisplaySlot.SIDEBAR) != null)) {
          pl.getScoreboard().getObjective(DisplaySlot.SIDEBAR).unregister();
        }
      }
      public void addskin(Player p)
      {
        if (this.plugin.getSkin(p).equals("Creeper")) {
          createSkin(p, DisguiseType.CREEPER);
        } else if (this.plugin.getSkin(p).equals("Mushroom Cow")) {
          createSkin(p, DisguiseType.MUSHROOM_COW);
        } else if (this.plugin.getSkin(p).equals("Silverfish")) {
          createSkin(p, DisguiseType.SILVERFISH);
        } else if (this.plugin.getSkin(p).equals("Squid")) {
          createSkin(p, DisguiseType.SQUID);
        } else if (this.plugin.getSkin(p).equals("Villager")) {
          createSkin(p, DisguiseType.VILLAGER);
        } else if (this.plugin.getSkin(p).equals("Zombie")) {
          createSkin(p, DisguiseType.ZOMBIE);
        } else if (this.plugin.getSkin(p).equals("Sheep")) {
          createSkin(p, DisguiseType.SHEEP);
        } else if (this.plugin.getSkin(p).equals("Blaze")) {
          createSkin(p, DisguiseType.BLAZE);
        } else if (this.plugin.getSkin(p).equals("Pigman")) {
          createSkin(p, DisguiseType.PIG_ZOMBIE);
        } else if (this.plugin.getSkin(p).equals("Enderman")) {
          createSkin(p, DisguiseType.ENDERMAN);
        } else if (this.plugin.getSkin(p).equals("Iron Golem")) {
          createSkin(p, DisguiseType.IRON_GOLEM);
        } else if (this.plugin.getSkin(p).equals("Snow Golem")) {
          createSkin(p, DisguiseType.SNOWMAN);
        } else if (this.plugin.getSkin(p).equals("W Skeleton")) {
          createSkin(p, DisguiseType.WITHER_SKELETON);
        } else if (this.plugin.getSkin(p).equals("Magma Cube")) {
          createSkin(p, DisguiseType.MAGMA_CUBE);
        }
      }
      public void addZapper(Player p)
      {
        if (this.plugin.getZapper(p).equals("wood")) {
          p.getInventory().setItem(1, createZapper(Material.WOOD_HOE, 58, "§bWood Zapper", 1));
        } else if (this.plugin.getZapper(p).equals("stone")) {
          p.getInventory().setItem(1, createZapper(Material.STONE_HOE, 127, "§bStone Zapper", 2));
        } else if (this.plugin.getZapper(p).equals("iron")) {
          p.getInventory().setItem(1, createZapper(Material.IRON_HOE, 247, "§bIron Zapper", 3));
        } else if (this.plugin.getZapper(p).equals("diamond")) {
          p.getInventory().setItem(1, createZapper(Material.DIAMOND_HOE, 1557, "§5Diamond Zapper", 4));
        } else if (this.plugin.getZapper(p).equals("gold")) {
          p.getInventory().setItem(1, createZapper(Material.GOLD_HOE, 27, "§eGold Zapper", 5));
        }
      }
      private ItemStack createZapper(Material objeto, int durability, String nombre, int shots)
      {
        ItemStack kit = new ItemStack(objeto, 1, (short)durability);
        ItemMeta meta = kit.getItemMeta();
        ArrayList lore = new ArrayList();
        lore.add(this.plugin.readConfig.get("zapper_shots").replace("&", "§").replace("$1", shots));
        lore.add(this.plugin.readConfig.get("zapper_description").replace("&", "§"));
        meta.setDisplayName(nombre);
        kit.setItemMeta(meta);
        return kit;
      }
      public void createSkin(Player p, DisguiseType disguise)
      {
        MobDisguise mobDisguise = new MobDisguise(disguise);
        LivingWatcher beast = (LivingWatcher)mobDisguise.getWatcher();
        beast.setCustomName("§7" + p.getName());
        beast.setCustomNameVisible(true);
        DisguiseAPI.disguiseToAll(p, mobDisguise);
      }
    }
    
    
    Here 2 images of the problem

    Problem #1

    [​IMG]

    Problem #2

    [​IMG]
     
  2. Offline

    bwfcwalshy Retired Staff

    Moved to Plugin Development.
     
    maxmar628 likes this.
  3. Offline

    ChipDev

    Did you even read the error? No integers in the param.
     
    OfficerDeveloper likes this.
  4. Offline

    SuchSwegMuchWow

    @maxmar628 This is a "String" and this is a 'Char' and for the int do shots.toString();
     
    maxmar628 likes this.
  5. Offline

    maxmar628

    Thanks for your answer, is that I'm new at this, you could be a little more specific? :rolleyes:

    Thanks for your answer, how i fix this? can u read the fix line? tysm
     
    Last edited by a moderator: Mar 7, 2015
  6. Offline

    Skionz

    @maxmar628 Use two 'chars' instead of a String and an int.
     
  7. Offline

    maxmar628

    @Skionz Tysm, but i dont understand, can u read the fix lines please :rolleyes:
     
  8. Offline

    Skionz

  9. Offline

    RROD

    In both the errors, you're providing an integer where the replace method requires a string.
    Easy fix. All you need to do change "a.maxplayers" on line 128, and "shots" on line 635, to the following:

    Code:
    "" + a.maxplayers
    
    "" + shots
    Technical: What this does is concatenate the integer with an empty string, converting the integer into a String.
     
  10. Offline

    maxmar628

    @RROD

    He man, tysm this killing me, im from Argentina sory for my bad english, look the line "128" with the fix:


    Code:
    BarAPI.setMessage(pl, this.plugin.readConfig.get("bar_waiting_for_players").replace("&", "§").replace("$1", a.pav).replace("$2", a.getPlayers().size()).replace("$3", "" + a.maxplayers), percent);
        }
    dont work, im reading some things wrong?
     
    Last edited: Mar 7, 2015
  11. Offline

    Funergy

    @maxmar628 We are not giving you the code. You only learn by writing the fix your own. If you read that link @Skionz gave you you should be able to fix it now with Skionz's answer
     
    OfficerDeveloper likes this.
  12. Offline

    maxmar628

    Read a book in Spanish and tell me everything you learned, ty for u """""""help""""""""
     
    Last edited: Mar 7, 2015
  13. Offline

    Skionz

    ChipDev likes this.
  14. Offline

    maxmar628

    Last edited by a moderator: Mar 7, 2015
  15. Offline

    bwfcwalshy Retired Staff

    @maxmar628 The first argument is a char, the second is a string.

    (#replace)
     
  16. Offline

    maxmar628

    @bwfcwalshy yes, i do, but where i aply on the lines for fix?
     
  17. Offline

    bwfcwalshy Retired Staff

    @maxmar628 I said, the #replace methods. The first arguments should be changed to a char.
     
  18. Offline

    maxmar628

    @bwfcwalshy i change the first arguments ("&", "§") for chars ('&', '§') , but now other .replease is wrong :s


    Code:
    BarAPI.setMessage(pl, this.plugin.readConfig.get("bar_waiting_for_players").replace('&', '§').replace("$1", a.pav).replace("$2", a.getPlayers().size()).replace("$3", a.maxplayers), percent);
        }
     
  19. Offline

    ChipDev

    Did you read the error?
    ø–ø
     
  20. Offline

    maxmar628

    @ChipDev i put the error on top of post, this is:

    The method replacer (char, char) in the type String is not aplicable for the arguments (String, int)
     
    Last edited: Mar 8, 2015
  21. Offline

    ChipDev

    Well..
    Send me your code..
     
    maxmar628 likes this.
Thread Status:
Not open for further replies.

Share This Page