All changes up to WIP B16

This commit is contained in:
nossr50 2011-03-07 09:12:52 -08:00
parent a633821158
commit 2ed3d65ed1
13 changed files with 44 additions and 31 deletions

View File

@ -14,7 +14,7 @@ public class mcAcrobatics {
return instance; return instance;
} }
public void acrobaticsCheck(Player player, EntityDamageEvent event, Location loc, int xx, int y, int z){ 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 && mcUsers.getProfile(player).getAcrobaticsInt() < 250
&& mcPermissions.getInstance().acrobatics(player)){ && mcPermissions.getInstance().acrobatics(player)){
if(Math.random() * 10 > 8){ if(Math.random() * 10 > 8){
@ -23,7 +23,7 @@ public class mcAcrobatics {
return; return;
} }
} }
if(mcUsers.getProfile(player).getAcrobaticsInt() >= 250 if(player != null && mcUsers.getProfile(player).getAcrobaticsInt() >= 250
&& mcUsers.getProfile(player).getAcrobaticsInt() < 450 && mcUsers.getProfile(player).getAcrobaticsInt() < 450
&& mcPermissions.getInstance().acrobatics(player)){ && mcPermissions.getInstance().acrobatics(player)){
if(Math.random() * 10 > 6){ if(Math.random() * 10 > 6){
@ -32,7 +32,7 @@ public class mcAcrobatics {
return; return;
} }
} }
if(mcUsers.getProfile(player).getAcrobaticsInt() >= 450 if(player != null && mcUsers.getProfile(player).getAcrobaticsInt() >= 450
&& mcUsers.getProfile(player).getAcrobaticsInt() < 750 && mcUsers.getProfile(player).getAcrobaticsInt() < 750
&& mcPermissions.getInstance().acrobatics(player)){ && mcPermissions.getInstance().acrobatics(player)){
if(Math.random() * 10 > 4){ if(Math.random() * 10 > 4){
@ -41,7 +41,7 @@ public class mcAcrobatics {
return; return;
} }
} }
if(mcUsers.getProfile(player).getAcrobaticsInt() >= 750 if(player != null && mcUsers.getProfile(player).getAcrobaticsInt() >= 750
&& mcUsers.getProfile(player).getAcrobaticsInt() < 950 && mcUsers.getProfile(player).getAcrobaticsInt() < 950
&& mcPermissions.getInstance().acrobatics(player)){ && mcPermissions.getInstance().acrobatics(player)){
if(Math.random() * 10 > 2){ if(Math.random() * 10 > 2){
@ -50,18 +50,18 @@ public class mcAcrobatics {
return; return;
} }
} }
if(mcUsers.getProfile(player).getAcrobaticsInt() >= 950 if(player != null && mcUsers.getProfile(player).getAcrobaticsInt() >= 950
&& mcPermissions.getInstance().acrobatics(player)){ && mcPermissions.getInstance().acrobatics(player)){
event.setCancelled(true); event.setCancelled(true);
player.sendMessage("**ROLLED... LIKE A BOSS**"); player.sendMessage("**ROLLED... LIKE A BOSS**");
return; return;
} }
if(player.getHealth() - event.getDamage() <= 0) if(player != null && player.getHealth() - event.getDamage() <= 0)
return; return;
if(!mcConfig.getInstance().isBlockWatched(loc.getWorld().getBlockAt(xx, y, z)) if(!mcConfig.getInstance().isBlockWatched(loc.getWorld().getBlockAt(xx, y, z))
&& mcPermissions.getInstance().acrobatics(player)){ && mcPermissions.getInstance().acrobatics(player)){
mcUsers.getProfile(player).addAcrobaticsGather(event.getDamage() * 3); 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; int skillups = 0;
while(mcUsers.getProfile(player).getAcrobaticsGatherInt() >= mcUsers.getProfile(player).getXpToLevel("acrobatics")){ while(mcUsers.getProfile(player).getAcrobaticsGatherInt() >= mcUsers.getProfile(player).getXpToLevel("acrobatics")){
skillups++; skillups++;

View File

@ -64,6 +64,9 @@ public class mcBlockListener extends BlockListener {
if(player != null && block.getTypeId() == 17 && mcPermissions.getInstance().woodcutting(player)){ if(player != null && block.getTypeId() == 17 && mcPermissions.getInstance().woodcutting(player)){
mcWoodCutting.getInstance().woodCuttingProcCheck(player, block, loc); mcWoodCutting.getInstance().woodCuttingProcCheck(player, block, loc);
mcUsers.getProfile(player).addWoodcuttingGather(7); mcUsers.getProfile(player).addWoodcuttingGather(7);
if(mcPermissions.getInstance().woodcuttingability(player)){
}
} }
/* /*
* EXCAVATION * EXCAVATION

View File

@ -42,6 +42,7 @@ public class mcCombat {
return; return;
} }
} }
if(defender != null)
mcUsers.getProfile(defender).setRecentlyHurt(30); mcUsers.getProfile(defender).setRecentlyHurt(30);
/* /*
* AXE CRITICAL CHECK * AXE CRITICAL CHECK
@ -51,7 +52,7 @@ public class mcCombat {
bleedCheck(attacker, x); bleedCheck(attacker, x);
} }
int healthbefore = defender.getHealth(); 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 //DMG MODIFIER
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));

View File

@ -11,14 +11,18 @@ public class mcConfig {
protected static final Logger log = Logger.getLogger("Minecraft"); protected static final Logger log = Logger.getLogger("Minecraft");
static ArrayList<String> adminChatList = new ArrayList<String>(); static ArrayList<String> adminChatList = new ArrayList<String>();
static ArrayList<Block> blockWatchList = new ArrayList<Block>(); static ArrayList<Block> blockWatchList = new ArrayList<Block>();
static ArrayList<Block> treeFeller = new ArrayList<Block>();
static ArrayList<String> partyChatList = new ArrayList<String>(); static ArrayList<String> partyChatList = new ArrayList<String>();
static ArrayList<String> godModeList = new ArrayList<String>(); static ArrayList<String> godModeList = new ArrayList<String>();
HashMap<Entity, Integer> arrowTracker = new HashMap<Entity, Integer>(); HashMap<Entity, Integer> arrowTracker = new HashMap<Entity, Integer>();
static ArrayList<Entity> bleedTracker = new ArrayList<Entity>(); static ArrayList<Entity> bleedTracker = new ArrayList<Entity>();
static ArrayList<Entity> mobSpawnTracker = new ArrayList<Entity>(); static ArrayList<Entity> mobSpawnTracker = new ArrayList<Entity>();
public boolean isBlockWatched(Block block) {return blockWatchList.contains(block);} public boolean isBlockWatched(Block block) {return blockWatchList.contains(block);}
public ArrayList<Block> getTreeFeller() {return treeFeller;}
public void removeBlockWatch(Block block) {blockWatchList.remove(blockWatchList.indexOf(block));} public void removeBlockWatch(Block block) {blockWatchList.remove(blockWatchList.indexOf(block));}
public void addBlockWatch(Block block) {blockWatchList.add(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 addBleedTrack(Entity entity) {bleedTracker.add(entity);}
public void addMobSpawnTrack(Entity entity) {mobSpawnTracker.add(entity);} public void addMobSpawnTrack(Entity entity) {mobSpawnTracker.add(entity);}
public ArrayList<Entity> getBleedTracked() {return bleedTracker;} public ArrayList<Entity> getBleedTracked() {return bleedTracker;}

View File

@ -32,7 +32,7 @@ public class mcMMO extends JavaPlugin {
//herp //herp
public void onEnable() { 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 //Make the directory if it does not exist
new File(maindirectory).mkdir(); new File(maindirectory).mkdir();
//Make the file if it does not exist //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.ENTITY_DEATH, entityListener, Priority.Normal, this);
pm.registerEvent(Event.Type.BLOCK_FLOW, blockListener, 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.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_RESPAWN, playerListener, Priority.Normal, this);
pm.registerEvent(Event.Type.PLAYER_ITEM_HELD, 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); pm.registerEvent(Event.Type.ENTITY_DAMAGED, entityListener, Priority.Normal, this);

View File

@ -126,7 +126,7 @@ public class mcMining {
mcUsers.getProfile(player).addMiningGather(40); mcUsers.getProfile(player).addMiningGather(40);
blockProcCheck(block, player); 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; int skillups = 0;
while(mcUsers.getProfile(player).getMiningGatherInt() >= mcUsers.getProfile(player).getXpToLevel("mining")){ while(mcUsers.getProfile(player).getMiningGatherInt() >= mcUsers.getProfile(player).getXpToLevel("mining")){
skillups++; skillups++;

View File

@ -37,6 +37,13 @@ public class mcPermissions {
return true; return true;
} }
} }
public boolean woodcuttingability(Player player) {
if (permissionsEnabled) {
return permission(player, "mcmmo.ability.woodcutting");
} else {
return true;
}
}
public boolean mcgod(Player player) { public boolean mcgod(Player player) {
if (permissionsEnabled) { if (permissionsEnabled) {
return permission(player, "mcmmo.tools.mcgod"); return permission(player, "mcmmo.tools.mcgod");

View File

@ -27,7 +27,7 @@ public class mcPlayerListener extends PlayerListener {
Player player = event.getPlayer(); Player player = event.getPlayer();
if(player != null){ if(player != null){
Location mySpawn = mcUsers.getProfile(player).getMySpawn(player); 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))); mySpawn.setWorld(plugin.getServer().getWorld(mcUsers.getProfile(player).getMySpawnWorld(plugin)));
if(mcPermissions.getInstance().mySpawn(player) && mySpawn != null){ if(mcPermissions.getInstance().mySpawn(player) && mySpawn != null){
event.setRespawnLocation(mySpawn); event.setRespawnLocation(mySpawn);

View File

@ -18,27 +18,21 @@ public class mcRepair {
return instance; return instance;
} }
public void repairCheck(Player player, ItemStack is, Block block){ public void repairCheck(Player player, ItemStack is, Block block){
player.sendMessage("mcMMO Debug: The block is an Anvil.");
if(block != null if(block != null
&& mcPermissions.getInstance().repair(player)){ && 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){ if(player.getItemInHand().getDurability() > 0){
player.sendMessage("mcMMO Debug: The item is not at full durability.");
/* /*
* ARMOR * ARMOR
*/ */
if(isArmor(is)){ if(isArmor(is)){
player.sendMessage("mcMMO Debug: The item is armor.");
/* /*
* DIAMOND ARMOR * DIAMOND ARMOR
*/ */
if(isDiamondArmor(is) && hasDiamond(player) && mcUsers.getProfile(player).getRepairInt() >= 50){ if(isDiamondArmor(is) && hasDiamond(player) && mcUsers.getProfile(player).getRepairInt() >= 50){
player.sendMessage("mcMMO Debug: CODE 1");
removeDiamond(player); removeDiamond(player);
player.getItemInHand().setDurability(getArmorRepairAmount(is, player)); player.getItemInHand().setDurability(getArmorRepairAmount(is, player));
mcUsers.getProfile(player).addRepairGather(75); mcUsers.getProfile(player).addRepairGather(75);
} else if (isIronArmor(is) && hasIron(player)){ } else if (isIronArmor(is) && hasIron(player)){
player.sendMessage("mcMMO Debug: CODE 2");
/* /*
* IRON ARMOR * IRON ARMOR
*/ */
@ -47,7 +41,6 @@ public class mcRepair {
mcUsers.getProfile(player).addRepairGather(20); mcUsers.getProfile(player).addRepairGather(20);
//GOLD ARMOR //GOLD ARMOR
} else if (isGoldArmor(is) && hasGold(player)){ } else if (isGoldArmor(is) && hasGold(player)){
player.sendMessage("mcMMO Debug: CODE 3");
removeGold(player); removeGold(player);
player.getItemInHand().setDurability(getArmorRepairAmount(is, player)); player.getItemInHand().setDurability(getArmorRepairAmount(is, player));
mcUsers.getProfile(player).addRepairGather(50); mcUsers.getProfile(player).addRepairGather(50);
@ -63,7 +56,6 @@ public class mcRepair {
* IRON TOOLS * IRON TOOLS
*/ */
if(isIronTools(is) && hasIron(player)){ if(isIronTools(is) && hasIron(player)){
player.sendMessage("mcMMO Debug: CODE 4");
is.setDurability(getToolRepairAmount(is, player)); is.setDurability(getToolRepairAmount(is, player));
removeIron(player); removeIron(player);
mcUsers.getProfile(player).addRepairGather(20); mcUsers.getProfile(player).addRepairGather(20);
@ -71,17 +63,14 @@ public class mcRepair {
/* /*
* DIAMOND TOOLS * DIAMOND TOOLS
*/ */
player.sendMessage("mcMMO Debug: CODE 5");
is.setDurability(getToolRepairAmount(is, player)); is.setDurability(getToolRepairAmount(is, player));
removeDiamond(player); removeDiamond(player);
mcUsers.getProfile(player).addRepairGather(75); mcUsers.getProfile(player).addRepairGather(75);
} else if(isGoldTools(is) && hasGold(player)){ } else if(isGoldTools(is) && hasGold(player)){
player.sendMessage("mcMMO Debug: CODE 6");
is.setDurability(getToolRepairAmount(is, player)); is.setDurability(getToolRepairAmount(is, player));
removeGold(player); removeGold(player);
mcUsers.getProfile(player).addRepairGather(50); mcUsers.getProfile(player).addRepairGather(50);
} else { } else {
player.sendMessage("mcMMO Debug: CODE 7");
needMoreVespeneGas(is, player); needMoreVespeneGas(is, player);
} }
} }

View File

@ -57,6 +57,6 @@ public class mcTimer extends TimerTask{
} else { } else {
thecount = 1; thecount = 1;
} }
mcCombat.getInstance().bleedSimulate(); //mcCombat.getInstance().bleedSimulate();
} }
} }

View File

@ -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)){
}
}
} }

View File

@ -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+"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+"iron ingots in your inventory the item will be repaired.");
player.sendMessage(ChatColor.GRAY+"You cannot hurt other party members"); 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+"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+"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+"Appreciate the mod? ");
player.sendMessage(ChatColor.GREEN+"You can donate via paypal to"+ChatColor.DARK_RED+" nossr50@gmail.com"); 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(ChatColor.GREEN+"--MYSPAWN COMMANDS--");
player.sendMessage("/"+mcLoadProperties.myspawn+" "+ChatColor.RED+"- Teleports you to your MySpawn"); player.sendMessage("/"+mcLoadProperties.myspawn+" "+ChatColor.RED+"- Teleports you to your MySpawn");
player.sendMessage("/"+mcLoadProperties.clearmyspawn+" "+ChatColor.RED+"- Clears your MySpawn"); player.sendMessage("/"+mcLoadProperties.clearmyspawn+" "+ChatColor.RED+"- Clears your MySpawn");
} if(mcPermissions.getInstance().setMySpawn(player))
if(mcPermissions.getInstance().adminChat(player)){ player.sendMessage("/"+mcLoadProperties.setmyspawn+" "+ChatColor.RED+"- Set your MySpawn");
player.sendMessage(ChatColor.GREEN+"--ADMIN COMMANDS--");
player.sendMessage("/a "+ChatColor.RED+"- Toggle admin chat");
} }
player.sendMessage(ChatColor.GREEN+"--OTHER COMMANDS--"); player.sendMessage(ChatColor.GREEN+"--OTHER COMMANDS--");
if(mcPermissions.getInstance().adminChat(player)){
player.sendMessage("/a "+ChatColor.RED+"- Toggle admin chat");
}
if(mcPermissions.getInstance().whois(player)) if(mcPermissions.getInstance().whois(player))
player.sendMessage("/"+mcLoadProperties.whois+" [playername] "+ChatColor.RED+"- View detailed player info"); player.sendMessage("/"+mcLoadProperties.whois+" [playername] "+ChatColor.RED+"- View detailed player info");
if(mcPermissions.getInstance().mmoedit(player)){ if(mcPermissions.getInstance().mmoedit(player)){

View File

@ -1,3 +1,3 @@
name: mcMMO name: mcMMO
main: com.gmail.nossr50.mcMMO main: com.gmail.nossr50.mcMMO
version: 0.8.11 WIP B15 version: 0.8.11 WIP B16