Version, fix command

This commit is contained in:
creeper123123321 2019-01-06 17:11:08 -02:00
parent 2d62af18d3
commit 05e58f65eb
No known key found for this signature in database
GPG Key ID: 0AC57D54786721D1
5 changed files with 16 additions and 7 deletions

View File

@ -1,3 +1,5 @@
import org.apache.tools.ant.filters.*
plugins { plugins {
id 'java' id 'java'
id 'net.minecrell.licenser' version '0.4.1' id 'net.minecrell.licenser' version '0.4.1'
@ -21,6 +23,12 @@ repositories {
maven { url 'https://maven.fabricmc.net/' } maven { url 'https://maven.fabricmc.net/' }
} }
processResources {
filter ReplaceTokens, tokens: [
"version": project.property("version")
]
}
configurations { configurations {
shade shade
compile.extendsFrom shade compile.extendsFrom shade

View File

@ -29,12 +29,9 @@ import com.github.creeper123123321.viafabric.util.VersionFormatFilter;
import net.minecraft.client.gui.Gui; import net.minecraft.client.gui.Gui;
import net.minecraft.client.gui.GuiEventListener; import net.minecraft.client.gui.GuiEventListener;
import net.minecraft.client.gui.menu.MultiplayerGui; import net.minecraft.client.gui.menu.MultiplayerGui;
import net.minecraft.client.gui.widget.ServerListWidget;
import net.minecraft.client.gui.widget.TextFieldWidget; import net.minecraft.client.gui.widget.TextFieldWidget;
import net.minecraft.client.resource.language.I18n; import net.minecraft.client.resource.language.I18n;
import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@ -44,7 +41,6 @@ import us.myles.ViaVersion.api.protocol.ProtocolVersion;
@Mixin(MultiplayerGui.class) @Mixin(MultiplayerGui.class)
public abstract class MixinMultiplayerGui extends Gui { public abstract class MixinMultiplayerGui extends Gui {
@Shadow private ServerListWidget field_3043;
private TextFieldWidget protocolVersion; private TextFieldWidget protocolVersion;
@Inject(method = "onInitialized", at = @At("TAIL")) @Inject(method = "onInitialized", at = @At("TAIL"))

View File

@ -28,6 +28,7 @@ import com.github.creeper123123321.viafabric.ViaFabric;
import com.github.creeper123123321.viafabric.protocol.Interceptor; import com.github.creeper123123321.viafabric.protocol.Interceptor;
import com.github.creeper123123321.viafabric.util.FutureTaskId; import com.github.creeper123123321.viafabric.util.FutureTaskId;
import com.github.creeper123123321.viafabric.util.ManagedBlockerRunnable; import com.github.creeper123123321.viafabric.util.ManagedBlockerRunnable;
import net.fabricmc.loader.FabricLoader;
import us.myles.ViaVersion.api.PacketWrapper; import us.myles.ViaVersion.api.PacketWrapper;
import us.myles.ViaVersion.api.Via; import us.myles.ViaVersion.api.Via;
import us.myles.ViaVersion.api.ViaAPI; import us.myles.ViaVersion.api.ViaAPI;
@ -66,7 +67,11 @@ public class VRPlatform implements ViaPlatform {
@Override @Override
public String getPlatformVersion() { public String getPlatformVersion() {
return "?"; // TODO return FabricLoader.INSTANCE.getModContainers()
.stream()
.filter(container -> container.getInfo().getId().equals("viafabric"))
.findFirst()
.get().getInfo().getVersionString(); // TODO
} }
@Override @Override

View File

@ -51,7 +51,7 @@ public class Interceptor extends Protocol {
if (msg.startsWith("/viafabric")) { if (msg.startsWith("/viafabric")) {
Via.getManager().getCommandHandler().onCommand( Via.getManager().getCommandHandler().onCommand(
new VRCommandSender(info.getUuid(), info.getUsername()), new VRCommandSender(info.getUuid(), info.getUsername()),
msg.length() == 10 ? new String[0] : msg.substring(9).split(" ", -1) msg.length() == 10 ? new String[0] : msg.substring(11).split(" ", -1)
); );
packetWrapper.cancel(); packetWrapper.cancel();
} }

View File

@ -2,7 +2,7 @@
"id": "viafabric", "id": "viafabric",
"name": "ViaFabric", "name": "ViaFabric",
"side": "client", "side": "client",
"version": "?", "version": "@version@",
"initializers": [ "initializers": [
"com.github.creeper123123321.viafabric.ViaFabric" "com.github.creeper123123321.viafabric.ViaFabric"
], ],