diff --git a/.externalToolBuilders/New_Builder.launch b/.externalToolBuilders/New_Builder.launch index 5f5ccd0..5bf756b 100644 --- a/.externalToolBuilders/New_Builder.launch +++ b/.externalToolBuilders/New_Builder.launch @@ -3,12 +3,18 @@ + + + + + + - - + + - + diff --git a/.project b/.project index 78d9189..c3a1604 100644 --- a/.project +++ b/.project @@ -1,6 +1,6 @@ - AutoPluginUpdate + TwosideKeeper diff --git a/TwosideKeeper.jar b/TwosideKeeper.jar index 509e57b..43b2ff6 100644 Binary files a/TwosideKeeper.jar and b/TwosideKeeper.jar differ diff --git a/src/sig/plugin/TwosideKeeper/HelperStructures/ItemSet.java b/src/sig/plugin/TwosideKeeper/HelperStructures/ItemSet.java index a7d42e0..a12ed2c 100644 --- a/src/sig/plugin/TwosideKeeper/HelperStructures/ItemSet.java +++ b/src/sig/plugin/TwosideKeeper/HelperStructures/ItemSet.java @@ -12,6 +12,7 @@ import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.ItemMeta; +import aPlugin.API; import sig.plugin.TwosideKeeper.TwosideKeeper; import sig.plugin.TwosideKeeper.HelperStructures.Common.BaublePouch; import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions; diff --git a/src/sig/plugin/TwosideKeeper/HelperStructures/Utils/InventoryUtils.java b/src/sig/plugin/TwosideKeeper/HelperStructures/Utils/InventoryUtils.java index 0f59d8b..b23900e 100644 --- a/src/sig/plugin/TwosideKeeper/HelperStructures/Utils/InventoryUtils.java +++ b/src/sig/plugin/TwosideKeeper/HelperStructures/Utils/InventoryUtils.java @@ -283,6 +283,11 @@ public class InventoryUtils { return destination.getLocation().getX()+destination.getLocation().getY()+destination.getLocation().getZ()+destination.getLocation().getWorld().getName(); } + public static int getInventoryNumberHash(Inventory destination) { + String hash = "-"+(Math.signum(destination.getLocation().getBlockX()+destination.getLocation().getBlockZ())>0?1:0)+Integer.toString(Math.abs(destination.getLocation().getBlockX())%1000)+Integer.toString(Math.abs(destination.getLocation().getBlockY())%1000)+Integer.toString(Math.abs(destination.getLocation().getBlockZ())%1000); + return Integer.parseInt(hash); + } + public static ItemStack[] RemoveAllNullItems(ItemStack[] contents) { List items = new ArrayList(); for (int i=0;i graph = TwosideKeeper.itemCubeGraph; graph.addVertex(id); DefaultEdge edge = graph.addEdge(PlayerStructure.getPlayerNegativeHash(p), id); - //TwosideKeeper.log("Added edge "+edge, 0); + TwosideKeeper.log("Added edge "+edge, TwosideKeeper.GRAPH_DEBUG); ItemCubeUtils.IterateAndAddToGraph(id, graph); } } @@ -472,7 +472,7 @@ public class ItemCubeUtils { UndirectedGraph graph = TwosideKeeper.itemCubeGraph; graph.addVertex(id); DefaultEdge edge = graph.addEdge(sourceCubeID, id); - //TwosideKeeper.log("Added edge "+edge, 0); + TwosideKeeper.log("Added edge "+edge, TwosideKeeper.GRAPH_DEBUG); ItemCubeUtils.IterateAndAddToGraph(id, graph); } } @@ -499,7 +499,7 @@ public class ItemCubeUtils { if (id!=newid) { //We don't need to link to itself. graph.addVertex(newid); DefaultEdge edge = graph.addEdge(id, newid); - //TwosideKeeper.log("Reconnected edge "+edge, 0); + TwosideKeeper.log("Reconnected edge "+edge, TwosideKeeper.GRAPH_DEBUG); } } } @@ -511,7 +511,7 @@ public class ItemCubeUtils { int newid = getItemCubeID(it); graph.addVertex(newid); DefaultEdge edge = graph.addEdge(PlayerStructure.getPlayerNegativeHash(p), newid); - //TwosideKeeper.log("Reconnected edge "+edge, 0); + TwosideKeeper.log("Reconnected edge "+edge, TwosideKeeper.GRAPH_DEBUG); } } } @@ -525,7 +525,7 @@ public class ItemCubeUtils { } while (destroyed.size()>0) { DefaultEdge edge = destroyed.remove(0); - //TwosideKeeper.log("Destroyed edge "+edge, 0); + TwosideKeeper.log("Destroyed edge "+edge, TwosideKeeper.GRAPH_DEBUG); graph.removeEdge(edge); } } @@ -539,8 +539,9 @@ public class ItemCubeUtils { } while (destroyed.size()>0) { DefaultEdge edge = destroyed.remove(0); - //TwosideKeeper.log("Destroyed edge "+edge, 0); + TwosideKeeper.log("Destroyed edge "+edge, TwosideKeeper.GRAPH_DEBUG); graph.removeEdge(edge); + } } @@ -581,4 +582,10 @@ public class ItemCubeUtils { } return false; } + /*public static void setupGraphForChest(Inventory inv) { + if (inv.getType()==InventoryType.CHEST || + inv.getType()==InventoryType.) { + + } + }*/ } diff --git a/src/sig/plugin/TwosideKeeper/TwosideKeeper.java b/src/sig/plugin/TwosideKeeper/TwosideKeeper.java index 50300c8..f8b87be 100644 --- a/src/sig/plugin/TwosideKeeper/TwosideKeeper.java +++ b/src/sig/plugin/TwosideKeeper/TwosideKeeper.java @@ -459,6 +459,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener { public static final int CLEANUP_DEBUG = 2; public static final int LOOT_DEBUG = 3; public static final int COMBAT_DEBUG = 3; + public static final int GRAPH_DEBUG = 0; public static double worldShopDistanceSquared = 1000000; public static double worldShopPriceMult = 2.0; //How much higher the price increases for every increment of worlsShopDistanceSquared. @@ -4903,6 +4904,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener { //GenericFunctions.updateSetItemsInInventory(ev.getInventory()); GenericFunctions.updateSetItemsInInventory(ev.getView().getBottomInventory()); GenericFunctions.updateSetItemsInInventory(ev.getView().getTopInventory()); + //ItemCubeUtils.setupGraphForChest(ev.getInventory()); } @EventHandler(priority=EventPriority.LOW,ignoreCancelled = true) @@ -5772,30 +5774,33 @@ public class TwosideKeeper extends JavaPlugin implements Listener { Inventory clickedinv = p.getOpenInventory().getTopInventory(); ItemStack item1 = p.getInventory().getItem(ev.getHotbarButton()); //Bottom to Top ItemStack item2 = p.getOpenInventory().getItem(ev.getRawSlot()); //Top to Bottom - TwosideKeeper.log(item1+" ||| "+item2, 0); if (clickedinv!=null && clickedinv.getTitle()!=null && clickedinv.getTitle().contains("Item Cube #") && ev.getRawSlot()