Skip to content
This repository has been archived by the owner on Jan 23, 2022. It is now read-only.

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Gerrygames committed Jan 28, 2018
1 parent 4d5ffc7 commit b711268
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 25 deletions.
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>de.gerrygames</groupId>
<artifactId>ClientViaVersion</artifactId>
<version>2.0-beta6</version>
<version>2.0-beta7</version>

<profiles>
<profile>
Expand Down Expand Up @@ -64,7 +64,7 @@
<dependency>
<groupId>de.gerrygames</groupId>
<artifactId>viarewind-all</artifactId>
<version>1.0.13</version>
<version>1.0.14</version>
<scope>compile</scope>
</dependency>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package de.gerrygames.the5zig.clientviaversion.viaversion;

import de.gerrygames.the5zig.clientviaversion.main.ClientViaVersion;
import eu.the5zig.mod.The5zigMod;
import us.myles.ViaVersion.api.PacketWrapper;
import us.myles.ViaVersion.api.boss.BossColor;
import us.myles.ViaVersion.api.boss.BossFlag;
import us.myles.ViaVersion.api.boss.BossStyle;
import us.myles.ViaVersion.api.type.Type;
import us.myles.ViaVersion.protocols.base.ProtocolInfo;
import us.myles.ViaVersion.protocols.protocol1_9to1_8.Protocol1_9TO1_8;

import java.util.*;
Expand Down Expand Up @@ -42,7 +42,7 @@ public String getTitle() {
@Override
public us.myles.ViaVersion.api.boss.BossBar setTitle(String title) {
this.title = title;
if (this.visible && this.players.contains(The5zigMod.getVars().getGameProfile().getId())) {
if (this.visible && this.players.contains(ClientViaVersion.user.get(ProtocolInfo.class).getUuid())) {
PacketWrapper wrapper = new PacketWrapper(0x0C, null, ClientViaVersion.user);
wrapper.write(Type.UUID, this.uuid);
wrapper.write(Type.VAR_INT, 3);
Expand All @@ -62,7 +62,7 @@ public float getHealth() {
@Override
public us.myles.ViaVersion.api.boss.BossBar setHealth(float health) {
this.health = health;
if (this.visible && this.players.contains(The5zigMod.getVars().getGameProfile().getId())) {
if (this.visible && this.players.contains(ClientViaVersion.user.get(ProtocolInfo.class).getUuid())) {
PacketWrapper wrapper = new PacketWrapper(0x0C, null, ClientViaVersion.user);
wrapper.write(Type.UUID, this.uuid);
wrapper.write(Type.VAR_INT, 2);
Expand All @@ -82,7 +82,7 @@ public BossColor getColor() {
@Override
public us.myles.ViaVersion.api.boss.BossBar setColor(BossColor bossColor) {
this.bossColor = bossColor;
if (this.visible && this.players.contains(The5zigMod.getVars().getGameProfile().getId())) {
if (this.visible && this.players.contains(ClientViaVersion.user.get(ProtocolInfo.class).getUuid())) {
PacketWrapper wrapper = new PacketWrapper(0x0C, null, ClientViaVersion.user);
wrapper.write(Type.UUID, this.uuid);
wrapper.write(Type.VAR_INT, 4);
Expand All @@ -103,7 +103,7 @@ public BossStyle getStyle() {
@Override
public us.myles.ViaVersion.api.boss.BossBar setStyle(BossStyle bossStyle) {
this.bossStyle = bossStyle;
if (this.visible && this.players.contains(The5zigMod.getVars().getGameProfile().getId())) {
if (this.visible && this.players.contains(ClientViaVersion.user.get(ProtocolInfo.class).getUuid())) {
PacketWrapper wrapper = new PacketWrapper(0x0C, null, ClientViaVersion.user);
wrapper.write(Type.UUID, this.uuid);
wrapper.write(Type.VAR_INT, 4);
Expand All @@ -119,7 +119,7 @@ public us.myles.ViaVersion.api.boss.BossBar setStyle(BossStyle bossStyle) {
@Override
public us.myles.ViaVersion.api.boss.BossBar addPlayer(UUID uuid) {
this.players.add(uuid);
if (visible && uuid.equals(The5zigMod.getVars().getGameProfile().getId())) {
if (visible && uuid.equals(ClientViaVersion.user.get(ProtocolInfo.class).getUuid())) {
PacketWrapper wrapper = new PacketWrapper(0x0C, null, ClientViaVersion.user);
wrapper.write(Type.UUID, this.uuid);
wrapper.write(Type.VAR_INT, 0);
Expand All @@ -140,7 +140,7 @@ public us.myles.ViaVersion.api.boss.BossBar addPlayer(UUID uuid) {
@Override
public us.myles.ViaVersion.api.boss.BossBar removePlayer(UUID uuid) {
this.players.remove(uuid);
if (visible && uuid.equals(The5zigMod.getVars().getGameProfile().getId())) {
if (visible && uuid.equals(ClientViaVersion.user.get(ProtocolInfo.class).getUuid())) {
PacketWrapper wrapper = new PacketWrapper(0x0C, null, ClientViaVersion.user);
wrapper.write(Type.UUID, this.uuid);
wrapper.write(Type.VAR_INT, 1);
Expand All @@ -166,7 +166,7 @@ public us.myles.ViaVersion.api.boss.BossBar removeFlag(BossFlag bossFlag) {
}

private void updateFlags() {
if (this.visible && this.players.contains(The5zigMod.getVars().getGameProfile().getId())) {
if (this.visible && this.players.contains(ClientViaVersion.user.get(ProtocolInfo.class).getUuid())) {
PacketWrapper wrapper = new PacketWrapper(0x0C, null, ClientViaVersion.user);
wrapper.write(Type.UUID, this.uuid);
wrapper.write(Type.VAR_INT, 5);
Expand All @@ -193,7 +193,7 @@ public Set<UUID> getPlayers() {
public us.myles.ViaVersion.api.boss.BossBar show() {
if (visible) return this;
this.visible = true;
if (this.players.contains(The5zigMod.getVars().getGameProfile().getId())) {
if (this.players.contains(ClientViaVersion.user.get(ProtocolInfo.class).getUuid())) {
PacketWrapper wrapper = new PacketWrapper(0x0C, null, ClientViaVersion.user);
wrapper.write(Type.UUID, this.uuid);
wrapper.write(Type.VAR_INT, 0);
Expand All @@ -215,7 +215,7 @@ public us.myles.ViaVersion.api.boss.BossBar show() {
public us.myles.ViaVersion.api.boss.BossBar hide() {
if (!visible) return this;
this.visible = false;
if (this.players.contains(The5zigMod.getVars().getGameProfile().getId())) {
if (this.players.contains(ClientViaVersion.user.get(ProtocolInfo.class).getUuid())) {
PacketWrapper wrapper = new PacketWrapper(0x0C, null, ClientViaVersion.user);
wrapper.write(Type.UUID, this.uuid);
wrapper.write(Type.VAR_INT, 1);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
package de.gerrygames.the5zig.clientviaversion.viaversion;

import eu.the5zig.mod.The5zigMod;
import io.netty.buffer.ByteBuf;
import de.gerrygames.the5zig.clientviaversion.main.ClientViaVersion;
import us.myles.ViaVersion.api.Via;
import us.myles.ViaVersion.api.ViaAPI;
import us.myles.ViaVersion.api.boss.BossBar;
import us.myles.ViaVersion.api.boss.BossColor;
import us.myles.ViaVersion.api.boss.BossStyle;
import us.myles.ViaVersion.protocols.base.ProtocolInfo;

import java.util.SortedSet;
import java.util.UUID;

public class CustomViaAPI implements ViaAPI {
@Override
public int getPlayerVersion(Object o) {
return -1;
throw new UnsupportedOperationException();
}

@Override
public int getPlayerVersion(UUID uuid) {
return uuid.equals(The5zigMod.getVars().getGameProfile().getId()) ? ClientViaVersion.CLIENT_PROTOCOL_VERSION : ClientViaVersion.spoofedVersion;
throw new UnsupportedOperationException();
}

@Override
Expand All @@ -30,15 +30,15 @@ public boolean isPorted(UUID uuid) {

@Override
public String getVersion() {
return ClientViaVersion.selected.getName();
return "unknown";
}

@Override
public void sendRawPacket(Object o, ByteBuf byteBuf) throws IllegalArgumentException {}

@Override
public void sendRawPacket(UUID uuid, ByteBuf byteBuf) throws IllegalArgumentException {
if (uuid.equals(The5zigMod.getVars().getGameProfile().getId())) {
if (uuid.equals(ClientViaVersion.user.get(ProtocolInfo.class).getUuid())) {
ClientViaVersion.user.sendRawPacket(byteBuf);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

import de.gerrygames.the5zig.clientviaversion.Version;
import de.gerrygames.the5zig.clientviaversion.utils.Scheduler;
import eu.the5zig.mod.The5zigAPI;
import eu.the5zig.mod.The5zigMod;
import us.myles.ViaVersion.api.ViaAPI;
import us.myles.ViaVersion.api.ViaVersionConfig;
import us.myles.ViaVersion.api.command.ViaCommandSender;
Expand Down Expand Up @@ -31,12 +29,12 @@ public String getPlatformName() {

@Override
public String getPlatformVersion() {
return The5zigAPI.getAPI().getMinecraftVersion();
return Version.PLUGIN_VERSION;
}

@Override
public String getPluginVersion() {
return Version.PLUGIN_VERSION;
return "unknown";
}

@Override
Expand Down Expand Up @@ -89,9 +87,7 @@ public ViaCommandSender[] getOnlinePlayers() {

@Override
public void sendMessage(UUID uuid, String msg) {
if (uuid.equals(The5zigMod.getVars().getGameProfile().getId())) {
The5zigMod.getVars().messagePlayer(msg);
}
throw new UnsupportedOperationException();
}

@Override
Expand Down Expand Up @@ -129,6 +125,6 @@ public JsonObject getDump() {

@Override
public boolean isOldClientsAllowed() {
return false;
return true;
}
}

0 comments on commit b711268

Please sign in to comment.