From d5d807121cd96787210ba5ae05316108b5b3caba Mon Sep 17 00:00:00 2001 From: mcmonkey Date: Wed, 23 Jan 2019 10:46:18 -0800 Subject: [PATCH] (possibly?) fix FakeItem command duration values --- .../denizen/scripts/commands/item/FakeItemCommand.java | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/plugin/src/main/java/net/aufdemrand/denizen/scripts/commands/item/FakeItemCommand.java b/plugin/src/main/java/net/aufdemrand/denizen/scripts/commands/item/FakeItemCommand.java index 1e7d631a5f..e18f3a0e23 100644 --- a/plugin/src/main/java/net/aufdemrand/denizen/scripts/commands/item/FakeItemCommand.java +++ b/plugin/src/main/java/net/aufdemrand/denizen/scripts/commands/item/FakeItemCommand.java @@ -82,10 +82,8 @@ public void execute(ScriptEntry scriptEntry) throws CommandExecutionException { final Element player_only = scriptEntry.getElement("player_only"); if (scriptEntry.dbCallShouldDebug()) { - dB.report(scriptEntry, getName(), aH.debugList("items", items) + elSlot.debug() + duration.debug() + aH.debugList("players", players) + player_only.debug()); - } int slot = SlotHelper.nameToIndex(elSlot.asString()); @@ -117,8 +115,8 @@ public void execute(ScriptEntry scriptEntry) throws CommandExecutionException { public void run() { for (dPlayer player : players) { Player ent = player.getPlayerEntity(); - ItemStack original = ent.getOpenInventory().getItem(translateSlot(ent, slotSnapshot, playerOnly)); - packetHelper.setSlot(ent, slotSnapshot, original, playerOnly); + ItemStack original = ent.getOpenInventory().getItem(slotSnapshot); + packetHelper.setSlot(ent, translateSlot(ent, slotSnapshot, playerOnly), original, playerOnly); } } }, (float) duration.getSeconds())); @@ -127,6 +125,7 @@ public void run() { } static int translateSlot(Player player, int slot, boolean player_only) { + // This is (probably?) a server-slot-order to network-slot-order translation if (slot < 0) { return 0; } @@ -144,6 +143,6 @@ else if (slot > 35) { if (slot > total) { return total; } - return (int) (slot + (total - 9) - (9 * (2 * Math.floor(slot / 9)))); + return (int) (slot + (total - 9) - (9 * (2 * Math.floor(slot / 9.0)))); } }