mirror of
				https://github.com/mcMMO-Dev/mcMMO.git
				synced 2025-11-04 02:53:43 +01:00 
			
		
		
		
	Another WIP
This commit is contained in:
		@@ -227,8 +227,6 @@ public class Combat
 | 
			
		||||
		 */
 | 
			
		||||
		if(event instanceof EntityDamageByEntityEvent && event.getEntity() instanceof Player)
 | 
			
		||||
		{
 | 
			
		||||
			Player defender = (Player)event.getEntity();
 | 
			
		||||
			Swords.parryCheck((EntityDamageByEntityEvent) event, defender);
 | 
			
		||||
			Swords.counterAttackChecks((EntityDamageByEntityEvent)event);
 | 
			
		||||
			Acrobatics.dodgeChecks((EntityDamageByEntityEvent)event);
 | 
			
		||||
		}
 | 
			
		||||
@@ -312,19 +310,6 @@ public class Combat
 | 
			
		||||
    		if(mcPermissions.getInstance().archery(attacker))
 | 
			
		||||
    		{
 | 
			
		||||
    			Archery.trackArrows(pluginx, x, event, attacker);
 | 
			
		||||
    			/*
 | 
			
		||||
    			 * DAMAGE MODIFIER
 | 
			
		||||
    			 */
 | 
			
		||||
    			if(PPa.getSkillLevel(SkillType.ARCHERY) >= 50 && PPa.getSkillLevel(SkillType.ARCHERY) < 250)
 | 
			
		||||
    				event.setDamage(event.getDamage()+1);
 | 
			
		||||
    			if(PPa.getSkillLevel(SkillType.ARCHERY) >= 250 && PPa.getSkillLevel(SkillType.ARCHERY) < 575)
 | 
			
		||||
    				event.setDamage(event.getDamage()+2);
 | 
			
		||||
    			if(PPa.getSkillLevel(SkillType.ARCHERY) >= 575 && PPa.getSkillLevel(SkillType.ARCHERY) < 725)
 | 
			
		||||
    				event.setDamage(event.getDamage()+3);
 | 
			
		||||
    			if(PPa.getSkillLevel(SkillType.ARCHERY) >= 725 && PPa.getSkillLevel(SkillType.ARCHERY) < 1000)
 | 
			
		||||
    				event.setDamage(event.getDamage()+4);
 | 
			
		||||
    			if(PPa.getSkillLevel(SkillType.ARCHERY) >= 1000)
 | 
			
		||||
    				event.setDamage(event.getDamage()+5);
 | 
			
		||||
    			
 | 
			
		||||
    			/*
 | 
			
		||||
    			 * IGNITION
 | 
			
		||||
 
 | 
			
		||||
@@ -132,17 +132,6 @@ public class Commands
 | 
			
		||||
			player.sendMessage(mcLocale.getString("m.WoodCuttingTreeFellerLength", new Object[] {ticks})); 
 | 
			
		||||
		}
 | 
			
		||||
		else if(label.equalsIgnoreCase("archery") || split[0].toLowerCase().equalsIgnoreCase(mcLocale.getString("m.SkillArchery").toLowerCase())){ 
 | 
			
		||||
			Integer rank = 0;
 | 
			
		||||
			if(PP.getSkillLevel(SkillType.ARCHERY) >= 50)
 | 
			
		||||
				rank++;
 | 
			
		||||
			if(PP.getSkillLevel(SkillType.ARCHERY) >= 250)
 | 
			
		||||
				rank++;
 | 
			
		||||
			if(PP.getSkillLevel(SkillType.ARCHERY) >= 575)
 | 
			
		||||
				rank++;
 | 
			
		||||
			if(PP.getSkillLevel(SkillType.ARCHERY) >= 725)
 | 
			
		||||
				rank++;
 | 
			
		||||
			if(PP.getSkillLevel(SkillType.ARCHERY) >= 1000)
 | 
			
		||||
				rank++;
 | 
			
		||||
			float skillvalue = (float)PP.getSkillLevel(SkillType.ARCHERY);
 | 
			
		||||
			String percentage = String.valueOf((skillvalue / 1000) * 100);
 | 
			
		||||
 | 
			
		||||
@@ -171,13 +160,11 @@ public class Commands
 | 
			
		||||
			player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] {mcLocale.getString("m.Effects")})); 
 | 
			
		||||
			player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] {mcLocale.getString("m.EffectsArchery1_0"), mcLocale.getString("m.EffectsArchery1_1")}));  
 | 
			
		||||
			player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] {mcLocale.getString("m.EffectsArchery2_0"), mcLocale.getString("m.EffectsArchery2_1")}));  
 | 
			
		||||
			player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] {mcLocale.getString("m.EffectsArchery3_0"), mcLocale.getString("m.EffectsArchery3_1")}));  
 | 
			
		||||
			player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] {mcLocale.getString("m.EffectsArchery4_0"), mcLocale.getString("m.EffectsArchery4_1")}));  
 | 
			
		||||
			player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] {mcLocale.getString("m.YourStats")})); 
 | 
			
		||||
			player.sendMessage(mcLocale.getString("m.ArcheryDazeChance", new Object[] {percentagedaze})); 
 | 
			
		||||
			player.sendMessage(mcLocale.getString("m.ArcheryRetrieveChance", new Object[] {percentage})); 
 | 
			
		||||
			player.sendMessage(mcLocale.getString("m.ArcheryIgnitionLength", new Object[] {(ignition / 20)})); 
 | 
			
		||||
			player.sendMessage(mcLocale.getString("m.ArcheryDamagePlus", new Object[] {rank})); 
 | 
			
		||||
			player.sendMessage(mcLocale.getString("m.ArcheryIgnitionLength", new Object[] {(ignition / 20)}));  
 | 
			
		||||
		}
 | 
			
		||||
		else if(label.equalsIgnoreCase("axes") || split[0].toLowerCase().equalsIgnoreCase(mcLocale.getString("m.SkillAxes"))){ 
 | 
			
		||||
			String percentage;
 | 
			
		||||
@@ -213,7 +200,7 @@ public class Commands
 | 
			
		||||
		}
 | 
			
		||||
		else if(label.equalsIgnoreCase("swords") || split[0].toLowerCase().equalsIgnoreCase(mcLocale.getString("m.SkillSwords").toLowerCase())){ 
 | 
			
		||||
			int bleedrank = 2;
 | 
			
		||||
			String percentage, parrypercentage = null, counterattackpercentage;
 | 
			
		||||
			String percentage, counterattackpercentage;
 | 
			
		||||
			float skillvalue = (float)PP.getSkillLevel(SkillType.SWORDS);
 | 
			
		||||
			if(PP.getSkillLevel(SkillType.SWORDS) < 750){
 | 
			
		||||
				percentage = String.valueOf((skillvalue / 1000) * 100);
 | 
			
		||||
@@ -223,12 +210,6 @@ public class Commands
 | 
			
		||||
			if(skillvalue >= 750)
 | 
			
		||||
				bleedrank+=1;
 | 
			
		||||
 | 
			
		||||
			if(PP.getSkillLevel(SkillType.SWORDS) <= 900){
 | 
			
		||||
				parrypercentage = String.valueOf((skillvalue / 3000) * 100);
 | 
			
		||||
			} else {
 | 
			
		||||
				parrypercentage = "30"; 
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			if(PP.getSkillLevel(SkillType.SWORDS) <= 600){
 | 
			
		||||
				counterattackpercentage = String.valueOf((skillvalue / 2000) * 100);
 | 
			
		||||
			} else {
 | 
			
		||||
@@ -250,14 +231,12 @@ public class Commands
 | 
			
		||||
			player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] {mcLocale.getString("m.EffectsSwords1_0"), mcLocale.getString("m.EffectsSwords1_1")}));  
 | 
			
		||||
			player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] {mcLocale.getString("m.EffectsSwords2_0"), mcLocale.getString("m.EffectsSwords2_1")}));  
 | 
			
		||||
			player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] {mcLocale.getString("m.EffectsSwords3_0"), mcLocale.getString("m.EffectsSwords3_1")}));  
 | 
			
		||||
			player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] {mcLocale.getString("m.EffectsSwords4_0"), mcLocale.getString("m.EffectsSwords4_1")}));  
 | 
			
		||||
			player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] {mcLocale.getString("m.EffectsSwords5_0"), mcLocale.getString("m.EffectsSwords5_1")}));  
 | 
			
		||||
			player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] {mcLocale.getString("m.YourStats")})); 
 | 
			
		||||
			player.sendMessage(mcLocale.getString("m.SwordsCounterAttChance", new Object[] {counterattackpercentage})); 
 | 
			
		||||
			player.sendMessage(mcLocale.getString("m.SwordsBleedLength", new Object[] {bleedrank})); 
 | 
			
		||||
			player.sendMessage(mcLocale.getString("m.SwordsTickNote")); 
 | 
			
		||||
			player.sendMessage(mcLocale.getString("m.SwordsBleedLength", new Object[] {percentage})); 
 | 
			
		||||
			player.sendMessage(mcLocale.getString("m.SwordsParryChance", new Object[] {parrypercentage})); 
 | 
			
		||||
			player.sendMessage(mcLocale.getString("m.SwordsSSLength", new Object[] {ticks})); 
 | 
			
		||||
 | 
			
		||||
		}
 | 
			
		||||
@@ -369,23 +348,6 @@ public class Commands
 | 
			
		||||
			player.sendMessage(mcLocale.getString("m.UnarmedBerserkLength", new Object[] {ticks})); 
 | 
			
		||||
		}
 | 
			
		||||
		else if(label.equalsIgnoreCase("herbalism") || split[0].toLowerCase().equalsIgnoreCase(mcLocale.getString("m.SkillHerbalism").toLowerCase())){ 
 | 
			
		||||
			int rank = 0;
 | 
			
		||||
			if(PP.getSkillLevel(SkillType.HERBALISM) >= 50)
 | 
			
		||||
				rank++;
 | 
			
		||||
			if (PP.getSkillLevel(SkillType.HERBALISM) >= 150)
 | 
			
		||||
				rank++;
 | 
			
		||||
			if (PP.getSkillLevel(SkillType.HERBALISM) >= 250)
 | 
			
		||||
				rank++;
 | 
			
		||||
			if (PP.getSkillLevel(SkillType.HERBALISM) >= 350)
 | 
			
		||||
				rank++;
 | 
			
		||||
			if (PP.getSkillLevel(SkillType.HERBALISM) >= 450)
 | 
			
		||||
				rank++;
 | 
			
		||||
			if (PP.getSkillLevel(SkillType.HERBALISM) >= 550)
 | 
			
		||||
				rank++;
 | 
			
		||||
			if (PP.getSkillLevel(SkillType.HERBALISM) >= 650)
 | 
			
		||||
				rank++;
 | 
			
		||||
			if (PP.getSkillLevel(SkillType.HERBALISM) >= 750)
 | 
			
		||||
				rank++;
 | 
			
		||||
			int bonus = 0;
 | 
			
		||||
			if(PP.getSkillLevel(SkillType.HERBALISM) >= 200)
 | 
			
		||||
				bonus++;
 | 
			
		||||
@@ -412,14 +374,12 @@ public class Commands
 | 
			
		||||
			player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] {mcLocale.getString("m.EffectsHerbalism1_0"), mcLocale.getString("m.EffectsHerbalism1_1")}));  
 | 
			
		||||
			player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] {mcLocale.getString("m.EffectsHerbalism2_0"), mcLocale.getString("m.EffectsHerbalism2_1")}));  
 | 
			
		||||
			player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] {mcLocale.getString("m.EffectsHerbalism3_0"), mcLocale.getString("m.EffectsHerbalism3_1")}));  
 | 
			
		||||
			player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] {mcLocale.getString("m.EffectsHerbalism4_0"), mcLocale.getString("m.EffectsHerbalism4_1")}));  
 | 
			
		||||
			player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] {mcLocale.getString("m.EffectsHerbalism5_0"), mcLocale.getString("m.EffectsHerbalism5_1")}));  
 | 
			
		||||
			player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] {mcLocale.getString("m.YourStats")})); 
 | 
			
		||||
			player.sendMessage(mcLocale.getString("m.HerbalismGreenTerraLength", new Object[] {ticks})); 
 | 
			
		||||
			player.sendMessage(mcLocale.getString("m.HerbalismGreenThumbChance", new Object[] {gpercentage})); 
 | 
			
		||||
			player.sendMessage(mcLocale.getString("m.HerbalismGreenThumbStage", new Object[] {bonus})); 
 | 
			
		||||
			player.sendMessage(mcLocale.getString("m.HerbalismDoubleDropChance", new Object[] {percentage})); 
 | 
			
		||||
			player.sendMessage(mcLocale.getString("m.HerbalismFoodPlus", new Object[] {rank})); 
 | 
			
		||||
			player.sendMessage(mcLocale.getString("m.HerbalismDoubleDropChance", new Object[] {percentage}));  
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		else if(label.equalsIgnoreCase("excavation") || split[0].toLowerCase().equalsIgnoreCase(mcLocale.getString("m.SkillExcavation").toLowerCase())) 
 | 
			
		||||
 
 | 
			
		||||
@@ -1,76 +0,0 @@
 | 
			
		||||
package com.gmail.nossr50.datatypes;
 | 
			
		||||
 | 
			
		||||
import java.util.HashMap;
 | 
			
		||||
 | 
			
		||||
import org.bukkit.entity.*;
 | 
			
		||||
 | 
			
		||||
public class Mob
 | 
			
		||||
{
 | 
			
		||||
	public HashMap<Integer, Short> mobDiff = new HashMap<Integer, Short>();
 | 
			
		||||
	public HashMap<Integer, Boolean> isAggressive = new HashMap<Integer, Boolean>();
 | 
			
		||||
	
 | 
			
		||||
	public void assignDifficulty(Entity entity)
 | 
			
		||||
	{
 | 
			
		||||
		short x = 0;
 | 
			
		||||
		
 | 
			
		||||
		if(entity.getLocation().getY() >= 45)
 | 
			
		||||
		{
 | 
			
		||||
			//LEVEL 2
 | 
			
		||||
			if(Math.random() * 100 > 50)
 | 
			
		||||
			{
 | 
			
		||||
				x = 0;
 | 
			
		||||
			}
 | 
			
		||||
			//LEVEL 3
 | 
			
		||||
			else
 | 
			
		||||
			{
 | 
			
		||||
				x = 1;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		else
 | 
			
		||||
		{
 | 
			
		||||
			double y = Math.random() * 100;
 | 
			
		||||
			//HIGH CHANCE FOR 5's
 | 
			
		||||
			if(entity.getLocation().getY() < 20)
 | 
			
		||||
			{
 | 
			
		||||
				//ASSIGN INTO THE 5 RANKS
 | 
			
		||||
				if(y >= 0 && y < 50)
 | 
			
		||||
					x = 0;
 | 
			
		||||
				if(y >= 50 && y < 80)
 | 
			
		||||
					x = 1;
 | 
			
		||||
				if(y >= 80 && y < 95)
 | 
			
		||||
					x = 2;
 | 
			
		||||
				if(y >= 95 && y < 98)
 | 
			
		||||
					x = 3;
 | 
			
		||||
				if(y >= 98 && y <= 100)
 | 
			
		||||
					x = 4;
 | 
			
		||||
			}
 | 
			
		||||
			//HIGH CHANCE FOR 4's
 | 
			
		||||
			else
 | 
			
		||||
			{
 | 
			
		||||
				//ASSIGN INTO THE 5 RANKS
 | 
			
		||||
				if(y >= 0 && y < 50)
 | 
			
		||||
					x = 0;
 | 
			
		||||
				if(y >= 50 && y < 74)
 | 
			
		||||
					x = 1;
 | 
			
		||||
				if(y >= 74 && y < 89)
 | 
			
		||||
					x = 2;
 | 
			
		||||
				if(y >= 89 && y < 99)
 | 
			
		||||
					x = 3;
 | 
			
		||||
				if(y >= 99 && y <= 100)
 | 
			
		||||
					x = 4;
 | 
			
		||||
			}
 | 
			
		||||
				if(x > 1)
 | 
			
		||||
				{
 | 
			
		||||
					isAggressive.put(entity.getEntityId(), false);
 | 
			
		||||
				}
 | 
			
		||||
				
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		if(!mobDiff.containsKey(entity.getEntityId()))
 | 
			
		||||
		{
 | 
			
		||||
			mobDiff.put(entity.getEntityId(), x);
 | 
			
		||||
			//System.out.println("Mob "+entity.getEntityId()+" (DIFFICULTY) "+
 | 
			
		||||
					//(x +1)+"(DEPTH) "+entity.getLocation().getY());
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
@@ -2,7 +2,6 @@ package com.gmail.nossr50.listeners;
 | 
			
		||||
 | 
			
		||||
import org.bukkit.entity.Entity;
 | 
			
		||||
import org.bukkit.entity.LivingEntity;
 | 
			
		||||
import org.bukkit.entity.Monster;
 | 
			
		||||
import org.bukkit.entity.Player;
 | 
			
		||||
import org.bukkit.entity.Wolf;
 | 
			
		||||
import org.bukkit.event.entity.CreatureSpawnEvent;
 | 
			
		||||
@@ -12,7 +11,6 @@ import org.bukkit.event.entity.EntityDamageEvent;
 | 
			
		||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
 | 
			
		||||
import org.bukkit.event.entity.EntityDeathEvent;
 | 
			
		||||
import org.bukkit.event.entity.EntityListener;
 | 
			
		||||
import org.bukkit.event.entity.EntityTargetEvent;
 | 
			
		||||
import org.bukkit.inventory.ItemStack;
 | 
			
		||||
 | 
			
		||||
import com.gmail.nossr50.Combat;
 | 
			
		||||
@@ -149,15 +147,9 @@ public class mcEntityListener extends EntityListener
 | 
			
		||||
    
 | 
			
		||||
    public void onEntityDeath(EntityDeathEvent event) 
 | 
			
		||||
    {
 | 
			
		||||
    	
 | 
			
		||||
    	Entity x = event.getEntity();
 | 
			
		||||
    	x.setFireTicks(0);
 | 
			
		||||
    	
 | 
			
		||||
    	//cleanup mob diff
 | 
			
		||||
    	if(plugin.mob.mobDiff.containsKey(event.getEntity().getEntityId()))
 | 
			
		||||
    			plugin.mob.mobDiff.remove(event.getEntity().getEntityId());
 | 
			
		||||
    	
 | 
			
		||||
    	
 | 
			
		||||
    	//Remove bleed track
 | 
			
		||||
    	if(plugin.misc.bleedTracker.contains((LivingEntity)x))
 | 
			
		||||
    		plugin.misc.addToBleedRemovalQue((LivingEntity)x);
 | 
			
		||||
@@ -183,29 +175,9 @@ public class mcEntityListener extends EntityListener
 | 
			
		||||
    	if(reason == SpawnReason.SPAWNER && !LoadProperties.xpGainsMobSpawners)
 | 
			
		||||
    	{
 | 
			
		||||
    		plugin.misc.mobSpawnerList.add(event.getEntity());
 | 
			
		||||
    	} else 
 | 
			
		||||
    	{
 | 
			
		||||
    		if(event.getEntity() instanceof Monster && !plugin.mob.mobDiff.containsKey(event.getEntity().getEntityId()))
 | 
			
		||||
        		plugin.mob.assignDifficulty(event.getEntity());
 | 
			
		||||
    	}
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    public void onEntityTarget(EntityTargetEvent event) 
 | 
			
		||||
	{
 | 
			
		||||
    	
 | 
			
		||||
		int type = event.getEntity().getEntityId();
 | 
			
		||||
		//Make 3+ non-aggressive
 | 
			
		||||
		if(event.getEntity() instanceof Monster 
 | 
			
		||||
				&& plugin.mob.mobDiff.containsKey(type)
 | 
			
		||||
				&& plugin.mob.isAggressive.containsKey(type))
 | 
			
		||||
		{
 | 
			
		||||
			if(plugin.mob.mobDiff.get(type) >= 2 && plugin.mob.isAggressive.get(type) == false)
 | 
			
		||||
			{
 | 
			
		||||
				event.setCancelled(true);
 | 
			
		||||
				event.setTarget(null);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	public boolean isBow(ItemStack is){
 | 
			
		||||
		if (is.getTypeId() == 261){
 | 
			
		||||
			return true;
 | 
			
		||||
 
 | 
			
		||||
@@ -201,22 +201,6 @@ public class mcPlayerListener extends PlayerListener
 | 
			
		||||
			Skills.hoeReadinessCheck(player);
 | 
			
		||||
			Skills.abilityActivationCheck(player);
 | 
			
		||||
		}
 | 
			
		||||
		if(action == Action.RIGHT_CLICK_AIR || action == Action.RIGHT_CLICK_BLOCK)
 | 
			
		||||
		{
 | 
			
		||||
			/*
 | 
			
		||||
			 * HERBALISM MODIFIERS
 | 
			
		||||
			 */
 | 
			
		||||
			if(action == Action.RIGHT_CLICK_BLOCK && !m.abilityBlockCheck(event.getClickedBlock()))
 | 
			
		||||
			{
 | 
			
		||||
				return;
 | 
			
		||||
			}
 | 
			
		||||
			
 | 
			
		||||
			if(mcPermissions.getInstance().herbalism(player))
 | 
			
		||||
			{
 | 
			
		||||
				Herbalism.breadCheck(player, player.getItemInHand());
 | 
			
		||||
				Herbalism.stewCheck(player, player.getItemInHand());
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		/*
 | 
			
		||||
		 * ITEM CHECKS
 | 
			
		||||
 
 | 
			
		||||
@@ -1,10 +1,10 @@
 | 
			
		||||
package com.gmail.nossr50;
 | 
			
		||||
 | 
			
		||||
import com.gmail.nossr50.datatypes.Mob;
 | 
			
		||||
import com.gmail.nossr50.datatypes.PlayerProfile;
 | 
			
		||||
import com.gmail.nossr50.datatypes.SkillType;
 | 
			
		||||
import com.gmail.nossr50.command.Commands;
 | 
			
		||||
import com.gmail.nossr50.config.*;
 | 
			
		||||
import com.gmail.nossr50.runnables.mcTimer;
 | 
			
		||||
import com.gmail.nossr50.spout.SpoutStuff;
 | 
			
		||||
import com.gmail.nossr50.spout.mmoHelper;
 | 
			
		||||
import com.gmail.nossr50.listeners.mcBlockListener;
 | 
			
		||||
@@ -14,6 +14,7 @@ import com.gmail.nossr50.party.Party;
 | 
			
		||||
import com.gmail.nossr50.skills.*;
 | 
			
		||||
import com.nijikokun.bukkit.Permissions.Permissions;
 | 
			
		||||
 | 
			
		||||
import org.blockface.bukkitstats.CallHome;
 | 
			
		||||
import org.bukkit.Bukkit;
 | 
			
		||||
import java.io.BufferedInputStream;
 | 
			
		||||
import java.io.BufferedReader;
 | 
			
		||||
@@ -70,7 +71,6 @@ public class mcMMO extends JavaPlugin
 | 
			
		||||
	//private Timer mcMMO_SpellTimer = new Timer(true);
 | 
			
		||||
 | 
			
		||||
	public static Database database = null;
 | 
			
		||||
	public Mob mob = new Mob();
 | 
			
		||||
	public Misc misc = new Misc(this);
 | 
			
		||||
 | 
			
		||||
	//Config file stuff
 | 
			
		||||
@@ -135,7 +135,6 @@ public class mcMMO extends JavaPlugin
 | 
			
		||||
		pm.registerEvent(Event.Type.BLOCK_PLACE, blockListener, Priority.Normal, this);
 | 
			
		||||
 | 
			
		||||
		//Entity Stuff
 | 
			
		||||
		pm.registerEvent(Event.Type.ENTITY_TARGET, entityListener, Priority.Normal, this);
 | 
			
		||||
		pm.registerEvent(Event.Type.ENTITY_DEATH, entityListener, Priority.Normal, this);
 | 
			
		||||
		pm.registerEvent(Event.Type.ENTITY_DAMAGE, entityListener, Priority.Monitor, this);
 | 
			
		||||
		pm.registerEvent(Event.Type.CREATURE_SPAWN, entityListener, Priority.Normal, this);
 | 
			
		||||
@@ -174,6 +173,7 @@ public class mcMMO extends JavaPlugin
 | 
			
		||||
		System.out.println(pdfFile.getName() + " version " + pdfFile.getVersion() + " is enabled!" );
 | 
			
		||||
		
 | 
			
		||||
		Bukkit.getServer().getScheduler().scheduleAsyncRepeatingTask(this, mcMMO_Timer, 0, 20);
 | 
			
		||||
		CallHome.load(this); //Swearword's blockface usage statistics, only dials home once
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public PlayerProfile getPlayerProfile(Player player)
 | 
			
		||||
 
 | 
			
		||||
@@ -1,91 +0,0 @@
 | 
			
		||||
package com.gmail.nossr50;
 | 
			
		||||
import org.bukkit.entity.*;
 | 
			
		||||
 | 
			
		||||
import com.gmail.nossr50.config.LoadProperties;
 | 
			
		||||
import com.gmail.nossr50.datatypes.PlayerProfile;
 | 
			
		||||
import com.gmail.nossr50.skills.Skills;
 | 
			
		||||
import com.gmail.nossr50.skills.Swords;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
public class mcTimer implements Runnable
 | 
			
		||||
{
 | 
			
		||||
	private final mcMMO plugin;
 | 
			
		||||
	int thecount = 1;
 | 
			
		||||
 | 
			
		||||
    public mcTimer(final mcMMO plugin) 
 | 
			
		||||
    {
 | 
			
		||||
        this.plugin = plugin;
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
	public void run() 
 | 
			
		||||
	{
 | 
			
		||||
		for(Player player : plugin.getServer().getOnlinePlayers())
 | 
			
		||||
		{
 | 
			
		||||
			if(player == null)
 | 
			
		||||
				continue;
 | 
			
		||||
			PlayerProfile PP = Users.getProfile(player);
 | 
			
		||||
			
 | 
			
		||||
			if(PP == null)
 | 
			
		||||
				continue;
 | 
			
		||||
			
 | 
			
		||||
			/*
 | 
			
		||||
			 * MONITOR SKILLS
 | 
			
		||||
			 */
 | 
			
		||||
			Skills.monitorSkills(player);
 | 
			
		||||
			
 | 
			
		||||
			/*
 | 
			
		||||
			 * COOLDOWN MONITORING
 | 
			
		||||
			 */
 | 
			
		||||
			Skills.watchCooldowns(player);
 | 
			
		||||
			
 | 
			
		||||
			/*
 | 
			
		||||
			 * PLAYER BLEED MONITORING
 | 
			
		||||
			 */
 | 
			
		||||
			if(thecount % 2 == 0 && PP.getBleedTicks() >= 1)
 | 
			
		||||
			{
 | 
			
		||||
        		player.damage(2);
 | 
			
		||||
        		PP.decreaseBleedTicks();
 | 
			
		||||
        	}
 | 
			
		||||
			
 | 
			
		||||
			if(LoadProperties.enableRegen && mcPermissions.getInstance().regeneration(player) && System.currentTimeMillis() >= PP.getRecentlyHurt() + 60000)
 | 
			
		||||
			{
 | 
			
		||||
				if(thecount == 20 || thecount == 40 || thecount == 60 || thecount == 80){
 | 
			
		||||
				    if(player != null &&
 | 
			
		||||
				    	player.getHealth() > 0 && player.getHealth() < 20 
 | 
			
		||||
				    	&& m.getPowerLevel(player) >= 1000){
 | 
			
		||||
				    	player.setHealth(m.calculateHealth(player.getHealth(), 1));
 | 
			
		||||
				    }
 | 
			
		||||
				}
 | 
			
		||||
				if(thecount == 40 || thecount == 80){
 | 
			
		||||
			   		if(player != null &&
 | 
			
		||||
			   			player.getHealth() > 0 && player.getHealth() < 20 
 | 
			
		||||
			    		&& m.getPowerLevel(player) >= 500 
 | 
			
		||||
			    		&& m.getPowerLevel(player) < 1000){
 | 
			
		||||
			    		player.setHealth(m.calculateHealth(player.getHealth(), 1));
 | 
			
		||||
			    	}
 | 
			
		||||
				}
 | 
			
		||||
				if(thecount == 80)
 | 
			
		||||
				{
 | 
			
		||||
			    	if(player != null &&
 | 
			
		||||
			    		player.getHealth() > 0 && player.getHealth() < 20  
 | 
			
		||||
			    		&& m.getPowerLevel(player) < 500){
 | 
			
		||||
			    		player.setHealth(m.calculateHealth(player.getHealth(), 1));
 | 
			
		||||
			    	}
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		
 | 
			
		||||
		/*
 | 
			
		||||
		 * NON-PLAYER BLEED MONITORING
 | 
			
		||||
		 */
 | 
			
		||||
		
 | 
			
		||||
		if(thecount % 2 == 0)
 | 
			
		||||
			Swords.bleedSimulate(plugin);
 | 
			
		||||
		
 | 
			
		||||
		//SETUP FOR HP REGEN/BLEED
 | 
			
		||||
		thecount++;
 | 
			
		||||
		if(thecount >= 81)
 | 
			
		||||
			thecount = 1;
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
@@ -19,7 +19,7 @@ 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.ArrayListString;
 | 
			
		||||
import com.gmail.nossr50.spout.util.ArrayListString;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
public class Party 
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										64
									
								
								src/com/gmail/nossr50/runnables/mcTimer.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										64
									
								
								src/com/gmail/nossr50/runnables/mcTimer.java
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,64 @@
 | 
			
		||||
package com.gmail.nossr50.runnables;
 | 
			
		||||
import org.bukkit.entity.*;
 | 
			
		||||
 | 
			
		||||
import com.gmail.nossr50.Users;
 | 
			
		||||
import com.gmail.nossr50.mcMMO;
 | 
			
		||||
import com.gmail.nossr50.datatypes.PlayerProfile;
 | 
			
		||||
import com.gmail.nossr50.skills.Skills;
 | 
			
		||||
import com.gmail.nossr50.skills.Swords;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
public class mcTimer implements Runnable
 | 
			
		||||
{
 | 
			
		||||
	private final mcMMO plugin;
 | 
			
		||||
	int thecount = 1;
 | 
			
		||||
 | 
			
		||||
    public mcTimer(final mcMMO plugin) 
 | 
			
		||||
    {
 | 
			
		||||
        this.plugin = plugin;
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
	public void run() 
 | 
			
		||||
	{
 | 
			
		||||
		for(Player player : plugin.getServer().getOnlinePlayers())
 | 
			
		||||
		{
 | 
			
		||||
			if(player == null)
 | 
			
		||||
				continue;
 | 
			
		||||
			PlayerProfile PP = Users.getProfile(player);
 | 
			
		||||
			
 | 
			
		||||
			if(PP == null)
 | 
			
		||||
				continue;
 | 
			
		||||
			
 | 
			
		||||
			/*
 | 
			
		||||
			 * MONITOR SKILLS
 | 
			
		||||
			 */
 | 
			
		||||
			Skills.monitorSkills(player);
 | 
			
		||||
			
 | 
			
		||||
			/*
 | 
			
		||||
			 * COOLDOWN MONITORING
 | 
			
		||||
			 */
 | 
			
		||||
			Skills.watchCooldowns(player);
 | 
			
		||||
			
 | 
			
		||||
			/*
 | 
			
		||||
			 * PLAYER BLEED MONITORING
 | 
			
		||||
			 */
 | 
			
		||||
			if(thecount % 2 == 0 && PP.getBleedTicks() >= 1)
 | 
			
		||||
			{
 | 
			
		||||
        		player.damage(2);
 | 
			
		||||
        		PP.decreaseBleedTicks();
 | 
			
		||||
        	}
 | 
			
		||||
		
 | 
			
		||||
			/*
 | 
			
		||||
			 * NON-PLAYER BLEED MONITORING
 | 
			
		||||
			 */
 | 
			
		||||
			
 | 
			
		||||
			if(thecount % 2 == 0)
 | 
			
		||||
				Swords.bleedSimulate(plugin);
 | 
			
		||||
			
 | 
			
		||||
			//SETUP FOR HP REGEN/BLEED
 | 
			
		||||
			thecount++;
 | 
			
		||||
			if(thecount >= 81)
 | 
			
		||||
				thecount = 1;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
@@ -52,7 +52,8 @@ public class Axes {
 | 
			
		||||
    		}
 | 
			
		||||
    	}
 | 
			
		||||
    }
 | 
			
		||||
	public static void axeCriticalCheck(Player attacker, EntityDamageByEntityEvent event, Plugin pluginx){
 | 
			
		||||
	public static void axeCriticalCheck(Player attacker, EntityDamageByEntityEvent event, Plugin pluginx)
 | 
			
		||||
	{
 | 
			
		||||
    	Entity x = event.getEntity();
 | 
			
		||||
    	if(x instanceof Wolf){
 | 
			
		||||
    		Wolf wolf = (Wolf)x;
 | 
			
		||||
 
 | 
			
		||||
@@ -305,86 +305,4 @@ public class Herbalism
 | 
			
		||||
    	}
 | 
			
		||||
    	Skills.XpCheckSkill(SkillType.HERBALISM, player);
 | 
			
		||||
    }
 | 
			
		||||
	public static void breadCheck(Player player, ItemStack is)
 | 
			
		||||
	{
 | 
			
		||||
		PlayerProfile PP = Users.getProfile(player);
 | 
			
		||||
		int herbalism = PP.getSkillLevel(SkillType.HERBALISM);
 | 
			
		||||
	    int heal = 0;
 | 
			
		||||
		if(is.getTypeId() == 297)
 | 
			
		||||
	    {
 | 
			
		||||
	    	if(herbalism >= 50 && herbalism < 150)
 | 
			
		||||
    		{
 | 
			
		||||
    			heal = 1;
 | 
			
		||||
    		} else if (herbalism >= 150 && herbalism < 250)
 | 
			
		||||
    		{
 | 
			
		||||
    			heal = 2;
 | 
			
		||||
    		} else if (herbalism >= 250 && herbalism < 350)
 | 
			
		||||
    		{
 | 
			
		||||
    			heal = 3;
 | 
			
		||||
    		} else if (herbalism >= 350 && herbalism < 450)
 | 
			
		||||
    		{
 | 
			
		||||
    			heal = 4;
 | 
			
		||||
    		} else if (herbalism >= 450 && herbalism < 550)
 | 
			
		||||
    		{
 | 
			
		||||
    			heal = 5;
 | 
			
		||||
    		} else if (herbalism >= 550 && herbalism < 650)
 | 
			
		||||
    		{
 | 
			
		||||
    			heal = 6;
 | 
			
		||||
    		} else if (herbalism >= 650 && herbalism < 750)
 | 
			
		||||
    		{
 | 
			
		||||
    			heal = 7;
 | 
			
		||||
    		} else if (herbalism >= 750)
 | 
			
		||||
    		{
 | 
			
		||||
    			heal = 8;
 | 
			
		||||
    		}
 | 
			
		||||
	    	
 | 
			
		||||
	    	if(player.getHealth()+heal > 20)
 | 
			
		||||
	    	{
 | 
			
		||||
	    		player.setHealth(20);
 | 
			
		||||
	    	}
 | 
			
		||||
	    	else
 | 
			
		||||
	    		player.setHealth(player.getHealth()+heal);
 | 
			
		||||
	   	}
 | 
			
		||||
    }
 | 
			
		||||
    public static void stewCheck(Player player, ItemStack is)
 | 
			
		||||
    {
 | 
			
		||||
    	PlayerProfile PP = Users.getProfile(player);
 | 
			
		||||
    	int herbalism = PP.getSkillLevel(SkillType.HERBALISM);
 | 
			
		||||
    	int heal = 0;
 | 
			
		||||
    	if(is.getTypeId() == 282)
 | 
			
		||||
    	{
 | 
			
		||||
    		if(herbalism >= 50 && herbalism < 150)
 | 
			
		||||
    		{
 | 
			
		||||
    			heal = 1;
 | 
			
		||||
    		} else if (herbalism >= 150 && herbalism < 250)
 | 
			
		||||
    		{
 | 
			
		||||
    			heal = 2;
 | 
			
		||||
    		} else if (herbalism >= 250 && herbalism < 350)
 | 
			
		||||
    		{
 | 
			
		||||
    			heal = 3;
 | 
			
		||||
    		} else if (herbalism >= 350 && herbalism < 450)
 | 
			
		||||
    		{
 | 
			
		||||
    			heal = 4;
 | 
			
		||||
    		} else if (herbalism >= 450 && herbalism < 550)
 | 
			
		||||
    		{
 | 
			
		||||
    			heal = 5;
 | 
			
		||||
    		} else if (herbalism >= 550 && herbalism < 650)
 | 
			
		||||
    		{
 | 
			
		||||
    			heal = 6;
 | 
			
		||||
    		} else if (herbalism >= 650 && herbalism < 750)
 | 
			
		||||
    		{
 | 
			
		||||
    			heal = 7;
 | 
			
		||||
    		} else if (herbalism >= 750)
 | 
			
		||||
    		{
 | 
			
		||||
    			heal = 8;
 | 
			
		||||
    		}
 | 
			
		||||
    		
 | 
			
		||||
    		if(player.getHealth()+heal > 20)
 | 
			
		||||
	    	{
 | 
			
		||||
	    		player.setHealth(20);
 | 
			
		||||
	    	}
 | 
			
		||||
	    	else
 | 
			
		||||
	    		player.setHealth(player.getHealth()+heal);
 | 
			
		||||
    	}
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -157,41 +157,6 @@ public class Swords
 | 
			
		||||
    	}
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    public static void parryCheck(EntityDamageByEntityEvent event, Player defender)
 | 
			
		||||
    {
 | 
			
		||||
    	Entity y = event.getDamager();
 | 
			
		||||
    	PlayerProfile PPd = Users.getProfile(defender);
 | 
			
		||||
    	if(defender != null && m.isSwords(defender.getItemInHand()) 
 | 
			
		||||
    			&& mcPermissions.getInstance().swords(defender)){
 | 
			
		||||
			if(PPd.getSkillLevel(SkillType.SWORDS) >= 900)
 | 
			
		||||
			{
 | 
			
		||||
				if(Math.random() * 3000 <= 900)
 | 
			
		||||
				{
 | 
			
		||||
					event.setCancelled(true);
 | 
			
		||||
					defender.sendMessage(ChatColor.GREEN+"**PARRIED**");
 | 
			
		||||
					defender.getItemInHand().setDurability((short) (defender.getItemInHand().getDurability() + 1));
 | 
			
		||||
					if(y instanceof Player)
 | 
			
		||||
					{
 | 
			
		||||
						Player attacker = (Player)y;
 | 
			
		||||
						attacker.sendMessage(ChatColor.GREEN+"**PARRIED**");
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
			} else 
 | 
			
		||||
			{
 | 
			
		||||
				if(Math.random() * 3000 <= PPd.getSkillLevel(SkillType.SWORDS))
 | 
			
		||||
				{
 | 
			
		||||
					event.setCancelled(true);
 | 
			
		||||
					defender.sendMessage(ChatColor.YELLOW+"*CLANG* SUCCESSFUL PARRY *CLANG*");
 | 
			
		||||
					defender.getItemInHand().setDurability((short) (defender.getItemInHand().getDurability() + 1));
 | 
			
		||||
					if(y instanceof Player)
 | 
			
		||||
					{
 | 
			
		||||
						Player attacker = (Player)y;
 | 
			
		||||
						attacker.sendMessage(ChatColor.DARK_RED+"**TARGET HAS PARRIED THAT ATTACK**");
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
    }
 | 
			
		||||
    public static void counterAttackChecks(EntityDamageByEntityEvent event)
 | 
			
		||||
    {
 | 
			
		||||
    	//Don't want to counter attack arrows
 | 
			
		||||
 
 | 
			
		||||
@@ -38,6 +38,7 @@ import org.getspout.spoutapi.player.SpoutPlayer;
 | 
			
		||||
 | 
			
		||||
import com.gmail.nossr50.Users;
 | 
			
		||||
import com.gmail.nossr50.party.Party;
 | 
			
		||||
import com.gmail.nossr50.spout.util.GenericLivingEntity;
 | 
			
		||||
 | 
			
		||||
public class mmoHelper 
 | 
			
		||||
{
 | 
			
		||||
 
 | 
			
		||||
@@ -15,7 +15,7 @@
 | 
			
		||||
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
package com.gmail.nossr50.spout;
 | 
			
		||||
package com.gmail.nossr50.spout.util;
 | 
			
		||||
 | 
			
		||||
import java.util.ArrayList;
 | 
			
		||||
 | 
			
		||||
@@ -15,7 +15,7 @@
 | 
			
		||||
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
package com.gmail.nossr50.spout;
 | 
			
		||||
package com.gmail.nossr50.spout.util;
 | 
			
		||||
 | 
			
		||||
import org.getspout.spoutapi.gui.GenericTexture;
 | 
			
		||||
 | 
			
		||||
@@ -14,13 +14,15 @@
 | 
			
		||||
 * 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;
 | 
			
		||||
package com.gmail.nossr50.spout.util;
 | 
			
		||||
 | 
			
		||||
import org.bukkit.Bukkit;
 | 
			
		||||
import org.bukkit.entity.LivingEntity;
 | 
			
		||||
import org.bukkit.entity.Player;
 | 
			
		||||
import org.getspout.spoutapi.gui.*;
 | 
			
		||||
 | 
			
		||||
import com.gmail.nossr50.spout.mmoHelper;
 | 
			
		||||
 | 
			
		||||
public class GenericLivingEntity extends GenericContainer {
 | 
			
		||||
 | 
			
		||||
	private Container _bars;
 | 
			
		||||
		Reference in New Issue
	
	Block a user