Fixed changes from bukkit

This commit is contained in:
Grafe 2012-12-28 20:45:57 +01:00
parent 3cf96c5f25
commit cd16ed2110
4 changed files with 186 additions and 190 deletions

View File

@ -4,14 +4,14 @@ import java.io.File;
import java.util.HashSet;
import java.util.Set;
import net.minecraft.server.Item;
import net.minecraft.server.v1_4_6.Item;
import org.bukkit.Location;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.craftbukkit.entity.CraftSkeleton;
import org.bukkit.craftbukkit.entity.CraftZombie;
import org.bukkit.craftbukkit.inventory.CraftItemStack;
import org.bukkit.craftbukkit.v1_4_6.entity.CraftSkeleton;
import org.bukkit.craftbukkit.v1_4_6.entity.CraftZombie;
import org.bukkit.craftbukkit.v1_4_6.inventory.CraftItemStack;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
import org.bukkit.inventory.ItemStack;
@ -21,106 +21,107 @@ import com.dre.dungeonsxl.game.GameWorld;
public class DMobType {
private static Set<DMobType> mobTypes = new HashSet<DMobType>();
private String name;
private EntityType type;
private int maxHealth;
private Item ItemHand;
private Item ItemHelmet;
private Item ItemChestplate;
private Item ItemLeggings;
private Item ItemBoots;
public DMobType(String name, EntityType type){
mobTypes.add(this);
this.name=name;
this.type=type;
}
public void spawn(GameWorld gWorld, Location loc){
if(type!=null){
if(type.isAlive()){
LivingEntity entity=(LivingEntity)gWorld.world.spawnEntity(loc, type);
/* Set the Items */
//Check if it's a Zombie
if(type==EntityType.ZOMBIE){
CraftZombie entityC = (CraftZombie)entity;
net.minecraft.server.EntityZombie entityMC = entityC.getHandle();
if(ItemHand!=null) entityMC.setEquipment(0, new net.minecraft.server.ItemStack(ItemHand));
if(ItemBoots!=null) entityMC.setEquipment(1, new net.minecraft.server.ItemStack(ItemBoots));
if(ItemLeggings!=null) entityMC.setEquipment(2, new net.minecraft.server.ItemStack(ItemLeggings));
if(ItemChestplate!=null) entityMC.setEquipment(3, new net.minecraft.server.ItemStack(ItemChestplate));
if(ItemHelmet!=null) entityMC.setEquipment(4, new net.minecraft.server.ItemStack(ItemHelmet));
net.minecraft.server.v1_4_6.EntityZombie entityMC = entityC.getHandle();
if(ItemHand!=null) entityMC.setEquipment(0, new net.minecraft.server.v1_4_6.ItemStack(ItemHand));
if(ItemBoots!=null) entityMC.setEquipment(1, new net.minecraft.server.v1_4_6.ItemStack(ItemBoots));
if(ItemLeggings!=null) entityMC.setEquipment(2, new net.minecraft.server.v1_4_6.ItemStack(ItemLeggings));
if(ItemChestplate!=null) entityMC.setEquipment(3, new net.minecraft.server.v1_4_6.ItemStack(ItemChestplate));
if(ItemHelmet!=null) entityMC.setEquipment(4, new net.minecraft.server.v1_4_6.ItemStack(ItemHelmet));
}
//Check if it's a Skeleton
if(type==EntityType.SKELETON){
CraftSkeleton entityC = (CraftSkeleton)entity;
net.minecraft.server.EntitySkeleton entityMC = entityC.getHandle();
if(ItemHand!=null) entityMC.setEquipment(0, new net.minecraft.server.ItemStack(ItemHand));
if(ItemBoots!=null) entityMC.setEquipment(1, new net.minecraft.server.ItemStack(ItemBoots));
if(ItemLeggings!=null) entityMC.setEquipment(2, new net.minecraft.server.ItemStack(ItemLeggings));
if(ItemChestplate!=null) entityMC.setEquipment(3, new net.minecraft.server.ItemStack(ItemChestplate));
if(ItemHelmet!=null) entityMC.setEquipment(4, new net.minecraft.server.ItemStack(ItemHelmet));
net.minecraft.server.v1_4_6.EntitySkeleton entityMC = entityC.getHandle();
if(ItemHand!=null) entityMC.setEquipment(0, new net.minecraft.server.v1_4_6.ItemStack(ItemHand));
if(ItemBoots!=null) entityMC.setEquipment(1, new net.minecraft.server.v1_4_6.ItemStack(ItemBoots));
if(ItemLeggings!=null) entityMC.setEquipment(2, new net.minecraft.server.v1_4_6.ItemStack(ItemLeggings));
if(ItemChestplate!=null) entityMC.setEquipment(3, new net.minecraft.server.v1_4_6.ItemStack(ItemChestplate));
if(ItemHelmet!=null) entityMC.setEquipment(4, new net.minecraft.server.v1_4_6.ItemStack(ItemHelmet));
}
/* Spawn Mob */
new DMob(entity, maxHealth, gWorld);
}
}
}
//Load Config
public static void load(File file){
FileConfiguration configFile = YamlConfiguration.loadConfiguration(file);
//Read Mobs
for(String mobName:configFile.getKeys(true)){
if(!mobName.contains(".")){
DungeonsXL.p.log("Test"+mobName);
EntityType type=EntityType.fromName(configFile.getString(mobName+".Type"));
DMobType mobType=new DMobType(mobName, type);
//Load MaxHealth
if(configFile.contains(mobName+".MaxHealth")){
mobType.maxHealth=configFile.getInt(mobName+".MaxHealth");
}
//Load Items
if(configFile.contains(mobName+".ItemHelmet")){
mobType.ItemHelmet=CraftItemStack.createNMSItemStack(new ItemStack(configFile.getInt(mobName+".ItemHelmet"))).getItem();
mobType.ItemHelmet=CraftItemStack.asNMSCopy(new ItemStack(configFile.getInt(mobName+".ItemHelmet"))).getItem();
}
if(configFile.contains(mobName+".ItemChestplate")){
mobType.ItemChestplate=CraftItemStack.createNMSItemStack(new ItemStack(configFile.getInt(mobName+".ItemChestplate"))).getItem();
mobType.ItemChestplate=CraftItemStack.asNMSCopy(new ItemStack(configFile.getInt(mobName+".ItemChestplate"))).getItem();
}
if(configFile.contains(mobName+".ItemBoots")){
mobType.ItemBoots=CraftItemStack.createNMSItemStack(new ItemStack(configFile.getInt(mobName+".ItemBoots"))).getItem();
mobType.ItemBoots=CraftItemStack.asNMSCopy(new ItemStack(configFile.getInt(mobName+".ItemBoots"))).getItem();
}
if(configFile.contains(mobName+".ItemLeggings")){
mobType.ItemLeggings=CraftItemStack.createNMSItemStack(new ItemStack(configFile.getInt(mobName+".ItemLeggings"))).getItem();
mobType.ItemLeggings=CraftItemStack.asNMSCopy(new ItemStack(configFile.getInt(mobName+".ItemLeggings"))).getItem();
}
if(configFile.contains(mobName+".ItemHand")){
mobType.ItemHand=CraftItemStack.createNMSItemStack(new ItemStack(configFile.getInt(mobName+".ItemHand"))).getItem();
mobType.ItemHand=CraftItemStack.asNMSCopy(new ItemStack(configFile.getInt(mobName+".ItemHand"))).getItem();
}
}
}
}
//Get
public static DMobType get(String name){
for(DMobType mobType:DMobType.mobTypes){

View File

@ -21,16 +21,16 @@ import com.dre.dungeonsxl.game.GameWorld;
public class DPlayer {
public DungeonsXL p=DungeonsXL.p;
public static CopyOnWriteArrayList<DPlayer> players=new CopyOnWriteArrayList<DPlayer>();
//Variables
public Player player;
public World world;
public DPlayer oldDPlayer=null;
public int isinTestMode=0;
public Location oldLocation;
public ItemStack[] oldInventory;
public ItemStack[] oldArmor;
@ -39,12 +39,12 @@ public class DPlayer {
public int oldHealth;
public int oldFoodLevel;
public GameMode oldGamemode;
public boolean isEditing;
public boolean isInWorldChat=false;
public boolean isReady=false;
public boolean isFinished=false;
public DClass dclass;
public GameCheckpoint checkpoint;
public CopyOnWriteArrayList<Integer> classItems=new CopyOnWriteArrayList<Integer>();
@ -53,14 +53,14 @@ public class DPlayer {
public int offlineTime;
public int invItemInHand;
public CopyOnWriteArrayList<ItemStack> respawnInventory=new CopyOnWriteArrayList<ItemStack>();
public Inventory treasureInv = DungeonsXL.p.getServer().createInventory(player, 45, "Belohnungen");
public DPlayer(Player player, World world, Location teleport, boolean isEditing){
players.add(this);
this.player=player;
this.world=world;
this.oldLocation=player.getLocation();
this.oldInventory=player.getInventory().getContents();
this.oldArmor=player.getInventory().getArmorContents();
@ -69,7 +69,7 @@ public class DPlayer {
this.oldFoodLevel=player.getFoodLevel();
this.oldGamemode=player.getGameMode();
this.oldLvl=player.getLevel();
this.player.teleport(teleport);
this.player.getInventory().clear();
this.player.getInventory().setArmorContents(null);
@ -79,25 +79,25 @@ public class DPlayer {
this.player.setFoodLevel(20);
this.isEditing=isEditing;
if(isEditing) this.player.setGameMode(GameMode.CREATIVE); else this.player.setGameMode(GameMode.SURVIVAL);
if(!isEditing){
if(GameWorld.get(world).confReader.isLobbyDisabled){
this.ready();
}
}
}
public void goOffline(){
offlineTime=1;
}
public void leave(){
remove(this);
if(this.oldDPlayer!=null){
this.oldDPlayer.isinTestMode=0;
}
this.player.teleport(this.oldLocation);
this.player.getInventory().setContents(this.oldInventory);
this.player.getInventory().setArmorContents(this.oldArmor);
@ -106,8 +106,8 @@ public class DPlayer {
this.player.setHealth(oldHealth);
this.player.setFoodLevel(oldFoodLevel);
this.player.setGameMode(oldGamemode);
if(this.isEditing){
EditWorld eworld=EditWorld.get(this.world);
if(eworld!=null){
@ -122,15 +122,15 @@ public class DPlayer {
dgroup.remove();
}
}
//Belohnung
if(this.oldDPlayer==null&&this.isinTestMode!=2){//Nur wenn man nicht am Testen ist
if(isFinished){
if(isFinished){
this.addTreasure();
//Set Time
File file=new File(p.getDataFolder()+"/dungeons/"+gworld.dungeonname, "players.yml");
if(!file.exists()){
try {
file.createNewFile();
@ -139,18 +139,18 @@ public class DPlayer {
e.printStackTrace();
}
}
FileConfiguration playerConfig = YamlConfiguration.loadConfiguration(file);
playerConfig.set(player.getName(), System.currentTimeMillis());
try {
playerConfig.save(file);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
//Tutorial Permissions
if(gworld.isTutorial){
p.permission.playerAddGroup(this.player, p.tutorialEndGroup);
@ -158,7 +158,7 @@ public class DPlayer {
}
}
}
//Give Secure Objects other Players
if(dgroup!=null){
if(!dgroup.isEmpty()){
@ -174,26 +174,26 @@ public class DPlayer {
}
}
}
DungeonsXL.p.updateInventory(groupplayer);
//DungeonsXL.p.updateInventory(groupplayer);
}
i++;
}while(groupplayer==null);
}
}
}
DungeonsXL.p.updateInventory(this.player);
//DungeonsXL.p.updateInventory(this.player);
}
public void ready(){
this.isReady=true;
DGroup dgroup=DGroup.get(this.player);
if(!dgroup.isPlaying){
if(dgroup!=null){
@ -204,14 +204,14 @@ public class DPlayer {
}
}
}
dgroup.startGame();
}else{
this.respawn();
}
}
public void respawn(){
DGroup dgroup=DGroup.get(this.player);
if(this.checkpoint==null){
@ -222,7 +222,7 @@ public class DPlayer {
if(this.wolf!=null){
this.wolf.teleport(this.player);
}
//Respawn Items
for(ItemStack istack:this.respawnInventory){
if(istack!=null){
@ -230,13 +230,13 @@ public class DPlayer {
}
}
this.respawnInventory.clear();
DungeonsXL.p.updateInventory(this.player);
//DungeonsXL.p.updateInventory(this.player);
}
public void finish(){
DungeonsXL.p.msg(this.player, ChatColor.YELLOW+"Du hast den Dungeon erfolgreich beendet!");
this.isFinished=true;
DGroup dgroup=DGroup.get(this.player);
if(dgroup!=null){
if(dgroup.isPlaying){
@ -247,7 +247,7 @@ public class DPlayer {
return;
}
}
for(Player player:dgroup.players){
DPlayer dplayer=get(player);
dplayer.leave();
@ -255,7 +255,7 @@ public class DPlayer {
}
}
}
public void msg(String msg){
if(this.isEditing){
EditWorld eworld=EditWorld.get(this.world);
@ -265,7 +265,7 @@ public class DPlayer {
p.msg(player, ChatColor.GREEN+"[Chatspy] "+ChatColor.WHITE+msg);
}
}
}else{
GameWorld gworld=GameWorld.get(this.world);
gworld.msg(msg);
@ -276,39 +276,39 @@ public class DPlayer {
}
}
}
public void setClass(String classname) {
GameWorld gworld=GameWorld.get(this.player.getWorld());
if(gworld==null) return;
DClass dclass=gworld.confReader.getClass(classname);
if(dclass!=null){
if(this.dclass!=dclass){
this.dclass=dclass;
//Set Dog
if(this.wolf!=null){
this.wolf.remove();
this.wolf=null;
}
if(dclass.hasDog){
this.wolf=(Wolf) this.world.spawnEntity(this.player.getLocation(), EntityType.WOLF);
this.wolf.setTamed(true);
this.wolf.setOwner(this.player);
this.wolf.setHealth(this.wolf.getMaxHealth());
}
//Delete Inventory
this.classItems.clear();
this.player.getInventory().clear();
this.player.getInventory().setArmorContents(null);
player.getInventory().setItemInHand(new ItemStack(0));
DungeonsXL.p.updateInventory(this.player);
//DungeonsXL.p.updateInventory(this.player);
//Set Inventory
for(ItemStack istack:dclass.items){
//Leggings
if(istack.getTypeId()==300||
istack.getTypeId()==304||
@ -345,43 +345,43 @@ public class DPlayer {
{
this.player.getInventory().setBoots(istack);
}
else{
this.player.getInventory().addItem(istack);
}
DungeonsXL.p.updateInventory(this.player);
//DungeonsXL.p.updateInventory(this.player);
}
for(int i=0;i<36;i++){
ItemStack istack=this.player.getInventory().getItem(i);
if(istack!=null){
this.classItems.add(i);
}
}
DungeonsXL.p.updateInventory(this.player);
//DungeonsXL.p.updateInventory(this.player);
}
}
}
public void setCheckpoint(GameCheckpoint checkpoint){
this.checkpoint=checkpoint;
}
public void addTreasure(){
new DLootInventory(this.player,this.treasureInv.getContents());
}
//Static
public static void remove(DPlayer player){
players.remove(player);
}
public static DPlayer get(Player player){
EditWorld eworld=EditWorld.get(player.getWorld());
boolean isEditing=false;
@ -397,16 +397,16 @@ public class DPlayer {
}
return null;
}
public static CopyOnWriteArrayList<DPlayer> get(World world){
CopyOnWriteArrayList<DPlayer> dplayers=new CopyOnWriteArrayList<DPlayer>();
for(DPlayer dplayer:players){
if(dplayer.world==world){
dplayers.add(dplayer);
}
}
return dplayers;
}
@ -429,7 +429,7 @@ public class DPlayer {
GameWorld gworld=GameWorld.get(dplayer.world);
if(gworld!=null){
if(gworld!=null){
DGroup dgroup=DGroup.get(dplayer.player);
if(dplayer.checkpoint==null){
dplayer.player.teleport(dgroup.gworld.locStart);
@ -442,8 +442,8 @@ public class DPlayer {
dplayer.wolf.teleport(dplayer.checkpoint.location);
}
}
//Respawn Items
for(ItemStack istack:dplayer.respawnInventory){
if(istack!=null){
@ -451,7 +451,7 @@ public class DPlayer {
}
}
dplayer.respawnInventory.clear();
DungeonsXL.p.updateInventory(dplayer.player);
//DungeonsXL.p.updateInventory(dplayer.player);
}
}
}
@ -484,9 +484,9 @@ public class DPlayer {
offplayer.oldFoodLevel=dplayer.oldFoodLevel;
offplayer.oldGamemode=dplayer.oldGamemode;
offplayer.oldLvl=dplayer.oldLvl;
remove(dplayer);
if(dplayer.isEditing){
EditWorld eworld=EditWorld.get(dplayer.world);
if(eworld!=null){
@ -505,14 +505,14 @@ public class DPlayer {
}
}
}
}
//Update ClassItems
for(Integer istackplace:dplayer.classItems){
ItemStack istack=dplayer.player.getInventory().getItem(istackplace);
if(istack!=null){
if(istack.getTypeId()!=0){
if(istack.getTypeId()>255 && istack.getTypeId()<318){

View File

@ -12,18 +12,13 @@ import java.util.logging.Level;
import java.util.logging.Logger;
import net.milkbowl.vault.permission.Permission;
import net.minecraft.server.Packet103SetSlot;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.craftbukkit.entity.CraftPlayer;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.event.Listener;
import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.RegisteredServiceProvider;
import org.bukkit.plugin.java.JavaPlugin;
@ -359,15 +354,15 @@ public class DungeonsXL extends JavaPlugin{
}
//Misc
public void updateInventory(Player p) {
/*public void updateInventory(Player p) {
CraftPlayer c = (CraftPlayer) p;
for (int i = 0;i < 36;i++) {
int nativeindex = i;
if (i < 9) nativeindex = i + 36;
ItemStack olditem = c.getInventory().getItem(i);
net.minecraft.server.ItemStack item = null;
net.minecraft.server.v1_4_6.ItemStack item = null;
if (olditem != null && olditem.getType() != Material.AIR) {
item = new net.minecraft.server.ItemStack(0, 0, 0);
item = new net.minecraft.server.v1_4_6.ItemStack(0, 0, 0);
item.id = olditem.getTypeId();
item.count = olditem.getAmount();
item.b = olditem.getDurability();
@ -379,7 +374,7 @@ public class DungeonsXL extends JavaPlugin{
}
}
}
}
}*/
//Msg

View File

@ -36,13 +36,13 @@ import com.dre.dungeonsxl.game.GameWorld;
public class PlayerListener implements Listener{
public DungeonsXL p=DungeonsXL.p;
@EventHandler(priority = EventPriority.HIGHEST)
public void onPlayerInteract(PlayerInteractEvent event){
Player player = event.getPlayer();
Block clickedBlock=event.getClickedBlock();
//Block Enderchests
if(clickedBlock!=null){
if(GameWorld.get(player.getWorld())!=null || EditWorld.get(player.getWorld())!=null){
@ -54,8 +54,8 @@ public class PlayerListener implements Listener{
}
}
}
//Check Portals
if(event.getItem()!=null){
if(event.getItem().getType()==Material.WOOD_SWORD){
@ -77,28 +77,28 @@ public class PlayerListener implements Listener{
}
}
}
//Check Signs
if(clickedBlock!=null){
if(clickedBlock.getTypeId()==68 || clickedBlock.getTypeId()==63){
//Check Group Signs
if(DGSign.playerInteract(event.getClickedBlock(), player)){
event.setCancelled(true);
}
//Leave Sign
if(LeaveSign.playerInteract(event.getClickedBlock(), player)){
event.setCancelled(true);
}
DPlayer dplayer=DPlayer.get(player);
if(dplayer!=null){
//Check GameWorld Signs
GameWorld gworld=GameWorld.get(player.getWorld());
if(gworld!=null){
@ -116,7 +116,7 @@ public class PlayerListener implements Listener{
}
}
}
//End Sign
for(Block blockEnd:gworld.blocksEnd){
if(blockEnd.getLocation().distance(clickedBlock.getLocation())<1){
@ -126,17 +126,17 @@ public class PlayerListener implements Listener{
}
}
}
//Leave Sign
for(Block blockLeave:gworld.blocksLeave){
if(blockLeave.getLocation().distance(clickedBlock.getLocation())<1){
dplayer.leave();
}
}
//Class Signs
for(Sign classSign:gworld.signClass){
if(classSign!=null){
if(classSign.getLocation().distance(clickedBlock.getLocation())<1){
@ -153,13 +153,13 @@ public class PlayerListener implements Listener{
}
}
}
}
@EventHandler(priority = EventPriority.HIGH)
public void onPlayerDropItem(PlayerDropItemEvent event){
Player player=event.getPlayer();
//Deny dropping things at the lobby
DGroup dgroup=DGroup.get(player);
if(dgroup!=null){
@ -171,7 +171,7 @@ public class PlayerListener implements Listener{
event.setCancelled(true);
return;
}
DPlayer dplayer=DPlayer.get(player);
GameWorld gworld=GameWorld.get(dplayer.world);
if(dplayer!=null){
@ -192,7 +192,7 @@ public class PlayerListener implements Listener{
}
}
}
@EventHandler(priority = EventPriority.LOWEST)
public void onPlayerRespawn(PlayerRespawnEvent event){
Player player=event.getPlayer();
@ -213,32 +213,32 @@ public class PlayerListener implements Listener{
DGroup dgroup=DGroup.get(dplayer.player);
if(dplayer.checkpoint==null){
event.setRespawnLocation(dgroup.gworld.locStart);
//Da einige Plugins einen anderen Respawn setzen wird ein Scheduler gestartet der den Player nach einer Sekunde teleportiert.
p.getServer().getScheduler().scheduleSyncDelayedTask(p, new RespawnRunnable(player,dgroup.gworld.locStart), 20);
if(dplayer.wolf!=null){
dplayer.wolf.teleport(dgroup.gworld.locStart);
}
}else{
event.setRespawnLocation(dplayer.checkpoint.location);
//Da einige Plugins einen anderen Respawn setzen wird ein Scheduler gestartet der den Player nach einer Sekunde teleportiert.
p.getServer().getScheduler().scheduleSyncDelayedTask(p, new RespawnRunnable(player,dplayer.checkpoint.location), 20);
if(dplayer.wolf!=null){
dplayer.wolf.teleport(dplayer.checkpoint.location);
}
}
}
}
}
}
@EventHandler(priority = EventPriority.HIGH)
public void onPlayerPortalEvent(PlayerPortalEvent event){
Player player=event.getPlayer();
@ -249,7 +249,7 @@ public class PlayerListener implements Listener{
dportal.teleport(player);
}
}
@EventHandler(priority = EventPriority.HIGH)
public void onPlayerTeleport(PlayerTeleportEvent event){
Player player=event.getPlayer();
@ -262,7 +262,7 @@ public class PlayerListener implements Listener{
}
}
}
@EventHandler(priority = EventPriority.HIGH)
public void onPlayerChat(AsyncPlayerChatEvent event){
Player player=event.getPlayer();
@ -274,7 +274,7 @@ public class PlayerListener implements Listener{
}
}
}
@EventHandler(priority = EventPriority.HIGH)
public void onPlayerQuit(PlayerQuitEvent event){
DPlayer dplayer=DPlayer.get(event.getPlayer());
@ -284,7 +284,7 @@ public class PlayerListener implements Listener{
dplayer.player.kickPlayer("");
}
}
@EventHandler(priority = EventPriority.HIGH)
public void onPlayerDeath(PlayerDeathEvent event){
DPlayer dplayer=DPlayer.get(event.getEntity());
@ -297,14 +297,14 @@ public class PlayerListener implements Listener{
}
}
}
//Deny Player Cmds
@EventHandler(priority = EventPriority.HIGH)
public void onPlayerCommand(PlayerCommandPreprocessEvent event){
if(DungeonsXL.p.permission.has(event.getPlayer(), "dungeonsxl.cmd")||event.getPlayer().isOp()){
return;
}
DPlayer dplayer=DPlayer.get(event.getPlayer());
if(dplayer!=null){
if(!dplayer.isEditing){
@ -316,14 +316,14 @@ public class PlayerListener implements Listener{
}
}
}
//Inventory Events
@EventHandler(priority = EventPriority.HIGH)
public void onInventoryOpen(InventoryOpenEvent event){
GameChest.onOpenInventory(event);
}
@EventHandler
public void onInventoryClose(InventoryCloseEvent event){
Player player =(Player) event.getPlayer();
@ -335,19 +335,19 @@ public class PlayerListener implements Listener{
player.getWorld().dropItem(player.getLocation(), istack);
}
}
DLootInventory.LootInventorys.remove(inventory);
}
}
}
}
//Player move
@EventHandler
public void onPlayerMove(PlayerMoveEvent event){
Player player=event.getPlayer();
DLootInventory inventory=DLootInventory.get(player);
if(inventory!=null){
if(player.getLocation().getBlock().getType()!=Material.PORTAL){
if(
@ -364,24 +364,24 @@ public class PlayerListener implements Listener{
}
}
}
//Etc. ---------------------------------
public class RespawnRunnable implements Runnable{
private Player player;
private Location location;
public RespawnRunnable(Player player, Location location){
this.location = location;
this.player = player;
}
@Override
public void run() {
this.player.teleport(this.location);
DPlayer dplayer = DPlayer.get(this.player);
if(dplayer!=null){
//Respawn Items
for(ItemStack istack:dplayer.respawnInventory){
@ -390,11 +390,11 @@ public class PlayerListener implements Listener{
}
}
dplayer.respawnInventory.clear();
DungeonsXL.p.updateInventory(this.player);
//DungeonsXL.p.updateInventory(this.player);
}
}
}
}