Skip to content

Commit

Permalink
feat: add xconomy integration
Browse files Browse the repository at this point in the history
  • Loading branch information
sysnote8main committed Feb 21, 2025
1 parent c24e372 commit 26281d2
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 1 deletion.
5 changes: 5 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ repositories {
name = "shopkeepers-repo"
url = "https://repo.projectshard.dev/repository/releases/"
}
maven {
name = "jitpack"
url = "https://jitpack.io"
}
}

dependencies {
Expand All @@ -32,6 +36,7 @@ dependencies {

// Optional dependencies
compileOnly("com.nisovin.shopkeepers:ShopkeepersAPI:2.23.3")
compileOnly("com.github.YiC200333:XConomyAPI:2.25.1")
}

def targetJavaVersion = 21
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package net.azisaba.rcitemloggingintegration;

import net.azisaba.rcitemloggingintegration.integration.ShopkeeperListener;
import net.azisaba.rcitemloggingintegration.integration.XConomyListener;
import net.azisaba.rcitemloggingintegration.manager.ListenerManager;
import org.bukkit.event.HandlerList;
import org.bukkit.plugin.java.JavaPlugin;

public final class RcItemLoggingIntegration extends JavaPlugin {
Expand All @@ -12,13 +14,15 @@ public void onEnable() {
getLogger().info("Initializing...");
listenerManager = new ListenerManager(getLogger());
listenerManager.addListener("Shopkeepers", new ShopkeeperListener(getLogger()));
listenerManager.addListener("XConomy", new XConomyListener(getLogger()));

listenerManager.register(this);
getLogger().info("Initialized!");
}

@Override
public void onDisable() {
HandlerList.unregisterAll(this);
// Plugin shutdown logic
getLogger().info("See you!");
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package net.azisaba.rcitemloggingintegration.integration;

import me.yic.xconomy.api.event.PlayerAccountEvent;
import net.azisaba.rcitemlogging.RcItemLogging;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;

import java.util.logging.Logger;

public class XConomyListener implements Listener {
private Logger logger;

public XConomyListener(Logger logger) {
this.logger = logger;
}

@EventHandler
public void onPlayerAccountEvent(PlayerAccountEvent e) {
logger.info(String.format("AccountName: %s, balance: %s, amount: %s, isAdd: %b, method: %s, uuid: %s, reason: %s",
e.getaccountname(),
e.getbalance().toString(),
e.getamount().toString(),
e.getisadd(),
e.getmethod(),
e.getUniqueId(),
e.getreason()
));
RcItemLogging.getApi().put(
"xconomy_player_money",
"#none",
e.getaccountname(),
String.format("%s by %s (%s)", e.getreason(), e.getmethod(), e.getisadd() ? "add" : "non-add"),
e.getUniqueId()
);
}
}
4 changes: 3 additions & 1 deletion src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@ authors: [sysnote8]
main: net.azisaba.rcitemloggingintegration.RcItemLoggingIntegration
api-version: '1.21'
description: Let's integrate RcItemLogging with other plugins!
softdepend: [Shopkeepers]
softdepend:
- Shopkeepers
- XConomy

0 comments on commit 26281d2

Please sign in to comment.