Browse Source

Another WIP

nossr50 14 years ago
parent
commit
b48deabbc8

+ 8 - 0
mcMMO/Changelog.txt

@@ -1,5 +1,13 @@
 Changelog:
 #Versions without changelogs probably had very small misc fixes, like tweaks to the source code
+Version 1.1.11
+mcMMO now properly cancels its Async taks when disabled
+Fixed newly generated configs using 2 instead of 1 for skill multipliers
+
+Version 1.1.10
+Added default hud setting to config
+Fixed bug where newly generated configs used old xp gain numbers
+
 Version 1.1.09
 Fixed mcMMO to run fine without Spout :)
 

+ 1 - 1
mcMMO/com/gmail/nossr50/Database.java

@@ -43,7 +43,7 @@ public class Database {
 	//Create the DB structure
 	public void createStructure(){
 		Write("CREATE TABLE IF NOT EXISTS `"+LoadProperties.MySQLtablePrefix+"huds` (`user_id` int(10) unsigned NOT NULL," +
-				"`hudtype` varchar(50) NOT NULL DEFAULT 'STANDARD'," +
+				"`hudtype` varchar(50) NOT NULL DEFAULT ''," +
 				"PRIMARY KEY (`user_id`)) ENGINE=MyISAM DEFAULT CHARSET=latin1;");
 		Write("CREATE TABLE IF NOT EXISTS `"+LoadProperties.MySQLtablePrefix+"users` (`id` int(10) unsigned NOT NULL AUTO_INCREMENT," +
 				"`user` varchar(40) NOT NULL," +

+ 0 - 31
mcMMO/com/gmail/nossr50/command/Commands.java

@@ -1148,13 +1148,6 @@ public class Commands
 				PP.acceptInvite();
 				Pinstance.addToParty(player, PP, PP.getParty(), true);
 				
-				//Refresh party hp bars
-				if(LoadProperties.partybar && LoadProperties.spoutEnabled)
-				{
-					SpoutStuff.resetPartyHealthBarDisplays(Party.getInstance().getPartyMembers(player));
-					SpoutStuff.resetPartyHealthBarDisplays(player);
-				}
-				
 			} else 
 			{
 				player.sendMessage(mcLocale.getString("mcPlayerListener.NoInvites")); 
@@ -1175,12 +1168,6 @@ public class Commands
 			{
 				Pinstance.addToParty(player, PP, PP.getParty(), false);
 				
-				//Refresh party hp bars
-				if(LoadProperties.partybar && LoadProperties.spoutEnabled)
-				{
-					SpoutStuff.resetPartyHealthBarDisplays(Party.getInstance().getPartyMembers(player));
-					SpoutStuff.resetPartyHealthBarDisplays(player);
-				}
 			}
 			
 			if(args.length == 0 && !PP.inParty())
@@ -1283,16 +1270,7 @@ public class Commands
 				{
 					if(PP.inParty()) 
 					{
-						ArrayList<Player> partymembers = Party.getInstance().getPartyMembers(player);
-						
 						Pinstance.removeFromParty(player, PP);
-						
-						//Refresh party hp bars
-						if(LoadProperties.partybar && LoadProperties.spoutEnabled)
-						{
-							SpoutStuff.resetPartyHealthBarDisplays(partymembers);
-							SpoutStuff.resetPartyHealthBarDisplays(player);
-						}
 					}
 					Pinstance.addToParty(player, PP, args[0], false);
 					return true;
@@ -1343,17 +1321,8 @@ public class Commands
 								}
 								PlayerProfile tPP = Users.getProfile(tPlayer);
 								
-								ArrayList<Player> partymembers = Party.getInstance().getPartyMembers(player);
-								
 								Pinstance.removeFromParty(tPlayer, tPP);
 								
-								//Refresh party hp bars
-								if(LoadProperties.partybar && LoadProperties.spoutEnabled)
-								{
-									SpoutStuff.resetPartyHealthBarDisplays(partymembers);
-									SpoutStuff.resetPartyHealthBarDisplays(player);
-								}
-								
 								tPlayer.sendMessage(mcLocale.getString("mcPlayerListener.LeftParty"));
 							}
 						} else {

+ 65 - 51
mcMMO/com/gmail/nossr50/config/LoadProperties.java

@@ -3,6 +3,8 @@ package com.gmail.nossr50.config;
 import java.io.File;
 import org.bukkit.util.config.Configuration;
 
+import com.gmail.nossr50.datatypes.HUDType;
+
 public class LoadProperties 
 {
 	public static Boolean watch, xplockEnable, xpbar, xpicon, partybar, string, bucket, web, xprateEnable, slimeballs, spoutEnabled, 
@@ -31,6 +33,8 @@ public class LoadProperties
 	repairxpmodifier, woodcuttingxpmodifier, sorceryxpmodifier, unarmedxpmodifier, herbalismxpmodifier, excavationxpmodifier,
 	archeryxpmodifier, swordsxpmodifier, axesxpmodifier, acrobaticsxpmodifier;
 	
+	public static HUDType defaulthud;
+	
 	public String directory = "plugins/mcMMO/"; 
 	
 	File file = new File(directory + File.separator + "config.yml");
@@ -109,6 +113,7 @@ public class LoadProperties
 	        System.out.println("Generating Config File...");  	
 	    	
 	        //Put in defaults
+	        write("Spout.HUD.Default", "STANDARD");
 	        write("Spout.XP.Bar.Enabled", true);
 	        write("Spout.Images.URL_DIR", "http://mcmmo.rycochet.net/mcmmo/");
 	        write("Spout.XP.Icon.Enabled", true);
@@ -181,57 +186,56 @@ public class LoadProperties
 	    	write("Experience.PVP.Rewards", true);
 	    	write("Experience.Gains.Multiplier.PVP", 1);
 	    	write("Experience.Gains.Mobspawners.Enabled", false);
-	    	write("Experience.Gains.Multiplier.Global", 1);
-	    	write("Experience.Formula.Multiplier.Global", 1);
-	    	write("Experience.Formula.Multiplier.Taming", 2);
-	    	write("Experience.Formula.Multiplier.Mining", 2);
-	    	write("Experience.Formula.Multiplier.Repair", 2);
-	    	write("Experience.Formula.Multiplier.Woodcutting", 2);
-	    	write("Experience.Formula.Multiplier.Unarmed", 2);
-	    	write("Experience.Formula.Multiplier.Herbalism", 2);
-	    	write("Experience.Formula.Multiplier.Excavation", 2);
-	    	write("Experience.Formula.Multiplier.Swords", 2);
-	    	write("Experience.Formula.Multiplier.Archery", 2);
-	    	write("Experience.Formula.Multiplier.Axes", 2);
-	    	write("Experience.Formula.Multiplier.Sorcery", 2);
-	    	write("Experience.Formula.Multiplier.Acrobatics", 2);
-	    	write("Experience.Mining.Gold", 35);
-	    	write("Experience.Mining.Diamond", 75);
-	    	write("Experience.Mining.Iron", 25);
-	    	write("Experience.Mining.Redstone", 15);
-	    	write("Experience.Mining.lapis", 40);
-	    	write("Experience.Mining.Obsidian", 15);
-	    	write("Experience.Mining.Netherrack", 3);
-	    	write("Experience.Mining.Glowstone", 3);
-	    	write("Experience.Mining.Coal", 10);
-	    	write("Experience.Mining.Stone", 3);
-	    	write("Experience.Mining.Sandstone", 3);
-	    	write("Experience.Herbalism.Sugar_Cane", 3);
-	    	write("Experience.Herbalism.Cactus", 3);
-	    	write("Experience.Herbalism.Pumpkin", 55);
-	    	write("Experience.Herbalism.Flowers", 10);
-	    	write("Experience.Herbalism.Wheat", 5);
-	    	write("Experience.Herbalism.Mushrooms", 15);
-	    	write("Experience.Woodcutting.Pine", 9);
-	    	write("Experience.Woodcutting.Birch", 7);
-	    	write("Experience.Woodcutting.Spruce", 8);
-	    	write("Experience.Excavation.Base", 4);
-	    	write("Experience.Excavation.Mushroom", 8);
-	    	write("Experience.Excavation.Sulphur", 3);
-	    	write("Experience.Excavation.Slowsand", 8);
-	    	write("Experience.Excavation.Glowstone", 8);
-	    	write("Experience.Excavation.Music", 300);
-	    	write("Experience.Excavation.Bones", 3);
-	    	write("Experience.Excavation.Diamond", 100);
-	    	write("Experience.Excavation.Apple", 10);
-	    	write("Experience.Excavation.Eggs", 10);
-	    	write("Experience.Excavation.Cake", 300);
-	    	write("Experience.Excavation.Slimeballs", 10);
-	    	write("Experience.Excavation.Cocoa_Beans", 10);
-	    	write("Experience.Excavation.Map", 20);
-	    	write("Experience.Excavation.String", 20);
-	    	write("Experience.Excavation.Bucket", 10);
-	    	write("Experience.Excavation.Web", 15);
+	    	write("Experience.Gains.Multiplier.Global", 1.0);
+	    	write("Experience.Formula.Multiplier.Taming", 1.0);
+	    	write("Experience.Formula.Multiplier.Mining", 1.0);
+	    	write("Experience.Formula.Multiplier.Repair", 1.0);
+	    	write("Experience.Formula.Multiplier.Woodcutting", 1.0);
+	    	write("Experience.Formula.Multiplier.Unarmed", 1.0);
+	    	write("Experience.Formula.Multiplier.Herbalism", 1.0);
+	    	write("Experience.Formula.Multiplier.Excavation", 1.0);
+	    	write("Experience.Formula.Multiplier.Swords", 1.0);
+	    	write("Experience.Formula.Multiplier.Archery", 1.0);
+	    	write("Experience.Formula.Multiplier.Axes", 1.0);
+	    	write("Experience.Formula.Multiplier.Sorcery", 1.0);
+	    	write("Experience.Formula.Multiplier.Acrobatics", 1.0);
+	    	write("Experience.Mining.Gold", 350);
+	    	write("Experience.Mining.Diamond", 750);
+	    	write("Experience.Mining.Iron", 250);
+	    	write("Experience.Mining.Redstone", 150);
+	    	write("Experience.Mining.lapis", 400);
+	    	write("Experience.Mining.Obsidian", 150);
+	    	write("Experience.Mining.Netherrack", 30);
+	    	write("Experience.Mining.Glowstone", 30);
+	    	write("Experience.Mining.Coal", 100);
+	    	write("Experience.Mining.Stone", 30);
+	    	write("Experience.Mining.Sandstone", 30);
+	    	write("Experience.Herbalism.Sugar_Cane", 30);
+	    	write("Experience.Herbalism.Cactus", 30);
+	    	write("Experience.Herbalism.Pumpkin", 550);
+	    	write("Experience.Herbalism.Flowers", 100);
+	    	write("Experience.Herbalism.Wheat", 50);
+	    	write("Experience.Herbalism.Mushrooms", 150);
+	    	write("Experience.Woodcutting.Pine", 90);
+	    	write("Experience.Woodcutting.Birch", 70);
+	    	write("Experience.Woodcutting.Spruce", 80);
+	    	write("Experience.Excavation.Base", 40);
+	    	write("Experience.Excavation.Mushroom", 80);
+	    	write("Experience.Excavation.Sulphur", 30);
+	    	write("Experience.Excavation.Slowsand", 80);
+	    	write("Experience.Excavation.Glowstone", 80);
+	    	write("Experience.Excavation.Music", 3000);
+	    	write("Experience.Excavation.Bones", 30);
+	    	write("Experience.Excavation.Diamond", 1000);
+	    	write("Experience.Excavation.Apple", 100);
+	    	write("Experience.Excavation.Eggs", 100);
+	    	write("Experience.Excavation.Cake", 3000);
+	    	write("Experience.Excavation.Slimeballs", 100);
+	    	write("Experience.Excavation.Cocoa_Beans", 100);
+	    	write("Experience.Excavation.Map", 200);
+	    	write("Experience.Excavation.String", 200);
+	    	write("Experience.Excavation.Bucket", 100);
+	    	write("Experience.Excavation.Web", 150);
 	    	
 	    	//write("Sorcery.Spells.Water.Thunder", 75);
 	    	//write("Sorcery.Spells.Curative.Cure_Self.Mana_Cost", 5);
@@ -327,6 +331,16 @@ public class LoadProperties
 	    {
 	        System.out.println("Loading Config File...");
 	        
+	        //Setup default HUD
+	        String temp = readString("Spout.HUD.Default", "STANDARD");
+	        for(HUDType x : HUDType.values())
+	        {
+	        	if(x.toString().equalsIgnoreCase(temp))
+	        	{
+	        		defaulthud = x;
+	        	}
+	        }
+	        
 	        donateMessage = readBoolean("Commands.mcmmo.Donate_Message", true);
 	        xpGainsMobSpawners = readBoolean("XP.Gains.Mobspawners.Enabled", false);
 	        

+ 2 - 7
mcMMO/com/gmail/nossr50/datatypes/HUDmmo.java

@@ -15,6 +15,7 @@ import com.gmail.nossr50.m;
 import com.gmail.nossr50.mcMMO;
 import com.gmail.nossr50.config.LoadProperties;
 import com.gmail.nossr50.spout.SpoutStuff;
+import com.gmail.nossr50.spout.mmoHelper;
 
 public class HUDmmo 
 {
@@ -94,13 +95,7 @@ public class HUDmmo
 			xpbg = null;
 			xpicon = null;
 			
-			if(SpoutStuff.partyHealthBars.containsKey(sPlayer))
-			{
-				SpoutStuff.partyHealthBars.remove(sPlayer);
-				if(LoadProperties.partybar && Users.getProfile(sPlayer).inParty())
-					SpoutStuff.initializePartyTracking(sPlayer);
-			}
-			
+			mmoHelper.initialize(sPlayer, plugin);
 			sPlayer.getMainScreen().setDirty(true);
 		}
 	}

+ 9 - 4
mcMMO/com/gmail/nossr50/datatypes/PlayerProfile.java

@@ -24,7 +24,7 @@ public class PlayerProfile
     protected final Logger log = Logger.getLogger("Minecraft");
     
     //HUD
-    private HUDType hud = HUDType.STANDARD;
+    private HUDType hud;
     
     //MISC
 	private String party, myspawn, myspawnworld, invite;
@@ -61,7 +61,7 @@ public class PlayerProfile
         
 	public PlayerProfile(Player player)
 	{
-		
+		hud = LoadProperties.defaulthud;
 		//Setup the HashMap for the skills
 		for(SkillType skillType : SkillType.values())
 		{
@@ -108,6 +108,8 @@ public class PlayerProfile
 			{
 				mcMMO.database.Write("INSERT INTO "+LoadProperties.MySQLtablePrefix+"huds (user_id) VALUES ("+id+")");
 			} else {
+				if(huds.get(1).get(0) != null)
+				{
 				for(HUDType x : HUDType.values())
 				{
 					if(x.toString().equals(huds.get(1).get(0)))
@@ -115,6 +117,9 @@ public class PlayerProfile
 						hud = x;
 					}
 				}
+				} else {
+					hud = LoadProperties.defaulthud;
+				}
 			}
 			HashMap<Integer, ArrayList<String>> users = mcMMO.database.Read("SELECT lastlogin, party FROM "+LoadProperties.MySQLtablePrefix+"users WHERE id = " + id);
 				//lastlogin = Integer.parseInt(users.get(1).get(0));
@@ -268,7 +273,7 @@ public class PlayerProfile
     			{
     				for(HUDType x : HUDType.values())
     				{
-    					if(x.toString().equals(character[33]))
+    					if(x.toString().equalsIgnoreCase(character[33]))
     					{
     						hud = x;
     					}
@@ -443,7 +448,7 @@ public class PlayerProfile
             out.append(0+":"); //DATS
             out.append(0+":"); //DATS
             out.append(0+":"); //DATS
-            out.append("STANDARD"+":");//HUD
+            out.append(LoadProperties.defaulthud.toString()+":");//HUD
 
             //Add more in the same format as the line above
             

+ 0 - 4
mcMMO/com/gmail/nossr50/listeners/mcEntityListener.java

@@ -26,7 +26,6 @@ import com.gmail.nossr50.party.Party;
 import com.gmail.nossr50.skills.Acrobatics;
 import com.gmail.nossr50.skills.Skills;
 import com.gmail.nossr50.skills.Taming;
-import com.gmail.nossr50.spout.SpoutStuff;
 
 
 public class mcEntityListener extends EntityListener 
@@ -142,9 +141,6 @@ public class mcEntityListener extends EntityListener
 			    		{
 			    			Users.getProfile(herpderp).setRecentlyHurt(System.currentTimeMillis());
 			    		}
-			    		
-			    		if(LoadProperties.partybar && LoadProperties.spoutEnabled && Users.getProfile(herpderp).inParty())
-			    			SpoutStuff.updatePartyHealthBarDisplay(herpderp, herpderp.getHealth()-event.getDamage());
 			    	}
 		    	}
 	    	}

+ 3 - 14
mcMMO/com/gmail/nossr50/listeners/mcPlayerListener.java

@@ -27,6 +27,7 @@ import com.gmail.nossr50.mcPermissions;
 import com.gmail.nossr50.command.Commands;
 import com.gmail.nossr50.config.LoadProperties;
 import com.gmail.nossr50.spout.SpoutStuff;
+import com.gmail.nossr50.spout.mmoHelper;
 import com.gmail.nossr50.datatypes.PlayerProfile;
 import com.gmail.nossr50.datatypes.SkillType;
 import com.gmail.nossr50.locale.mcLocale;
@@ -76,10 +77,6 @@ public class mcPlayerListener extends PlayerListener
 				}
 			}
 		}
-		if(LoadProperties.partybar && LoadProperties.spoutEnabled && PP.inParty())
-		{
-			SpoutStuff.updatePartyHealthBarDisplay(player, 20);
-		}
 	}
 	
 	public void onPlayerLogin(PlayerLoginEvent event) 
@@ -96,16 +93,12 @@ public class mcPlayerListener extends PlayerListener
 		//Discard the PlayerProfile object
 		Player player = event.getPlayer();
 		
-		//Health bar stuff
-		if(LoadProperties.spoutEnabled && Users.getProfile(player).inParty())
-			SpoutStuff.resetPartyHealthBarDisplays(Party.getInstance().getPartyMembers(player));
-		
 		if(LoadProperties.spoutEnabled)
 		{
 			if(SpoutStuff.playerHUDs.containsKey(player))
 				SpoutStuff.playerHUDs.remove(player);
-			if(SpoutStuff.partyHealthBars.containsKey(event.getPlayer()))
-				SpoutStuff.partyHealthBars.remove(event.getPlayer());
+			if(mmoHelper.containers.containsKey(player))
+				mmoHelper.containers.remove(player);
 		}
 		
 		Users.removeUser(event.getPlayer());
@@ -123,10 +116,6 @@ public class mcPlayerListener extends PlayerListener
 		}
 		if(Commands.xpevent)
 			player.sendMessage(ChatColor.GOLD+"mcMMO is currently in an XP rate event! XP rate is "+LoadProperties.xpGainMultiplier+"x!");
-		
-		//Health bar stuff
-		if(LoadProperties.spoutEnabled && Users.getProfile(player).inParty())
-			SpoutStuff.resetPartyHealthBarDisplays(Party.getInstance().getPartyMembers(player));
 	}
 
 	@SuppressWarnings("deprecation")

+ 14 - 3
mcMMO/com/gmail/nossr50/listeners/mcSpoutListener.java

@@ -5,12 +5,20 @@ import org.getspout.spoutapi.event.spout.SpoutListener;
 import org.getspout.spoutapi.player.SpoutPlayer;
 
 import com.gmail.nossr50.Users;
-import com.gmail.nossr50.config.LoadProperties;
+import com.gmail.nossr50.mcMMO;
 import com.gmail.nossr50.datatypes.HUDmmo;
 import com.gmail.nossr50.spout.SpoutStuff;
+import com.gmail.nossr50.spout.mmoHelper;
 
 public class mcSpoutListener extends SpoutListener
 {
+	mcMMO plugin = null;
+	
+	public mcSpoutListener(mcMMO pluginx)
+	{
+		plugin = pluginx;
+	}
+	
 	public void onSpoutCraftEnable(SpoutCraftEnableEvent event) 
 	{
 		SpoutPlayer sPlayer = event.getPlayer();
@@ -19,9 +27,12 @@ public class mcSpoutListener extends SpoutListener
 			//Setup Party HUD stuff
 			SpoutStuff.playerHUDs.put(sPlayer, new HUDmmo(sPlayer));
 			
-			if(LoadProperties.partybar && Users.getProfile(sPlayer).inParty())
-				SpoutStuff.initializePartyTracking(sPlayer);
+			//if(LoadProperties.partybar && Users.getProfile(sPlayer).inParty())
+				//SpoutStuff.initializePartyTracking(sPlayer);
+			
+			mmoHelper.initialize(sPlayer, plugin);
 			
+			//Party.update(sPlayer);
 			Users.getProfile(sPlayer).toggleSpoutEnabled();
 		}
 	}

+ 12 - 0
mcMMO/com/gmail/nossr50/mcMMO.java

@@ -6,6 +6,7 @@ import com.gmail.nossr50.datatypes.SkillType;
 import com.gmail.nossr50.command.Commands;
 import com.gmail.nossr50.config.*;
 import com.gmail.nossr50.spout.SpoutStuff;
+import com.gmail.nossr50.spout.mmoHelper;
 import com.gmail.nossr50.listeners.mcBlockListener;
 import com.gmail.nossr50.listeners.mcEntityListener;
 import com.gmail.nossr50.listeners.mcPlayerListener;
@@ -153,7 +154,17 @@ public class mcMMO extends JavaPlugin
 
 		for(Player player : getServer().getOnlinePlayers()){Users.addUser(player);} //In case of reload add all users back into PlayerProfile   
 		System.out.println(pdfFile.getName() + " version " + pdfFile.getVersion() + " is enabled!" );
+		
 		Bukkit.getServer().getScheduler().scheduleAsyncRepeatingTask(this, mcMMO_Timer, 0, 20);
+		
+		Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(this,
+				  new Runnable() {
+
+					  @Override
+					  public void run() {
+						  mmoHelper.updateAll();
+					  }
+				  }, 20, 20);
 	}
 
 	public PlayerProfile getPlayerProfile(Player player)
@@ -218,6 +229,7 @@ public class mcMMO extends JavaPlugin
 		return permissions;
 	}
 	public void onDisable() {
+		Bukkit.getServer().getScheduler().cancelTasks(this);
 		System.out.println("mcMMO was disabled."); 
 	}
 

+ 0 - 7
mcMMO/com/gmail/nossr50/mcTimer.java

@@ -5,7 +5,6 @@ import com.gmail.nossr50.config.LoadProperties;
 import com.gmail.nossr50.datatypes.PlayerProfile;
 import com.gmail.nossr50.skills.Skills;
 import com.gmail.nossr50.skills.Swords;
-import com.gmail.nossr50.spout.SpoutStuff;
 
 
 public class mcTimer implements Runnable
@@ -55,8 +54,6 @@ public class mcTimer implements Runnable
 				    	player.getHealth() > 0 && player.getHealth() < 20 
 				    	&& m.getPowerLevel(player) >= 1000){
 				    	player.setHealth(m.calculateHealth(player.getHealth(), 1));
-				    	if(LoadProperties.partybar && LoadProperties.spoutEnabled && Users.getProfile(player).inParty())
-				    		SpoutStuff.updatePartyHealthBarDisplay(player, player.getHealth());
 				    }
 				}
 				if(thecount == 40 || thecount == 80){
@@ -65,8 +62,6 @@ public class mcTimer implements Runnable
 			    		&& m.getPowerLevel(player) >= 500 
 			    		&& m.getPowerLevel(player) < 1000){
 			    		player.setHealth(m.calculateHealth(player.getHealth(), 1));
-			    		if(LoadProperties.partybar && LoadProperties.spoutEnabled && Users.getProfile(player).inParty())
-			    			SpoutStuff.updatePartyHealthBarDisplay(player, player.getHealth());
 			    	}
 				}
 				if(thecount == 80)
@@ -75,8 +70,6 @@ public class mcTimer implements Runnable
 			    		player.getHealth() > 0 && player.getHealth() < 20  
 			    		&& m.getPowerLevel(player) < 500){
 			    		player.setHealth(m.calculateHealth(player.getHealth(), 1));
-			    		if(LoadProperties.partybar && LoadProperties.spoutEnabled && Users.getProfile(player).inParty())
-			    			SpoutStuff.updatePartyHealthBarDisplay(player, player.getHealth());
 			    	}
 				}
 			}

+ 37 - 12
mcMMO/com/gmail/nossr50/party/Party.java

@@ -14,21 +14,37 @@ import java.util.Iterator;
 
 import org.bukkit.Bukkit;
 import org.bukkit.entity.Player;
-
 import com.gmail.nossr50.Users;
 import com.gmail.nossr50.mcMMO;
 import com.gmail.nossr50.config.LoadProperties;
 import com.gmail.nossr50.datatypes.PlayerProfile;
 import com.gmail.nossr50.locale.mcLocale;
-import com.gmail.nossr50.spout.SpoutStuff;
+import com.gmail.nossr50.spout.ArrayListString;
 
 
 public class Party 
 {
+	/*
+	 * This file is part of mmoMinecraft (http://code.google.com/p/mmo-minecraft/).
+	 * 
+	 * mmoMinecraft is free software: you can redistribute it and/or modify
+	 * it under the terms of the GNU General Public License as published by
+	 * the Free Software Foundation, either version 3 of the License, or
+	 * (at your option) any later version.
+	 *
+	 * This program is distributed in the hope that it will be useful,
+	 * but WITHOUT ANY WARRANTY; without even the implied warranty of
+	 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+	 * GNU General Public License for more details.
+
+	 * You should have received a copy of the GNU General Public License
+	 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+	 */
+	
 	public static String partyPlayersFile = mcMMO.maindirectory + File.separator + "FlatFileStuff" + File.separator + "partyPlayers";
 	public static String partyLocksFile = mcMMO.maindirectory + File.separator + "FlatFileStuff" + File.separator + "partyLocks";
 	public static String partyPasswordsFile = mcMMO.maindirectory + File.separator + "FlatFileStuff" + File.separator + "partyPasswords";
-	
+
 	HashMap<String, HashMap<String, Boolean>> partyPlayers = new HashMap<String, HashMap<String, Boolean>>();
 	HashMap<String, Boolean> partyLocks = new HashMap<String, Boolean>();
 	HashMap<String, String> partyPasswords = new HashMap<String, String>();
@@ -39,6 +55,7 @@ public class Party
     	plugin = instance;
     }
 	private static volatile Party instance;
+	
 	public static Party getInstance() 
 	{
     	if (instance == null) {
@@ -46,6 +63,7 @@ public class Party
     	}
     	return instance;
     }
+	
     public boolean inSameParty(Player playera, Player playerb){
     	if(Users.getProfile(playera) == null || Users.getProfile(playerb) == null)
     	{
@@ -119,6 +137,22 @@ public class Party
         }
     	return players;
     }
+    public ArrayListString getPartyMembersByName(Player player)
+    {
+    	ArrayListString players = new ArrayListString();
+    	
+    	for(Player p : Bukkit.getServer().getOnlinePlayers())
+        {
+        	if(p.isOnline() && player != null && p != null)
+        	{
+                if(inSameParty(player, p))
+                {
+                	players.add(p.getName());
+                }
+            }
+        }
+    	return players;
+    }
     
     public void informPartyMembersOwnerChange(String newOwner) {
     	Player newOwnerPlayer = plugin.getServer().getPlayer(newOwner);
@@ -160,8 +194,6 @@ public class Party
     
     public void removeFromParty(Player player, PlayerProfile PP) 
     {
-    	ArrayList<Player> partymembers = Party.getInstance().getPartyMembers(player);
-    	
     	//Stop NPE... hopefully
     	if(!isParty(PP.getParty()) || !isInParty(player, PP))
     		addToParty(player, PP, PP.getParty(), false);
@@ -179,13 +211,6 @@ public class Party
     	if(isPartyEmpty(party)) deleteParty(party);
 		PP.removeParty();
 		savePartyPlayers();
-		
-		//Refresh party hp bars
-		if(LoadProperties.partybar && LoadProperties.spoutEnabled)
-		{
-			SpoutStuff.resetPartyHealthBarDisplays(partymembers);
-			SpoutStuff.resetPartyHealthBarDisplays(player);
-		}
     }
     
     public void addToParty(Player player, PlayerProfile PP, String newParty, Boolean invite) {

+ 112 - 0
mcMMO/com/gmail/nossr50/spout/ArrayListString.java

@@ -0,0 +1,112 @@
+/*
+ * This file is part of mmoMinecraft (http://code.google.com/p/mmo-minecraft/).
+ * 
+ * mmoMinecraft is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+package com.gmail.nossr50.spout;
+
+import java.util.ArrayList;
+
+/**
+ * Case insensitive ArrayList<String>.
+ * Overrides the .contains(), .indexOf(), .lastIndexOf() and .remove() methods.
+ */
+public class ArrayListString extends ArrayList<String> {
+	
+	private static final long serialVersionUID = -8111006526598412404L;
+
+	/**
+	 * Returns true if this list contains the specified string.
+	 * @param o String whose presence in this list is to be tested
+	 * @return true if this list contains the specified string
+	 */
+	public boolean contains(String o) {
+		for (String e : this) {
+			if (o == null ? e == null : o.equalsIgnoreCase(e)) {
+				return true;
+			}
+		}
+		return false;
+	}
+
+	/**
+	 * Returns the index of the first occurrence of the specified string in this list, or -1 if this list does not contain the string.
+	 * @param o String to search for
+	 * @return The index of the first occurrence of the specified string in this list, or -1 if this list does not contain the string
+	 */
+	public int indexOf(String o) {
+		for (int i = 0; i < this.size(); i++) {
+			if (o == null ? get(i) == null : o.equalsIgnoreCase(get(i))) {
+				return i;
+			}
+		}
+		return -1;
+	}
+
+	/**
+	 * Returns the index of the last occurrence of the specified string in this list, or -1 if this list does not contain the string.
+	 * @param o String to search for
+	 * @return The index of the last occurrence of the specified string in this list, or -1 if this list does not contain the string
+	 */
+	public int lastIndexOf(String o) {
+		for (int i = size() - 1; i >= 0; i--) {
+			if (o == null ? get(i) == null : o.equalsIgnoreCase(get(i))) {
+				return i;
+			}
+		}
+		return -1;
+	}
+
+	/**
+	 * Removes the first occurrence of the specified string from this list, if it is present. If the list does not contain the string, it is unchanged.
+	 * @param o String to be removed from this list, if present
+	 * @return true if this list contained the specified string
+	 */
+	public boolean remove(String o) {
+		int i = indexOf(o);
+		if (i != -1) {
+			remove(i);
+			return true;
+		}
+		return false;
+	}
+
+	/**
+	 * Returns the element at the specified position in this list.
+	 * This is for finding the correct capitalisation of an element.
+	 * @param index String to search for
+	 * @return the correctly capitalised element
+	 */
+	public String get(String index) {
+		int i = this.indexOf(index);
+		if (i != -1) {
+			return this.get(i);
+		}
+		return null;
+	}
+
+	public ArrayListString meFirst(String name) {
+		ArrayListString copy = new ArrayListString();
+		if (this.contains(name)) {
+			copy.add(name);
+		}
+		for (String next : this) {
+			if (!next.equalsIgnoreCase(name)) {
+				copy.add(next);
+			}
+		}
+		return copy;
+	}
+}

+ 58 - 0
mcMMO/com/gmail/nossr50/spout/GenericFace.java

@@ -0,0 +1,58 @@
+/*
+ * This file is part of mmoMinecraft (http://code.google.com/p/mmo-minecraft/).
+ * 
+ * mmoMinecraft is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+package com.gmail.nossr50.spout;
+
+import org.getspout.spoutapi.gui.GenericTexture;
+
+public final class GenericFace extends GenericTexture {
+
+	private static String facePath = "http://face.rycochet.net/";
+	private static int defaultSize = 8;
+	private String name;
+
+	public GenericFace() {
+		this.setWidth(defaultSize).setHeight(defaultSize).setFixed(true);
+		setName("");
+	}
+
+	public GenericFace(String name) {
+		this.setWidth(defaultSize).setHeight(defaultSize).setFixed(true);
+		setName(name);
+	}
+
+	public GenericFace(String name, int size) {
+		this.setWidth(size).setHeight(size).setFixed(true);
+		setName(name);
+	}
+
+	public String getName() {
+		return name;
+	}
+
+	public GenericFace setName(String name) {
+		this.name = name == null ? "" : name;
+		super.setUrl(facePath + this.name + ".png");
+		super.setDirty(true);
+		return this;
+	}
+
+	public GenericFace setSize(int size) {
+		super.setWidth(size).setHeight(size);
+		return this;
+	}
+}

+ 227 - 0
mcMMO/com/gmail/nossr50/spout/GenericLivingEntity.java

@@ -0,0 +1,227 @@
+/*
+ * This file is from mmoMinecraft (http://code.google.com/p/mmo-minecraft/).
+ * 
+ * mmoMinecraft is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+package com.gmail.nossr50.spout;
+
+import org.bukkit.Bukkit;
+import org.bukkit.entity.LivingEntity;
+import org.bukkit.entity.Player;
+import org.getspout.spoutapi.gui.*;
+
+public class GenericLivingEntity extends GenericContainer {
+
+	private Container _bars;
+	private Container _space;
+	private Label _label;
+	private Gradient _health;
+	private Gradient _armor;
+	private GenericFace _face;
+	private int health = 100;
+	private int armor = 100;
+	private int def_width = 80;
+	private int def_height = 14;
+	private boolean target = false;
+	String face = "~";
+	String label = "";
+
+	public GenericLivingEntity() {
+		super();
+		Color black = new Color(0, 0, 0, 0.75f);
+
+		this.addChildren( 
+			new GenericContainer(	// Used for the bar, this.children with an index 1+ are targets
+				_space = (Container) new GenericContainer()
+					  .setMinWidth(def_width / 4)
+					  .setMaxWidth(def_width / 4)
+					  .setVisible(target),
+				new GenericContainer(
+					new GenericGradient()
+							.setTopColor(black)
+							.setBottomColor(black)
+							.setPriority(RenderPriority.Highest),
+					_bars = (Container) new GenericContainer(
+						_health = (Gradient) new GenericGradient(),
+						_armor = (Gradient) new GenericGradient()
+					)		.setMargin(1)
+							.setPriority(RenderPriority.High),
+					new GenericContainer(
+						_face = (GenericFace) new GenericFace()
+								.setMargin(3, 0, 3, 3),
+						_label = (Label) new GenericLabel()
+								.setMargin(3)
+					)		.setLayout(ContainerType.HORIZONTAL)
+				)		.setLayout(ContainerType.OVERLAY)
+			)		.setLayout(ContainerType.HORIZONTAL)
+					.setMargin(0, 0, 1, 0)
+					.setFixed(true)
+					.setWidth(def_width)
+					.setHeight(def_height)
+		)		.setAlign(WidgetAnchor.TOP_LEFT)
+				.setFixed(true)
+				.setWidth(def_width)
+				.setHeight(def_height + 1);
+
+		this.setHealthColor(new Color(1f, 0, 0, 0.75f));
+		this.setArmorColor(new Color(0.75f, 0.75f, 0.75f, 0.75f));
+	}
+
+	/**
+	 * Set the display from a possibly offline player
+	 * @param name
+	 * @return 
+	 */
+	public GenericLivingEntity setEntity(String name) {
+		return setEntity(name, "");
+	}
+
+	/**
+	 * Set the display from a possibly offline player
+	 * @param name
+	 * @param prefix Place before the name
+	 * @return 
+	 */
+	public GenericLivingEntity setEntity(String name, String prefix) {
+		Player player = Bukkit.getServer().getPlayer(name);
+		if (player != null && player.isOnline()) {
+			return setEntity(player, prefix);
+		}
+		setHealth(0);
+		setArmor(0);
+		setLabel((!"".equals(prefix) ? prefix : "") + mmoHelper.getColor(screen != null ? screen.getPlayer() : null, null) + name);
+		setFace("~" + name);
+		return this;
+	}
+
+	/**
+	 * Set the display from a player or living entity
+	 * @param entity
+	 * @return 
+	 */
+	public GenericLivingEntity setEntity(LivingEntity entity) {
+		return setEntity(entity, "");
+	}
+
+	/**
+	 * Set the display from a player or living entity
+	 * @param entity
+	 * @param prefix Place before the name
+	 * @return 
+	 */
+	public GenericLivingEntity setEntity(LivingEntity entity, String prefix) {
+		if (entity != null && entity instanceof LivingEntity) {
+			setHealth(mmoHelper.getHealth(entity)); // Needs a maxHealth() check
+			setArmor(mmoHelper.getArmor(entity));
+			setLabel((!"".equals(prefix) ? prefix : "") + mmoHelper.getColor(screen != null ? screen.getPlayer() : null, entity) + mmoHelper.getSimpleName(entity, !target));
+			setFace(entity instanceof Player ? ((Player)entity).getName() : "");
+		} else {
+			setHealth(0);
+			setArmor(0);
+			setLabel("");
+			setFace("");
+		}
+		return this;
+	}
+
+	/**
+	 * Set the targets of this entity - either actual targets, or pets etc
+	 * @param targets
+	 * @return 
+	 */
+	public GenericLivingEntity setTargets(LivingEntity... targets) {
+		Widget[] widgets = this.getChildren();
+		if (targets == null) {
+			targets = new LivingEntity[0]; // zero-length array is easier to handle
+		}
+		for (int i=targets.length + 1; i<widgets.length; i++) {
+			this.removeChild(widgets[i]);
+		}
+		for (int i=0; i<targets.length; i++) {
+			GenericLivingEntity child;
+			if (widgets.length > i + 1) {
+				child = (GenericLivingEntity) widgets[i+1];
+			} else {
+				this.addChild(child = new GenericLivingEntity());
+			}
+			child.setTarget(true);
+			child.setEntity(targets[i]);
+		}
+		setHeight((targets.length + 1) * (def_height + 1));
+		updateLayout();
+		return this;
+	}
+
+	public GenericLivingEntity setTarget(boolean target) {
+		if (this.target != target) {
+			this.target = target;
+			_space.setVisible(target);
+			updateLayout();
+		}
+		return this;
+	}
+
+	public GenericLivingEntity setHealth(int health) {
+		if (this.health != health) {
+			this.health = health;
+			updateLayout();
+		}
+		return this;
+	}
+
+	public GenericLivingEntity setHealthColor(Color color) {
+		_health.setTopColor(color).setBottomColor(color);
+		return this;
+	}
+
+	public GenericLivingEntity setArmor(int armor) {
+		if (this.armor != armor) {
+			this.armor = armor;
+			updateLayout();
+		}
+		return this;
+	}
+
+	public GenericLivingEntity setArmorColor(Color color) {
+		_armor.setTopColor(color).setBottomColor(color);
+		return this;
+	}
+
+	public GenericLivingEntity setLabel(String label) {
+		if (!this.label.equals(label)) {
+			this.label = label;
+			_label.setText(label).setDirty(true);
+			updateLayout();
+		}
+		return this;
+	}
+
+	public GenericLivingEntity setFace(String name) {
+		if (!this.face.equals(name)) {
+			this.face = name;
+			_face.setVisible(!name.isEmpty());
+			_face.setName(name);
+			updateLayout();
+		}
+		return this;
+	}
+
+	@Override
+	public Container updateLayout() {
+		super.updateLayout();
+		_armor.setWidth((_bars.getWidth() * armor) / 100).setDirty(true);
+		_health.setWidth((_bars.getWidth() * health) / 100).setDirty(true);
+		return this;
+	}
+}

+ 6 - 7
mcMMO/com/gmail/nossr50/spout/SpoutStuff.java

@@ -1,6 +1,5 @@
 package com.gmail.nossr50.spout;
 
-import java.util.ArrayList;
 import java.util.HashMap;
 
 import org.bukkit.Bukkit;
@@ -12,7 +11,6 @@ import org.bukkit.event.Event;
 import org.bukkit.event.Event.Priority;
 import org.getspout.spoutapi.SpoutManager;
 import org.getspout.spoutapi.gui.Color;
-import org.getspout.spoutapi.gui.Widget;
 import org.getspout.spoutapi.keyboard.Keyboard;
 import org.getspout.spoutapi.player.SpoutPlayer;
 import org.getspout.spoutapi.sound.SoundEffect;
@@ -27,22 +25,20 @@ import com.gmail.nossr50.datatypes.HUDmmo;
 import com.gmail.nossr50.datatypes.PlayerProfile;
 import com.gmail.nossr50.datatypes.popups.PopupMMO;
 import com.gmail.nossr50.datatypes.SkillType;
-import com.gmail.nossr50.datatypes.HealthBarMMO;
 import com.gmail.nossr50.listeners.mcSpoutInputListener;
 import com.gmail.nossr50.listeners.mcSpoutListener;
 import com.gmail.nossr50.listeners.mcSpoutScreenListener;
-import com.gmail.nossr50.party.Party;
 
 public class SpoutStuff 
 {
 	static mcMMO plugin = (mcMMO) Bukkit.getServer().getPluginManager().getPlugin("mcMMO");
 	
-	private final static mcSpoutListener spoutListener = new mcSpoutListener();
+	private final static mcSpoutListener spoutListener = new mcSpoutListener(plugin);
 	private final static mcSpoutInputListener spoutInputListener = new mcSpoutInputListener(plugin);
 	private final static mcSpoutScreenListener spoutScreenListener = new mcSpoutScreenListener(plugin);
 	
 	public static HashMap<Player, HUDmmo> playerHUDs = new HashMap<Player, HUDmmo>();
-	public static HashMap<Player, ArrayList<HealthBarMMO>> partyHealthBars = new HashMap<Player, ArrayList<HealthBarMMO>>();
+	//public static HashMap<Player, ArrayList<HealthBarMMO>> partyHealthBars = new HashMap<Player, ArrayList<HealthBarMMO>>();
 	public static HashMap<SpoutPlayer, PopupMMO> playerScreens = new HashMap<SpoutPlayer, PopupMMO>();
 	
 	public static Keyboard keypress;
@@ -136,6 +132,7 @@ public class SpoutStuff
 		SM.playSoundEffect(sPlayer, effect, location);
 	}
 	
+	/*
 	public static void initializePartyTracking(SpoutPlayer player)
 	{
 		if(Users.getProfile(player).inParty())
@@ -173,6 +170,7 @@ public class SpoutStuff
 			}
 		}
 	}
+	
 	public static void resetPartyHealthBarDisplays(final ArrayList<Player> players)
 	{
 		Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(plugin,
@@ -224,6 +222,7 @@ public class SpoutStuff
 		}, 1);
 	}
 	
+	
 	public static void resetPartyHealthBarDisplays(final Player player)
 	{
 		Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(plugin,
@@ -291,7 +290,7 @@ public class SpoutStuff
 			}
 		}
 	}
-	
+	*/
 	public static void playRepairNoise(Player player)
 	{
 		SoundManager SM = SpoutManager.getSoundManager();

+ 252 - 0
mcMMO/com/gmail/nossr50/spout/mmoHelper.java

@@ -0,0 +1,252 @@
+/*
+ * This file is from mmoMinecraft (http://code.google.com/p/mmo-minecraft/).
+ * 
+ * mmoMinecraft is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+package com.gmail.nossr50.spout;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+
+import org.bukkit.Bukkit;
+import org.bukkit.ChatColor;
+import org.bukkit.World;
+import org.bukkit.entity.Entity;
+import org.bukkit.entity.LivingEntity;
+import org.bukkit.entity.Player;
+import org.bukkit.entity.Tameable;
+import org.bukkit.inventory.ItemStack;
+import org.bukkit.plugin.Plugin;
+import org.bukkit.entity.*;
+import org.getspout.spoutapi.gui.Container;
+import org.getspout.spoutapi.gui.GenericContainer;
+import org.getspout.spoutapi.gui.Widget;
+import org.getspout.spoutapi.gui.WidgetAnchor;
+import org.getspout.spoutapi.player.SpoutPlayer;
+
+import com.gmail.nossr50.Users;
+import com.gmail.nossr50.party.Party;
+
+public class mmoHelper 
+{
+	
+	/**
+	 * A map of player containers, each container is their party bar
+	 */
+	public static HashMap<Player, GenericContainer> containers = new HashMap<Player, GenericContainer>();
+	
+	/**
+	 * Get the percentage health of a Player.
+	 * @param player The Player we're interested in
+	 * @return The percentage of max health
+	 */
+	public static int getHealth(Entity player) {
+		if (player != null && player instanceof LivingEntity) {
+			try {
+				return Math.min(((LivingEntity) player).getHealth() * 5, 100);
+			} catch (Exception e) {
+			}
+		}
+		return 0;
+	}
+	
+	/**
+	 * Get the colour of a LivingEntity target from a player's point of view.
+	 * @param player The player viewing the target
+	 * @param target The target to name
+	 * @return The name to use
+	 */
+	public static String getColor(Player player, LivingEntity target) {
+		if (target instanceof Player) {
+			return ChatColor.YELLOW.toString();
+		} else {
+			if (target instanceof Monster) {
+				if (player != null && player.equals(((Creature) target).getTarget())) {
+					return ChatColor.RED.toString();
+				} else {
+					return ChatColor.YELLOW.toString();
+				}
+			} else if (target instanceof WaterMob) {
+				return ChatColor.GREEN.toString();
+			} else if (target instanceof Flying) {
+				return ChatColor.YELLOW.toString();
+			} else if (target instanceof Animals) {
+				if (player != null && player.equals(((Creature) target).getTarget())) {
+					return ChatColor.RED.toString();
+				} else if (target instanceof Tameable) {
+					Tameable pet = (Tameable) target;
+					if (pet.isTamed()) {
+						return ChatColor.GREEN.toString();
+					} else {
+						return ChatColor.YELLOW.toString();
+					}
+				} else {
+					return ChatColor.GRAY.toString();
+				}
+			} else {
+				return ChatColor.GRAY.toString();
+			}
+		}
+	}
+
+	/**
+	 * Get the percentage armour of a Player.
+	 * @param player The Player we're interested in
+	 * @return The percentage of max armour
+	 */
+	public static int getArmor(Entity player) {
+		if (player != null && player instanceof Player) {
+			int armor = 0, max, multi[] = {15, 30, 40, 15};
+			ItemStack inv[] = ((Player) player).getInventory().getArmorContents();
+			for (int i = 0; i < inv.length; i++) {
+				max = inv[i].getType().getMaxDurability();
+				if (max >= 0) {
+					armor += multi[i] * (max - inv[i].getDurability()) / max;
+				}
+			}
+			return armor;
+		}
+		return 0;
+	}
+	
+	public static String getSimpleName(LivingEntity target, boolean showOwner) {
+		String name = "";
+		if (target instanceof Player) {
+			name += ((Player)target).getName();
+		} else {
+			if (target instanceof Tameable) {
+				if (((Tameable)target).isTamed()) {
+					if (showOwner && ((Tameable)target).getOwner() instanceof Player) {
+						name += ((Player)((Tameable)target).getOwner()).getName() + "'s ";
+					} else {
+						name += "Pet ";
+					}
+				}
+			}
+			if (target instanceof Chicken) {
+				name += "Chicken";
+			} else if (target instanceof Cow) {
+				name += "Cow";
+			} else if (target instanceof Creeper) {
+				name += "Creeper";
+			} else if (target instanceof Giant) {
+				name += "Giant";
+			} else if (target instanceof Pig) {
+				name += "Pig";
+			} else if (target instanceof PigZombie) {
+				name += "PigZombie";
+			} else if (target instanceof Sheep) {
+				name += "Sheep";
+			} else if (target instanceof Skeleton) {
+				name += "Skeleton";
+			} else if (target instanceof Spider) {
+				name += "Spider";
+			} else if (target instanceof Squid) {
+				name += "Squid";
+			} else if (target instanceof Wolf) {
+				name += "Wolf";
+			} else if (target instanceof Zombie) {
+				name += "Zombie";
+			} else if (target instanceof Monster) {
+				name += "Monster";
+			} else if (target instanceof Creature) {
+				name += "Creature";
+			} else {
+				name += "Unknown";
+			}
+		}
+		return name;
+	}
+	
+	public static LivingEntity[] getPets(HumanEntity player) {
+		ArrayList<LivingEntity> pets = new ArrayList<LivingEntity>();
+		if (player != null && (!(player instanceof Player) || ((Player)player).isOnline())) {
+			String name = player.getName();
+			for (World world : Bukkit.getServer().getWorlds()) {
+				for (LivingEntity entity : world.getLivingEntities()) {
+					if (entity instanceof Tameable && ((Tameable) entity).isTamed() && ((Tameable) entity).getOwner() instanceof Player) {
+						if (name.equals(((Player) ((Tameable) entity).getOwner()).getName())) {
+							pets.add(entity);
+						}
+					}
+				}
+			}
+		}
+		LivingEntity[] list = new LivingEntity[pets.size()];
+		pets.toArray(list);
+		return list;
+	}
+	
+	public static void update(Player player) 
+	{
+		boolean show_pets = true;
+		Container container = containers.get(player);
+
+		if (container != null) 
+		{
+			int index = 0;
+			Widget[] bars = container.getChildren();
+			for (String name : Party.getInstance().getPartyMembersByName(player).meFirst(player.getName())) 
+			{
+				if(Bukkit.getServer().getPlayer(name).isOnline())
+				{
+					GenericLivingEntity bar;
+					if (index >= bars.length) {
+						container.addChild(bar = new GenericLivingEntity());
+					} else {
+						bar = (GenericLivingEntity)bars[index];
+					}
+					bar.setEntity(name, Party.getInstance().isPartyLeader(player, Users.getProfile(player).getParty()) ? ChatColor.GREEN + "@" : "");
+					bar.setTargets(show_pets ? getPets(Bukkit.getServer().getPlayer(name)) : null);
+					index++;
+				}
+			}
+			while (index < bars.length) {
+				container.removeChild(bars[index--]);
+			}
+			container.updateLayout();
+		}
+	}
+	
+	public static void initialize(SpoutPlayer sPlayer, Plugin plugin)
+	{
+		GenericContainer container = new GenericContainer();
+		
+		container.setAlign(WidgetAnchor.TOP_LEFT)
+			.setAnchor(WidgetAnchor.TOP_LEFT)
+			.setX(3)
+			.setY(3)
+			.setWidth(427)
+			.setHeight(240)
+			.setFixed(true);
+		
+		mmoHelper.containers.put(sPlayer, container);
+		
+		sPlayer.getMainScreen().attachWidget(plugin, container);
+	}
+	/**
+	 * Update all parties.
+	 */
+	public static void updateAll() {
+		for(Player x : Bukkit.getServer().getOnlinePlayers())
+		{
+			if(Users.getProfile(x).inParty())
+			{
+				update(x);
+			}
+		}
+	}
+	
+}

+ 1 - 1
mcMMO/plugin.yml

@@ -1,6 +1,6 @@
 name: mcMMO
 main: com.gmail.nossr50.mcMMO
-version: 1.1.09
+version: 1.1.11
 softdepend: [Spout]
 commands:
     mchud: