diff --git a/TwosideKeeper.jar b/TwosideKeeper.jar index 20265cd..3e1b156 100644 Binary files a/TwosideKeeper.jar and b/TwosideKeeper.jar differ diff --git a/src/sig/plugin/TwosideKeeper/ItemCubeWindow.java b/src/sig/plugin/TwosideKeeper/ItemCubeWindow.java index 71e5508..9748fe0 100644 --- a/src/sig/plugin/TwosideKeeper/ItemCubeWindow.java +++ b/src/sig/plugin/TwosideKeeper/ItemCubeWindow.java @@ -4,6 +4,7 @@ import org.bukkit.Bukkit; import org.bukkit.Sound; import org.bukkit.entity.Player; import org.bukkit.inventory.Inventory; +import org.bukkit.inventory.InventoryView; import sig.plugin.TwosideKeeper.HelperStructures.CubeType; import sig.plugin.TwosideKeeper.HelperStructures.ItemCube; @@ -35,6 +36,8 @@ public class ItemCubeWindow { Inventory temp = Bukkit.getServer().createInventory(p, inv_size, "Item Cube #"+itemcubeid); pd.opened_another_cube=true; TwosideKeeper.openItemCubeInventory(temp); + @SuppressWarnings("unused") + InventoryView newinv = p.openInventory(temp); pd.opened_another_cube=false; pd.isViewingItemCube=true; p.playSound(p.getLocation(),Sound.BLOCK_CHEST_OPEN,1.0f,1.0f); diff --git a/src/sig/plugin/TwosideKeeper/TwosideKeeper.java b/src/sig/plugin/TwosideKeeper/TwosideKeeper.java index 8ad8924..78b60bf 100644 --- a/src/sig/plugin/TwosideKeeper/TwosideKeeper.java +++ b/src/sig/plugin/TwosideKeeper/TwosideKeeper.java @@ -48,7 +48,6 @@ import org.bukkit.entity.Player; import org.bukkit.entity.Projectile; import org.bukkit.entity.ThrownPotion; import org.bukkit.entity.TippedArrow; -import org.bukkit.entity.Vehicle; import org.bukkit.entity.Witch; import org.bukkit.entity.minecart.HopperMinecart; import org.bukkit.event.Event.Result; @@ -216,7 +215,8 @@ public class TwosideKeeper extends JavaPlugin implements Listener { WorldShop newshop = TwosideShops.CreateWorldShop(current_session.GetSign(), current_session.getItem(), current_session.getAmt(), Double.parseDouble(df.format(amt)), ev.getPlayer().getName(),true); TwosideShops.SaveWorldShopData(newshop); WorldShop.spawnShopItem(current_session.GetSign().getLocation(), newshop); - notWorldShop.remove(WorldShop.getBlockShopSignAttachedTo(current_session.GetSign())); + Chest c = (Chest)WorldShop.getBlockShopSignAttachedTo(current_session.GetSign()).getState(); + notWorldShop.remove(c.getInventory()); TwosideShops.RemoveSession(ev.getPlayer()); } } @@ -239,7 +239,8 @@ public class TwosideKeeper extends JavaPlugin implements Listener { public void run() { WorldShop newshop = TwosideShops.CreateWorldShop(current_session.GetSign(), current_session.getItem(), current_session.getAmt(), Double.parseDouble(df.format(amt)), ev.getPlayer().getName()); WorldShop.spawnShopItem(current_session.GetSign().getLocation(), newshop); - notWorldShop.remove(WorldShop.getBlockShopSignAttachedTo(current_session.GetSign())); + Chest c = (Chest)WorldShop.getBlockShopSignAttachedTo(current_session.GetSign()).getState(); + notWorldShop.remove(c.getInventory()); TwosideShops.SaveWorldShopData(newshop); //RemoveItemAmount(ev.getPlayer(), current_session.getItem(), current_session.getAmt()); //We now handle items via chest. TwosideShops.RemoveSession(ev.getPlayer()); @@ -846,7 +847,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener { public static Location ELITE_LOCATION = null; public static boolean LOOT_TABLE_NEEDS_POPULATING=true; public static List TEMPORARYABILITIES = new ArrayList(); - public static Set notWorldShop = new HashSet(); + public static Set notWorldShop = new HashSet(); public static CustomItem HUNTERS_COMPASS; public static CustomItem UPGRADE_SHARD; @@ -5212,11 +5213,14 @@ public class TwosideKeeper extends JavaPlugin implements Listener { @EventHandler(priority=EventPriority.LOW,ignoreCancelled = true) public void onHopperSuction(InventoryMoveItemEvent ev) { + if (notWorldShop.contains(ev.getDestination()) || notWorldShop.contains(ev.getSource())) { + return; + } Inventory source = ev.getSource(); Inventory destination = ev.getDestination(); if ((source.getHolder() instanceof HopperMinecart) || source.getLocation().getBlock().getType()==Material.HOPPER) { //log("In here 1",2); - if (notWorldShop.contains(destination.getLocation().getBlock())) { + if (notWorldShop.contains(destination)) { return; } else { Location l = destination.getLocation(); @@ -5239,14 +5243,14 @@ public class TwosideKeeper extends JavaPlugin implements Listener { ,1); } } else { - notWorldShop.add(ev.getDestination().getLocation().getBlock()); + notWorldShop.add(ev.getDestination()); log("Added not world shop "+ev.getDestination().getLocation(),4); } } } if ((destination.getHolder() instanceof HopperMinecart) || destination.getLocation().getBlock().getType()==Material.HOPPER) { //log("In here 2",2); - if (notWorldShop.contains(source.getLocation().getBlock())) { + if (notWorldShop.contains(source)) { return; } else { Location l = source.getLocation(); @@ -5272,7 +5276,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener { ,1); } } else { - notWorldShop.add(ev.getSource().getLocation().getBlock()); + notWorldShop.add(ev.getSource()); log("Added not world shop "+ev.getSource().getLocation(),4); } }