Skip to content

Commit

Permalink
NBT fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Uncovery committed May 22, 2020
1 parent addc302 commit 0d0b8c2
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
4 changes: 1 addition & 3 deletions inventory.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,7 @@ function umc_check_inventory($item_name, $data, $meta) {
$inv = $UMC_USER['inv'];
$amount = 0;

if (is_array($meta)) { // this should be always the case
$comparator = 'nbt_array';
} else if (!is_array($meta) && strpos($meta, "{") === 0) {
if (!is_array($meta) && strpos($meta, "{") === 0) {
$comparator = 'nbt';
} else if (!is_array($meta)) {
$comparator = 'meta'; // this should not happen anymore
Expand Down
12 changes: 11 additions & 1 deletion websend_inc/depositbox.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -594,6 +594,7 @@ function umc_do_deposit_internal($all = false) {
$amount = $inv;
$amount_str = $inv;
}

umc_echo("{yellow}[!]{gray} You have {yellow}$inv{gray} items in your inventory, depositing {yellow}$amount");

// retrieve the data from the db
Expand Down Expand Up @@ -635,7 +636,16 @@ function umc_do_deposit_internal($all = false) {

// provide feedback
$log_text = "{green}[+]{gray} Depositing {yellow}$amount_str {$item['full']}{gray} for {gold}$recipient";
umc_echo($log_text);
// umc_echo($log_text);
$text_data = array(
array('text' => '[+]', 'format' => 'green'),
array('text' => 'Depositing', 'format' => 'gray'),
array('text' => $amount, 'format' => 'yellow'),
array('text' => $item['name'], 'format' => array('blue', 'show_item' => array('item_name' => $item['item_name'], 'damage' => $item['type'], 'nbt' => $item['nbt_raw']))),
array('text' => "for $recipient", 'format' => 'gold'),

);
umc_text_format($text_data, false, true);

$sentFromSystem = umc_depositbox_system_UUID_check($uuid);

Expand Down
3 changes: 1 addition & 2 deletions websend_inc/shop.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,6 @@ function umc_do_offer_internal($deposit) {
$item_name = $inv[$item_slot]['item_name'];
$item_type = $inv[$item_slot]['data'];
if (isset($inv[$item_slot]['nbt_array']) && count($inv[$item_slot]['nbt_array']) > 0) { //we have nbt
$nbt_array = $inv[$item_slot]['nbt_array'];
$meta = $inv[$item_slot]['nbt'];
} else if ($inv[$item_slot]['meta']) { // we do not want "false" to be serialized
$meta = serialize($inv[$item_slot]['meta']);
Expand All @@ -533,7 +532,7 @@ function umc_do_offer_internal($deposit) {
if (!is_numeric($item_type)) {
$item_type = 0;
}
$inv_amount = umc_check_inventory($item_name, $item_type, $nbt_array);
$inv_amount = umc_check_inventory($item_name, $item_type, $meta);
}

if ($inv_amount == 0) {
Expand Down

0 comments on commit 0d0b8c2

Please sign in to comment.