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.HashSet;
import java.util.Set; import java.util.Set;
import net.minecraft.server.Item; import net.minecraft.server.v1_4_6.Item;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.craftbukkit.entity.CraftSkeleton; import org.bukkit.craftbukkit.v1_4_6.entity.CraftSkeleton;
import org.bukkit.craftbukkit.entity.CraftZombie; import org.bukkit.craftbukkit.v1_4_6.entity.CraftZombie;
import org.bukkit.craftbukkit.inventory.CraftItemStack; import org.bukkit.craftbukkit.v1_4_6.inventory.CraftItemStack;
import org.bukkit.entity.EntityType; import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
@ -38,6 +38,7 @@ public class DMobType {
this.name=name; this.name=name;
this.type=type; this.type=type;
} }
public void spawn(GameWorld gWorld, Location loc){ public void spawn(GameWorld gWorld, Location loc){
@ -50,25 +51,25 @@ public class DMobType {
//Check if it's a Zombie //Check if it's a Zombie
if(type==EntityType.ZOMBIE){ if(type==EntityType.ZOMBIE){
CraftZombie entityC = (CraftZombie)entity; CraftZombie entityC = (CraftZombie)entity;
net.minecraft.server.EntityZombie entityMC = entityC.getHandle(); net.minecraft.server.v1_4_6.EntityZombie entityMC = entityC.getHandle();
if(ItemHand!=null) entityMC.setEquipment(0, new net.minecraft.server.ItemStack(ItemHand)); 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.ItemStack(ItemBoots)); 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.ItemStack(ItemLeggings)); 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.ItemStack(ItemChestplate)); 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.ItemStack(ItemHelmet)); if(ItemHelmet!=null) entityMC.setEquipment(4, new net.minecraft.server.v1_4_6.ItemStack(ItemHelmet));
} }
//Check if it's a Skeleton //Check if it's a Skeleton
if(type==EntityType.SKELETON){ if(type==EntityType.SKELETON){
CraftSkeleton entityC = (CraftSkeleton)entity; CraftSkeleton entityC = (CraftSkeleton)entity;
net.minecraft.server.EntitySkeleton entityMC = entityC.getHandle(); net.minecraft.server.v1_4_6.EntitySkeleton entityMC = entityC.getHandle();
if(ItemHand!=null) entityMC.setEquipment(0, new net.minecraft.server.ItemStack(ItemHand)); 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.ItemStack(ItemBoots)); 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.ItemStack(ItemLeggings)); 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.ItemStack(ItemChestplate)); 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.ItemStack(ItemHelmet)); if(ItemHelmet!=null) entityMC.setEquipment(4, new net.minecraft.server.v1_4_6.ItemStack(ItemHelmet));
} }
/* Spawn Mob */ /* Spawn Mob */
@ -98,23 +99,23 @@ public class DMobType {
//Load Items //Load Items
if(configFile.contains(mobName+".ItemHelmet")){ 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")){ 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")){ 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")){ 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")){ 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();
} }
} }
} }

View File

@ -174,7 +174,7 @@ public class DPlayer {
} }
} }
} }
DungeonsXL.p.updateInventory(groupplayer); //DungeonsXL.p.updateInventory(groupplayer);
} }
i++; i++;
}while(groupplayer==null); }while(groupplayer==null);
@ -188,7 +188,7 @@ public class DPlayer {
DungeonsXL.p.updateInventory(this.player); //DungeonsXL.p.updateInventory(this.player);
} }
public void ready(){ public void ready(){
@ -230,7 +230,7 @@ public class DPlayer {
} }
} }
this.respawnInventory.clear(); this.respawnInventory.clear();
DungeonsXL.p.updateInventory(this.player); //DungeonsXL.p.updateInventory(this.player);
} }
public void finish(){ public void finish(){
@ -304,7 +304,7 @@ public class DPlayer {
this.player.getInventory().clear(); this.player.getInventory().clear();
this.player.getInventory().setArmorContents(null); this.player.getInventory().setArmorContents(null);
player.getInventory().setItemInHand(new ItemStack(0)); player.getInventory().setItemInHand(new ItemStack(0));
DungeonsXL.p.updateInventory(this.player); //DungeonsXL.p.updateInventory(this.player);
//Set Inventory //Set Inventory
for(ItemStack istack:dclass.items){ for(ItemStack istack:dclass.items){
@ -352,7 +352,7 @@ public class DPlayer {
DungeonsXL.p.updateInventory(this.player); //DungeonsXL.p.updateInventory(this.player);
} }
for(int i=0;i<36;i++){ for(int i=0;i<36;i++){
@ -363,7 +363,7 @@ public class DPlayer {
} }
DungeonsXL.p.updateInventory(this.player); //DungeonsXL.p.updateInventory(this.player);
} }
} }
@ -451,7 +451,7 @@ public class DPlayer {
} }
} }
dplayer.respawnInventory.clear(); dplayer.respawnInventory.clear();
DungeonsXL.p.updateInventory(dplayer.player); //DungeonsXL.p.updateInventory(dplayer.player);
} }
} }
} }

View File

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

View File

@ -390,7 +390,7 @@ public class PlayerListener implements Listener{
} }
} }
dplayer.respawnInventory.clear(); dplayer.respawnInventory.clear();
DungeonsXL.p.updateInventory(this.player); //DungeonsXL.p.updateInventory(this.player);
} }
} }