diff --git a/mcMMO/Changelog.txt b/mcMMO/Changelog.txt index fd7cee3b8..eff603633 100644 --- a/mcMMO/Changelog.txt +++ b/mcMMO/Changelog.txt @@ -1,5 +1,24 @@ Changelog: #Versions without changelogs probably had very small misc fixes, like tweaks to the source code# +Version 0.5.11 + + Added /mmoedit command + Fixed bug preventing player versus player damage + Fixed bug preventing damage from scaling with unarmed & bows + Fixed disarm proc making the opponent dupe his/her items + Added mcmmo.tools.mmoedit permission + Added mcmmo.commands.setmyspawn permission + Added totalskill to /stats + Changed the look of /stats + +Version 0.5.10 + + Fixed trying to set health to an invalid value + +Version 0.5.9 + + Fixed duping inventories on death + Version 0.5.8 Fixed bug where players inventories would dupe during combat diff --git a/mcMMO/com/bukkit/nossr50/mcMMO/mcEntityListener.java b/mcMMO/com/bukkit/nossr50/mcMMO/mcEntityListener.java index 010a7b543..f844e535f 100644 --- a/mcMMO/com/bukkit/nossr50/mcMMO/mcEntityListener.java +++ b/mcMMO/com/bukkit/nossr50/mcMMO/mcEntityListener.java @@ -37,12 +37,14 @@ public class mcEntityListener extends EntityListener { if(block != null && block.getTypeId() == 81){ if(mcUsers.getProfile(player).isDead()) return; + /* if(player.getHealth() - event.getDamage() <= 0){ mcUsers.getProfile(player).setDead(true); for(Player bidoof : plugin.getServer().getOnlinePlayers()){ bidoof.sendMessage(ChatColor.GRAY+player.getName()+" has been"+ChatColor.DARK_GREEN+" cactus tickled "+ChatColor.GRAY+"to death."); } } + */ } } } @@ -66,6 +68,7 @@ public class mcEntityListener extends EntityListener { * CHECKS IF THE PLAYER DIES, IF SO DROP HIS SHIT BECAUSE OF THE DAMAGE MODIFIERS * MIGHT BE A BIT BUGGY, IT SEEMS TO WORK RIGHT NOW AT LEAST... */ + } /* * IF ATTACKER IS PLAYER @@ -112,16 +115,16 @@ public class mcEntityListener extends EntityListener { */ if(x instanceof Monster){ Monster defender = (Monster)x; - if(mcUsers.getProfile(attacker).getArcheryInt() >= 50 && mcUsers.getProfile(attacker).getArcheryInt() < 150) - defender.setHealth(defender.getHealth() - 1); - if(mcUsers.getProfile(attacker).getArcheryInt() >= 150 && mcUsers.getProfile(attacker).getArcheryInt() < 375) - defender.setHealth(defender.getHealth() - 2); - if(mcUsers.getProfile(attacker).getArcheryInt() >= 375 && mcUsers.getProfile(attacker).getArcheryInt() < 525) - defender.setHealth(defender.getHealth() - 3); - if(mcUsers.getProfile(attacker).getArcheryInt() >= 525 && mcUsers.getProfile(attacker).getArcheryInt() < 800) - defender.setHealth(defender.getHealth() - 4); - if(mcUsers.getProfile(attacker).getArcheryInt() >= 800 && mcUsers.getProfile(attacker).getArcheryInt() < 1000) - defender.setHealth(defender.getHealth() - 6); + 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) + defender.setHealth(mcm.getInstance().calculateDamage(defender, 2)); + if(mcUsers.getProfile(attacker).getArcheryInt() >= 575 && mcUsers.getProfile(attacker).getArcheryInt() < 725) + defender.setHealth(mcm.getInstance().calculateDamage(defender, 3)); + if(mcUsers.getProfile(attacker).getArcheryInt() >= 725 && mcUsers.getProfile(attacker).getArcheryInt() < 1000) + 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); //XP @@ -135,16 +138,16 @@ public class mcEntityListener extends EntityListener { */ if(x instanceof Animals){ Animals defender = (Animals)x; - if(mcUsers.getProfile(attacker).getArcheryInt() >= 50 && mcUsers.getProfile(attacker).getArcheryInt() < 150) - defender.setHealth(defender.getHealth() - 1); - if(mcUsers.getProfile(attacker).getArcheryInt() >= 150 && mcUsers.getProfile(attacker).getArcheryInt() < 375) - defender.setHealth(defender.getHealth() - 2); - if(mcUsers.getProfile(attacker).getArcheryInt() >= 375 && mcUsers.getProfile(attacker).getArcheryInt() < 525) - defender.setHealth(defender.getHealth() - 3); - if(mcUsers.getProfile(attacker).getArcheryInt() >= 525 && mcUsers.getProfile(attacker).getArcheryInt() < 800) - defender.setHealth(defender.getHealth() - 4); - if(mcUsers.getProfile(attacker).getArcheryInt() >= 800 && mcUsers.getProfile(attacker).getArcheryInt() < 1000) - defender.setHealth(defender.getHealth() - 6); + 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) + defender.setHealth(mcm.getInstance().calculateDamage(defender, 2)); + if(mcUsers.getProfile(attacker).getArcheryInt() >= 575 && mcUsers.getProfile(attacker).getArcheryInt() < 725) + defender.setHealth(mcm.getInstance().calculateDamage(defender, 3)); + if(mcUsers.getProfile(attacker).getArcheryInt() >= 725 && mcUsers.getProfile(attacker).getArcheryInt() < 1000) + 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); } @@ -153,16 +156,16 @@ public class mcEntityListener extends EntityListener { */ if(x instanceof Squid){ Squid defender = (Squid)x; - if(mcUsers.getProfile(attacker).getArcheryInt() >= 50 && mcUsers.getProfile(attacker).getArcheryInt() < 150) - defender.setHealth(defender.getHealth() - 1); - if(mcUsers.getProfile(attacker).getArcheryInt() >= 150 && mcUsers.getProfile(attacker).getArcheryInt() < 375) - defender.setHealth(defender.getHealth() - 2); - if(mcUsers.getProfile(attacker).getArcheryInt() >= 375 && mcUsers.getProfile(attacker).getArcheryInt() < 525) - defender.setHealth(defender.getHealth() - 3); - if(mcUsers.getProfile(attacker).getArcheryInt() >= 525 && mcUsers.getProfile(attacker).getArcheryInt() < 800) - defender.setHealth(defender.getHealth() - 4); - if(mcUsers.getProfile(attacker).getArcheryInt() >= 800 && mcUsers.getProfile(attacker).getArcheryInt() < 1000) - defender.setHealth(defender.getHealth() - 6); + 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) + defender.setHealth(mcm.getInstance().calculateDamage(defender, 2)); + if(mcUsers.getProfile(attacker).getArcheryInt() >= 575 && mcUsers.getProfile(attacker).getArcheryInt() < 725) + defender.setHealth(mcm.getInstance().calculateDamage(defender, 3)); + if(mcUsers.getProfile(attacker).getArcheryInt() >= 725 && mcUsers.getProfile(attacker).getArcheryInt() < 1000) + 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); } @@ -171,36 +174,42 @@ public class mcEntityListener extends EntityListener { */ if(x instanceof Player){ Player defender = (Player)x; + /* + * Stuff for the daze proc + */ Location loc = defender.getLocation(); if(Math.random() * 10 > 5){ loc.setPitch(90); } else { loc.setPitch(-90); } - if(mcUsers.getProfile(attacker).getArcheryInt() >= 200 && mcUsers.getProfile(attacker).getArcheryInt() < 400){ + /* + * Check the proc + */ + if(mcUsers.getProfile(attacker).getArcheryInt() >= 300 && mcUsers.getProfile(attacker).getArcheryInt() < 400){ if(Math.random() * 10 > 7){ defender.teleportTo(loc); defender.sendMessage(ChatColor.DARK_RED+"Touched Fuzzy. Felt Dizzy."); attacker.sendMessage("Target was "+ChatColor.DARK_RED+"Dazed"); } } - if(mcUsers.getProfile(attacker).getArcheryInt() >= 400){ + if(mcUsers.getProfile(attacker).getArcheryInt() >= 600){ if(Math.random() * 10 > 4){ defender.teleportTo(loc); defender.sendMessage(ChatColor.DARK_RED+"Touched Fuzzy. Felt Dizzy."); attacker.sendMessage("Target was "+ChatColor.DARK_RED+"Dazed"); } } - if(mcUsers.getProfile(attacker).getArcheryInt() >= 50 && mcUsers.getProfile(attacker).getArcheryInt() < 150) - defender.setHealth(defender.getHealth() - 1); - if(mcUsers.getProfile(attacker).getArcheryInt() >= 150 && mcUsers.getProfile(attacker).getArcheryInt() < 375) - defender.setHealth(defender.getHealth() - 2); - if(mcUsers.getProfile(attacker).getArcheryInt() >= 375 && mcUsers.getProfile(attacker).getArcheryInt() < 525) - defender.setHealth(defender.getHealth() - 3); - if(mcUsers.getProfile(attacker).getArcheryInt() >= 525 && mcUsers.getProfile(attacker).getArcheryInt() < 800) - defender.setHealth(defender.getHealth() - 4); - if(mcUsers.getProfile(attacker).getArcheryInt() >= 800 && mcUsers.getProfile(attacker).getArcheryInt() < 1000) - defender.setHealth(defender.getHealth() - 6); + 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) + defender.setHealth(mcm.getInstance().calculateDamage(defender, 2)); + if(mcUsers.getProfile(attacker).getArcheryInt() >= 575 && mcUsers.getProfile(attacker).getArcheryInt() < 725) + defender.setHealth(mcm.getInstance().calculateDamage(defender, 3)); + if(mcUsers.getProfile(attacker).getArcheryInt() >= 725 && mcUsers.getProfile(attacker).getArcheryInt() < 1000) + defender.setHealth(mcm.getInstance().calculateDamage(defender, 4)); + if(mcUsers.getProfile(attacker).getArcheryInt() >= 1000) + defender.setHealth(mcm.getInstance().calculateDamage(defender, 5)); if(defender.getHealth() >= 0){ if(mcUsers.getProfile(defender).isDead()) return; @@ -216,7 +225,7 @@ public class mcEntityListener extends EntityListener { return; if(defender.getHealth() - event.getDamage() <= 0){ for(Player derp : plugin.getServer().getOnlinePlayers()){ - derp.sendMessage(ChatColor.GRAY+attacker.getName() + " has " +ChatColor.DARK_RED+"slain "+ChatColor.GRAY+defender.getName() + " with an arrow."); + derp.sendMessage(ChatColor.GRAY+attacker.getName() + " has " +ChatColor.DARK_RED+"slain "+ChatColor.GRAY+defender.getName() + " with the bow and arrow."); mcUsers.getProfile(defender).setDead(true); } } @@ -234,35 +243,35 @@ public class mcEntityListener extends EntityListener { int y = loc.getBlockY(); int z = loc.getBlockZ(); if(type == DamageCause.FALL){ - if(mcUsers.getProfile(player).getAcrobaticsInt() >= 50 && mcUsers.getProfile(player).getAcrobaticsInt() < 150 ){ + if(mcUsers.getProfile(player).getAcrobaticsInt() >= 50 && mcUsers.getProfile(player).getAcrobaticsInt() < 250 ){ if(Math.random() * 10 > 8){ event.setCancelled(true); player.sendMessage("**ROLLED**"); return; } } - if(mcUsers.getProfile(player).getAcrobaticsInt() >= 150 && mcUsers.getProfile(player).getAcrobaticsInt() < 250 ){ + if(mcUsers.getProfile(player).getAcrobaticsInt() >= 250 && mcUsers.getProfile(player).getAcrobaticsInt() < 450 ){ if(Math.random() * 10 > 6){ event.setCancelled(true); player.sendMessage("**ROLLED**"); return; } } - if(mcUsers.getProfile(player).getAcrobaticsInt() >= 250 && mcUsers.getProfile(player).getAcrobaticsInt() < 350 ){ + if(mcUsers.getProfile(player).getAcrobaticsInt() >= 450 && mcUsers.getProfile(player).getAcrobaticsInt() < 750 ){ if(Math.random() * 10 > 4){ event.setCancelled(true); player.sendMessage("**ROLLED**"); return; } } - if(mcUsers.getProfile(player).getAcrobaticsInt() >= 350 && mcUsers.getProfile(player).getAcrobaticsInt() < 450 ){ + if(mcUsers.getProfile(player).getAcrobaticsInt() >= 750 && mcUsers.getProfile(player).getAcrobaticsInt() < 950 ){ if(Math.random() * 10 > 2){ event.setCancelled(true); player.sendMessage("**BARREL ROLLED**"); return; } } - if(mcUsers.getProfile(player).getAcrobaticsInt() >= 450){ + if(mcUsers.getProfile(player).getAcrobaticsInt() >= 950){ event.setCancelled(true); player.sendMessage("**ROLLED... LIKE A BOSS**"); return; @@ -303,6 +312,7 @@ public class mcEntityListener extends EntityListener { } } } + /* if(type == DamageCause.FIRE || type == DamageCause.FIRE_TICK){ if(mcUsers.getProfile(player).isDead()) return; @@ -313,6 +323,7 @@ public class mcEntityListener extends EntityListener { } } } + */ if(type == DamageCause.LAVA){ if(mcUsers.getProfile(player).isDead()) return; @@ -329,10 +340,6 @@ public class mcEntityListener extends EntityListener { Entity x = event.getEntity(); if(x instanceof Player){ Player player = (Player)x; - for(ItemStack i : player.getInventory().getContents()){ - if(i != null && i.getTypeId() != 0) - player.getLocation().getWorld().dropItemNaturally(player.getLocation(), i); - } if(mcUsers.getProfile(player).isDead()){ mcUsers.getProfile(player).setDead(false); return; diff --git a/mcMMO/com/bukkit/nossr50/mcMMO/mcPermissions.java b/mcMMO/com/bukkit/nossr50/mcMMO/mcPermissions.java index abcb86f6c..2f85da3f7 100644 --- a/mcMMO/com/bukkit/nossr50/mcMMO/mcPermissions.java +++ b/mcMMO/com/bukkit/nossr50/mcMMO/mcPermissions.java @@ -29,6 +29,13 @@ public class mcPermissions { private boolean permission(Player player, String string) { return permissionsPlugin.Security.permission(player, string); } + public boolean mmoedit(Player player) { + if (permissionsEnabled) { + return permission(player, "mcmmo.tools.mmoedit"); + } else { + return true; + } + } public boolean motd(Player player) { if (permissionsEnabled) { return permission(player, "mcmmo.motd"); @@ -43,6 +50,13 @@ public class mcPermissions { return true; } } + public boolean setMySpawn(Player player) { + if (permissionsEnabled) { + return permission(player, "mcmmo.commands.setmyspawn"); + } else { + return true; + } + } public boolean partyChat(Player player) { if (permissionsEnabled) { return permission(player, "mcmmo.chat.partychat"); diff --git a/mcMMO/com/bukkit/nossr50/mcMMO/mcPlayerListener.java b/mcMMO/com/bukkit/nossr50/mcMMO/mcPlayerListener.java index e40baa160..b1c48b9a8 100644 --- a/mcMMO/com/bukkit/nossr50/mcMMO/mcPlayerListener.java +++ b/mcMMO/com/bukkit/nossr50/mcMMO/mcPlayerListener.java @@ -104,6 +104,28 @@ public class mcPlayerListener extends PlayerListener { String playerName = player.getName(); //Check if the command is an mcMMO related help command mcm.getInstance().mcmmoHelpCheck(split, player, event); + if(mcPermissions.getInstance().mmoedit(player) && split[0].equalsIgnoreCase("/mmoedit")){ + if(split.length < 3){ + player.sendMessage(ChatColor.RED+"Usage is /mmoedit playername skillname newvalue"); + return; + } + if(split.length == 4){ + if(isPlayer(split[1]) && mcm.getInstance().isInt(split[3]) && mcm.getInstance().isSkill(split[2])){ + int newvalue = Integer.valueOf(split[3]); + mcUsers.getProfile(getPlayer(split[1])).modifyskill(newvalue, split[2]); + player.sendMessage(ChatColor.RED+split[2]+" has been modified."); + } + } + else if(split.length == 3){ + if(mcm.getInstance().isInt(split[2]) && mcm.getInstance().isSkill(split[1])){ + int newvalue = Integer.valueOf(split[2]); + mcUsers.getProfile(player).modifyskill(newvalue, split[1]); + player.sendMessage(ChatColor.RED+split[1]+" has been modified."); + } + } else { + player.sendMessage(ChatColor.RED+"Usage is /mmoedit playername skillname newvalue"); + } + } if(mcUsers.getProfile(player).inParty() && split[0].equalsIgnoreCase("/ptp")){ event.setCancelled(true); if(!mcPermissions.getInstance().partyTeleport(player)){ @@ -160,7 +182,7 @@ public class mcPlayerListener extends PlayerListener { } } if(split[0].equalsIgnoreCase("/setmyspawn")){ - if(!mcPermissions.getInstance().mySpawn(player)){ + if(!mcPermissions.getInstance().setMySpawn(player)){ player.sendMessage(ChatColor.YELLOW+"[mcMMO]"+ChatColor.DARK_RED +" Insufficient permissions."); return; } @@ -173,17 +195,29 @@ public class mcPlayerListener extends PlayerListener { } if(split[0].equalsIgnoreCase("/stats")){ event.setCancelled(true); - player.sendMessage(ChatColor.DARK_GREEN + "mcMMO stats"); - player.sendMessage(ChatColor.DARK_GREEN + "Mining Skill: " + mcUsers.getProfile(player).getMining()); - player.sendMessage(ChatColor.DARK_GREEN + "Repair Skill: " + mcUsers.getProfile(player).getRepair()); - player.sendMessage(ChatColor.DARK_GREEN + "Woodcutting Skill: "+mcUsers.getProfile(player).getWoodCutting()); - player.sendMessage(ChatColor.DARK_GREEN + "Unarmed Skill: " + mcUsers.getProfile(player).getUnarmed()); - player.sendMessage(ChatColor.DARK_GREEN + "Herbalism Skill: " + mcUsers.getProfile(player).getHerbalism()); - player.sendMessage(ChatColor.DARK_GREEN + "Excavation Skill: " + mcUsers.getProfile(player).getExcavation()); - player.sendMessage(ChatColor.DARK_GREEN + "Archery Skill: " + mcUsers.getProfile(player).getArchery()); - player.sendMessage(ChatColor.DARK_GREEN + "Swords Skill: " + mcUsers.getProfile(player).getSwords()); - //player.sendMessage(ChatColor.DARK_GREEN + "Axes Skill: " + mcUsers.getProfile(player).getAxes()); - player.sendMessage(ChatColor.DARK_GREEN + "Acrobatics Skill: " + mcUsers.getProfile(player).getAcrobatics()); + player.sendMessage(ChatColor.DARK_RED + "mcMMO stats"); + player.sendMessage(ChatColor.YELLOW + "Mining Skill: " + ChatColor.GREEN + mcUsers.getProfile(player).getMining()); + player.sendMessage(ChatColor.YELLOW + "Repair Skill: "+ ChatColor.GREEN + mcUsers.getProfile(player).getRepair()); + player.sendMessage(ChatColor.YELLOW + "Woodcutting Skill: "+ ChatColor.GREEN + mcUsers.getProfile(player).getWoodCutting()); + player.sendMessage(ChatColor.YELLOW + "Unarmed Skill: "+ ChatColor.GREEN + mcUsers.getProfile(player).getUnarmed()); + player.sendMessage(ChatColor.YELLOW + "Herbalism Skill: "+ ChatColor.GREEN + mcUsers.getProfile(player).getHerbalism()); + player.sendMessage(ChatColor.YELLOW + "Excavation Skill: "+ ChatColor.GREEN + mcUsers.getProfile(player).getExcavation()); + player.sendMessage(ChatColor.YELLOW + "Archery Skill: "+ ChatColor.GREEN + mcUsers.getProfile(player).getArchery()); + player.sendMessage(ChatColor.YELLOW + "Swords Skill: " + ChatColor.GREEN + mcUsers.getProfile(player).getSwords()); + //player.sendMessage(ChatColor.YELLOW+ "Axes Skill: " + ChatColor.GREEN + mcUsers.getProfile(player).getAxes()); + player.sendMessage(ChatColor.YELLOW + "Acrobatics Skill: " + ChatColor.GREEN + mcUsers.getProfile(player).getAcrobatics()); + player.sendMessage(ChatColor.DARK_RED+"TOTAL SKILL: "+ChatColor.GREEN+ + (mcUsers.getProfile(player).getAcrobaticsInt()+ + mcUsers.getProfile(player).getArcheryInt()+ + mcUsers.getProfile(player).getAxesInt()+ + mcUsers.getProfile(player).getExcavationInt()+ + mcUsers.getProfile(player).getHerbalismInt()+ + mcUsers.getProfile(player).getMiningInt()+ + mcUsers.getProfile(player).getRepairInt()+ + mcUsers.getProfile(player).getSwordsInt()+ + mcUsers.getProfile(player).getUnarmedInt()+ + mcUsers.getProfile(player).getWoodCuttingint()) + ); } //Party command if(split[0].equalsIgnoreCase("/party")){ diff --git a/mcMMO/com/bukkit/nossr50/mcMMO/mcUsers.java b/mcMMO/com/bukkit/nossr50/mcMMO/mcUsers.java index 00e97a488..dd68807e2 100644 --- a/mcMMO/com/bukkit/nossr50/mcMMO/mcUsers.java +++ b/mcMMO/com/bukkit/nossr50/mcMMO/mcUsers.java @@ -491,31 +491,67 @@ class PlayerList save(); } public String getRepair(){ + if(repair != null && !repair.equals("") && !repair.equals("null")){ return repair; + } else { + return "0"; + } } public String getMining(){ - return mining; + if(mining != null && !mining.equals("") && !mining.equals("null")){ + return mining; + } else { + return "0"; + } } public String getUnarmed(){ - return unarmed; + if(unarmed != null && !unarmed.equals("") && !unarmed.equals("null")){ + return unarmed; + } else { + return "0"; + } } public String getHerbalism(){ - return herbalism; + if(herbalism != null && !herbalism.equals("") && !herbalism.equals("null")){ + return herbalism; + } else { + return "0"; + } } public String getExcavation(){ - return excavation; + if(excavation != null && !excavation.equals("") && !excavation.equals("null")){ + return excavation; + } else { + return "0"; + } } public String getArchery(){ - return archery; + if(archery != null && !archery.equals("") && !archery.equals("null")){ + return archery; + } else { + return "0"; + } } public String getSwords(){ - return swords; + if(swords != null && !swords.equals("") && !swords.equals("null")){ + return swords; + } else { + return "0"; + } } public String getAxes(){ - return axes; + if(axes != null && !axes.equals("") && !axes.equals("null")){ + return axes; + } else { + return "0"; + } } public String getAcrobatics(){ - return acrobatics; + if(acrobatics != null && !acrobatics.equals("") && !acrobatics.equals("null")){ + return acrobatics; + } else { + return "0"; + } } public int getMiningInt(){ if(isInt(mining)){ @@ -598,7 +634,11 @@ class PlayerList } } public String getWoodCutting(){ - return woodcutting; + if(woodcutting != null && !woodcutting.equals("") && !woodcutting.equals("null")){ + return woodcutting; + } else { + return "0"; + } } public void addwgather(int newgather) @@ -673,6 +713,36 @@ class PlayerList return 0; } } + public void modifyskill(int newvalue, String skillname){ + if(skillname.equals("mining")){ + mining = String.valueOf(newvalue); + } + if(skillname.equals("woodcutting")){ + woodcutting = String.valueOf(newvalue); + } + if(skillname.equals("repair")){ + repair = String.valueOf(newvalue); + } + if(skillname.equals("herbalism")){ + herbalism = String.valueOf(newvalue); + } + if(skillname.equals("acrobatics")){ + acrobatics = String.valueOf(newvalue); + } + if(skillname.equals("swords")){ + swords = String.valueOf(newvalue); + } + if(skillname.equals("archery")){ + archery = String.valueOf(newvalue); + } + if(skillname.equals("unarmed")){ + unarmed = String.valueOf(newvalue); + } + if(skillname.equals("excavation")){ + excavation = String.valueOf(newvalue); + } + save(); + } public int getgatheramt() { if(isInt(gather)){ return Integer.parseInt(getgather()); @@ -698,7 +768,7 @@ class PlayerList } //Retrieve whether or not the player is in a party public boolean inParty() { - if(party != null){ + if(party != null && !party.equals("") && !party.equals("null")){ return true; } else { return false; diff --git a/mcMMO/com/bukkit/nossr50/mcMMO/mcm.java b/mcMMO/com/bukkit/nossr50/mcMMO/mcm.java index 1baf54b87..96aba939b 100644 --- a/mcMMO/com/bukkit/nossr50/mcMMO/mcm.java +++ b/mcMMO/com/bukkit/nossr50/mcMMO/mcm.java @@ -54,6 +54,43 @@ public class mcm { } } } + public boolean isSkill(String skillname){ + if(skillname.equals("mining")){ + return true; + } + else if(skillname.equals("woodcutting")){ + 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 { + return false; + } + } + public boolean isInt(String string){ + try { + int x = Integer.parseInt(string); + } + catch(NumberFormatException nFE) { + return false; + } + return true; + } public void simulateNaturalDrops(Entity entity){ Location loc = entity.getLocation(); if(entity instanceof Pig){ @@ -404,10 +441,15 @@ public class mcm { } public void playerVersusPlayerChecks(Entity x, Player attacker, EntityDamageByEntityEvent event, Plugin plugin){ if(x instanceof Player){ - Player defender = (Player)x; + Player defender = (Player)x; + if(mcUsers.getProfile(attacker).inParty() && mcUsers.getProfile(defender).inParty()){ + if(inSameParty(defender, attacker)){ + event.setCancelled(true); + return; + } + } if(attacker.getItemInHand().getTypeId() == 0){ //DMG MODIFIER - if((mcUsers.getProfile(defender).inParty() && mcUsers.getProfile(attacker).inParty())&& !mcUsers.getProfile(defender).getParty().equals(mcUsers.getProfile(attacker).getParty()) && !mcUsers.getProfile(defender).getParty().equals(mcUsers.getProfile(attacker).getParty())) { if(mcUsers.getProfile(attacker).getUnarmedInt() >= 50 && mcUsers.getProfile(attacker).getUnarmedInt() < 100){ defender.setHealth(calculateDamage(defender, 1)); } else if(mcUsers.getProfile(attacker).getUnarmedInt() >= 100 && mcUsers.getProfile(attacker).getUnarmedInt() < 200){ @@ -436,27 +478,35 @@ public class mcm { } //PROC if(simulateUnarmedProc(attacker)){ - attacker.sendMessage(ChatColor.DARK_RED+"You have hit with great force."); 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); - item.setTypeId(0); - item.setAmount(0); + Material mat; + mat = Material.getMaterial(0); + ItemStack itemx = null; + defender.setItemInHand(itemx); } } } /* * Make the defender drop items on death */ - if(defender.getHealth() <= 0){ + if(defender.getHealth()<= 0 && !mcUsers.getProfile(defender).isDead()){ + mcUsers.getProfile(defender).setDead(true); + event.setCancelled(true); //SEE IF THIS HELPS + for(ItemStack herp : defender.getInventory().getContents()){ + if(herp != null && herp.getTypeId() != 0) + defender.getLocation().getWorld().dropItemNaturally(defender.getLocation(), herp); + } for(Player derp : plugin.getServer().getOnlinePlayers()){ derp.sendMessage(ChatColor.GRAY+attacker.getName() + " has " +ChatColor.DARK_RED+"slain "+ChatColor.GRAY+defender.getName()); mcUsers.getProfile(defender).setDead(true); } } - } return; } if(mcUsers.getProfile(defender).isDead()) @@ -686,6 +736,7 @@ public class mcm { Player attacker = (Player)y; attacker.sendMessage(ChatColor.DARK_RED+"**TARGET HAS PARRIED THAT ATTACK**"); } + return; } } if(mcUsers.getProfile(defender).getSwordsInt() >= 250 && mcUsers.getProfile(defender).getSwordsInt() < 450){ @@ -699,6 +750,7 @@ public class mcm { Player attacker = (Player)y; attacker.sendMessage(ChatColor.DARK_RED+"**TARGET HAS PARRIED THAT ATTACK**"); } + return; } } if(mcUsers.getProfile(defender).getSwordsInt() >= 450 && mcUsers.getProfile(defender).getSwordsInt() < 775){ @@ -712,6 +764,7 @@ public class mcm { Player attacker = (Player)y; attacker.sendMessage(ChatColor.DARK_RED+"**TARGET HAS PARRIED THAT ATTACK**"); } + return; } } if(mcUsers.getProfile(defender).getSwordsInt() >= 775){ @@ -723,6 +776,7 @@ public class mcm { Player attacker = (Player)y; attacker.sendMessage(ChatColor.DARK_RED+"**TARGET HAS PARRIED THAT ATTACK**"); } + return; } } } @@ -830,23 +884,32 @@ public class mcm { event.setCancelled(true); player.sendMessage(ChatColor.GRAY+"mcMMO has a party system included"); player.sendMessage(ChatColor.GREEN+"~~Commands~~"); + if(mcPermissions.getInstance().party(player)){ player.sendMessage(ChatColor.GRAY+"/party - to join a party"); player.sendMessage(ChatColor.GRAY+"/party q - to quit a party"); + } + if(mcPermissions.getInstance().partyTeleport(player)) player.sendMessage(ChatColor.GRAY+"/ptp - party teleport"); + if(mcPermissions.getInstance().partyChat(player)) player.sendMessage(ChatColor.GRAY+"/p - toggles party chat"); player.sendMessage(ChatColor.GREEN+"/stats"+ChatColor.GRAY+" - Check current skill levels"); - player.sendMessage(ChatColor.GRAY+"/setmyspawn - set your own spawn location"); + if(mcPermissions.getInstance().setMySpawn(player)) + player.sendMessage(ChatColor.GRAY+"/setmyspawn - Skill info"); + if(mcPermissions.getInstance().mySpawn(player)) player.sendMessage(ChatColor.GRAY+"/myspawn - travel to myspawn, clears inventory"); + if(mcPermissions.getInstance().whois(player) || player.isOp()) player.sendMessage(ChatColor.GRAY+"/whois - view detailed info about a player (req op)"); - player.sendMessage(ChatColor.GRAY+"/woodcutting - displays info about the skill"); - player.sendMessage(ChatColor.GRAY+"/mining - displays info about the skill"); - player.sendMessage(ChatColor.GRAY+"/repair - displays info about the skill"); - player.sendMessage(ChatColor.GRAY+"/unarmed - displays info about the skill"); - player.sendMessage(ChatColor.GRAY+"/herbalism - displays info about the skill"); - player.sendMessage(ChatColor.GRAY+"/excavation - displays info about the skill"); - player.sendMessage(ChatColor.GRAY+"/archery - displays info about the skill"); - player.sendMessage(ChatColor.GRAY+"/swords - displays info about the skill"); - player.sendMessage(ChatColor.GRAY+"/acrobatics - displays info about the skill"); + player.sendMessage(ChatColor.GRAY+"/woodcutting - Skill info"); + player.sendMessage(ChatColor.GRAY+"/mining - Skill info"); + player.sendMessage(ChatColor.GRAY+"/repair - Skill info"); + player.sendMessage(ChatColor.GRAY+"/unarmed - Skill info"); + player.sendMessage(ChatColor.GRAY+"/herbalism - Skill info"); + player.sendMessage(ChatColor.GRAY+"/excavation - Skill info"); + player.sendMessage(ChatColor.GRAY+"/archery - Skill info"); + player.sendMessage(ChatColor.GRAY+"/swords - Skill info"); + player.sendMessage(ChatColor.GRAY+"/acrobatics - Skill info"); + if(mcPermissions.getInstance().mmoedit(player)) + player.sendMessage(ChatColor.GRAY+"/mmoedit - Modify mcMMO skills of players/yourself"); } } public void repairCheck(Player player, ItemStack is, Block block){ diff --git a/mcMMO/plugin.yml b/mcMMO/plugin.yml index 8b1a33f08..f03e637b2 100644 --- a/mcMMO/plugin.yml +++ b/mcMMO/plugin.yml @@ -1,3 +1,3 @@ name: mcMMO main: com.bukkit.nossr50.mcMMO.mcMMO -version: 0.5.8 \ No newline at end of file +version: 0.5.11 \ No newline at end of file