Fixed bug for standing on portals

This commit is contained in:
Alastair 2016-04-07 14:35:48 +01:00
parent b201c76e97
commit 3fbdccbd40

View File

@ -1,14 +1,19 @@
package com.sekwah.advancedportals.listeners;
import com.avaje.ebeaninternal.server.transaction.RemoteTransactionEvent;
import com.google.common.base.Optional;
import com.sekwah.advancedportals.AdvancedPortalsPlugin;
import com.sekwah.advancedportals.ConfigAccessor;
import com.sekwah.advancedportals.events.WarpEvent;
import com.sekwah.advancedportals.portals.AdvancedPortal;
import com.sekwah.advancedportals.portals.Portal;
import com.sun.org.apache.regexp.internal.RE;
import net.minecraft.server.v1_9_R1.DataWatcherObject;
import net.minecraft.server.v1_9_R1.EntityItem;
import net.minecraft.server.v1_9_R1.ItemStack;
import org.bukkit.*;
import org.bukkit.block.Block;
import org.bukkit.craftbukkit.v1_9_R1.CraftWorld;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
@ -24,6 +29,7 @@ import org.bukkit.event.player.PlayerTeleportEvent;
import org.bukkit.event.world.ChunkUnloadEvent;
import org.bukkit.metadata.FixedMetadataValue;
import java.lang.reflect.Field;
import java.util.HashMap;
public class Listeners implements Listener {
@ -262,6 +268,16 @@ public class Listeners implements Listener {
}
}
EntityItem item = new EntityItem(((CraftWorld)loc.getWorld()).getHandle());
try {
Field f = item.getClass().getDeclaredField("c");
f.setAccessible(true);
DataWatcherObject<Optional<ItemStack>> ITEM_DATA = (DataWatcherObject<Optional<ItemStack>>) f.get(item);
} catch (NoSuchFieldException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
}
}