Pārlūkot izejas kodu

All changes up to 0.8.17

nossr50 14 gadi atpakaļ
vecāks
revīzija
afa9abfb91

+ 6 - 0
mcMMO/Changelog.txt

@@ -1,5 +1,11 @@
 Changelog:
 #Versions without changelogs probably had very small misc fixes, like tweaks to the source code#
+Version 0.8.17
+	mcmmo.users moved to plugins/mcMMO/
+	Snowballs and Eggs will no longer trigger Ignition
+	Loot tables for excavation adjusted
+	Mining benefits now require the player to be holding a mining pick
+	Woodcutting benefits now require the player to be holding an axe
 Version 0.8.16
 	Moved configuration file to /plugins/mcMMO
 	Arrows now have a chance to Ignite enemiesw

+ 61 - 67
mcMMO/com/gmail/nossr50/mcBlockListener.java

@@ -22,17 +22,14 @@ public class mcBlockListener extends BlockListener {
     }
     public void onBlockPlace(BlockPlaceEvent event) {
     	Block block;
+    	Player player = event.getPlayer();
     	if (event.getBlockReplacedState().getTypeId() == 78) {
     		block = event.getBlockAgainst();
     		}
     		else {
     		block = event.getBlock();
     		}
-    	int x = block.getX();
-    	int y = block.getY();
-    	int z = block.getZ();
-    	String xyz = x+","+y+","+z;
-    	if(mcm.getInstance().shouldBeWatched(block))
+    	if(player != null && mcm.getInstance().shouldBeWatched(block))
     	mcConfig.getInstance().addBlockWatch(block);
     	if(block.getTypeId() == 42 && mcLoadProperties.anvilmessages)
     		event.getPlayer().sendMessage(ChatColor.DARK_RED+"You have placed an anvil, anvils can repair tools and armor.");
@@ -41,12 +38,9 @@ public class mcBlockListener extends BlockListener {
     public void onBlockDamage(BlockDamageEvent event) {
     		//STARTED(0), DIGGING(1), BROKEN(3), STOPPED(2);
     		Player player = event.getPlayer();
+    		ItemStack inhand = player.getItemInHand();
     		//player.sendMessage("mcMMO DEBUG: EVENT-OK DMG LEVEL ("+event.getDamageLevel().getLevel()+")");
     		Block block = event.getBlock();
-    		int x = block.getX();
-        	int y = block.getY();
-        	int z = block.getZ();
-        	String xyz = x+","+y+","+z;
     		Location loc = block.getLocation();
     		int dmg = event.getDamageLevel().getLevel();
     		/*
@@ -60,64 +54,64 @@ public class mcBlockListener extends BlockListener {
     		 * MINING
     		 */
     		if(player != null && dmg == 2 && !mcConfig.getInstance().isBlockWatched(block)){
-    		if(mcPermissions.getInstance().mining(player))
-    		mcMining.getInstance().miningBlockCheck(player, block);
-    		/*
-    		 * WOOD CUTTING
-    		 */
-    		if(player != null && block.getTypeId() == 17 && mcPermissions.getInstance().woodcutting(player)){    		
-    				mcWoodCutting.getInstance().woodCuttingProcCheck(player, block, loc);
-    				mcUsers.getProfile(player).addWoodcuttingGather(7);
-    				/*
-    				 * IF PLAYER IS USING TREEFELLER
-    				 */
-    				if(mcPermissions.getInstance().woodcuttingability(player) && mcUsers.getProfile(player).getTreeFellerMode() && block.getTypeId() == 17){
-    					mcWoodCutting.getInstance().treeFeller(block, player);
-    					for(Block blockx : mcConfig.getInstance().getTreeFeller()){
-    						if(blockx != null){
-    							Material mat = Material.getMaterial(blockx.getTypeId());
-    							byte damage = 0;
-    							ItemStack item = new ItemStack(mat, 1, (byte)0, damage);
-    							blockx.setTypeId(0);
-    							if(item.getTypeId() == 17){
-    							blockx.getLocation().getWorld().dropItemNaturally(blockx.getLocation(), item);
-    							mcWoodCutting.getInstance().woodCuttingProcCheck(player, blockx, blockx.getLocation());
-    							mcUsers.getProfile(player).addWoodcuttingGather(7);
-    							}
-    							if(item.getTypeId() == 18){
-    								mat = Material.getMaterial(6);
-    								item = new ItemStack(mat, 1, (byte)0, damage);
-    								if(Math.random() * 10 > 8)
-    								blockx.getLocation().getWorld().dropItemNaturally(blockx.getLocation(), item);
-    							}
-    						}
-    					}
-    					/*
-    					 * NOTE TO SELF
-    					 * I NEED TO REMOVE TREE FELL BLOCKS FROM BEING WATCHED AFTER THIS CODE IS EXECUTED
-    					 * OR ELSE IT COULD BE A MEMORY LEAK SITUATION
-    					 */
-    					mcConfig.getInstance().clearTreeFeller();
-    				}
-    		}
-    		/*
-    		 * EXCAVATION
-    		 */
-    		if(mcPermissions.getInstance().excavation(player) && block != null && player != null)
-    		mcExcavation.getInstance().excavationProcCheck(block, player);
-    		/*
-    		 * EXPLOIT COUNTERMEASURES
-    		 */
-    		mcConfig.getInstance().addBlockWatch(block);
-    		if(player != null && mcUsers.getProfile(player).getWoodCuttingGatherInt() >= mcUsers.getProfile(player).getXpToLevel("woodcutting")){
-    			int skillups = 0;
-    			while(mcUsers.getProfile(player).getWoodCuttingGatherInt() >= mcUsers.getProfile(player).getXpToLevel("woodcutting")){
-    				skillups++;
-    				mcUsers.getProfile(player).removeWoodCuttingGather(mcUsers.getProfile(player).getXpToLevel("woodcutting"));
-    				mcUsers.getProfile(player).skillUpWoodCutting(1);
-    			}
-    			player.sendMessage(ChatColor.YELLOW+"WoodCutting skill increased by "+skillups+"."+" Total ("+mcUsers.getProfile(player).getWoodCutting()+")");	
-    		}
+	    		if(mcm.getInstance().isMiningPick(inhand) && mcPermissions.getInstance().mining(player))
+		    			mcMining.getInstance().miningBlockCheck(player, block);
+	    		/*
+	    		 * WOOD CUTTING
+	    		 */
+	    		if(player != null && mcm.getInstance().isAxes(inhand) && block.getTypeId() == 17 && mcPermissions.getInstance().woodcutting(player)){
+	    				mcWoodCutting.getInstance().woodCuttingProcCheck(player, block, loc);
+	    				mcUsers.getProfile(player).addWoodcuttingGather(7);
+	    				/*
+	    				 * IF PLAYER IS USING TREEFELLER
+	    				 */
+	    				if(mcPermissions.getInstance().woodcuttingability(player) && mcUsers.getProfile(player).getTreeFellerMode() && block.getTypeId() == 17){
+	    					mcWoodCutting.getInstance().treeFeller(block, player);
+	    					for(Block blockx : mcConfig.getInstance().getTreeFeller()){
+	    						if(blockx != null){
+	    							Material mat = Material.getMaterial(blockx.getTypeId());
+	    							byte damage = 0;
+	    							ItemStack item = new ItemStack(mat, 1, (byte)0, damage);
+	    							blockx.setTypeId(0);
+	    							if(item.getTypeId() == 17){
+	    							blockx.getLocation().getWorld().dropItemNaturally(blockx.getLocation(), item);
+	    							mcWoodCutting.getInstance().woodCuttingProcCheck(player, blockx, blockx.getLocation());
+	    							mcUsers.getProfile(player).addWoodcuttingGather(7);
+	    							}
+	    							if(item.getTypeId() == 18){
+	    								mat = Material.getMaterial(6);
+	    								item = new ItemStack(mat, 1, (byte)0, damage);
+	    								if(Math.random() * 10 > 8)
+	    								blockx.getLocation().getWorld().dropItemNaturally(blockx.getLocation(), item);
+	    							}
+	    						}
+	    					}
+	    					/*
+	    					 * NOTE TO SELF
+	    					 * I NEED TO REMOVE TREE FELL BLOCKS FROM BEING WATCHED AFTER THIS CODE IS EXECUTED
+	    					 * OR ELSE IT COULD BE A MEMORY LEAK SITUATION
+	    					 */
+	    					mcConfig.getInstance().clearTreeFeller();
+	    				}
+	    		}
+	    		/*
+	    		 * EXCAVATION
+	    		 */
+	    		if(mcPermissions.getInstance().excavation(player) && block != null && player != null)
+	    		mcExcavation.getInstance().excavationProcCheck(block, player);
+	    		/*
+	    		 * EXPLOIT COUNTERMEASURES
+	    		 */
+	    		mcConfig.getInstance().addBlockWatch(block);
+	    		if(player != null && mcUsers.getProfile(player).getWoodCuttingGatherInt() >= mcUsers.getProfile(player).getXpToLevel("woodcutting")){
+	    			int skillups = 0;
+	    			while(mcUsers.getProfile(player).getWoodCuttingGatherInt() >= mcUsers.getProfile(player).getXpToLevel("woodcutting")){
+	    				skillups++;
+	    				mcUsers.getProfile(player).removeWoodCuttingGather(mcUsers.getProfile(player).getXpToLevel("woodcutting"));
+	    				mcUsers.getProfile(player).skillUpWoodCutting(1);
+	    			}
+	    			player.sendMessage(ChatColor.YELLOW+"WoodCutting skill increased by "+skillups+"."+" Total ("+mcUsers.getProfile(player).getWoodCutting()+")");	
+	    		}
     		}
     }
     

+ 13 - 13
mcMMO/com/gmail/nossr50/mcCombat.java

@@ -332,19 +332,6 @@ public class mcCombat {
     	 */
     	if(y instanceof Player){
     		Player attacker = (Player)y;
-    		if(Math.random() * 1500 <= mcUsers.getProfile(attacker).getArcheryInt()){
-    			if(x instanceof Player){
-    				Player Defender = (Player)x;
-    				if(!mcParty.getInstance().inSameParty(attacker, Defender)){
-    					event.getEntity().setFireTicks(120);
-    					attacker.sendMessage(ChatColor.RED+"**IGNITION**");
-    					Defender.sendMessage(ChatColor.DARK_RED+"You were struck by a burning arrow!");
-    				}
-    			} else {
-    			event.getEntity().setFireTicks(160);
-    			attacker.sendMessage(ChatColor.RED+"**IGNITION**");
-    			}
-    		}
     		if(event.getProjectile().toString().equals("CraftArrow") && mcPermissions.getInstance().archery(attacker)){
     			if(!mcConfig.getInstance().isTracked(x) && event.getDamage() > 0){
     				mcConfig.getInstance().addArrowTrack(x, 0);
@@ -362,6 +349,19 @@ public class mcCombat {
         				}
     				}
     			}
+    			if(event.getDamage() > 0 && Math.random() * 1500 <= mcUsers.getProfile(attacker).getArcheryInt()){
+        			if(x instanceof Player){
+        				Player Defender = (Player)x;
+        				if(!mcParty.getInstance().inSameParty(attacker, Defender)){
+        					event.getEntity().setFireTicks(120);
+        					attacker.sendMessage(ChatColor.RED+"**IGNITION**");
+        					Defender.sendMessage(ChatColor.DARK_RED+"You were struck by a burning arrow!");
+        				}
+        			} else {
+        			event.getEntity().setFireTicks(160);
+        			attacker.sendMessage(ChatColor.RED+"**IGNITION**");
+        			}
+        		}
     		/*
     		 * Defender is Monster
     		 */

+ 13 - 13
mcMMO/com/gmail/nossr50/mcExcavation.java

@@ -53,19 +53,9 @@ public class mcExcavation {
     				loc.getWorld().dropItemNaturally(loc, is);
     			}
     		}
-    		if(mcUsers.getProfile(player).getExcavationInt() > 150){
-    			//CHANCE TO GET MUSIC
-    			if(mcLoadProperties.music == true && Math.random() * 2000 > 1999){
-    				mcUsers.getProfile(player).addExcavationGather(300);
-    				mat = Material.getMaterial(2256);
-    				is = new ItemStack(mat, 1, (byte)0, (byte)0);
-    				loc.getWorld().dropItemNaturally(loc, is);
-    			}
-    			
-    		}
     		if(mcUsers.getProfile(player).getExcavationInt() > 350){
     			//CHANCE TO GET DIAMOND
-    			if(mcLoadProperties.diamond == true && Math.random() * 500 > 499){
+    			if(mcLoadProperties.diamond == true && Math.random() * 750 > 749){
     				mcUsers.getProfile(player).addExcavationGather(100);
         				mat = Material.getMaterial(264);
         				is = new ItemStack(mat, 1, (byte)0, (byte)0);
@@ -73,7 +63,17 @@ public class mcExcavation {
     			}
     		}
     		if(mcUsers.getProfile(player).getExcavationInt() > 250){
-    			//CHANCE TO GET MUSIC
+    			//CHANCE TO GET YELLOW MUSIC
+    			if(mcLoadProperties.music == true && Math.random() * 2000 > 1999){
+    				mcUsers.getProfile(player).addExcavationGather(300);
+    				mat = Material.getMaterial(2256);
+    				is = new ItemStack(mat, 1, (byte)0, (byte)0);
+    				loc.getWorld().dropItemNaturally(loc, is);
+    			}
+    			
+    		}
+    		if(mcUsers.getProfile(player).getExcavationInt() > 350){
+    			//CHANCE TO GET GREEN MUSIC
     			if(mcLoadProperties.music == true && Math.random() * 2000 > 1999){
     				mcUsers.getProfile(player).addExcavationGather(300);
     				mat = Material.getMaterial(2257);
@@ -136,7 +136,7 @@ public class mcExcavation {
     		}
     		//CHANCE TO GET BONES
     		if(mcLoadProperties.bones == true && mcUsers.getProfile(player).getExcavationInt() > 175){
-        		if(Math.random() * 10 > 6){
+        		if(Math.random() * 10 > 9){
         			mcUsers.getProfile(player).addExcavationGather(3);
         			mat = Material.getMaterial(352);
     				is = new ItemStack(mat, 1, (byte)0, (byte)0);

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

@@ -32,7 +32,7 @@ public class mcMMO extends JavaPlugin {
     
     //herp
     public void onEnable() {
-    	mcMMO_Timer.schedule(new mcTimer(this), 0, (long)(2000));
+    	//mcMMO_Timer.schedule(new mcTimer(this), 0, (long)(2000));
     	//Make the directory if it does not exist
     	new File(maindirectory).mkdir();
     	//Make the file if it does not exist

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

@@ -26,7 +26,6 @@ public class mcMining {
 		ItemStack item = new ItemStack(mat, 1, (byte)0, damage);
 		if(block.getTypeId() != 73 && block.getTypeId() != 74 && block.getTypeId() != 56 && block.getTypeId() != 21 && block.getTypeId() != 1 && block.getTypeId() != 16)
 		loc.getWorld().dropItemNaturally(loc, item);
-		//hurrdurr
 		if(block.getTypeId() == 73 || block.getTypeId() == 74){
 			mat = Material.getMaterial(331);
 			item = new ItemStack(mat, 1, (byte)0, damage);

+ 2 - 0
mcMMO/com/gmail/nossr50/mcPlayerListener.java

@@ -69,6 +69,7 @@ public class mcPlayerListener extends PlayerListener {
     	Block block = event.getBlockClicked();
     	Player player = event.getPlayer();
     	ItemStack is = player.getItemInHand();
+    	/*
     	if(mcPermissions.getInstance().woodcuttingability(player) && mcm.getInstance().isAxes(is)){
     		if(block != null){
     		if(!mcm.getInstance().abilityBlockCheck(block))
@@ -83,6 +84,7 @@ public class mcPlayerListener extends PlayerListener {
     			player.sendMessage(ChatColor.RED+"You are too tired to use that ability again.");
     		}
     	}
+    	*/
     	if(mcPermissions.getInstance().herbalism(player)){
     	//BREADCHECK, CHECKS HERBALISM SKILL FOR BREAD HP MODIFIERS
     	mcHerbalism.getInstance().breadCheck(player, is);

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

@@ -13,7 +13,7 @@ import org.bukkit.plugin.Plugin;
 public class mcUsers {
     private static volatile mcUsers instance;
     protected static final Logger log = Logger.getLogger("Minecraft");
-    String location = "mcmmo.users";
+    String location = "plugins/mcMMO/mcmmo.users";
     public static PlayerList players = new PlayerList();
     private Properties properties = new Properties();
     
@@ -161,7 +161,7 @@ class PlayerList
 		Player thisplayer;
 		char defaultColor;
 
-        String location = "mcmmo.users";
+        String location = "plugins/mcMMO/mcmmo.users";
 		
 		
 		//=====================================================================

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

@@ -224,7 +224,13 @@ public class mcm {
     		return false;
     	}
     }
-    
+    public boolean isMiningPick(ItemStack is){
+    	if(is.getTypeId() == 270 || is.getTypeId() == 274 || is.getTypeId() == 285 || is.getTypeId() == 257 || is.getTypeId() == 278){
+    		return true;
+    	} else {
+    		return false;
+    	}
+    }
     public void mcmmoHelpCheck(String[] split, Player player, PlayerChatEvent event){
     	if(split[0].equalsIgnoreCase("/woodcutting")){
 			event.setCancelled(true);

+ 1 - 1
mcMMO/plugin.yml

@@ -1,3 +1,3 @@
 name: mcMMO
 main: com.gmail.nossr50.mcMMO
-version: 0.9 WIP
+version: 0.8.17