public void save() {
   GuiNpcTextField.unfocus();
   if (!this.categorySelection && this.dialog.id >= 0) {
     Client.sendData(
         EnumPacketServer.DialogSave,
         new Object[] {
           Integer.valueOf(this.category.id), this.dialog.writeToNBT(new NBTTagCompound())
         });
   } else if (this.categorySelection && this.category.id >= 0) {
     Client.sendData(
         EnumPacketServer.DialogCategorySave,
         new Object[] {this.category.writeNBT(new NBTTagCompound())});
   }
 }
  public void unFocused(GuiNpcTextField guiNpcTextField) {
    String name;
    String old;
    if (guiNpcTextField.id == 0) {
      if (this.category.id < 0) {
        guiNpcTextField.setText("");
      } else {
        name = guiNpcTextField.getText();
        if (!name.isEmpty() && !this.data.containsKey(name)) {
          if (this.categorySelection && this.category.id >= 0) {
            old = this.category.title;
            this.data.remove(this.category.title);
            this.category.title = name;
            this.data.put(this.category.title, Integer.valueOf(this.category.id));
            this.scroll.replace(old, this.category.title);
          }
        } else {
          guiNpcTextField.setText(this.category.title);
        }
      }
    }

    if (guiNpcTextField.id == 1) {
      if (this.dialog.id < 0) {
        guiNpcTextField.setText("");
      } else {
        name = guiNpcTextField.getText();
        if (!name.isEmpty() && !this.data.containsKey(name)) {
          if (!this.categorySelection && this.dialog.id >= 0) {
            old = this.dialog.title;
            this.data.remove(old);
            this.dialog.title = name;
            this.data.put(this.dialog.title, Integer.valueOf(this.dialog.id));
            this.scroll.replace(old, this.dialog.title);
          }
        } else {
          guiNpcTextField.setText(this.dialog.title);
        }
      }
    }

    if (guiNpcTextField.id == 2) {
      this.dialog.sound = guiNpcTextField.getText();
    }
  }