Mirror von
https://github.com/ViaVersion/ViaVersion.git
synchronisiert 2024-12-26 16:12:42 +01:00
Correct last commit to make it work.
Dieser Commit ist enthalten in:
Ursprung
0db43e612e
Commit
6199e1d8ce
@ -84,28 +84,6 @@ public class ViaVersionPlugin extends JavaPlugin implements ViaVersionAPI {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Entity getEntity(final UUID player, final int id) {
|
|
||||||
try {
|
|
||||||
return Bukkit.getScheduler().callSyncMethod(getPlugin(ViaVersionPlugin.class), new Callable<Entity>() {
|
|
||||||
@Override
|
|
||||||
public Entity call() throws Exception {
|
|
||||||
Player p = Bukkit.getPlayer(player);
|
|
||||||
if (p == null) return null;
|
|
||||||
for (Entity e : p.getWorld().getEntities()) {
|
|
||||||
if (e.getEntityId() == id) {
|
|
||||||
return e;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}).get(10, TimeUnit.SECONDS);
|
|
||||||
} catch (Exception e) {
|
|
||||||
System.out.println("Error fetching entity ");
|
|
||||||
e.printStackTrace();
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static ItemStack getHandItem(final ConnectionInfo info) {
|
public static ItemStack getHandItem(final ConnectionInfo info) {
|
||||||
try {
|
try {
|
||||||
return Bukkit.getScheduler().callSyncMethod(getPlugin(ViaVersionPlugin.class), new Callable<ItemStack>() {
|
return Bukkit.getScheduler().callSyncMethod(getPlugin(ViaVersionPlugin.class), new Callable<ItemStack>() {
|
||||||
|
@ -212,7 +212,7 @@ public class IncomingTransformer {
|
|||||||
output.writeLong(-1L);
|
output.writeLong(-1L);
|
||||||
output.writeByte(255);
|
output.writeByte(255);
|
||||||
// write item in hand
|
// write item in hand
|
||||||
ItemStack inHand = Core.getHandItem(info);
|
ItemStack inHand = ViaVersionPlugin.getHandItem(info);
|
||||||
Object item = null;
|
Object item = null;
|
||||||
try {
|
try {
|
||||||
Method m = ReflectionUtil.obc("inventory.CraftItemStack").getDeclaredMethod("asNMSCopy", ItemStack.class);
|
Method m = ReflectionUtil.obc("inventory.CraftItemStack").getDeclaredMethod("asNMSCopy", ItemStack.class);
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren