Replace help

Discussion in 'Plugin Development' started by chunkaymonkay, Jan 18, 2015.

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

    chunkaymonkay

    Hey guys im working on a guild plugin but im having some issues with "replace" it doesnt seem to work in the part this.inCreation.replace(e.getPlayer().getName(),
    Code:
      @EventHandler
      public void onTalk2(AsyncPlayerChatEvent e)
      {
        if (this.step1.contains(e.getPlayer().getName()))
        {
          if (e.getMessage().equalsIgnoreCase("N"))
          {
            this.step1.remove(e.getPlayer().getName());
            this.inCreation.remove(e.getPlayer().getName());
            e.getPlayer().sendMessage(this.ch + "Cancelled");
            return;
          }
          e.setCancelled(true);
          if (e.getMessage().length() <= 4)
          {
            this.inCreation.replace(e.getPlayer().getName(),
              new Guild(e.getMessage(), null, null));
            this.step1.remove(e.getPlayer().getName());
            this.step2.add(e.getPlayer().getName());
            e.getPlayer()
              .sendMessage(
              ChatColor.WHITE + "" + ChatColor.BOLD +
              "Type in chat What the Prefix of the guild be EX: VK,123");
          }
          else
          {
            e.getPlayer().sendMessage(
              this.ch + "That name is too long! (Max 4 char).");
          }
        }
      }
      
     
  2. Offline

    Skionz

    @chunkaymonkay Your sending the player an Object as a String. Get the Guild's name or however you would like to do that. Also replace returns a new String. It doesn't modify the old one.
     
Thread Status:
Not open for further replies.

Share This Page