From ee325aa22948c9969c7310a43bfb3c88e8cb777d Mon Sep 17 00:00:00 2001 From: Robert Herhold Date: Thu, 15 Jun 2017 14:47:21 -0400 Subject: [PATCH] Add config option to collect event data --- src/main/java/io/badgeup/sponge/Config.java | 7 +++++++ src/main/java/io/badgeup/sponge/event/BadgeUpEvent.java | 5 +++++ 2 files changed, 12 insertions(+) diff --git a/src/main/java/io/badgeup/sponge/Config.java b/src/main/java/io/badgeup/sponge/Config.java index efd4cec..9b936fe 100644 --- a/src/main/java/io/badgeup/sponge/Config.java +++ b/src/main/java/io/badgeup/sponge/Config.java @@ -47,6 +47,13 @@ public String getBaseAPIURL() { public int getEventPoolConnections() { return this.eventPoolConnections; } + + @Setting("collect-event-data") private boolean collectEventData = false; + + public boolean collectEventData() { + return this.collectEventData; + } + } @Setting("badgeup") private BadgeUpConfig bUpConfig = new BadgeUpConfig(); diff --git a/src/main/java/io/badgeup/sponge/event/BadgeUpEvent.java b/src/main/java/io/badgeup/sponge/event/BadgeUpEvent.java index 289d6ee..f7a7d0d 100644 --- a/src/main/java/io/badgeup/sponge/event/BadgeUpEvent.java +++ b/src/main/java/io/badgeup/sponge/event/BadgeUpEvent.java @@ -1,5 +1,6 @@ package io.badgeup.sponge.event; +import io.badgeup.sponge.BadgeUpSponge; import io.badgeup.sponge.util.JSONSerializable; import io.badgeup.sponge.util.ObjectSerializers; import org.json.JSONArray; @@ -64,6 +65,10 @@ public UUID getSubject() { */ @SuppressWarnings("rawtypes") public void addDataEntry(final String key, Object value) { + if (!BadgeUpSponge.getConfig().getBadgeUpConfig().collectEventData()) { + return; + } + if (value instanceof Player || value instanceof Cause || value instanceof Class) { return; }