Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e3c1b9bf64 | ||
|
|
a52552dcb4 | ||
|
|
e8039e158f | ||
|
|
c37ef71f72 | ||
|
|
0388f340cc | ||
|
|
5e437d26d9 | ||
|
|
c10c3547b9 | ||
|
|
528a8e5587 | ||
|
|
ea4487e33f |
No files matched your search
+1
-1
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>viaversion-parent</artifactId>
|
||||
<groupId>us.myles</groupId>
|
||||
<version>1.0.3</version>
|
||||
<version>1.0.4</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -253,4 +253,9 @@ public class ViaVersionPlugin extends JavaPlugin implements ViaPlatform {
|
||||
|
||||
return platformSpecific;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOldClientsAllowed() {
|
||||
return !protocolSupport; // Use protocolsupport for older clients
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>viaversion-parent</artifactId>
|
||||
<groupId>us.myles</groupId>
|
||||
<version>1.0.3</version>
|
||||
<version>1.0.4</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
<dependency>
|
||||
<groupId>us.myles</groupId>
|
||||
<artifactId>viaversion-common</artifactId>
|
||||
<version>1.0.3</version>
|
||||
<version>1.0.4</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
@@ -155,6 +155,11 @@ public class BungeePlugin extends Plugin implements ViaPlatform, Listener {
|
||||
return platformSpecific;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOldClientsAllowed() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onQuit(PlayerDisconnectEvent e) {
|
||||
Via.getManager().removePortedClient(e.getPlayer().getUniqueId());
|
||||
|
||||
@@ -9,11 +9,13 @@ import us.myles.ViaVersion.bungee.handlers.BungeeServerHandler;
|
||||
import us.myles.ViaVersion.bungee.listeners.ElytraPatch;
|
||||
import us.myles.ViaVersion.bungee.listeners.MainHandPatch;
|
||||
import us.myles.ViaVersion.bungee.listeners.UpdateListener;
|
||||
import us.myles.ViaVersion.bungee.providers.BungeeBossBarProvider;
|
||||
import us.myles.ViaVersion.bungee.providers.BungeeEntityIdProvider;
|
||||
import us.myles.ViaVersion.bungee.providers.BungeeMovementTransmitter;
|
||||
import us.myles.ViaVersion.bungee.providers.BungeeVersionProvider;
|
||||
import us.myles.ViaVersion.bungee.service.ProtocolDetectorService;
|
||||
import us.myles.ViaVersion.protocols.base.VersionProvider;
|
||||
import us.myles.ViaVersion.protocols.protocol1_9to1_8.providers.BossBarProvider;
|
||||
import us.myles.ViaVersion.protocols.protocol1_9to1_8.providers.EntityIdProvider;
|
||||
import us.myles.ViaVersion.protocols.protocol1_9to1_8.providers.MovementTransmitterProvider;
|
||||
|
||||
@@ -36,6 +38,8 @@ public class BungeeViaLoader implements ViaPlatformLoader {
|
||||
Via.getManager().getProviders().use(MovementTransmitterProvider.class, new BungeeMovementTransmitter());
|
||||
Via.getManager().getProviders().use(VersionProvider.class, new BungeeVersionProvider());
|
||||
Via.getManager().getProviders().use(EntityIdProvider.class, new BungeeEntityIdProvider());
|
||||
Via.getManager().getProviders().use(BossBarProvider.class, new BungeeBossBarProvider());
|
||||
|
||||
if (plugin.getConf().getBungeePingInterval() > 0) {
|
||||
plugin.getProxy().getScheduler().schedule(plugin, new ProtocolDetectorService(plugin), 0, plugin.getConf().getBungeePingInterval(), TimeUnit.SECONDS);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
package us.myles.ViaVersion.bungee.providers;
|
||||
|
||||
import us.myles.ViaVersion.api.data.UserConnection;
|
||||
import us.myles.ViaVersion.bungee.storage.BungeeStorage;
|
||||
import us.myles.ViaVersion.protocols.protocol1_9to1_8.providers.BossBarProvider;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public class BungeeBossBarProvider extends BossBarProvider {
|
||||
@Override
|
||||
public void handleAdd(UserConnection user, UUID barUUID) {
|
||||
if (user.has(BungeeStorage.class)) {
|
||||
BungeeStorage storage = user.get(BungeeStorage.class);
|
||||
// Check if bossbars are supported by bungee, static maybe
|
||||
if (storage.getBossbar() != null) {
|
||||
storage.getBossbar().add(barUUID);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleRemove(UserConnection user, UUID barUUID) {
|
||||
if (user.has(BungeeStorage.class)) {
|
||||
BungeeStorage storage = user.get(BungeeStorage.class);
|
||||
if (storage.getBossbar() != null) {
|
||||
storage.getBossbar().remove(barUUID);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,15 +6,43 @@ import net.md_5.bungee.api.connection.ProxiedPlayer;
|
||||
import us.myles.ViaVersion.api.data.StoredObject;
|
||||
import us.myles.ViaVersion.api.data.UserConnection;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class BungeeStorage extends StoredObject {
|
||||
private static Field bossField;
|
||||
|
||||
static {
|
||||
try {
|
||||
Class<?> user = Class.forName("net.md_5.bungee.UserConnection");
|
||||
bossField = user.getDeclaredField("sentBossBars");
|
||||
bossField.setAccessible(true);
|
||||
} catch (ClassNotFoundException e) {
|
||||
// Not supported *shrug* probably modified
|
||||
} catch (NoSuchFieldException e) {
|
||||
// Not supported, old version probably
|
||||
}
|
||||
}
|
||||
|
||||
private ProxiedPlayer player;
|
||||
private String currentServer;
|
||||
private Set<UUID> bossbar;
|
||||
|
||||
public BungeeStorage(UserConnection user, ProxiedPlayer player) {
|
||||
super(user);
|
||||
this.player = player;
|
||||
this.currentServer = "";
|
||||
|
||||
// Get bossbar list if it's supported
|
||||
if (bossField != null) {
|
||||
try {
|
||||
bossbar = (Set<UUID>) bossField.get(player);
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
-2
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>viaversion-parent</artifactId>
|
||||
<groupId>us.myles</groupId>
|
||||
<version>1.0.3</version>
|
||||
<version>1.0.4</version>
|
||||
</parent>
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
@@ -13,7 +13,6 @@
|
||||
<artifactId>viaversion-common</artifactId>
|
||||
<dependencies>
|
||||
<!-- Snake YAML -->
|
||||
|
||||
<dependency>
|
||||
<groupId>org.yaml</groupId>
|
||||
<artifactId>snakeyaml</artifactId>
|
||||
|
||||
@@ -167,4 +167,11 @@ public abstract class BossBar<T> {
|
||||
* @return visibility changable with show() and hide()
|
||||
*/
|
||||
public abstract boolean isVisible();
|
||||
|
||||
/**
|
||||
* Get the UUID of this bossbar
|
||||
*
|
||||
* @return Unique Id for this bossbar
|
||||
*/
|
||||
public abstract UUID getId();
|
||||
}
|
||||
@@ -140,4 +140,12 @@ public interface ViaPlatform<T> {
|
||||
* @return The json data
|
||||
*/
|
||||
JsonObject getDump();
|
||||
|
||||
/**
|
||||
* Get if older clients are allowed to be used using ViaVersion.
|
||||
* (Only 1.9 on 1.9.2 server is supported by ViaVersion alone)
|
||||
*
|
||||
* @return True if allowed
|
||||
*/
|
||||
boolean isOldClientsAllowed();
|
||||
}
|
||||
@@ -8,7 +8,9 @@ import org.spacehq.opennbt.NBTIO;
|
||||
import org.spacehq.opennbt.tag.builtin.CompoundTag;
|
||||
import us.myles.ViaVersion.api.type.Type;
|
||||
|
||||
import java.io.DataInput;
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutput;
|
||||
import java.io.DataOutputStream;
|
||||
|
||||
public class NBTType extends Type<CompoundTag> {
|
||||
@@ -28,7 +30,7 @@ public class NBTType extends Type<CompoundTag> {
|
||||
buffer.readerIndex(readerIndex);
|
||||
ByteBufInputStream bytebufStream = new ByteBufInputStream(buffer);
|
||||
try (DataInputStream dataInputStream = new DataInputStream(bytebufStream)) {
|
||||
return (CompoundTag) NBTIO.readTag(dataInputStream);
|
||||
return (CompoundTag) NBTIO.readTag((DataInput) dataInputStream);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -41,7 +43,7 @@ public class NBTType extends Type<CompoundTag> {
|
||||
ByteBufOutputStream bytebufStream = new ByteBufOutputStream(buffer);
|
||||
DataOutputStream dataOutputStream = new DataOutputStream(bytebufStream);
|
||||
|
||||
NBTIO.writeTag(dataOutputStream, object);
|
||||
NBTIO.writeTag((DataOutput) dataOutputStream, object);
|
||||
|
||||
dataOutputStream.close();
|
||||
}
|
||||
|
||||
@@ -138,6 +138,11 @@ public abstract class CommonBoss<T> extends BossBar<T> {
|
||||
return visible;
|
||||
}
|
||||
|
||||
@Override
|
||||
public UUID getId() {
|
||||
return uuid;
|
||||
}
|
||||
|
||||
private void setVisible(boolean value) {
|
||||
if (visible != value) {
|
||||
visible = value;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package us.myles.ViaVersion.commands.defaultsubs;
|
||||
|
||||
import com.google.common.io.CharStreams;
|
||||
import com.google.gson.JsonObject;
|
||||
import net.md_5.bungee.api.ChatColor;
|
||||
import us.myles.ViaVersion.api.Via;
|
||||
@@ -10,6 +11,7 @@ import us.myles.ViaVersion.dump.DumpTemplate;
|
||||
import us.myles.ViaVersion.dump.VersionInfo;
|
||||
import us.myles.ViaVersion.util.GsonUtil;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.InvalidObjectException;
|
||||
import java.io.OutputStream;
|
||||
@@ -50,35 +52,66 @@ public class DumpSubCmd extends ViaSubCommand {
|
||||
Via.getPlatform().runAsync(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
HttpURLConnection con = (HttpURLConnection) new URL("http://hastebin.com/documents").openConnection();
|
||||
|
||||
con.setRequestProperty("Content-Type", "text/plain");
|
||||
HttpURLConnection con;
|
||||
try {
|
||||
con = (HttpURLConnection) new URL("https://api.github.com/gists").openConnection();
|
||||
} catch (IOException e) {
|
||||
sender.sendMessage(ChatColor.RED + "Failed to dump, please check the console for more information");
|
||||
Via.getPlatform().getLogger().log(Level.WARNING, "Could not paste ViaVersion dump to Gist", e);
|
||||
return;
|
||||
}
|
||||
try {
|
||||
con.setRequestProperty("Content-Type", "application/json");
|
||||
con.addRequestProperty("User-Agent", "ViaVersion");
|
||||
con.setRequestMethod("POST");
|
||||
con.setDoOutput(true);
|
||||
|
||||
OutputStream out = con.getOutputStream();
|
||||
out.write(GsonUtil.getGsonBuilder().setPrettyPrinting().create().toJson(template).getBytes(Charset.forName("UTF-8")));
|
||||
String contents = GsonUtil.getGsonBuilder().setPrettyPrinting().create().toJson(template);
|
||||
// Create payload
|
||||
JsonObject payload = new JsonObject();
|
||||
payload.addProperty("description", "ViaVersion Dump");
|
||||
payload.addProperty("public", "false");
|
||||
// Create file contents
|
||||
JsonObject file = new JsonObject();
|
||||
file.addProperty("content", contents);
|
||||
// Create file list
|
||||
JsonObject files = new JsonObject();
|
||||
files.add("dump.json", file);
|
||||
payload.add("files", files);
|
||||
// Write to stream
|
||||
out.write(GsonUtil.getGson().toJson(payload).getBytes(Charset.forName("UTF-8")));
|
||||
out.close();
|
||||
|
||||
JsonObject output = GsonUtil.getGson().fromJson(new InputStreamReader(con.getInputStream()), JsonObject.class);
|
||||
String rawOutput = CharStreams.toString(new InputStreamReader(con.getInputStream()));
|
||||
con.getInputStream().close();
|
||||
JsonObject output = GsonUtil.getGson().fromJson(rawOutput, JsonObject.class);
|
||||
|
||||
if (!output.has("key"))
|
||||
throw new InvalidObjectException("Key is not given in Hastebin output");
|
||||
|
||||
sender.sendMessage(ChatColor.GREEN + "We've made a dump with useful information, report your issue and provide this url: " + getUrl(output.get("key").getAsString()));
|
||||
if (!output.has("html_url"))
|
||||
throw new InvalidObjectException("URL is not given in Gist output");
|
||||
|
||||
sender.sendMessage(ChatColor.GREEN + "We've made a dump with useful information, report your issue and provide this url: " + output.get("html_url").getAsString());
|
||||
} catch (Exception e) {
|
||||
sender.sendMessage(ChatColor.RED + "Failed to dump, please check the console for more information");
|
||||
Via.getPlatform().getLogger().log(Level.WARNING, "Could not paste ViaVersion dump to Hastebin", e);
|
||||
try {
|
||||
if (con.getResponseCode() == 403) {
|
||||
// Ensure 403 is due to rate limit being hit
|
||||
if("0".equals(con.getHeaderField("X-RateLimit-Remaining"))) {
|
||||
Via.getPlatform().getLogger().log(Level.WARNING, "You may only create 60 dumps per hour, please try again later.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
Via.getPlatform().getLogger().log(Level.WARNING, "Could not paste ViaVersion dump to Gist", e);
|
||||
|
||||
} catch (IOException e1) {
|
||||
Via.getPlatform().getLogger().log(Level.WARNING, "Failed to capture further info", e1);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private String getUrl(String id) {
|
||||
return String.format("http://hastebin.com/%s.json", id);
|
||||
}
|
||||
}
|
||||
@@ -72,7 +72,12 @@ public class BaseProtocol extends Protocol {
|
||||
ProtocolRegistry.SERVER_PROTOCOL = protocolVersion;
|
||||
|
||||
int protocol = Via.getManager().getProviders().get(VersionProvider.class).getServerProtocol(wrapper.user());
|
||||
List<Pair<Integer, Protocol>> protocols = ProtocolRegistry.getProtocolPath(info.getProtocolVersion(), protocol);
|
||||
List<Pair<Integer, Protocol>> protocols = null;
|
||||
|
||||
// Only allow newer clients or (1.9.2 on 1.9.4 server if the server supports it)
|
||||
if (info.getProtocolVersion() >= protocol || Via.getPlatform().isOldClientsAllowed()) {
|
||||
protocols = ProtocolRegistry.getProtocolPath(info.getProtocolVersion(), protocol);
|
||||
}
|
||||
|
||||
if (protocols != null) {
|
||||
if (protocolVersion != 9999) {
|
||||
@@ -163,7 +168,13 @@ public class BaseProtocol extends Protocol {
|
||||
info.setProtocolVersion(protVer);
|
||||
// Choose the pipe
|
||||
int protocol = Via.getManager().getProviders().get(VersionProvider.class).getServerProtocol(wrapper.user());
|
||||
List<Pair<Integer, Protocol>> protocols = ProtocolRegistry.getProtocolPath(info.getProtocolVersion(), protocol);
|
||||
List<Pair<Integer, Protocol>> protocols = null;
|
||||
|
||||
// Only allow newer clients or (1.9.2 on 1.9.4 server if the server supports it)
|
||||
if (info.getProtocolVersion() >= protocol || Via.getPlatform().isOldClientsAllowed()) {
|
||||
protocols = ProtocolRegistry.getProtocolPath(info.getProtocolVersion(), protocol);
|
||||
}
|
||||
|
||||
ProtocolPipeline pipeline = wrapper.user().get(ProtocolInfo.class).getPipeline();
|
||||
if (protocols != null) {
|
||||
for (Pair<Integer, Protocol> prot : protocols) {
|
||||
|
||||
+88
-6
@@ -1,16 +1,100 @@
|
||||
package us.myles.ViaVersion.protocols.protocol1_11to1_10;
|
||||
|
||||
import com.google.common.collect.BiMap;
|
||||
import com.google.common.collect.HashBiMap;
|
||||
import org.spacehq.opennbt.tag.builtin.CompoundTag;
|
||||
import org.spacehq.opennbt.tag.builtin.StringTag;
|
||||
import us.myles.ViaVersion.api.minecraft.item.Item;
|
||||
|
||||
public class ItemRewriter {
|
||||
private static BiMap<String, String> oldToNewNames = HashBiMap.create();
|
||||
|
||||
static {
|
||||
oldToNewNames.put("AreaEffectCloud", "minecraft:area_effect_cloud");
|
||||
oldToNewNames.put("ArmorStand", "minecraft:armor_stand");
|
||||
oldToNewNames.put("Arrow", "minecraft:arrow");
|
||||
oldToNewNames.put("Bat", "minecraft:bat");
|
||||
oldToNewNames.put("Blaze", "minecraft:blaze");
|
||||
oldToNewNames.put("Boat", "minecraft:boat");
|
||||
oldToNewNames.put("CaveSpider", "minecraft:cave_spider");
|
||||
oldToNewNames.put("Chicken", "minecraft:chicken");
|
||||
oldToNewNames.put("Cow", "minecraft:cow");
|
||||
oldToNewNames.put("Creeper", "minecraft:creeper");
|
||||
oldToNewNames.put("Donkey", "minecraft:donkey");
|
||||
oldToNewNames.put("DragonFireball", "minecraft:dragon_fireball");
|
||||
oldToNewNames.put("ElderGuardian", "minecraft:elder_guardian");
|
||||
oldToNewNames.put("EnderCrystal", "minecraft:ender_crystal");
|
||||
oldToNewNames.put("EnderDragon", "minecraft:ender_dragon");
|
||||
oldToNewNames.put("Enderman", "minecraft:enderman");
|
||||
oldToNewNames.put("Endermite", "minecraft:endermite");
|
||||
oldToNewNames.put("EntityHorse", "minecraft:horse");
|
||||
oldToNewNames.put("EyeOfEnderSignal", "minecraft:eye_of_ender_signal");
|
||||
oldToNewNames.put("FallingSand", "minecraft:falling_block");
|
||||
oldToNewNames.put("Fireball", "minecraft:fireball");
|
||||
oldToNewNames.put("FireworksRocketEntity", "minecraft:fireworks_rocket");
|
||||
oldToNewNames.put("Ghast", "minecraft:ghast");
|
||||
oldToNewNames.put("Giant", "minecraft:giant");
|
||||
oldToNewNames.put("Guardian", "minecraft:guardian");
|
||||
oldToNewNames.put("Husk", "minecraft:husk");
|
||||
oldToNewNames.put("Item", "minecraft:item");
|
||||
oldToNewNames.put("ItemFrame", "minecraft:item_frame");
|
||||
oldToNewNames.put("LavaSlime", "minecraft:magma_cube");
|
||||
oldToNewNames.put("LeashKnot", "minecraft:leash_knot");
|
||||
oldToNewNames.put("MinecartChest", "minecraft:chest_minecart");
|
||||
oldToNewNames.put("MinecartCommandBlock", "minecraft:commandblock_minecart");
|
||||
oldToNewNames.put("MinecartFurnace", "minecraft:furnace_minecart");
|
||||
oldToNewNames.put("MinecartHopper", "minecraft:hopper_minecart");
|
||||
oldToNewNames.put("MinecartRideable", "minecraft:minecart");
|
||||
oldToNewNames.put("MinecartSpawner", "minecraft:spawner_minecart");
|
||||
oldToNewNames.put("MinecartTNT", "minecraft:tnt_minecart");
|
||||
oldToNewNames.put("Mule", "minecraft:mule");
|
||||
oldToNewNames.put("MushroomCow", "minecraft:mooshroom");
|
||||
oldToNewNames.put("Ozelot", "minecraft:ocelot");
|
||||
oldToNewNames.put("Painting", "minecraft:painting");
|
||||
oldToNewNames.put("Pig", "minecraft:pig");
|
||||
oldToNewNames.put("PigZombie", "minecraft:zombie_pigman");
|
||||
oldToNewNames.put("PolarBear", "minecraft:polar_bear");
|
||||
oldToNewNames.put("PrimedTnt", "minecraft:tnt");
|
||||
oldToNewNames.put("Rabbit", "minecraft:rabbit");
|
||||
oldToNewNames.put("Sheep", "minecraft:sheep");
|
||||
oldToNewNames.put("Shulker", "minecraft:shulker");
|
||||
oldToNewNames.put("ShulkerBullet", "minecraft:shulker_bullet");
|
||||
oldToNewNames.put("Silverfish", "minecraft:silverfish");
|
||||
oldToNewNames.put("Skeleton", "minecraft:skeleton");
|
||||
oldToNewNames.put("SkeletonHorse", "minecraft:skeleton_horse");
|
||||
oldToNewNames.put("Slime", "minecraft:slime");
|
||||
oldToNewNames.put("SmallFireball", "minecraft:small_fireball");
|
||||
oldToNewNames.put("Snowball", "minecraft:snowball");
|
||||
oldToNewNames.put("SnowMan", "minecraft:snowman");
|
||||
oldToNewNames.put("SpectralArrow", "minecraft:spectral_arrow");
|
||||
oldToNewNames.put("Spider", "minecraft:spider");
|
||||
oldToNewNames.put("Squid", "minecraft:squid");
|
||||
oldToNewNames.put("Stray", "minecraft:stray");
|
||||
oldToNewNames.put("ThrownEgg", "minecraft:egg");
|
||||
oldToNewNames.put("ThrownEnderpearl", "minecraft:ender_pearl");
|
||||
oldToNewNames.put("ThrownExpBottle", "minecraft:xp_bottle");
|
||||
oldToNewNames.put("ThrownPotion", "minecraft:potion");
|
||||
oldToNewNames.put("Villager", "minecraft:villager");
|
||||
oldToNewNames.put("VillagerGolem", "minecraft:villager_golem");
|
||||
oldToNewNames.put("Witch", "minecraft:witch");
|
||||
oldToNewNames.put("WitherBoss", "minecraft:wither");
|
||||
oldToNewNames.put("WitherSkeleton", "minecraft:wither_skeleton");
|
||||
oldToNewNames.put("WitherSkull", "minecraft:wither_skull");
|
||||
oldToNewNames.put("Wolf", "minecraft:wolf");
|
||||
oldToNewNames.put("XPOrb", "minecraft:xp_orb");
|
||||
oldToNewNames.put("Zombie", "minecraft:zombie");
|
||||
oldToNewNames.put("ZombieHorse", "minecraft:zombie_horse");
|
||||
oldToNewNames.put("ZombieVillager", "minecraft:zombie_villager");
|
||||
}
|
||||
|
||||
public static void toClient(Item item) {
|
||||
if (hasEntityTag(item)) {
|
||||
CompoundTag entityTag = item.getTag().get("EntityTag");
|
||||
if (entityTag.get("id") instanceof StringTag) {
|
||||
StringTag id = entityTag.get("id");
|
||||
id.setValue("minecraft:" + id.getValue().toLowerCase());
|
||||
if (oldToNewNames.containsKey(id.getValue())) {
|
||||
id.setValue(oldToNewNames.get(id.getValue()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -20,11 +104,9 @@ public class ItemRewriter {
|
||||
CompoundTag entityTag = item.getTag().get("EntityTag");
|
||||
if (entityTag.get("id") instanceof StringTag) {
|
||||
StringTag id = entityTag.get("id");
|
||||
|
||||
String value = id.getValue().replaceAll("minecraft:", "");
|
||||
if (value.length() > 1)
|
||||
value = value.substring(0, 1).toUpperCase() + value.substring(1);
|
||||
id.setValue(value);
|
||||
if (oldToNewNames.inverse().containsKey(id.getValue())) {
|
||||
id.setValue(oldToNewNames.inverse().get(id.getValue()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
@@ -94,6 +94,7 @@ public class Protocol1_9TO1_8 extends Protocol {
|
||||
providers.register(BulkChunkTranslatorProvider.class, new BulkChunkTranslatorProvider());
|
||||
providers.register(CommandBlockProvider.class, new CommandBlockProvider());
|
||||
providers.register(EntityIdProvider.class, new EntityIdProvider());
|
||||
providers.register(BossBarProvider.class, new BossBarProvider());
|
||||
providers.require(MovementTransmitterProvider.class);
|
||||
if (Via.getConfig().isStimulatePlayerTick()) {
|
||||
Via.getPlatform().runRepeatingSync(new ViaIdleThread(), 1L);
|
||||
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
package us.myles.ViaVersion.protocols.protocol1_9to1_8.providers;
|
||||
|
||||
import us.myles.ViaVersion.api.data.UserConnection;
|
||||
import us.myles.ViaVersion.api.platform.providers.Provider;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public class BossBarProvider implements Provider {
|
||||
public void handleAdd(UserConnection user, UUID barUUID) {
|
||||
|
||||
}
|
||||
|
||||
public void handleRemove(UserConnection user, UUID barUUID) {
|
||||
|
||||
}
|
||||
}
|
||||
+9
@@ -24,6 +24,8 @@ import us.myles.ViaVersion.protocols.base.ProtocolInfo;
|
||||
import us.myles.ViaVersion.protocols.protocol1_9to1_8.Protocol1_9TO1_8;
|
||||
import us.myles.ViaVersion.protocols.protocol1_9to1_8.chat.GameMode;
|
||||
import us.myles.ViaVersion.protocols.protocol1_9to1_8.metadata.MetadataRewriter;
|
||||
import us.myles.ViaVersion.protocols.protocol1_9to1_8.providers.BossBarProvider;
|
||||
import us.myles.ViaVersion.protocols.protocol1_9to1_8.providers.BulkChunkTranslatorProvider;
|
||||
import us.myles.ViaVersion.protocols.protocol1_9to1_8.providers.EntityIdProvider;
|
||||
|
||||
import java.util.*;
|
||||
@@ -95,6 +97,8 @@ public class EntityTracker extends StoredObject {
|
||||
BossBar bar = bossBarMap.remove(entityID);
|
||||
if (bar != null) {
|
||||
bar.hide();
|
||||
// Send to provider
|
||||
Via.getManager().getProviders().get(BossBarProvider.class).handleRemove(getUser(), bar.getId());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -203,6 +207,9 @@ public class EntityTracker extends StoredObject {
|
||||
bossBarMap.put(entityID, bar);
|
||||
bar.addPlayer(uuid);
|
||||
bar.show();
|
||||
|
||||
// Send to provider
|
||||
Via.getManager().getProviders().get(BossBarProvider.class).handleAdd(getUser(), bar.getId());
|
||||
} else {
|
||||
bar.setTitle(title);
|
||||
}
|
||||
@@ -217,6 +224,8 @@ public class EntityTracker extends StoredObject {
|
||||
bossBarMap.put(entityID, bar);
|
||||
bar.addPlayer(uuid);
|
||||
bar.show();
|
||||
// Send to provider
|
||||
Via.getManager().getProviders().get(BossBarProvider.class).handleAdd(getUser(), bar.getId());
|
||||
} else {
|
||||
bar.setHealth(health);
|
||||
}
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>viaversion-parent</artifactId>
|
||||
<groupId>us.myles</groupId>
|
||||
<version>1.0.3</version>
|
||||
<version>1.0.4</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<name>viaversion-jar</name>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
<groupId>us.myles</groupId>
|
||||
<artifactId>viaversion-parent</artifactId>
|
||||
<version>1.0.3</version>
|
||||
<version>1.0.4</version>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<name>viaversion-parent</name>
|
||||
@@ -65,6 +65,7 @@
|
||||
<version>1.16.6</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- Javassist (Bytecode Library) -->
|
||||
<dependency>
|
||||
<groupId>org.javassist</groupId>
|
||||
@@ -74,11 +75,11 @@
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
<!-- NBT Edit Library -->
|
||||
<!-- OpenNBT Library -->
|
||||
<dependency>
|
||||
<groupId>org.spacehq</groupId>
|
||||
<artifactId>opennbt</artifactId>
|
||||
<version>1.0</version>
|
||||
<version>1.1</version>
|
||||
<scope>compile</scope>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>viaversion-parent</artifactId>
|
||||
<groupId>us.myles</groupId>
|
||||
<version>1.0.3</version>
|
||||
<version>1.0.4</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>viaversion-parent</artifactId>
|
||||
<groupId>us.myles</groupId>
|
||||
<version>1.0.3</version>
|
||||
<version>1.0.4</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -199,4 +199,9 @@ public class SpongePlugin implements ViaPlatform {
|
||||
|
||||
return platformSpecific;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOldClientsAllowed() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user