diff --git a/mcMMO/com/gmail/nossr50/mcAcrobatics.java b/mcMMO/com/gmail/nossr50/mcAcrobatics.java index 0814ae25b..df32bb575 100644 --- a/mcMMO/com/gmail/nossr50/mcAcrobatics.java +++ b/mcMMO/com/gmail/nossr50/mcAcrobatics.java @@ -14,7 +14,7 @@ public class mcAcrobatics { return instance; } public void acrobaticsCheck(Player player, EntityDamageEvent event, Location loc, int xx, int y, int z){ - if(mcUsers.getProfile(player).getAcrobaticsInt() >= 50 + if(player != null && mcUsers.getProfile(player).getAcrobaticsInt() >= 50 && mcUsers.getProfile(player).getAcrobaticsInt() < 250 && mcPermissions.getInstance().acrobatics(player)){ if(Math.random() * 10 > 8){ @@ -23,7 +23,7 @@ public class mcAcrobatics { return; } } - if(mcUsers.getProfile(player).getAcrobaticsInt() >= 250 + if(player != null && mcUsers.getProfile(player).getAcrobaticsInt() >= 250 && mcUsers.getProfile(player).getAcrobaticsInt() < 450 && mcPermissions.getInstance().acrobatics(player)){ if(Math.random() * 10 > 6){ @@ -32,7 +32,7 @@ public class mcAcrobatics { return; } } - if(mcUsers.getProfile(player).getAcrobaticsInt() >= 450 + if(player != null && mcUsers.getProfile(player).getAcrobaticsInt() >= 450 && mcUsers.getProfile(player).getAcrobaticsInt() < 750 && mcPermissions.getInstance().acrobatics(player)){ if(Math.random() * 10 > 4){ @@ -41,7 +41,7 @@ public class mcAcrobatics { return; } } - if(mcUsers.getProfile(player).getAcrobaticsInt() >= 750 + if(player != null && mcUsers.getProfile(player).getAcrobaticsInt() >= 750 && mcUsers.getProfile(player).getAcrobaticsInt() < 950 && mcPermissions.getInstance().acrobatics(player)){ if(Math.random() * 10 > 2){ @@ -50,18 +50,18 @@ public class mcAcrobatics { return; } } - if(mcUsers.getProfile(player).getAcrobaticsInt() >= 950 + if(player != null && mcUsers.getProfile(player).getAcrobaticsInt() >= 950 && mcPermissions.getInstance().acrobatics(player)){ event.setCancelled(true); player.sendMessage("**ROLLED... LIKE A BOSS**"); return; } - if(player.getHealth() - event.getDamage() <= 0) + if(player != null && player.getHealth() - event.getDamage() <= 0) return; if(!mcConfig.getInstance().isBlockWatched(loc.getWorld().getBlockAt(xx, y, z)) && mcPermissions.getInstance().acrobatics(player)){ mcUsers.getProfile(player).addAcrobaticsGather(event.getDamage() * 3); - if(mcUsers.getProfile(player).getAcrobaticsGatherInt() >= mcUsers.getProfile(player).getXpToLevel("acrobatics")){ + if(player != null && mcUsers.getProfile(player).getAcrobaticsGatherInt() >= mcUsers.getProfile(player).getXpToLevel("acrobatics")){ int skillups = 0; while(mcUsers.getProfile(player).getAcrobaticsGatherInt() >= mcUsers.getProfile(player).getXpToLevel("acrobatics")){ skillups++; diff --git a/mcMMO/com/gmail/nossr50/mcBlockListener.java b/mcMMO/com/gmail/nossr50/mcBlockListener.java index 986e8485d..b8f741f5d 100644 --- a/mcMMO/com/gmail/nossr50/mcBlockListener.java +++ b/mcMMO/com/gmail/nossr50/mcBlockListener.java @@ -64,6 +64,9 @@ public class mcBlockListener extends BlockListener { if(player != null && block.getTypeId() == 17 && mcPermissions.getInstance().woodcutting(player)){ mcWoodCutting.getInstance().woodCuttingProcCheck(player, block, loc); mcUsers.getProfile(player).addWoodcuttingGather(7); + if(mcPermissions.getInstance().woodcuttingability(player)){ + + } } /* * EXCAVATION diff --git a/mcMMO/com/gmail/nossr50/mcCombat.java b/mcMMO/com/gmail/nossr50/mcCombat.java index 984163a78..ec9b878cd 100644 --- a/mcMMO/com/gmail/nossr50/mcCombat.java +++ b/mcMMO/com/gmail/nossr50/mcCombat.java @@ -42,6 +42,7 @@ public class mcCombat { return; } } + if(defender != null) mcUsers.getProfile(defender).setRecentlyHurt(30); /* * AXE CRITICAL CHECK @@ -51,7 +52,7 @@ public class mcCombat { bleedCheck(attacker, x); } int healthbefore = defender.getHealth(); - if(mcPermissions.getInstance().unarmed(attacker) && attacker.getItemInHand().getTypeId() == 0){ + if(defender != null && mcPermissions.getInstance().unarmed(attacker) && attacker.getItemInHand().getTypeId() == 0){ //DMG MODIFIER if(mcUsers.getProfile(attacker).getUnarmedInt() >= 50 && mcUsers.getProfile(attacker).getUnarmedInt() < 100){ defender.setHealth(calculateDamage(defender, 1)); diff --git a/mcMMO/com/gmail/nossr50/mcConfig.java b/mcMMO/com/gmail/nossr50/mcConfig.java index 597a56bb8..88a58c7f9 100644 --- a/mcMMO/com/gmail/nossr50/mcConfig.java +++ b/mcMMO/com/gmail/nossr50/mcConfig.java @@ -11,14 +11,18 @@ public class mcConfig { protected static final Logger log = Logger.getLogger("Minecraft"); static ArrayList adminChatList = new ArrayList(); static ArrayList blockWatchList = new ArrayList(); + static ArrayList treeFeller = new ArrayList(); static ArrayList partyChatList = new ArrayList(); static ArrayList godModeList = new ArrayList(); HashMap arrowTracker = new HashMap(); static ArrayList bleedTracker = new ArrayList(); static ArrayList mobSpawnTracker = new ArrayList(); public boolean isBlockWatched(Block block) {return blockWatchList.contains(block);} + public ArrayList getTreeFeller() {return treeFeller;} public void removeBlockWatch(Block block) {blockWatchList.remove(blockWatchList.indexOf(block));} public void addBlockWatch(Block block) {blockWatchList.add(block);} + public void removeTreeFeller(Block block) {treeFeller.remove(treeFeller.indexOf(block));} + public void addTreeFeller(Block block) {treeFeller.add(block);} public void addBleedTrack(Entity entity) {bleedTracker.add(entity);} public void addMobSpawnTrack(Entity entity) {mobSpawnTracker.add(entity);} public ArrayList getBleedTracked() {return bleedTracker;} diff --git a/mcMMO/com/gmail/nossr50/mcMMO.java b/mcMMO/com/gmail/nossr50/mcMMO.java index d59940eae..ebd334a77 100644 --- a/mcMMO/com/gmail/nossr50/mcMMO.java +++ b/mcMMO/com/gmail/nossr50/mcMMO.java @@ -32,7 +32,7 @@ public class mcMMO extends JavaPlugin { //herp public void onEnable() { - //mcMMO_Timer.schedule(new mcTimer(this), 0, (long)(2000)); + mcMMO_Timer.schedule(new mcTimer(this), 0, (long)(2000)); //Make the directory if it does not exist new File(maindirectory).mkdir(); //Make the file if it does not exist @@ -70,7 +70,7 @@ public class mcMMO extends JavaPlugin { pm.registerEvent(Event.Type.ENTITY_DEATH, entityListener, Priority.Normal, this); pm.registerEvent(Event.Type.BLOCK_FLOW, blockListener, Priority.Normal, this); pm.registerEvent(Event.Type.BLOCK_PLACED, blockListener, Priority.Normal, this); - pm.registerEvent(Event.Type.PLAYER_ITEM, playerListener, Priority.Normal, this); + pm.registerEvent(Event.Type.PLAYER_ITEM, playerListener, Priority.Monitor, this); pm.registerEvent(Event.Type.PLAYER_RESPAWN, playerListener, Priority.Normal, this); pm.registerEvent(Event.Type.PLAYER_ITEM_HELD, playerListener, Priority.Normal, this); pm.registerEvent(Event.Type.ENTITY_DAMAGED, entityListener, Priority.Normal, this); diff --git a/mcMMO/com/gmail/nossr50/mcMining.java b/mcMMO/com/gmail/nossr50/mcMining.java index 9c441bb52..f2a9edf0d 100644 --- a/mcMMO/com/gmail/nossr50/mcMining.java +++ b/mcMMO/com/gmail/nossr50/mcMining.java @@ -126,7 +126,7 @@ public class mcMining { mcUsers.getProfile(player).addMiningGather(40); blockProcCheck(block, player); } - if(mcUsers.getProfile(player).getMiningGatherInt() >= mcUsers.getProfile(player).getXpToLevel("mining")){ + if(player != null && mcUsers.getProfile(player).getMiningGatherInt() >= mcUsers.getProfile(player).getXpToLevel("mining")){ int skillups = 0; while(mcUsers.getProfile(player).getMiningGatherInt() >= mcUsers.getProfile(player).getXpToLevel("mining")){ skillups++; diff --git a/mcMMO/com/gmail/nossr50/mcPermissions.java b/mcMMO/com/gmail/nossr50/mcPermissions.java index 9e5f26668..7464acc5b 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 woodcuttingability(Player player) { + if (permissionsEnabled) { + return permission(player, "mcmmo.ability.woodcutting"); + } else { + return true; + } + } public boolean mcgod(Player player) { if (permissionsEnabled) { return permission(player, "mcmmo.tools.mcgod"); diff --git a/mcMMO/com/gmail/nossr50/mcPlayerListener.java b/mcMMO/com/gmail/nossr50/mcPlayerListener.java index da76d327a..d645f080f 100644 --- a/mcMMO/com/gmail/nossr50/mcPlayerListener.java +++ b/mcMMO/com/gmail/nossr50/mcPlayerListener.java @@ -27,7 +27,7 @@ public class mcPlayerListener extends PlayerListener { Player player = event.getPlayer(); if(player != null){ Location mySpawn = mcUsers.getProfile(player).getMySpawn(player); - if(plugin.getServer().getWorld(mcUsers.getProfile(player).getMySpawnWorld(plugin)) != null) + if(mySpawn != null && plugin.getServer().getWorld(mcUsers.getProfile(player).getMySpawnWorld(plugin)) != null) mySpawn.setWorld(plugin.getServer().getWorld(mcUsers.getProfile(player).getMySpawnWorld(plugin))); if(mcPermissions.getInstance().mySpawn(player) && mySpawn != null){ event.setRespawnLocation(mySpawn); diff --git a/mcMMO/com/gmail/nossr50/mcRepair.java b/mcMMO/com/gmail/nossr50/mcRepair.java index 90a72e409..5dc4afd80 100644 --- a/mcMMO/com/gmail/nossr50/mcRepair.java +++ b/mcMMO/com/gmail/nossr50/mcRepair.java @@ -18,27 +18,21 @@ public class mcRepair { return instance; } public void repairCheck(Player player, ItemStack is, Block block){ - player.sendMessage("mcMMO Debug: The block is an Anvil."); if(block != null && mcPermissions.getInstance().repair(player)){ - player.sendMessage("mcMMO Debug: The block is not null and the player has access to repair."); if(player.getItemInHand().getDurability() > 0){ - player.sendMessage("mcMMO Debug: The item is not at full durability."); /* * ARMOR */ if(isArmor(is)){ - player.sendMessage("mcMMO Debug: The item is armor."); /* * DIAMOND ARMOR */ if(isDiamondArmor(is) && hasDiamond(player) && mcUsers.getProfile(player).getRepairInt() >= 50){ - player.sendMessage("mcMMO Debug: CODE 1"); removeDiamond(player); player.getItemInHand().setDurability(getArmorRepairAmount(is, player)); mcUsers.getProfile(player).addRepairGather(75); } else if (isIronArmor(is) && hasIron(player)){ - player.sendMessage("mcMMO Debug: CODE 2"); /* * IRON ARMOR */ @@ -47,7 +41,6 @@ public class mcRepair { mcUsers.getProfile(player).addRepairGather(20); //GOLD ARMOR } else if (isGoldArmor(is) && hasGold(player)){ - player.sendMessage("mcMMO Debug: CODE 3"); removeGold(player); player.getItemInHand().setDurability(getArmorRepairAmount(is, player)); mcUsers.getProfile(player).addRepairGather(50); @@ -63,7 +56,6 @@ public class mcRepair { * IRON TOOLS */ if(isIronTools(is) && hasIron(player)){ - player.sendMessage("mcMMO Debug: CODE 4"); is.setDurability(getToolRepairAmount(is, player)); removeIron(player); mcUsers.getProfile(player).addRepairGather(20); @@ -71,17 +63,14 @@ public class mcRepair { /* * DIAMOND TOOLS */ - player.sendMessage("mcMMO Debug: CODE 5"); is.setDurability(getToolRepairAmount(is, player)); removeDiamond(player); mcUsers.getProfile(player).addRepairGather(75); } else if(isGoldTools(is) && hasGold(player)){ - player.sendMessage("mcMMO Debug: CODE 6"); is.setDurability(getToolRepairAmount(is, player)); removeGold(player); mcUsers.getProfile(player).addRepairGather(50); } else { - player.sendMessage("mcMMO Debug: CODE 7"); needMoreVespeneGas(is, player); } } diff --git a/mcMMO/com/gmail/nossr50/mcTimer.java b/mcMMO/com/gmail/nossr50/mcTimer.java index 5e9b1e331..f4fcbcafa 100644 --- a/mcMMO/com/gmail/nossr50/mcTimer.java +++ b/mcMMO/com/gmail/nossr50/mcTimer.java @@ -57,6 +57,6 @@ public class mcTimer extends TimerTask{ } else { thecount = 1; } - mcCombat.getInstance().bleedSimulate(); + //mcCombat.getInstance().bleedSimulate(); } } diff --git a/mcMMO/com/gmail/nossr50/mcWoodCutting.java b/mcMMO/com/gmail/nossr50/mcWoodCutting.java index ac1fc2974..4d03370ce 100644 --- a/mcMMO/com/gmail/nossr50/mcWoodCutting.java +++ b/mcMMO/com/gmail/nossr50/mcWoodCutting.java @@ -56,4 +56,12 @@ public class mcWoodCutting { } } } + public void treeFeller(Block block){ + Location loc = block.getLocation(); + int radius = 1; + int typeid = 17; + if(mcm.getInstance().isBlockAround(loc, radius, typeid)){ + + } + } } diff --git a/mcMMO/com/gmail/nossr50/mcm.java b/mcMMO/com/gmail/nossr50/mcm.java index 9405f4ad7..7eeff17f1 100644 --- a/mcMMO/com/gmail/nossr50/mcm.java +++ b/mcMMO/com/gmail/nossr50/mcm.java @@ -311,10 +311,10 @@ public class mcm { player.sendMessage(ChatColor.GRAY+"right click the anvil to interact with it, If you have spare"); player.sendMessage(ChatColor.GRAY+"iron ingots in your inventory the item will be repaired."); player.sendMessage(ChatColor.GRAY+"You cannot hurt other party members"); - player.sendMessage(ChatColor.BLUE+"Set your own spawn with "+ChatColor.RED+"/myspawn"); + player.sendMessage(ChatColor.BLUE+"Set your own spawn with "+ChatColor.RED+"/"+mcLoadProperties.setmyspawn); player.sendMessage(ChatColor.GREEN+"Based on your skills you will get "+ChatColor.DARK_RED+"random procs "+ChatColor.GREEN+ "when"); player.sendMessage(ChatColor.GREEN+"using your profession, like "+ChatColor.DARK_RED+"double drops "+ChatColor.GREEN+"or "+ChatColor.DARK_RED+"better repairs"); - player.sendMessage(ChatColor.GREEN+"Find out mcMMO commands with /mcc"); + player.sendMessage(ChatColor.GREEN+"Find out mcMMO commands with /"+mcLoadProperties.mcc); player.sendMessage(ChatColor.GREEN+"Appreciate the mod? "); player.sendMessage(ChatColor.GREEN+"You can donate via paypal to"+ChatColor.DARK_RED+" nossr50@gmail.com"); } @@ -336,12 +336,13 @@ public class mcm { player.sendMessage(ChatColor.GREEN+"--MYSPAWN COMMANDS--"); player.sendMessage("/"+mcLoadProperties.myspawn+" "+ChatColor.RED+"- Teleports you to your MySpawn"); player.sendMessage("/"+mcLoadProperties.clearmyspawn+" "+ChatColor.RED+"- Clears your MySpawn"); - } - if(mcPermissions.getInstance().adminChat(player)){ - player.sendMessage(ChatColor.GREEN+"--ADMIN COMMANDS--"); - player.sendMessage("/a "+ChatColor.RED+"- Toggle admin chat"); + if(mcPermissions.getInstance().setMySpawn(player)) + player.sendMessage("/"+mcLoadProperties.setmyspawn+" "+ChatColor.RED+"- Set your MySpawn"); } player.sendMessage(ChatColor.GREEN+"--OTHER COMMANDS--"); + if(mcPermissions.getInstance().adminChat(player)){ + player.sendMessage("/a "+ChatColor.RED+"- Toggle admin chat"); + } if(mcPermissions.getInstance().whois(player)) player.sendMessage("/"+mcLoadProperties.whois+" [playername] "+ChatColor.RED+"- View detailed player info"); if(mcPermissions.getInstance().mmoedit(player)){ diff --git a/mcMMO/plugin.yml b/mcMMO/plugin.yml index e90840a97..ff0ef1003 100644 --- a/mcMMO/plugin.yml +++ b/mcMMO/plugin.yml @@ -1,3 +1,3 @@ name: mcMMO main: com.gmail.nossr50.mcMMO -version: 0.8.11 WIP B15 \ No newline at end of file +version: 0.8.11 WIP B16 \ No newline at end of file