Quellcode durchsuchen

Updates to Blast Mining.

GJ vor 13 Jahren
Ursprung
Commit
8254a8ab0f

+ 4 - 1
src/main/java/com/gmail/nossr50/config/LoadProperties.java

@@ -60,7 +60,8 @@ public class LoadProperties {
 			levelCapFishing, levelCapHerbalism, levelCapMining, levelCapRepair,
 			levelCapSwords, levelCapTaming, levelCapUnarmed, levelCapWoodcutting,
 			anvilID, saveInterval, fishingTier1, fishingTier2, fishingTier3, fishingTier4, fishingTier5,
-			repairStoneLevel, repairIronLevel, repairGoldLevel, arcaneRank1, arcaneRank2, arcaneRank3, arcaneRank4;
+			repairStoneLevel, repairIronLevel, repairGoldLevel, arcaneRank1, arcaneRank2, arcaneRank3, arcaneRank4,
+			detonatorID;
 
 	public static double xpbackground_r, xpbackground_g, xpbackground_b,
 			xpborder_r, xpborder_g, xpborder_b, fishing_r, fishing_g,
@@ -403,5 +404,7 @@ public class LoadProperties {
 		blazeXP = readDouble("Experience.Combat.Multiplier.Blaze", 3.0);
 		magmacubeXP = readDouble("Experience.Combat.Multiplier.Magma_Cube", 2.0);
 		enderdragonXP = readDouble("Experience.Combat.Multiplier.Ender_Dragon", 8.0);
+		
+		detonatorID = readInteger("Skills.Mining.Detonator_ID", 259);
 	}
 }

+ 3 - 3
src/main/java/com/gmail/nossr50/listeners/mcBlockListener.java

@@ -73,10 +73,7 @@ public class mcBlockListener implements Listener
     	
     	//TNT placement checks - needed for Blast Mining
     	if(id == 46 && mcPermissions.getInstance().blastMining(player))
-    	{
-    		int skill = Users.getProfile(player).getSkillLevel(SkillType.MINING);
     		plugin.misc.tntTracker.put(block.getLocation(), player);
-    	}
     	
     	//Check if the blocks placed should be monitored so they do not give out XP in the future
     	if(m.shouldBeWatched(mat))
@@ -159,6 +156,9 @@ public class mcBlockListener implements Listener
     	/*
     	 * MINING
     	 */
+    	//TNT removal checks - needed for Blast Mining
+    	if(id == 46 && plugin.misc.tntTracker.containsKey(block.getLocation()))
+    		plugin.misc.tntTracker.remove(block.getLocation());
     	
     	if(mcPermissions.getInstance().mining(player))
     	{

+ 3 - 9
src/main/java/com/gmail/nossr50/listeners/mcEntityListener.java

@@ -181,19 +181,15 @@ public class mcEntityListener implements Listener
 		if(event.getEntity() instanceof TNTPrimed)
 		{
 			Location location = event.getEntity().getLocation();
-			System.out.println("TNT Primed.");
 			
 			//Ugly code to make it recognize the location
 			location.setX(location.getBlockX()+1);
 			location.setY(location.getBlockY());
 			location.setZ(location.getBlockZ()+1);
-			System.out.println(location.toString());
 			
-			if(plugin.misc.tntTracker.get(location) != null)
+			if(plugin.misc.tntTracker.containsKey(location))
 			{
-				System.out.println("Being Tracked.");
 				Player player = plugin.misc.tntTracker.get(location);
-				
 				BlastMining.biggerBombs(Users.getProfile(player).getSkillLevel(SkillType.MINING), event);
 			}
 		}		
@@ -205,19 +201,17 @@ public class mcEntityListener implements Listener
 		if(event.getEntity() instanceof TNTPrimed)
 		{
 			Location location = event.getEntity().getLocation();
-			System.out.println("TNT Explode.");
 			
 			//Ugly code to make it recognize the location
 			location.setX(location.getBlockX()+1);
 			location.setY(location.getBlockY());
 			location.setZ(location.getBlockZ()+1);
-			System.out.println(location.toString());
 
-			if(plugin.misc.tntTracker.get(location) != null)
+			if(plugin.misc.tntTracker.containsKey(location))
 			{
-				System.out.println("Being Tracked.");
 				Player player = plugin.misc.tntTracker.get(location);
 				BlastMining.dropProcessing(Users.getProfile(player).getSkillLevel(SkillType.MINING), event, plugin);
+				plugin.misc.tntTracker.remove(location);
 			}
 		}
 	}

+ 1 - 3
src/main/java/com/gmail/nossr50/listeners/mcPlayerListener.java

@@ -282,7 +282,7 @@ public class mcPlayerListener implements Listener
 			}
 		}
 		
-		if(action == Action.RIGHT_CLICK_AIR)
+		if(action == Action.RIGHT_CLICK_AIR && is.getTypeId() == LoadProperties.detonatorID)
 		{
 			Block b = player.getTargetBlock(null, 100);
 			if(b.getType().equals(Material.TNT))
@@ -290,8 +290,6 @@ public class mcPlayerListener implements Listener
 				TNTPrimed tnt = player.getWorld().spawn(b.getLocation(), TNTPrimed.class);
 				b.setType(Material.AIR);
 				tnt.setFuseTicks(0);
-				if(plugin.misc.tntTracker.get(tnt.getLocation()) != null)
-					System.out.println(tnt.getLocation().toString());
 			}
 		}
 	}

+ 1 - 0
src/main/resources/config.yml

@@ -126,6 +126,7 @@ Skills:
     Mining:
         Level_Cap: 0
         Requires_Pickaxe: true
+        Detonator_ID: 259
     Repair:
         Level_Cap: 0
         Anvil_Messages: true