aboutsummaryrefslogtreecommitdiff
path: root/src/Java/gtPlusPlus/api
diff options
context:
space:
mode:
Diffstat (limited to 'src/Java/gtPlusPlus/api')
-rw-r--r--src/Java/gtPlusPlus/api/analytics/SegmentHelper.java81
-rw-r--r--src/Java/gtPlusPlus/api/interfaces/ITexturedBlock.java13
-rw-r--r--src/Java/gtPlusPlus/api/objects/Logger.java8
3 files changed, 100 insertions, 2 deletions
diff --git a/src/Java/gtPlusPlus/api/analytics/SegmentHelper.java b/src/Java/gtPlusPlus/api/analytics/SegmentHelper.java
new file mode 100644
index 0000000000..6e264fe1d2
--- /dev/null
+++ b/src/Java/gtPlusPlus/api/analytics/SegmentHelper.java
@@ -0,0 +1,81 @@
+package gtPlusPlus.api.analytics;
+
+import com.segment.analytics.Analytics;
+import com.segment.analytics.Callback;
+import com.segment.analytics.messages.Message;
+import com.segment.analytics.messages.TrackMessage;
+import com.segment.analytics.messages.*;
+import java.util.Map;
+
+public class SegmentHelper implements Callback {
+
+ /**
+ * Credits to Author: FLAMINSAGANAKI/Theodore Mavrakis
+ * http://domisydev.com/2015/11/05/using-segment-analytics-in-your-java-servlet/
+ */
+
+ private static final String writeKey = "EDOWl9peleGlUqe1ZwTqKDyuTMFhyT4k";
+ private static volatile SegmentHelper segment = new SegmentHelper();
+ private Analytics analytics;
+
+ public SegmentHelper(){
+ try{
+ this.analytics = Analytics.builder(writeKey).callback(this).build();
+ }catch(Exception e){
+ SegmentAnalytics.LOG("exception while creating Analytics : " + e);
+ }
+ }
+
+ public static SegmentHelper getInstance(){
+ return segment;
+ }
+
+ public Analytics getAnalyticsClient(){
+ return segment.analytics;
+ }
+
+ public void success(Message message) {
+ SegmentAnalytics.LOG("Successfully uploaded " + message);
+ }
+
+ public void failure(Message message, Throwable throwable) {
+ SegmentAnalytics.LOG("Could not upload " + message);
+ }
+
+ public void addUser(String user_id, Map<String, Object> properties) {
+ try {
+ this.analytics.enqueue(IdentifyMessage.builder().userId(user_id).traits(properties));
+ //trackUser(user_id, "Logged In", properties);
+ } catch (Exception e) {
+ SegmentAnalytics.LOG("Exception in addUser() - " + e);
+ }
+ }
+
+ public void trackUser(String user_id, String description, Map<String, Object> properties) {
+ try {
+ this.analytics.enqueue(TrackMessage.builder(description).userId(user_id).properties(properties));
+ } catch (Exception e) {
+ SegmentAnalytics.LOG("Exception in trackUser() - " + e);
+ }
+ }
+
+ public void trackUser(String user_id, String description) {
+ try {
+ this.analytics.enqueue(TrackMessage.builder(description).userId(user_id));
+ } catch (Exception e) {
+ SegmentAnalytics.LOG("Exception in trackUser() - " + e);
+ }
+ }
+
+ public void groupUser(String group_id, String user_id) {
+ try {
+ this.analytics.enqueue(GroupMessage.builder(group_id).userId(user_id));
+ } catch (Exception e) {
+ SegmentAnalytics.LOG("Exception in groupUser() - " + e);
+ }
+ }
+
+ public static void main(String[] args){
+
+ }
+} \ No newline at end of file
diff --git a/src/Java/gtPlusPlus/api/interfaces/ITexturedBlock.java b/src/Java/gtPlusPlus/api/interfaces/ITexturedBlock.java
new file mode 100644
index 0000000000..3a4b8f188c
--- /dev/null
+++ b/src/Java/gtPlusPlus/api/interfaces/ITexturedBlock.java
@@ -0,0 +1,13 @@
+package gtPlusPlus.api.interfaces;
+
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.tileentity.ITexturedTileEntity;
+import net.minecraft.block.Block;
+
+public interface ITexturedBlock extends ITexturedTileEntity{
+
+ ITexture[] getTexture(byte side);
+
+ ITexture[] getTexture(Block block, byte side);
+
+}
diff --git a/src/Java/gtPlusPlus/api/objects/Logger.java b/src/Java/gtPlusPlus/api/objects/Logger.java
index 848972142a..6e2e9f6107 100644
--- a/src/Java/gtPlusPlus/api/objects/Logger.java
+++ b/src/Java/gtPlusPlus/api/objects/Logger.java
@@ -8,6 +8,10 @@ import gtPlusPlus.core.lib.CORE;
import gtPlusPlus.core.proxy.ClientProxy;
public class Logger {
+
+ public Logger(String string) {
+
+ }
// Logging Functions
public static final org.apache.logging.log4j.Logger modLogger = Logger.makeLogger();
@@ -50,14 +54,14 @@ public class Logger {
// Developer Comments
public static void WARNING(final String s) {
- if (CORE.DEVENV || CORE.DEBUG) {
+ if (CORE.DEBUG) {
modLogger.warn(s);
}
}
// Errors
public static void ERROR(final String s) {
- if (CORE.DEVENV || CORE.DEBUG) {
+ if (CORE.DEBUG) {
modLogger.fatal(s);
}
}