Added Spout class skins

This commit is contained in:
Grafe 2013-01-16 03:28:53 +01:00
parent ce1fa28ae6
commit b037078c87
4 changed files with 39 additions and 19 deletions

View File

@ -9,9 +9,13 @@ public class DClass {
public String name;
public boolean hasDog;
public DClass(String name,CopyOnWriteArrayList<ItemStack> items,boolean hasDog){
this.items=items;
this.name=name;
this.hasDog=hasDog;
//Spout
public String spoutSkinURL;
public DClass(String name, CopyOnWriteArrayList<ItemStack> items, boolean hasDog, String spoutSkinURL){
this.items = items;
this.name = name;
this.hasDog = hasDog;
this.spoutSkinURL = spoutSkinURL;
}
}

View File

@ -98,7 +98,17 @@ public class DConfig {
istacks.add(istack);
}
}
this.dClasses.add(new DClass(name,istacks,hasDog));
/* Spout */
String spoutSkinURL = null;
if(P.p.isSpoutEnabled){
if(configSetionClasses.contains(className+".spoutSkinURL")){
spoutSkinURL = configSetionClasses.getString(className+".spoutSkinURL");
}
}
/* Create Class */
this.dClasses.add(new DClass(name,istacks,hasDog,spoutSkinURL));
}
}

View File

@ -305,7 +305,7 @@ public class DPlayer {
if(this.dclass!=dclass){
this.dclass=dclass;
//Set Dog
/* Set Dog */
if(this.wolf!=null){
this.wolf.remove();
this.wolf=null;
@ -318,14 +318,13 @@ public class DPlayer {
this.wolf.setHealth(this.wolf.getMaxHealth());
}
//Delete Inventory
/* Delete Inventory */
this.classItems.clear();
this.player.getInventory().clear();
this.player.getInventory().setArmorContents(null);
player.getInventory().setItemInHand(new ItemStack(0));
//P.p.updateInventory(this.player);
//Set Inventory
/* Set Inventory */
for(ItemStack istack:dclass.items){
//Leggings
@ -368,10 +367,6 @@ public class DPlayer {
else{
this.player.getInventory().addItem(istack);
}
//P.p.updateInventory(this.player);
}
for(int i=0;i<36;i++){
@ -380,10 +375,20 @@ public class DPlayer {
this.classItems.add(i);
}
}
//P.p.updateInventory(this.player);
/* Spout Skin */
if(p.isSpoutEnabled){
if(this.dclass.spoutSkinURL!=null){
try{
Spout.getServer().getPlayer(player.getName()).setSkin(this.dclass.spoutSkinURL);
} catch(UnsupportedOperationException exception) {
p.log(p.language.get("Log_Error_Spout_Skin", this.dclass.name));
Spout.getServer().getPlayer(player.getName()).resetSkin();
}
} else {
Spout.getServer().getPlayer(player.getName()).resetSkin();
}
}
}
}
}

View File

@ -42,7 +42,8 @@ public class LanguageReader {
defaults.put("Log_Error_MobEnchantment","Error at loading mob.yml: Enchantmet &v1 doesn't exist!");
defaults.put("Log_Error_MobType","Error at loading mob.yml: Mob &v1 doesn't exist!");
defaults.put("Log_Error_Spout","Spout wurde nicht gefunden!");
defaults.put("Log_Error_Spout_Skin","Der Spout Skin von &v1 ist kein png!");
/* Player */
defaults.put("Player_CheckpointReached","&6Checkpoint erreicht!");
defaults.put("Player_LootAdded","&6Deinem Belohnungsinventar sind&4&v1&6 hinzugefügt worden!");