All the changes up until 0.5.11

This commit is contained in:
nossr50 2011-02-13 18:02:05 -08:00
parent b972e17bd1
commit 3647ba5bd9
7 changed files with 299 additions and 92 deletions

View File

@ -1,5 +1,24 @@
Changelog: Changelog:
#Versions without changelogs probably had very small misc fixes, like tweaks to the source code# #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 Version 0.5.8
Fixed bug where players inventories would dupe during combat Fixed bug where players inventories would dupe during combat

View File

@ -37,12 +37,14 @@ public class mcEntityListener extends EntityListener {
if(block != null && block.getTypeId() == 81){ if(block != null && block.getTypeId() == 81){
if(mcUsers.getProfile(player).isDead()) if(mcUsers.getProfile(player).isDead())
return; return;
/*
if(player.getHealth() - event.getDamage() <= 0){ if(player.getHealth() - event.getDamage() <= 0){
mcUsers.getProfile(player).setDead(true); mcUsers.getProfile(player).setDead(true);
for(Player bidoof : plugin.getServer().getOnlinePlayers()){ for(Player bidoof : plugin.getServer().getOnlinePlayers()){
bidoof.sendMessage(ChatColor.GRAY+player.getName()+" has been"+ChatColor.DARK_GREEN+" cactus tickled "+ChatColor.GRAY+"to death."); 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 * 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... * MIGHT BE A BIT BUGGY, IT SEEMS TO WORK RIGHT NOW AT LEAST...
*/ */
} }
/* /*
* IF ATTACKER IS PLAYER * IF ATTACKER IS PLAYER
@ -112,16 +115,16 @@ public class mcEntityListener extends EntityListener {
*/ */
if(x instanceof Monster){ if(x instanceof Monster){
Monster defender = (Monster)x; Monster defender = (Monster)x;
if(mcUsers.getProfile(attacker).getArcheryInt() >= 50 && mcUsers.getProfile(attacker).getArcheryInt() < 150) if(mcUsers.getProfile(attacker).getArcheryInt() >= 50 && mcUsers.getProfile(attacker).getArcheryInt() < 250)
defender.setHealth(defender.getHealth() - 1); defender.setHealth(mcm.getInstance().calculateDamage(defender, 1));
if(mcUsers.getProfile(attacker).getArcheryInt() >= 150 && mcUsers.getProfile(attacker).getArcheryInt() < 375) if(mcUsers.getProfile(attacker).getArcheryInt() >= 250 && mcUsers.getProfile(attacker).getArcheryInt() < 575)
defender.setHealth(defender.getHealth() - 2); defender.setHealth(mcm.getInstance().calculateDamage(defender, 2));
if(mcUsers.getProfile(attacker).getArcheryInt() >= 375 && mcUsers.getProfile(attacker).getArcheryInt() < 525) if(mcUsers.getProfile(attacker).getArcheryInt() >= 575 && mcUsers.getProfile(attacker).getArcheryInt() < 725)
defender.setHealth(defender.getHealth() - 3); defender.setHealth(mcm.getInstance().calculateDamage(defender, 3));
if(mcUsers.getProfile(attacker).getArcheryInt() >= 525 && mcUsers.getProfile(attacker).getArcheryInt() < 800) if(mcUsers.getProfile(attacker).getArcheryInt() >= 725 && mcUsers.getProfile(attacker).getArcheryInt() < 1000)
defender.setHealth(defender.getHealth() - 4); defender.setHealth(mcm.getInstance().calculateDamage(defender, 4));
if(mcUsers.getProfile(attacker).getArcheryInt() >= 800 && mcUsers.getProfile(attacker).getArcheryInt() < 1000) if(mcUsers.getProfile(attacker).getArcheryInt() >= 1000)
defender.setHealth(defender.getHealth() - 6); defender.setHealth(mcm.getInstance().calculateDamage(defender, 5));
if(defender.getHealth() <= 0) if(defender.getHealth() <= 0)
mcm.getInstance().simulateNaturalDrops(defender); mcm.getInstance().simulateNaturalDrops(defender);
//XP //XP
@ -135,16 +138,16 @@ public class mcEntityListener extends EntityListener {
*/ */
if(x instanceof Animals){ if(x instanceof Animals){
Animals defender = (Animals)x; Animals defender = (Animals)x;
if(mcUsers.getProfile(attacker).getArcheryInt() >= 50 && mcUsers.getProfile(attacker).getArcheryInt() < 150) if(mcUsers.getProfile(attacker).getArcheryInt() >= 50 && mcUsers.getProfile(attacker).getArcheryInt() < 250)
defender.setHealth(defender.getHealth() - 1); defender.setHealth(mcm.getInstance().calculateDamage(defender, 1));
if(mcUsers.getProfile(attacker).getArcheryInt() >= 150 && mcUsers.getProfile(attacker).getArcheryInt() < 375) if(mcUsers.getProfile(attacker).getArcheryInt() >= 250 && mcUsers.getProfile(attacker).getArcheryInt() < 575)
defender.setHealth(defender.getHealth() - 2); defender.setHealth(mcm.getInstance().calculateDamage(defender, 2));
if(mcUsers.getProfile(attacker).getArcheryInt() >= 375 && mcUsers.getProfile(attacker).getArcheryInt() < 525) if(mcUsers.getProfile(attacker).getArcheryInt() >= 575 && mcUsers.getProfile(attacker).getArcheryInt() < 725)
defender.setHealth(defender.getHealth() - 3); defender.setHealth(mcm.getInstance().calculateDamage(defender, 3));
if(mcUsers.getProfile(attacker).getArcheryInt() >= 525 && mcUsers.getProfile(attacker).getArcheryInt() < 800) if(mcUsers.getProfile(attacker).getArcheryInt() >= 725 && mcUsers.getProfile(attacker).getArcheryInt() < 1000)
defender.setHealth(defender.getHealth() - 4); defender.setHealth(mcm.getInstance().calculateDamage(defender, 4));
if(mcUsers.getProfile(attacker).getArcheryInt() >= 800 && mcUsers.getProfile(attacker).getArcheryInt() < 1000) if(mcUsers.getProfile(attacker).getArcheryInt() >= 1000)
defender.setHealth(defender.getHealth() - 6); defender.setHealth(mcm.getInstance().calculateDamage(defender, 5));
if(defender.getHealth() <= 0) if(defender.getHealth() <= 0)
mcm.getInstance().simulateNaturalDrops(defender); mcm.getInstance().simulateNaturalDrops(defender);
} }
@ -153,16 +156,16 @@ public class mcEntityListener extends EntityListener {
*/ */
if(x instanceof Squid){ if(x instanceof Squid){
Squid defender = (Squid)x; Squid defender = (Squid)x;
if(mcUsers.getProfile(attacker).getArcheryInt() >= 50 && mcUsers.getProfile(attacker).getArcheryInt() < 150) if(mcUsers.getProfile(attacker).getArcheryInt() >= 50 && mcUsers.getProfile(attacker).getArcheryInt() < 250)
defender.setHealth(defender.getHealth() - 1); defender.setHealth(mcm.getInstance().calculateDamage(defender, 1));
if(mcUsers.getProfile(attacker).getArcheryInt() >= 150 && mcUsers.getProfile(attacker).getArcheryInt() < 375) if(mcUsers.getProfile(attacker).getArcheryInt() >= 250 && mcUsers.getProfile(attacker).getArcheryInt() < 575)
defender.setHealth(defender.getHealth() - 2); defender.setHealth(mcm.getInstance().calculateDamage(defender, 2));
if(mcUsers.getProfile(attacker).getArcheryInt() >= 375 && mcUsers.getProfile(attacker).getArcheryInt() < 525) if(mcUsers.getProfile(attacker).getArcheryInt() >= 575 && mcUsers.getProfile(attacker).getArcheryInt() < 725)
defender.setHealth(defender.getHealth() - 3); defender.setHealth(mcm.getInstance().calculateDamage(defender, 3));
if(mcUsers.getProfile(attacker).getArcheryInt() >= 525 && mcUsers.getProfile(attacker).getArcheryInt() < 800) if(mcUsers.getProfile(attacker).getArcheryInt() >= 725 && mcUsers.getProfile(attacker).getArcheryInt() < 1000)
defender.setHealth(defender.getHealth() - 4); defender.setHealth(mcm.getInstance().calculateDamage(defender, 4));
if(mcUsers.getProfile(attacker).getArcheryInt() >= 800 && mcUsers.getProfile(attacker).getArcheryInt() < 1000) if(mcUsers.getProfile(attacker).getArcheryInt() >= 1000)
defender.setHealth(defender.getHealth() - 6); defender.setHealth(mcm.getInstance().calculateDamage(defender, 5));
if(defender.getHealth() <= 0) if(defender.getHealth() <= 0)
mcm.getInstance().simulateNaturalDrops(defender); mcm.getInstance().simulateNaturalDrops(defender);
} }
@ -171,36 +174,42 @@ public class mcEntityListener extends EntityListener {
*/ */
if(x instanceof Player){ if(x instanceof Player){
Player defender = (Player)x; Player defender = (Player)x;
/*
* Stuff for the daze proc
*/
Location loc = defender.getLocation(); Location loc = defender.getLocation();
if(Math.random() * 10 > 5){ if(Math.random() * 10 > 5){
loc.setPitch(90); loc.setPitch(90);
} else { } else {
loc.setPitch(-90); 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){ if(Math.random() * 10 > 7){
defender.teleportTo(loc); defender.teleportTo(loc);
defender.sendMessage(ChatColor.DARK_RED+"Touched Fuzzy. Felt Dizzy."); defender.sendMessage(ChatColor.DARK_RED+"Touched Fuzzy. Felt Dizzy.");
attacker.sendMessage("Target was "+ChatColor.DARK_RED+"Dazed"); 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){ if(Math.random() * 10 > 4){
defender.teleportTo(loc); defender.teleportTo(loc);
defender.sendMessage(ChatColor.DARK_RED+"Touched Fuzzy. Felt Dizzy."); defender.sendMessage(ChatColor.DARK_RED+"Touched Fuzzy. Felt Dizzy.");
attacker.sendMessage("Target was "+ChatColor.DARK_RED+"Dazed"); attacker.sendMessage("Target was "+ChatColor.DARK_RED+"Dazed");
} }
} }
if(mcUsers.getProfile(attacker).getArcheryInt() >= 50 && mcUsers.getProfile(attacker).getArcheryInt() < 150) if(mcUsers.getProfile(attacker).getArcheryInt() >= 50 && mcUsers.getProfile(attacker).getArcheryInt() < 250)
defender.setHealth(defender.getHealth() - 1); defender.setHealth(mcm.getInstance().calculateDamage(defender, 1));
if(mcUsers.getProfile(attacker).getArcheryInt() >= 150 && mcUsers.getProfile(attacker).getArcheryInt() < 375) if(mcUsers.getProfile(attacker).getArcheryInt() >= 250 && mcUsers.getProfile(attacker).getArcheryInt() < 575)
defender.setHealth(defender.getHealth() - 2); defender.setHealth(mcm.getInstance().calculateDamage(defender, 2));
if(mcUsers.getProfile(attacker).getArcheryInt() >= 375 && mcUsers.getProfile(attacker).getArcheryInt() < 525) if(mcUsers.getProfile(attacker).getArcheryInt() >= 575 && mcUsers.getProfile(attacker).getArcheryInt() < 725)
defender.setHealth(defender.getHealth() - 3); defender.setHealth(mcm.getInstance().calculateDamage(defender, 3));
if(mcUsers.getProfile(attacker).getArcheryInt() >= 525 && mcUsers.getProfile(attacker).getArcheryInt() < 800) if(mcUsers.getProfile(attacker).getArcheryInt() >= 725 && mcUsers.getProfile(attacker).getArcheryInt() < 1000)
defender.setHealth(defender.getHealth() - 4); defender.setHealth(mcm.getInstance().calculateDamage(defender, 4));
if(mcUsers.getProfile(attacker).getArcheryInt() >= 800 && mcUsers.getProfile(attacker).getArcheryInt() < 1000) if(mcUsers.getProfile(attacker).getArcheryInt() >= 1000)
defender.setHealth(defender.getHealth() - 6); defender.setHealth(mcm.getInstance().calculateDamage(defender, 5));
if(defender.getHealth() >= 0){ if(defender.getHealth() >= 0){
if(mcUsers.getProfile(defender).isDead()) if(mcUsers.getProfile(defender).isDead())
return; return;
@ -216,7 +225,7 @@ public class mcEntityListener extends EntityListener {
return; return;
if(defender.getHealth() - event.getDamage() <= 0){ if(defender.getHealth() - event.getDamage() <= 0){
for(Player derp : plugin.getServer().getOnlinePlayers()){ 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); mcUsers.getProfile(defender).setDead(true);
} }
} }
@ -234,35 +243,35 @@ public class mcEntityListener extends EntityListener {
int y = loc.getBlockY(); int y = loc.getBlockY();
int z = loc.getBlockZ(); int z = loc.getBlockZ();
if(type == DamageCause.FALL){ 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){ if(Math.random() * 10 > 8){
event.setCancelled(true); event.setCancelled(true);
player.sendMessage("**ROLLED**"); player.sendMessage("**ROLLED**");
return; 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){ if(Math.random() * 10 > 6){
event.setCancelled(true); event.setCancelled(true);
player.sendMessage("**ROLLED**"); player.sendMessage("**ROLLED**");
return; 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){ if(Math.random() * 10 > 4){
event.setCancelled(true); event.setCancelled(true);
player.sendMessage("**ROLLED**"); player.sendMessage("**ROLLED**");
return; 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){ if(Math.random() * 10 > 2){
event.setCancelled(true); event.setCancelled(true);
player.sendMessage("**BARREL ROLLED**"); player.sendMessage("**BARREL ROLLED**");
return; return;
} }
} }
if(mcUsers.getProfile(player).getAcrobaticsInt() >= 450){ if(mcUsers.getProfile(player).getAcrobaticsInt() >= 950){
event.setCancelled(true); event.setCancelled(true);
player.sendMessage("**ROLLED... LIKE A BOSS**"); player.sendMessage("**ROLLED... LIKE A BOSS**");
return; return;
@ -303,6 +312,7 @@ public class mcEntityListener extends EntityListener {
} }
} }
} }
/*
if(type == DamageCause.FIRE || type == DamageCause.FIRE_TICK){ if(type == DamageCause.FIRE || type == DamageCause.FIRE_TICK){
if(mcUsers.getProfile(player).isDead()) if(mcUsers.getProfile(player).isDead())
return; return;
@ -313,6 +323,7 @@ public class mcEntityListener extends EntityListener {
} }
} }
} }
*/
if(type == DamageCause.LAVA){ if(type == DamageCause.LAVA){
if(mcUsers.getProfile(player).isDead()) if(mcUsers.getProfile(player).isDead())
return; return;
@ -329,10 +340,6 @@ public class mcEntityListener extends EntityListener {
Entity x = event.getEntity(); Entity x = event.getEntity();
if(x instanceof Player){ if(x instanceof Player){
Player player = (Player)x; 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()){ if(mcUsers.getProfile(player).isDead()){
mcUsers.getProfile(player).setDead(false); mcUsers.getProfile(player).setDead(false);
return; return;

View File

@ -29,6 +29,13 @@ public class mcPermissions {
private boolean permission(Player player, String string) { private boolean permission(Player player, String string) {
return permissionsPlugin.Security.permission(player, 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) { public boolean motd(Player player) {
if (permissionsEnabled) { if (permissionsEnabled) {
return permission(player, "mcmmo.motd"); return permission(player, "mcmmo.motd");
@ -43,6 +50,13 @@ public class mcPermissions {
return true; return true;
} }
} }
public boolean setMySpawn(Player player) {
if (permissionsEnabled) {
return permission(player, "mcmmo.commands.setmyspawn");
} else {
return true;
}
}
public boolean partyChat(Player player) { public boolean partyChat(Player player) {
if (permissionsEnabled) { if (permissionsEnabled) {
return permission(player, "mcmmo.chat.partychat"); return permission(player, "mcmmo.chat.partychat");

View File

@ -104,6 +104,28 @@ public class mcPlayerListener extends PlayerListener {
String playerName = player.getName(); String playerName = player.getName();
//Check if the command is an mcMMO related help command //Check if the command is an mcMMO related help command
mcm.getInstance().mcmmoHelpCheck(split, player, event); 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")){ if(mcUsers.getProfile(player).inParty() && split[0].equalsIgnoreCase("/ptp")){
event.setCancelled(true); event.setCancelled(true);
if(!mcPermissions.getInstance().partyTeleport(player)){ if(!mcPermissions.getInstance().partyTeleport(player)){
@ -160,7 +182,7 @@ public class mcPlayerListener extends PlayerListener {
} }
} }
if(split[0].equalsIgnoreCase("/setmyspawn")){ 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."); player.sendMessage(ChatColor.YELLOW+"[mcMMO]"+ChatColor.DARK_RED +" Insufficient permissions.");
return; return;
} }
@ -173,17 +195,29 @@ public class mcPlayerListener extends PlayerListener {
} }
if(split[0].equalsIgnoreCase("/stats")){ if(split[0].equalsIgnoreCase("/stats")){
event.setCancelled(true); event.setCancelled(true);
player.sendMessage(ChatColor.DARK_GREEN + "mcMMO stats"); player.sendMessage(ChatColor.DARK_RED + "mcMMO stats");
player.sendMessage(ChatColor.DARK_GREEN + "Mining Skill: " + mcUsers.getProfile(player).getMining()); player.sendMessage(ChatColor.YELLOW + "Mining Skill: " + ChatColor.GREEN + mcUsers.getProfile(player).getMining());
player.sendMessage(ChatColor.DARK_GREEN + "Repair Skill: " + mcUsers.getProfile(player).getRepair()); player.sendMessage(ChatColor.YELLOW + "Repair Skill: "+ ChatColor.GREEN + mcUsers.getProfile(player).getRepair());
player.sendMessage(ChatColor.DARK_GREEN + "Woodcutting Skill: "+mcUsers.getProfile(player).getWoodCutting()); player.sendMessage(ChatColor.YELLOW + "Woodcutting Skill: "+ ChatColor.GREEN + mcUsers.getProfile(player).getWoodCutting());
player.sendMessage(ChatColor.DARK_GREEN + "Unarmed Skill: " + mcUsers.getProfile(player).getUnarmed()); player.sendMessage(ChatColor.YELLOW + "Unarmed Skill: "+ ChatColor.GREEN + mcUsers.getProfile(player).getUnarmed());
player.sendMessage(ChatColor.DARK_GREEN + "Herbalism Skill: " + mcUsers.getProfile(player).getHerbalism()); player.sendMessage(ChatColor.YELLOW + "Herbalism Skill: "+ ChatColor.GREEN + mcUsers.getProfile(player).getHerbalism());
player.sendMessage(ChatColor.DARK_GREEN + "Excavation Skill: " + mcUsers.getProfile(player).getExcavation()); player.sendMessage(ChatColor.YELLOW + "Excavation Skill: "+ ChatColor.GREEN + mcUsers.getProfile(player).getExcavation());
player.sendMessage(ChatColor.DARK_GREEN + "Archery Skill: " + mcUsers.getProfile(player).getArchery()); player.sendMessage(ChatColor.YELLOW + "Archery Skill: "+ ChatColor.GREEN + mcUsers.getProfile(player).getArchery());
player.sendMessage(ChatColor.DARK_GREEN + "Swords Skill: " + mcUsers.getProfile(player).getSwords()); player.sendMessage(ChatColor.YELLOW + "Swords Skill: " + ChatColor.GREEN + mcUsers.getProfile(player).getSwords());
//player.sendMessage(ChatColor.DARK_GREEN + "Axes Skill: " + mcUsers.getProfile(player).getAxes()); //player.sendMessage(ChatColor.YELLOW+ "Axes Skill: " + ChatColor.GREEN + mcUsers.getProfile(player).getAxes());
player.sendMessage(ChatColor.DARK_GREEN + "Acrobatics Skill: " + mcUsers.getProfile(player).getAcrobatics()); 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 //Party command
if(split[0].equalsIgnoreCase("/party")){ if(split[0].equalsIgnoreCase("/party")){

View File

@ -491,31 +491,67 @@ class PlayerList
save(); save();
} }
public String getRepair(){ public String getRepair(){
if(repair != null && !repair.equals("") && !repair.equals("null")){
return repair; return repair;
} else {
return "0";
}
} }
public String getMining(){ public String getMining(){
return mining; if(mining != null && !mining.equals("") && !mining.equals("null")){
return mining;
} else {
return "0";
}
} }
public String getUnarmed(){ public String getUnarmed(){
return unarmed; if(unarmed != null && !unarmed.equals("") && !unarmed.equals("null")){
return unarmed;
} else {
return "0";
}
} }
public String getHerbalism(){ public String getHerbalism(){
return herbalism; if(herbalism != null && !herbalism.equals("") && !herbalism.equals("null")){
return herbalism;
} else {
return "0";
}
} }
public String getExcavation(){ public String getExcavation(){
return excavation; if(excavation != null && !excavation.equals("") && !excavation.equals("null")){
return excavation;
} else {
return "0";
}
} }
public String getArchery(){ public String getArchery(){
return archery; if(archery != null && !archery.equals("") && !archery.equals("null")){
return archery;
} else {
return "0";
}
} }
public String getSwords(){ public String getSwords(){
return swords; if(swords != null && !swords.equals("") && !swords.equals("null")){
return swords;
} else {
return "0";
}
} }
public String getAxes(){ public String getAxes(){
return axes; if(axes != null && !axes.equals("") && !axes.equals("null")){
return axes;
} else {
return "0";
}
} }
public String getAcrobatics(){ public String getAcrobatics(){
return acrobatics; if(acrobatics != null && !acrobatics.equals("") && !acrobatics.equals("null")){
return acrobatics;
} else {
return "0";
}
} }
public int getMiningInt(){ public int getMiningInt(){
if(isInt(mining)){ if(isInt(mining)){
@ -598,7 +634,11 @@ class PlayerList
} }
} }
public String getWoodCutting(){ public String getWoodCutting(){
return woodcutting; if(woodcutting != null && !woodcutting.equals("") && !woodcutting.equals("null")){
return woodcutting;
} else {
return "0";
}
} }
public void addwgather(int newgather) public void addwgather(int newgather)
@ -673,6 +713,36 @@ class PlayerList
return 0; 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() { public int getgatheramt() {
if(isInt(gather)){ if(isInt(gather)){
return Integer.parseInt(getgather()); return Integer.parseInt(getgather());
@ -698,7 +768,7 @@ class PlayerList
} }
//Retrieve whether or not the player is in a party //Retrieve whether or not the player is in a party
public boolean inParty() { public boolean inParty() {
if(party != null){ if(party != null && !party.equals("") && !party.equals("null")){
return true; return true;
} else { } else {
return false; return false;

View File

@ -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){ public void simulateNaturalDrops(Entity entity){
Location loc = entity.getLocation(); Location loc = entity.getLocation();
if(entity instanceof Pig){ if(entity instanceof Pig){
@ -404,10 +441,15 @@ public class mcm {
} }
public void playerVersusPlayerChecks(Entity x, Player attacker, EntityDamageByEntityEvent event, Plugin plugin){ public void playerVersusPlayerChecks(Entity x, Player attacker, EntityDamageByEntityEvent event, Plugin plugin){
if(x instanceof Player){ 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){ if(attacker.getItemInHand().getTypeId() == 0){
//DMG MODIFIER //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){ if(mcUsers.getProfile(attacker).getUnarmedInt() >= 50 && mcUsers.getProfile(attacker).getUnarmedInt() < 100){
defender.setHealth(calculateDamage(defender, 1)); defender.setHealth(calculateDamage(defender, 1));
} else if(mcUsers.getProfile(attacker).getUnarmedInt() >= 100 && mcUsers.getProfile(attacker).getUnarmedInt() < 200){ } else if(mcUsers.getProfile(attacker).getUnarmedInt() >= 100 && mcUsers.getProfile(attacker).getUnarmedInt() < 200){
@ -436,27 +478,35 @@ public class mcm {
} }
//PROC //PROC
if(simulateUnarmedProc(attacker)){ if(simulateUnarmedProc(attacker)){
attacker.sendMessage(ChatColor.DARK_RED+"You have hit with great force.");
Location loc = defender.getLocation(); Location loc = defender.getLocation();
if(defender.getItemInHand() != null && defender.getItemInHand().getTypeId() != 0){ 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(); ItemStack item = defender.getItemInHand();
if(item != null){ if(item != null){
loc.getWorld().dropItemNaturally(loc, item); loc.getWorld().dropItemNaturally(loc, item);
item.setTypeId(0); Material mat;
item.setAmount(0); mat = Material.getMaterial(0);
ItemStack itemx = null;
defender.setItemInHand(itemx);
} }
} }
} }
/* /*
* Make the defender drop items on death * 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()){ for(Player derp : plugin.getServer().getOnlinePlayers()){
derp.sendMessage(ChatColor.GRAY+attacker.getName() + " has " +ChatColor.DARK_RED+"slain "+ChatColor.GRAY+defender.getName()); derp.sendMessage(ChatColor.GRAY+attacker.getName() + " has " +ChatColor.DARK_RED+"slain "+ChatColor.GRAY+defender.getName());
mcUsers.getProfile(defender).setDead(true); mcUsers.getProfile(defender).setDead(true);
} }
} }
}
return; return;
} }
if(mcUsers.getProfile(defender).isDead()) if(mcUsers.getProfile(defender).isDead())
@ -686,6 +736,7 @@ public class mcm {
Player attacker = (Player)y; Player attacker = (Player)y;
attacker.sendMessage(ChatColor.DARK_RED+"**TARGET HAS PARRIED THAT ATTACK**"); attacker.sendMessage(ChatColor.DARK_RED+"**TARGET HAS PARRIED THAT ATTACK**");
} }
return;
} }
} }
if(mcUsers.getProfile(defender).getSwordsInt() >= 250 && mcUsers.getProfile(defender).getSwordsInt() < 450){ if(mcUsers.getProfile(defender).getSwordsInt() >= 250 && mcUsers.getProfile(defender).getSwordsInt() < 450){
@ -699,6 +750,7 @@ public class mcm {
Player attacker = (Player)y; Player attacker = (Player)y;
attacker.sendMessage(ChatColor.DARK_RED+"**TARGET HAS PARRIED THAT ATTACK**"); attacker.sendMessage(ChatColor.DARK_RED+"**TARGET HAS PARRIED THAT ATTACK**");
} }
return;
} }
} }
if(mcUsers.getProfile(defender).getSwordsInt() >= 450 && mcUsers.getProfile(defender).getSwordsInt() < 775){ if(mcUsers.getProfile(defender).getSwordsInt() >= 450 && mcUsers.getProfile(defender).getSwordsInt() < 775){
@ -712,6 +764,7 @@ public class mcm {
Player attacker = (Player)y; Player attacker = (Player)y;
attacker.sendMessage(ChatColor.DARK_RED+"**TARGET HAS PARRIED THAT ATTACK**"); attacker.sendMessage(ChatColor.DARK_RED+"**TARGET HAS PARRIED THAT ATTACK**");
} }
return;
} }
} }
if(mcUsers.getProfile(defender).getSwordsInt() >= 775){ if(mcUsers.getProfile(defender).getSwordsInt() >= 775){
@ -723,6 +776,7 @@ public class mcm {
Player attacker = (Player)y; Player attacker = (Player)y;
attacker.sendMessage(ChatColor.DARK_RED+"**TARGET HAS PARRIED THAT ATTACK**"); attacker.sendMessage(ChatColor.DARK_RED+"**TARGET HAS PARRIED THAT ATTACK**");
} }
return;
} }
} }
} }
@ -830,23 +884,32 @@ public class mcm {
event.setCancelled(true); event.setCancelled(true);
player.sendMessage(ChatColor.GRAY+"mcMMO has a party system included"); player.sendMessage(ChatColor.GRAY+"mcMMO has a party system included");
player.sendMessage(ChatColor.GREEN+"~~Commands~~"); player.sendMessage(ChatColor.GREEN+"~~Commands~~");
if(mcPermissions.getInstance().party(player)){
player.sendMessage(ChatColor.GRAY+"/party <name> - to join a party"); player.sendMessage(ChatColor.GRAY+"/party <name> - to join a party");
player.sendMessage(ChatColor.GRAY+"/party q - to quit a party"); player.sendMessage(ChatColor.GRAY+"/party q - to quit a party");
}
if(mcPermissions.getInstance().partyTeleport(player))
player.sendMessage(ChatColor.GRAY+"/ptp <name> - party teleport"); player.sendMessage(ChatColor.GRAY+"/ptp <name> - party teleport");
if(mcPermissions.getInstance().partyChat(player))
player.sendMessage(ChatColor.GRAY+"/p - toggles party chat"); player.sendMessage(ChatColor.GRAY+"/p - toggles party chat");
player.sendMessage(ChatColor.GREEN+"/stats"+ChatColor.GRAY+" - Check current skill levels"); 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"); 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+"/whois - view detailed info about a player (req op)");
player.sendMessage(ChatColor.GRAY+"/woodcutting - displays info about the skill"); player.sendMessage(ChatColor.GRAY+"/woodcutting - Skill info");
player.sendMessage(ChatColor.GRAY+"/mining - displays info about the skill"); player.sendMessage(ChatColor.GRAY+"/mining - Skill info");
player.sendMessage(ChatColor.GRAY+"/repair - displays info about the skill"); player.sendMessage(ChatColor.GRAY+"/repair - Skill info");
player.sendMessage(ChatColor.GRAY+"/unarmed - displays info about the skill"); player.sendMessage(ChatColor.GRAY+"/unarmed - Skill info");
player.sendMessage(ChatColor.GRAY+"/herbalism - displays info about the skill"); player.sendMessage(ChatColor.GRAY+"/herbalism - Skill info");
player.sendMessage(ChatColor.GRAY+"/excavation - displays info about the skill"); player.sendMessage(ChatColor.GRAY+"/excavation - Skill info");
player.sendMessage(ChatColor.GRAY+"/archery - displays info about the skill"); player.sendMessage(ChatColor.GRAY+"/archery - Skill info");
player.sendMessage(ChatColor.GRAY+"/swords - displays info about the skill"); player.sendMessage(ChatColor.GRAY+"/swords - Skill info");
player.sendMessage(ChatColor.GRAY+"/acrobatics - displays info about the skill"); 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){ public void repairCheck(Player player, ItemStack is, Block block){

View File

@ -1,3 +1,3 @@
name: mcMMO name: mcMMO
main: com.bukkit.nossr50.mcMMO.mcMMO main: com.bukkit.nossr50.mcMMO.mcMMO
version: 0.5.8 version: 0.5.11