-
-
Einzelpreis: price); ?>
Status: status)); ?>
server)): ?>
Server: server); ?>
response;
- $decoded = null;
- if (!empty($response)) {
- $decoded = json_decode($response, true);
- }
- if (is_array($decoded) && isset($decoded['items'])) {
- echo '
Gekaufte Items:';
- foreach ($decoded['items'] as $item) {
- $item_id = isset($item['id']) ? $item['id'] : '';
- $item_id = preg_replace('/^minecraft:/', '', $item_id);
- $amount = isset($item['amount']) ? (int)$item['amount'] : 1;
- echo '- ' . esc_html($item_id) . ' x' . $amount . '
';
+ $decoded = !empty($response) ? json_decode($response, true) : null;
+
+ if (is_array($decoded)) {
+ $has_content = false;
+
+ // Normale Minecraft-Items
+ if (!empty($decoded['items'])) {
+ $has_content = true;
+ echo 'Gekaufte Items:';
+ foreach ($decoded['items'] as $item) {
+ $item_id = preg_replace('/^minecraft:/', '', $item['id'] ?? '');
+ $amount = (int)($item['amount'] ?? 1);
+ echo '- ' . esc_html($item_id) . ' x' . $amount . '
';
+ }
+ echo '
';
}
- echo '
';
- if (isset($decoded['coupon']['code'])) {
+
+ // Commands: Fly & Rang
+ if (!empty($decoded['commands'])) {
+ $has_content = true;
+ echo '
Enthaltene Leistungen:';
+ foreach ($decoded['commands'] as $cmd) {
+ $type = $cmd['type'] ?? '';
+ if ($type === 'fly') {
+ $label = $cmd['label'] ?? '';
+ if (empty($label) && !empty($cmd['duration_sec'])) {
+ $sec = (int)$cmd['duration_sec'];
+ $h = floor($sec / 3600);
+ $m = floor(($sec % 3600) / 60);
+ $label = $h > 0 ? $h . 'h Fly' : $m . ' Min. Fly';
+ }
+ echo '- ✈ ' . esc_html($label ?: 'Fly-Gutschein') . '
';
+ } elseif ($type === 'rank') {
+ $label = $cmd['label'] ?? ($cmd['rank_id'] ?? '');
+ $days = (int)($cmd['days'] ?? 0);
+ $dauer = $days === 0 ? 'dauerhaft' : $days . ' Tag(e)';
+ echo '- 👑 ' . esc_html($label) . ' (' . esc_html($dauer) . ')
';
+ } elseif ($type === 'generic' && !empty($cmd['cmd'])) {
+ echo '- ⚙ ' . esc_html($cmd['cmd']) . '
';
+ }
+ }
+ echo '
';
+ }
+
+ // Coupon
+ if (!empty($decoded['coupon']['code'])) {
$c = $decoded['coupon'];
echo '
Coupon: ' . esc_html($c['code']) . '';
- if (isset($c['discount'])) echo ' (' . intval($c['discount']) . '% Rabatt)';
+ if (isset($c['discount'])) echo ' (-' . intval($c['discount']) . ' Rabatt)';
echo '
';
}
+
+ if (!$has_content) {
+ echo '
Keine Detailinfos verfügbar.';
+ }
} elseif (!empty($response)) {
echo '
Antwort: ' . esc_html($response) . '
';
}