Optimized Hopper events further. Fixed Item Cube navigation.
This commit is contained in:
parent
739f84932b
commit
cf4ef2ef4f
Binary file not shown.
@ -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);
|
||||
|
@ -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<ArtifactAbility> TEMPORARYABILITIES = new ArrayList<ArtifactAbility>();
|
||||
public static Set<Block> notWorldShop = new HashSet<Block>();
|
||||
public static Set<Inventory> notWorldShop = new HashSet<Inventory>();
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user