Example #1
0
  public void saveRecord(ItemStack record) {
    Debug.debug("Saving Record Data");
    RPStorageData data = getData();

    if (record == null || record.getType().equals(Material.AIR)) {
      data = RPStorageData.removeDisc(block);
    } else {
      data = RPStorageData.setDisc(block, record);
    }
    RecordPlayer.stopMusic(block.getLocation(), RPNeedle.getById(data.getNeedle()), false);
    RecordPlayer.updateBlockDesign(block, data);
  }
Example #2
0
  private void updatePlayerSlots() {
    if (dirtySlots != true) return;

    Debug.debug("Updating Player Slots");
    Inventory inventory = player.getInventory();
    for (int i = 0; i < 36; i++) {
      if (!playerSlots[i].getItem().equals(inventory.getItem(i))) {
        playerSlots[i].setItem(inventory.getItem(i));
      }
    }

    dirtySlots = false;
  }
Example #3
0
  public void saveNeedle(ItemStack needle) {
    Debug.debug("Saving Needle Data");
    RPStorageData data = getData();

    if (needle == null || needle.getType().equals(Material.AIR)) {
      data.setNeedle(RPNeedle.NONE.id());
    } else {
      Needle n = (Needle) (new SpoutItemStack(needle)).getMaterial();
      data.setNeedle(n.getNeedleType().id());
    }

    JukeIt.getInstance().getDatabase().save(data);
    RecordPlayer.stopMusic(block.getLocation(), RPNeedle.getById(data.getNeedle()), false);
    RecordPlayer.updateBlockDesign(block, data);
  }