diff options
Diffstat (limited to 'spark-forge')
4 files changed, 69 insertions, 8 deletions
diff --git a/spark-forge/src/main/java/me/lucko/spark/forge/ForgePlatformInfo.java b/spark-forge/src/main/java/me/lucko/spark/forge/ForgePlatformInfo.java new file mode 100644 index 0000000..0544072 --- /dev/null +++ b/spark-forge/src/main/java/me/lucko/spark/forge/ForgePlatformInfo.java @@ -0,0 +1,54 @@ +/* + * This file is part of spark. + * + * Copyright (c) lucko (Luck) <luck@lucko.me> + * Copyright (c) contributors + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +package me.lucko.spark.forge; + +import me.lucko.spark.common.PlatformInfo; +import net.minecraftforge.versions.forge.ForgeVersion; +import net.minecraftforge.versions.mcp.MCPVersion; + +public class ForgePlatformInfo implements PlatformInfo { + + private final Type type; + + public ForgePlatformInfo(Type type) { + this.type = type; + } + + @Override + public Type getType() { + return type; + } + + @Override + public String getName() { + return "Forge"; + } + + @Override + public String getVersion() { + return ForgeVersion.getVersion(); + } + + @Override + public String getMinecraftVersion() { + return MCPVersion.getMCVersion(); + } +} diff --git a/spark-forge/src/main/java/me/lucko/spark/forge/plugin/ForgeClientSparkPlugin.java b/spark-forge/src/main/java/me/lucko/spark/forge/plugin/ForgeClientSparkPlugin.java index 070c28a..278e838 100644 --- a/spark-forge/src/main/java/me/lucko/spark/forge/plugin/ForgeClientSparkPlugin.java +++ b/spark-forge/src/main/java/me/lucko/spark/forge/plugin/ForgeClientSparkPlugin.java @@ -27,12 +27,10 @@ import com.mojang.brigadier.exceptions.CommandSyntaxException; import com.mojang.brigadier.suggestion.SuggestionProvider; import com.mojang.brigadier.suggestion.Suggestions; import com.mojang.brigadier.suggestion.SuggestionsBuilder; +import me.lucko.spark.common.PlatformInfo; import me.lucko.spark.common.sampler.tick.TickHook; import me.lucko.spark.common.sampler.tick.TickReporter; -import me.lucko.spark.forge.ForgeCommandSender; -import me.lucko.spark.forge.ForgeSparkMod; -import me.lucko.spark.forge.ForgeTickHook; -import me.lucko.spark.forge.ForgeTickReporter; +import me.lucko.spark.forge.*; import net.minecraft.client.Minecraft; import net.minecraft.client.network.play.ClientPlayNetHandler; import net.minecraft.command.ICommandSource; @@ -144,6 +142,11 @@ public class ForgeClientSparkPlugin extends ForgeSparkPlugin implements Suggesti } @Override + public PlatformInfo getPlatformInfo() { + return new ForgePlatformInfo(PlatformInfo.Type.CLIENT); + } + + @Override public String getCommandName() { return "sparkc"; } diff --git a/spark-forge/src/main/java/me/lucko/spark/forge/plugin/ForgeServerSparkPlugin.java b/spark-forge/src/main/java/me/lucko/spark/forge/plugin/ForgeServerSparkPlugin.java index 4051d24..c433c95 100644 --- a/spark-forge/src/main/java/me/lucko/spark/forge/plugin/ForgeServerSparkPlugin.java +++ b/spark-forge/src/main/java/me/lucko/spark/forge/plugin/ForgeServerSparkPlugin.java @@ -27,12 +27,10 @@ import com.mojang.brigadier.exceptions.CommandSyntaxException; import com.mojang.brigadier.suggestion.SuggestionProvider; import com.mojang.brigadier.suggestion.Suggestions; import com.mojang.brigadier.suggestion.SuggestionsBuilder; +import me.lucko.spark.common.PlatformInfo; import me.lucko.spark.common.sampler.tick.TickHook; import me.lucko.spark.common.sampler.tick.TickReporter; -import me.lucko.spark.forge.ForgeCommandSender; -import me.lucko.spark.forge.ForgeSparkMod; -import me.lucko.spark.forge.ForgeTickHook; -import me.lucko.spark.forge.ForgeTickReporter; +import me.lucko.spark.forge.*; import net.minecraft.command.CommandSource; import net.minecraft.command.ICommandSource; import net.minecraft.entity.player.PlayerEntity; @@ -127,6 +125,11 @@ public class ForgeServerSparkPlugin extends ForgeSparkPlugin implements Command< } @Override + public PlatformInfo getPlatformInfo() { + return new ForgePlatformInfo(PlatformInfo.Type.SERVER); + } + + @Override public String getCommandName() { return "spark"; } diff --git a/spark-forge/src/main/java/me/lucko/spark/forge/plugin/ForgeSparkPlugin.java b/spark-forge/src/main/java/me/lucko/spark/forge/plugin/ForgeSparkPlugin.java index 0f0ce11..920ca24 100644 --- a/spark-forge/src/main/java/me/lucko/spark/forge/plugin/ForgeSparkPlugin.java +++ b/spark-forge/src/main/java/me/lucko/spark/forge/plugin/ForgeSparkPlugin.java @@ -93,4 +93,5 @@ public abstract class ForgeSparkPlugin implements SparkPlugin { public ThreadDumper getDefaultThreadDumper() { return new ThreadDumper.Specific(new long[]{Thread.currentThread().getId()}); } + } |