diff --git a/mcMMO/com/gmail/nossr50/FakeBlockBreakEvent.java b/mcMMO/com/gmail/nossr50/FakeBlockBreakEvent.java deleted file mode 100644 index 3995e9d5a..000000000 --- a/mcMMO/com/gmail/nossr50/FakeBlockBreakEvent.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.gmail.nossr50; - -import org.bukkit.block.Block; -import org.bukkit.entity.Player; -import org.bukkit.event.block.BlockBreakEvent; - -public class FakeBlockBreakEvent extends BlockBreakEvent { - public FakeBlockBreakEvent(Block theBlock, Player player) { - super(theBlock, player); - } -} \ No newline at end of file diff --git a/mcMMO/com/gmail/nossr50/PlayerStat.java b/mcMMO/com/gmail/nossr50/PlayerStat.java deleted file mode 100644 index 9abd1d961..000000000 --- a/mcMMO/com/gmail/nossr50/PlayerStat.java +++ /dev/null @@ -1,6 +0,0 @@ -package com.gmail.nossr50; - -public class PlayerStat { - public String name; - public int statVal = 0; -} diff --git a/mcMMO/com/gmail/nossr50/Tree.java b/mcMMO/com/gmail/nossr50/Tree.java deleted file mode 100644 index 378d79010..000000000 --- a/mcMMO/com/gmail/nossr50/Tree.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.gmail.nossr50; - -import java.util.ArrayList; - -import org.bukkit.entity.Player; - -public class Tree { - - TreeNode root = null; - - public Tree(){} - - public void add(String p, int in) - { - if(root == null) - root = new TreeNode(p, in); - else - root.add(p,in); - } - - public PlayerStat[] inOrder() - { - ArrayList order = root.inOrder(new ArrayList()); - return order.toArray(new PlayerStat[order.size()]); - } - -} diff --git a/mcMMO/com/gmail/nossr50/TreeNode.java b/mcMMO/com/gmail/nossr50/TreeNode.java deleted file mode 100644 index 417215183..000000000 --- a/mcMMO/com/gmail/nossr50/TreeNode.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.gmail.nossr50; - -import java.util.ArrayList; - -import org.bukkit.entity.Player; - -public class TreeNode { - TreeNode left = null - , right = null; - PlayerStat ps = new PlayerStat(); - - public TreeNode(String p, int in) {ps.statVal = in; ps.name = p;} - - public void add (String p, int in) { - if (in >= ps.statVal) - { - if (left == null) - left = new TreeNode(p,in); - else - left.add(p, in); - } - else if(in < ps.statVal) - { - if (right == null) - right = new TreeNode(p,in); - else - right.add(p, in); - } - } - - public ArrayList inOrder(ArrayList a) - { - if(left != null) - a = left.inOrder(a); - - a.add(ps); - - if(right != null) - a = right.inOrder(a); - - return a; - } -} diff --git a/mcMMO/com/gmail/nossr50/mcAcrobatics.java b/mcMMO/com/gmail/nossr50/mcAcrobatics.java deleted file mode 100644 index 17f1b26c9..000000000 --- a/mcMMO/com/gmail/nossr50/mcAcrobatics.java +++ /dev/null @@ -1,56 +0,0 @@ -package com.gmail.nossr50; - -import org.bukkit.ChatColor; -import org.bukkit.Location; -import org.bukkit.entity.Player; -import org.bukkit.event.entity.EntityDamageEvent; -import com.gmail.nossr50.datatypes.PlayerProfile; - - -public class mcAcrobatics { - private static volatile mcAcrobatics instance; - public static mcAcrobatics getInstance() { - if (instance == null) { - instance = new mcAcrobatics(); - } - return instance; - } - public void acrobaticsCheck(Player player, EntityDamageEvent event, Location loc, int xx, int y, int z){ - if(player != null && mcPermissions.getInstance().acrobatics(player)){ - PlayerProfile PP = mcUsers.getProfile(player); - int acrovar = PP.getAcrobaticsInt(); - if(player.isSneaking()) - acrovar = acrovar * 2; - if(Math.random() * 1000 <= acrovar && !event.isCancelled()){ - int threshold = 7; - if(player.isSneaking()) - threshold = 14; - int newDamage = event.getDamage() - threshold; - if(newDamage < 0) - newDamage = 0; - /* - * Check for death - */ - if(player.getHealth() - newDamage >= 1){ - if(!event.isCancelled()) - PP.addAcrobaticsXP((event.getDamage() * 8) * mcLoadProperties.xpGainMultiplier); - mcSkills.XpCheck(player); - event.setDamage(newDamage); - if(event.getDamage() <= 0) - event.setCancelled(true); - if(player.isSneaking()){ - player.sendMessage(ChatColor.GREEN+"**GRACEFUL ROLL**"); - } else { - player.sendMessage("**ROLL**"); - } - } - } else if (!event.isCancelled()){ - if(player.getHealth() - event.getDamage() >= 1){ - PP.addAcrobaticsXP((event.getDamage() * 12) * mcLoadProperties.xpGainMultiplier); - mcSkills.XpCheck(player); - } - } - } - } - -} diff --git a/mcMMO/com/gmail/nossr50/mcCombat.java b/mcMMO/com/gmail/nossr50/mcCombat.java deleted file mode 100644 index 08bd24781..000000000 --- a/mcMMO/com/gmail/nossr50/mcCombat.java +++ /dev/null @@ -1,682 +0,0 @@ -package com.gmail.nossr50; - -import org.bukkit.ChatColor; -import org.bukkit.Location; -import org.bukkit.entity.Animals; -import org.bukkit.entity.Creeper; -import org.bukkit.entity.Entity; -import org.bukkit.entity.Monster; -import org.bukkit.entity.PigZombie; -import org.bukkit.entity.Player; -import org.bukkit.entity.Skeleton; -import org.bukkit.entity.Spider; -import org.bukkit.entity.Squid; -import org.bukkit.entity.Wolf; -import org.bukkit.entity.Zombie; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.bukkit.event.entity.EntityDamageByProjectileEvent; -import org.bukkit.event.entity.EntityDamageEvent; -import org.bukkit.inventory.ItemStack; -import com.gmail.nossr50.datatypes.PlayerProfile; - -public class mcCombat { - private static mcMMO plugin; - public mcCombat(mcMMO instance) { - plugin = instance; - } - public static void playerVersusPlayerChecks(Entity x, Player attacker, EntityDamageByEntityEvent event){ - if(x instanceof Player){ - if(mcLoadProperties.pvp == false){ - event.setCancelled(true); - return; - } - PlayerProfile PPa = mcUsers.getProfile(attacker); - Player defender = (Player)x; - PlayerProfile PPd = mcUsers.getProfile(defender); - - /* - * COMPATABILITY CHECKS (Stuff that wouldn't happen normally in MC basically...) - */ - if(mcUsers.getProfile(defender) == null) - mcUsers.addUser(defender); - if(attacker != null && defender != null && mcUsers.getProfile(attacker).inParty() && mcUsers.getProfile(defender).inParty()){ - if(mcParty.getInstance().inSameParty(defender, attacker)){ - event.setCancelled(true); - return; - } - } - /* - * AXE CRITICAL CHECK - */ - axeCriticalCheck(attacker, event, x); - if(!mcConfig.getInstance().isBleedTracked(x)){ - bleedCheck(attacker, x); - } - if(defender != null && mcPermissions.getInstance().unarmed(attacker) && attacker.getItemInHand().getTypeId() == 0){ - - //Bonus just for having unarmed - int bonus = 2; - if (PPa.getUnarmedInt() >= 250) - bonus++; - if (PPa.getUnarmedInt() >= 500) - bonus++; - event.setDamage(calculateDamage(event, bonus)); - - //PROC - if(simulateUnarmedProc(attacker)){ - Location loc = defender.getLocation(); - if(defender.getItemInHand() != null && defender.getItemInHand().getTypeId() != 0){ - attacker.sendMessage(ChatColor.DARK_RED+"You have hit with great force."); - defender.sendMessage(ChatColor.DARK_RED+"You have been disarmed!"); - ItemStack item = defender.getItemInHand(); - if(item != null){ - loc.getWorld().dropItemNaturally(loc, item); - ItemStack itemx = null; - defender.setItemInHand(itemx); - } - } - } - } - /* - * PVP XP - */ - if(attacker != null && defender != null && mcLoadProperties.pvpxp){ - if(PPd.inParty() && PPa.inParty() && mcParty.getInstance().inSameParty(attacker, defender)) - return; - if(System.currentTimeMillis() >= PPd.getRespawnATS() + 5000 && defender.getHealth() >= 1){ - if(mcm.isAxes(attacker.getItemInHand())) - PPa.addAxesXP((event.getDamage() * 3) * mcLoadProperties.pvpxprewardmodifier); - if(mcm.isSwords(attacker.getItemInHand())) - PPa.addSwordsXP((event.getDamage() * 3) * mcLoadProperties.pvpxprewardmodifier); - if(attacker.getItemInHand().getTypeId() == 0) - PPa.addUnarmedXP((event.getDamage() * 3) * mcLoadProperties.pvpxprewardmodifier); - } - } - /* - * CHECK FOR LEVEL UPS - */ - mcSkills.XpCheck(attacker); - } - } - public static void playerVersusSquidChecks(EntityDamageByEntityEvent event, Player attacker, Entity x, int type){ - PlayerProfile PPa = mcUsers.getProfile(attacker); - if(x instanceof Squid){ - if(!mcConfig.getInstance().isBleedTracked(x)){ - bleedCheck(attacker, x); - } - Squid defender = (Squid)event.getEntity(); - if(mcm.isSwords(attacker.getItemInHand()) && defender.getHealth() > 0 && mcPermissions.getInstance().swords(attacker)){ - PPa.addSwordsXP(10 * mcLoadProperties.xpGainMultiplier); - } - mcSkills.XpCheck(attacker); - if(mcm.isAxes(attacker.getItemInHand()) - && defender.getHealth() > 0 - && mcPermissions.getInstance().axes(attacker)){ - PPa.addAxesXP(10 * mcLoadProperties.xpGainMultiplier); - mcSkills.XpCheck(attacker); - } - if(mcm.isAxes(attacker.getItemInHand()) && mcPermissions.getInstance().axes(attacker)){ - if(PPa.getAxesInt() >= 500){ - event.setDamage(calculateDamage(event, 4)); - } - } - /* - * UNARMED VS SQUID - */ - if(type == 0 && mcPermissions.getInstance().unarmed(attacker)){ - if(defender.getHealth() <= 0) - return; - - //Bonus just for having unarmed - int bonus = 2; - if (PPa.getUnarmedInt() >= 250) - bonus++; - if (PPa.getUnarmedInt() >= 500) - bonus++; - event.setDamage(calculateDamage(event, bonus)); - - //XP - if(defender.getHealth() != 0){ - PPa.addUnarmedXP(10 * mcLoadProperties.xpGainMultiplier); - mcSkills.XpCheck(attacker); - } - } - } - } - public static void playerVersusAnimalsChecks(Entity x, Player attacker, EntityDamageByEntityEvent event, int type){ - PlayerProfile PPa = mcUsers.getProfile(attacker); - if(x instanceof Animals){ - if(!mcConfig.getInstance().isBleedTracked(x)){ - bleedCheck(attacker, x); - } - Animals defender = (Animals)event.getEntity(); - if(mcm.isAxes(attacker.getItemInHand()) && mcPermissions.getInstance().axes(attacker)){ - if(defender.getHealth() <= 0) - return; - if(PPa.getAxesInt() >= 500){ - event.setDamage(calculateDamage(event, 4)); - } - } - if(type == 0 && mcPermissions.getInstance().unarmed(attacker)){ - //Bonus just for having unarmed - int bonus = 2; - if (PPa.getUnarmedInt() >= 250) - bonus++; - if (PPa.getUnarmedInt() >= 500) - bonus++; - event.setDamage(calculateDamage(event, bonus)); - } - } - } - public static void playerVersusMonsterChecks(EntityDamageByEntityEvent event, Player attacker, Entity x, int type){ - PlayerProfile PPa = mcUsers.getProfile(attacker); - if(x instanceof Monster){ - /* - * AXE PROC CHECKS - */ - axeCriticalCheck(attacker, event, x); - if(!mcConfig.getInstance().isBleedTracked(x)){ - bleedCheck(attacker, x); - } - Monster defender = (Monster)event.getEntity(); - if(mcm.isSwords(attacker.getItemInHand()) - && defender.getHealth() > 0 - && mcPermissions.getInstance().swords(attacker)){ - if(!mcConfig.getInstance().isMobSpawnTracked(x)){ - if(x instanceof Creeper) - PPa.addSwordsXP((event.getDamage() * 4) * mcLoadProperties.xpGainMultiplier); - if(x instanceof Spider) - PPa.addSwordsXP((event.getDamage() * 3) * mcLoadProperties.xpGainMultiplier); - if(x instanceof Skeleton) - PPa.addSwordsXP((event.getDamage() * 2) * mcLoadProperties.xpGainMultiplier); - if(x instanceof Zombie) - PPa.addSwordsXP((event.getDamage() * 2) * mcLoadProperties.xpGainMultiplier); - if(x instanceof PigZombie) - PPa.addSwordsXP((event.getDamage() * 3) * mcLoadProperties.xpGainMultiplier); - } - mcSkills.XpCheck(attacker); - } - if(mcm.isAxes(attacker.getItemInHand()) - && defender.getHealth() > 0 - && mcPermissions.getInstance().axes(attacker)){ - if(!mcConfig.getInstance().isMobSpawnTracked(x)){ - if(x instanceof Creeper) - PPa.addAxesXP((event.getDamage() * 4) * mcLoadProperties.xpGainMultiplier); - if(x instanceof Spider) - PPa.addAxesXP((event.getDamage() * 3) * mcLoadProperties.xpGainMultiplier); - if(x instanceof Skeleton) - PPa.addAxesXP((event.getDamage() * 2) * mcLoadProperties.xpGainMultiplier); - if(x instanceof Zombie) - PPa.addAxesXP((event.getDamage() * 2) * mcLoadProperties.xpGainMultiplier); - if(x instanceof PigZombie) - PPa.addAxesXP((event.getDamage() * 3) * mcLoadProperties.xpGainMultiplier); - } - mcSkills.XpCheck(attacker); - } - /* - * AXE DAMAGE SCALING && LOOT CHECKS - */ - if(mcm.isAxes(attacker.getItemInHand()) && mcPermissions.getInstance().axes(attacker)){ - if(PPa.getAxesInt() >= 500){ - event.setDamage(calculateDamage(event, 4)); - } - } - if(type == 0 && mcPermissions.getInstance().unarmed(attacker)){ - if(defender.getHealth() <= 0) - return; - - //Bonus just for having unarmed - int bonus = 2; - if (PPa.getUnarmedInt() >= 250) - bonus++; - if (PPa.getUnarmedInt() >= 500) - bonus++; - event.setDamage(calculateDamage(event, bonus)); - - //XP - if(!mcConfig.getInstance().isMobSpawnTracked(x)){ - if(x instanceof Creeper) - PPa.addUnarmedXP((event.getDamage() * 4) * mcLoadProperties.xpGainMultiplier); - if(x instanceof Spider) - PPa.addUnarmedXP((event.getDamage() * 3) * mcLoadProperties.xpGainMultiplier); - if(x instanceof Skeleton) - PPa.addUnarmedXP((event.getDamage() * 2) * mcLoadProperties.xpGainMultiplier); - if(x instanceof Zombie) - PPa.addUnarmedXP((event.getDamage() * 2) * mcLoadProperties.xpGainMultiplier); - if(x instanceof PigZombie) - PPa.addUnarmedXP((event.getDamage() * 3) * mcLoadProperties.xpGainMultiplier); - } - mcSkills.XpCheck(attacker); - } - } - } - public static void archeryCheck(EntityDamageByProjectileEvent event){ - Entity y = event.getDamager(); - Entity x = event.getEntity(); - if(event.getProjectile().toString().equals("CraftArrow") && x instanceof Player){ - Player defender = (Player)x; - PlayerProfile PPd = mcUsers.getProfile(defender); - if(PPd == null) - mcUsers.addUser(defender); - if(mcPermissions.getInstance().unarmed(defender) && defender.getItemInHand().getTypeId() == 0){ - if(defender != null && PPd.getUnarmedInt() >= 1000){ - if(Math.random() * 1000 <= 500){ - event.setCancelled(true); - defender.sendMessage(ChatColor.WHITE+"**ARROW DEFLECT**"); - return; - } - } else if(defender != null && Math.random() * 1000 <= (PPd.getUnarmedInt() / 2)){ - event.setCancelled(true); - defender.sendMessage(ChatColor.WHITE+"**ARROW DEFLECT**"); - return; - } - } - } - /* - * If attacker is player - */ - if(y instanceof Player){ - Player attacker = (Player)y; - PlayerProfile PPa = mcUsers.getProfile(attacker); - if(event.getProjectile().toString().equals("CraftArrow") && mcPermissions.getInstance().archery(attacker)){ - if(!mcConfig.getInstance().isTracked(x) && event.getDamage() > 0){ - mcConfig.getInstance().addArrowTrack(x, 0); - if(attacker != null){ - if(Math.random() * 1000 <= PPa.getArcheryInt()){ - mcConfig.getInstance().addArrowCount(x, 1); - } - } - } else { - if(event.getDamage() > 0){ - if(attacker != null){ - if(Math.random() * 1000 <= PPa.getArcheryInt()){ - mcConfig.getInstance().addArrowCount(x, 1); - } - } - } - } - /* - * IGNITION - */ - if(Math.random() * 100 >= 75){ - - int ignition = 20; - if(PPa.getArcheryInt() >= 200) - ignition+=20; - if(PPa.getArcheryInt() >= 400) - ignition+=20; - if(PPa.getArcheryInt() >= 600) - ignition+=20; - if(PPa.getArcheryInt() >= 800) - ignition+=20; - if(PPa.getArcheryInt() >= 1000) - ignition+=20; - - if(x instanceof Player){ - Player Defender = (Player)x; - if(!mcParty.getInstance().inSameParty(attacker, Defender)){ - event.getEntity().setFireTicks(ignition); - attacker.sendMessage(ChatColor.RED+"**IGNITION**"); - Defender.sendMessage(ChatColor.DARK_RED+"You were struck by a burning arrow!"); - } - } else { - event.getEntity().setFireTicks(ignition); - attacker.sendMessage(ChatColor.RED+"**IGNITION**"); - } - } - /* - * Defender is Monster - */ - if(x instanceof Monster){ - /* - * TRACK ARROWS USED AGAINST THE ENTITY - */ - if(PPa.getArcheryInt() >= 50 && PPa.getArcheryInt() < 250) - event.setDamage(calculateDamage(event, 1)); - if(PPa.getArcheryInt() >= 250 && PPa.getArcheryInt() < 575) - event.setDamage(calculateDamage(event, 2)); - if(PPa.getArcheryInt() >= 575 && PPa.getArcheryInt() < 725) - event.setDamage(calculateDamage(event, 3)); - if(PPa.getArcheryInt() >= 725 && PPa.getArcheryInt() < 1000) - event.setDamage(calculateDamage(event, 4)); - if(PPa.getArcheryInt() >= 1000) - event.setDamage(calculateDamage(event, 5)); - //XP - if(!mcConfig.getInstance().isMobSpawnTracked(x)){ - if(x instanceof Creeper) - PPa.addArcheryXP((event.getDamage() * 4) * mcLoadProperties.xpGainMultiplier); - if(x instanceof Spider) - PPa.addArcheryXP((event.getDamage() * 3) * mcLoadProperties.xpGainMultiplier); - if(x instanceof Skeleton) - PPa.addArcheryXP((event.getDamage() * 2) * mcLoadProperties.xpGainMultiplier); - if(x instanceof Zombie) - PPa.addArcheryXP((event.getDamage() * 2) * mcLoadProperties.xpGainMultiplier); - if(x instanceof PigZombie) - PPa.addArcheryXP((event.getDamage() * 3) * mcLoadProperties.xpGainMultiplier); - } - } - /* - * Defender is Animals - */ - if(x instanceof Animals){ - if(PPa.getArcheryInt() >= 50 && PPa.getArcheryInt() < 250) - event.setDamage(calculateDamage(event, 1)); - if(PPa.getArcheryInt() >= 250 && PPa.getArcheryInt() < 575) - event.setDamage(calculateDamage(event, 2)); - if(PPa.getArcheryInt() >= 575 && PPa.getArcheryInt() < 725) - event.setDamage(calculateDamage(event, 3)); - if(PPa.getArcheryInt() >= 725 && PPa.getArcheryInt() < 1000) - event.setDamage(calculateDamage(event, 4)); - if(PPa.getArcheryInt() >= 1000) - event.setDamage(calculateDamage(event, 5)); - } - /* - * Defender is Squid - */ - if(x instanceof Squid){ - if(PPa.getArcheryInt() >= 50 && PPa.getArcheryInt() < 250) - event.setDamage(calculateDamage(event, 1)); - if(PPa.getArcheryInt() >= 250 && PPa.getArcheryInt() < 575) - event.setDamage(calculateDamage(event, 2)); - if(PPa.getArcheryInt() >= 575 && PPa.getArcheryInt() < 725) - event.setDamage(calculateDamage(event, 3)); - if(PPa.getArcheryInt() >= 725 && PPa.getArcheryInt() < 1000) - event.setDamage(calculateDamage(event, 4)); - if(PPa.getArcheryInt() >= 1000) - event.setDamage(calculateDamage(event, 5)); - } - /* - * Attacker is Player - */ - if(x instanceof Player){ - if(mcLoadProperties.pvp == false){ - event.setCancelled(true); - return; - } - Player defender = (Player)x; - PlayerProfile PPd = mcUsers.getProfile(defender); - /* - * Stuff for the daze proc - */ - if(PPa.inParty() && PPd.inParty()){ - if(mcParty.getInstance().inSameParty(defender, attacker)){ - event.setCancelled(true); - return; - } - } - /* - * PVP XP - */ - if(mcLoadProperties.pvpxp && !mcParty.getInstance().inSameParty(attacker, defender)){ - PPa.addArcheryXP((event.getDamage() * 3) * mcLoadProperties.pvpxprewardmodifier); - } - /* - * DAZE PROC - */ - Location loc = defender.getLocation(); - if(Math.random() * 10 > 5){ - loc.setPitch(90); - } else { - loc.setPitch(-90); - } - if(PPa.getArcheryInt() >= 1000){ - if(Math.random() * 1000 <= 500){ - defender.teleportTo(loc); - defender.sendMessage(ChatColor.DARK_RED+"Touched Fuzzy. Felt Dizzy."); - attacker.sendMessage("Target was "+ChatColor.DARK_RED+"Dazed"); - } - } else if(Math.random() * 2000 <= PPa.getArcheryInt()){ - defender.teleportTo(loc); - defender.sendMessage(ChatColor.DARK_RED+"Touched Fuzzy. Felt Dizzy."); - attacker.sendMessage("Target was "+ChatColor.DARK_RED+"Dazed"); - } - - if(PPa.getArcheryInt() >= 50 && PPa.getArcheryInt() < 250) - event.setDamage(calculateDamage(event, 1)); - if(PPa.getArcheryInt() >= 250 && PPa.getArcheryInt() < 575) - event.setDamage(calculateDamage(event, 2)); - if(PPa.getArcheryInt() >= 575 && PPa.getArcheryInt() < 725) - event.setDamage(calculateDamage(event, 3)); - if(PPa.getArcheryInt() >= 725 && PPa.getArcheryInt() < 1000) - event.setDamage(calculateDamage(event, 4)); - if(PPa.getArcheryInt() >= 1000) - event.setDamage(calculateDamage(event, 5)); - } - } - mcSkills.XpCheck(attacker); - } - } - public static boolean simulateUnarmedProc(Player player){ - PlayerProfile PP = mcUsers.getProfile(player); - if(PP.getUnarmedInt() >= 1000){ - if(Math.random() * 4000 <= 1000){ - return true; - } - } else { - if(Math.random() * 4000 <= PP.getUnarmedInt()){ - return true; - } - } - return false; - } - public static void bleedCheck(Player attacker, Entity x){ - PlayerProfile PPa = mcUsers.getProfile(attacker); - if(mcPermissions.getInstance().swords(attacker) && mcm.isSwords(attacker.getItemInHand())){ - if(PPa.getSwordsInt() >= 750){ - if(Math.random() * 1000 >= 750){ - if(!(x instanceof Player)) - mcConfig.getInstance().addToBleedQue(x); - if(x instanceof Player){ - Player target = (Player)x; - mcUsers.getProfile(target).addBleedTicks(3); - } - attacker.sendMessage(ChatColor.GREEN+"**ENEMY BLEEDING**"); - } - } else if (Math.random() * 1000 <= PPa.getSwordsInt()){ - if(!(x instanceof Player)) - mcConfig.getInstance().addToBleedQue(x); - if(x instanceof Player){ - Player target = (Player)x; - mcUsers.getProfile(target).addBleedTicks(2); - } - attacker.sendMessage(ChatColor.GREEN+"**ENEMY BLEEDING**"); - } - } - } - public static int calculateDamage(EntityDamageEvent event, int dmg){ - return event.getDamage() + dmg; - } - public static void dealDamage(Entity target, int dmg){ - if(target instanceof Player){ - ((Player) target).damage(dmg); - } - if(target instanceof Animals){ - ((Animals) target).damage(dmg); - } - if(target instanceof Monster){ - ((Monster) target).damage(dmg); - } - } - public static void applyAoeDamage(Player attacker, EntityDamageByEntityEvent event, Entity x){ - int targets = 0; - targets = mcm.getTier(attacker); - for(Entity derp : x.getWorld().getEntities()){ - if(mcm.getDistance(x.getLocation(), derp.getLocation()) < 5){ - if(derp instanceof Player){ - Player target = (Player)derp; - if(mcParty.getInstance().inSameParty(attacker, target)) - continue; - if(!target.getName().equals(attacker.getName()) && targets >= 1){ - target.damage(event.getDamage() / 2); - target.sendMessage(ChatColor.DARK_RED+"Struck by CLEAVE!"); - targets--; - } - } - if(derp instanceof Monster && targets >= 1){ - Monster target = (Monster)derp; - target.damage(event.getDamage() / 2); - targets--; - } - if(derp instanceof Wolf){ - continue; - } - if(derp instanceof Animals && targets >= 1){ - Animals target = (Animals)derp; - target.damage(event.getDamage() / 2); - targets--; - } - } - } - } - public static void applySerratedStrikes(Player attacker, EntityDamageByEntityEvent event, Entity x){ - int targets = 0; - targets = mcm.getTier(attacker); - for(Entity derp : x.getWorld().getEntities()){ - if(mcm.getDistance(x.getLocation(), derp.getLocation()) < 5){ - if(derp instanceof Player){ - Player target = (Player)derp; - if(mcParty.getInstance().inSameParty(attacker, target)) - continue; - if(!target.getName().equals(attacker.getName()) && targets >= 1){ - target.damage(event.getDamage() / 4); - target.sendMessage(ChatColor.DARK_RED+"Struck by Serrated Strikes!"); - mcUsers.getProfile(target).addBleedTicks(5); - targets--; - } - } - if(derp instanceof Monster && targets >= 1){ - if(!mcConfig.getInstance().isBleedTracked(derp)) - mcConfig.getInstance().addToBleedQue(x); - Monster target = (Monster)derp; - target.damage(event.getDamage() / 4); - targets--; - } - if(derp instanceof Wolf){ - continue; - } - if(derp instanceof Animals && targets >= 1){ - if(!mcConfig.getInstance().isBleedTracked(derp)) - mcConfig.getInstance().addToBleedQue(x); - Animals target = (Animals)derp; - target.damage(event.getDamage() / 4); - targets--; - } - } - //attacker.sendMessage(ChatColor.GREEN+"**SERRATED STRIKES HIT "+(mcm.getTier(attacker)-targets)+" FOES**"); - } - } - public static void axeCriticalCheck(Player attacker, EntityDamageByEntityEvent event, Entity x){ - PlayerProfile PPa = mcUsers.getProfile(attacker); - if(mcm.isAxes(attacker.getItemInHand()) && mcPermissions.getInstance().axes(attacker)){ - if(PPa.getAxesInt() >= 750){ - if(Math.random() * 1000 <= 750){ - if(x instanceof Player){ - Player player = (Player)x; - player.sendMessage(ChatColor.DARK_RED + "You were CRITICALLY hit!"); - } - if(x instanceof Player){ - event.setDamage(event.getDamage() * 2 - event.getDamage() / 2); - } else { - event.setDamage(event.getDamage() * 2); - } - attacker.sendMessage(ChatColor.RED+"CRITICAL HIT!"); - } - } else if(Math.random() * 1000 <= PPa.getAxesInt()){ - if(x instanceof Player){ - Player player = (Player)x; - player.sendMessage(ChatColor.DARK_RED + "You were CRITICALLY hit!"); - } - if(x instanceof Player){ - event.setDamage(event.getDamage() * 2 - event.getDamage() / 2); - } else { - event.setDamage(event.getDamage() * 2); - } - attacker.sendMessage(ChatColor.RED+"CRITICAL HIT!"); - } - } - } - public static void parryCheck(Player defender, EntityDamageByEntityEvent event, Entity y){ - PlayerProfile PPd = mcUsers.getProfile(defender); - if(defender != null && mcm.isSwords(defender.getItemInHand()) - && mcPermissions.getInstance().swords(defender)){ - if(PPd.getSwordsInt() >= 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.getSwordsInt()){ - 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 bleedSimulate(){ - - //Add items from Que list to BleedTrack list - for(Entity x : mcConfig.getInstance().getBleedQue()){ - mcConfig.getInstance().addBleedTrack(x); - } - //Clear list - mcConfig.getInstance().clearBleedQue(); - - //Cleanup any dead entities from the list - for(Entity x : mcConfig.getInstance().getBleedRemovalQue()){ - mcConfig.getInstance().removeBleedTrack(x); - } - - //Clear bleed removal list - mcConfig.getInstance().clearBleedRemovalQue(); - - //Bleed monsters/animals - for(Entity x : mcConfig.getInstance().getBleedTracked()){ - if(x == null){ - continue; - } - - if(mcm.getHealth(x) <= 0){ - continue; - } - - if(x instanceof Animals){ - ((Animals) x).damage(2); - } - - if(x instanceof Monster){ - ((Monster) x).damage(2); - } - - /* - Lets try something else... - if(x instanceof Player){ - Player player = (Player)x; - if(player.getHealth() >= 1){ - player.damage(1); - player.sendMessage(ChatColor.RED+"**BLEED**"); - if(player.getHealth() <= 0){ - mcUsers.getProfile(player).setBleedTicks(0); - } - if(mcUsers.getProfile(player).getBleedTicks() >= 1){ - mcUsers.getProfile(player).setBleedTicks(mcUsers.getProfile(player).getBleedTicks() - 1); - if(mcUsers.getProfile(player).getBleedTicks() <= 0) - mcConfig.getInstance().addToBleedRemovalQue(x); //Add for removal if bleedticks are 0 - } - } - } - */ - } - - } - - -} diff --git a/mcMMO/com/gmail/nossr50/mcConfig.java b/mcMMO/com/gmail/nossr50/mcConfig.java deleted file mode 100644 index 2cd446eb5..000000000 --- a/mcMMO/com/gmail/nossr50/mcConfig.java +++ /dev/null @@ -1,174 +0,0 @@ -package com.gmail.nossr50; - -import java.util.*; -import java.util.logging.Logger; -import org.bukkit.block.Block; -import org.bukkit.entity.Entity; - -public class mcConfig { - private static volatile mcConfig instance; - String location = "mcmmo.properties"; - protected static final Logger log = Logger.getLogger("Minecraft"); - static ArrayList adminChatList = new ArrayList(); - static ArrayList blockWatchList = new ArrayList(); - static ArrayList treeFeller = new ArrayList(); - static ArrayList partyChatList = new ArrayList(); - static ArrayList godModeList = new ArrayList(); - HashMap arrowTracker = new HashMap(); - static ArrayList bleedTracker = new ArrayList(); - static ArrayList mobSpawnTracker = new ArrayList(); - - /* - * The Bleed Que Stuff - */ - public Entity[] bleedQue = new Entity[20]; - public int bleedQuePos = 0; - - public void addToBleedQue(Entity entity){ - //Assign entity to empty position - bleedQue[bleedQuePos] = entity; - //Move position up by 1 increment - bleedQuePos++; - - //Check if array is full - if(bleedQuePos >= bleedQue.length){ - //Create new temporary array - Entity[] temp = new Entity[bleedQue.length*2]; - //Copy data from bleedQue to temporary array - System.arraycopy(bleedQue, 0, temp, 0, bleedQue.length); - //Point bleedQue to new array - bleedQue = temp; - } - } - - public Entity[] getBleedQue(){return bleedQue;} - - public void clearBleedQue(){ - bleedQue = new Entity[bleedQue.length]; - setBleedQuePos(0); - } - public void setBleedQuePos(int x){bleedQuePos = x;} - - /* - * The Bleed Removal Que Stuff - */ - - public Entity[] bleedRemovalQue = new Entity[20]; - public int bleedRemovalQuePos = 0; - - public void addToBleedRemovalQue(Entity entity){ - //Assign entity to empty position - bleedRemovalQue[bleedRemovalQuePos] = entity; - //Move position up by 1 increment - bleedRemovalQuePos++; - - //Check if array is full - if(bleedRemovalQuePos >= bleedRemovalQue.length){ - //Create new temporary array - Entity[] temp = new Entity[bleedRemovalQue.length*2]; - //Copy data from bleedRemovalQue to temporary array - System.arraycopy(bleedRemovalQue, 0, temp, 0, bleedRemovalQue.length); - //Point bleedRemovalQue to new array - bleedRemovalQue = temp; - } - } - - public Entity[] getBleedRemovalQue(){return bleedRemovalQue;} - - public void clearBleedRemovalQue(){ - bleedQue = new Entity[bleedRemovalQue.length]; - setBleedQuePos(0); - } - public void setBleedRemovalQuePos(int x){bleedRemovalQuePos = x;} - - - public boolean isBlockWatched(Block block) {return blockWatchList.contains(block);} - public boolean isTreeFellerWatched(Block block) {return treeFeller.contains(block);} - public ArrayList getTreeFeller() {return treeFeller;} - public void removeBlockWatch(Block block) {blockWatchList.remove(blockWatchList.indexOf(block));} - public void addBlockWatch(Block block) {blockWatchList.add(block);} - public void removeTreeFeller(Block block) {treeFeller.remove(treeFeller.indexOf(block));} - public void addTreeFeller(Block block) {treeFeller.add(block);} - public void addBleedTrack(Entity entity) {bleedTracker.add(entity);} - public void addMobSpawnTrack(Entity entity) {mobSpawnTracker.add(entity);} - public void removeMobSpawnTrack(Entity entity) {mobSpawnTracker.remove(entity);} - public ArrayList getBleedTracked() {return bleedTracker;} - public void addArrowTrack(Entity entity, Integer arrowcount) {arrowTracker.put(entity, arrowcount);} - public Integer getArrowCount(Entity entity) {return arrowTracker.get(entity);} - public void removeArrowTracked(Entity entity){ - if(arrowTracker.containsKey(entity)){ - arrowTracker.remove(entity); - } - } - public void removeBleedTrack(Entity entity){ - bleedTracker.remove(entity); - } - public void clearTreeFeller(){ - treeFeller.clear(); - } - public void setBleedCount(Entity entity, Integer newvalue){ - bleedTracker.add(entity); - } - public void addArrowCount(Entity entity, Integer newvalue) { - arrowTracker.put(entity, arrowTracker.get(entity) + newvalue); - } - public boolean isTracked(Entity entity) { - if(arrowTracker.containsKey(entity)){ - return true; - } else { - return false; - } - } - public boolean isMobSpawnTracked(Entity entity) { - if(mobSpawnTracker.contains(entity)){ - return true; - } else { - return false; - } - } - public boolean isBleedTracked(Entity entity) { - if(bleedTracker.contains(entity)){ - return true; - } else { - return false; - } - } - public boolean isAdminToggled(String playerName) {return adminChatList.contains(playerName);} - public boolean isPartyToggled(String playerName) {return partyChatList.contains(playerName);} - public boolean isGodModeToggled(String playerName) {return godModeList.contains(playerName);} - public void removeGodModeToggled(String playerName) {godModeList.remove(godModeList.indexOf(playerName));} - public void removePartyToggled(String playerName) {partyChatList.remove(partyChatList.indexOf(playerName));} - public void removeAdminToggled(String playerName) {adminChatList.remove(adminChatList.indexOf(playerName));} - public void addGodModeToggled(String playerName) {godModeList.add(playerName);} - public void addPartyToggled(String playerName) {partyChatList.add(playerName);} - public void addAdminToggled(String playerName) {adminChatList.add(playerName);} - - public static mcConfig getInstance() { - if (instance == null) { - instance = new mcConfig(); - } - return instance; - } - public void toggleAdminChat(String playerName){ - if(isAdminToggled(playerName)){ - removeAdminToggled(playerName); - } else { - addAdminToggled(playerName); - } - } - public void toggleGodMode(String playerName){ - if(isGodModeToggled(playerName)){ - removeGodModeToggled(playerName); - } else { - addGodModeToggled(playerName); - } - } - public void togglePartyChat(String playerName){ - if(isPartyToggled(playerName)){ - removePartyToggled(playerName); - } else { - addPartyToggled(playerName); - } - } - -} \ No newline at end of file diff --git a/mcMMO/com/gmail/nossr50/mcExcavation.java b/mcMMO/com/gmail/nossr50/mcExcavation.java deleted file mode 100644 index 23307dc12..000000000 --- a/mcMMO/com/gmail/nossr50/mcExcavation.java +++ /dev/null @@ -1,203 +0,0 @@ -package com.gmail.nossr50; - -import org.bukkit.ChatColor; -import org.bukkit.Location; -import org.bukkit.Material; -import org.bukkit.block.Block; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; -import org.bukkit.plugin.Plugin; - -import com.gmail.nossr50.datatypes.PlayerProfile; - - -public class mcExcavation { - private static mcMMO plugin; - public mcExcavation(mcMMO instance) { - plugin = instance; - } - public static void gigaDrillBreakerActivationCheck(Player player, Block block, Plugin pluginx){ - PlayerProfile PP = mcUsers.getProfile(player); - if(mcm.isShovel(player.getItemInHand())){ - if(block != null){ - if(!mcm.abilityBlockCheck(block)) - return; - } - if(PP.getShovelPreparationMode()){ - PP.setShovelPreparationMode(false); - } - int ticks = 2; - int x = PP.getExcavationInt(); - while(x >= 50){ - x-=50; - ticks++; - } - - if(!PP.getGigaDrillBreakerMode() && PP.getGigaDrillBreakerCooldown() == 0){ - player.sendMessage(ChatColor.GREEN+"**GIGA DRILL BREAKER ACTIVATED**"); - for(Player y : pluginx.getServer().getOnlinePlayers()){ - if(y != null && y != player && mcm.getDistance(player.getLocation(), y.getLocation()) < 10) - y.sendMessage(ChatColor.GREEN+player.getName()+ChatColor.DARK_GREEN+" has used "+ChatColor.RED+"Giga Drill Breaker!"); - } - PP.setGigaDrillBreakerTicks(ticks * 1000); - PP.setGigaDrillBreakerActivatedTimeStamp(System.currentTimeMillis()); - PP.setGigaDrillBreakerMode(true); - } - - } - } - public static boolean canBeGigaDrillBroken(Block block){ - int i = block.getTypeId(); - if(i == 2||i == 3||i == 12||i == 13){ - return true; - } else { - return false; - } - } - public static void excavationProcCheck(Block block, Player player){ - PlayerProfile PP = mcUsers.getProfile(player); - int type = block.getTypeId(); - Location loc = block.getLocation(); - ItemStack is = null; - Material mat = null; - if(block.getData() == (byte) 5){ - return; - } - if(type == 2){ - if(PP.getExcavationInt() > 250){ - //CHANCE TO GET EGGS - if(mcLoadProperties.eggs == true && Math.random() * 100 > 99){ - PP.addExcavationXP(10 * mcLoadProperties.xpGainMultiplier); - mat = Material.getMaterial(344); - is = new ItemStack(mat, 1, (byte)0, (byte)0); - loc.getWorld().dropItemNaturally(loc, is); - } - //CHANCE TO GET APPLES - if(mcLoadProperties.apples == true && Math.random() * 100 > 99){ - PP.addExcavationXP(10 * mcLoadProperties.xpGainMultiplier); - mat = Material.getMaterial(260); - is = new ItemStack(mat, 1, (byte)0, (byte)0); - loc.getWorld().dropItemNaturally(loc, is); - } - } - } - //DIRT SAND OR GRAVEL - if(type == 3 || type == 13 || type == 2 || type == 12){ - PP.addExcavationXP(4 * mcLoadProperties.xpGainMultiplier); - if(PP.getExcavationInt() > 750){ - //CHANCE TO GET CAKE - if(mcLoadProperties.cake == true && Math.random() * 2000 > 1999){ - PP.addExcavationXP(300 * mcLoadProperties.xpGainMultiplier); - mat = Material.getMaterial(354); - is = new ItemStack(mat, 1, (byte)0, (byte)0); - loc.getWorld().dropItemNaturally(loc, is); - } - } - if(PP.getExcavationInt() > 350){ - //CHANCE TO GET DIAMOND - if(mcLoadProperties.diamond == true && Math.random() * 750 > 749){ - PP.addExcavationXP(100 * mcLoadProperties.xpGainMultiplier); - mat = Material.getMaterial(264); - is = new ItemStack(mat, 1, (byte)0, (byte)0); - loc.getWorld().dropItemNaturally(loc, is); - } - } - if(PP.getExcavationInt() > 250){ - //CHANCE TO GET YELLOW MUSIC - if(mcLoadProperties.music == true && Math.random() * 2000 > 1999){ - PP.addExcavationXP(300 * mcLoadProperties.xpGainMultiplier); - mat = Material.getMaterial(2256); - is = new ItemStack(mat, 1, (byte)0, (byte)0); - loc.getWorld().dropItemNaturally(loc, is); - } - - } - if(PP.getExcavationInt() > 350){ - //CHANCE TO GET GREEN MUSIC - if(mcLoadProperties.music == true && Math.random() * 2000 > 1999){ - PP.addExcavationXP(300 * mcLoadProperties.xpGainMultiplier); - mat = Material.getMaterial(2257); - is = new ItemStack(mat, 1, (byte)0, (byte)0); - loc.getWorld().dropItemNaturally(loc, is); - } - } - } - //SAND - if(type == 12){ - //CHANCE TO GET GLOWSTONE - if(mcLoadProperties.glowstone == true && PP.getExcavationInt() > 50 && Math.random() * 100 > 95){ - PP.addExcavationXP(8 * mcLoadProperties.xpGainMultiplier); - mat = Material.getMaterial(348); - is = new ItemStack(mat, 1, (byte)0, (byte)0); - loc.getWorld().dropItemNaturally(loc, is); - } - //CHANCE TO GET SLOWSAND - if(mcLoadProperties.slowsand == true && PP.getExcavationInt() > 650 && Math.random() * 200 > 199){ - PP.addExcavationXP(8 * mcLoadProperties.xpGainMultiplier); - mat = Material.getMaterial(88); - is = new ItemStack(mat, 1, (byte)0, (byte)0); - loc.getWorld().dropItemNaturally(loc, is); - } - } - //GRASS OR DIRT - if(type == 2 || type == 3){ - if(PP.getExcavationInt() > 50){ - //CHANCE FOR COCOA BEANS - if(mcLoadProperties.eggs == true && Math.random() * 75 > 74){ - PP.addExcavationXP(10 * mcLoadProperties.xpGainMultiplier); - mat = Material.getMaterial(351); - is = new ItemStack(mat, 1, (byte)0, (byte)0); - is.setDurability((byte) 3); //COCOA - loc.getWorld().dropItemNaturally(loc, is); - } - } - //CHANCE FOR SHROOMS - if(mcLoadProperties.mushrooms == true && PP.getExcavationInt() > 500 && Math.random() * 200 > 199){ - PP.addExcavationXP(8 * mcLoadProperties.xpGainMultiplier); - if(Math.random() * 10 > 5){ - mat = Material.getMaterial(39); - } else { - mat = Material.getMaterial(40); - } - is = new ItemStack(mat, 1, (byte)0, (byte)0); - loc.getWorld().dropItemNaturally(loc, is); - } - //CHANCE TO GET GLOWSTONE - if(mcLoadProperties.glowstone == true && PP.getExcavationInt() > 25 && Math.random() * 100 > 95){ - PP.addExcavationXP(8 * mcLoadProperties.xpGainMultiplier); - mat = Material.getMaterial(348); - is = new ItemStack(mat, 1, (byte)0, (byte)0); - loc.getWorld().dropItemNaturally(loc, is); - } - } - //GRAVEL - if(type == 13){ - //CHANCE TO GET NETHERRACK - if(mcLoadProperties.netherrack == true && PP.getExcavationInt() > 850 && Math.random() * 200 > 199){ - PP.addExcavationXP(3 * mcLoadProperties.xpGainMultiplier); - mat = Material.getMaterial(87); - is = new ItemStack(mat, 1, (byte)0, (byte)0); - loc.getWorld().dropItemNaturally(loc, is); - } - //CHANCE TO GET SULPHUR - if(mcLoadProperties.sulphur == true && PP.getExcavationInt() > 75){ - if(Math.random() * 10 > 9){ - PP.addExcavationXP(3 * mcLoadProperties.xpGainMultiplier); - mat = Material.getMaterial(289); - is = new ItemStack(mat, 1, (byte)0, (byte)0); - loc.getWorld().dropItemNaturally(loc, is); - } - } - //CHANCE TO GET BONES - if(mcLoadProperties.bones == true && PP.getExcavationInt() > 175){ - if(Math.random() * 10 > 9){ - PP.addExcavationXP(3 * mcLoadProperties.xpGainMultiplier); - mat = Material.getMaterial(352); - is = new ItemStack(mat, 1, (byte)0, (byte)0); - loc.getWorld().dropItemNaturally(loc, is); - } - } - } - mcSkills.XpCheck(player); - } -} diff --git a/mcMMO/com/gmail/nossr50/mcHerbalism.java b/mcMMO/com/gmail/nossr50/mcHerbalism.java deleted file mode 100644 index 45c0b463c..000000000 --- a/mcMMO/com/gmail/nossr50/mcHerbalism.java +++ /dev/null @@ -1,261 +0,0 @@ -package com.gmail.nossr50; - -import org.bukkit.ChatColor; -import org.bukkit.Location; -import org.bukkit.Material; -import org.bukkit.World; -import org.bukkit.block.Block; -import org.bukkit.entity.Player; -import org.bukkit.event.block.BlockBreakEvent; -import org.bukkit.inventory.ItemStack; -import org.bukkit.plugin.Plugin; - -import com.gmail.nossr50.datatypes.PlayerProfile; - - -public class mcHerbalism { - private static mcMMO plugin; - public mcHerbalism(mcMMO instance) { - plugin = instance; - } - - public static void greenTerraWheat(Player player, Block block, BlockBreakEvent event){ - if(block.getType() == Material.WHEAT && block.getData() == (byte) 0x07){ - event.setCancelled(true); - PlayerProfile PP = mcUsers.getProfile(player); - Material mat = Material.getMaterial(296); - Location loc = block.getLocation(); - ItemStack is = new ItemStack(mat, 1, (byte)0, (byte)0); - PP.addHerbalismXP(5 * mcLoadProperties.xpGainMultiplier); - loc.getWorld().dropItemNaturally(loc, is); - herbalismProcCheck(block, player, event); - herbalismProcCheck(block, player, event); - block.setData((byte) 0x03); - } - } - public static void greenTerra(Player player, Block block){ - if(block.getType() == Material.COBBLESTONE || block.getType() == Material.DIRT){ - if(!hasSeeds(player)) - player.sendMessage("You need more seeds to spread Green Terra"); - if(hasSeeds(player) && block.getType() != Material.WHEAT){ - removeSeeds(player); - if(block.getType() == Material.DIRT) - block.setType(Material.GRASS); - if(block.getType() == Material.COBBLESTONE) - block.setType(Material.MOSSY_COBBLESTONE); - } - } - } - public static Boolean canBeGreenTerra(Block block){ - int t = block.getTypeId(); - if(t == 4 || t == 3 || t == 59 || t == 81 || t == 83 || t == 91 || t == 86 || t == 39 || t == 46 || t == 37 || t == 38){ - return true; - } else { - return false; - } - } - public static boolean hasSeeds(Player player){ - ItemStack[] inventory = player.getInventory().getContents(); - for(ItemStack x : inventory){ - if(x != null && x.getTypeId() == 295){ - return true; - } - } - return false; - } - public static void removeSeeds(Player player){ - ItemStack[] inventory = player.getInventory().getContents(); - for(ItemStack x : inventory){ - if(x != null && x.getTypeId() == 295){ - if(x.getAmount() == 1){ - x.setTypeId(0); - x.setAmount(0); - player.getInventory().setContents(inventory); - } else{ - x.setAmount(x.getAmount() - 1); - player.getInventory().setContents(inventory); - } - return; - } - } - } - public static void greenTerraCheck(Player player, Block block, Plugin pluginx){ - PlayerProfile PP = mcUsers.getProfile(player); - if(mcm.isHoe(player.getItemInHand())){ - if(block != null){ - if(!mcm.abilityBlockCheck(block)) - return; - } - if(PP.getHoePreparationMode()){ - PP.setHoePreparationMode(false); - } - int ticks = 2; - int x = PP.getHerbalismInt(); - while(x >= 50){ - x-=50; - ticks++; - } - - if(!PP.getGreenTerraMode() && mcSkills.cooldownOver(player, PP.getGreenTerraDeactivatedTimeStamp(), mcLoadProperties.greenTerraCooldown)){ - player.sendMessage(ChatColor.GREEN+"**GREEN TERRA ACTIVATED**"); - for(Player y : pluginx.getServer().getOnlinePlayers()){ - if(y != null && y != player && mcm.getDistance(player.getLocation(), y.getLocation()) < 10) - y.sendMessage(ChatColor.GREEN+player.getName()+ChatColor.DARK_GREEN+" has used "+ChatColor.RED+"Green Terra!"); - } - PP.setGreenTerraTicks(ticks * 1000); - PP.setGreenTerraActivatedTimeStamp(System.currentTimeMillis()); - PP.setGreenTerraMode(true); - } - - } - } - public static void herbalismProcCheck(Block block, Player player, BlockBreakEvent event){ - PlayerProfile PP = mcUsers.getProfile(player); - int type = block.getTypeId(); - Location loc = block.getLocation(); - ItemStack is = null; - Material mat = null; - - if(mcConfig.getInstance().isBlockWatched(block)){ - return; - } - if(type == 59 && block.getData() == (byte) 0x7){ - mat = Material.getMaterial(296); - is = new ItemStack(mat, 1, (byte)0, (byte)0); - PP.addHerbalismXP(5 * mcLoadProperties.xpGainMultiplier); - if(player != null){ - if(Math.random() * 1000 <= PP.getHerbalismInt()){ - loc.getWorld().dropItemNaturally(loc, is); - } - } - //GREEN THUMB - if(Math.random() * 1500 <= PP.getHerbalismInt()){ - event.setCancelled(true); - loc.getWorld().dropItemNaturally(loc, is); - - block.setData((byte) 0x1); //Change it to first stage - - //Setup the bonuses - int bonus = 0; - if(PP.getHerbalismInt() >= 200) - bonus++; - if(PP.getHerbalismInt() >= 400) - bonus++; - if(PP.getHerbalismInt() >= 600) - bonus++; - - //Change wheat to be whatever stage based on the bonus - if(bonus == 1) - block.setData((byte) 0x2); - if(bonus == 2) - block.setData((byte) 0x3); - if(bonus == 3) - block.setData((byte) 0x4); - } - } - /* - * We need to check not-wheat stuff for if it was placed by the player or not - */ - if(block.getData() != (byte) 5){ - //Cactus - if(type == 81){ - mat = Material.getMaterial(block.getTypeId()); - is = new ItemStack(mat, 1, (byte)0, (byte)0); - if(player != null){ - if(Math.random() * 1000 <= PP.getHerbalismInt()){ - loc.getWorld().dropItemNaturally(loc, is); - } - } - PP.addHerbalismXP(3 * mcLoadProperties.xpGainMultiplier); - } - //Sugar Canes - if(type == 83){ - is = new ItemStack(Material.SUGAR_CANE, 1, (byte)0, (byte)0); - if(player != null){ - if(Math.random() * 1000 <= PP.getHerbalismInt()){ - loc.getWorld().dropItemNaturally(loc, is); - } - } - PP.addHerbalismXP(3 * mcLoadProperties.xpGainMultiplier); - } - //Pumpkins - if((type == 91 || type == 86) && !mcConfig.getInstance().isBlockWatched(block)){ - mat = Material.getMaterial(block.getTypeId()); - is = new ItemStack(mat, 1, (byte)0, (byte)0); - if(player != null){ - if(Math.random() * 1000 <= PP.getHerbalismInt()){ - loc.getWorld().dropItemNaturally(loc, is); - } - } - PP.addHerbalismXP(55 * mcLoadProperties.xpGainMultiplier); - } - //Mushroom - if(type == 39 || type == 40){ - mat = Material.getMaterial(block.getTypeId()); - is = new ItemStack(mat, 1, (byte)0, (byte)0); - if(player != null){ - if(Math.random() * 1000 <= PP.getHerbalismInt()){ - loc.getWorld().dropItemNaturally(loc, is); - } - } - PP.addHerbalismXP(40 * mcLoadProperties.xpGainMultiplier); - } - //Flower - if(type == 37 || type == 38){ - mat = Material.getMaterial(block.getTypeId()); - is = new ItemStack(mat, 1, (byte)0, (byte)0); - if(player != null){ - if(Math.random() * 1000 <= PP.getHerbalismInt()){ - loc.getWorld().dropItemNaturally(loc, is); - } - } - PP.addHerbalismXP(10 * mcLoadProperties.xpGainMultiplier); - } - } - mcSkills.XpCheck(player); - } - public static void breadCheck(Player player, ItemStack is){ - PlayerProfile PP = mcUsers.getProfile(player); - if(is.getTypeId() == 297){ - if(PP.getHerbalismInt() >= 50 && PP.getHerbalismInt() < 150){ - player.setHealth(player.getHealth() + 1); - } else if (PP.getHerbalismInt() >= 150 && PP.getHerbalismInt() < 250){ - player.setHealth(player.getHealth() + 2); - } else if (PP.getHerbalismInt() >= 250 && PP.getHerbalismInt() < 350){ - player.setHealth(player.getHealth() + 3); - } else if (PP.getHerbalismInt() >= 350 && PP.getHerbalismInt() < 450){ - player.setHealth(player.getHealth() + 4); - } else if (PP.getHerbalismInt() >= 450 && PP.getHerbalismInt() < 550){ - player.setHealth(player.getHealth() + 5); - } else if (PP.getHerbalismInt() >= 550 && PP.getHerbalismInt() < 650){ - player.setHealth(player.getHealth() + 6); - } else if (PP.getHerbalismInt() >= 650 && PP.getHerbalismInt() < 750){ - player.setHealth(player.getHealth() + 7); - } else if (PP.getHerbalismInt() >= 750){ - player.setHealth(player.getHealth() + 8); - } - } - } - public static void stewCheck(Player player, ItemStack is){ - PlayerProfile PP = mcUsers.getProfile(player); - if(is.getTypeId() == 282){ - if(PP.getHerbalismInt() >= 50 && PP.getHerbalismInt() < 150){ - player.setHealth(player.getHealth() + 1); - } else if (PP.getHerbalismInt() >= 150 && PP.getHerbalismInt() < 250){ - player.setHealth(player.getHealth() + 2); - } else if (PP.getHerbalismInt() >= 250 && PP.getHerbalismInt() < 350){ - player.setHealth(player.getHealth() + 3); - } else if (PP.getHerbalismInt() >= 350 && PP.getHerbalismInt() < 450){ - player.setHealth(player.getHealth() + 4); - } else if (PP.getHerbalismInt() >= 450 && PP.getHerbalismInt() < 550){ - player.setHealth(player.getHealth() + 5); - } else if (PP.getHerbalismInt() >= 550 && PP.getHerbalismInt() < 650){ - player.setHealth(player.getHealth() + 6); - } else if (PP.getHerbalismInt() >= 650 && PP.getHerbalismInt() < 750){ - player.setHealth(player.getHealth() + 7); - } else if (PP.getHerbalismInt() >= 750){ - player.setHealth(player.getHealth() + 8); - } - } - } -} diff --git a/mcMMO/com/gmail/nossr50/mcItem.java b/mcMMO/com/gmail/nossr50/mcItem.java deleted file mode 100644 index dbf23be53..000000000 --- a/mcMMO/com/gmail/nossr50/mcItem.java +++ /dev/null @@ -1,77 +0,0 @@ -package com.gmail.nossr50; - -import org.bukkit.ChatColor; -import org.bukkit.Location; -import org.bukkit.Material; -import org.bukkit.block.Block; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; -import org.bukkit.plugin.Plugin; - -import com.gmail.nossr50.datatypes.PlayerProfile; - - -public class mcItem { - - public static void itemChecks(Player player, Plugin plugin){ - ItemStack inhand = player.getItemInHand(); - if(inhand.getTypeId() == 288){ - chimaerawing(player, plugin); - } - } - public static void chimaerawing(Player player, Plugin plugin){ - PlayerProfile PP = mcUsers.getProfile(player); - ItemStack is = player.getItemInHand(); - Block block = player.getLocation().getBlock(); - if(mcPermissions.getInstance().chimaeraWing(player) && is.getTypeId() == 288){ - if(mcSkills.cooldownOver(player, PP.getRecentlyHurt(), 60) && is.getAmount() >= mcLoadProperties.feathersConsumedByChimaeraWing){ - Block derp = player.getLocation().getBlock(); - int y = derp.getY(); - ItemStack[] inventory = player.getInventory().getContents(); - for(ItemStack x : inventory){ - if(x != null && x.getTypeId() == 288){ - if(x.getAmount() >= mcLoadProperties.feathersConsumedByChimaeraWing + 1){ - x.setAmount(x.getAmount() - mcLoadProperties.feathersConsumedByChimaeraWing); - player.getInventory().setContents(inventory); - player.updateInventory(); - break; - } else { - x.setAmount(0); - x.setTypeId(0); - player.getInventory().setContents(inventory); - player.updateInventory(); - break; - } - } - } - while(y < 127){ - y++; - if(player != null){ - if(player.getLocation().getWorld().getBlockAt(block.getX(), y, block.getZ()).getType() != Material.AIR){ - player.sendMessage("**CHIMAERA WING FAILED!**"); - player.teleportTo(player.getLocation().getWorld().getBlockAt(block.getX(), (y - 1), block.getZ()).getLocation()); - return; - } - } - } - if(PP.getMySpawn(player) != null){ - Location mySpawn = PP.getMySpawn(player); - if(mySpawn != null && plugin.getServer().getWorld(PP.getMySpawnWorld(plugin)) != null) - mySpawn.setWorld(plugin.getServer().getWorld(PP.getMySpawnWorld(plugin))); - if(mySpawn != null){ - player.teleportTo(mySpawn);//Do it twice to prevent weird stuff - player.teleportTo(mySpawn); - } - } else { - player.teleportTo(player.getWorld().getSpawnLocation()); - } - player.sendMessage("**CHIMAERA WING**"); - } else if (!mcSkills.cooldownOver(player, PP.getRecentlyHurt(), 60) && is.getAmount() >= 10) { - player.sendMessage("You were injured recently and must wait to use this." - +ChatColor.YELLOW+" ("+mcSkills.calculateTimeLeft(player, PP.getRecentlyHurt(), 60)+"s)"); - } else if (is.getTypeId() == 288 && is.getAmount() <= 9){ - player.sendMessage("You need more of that to use it"); - } - } - } -} diff --git a/mcMMO/com/gmail/nossr50/mcLeaderboard.java b/mcMMO/com/gmail/nossr50/mcLeaderboard.java deleted file mode 100644 index f8689e422..000000000 --- a/mcMMO/com/gmail/nossr50/mcLeaderboard.java +++ /dev/null @@ -1,242 +0,0 @@ -package com.gmail.nossr50; - -import java.io.BufferedReader; -import java.io.File; -import java.io.FileReader; -import java.io.FileWriter; -import java.io.IOException; -import java.util.logging.Level; -import java.util.logging.Logger; - -import com.gmail.nossr50.datatypes.Tree; - -public class mcLeaderboard { - static String location = "plugins/mcMMO/mcmmo.users"; - protected static final Logger log = Logger.getLogger("Minecraft"); - - /* - * Read from the file - */ - public static void makeLeaderboards(){ - //Make Trees - Tree Mining = new Tree(); - Tree WoodCutting = new Tree(); - Tree Herbalism = new Tree(); - Tree Excavation = new Tree(); - Tree Acrobatics = new Tree(); - Tree Repair = new Tree(); - Tree Swords = new Tree(); - Tree Axes = new Tree(); - Tree Archery = new Tree(); - Tree Unarmed = new Tree(); - Tree Taming = new Tree(); - Tree PowerLevel = new Tree(); - - //Add Data To Trees - try { - //Open the user file - FileReader file = new FileReader(location); - BufferedReader in = new BufferedReader(file); - String line = ""; - while((line = in.readLine()) != null) - { - - String[] character = line.split(":"); - String p = character[0]; - - - int Plvl = 0; - - if(character.length > 1 && isInt(character[1])) - { - Mining.add(p, Integer.valueOf(character[1])); - Plvl += Integer.valueOf(character[1]); - } - if(character.length > 5 && isInt(character[5])){ - WoodCutting.add(p, Integer.valueOf(character[5])); - Plvl += Integer.valueOf(character[5]); - } - if(character.length > 7 && isInt(character[7])){ - Repair.add(p, Integer.valueOf(character[7])); - Plvl += Integer.valueOf(character[7]); - } - if(character.length > 8 && isInt(character[8])){ - Unarmed.add(p, Integer.valueOf(character[8])); - Plvl += Integer.valueOf(character[8]); - } - if(character.length > 9 && isInt(character[9])){ - Herbalism.add(p, Integer.valueOf(character[9])); - Plvl += Integer.valueOf(character[9]); - } - if(character.length > 10 && isInt(character[10])){ - Excavation.add(p, Integer.valueOf(character[10])); - Plvl += Integer.valueOf(character[10]); - } - if(character.length > 11 && isInt(character[11])){ - Archery.add(p, Integer.valueOf(character[11])); - Plvl += Integer.valueOf(character[11]); - } - if(character.length > 12 && isInt(character[12])){ - Swords.add(p, Integer.valueOf(character[12])); - Plvl += Integer.valueOf(character[12]); - } - if(character.length > 13 && isInt(character[13])){ - Axes.add(p, Integer.valueOf(character[13])); - Plvl += Integer.valueOf(character[13]); - } - if(character.length > 14 && isInt(character[14])){ - Acrobatics.add(p, Integer.valueOf(character[14])); - Plvl += Integer.valueOf(character[14]); - } - if(character.length > 24 && isInt(character[24])){ - Taming.add(p, Integer.valueOf(character[24])); - Plvl += Integer.valueOf(character[24]); - } - - PowerLevel.add(p, Plvl); - } - in.close(); - } catch (Exception e) { - log.log(Level.SEVERE, "Exception while reading " - + location + " (Are you sure you formatted it correctly?)", e); - } - //Write the leader board files - leaderWrite(Mining.inOrder(), "mining"); - leaderWrite(WoodCutting.inOrder(), "woodcutting"); - leaderWrite(Repair.inOrder(), "repair"); - leaderWrite(Unarmed.inOrder(), "unarmed"); - leaderWrite(Herbalism.inOrder(), "herbalism"); - leaderWrite(Excavation.inOrder(), "excavation"); - leaderWrite(Archery.inOrder(), "archery"); - leaderWrite(Swords.inOrder(), "swords"); - leaderWrite(Axes.inOrder(), "axes"); - leaderWrite(Acrobatics.inOrder(), "acrobatics"); - leaderWrite(Taming.inOrder(), "taming"); - leaderWrite(PowerLevel.inOrder(), "powerlevel"); - } - public static void leaderWrite(PlayerStat[] ps, String statName) - { - String theLocation = "plugins/mcMMO/" + statName + ".mcmmo"; - //CHECK IF THE FILE EXISTS - File theDir = new File(theLocation); - if(!theDir.exists()){ - //properties = new PropertiesFile(location); - FileWriter writer = null; - try { - writer = new FileWriter(theLocation); - } catch (Exception e) { - log.log(Level.SEVERE, "Exception while creating " + theLocation, e); - } finally { - try { - if (writer != null) { - writer.close(); - } - } catch (IOException e) { - log.log(Level.SEVERE, "Exception while closing writer for " + theLocation, e); - } - } - } else { - try { - FileReader file = new FileReader(theLocation); - - //HERP - BufferedReader in = new BufferedReader(file); - StringBuilder writer = new StringBuilder(); - String line = ""; - for(PlayerStat p : ps) - { - writer.append(p.name + ":" + p.statVal); - writer.append("\r\n"); - } - in.close(); - //Write the new file - FileWriter out = new FileWriter(theLocation); - out.write(writer.toString()); - out.close(); - } catch (Exception e) { - log.log(Level.SEVERE, "Exception while writing to " + theLocation + " (Are you sure you formatted it correctly?)", e); - } - } - //Create/open the file - //Loop through backward writing each player - //Close the file - } - - public static String[] retrieveInfo(String statName, int pagenumber){ - String theLocation = "plugins/mcMMO/" + statName + ".mcmmo"; - try { - FileReader file = new FileReader(theLocation); - BufferedReader in = new BufferedReader(file); - - int destination = (pagenumber - 1) * 10; //How many lines to skip through - int x = 0; //how many lines we've gone through - int y = 0; //going through the lines - String line = ""; - String[] info = new String[10]; //what to return - while((line = in.readLine()) != null && y < 10) - { - x++; - if(x >= destination && y < 10){ - info[y] = line.toString(); - y++; - } - } - in.close(); - return info; - } catch (Exception e) { - log.log(Level.SEVERE, "Exception while reading " - + theLocation + " (Are you sure you formatted it correctly?)", e); - } - return null; //Shouldn't get here - } - public static void updateLeaderboard(PlayerStat ps, String statName){ - if(mcLoadProperties.useMySQL) - return; - String theLocation = "plugins/mcMMO/" + statName + ".mcmmo"; - try { - //Open the file - FileReader file = new FileReader(theLocation); - BufferedReader in = new BufferedReader(file); - StringBuilder writer = new StringBuilder(); - String line = ""; - Boolean inserted = false; - //While not at the end of the file - while((line = in.readLine()) != null) - { - //Insert the player into the line before it finds a smaller one - if(Integer.valueOf(line.split(":")[1]) < ps.statVal && !inserted) - { - writer.append(ps.name + ":" + ps.statVal).append("\r\n"); - inserted = true; - } - //Write anything that isn't the player already in the file so we remove the duplicate - if(!line.split(":")[0].equalsIgnoreCase(ps.name)) - { - writer.append(line).append("\r\n"); - } - } - - if(!inserted) - { - writer.append(ps.name + ":" + ps.statVal).append("\r\n"); - } - - in.close(); - //Write the new file - FileWriter out = new FileWriter(theLocation); - out.write(writer.toString()); - out.close(); - } catch (Exception e) { - log.log(Level.SEVERE, "Exception while writing to " + theLocation + " (Are you sure you formatted it correctly?)", e); - } - } - public static boolean isInt(String string){ - try { - int x = Integer.parseInt(string); - } - catch(NumberFormatException nFE) { - return false; - } - return true; - } -} diff --git a/mcMMO/com/gmail/nossr50/mcLoadProperties.java b/mcMMO/com/gmail/nossr50/mcLoadProperties.java deleted file mode 100644 index cb13c165d..000000000 --- a/mcMMO/com/gmail/nossr50/mcLoadProperties.java +++ /dev/null @@ -1,114 +0,0 @@ -package com.gmail.nossr50; - -public class mcLoadProperties { - 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 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(){ - String propertiesFile = mcMMO.maindirectory + "mcmmo.properties"; - mcProperties properties = new mcProperties(propertiesFile); - properties.load(); - - /* - * COOLDOWN CONTROL - */ - greenTerraCooldown = properties.getInteger("greenTerraCooldown", 240); - superBreakerCooldown = properties.getInteger("superBreakerCooldown", 240); - gigaDrillBreakerCooldown = properties.getInteger("gigaDrillBreakerCooldown", 240); - treeFellerCooldown = properties.getInteger("treeFellerCooldown", 240); - berserkCooldown = properties.getInteger("berserkCooldown", 240); - serratedStrikeCooldown = properties.getInteger("serratedStrikeCooldown", 240); - skullSplitterCooldown = properties.getInteger("skullSplitterCooldown", 240); - - /* - * MySQL Stuff - */ - - MySQLserverName = properties.getString("MySQLServer", "ipofserver"); - MySQLdbPass = properties.getString("MySQLdbPass", "defaultdbpass"); - MySQLdbName = properties.getString("MySQLdbName", "defaultdbname"); - MySQLuserName = properties.getString("MySQLuserName", "defaultusername"); - MySQLport = properties.getInteger("MySQLport", 3306); - useMySQL = properties.getBoolean("mysql", false); - - /* - * OTHER - */ - - 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); - feathersConsumedByChimaeraWing = properties.getInteger("feathersConsumedByChimaeraWing", 10); - pvpxp = properties.getBoolean("pvpGivesXP", true); - pvpxprewardmodifier = properties.getInteger("pvpXpRewardModifier", 1); - miningrequirespickaxe = properties.getBoolean("miningRequiresPickaxe", true); - woodcuttingrequiresaxe = properties.getBoolean("woodcuttingRequiresAxe", true); - repairdiamondlevel = properties.getInteger("repairDiamondLevel", 50); - /* - * EXPERIENCE RATE MODIFIER - */ - globalxpmodifier = properties.getInteger("globalXpModifier", 1); - tamingxpmodifier = properties.getInteger("tamingXpModifier", 2); - miningxpmodifier = properties.getInteger("miningXpModifier", 2); - repairxpmodifier = properties.getInteger("repairXpModifier", 2); - woodcuttingxpmodifier = properties.getInteger("woodcuttingXpModifier", 2); - unarmedxpmodifier = properties.getInteger("unarmedXpModifier", 2); - herbalismxpmodifier = properties.getInteger("herbalismXpModifier", 2); - excavationxpmodifier = properties.getInteger("excavationXpModifier", 2); - archeryxpmodifier = properties.getInteger("archeryXpModifier", 2); - swordsxpmodifier = properties.getInteger("swordsXpModifier", 2); - axesxpmodifier = properties.getInteger("axesXpModifier", 2); - acrobaticsxpmodifier = properties.getInteger("acrobaticsXpModifier", 2); - /* - * TOGGLE CLAY - */ - clay = properties.getBoolean("gravelToClay", true); - /* - * ANVIL MESSAGES - */ - anvilmessages = properties.getBoolean("anvilMessages", true); - /* - * EXCAVATION LOOT TOGGLES - */ - cocoabeans = properties.getBoolean("canExcavateCocoaBeans", true); - mushrooms = properties.getBoolean("canExcavateMushrooms", true); - glowstone = properties.getBoolean("canExcavateGlowstone", true); - pvp = properties.getBoolean("pvp", true); - eggs = properties.getBoolean("canExcavateEggs", true); - apples = properties.getBoolean("canExcavateApples", true); - cake = properties.getBoolean("canExcavateCake", true); - music = properties.getBoolean("canExcavateMusic", true); - diamond = properties.getBoolean("canExcavateDiamond", true); - slowsand = properties.getBoolean("canExcavateSlowSand", true); - sulphur = properties.getBoolean("canExcavateSulphur", true); - netherrack = properties.getBoolean("canExcavateNetherrack", true); - bones = properties.getBoolean("canExcavateBones", true); - - /* - * CUSTOM COMMANDS - */ - mctop = properties.getString("/mctop", "mctop"); - addxp = properties.getString("/addxp", "addxp"); - mcability = properties.getString("/mcability", "mcability"); - mcrefresh = properties.getString("/mcrefresh", "mcrefresh"); - mcitem = properties.getString("/mcitem", "mcitem"); - mcmmo = properties.getString("/mcmmo", "mcmmo"); - mcc = properties.getString("/mcc", "mcc"); - mcgod = properties.getString("/mcgod", "mcgod"); - stats = properties.getString("/stats", "stats"); - mmoedit = properties.getString("/mmoedit", "mmoedit"); - ptp = properties.getString("/ptp", "ptp"); - party = properties.getString("/party", "party"); - myspawn = properties.getString("/myspawn", "myspawn"); - setmyspawn = properties.getString("/setmyspawn", "setmyspawn"); - whois = properties.getString("/whois", "whois"); - invite = properties.getString("/invite", "invite"); - accept = properties.getString("/accept", "accept"); - clearmyspawn = properties.getString("/clearmyspawn", "clearmyspawn"); - properties.save("==McMMO Configuration==\r\nYou can turn off excavation loot tables by turning the option to false\r\nYou can customize mcMMOs command names by modifying them here as well\r\nThis is an early version of the configuration file, eventually you'll be able to customize messages from mcMMO and XP gains"); - //herp derp - } -} \ No newline at end of file diff --git a/mcMMO/com/gmail/nossr50/mcMining.java b/mcMMO/com/gmail/nossr50/mcMining.java deleted file mode 100644 index 7afeef207..000000000 --- a/mcMMO/com/gmail/nossr50/mcMining.java +++ /dev/null @@ -1,317 +0,0 @@ -package com.gmail.nossr50; - -import org.bukkit.ChatColor; -import org.bukkit.Location; -import org.bukkit.Material; -import org.bukkit.block.Block; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; -import org.bukkit.plugin.Plugin; - -import com.gmail.nossr50.datatypes.PlayerProfile; - - -public class mcMining { - private static mcMMO plugin; - public mcMining(mcMMO instance) { - plugin = instance; - } - - public static void superBreakerCheck(Player player, Block block, Plugin pluginx){ - PlayerProfile PP = mcUsers.getProfile(player); - if(mcm.isMiningPick(player.getItemInHand())){ - if(block != null){ - if(!mcm.abilityBlockCheck(block)) - return; - } - if(PP.getPickaxePreparationMode()){ - PP.setPickaxePreparationMode(false); - } - int ticks = 2; - int x = PP.getMiningInt(); - while(x >= 50){ - x-=50; - ticks++; - } - - if(!PP.getSuperBreakerMode() && mcSkills.cooldownOver(player, PP.getSuperBreakerDeactivatedTimeStamp(), mcLoadProperties.superBreakerCooldown)){ - player.sendMessage(ChatColor.GREEN+"**SUPER BREAKER ACTIVATED**"); - for(Player y : pluginx.getServer().getOnlinePlayers()){ - if(y != null && y != player && mcm.getDistance(player.getLocation(), y.getLocation()) < 10) - y.sendMessage(ChatColor.GREEN+player.getName()+ChatColor.DARK_GREEN+" has used "+ChatColor.RED+"Super Breaker!"); - } - PP.setSuperBreakerTicks(ticks * 1000); - PP.setSuperBreakerActivatedTimeStamp(System.currentTimeMillis()); - PP.setSuperBreakerMode(true); - } - - } - } - public static void blockProcSimulate(Block block){ - Location loc = block.getLocation(); - Material mat = Material.getMaterial(block.getTypeId()); - byte damage = 0; - ItemStack item = new ItemStack(mat, 1, (byte)0, damage); - if(block.getTypeId() != 89 && block.getTypeId() != 73 && block.getTypeId() != 74 && block.getTypeId() != 56 && block.getTypeId() != 21 && block.getTypeId() != 1 && block.getTypeId() != 16) - loc.getWorld().dropItemNaturally(loc, item); - if(block.getTypeId() == 89){ - mat = Material.getMaterial(348); - item = new ItemStack(mat, 1, (byte)0, damage); - loc.getWorld().dropItemNaturally(loc, item); - } - if(block.getTypeId() == 73 || block.getTypeId() == 74){ - mat = Material.getMaterial(331); - item = new ItemStack(mat, 1, (byte)0, damage); - loc.getWorld().dropItemNaturally(loc, item); - loc.getWorld().dropItemNaturally(loc, item); - loc.getWorld().dropItemNaturally(loc, item); - if(Math.random() * 10 > 5){ - loc.getWorld().dropItemNaturally(loc, item); - } - } - if(block.getTypeId() == 21){ - mat = Material.getMaterial(351); - item = new ItemStack(mat, 1, (byte)0,(byte)0x4); - loc.getWorld().dropItemNaturally(loc, item); - loc.getWorld().dropItemNaturally(loc, item); - loc.getWorld().dropItemNaturally(loc, item); - loc.getWorld().dropItemNaturally(loc, item); - } - if(block.getTypeId() == 56){ - mat = Material.getMaterial(264); - item = new ItemStack(mat, 1, (byte)0, damage); - loc.getWorld().dropItemNaturally(loc, item); - } - if(block.getTypeId() == 1){ - mat = Material.getMaterial(4); - item = new ItemStack(mat, 1, (byte)0, damage); - loc.getWorld().dropItemNaturally(loc, item); - } - if(block.getTypeId() == 16){ - mat = Material.getMaterial(263); - item = new ItemStack(mat, 1, (byte)0, damage); - loc.getWorld().dropItemNaturally(loc, item); - } - } - public static void blockProcCheck(Block block, Player player){ - PlayerProfile PP = mcUsers.getProfile(player); - if(player != null){ - if(Math.random() * 1000 <= PP.getMiningInt()){ - blockProcSimulate(block); - return; - } - } - } - public static void miningBlockCheck(Player player, Block block){ - PlayerProfile PP = mcUsers.getProfile(player); - if(mcConfig.getInstance().isBlockWatched(block) || block.getData() == (byte) 5) - return; - int xp = 0; - if(block.getTypeId() == 1 || block.getTypeId() == 24){ - xp += 3; - blockProcCheck(block, player); - } - //OBSIDIAN - if(block.getTypeId() == 49){ - xp += 15; - blockProcCheck(block, player); - } - //NETHERRACK - if(block.getTypeId() == 87){ - xp += 3; - blockProcCheck(block, player); - } - //GLOWSTONE - if(block.getTypeId() == 89){ - xp += 3; - blockProcCheck(block, player); - } - //COAL - if(block.getTypeId() == 16){ - xp += 10; - blockProcCheck(block, player); - } - //GOLD - if(block.getTypeId() == 14){ - xp += 35; - blockProcCheck(block, player); - } - //DIAMOND - if(block.getTypeId() == 56){ - xp += 75; - blockProcCheck(block, player); - } - //IRON - if(block.getTypeId() == 15){ - xp += 25; - blockProcCheck(block, player); - } - //REDSTONE - if(block.getTypeId() == 73 || block.getTypeId() == 74){ - xp += 15; - blockProcCheck(block, player); - } - //LAPUS - if(block.getTypeId() == 21){ - xp += 40; - blockProcCheck(block, player); - } - PP.addMiningXP(xp * mcLoadProperties.xpGainMultiplier); - mcSkills.XpCheck(player); - } - /* - * Handling SuperBreaker stuff - */ - public static Boolean canBeSuperBroken(Block block){ - int t = block.getTypeId(); - if(t == 49 || t == 87 || t == 89 || t == 73 || t == 74 || t == 56 || t == 21 || t == 1 || t == 16 || t == 14 || t == 15){ - return true; - } else { - return false; - } - } - public static void SuperBreakerBlockCheck(Player player, Block block){ - PlayerProfile PP = mcUsers.getProfile(player); - if(mcLoadProperties.toolsLoseDurabilityFromAbilities) - mcm.damageTool(player, (short) mcLoadProperties.abilityDurabilityLoss); - Location loc = block.getLocation(); - Material mat = Material.getMaterial(block.getTypeId()); - int xp = 0; - byte damage = 0; - ItemStack item = new ItemStack(mat, 1, (byte)0, damage); - if(block.getTypeId() == 1 || block.getTypeId() == 24){ - if(!mcConfig.getInstance().isBlockWatched(block) && block.getData() != (byte) 5){ - xp += 3; - blockProcCheck(block, player); - blockProcCheck(block, player); - } - if(block.getTypeId() == 1){ - mat = Material.COBBLESTONE; - } else { - mat = Material.SANDSTONE; - } - item = new ItemStack(mat, 1, (byte)0, damage); - loc.getWorld().dropItemNaturally(loc, item); - block.setType(Material.AIR); - } - //NETHERRACK - if(block.getTypeId() == 87){ - if(!mcConfig.getInstance().isBlockWatched(block)&& block.getData() != (byte) 5){ - xp += 3; - blockProcCheck(block, player); - blockProcCheck(block, player); - } - mat = Material.getMaterial(87); - item = new ItemStack(mat, 1, (byte)0, damage); - loc.getWorld().dropItemNaturally(loc, item); - block.setType(Material.AIR); - } - //GLOWSTONE - if(block.getTypeId() == 89){ - if(!mcConfig.getInstance().isBlockWatched(block)&& block.getData() != (byte) 5){ - xp += 3; - blockProcCheck(block, player); - blockProcCheck(block, player); - } - mat = Material.getMaterial(348); - item = new ItemStack(mat, 1, (byte)0, damage); - loc.getWorld().dropItemNaturally(loc, item); - block.setType(Material.AIR); - } - //COAL - if(block.getTypeId() == 16){ - if(!mcConfig.getInstance().isBlockWatched(block)&& block.getData() != (byte) 5){ - xp += 10; - blockProcCheck(block, player); - blockProcCheck(block, player); - } - mat = Material.getMaterial(263); - item = new ItemStack(mat, 1, (byte)0, damage); - loc.getWorld().dropItemNaturally(loc, item); - block.setType(Material.AIR); - } - //GOLD - if(block.getTypeId() == 14 && mcm.getTier(player) >= 3){ - if(!mcConfig.getInstance().isBlockWatched(block)&& block.getData() != (byte) 5){ - xp += 35; - blockProcCheck(block, player); - blockProcCheck(block, player); - } - item = new ItemStack(mat, 1, (byte)0, damage); - loc.getWorld().dropItemNaturally(loc, item); - block.setType(Material.AIR); - } - //OBSIDIAN - if(block.getTypeId() == 49 && mcm.getTier(player) >= 4){ - if(mcLoadProperties.toolsLoseDurabilityFromAbilities) - mcm.damageTool(player, (short) 104); - if(!mcConfig.getInstance().isBlockWatched(block)&& block.getData() != (byte) 5){ - xp += 15; - blockProcCheck(block, player); - blockProcCheck(block, player); - } - mat = Material.getMaterial(49); - item = new ItemStack(mat, 1, (byte)0, damage); - loc.getWorld().dropItemNaturally(loc, item); - block.setType(Material.AIR); - } - //DIAMOND - if(block.getTypeId() == 56 && mcm.getTier(player) >= 3){ - if(!mcConfig.getInstance().isBlockWatched(block)&& block.getData() != (byte) 5){ - xp += 75; - blockProcCheck(block, player); - blockProcCheck(block, player); - } - mat = Material.getMaterial(264); - item = new ItemStack(mat, 1, (byte)0, damage); - loc.getWorld().dropItemNaturally(loc, item); - block.setType(Material.AIR); - } - //IRON - if(block.getTypeId() == 15 && mcm.getTier(player) >= 2){ - if(!mcConfig.getInstance().isBlockWatched(block)&& block.getData() != (byte) 5){ - xp += 25; - blockProcCheck(block, player); - blockProcCheck(block, player); - } - item = new ItemStack(mat, 1, (byte)0, damage); - loc.getWorld().dropItemNaturally(loc, item); - block.setType(Material.AIR); - } - //REDSTONE - if((block.getTypeId() == 73 || block.getTypeId() == 74) && mcm.getTier(player) >= 4){ - if(!mcConfig.getInstance().isBlockWatched(block)&& block.getData() != (byte) 5){ - xp += 15; - blockProcCheck(block, player); - blockProcCheck(block, player); - } - mat = Material.getMaterial(331); - item = new ItemStack(mat, 1, (byte)0, damage); - loc.getWorld().dropItemNaturally(loc, item); - loc.getWorld().dropItemNaturally(loc, item); - loc.getWorld().dropItemNaturally(loc, item); - if(Math.random() * 10 > 5){ - loc.getWorld().dropItemNaturally(loc, item); - } - block.setType(Material.AIR); - } - //LAPUS - if(block.getTypeId() == 21 && mcm.getTier(player) >= 3){ - if(!mcConfig.getInstance().isBlockWatched(block)&& block.getData() != (byte) 5){ - xp += 40; - blockProcCheck(block, player); - blockProcCheck(block, player); - } - mat = Material.getMaterial(351); - item = new ItemStack(mat, 1, (byte)0,(byte)0x4); - loc.getWorld().dropItemNaturally(loc, item); - loc.getWorld().dropItemNaturally(loc, item); - loc.getWorld().dropItemNaturally(loc, item); - loc.getWorld().dropItemNaturally(loc, item); - block.setType(Material.AIR); - } - if(block.getData() != (byte) 5) - PP.addMiningXP(xp * mcLoadProperties.xpGainMultiplier); - mcSkills.XpCheck(player); - } -} diff --git a/mcMMO/com/gmail/nossr50/mcParty.java b/mcMMO/com/gmail/nossr50/mcParty.java deleted file mode 100644 index c076c3973..000000000 --- a/mcMMO/com/gmail/nossr50/mcParty.java +++ /dev/null @@ -1,68 +0,0 @@ -package com.gmail.nossr50; - -import org.bukkit.ChatColor; -import org.bukkit.entity.Player; - - -public class mcParty { - private static mcMMO plugin; - public mcParty(mcMMO instance) { - plugin = instance; - } - private static volatile mcParty instance; - public static mcParty getInstance() { - if (instance == null) { - instance = new mcParty(plugin); - } - return instance; - } - public boolean inSameParty(Player playera, Player playerb){ - if(mcUsers.getProfile(playera) == null || mcUsers.getProfile(playerb) == null){ - mcUsers.addUser(playera); - mcUsers.addUser(playerb); - } - if(mcUsers.getProfile(playera).inParty() && mcUsers.getProfile(playerb).inParty()){ - if(mcUsers.getProfile(playera).getParty().equals(mcUsers.getProfile(playerb).getParty())){ - return true; - } else { - return false; - } - } else { - return false; - } - } - - public int partyCount(Player player, Player[] players){ - int x = 0; - for(Player hurrdurr : players){ - if(player != null && hurrdurr != null){ - if(mcUsers.getProfile(player).getParty().equals(mcUsers.getProfile(hurrdurr).getParty())) - x++; - } - } - return x; - } - public void informPartyMembers(Player player, Player[] players){ - int x = 0; - for(Player p : players){ - if(player != null && p != null){ - if(inSameParty(player, p) && !p.getName().equals(player.getName())){ - p.sendMessage(player.getName() + ChatColor.GREEN + " has joined your party"); - x++; - } - } - } - } - public void informPartyMembersQuit(Player player, Player[] players){ - int x = 0; - for(Player p : players){ - if(player != null && p != null){ - if(inSameParty(player, p) && !p.getName().equals(player.getName())){ - p.sendMessage(player.getName() + ChatColor.GREEN + " has left your party"); - x++; - } - } - } - } - -} diff --git a/mcMMO/com/gmail/nossr50/mcProperties.java b/mcMMO/com/gmail/nossr50/mcProperties.java deleted file mode 100644 index 9d1135b23..000000000 --- a/mcMMO/com/gmail/nossr50/mcProperties.java +++ /dev/null @@ -1,64 +0,0 @@ -package com.gmail.nossr50; - -import java.io.File; -import java.io.FileInputStream; -import java.io.FileOutputStream; -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)); - } 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)); - } - put(key, String.valueOf(value)); - return value; -} -public String getString(String key, String value){ - if(containsKey(key)){ - return getProperty(key); - } - 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'); - } - put(key, value ? "true" : "false"); - return value; -} -public double getDouble(String key, double value) { - if (containsKey(key)) { - return Double.parseDouble(getProperty(key)); - } - - put(key, String.valueOf(value)); - return value; -} - -} diff --git a/mcMMO/com/gmail/nossr50/mcRepair.java b/mcMMO/com/gmail/nossr50/mcRepair.java deleted file mode 100644 index 5c74e6e61..000000000 --- a/mcMMO/com/gmail/nossr50/mcRepair.java +++ /dev/null @@ -1,429 +0,0 @@ -package com.gmail.nossr50; - -import org.bukkit.ChatColor; -import org.bukkit.block.Block; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; - -import com.gmail.nossr50.datatypes.PlayerProfile; - - -public class mcRepair { - private static mcMMO plugin; - public mcRepair(mcMMO instance) { - plugin = instance; - } - private static volatile mcRepair instance; - - public static void repairCheck(Player player, ItemStack is, Block block){ - PlayerProfile PP = mcUsers.getProfile(player); - short durabilityBefore = player.getItemInHand().getDurability(); - short durabilityAfter = 0; - short dif = 0; - if(block != null - && mcPermissions.repair(player)){ - if(player.getItemInHand().getDurability() > 0 && player.getItemInHand().getAmount() < 2){ - /* - * ARMOR - */ - if(isArmor(is)){ - /* - * DIAMOND ARMOR - */ - if(isDiamondArmor(is) && hasDiamond(player) && PP.getRepairInt() >= mcLoadProperties.repairdiamondlevel){ - removeDiamond(player); - player.getItemInHand().setDurability(getArmorRepairAmount(is, player)); - durabilityAfter = player.getItemInHand().getDurability(); - player.sendMessage(String.valueOf(durabilityBefore - durabilityAfter)); - dif = (short) (durabilityBefore - durabilityAfter); - dif = (short) (dif * 6); //Boost XP - PP.addRepairXP(dif * mcLoadProperties.xpGainMultiplier); - } else if (isIronArmor(is) && hasIron(player)){ - /* - * IRON ARMOR - */ - removeIron(player); - player.getItemInHand().setDurability(getArmorRepairAmount(is, player)); - durabilityAfter = player.getItemInHand().getDurability(); - dif = (short) (durabilityBefore - durabilityAfter); - dif = (short) (dif * 2); //Boost XP - PP.addRepairXP(dif * mcLoadProperties.xpGainMultiplier); - //GOLD ARMOR - } else if (isGoldArmor(is) && hasGold(player)){ - removeGold(player); - player.getItemInHand().setDurability(getArmorRepairAmount(is, player)); - durabilityAfter = player.getItemInHand().getDurability(); - dif = (short) (durabilityBefore - durabilityAfter); - dif = (short) (dif * 4); //Boost XP of Gold to around Iron - PP.addRepairXP(dif * mcLoadProperties.xpGainMultiplier); - } else { - needMoreVespeneGas(is, player); - } - } - /* - * TOOLS - */ - if(isTools(is)){ - /* - * IRON TOOLS - */ - if(isIronTools(is) && hasIron(player)){ - removeIron(player); - /* - * Repair Durability and calculate dif - */ - player.getItemInHand().setDurability(getToolRepairAmount(is, player)); - durabilityAfter = player.getItemInHand().getDurability(); - dif = (short) (durabilityBefore - durabilityAfter); - if(mcm.isShovel(is)) - dif = (short) (dif / 3); - if(mcm.isSwords(is)) - dif = (short) (dif / 2); - if(mcm.isHoe(is)) - dif = (short) (dif / 2); - PP.addRepairXP(dif * mcLoadProperties.xpGainMultiplier); - } else if (isDiamondTools(is) && hasDiamond(player) && PP.getRepairInt() >= mcLoadProperties.repairdiamondlevel){ //Check if its diamond and the player has diamonds - /* - * DIAMOND TOOLS - */ - player.getItemInHand().setDurability(getToolRepairAmount(is, player)); - removeDiamond(player); - durabilityAfter = player.getItemInHand().getDurability(); - dif = (short) (durabilityBefore - durabilityAfter); - if(mcm.isShovel(is)) - dif = (short) (dif / 3); - if(mcm.isSwords(is)) - dif = (short) (dif / 2); - if(mcm.isHoe(is)) - dif = (short) (dif / 2); - PP.addRepairXP(dif * mcLoadProperties.xpGainMultiplier); - } else if(isGoldTools(is) && hasGold(player)){ - player.getItemInHand().setDurability(getToolRepairAmount(is, player)); - removeGold(player); - durabilityAfter = player.getItemInHand().getDurability(); - dif = (short) (durabilityBefore - durabilityAfter); - dif = (short) (dif * 7.6); //Boost XP for Gold to that of around Iron - if(mcm.isShovel(is)) - dif = (short) (dif / 3); - if(mcm.isSwords(is)) - dif = (short) (dif / 2); - if(mcm.isHoe(is)) - dif = (short) (dif / 2); - PP.addRepairXP(dif * mcLoadProperties.xpGainMultiplier); - } else { - needMoreVespeneGas(is, player); - } - } - - } else { - player.sendMessage("That is at full durability."); - } - player.updateInventory(); - /* - * GIVE SKILL IF THERE IS ENOUGH XP - */ - mcSkills.XpCheck(player); - } - } - public static boolean isArmor(ItemStack is){ - if(is.getTypeId() == 306 || is.getTypeId() == 307 ||is.getTypeId() == 308 ||is.getTypeId() == 309 || - is.getTypeId() == 310 ||is.getTypeId() == 311 ||is.getTypeId() == 312 ||is.getTypeId() == 313 || - is.getTypeId() == 314 || is.getTypeId() == 315 || is.getTypeId() == 316 || is.getTypeId() == 317){ - return true; - } else { - return false; - } - } - public static boolean isGoldArmor(ItemStack is){ - if(is.getTypeId() == 314 || is.getTypeId() == 315 || is.getTypeId() == 316 || is.getTypeId() == 317){ - return true; - } else { - return false; - } - } - public static boolean isIronArmor(ItemStack is){ - if(is.getTypeId() == 306 || is.getTypeId() == 307 || is.getTypeId() == 308 || is.getTypeId() == 309) - { - return true; - } else { - return false; - } - } - public static boolean isDiamondArmor(ItemStack is){ - if(is.getTypeId() == 310 || is.getTypeId() == 311 || is.getTypeId() == 312 || is.getTypeId() == 313) - { - return true; - } else { - return false; - } - } - public static boolean isTools(ItemStack is){ - if(is.getTypeId() == 256 || is.getTypeId() == 257 || is.getTypeId() == 258 || is.getTypeId() == 267 || is.getTypeId() == 292 || //IRON - is.getTypeId() == 276 || is.getTypeId() == 277 || is.getTypeId() == 278 || is.getTypeId() == 279 || is.getTypeId() == 293 || //DIAMOND - is.getTypeId() == 283 || is.getTypeId() == 285 || is.getTypeId() == 286 || is.getTypeId() == 284) //GOLD - { - return true; - } else { - return false; - } - } - public static boolean isGoldTools(ItemStack is){ - if(is.getTypeId() == 283 || is.getTypeId() == 285 || is.getTypeId() == 286 || is.getTypeId() == 284 || is.getTypeId() == 294){ - return true; - } else { - return false; - } - } - public static boolean isIronTools(ItemStack is){ - if(is.getTypeId() == 256 || is.getTypeId() == 257 || is.getTypeId() == 258 || is.getTypeId() == 267 || is.getTypeId() == 292) - { - return true; - } else { - return false; - } - } - - public static boolean isDiamondTools(ItemStack is){ - if(is.getTypeId() == 276 || is.getTypeId() == 277 || is.getTypeId() == 278 || is.getTypeId() == 279 || is.getTypeId() == 293) - { - return true; - } else { - return false; - } - } - public static void removeIron(Player player){ - ItemStack[] inventory = player.getInventory().getContents(); - for(ItemStack x : inventory){ - if(x != null && x.getTypeId() == 265){ - if(x.getAmount() == 1){ - x.setTypeId(0); - x.setAmount(0); - player.getInventory().setContents(inventory); - } else{ - x.setAmount(x.getAmount() - 1); - player.getInventory().setContents(inventory); - } - return; - } - } - } - public static void removeGold(Player player){ - ItemStack[] inventory = player.getInventory().getContents(); - for(ItemStack x : inventory){ - if(x != null && x.getTypeId() == 266){ - if(x.getAmount() == 1){ - x.setTypeId(0); - x.setAmount(0); - player.getInventory().setContents(inventory); - } else{ - x.setAmount(x.getAmount() - 1); - player.getInventory().setContents(inventory); - } - return; - } - } - } - public static void removeDiamond(Player player){ - ItemStack[] inventory = player.getInventory().getContents(); - for(ItemStack x : inventory){ - if(x != null && x.getTypeId() == 264){ - if(x.getAmount() == 1){ - x.setTypeId(0); - x.setAmount(0); - player.getInventory().setContents(inventory); - } else{ - x.setAmount(x.getAmount() - 1); - player.getInventory().setContents(inventory); - } - return; - } - } - } - public static boolean hasGold(Player player){ - ItemStack[] inventory = player.getInventory().getContents(); - for(ItemStack x : inventory){ - if(x != null && x.getTypeId() == 266){ - return true; - } - } - return false; - } - public static boolean hasDiamond(Player player){ - ItemStack[] inventory = player.getInventory().getContents(); - for(ItemStack x : inventory){ - if(x != null && x.getTypeId() == 264){ - return true; - } - } - return false; - } - public static boolean hasIron(Player player){ - ItemStack[] inventory = player.getInventory().getContents(); - for(ItemStack x : inventory){ - if(x != null && x.getTypeId() == 265){ - return true; - } - } - return false; - } - public static short repairCalculate(Player player, short durability, short ramt){ - PlayerProfile PP = mcUsers.getProfile(player); - float bonus = (PP.getRepairInt() / 500); - bonus = (ramt * bonus); - ramt = ramt+=bonus; - if(checkPlayerProcRepair(player)){ - ramt = (short) (ramt * 2); - } - durability-=ramt; - if(durability < 0){ - durability = 0; - } - return durability; - } - public static short getToolRepairAmount(ItemStack is, Player player){ - short durability = is.getDurability(); - short ramt = 0; - switch(is.getTypeId()) - { - //GOLD SHOVEL - case 284: - ramt = 33; - break; - //IRON SHOVEL - case 256: - ramt = 251; - break; - //DIAMOND SHOVEL - case 277: - ramt = 1562; - break; - //IRON PICK - case 257: - ramt = 84; - break; - //IRON AXE - case 258: - ramt = 84; - break; - //IRON SWORD - case 267: - ramt = 126; - break; - //IRON HOE - case 292: - ramt = 126; - break; - //DIAMOND SWORD - case 276: - ramt = 781; - break; - //DIAMOND PICK - case 278: - ramt = 521; - break; - //DIAMOND AXE - case 279: - ramt = 521; - break; - //DIAMOND HOE - case 293: - ramt = 781; - break; - //GOLD SWORD - case 283: - ramt = 17; - break; - //GOLD PICK - case 285: - ramt = 11; - break; - //GOLD AXE - case 286: - ramt = 11; - break; - //GOLD HOE - case 294: - ramt = 17; - break; - } - return repairCalculate(player, durability, ramt); - } - //This determines how much we repair - public static short getArmorRepairAmount(ItemStack is, Player player){ - short durability = is.getDurability(); - short ramt = 0; - switch(is.getTypeId()) - { - case 306: - ramt = 27; - break; - case 310: - ramt = 55; - break; - case 307: - ramt = 24; - break; - case 311: - ramt = 48; - break; - case 308: - ramt = 27; - break; - case 312: - ramt = 53; - break; - case 309: - ramt = 40; - break; - case 313: - ramt = 80; - break; - case 314: - ramt = 13; - break; - case 315: - ramt = 12; - break; - case 316: - ramt = 14; - break; - case 317: - ramt = 20; - break; - } - if(durability < 0) - durability = 0; - return repairCalculate(player, durability, ramt); - } - public static void needMoreVespeneGas(ItemStack is, Player player){ - PlayerProfile PP = mcUsers.getProfile(player); - if ((isDiamondTools(is) || isDiamondArmor(is)) && PP.getRepairInt() < mcLoadProperties.repairdiamondlevel){ - player.sendMessage(ChatColor.DARK_RED +"You're not adept enough to repair Diamond"); - } else if (isDiamondTools(is) && !hasDiamond(player) || isIronTools(is) && !hasIron(player) || isGoldTools(is) && !hasGold(player)){ - if(isDiamondTools(is) && !hasDiamond(player)) - player.sendMessage(ChatColor.DARK_RED+"You need more "+ChatColor.BLUE+ "Diamonds"); - if(isIronTools(is) && !hasIron(player)) - player.sendMessage(ChatColor.DARK_RED+"You need more "+ChatColor.GRAY+ "Iron"); - //herp - if(isGoldTools(is) && !hasGold(player)) - player.sendMessage(ChatColor.DARK_RED+"You need more "+ChatColor.GOLD+"Gold"); - } else if (isDiamondArmor(is) && !hasDiamond(player)){ - player.sendMessage(ChatColor.DARK_RED+"You need more "+ChatColor.BLUE+ "Diamonds"); - } else if (isIronArmor(is) && !hasIron(player)){ - player.sendMessage(ChatColor.DARK_RED+"You need more "+ChatColor.GRAY+ "Iron"); - } else if (isGoldArmor(is) && !hasGold(player)){ - player.sendMessage(ChatColor.DARK_RED+"You need more "+ChatColor.GOLD+"Gold"); - } else if (is.getAmount() > 1) - player.sendMessage(ChatColor.DARK_RED+"You can't repair stacked items"); - } - public static boolean checkPlayerProcRepair(Player player){ - PlayerProfile PP = mcUsers.getProfile(player); - if(player != null){ - if(Math.random() * 1000 <= PP.getRepairInt()){ - player.sendMessage(ChatColor.GRAY + "That felt easy."); - return true; - } - } - return false; - } -} diff --git a/mcMMO/com/gmail/nossr50/mcServerListener.java b/mcMMO/com/gmail/nossr50/mcServerListener.java deleted file mode 100644 index 840283d55..000000000 --- a/mcMMO/com/gmail/nossr50/mcServerListener.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.gmail.nossr50; - -import java.util.logging.Logger; - -import org.bukkit.Location; -import org.bukkit.event.server.ServerCommandEvent; -import org.bukkit.event.server.ServerListener; - -public class mcServerListener extends ServerListener{ - protected static final Logger log = Logger.getLogger("Minecraft"); - public Location spawn = null; - private mcMMO plugin; - - public mcServerListener(mcMMO instance) { - plugin = instance; - } - public void onServerCommand(ServerCommandEvent event) { - } -} diff --git a/mcMMO/com/gmail/nossr50/mcSkills.java b/mcMMO/com/gmail/nossr50/mcSkills.java deleted file mode 100644 index 2e45379b2..000000000 --- a/mcMMO/com/gmail/nossr50/mcSkills.java +++ /dev/null @@ -1,641 +0,0 @@ -package com.gmail.nossr50; - -import java.io.BufferedReader; -import java.io.FileReader; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.logging.Level; -import java.util.logging.Logger; - -import org.bukkit.ChatColor; -import org.bukkit.block.Block; -import org.bukkit.entity.Entity; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; -import org.bukkit.plugin.Plugin; - -import com.gmail.nossr50.datatypes.PlayerProfile; - - -public class mcSkills { - private static mcMMO plugin; - public mcSkills(mcMMO instance) { - plugin = instance; - } - private static volatile mcSkills instance; - protected static final Logger log = Logger.getLogger("Minecraft"); - - public void updateSQLfromFile(Player player){ - - } - public static boolean cooldownOver(Player player, long oldTime, int cooldown){ - long currentTime = System.currentTimeMillis(); - if(currentTime - oldTime >= (cooldown * 1000)){ - return true; - } else { - return false; - } - } - public boolean hasArrows(Player player){ - for(ItemStack x : player.getInventory().getContents()){ - if (x.getTypeId() == 262){ - return true; - } - } - return false; - } - public void addArrows(Player player){ - for(ItemStack x : player.getInventory().getContents()){ - if (x.getTypeId() == 262){ - x.setAmount(x.getAmount() + 1); - return; - } - } - } - public static int calculateTimeLeft(Player player, long deactivatedTimeStamp, int cooldown){ - long currentTime = System.currentTimeMillis(); - int x = 0; - while(currentTime < deactivatedTimeStamp + (cooldown * 1000)){ - currentTime += 1000; - x++; - } - return x; - } - public static void watchCooldowns(Player player){ - PlayerProfile PP = mcUsers.getProfile(player); - if(!PP.getGreenTerraInformed() && System.currentTimeMillis() - PP.getGreenTerraDeactivatedTimeStamp() >= (mcLoadProperties.greenTerraCooldown * 1000)){ - PP.setGreenTerraInformed(true); - player.sendMessage(ChatColor.GREEN+"Your "+ChatColor.YELLOW+"Green Terra "+ChatColor.GREEN+"ability is refreshed!"); - } - if(!PP.getTreeFellerInformed() && System.currentTimeMillis() - PP.getTreeFellerDeactivatedTimeStamp() >= (mcLoadProperties.berserkCooldown * 1000)){ - PP.setTreeFellerInformed(true); - player.sendMessage(ChatColor.GREEN+"Your "+ChatColor.YELLOW+"Tree Feller "+ChatColor.GREEN+"ability is refreshed!"); - } - if(!PP.getSuperBreakerInformed() && System.currentTimeMillis() - PP.getSuperBreakerDeactivatedTimeStamp() >= (mcLoadProperties.berserkCooldown * 1000)){ - PP.setSuperBreakerInformed(true); - player.sendMessage(ChatColor.GREEN+"Your "+ChatColor.YELLOW+"Super Breaker "+ChatColor.GREEN+"ability is refreshed!"); - } - if(!PP.getSerratedStrikesInformed() && System.currentTimeMillis() - PP.getSerratedStrikesDeactivatedTimeStamp() >= (mcLoadProperties.berserkCooldown * 1000)){ - PP.setSerratedStrikesInformed(true); - player.sendMessage(ChatColor.GREEN+"Your "+ChatColor.YELLOW+"Serrated Strikes "+ChatColor.GREEN+"ability is refreshed!"); - } - if(!PP.getBerserkInformed() && System.currentTimeMillis() - PP.getBerserkDeactivatedTimeStamp() >= (mcLoadProperties.berserkCooldown * 1000)){ - PP.setBerserkInformed(true); - player.sendMessage(ChatColor.GREEN+"Your "+ChatColor.YELLOW+"Berserk "+ChatColor.GREEN+"ability is refreshed!"); - } - if(!PP.getSkullSplitterInformed() && System.currentTimeMillis() - PP.getSkullSplitterDeactivatedTimeStamp() >= (mcLoadProperties.berserkCooldown * 1000)){ - PP.setSkullSplitterInformed(true); - player.sendMessage(ChatColor.GREEN+"Your "+ChatColor.YELLOW+"Skull Splitter "+ChatColor.GREEN+"ability is refreshed!"); - } - if(!PP.getGigaDrillBreakerInformed() && System.currentTimeMillis() - PP.getGigaDrillBreakerDeactivatedTimeStamp() >= (mcLoadProperties.berserkCooldown * 1000)){ - PP.setGigaDrillBreakerInformed(true); - player.sendMessage(ChatColor.GREEN+"Your "+ChatColor.YELLOW+"Giga Drill Breaker "+ChatColor.GREEN+"ability is refreshed!"); - } - } - public static void hoeReadinessCheck(Player player){ - PlayerProfile PP = mcUsers.getProfile(player); - if(mcPermissions.getInstance().herbalismAbility(player) && mcm.isHoe(player.getItemInHand()) && !PP.getHoePreparationMode()){ - if(!PP.getGreenTerraMode() && !cooldownOver(player, PP.getGreenTerraDeactivatedTimeStamp(), mcLoadProperties.greenTerraCooldown)){ - player.sendMessage(ChatColor.RED+"You are too tired to use that ability again." - +ChatColor.YELLOW+" ("+calculateTimeLeft(player, PP.getGreenTerraDeactivatedTimeStamp(), mcLoadProperties.greenTerraCooldown)+"s)"); - return; - } - player.sendMessage(ChatColor.GREEN+"**YOU READY YOUR HOE**"); - PP.setHoePreparationATS(System.currentTimeMillis()); - PP.setHoePreparationMode(true); - } - } - public static void abilityActivationCheck(Player player){ - PlayerProfile PP = mcUsers.getProfile(player); - if(!PP.getAbilityUse()) - return; - if(mcPermissions.getInstance().miningAbility(player) && mcm.isMiningPick(player.getItemInHand()) && !PP.getPickaxePreparationMode()){ - if(!PP.getSuperBreakerMode() && !cooldownOver(player, PP.getSuperBreakerDeactivatedTimeStamp(), mcLoadProperties.superBreakerCooldown)){ - player.sendMessage(ChatColor.RED+"You are too tired to use that ability again." - +ChatColor.YELLOW+" ("+calculateTimeLeft(player, PP.getSuperBreakerDeactivatedTimeStamp(), mcLoadProperties.superBreakerCooldown)+"s)"); - return; - } - player.sendMessage(ChatColor.GREEN+"**YOU READY YOUR PICKAXE**"); - PP.setPickaxePreparationATS(System.currentTimeMillis()); - PP.setPickaxePreparationMode(true); - } - if(mcPermissions.getInstance().excavationAbility(player) && mcm.isShovel(player.getItemInHand()) && !PP.getShovelPreparationMode()){ - if(!PP.getGigaDrillBreakerMode() && !cooldownOver(player, PP.getGigaDrillBreakerDeactivatedTimeStamp(), mcLoadProperties.gigaDrillBreakerCooldown)){ - player.sendMessage(ChatColor.RED+"You are too tired to use that ability again." - +ChatColor.YELLOW+" ("+calculateTimeLeft(player, PP.getGigaDrillBreakerDeactivatedTimeStamp(), mcLoadProperties.gigaDrillBreakerCooldown)+"s)"); - return; - } - player.sendMessage(ChatColor.GREEN+"**YOU READY YOUR SHOVEL**"); - PP.setShovelPreparationATS(System.currentTimeMillis()); - PP.setShovelPreparationMode(true); - } - if(mcPermissions.getInstance().swordsAbility(player) && mcm.isSwords(player.getItemInHand()) && !PP.getSwordsPreparationMode()){ - if(!PP.getSerratedStrikesMode() && !cooldownOver(player, PP.getSerratedStrikesDeactivatedTimeStamp(), mcLoadProperties.serratedStrikeCooldown)){ - player.sendMessage(ChatColor.RED+"You are too tired to use that ability again." - +ChatColor.YELLOW+" ("+calculateTimeLeft(player, PP.getSerratedStrikesDeactivatedTimeStamp(), mcLoadProperties.serratedStrikeCooldown)+"s)"); - return; - } - player.sendMessage(ChatColor.GREEN+"**YOU READY YOUR SWORD**"); - PP.setSwordsPreparationATS(System.currentTimeMillis()); - PP.setSwordsPreparationMode(true); - } - if(mcPermissions.getInstance().unarmedAbility(player) && player.getItemInHand().getTypeId() == 0 && !PP.getFistsPreparationMode()){ - if(!PP.getBerserkMode() && !cooldownOver(player, PP.getBerserkDeactivatedTimeStamp(), mcLoadProperties.berserkCooldown)){ - player.sendMessage(ChatColor.RED+"You are too tired to use that ability again." - +ChatColor.YELLOW+" ("+calculateTimeLeft(player, PP.getBerserkDeactivatedTimeStamp(), mcLoadProperties.berserkCooldown)+"s)"); - return; - } - player.sendMessage(ChatColor.GREEN+"**YOU READY YOUR FISTS**"); - PP.setFistsPreparationATS(System.currentTimeMillis()); - PP.setFistsPreparationMode(true); - } - if((mcPermissions.getInstance().axes(player) || mcPermissions.getInstance().woodcutting(player)) && !PP.getAxePreparationMode()){ - if(mcm.isAxes(player.getItemInHand())){ - player.sendMessage(ChatColor.GREEN+"**YOU READY YOUR AXE**"); - PP.setAxePreparationATS(System.currentTimeMillis()); - PP.setAxePreparationMode(true); - } - } - } - public static void serratedStrikesActivationCheck(Player player, Plugin pluginx){ - PlayerProfile PP = mcUsers.getProfile(player); - if(mcm.isSwords(player.getItemInHand())){ - if(PP.getSwordsPreparationMode()){ - PP.setSwordsPreparationMode(false); - } - int ticks = 2; - int x = PP.getSwordsInt(); - while(x >= 50){ - x-=50; - ticks++; - } - - if(!PP.getSerratedStrikesMode() && PP.getSerratedStrikesCooldown() == 0){ - player.sendMessage(ChatColor.GREEN+"**SERRATED STRIKES ACTIVATED**"); - for(Player y : pluginx.getServer().getOnlinePlayers()){ - if(y != null && y != player && mcm.getDistance(player.getLocation(), y.getLocation()) < 10) - y.sendMessage(ChatColor.GREEN+player.getName()+ChatColor.DARK_GREEN+" has used "+ChatColor.RED+"Serrated Strikes!"); - } - PP.setSerratedStrikesTicks((ticks * 2) * 1000); - PP.setSerratedStrikesActivatedTimeStamp(System.currentTimeMillis()); - PP.setSerratedStrikesMode(true); - } - - } - } - public static void berserkActivationCheck(Player player, Plugin pluginx){ - PlayerProfile PP = mcUsers.getProfile(player); - if(player.getItemInHand().getTypeId() == 0){ - if(PP.getFistsPreparationMode()){ - PP.setFistsPreparationMode(false); - } - int ticks = 2; - int x = PP.getUnarmedInt(); - while(x >= 50){ - x-=50; - ticks++; - } - - if(!PP.getBerserkMode() && cooldownOver(player, PP.getBerserkDeactivatedTimeStamp(), mcLoadProperties.berserkCooldown)){ - player.sendMessage(ChatColor.GREEN+"**BERSERK ACTIVATED**"); - for(Player y : pluginx.getServer().getOnlinePlayers()){ - if(y != null && y != player && mcm.getDistance(player.getLocation(), y.getLocation()) < 10) - y.sendMessage(ChatColor.GREEN+player.getName()+ChatColor.DARK_GREEN+" has used "+ChatColor.RED+"Berserk!"); - } - PP.setBerserkTicks(ticks * 1000); - PP.setBerserkActivatedTimeStamp(System.currentTimeMillis()); - PP.setBerserkMode(true); - } - } - } - public static void skullSplitterCheck(Player player, Plugin pluginx){ - PlayerProfile PP = mcUsers.getProfile(player); - if(mcm.isAxes(player.getItemInHand()) && mcPermissions.getInstance().axesAbility(player)){ - /* - * CHECK FOR AXE PREP MODE - */ - if(PP.getAxePreparationMode()){ - PP.setAxePreparationMode(false); - } - int ticks = 2; - int x = PP.getAxesInt(); - while(x >= 50){ - x-=50; - ticks++; - } - - if(!PP.getSkullSplitterMode() && cooldownOver(player, PP.getSkullSplitterDeactivatedTimeStamp(), mcLoadProperties.skullSplitterCooldown)){ - player.sendMessage(ChatColor.GREEN+"**SKULL SPLITTER ACTIVATED**"); - for(Player y : pluginx.getServer().getOnlinePlayers()){ - if(y != null && y != player && mcm.getDistance(player.getLocation(), y.getLocation()) < 10) - y.sendMessage(ChatColor.GREEN+player.getName()+ChatColor.DARK_GREEN+" has used "+ChatColor.RED+"Skull Splitter!"); - } - PP.setSkullSplitterTicks(ticks * 1000); - PP.setSkullSplitterActivatedTimeStamp(System.currentTimeMillis()); - PP.setSkullSplitterMode(true); - } - if(!PP.getSkullSplitterMode() && !cooldownOver(player, PP.getSkullSplitterDeactivatedTimeStamp(), mcLoadProperties.skullSplitterCooldown)){ - player.sendMessage(ChatColor.RED+"You are too tired to use that ability again." - +ChatColor.YELLOW+" ("+calculateTimeLeft(player, PP.getSkullSplitterDeactivatedTimeStamp(), mcLoadProperties.skullSplitterCooldown)+"s)"); - } - } - } - public static void monitorSkills(Player player){ - PlayerProfile PP = mcUsers.getProfile(player); - if(PP == null) - mcUsers.addUser(player); - if(PP.getHoePreparationMode() && System.currentTimeMillis() - PP.getHoePreparationATS() >= 4000){ - PP.setHoePreparationMode(false); - player.sendMessage(ChatColor.GRAY+"**YOU LOWER YOUR HOE**"); - } - if(PP.getAxePreparationMode() && System.currentTimeMillis() - PP.getAxePreparationATS() >= 4000){ - PP.setAxePreparationMode(false); - player.sendMessage(ChatColor.GRAY+"**YOU LOWER YOUR AXE**"); - } - if(PP.getPickaxePreparationMode() && System.currentTimeMillis() - PP.getPickaxePreparationATS() >= 4000){ - PP.setPickaxePreparationMode(false); - player.sendMessage(ChatColor.GRAY+"**YOU LOWER YOUR PICKAXE**"); - } - if(PP.getSwordsPreparationMode() && System.currentTimeMillis() - PP.getSwordsPreparationATS() >= 4000){ - PP.setSwordsPreparationMode(false); - player.sendMessage(ChatColor.GRAY+"**YOU LOWER YOUR SWORD**"); - } - if(PP.getFistsPreparationMode() && System.currentTimeMillis() - PP.getFistsPreparationATS() >= 4000){ - PP.setFistsPreparationMode(false); - player.sendMessage(ChatColor.GRAY+"**YOU LOWER YOUR FISTS**"); - } - if(PP.getShovelPreparationMode() && System.currentTimeMillis() - PP.getShovelPreparationATS() >= 4000){ - PP.setShovelPreparationMode(false); - player.sendMessage(ChatColor.GRAY+"**YOU LOWER YOUR SHOVEL**"); - } - /* - * HERBALISM ABILITY - */ - if(mcPermissions.getInstance().herbalismAbility(player)){ - if(PP.getGreenTerraMode() && PP.getGreenTerraActivatedTimeStamp() + PP.getGreenTerraTicks() <= System.currentTimeMillis()){ - PP.setGreenTerraMode(false); - PP.setGreenTerraInformed(false); - player.sendMessage(ChatColor.RED+"**Green Terra has worn off**"); - PP.setGreenTerraDeactivatedTimeStamp(System.currentTimeMillis()); - } - } - /* - * AXES ABILITY - */ - if(mcPermissions.getInstance().axesAbility(player)){ - if(PP.getSkullSplitterMode() && PP.getSkullSplitterActivatedTimeStamp() + PP.getSkullSplitterTicks() <= System.currentTimeMillis()){ - PP.setSkullSplitterMode(false); - PP.setSkullSplitterInformed(false); - player.sendMessage(ChatColor.RED+"**Skull Splitter has worn off**"); - PP.setSkullSplitterDeactivatedTimeStamp(System.currentTimeMillis()); - } - } - /* - * WOODCUTTING ABILITY - */ - if(mcPermissions.getInstance().woodCuttingAbility(player)){ - if(PP.getTreeFellerMode() && PP.getTreeFellerActivatedTimeStamp() + PP.getTreeFellerTicks() <= System.currentTimeMillis()){ - PP.setTreeFellerMode(false); - PP.setTreeFellerInformed(false); - player.sendMessage(ChatColor.RED+"**Tree Feller has worn off**"); - PP.setTreeFellerDeactivatedTimeStamp(System.currentTimeMillis()); - } - } - /* - * MINING ABILITY - */ - if(mcPermissions.getInstance().miningAbility(player)){ - if(PP.getSuperBreakerMode() && PP.getSuperBreakerActivatedTimeStamp() + PP.getSuperBreakerTicks() <= System.currentTimeMillis()){ - PP.setSuperBreakerMode(false); - PP.setSuperBreakerInformed(false); - player.sendMessage(ChatColor.RED+"**Super Breaker has worn off**"); - PP.setSuperBreakerDeactivatedTimeStamp(System.currentTimeMillis()); - } - } - /* - * EXCAVATION ABILITY - */ - if(mcPermissions.getInstance().excavationAbility(player)){ - if(PP.getGigaDrillBreakerMode() && PP.getGigaDrillBreakerActivatedTimeStamp() + PP.getGigaDrillBreakerTicks() <= System.currentTimeMillis()){ - PP.setGigaDrillBreakerMode(false); - PP.setGigaDrillBreakerInformed(false); - player.sendMessage(ChatColor.RED+"**Giga Drill Breaker has worn off**"); - PP.setGigaDrillBreakerDeactivatedTimeStamp(System.currentTimeMillis()); - } - } - /* - * SWORDS ABILITY - */ - if(mcPermissions.getInstance().swordsAbility(player)){ - if(PP.getSerratedStrikesMode() && PP.getSerratedStrikesActivatedTimeStamp() + PP.getSerratedStrikesTicks() <= System.currentTimeMillis()){ - PP.setSerratedStrikesMode(false); - PP.setSerratedStrikesInformed(false); - player.sendMessage(ChatColor.RED+"**Serrated Strikes has worn off**"); - PP.setSerratedStrikesDeactivatedTimeStamp(System.currentTimeMillis()); - } - } - /* - * UNARMED ABILITY - */ - if(mcPermissions.getInstance().unarmedAbility(player)){ - if(PP.getBerserkMode() && PP.getBerserkActivatedTimeStamp() + PP.getBerserkTicks() <= System.currentTimeMillis()){ - PP.setBerserkMode(false); - PP.setBerserkInformed(false); - player.sendMessage(ChatColor.RED+"**Berserk has worn off**"); - PP.setBerserkDeactivatedTimeStamp(System.currentTimeMillis()); - } - } - } - public static void XpCheck(Player player){ - PlayerProfile PP = mcUsers.getProfile(player); - /* - * TAMING - */ - if(player != null && PP.getTamingXPInt() >= PP.getXpToLevel("taming")){ - int skillups = 0; - while(PP.getTamingXPInt() >= PP.getXpToLevel("taming")){ - skillups++; - PP.removeTamingXP(PP.getXpToLevel("taming")); - PP.skillUpTaming(1); - } - /* - * Leaderboard updating stuff - */ - PlayerStat ps = new PlayerStat(); - ps.statVal = PP.getTamingInt(); - ps.name = player.getName(); - mcLeaderboard.updateLeaderboard(ps, "taming"); - if(player != null && PP.getTaming() != null) - player.sendMessage(ChatColor.YELLOW+"Taming skill increased by "+skillups+"."+" Total ("+PP.getTaming()+")"); - } - /* - * ACROBATICS - */ - if(player != null && PP.getAcrobaticsXPInt() >= PP.getXpToLevel("acrobatics")){ - int skillups = 0; - while(PP.getAcrobaticsXPInt() >= PP.getXpToLevel("acrobatics")){ - skillups++; - PP.removeAcrobaticsXP(PP.getXpToLevel("acrobatics")); - PP.skillUpAcrobatics(1); - } - /* - * Leaderboard updating stuff - */ - PlayerStat ps = new PlayerStat(); - ps.statVal = PP.getAcrobaticsInt(); - ps.name = player.getName(); - mcLeaderboard.updateLeaderboard(ps, "acrobatics"); - - if(player != null && PP.getAcrobatics() != null) - player.sendMessage(ChatColor.YELLOW+"Acrobatics skill increased by "+skillups+"."+" Total ("+PP.getAcrobatics()+")"); - } - /* - * ARCHERY - */ - if(PP.getArcheryXPInt() >= PP.getXpToLevel("archery")){ - int skillups = 0; - while(PP.getArcheryXPInt() >= PP.getXpToLevel("archery")){ - skillups++; - PP.removeArcheryXP(PP.getXpToLevel("archery")); - PP.skillUpArchery(1); - } - /* - * Leaderboard updating stuff - */ - PlayerStat ps = new PlayerStat(); - ps.statVal = PP.getArcheryInt(); - ps.name = player.getName(); - mcLeaderboard.updateLeaderboard(ps, "archery"); - - if(player != null && PP.getArchery() != null) - player.sendMessage(ChatColor.YELLOW+"Archery skill increased by "+skillups+"."+" Total ("+PP.getArchery()+")"); - } - /* - * SWORDS - */ - if(PP.getSwordsXPInt() >= PP.getXpToLevel("swords")){ - int skillups = 0; - while(PP.getSwordsXPInt() >= PP.getXpToLevel("swords")){ - skillups++; - PP.removeSwordsXP(PP.getXpToLevel("swords")); - PP.skillUpSwords(1); - } - /* - * Leaderboard updating stuff - */ - PlayerStat ps = new PlayerStat(); - ps.statVal = PP.getSwordsInt(); - ps.name = player.getName(); - mcLeaderboard.updateLeaderboard(ps, "swords"); - - if(player != null && PP.getSwords() != null) - player.sendMessage(ChatColor.YELLOW+"Swords skill increased by "+skillups+"."+" Total ("+PP.getSwords()+")"); - } - /* - * AXES - */ - if(PP.getAxesXPInt() >= PP.getXpToLevel("axes")){ - int skillups = 0; - while(PP.getAxesXPInt() >= PP.getXpToLevel("axes")){ - skillups++; - PP.removeAxesXP(PP.getXpToLevel("axes")); - PP.skillUpAxes(1); - } - /* - * Leaderboard updating stuff - */ - PlayerStat ps = new PlayerStat(); - ps.statVal = PP.getAxesInt(); - ps.name = player.getName(); - mcLeaderboard.updateLeaderboard(ps, "axes"); - - if(player != null && PP.getAxes() != null) - player.sendMessage(ChatColor.YELLOW+"Axes skill increased by "+skillups+"."+" Total ("+PP.getAxes()+")"); - } - /* - * UNARMED - */ - if(PP.getUnarmedXPInt() >= PP.getXpToLevel("unarmed")){ - int skillups = 0; - while(PP.getUnarmedXPInt() >= PP.getXpToLevel("unarmed")){ - skillups++; - PP.removeUnarmedXP(PP.getXpToLevel("unarmed")); - PP.skillUpUnarmed(1); - } - /* - * Leaderboard updating stuff - */ - PlayerStat ps = new PlayerStat(); - ps.statVal = PP.getUnarmedInt(); - ps.name = player.getName(); - mcLeaderboard.updateLeaderboard(ps, "unarmed"); - - if(player != null && PP.getUnarmed() != null) - player.sendMessage(ChatColor.YELLOW+"Unarmed skill increased by "+skillups+"."+" Total ("+PP.getUnarmed()+")"); - } - /* - * HERBALISM - */ - if(PP.getHerbalismXPInt() >= PP.getXpToLevel("herbalism")){ - int skillups = 0; - while(PP.getHerbalismXPInt() >= PP.getXpToLevel("herbalism")){ - skillups++; - PP.removeHerbalismXP(PP.getXpToLevel("herbalism")); - PP.skillUpHerbalism(1); - } - /* - * Leaderboard updating stuff - */ - PlayerStat ps = new PlayerStat(); - ps.statVal = PP.getHerbalismInt(); - ps.name = player.getName(); - mcLeaderboard.updateLeaderboard(ps, "herbalism"); - - if(player != null && PP.getHerbalism() != null) - player.sendMessage(ChatColor.YELLOW+"Herbalism skill increased by "+skillups+"."+" Total ("+PP.getHerbalism()+")"); - } - /* - * MINING - */ - if(player != null && PP.getMiningXPInt() >= PP.getXpToLevel("mining")){ - int skillups = 0; - while(PP.getMiningXPInt() >= PP.getXpToLevel("mining")){ - skillups++; - PP.removeMiningXP(PP.getXpToLevel("mining")); - PP.skillUpMining(1); - } - /* - * Leaderboard updating stuff - */ - PlayerStat ps = new PlayerStat(); - ps.statVal = PP.getMiningInt(); - ps.name = player.getName(); - mcLeaderboard.updateLeaderboard(ps, "mining"); - - if(player != null && PP.getMining() != null) - player.sendMessage(ChatColor.YELLOW+"Mining skill increased by "+skillups+"."+" Total ("+PP.getMining()+")"); - } - /* - * WOODCUTTING - */ - if(player != null && PP.getWoodCuttingXPInt() >= PP.getXpToLevel("woodcutting")){ - int skillups = 0; - while(PP.getWoodCuttingXPInt() >= PP.getXpToLevel("woodcutting")){ - skillups++; - PP.removeWoodCuttingXP(PP.getXpToLevel("woodcutting")); - PP.skillUpWoodCutting(1); - } - /* - * Leaderboard updating stuff - */ - PlayerStat ps = new PlayerStat(); - ps.statVal = PP.getWoodCuttingInt(); - ps.name = player.getName(); - mcLeaderboard.updateLeaderboard(ps, "woodcutting"); - - if(player != null && PP.getWoodCutting() != null) - player.sendMessage(ChatColor.YELLOW+"WoodCutting skill increased by "+skillups+"."+" Total ("+PP.getWoodCutting()+")"); - } - /* - * REPAIR - */ - if(PP.getRepairXPInt() >= PP.getXpToLevel("repair")){ - int skillups = 0; - while(PP.getRepairXPInt() >= PP.getXpToLevel("repair")){ - skillups++; - PP.removeRepairXP(PP.getXpToLevel("repair")); - PP.skillUpRepair(1); - } - /* - * Leaderboard updating stuff - */ - PlayerStat ps = new PlayerStat(); - ps.statVal = PP.getRepairInt(); - ps.name = player.getName(); - mcLeaderboard.updateLeaderboard(ps, "repair"); - - if(player != null && PP.getRepair() != null) - player.sendMessage(ChatColor.YELLOW+"Repair skill increased by "+skillups+"."+" Total ("+PP.getRepair()+")"); - } - /* - * EXCAVATION - */ - if(PP.getExcavationXPInt() >= PP.getXpToLevel("excavation")){ - int skillups = 0; - while(PP.getExcavationXPInt() >= PP.getXpToLevel("excavation")){ - skillups++; - PP.removeExcavationXP(PP.getXpToLevel("excavation")); - PP.skillUpExcavation(1); - } - /* - * Leaderboard updating stuff - */ - PlayerStat ps = new PlayerStat(); - ps.statVal = PP.getExcavationInt(); - ps.name = player.getName(); - mcLeaderboard.updateLeaderboard(ps, "excavation"); - - if(player != null && PP.getExcavation() != null) - player.sendMessage(ChatColor.YELLOW+"Excavation skill increased by "+skillups+"."+" Total ("+PP.getExcavation()+")"); - } - /* - * Leaderboard updating stuff - */ - PlayerStat ps = new PlayerStat(); - ps.statVal = mcm.getPowerLevel(player); - ps.name = player.getName(); - mcLeaderboard.updateLeaderboard(ps, "powerlevel"); - } - public static boolean isSkill(String skillname){ - skillname = skillname.toLowerCase(); - if(skillname.equals("all")){ - return true; - } - if(skillname.equals("taming")){ - return true; - } - if(skillname.equals("mining")){ - return true; - } - else if(skillname.equals("woodcutting")){ - return true; - } - else if(skillname.equals("excavation")){ - return true; - } - else if(skillname.equals("repair")){ - return true; - } - else if(skillname.equals("herbalism")){ - return true; - } - else if(skillname.equals("acrobatics")){ - return true; - } - else if(skillname.equals("swords")){ - return true; - } - else if(skillname.equals("archery")){ - return true; - } - else if(skillname.equals("unarmed")){ - return true; - } - else if(skillname.equals("axes")){ - return true; - } - else { - return false; - } -} - public static void arrowRetrievalCheck(Entity entity){ - if(mcConfig.getInstance().isTracked(entity)){ - Integer x = 0; - while(x < mcConfig.getInstance().getArrowCount(entity)){ - mcm.mcDropItem(entity.getLocation(), 262); - x++; - } - } - mcConfig.getInstance().removeArrowTracked(entity); - } -} diff --git a/mcMMO/com/gmail/nossr50/mcTaming.java b/mcMMO/com/gmail/nossr50/mcTaming.java deleted file mode 100644 index cc1568d35..000000000 --- a/mcMMO/com/gmail/nossr50/mcTaming.java +++ /dev/null @@ -1,45 +0,0 @@ -package com.gmail.nossr50; - -import net.minecraft.server.EntityWolf; - -import org.bukkit.craftbukkit.entity.CraftWolf; -import org.bukkit.entity.Entity; -import org.bukkit.entity.Player; -import org.bukkit.plugin.Plugin; - -public class mcTaming { - private static mcMMO plugin; - public mcTaming(mcMMO instance) { - plugin = instance; - } - - private static volatile mcTaming instance; - - public static String getOwnerName(Entity theWolf){ - CraftWolf cWolf = (CraftWolf)theWolf; - EntityWolf eWolf = (EntityWolf)cWolf.getHandle(); - - String playerName = eWolf.v(); - return playerName; - } - public static boolean hasOwner(Entity theWolf, Plugin pluginx){ - for(Player x : pluginx.getServer().getOnlinePlayers()){ - if(x != null && x.getName().equals(getOwnerName(theWolf))){ - return true; - } - } - return false; - } - public Player getOwner(Entity theWolf, Plugin pluginx){ - for(Player x : pluginx.getServer().getOnlinePlayers()){ - if(x != null && x.getName().equals(getOwnerName(theWolf))){ - return x; - } - } - return null; - } - public static mcTaming getInstance() { - // TODO Auto-generated method stub - return null; - } -} diff --git a/mcMMO/com/gmail/nossr50/mcUsers.java b/mcMMO/com/gmail/nossr50/mcUsers.java deleted file mode 100644 index 2a0252b5f..000000000 --- a/mcMMO/com/gmail/nossr50/mcUsers.java +++ /dev/null @@ -1,95 +0,0 @@ -package com.gmail.nossr50; - -import java.io.*; -import java.util.ArrayList; -import java.util.Properties; -import java.util.logging.Level; -import java.util.logging.Logger; -import java.util.HashMap; - -import org.bukkit.Location; -import org.bukkit.entity.*; -import org.bukkit.plugin.Plugin; - -import com.gmail.nossr50.datatypes.PlayerProfile; - - -public class mcUsers { - private static volatile mcUsers instance; - protected static final Logger log = Logger.getLogger("Minecraft"); - String location = "plugins/mcMMO/mcmmo.users"; - - //public static ArrayList players; - public static HashMap players = new HashMap(); - private Properties properties = new Properties(); - - //To load - public void load() throws IOException { - properties.load(new FileInputStream(location)); - } - //To save - public void save() { - try { - properties.store(new FileOutputStream(location), null); - }catch(IOException ex) { - } - } - - - public void loadUsers(){ - File theDir = new File(location); - if(!theDir.exists()){ - //properties = new PropertiesFile(location); - FileWriter writer = null; - try { - writer = new FileWriter(location); - writer.write("#Storage place for user information\r\n"); - } catch (Exception e) { - log.log(Level.SEVERE, "Exception while creating " + location, e); - } finally { - try { - if (writer != null) { - writer.close(); - } - } catch (IOException e) { - log.log(Level.SEVERE, "Exception while closing writer for " + location, e); - } - } - - } else { - //properties = new PropertiesFile(location); - try { - load(); - } catch (IOException e) { - log.log(Level.SEVERE, "Exception while loading " + location, e); - } - } - } - - - public static void addUser(Player player){ - //players.add(new PlayerProfile(player)); - players.put(player, new PlayerProfile(player)); - } - - - public static void removeUser(Player player){ - //players.remove(getProfile(playername)); - players.remove(player); - } - - public static PlayerProfile getProfile(Player player){ - return players.get(player); - } - - public static mcUsers getInstance() { - if (instance == null) { - instance = new mcUsers(); - } - return instance; - } - public static void getRow(){ - - } - -} \ No newline at end of file diff --git a/mcMMO/com/gmail/nossr50/mcWoodCutting.java b/mcMMO/com/gmail/nossr50/mcWoodCutting.java deleted file mode 100644 index a0e9b9ff9..000000000 --- a/mcMMO/com/gmail/nossr50/mcWoodCutting.java +++ /dev/null @@ -1,137 +0,0 @@ -package com.gmail.nossr50; - -import java.util.ArrayList; - -import org.bukkit.ChatColor; -import org.bukkit.Location; -import org.bukkit.Material; -import org.bukkit.block.Block; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; -import org.bukkit.plugin.Plugin; - -import com.gmail.nossr50.datatypes.PlayerProfile; - - -public class mcWoodCutting { - static int w = 0; - private static boolean isdone = false; - private static mcMMO plugin; - public mcWoodCutting(mcMMO instance) { - plugin = instance; - } - - public static void woodCuttingProcCheck(Player player, Block block){ - PlayerProfile PP = mcUsers.getProfile(player); - byte type = block.getData(); - Material mat = Material.getMaterial(block.getTypeId()); - if(player != null){ - if(Math.random() * 1000 <= PP.getWoodCuttingInt()){ - ItemStack item = new ItemStack(mat, 1, (short) 0, type); - block.getWorld().dropItemNaturally(block.getLocation(), item); - } - } - } - public static void treeFellerCheck(Player player, Block block, Plugin pluginx){ - PlayerProfile PP = mcUsers.getProfile(player); - if(mcm.isAxes(player.getItemInHand())){ - if(block != null){ - if(!mcm.abilityBlockCheck(block)) - return; - } - /* - * CHECK FOR AXE PREP MODE - */ - if(PP.getAxePreparationMode()){ - PP.setAxePreparationMode(false); - } - int ticks = 2; - int x = PP.getWoodCuttingInt(); - while(x >= 50){ - x-=50; - ticks++; - } - - if(!PP.getTreeFellerMode() && mcSkills.cooldownOver(player, PP.getTreeFellerDeactivatedTimeStamp(), mcLoadProperties.treeFellerCooldown)){ - player.sendMessage(ChatColor.GREEN+"**TREE FELLING ACTIVATED**"); - for(Player y : pluginx.getServer().getOnlinePlayers()){ - if(y != null && y != player && mcm.getDistance(player.getLocation(), y.getLocation()) < 10) - y.sendMessage(ChatColor.GREEN+player.getName()+ChatColor.DARK_GREEN+" has used "+ChatColor.RED+"Tree Feller!"); - } - PP.setTreeFellerTicks(ticks * 1000); - PP.setTreeFellerActivatedTimeStamp(System.currentTimeMillis()); - PP.setTreeFellerMode(true); - } - if(!PP.getTreeFellerMode() && !mcSkills.cooldownOver(player, PP.getTreeFellerDeactivatedTimeStamp(), mcLoadProperties.treeFellerCooldown)){ - player.sendMessage(ChatColor.RED+"You are too tired to use that ability again." - +ChatColor.YELLOW+" ("+mcSkills.calculateTimeLeft(player, PP.getTreeFellerDeactivatedTimeStamp(), mcLoadProperties.treeFellerCooldown)+"s)"); - } - } - } - public static void treeFeller(Block block, Player player){ - PlayerProfile PP = mcUsers.getProfile(player); - int radius = 1; - if(PP.getWoodCuttingXPInt() >= 500) - radius++; - if(PP.getWoodCuttingXPInt() >= 950) - radius++; - ArrayList blocklist = new ArrayList(); - ArrayList toAdd = new ArrayList(); - if(block != null) - blocklist.add(block); - while(isdone == false){ - addBlocksToTreeFelling(blocklist, toAdd, radius); - } - //This needs to be a hashmap too! - isdone = false; - /* - * Add blocks from the temporary 'toAdd' array list into the 'treeFeller' array list - * We use this temporary list to prevent concurrent modification exceptions - */ - for(Block x : toAdd){ - if(!mcConfig.getInstance().isTreeFellerWatched(x)) - mcConfig.getInstance().addTreeFeller(x); - } - toAdd.clear(); - } - public static void addBlocksToTreeFelling(ArrayList blocklist, ArrayList toAdd, Integer radius){ - int u = 0; - for (Block x : blocklist){ - u++; - if(toAdd.contains(x)) - continue; - w = 0; - Location loc = x.getLocation(); - int vx = x.getX(); - int vy = x.getY(); - int vz = x.getZ(); - - /* - * Run through the blocks around the broken block to see if they qualify to be 'felled' - */ - for (int cx = -radius; cx <= radius; cx++) { - for (int cy = -radius; cy <= radius; cy++) { - for (int cz = -radius; cz <= radius; cz++) { - Block blocktarget = loc.getWorld().getBlockAt(vx + cx, vy + cy, vz + cz); - if (!blocklist.contains(blocktarget) && !toAdd.contains(blocktarget) && (blocktarget.getTypeId() == 17 || blocktarget.getTypeId() == 18)) { - toAdd.add(blocktarget); - w++; - } - } - } - } - } - /* - * Add more blocks to blocklist so they can be 'felled' - */ - for(Block xx : toAdd){ - if(!blocklist.contains(xx)) - blocklist.add(xx); - } - if(u >= blocklist.size()){ - isdone = true; - } else { - isdone = false; - } - } -} diff --git a/mcMMO/com/gmail/nossr50/mcm.java b/mcMMO/com/gmail/nossr50/mcm.java deleted file mode 100644 index 1f3d14e4c..000000000 --- a/mcMMO/com/gmail/nossr50/mcm.java +++ /dev/null @@ -1,681 +0,0 @@ -package com.gmail.nossr50; - -import java.io.BufferedReader; -import java.io.FileNotFoundException; -import java.io.FileReader; -import java.io.IOException; -import org.bukkit.ChatColor; -import org.bukkit.Location; -import org.bukkit.Material; -import org.bukkit.block.Block; -import org.bukkit.entity.*; -import org.bukkit.event.block.BlockBreakEvent; -import org.bukkit.event.player.PlayerChatEvent; -import org.bukkit.inventory.ItemStack; -import org.bukkit.plugin.Plugin; - -import com.gmail.nossr50.datatypes.PlayerProfile; -import com.gmail.nossr50.datatypes.FakeBlockBreakEvent; - -public class mcm { - /* - * I'm storing my functions/methods in here in an unorganized manner. Spheal with it. - */ - private static mcMMO plugin; - private static mcMMO pluginx; - public mcm(mcMMO instance) { - plugin = instance; - } - - public static boolean shouldBeWatched(Block block){ - int id = block.getTypeId(); - if(id == 49 || id == 81 || id == 83 || id == 86 || id == 91 || id == 1 || id == 17 || id == 42 || id == 87 || id == 89 || id == 2 || id == 3 || id == 12 || id == 13 || id == 21 || id == 15 || id == 14 || id == 56 || id == 38 || id == 37 || id == 39 || id == 40 || id == 24){ - return true; - } else { - return false; - } - } - - public static int getPowerLevel(Player player){ - PlayerProfile PP = mcUsers.getProfile(player); - int x = 0; - if(mcPermissions.getInstance().mining(player)) - x+=PP.getMiningInt(); - if(mcPermissions.getInstance().woodcutting(player)) - x+=PP.getWoodCuttingInt(); - if(mcPermissions.getInstance().unarmed(player)) - x+=PP.getUnarmedInt(); - if(mcPermissions.getInstance().herbalism(player)) - x+=PP.getHerbalismInt(); - if(mcPermissions.getInstance().excavation(player)) - x+=PP.getExcavationInt(); - if(mcPermissions.getInstance().archery(player)) - x+=PP.getArcheryInt(); - if(mcPermissions.getInstance().swords(player)) - x+=PP.getSwordsInt(); - if(mcPermissions.getInstance().axes(player)) - x+=PP.getAxesInt(); - if(mcPermissions.getInstance().acrobatics(player)) - x+=PP.getAcrobaticsInt(); - if(mcPermissions.getInstance().repair(player)) - x+=PP.getRepairInt(); - return x; - } - public static boolean blockBreakSimulate(Block block, Player player, Plugin plugin){ - - FakeBlockBreakEvent event = new FakeBlockBreakEvent(block, player); - if(block != null && plugin != null && player != null){ - plugin.getServer().getPluginManager().callEvent(event); - if(!event.isCancelled()) - { - return true; //Return true if not cancelled - } else { - return false; //Return false if cancelled - } - } else { - return false; //Return false if something went wrong - } - } - - public static void damageTool(Player player, short damage){ - if(player.getItemInHand().getTypeId() == 0) - return; - player.getItemInHand().setDurability((short) (player.getItemInHand().getDurability() + damage)); - if(player.getItemInHand().getDurability() >= getMaxDurability(getTier(player), player.getItemInHand())){ - ItemStack[] inventory = player.getInventory().getContents(); - for(ItemStack x : inventory){ - if(x != null && x.getTypeId() == player.getItemInHand().getTypeId() && x.getDurability() == player.getItemInHand().getDurability()){ - x.setTypeId(0); - x.setAmount(0); - player.getInventory().setContents(inventory); - return; - } - } - } - } - public boolean hasArrows(Player player){ - for(ItemStack x : player.getInventory().getContents()){ - if(x.getTypeId() == 262) - return true; - } - return false; - } - public void addArrows(Player player){ - ItemStack[] inventory = player.getInventory().getContents(); - for(ItemStack x : inventory){ - if(x != null && x.getTypeId() == 262){ - if(x.getAmount() >= 1 && x.getAmount() < 64){ - x.setAmount(x.getAmount() + 1); - player.getInventory().setContents(inventory); - } - return; - } - } - } - public static Integer getTier(Player player){ - int i = player.getItemInHand().getTypeId(); - if(i == 268 || i == 269 || i == 270 || i == 271 || i == 290){ - return 1; //WOOD - } else if (i == 272 || i == 273 || i == 274 || i == 275 || i == 291){ - return 2; //STONE - } else if (i == 256 || i == 257 || i == 258 || i == 267 || i == 292){ - return 3; //IRON - } else if (i == 283 || i == 284 || i == 285 || i == 286 || i == 294){ - return 1; //GOLD - } else if (i == 276 || i == 277 || i == 278 || i == 279 || i == 293){ - return 4; //DIAMOND - } else { - return 1; //UNRECOGNIZED - } - } - public static Integer getMaxDurability(Integer tier, ItemStack item){ - int id = item.getTypeId(); - if(tier == 1){ - if((id == 276 || id == 277 || id == 278 || id == 279 || id == 293)){ - return 33; - } else { - return 60; - } - } else if (tier == 2){ - return 132; - } else if (tier == 3){ - return 251; - } else if (tier == 4){ - return 1562; - } else { - return 0; - } - } - public static double getDistance(Location loca, Location locb) - { - return Math.sqrt(Math.pow(loca.getX() - locb.getX(), 2) + Math.pow(loca.getY() - locb.getY(), 2) - + Math.pow(loca.getZ() - locb.getZ(), 2)); - } - public static boolean abilityBlockCheck(Block block){ - int i = block.getTypeId(); - if(i == 68 || i == 355 || i == 26 || i == 323 || i == 25 || i == 54 || i == 69 || i == 92 || i == 77 || i == 58 || i == 61 || i == 62 || i == 42 || i == 71 || i == 64 || i == 84 || i == 324 || i == 330){ - return false; - } else { - return true; - } - } - public static boolean isBlockAround(Location loc, Integer radius, Integer typeid){ - Block blockx = loc.getBlock(); - int ox = blockx.getX(); - int oy = blockx.getY(); - int oz = blockx.getZ(); - for (int cx = -radius; cx <= radius; cx++) { - for (int cy = -radius; cy <= radius; cy++) { - for (int cz = -radius; cz <= radius; cz++) { - Block block = loc.getWorld().getBlockAt(ox + cx, oy + cy, oz + cz); - //If block is block - if (block.getTypeId() == typeid) { - return true; - } - } - } - } - return false; - } - public static boolean isPvpEnabled(){ - String propertyName = "pvp"; - FileReader fr = null; - try { - fr = new FileReader("server.properties"); - } catch (FileNotFoundException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - BufferedReader br = new BufferedReader(fr); - String property; - String s = null; - try { - while((s=br.readLine()) .indexOf(propertyName)==-1); - } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - property = s.split("=")[1]; - try { - fr.close(); - } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - if(property.toLowerCase().equals("true")){ - return true; - } else { - return false; - } - } - public static Integer calculateHealth(Integer health, Integer newvalue){ - if((health + newvalue) > 20){ - return 20; - } else { - return health+newvalue; - } - } - public Integer calculateMinusHealth(Integer health, Integer newvalue){ - if((health - newvalue) < 1){ - return 0; - } else { - return health-newvalue; - } - } - public static Integer getHealth(Entity entity){ - if(entity instanceof Monster){ - Monster monster = (Monster)entity; - return monster.getHealth(); - } else if (entity instanceof Animals){ - Animals animals = (Animals)entity; - return animals.getHealth(); - } else if (entity instanceof Player){ - Player player = (Player)entity; - return player.getHealth(); - } else { - return 0; - } - } - public static boolean isInt(String string){ - try { - int x = Integer.parseInt(string); - } - catch(NumberFormatException nFE) { - return false; - } - return true; - } - public static void mcDropItem(Location loc, int id){ - if(loc != null){ - Material mat = Material.getMaterial(id); - byte damage = 0; - ItemStack item = new ItemStack(mat, 1, (byte)0, damage); - loc.getWorld().dropItemNaturally(loc, item); - } - } - - public static boolean isSwords(ItemStack is){ - if(is.getTypeId() == 268 || is.getTypeId() == 267 || is.getTypeId() == 272 || is.getTypeId() == 283 || is.getTypeId() == 276){ - return true; - } else { - return false; - } - } - public static boolean isHoe(ItemStack is){ - int id = is.getTypeId(); - if(id == 290 || id == 291 || id == 292 || id == 293 || id == 294){ - return true; - } else { - return false; - } - } - public static boolean isShovel(ItemStack is){ - if(is.getTypeId() == 269 || is.getTypeId() == 273 || is.getTypeId() == 277 || is.getTypeId() == 284 || is.getTypeId() == 256){ - return true; - } else { - return false; - } - } - public static boolean isAxes(ItemStack is){ - if(is.getTypeId() == 271 || is.getTypeId() == 258 || is.getTypeId() == 286 || is.getTypeId() == 279 || is.getTypeId() == 275){ - return true; - } else { - return false; - } - } - public static 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 boolean isGold(ItemStack is){ - int i = is.getTypeId(); - if(i == 283 || i == 284 || i == 285 || i == 286 || i == 294 || i == 314 || i == 315 || i == 316 || i == 317){ - return true; - } else { - return false; - } - } - public static void mcmmoHelpCheck(String[] split, Player player, PlayerChatEvent event){ - PlayerProfile PP = mcUsers.getProfile(player); - if(split[0].equalsIgnoreCase("/woodcutting")){ - event.setCancelled(true); - float skillvalue = (float)PP.getWoodCuttingInt(); - int ticks = 2; - int x = PP.getWoodCuttingInt(); - while(x >= 50){ - x-=50; - ticks++; - } - String percentage = String.valueOf((skillvalue / 1000) * 100); - player.sendMessage(ChatColor.RED+"-----[]"+ChatColor.GREEN+"WOODCUTTING"+ChatColor.RED+"[]-----"); - 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+"Double Drops: "+ChatColor.YELLOW+ChatColor.GREEN+"Double the normal loot"); - player.sendMessage(ChatColor.RED+"---[]"+ChatColor.GREEN+"YOUR STATS"+ChatColor.RED+"[]---"); - player.sendMessage(ChatColor.RED+"Double Drop Chance: "+ChatColor.YELLOW+percentage+"%"); - player.sendMessage(ChatColor.RED+"Tree Feller Length: "+ChatColor.YELLOW+ticks+"s"); - } - if(split[0].equalsIgnoreCase("/archery")){ - event.setCancelled(true); - Integer rank = 0; - if(PP.getArcheryInt() >= 50) - rank++; - if(PP.getArcheryInt() >= 250) - rank++; - if(PP.getArcheryInt() >= 575) - rank++; - if(PP.getArcheryInt() >= 725) - rank++; - if(PP.getArcheryInt() >= 1000) - rank++; - float skillvalue = (float)PP.getArcheryInt(); - String percentage = String.valueOf((skillvalue / 1000) * 100); - - int ignition = 20; - if(PP.getArcheryInt() >= 200) - ignition+=20; - if(PP.getArcheryInt() >= 400) - ignition+=20; - if(PP.getArcheryInt() >= 600) - ignition+=20; - if(PP.getArcheryInt() >= 800) - ignition+=20; - if(PP.getArcheryInt() >= 1000) - ignition+=20; - - String percentagedaze; - if(PP.getArcheryInt() < 1000){ - percentagedaze = String.valueOf((skillvalue / 2000) * 100); - } else { - percentagedaze = "50"; - } - player.sendMessage(ChatColor.RED+"-----[]"+ChatColor.GREEN+"ARCHERY"+ChatColor.RED+"[]-----"); - player.sendMessage(ChatColor.DARK_GRAY+"XP GAIN: "+ChatColor.WHITE+"Attacking Monsters"); - player.sendMessage(ChatColor.RED+"---[]"+ChatColor.GREEN+"EFFECTS"+ChatColor.RED+"[]---"); - player.sendMessage(ChatColor.DARK_AQUA+"Ignition: "+ChatColor.GREEN+"25% Chance Enemies will ignite"); - player.sendMessage(ChatColor.DARK_AQUA+"Daze (Players): "+ChatColor.GREEN+"Disorients foes"); - player.sendMessage(ChatColor.DARK_AQUA+"Damage+: "+ChatColor.GREEN+"Modifies Damage"); - player.sendMessage(ChatColor.DARK_AQUA+"Arrow Retrieval: "+ChatColor.GREEN+"Chance to retrieve arrows from corpses"); - player.sendMessage(ChatColor.RED+"---[]"+ChatColor.GREEN+"YOUR STATS"+ChatColor.RED+"[]---"); - player.sendMessage(ChatColor.RED+"Chance to Daze: "+ChatColor.YELLOW+percentagedaze+"%"); - player.sendMessage(ChatColor.RED+"Chance to Retrieve Arrows: "+ChatColor.YELLOW+percentage+"%"); - player.sendMessage(ChatColor.RED+"Length of Ignition: "+ChatColor.YELLOW+(ignition / 20)+" seconds"); - player.sendMessage(ChatColor.RED+"Damage+ (Rank"+rank+"): Bonus "+rank+" damage"); - } - if(split[0].equalsIgnoreCase("/axes")){ - event.setCancelled(true); - String percentage; - float skillvalue = (float)PP.getAxesInt(); - if(PP.getAxesInt() < 750){ - percentage = String.valueOf((skillvalue / 1000) * 100); - } else { - percentage = "75"; - } - int ticks = 2; - int x = PP.getAxesInt(); - while(x >= 50){ - x-=50; - ticks++; - } - - player.sendMessage(ChatColor.RED+"-----[]"+ChatColor.GREEN+"AXES"+ChatColor.RED+"[]-----"); - player.sendMessage(ChatColor.DARK_GRAY+"XP GAIN: "+ChatColor.WHITE+"Attacking Monsters"); - player.sendMessage(ChatColor.RED+"---[]"+ChatColor.GREEN+"EFFECTS"+ChatColor.RED+"[]---"); - player.sendMessage(ChatColor.DARK_AQUA+"Skull Splitter (ABILITY): "+ChatColor.GREEN+"Deal AoE Damage"); - player.sendMessage(ChatColor.DARK_AQUA+"Critical Strikes: "+ChatColor.GREEN+"Double Damage"); - player.sendMessage(ChatColor.DARK_AQUA+"Axe Mastery (500 SKILL): "+ChatColor.GREEN+"Modifies Damage"); - player.sendMessage(ChatColor.RED+"---[]"+ChatColor.GREEN+"YOUR STATS"+ChatColor.RED+"[]---"); - player.sendMessage(ChatColor.RED+"Chance to crtically strike: "+ChatColor.YELLOW+percentage+"%"); - if(PP.getAxesInt() < 500){ - player.sendMessage(ChatColor.GRAY+"LOCKED UNTIL 500+ SKILL (AXEMASTERY)"); - } else { - player.sendMessage(ChatColor.RED+"Axe Mastery:"+ChatColor.YELLOW+" Bonus 4 damage"); - } - player.sendMessage(ChatColor.RED+"Skull Splitter Length: "+ChatColor.YELLOW+ticks+"s"); - } - if(split[0].equalsIgnoreCase("/swords")){ - event.setCancelled(true); - int bleedrank = 2; - String percentage, parrypercentage = null, counterattackpercentage; - float skillvalue = (float)PP.getSwordsInt(); - if(PP.getSwordsInt() < 750){ - percentage = String.valueOf((skillvalue / 1000) * 100); - } else { - percentage = "75"; - } - if(skillvalue >= 750) - bleedrank+=1; - - if(PP.getSwordsInt() <= 900){ - parrypercentage = String.valueOf((skillvalue / 3000) * 100); - } else { - parrypercentage = "30"; - } - - if(PP.getSwordsInt() <= 600){ - counterattackpercentage = String.valueOf((skillvalue / 2000) * 100); - } else { - counterattackpercentage = "30"; - } - - int ticks = 2; - int x = PP.getSwordsInt(); - while(x >= 50){ - x-=50; - ticks++; - } - - player.sendMessage(ChatColor.RED+"-----[]"+ChatColor.GREEN+"SWORDS"+ChatColor.RED+"[]-----"); - player.sendMessage(ChatColor.DARK_GRAY+"XP GAIN: "+ChatColor.WHITE+"Attacking Monsters"); - player.sendMessage(ChatColor.RED+"---[]"+ChatColor.GREEN+"EFFECTS"+ChatColor.RED+"[]---"); - player.sendMessage(ChatColor.DARK_AQUA+"Counter Attack: "+ChatColor.GREEN+"Reflect 50% of damage taken"); - player.sendMessage(ChatColor.DARK_AQUA+"Serrated Strikes (ABILITY): "+ChatColor.GREEN+"25% DMG AoE, Bleed+ AoE"); - player.sendMessage(ChatColor.DARK_GRAY+"Serrated Strikes Bleed+: "+ChatColor.GREEN+"5 Tick Bleed"); - player.sendMessage(ChatColor.DARK_AQUA+"Parrying: "+ChatColor.GREEN+"Negates Damage"); - player.sendMessage(ChatColor.DARK_AQUA+"Bleed: "+ChatColor.GREEN+"Apply a bleed DoT"); - player.sendMessage(ChatColor.RED+"---[]"+ChatColor.GREEN+"YOUR STATS"+ChatColor.RED+"[]---"); - player.sendMessage(ChatColor.RED+"Counter Attack Chance: "+ChatColor.YELLOW+counterattackpercentage+"%"); - player.sendMessage(ChatColor.RED+"Bleed Length: "+ChatColor.YELLOW+bleedrank+" ticks"); - player.sendMessage(ChatColor.GRAY+"NOTE: "+ChatColor.YELLOW+"1 Tick happens every 2 seconds"); - player.sendMessage(ChatColor.RED+"Bleed Chance: "+ChatColor.YELLOW+percentage+"%"); - player.sendMessage(ChatColor.RED+"Parry Chance: "+ChatColor.YELLOW+parrypercentage+"%"); - player.sendMessage(ChatColor.RED+"Serrated Strikes Length: "+ChatColor.YELLOW+ticks+"s"); - - } - if(split[0].equalsIgnoreCase("/acrobatics")){ - event.setCancelled(true); - String dodgepercentage; - float skillvalue = (float)PP.getAcrobaticsInt(); - String percentage = String.valueOf((skillvalue / 1000) * 100); - String gracepercentage = String.valueOf(((skillvalue / 1000) * 100) * 2); - if(PP.getAcrobaticsInt() <= 800){ - dodgepercentage = String.valueOf((skillvalue / 4000 * 100)); - } else { - dodgepercentage = "20"; - } - player.sendMessage(ChatColor.RED+"-----[]"+ChatColor.GREEN+"ACROBATICS"+ChatColor.RED+"[]-----"); - player.sendMessage(ChatColor.DARK_GRAY+"XP GAIN: "+ChatColor.WHITE+"Falling"); - player.sendMessage(ChatColor.RED+"---[]"+ChatColor.GREEN+"EFFECTS"+ChatColor.RED+"[]---"); - player.sendMessage(ChatColor.DARK_AQUA+"Roll: "+ChatColor.GREEN+"Reduces or Negates damage"); - player.sendMessage(ChatColor.DARK_AQUA+"Graceful Roll: "+ChatColor.GREEN+"Twice as effective as Roll"); - player.sendMessage(ChatColor.DARK_AQUA+"Dodge: "+ChatColor.GREEN+"Reduce damage by half"); - player.sendMessage(ChatColor.RED+"---[]"+ChatColor.GREEN+"YOUR STATS"+ChatColor.RED+"[]---"); - player.sendMessage(ChatColor.RED+"Roll Chance: "+ChatColor.YELLOW+percentage+"%"); - player.sendMessage(ChatColor.RED+"Graceful Roll Chance: "+ChatColor.YELLOW+gracepercentage+"%"); - player.sendMessage(ChatColor.RED+"Dodge Chance: "+ChatColor.YELLOW+dodgepercentage+"%"); - } - if(split[0].equalsIgnoreCase("/mining")){ - float skillvalue = (float)PP.getMiningInt(); - String percentage = String.valueOf((skillvalue / 1000) * 100); - int ticks = 2; - int x = PP.getMiningInt(); - while(x >= 50){ - x-=50; - ticks++; - } - event.setCancelled(true); - player.sendMessage(ChatColor.RED+"-----[]"+ChatColor.GREEN+"MINING"+ChatColor.RED+"[]-----"); - player.sendMessage(ChatColor.DARK_GRAY+"XP GAIN: "+ChatColor.WHITE+"Mining Stone & Ore"); - player.sendMessage(ChatColor.RED+"---[]"+ChatColor.GREEN+"EFFECTS"+ChatColor.RED+"[]---"); - player.sendMessage(ChatColor.DARK_AQUA+"Super Breaker (ABILITY): "+ChatColor.GREEN+"Speed+, Triple Drop Chance"); - player.sendMessage(ChatColor.DARK_AQUA+"Double Drops: "+ChatColor.GREEN+"Double the normal loot"); - player.sendMessage(ChatColor.RED+"---[]"+ChatColor.GREEN+"YOUR STATS"+ChatColor.RED+"[]---"); - player.sendMessage(ChatColor.RED+"Double Drop Chance: "+ChatColor.YELLOW+percentage+"%"); - player.sendMessage(ChatColor.RED+"Super Breaker Length: "+ChatColor.YELLOW+ticks+"s"); - } - if(split[0].equalsIgnoreCase("/repair")){ - float skillvalue = (float)PP.getRepairInt(); - String percentage = String.valueOf((skillvalue / 1000) * 100); - String repairmastery = String.valueOf((skillvalue / 500) * 100); - event.setCancelled(true); - player.sendMessage(ChatColor.RED+"-----[]"+ChatColor.GREEN+"REPAIR"+ChatColor.RED+"[]-----"); - player.sendMessage(ChatColor.DARK_GRAY+"XP GAIN: "+ChatColor.WHITE+"Repairing"); - player.sendMessage(ChatColor.RED+"---[]"+ChatColor.GREEN+"EFFECTS"+ChatColor.RED+"[]---"); - player.sendMessage(ChatColor.DARK_AQUA+"Repair: "+ChatColor.GREEN+"Repair Iron Tools & Armor"); - player.sendMessage(ChatColor.DARK_AQUA+"Repair Mastery: "+ChatColor.GREEN+"Increased repair amount"); - player.sendMessage(ChatColor.DARK_AQUA+"Super Repair: "+ChatColor.GREEN+"Double effectiveness"); - player.sendMessage(ChatColor.DARK_AQUA+"Diamond Repair ("+mcLoadProperties.repairdiamondlevel+"+ SKILL): "+ChatColor.GREEN+"Repair Diamond Tools & Armor"); - player.sendMessage(ChatColor.RED+"---[]"+ChatColor.GREEN+"YOUR STATS"+ChatColor.RED+"[]---"); - player.sendMessage(ChatColor.RED+"Repair Mastery: "+ChatColor.YELLOW+"Extra "+repairmastery+"% durability restored"); - player.sendMessage(ChatColor.RED+"Super Repair Chance: "+ChatColor.YELLOW+percentage+"%"); - } - if(split[0].equalsIgnoreCase("/unarmed")){ - event.setCancelled(true); - String percentage, arrowpercentage; - float skillvalue = (float)PP.getUnarmedInt(); - - if(PP.getUnarmedInt() < 1000){ - percentage = String.valueOf((skillvalue / 4000) * 100); - } else { - percentage = "25"; - } - - if(PP.getUnarmedInt() < 1000){ - arrowpercentage = String.valueOf(((skillvalue / 1000) * 100) / 2); - } else { - arrowpercentage = "50"; - } - - - int ticks = 2; - int x = PP.getUnarmedInt(); - while(x >= 50){ - x-=50; - ticks++; - } - - player.sendMessage(ChatColor.RED+"-----[]"+ChatColor.GREEN+"UNARMED"+ChatColor.RED+"[]-----"); - player.sendMessage(ChatColor.DARK_GRAY+"XP GAIN: "+ChatColor.WHITE+"Attacking Monsters"); - player.sendMessage(ChatColor.RED+"---[]"+ChatColor.GREEN+"EFFECTS"+ChatColor.RED+"[]---"); - player.sendMessage(ChatColor.DARK_AQUA+"Berserk (ABILITY): "+ChatColor.GREEN+"+50% DMG, Breaks weak materials"); - player.sendMessage(ChatColor.DARK_AQUA+"Disarm (Players): "+ChatColor.GREEN+"Drops the foes item held in hand"); - player.sendMessage(ChatColor.DARK_AQUA+"Unarmed Mastery: "+ChatColor.GREEN+"Large Damage Upgrade"); - player.sendMessage(ChatColor.DARK_AQUA+"Unarmed Apprentice: "+ChatColor.GREEN+"Damage Upgrade"); - player.sendMessage(ChatColor.DARK_AQUA+"Arrow Deflect: "+ChatColor.GREEN+"Deflect arrows"); - player.sendMessage(ChatColor.RED+"---[]"+ChatColor.GREEN+"YOUR STATS"+ChatColor.RED+"[]---"); - player.sendMessage(ChatColor.RED+"Arrow Deflect Chance: "+ChatColor.YELLOW+arrowpercentage+"%"); - player.sendMessage(ChatColor.RED+"Disarm Chance: "+ChatColor.YELLOW+percentage+"%"); - if(PP.getUnarmedInt() < 250){ - player.sendMessage(ChatColor.GRAY+"LOCKED UNTIL 250+ SKILL (UNARMED APPRENTICE)"); - } else if(PP.getUnarmedInt() >= 250 && PP.getUnarmedInt() < 500){ - player.sendMessage(ChatColor.RED+"Unarmed Apprentice: "+ChatColor.YELLOW+"Damage Upgrade"); - player.sendMessage(ChatColor.GRAY+"LOCKED UNTIL 500+ SKILL (UNARMED MASTERY)"); - } else { - player.sendMessage(ChatColor.RED+"Unarmed Mastery: "+ChatColor.YELLOW+"Large Damage Upgrade"); - } - player.sendMessage(ChatColor.RED+"Berserk Length: "+ChatColor.YELLOW+ticks+"s"); - } - if(split[0].equalsIgnoreCase("/herbalism")){ - event.setCancelled(true); - int rank = 0; - if(PP.getHerbalismInt() >= 50) - rank++; - if (PP.getHerbalismInt() >= 150) - rank++; - if (PP.getHerbalismInt() >= 250) - rank++; - if (PP.getHerbalismInt() >= 350) - rank++; - if (PP.getHerbalismInt() >= 450) - rank++; - if (PP.getHerbalismInt() >= 550) - rank++; - if (PP.getHerbalismInt() >= 650) - rank++; - if (PP.getHerbalismInt() >= 750) - rank++; - int bonus = 0; - if(PP.getHerbalismInt() >= 200) - bonus++; - if(PP.getHerbalismInt() >= 400) - bonus++; - if(PP.getHerbalismInt() >= 600) - bonus++; - - int ticks = 2; - int x = PP.getHerbalismInt(); - while(x >= 50){ - x-=50; - ticks++; - } - - float skillvalue = (float)PP.getHerbalismInt(); - String percentage = String.valueOf((skillvalue / 1000) * 100); - String gpercentage = String.valueOf((skillvalue / 1500) * 100); - player.sendMessage(ChatColor.RED+"-----[]"+ChatColor.GREEN+"HERBALISM"+ChatColor.RED+"[]-----"); - player.sendMessage(ChatColor.DARK_GRAY+"XP GAIN: "+ChatColor.WHITE+"Harvesting Herbs"); - player.sendMessage(ChatColor.RED+"---[]"+ChatColor.GREEN+"EFFECTS"+ChatColor.RED+"[]---"); - player.sendMessage(ChatColor.DARK_AQUA+"Green Terra (ABILITY): "+ChatColor.GREEN+"Spread the Terra, 3x Drops"); - player.sendMessage(ChatColor.DARK_AQUA+"Green Thumb (Wheat): "+ChatColor.GREEN+"Auto-Plants wheat when harvesting"); - player.sendMessage(ChatColor.DARK_AQUA+"Green Thumb (Cobble): "+ChatColor.GREEN+"Cobblestone -> Mossy w/ Seeds"); - player.sendMessage(ChatColor.DARK_AQUA+"Food+: "+ChatColor.GREEN+"Modifies health received from bread/stew"); - player.sendMessage(ChatColor.DARK_AQUA+"Double Drops (All Herbs): "+ChatColor.GREEN+"Double the normal loot"); - player.sendMessage(ChatColor.RED+"---[]"+ChatColor.GREEN+"YOUR STATS"+ChatColor.RED+"[]---"); - player.sendMessage(ChatColor.RED+"Green Terra Length: "+ChatColor.YELLOW+ticks+"s"); - player.sendMessage(ChatColor.RED+"Green Thumb Chance: "+gpercentage+"%"); - player.sendMessage(ChatColor.RED+"Green Thumb Stage: Wheat grows in stage "+bonus); - player.sendMessage(ChatColor.RED+"Double Drop Chance: "+percentage+"%"); - player.sendMessage(ChatColor.RED+"Food+ (Rank"+rank+"): Bonus "+rank+" healing"); - } - if(split[0].equalsIgnoreCase("/excavation")){ - event.setCancelled(true); - int ticks = 2; - int x = PP.getExcavationInt(); - while(x >= 50){ - x-=50; - ticks++; - } - player.sendMessage(ChatColor.RED+"-----[]"+ChatColor.GREEN+"EXCAVATION"+ChatColor.RED+"[]-----"); - player.sendMessage(ChatColor.DARK_GRAY+"XP GAIN: "+ChatColor.WHITE+"Digging and finding treasures"); - player.sendMessage(ChatColor.RED+"---[]"+ChatColor.GREEN+"EFFECTS"+ChatColor.RED+"[]---"); - player.sendMessage(ChatColor.DARK_AQUA+"Giga Drill Breaker (ABILITY): "+ChatColor.GREEN+"3x Drop Rate, 3x EXP, +Speed"); - player.sendMessage(ChatColor.DARK_AQUA+"Treasure Hunter: "+ChatColor.GREEN+"Ability to dig for treasure"); - player.sendMessage(ChatColor.RED+"---[]"+ChatColor.GREEN+"YOUR STATS"+ChatColor.RED+"[]---"); - player.sendMessage(ChatColor.RED+"Giga Drill Breaker Length: "+ChatColor.YELLOW+ticks+"s"); - } - if(split[0].equalsIgnoreCase("/"+mcLoadProperties.mcmmo)){ - event.setCancelled(true); - player.sendMessage(ChatColor.RED+"-----[]"+ChatColor.GREEN+"mcMMO"+ChatColor.RED+"[]-----"); - player.sendMessage(ChatColor.YELLOW+"mcMMO is an RPG server mod for minecraft."); - player.sendMessage(ChatColor.YELLOW+"There are many skills added by mcMMO to minecraft."); - player.sendMessage(ChatColor.YELLOW+"They can do anything from giving a chance"); - player.sendMessage(ChatColor.YELLOW+"for double drops to letting you break materials instantly."); - player.sendMessage(ChatColor.YELLOW+"For example, by harvesting logs from trees you will gain"); - player.sendMessage(ChatColor.YELLOW+"Woodcutting xp and once you have enough xp you will gain"); - player.sendMessage(ChatColor.YELLOW+"a skill level in Woodcutting. By raising this skill you will"); - player.sendMessage(ChatColor.YELLOW+"be able to receive benefits like "+ChatColor.RED+"double drops"); - player.sendMessage(ChatColor.YELLOW+"and increase the effects of the "+ChatColor.RED+"\"Tree Felling\""+ChatColor.YELLOW+" ability."); - player.sendMessage(ChatColor.YELLOW+"mcMMO has abilities related to the skill, skills normally"); - player.sendMessage(ChatColor.YELLOW+"provide passive bonuses but they also have activated"); - player.sendMessage(ChatColor.YELLOW+"abilities too. Each ability is activated by holding"); - player.sendMessage(ChatColor.YELLOW+"the appropriate tool and "+ChatColor.RED+"right clicking."); - player.sendMessage(ChatColor.YELLOW+"For example, if you hold a Mining Pick and right click"); - player.sendMessage(ChatColor.YELLOW+"you will ready your Pickaxe, attack mining materials"); - player.sendMessage(ChatColor.YELLOW+"and then "+ChatColor.RED+"Super Breaker "+ChatColor.YELLOW+"will activate."); - player.sendMessage(ChatColor.GREEN+"Find out mcMMO commands with "+ChatColor.DARK_AQUA+"/"+mcLoadProperties.mcc); - player.sendMessage(ChatColor.GREEN+"You can donate via paypal to"+ChatColor.DARK_RED+" nossr50@gmail.com"); - } - if(split[0].equalsIgnoreCase("/"+mcLoadProperties.mcc)){ - event.setCancelled(true); - player.sendMessage(ChatColor.RED+"---[]"+ChatColor.YELLOW+"mcMMO Commands"+ChatColor.RED+"[]---"); - player.sendMessage("/"+mcLoadProperties.stats+ChatColor.RED+" - View your mcMMO stats"); - if(mcPermissions.getInstance().party(player)){ - player.sendMessage(ChatColor.GREEN+"--PARTY COMMANDS--"); - player.sendMessage("/"+mcLoadProperties.party+" [party name] "+ChatColor.RED+"- Create/Join designated party"); - player.sendMessage("/"+mcLoadProperties.party+" q "+ChatColor.RED+"- Leave your current party"); - if(mcPermissions.getInstance().partyChat(player)) - player.sendMessage("/p "+ChatColor.RED+" - Toggle Party Chat"); - player.sendMessage("/"+mcLoadProperties.invite+" [player name] "+ChatColor.RED+"- Send party invite"); - player.sendMessage("/"+mcLoadProperties.accept+" "+ChatColor.RED+"- Accept party invite"); - if(mcPermissions.getInstance().partyTeleport(player)) - player.sendMessage("/"+mcLoadProperties.ptp+" [party member name] "+ChatColor.RED+"- Teleport to party member"); - } - if(mcPermissions.getInstance().mySpawn(player)){ - player.sendMessage(ChatColor.GREEN+"--MYSPAWN COMMANDS--"); - player.sendMessage("/"+mcLoadProperties.myspawn+" "+ChatColor.RED+"- Clears inventory & teleports to myspawn"); - player.sendMessage("/"+mcLoadProperties.clearmyspawn+" "+ChatColor.RED+"- Clears your MySpawn"); - } - player.sendMessage(ChatColor.GREEN+"--OTHER COMMANDS--"); - player.sendMessage("/mctop "+ChatColor.RED+"- Leaderboards"); - if(mcPermissions.getInstance().mcAbility(player)) - player.sendMessage("/"+mcLoadProperties.mcability+ChatColor.RED+" - Toggle ability activation with right click"); - if(mcPermissions.getInstance().adminChat(player)){ - player.sendMessage("/a "+ChatColor.RED+"- Toggle admin chat"); - } - if(mcPermissions.getInstance().whois(player)) - player.sendMessage("/"+mcLoadProperties.whois+" [playername] "+ChatColor.RED+"- View detailed player info"); - if(mcPermissions.getInstance().mmoedit(player)){ - //player.sendMessage("/"+mcLoadProperties.mmoedit+" [skill] [newvalue] "+ChatColor.RED+"Modify the designated skill value"); - player.sendMessage("/"+mcLoadProperties.mmoedit+" [playername] [skill] [newvalue] "+ChatColor.RED+"- Modify target"); - } - if(mcPermissions.getInstance().mcgod(player)) - player.sendMessage("/"+mcLoadProperties.mcgod+ChatColor.RED+" - God Mode"); - player.sendMessage("/[skillname] "+ChatColor.RED+" View detailed information about a skill"); - player.sendMessage("/"+mcLoadProperties.mcmmo+" "+ChatColor.RED+"- Read brief mod description"); - } - } -}