Implementation of Graph data structure inside Item Cubes. Fully

functional and bug-free.
This commit is contained in:
sigonasr2 2017-04-04 21:59:28 -05:00
parent 1fa2a080c8
commit 87dbf99a31
7 changed files with 90 additions and 48 deletions

View File

@ -3,12 +3,18 @@
<booleanAttribute key="org.eclipse.ant.ui.ATTR_TARGETS_UPDATED" value="true"/> <booleanAttribute key="org.eclipse.ant.ui.ATTR_TARGETS_UPDATED" value="true"/>
<booleanAttribute key="org.eclipse.ant.ui.DEFAULT_VM_INSTALL" value="false"/> <booleanAttribute key="org.eclipse.ant.ui.DEFAULT_VM_INSTALL" value="false"/>
<stringAttribute key="org.eclipse.debug.core.ATTR_REFRESH_SCOPE" value="${resource}"/> <stringAttribute key="org.eclipse.debug.core.ATTR_REFRESH_SCOPE" value="${resource}"/>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/TwosideKeeper"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="4"/>
</listAttribute>
<booleanAttribute key="org.eclipse.debug.ui.ATTR_LAUNCH_IN_BACKGROUND" value="false"/> <booleanAttribute key="org.eclipse.debug.ui.ATTR_LAUNCH_IN_BACKGROUND" value="false"/>
<stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="org.eclipse.ant.ui.AntClasspathProvider"/> <stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="org.eclipse.ant.ui.AntClasspathProvider"/>
<booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="true"/> <booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="true"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="Project"/> <stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="TwosideKeeper"/>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${workspace_loc:/Project/projectBuilder.xml}"/> <stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${workspace_loc:/TwosideKeeper/projectBuilder.xml}"/>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_RUN_BUILD_KINDS" value="full,incremental,"/> <stringAttribute key="org.eclipse.ui.externaltools.ATTR_RUN_BUILD_KINDS" value="full,incremental,"/>
<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_TRIGGERS_CONFIGURED" value="true"/> <booleanAttribute key="org.eclipse.ui.externaltools.ATTR_TRIGGERS_CONFIGURED" value="true"/>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_WORKING_DIRECTORY" value="${workspace_loc:/Project}"/> <stringAttribute key="org.eclipse.ui.externaltools.ATTR_WORKING_DIRECTORY" value="${workspace_loc:/TwosideKeeper}"/>
</launchConfiguration> </launchConfiguration>

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<projectDescription> <projectDescription>
<name>AutoPluginUpdate</name> <name>TwosideKeeper</name>
<comment></comment> <comment></comment>
<projects> <projects>
</projects> </projects>

Binary file not shown.

View File

@ -12,6 +12,7 @@ import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta; import org.bukkit.inventory.meta.ItemMeta;
import aPlugin.API;
import sig.plugin.TwosideKeeper.TwosideKeeper; import sig.plugin.TwosideKeeper.TwosideKeeper;
import sig.plugin.TwosideKeeper.HelperStructures.Common.BaublePouch; import sig.plugin.TwosideKeeper.HelperStructures.Common.BaublePouch;
import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions; import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions;

View File

@ -283,6 +283,11 @@ public class InventoryUtils {
return destination.getLocation().getX()+destination.getLocation().getY()+destination.getLocation().getZ()+destination.getLocation().getWorld().getName(); 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) { public static ItemStack[] RemoveAllNullItems(ItemStack[] contents) {
List<ItemStack> items = new ArrayList<ItemStack>(); List<ItemStack> items = new ArrayList<ItemStack>();
for (int i=0;i<contents.length;i++) { for (int i=0;i<contents.length;i++) {

View File

@ -460,7 +460,7 @@ public class ItemCubeUtils {
UndirectedGraph<Integer,DefaultEdge> graph = TwosideKeeper.itemCubeGraph; UndirectedGraph<Integer,DefaultEdge> graph = TwosideKeeper.itemCubeGraph;
graph.addVertex(id); graph.addVertex(id);
DefaultEdge edge = graph.addEdge(PlayerStructure.getPlayerNegativeHash(p), 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); ItemCubeUtils.IterateAndAddToGraph(id, graph);
} }
} }
@ -472,7 +472,7 @@ public class ItemCubeUtils {
UndirectedGraph<Integer,DefaultEdge> graph = TwosideKeeper.itemCubeGraph; UndirectedGraph<Integer,DefaultEdge> graph = TwosideKeeper.itemCubeGraph;
graph.addVertex(id); graph.addVertex(id);
DefaultEdge edge = graph.addEdge(sourceCubeID, 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); ItemCubeUtils.IterateAndAddToGraph(id, graph);
} }
} }
@ -499,7 +499,7 @@ public class ItemCubeUtils {
if (id!=newid) { //We don't need to link to itself. if (id!=newid) { //We don't need to link to itself.
graph.addVertex(newid); graph.addVertex(newid);
DefaultEdge edge = graph.addEdge(id, 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); int newid = getItemCubeID(it);
graph.addVertex(newid); graph.addVertex(newid);
DefaultEdge edge = graph.addEdge(PlayerStructure.getPlayerNegativeHash(p), 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) { while (destroyed.size()>0) {
DefaultEdge edge = destroyed.remove(0); DefaultEdge edge = destroyed.remove(0);
//TwosideKeeper.log("Destroyed edge "+edge, 0); TwosideKeeper.log("Destroyed edge "+edge, TwosideKeeper.GRAPH_DEBUG);
graph.removeEdge(edge); graph.removeEdge(edge);
} }
} }
@ -539,8 +539,9 @@ public class ItemCubeUtils {
} }
while (destroyed.size()>0) { while (destroyed.size()>0) {
DefaultEdge edge = destroyed.remove(0); DefaultEdge edge = destroyed.remove(0);
//TwosideKeeper.log("Destroyed edge "+edge, 0); TwosideKeeper.log("Destroyed edge "+edge, TwosideKeeper.GRAPH_DEBUG);
graph.removeEdge(edge); graph.removeEdge(edge);
} }
} }
@ -581,4 +582,10 @@ public class ItemCubeUtils {
} }
return false; return false;
} }
/*public static void setupGraphForChest(Inventory inv) {
if (inv.getType()==InventoryType.CHEST ||
inv.getType()==InventoryType.) {
}
}*/
} }

View File

@ -459,6 +459,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
public static final int CLEANUP_DEBUG = 2; public static final int CLEANUP_DEBUG = 2;
public static final int LOOT_DEBUG = 3; public static final int LOOT_DEBUG = 3;
public static final int COMBAT_DEBUG = 3; public static final int COMBAT_DEBUG = 3;
public static final int GRAPH_DEBUG = 0;
public static double worldShopDistanceSquared = 1000000; public static double worldShopDistanceSquared = 1000000;
public static double worldShopPriceMult = 2.0; //How much higher the price increases for every increment of worlsShopDistanceSquared. 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.getInventory());
GenericFunctions.updateSetItemsInInventory(ev.getView().getBottomInventory()); GenericFunctions.updateSetItemsInInventory(ev.getView().getBottomInventory());
GenericFunctions.updateSetItemsInInventory(ev.getView().getTopInventory()); GenericFunctions.updateSetItemsInInventory(ev.getView().getTopInventory());
//ItemCubeUtils.setupGraphForChest(ev.getInventory());
} }
@EventHandler(priority=EventPriority.LOW,ignoreCancelled = true) @EventHandler(priority=EventPriority.LOW,ignoreCancelled = true)
@ -5772,30 +5774,33 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
Inventory clickedinv = p.getOpenInventory().getTopInventory(); Inventory clickedinv = p.getOpenInventory().getTopInventory();
ItemStack item1 = p.getInventory().getItem(ev.getHotbarButton()); //Bottom to Top ItemStack item1 = p.getInventory().getItem(ev.getHotbarButton()); //Bottom to Top
ItemStack item2 = p.getOpenInventory().getItem(ev.getRawSlot()); //Top to Bottom 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 #") && if (clickedinv!=null && clickedinv.getTitle()!=null && clickedinv.getTitle().contains("Item Cube #") &&
ev.getRawSlot()<p.getOpenInventory().getTopInventory().getSize()) { ev.getRawSlot()<p.getOpenInventory().getTopInventory().getSize()) {
int id = Integer.parseInt(clickedinv.getTitle().split("#")[1]); int id = Integer.parseInt(clickedinv.getTitle().split("#")[1]);
if (ItemCubeUtils.isItemCube(item1)) { if (ItemCubeUtils.isItemCube(item1)) {
int cubeid = ItemCubeUtils.getItemCubeID(item1); int cubeid = ItemCubeUtils.getItemCubeID(item1);
try { if (id!=cubeid) {
DefaultEdge edge = TwosideKeeper.itemCubeGraph.addEdge(id, cubeid); DefaultEdge edge = TwosideKeeper.itemCubeGraph.addEdge(id, cubeid);
if (edge!=null) {
TwosideKeeper.log("Added edge "+edge, TwosideKeeper.GRAPH_DEBUG);
edge = TwosideKeeper.itemCubeGraph.removeEdge(PlayerStructure.getPlayerNegativeHash(p), cubeid); edge = TwosideKeeper.itemCubeGraph.removeEdge(PlayerStructure.getPlayerNegativeHash(p), cubeid);
} catch (IllegalArgumentException ex) { TwosideKeeper.log("Removed edge "+edge, TwosideKeeper.GRAPH_DEBUG);
ev.setCancelled(true);
ev.setCursor(ev.getCursor());
return;
}
if (!ItemCubeUtils.isConnectedToRootNode(TwosideKeeper.itemCubeGraph, id)) { if (!ItemCubeUtils.isConnectedToRootNode(TwosideKeeper.itemCubeGraph, id)) {
try { edge = TwosideKeeper.itemCubeGraph.addEdge(PlayerStructure.getPlayerNegativeHash(p), cubeid);
DefaultEdge edge = TwosideKeeper.itemCubeGraph.addEdge(PlayerStructure.getPlayerNegativeHash(p), cubeid); TwosideKeeper.log("Added edge "+edge, TwosideKeeper.GRAPH_DEBUG);
edge = TwosideKeeper.itemCubeGraph.removeEdge(id, cubeid); edge = TwosideKeeper.itemCubeGraph.removeEdge(id, cubeid);
//TwosideKeeper.log("Added edge "+edge, 0); TwosideKeeper.log("Removed edge "+edge, TwosideKeeper.GRAPH_DEBUG);
} catch (IllegalArgumentException ex) {
ev.setCancelled(true); ev.setCancelled(true);
ev.setCursor(ev.getCursor()); ev.setCursor(ev.getCursor());
return; return;
} }
} else {
ev.setCancelled(true);
ev.setCursor(ev.getCursor());
return;
}
return;
} else {
ev.setCancelled(true); ev.setCancelled(true);
ev.setCursor(ev.getCursor()); ev.setCursor(ev.getCursor());
return; return;
@ -5805,8 +5810,9 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
int cubeid = ItemCubeUtils.getItemCubeID(item2); int cubeid = ItemCubeUtils.getItemCubeID(item2);
try { try {
DefaultEdge edge = TwosideKeeper.itemCubeGraph.addEdge(PlayerStructure.getPlayerNegativeHash(p), cubeid); DefaultEdge edge = TwosideKeeper.itemCubeGraph.addEdge(PlayerStructure.getPlayerNegativeHash(p), cubeid);
TwosideKeeper.log("Added edge "+edge, TwosideKeeper.GRAPH_DEBUG);
edge = TwosideKeeper.itemCubeGraph.removeEdge(id, cubeid); edge = TwosideKeeper.itemCubeGraph.removeEdge(id, cubeid);
//TwosideKeeper.log("Added edge "+edge, 0); TwosideKeeper.log("Removed edge "+edge, TwosideKeeper.GRAPH_DEBUG);
} catch (IllegalArgumentException ex) { } catch (IllegalArgumentException ex) {
ev.setCancelled(true); ev.setCancelled(true);
ev.setCursor(ev.getCursor()); ev.setCursor(ev.getCursor());
@ -5825,16 +5831,29 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
if (!InventoryUtils.hasFullInventory(clickedinv)) { if (!InventoryUtils.hasFullInventory(clickedinv)) {
int id = Integer.parseInt(clickedinv.getTitle().split("#")[1]); int id = Integer.parseInt(clickedinv.getTitle().split("#")[1]);
int clickedid = ItemCubeUtils.getItemCubeID(ev.getCurrentItem()); int clickedid = ItemCubeUtils.getItemCubeID(ev.getCurrentItem());
TwosideKeeper.log("ID is "+id+":"+clickedid, 0);
if (id!=clickedid) {
DefaultEdge edge = TwosideKeeper.itemCubeGraph.addEdge(id, clickedid);
if (edge!=null) {
TwosideKeeper.log("Added edge "+TwosideKeeper.itemCubeGraph.getEdgeSource(edge)+","+TwosideKeeper.itemCubeGraph.getEdgeTarget(edge), TwosideKeeper.GRAPH_DEBUG);
edge = TwosideKeeper.itemCubeGraph.removeEdge(PlayerStructure.getPlayerNegativeHash(p), clickedid);
TwosideKeeper.log("Removed edge "+TwosideKeeper.itemCubeGraph.getEdgeSource(edge)+","+TwosideKeeper.itemCubeGraph.getEdgeTarget(edge), TwosideKeeper.GRAPH_DEBUG);
if (!ItemCubeUtils.isConnectedToRootNode(TwosideKeeper.itemCubeGraph, id)) { if (!ItemCubeUtils.isConnectedToRootNode(TwosideKeeper.itemCubeGraph, id)) {
edge = TwosideKeeper.itemCubeGraph.addEdge(PlayerStructure.getPlayerNegativeHash(p), clickedid);
TwosideKeeper.log("Added edge "+TwosideKeeper.itemCubeGraph.getEdgeSource(edge)+","+TwosideKeeper.itemCubeGraph.getEdgeTarget(edge), TwosideKeeper.GRAPH_DEBUG);
edge = TwosideKeeper.itemCubeGraph.removeEdge(id, clickedid);
TwosideKeeper.log("Removed edge "+TwosideKeeper.itemCubeGraph.getEdgeSource(edge)+","+TwosideKeeper.itemCubeGraph.getEdgeTarget(edge), TwosideKeeper.GRAPH_DEBUG);
ev.setCancelled(true); ev.setCancelled(true);
ev.setCursor(ev.getCursor()); ev.setCursor(ev.getCursor());
return; return;
} }
try { } else {
DefaultEdge edge = TwosideKeeper.itemCubeGraph.addEdge(id, clickedid); ev.setCancelled(true);
edge = TwosideKeeper.itemCubeGraph.removeEdge(PlayerStructure.getPlayerNegativeHash(p), clickedid); ev.setCursor(ev.getCursor());
//TwosideKeeper.log("Added edge "+edge, 0); return;
} catch (IllegalArgumentException ex) { }
return;
} else {
ev.setCancelled(true); ev.setCancelled(true);
ev.setCursor(ev.getCursor()); ev.setCursor(ev.getCursor());
return; return;
@ -5848,12 +5867,13 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
Inventory clickedinv = p.getOpenInventory().getTopInventory(); Inventory clickedinv = p.getOpenInventory().getTopInventory();
try { try {
DefaultEdge edge = TwosideKeeper.itemCubeGraph.addEdge(PlayerStructure.getPlayerNegativeHash(p), clickedid); DefaultEdge edge = TwosideKeeper.itemCubeGraph.addEdge(PlayerStructure.getPlayerNegativeHash(p), clickedid);
TwosideKeeper.log("Added edge "+edge, TwosideKeeper.GRAPH_DEBUG);
if (pd.isViewingItemCube && clickedinv.getTitle()!=null && if (pd.isViewingItemCube && clickedinv.getTitle()!=null &&
clickedinv.getTitle().contains("Item Cube #")) { clickedinv.getTitle().contains("Item Cube #")) {
int id = Integer.parseInt(clickedinv.getTitle().split("#")[1]); int id = Integer.parseInt(clickedinv.getTitle().split("#")[1]);
edge = TwosideKeeper.itemCubeGraph.removeEdge(id, clickedid); edge = TwosideKeeper.itemCubeGraph.removeEdge(id, clickedid);
TwosideKeeper.log("Removed edge "+edge, TwosideKeeper.GRAPH_DEBUG);
} }
//TwosideKeeper.log("Added edge "+edge, 0);
} catch (IllegalArgumentException ex) { } catch (IllegalArgumentException ex) {
ev.setCancelled(true); ev.setCancelled(true);
ev.setCursor(ev.getCursor()); ev.setCursor(ev.getCursor());
@ -5876,19 +5896,20 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
} }
try { try {
DefaultEdge edge = TwosideKeeper.itemCubeGraph.addEdge(id, clickedid); DefaultEdge edge = TwosideKeeper.itemCubeGraph.addEdge(id, clickedid);
//TwosideKeeper.log("Added edge "+edge, 0); TwosideKeeper.log("Added edge "+edge, TwosideKeeper.GRAPH_DEBUG);
} catch (IllegalArgumentException ex) { } catch (IllegalArgumentException ex) {
ev.setCancelled(true); ev.setCancelled(true);
ev.setCursor(ev.getCursor()); ev.setCursor(ev.getCursor());
return; return;
} }
return;
//ItemCube.addItemCubeToAllViewerGraphs(id, ev.getCursor(), p); //ItemCube.addItemCubeToAllViewerGraphs(id, ev.getCursor(), p);
} else } else
if (clickedinv.getType()==InventoryType.PLAYER) { if (clickedinv.getType()==InventoryType.PLAYER) {
int clickedid = ItemCubeUtils.getItemCubeID(ev.getCursor()); int clickedid = ItemCubeUtils.getItemCubeID(ev.getCursor());
try { try {
DefaultEdge edge = TwosideKeeper.itemCubeGraph.addEdge(PlayerStructure.getPlayerNegativeHash(p), clickedid); DefaultEdge edge = TwosideKeeper.itemCubeGraph.addEdge(PlayerStructure.getPlayerNegativeHash(p), clickedid);
//TwosideKeeper.log("Added edge "+edge, 0); TwosideKeeper.log("Added edge "+edge, TwosideKeeper.GRAPH_DEBUG);
} catch (IllegalArgumentException ex) { } catch (IllegalArgumentException ex) {
ev.setCancelled(true); ev.setCancelled(true);
ev.setCursor(ev.getCursor()); ev.setCursor(ev.getCursor());
@ -5903,15 +5924,16 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
clickedinv.getTitle().contains("Item Cube #")) { clickedinv.getTitle().contains("Item Cube #")) {
int id = Integer.parseInt(clickedinv.getTitle().split("#")[1]); int id = Integer.parseInt(clickedinv.getTitle().split("#")[1]);
int clickedid = ItemCubeUtils.getItemCubeID(ev.getCurrentItem()); int clickedid = ItemCubeUtils.getItemCubeID(ev.getCurrentItem());
//TwosideKeeper.itemCubeGraph.addEdge(id, clickedid); DefaultEdge edge = TwosideKeeper.itemCubeGraph.addEdge(id, clickedid);
DefaultEdge edge = TwosideKeeper.itemCubeGraph.removeEdge(id, clickedid); TwosideKeeper.log("Added edge "+edge, TwosideKeeper.GRAPH_DEBUG);
//TwosideKeeper.log("Destroyed edge "+edge, 0); edge = TwosideKeeper.itemCubeGraph.removeEdge(id, clickedid);
TwosideKeeper.log("Destroyed edge "+edge, TwosideKeeper.GRAPH_DEBUG);
//ItemCubeUtils.DestroyAllTargetEdges(clickedid, TwosideKeeper.itemCubeGraph); //ItemCubeUtils.DestroyAllTargetEdges(clickedid, TwosideKeeper.itemCubeGraph);
} else } else
if (clickedinv.getType()==InventoryType.PLAYER) { if (clickedinv.getType()==InventoryType.PLAYER) {
int clickedid = ItemCubeUtils.getItemCubeID(ev.getCurrentItem()); int clickedid = ItemCubeUtils.getItemCubeID(ev.getCurrentItem());
DefaultEdge edge = TwosideKeeper.itemCubeGraph.removeEdge(PlayerStructure.getPlayerNegativeHash(p), clickedid); DefaultEdge edge = TwosideKeeper.itemCubeGraph.removeEdge(PlayerStructure.getPlayerNegativeHash(p), clickedid);
//TwosideKeeper.log("Destroyed edge "+edge, 0); TwosideKeeper.log("Destroyed edge "+edge, TwosideKeeper.GRAPH_DEBUG);
} }
} }
} }
@ -5939,12 +5961,13 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
} }
try { try {
DefaultEdge edge = TwosideKeeper.itemCubeGraph.addEdge(id, clickedid); DefaultEdge edge = TwosideKeeper.itemCubeGraph.addEdge(id, clickedid);
TwosideKeeper.log("Added edge "+edge, 0); TwosideKeeper.log("Added edge "+edge, TwosideKeeper.GRAPH_DEBUG);
} catch (IllegalArgumentException ex) { } catch (IllegalArgumentException ex) {
ev.setCancelled(true); ev.setCancelled(true);
ev.setCursor(ev.getCursor()); ev.setCursor(ev.getCursor());
return; return;
} }
return;
} else } else
{ {
TwosideKeeper.log("Clicked "+clickedslot, 0); TwosideKeeper.log("Clicked "+clickedslot, 0);
@ -5952,7 +5975,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
int clickedid = ItemCubeUtils.getItemCubeID(item); int clickedid = ItemCubeUtils.getItemCubeID(item);
try { try {
DefaultEdge edge = TwosideKeeper.itemCubeGraph.addEdge(PlayerStructure.getPlayerNegativeHash(p), clickedid); DefaultEdge edge = TwosideKeeper.itemCubeGraph.addEdge(PlayerStructure.getPlayerNegativeHash(p), clickedid);
TwosideKeeper.log("Added edge "+edge, 0); TwosideKeeper.log("Added edge "+edge, TwosideKeeper.GRAPH_DEBUG);
} catch (IllegalArgumentException ex) { } catch (IllegalArgumentException ex) {
ev.setCancelled(true); ev.setCancelled(true);
ev.setCursor(ev.getCursor()); ev.setCursor(ev.getCursor());