From 076ee4ffd0dd3041b8c40d1c35dd22533442fd4e Mon Sep 17 00:00:00 2001 From: NorbiPeti Date: Mon, 31 Oct 2016 17:35:19 +0100 Subject: [PATCH] Fixed a stack trace index --- src/main/java/buttondevteam/lib/TBMCPlayer.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/buttondevteam/lib/TBMCPlayer.java b/src/main/java/buttondevteam/lib/TBMCPlayer.java index 22c0564..5deb51f 100644 --- a/src/main/java/buttondevteam/lib/TBMCPlayer.java +++ b/src/main/java/buttondevteam/lib/TBMCPlayer.java @@ -73,7 +73,7 @@ public class TBMCPlayer implements AutoCloseable { * The value to set */ protected void setData(Object value) { - StackTraceElement st = new Exception().getStackTrace()[0]; + StackTraceElement st = new Exception().getStackTrace()[1]; String mname = st.getMethodName(); if (!mname.startsWith("set")) throw new UnsupportedOperationException("Can only use setData from a setXYZ method"); @@ -124,7 +124,7 @@ public class TBMCPlayer implements AutoCloseable { * The value to set */ protected void setEnumData(Enum value) { - StackTraceElement st = new Exception().getStackTrace()[0]; + StackTraceElement st = new Exception().getStackTrace()[1]; String mname = st.getMethodName(); if (!mname.startsWith("set")) throw new UnsupportedOperationException("Can only use setEnumData from a setXYZ method"); @@ -179,7 +179,7 @@ public class TBMCPlayer implements AutoCloseable { * The value to set */ protected void setIntData(Number value) { - StackTraceElement st = new Exception().getStackTrace()[0]; + StackTraceElement st = new Exception().getStackTrace()[1]; String mname = st.getMethodName(); if (!mname.startsWith("set")) throw new UnsupportedOperationException("Can only use setIntData from a setXYZ method");