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 String name;
public boolean hasDog; public boolean hasDog;
public DClass(String name,CopyOnWriteArrayList<ItemStack> items,boolean hasDog){ //Spout
public String spoutSkinURL;
public DClass(String name, CopyOnWriteArrayList<ItemStack> items, boolean hasDog, String spoutSkinURL){
this.items = items; this.items = items;
this.name = name; this.name = name;
this.hasDog = hasDog; this.hasDog = hasDog;
this.spoutSkinURL = spoutSkinURL;
} }
} }

View File

@ -98,7 +98,17 @@ public class DConfig {
istacks.add(istack); 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){ if(this.dclass!=dclass){
this.dclass=dclass; this.dclass=dclass;
//Set Dog /* Set Dog */
if(this.wolf!=null){ if(this.wolf!=null){
this.wolf.remove(); this.wolf.remove();
this.wolf=null; this.wolf=null;
@ -318,14 +318,13 @@ public class DPlayer {
this.wolf.setHealth(this.wolf.getMaxHealth()); this.wolf.setHealth(this.wolf.getMaxHealth());
} }
//Delete Inventory /* Delete Inventory */
this.classItems.clear(); this.classItems.clear();
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));
//P.p.updateInventory(this.player);
//Set Inventory /* Set Inventory */
for(ItemStack istack:dclass.items){ for(ItemStack istack:dclass.items){
//Leggings //Leggings
@ -368,10 +367,6 @@ public class DPlayer {
else{ else{
this.player.getInventory().addItem(istack); this.player.getInventory().addItem(istack);
} }
//P.p.updateInventory(this.player);
} }
for(int i=0;i<36;i++){ for(int i=0;i<36;i++){
@ -381,9 +376,19 @@ public class DPlayer {
} }
} }
/* Spout Skin */
//P.p.updateInventory(this.player); 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,6 +42,7 @@ public class LanguageReader {
defaults.put("Log_Error_MobEnchantment","Error at loading mob.yml: Enchantmet &v1 doesn't exist!"); 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_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","Spout wurde nicht gefunden!");
defaults.put("Log_Error_Spout_Skin","Der Spout Skin von &v1 ist kein png!");
/* Player */ /* Player */
defaults.put("Player_CheckpointReached","&6Checkpoint erreicht!"); defaults.put("Player_CheckpointReached","&6Checkpoint erreicht!");