Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7ea2156f37 | ||
|
|
5032e7d07e | ||
|
|
c7c6ee9fbc | ||
|
|
4431ca63c2 | ||
|
|
1fa7211cf0 | ||
|
|
de576795dc |
No files matched your search
@@ -1,4 +1,4 @@
|
||||
# ViaVersion 0.7.3
|
||||
# ViaVersion 0.7.4
|
||||
[](https://travis-ci.org/MylesIsCool/ViaVersion)
|
||||
[](https://gitter.im/MylesIsCool/ViaVersion)
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
<groupId>us.myles</groupId>
|
||||
<artifactId>viaversion</artifactId>
|
||||
<version>0.7.4-SNAPSHOT</version>
|
||||
<version>0.7.5-SNAPSHOT</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>ViaVersion</name>
|
||||
|
||||
@@ -94,6 +94,9 @@ public class ViaVersionPlugin extends JavaPlugin implements ViaVersionAPI, ViaVe
|
||||
|
||||
getCommand("viaversion").setExecutor(commandHandler = new ViaCommandHandler());
|
||||
getCommand("viaversion").setTabCompleter(commandHandler);
|
||||
|
||||
// Register Protocol Listeners
|
||||
ProtocolRegistry.registerListeners();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -20,7 +20,6 @@ public abstract class Protocol {
|
||||
|
||||
public Protocol() {
|
||||
registerPackets();
|
||||
registerListeners();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package us.myles.ViaVersion.api.protocol;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import us.myles.ViaVersion.api.Pair;
|
||||
import us.myles.ViaVersion.protocols.protocol1_9_1to1_9.Protocol1_9_1TO1_9;
|
||||
import us.myles.ViaVersion.protocols.protocol1_9to1_8.Protocol1_9TO1_8;
|
||||
@@ -11,6 +12,7 @@ public class ProtocolRegistry {
|
||||
// Input Version -> Output Version & Protocol (Allows fast lookup)
|
||||
private static Map<Integer, Map<Integer, Protocol>> registryMap = new HashMap<>();
|
||||
private static Map<Pair<Integer, Integer>, List<Pair<Integer, Protocol>>> pathCache = new HashMap<>();
|
||||
private static List<Protocol> registerList = new ArrayList<>();
|
||||
|
||||
static {
|
||||
// Register built in protocols
|
||||
@@ -37,6 +39,12 @@ public class ProtocolRegistry {
|
||||
|
||||
registryMap.get(version).put(output, protocol);
|
||||
}
|
||||
|
||||
if (Bukkit.getPluginManager().getPlugin("ViaVersion").isEnabled()) {
|
||||
protocol.registerListeners();
|
||||
} else {
|
||||
registerList.add(protocol);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -51,6 +59,16 @@ public class ProtocolRegistry {
|
||||
return false; // No destination for protocol
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the server is enabled, to register any non registered listeners.
|
||||
*/
|
||||
public static void registerListeners() {
|
||||
for (Protocol protocol : registerList) {
|
||||
protocol.registerListeners();
|
||||
}
|
||||
registerList.clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate a path to get from an input protocol to the servers protocol.
|
||||
*
|
||||
|
||||
@@ -30,11 +30,9 @@ public class ListSubCmd extends ViaSubCommand {
|
||||
Map<Integer, Set<String>> playerVersions = new HashMap<>();
|
||||
for (Player p : Bukkit.getOnlinePlayers()) {
|
||||
int playerVersion = ViaVersion.getInstance().getPlayerVersion(p);
|
||||
if (playerVersions.containsKey(playerVersion)) {
|
||||
playerVersions.get(playerVersion).add(p.getName());
|
||||
continue;
|
||||
}
|
||||
playerVersions.put(playerVersion, Collections.singleton(p.getName()));
|
||||
if (!playerVersions.containsKey(playerVersion))
|
||||
playerVersions.put(playerVersion, new HashSet<String>());
|
||||
playerVersions.get(playerVersion).add(p.getName());
|
||||
}
|
||||
Map<Integer, Set<String>> sorted = new TreeMap<>(playerVersions);
|
||||
|
||||
|
||||
+1
-1
@@ -290,7 +290,7 @@ public class SpawnPackets {
|
||||
@Override
|
||||
public void handle(PacketWrapper wrapper) throws Exception {
|
||||
short item = wrapper.read(Type.SHORT);
|
||||
System.out.println(item);
|
||||
// System.out.println(item);
|
||||
if (item != 0) {
|
||||
PacketWrapper packet = new PacketWrapper(0x3C, null, wrapper.user());
|
||||
packet.write(Type.VAR_INT, wrapper.get(Type.VAR_INT, 0));
|
||||
|
||||
+16
-8
@@ -89,21 +89,21 @@ public class EntityTracker extends StoredObject {
|
||||
}
|
||||
|
||||
public boolean interactedBlockRecently(int x, int y, int z) {
|
||||
if(blockInteractions.size() == 0)
|
||||
if (blockInteractions.size() == 0)
|
||||
return false;
|
||||
Iterator<Position> it = blockInteractions.asMap().keySet().iterator();
|
||||
while(it.hasNext()) {
|
||||
while (it.hasNext()) {
|
||||
Position p = it.next();
|
||||
if(p.getX() == x)
|
||||
if(p.getY() == y)
|
||||
if(p.getZ() == z)
|
||||
if (p.getX() == x)
|
||||
if (p.getY() == y)
|
||||
if (p.getZ() == z)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void addBlockInteraction(Position p) {
|
||||
blockInteractions.put(p,Material.AIR);
|
||||
blockInteractions.put(p, Material.AIR);
|
||||
}
|
||||
|
||||
public void handleMetadata(int entityID, List<Metadata> metadataList) {
|
||||
@@ -143,9 +143,10 @@ public class EntityTracker extends StoredObject {
|
||||
}
|
||||
}
|
||||
if (type == EntityType.ARMOR_STAND && ((ViaVersionPlugin) ViaVersion.getInstance()).isHologramPatch()) {
|
||||
if (metadata.getId() == 0) {
|
||||
if (metadata.getId() == 0 && getMetaByIndex(metadataList, 10) != null) {
|
||||
Metadata meta = getMetaByIndex(metadataList, 10); //Only happens if the armorstand is small
|
||||
byte data = (byte) metadata.getValue();
|
||||
if ((data & 0x20) == 0x20) {
|
||||
if ((data & 0x20) == 0x20 && ((byte) meta.getValue() & 0x01) == 0x01) {
|
||||
if (!knownHolograms.contains(entityID)) {
|
||||
knownHolograms.add(entityID);
|
||||
try {
|
||||
@@ -200,6 +201,13 @@ public class EntityTracker extends StoredObject {
|
||||
}
|
||||
}
|
||||
|
||||
public Metadata getMetaByIndex(List<Metadata> list, int index) {
|
||||
for (Metadata meta : list)
|
||||
if (index == meta.getId())
|
||||
return meta;
|
||||
return null;
|
||||
}
|
||||
|
||||
public void sendTeamPacket(boolean b) {
|
||||
PacketWrapper wrapper = new PacketWrapper(0x41, null, getUser());
|
||||
wrapper.write(Type.STRING, "viaversion"); // Use viaversion as name
|
||||
|
||||
Reference in new issue
Block a user