2
0
Эх сурвалжийг харах

Another WIP, some tweaks to WoodCutting and a working version of Leaderboards for MySQL.

nossr50 14 жил өмнө
parent
commit
947174c34e

+ 2 - 0
mcMMO/Changelog.txt

@@ -1,6 +1,8 @@
 Changelog:
 #Versions without changelogs probably had very small misc fixes, like tweaks to the source code#
 Version 1.0
+Added Leaf Blower to WoodCutting
+Different Trees give different WoodCutting XP
 Water changing Gravel to Clay removed
 Code Organized/Optimized further
 MySQL Support

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

@@ -40,13 +40,13 @@ public class Database {
 	}
 	//Create the DB structure
 	public void createStructure(){
-		Write("CREATE TABLE IF NOT EXISTS `users` (`id` int(10) unsigned NOT NULL AUTO_INCREMENT," +
+		Write("CREATE TABLE IF NOT EXISTS `"+LoadProperties.MySQLtablePrefix+"users` (`id` int(10) unsigned NOT NULL AUTO_INCREMENT," +
 				"`user` varchar(30) NOT NULL," +
-				"`lastlogin` int(10) unsigned NOT NULL," +
+				"`lastlogin` int(32) unsigned NOT NULL," +
 				"`party` varchar(100) NOT NULL DEFAULT ''," +
 				"PRIMARY KEY (`id`)," +
 				"UNIQUE KEY `user` (`user`)) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=1;");
-		Write("CREATE TABLE IF NOT EXISTS `skills` (`user_id` int(10) unsigned NOT NULL," +
+		Write("CREATE TABLE IF NOT EXISTS `"+LoadProperties.MySQLtablePrefix+"skills` (`user_id` int(10) unsigned NOT NULL," +
 				"`taming` int(10) unsigned NOT NULL DEFAULT '0'," +
 				"`mining` int(10) unsigned NOT NULL DEFAULT '0'," +
 				"`woodcutting` int(10) unsigned NOT NULL DEFAULT '0'," +
@@ -59,7 +59,7 @@ public class Database {
 				"`axes` int(10) unsigned NOT NULL DEFAULT '0'," +
 				"`acrobatics` int(10) unsigned NOT NULL DEFAULT '0'," +
 				"PRIMARY KEY (`user_id`)) ENGINE=MyISAM DEFAULT CHARSET=latin1;");
-		Write("CREATE TABLE IF NOT EXISTS `experience` (`user_id` int(10) unsigned NOT NULL," +
+		Write("CREATE TABLE IF NOT EXISTS `"+LoadProperties.MySQLtablePrefix+"experience` (`user_id` int(10) unsigned NOT NULL," +
 				"`taming` int(10) unsigned NOT NULL DEFAULT '0'," +
 				"`mining` int(10) unsigned NOT NULL DEFAULT '0'," +
 				"`woodcutting` int(10) unsigned NOT NULL DEFAULT '0'," +
@@ -72,10 +72,10 @@ public class Database {
 				"`axes` int(10) unsigned NOT NULL DEFAULT '0'," +
 				"`acrobatics` int(10) unsigned NOT NULL DEFAULT '0'," +
 				"PRIMARY KEY (`user_id`)) ENGINE=MyISAM DEFAULT CHARSET=latin1;");
-		Write("CREATE TABLE IF NOT EXISTS `spawn` (`user_id` int(10) NOT NULL," +
-				"`x` int(11) NOT NULL DEFAULT '0'," +
-				"`y` int(11) NOT NULL DEFAULT '0'," +
-				"`z` int(11) NOT NULL DEFAULT '0'," +
+		Write("CREATE TABLE IF NOT EXISTS `"+LoadProperties.MySQLtablePrefix+"spawn` (`user_id` int(10) NOT NULL," +
+				"`x` int(64) NOT NULL DEFAULT '0'," +
+				"`y` int(64) NOT NULL DEFAULT '0'," +
+				"`z` int(64) NOT NULL DEFAULT '0'," +
 				"`world` varchar(50) NOT NULL DEFAULT ''," +
 				"PRIMARY KEY (`user_id`)) ENGINE=MyISAM DEFAULT CHARSET=latin1;");
 	}

+ 2 - 2
mcMMO/com/gmail/nossr50/config/LoadProperties.java

@@ -4,7 +4,7 @@ import com.gmail.nossr50.mcMMO;
 
 public class LoadProperties {
 	public static Boolean useMySQL, cocoabeans, archeryFireRateLimit, mushrooms, toolsLoseDurabilityFromAbilities, pvpxp, miningrequirespickaxe, woodcuttingrequiresaxe, pvp, eggs, apples, myspawnclearsinventory, cake, music, diamond, glowstone, slowsand, sulphur, netherrack, bones, coal, clay, anvilmessages;
-	public static String MySQLuserName, MySQLserverName, MySQLdbName, MySQLdbPass, mctop, addxp, mcability, mcmmo, mcc, mcrefresh, mcitem, mcgod, stats, mmoedit, ptp, party, myspawn, setmyspawn, whois, invite, accept, clearmyspawn;
+	public static String MySQLtablePrefix, MySQLuserName, MySQLserverName, MySQLdbName, MySQLdbPass, mctop, addxp, mcability, mcmmo, mcc, mcrefresh, mcitem, mcgod, stats, mmoedit, ptp, party, myspawn, setmyspawn, whois, invite, accept, clearmyspawn;
 	public static int MySQLport, xpGainMultiplier, superBreakerCooldown, greenTerraCooldown, gigaDrillBreakerCooldown, treeFellerCooldown, berserkCooldown, serratedStrikeCooldown, skullSplitterCooldown, abilityDurabilityLoss, feathersConsumedByChimaeraWing, pvpxprewardmodifier, repairdiamondlevel, globalxpmodifier, tamingxpmodifier, miningxpmodifier, repairxpmodifier, woodcuttingxpmodifier, unarmedxpmodifier, herbalismxpmodifier, excavationxpmodifier, archeryxpmodifier, swordsxpmodifier, axesxpmodifier, acrobaticsxpmodifier;
 	
 	public static void loadMain(){
@@ -31,6 +31,7 @@ public class LoadProperties {
     	MySQLdbPass = properties.getString("MySQLdbPass", "defaultdbpass");
     	MySQLdbName = properties.getString("MySQLdbName", "defaultdbname");
     	MySQLuserName = properties.getString("MySQLuserName", "defaultusername");
+    	MySQLtablePrefix = properties.getString("MySQLTablePrefix", "mcmmo_");
     	MySQLport = properties.getInteger("MySQLport", 3306);
     	useMySQL = properties.getBoolean("mysql", false);
     	
@@ -39,7 +40,6 @@ public class LoadProperties {
     	 */
     	
     	archeryFireRateLimit = properties.getBoolean("archeryFireRateLimit", true);
-    	myspawnclearsinventory = properties.getBoolean("mySpawnClearsInventory", true);
     	xpGainMultiplier = properties.getInteger("xpGainMultiplier", 1);
     	toolsLoseDurabilityFromAbilities = properties.getBoolean("toolsLoseDurabilityFromAbilities", true);
     	abilityDurabilityLoss = properties.getInteger("abilityDurabilityLoss", 2);

+ 45 - 45
mcMMO/com/gmail/nossr50/config/mcProperties.java

@@ -7,58 +7,58 @@ import java.io.IOException;
 import java.util.Properties;
 
 public class mcProperties extends Properties{
-//private static volatile mcProperties instance;
-private String fileName;
-public mcProperties(String file) {
-	this.fileName = file;
-}
-public void load() {
-	File file = new File(this.fileName);
-	if(file.exists()) {
-		try  {
-			load(new FileInputStream(this.fileName));
+	//private static volatile mcProperties instance;
+	private String fileName;
+	public mcProperties(String file) {
+		this.fileName = file;
+	}
+	public void load() {
+		File file = new File(this.fileName);
+		if(file.exists()) {
+			try  {
+				load(new FileInputStream(this.fileName));
+			} catch (IOException ex) {
+				
+			}
+		}
+	}
+	public void save(String start){
+		try{
+			store(new FileOutputStream(this.fileName), start);
 		} catch (IOException ex) {
 			
 		}
 	}
-}
-public void save(String start){
-	try{
-		store(new FileOutputStream(this.fileName), start);
-	} catch (IOException ex) {
-		
-	}
-}
-public int getInteger(String key, int value){
-	if(containsKey(key)){
-		return Integer.parseInt(getProperty(key));
+	public int getInteger(String key, int value){
+		if(containsKey(key)){
+			return Integer.parseInt(getProperty(key));
+		}
+		put(key, String.valueOf(value));
+		return value;
 	}
-	put(key, String.valueOf(value));
-	return value;
-}
-public String getString(String key, String value){
-	if(containsKey(key)){
-		return getProperty(key);
+	public String getString(String key, String value){
+		if(containsKey(key)){
+			return getProperty(key);
+		}
+		put(key, value);
+		return value;
 	}
-	put(key, value);
-	return value;
-}
-public Boolean getBoolean(String key, boolean value) {
-	if (containsKey(key)) {
-		String boolString = getProperty(key);
-		return (boolString.length() > 0)
-				&& (boolString.toLowerCase().charAt(0) == 't');
+	public Boolean getBoolean(String key, boolean value) {
+		if (containsKey(key)) {
+			String boolString = getProperty(key);
+			return (boolString.length() > 0)
+					&& (boolString.toLowerCase().charAt(0) == 't');
+		}
+		put(key, value ? "true" : "false");
+		return value;
 	}
-	put(key, value ? "true" : "false");
-	return value;
-}
-public double getDouble(String key, double value) {
-	if (containsKey(key)) {
-		return Double.parseDouble(getProperty(key));
+	public double getDouble(String key, double value) {
+		if (containsKey(key)) {
+			return Double.parseDouble(getProperty(key));
+		}
+	
+		put(key, String.valueOf(value));
+		return value;
 	}
 
-	put(key, String.valueOf(value));
-	return value;
-}
-
 }

+ 15 - 23
mcMMO/com/gmail/nossr50/datatypes/PlayerProfile.java

@@ -67,23 +67,17 @@ public class PlayerProfile
 	
 	
 	public boolean loadMySQL(Player p) {
-		/* returns a list of all the users ordered by their username
-		HashMap<Integer, ArrayList<String>> userslist = mcMMO.database.Read("SELECT id, lastlogin, party FROM users ORDER BY user");
-		for(int i=1;i<=userslist.size();i++) {
-			System.out.println("User: " + userslist.get(i).get(0) + ", Lastlogin: " + userslist.get(i).get(1));
-		}
-		*/
 		Integer id = 0;
-		id = mcMMO.database.GetInt("SELECT id FROM users WHERE user = '" + p.getName() + "'");
+		id = mcMMO.database.GetInt("SELECT id FROM "+LoadProperties.MySQLtablePrefix+"users WHERE user = '" + p.getName() + "'");
 		this.userid = id;
 		if (id > 0) {
-			HashMap<Integer, ArrayList<String>> users = mcMMO.database.Read("SELECT lastlogin, party FROM users WHERE id = " + id);
+			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));
 				party = users.get(1).get(1);
-			HashMap<Integer, ArrayList<String>> spawn = mcMMO.database.Read("SELECT world, x, y, z FROM spawn WHERE user_id = " + id);
+			HashMap<Integer, ArrayList<String>> spawn = mcMMO.database.Read("SELECT world, x, y, z FROM "+LoadProperties.MySQLtablePrefix+"spawn WHERE user_id = " + id);
 				myspawnworld = spawn.get(1).get(0);
 				myspawn = spawn.get(1).get(1) + "," + spawn.get(1).get(2) + "," + spawn.get(1).get(3);				
-			HashMap<Integer, ArrayList<String>> skills = mcMMO.database.Read("SELECT taming, mining, repair, woodcutting, unarmed, herbalism, excavation, archery, swords, axes, acrobatics FROM skills WHERE user_id = " + id);
+			HashMap<Integer, ArrayList<String>> skills = mcMMO.database.Read("SELECT taming, mining, repair, woodcutting, unarmed, herbalism, excavation, archery, swords, axes, acrobatics FROM "+LoadProperties.MySQLtablePrefix+"skills WHERE user_id = " + id);
 				taming = skills.get(1).get(0);
 				mining = skills.get(1).get(1);;
 				repair = skills.get(1).get(2);;
@@ -95,7 +89,7 @@ public class PlayerProfile
 				swords = skills.get(1).get(8);
 				axes = skills.get(1).get(9);
 				acrobatics = skills.get(1).get(10);
-			HashMap<Integer, ArrayList<String>> experience = mcMMO.database.Read("SELECT taming, mining, repair, woodcutting, unarmed, herbalism, excavation, archery, swords, axes, acrobatics FROM experience WHERE user_id = " + id);
+			HashMap<Integer, ArrayList<String>> experience = mcMMO.database.Read("SELECT taming, mining, repair, woodcutting, unarmed, herbalism, excavation, archery, swords, axes, acrobatics FROM "+LoadProperties.MySQLtablePrefix+"experience WHERE user_id = " + id);
 				tamingXP = experience.get(1).get(0);
 				miningXP = experience.get(1).get(1);;
 				repairXP = experience.get(1).get(2);;
@@ -115,13 +109,12 @@ public class PlayerProfile
 	}
 	public void addMySQLPlayer(Player p) {
 		Integer id = 0;
-		mcMMO.database.Write("INSERT INTO users (user, lastlogin) VALUES ('" + p.getName() + "'," + System.currentTimeMillis() / 1000 +")");
-		id = mcMMO.database.GetInt("SELECT id FROM users WHERE user = '" + p.getName() + "'");
-		mcMMO.database.Write("INSERT INTO spawn (user_id) VALUES ("+id+")");
-		mcMMO.database.Write("INSERT INTO skills (user_id) VALUES ("+id+")");
-		mcMMO.database.Write("INSERT INTO experience (user_id) VALUES ("+id+")");
+		mcMMO.database.Write("INSERT INTO "+LoadProperties.MySQLtablePrefix+"users (user, lastlogin) VALUES ('" + p.getName() + "'," + System.currentTimeMillis() / 1000 +")");
+		id = mcMMO.database.GetInt("SELECT id FROM "+LoadProperties.MySQLtablePrefix+"users WHERE user = '" + p.getName() + "'");
+		mcMMO.database.Write("INSERT INTO "+LoadProperties.MySQLtablePrefix+"spawn (user_id) VALUES ("+id+")");
+		mcMMO.database.Write("INSERT INTO "+LoadProperties.MySQLtablePrefix+"skills (user_id) VALUES ("+id+")");
+		mcMMO.database.Write("INSERT INTO "+LoadProperties.MySQLtablePrefix+"experience (user_id) VALUES ("+id+")");
 		this.userid = id;
-
 	}
 	
 	public boolean load()
@@ -205,13 +198,12 @@ public class PlayerProfile
 	
     public void save()
     {
-    	Long timestamp = System.currentTimeMillis();
-    	
+    	Long timestamp = System.currentTimeMillis()/1000; //Convert to seconds
     	// if we are using mysql save to database
     	if (LoadProperties.useMySQL) {
-    		mcMMO.database.Write("UPDATE users SET lastlogin = " + timestamp.intValue() + " WHERE id = " + this.userid);
-    		mcMMO.database.Write("UPDATE spawn SET world = '" + this.myspawnworld + "', x = " +getX()+", y = "+getY()+", z = "+getZ()+" WHERE user_id = "+this.userid);
-    		mcMMO.database.Write("UPDATE skills SET "
+    		mcMMO.database.Write("UPDATE "+LoadProperties.MySQLtablePrefix+"users SET lastlogin = " + timestamp.intValue() + " WHERE id = " + this.userid);
+    		mcMMO.database.Write("UPDATE "+LoadProperties.MySQLtablePrefix+"spawn SET world = '" + this.myspawnworld + "', x = " +getX()+", y = "+getY()+", z = "+getZ()+" WHERE user_id = "+this.userid);
+    		mcMMO.database.Write("UPDATE "+LoadProperties.MySQLtablePrefix+"skills SET "
     				+"  taming = "+taming
     				+", mining = "+mining
     				+", repair = "+repair
@@ -224,7 +216,7 @@ public class PlayerProfile
     				+", axes = "+axes
     				+", acrobatics = "+acrobatics
     				+" WHERE user_id = "+this.userid);
-    		mcMMO.database.Write("UPDATE experience SET "
+    		mcMMO.database.Write("UPDATE "+LoadProperties.MySQLtablePrefix+"experience SET "
     				+"  taming = "+tamingXP
     				+", mining = "+miningXP
     				+", repair = "+repairXP

+ 5 - 1
mcMMO/com/gmail/nossr50/m.java

@@ -38,7 +38,6 @@ public class m {
 			return false;
 		}
 	}
-
 	public static int getPowerLevel(Player player){
 		PlayerProfile PP = Users.getProfile(player);
 		int x = 0;
@@ -346,8 +345,13 @@ public class m {
 			player.sendMessage(ChatColor.DARK_GRAY+"XP GAIN: "+ChatColor.WHITE+"Chopping down trees");
 			player.sendMessage(ChatColor.RED+"---[]"+ChatColor.GREEN+"EFFECTS"+ChatColor.RED+"[]---");
 			player.sendMessage(ChatColor.DARK_AQUA+"Tree Feller (ABILITY): "+ChatColor.GREEN+"Make trees explode");
+			player.sendMessage(ChatColor.DARK_AQUA+"Leaf Blower: "+ChatColor.GREEN+"Blow Away Leaves");
 			player.sendMessage(ChatColor.DARK_AQUA+"Double Drops: "+ChatColor.YELLOW+ChatColor.GREEN+"Double the normal loot");
 			player.sendMessage(ChatColor.RED+"---[]"+ChatColor.GREEN+"YOUR STATS"+ChatColor.RED+"[]---");
+			if(PP.getWoodCuttingInt() < 100)
+				player.sendMessage(ChatColor.GRAY+"LOCKED UNTIL 100+ SKILL (LEAF BLOWER)");
+			else
+				player.sendMessage(ChatColor.RED+"Leaf Blower: "+ChatColor.YELLOW+"Blow away leaves");
 			player.sendMessage(ChatColor.RED+"Double Drop Chance: "+ChatColor.YELLOW+percentage+"%");
 			player.sendMessage(ChatColor.RED+"Tree Feller Length: "+ChatColor.YELLOW+ticks+"s");
     	}

+ 38 - 7
mcMMO/com/gmail/nossr50/mcBlockListener.java

@@ -96,13 +96,29 @@ public class mcBlockListener extends BlockListener {
 				if(m.isAxes(inhand)){
 					if(!Config.getInstance().isBlockWatched(block)){
 	    				WoodCutting.woodCuttingProcCheck(player, block);
-	    				PP.addWoodcuttingXP(7 * LoadProperties.xpGainMultiplier);
+	    				//Default
+	    				if(block.getData() == (byte)0)
+	    					PP.addWoodcuttingXP(7 * LoadProperties.xpGainMultiplier);
+	    				//Spruce
+	    				if(block.getData() == (byte)1)
+	    					PP.addWoodcuttingXP(8 * LoadProperties.xpGainMultiplier);
+	    				//Birch
+	    				if(block.getData() == (byte)2)
+	    					PP.addWoodcuttingXP(9 * LoadProperties.xpGainMultiplier);
 					}
     			}
     		} else {
-    			if(block.getData() != 5){
+    			if(!Config.getInstance().isBlockWatched(block)){
 	    			WoodCutting.woodCuttingProcCheck(player, block);
-					PP.addWoodcuttingXP(7 * LoadProperties.xpGainMultiplier);	
+	    			//Default
+    				if(block.getData() == (byte)0)
+    					PP.addWoodcuttingXP(7 * LoadProperties.xpGainMultiplier);
+    				//Spruce
+    				if(block.getData() == (byte)1)
+    					PP.addWoodcuttingXP(8 * LoadProperties.xpGainMultiplier);
+    				//Birch
+    				if(block.getData() == (byte)2)
+    					PP.addWoodcuttingXP(9 * LoadProperties.xpGainMultiplier);
     			}
    			}
     		Skills.XpCheck(player);
@@ -132,9 +148,11 @@ public class mcBlockListener extends BlockListener {
     						}
     					}
     					if(blockx.getTypeId() == 18){
-    						mat = Material.getMaterial(6);
-    						item = new ItemStack(mat, 1, (byte)0, (byte) 0);
-    						if(Math.random() * 10 > 8)
+    						mat = Material.SAPLING;
+    						
+    						item = new ItemStack(mat, 1, (short)0, blockx.getData());
+    						
+    						if(Math.random() * 10 > 9)
     							blockx.getLocation().getWorld().dropItemNaturally(blockx.getLocation(), item);
     					}
     					blockx.setType(Material.AIR);
@@ -160,7 +178,7 @@ public class mcBlockListener extends BlockListener {
 			Herbalism.herbalismProcCheck(block, player, event);
     	
     	//Change the byte back when broken
-    	if(block.getData() == 5)
+    	if(block.getData() == 5 && m.shouldBeWatched(block))
     		block.setData((byte) 0);
     }
     public void onBlockDamage(BlockDamageEvent event) {
@@ -249,6 +267,19 @@ public class mcBlockListener extends BlockListener {
     		}
     	}
     	
+    	/*
+    	 * LEAF BLOWER
+    	 */
+    	if(block.getTypeId() == 18 && mcPermissions.getInstance().woodcutting(player) && PP.getWoodCuttingInt() >= 100 && m.isAxes(player.getItemInHand()) && m.blockBreakSimulate(block, player, plugin))
+    	{
+    		m.damageTool(player, (short)1);
+    		if(Math.random() * 10 > 9)
+    		{
+    			ItemStack x = new ItemStack(Material.SAPLING, 1, (short)0, block.getData());
+    			block.getLocation().getWorld().dropItemNaturally(block.getLocation(), x);
+    		}
+    		block.setType(Material.AIR);
+    	}
     }
     
     public void onBlockFromTo(BlockFromToEvent event) {

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

@@ -103,7 +103,7 @@ public class mcMMO extends JavaPlugin {
         mcLoadMySQL(); 
         database.createStructure(); //Make Structure
         
-        Leaderboard.makeLeaderboards(); //Make the leaderboards
+        //Leaderboard.makeLeaderboards(); //Make the leaderboards
         System.out.println( pdfFile.getName() + " version " + pdfFile.getVersion() + " is enabled!" );
     }
     

+ 179 - 103
mcMMO/com/gmail/nossr50/mcPlayerListener.java

@@ -1,5 +1,7 @@
 package com.gmail.nossr50;
 
+import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
@@ -99,6 +101,7 @@ public class mcPlayerListener extends PlayerListener {
     		{
     			Block targetBlock = player.getTargetBlock(null, 20);
     			player.sendMessage("Target Block TypeID = "+targetBlock.getTypeId());
+    			player.sendMessage("Target Block Byte Data = "+targetBlock.getData());
     		}
     	}
     	if(player.getItemInHand().getTypeId() == 261 && LoadProperties.archeryFireRateLimit){
@@ -199,112 +202,185 @@ public class mcPlayerListener extends PlayerListener {
     			PP.toggleAbilityUse();
     		}
     	}
+    	if(split[0].equalsIgnoreCase("/details")){
+    		event.setCancelled(true);
+    		player.sendMessage("Material : "+player.getItemInHand().getType());
+    		player.sendMessage("Type ID : "+player.getItemInHand().getTypeId());
+    		player.sendMessage("Byte Data : "+player.getItemInHand().getDurability());
+    	}
     	/*
     	 * LEADER BOARD COMMAND
     	 */
-    	
     	if(split[0].equalsIgnoreCase("/"+LoadProperties.mctop)){
     		event.setCancelled(true);
-    		//Format: /top <skillname> <pagenumber>
-
-    		/*
-    		 * POWER LEVEL INFO RETRIEVAL
-    		 */
-    		if(split.length == 1){
-    			int p = 1;
-    			String[] info = Leaderboard.retrieveInfo("powerlevel", p);
-    			player.sendMessage(ChatColor.YELLOW+"--MMO"+ChatColor.BLUE+" Power Level "+ChatColor.YELLOW+"Leaderboard--");
-    			int n = 1 * p; //Position
-    			for(String x : info){
-    				if(x != null){
-    					String digit = String.valueOf(n);
-    					if(n < 10)
-    						digit ="0"+String.valueOf(n);
-	    				String[] splitx = x.split(":");
-	    				//Format: 1. Playername - skill value
-	    				player.sendMessage(digit+". "+ChatColor.GREEN+splitx[1]+" - "+ChatColor.WHITE+splitx[0]);
-	    				n++;
-    				}
-    			}
-    		}
-    		if(split.length >= 2 && Leaderboard.isInt(split[1])){
-    			int p = 1;
-    			//Grab page value if specified
-    			if(split.length >= 2){
-    				if(Leaderboard.isInt(split[1])){
-    					p = Integer.valueOf(split[1]);
-    				}
-    			}
-    			int pt = p;
-    			if(p > 1){
-    				pt -= 1;
-    				pt += (pt * 10);
-    				pt = 10;
-    			}
-    			String[] info = Leaderboard.retrieveInfo("powerlevel", p);
-    			player.sendMessage("--MMO Power Level Leaderboard--");
-    			int n = 1 * pt; //Position
-    			for(String x : info){
-    				if(x != null){
-    					String digit = String.valueOf(n);
-    					if(n < 10)
-    						digit ="0"+String.valueOf(n);
-	    				String[] splitx = x.split(":");
-	    				//Format: 1. Playername - skill value
-	    				player.sendMessage(digit+". "+ChatColor.GREEN+splitx[1]+" - "+ChatColor.WHITE+splitx[0]);
-	    				n++;
-    				}
-    			}
-    		}
+    		if(LoadProperties.useMySQL == false){
+	    		/*
+	    		 * POWER LEVEL INFO RETRIEVAL
+	    		 */
+	    		if(split.length == 1){
+	    			int p = 1;
+	    			String[] info = Leaderboard.retrieveInfo("powerlevel", p);
+	    			player.sendMessage(ChatColor.YELLOW+"--MMO"+ChatColor.BLUE+" Power Level "+ChatColor.YELLOW+"Leaderboard--");
+	    			int n = 1 * p; //Position
+	    			for(String x : info){
+	    				if(x != null){
+	    					String digit = String.valueOf(n);
+	    					if(n < 10)
+	    						digit ="0"+String.valueOf(n);
+		    				String[] splitx = x.split(":");
+		    				//Format: 1. Playername - skill value
+		    				player.sendMessage(digit+". "+ChatColor.GREEN+splitx[1]+" - "+ChatColor.WHITE+splitx[0]);
+		    				n++;
+	    				}
+	    			}
+	    		}
+	    		if(split.length >= 2 && Leaderboard.isInt(split[1])){
+	    			int p = 1;
+	    			//Grab page value if specified
+	    			if(split.length >= 2){
+	    				if(Leaderboard.isInt(split[1])){
+	    					p = Integer.valueOf(split[1]);
+	    				}
+	    			}
+	    			int pt = p;
+	    			if(p > 1){
+	    				pt -= 1;
+	    				pt += (pt * 10);
+	    				pt = 10;
+	    			}
+	    			String[] info = Leaderboard.retrieveInfo("powerlevel", p);
+	    			player.sendMessage("--MMO Power Level Leaderboard--");
+	    			int n = 1 * pt; //Position
+	    			for(String x : info){
+	    				if(x != null){
+	    					String digit = String.valueOf(n);
+	    					if(n < 10)
+	    						digit ="0"+String.valueOf(n);
+		    				String[] splitx = x.split(":");
+		    				//Format: 1. Playername - skill value
+		    				player.sendMessage(digit+". "+ChatColor.GREEN+splitx[1]+" - "+ChatColor.WHITE+splitx[0]);
+		    				n++;
+	    				}
+	    			}
+	    		}
+	    		/*
+	    		 * SKILL SPECIFIED INFO RETRIEVAL
+	    		 */
+	    		if(split.length >= 2 && Skills.isSkill(split[1])){
+	    			int p = 1;
+	    			//Grab page value if specified
+	    			if(split.length >= 3){
+	    				if(Leaderboard.isInt(split[2])){
+	    					p = Integer.valueOf(split[2]);
+	    				}
+	    			}
+	    			int pt = p;
+	    			if(p > 1){
+	    				pt -= 1;
+	    				pt += (pt * 10);
+	    				pt = 10;
+	    			}
+	    			String firstLetter = split[1].substring(0,1);  // Get first letter
+	    	        String remainder   = split[1].substring(1);    // Get remainder of word.
+	    	        String capitalized = firstLetter.toUpperCase() + remainder.toLowerCase();
+	    	        
+	    			String[] info = Leaderboard.retrieveInfo(split[1].toLowerCase(), p);
+	    			player.sendMessage(ChatColor.YELLOW+"--MMO "+ChatColor.BLUE+capitalized+ChatColor.YELLOW+" Leaderboard--");
+	    			int n = 1 * pt; //Position
+	    			for(String x : info){
+	    				if(x != null){
+	    					String digit = String.valueOf(n);
+	    					if(n < 10)
+	    						digit ="0"+String.valueOf(n);
+		    				String[] splitx = x.split(":");
+		    				//Format: 1. Playername - skill value
+		    				player.sendMessage(digit+". "+ChatColor.GREEN+splitx[1]+" - "+ChatColor.WHITE+splitx[0]);
+		    				n++;
+	    				}
+	    			}
+	    		}
+    		} else
     		/*
-    		 * SKILL SPECIFIED INFO RETRIEVAL
-    		 */
-    		if(split.length >= 2 && Skills.isSkill(split[1])){
-    			int p = 1;
-    			//Grab page value if specified
-    			if(split.length >= 3){
-    				if(Leaderboard.isInt(split[2])){
-    					p = Integer.valueOf(split[2]);
-    				}
-    			}
-    			int pt = p;
-    			if(p > 1){
-    				pt -= 1;
-    				pt += (pt * 10);
-    				pt = 10;
+    		* MYSQL LEADERBOARDS
+    		*/
+    		{
+    			if(split.length >= 2 && Skills.isSkill(split[1]))
+    			{
+    				/*
+    				 * Create a nice consistent capitalized leaderboard name
+    				 */
+    				String lowercase = split[1].toLowerCase(); //For the query
+    				String firstLetter = split[1].substring(0,1); //Get first letter
+	    	        String remainder   = split[1].substring(1); //Get remainder of word.
+	    	        String capitalized = firstLetter.toUpperCase() + remainder.toLowerCase();
+	    	        
+	    	        player.sendMessage(ChatColor.YELLOW+"--mcMMO "+ChatColor.BLUE+capitalized+ChatColor.YELLOW+" Leaderboard--");
+	    	        if(split.length >= 3 && m.isInt(split[2]))
+	    	        {
+	    	        	int n = 1; //For the page number
+	    	        	int n2 = Integer.valueOf(split[2]);
+	    	        	if(n2 > 1)
+	    	        	{
+	    	        		//Figure out the 'page' here
+	    	        		n = 10;
+	    	        		n = n * (n2-1);
+	    	        	}
+	    	        	//If a page number is specified
+	    	        	HashMap<Integer, ArrayList<String>> userslist = mcMMO.database.Read("SELECT "+lowercase+", user_id FROM "
+    	    					+LoadProperties.MySQLtablePrefix+"skills ORDER BY `"+LoadProperties.MySQLtablePrefix+"skills`.`"+lowercase+"` DESC ");
+	    	        	
+	    	        	for(int i=n;i<=n+10;i++)
+    	    			{
+    	    				HashMap<Integer, ArrayList<String>> username =  mcMMO.database.Read("SELECT user FROM "+LoadProperties.MySQLtablePrefix+"users WHERE id = '" + Integer.valueOf(userslist.get(i).get(1)) + "'");
+    	    				player.sendMessage(String.valueOf(i)+". "+ChatColor.GREEN+userslist.get(i).get(0)+" - "+ChatColor.WHITE+username.get(1).get(0));
+    	    			}
+    	        		return;
+	    	        }
+	    	        //If no page number is specified
+	    	        HashMap<Integer, ArrayList<String>> userslist = mcMMO.database.Read("SELECT "+lowercase+", user_id FROM "
+	    					+LoadProperties.MySQLtablePrefix+"skills ORDER BY `"+LoadProperties.MySQLtablePrefix+"skills`.`"+lowercase+"` DESC ");
+	    	        for(int i=1;i<=10;i++) //i<=userslist.size()
+	    			{
+	    				HashMap<Integer, ArrayList<String>> username =  mcMMO.database.Read("SELECT user FROM "+LoadProperties.MySQLtablePrefix+"users WHERE id = '" + Integer.valueOf(userslist.get(i).get(1)) + "'");
+	    				player.sendMessage(String.valueOf(i)+". "+ChatColor.GREEN+userslist.get(i).get(0)+" - "+ChatColor.WHITE+username.get(1).get(0));
+	    			}
     			}
-    			String firstLetter = split[1].substring(0,1);  // Get first letter
-    	        String remainder   = split[1].substring(1);    // Get remainder of word.
-    	        String capitalized = firstLetter.toUpperCase() + remainder.toLowerCase();
-    	        
-    			String[] info = Leaderboard.retrieveInfo(split[1].toLowerCase(), p);
-    			player.sendMessage(ChatColor.YELLOW+"--MMO "+ChatColor.BLUE+capitalized+ChatColor.YELLOW+" Leaderboard--");
-    			int n = 1 * pt; //Position
-    			for(String x : info){
-    				if(x != null){
-    					String digit = String.valueOf(n);
-    					if(n < 10)
-    						digit ="0"+String.valueOf(n);
-	    				String[] splitx = x.split(":");
-	    				//Format: 1. Playername - skill value
-	    				player.sendMessage(digit+". "+ChatColor.GREEN+splitx[1]+" - "+ChatColor.WHITE+splitx[0]);
-	    				n++;
-    				}
+    			if(split.length >= 1)
+    			{
+	    			player.sendMessage(ChatColor.YELLOW+"--mcMMO "+ChatColor.BLUE+"Power Level"+ChatColor.YELLOW+" Leaderboard--");
+	    			if(split.length >= 2 && m.isInt(split[1]))
+	    	        {
+	    	        	int n = 1; //For the page number
+	    	        	int n2 = Integer.valueOf(split[1]);
+	    	        	if(n2 > 1)
+	    	        	{
+	    	        		//Figure out the 'page' here
+	    	        		n = 10;
+	    	        		n = n * (n2-1);
+	    	        	}
+	    	        	//If a page number is specified
+	    	        	HashMap<Integer, ArrayList<String>> userslist = mcMMO.database.Read("SELECT taming+mining+woodcutting+repair+unarmed+herbalism+excavation+archery+swords+axes+acrobatics, user_id FROM "
+		    					+LoadProperties.MySQLtablePrefix+"skills ORDER BY taming+mining+woodcutting+repair+unarmed+herbalism+excavation+archery+swords+axes+acrobatics DESC ");
+	    	        	for(int i=n;i<=n+10;i++)
+    	    			{
+    	    				HashMap<Integer, ArrayList<String>> username =  mcMMO.database.Read("SELECT user FROM "+LoadProperties.MySQLtablePrefix+"users WHERE id = '" + Integer.valueOf(userslist.get(i).get(1)) + "'");
+    	    				player.sendMessage(String.valueOf(i)+". "+ChatColor.GREEN+userslist.get(i).get(0)+" - "+ChatColor.WHITE+username.get(1).get(0));
+    	    			}
+    	        		return;
+	    	        }
+	    			HashMap<Integer, ArrayList<String>> userslist = mcMMO.database.Read("SELECT taming+mining+woodcutting+repair+unarmed+herbalism+excavation+archery+swords+axes+acrobatics, user_id FROM "
+	    					+LoadProperties.MySQLtablePrefix+"skills ORDER BY taming+mining+woodcutting+repair+unarmed+herbalism+excavation+archery+swords+axes+acrobatics DESC ");
+	    			for(int i=1;i<=10;i++)
+	    			{
+	    				HashMap<Integer, ArrayList<String>> username =  mcMMO.database.Read("SELECT user FROM "+LoadProperties.MySQLtablePrefix+"users WHERE id = '" + Integer.valueOf(userslist.get(i).get(1)) + "'");
+	    				player.sendMessage(String.valueOf(i)+". "+ChatColor.GREEN+userslist.get(i).get(0)+" - "+ChatColor.WHITE+username.get(1).get(0));
+	    				//System.out.println(username.get(1).get(0));
+	    				//System.out.println("Mining : " + userslist.get(i).get(0) + ", User id : " + userslist.get(i).get(1));
+	    			}
     			}
     		}
     	}
     	
-    	
-    	/*
-    	if(split[0].equalsIgnoreCase("/mutechat")){
-    		event.setCancelled(true);
-    		if(PP.getPartyChatOnlyToggle() == true)
-    			player.sendMessage("Party Chat Only "+ChatColor.RED+"Off");
-    		if(PP.getPartyChatOnlyToggle() == false)
-    			player.sendMessage("Party Chat Only "+ChatColor.RED+"On");
-    		PP.togglePartyChatOnly();
-    	}
-    	*/
 		if(mcPermissions.getInstance().mcAbility(player) && split[0].equalsIgnoreCase("/"+LoadProperties.mcrefresh)){
 			event.setCancelled(true);
     		if(!mcPermissions.getInstance().mcrefresh(player)){
@@ -460,14 +536,14 @@ public class mcPlayerListener extends PlayerListener {
     			player.sendMessage("That is not a valid player");
     		}
     		if(isPlayer(split[1])){
-        	Player target = getPlayer(split[1]);
-        	PlayerProfile PPt = Users.getProfile(target);
-        	if(PP.getParty().equals(PPt.getParty())){
-        	player.teleportTo(target);
-        	player.sendMessage(ChatColor.GREEN+"You have teleported to "+target.getName());
-        	target.sendMessage(ChatColor.GREEN+player.getName() + " has teleported to you.");
-        	}
-    	}
+    			Player target = getPlayer(split[1]);
+    			PlayerProfile PPt = Users.getProfile(target);
+	        	if(PP.getParty().equals(PPt.getParty())){
+	        		player.teleportTo(target);
+	        		player.sendMessage(ChatColor.GREEN+"You have teleported to "+target.getName());
+	        		target.sendMessage(ChatColor.GREEN+player.getName() + " has teleported to you.");
+	        	}
+    		}
     	}
     	/*
     	 * WHOIS COMMAND

+ 2 - 2
mcMMO/com/gmail/nossr50/mcTimer.java

@@ -38,12 +38,12 @@ public class mcTimer extends TimerTask{
 			/*
 			 * PLAYER BLEED MONITORING
 			 */
-			if(thecount % 2 == 0 && player != null && PP.getBleedTicks() >= 1){
+			if(thecount % 2 == 0 && player != null && PP != null && PP.getBleedTicks() >= 1){
         		player.damage(2);
         		PP.decreaseBleedTicks();
         	}
 			
-			if(mcPermissions.getInstance().regeneration(player) && System.currentTimeMillis() >= PP.getRecentlyHurt() + 60000){
+			if(mcPermissions.getInstance().regeneration(player) && PP != null && System.currentTimeMillis() >= PP.getRecentlyHurt() + 60000){
 				if(thecount == 10 || thecount == 20 || thecount == 30 || thecount == 40){
 				    if(player != null &&
 				    	player.getHealth() > 0 && player.getHealth() < 20