mirror of
https://e.coding.net/circlecloud/QuickShop.git
synced 2024-11-25 02:28:54 +00:00
fix: 修复悬浮物初始化错误
Signed-off-by: 502647092 <admin@yumc.pw>
This commit is contained in:
parent
dec12d75cb
commit
b3995f3b2f
2
pom.xml
2
pom.xml
@ -78,7 +78,7 @@
|
|||||||
<groupId>pw.yumc</groupId>
|
<groupId>pw.yumc</groupId>
|
||||||
<artifactId>YumCore</artifactId>
|
<artifactId>YumCore</artifactId>
|
||||||
<type>jar</type>
|
<type>jar</type>
|
||||||
<version>1.8</version>
|
<version>1.7</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>io.github.Cnly.WowSuchCleaner</groupId>
|
<groupId>io.github.Cnly.WowSuchCleaner</groupId>
|
||||||
|
@ -31,15 +31,16 @@ public abstract class DisplayItem {
|
|||||||
List<Class<? extends DisplayItem>> fakeItems = Arrays.asList(FakeItem_19_111.class, FakeItem_18.class, FakeItem_17.class);
|
List<Class<? extends DisplayItem>> fakeItems = Arrays.asList(FakeItem_19_111.class, FakeItem_18.class, FakeItem_17.class);
|
||||||
Log.i("启用虚拟悬浮物 尝试启动中...");
|
Log.i("启用虚拟悬浮物 尝试启动中...");
|
||||||
FakeItem.register(plugin);
|
FakeItem.register(plugin);
|
||||||
fakeItems.forEach(c -> {
|
for (Class<? extends DisplayItem> c : fakeItems) {
|
||||||
try {
|
try {
|
||||||
c.getConstructor(Location.class, ItemStack.class).newInstance(new Location(Bukkit.getWorlds().get(0), 0, 0, 0), new ItemStack(Material.STONE)).spawn();
|
c.getConstructor(Location.class, ItemStack.class).newInstance(new Location(Bukkit.getWorlds().get(0), 0, 0, 0), new ItemStack(Material.STONE)).spawn();
|
||||||
displayItemClass = c;
|
displayItemClass = c;
|
||||||
Log.i("虚拟悬浮物功能测试正常(%s)...", c.getSimpleName());
|
Log.i("虚拟悬浮物功能测试正常(%s)...", c.getSimpleName());
|
||||||
|
break;
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
Log.d(e);
|
Log.d(e);
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
if (displayItemClass == null) {
|
if (displayItemClass == null) {
|
||||||
displayItemClass = NormalItem.class;
|
displayItemClass = NormalItem.class;
|
||||||
Log.w("+=========================================");
|
Log.w("+=========================================");
|
||||||
|
@ -30,7 +30,7 @@ public class FakeItem_18 extends FakeItem {
|
|||||||
@Override
|
@Override
|
||||||
protected PacketContainer setMetadataPacket(PacketContainer fakePacket) {
|
protected PacketContainer setMetadataPacket(PacketContainer fakePacket) {
|
||||||
fakePacket.getIntegers().write(0, eid);
|
fakePacket.getIntegers().write(0, eid);
|
||||||
final WrappedWatchableObject itemMeta = new WrappedWatchableObject(10, itemStack);
|
final WrappedWatchableObject itemMeta = new WrappedWatchableObject(5, itemStack);
|
||||||
final List<WrappedWatchableObject> entityMetaList = new ArrayList<>(1);
|
final List<WrappedWatchableObject> entityMetaList = new ArrayList<>(1);
|
||||||
entityMetaList.add(itemMeta);
|
entityMetaList.add(itemMeta);
|
||||||
fakePacket.getWatchableCollectionModifier().write(0, entityMetaList);
|
fakePacket.getWatchableCollectionModifier().write(0, entityMetaList);
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
package org.maxgamer.QuickShop.Shop.Item;
|
package org.maxgamer.QuickShop.Shop.Item;
|
||||||
|
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
@ -8,7 +10,6 @@ import com.comphenix.protocol.reflect.StructureModifier;
|
|||||||
import com.comphenix.protocol.wrappers.WrappedDataWatcher;
|
import com.comphenix.protocol.wrappers.WrappedDataWatcher;
|
||||||
import com.comphenix.protocol.wrappers.WrappedDataWatcher.Serializer;
|
import com.comphenix.protocol.wrappers.WrappedDataWatcher.Serializer;
|
||||||
import com.comphenix.protocol.wrappers.WrappedDataWatcher.WrappedDataWatcherObject;
|
import com.comphenix.protocol.wrappers.WrappedDataWatcher.WrappedDataWatcherObject;
|
||||||
import com.google.common.base.Optional;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Minecraft 虚拟悬浮物品工具类
|
* Minecraft 虚拟悬浮物品工具类
|
||||||
@ -28,7 +29,7 @@ public class FakeItem_19_111 extends FakeItem {
|
|||||||
fakePacket.getIntegers().write(0, eid);
|
fakePacket.getIntegers().write(0, eid);
|
||||||
final WrappedDataWatcher wr = new WrappedDataWatcher();
|
final WrappedDataWatcher wr = new WrappedDataWatcher();
|
||||||
final Serializer serializer = WrappedDataWatcher.Registry.getItemStackSerializer(true);
|
final Serializer serializer = WrappedDataWatcher.Registry.getItemStackSerializer(true);
|
||||||
final WrappedDataWatcherObject object = new WrappedDataWatcher.WrappedDataWatcherObject(6, serializer);
|
final WrappedDataWatcherObject object = new WrappedDataWatcherObject(6, serializer);
|
||||||
wr.setObject(object, Optional.of(itemStack));
|
wr.setObject(object, Optional.of(itemStack));
|
||||||
fakePacket.getWatchableCollectionModifier().write(0, wr.getWatchableObjects());
|
fakePacket.getWatchableCollectionModifier().write(0, wr.getWatchableObjects());
|
||||||
return fakePacket;
|
return fakePacket;
|
||||||
|
Loading…
Reference in New Issue
Block a user