Skip to content

Commit

Permalink
Update HyperConomy support, fixes #183
Browse files Browse the repository at this point in the history
  • Loading branch information
Morphan1 committed Dec 29, 2017
1 parent 08a91df commit b2bec32
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 7 deletions.
2 changes: 1 addition & 1 deletion bukkit/pom.xml
Expand Up @@ -195,7 +195,7 @@
<dependency>
<groupId>regalowl.hyperconomy</groupId>
<artifactId>Hyperconomy</artifactId>
<version>0.975.5-SNAPSHOT</version>
<version>0.975.7-SNAPSHOT</version>
<scope>system</scope>
<systemPath>${basedir}/src/main/resources/lib/HyperConomy.jar</systemPath>
</dependency>
Expand Down
Expand Up @@ -14,7 +14,10 @@
import org.bukkit.scheduler.BukkitRunnable;
import regalowl.hyperconomy.account.HyperPlayer;
import regalowl.hyperconomy.bukkit.BukkitConnector;
import regalowl.hyperconomy.event.HyperEvent;
import regalowl.hyperconomy.event.HyperEventHandler;
import regalowl.hyperconomy.event.HyperEventListener;
import regalowl.hyperconomy.event.TransactionEvent;
import regalowl.hyperconomy.inventory.HItemStack;
import regalowl.hyperconomy.transaction.PlayerTransaction;
import regalowl.hyperconomy.transaction.TransactionResponse;
Expand All @@ -25,7 +28,7 @@
import java.util.List;
import java.util.Map;

public class HyperConomySupport extends Support {
public class HyperConomySupport extends Support implements HyperEventListener {

private static final Field TRANSACTION_RESPONSE_PLAYER;

Expand All @@ -50,7 +53,7 @@ public HyperConomySupport() {
public void run() {
BukkitConnector hyperConomy = Support.getPlugin(HyperConomySupport.class);
HyperEventHandler eventHandler = hyperConomy.getHC().getHyperEventHandler();
eventHandler.registerListener(this);
eventHandler.registerListener(HyperConomySupport.this);
}
}.runTaskLaterAsynchronously(DepenizenPlugin.getCurrentInstance(), 1);
}
Expand Down Expand Up @@ -114,16 +117,23 @@ public void onTransaction(PlayerTransaction playerTransaction, TransactionRespon
events.add("player sells " + item.identifyMaterial());
break;

// TODO: are these actually used?
case BUY_FROM_INVENTORY:
break;
// TODO: implement?

case SELL_TO_INVENTORY:
case BUY_CUSTOM:
break;
case SELL_CUSTOM:
break;
}

OldEventManager.doEvents(events, new BukkitScriptEntryData(dPlayer.mirrorBukkitPlayer(Bukkit.getServer()
.getPlayer(hyperPlayer.getUUID())), null), context);
}

@Override
public void handleHyperEvent(HyperEvent hyperEvent) {
if (hyperEvent instanceof TransactionEvent) {
TransactionEvent event = (TransactionEvent) hyperEvent;
onTransaction(event.getTransaction(), event.getTransactionResponse());
}
}
}
Binary file modified bukkit/src/main/resources/lib/HyperConomy.jar
Binary file not shown.

0 comments on commit b2bec32

Please sign in to comment.