Correctly wrap and unwrap ItemStacks in WrappedWatchableObject.
This should make it possible to set and retrieve watchable objects of the type ItemStack.
Dieser Commit ist enthalten in:
Ursprung
b6809f6ce6
Commit
8c8ca3746b
@ -280,6 +280,8 @@ public class WrappedWatchableObject {
|
|||||||
return ChunkPosition.class;
|
return ChunkPosition.class;
|
||||||
else if (unwrapped.equals(MinecraftReflection.getChunkCoordinatesClass()))
|
else if (unwrapped.equals(MinecraftReflection.getChunkCoordinatesClass()))
|
||||||
return WrappedChunkCoordinate.class;
|
return WrappedChunkCoordinate.class;
|
||||||
|
else if (unwrapped.equals(MinecraftReflection.getItemStackClass()))
|
||||||
|
return ItemStack.class;
|
||||||
else
|
else
|
||||||
return unwrapped;
|
return unwrapped;
|
||||||
}
|
}
|
||||||
@ -291,7 +293,10 @@ public class WrappedWatchableObject {
|
|||||||
*/
|
*/
|
||||||
static Object getUnwrapped(Object wrapped) {
|
static Object getUnwrapped(Object wrapped) {
|
||||||
// Convert special cases
|
// Convert special cases
|
||||||
if (wrapped instanceof WrappedChunkCoordinate)
|
if (wrapped instanceof ChunkPosition)
|
||||||
|
return ChunkPosition.getConverter().getGeneric(
|
||||||
|
MinecraftReflection.getChunkPositionClass(), (ChunkPosition) wrapped);
|
||||||
|
else if (wrapped instanceof WrappedChunkCoordinate)
|
||||||
return ((WrappedChunkCoordinate) wrapped).getHandle();
|
return ((WrappedChunkCoordinate) wrapped).getHandle();
|
||||||
else if (wrapped instanceof ItemStack)
|
else if (wrapped instanceof ItemStack)
|
||||||
return BukkitConverters.getItemStackConverter().getGeneric(
|
return BukkitConverters.getItemStackConverter().getGeneric(
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren