Browse Source

Changes up to 0.8.1

nossr50 14 years ago
parent
commit
ab7fe5320a

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

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

+ 25 - 28
mcMMO/com/gmail/nossr50/mcTimer.java

@@ -45,24 +45,15 @@ public class mcTimer extends TimerTask{
 	public void run() {
 	public void run() {
 		for(World world : plugin.getServer().getWorlds()){
 		for(World world : plugin.getServer().getWorlds()){
 			for(Entity entity : world.getEntities()){
 			for(Entity entity : world.getEntities()){
-				if(entity == null || getHealth(entity) <= 0)
+				if(entity == null)
 					return;
 					return;
-				if(mcConfig.getInstance().getBleedCount(entity) < 1)
+				/*
+				if(!mcConfig.getInstance().isBleedTracked(entity))
 					return;
 					return;
-				if(mcConfig.getInstance().isBleedTracked(entity)){
-					if(entity instanceof Player){
-						Player player = (Player)entity;
-						if(player.getHealth() >= 1){
-						player.setHealth(calculateMinusHealth(player.getHealth(), 1));
-						player.sendMessage(ChatColor.RED+"**BLEED**");
-						if(player.getHealth() <= 0){
-							for(ItemStack items : player.getInventory().getContents()){
-								if(items.getTypeId() != 0)
-								player.getLocation().getWorld().dropItemNaturally(player.getLocation(), items);
-							}
-						}
-					}
-					}
+				*/
+				if(getHealth(entity) <= 0)
+					return;
+				/*
 					if(entity instanceof Animals){
 					if(entity instanceof Animals){
 						Animals animals = (Animals)entity;
 						Animals animals = (Animals)entity;
 						if(animals.getHealth() >= 1){
 						if(animals.getHealth() >= 1){
@@ -77,22 +68,28 @@ public class mcTimer extends TimerTask{
 						if(monster.getHealth() >= 1){
 						if(monster.getHealth() >= 1){
 						monster.setHealth(calculateMinusHealth(monster.getHealth(), 1));
 						monster.setHealth(calculateMinusHealth(monster.getHealth(), 1));
 						if(monster.getHealth() <= 0){
 						if(monster.getHealth() <= 0){
-							mcm.getInstance().simulateNaturalDrops(entity);
+						mcm.getInstance().simulateNaturalDrops(entity);
 						}
 						}
 						}
 						}
 					}
 					}
-				}
-			}
-		}
-		for(World world : plugin.getServer().getWorlds()){
-			for(Entity entity : world.getEntities()){
-				if(mcConfig.getInstance().isBleedTracked(entity)){
-					if(mcConfig.getInstance().getBleedCount(entity) >= 2){
-						mcConfig.getInstance().removeBleedCount(entity, 1);
-					} else if(mcConfig.getInstance().getBleedCount(entity) == 1){
-						mcConfig.getInstance().removeBleedTrack(entity);
+					*/
+					if(entity instanceof Player){
+						Player player = (Player)entity;
+						if(player.getHealth() >= 1 && mcUsers.getProfile(player).getBleedTicks() >= 1){
+						player.setHealth(calculateMinusHealth(player.getHealth(), 1));
+						player.sendMessage(ChatColor.RED+"**BLEED**");
+						if(player.getHealth() <= 0){
+							mcUsers.getProfile(player).setBleedTicks(0);
+							for(ItemStack items : player.getInventory().getContents()){
+								if(items.getTypeId() != 0)
+								player.getLocation().getWorld().dropItemNaturally(player.getLocation(), items);
+							}
+						}
+						if(mcUsers.getProfile(player).getBleedTicks() >= 1){
+							mcUsers.getProfile(player).setBleedTicks(mcUsers.getProfile(player).getBleedTicks() - 1);
+						}
+					}
 					}
 					}
-				}
 			}
 			}
 		}
 		}
 		if(thecount == 10 || thecount == 20 || thecount == 30 || thecount == 40){
 		if(thecount == 10 || thecount == 20 || thecount == 30 || thecount == 40){

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

@@ -156,7 +156,7 @@ class PlayerList
 		private String playerName, gather, wgather, woodcutting, repair, mining, party, myspawn, myspawnworld, unarmed, herbalism, excavation,
 		private String playerName, gather, wgather, woodcutting, repair, mining, party, myspawn, myspawnworld, unarmed, herbalism, excavation,
 		archery, swords, axes, invite, acrobatics, repairgather, unarmedgather, herbalismgather, excavationgather, archerygather, swordsgather, axesgather, acrobaticsgather;
 		archery, swords, axes, invite, acrobatics, repairgather, unarmedgather, herbalismgather, excavationgather, archerygather, swordsgather, axesgather, acrobaticsgather;
 		private boolean dead;
 		private boolean dead;
-		private int recentlyhurt = 0;
+		private int recentlyhurt = 0, bleedticks = 0;
 		Player thisplayer;
 		Player thisplayer;
 		char defaultColor;
 		char defaultColor;
 
 
@@ -421,6 +421,17 @@ class PlayerList
 				recentlyhurt--;
 				recentlyhurt--;
 			}
 			}
 		}
 		}
+		public void decreaseBleedTicks(){
+			if(bleedticks >= 1){
+				bleedticks--;
+			}
+		}
+		public Integer getBleedTicks(){
+			return bleedticks;
+		}
+		public void setBleedTicks(Integer newvalue){
+			bleedticks = newvalue;
+		}
 		public Integer getRecentlyHurt(){
 		public Integer getRecentlyHurt(){
 			return recentlyhurt;
 			return recentlyhurt;
 		}
 		}

+ 16 - 0
mcMMO/com/gmail/nossr50/mcm.java

@@ -753,21 +753,37 @@ public class mcm {
 			if(mcUsers.getProfile(attacker).getSwordsInt() >= 50 && mcUsers.getProfile(attacker).getSwordsInt() < 200){
 			if(mcUsers.getProfile(attacker).getSwordsInt() >= 50 && mcUsers.getProfile(attacker).getSwordsInt() < 200){
 				if(Math.random() * 10 > 8){
 				if(Math.random() * 10 > 8){
 					mcConfig.getInstance().addBleedTrack(x, 4);
 					mcConfig.getInstance().addBleedTrack(x, 4);
+					if(x instanceof Player){
+						Player target = (Player)x;
+						mcUsers.getProfile(target).setBleedTicks(4);
+					}
 					attacker.sendMessage(ChatColor.RED+"**Your target is bleeding**");
 					attacker.sendMessage(ChatColor.RED+"**Your target is bleeding**");
 				}
 				}
 			} else if(mcUsers.getProfile(attacker).getSwordsInt() >= 200 && mcUsers.getProfile(attacker).getSwordsInt() < 600){
 			} else if(mcUsers.getProfile(attacker).getSwordsInt() >= 200 && mcUsers.getProfile(attacker).getSwordsInt() < 600){
 				if(Math.random() * 10 > 6){
 				if(Math.random() * 10 > 6){
 					mcConfig.getInstance().addBleedTrack(x, 4);
 					mcConfig.getInstance().addBleedTrack(x, 4);
+					if(x instanceof Player){
+						Player target = (Player)x;
+						mcUsers.getProfile(target).setBleedTicks(4);
+					}
 					attacker.sendMessage(ChatColor.RED+"**Your target is bleeding**");
 					attacker.sendMessage(ChatColor.RED+"**Your target is bleeding**");
 				}
 				}
 			} else if(mcUsers.getProfile(attacker).getSwordsInt() >= 600 && mcUsers.getProfile(attacker).getSwordsInt() < 900){
 			} else if(mcUsers.getProfile(attacker).getSwordsInt() >= 600 && mcUsers.getProfile(attacker).getSwordsInt() < 900){
 				if(Math.random() * 10 > 4){
 				if(Math.random() * 10 > 4){
 					mcConfig.getInstance().addBleedTrack(x, 6);
 					mcConfig.getInstance().addBleedTrack(x, 6);
+					if(x instanceof Player){
+						Player target = (Player)x;
+						mcUsers.getProfile(target).setBleedTicks(6);
+					}
 					attacker.sendMessage(ChatColor.RED+"**Your target is bleeding**");
 					attacker.sendMessage(ChatColor.RED+"**Your target is bleeding**");
 				}
 				}
 			} else if(mcUsers.getProfile(attacker).getSwordsInt() >= 900){
 			} else if(mcUsers.getProfile(attacker).getSwordsInt() >= 900){
 				if(Math.random() * 100 > 75){
 				if(Math.random() * 100 > 75){
 					mcConfig.getInstance().addBleedTrack(x, 6);
 					mcConfig.getInstance().addBleedTrack(x, 6);
+					if(x instanceof Player){
+						Player target = (Player)x;
+						mcUsers.getProfile(target).setBleedTicks(6);
+					}
 					attacker.sendMessage(ChatColor.RED+"**Your target is bleeding**");
 					attacker.sendMessage(ChatColor.RED+"**Your target is bleeding**");
 				}
 				}
 			}
 			}

+ 1 - 1
mcMMO/plugin.yml

@@ -1,3 +1,3 @@
 name: mcMMO
 name: mcMMO
 main: com.gmail.nossr50.mcMMO
 main: com.gmail.nossr50.mcMMO
-version: 0.8
+version: 0.8.1