3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-12-27 08:30:09 +01:00

Sync with master

Dieser Commit ist enthalten in:
Matsv 2016-05-27 19:16:22 +02:00
Commit d5bf7909e8
7 geänderte Dateien mit 54 neuen und 21 gelöschten Zeilen

Datei anzeigen

@ -1,4 +1,4 @@
# ViaVersion 0.8.3 # ViaVersion 0.8.4
[![Build Status](https://travis-ci.org/MylesIsCool/ViaVersion.svg?branch=master)](https://travis-ci.org/MylesIsCool/ViaVersion) [![Build Status](https://travis-ci.org/MylesIsCool/ViaVersion.svg?branch=master)](https://travis-ci.org/MylesIsCool/ViaVersion)
[![Gitter](https://badges.gitter.im/MylesIsCool/ViaVersion.svg)](https://gitter.im/MylesIsCool/ViaVersion) [![Gitter](https://badges.gitter.im/MylesIsCool/ViaVersion.svg)](https://gitter.im/MylesIsCool/ViaVersion)
@ -56,14 +56,13 @@ https://www.spigotmc.org/resources/viaversion.19254/history
---------- ----------
You can find unofficial dev builds here: You can find official dev builds here:
**Terrobility's Build Server:** https://ci.terrocidepvp.net/job/ViaVersion/ **Jenkins:** https://ci.viaversion.com
**sgdc3's Build Server:** http://ci.xephi.fr/job/ViaVersion/ **JavaDocs:** https://jd.viaversion.com
**sgdc3's Maven:** http://ci.xephi.fr/plugin/repository/everything/
**JavaDocs:** https://jd.matsv.nl/ **Maven Repo:** https://repo.viaversion.com
License: License:
-------- --------

Datei anzeigen

@ -423,7 +423,7 @@ public class ViaVersionPlugin extends JavaPlugin implements ViaVersionAPI, ViaVe
} }
public boolean isUnknownEntitiesSuppressed() { public boolean isUnknownEntitiesSuppressed() {
return getConfig().getBoolean("suppress-entityid-errors", false); return false;
} }
public double getHologramYOffset() { public double getHologramYOffset() {
@ -431,7 +431,7 @@ public class ViaVersionPlugin extends JavaPlugin implements ViaVersionAPI, ViaVe
} }
public boolean isBlockBreakPatch() { public boolean isBlockBreakPatch() {
return getConfig().getBoolean("block-break-patch", true); return false;
} }
@Override @Override

Datei anzeigen

@ -78,6 +78,7 @@ public interface ViaVersionConfig {
* *
* @return true if boss bar patching is enabled * @return true if boss bar patching is enabled
*/ */
@Deprecated
boolean isUnknownEntitiesSuppressed(); boolean isUnknownEntitiesSuppressed();
/** /**
@ -99,6 +100,7 @@ public interface ViaVersionConfig {
* *
* @return true if it is enabled. * @return true if it is enabled.
*/ */
@Deprecated
boolean isBlockBreakPatch(); boolean isBlockBreakPatch();
/** /**

Datei anzeigen

@ -184,9 +184,10 @@ public class EntityPackets {
EntityTracker tracker = wrapper.user().get(EntityTracker.class); EntityTracker tracker = wrapper.user().get(EntityTracker.class);
if (tracker.getClientEntityTypes().containsKey(entityID)) { if (tracker.getClientEntityTypes().containsKey(entityID)) {
MetadataRewriter.transform(tracker.getClientEntityTypes().get(entityID), metadataList); MetadataRewriter.transform(tracker.getClientEntityTypes().get(entityID), metadataList);
} else if (!ViaVersion.getConfig().isUnknownEntitiesSuppressed() || ViaVersion.getInstance().isDebug()) { } else {
System.out.println("Unable to find entity for metadata, entity ID: " + entityID); // Buffer
metadataList.clear(); tracker.addMetadataToBuffer(entityID, metadataList);
wrapper.cancel();
} }
} }
}); });
@ -207,8 +208,9 @@ public class EntityPackets {
@Override @Override
public void handle(PacketWrapper wrapper) throws Exception { public void handle(PacketWrapper wrapper) throws Exception {
List<Metadata> metadataList = wrapper.get(Protocol1_9TO1_8.METADATA_LIST, 0); List<Metadata> metadataList = wrapper.get(Protocol1_9TO1_8.METADATA_LIST, 0);
if (metadataList.size() == 0) if (metadataList.size() == 0) {
wrapper.cancel(); wrapper.cancel();
}
} }
}); });
} }
@ -243,9 +245,6 @@ public class EntityPackets {
handler(new PacketHandler() { handler(new PacketHandler() {
@Override @Override
public void handle(PacketWrapper wrapper) throws Exception { public void handle(PacketWrapper wrapper) throws Exception {
// int id = wrapper.read(Type.VAR_INT);
// CompoundTag tag = wrapper.read(Type.NBT);
// System.out.println(id + " - " + tag);
wrapper.cancel(); wrapper.cancel();
} }
}); });

Datei anzeigen

@ -55,6 +55,7 @@ public class SpawnPackets {
int typeID = wrapper.get(Type.BYTE, 0); int typeID = wrapper.get(Type.BYTE, 0);
EntityTracker tracker = wrapper.user().get(EntityTracker.class); EntityTracker tracker = wrapper.user().get(EntityTracker.class);
tracker.getClientEntityTypes().put(entityID, EntityUtil.getTypeFromID(typeID, true)); tracker.getClientEntityTypes().put(entityID, EntityUtil.getTypeFromID(typeID, true));
tracker.sendMetadataBuffer(entityID);
} }
}); });
@ -129,6 +130,7 @@ public class SpawnPackets {
int entityID = wrapper.get(Type.VAR_INT, 0); int entityID = wrapper.get(Type.VAR_INT, 0);
EntityTracker tracker = wrapper.user().get(EntityTracker.class); EntityTracker tracker = wrapper.user().get(EntityTracker.class);
tracker.getClientEntityTypes().put(entityID, EntityType.EXPERIENCE_ORB); tracker.getClientEntityTypes().put(entityID, EntityType.EXPERIENCE_ORB);
tracker.sendMetadataBuffer(entityID);
} }
}); });
@ -154,6 +156,7 @@ public class SpawnPackets {
int entityID = wrapper.get(Type.VAR_INT, 0); int entityID = wrapper.get(Type.VAR_INT, 0);
EntityTracker tracker = wrapper.user().get(EntityTracker.class); EntityTracker tracker = wrapper.user().get(EntityTracker.class);
tracker.getClientEntityTypes().put(entityID, EntityType.LIGHTNING); tracker.getClientEntityTypes().put(entityID, EntityType.LIGHTNING);
tracker.sendMetadataBuffer(entityID);
} }
}); });
@ -187,6 +190,7 @@ public class SpawnPackets {
int typeID = wrapper.get(Type.UNSIGNED_BYTE, 0); int typeID = wrapper.get(Type.UNSIGNED_BYTE, 0);
EntityTracker tracker = wrapper.user().get(EntityTracker.class); EntityTracker tracker = wrapper.user().get(EntityTracker.class);
tracker.getClientEntityTypes().put(entityID, EntityUtil.getTypeFromID(typeID, false)); tracker.getClientEntityTypes().put(entityID, EntityUtil.getTypeFromID(typeID, false));
tracker.sendMetadataBuffer(entityID);
} }
}); });
@ -243,6 +247,7 @@ public class SpawnPackets {
int entityID = wrapper.get(Type.VAR_INT, 0); int entityID = wrapper.get(Type.VAR_INT, 0);
EntityTracker tracker = wrapper.user().get(EntityTracker.class); EntityTracker tracker = wrapper.user().get(EntityTracker.class);
tracker.getClientEntityTypes().put(entityID, EntityType.PAINTING); tracker.getClientEntityTypes().put(entityID, EntityType.PAINTING);
tracker.sendMetadataBuffer(entityID);
} }
}); });
@ -276,6 +281,7 @@ public class SpawnPackets {
int entityID = wrapper.get(Type.VAR_INT, 0); int entityID = wrapper.get(Type.VAR_INT, 0);
EntityTracker tracker = wrapper.user().get(EntityTracker.class); EntityTracker tracker = wrapper.user().get(EntityTracker.class);
tracker.getClientEntityTypes().put(entityID, EntityType.PLAYER); tracker.getClientEntityTypes().put(entityID, EntityType.PLAYER);
tracker.sendMetadataBuffer(entityID);
} }
}); });

Datei anzeigen

@ -21,7 +21,9 @@ import us.myles.ViaVersion.api.minecraft.item.Item;
import us.myles.ViaVersion.api.minecraft.metadata.Metadata; import us.myles.ViaVersion.api.minecraft.metadata.Metadata;
import us.myles.ViaVersion.api.type.Type; import us.myles.ViaVersion.api.type.Type;
import us.myles.ViaVersion.protocols.base.ProtocolInfo; 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.chat.GameMode;
import us.myles.ViaVersion.protocols.protocol1_9to1_8.metadata.MetadataRewriter;
import us.myles.ViaVersion.protocols.protocol1_9to1_8.metadata.NewType; import us.myles.ViaVersion.protocols.protocol1_9to1_8.metadata.NewType;
import java.util.*; import java.util.*;
@ -32,6 +34,7 @@ import java.util.concurrent.TimeUnit;
public class EntityTracker extends StoredObject { public class EntityTracker extends StoredObject {
private final Map<Integer, UUID> uuidMap = new ConcurrentHashMap<>(); private final Map<Integer, UUID> uuidMap = new ConcurrentHashMap<>();
private final Map<Integer, EntityType> clientEntityTypes = new ConcurrentHashMap<>(); private final Map<Integer, EntityType> clientEntityTypes = new ConcurrentHashMap<>();
private final Map<Integer, List<Metadata>> metadataBuffer = new ConcurrentHashMap<>();
private final Map<Integer, Integer> vehicleMap = new ConcurrentHashMap<>(); private final Map<Integer, Integer> vehicleMap = new ConcurrentHashMap<>();
private final Map<Integer, BossBar> bossBarMap = new ConcurrentHashMap<>(); private final Map<Integer, BossBar> bossBarMap = new ConcurrentHashMap<>();
private final Set<Integer> validBlocking = Sets.newConcurrentHashSet(); private final Set<Integer> validBlocking = Sets.newConcurrentHashSet();
@ -87,6 +90,7 @@ public class EntityTracker extends StoredObject {
uuidMap.remove(entityID); uuidMap.remove(entityID);
validBlocking.remove(entityID); validBlocking.remove(entityID);
knownHolograms.remove(entityID); knownHolograms.remove(entityID);
metadataBuffer.remove(entityID);
BossBar bar = bossBarMap.remove(entityID); BossBar bar = bossBarMap.remove(entityID);
if (bar != null) { if (bar != null) {
@ -113,7 +117,9 @@ public class EntityTracker extends StoredObject {
} }
public void handleMetadata(int entityID, List<Metadata> metadataList) { public void handleMetadata(int entityID, List<Metadata> metadataList) {
if (!clientEntityTypes.containsKey(entityID)) return; if (!clientEntityTypes.containsKey(entityID)) {
return;
}
EntityType type = clientEntityTypes.get(entityID); EntityType type = clientEntityTypes.get(entityID);
for (Metadata metadata : new ArrayList<>(metadataList)) { for (Metadata metadata : new ArrayList<>(metadataList)) {
@ -251,4 +257,30 @@ public class EntityTracker extends StoredObject {
e.printStackTrace(); e.printStackTrace();
} }
} }
public void addMetadataToBuffer(int entityID, List<Metadata> metadataList) {
if (metadataBuffer.containsKey(entityID)) {
metadataBuffer.get(entityID).addAll(metadataList);
} else {
metadataBuffer.put(entityID, metadataList);
}
}
public void sendMetadataBuffer(int entityID) {
if (metadataBuffer.containsKey(entityID)) {
PacketWrapper wrapper = new PacketWrapper(0x39, null, getUser());
wrapper.write(Type.VAR_INT, entityID);
wrapper.write(Protocol1_9TO1_8.METADATA_LIST, metadataBuffer.get(entityID));
MetadataRewriter.transform(getClientEntityTypes().get(entityID), metadataBuffer.get(entityID));
handleMetadata(entityID, metadataBuffer.get(entityID));
if (metadataBuffer.get(entityID).size() > 0) {
try {
wrapper.send();
} catch (Exception e) {
e.printStackTrace();
}
}
metadataBuffer.remove(entityID);
}
}
} }

Datei anzeigen

@ -67,11 +67,6 @@ bossbar-anti-flicker: false
use-new-effect-indicator: true use-new-effect-indicator: true
# Show the new death messages for 1.9 on the death screen # Show the new death messages for 1.9 on the death screen
use-new-deathmessages: false use-new-deathmessages: false
# This will suppress the following error: 'Unable to get entity for ID: xxxx'
# This error message means one of you plugins is sending bad packets!
suppress-entityid-errors: false
# Our patch for block breaking issue, if you have issues with block updates then disable this.
block-break-patch: true
# Should we cache our items, this will prevent server from being lagged out, however the cost is a constant task caching items # Should we cache our items, this will prevent server from being lagged out, however the cost is a constant task caching items
item-cache: true item-cache: true
# Patch the Anti xray to work on 1.9 (If your server is 1.8) This can cost more performance, so disable it if you don't use it. # Patch the Anti xray to work on 1.9 (If your server is 1.8) This can cost more performance, so disable it if you don't use it.