diff --git a/sponge/pom.xml b/sponge/pom.xml
index 673aa052..87d4b0b8 100644
--- a/sponge/pom.xml
+++ b/sponge/pom.xml
@@ -70,38 +70,17 @@
- de.icongmbh.oss.maven.plugins
- javassist-maven-plugin
- 1.1.0
-
- false
-
-
- me.lucko.luckperms.sponge.utils.VersionUtil
-
-
- version
- ${release.version}.${git.closest.tag.commit.count}
-
-
-
-
-
+ org.codehaus.mojo
+ templating-maven-plugin
+ 1.0.0
- process-classes
+ filter-src
- javassist
+ filter-sources
-
-
- me.lucko.luckperms
- luckperms-sponge
- ${project.version}
-
-
pl.project13.maven
diff --git a/sponge/src/main/java-templates/me/lucko/luckperms/sponge/utils/VersionData.java b/sponge/src/main/java-templates/me/lucko/luckperms/sponge/utils/VersionData.java
new file mode 100644
index 00000000..ea298f00
--- /dev/null
+++ b/sponge/src/main/java-templates/me/lucko/luckperms/sponge/utils/VersionData.java
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2016 Lucko (Luck)
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+package me.lucko.luckperms.sponge.utils;
+
+public class VersionData {
+
+ public static final String VERSION = "${release.version}.${git.closest.tag.commit.count}";
+
+}
diff --git a/sponge/src/main/java/me/lucko/luckperms/sponge/LPSpongePlugin.java b/sponge/src/main/java/me/lucko/luckperms/sponge/LPSpongePlugin.java
index 65095fac..58d793b7 100644
--- a/sponge/src/main/java/me/lucko/luckperms/sponge/LPSpongePlugin.java
+++ b/sponge/src/main/java/me/lucko/luckperms/sponge/LPSpongePlugin.java
@@ -50,6 +50,7 @@ import me.lucko.luckperms.common.utils.LocaleManager;
import me.lucko.luckperms.common.utils.LogFactory;
import me.lucko.luckperms.sponge.contexts.WorldCalculator;
import me.lucko.luckperms.sponge.service.LuckPermsService;
+import me.lucko.luckperms.sponge.utils.VersionData;
import org.slf4j.Logger;
import org.spongepowered.api.Game;
import org.spongepowered.api.Sponge;
@@ -75,7 +76,7 @@ import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
@Getter
-@Plugin(id = "luckperms", name = "LuckPerms", version = "null", authors = {"Luck"}, description = "A permissions plugin")
+@Plugin(id = "luckperms", name = "LuckPerms", version = VersionData.VERSION, authors = {"Luck"}, description = "A permissions plugin")
public class LPSpongePlugin implements LuckPermsPlugin {
@Inject
@@ -219,7 +220,7 @@ public class LPSpongePlugin implements LuckPermsPlugin {
@Override
public String getVersion() {
- return "null";
+ return VersionData.VERSION;
}
@Override
diff --git a/sponge/src/main/java/me/lucko/luckperms/sponge/utils/VersionUtil.java b/sponge/src/main/java/me/lucko/luckperms/sponge/utils/VersionUtil.java
deleted file mode 100644
index 7941c277..00000000
--- a/sponge/src/main/java/me/lucko/luckperms/sponge/utils/VersionUtil.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Copyright (c) 2016 Lucko (Luck)
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-package me.lucko.luckperms.sponge.utils;
-
-import de.icongmbh.oss.maven.plugin.javassist.ClassTransformer;
-import javassist.*;
-import javassist.bytecode.AnnotationsAttribute;
-import javassist.bytecode.annotation.Annotation;
-import javassist.bytecode.annotation.StringMemberValue;
-import me.lucko.luckperms.sponge.LPSpongePlugin;
-
-import java.util.Properties;
-
-/**
- * Sets the version value of the plugin.
- * Most of the code in this class was taken from:
- * https://github.com/icon-Systemhaus-GmbH/javassist-maven-plugin/blob/master/README.textile
- */
-public class VersionUtil extends ClassTransformer {
- private String version = null;
-
- @Override
- protected boolean shouldTransform(CtClass clazz) throws NotFoundException {
- CtClass pluginClass = ClassPool.getDefault().get(LPSpongePlugin.class.getName());
- return !clazz.equals(pluginClass) && clazz.subtypeOf(pluginClass);
- }
-
- @Override
- protected void applyTransformations(CtClass clazz) throws Exception {
- AnnotationsAttribute attribute = (AnnotationsAttribute) clazz.getClassFile().getAttribute(AnnotationsAttribute.visibleTag);
- Annotation annotation = attribute.getAnnotation("org.spongepowered.api.plugin.Plugin");
- StringMemberValue versionValue = (StringMemberValue) annotation.getMemberValue("version");
- versionValue.setValue(version);
- attribute.setAnnotation(annotation);
-
- CtMethod getVersionMethod = clazz.getDeclaredMethod("getVersion");
- CtMethod hackedVersionMethod = CtNewMethod.make("public String getVersion() { return \"" + version + "\"; }", clazz);
- clazz.removeMethod(getVersionMethod);
- clazz.addMethod(hackedVersionMethod);
- }
-
- @Override
- public void configure(Properties properties) {
- assert properties != null;
- version = properties.getProperty("version");
- }
-}
\ No newline at end of file