diff --git a/mcMMO/Changelog.txt b/mcMMO/Changelog.txt index 7277a53ed..201ea91c0 100644 --- a/mcMMO/Changelog.txt +++ b/mcMMO/Changelog.txt @@ -1,5 +1,11 @@ Changelog: #Versions without changelogs probably had very small misc fixes, like tweaks to the source code# +Version 0.8 + Archery skill now lets players recover arrows from downed foes + Health regenerates based on power level + Added toggle to myspawn clearing player inventory in settings file + Swords now have a bleed effect + Rewrote Skill descriptions to be more informative/better Version 0.7.9 XP Curve now follows a new formula Acrobatics XP gains changed diff --git a/mcMMO/com/gmail/nossr50/mcConfig.java b/mcMMO/com/gmail/nossr50/mcConfig.java index 3c16cd535..b1ee3542f 100644 --- a/mcMMO/com/gmail/nossr50/mcConfig.java +++ b/mcMMO/com/gmail/nossr50/mcConfig.java @@ -7,6 +7,7 @@ import java.util.logging.Logger; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.block.Block; +import org.bukkit.entity.Entity; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; import java.util.Map.Entry; @@ -19,12 +20,44 @@ public class mcConfig { static ArrayList coordsWatchList = new ArrayList(); static ArrayList blockWatchList = new ArrayList(); static ArrayList partyChatList = new ArrayList(); + HashMap arrowTracker = new HashMap(); + HashMap bleedTracker = new HashMap(); public boolean isBlockWatched(Block block) {return blockWatchList.contains(block);} public boolean isCoordsWatched(String xyz) {return coordsWatchList.contains(xyz);} public void removeBlockWatch(Block block) {blockWatchList.remove(blockWatchList.indexOf(block));} public void removeCoordsWatch(String xyz) {coordsWatchList.remove(coordsWatchList.indexOf(xyz));} public void addBlockWatch(Block block) {blockWatchList.add(block);} public void addCoordsWatch(String xyz) {coordsWatchList.add(xyz);} + public void addArrowTrack(Entity entity, Integer arrowcount) {arrowTracker.put(entity, arrowcount);} + public void addBleedTrack(Entity entity, Integer duration) {bleedTracker.put(entity, duration);} + public Integer getArrowCount(Entity entity) {return arrowTracker.get(entity);} + public Integer getBleedCount(Entity entity) {return bleedTracker.get(entity);} + public void removeBleedTrack(Entity entity){ + bleedTracker.remove(entity); + } + public void setBleedCount(Entity entity, Integer newvalue){ + bleedTracker.put(entity, newvalue); + } + public void removeBleedCount(Entity entity, Integer newvalue) { + bleedTracker.put(entity, bleedTracker.get(entity) - newvalue); + } + 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 isBleedTracked(Entity entity) { + if(bleedTracker.containsKey(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 void removePartyToggled(String playerName) {partyChatList.remove(partyChatList.indexOf(playerName));} diff --git a/mcMMO/com/gmail/nossr50/mcEntityListener.java b/mcMMO/com/gmail/nossr50/mcEntityListener.java index 1c98872ae..41d108d90 100644 --- a/mcMMO/com/gmail/nossr50/mcEntityListener.java +++ b/mcMMO/com/gmail/nossr50/mcEntityListener.java @@ -71,6 +71,9 @@ public class mcEntityListener extends EntityListener { */ if(e instanceof Player){ Player defender = (Player)e; + if(f instanceof Monster){ + mcUsers.getProfile(defender).setRecentlyHurt(60); + } /* * PARRYING CHECK, CHECK TO SEE IF ITS A SUCCESSFUL PARRY OR NOT */ diff --git a/mcMMO/com/gmail/nossr50/mcLoadProperties.java b/mcMMO/com/gmail/nossr50/mcLoadProperties.java index dc445f57e..7ecc063e8 100644 --- a/mcMMO/com/gmail/nossr50/mcLoadProperties.java +++ b/mcMMO/com/gmail/nossr50/mcLoadProperties.java @@ -1,7 +1,7 @@ package com.gmail.nossr50; public class mcLoadProperties { - public static Boolean pvp, eggs, apples, cake, music, diamond, glowstone, slowsand, sulphur, netherrack, bones, coal, clay, anvilmessages; + public static Boolean pvp, eggs, apples, myspawnclearsinventory, cake, music, diamond, glowstone, slowsand, sulphur, netherrack, bones, coal, clay, anvilmessages; public static String mcmmo, mcc, stats, mmoedit, ptp, party, myspawn, setmyspawn, whois, invite, accept, clearmyspawn; public static int xpmodifier; @@ -25,6 +25,7 @@ public class mcLoadProperties { /* * EXCAVATION LOOT TOGGLES */ + myspawnclearsinventory = properties.getBoolean("myspawnclearsinventory", true); glowstone = properties.getBoolean("glowstone", true); pvp = properties.getBoolean("pvp", true); eggs = properties.getBoolean("eggs", true); diff --git a/mcMMO/com/gmail/nossr50/mcMMO.java b/mcMMO/com/gmail/nossr50/mcMMO.java index 62259be94..8eff5afcd 100644 --- a/mcMMO/com/gmail/nossr50/mcMMO.java +++ b/mcMMO/com/gmail/nossr50/mcMMO.java @@ -9,6 +9,7 @@ import java.io.File; import java.io.FileWriter; import java.io.IOException; import java.util.HashMap; +import java.util.Timer; import java.util.logging.Level; import java.util.logging.Logger; import org.bukkit.event.player.*; @@ -33,6 +34,7 @@ public class mcMMO extends JavaPlugin { private final String name = "mcMMO"; public static PermissionHandler PermissionsHandler = null; private Permissions permissions; + private Timer mcMMO_Timer = new Timer(true); /* public mcMMO(PluginLoader pluginLoader, Server instance, PluginDescriptionFile desc, File folder, File plugin, ClassLoader cLoader) { @@ -41,6 +43,7 @@ public class mcMMO extends JavaPlugin { */ //herp public void onEnable() { + mcMMO_Timer.schedule(new mcTimer(this), 0, (long)(1000)); //Make the directory if it does not exist new File(maindirectory).mkdir(); //Make the file if it does not exist diff --git a/mcMMO/com/gmail/nossr50/mcPermissions.java b/mcMMO/com/gmail/nossr50/mcPermissions.java index d6031516e..1273123a8 100644 --- a/mcMMO/com/gmail/nossr50/mcPermissions.java +++ b/mcMMO/com/gmail/nossr50/mcPermissions.java @@ -37,6 +37,13 @@ public class mcPermissions { return true; } } + public boolean regeneration(Player player){ + if (permissionsEnabled) { + return permission(player, "mcmmo.skills.regeneration"); + } else { + return true; + } + } public boolean motd(Player player) { if (permissionsEnabled) { return permission(player, "mcmmo.motd"); diff --git a/mcMMO/com/gmail/nossr50/mcPlayerListener.java b/mcMMO/com/gmail/nossr50/mcPlayerListener.java index 541e5bb15..3325cf472 100644 --- a/mcMMO/com/gmail/nossr50/mcPlayerListener.java +++ b/mcMMO/com/gmail/nossr50/mcPlayerListener.java @@ -423,6 +423,7 @@ public class mcPlayerListener extends PlayerListener { } event.setCancelled(true); if(mcUsers.getProfile(player).getMySpawn(player) != null){ + if(mcLoadProperties.myspawnclearsinventory) player.getInventory().clear(); player.setHealth(20); Location mySpawn = mcUsers.getProfile(player).getMySpawn(player); diff --git a/mcMMO/com/gmail/nossr50/mcTimer.java b/mcMMO/com/gmail/nossr50/mcTimer.java new file mode 100644 index 000000000..0d7d8c0c5 --- /dev/null +++ b/mcMMO/com/gmail/nossr50/mcTimer.java @@ -0,0 +1,147 @@ +package com.gmail.nossr50; +import java.util.Timer; +import java.util.TimerTask; + +import org.bukkit.ChatColor; +import org.bukkit.World; +import org.bukkit.entity.*; +import org.bukkit.inventory.ItemStack; + +public class mcTimer extends TimerTask{ + private final mcMMO plugin; + int thecount = 1; + + public mcTimer(final mcMMO plugin) { + this.plugin = plugin; + } + public 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 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 void run() { + for(World world : plugin.getServer().getWorlds()){ + for(Entity entity : world.getEntities()){ + if(entity == null || getHealth(entity) <= 0) + return; + if(mcConfig.getInstance().getBleedCount(entity) < 1) + return; + if(mcConfig.getInstance().isBleedTracked(entity)){ + if(entity instanceof Player){ + Player player = (Player)entity; + if(player.getHealth() >= 1){ + player.setHealth(calculateMinusHealth(player.getHealth(), 1)); + player.sendMessage(ChatColor.RED+"**BLEED**"); + if(player.getHealth() <= 0){ + for(ItemStack items : player.getInventory().getContents()){ + if(items.getTypeId() != 0) + player.getLocation().getWorld().dropItemNaturally(player.getLocation(), items); + } + } + } + } + if(entity instanceof Animals){ + Animals animals = (Animals)entity; + if(animals.getHealth() >= 1){ + animals.setHealth(calculateMinusHealth(animals.getHealth(), 1)); + if(animals.getHealth() <= 0){ + mcm.getInstance().simulateNaturalDrops(entity); + } + } + } + if(entity instanceof Monster){ + Monster monster = (Monster)entity; + if(monster.getHealth() >= 1){ + monster.setHealth(calculateMinusHealth(monster.getHealth(), 1)); + if(monster.getHealth() <= 0){ + mcm.getInstance().simulateNaturalDrops(entity); + } + } + } + } + } + } + for(World world : plugin.getServer().getWorlds()){ + for(Entity entity : world.getEntities()){ + if(mcConfig.getInstance().isBleedTracked(entity)){ + if(mcConfig.getInstance().getBleedCount(entity) >= 2){ + mcConfig.getInstance().removeBleedCount(entity, 1); + } else if(mcConfig.getInstance().getBleedCount(entity) == 1){ + mcConfig.getInstance().removeBleedTrack(entity); + } + } + } + } + if(thecount == 10 || thecount == 20 || thecount == 30 || thecount == 40){ + for(Player player : plugin.getServer().getOnlinePlayers()){ + if(player != null && mcUsers.getProfile(player).getRecentlyHurt() >= 1) + mcUsers.getProfile(player).decreaseLastHurt(); + } + } + + for(Player player : plugin.getServer().getOnlinePlayers()){ + if(player != null && + player.getHealth() > 0 && player.getHealth() < 20 + && mcUsers.getProfile(player).getPowerLevel() >= 1000 + && mcUsers.getProfile(player).getRecentlyHurt() == 0 + && mcPermissions.getInstance().regeneration(player)){ + player.setHealth(calculateHealth(player.getHealth(), 1)); + } + } + if(thecount == 20 || thecount == 40){ + for(Player player : plugin.getServer().getOnlinePlayers()){ + if(player != null && + player.getHealth() > 0 && player.getHealth() < 20 + && mcUsers.getProfile(player).getPowerLevel() >= 500 + && mcUsers.getProfile(player).getPowerLevel() < 1000 + && mcUsers.getProfile(player).getRecentlyHurt() == 0 + && mcPermissions.getInstance().regeneration(player)){ + player.setHealth(calculateHealth(player.getHealth(), 1)); + } + } + } + if(thecount == 40){ + for(Player player : plugin.getServer().getOnlinePlayers()){ + if(player != null && + player.getHealth() > 0 && player.getHealth() < 20 + && mcUsers.getProfile(player).getPowerLevel() >= 100 + && mcUsers.getProfile(player).getPowerLevel() < 500 + && mcUsers.getProfile(player).getRecentlyHurt() == 0 + && mcPermissions.getInstance().regeneration(player)){ + player.setHealth(calculateHealth(player.getHealth(), 1)); + } + } + } + /* + * RESET THE COUNT + */ + if(thecount < 40){ + thecount++; + } else { + thecount = 1; + } + } +} diff --git a/mcMMO/com/gmail/nossr50/mcUsers.java b/mcMMO/com/gmail/nossr50/mcUsers.java index 1667b9f87..ded24bcf5 100644 --- a/mcMMO/com/gmail/nossr50/mcUsers.java +++ b/mcMMO/com/gmail/nossr50/mcUsers.java @@ -156,6 +156,7 @@ class PlayerList private String playerName, gather, wgather, woodcutting, repair, mining, party, myspawn, myspawnworld, unarmed, herbalism, excavation, archery, swords, axes, invite, acrobatics, repairgather, unarmedgather, herbalismgather, excavationgather, archerygather, swordsgather, axesgather, acrobaticsgather; private boolean dead; + private int recentlyhurt = 0; Player thisplayer; char defaultColor; @@ -415,6 +416,17 @@ class PlayerList { return player.getName().equals(playerName); } + public void decreaseLastHurt(){ + if(recentlyhurt >= 1){ + recentlyhurt--; + } + } + public Integer getRecentlyHurt(){ + return recentlyhurt; + } + public void setRecentlyHurt(Integer newvalue){ + recentlyhurt = newvalue; + } public void skillUpAxes(int newskill){ int x = 0; if(axes != null){ @@ -1172,6 +1184,11 @@ class PlayerList return 0; } } + public int getPowerLevel(){ + int x = 0; + x+=getMiningInt()+getRepairInt()+getWoodCuttingInt()+getUnarmedInt()+getHerbalismInt()+getExcavationInt()+getArcheryInt()+getSwordsInt()+getAxesInt()+getAcrobaticsInt(); + return x; + } public int getMiningGatherInt() { if(isInt(gather)){ return Integer.parseInt(gather); diff --git a/mcMMO/com/gmail/nossr50/mcm.java b/mcMMO/com/gmail/nossr50/mcm.java index 9311b728e..dca6ffbaa 100644 --- a/mcMMO/com/gmail/nossr50/mcm.java +++ b/mcMMO/com/gmail/nossr50/mcm.java @@ -102,6 +102,15 @@ public class mcm { } return true; } + public void arrowRetrievalCheck(Entity entity){ + if(mcConfig.getInstance().isTracked(entity)){ + Integer x = 0; + while(x < mcConfig.getInstance().getArrowCount(entity)){ + mcDropItem(entity.getLocation(), 262); + x++; + } + } + } public void archeryCheck(EntityDamageByProjectileEvent event){ Entity y = event.getDamager(); Entity x = event.getEntity(); @@ -110,16 +119,59 @@ public class mcm { */ if(y instanceof Player){ Player attacker = (Player)y; - /* - * DEBUG MESSAGE - */ - //attacker.sendMessage(event.getProjectile().toString()); if(event.getProjectile().toString().equals("CraftArrow") && mcPermissions.getInstance().archery(attacker)){ + if(!mcConfig.getInstance().isTracked(x) && event.getDamage() > 0){ + mcConfig.getInstance().addArrowTrack(x, 0); + if(mcUsers.getProfile(attacker).getArcheryInt() >= 50 && mcUsers.getProfile(attacker).getArcheryInt() < 200){ + if(Math.random() * 10 > 8){ + mcConfig.getInstance().addArrowCount(x, 1); + } + } else if(mcUsers.getProfile(attacker).getArcheryInt() >= 200 && mcUsers.getProfile(attacker).getArcheryInt() < 400){ + if(Math.random() * 10 > 6){ + mcConfig.getInstance().addArrowCount(x, 1); + } + } else if(mcUsers.getProfile(attacker).getArcheryInt() >= 400 && mcUsers.getProfile(attacker).getArcheryInt() < 600){ + if(Math.random() * 10 > 4){ + mcConfig.getInstance().addArrowCount(x, 1); + } + } else if(mcUsers.getProfile(attacker).getArcheryInt() >= 600 && mcUsers.getProfile(attacker).getArcheryInt() < 800){ + if(Math.random() * 10 > 2){ + mcConfig.getInstance().addArrowCount(x, 1); + } + } else if(mcUsers.getProfile(attacker).getArcheryInt() >= 800){ + mcConfig.getInstance().addArrowCount(x, 1); + } + } else { + if(event.getDamage() > 0){ + if(mcUsers.getProfile(attacker).getArcheryInt() >= 50 && mcUsers.getProfile(attacker).getArcheryInt() < 200){ + if(Math.random() * 10 > 8){ + mcConfig.getInstance().addArrowCount(x, 1); + } + } else if(mcUsers.getProfile(attacker).getArcheryInt() >= 200 && mcUsers.getProfile(attacker).getArcheryInt() < 400){ + if(Math.random() * 10 > 6){ + mcConfig.getInstance().addArrowCount(x, 1); + } + } else if(mcUsers.getProfile(attacker).getArcheryInt() >= 400 && mcUsers.getProfile(attacker).getArcheryInt() < 600){ + if(Math.random() * 10 > 4){ + mcConfig.getInstance().addArrowCount(x, 1); + } + } else if(mcUsers.getProfile(attacker).getArcheryInt() >= 600 && mcUsers.getProfile(attacker).getArcheryInt() < 800){ + if(Math.random() * 10 > 2){ + mcConfig.getInstance().addArrowCount(x, 1); + } + } else if(mcUsers.getProfile(attacker).getArcheryInt() >= 800){ + mcConfig.getInstance().addArrowCount(x, 1); + } + } + } /* * Defender is Monster */ if(x instanceof Monster){ Monster defender = (Monster)x; + /* + * TRACK ARROWS USED AGAINST THE ENTITY + */ if(mcUsers.getProfile(attacker).getArcheryInt() >= 50 && mcUsers.getProfile(attacker).getArcheryInt() < 250) defender.setHealth(mcm.getInstance().calculateDamage(defender, 1)); if(mcUsers.getProfile(attacker).getArcheryInt() >= 250 && mcUsers.getProfile(attacker).getArcheryInt() < 575) @@ -130,8 +182,9 @@ public class mcm { defender.setHealth(mcm.getInstance().calculateDamage(defender, 4)); if(mcUsers.getProfile(attacker).getArcheryInt() >= 1000) defender.setHealth(mcm.getInstance().calculateDamage(defender, 5)); - if(defender.getHealth() <= 0) - mcm.getInstance().simulateNaturalDrops(defender); + if(defender.getHealth() <= 0){ + simulateNaturalDrops(defender); + } //XP if(x instanceof Creeper) mcUsers.getProfile(attacker).addArcheryGather(10); @@ -394,8 +447,7 @@ public class mcm { mcDropItem(loc, 351); } } - - + arrowRetrievalCheck(entity); } public void mcDropItem(Location loc, int id){ if(loc != null){ @@ -696,6 +748,31 @@ public class mcm { } return false; } + public void bleedCheck(Player attacker, Entity x){ + if(mcm.getInstance().isSwords(attacker.getItemInHand()) && !mcConfig.getInstance().isBleedTracked(x)){ + if(mcUsers.getProfile(attacker).getSwordsInt() >= 50 && mcUsers.getProfile(attacker).getSwordsInt() < 200){ + if(Math.random() * 10 > 8){ + mcConfig.getInstance().addBleedTrack(x, 4); + attacker.sendMessage(ChatColor.RED+"**Your target is bleeding**"); + } + } else if(mcUsers.getProfile(attacker).getSwordsInt() >= 200 && mcUsers.getProfile(attacker).getSwordsInt() < 600){ + if(Math.random() * 10 > 6){ + mcConfig.getInstance().addBleedTrack(x, 4); + attacker.sendMessage(ChatColor.RED+"**Your target is bleeding**"); + } + } else if(mcUsers.getProfile(attacker).getSwordsInt() >= 600 && mcUsers.getProfile(attacker).getSwordsInt() < 900){ + if(Math.random() * 10 > 4){ + mcConfig.getInstance().addBleedTrack(x, 6); + attacker.sendMessage(ChatColor.RED+"**Your target is bleeding**"); + } + } else if(mcUsers.getProfile(attacker).getSwordsInt() >= 900){ + if(Math.random() * 100 > 75){ + mcConfig.getInstance().addBleedTrack(x, 6); + attacker.sendMessage(ChatColor.RED+"**Your target is bleeding**"); + } + } + } + } public void playerVersusPlayerChecks(Entity x, Player attacker, EntityDamageByEntityEvent event, Plugin plugin){ if(x instanceof Player){ if(mcLoadProperties.pvp == false){ @@ -709,10 +786,14 @@ public class mcm { return; } } + mcUsers.getProfile(defender).setRecentlyHurt(60); /* * AXE CRITICAL CHECK */ axeCriticalCheckPlayer(attacker, event, x, plugin); + if(!mcConfig.getInstance().isBleedTracked(x)){ + bleedCheck(attacker, x); + } if(mcPermissions.getInstance().unarmed(attacker) && attacker.getItemInHand().getTypeId() == 0){ //DMG MODIFIER if(mcUsers.getProfile(attacker).getUnarmedInt() >= 50 && mcUsers.getProfile(attacker).getUnarmedInt() < 100){ @@ -793,6 +874,9 @@ public class mcm { } public void playerVersusSquidChecks(EntityDamageByEntityEvent event, Player attacker, Entity x, int type){ if(x instanceof Squid){ + if(!mcConfig.getInstance().isBleedTracked(x)){ + bleedCheck(attacker, x); + } Squid defender = (Squid)event.getEntity(); if(isSwords(attacker.getItemInHand()) && defender.getHealth() > 0 && mcPermissions.getInstance().swords(attacker)){ mcUsers.getProfile(attacker).addSwordsGather(10); @@ -872,6 +956,9 @@ public class mcm { } public void playerVersusAnimalsChecks(Entity x, Player attacker, EntityDamageByEntityEvent event, int type){ if(x instanceof Animals){ + if(!mcConfig.getInstance().isBleedTracked(x)){ + bleedCheck(attacker, x); + } Animals defender = (Animals)event.getEntity(); if(isAxes(attacker.getItemInHand()) && mcPermissions.getInstance().axes(attacker)){ if(defender.getHealth() <= 0) @@ -908,45 +995,15 @@ public class mcm { } } } - public void playerDeathByMonsterMessageCheck(Entity y, Player defender, Plugin plugin){ - if(y instanceof Monster){ - if(mcUsers.getProfile(defender).isDead()) - return; - if(defender.getHealth() <= 0){ - mcm.getInstance().simulateNaturalDrops(defender); - if(y instanceof Creeper){ - mcUsers.getProfile(defender).setDead(true); - for(Player derp : plugin.getServer().getOnlinePlayers()){ - derp.sendMessage(ChatColor.GRAY + "A "+ChatColor.DARK_GREEN+"Creeper"+ChatColor.GRAY+" has killed "+ChatColor.DARK_RED+defender.getName()); - } - } - if(y instanceof Skeleton){ - mcUsers.getProfile(defender).setDead(true); - for(Player derp : plugin.getServer().getOnlinePlayers()){ - derp.sendMessage(ChatColor.GRAY + "A "+ChatColor.WHITE+"Skeleton"+ChatColor.GRAY+" has killed "+ChatColor.DARK_RED+defender.getName()); - } - } - if(y instanceof Spider){ - mcUsers.getProfile(defender).setDead(true); - for(Player derp : plugin.getServer().getOnlinePlayers()){ - derp.sendMessage(ChatColor.GRAY + "A "+ChatColor.DARK_PURPLE+"Spider"+ChatColor.GRAY+" has killed "+ChatColor.DARK_RED+defender.getName()); - } - } - if(y instanceof Zombie){ - mcUsers.getProfile(defender).setDead(true); - for(Player derp : plugin.getServer().getOnlinePlayers()){ - derp.sendMessage(ChatColor.GRAY + "A "+ChatColor.DARK_AQUA+"Zombie"+ChatColor.GRAY+" has killed "+ChatColor.DARK_RED+defender.getName()); - } - } - } - } - } public void playerVersusMonsterChecks(EntityDamageByEntityEvent event, Player attacker, Entity x, int type){ if(x instanceof Monster){ /* * AXE PROC CHECKS */ axeCriticalCheckMonster(attacker, event, x); + if(!mcConfig.getInstance().isBleedTracked(x)){ + bleedCheck(attacker, x); + } Monster defender = (Monster)event.getEntity(); if(isSwords(attacker.getItemInHand()) && defender.getHealth() > 0 @@ -1004,8 +1061,9 @@ public class mcm { if(mcUsers.getProfile(attacker).getAxesInt() >= 500){ defender.setHealth(calculateDamage(defender, (4 - axeNerf(attacker.getItemInHand().getTypeId())))); } - if(defender.getHealth() <= 0) - mcm.getInstance().simulateNaturalDrops(defender); + if(defender.getHealth() <= 0 || defender.getHealth() - event.getDamage() <= 0){ + simulateNaturalDrops(defender); + } } if(type == 0 && mcPermissions.getInstance().unarmed(attacker)){ if(defender.getHealth() <= 0) @@ -1047,8 +1105,9 @@ public class mcm { } attacker.sendMessage(ChatColor.YELLOW+"Unarmed skill increased by "+skillups+"."+" Total ("+mcUsers.getProfile(attacker).getUnarmed()+")"); } - if(defender.getHealth() <= 0) - mcm.getInstance().simulateNaturalDrops(defender); + if(defender.getHealth() <= 0 || defender.getHealth() - event.getDamage() <= 0){ + simulateNaturalDrops(defender); + } } } } @@ -1108,7 +1167,7 @@ public class mcm { Animals animal = (Animals)x; animal.setHealth(0); simulateNaturalDrops(x); - attacker.sendMessage(ChatColor.RED+"CRTICIAL HIT!"); + attacker.sendMessage(ChatColor.RED+"CRITICAL HIT!"); } } } @@ -1118,7 +1177,7 @@ public class mcm { Animals animal = (Animals)x; animal.setHealth(0); simulateNaturalDrops(x); - attacker.sendMessage(ChatColor.RED+"CRTICIAL HIT!"); + attacker.sendMessage(ChatColor.RED+"CRITICAL HIT!"); } } } @@ -1128,7 +1187,7 @@ public class mcm { Animals animal = (Animals)x; animal.setHealth(0); simulateNaturalDrops(x); - attacker.sendMessage(ChatColor.RED+"CRTICIAL HIT!"); + attacker.sendMessage(ChatColor.RED+"CRITICAL HIT!"); } } } @@ -1138,7 +1197,7 @@ public class mcm { Animals animal = (Animals)x; animal.setHealth(0); simulateNaturalDrops(x); - attacker.sendMessage(ChatColor.RED+"CRTICIAL HIT!"); + attacker.sendMessage(ChatColor.RED+"CRITICAL HIT!"); } } } @@ -1148,7 +1207,7 @@ public class mcm { Animals animal = (Animals)x; animal.setHealth(0); simulateNaturalDrops(x); - attacker.sendMessage(ChatColor.RED+"CRTICIAL HIT!"); + attacker.sendMessage(ChatColor.RED+"CRITICAL HIT!"); } } } @@ -1162,7 +1221,7 @@ public class mcm { Monster monster = (Monster)x; monster.setHealth(0); simulateNaturalDrops(x); - attacker.sendMessage(ChatColor.RED+"CRTICIAL HIT!"); + attacker.sendMessage(ChatColor.RED+"CRITICAL HIT!"); } } } @@ -1172,7 +1231,7 @@ public class mcm { Monster monster = (Monster)x; monster.setHealth(0); simulateNaturalDrops(x); - attacker.sendMessage(ChatColor.RED+"CRTICIAL HIT!"); + attacker.sendMessage(ChatColor.RED+"CRITICAL HIT!"); } } } @@ -1182,7 +1241,7 @@ public class mcm { Monster monster = (Monster)x; monster.setHealth(0); simulateNaturalDrops(x); - attacker.sendMessage(ChatColor.RED+"CRTICIAL HIT!"); + attacker.sendMessage(ChatColor.RED+"CRITICAL HIT!"); } } } @@ -1192,7 +1251,7 @@ public class mcm { Monster monster = (Monster)x; monster.setHealth(0); simulateNaturalDrops(x); - attacker.sendMessage(ChatColor.RED+"CRTICIAL HIT!"); + attacker.sendMessage(ChatColor.RED+"CRITICAL HIT!"); } } } @@ -1202,7 +1261,7 @@ public class mcm { Monster monster = (Monster)x; monster.setHealth(0); simulateNaturalDrops(x); - attacker.sendMessage(ChatColor.RED+"CRTICIAL HIT!"); + attacker.sendMessage(ChatColor.RED+"CRITICAL HIT!"); } } } @@ -1215,7 +1274,7 @@ public class mcm { if(x instanceof Player){ Player player = (Player)x; player.setHealth(calculateDamage(player, (player.getHealth() - event.getDamage()))); - attacker.sendMessage(ChatColor.RED+"CRTICIAL HIT!"); + attacker.sendMessage(ChatColor.RED+"CRITICAL HIT!"); player.sendMessage(ChatColor.DARK_RED + "You were CRITICALLY hit!"); } } @@ -1225,7 +1284,7 @@ public class mcm { if(x instanceof Player){ Player player = (Player)x; player.setHealth(calculateDamage(player, (player.getHealth() - event.getDamage()))); - attacker.sendMessage(ChatColor.RED+"CRTICIAL HIT!"); + attacker.sendMessage(ChatColor.RED+"CRITICAL HIT!"); player.sendMessage(ChatColor.DARK_RED + "You were CRITICALLY hit!"); } } @@ -1235,7 +1294,7 @@ public class mcm { if(x instanceof Player){ Player player = (Player)x; player.setHealth(calculateDamage(player, (player.getHealth() - event.getDamage()))); - attacker.sendMessage(ChatColor.RED+"CRTICIAL HIT!"); + attacker.sendMessage(ChatColor.RED+"CRITICAL HIT!"); player.sendMessage(ChatColor.DARK_RED + "You were CRITICALLY hit!"); } } @@ -1245,7 +1304,7 @@ public class mcm { if(x instanceof Player){ Player player = (Player)x; player.setHealth(calculateDamage(player, (player.getHealth() - event.getDamage()))); - attacker.sendMessage(ChatColor.RED+"CRTICIAL HIT!"); + attacker.sendMessage(ChatColor.RED+"CRITICAL HIT!"); player.sendMessage(ChatColor.DARK_RED + "You were CRITICALLY hit!"); } } @@ -1255,7 +1314,7 @@ public class mcm { if(x instanceof Player){ Player player = (Player)x; player.setHealth(calculateDamage(player, (player.getHealth() - event.getDamage()))); - attacker.sendMessage(ChatColor.RED+"CRTICIAL HIT!"); + attacker.sendMessage(ChatColor.RED+"CRITICAL HIT!"); player.sendMessage(ChatColor.DARK_RED + "You were CRITICALLY hit!"); } } @@ -1334,90 +1393,81 @@ public class mcm { public void mcmmoHelpCheck(String[] split, Player player, PlayerChatEvent event){ if(split[0].equalsIgnoreCase("/woodcutting")){ event.setCancelled(true); - player.sendMessage(ChatColor.GREEN+"~~WOODCUTTING INFO~~"); - player.sendMessage(ChatColor.GREEN+"Gaining Skill: "+ChatColor.DARK_GRAY+"Chop down trees."); - player.sendMessage(ChatColor.GREEN+"~~EFFECTS~~"); - player.sendMessage(ChatColor.GRAY+"Double Drops start to happen at 10 woodcutting skill"); - player.sendMessage(ChatColor.GRAY+"and it gets more frequent from there."); + 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+"Double Drops: "+ChatColor.GREEN+"Double the normal loot"); } if(split[0].equalsIgnoreCase("/archery")){ event.setCancelled(true); - player.sendMessage(ChatColor.GREEN+"~~ARCHERY INFO~~"); - player.sendMessage(ChatColor.GREEN+"Gaining Skill: "+ChatColor.DARK_GRAY+"Shooting monsters."); - player.sendMessage(ChatColor.GREEN+"~~EFFECTS~~"); - player.sendMessage(ChatColor.GRAY+"Damage scales with Archery skill"); - player.sendMessage(ChatColor.GRAY+"Chance to daze player opponents with high skill lvl"); + 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+"Daze (Monsters): "+ChatColor.GREEN+"Enemies lose interest for 1 second"); + player.sendMessage(ChatColor.DARK_AQUA+"Daze (Players): "+ChatColor.GREEN+"Disorients foes"); + player.sendMessage(ChatColor.DARK_AQUA+"Damage+: "+ChatColor.GREEN+"Modifies Damage"); } if(split[0].equalsIgnoreCase("/axes")){ event.setCancelled(true); - player.sendMessage(ChatColor.GREEN+"~~AXES INFO~~"); - player.sendMessage(ChatColor.GREEN+"Gaining Skill: "+ChatColor.DARK_GRAY+"Hacking up Monsters."); - player.sendMessage(ChatColor.GREEN+"~~EFFECTS~~"); - player.sendMessage(ChatColor.GRAY+"Damage with Axes changes after 500 skill"); - player.sendMessage(ChatColor.GRAY+"Chance to do critical hits scales with skill"); + 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+"Critical Strikes (Monster): "+ChatColor.GREEN+"Instant kill"); + player.sendMessage(ChatColor.DARK_AQUA+"Critical Strikes (Players): "+ChatColor.GREEN+"Double Damage"); + player.sendMessage(ChatColor.DARK_AQUA+"Axe Mastery (500 SKILL): "+ChatColor.GREEN+"Modifies Damage"); } if(split[0].equalsIgnoreCase("/swords")){ event.setCancelled(true); - player.sendMessage(ChatColor.GREEN+"~~SWORDS INFO~~"); - player.sendMessage(ChatColor.GREEN+"Gaining Skill: "+ChatColor.DARK_GRAY+"Slicing up monsters"); - player.sendMessage(ChatColor.GREEN+"~~EFFECTS~~"); - player.sendMessage(ChatColor.GRAY+"Parrying. It negates damage."); - player.sendMessage(ChatColor.GRAY+"Chance to parry scales with skill."); + 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+"Parrying: "+ChatColor.GREEN+"Negates Damage"); + player.sendMessage(ChatColor.DARK_AQUA+"Bleed: "+ChatColor.GREEN+"Apply a 2 second bleed DoT to enemies"); } if(split[0].equalsIgnoreCase("/acrobatics")){ event.setCancelled(true); - player.sendMessage(ChatColor.GREEN+"~~ACROBATICS INFO~~"); - player.sendMessage(ChatColor.GREEN+"Gaining Skill: "+ChatColor.DARK_GRAY+"Spraining ankles."); - player.sendMessage(ChatColor.GREEN+"~~EFFECTS~~"); - player.sendMessage(ChatColor.GRAY+"Rolling. Negates fall damage."); - player.sendMessage(ChatColor.GRAY+"Chance to roll scales with skill."); + 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+"Negates Damage"); } if(split[0].equalsIgnoreCase("/mining")){ event.setCancelled(true); - player.sendMessage(ChatColor.GREEN+"~~MINING INFO~~"); - player.sendMessage(ChatColor.GREEN+"Gaining Skill: "+ChatColor.DARK_GRAY+"Mining ore and stone,"); - player.sendMessage(ChatColor.DARK_GRAY+"the xp rate depends entirely upon the rarity of what you're harvesting."); - player.sendMessage(ChatColor.GREEN+"~~EFFECTS~~"); - player.sendMessage(ChatColor.GRAY+"Double Drops start to happen at 25 Mining skill,"); - player.sendMessage(ChatColor.GRAY+"and the chance for it increases with skill."); + 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+"Double Drops: "+ChatColor.GREEN+"Double the normal loot"); } if(split[0].equalsIgnoreCase("/repair")){ event.setCancelled(true); - player.sendMessage(ChatColor.GREEN+"~~REPAIR INFO~~"); - player.sendMessage(ChatColor.GREEN+"Gaining Skill: "+ChatColor.DARK_GRAY+"Repairing tools and armor."); - player.sendMessage(ChatColor.GREEN+"~~EFFECTS~~"); - player.sendMessage(ChatColor.GRAY+"High skill levels make a proc to fully repair items happen more often."); - player.sendMessage(ChatColor.GREEN+"~~USE~~"); - player.sendMessage(ChatColor.GRAY+"Approach an Anvil (Iron Block) with the item you wish "); - player.sendMessage(ChatColor.GRAY+"to repair in hand, right click to consume resources of the"); - player.sendMessage(ChatColor.GRAY+"same type to repair it. This does not work for stone/wood/gold"); + 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+"Diamond Repair (50+ SKILL): "+ChatColor.GREEN+"Repair Diamond Tools & Armor"); } if(split[0].equalsIgnoreCase("/unarmed")){ event.setCancelled(true); - player.sendMessage(ChatColor.GREEN+"~~UNARMED INFO~~"); - player.sendMessage(ChatColor.GREEN+"Gaining Skill: "+ChatColor.DARK_GRAY+"Punching monsters and players."); - player.sendMessage(ChatColor.GREEN+"~~EFFECTS~~"); - player.sendMessage(ChatColor.GRAY+"Damage scales with unarmed skill. The first damage increase"); - player.sendMessage(ChatColor.DARK_GRAY+"happens at 50 skill. At very high skill levels, you will"); - player.sendMessage(ChatColor.DARK_GRAY+"gain a proc to disarm player opponents on hit"); + 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+"Disarm (Players): "+ChatColor.GREEN+"Drops the foes item held in hand"); + player.sendMessage(ChatColor.DARK_AQUA+"Damage+: "+ChatColor.GREEN+"Modifies Damage"); } if(split[0].equalsIgnoreCase("/herbalism")){ event.setCancelled(true); - player.sendMessage(ChatColor.GREEN+"~~HERBALISM INFO~~"); - player.sendMessage(ChatColor.GREEN+"Gaining Skill: "+ChatColor.DARK_GRAY+"Farming and picking herbs."); - player.sendMessage(ChatColor.GREEN+"~~EFFECTS~~"); - player.sendMessage(ChatColor.GRAY+"Increases healing effects of bread and stew."); - player.sendMessage(ChatColor.GRAY+"Allows for chance to receive double drops based on skill"); + 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+"Food+: "+ChatColor.GREEN+"Modifies health received from bread/stew"); + player.sendMessage(ChatColor.DARK_AQUA+"Double Drops (Wheat): "+ChatColor.GREEN+"Double the normal loot"); } if(split[0].equalsIgnoreCase("/excavation")){ event.setCancelled(true); - player.sendMessage(ChatColor.GREEN+"~~EXCAVATION INFO~~"); - player.sendMessage(ChatColor.GREEN+"Gaining Skill: "+ChatColor.DARK_GRAY+"Digging."); - player.sendMessage(ChatColor.GREEN+"~~EFFECTS~~"); - player.sendMessage(ChatColor.GRAY+"You will find treasures while digging based on your excavation,"); - player.sendMessage(ChatColor.GRAY+"and at high levels the rewards are quite nice. The items you get"); - player.sendMessage(ChatColor.GRAY+"depend on the block you're digging."); - player.sendMessage(ChatColor.GRAY+"Different blocks give diffrent stuff."); + player.sendMessage(ChatColor.RED+"-----[]"+ChatColor.GREEN+"ARCHERY"+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+"Treasure Hunter: "+ChatColor.GREEN+"Ability to dig for treasure"); } if(split[0].equalsIgnoreCase("/"+mcLoadProperties.mcmmo)){ event.setCancelled(true); @@ -1481,25 +1531,20 @@ public class mcm { if(block != null && block.getTypeId() == 42 && mcPermissions.getInstance().repair(player)){ - player.sendMessage("DEBUG CODE 0"); short durability = is.getDurability(); if(player.getItemInHand().getDurability() > 0){ - //player.sendMessage("DEBUG CODE 1"); /* * ARMOR */ if(mcm.getInstance().isArmor(is) && block.getTypeId() == 42){ - //player.sendMessage("DEBUG CODE 2"); /* * DIAMOND ARMOR */ if(mcm.getInstance().isDiamondArmor(is) && mcm.getInstance().hasDiamond(player) && mcUsers.getProfile(player).getRepairInt() >= 50){ - //player.sendMessage("DEBUG CODE 3"); mcm.getInstance().removeDiamond(player); player.getItemInHand().setDurability(mcm.getInstance().getArmorRepairAmount(is, player)); mcUsers.getProfile(player).addRepairGather(50); } else if (mcm.getInstance().isIronArmor(is) && mcm.getInstance().hasIron(player)){ - //player.sendMessage("DEBUG CODE 3"); /* * IRON ARMOR */ @@ -1517,17 +1562,14 @@ public class mcm { * TOOLS */ if(mcm.getInstance().isTools(is) && block.getTypeId() == 42){ - //player.sendMessage("DEBUG CODE 4"); /* * IRON TOOLS */ if(mcm.getInstance().isIronTools(is) && mcm.getInstance().hasIron(player)){ - //player.sendMessage("DEBUG CODE 5"); is.setDurability(mcm.getInstance().getToolRepairAmount(is, durability, player)); mcm.getInstance().removeIron(player); mcUsers.getProfile(player).addRepairGather(20); } else if (mcm.getInstance().isDiamondTools(is) && mcm.getInstance().hasDiamond(player) && mcUsers.getProfile(player).getRepairInt() >= 50){ //Check if its diamond and the player has diamonds - //player.sendMessage("DEBUG CODE 5"); /* * DIAMOND TOOLS */ diff --git a/mcMMO/plugin.yml b/mcMMO/plugin.yml index 639f78289..654d67224 100644 --- a/mcMMO/plugin.yml +++ b/mcMMO/plugin.yml @@ -1,3 +1,3 @@ name: mcMMO main: com.gmail.nossr50.mcMMO -version: 0.7.10 \ No newline at end of file +version: 0.8 \ No newline at end of file