All changes up to 0.9.12

This commit is contained in:
nossr50 2011-03-29 16:56:29 -07:00
parent b0f6e6267a
commit 596f504320
21 changed files with 3050 additions and 1260 deletions

View File

@ -1,5 +1,182 @@
Changelog:
#Versions without changelogs probably had very small misc fixes, like tweaks to the source code#
Version 0.9.12
mcMMO now fakes a block break event for abilities to maximize plugin compatibility
/herbalism will return the correct values now
New /addxp command
Version 0.9.11
PVE Combat Skills experience is now based on damage dealt
The Timer will no longer break from Bleed Simulation
Tree feller no longer "damages" saplings
Bleed+ (Serrated Strikes) lasts 5 ticks down from 12
Bleed/Bleed+ now do 2 damage instead of 1
Power Level is now based on permissions
Counter Attack added to swords
Parry is now based directly on Swords skill level
Parry maximum proc chance raised to 30% from 20%
Serrated Strikes now properly applies Bleed+ to targets
Players who parry can no longer be disarmed
Acrobatics now has a Dodge passive skill reducing damage
Repair skill now effects how much durability is restored
Super repair now doubles the repair amount on proc
Unarmed now starts with a bonus to damage to encourage use
Unarmed now has two steps to damage scaling, Appentice, and Mastery
Unarmed disarm now caps at 25% for 1000 skill
Fixed problem where Archery skill procs would ignore other plugins
Ignition changed to 25% chance
Ignition length will be based on archery skill level
/myspawn now has a warning about the inventory loss penalty in /mcc
mcMMO Timer now runs in 1 second intervals rather than 2
Version 0.9.10
Party invites now show who they are from
Mushrooms added to Dirt/Grass excavation loot tables, drops with 500+ skill
mcMMO configuration files property setting names have been changed for readability
Fixed bug where Gold and Iron wouldn't drop anything during Super Breaker
Added /mcability info to /mcc
Potentially fixed NPE error when checking players for being in same party for PVP XP
Removed sand specific diamond drop from sand excavation loot table, Diamonds can still drop globally for sand
Added a global XP gain multiplier, increase it to increase XP gained
Reduced PVE XP for Unarmed, now identical to Axes/Swords
Changed Chat priority in mcMMO to be higher, this should help plugin conflicts
Mushroom XP raised to 40 from 10
Flower XP raised to 10 from 3
Version 0.9.9
Fixed problem where entities never got removed from the arrow retrieval list of entities
Version 0.9.8
EntityLiving shouldn't be cast to entities that are not an instance of EntityLiving
Added a null check in the timer for players being null before proceeding
Version 0.9.7
Procs/XP Gain will no longer happen when the Entity is immune to damage (Thanks EdwardHand!)
Axes critical damage versus players reduced to 150% damage from 200% damage
Fixed bug where Daze might not proc
Changed archery Daze to follow smooth transition
Added archery Daze chance info to /archery
Cooldown lengths are now customizable, they are in seconds and multiplied by 2 by mcMMO
Version 0.9.6
Timer checks for player being null before adding them to the mcUsers system
Cooldowns will now show how much time is remaining when trying to use their respective abilities
SkullSpliiter will now correctly inform the player when they are too tired to use it
Acrobatics will no longer give XP if the event was cancelled by another plugin
Version 0.9.5
Super Breaker now gives a chance for Triple Drops based on mining skill
Ability durability loss down from 15 to 2
Ability durability loss is now toggle-able
Ability durability loss can be adjusted in the configuration file
Mining Picks are no longer lowered after activating Super Breaker
Version 0.9.4
Flowers won't drop wheat anymore
Signs won't trigger ability readiness anymore
Version 0.9.3
Bug stopping abilities from never wearing of may have been fixed
Changed color of "X Ability has worn off" to RED from GRAY
Super Breaker, Giga Drill Breaker, and Tree Feller now damage the tool significantly during use
Netherrack and Glowstone now give Mining XP
Netherrack and Glowstone are now effected by Super Breaker
Abilities will no longer be readied when you right click signs or beds
Chimaera Wings won't activate on blocks you can interact with and signs
Abilities now adjust their effects depending on tool quality
Superbreaker won't break things that tool couldn't normally break
Giga Drill Breaker will only give triple xp and triple drops for diamond tools, with a reduced effect for lesser tools
Skull Splitter now has a limit of opponents nearby it will strike based on your tool quality
Serrated Strikes now has a limit of opponents nearby it will strike based on your tool quality
Modified /mcmmo description to be a little bit more relevant.
Version 0.9.2
Changed priority of some of the mcMMO listeners
Now when certain abilities are activated it shouldn't say "You lower your x"
Version 0.9.1
Fixed "Unknown console command" errors with CB 556
Added /mcability command to toggle being able to trigger abilities with right click
Added some more nullchecks for people reporting NPE errors
Compatibility with NPC mods improved (Mainly for archery!)
Other plugins can now call inSameParty() from mcMMO to increase compatibility
Version 0.9
--NEW CONTENT--
Woodcutting now has the "Tree Feller" Ability
Unarmed now has the "Berserk" Ability
Swords now has the "Serrated Strikes" Ability
Mining now has the "Super Breaker" Ability
Axes now has the "Skull Splitter" Ability
Excavation now has the "Giga Drill Breaker" Ability
Added /mcrefresh <playername> - tool for refreshing cooldowns
Unarmed now has the "Deflect Arrows" passive skill
Chimaera Wing Item Added
--CHANGES--
HP Regen & Bleed are back
Woodcutting will drop the appropriate log on double drop procs
Herbalism now applies double drops to herbs
/<skillname> now shows much more information to the player regarding their stats
Axes skill Critical Strikes are now based directly on your skill level
Swords skill Bleed chance is now based directly on your skill level
Unarmed disarm chance is now based directly on your skill level
Acrobatics now gives XP when you roll
--BUGFIXES--
Memory Leak Fixed
Axes not doing critical strikes
Gold Armor repair
Capped skills now have the correct proc chance
/mmoedit is no longer case sensitive
More NPE errors fixed
Many bugs I forgot to write down
--PLUGIN COMPATABILITY FIXES--
If combat interactions are cancelled by other plugins mcMMO should ignore the event
If block damage interactions are cancelled by other plugins mcMMO should ignore the event
Version 0.8.22
Fixed bug where Axes did less damage than normal
Acrobatic rolls now give XP
Acrobatics XP increased for non-rolls
Version 0.8.21
Fixed bug where axe criticals would dupe items
Version 0.8.20
99.99% sure I fixed anvils that suddenly stop working
Version 0.8.19
Fixed being able to excavate placed blocks
Added toggle option to mining requiring a pickaxe
Added toggle option to woodcutting requiring an axe
PVP interactions now reward XP based on the damage caused (this is effected by skills)
PVP XP gain can be disabled in the configuration file
PVP XP has a modifier, increase the modifier for higher XP rewards from PVP combat
Version 0.8.18
Fixed sandstone not being watched for exploitation
Version 0.8.17
mcmmo.users moved to plugins/mcMMO/
Snowballs and Eggs will no longer trigger Ignition
Loot tables for excavation adjusted
Mining benefits now require the player to be holding a mining pick
Woodcutting benefits now require the player to be holding an axe
Version 0.8.16
Moved configuration file to /plugins/mcMMO
Arrows now have a chance to Ignite enemiesw
Fixed arrows not being retrievable from corpses
Added info about ignition to /archery
Version 0.8.14
Mining, Woodcutting, Herbalism, and Acrobatics proc rates now are based on your skill level directly rather than tiers you unlock via skill levels
Archery's ability to retrieve arrows from corpses now is based on your skill level directly rather than tiers you unlock via skill levels
Mining, Woodcutting, Herbalism, Archery, and Acrobatics now show their proc % relative to your skill if you type /<skillname>
You can now adjust what level is required to repair diamond in the configuration file
Changed mining XP rates to be a tad higher for some things
You can now get XP from sandstone
XP rates increased for gathering glowstone with excavation
XP rates increased a bit for excavation
Skill info is now a bit more detailed for certain skills
Added info about arrow retrieval to /archery
Version 0.8.13
Enemies no longer look like they have frozen when they die
Item duping fix
Version 0.8.11
Performance improvements
Memory leak fixed

View File

@ -1,6 +1,5 @@
package com.gmail.nossr50;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import org.bukkit.event.entity.EntityDamageEvent;
@ -14,68 +13,33 @@ public class mcAcrobatics {
return instance;
}
public void acrobaticsCheck(Player player, EntityDamageEvent event, Location loc, int xx, int y, int z){
if(player != null && mcUsers.getProfile(player).getAcrobaticsInt() >= 50
&& mcUsers.getProfile(player).getAcrobaticsInt() < 250
&& mcPermissions.getInstance().acrobatics(player)){
if(Math.random() * 10 > 8){
event.setCancelled(true);
if(player != null){
if(Math.random() * 1000 <= mcUsers.getProfile(player).getAcrobaticsInt()){
player.sendMessage("**ROLLED**");
if(!mcConfig.getInstance().isBlockWatched(loc.getWorld().getBlockAt(xx, y, z))
&& mcPermissions.getInstance().acrobatics(player)){
if(!event.isCancelled())
mcUsers.getProfile(player).addAcrobaticsGather((event.getDamage() * 8) * mcLoadProperties.xpGainMultiplier);
mcSkills.getInstance().XpCheck(player);
event.setCancelled(true);
}
return;
}
}
if(player != null && mcUsers.getProfile(player).getAcrobaticsInt() >= 250
&& mcUsers.getProfile(player).getAcrobaticsInt() < 450
&& mcPermissions.getInstance().acrobatics(player)){
if(Math.random() * 10 > 6){
event.setCancelled(true);
player.sendMessage("**ROLLED**");
return;
}
}
if(player != null && mcUsers.getProfile(player).getAcrobaticsInt() >= 450
&& mcUsers.getProfile(player).getAcrobaticsInt() < 750
&& mcPermissions.getInstance().acrobatics(player)){
if(Math.random() * 10 > 4){
event.setCancelled(true);
player.sendMessage("**ROLLED**");
return;
}
}
if(player != null && mcUsers.getProfile(player).getAcrobaticsInt() >= 750
&& mcUsers.getProfile(player).getAcrobaticsInt() < 950
&& mcPermissions.getInstance().acrobatics(player)){
if(Math.random() * 10 > 2){
event.setCancelled(true);
player.sendMessage("**BARREL ROLLED**");
return;
}
}
if(player != null && mcUsers.getProfile(player).getAcrobaticsInt() >= 950
&& mcPermissions.getInstance().acrobatics(player)){
event.setCancelled(true);
player.sendMessage("**ROLLED... LIKE A BOSS**");
return;
}
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(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++;
mcUsers.getProfile(player).removeAcrobaticsGather(mcUsers.getProfile(player).getXpToLevel("acrobatics"));
mcUsers.getProfile(player).skillUpAcrobatics(1);
if(!event.isCancelled())
mcUsers.getProfile(player).addAcrobaticsGather(event.getDamage() * 8);
mcUsers.getProfile(player).addAcrobaticsGather((event.getDamage() * 12) * mcLoadProperties.xpGainMultiplier);
mcSkills.getInstance().XpCheck(player);
mcConfig.getInstance().addBlockWatch(loc.getWorld().getBlockAt(xx, y, z));
if(player.getHealth() - event.getDamage() <= 0){
if(mcUsers.getProfile(player).isDead())
return;
mcUsers.getProfile(player).setDead(true);
}
player.sendMessage(ChatColor.YELLOW+"Acrobatics skill increased by "+skillups+"."+" Total ("+mcUsers.getProfile(player).getAcrobatics()+")");
}
mcConfig.getInstance().addBlockWatch(loc.getWorld().getBlockAt(xx, y, z));
if(player.getHealth() - event.getDamage() <= 0){
if(mcUsers.getProfile(player).isDead())
return;
mcUsers.getProfile(player).setDead(true);
}
}
}

View File

@ -2,13 +2,17 @@ package com.gmail.nossr50;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.block.BlockDamageEvent;
import org.bukkit.event.block.BlockFromToEvent;
import org.bukkit.event.block.BlockListener;
import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.event.block.BlockRightClickEvent;
import org.bukkit.inventory.ItemStack;
public class mcBlockListener extends BlockListener {
private final mcMMO plugin;
@ -16,80 +20,178 @@ public class mcBlockListener extends BlockListener {
public mcBlockListener(final mcMMO plugin) {
this.plugin = plugin;
}
public void onBlockPlace(BlockPlaceEvent event) {
Block block;
if (event.getBlockReplacedState().getTypeId() == 78) {
block = event.getBlockAgainst();
Player player = event.getPlayer();
if (event.getBlock() != null && event.getBlockReplacedState() != null && event.getBlockReplacedState().getTypeId() == 78) {
block = event.getBlockAgainst();
}
else {
block = event.getBlock();
block = event.getBlock();
}
int x = block.getX();
int y = block.getY();
int z = block.getZ();
String xyz = x+","+y+","+z;
if(mcm.getInstance().shouldBeWatched(block))
mcConfig.getInstance().addBlockWatch(block);
if(player != null && mcm.getInstance().shouldBeWatched(block))
mcConfig.getInstance().addBlockWatch(block);
if(block.getTypeId() == 42 && mcLoadProperties.anvilmessages)
event.getPlayer().sendMessage(ChatColor.DARK_RED+"You have placed an anvil, anvils can repair tools and armor.");
}
public void onBlockRightClick(BlockRightClickEvent event) {
Block block = event.getBlock();
Player player = event.getPlayer();
ItemStack is = player.getItemInHand();
if(mcPermissions.getInstance().unarmed(player) && player.getItemInHand().getTypeId() == 0 && mcm.getInstance().abilityBlockCheck(block) && mcUsers.getProfile(player).getAbilityUse()){
mcSkills.getInstance().abilityActivationCheck(player, block);
}
if(block != null && player != null && mcPermissions.getInstance().repair(player) && event.getBlock().getTypeId() == 42){
mcRepair.getInstance().repairCheck(player, is, event.getBlock());
}
}
//put all Block related code here
public void onBlockDamage(BlockDamageEvent event) {
//STARTED(0), DIGGING(1), BROKEN(3), STOPPED(2);
Player player = event.getPlayer();
//player.sendMessage("mcMMO DEBUG: EVENT-OK DMG LEVEL ("+event.getDamageLevel().getLevel()+")");
Block block = event.getBlock();
int x = block.getX();
int y = block.getY();
int z = block.getZ();
String xyz = x+","+y+","+z;
Location loc = block.getLocation();
int dmg = event.getDamageLevel().getLevel();
/*
* HERBALISM
*/
if(dmg == 3){
if(mcPermissions.getInstance().herbalism(player))
mcHerbalism.getInstance().herbalismProcCheck(block, player);
if(event.isCancelled())
return;
//STARTED(0), DIGGING(1), BROKEN(3), STOPPED(2);
Player player = event.getPlayer();
ItemStack inhand = player.getItemInHand();
//player.sendMessage("mcMMO DEBUG: EVENT-OK DMG LEVEL ("+event.getDamageLevel().getLevel()+")");
Block block = event.getBlock();
Location loc = block.getLocation();
int dmg = event.getDamageLevel().getLevel();
/*
* ABILITY PREPARATION CHECKS
*/
if(mcUsers.getProfile(player).getAxePreparationMode() && block.getTypeId() == 17)
mcWoodCutting.getInstance().treeFellerCheck(player, block);
if(mcUsers.getProfile(player).getPickaxePreparationMode())
mcMining.getInstance().superBreakerCheck(player, block);
if(mcUsers.getProfile(player).getShovelPreparationMode() && mcExcavation.getInstance().canBeGigaDrillBroken(block))
mcExcavation.getInstance().gigaDrillBreakerActivationCheck(player, block);
if(mcUsers.getProfile(player).getFistsPreparationMode() && mcExcavation.getInstance().canBeGigaDrillBroken(block))
mcSkills.getInstance().berserkActivationCheck(player);
/*
* GIGA DRILL BREAKER CHECKS
*/
if(mcm.getInstance().blockBreakSimulate(block, player, plugin) && mcUsers.getProfile(player).getGigaDrillBreakerMode() && dmg == 0 && mcExcavation.getInstance().canBeGigaDrillBroken(block) && mcm.getInstance().isShovel(inhand)){
if(mcm.getInstance().getTier(player) >= 2)
mcExcavation.getInstance().excavationProcCheck(block, player);
if(mcm.getInstance().getTier(player) >= 3)
mcExcavation.getInstance().excavationProcCheck(block, player);
if(mcm.getInstance().getTier(player) >= 4)
mcExcavation.getInstance().excavationProcCheck(block, player);
Material mat = Material.getMaterial(block.getTypeId());
if(block.getTypeId() == 2)
mat = Material.DIRT;
byte type = block.getData();
ItemStack item = new ItemStack(mat, 1, (byte)0, type);
block.setType(Material.AIR);
if(mcLoadProperties.toolsLoseDurabilityFromAbilities)
mcm.getInstance().damageTool(player, (short) mcLoadProperties.abilityDurabilityLoss);
block.getLocation().getWorld().dropItemNaturally(block.getLocation(), item);
}
/*
* BERSERK MODE CHECKS
*/
if(mcUsers.getProfile(player).getBerserkMode() && player.getItemInHand().getTypeId() == 0 && dmg == 0 && mcExcavation.getInstance().canBeGigaDrillBroken(block)){
Material mat = Material.getMaterial(block.getTypeId());
if(block.getTypeId() == 2)
mat = Material.DIRT;
byte type = block.getData();
ItemStack item = new ItemStack(mat, 1, (byte)0, type);
block.setType(Material.AIR);
block.getLocation().getWorld().dropItemNaturally(block.getLocation(), item);
}
/*
* SUPER BREAKER CHECKS
*/
if(mcm.getInstance().blockBreakSimulate(block, player, plugin) && mcUsers.getProfile(player).getSuperBreakerMode() && dmg == 0 && mcMining.getInstance().canBeSuperBroken(block)){
if(mcLoadProperties.miningrequirespickaxe){
if(mcm.getInstance().isMiningPick(inhand))
mcMining.getInstance().SuperBreakerBlockCheck(player, block);
} else {
mcMining.getInstance().SuperBreakerBlockCheck(player, block);
}
}
/*
* HERBALISM
*/
if(dmg == 3){
if(mcPermissions.getInstance().herbalism(player))
mcHerbalism.getInstance().herbalismProcCheck(block, player);
}
if(player != null && dmg == 2 && !mcConfig.getInstance().isBlockWatched(block)){
/*
* MINING
*/
if(player != null && dmg == 2 && !mcConfig.getInstance().isBlockWatched(block)){
if(mcPermissions.getInstance().mining(player))
mcMining.getInstance().miningBlockCheck(player, block);
/*
* WOOD CUTTING
*/
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
*/
if(mcPermissions.getInstance().excavation(player) && block != null && player != null)
mcExcavation.getInstance().excavationProcCheck(block, player);
/*
* EXPLOIT COUNTERMEASURES
*/
mcConfig.getInstance().addBlockWatch(block);
if(player != null && mcUsers.getProfile(player).getWoodCuttingGatherInt() >= mcUsers.getProfile(player).getXpToLevel("woodcutting")){
int skillups = 0;
while(mcUsers.getProfile(player).getWoodCuttingGatherInt() >= mcUsers.getProfile(player).getXpToLevel("woodcutting")){
skillups++;
mcUsers.getProfile(player).removeWoodCuttingGather(mcUsers.getProfile(player).getXpToLevel("woodcutting"));
mcUsers.getProfile(player).skillUpWoodCutting(1);
}
player.sendMessage(ChatColor.YELLOW+"WoodCutting skill increased by "+skillups+"."+" Total ("+mcUsers.getProfile(player).getWoodCutting()+")");
}
* MINING
*/
if(mcPermissions.getInstance().mining(player)){
if(mcLoadProperties.miningrequirespickaxe){
if(mcm.getInstance().isMiningPick(inhand))
mcMining.getInstance().miningBlockCheck(player, block);
} else {
mcMining.getInstance().miningBlockCheck(player, block);
}
}
/*
* WOOD CUTTING
*/
if(player != null && block.getTypeId() == 17 && mcPermissions.getInstance().woodcutting(player)){
if(mcLoadProperties.woodcuttingrequiresaxe){
if(mcm.getInstance().isAxes(inhand)){
mcWoodCutting.getInstance().woodCuttingProcCheck(player, block, loc);
mcUsers.getProfile(player).addWoodcuttingGather(7 * mcLoadProperties.xpGainMultiplier);
}
} else {
mcWoodCutting.getInstance().woodCuttingProcCheck(player, block, loc);
mcUsers.getProfile(player).addWoodcuttingGather(7 * mcLoadProperties.xpGainMultiplier);
}
mcSkills.getInstance().XpCheck(player);
/*
* IF PLAYER IS USING TREEFELLER
*/
if(mcm.getInstance().blockBreakSimulate(block, player, plugin) && mcPermissions.getInstance().woodCuttingAbility(player) && mcUsers.getProfile(player).getTreeFellerMode() && block.getTypeId() == 17){
mcWoodCutting.getInstance().treeFeller(block, player);
for(Block blockx : mcConfig.getInstance().getTreeFeller()){
if(blockx != null){
Material mat = Material.getMaterial(block.getTypeId());
byte type = 0;
if(block.getTypeId() == 17)
type = block.getData();
ItemStack item = new ItemStack(mat, 1, (byte)0, type);
if(blockx.getTypeId() == 17){
blockx.getLocation().getWorld().dropItemNaturally(blockx.getLocation(), item);
mcWoodCutting.getInstance().woodCuttingProcCheck(player, blockx, blockx.getLocation());
mcUsers.getProfile(player).addWoodcuttingGather(7);
}
if(blockx.getTypeId() == 18){
mat = Material.getMaterial(6);
item = new ItemStack(mat, 1, (byte)0, (byte) 0);
if(Math.random() * 10 > 8)
blockx.getLocation().getWorld().dropItemNaturally(blockx.getLocation(), item);
}
block.setType(Material.AIR);
}
}
if(mcLoadProperties.toolsLoseDurabilityFromAbilities)
mcm.getInstance().damageTool(player, (short) mcLoadProperties.abilityDurabilityLoss);
/*
* NOTE TO SELF
* I NEED TO REMOVE TREE FELL BLOCKS FROM BEING WATCHED AFTER THIS CODE IS EXECUTED
* OR ELSE IT COULD BE A MEMORY LEAK SITUATION
*/
mcConfig.getInstance().clearTreeFeller();
}
}
/*
* EXCAVATION
*/
if(mcPermissions.getInstance().excavation(player) && block != null && player != null)
mcExcavation.getInstance().excavationProcCheck(block, player);
}
}
public void onBlockFlow(BlockFromToEvent event) {
//Code borrowed from WorldGuard by sk89q
World world = event.getBlock().getWorld();

File diff suppressed because it is too large Load Diff

View File

@ -17,7 +17,73 @@ public class mcConfig {
HashMap<Entity, Integer> arrowTracker = new HashMap<Entity, Integer>();
static ArrayList<Entity> bleedTracker = new ArrayList<Entity>();
static ArrayList<Entity> mobSpawnTracker = new ArrayList<Entity>();
/*
* The Bleed Que Stuff
*/
public Entity[] bleedQue = new Entity[20];
public int bleedQuePos = 0;
public void addToBleedQue(Entity entity){
//Assign entity to empty position
bleedQue[bleedQuePos] = entity;
//Move position up by 1 increment
bleedQuePos++;
//Check if array is full
if(bleedQuePos >= bleedQue.length){
//Create new temporary array
Entity[] temp = new Entity[bleedQue.length*2];
//Copy data from bleedQue to temporary array
System.arraycopy(bleedQue, 0, temp, 0, bleedQue.length);
//Point bleedQue to new array
bleedQue = temp;
}
}
public Entity[] getBleedQue(){return bleedQue;}
public void clearBleedQue(){
bleedQue = new Entity[bleedQue.length];
setBleedQuePos(0);
}
public void setBleedQuePos(int x){bleedQuePos = x;}
/*
* The Bleed Removal Que Stuff
*/
public Entity[] bleedRemovalQue = new Entity[20];
public int bleedRemovalQuePos = 0;
public void addToBleedRemovalQue(Entity entity){
//Assign entity to empty position
bleedRemovalQue[bleedRemovalQuePos] = entity;
//Move position up by 1 increment
bleedRemovalQuePos++;
//Check if array is full
if(bleedRemovalQuePos >= bleedRemovalQue.length){
//Create new temporary array
Entity[] temp = new Entity[bleedRemovalQue.length*2];
//Copy data from bleedRemovalQue to temporary array
System.arraycopy(bleedRemovalQue, 0, temp, 0, bleedRemovalQue.length);
//Point bleedRemovalQue to new array
bleedRemovalQue = temp;
}
}
public Entity[] getBleedRemovalQue(){return bleedRemovalQue;}
public void clearBleedRemovalQue(){
bleedQue = new Entity[bleedRemovalQue.length];
setBleedQuePos(0);
}
public void setBleedRemovalQuePos(int x){bleedRemovalQuePos = x;}
public boolean isBlockWatched(Block block) {return blockWatchList.contains(block);}
public boolean isTreeFellerWatched(Block block) {return treeFeller.contains(block);}
public ArrayList<Block> getTreeFeller() {return treeFeller;}
public void removeBlockWatch(Block block) {blockWatchList.remove(blockWatchList.indexOf(block));}
public void addBlockWatch(Block block) {blockWatchList.add(block);}
@ -25,12 +91,21 @@ public class mcConfig {
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 void removeMobSpawnTrack(Entity entity) {mobSpawnTracker.remove(entity);}
public ArrayList<Entity> getBleedTracked() {return bleedTracker;}
public void addArrowTrack(Entity entity, Integer arrowcount) {arrowTracker.put(entity, arrowcount);}
public Integer getArrowCount(Entity entity) {return arrowTracker.get(entity);}
public void removeArrowTracked(Entity entity){
if(arrowTracker.containsKey(entity)){
arrowTracker.remove(entity);
}
}
public void removeBleedTrack(Entity entity){
bleedTracker.remove(entity);
}
public void clearTreeFeller(){
treeFeller.clear();
}
public void setBleedCount(Entity entity, Integer newvalue){
bleedTracker.add(entity);
}

View File

@ -1,7 +1,12 @@
package com.gmail.nossr50;
import net.minecraft.server.EntityLiving;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.craftbukkit.entity.CraftEntity;
import org.bukkit.entity.Animals;
import org.bukkit.entity.Arrow;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Monster;
import org.bukkit.entity.Player;
@ -13,6 +18,7 @@ import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.entity.EntityDeathEvent;
import org.bukkit.event.entity.EntityListener;
import org.bukkit.inventory.ItemStack;
import org.bukkit.util.Vector;
public class mcEntityListener extends EntityListener {
private final mcMMO plugin;
@ -35,6 +41,14 @@ public class mcEntityListener extends EntityListener {
}
}
public void onEntityDamage(EntityDamageEvent event) {
/*
* CHECK FOR INVULNERABILITY
*/
if(event.getEntity() instanceof CraftEntity){
CraftEntity cEntity = (CraftEntity)event.getEntity();
if(cEntity.getHandle() instanceof EntityLiving){
EntityLiving entityliving = (EntityLiving)cEntity.getHandle();
if(entityliving.noDamageTicks < entityliving.maxNoDamageTicks/2.0F){
Entity x = event.getEntity();
DamageCause type = event.getCause();
/*
@ -50,42 +64,65 @@ public class mcEntityListener extends EntityListener {
mcAcrobatics.getInstance().acrobaticsCheck(player, event, loc, xx, y, z);
}
}
/*
* ARCHERY CHECKS
*/
if(event instanceof EntityDamageByProjectileEvent){
EntityDamageByProjectileEvent c = (EntityDamageByProjectileEvent)event;
mcCombat.getInstance().archeryCheck(c);
}
/*
* Entity Damage by Entity checks
*/
if(event instanceof EntityDamageByEntityEvent){
if(event instanceof EntityDamageByEntityEvent && event.getDamage() >= 1){
if(event.isCancelled()){
return;
}
EntityDamageByEntityEvent eventb = (EntityDamageByEntityEvent)event;
Entity e = eventb.getEntity(); //Defender
Entity f = eventb.getDamager(); //Attacker
/*
* IF DEFENDER IS PLAYER
* DEFENDER PROC/GODMODE CHECKS
*/
if(e instanceof Player){
Player defender = (Player)e;
if(defender != null && mcConfig.getInstance().isGodModeToggled(defender.getName()))
event.setCancelled(true);
if(f instanceof Monster && defender != null){
mcUsers.getProfile(defender).setRecentlyHurt(30);
}
/*
* PARRYING CHECK, CHECK TO SEE IF ITS A SUCCESSFUL PARRY OR NOT
*/
mcCombat.getInstance().parryCheck(defender, eventb, f);
}
/*
* ARCHERY CHECKS
*/
if(!event.isCancelled() && event instanceof EntityDamageByProjectileEvent && event.getDamage() >= 1){
EntityDamageByProjectileEvent c = (EntityDamageByProjectileEvent)event;
mcCombat.getInstance().archeryCheck(c);
}
/*
* CHECK FOR PVP INTERACTIONS
*/
if(f instanceof Player && e instanceof Player && !mcLoadProperties.pvp)
event.setCancelled(true);
/*
* IF ATTACKER IS PLAYER
*/
if(f instanceof Player){
if(f instanceof Player && !event.isCancelled()){
//((Player) f).sendMessage("DEBUG: EntityDamageByEntity cast correctly!");
int typeid = ((Player) f).getItemInHand().getTypeId();
Player attacker = (Player)f;
/*
* ACTIVATE ABILITIES
*/
if(mcUsers.getProfile(attacker).getAxePreparationMode())
mcSkills.getInstance().skullSplitterCheck(attacker);
if(mcUsers.getProfile(attacker).getSwordsPreparationMode())
mcSkills.getInstance().serratedStrikesActivationCheck(attacker);
if(mcUsers.getProfile(attacker).getFistsPreparationMode())
mcSkills.getInstance().berserkActivationCheck(attacker);
/*
* BERSERK DAMAGE MODIFIER
*/
if(mcUsers.getProfile(attacker).getBerserkMode())
event.setDamage(event.getDamage() + (event.getDamage() / 2));
/*
* Player versus Monster checks, this handles all skill damage modifiers and any procs.
*/
@ -98,38 +135,101 @@ public class mcEntityListener extends EntityListener {
* Player versus Player checks, these checks make sure players are not in the same party, etc. They also check for any procs from skills and handle damage modifiers.
*/
if(mcm.getInstance().isPvpEnabled())
mcCombat.getInstance().playerVersusPlayerChecks(e, attacker, eventb);
mcCombat.getInstance().playerVersusPlayerChecks(e, attacker, eventb);
/*
* Player versus Animals checks, these checks handle any skill modifiers or procs
*/
mcCombat.getInstance().playerVersusAnimalsChecks(e, attacker, eventb, typeid);
/*
* This will do AOE damage from the axes ability
*/
if(!event.isCancelled() && mcUsers.getProfile(attacker).getSkullSplitterMode() && mcm.getInstance().isAxes(attacker.getItemInHand()))
mcCombat.getInstance().applyAoeDamage(attacker, eventb, x);
if(!event.isCancelled() && mcUsers.getProfile(attacker).getSerratedStrikesMode() && mcm.getInstance().isSwords(attacker.getItemInHand()))
mcCombat.getInstance().applySerratedStrikes(attacker, eventb, x);
}
if(f instanceof Player && e instanceof Player && !mcLoadProperties.pvp)
event.setCancelled(true);
if(e instanceof Monster || e instanceof Animals){
if(e instanceof Monster){
Monster monster = (Monster)e;
if(monster.getHealth() <= 0){
mcConfig.getInstance().removeBleedTrack(e);
}
}
if(e instanceof Animals){
Animals animals = (Animals)e;
if(animals.getHealth() <= 0){
mcConfig.getInstance().removeBleedTrack(e);
}
}
/*
* DODGE / COUNTERATTACK CHECKS
*/
if(e instanceof Player){
Player defender = (Player)e;
/*
* COUNTER ATTACK STUFF
*/
if(mcPermissions.getInstance().swords(defender)
&& mcm.getInstance().isSwords(defender.getItemInHand())){
boolean isArrow = false;
if (event instanceof EntityDamageByProjectileEvent) {
final EntityDamageByProjectileEvent realEvent =
(EntityDamageByProjectileEvent) event;
isArrow = (realEvent.getProjectile() instanceof Arrow);
}
if(isArrow == false){
//defender.sendMessage("isArrow ="+isArrow);
if(mcUsers.getProfile(defender).getSwordsInt() >= 600){
if(Math.random() * 2000 <= 600){
mcCombat.getInstance().dealDamage(f, event.getDamage() / 2);
defender.sendMessage(ChatColor.GREEN+"**COUNTER-ATTACKED**");
if(f instanceof Player)
((Player) f).sendMessage(ChatColor.DARK_RED+"Hit with counterattack!");
}
} else if (Math.random() * 2000 <= mcUsers.getProfile(defender).getSwordsInt()){
mcCombat.getInstance().dealDamage(f, event.getDamage() / 2);
defender.sendMessage(ChatColor.GREEN+"**COUNTER-ATTACKED**");
if(f instanceof Player)
((Player) f).sendMessage(ChatColor.DARK_RED+"Hit with counterattack!");
}
}
}
/*
* DODGE STUFF
*/
if(mcPermissions.getInstance().acrobatics(defender)){
if(mcUsers.getProfile(defender).getAcrobaticsInt() <= 800){
if(Math.random() * 4000 <= mcUsers.getProfile(defender).getAcrobaticsInt()){
defender.sendMessage(ChatColor.RED+"**DODGE - DAMAGE REDUCED**");
mcUsers.getProfile(defender).addAcrobaticsGather(event.getDamage() * 12);
mcSkills.getInstance().XpCheck(defender);
event.setDamage(event.getDamage() / 2);
}
} if(Math.random() * 4000 <= 800) {
defender.sendMessage(ChatColor.RED+"**DODGE - DAMAGE REDUCED**");
mcUsers.getProfile(defender).addAcrobaticsGather(event.getDamage() * 12);
mcSkills.getInstance().XpCheck(defender);
event.setDamage(event.getDamage() / 2);
}
}
}
}
/*
* Check to see if the defender took damage so we can apply recently hurt
*/
if(x instanceof Player && !event.isCancelled()){
Player herpderp = (Player)x;
mcUsers.getProfile(herpderp).setRecentlyHurt(30);
}
}
}
}
}
public void onEntityDeath(EntityDeathEvent event) {
Entity x = event.getEntity();
x.setFireTicks(0);
//Remove bleed track
if(mcConfig.getInstance().isBleedTracked(x))
mcConfig.getInstance().addToBleedRemovalQue(x);
mcSkills.getInstance().arrowRetrievalCheck(x);
if(mcConfig.getInstance().isMobSpawnTracked(x)){
mcConfig.getInstance().removeMobSpawnTrack(x);
}
if(x instanceof Player){
Player player = (Player)x;
if(mcUsers.getProfile(player).isDead()){
mcUsers.getProfile(player).setDead(false);
return;
}
mcUsers.getProfile(player).setBleedTicks(0);
}
}
public boolean isPlayer(Entity entity){

View File

@ -19,44 +19,98 @@ public class mcExcavation {
}
return instance;
}
public void gigaDrillBreakerActivationCheck(Player player, Block block){
if(mcm.getInstance().isShovel(player.getItemInHand())){
if(block != null){
if(!mcm.getInstance().abilityBlockCheck(block))
return;
}
if(mcUsers.getProfile(player).getShovelPreparationMode()){
mcUsers.getProfile(player).setShovelPreparationMode(false);
mcUsers.getProfile(player).setShovelPreparationTicks(0);
}
int ticks = 2;
if(mcUsers.getProfile(player).getExcavationInt() >= 50)
ticks++;
if(mcUsers.getProfile(player).getExcavationInt() >= 150)
ticks++;
if(mcUsers.getProfile(player).getExcavationInt() >= 250)
ticks++;
if(mcUsers.getProfile(player).getExcavationInt() >= 350)
ticks++;
if(mcUsers.getProfile(player).getExcavationInt() >= 450)
ticks++;
if(mcUsers.getProfile(player).getExcavationInt() >= 550)
ticks++;
if(mcUsers.getProfile(player).getExcavationInt() >= 650)
ticks++;
if(mcUsers.getProfile(player).getExcavationInt() >= 750)
ticks++;
if(!mcUsers.getProfile(player).getGigaDrillBreakerMode() && mcUsers.getProfile(player).getGigaDrillBreakerCooldown() == 0){
player.sendMessage(ChatColor.GREEN+"**GIGA DRILL BREAKER ACTIVATED**");
mcUsers.getProfile(player).setGigaDrillBreakerTicks(ticks * 2);
mcUsers.getProfile(player).setGigaDrillBreakerMode(true);
}
}
}
public boolean canBeGigaDrillBroken(Block block){
int i = block.getTypeId();
if(i == 2||i == 3||i == 12||i == 13){
return true;
} else {
return false;
}
}
public void excavationProcCheck(Block block, Player player){
int type = block.getTypeId();
Location loc = block.getLocation();
ItemStack is = null;
Material mat = null;
if(type == 2 && mcUsers.getProfile(player).getExcavationInt() > 250){
//CHANCE TO GET EGGS
if(mcLoadProperties.eggs == true && Math.random() * 100 > 99){
mcUsers.getProfile(player).addExcavationGather(10);
mat = Material.getMaterial(344);
is = new ItemStack(mat, 1, (byte)0, (byte)0);
loc.getWorld().dropItemNaturally(loc, is);
}
//CHANCE TO GET APPLES
if(mcLoadProperties.apples == true && Math.random() * 100 > 99){
mcUsers.getProfile(player).addExcavationGather(10);
mat = Material.getMaterial(260);
is = new ItemStack(mat, 1, (byte)0, (byte)0);
loc.getWorld().dropItemNaturally(loc, is);
if(type == 2){
if(mcUsers.getProfile(player).getExcavationInt() > 250){
//CHANCE TO GET EGGS
if(mcLoadProperties.eggs == true && Math.random() * 100 > 99){
mcUsers.getProfile(player).addExcavationGather(10 * mcLoadProperties.xpGainMultiplier);
mat = Material.getMaterial(344);
is = new ItemStack(mat, 1, (byte)0, (byte)0);
loc.getWorld().dropItemNaturally(loc, is);
}
//CHANCE TO GET APPLES
if(mcLoadProperties.apples == true && Math.random() * 100 > 99){
mcUsers.getProfile(player).addExcavationGather(10 * mcLoadProperties.xpGainMultiplier);
mat = Material.getMaterial(260);
is = new ItemStack(mat, 1, (byte)0, (byte)0);
loc.getWorld().dropItemNaturally(loc, is);
}
}
}
//DIRT SAND OR GRAVEL
if(type == 3 || type == 13 || type == 2 || type == 12){
mcUsers.getProfile(player).addExcavationGather(3);
mcUsers.getProfile(player).addExcavationGather(4);
if(mcUsers.getProfile(player).getExcavationInt() > 750){
//CHANCE TO GET CAKE
if(mcLoadProperties.cake == true && Math.random() * 2000 > 1999){
mcUsers.getProfile(player).addExcavationGather(300);
mcUsers.getProfile(player).addExcavationGather(300 * mcLoadProperties.xpGainMultiplier);
mat = Material.getMaterial(354);
is = new ItemStack(mat, 1, (byte)0, (byte)0);
loc.getWorld().dropItemNaturally(loc, is);
}
}
if(mcUsers.getProfile(player).getExcavationInt() > 150){
//CHANCE TO GET MUSIC
if(mcUsers.getProfile(player).getExcavationInt() > 350){
//CHANCE TO GET DIAMOND
if(mcLoadProperties.diamond == true && Math.random() * 750 > 749){
mcUsers.getProfile(player).addExcavationGather(100 * mcLoadProperties.xpGainMultiplier);
mat = Material.getMaterial(264);
is = new ItemStack(mat, 1, (byte)0, (byte)0);
loc.getWorld().dropItemNaturally(loc, is);
}
}
if(mcUsers.getProfile(player).getExcavationInt() > 250){
//CHANCE TO GET YELLOW MUSIC
if(mcLoadProperties.music == true && Math.random() * 2000 > 1999){
mcUsers.getProfile(player).addExcavationGather(300);
mcUsers.getProfile(player).addExcavationGather(300 * mcLoadProperties.xpGainMultiplier);
mat = Material.getMaterial(2256);
is = new ItemStack(mat, 1, (byte)0, (byte)0);
loc.getWorld().dropItemNaturally(loc, is);
@ -64,18 +118,9 @@ public class mcExcavation {
}
if(mcUsers.getProfile(player).getExcavationInt() > 350){
//CHANCE TO GET DIAMOND
if(mcLoadProperties.diamond == true && Math.random() * 500 > 499){
mcUsers.getProfile(player).addExcavationGather(100);
mat = Material.getMaterial(264);
is = new ItemStack(mat, 1, (byte)0, (byte)0);
loc.getWorld().dropItemNaturally(loc, is);
}
}
if(mcUsers.getProfile(player).getExcavationInt() > 250){
//CHANCE TO GET MUSIC
//CHANCE TO GET GREEN MUSIC
if(mcLoadProperties.music == true && Math.random() * 2000 > 1999){
mcUsers.getProfile(player).addExcavationGather(300);
mcUsers.getProfile(player).addExcavationGather(300 * mcLoadProperties.xpGainMultiplier);
mat = Material.getMaterial(2257);
is = new ItemStack(mat, 1, (byte)0, (byte)0);
loc.getWorld().dropItemNaturally(loc, is);
@ -86,31 +131,35 @@ public class mcExcavation {
if(type == 12){
//CHANCE TO GET GLOWSTONE
if(mcLoadProperties.glowstone == true && mcUsers.getProfile(player).getExcavationInt() > 50 && Math.random() * 100 > 95){
mcUsers.getProfile(player).addExcavationGather(3);
mcUsers.getProfile(player).addExcavationGather(8 * mcLoadProperties.xpGainMultiplier);
mat = Material.getMaterial(348);
is = new ItemStack(mat, 1, (byte)0, (byte)0);
loc.getWorld().dropItemNaturally(loc, is);
}
//CHANCE TO GET SLOWSAND
if(mcLoadProperties.slowsand == true && mcUsers.getProfile(player).getExcavationInt() > 650 && Math.random() * 200 > 199){
mcUsers.getProfile(player).addExcavationGather(5);
mcUsers.getProfile(player).addExcavationGather(8 * mcLoadProperties.xpGainMultiplier);
mat = Material.getMaterial(88);
is = new ItemStack(mat, 1, (byte)0, (byte)0);
loc.getWorld().dropItemNaturally(loc, is);
}
//CHANCE TO GET DIAMOND
if(mcLoadProperties.diamond == true && mcUsers.getProfile(player).getExcavationInt() > 500 && Math.random() * 500 > 499){
mcUsers.getProfile(player).addExcavationGather(100);
mat = Material.getMaterial(264);
is = new ItemStack(mat, 1, (byte)0, (byte)0);
loc.getWorld().dropItemNaturally(loc, is);
}
}
//GRASS OR DIRT
if((type == 2 || type == 3) && mcUsers.getProfile(player).getExcavationInt() > 25){
if(type == 2 || type == 3){
//CHANCE FOR SHROOMS
if(mcLoadProperties.mushrooms == true && mcUsers.getProfile(player).getExcavationInt() > 500 && Math.random() * 200 > 199){
mcUsers.getProfile(player).addExcavationGather(8 * mcLoadProperties.xpGainMultiplier);
if(Math.random() * 10 > 5){
mat = Material.getMaterial(39);
} else {
mat = Material.getMaterial(40);
}
is = new ItemStack(mat, 1, (byte)0, (byte)0);
loc.getWorld().dropItemNaturally(loc, is);
}
//CHANCE TO GET GLOWSTONE
if(mcLoadProperties.glowstone == true && Math.random() * 100 > 95){
mcUsers.getProfile(player).addExcavationGather(5);
if(mcLoadProperties.glowstone == true && mcUsers.getProfile(player).getExcavationInt() > 25 && Math.random() * 100 > 95){
mcUsers.getProfile(player).addExcavationGather(8 * mcLoadProperties.xpGainMultiplier);
mat = Material.getMaterial(348);
is = new ItemStack(mat, 1, (byte)0, (byte)0);
loc.getWorld().dropItemNaturally(loc, is);
@ -120,38 +169,30 @@ public class mcExcavation {
if(type == 13){
//CHANCE TO GET NETHERRACK
if(mcLoadProperties.netherrack == true && mcUsers.getProfile(player).getExcavationInt() > 850 && Math.random() * 200 > 199){
mcUsers.getProfile(player).addExcavationGather(3);
mcUsers.getProfile(player).addExcavationGather(3 * mcLoadProperties.xpGainMultiplier);
mat = Material.getMaterial(87);
is = new ItemStack(mat, 1, (byte)0, (byte)0);
loc.getWorld().dropItemNaturally(loc, is);
}
//CHANCE TO GET SULPHUR
if(mcLoadProperties.sulphur == true && mcUsers.getProfile(player).getExcavationInt() > 75){
if(Math.random() * 10 > 9){
mcUsers.getProfile(player).addExcavationGather(3);
mat = Material.getMaterial(289);
is = new ItemStack(mat, 1, (byte)0, (byte)0);
loc.getWorld().dropItemNaturally(loc, is);
}
if(Math.random() * 10 > 9){
mcUsers.getProfile(player).addExcavationGather(3 * mcLoadProperties.xpGainMultiplier);
mat = Material.getMaterial(289);
is = new ItemStack(mat, 1, (byte)0, (byte)0);
loc.getWorld().dropItemNaturally(loc, is);
}
}
//CHANCE TO GET BONES
if(mcLoadProperties.bones == true && mcUsers.getProfile(player).getExcavationInt() > 175){
if(Math.random() * 10 > 6){
mcUsers.getProfile(player).addExcavationGather(3);
if(Math.random() * 10 > 9){
mcUsers.getProfile(player).addExcavationGather(3 * mcLoadProperties.xpGainMultiplier);
mat = Material.getMaterial(352);
is = new ItemStack(mat, 1, (byte)0, (byte)0);
loc.getWorld().dropItemNaturally(loc, is);
}
}
}
}
if(mcUsers.getProfile(player).getExcavationGatherInt() >= mcUsers.getProfile(player).getXpToLevel("excavation")){
int skillups = 0;
while(mcUsers.getProfile(player).getExcavationGatherInt() >= mcUsers.getProfile(player).getXpToLevel("excavation")){
skillups++;
mcUsers.getProfile(player).removeExcavationGather(mcUsers.getProfile(player).getXpToLevel("excavation"));
mcUsers.getProfile(player).skillUpExcavation(1);
}
player.sendMessage(ChatColor.YELLOW+"Excavation skill increased by "+skillups+"."+" Total ("+mcUsers.getProfile(player).getExcavation()+")");
}
mcSkills.getInstance().XpCheck(player);
}
}

View File

@ -24,49 +24,44 @@ public class mcHerbalism {
Location loc = block.getLocation();
ItemStack is = null;
Material mat = null;
//player.sendMessage("mcMMO DEBUG: Data ("+block.getData()+")"+" TYPEID ("+block.getTypeId()+")");
if(type == 59 && block.getData() == (byte) 0x7){
mat = Material.getMaterial(296);
is = new ItemStack(mat, 1, (byte)0, (byte)0);
mcUsers.getProfile(player).addHerbalismGather(5);
if(mcUsers.getProfile(player).getHerbalismInt() >= 50 && mcUsers.getProfile(player).getHerbalismInt() < 150){
if(Math.random() * 10 > 8)
loc.getWorld().dropItemNaturally(loc, is);
}
if(mcUsers.getProfile(player).getHerbalismInt() >= 150 && mcUsers.getProfile(player).getHerbalismInt() < 350 ){
if(Math.random() * 10 > 6)
loc.getWorld().dropItemNaturally(loc, is);
}
if(mcUsers.getProfile(player).getHerbalismInt() >= 350 && mcUsers.getProfile(player).getHerbalismInt() < 500 ){
if(Math.random() * 10 > 4)
loc.getWorld().dropItemNaturally(loc, is);
}
if(mcUsers.getProfile(player).getHerbalismInt() >= 500 && mcUsers.getProfile(player).getHerbalismInt() < 750 ){
if(Math.random() * 10 > 2)
loc.getWorld().dropItemNaturally(loc, is);
mcUsers.getProfile(player).addHerbalismGather(5 * mcLoadProperties.xpGainMultiplier);
if(player != null){
if(Math.random() * 1000 <= mcUsers.getProfile(player).getHerbalismInt()){
loc.getWorld().dropItemNaturally(loc, is);
}
}
}
/*
* We need to check not-wheat stuff for if it was placed by the player or not
*/
if(!mcConfig.getInstance().isBlockWatched(block)){
//player.sendMessage("DEBUG CODE 2");
if(type == 39 || type == 40){
mcUsers.getProfile(player).addHerbalismGather(10);
}
if(type == 37 || type == 38){
mcUsers.getProfile(player).addHerbalismGather(3);
//Mushroom
if(type == 39 || type == 40){
mat = Material.getMaterial(block.getTypeId());
is = new ItemStack(mat, 1, (byte)0, (byte)0);
if(player != null){
if(Math.random() * 1000 <= mcUsers.getProfile(player).getHerbalismInt()){
loc.getWorld().dropItemNaturally(loc, is);
}
}
mcUsers.getProfile(player).addHerbalismGather(40 * mcLoadProperties.xpGainMultiplier);
}
//Flower
if(type == 37 || type == 38){
mat = Material.getMaterial(block.getTypeId());
is = new ItemStack(mat, 1, (byte)0, (byte)0);
if(player != null){
if(Math.random() * 1000 <= mcUsers.getProfile(player).getHerbalismInt()){
loc.getWorld().dropItemNaturally(loc, is);
}
}
mcUsers.getProfile(player).addHerbalismGather(10 * mcLoadProperties.xpGainMultiplier);
}
}
}
if(mcUsers.getProfile(player).getHerbalismGatherInt() >= mcUsers.getProfile(player).getXpToLevel("herbalism")){
int skillups = 0;
while(mcUsers.getProfile(player).getHerbalismGatherInt() >= mcUsers.getProfile(player).getXpToLevel("herbalism")){
skillups++;
mcUsers.getProfile(player).removeHerbalismGather(mcUsers.getProfile(player).getXpToLevel("herbalism"));
mcUsers.getProfile(player).skillUpHerbalism(1);
}
player.sendMessage(ChatColor.YELLOW+"Herbalism skill increased by "+skillups+"."+" Total ("+mcUsers.getProfile(player).getHerbalism()+")");
}
mcSkills.getInstance().XpCheck(player);
}
public void breadCheck(Player player, ItemStack is){
if(is.getTypeId() == 297){

View File

@ -1,55 +1,82 @@
package com.gmail.nossr50;
public class mcLoadProperties {
public static Boolean pvp, eggs, apples, myspawnclearsinventory, cake, music, diamond, glowstone, slowsand, sulphur, netherrack, bones, coal, clay, anvilmessages;
public static String mcmmo, mcc, mcgod, stats, mmoedit, ptp, party, myspawn, setmyspawn, whois, invite, accept, clearmyspawn;
public static int globalxpmodifier, miningxpmodifier, repairxpmodifier, woodcuttingxpmodifier, unarmedxpmodifier, herbalismxpmodifier, excavationxpmodifier, archeryxpmodifier, swordsxpmodifier, axesxpmodifier, acrobaticsxpmodifier;
public static Boolean mushrooms, toolsLoseDurabilityFromAbilities, pvpxp, miningrequirespickaxe, woodcuttingrequiresaxe, pvp, eggs, apples, myspawnclearsinventory, cake, music, diamond, glowstone, slowsand, sulphur, netherrack, bones, coal, clay, anvilmessages;
public static String addxp, mcability, mcmmo, mcc, mcrefresh, mcitem, mcgod, stats, mmoedit, ptp, party, myspawn, setmyspawn, whois, invite, accept, clearmyspawn;
public static int xpGainMultiplier, superBreakerCooldown, gigaDrillBreakerCooldown, treeFellerCooldown, berserkCooldown, serratedStrikeCooldown, skullSplitterCooldown, abilityDurabilityLoss, feathersConsumedByChimaeraWing, pvpxprewardmodifier, repairdiamondlevel, globalxpmodifier, miningxpmodifier, repairxpmodifier, woodcuttingxpmodifier, unarmedxpmodifier, herbalismxpmodifier, excavationxpmodifier, archeryxpmodifier, swordsxpmodifier, axesxpmodifier, acrobaticsxpmodifier;
public static void loadMain(){
String propertiesFile = mcMMO.maindirectory + "mcmmo.properties";
mcProperties properties = new mcProperties(propertiesFile);
properties.load();
/*
* COOLDOWN CONTROL
*/
superBreakerCooldown = properties.getInteger("superBreakerCooldown", 240);
gigaDrillBreakerCooldown = properties.getInteger("gigaDrillBreakerCooldown", 240);
treeFellerCooldown = properties.getInteger("treeFellerCooldown", 240);
berserkCooldown = properties.getInteger("berserkCooldown", 240);
serratedStrikeCooldown = properties.getInteger("serratedStrikeCooldown", 240);
skullSplitterCooldown = properties.getInteger("skullSplitterCooldown", 240);
/*
* OTHER
*/
myspawnclearsinventory = properties.getBoolean("mySpawnClearsInventory", true);
xpGainMultiplier = properties.getInteger("xpGainMultiplier", 1);
toolsLoseDurabilityFromAbilities = properties.getBoolean("toolsLoseDurabilityFromAbilities", true);
abilityDurabilityLoss = properties.getInteger("abilityDurabilityLoss", 2);
feathersConsumedByChimaeraWing = properties.getInteger("feathersConsumedByChimaeraWing", 10);
pvpxp = properties.getBoolean("pvpGivesXP", true);
pvpxprewardmodifier = properties.getInteger("pvpXpRewardModifier", 1);
miningrequirespickaxe = properties.getBoolean("miningRequiresPickaxe", true);
woodcuttingrequiresaxe = properties.getBoolean("woodcuttingRequiresAxe", true);
repairdiamondlevel = properties.getInteger("repairDiamondLevel", 50);
/*
* EXPERIENCE RATE MODIFIER
*/
globalxpmodifier = properties.getInteger("globalxpmodifier", 1);
miningxpmodifier = properties.getInteger("miningxpmodifier", 2);
repairxpmodifier = properties.getInteger("repairxpmodifier", 2);
woodcuttingxpmodifier = properties.getInteger("woodcuttingxpmodifier", 2);
unarmedxpmodifier = properties.getInteger("unarmedxpmodifier", 2);
herbalismxpmodifier = properties.getInteger("herbalismxpmodifier", 2);
excavationxpmodifier = properties.getInteger("excavationxpmodifier", 2);
archeryxpmodifier = properties.getInteger("archeryxpmodifier", 2);
swordsxpmodifier = properties.getInteger("swordsxpmodifier", 2);
axesxpmodifier = properties.getInteger("axesxpmodifier", 2);
acrobaticsxpmodifier = properties.getInteger("acrobaticsxpmodifier", 2);
globalxpmodifier = properties.getInteger("globalXpModifier", 1);
miningxpmodifier = properties.getInteger("miningXpModifier", 2);
repairxpmodifier = properties.getInteger("repairXpModifier", 2);
woodcuttingxpmodifier = properties.getInteger("woodcuttingXpModifier", 2);
unarmedxpmodifier = properties.getInteger("unarmedXpModifier", 2);
herbalismxpmodifier = properties.getInteger("herbalismXpModifier", 2);
excavationxpmodifier = properties.getInteger("excavationXpModifier", 2);
archeryxpmodifier = properties.getInteger("archeryXpModifier", 2);
swordsxpmodifier = properties.getInteger("swordsXpModifier", 2);
axesxpmodifier = properties.getInteger("axesXpModifier", 2);
acrobaticsxpmodifier = properties.getInteger("acrobaticsXpModifier", 2);
/*
* TOGGLE CLAY
*/
clay = properties.getBoolean("graveltoclay", true);
clay = properties.getBoolean("gravelToClay", true);
/*
* ANVIL MESSAGES
*/
anvilmessages = properties.getBoolean("anvilmessages", true);
anvilmessages = properties.getBoolean("anvilMessages", true);
/*
* EXCAVATION LOOT TOGGLES
*/
myspawnclearsinventory = properties.getBoolean("myspawnclearsinventory", true);
glowstone = properties.getBoolean("canexcavateglowstone", true);
mushrooms = properties.getBoolean("canExcavateMushrooms", true);
glowstone = properties.getBoolean("canExcavateGlowstone", true);
pvp = properties.getBoolean("pvp", true);
eggs = properties.getBoolean("canexcavateeggs", true);
apples = properties.getBoolean("canexcavateapples", true);
cake = properties.getBoolean("canexcavatecake", true);
music = properties.getBoolean("canexcavatemusic", true);
diamond = properties.getBoolean("canexcavatediamond", true);
slowsand = properties.getBoolean("canexcavateslowsand", true);
sulphur = properties.getBoolean("canexcavatesulphur", true);
netherrack = properties.getBoolean("canexcavatenetherrack", true);
bones = properties.getBoolean("canexcavatebones", true);
eggs = properties.getBoolean("canExcavateEggs", true);
apples = properties.getBoolean("canExcavateApples", true);
cake = properties.getBoolean("canExcavateCake", true);
music = properties.getBoolean("canExcavateMusic", true);
diamond = properties.getBoolean("canExcavateDiamond", true);
slowsand = properties.getBoolean("canExcavateSlowSand", true);
sulphur = properties.getBoolean("canExcavateSulphur", true);
netherrack = properties.getBoolean("canExcavateNetherrack", true);
bones = properties.getBoolean("canExcavateBones", true);
/*
* CUSTOM COMMANDS
*/
addxp = properties.getString("/addxp", "addxp");
mcability = properties.getString("/mcability", "mcability");
mcrefresh = properties.getString("/mcrefresh", "mcrefresh");
mcitem = properties.getString("/mcitem", "mcitem");
mcmmo = properties.getString("/mcmmo", "mcmmo");
mcc = properties.getString("/mcc", "mcc");
mcgod = properties.getString("/mcgod", "mcgod");

View File

@ -18,7 +18,7 @@ import org.bukkit.entity.Player;
public class mcMMO extends JavaPlugin {
static String maindirectory = "mcMMO/";
static String maindirectory = "plugins/mcMMO/";
static File Properties = new File(maindirectory + "mcmmo.properties");
public static final Logger log = Logger.getLogger("Minecraft");
private final mcPlayerListener playerListener = new mcPlayerListener(this);
@ -30,9 +30,8 @@ public class mcMMO extends JavaPlugin {
private Permissions permissions;
private Timer mcMMO_Timer = new Timer(true);
//herp
public void onEnable() {
//mcMMO_Timer.schedule(new mcTimer(this), 0, (long)(2000));
mcMMO_Timer.schedule(new mcTimer(this), 0, (long)(1000));
//Make the directory if it does not exist
new File(maindirectory).mkdir();
//Make the file if it does not exist
@ -61,19 +60,23 @@ public class mcMMO extends JavaPlugin {
//Load the file
mcLoadProperties.loadMain();
mcUsers.getInstance().loadUsers();
for(Player player : getServer().getOnlinePlayers()){
mcUsers.addUser(player);
}
PluginManager pm = getServer().getPluginManager();
pm.registerEvent(Event.Type.PLAYER_JOIN, playerListener, Priority.Normal, this);
pm.registerEvent(Event.Type.PLAYER_LOGIN, playerListener, Priority.Normal, this);
pm.registerEvent(Event.Type.BLOCK_DAMAGED, blockListener, Priority.Normal, this);
pm.registerEvent(Event.Type.PLAYER_CHAT, playerListener, Priority.Monitor, this);
pm.registerEvent(Event.Type.PLAYER_COMMAND_PREPROCESS, playerListener, Priority.High, this);
pm.registerEvent(Event.Type.BLOCK_DAMAGED, blockListener, Priority.Highest, this);
pm.registerEvent(Event.Type.PLAYER_CHAT, playerListener, Priority.Lowest, this);
pm.registerEvent(Event.Type.PLAYER_COMMAND_PREPROCESS, playerListener, 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_PLACED, blockListener, 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);
pm.registerEvent(Event.Type.ENTITY_DAMAGED, entityListener, Priority.Highest, this);
pm.registerEvent(Event.Type.BLOCK_RIGHTCLICKED, blockListener, Priority.Normal, this);
//pm.registerEvent(Event.Type.CREATURE_SPAWN, entityListener, Priority.Normal, this);
//Displays a message when plugin is loaded
PluginDescriptionFile pdfFile = this.getDescription();
@ -98,6 +101,17 @@ public class mcMMO extends JavaPlugin {
return false;
}
}
public boolean inSameParty(Player playera, Player playerb){
if(mcUsers.getProfile(playera).inParty() && mcUsers.getProfile(playerb).inParty()){
if(mcUsers.getProfile(playera).getParty().equals(mcUsers.getProfile(playerb).getParty())){
return true;
} else {
return false;
}
} else {
return false;
}
}
public boolean isAdminChatToggled(Player player){
if(mcConfig.getInstance().isAdminToggled(player.getName())){
return true;

View File

@ -19,14 +19,54 @@ public class mcMining {
}
return instance;
}
public void superBreakerCheck(Player player, Block block){
if(mcm.getInstance().isMiningPick(player.getItemInHand())){
if(block != null){
if(!mcm.getInstance().abilityBlockCheck(block))
return;
}
if(mcUsers.getProfile(player).getPickaxePreparationMode()){
mcUsers.getProfile(player).setPickaxePreparationMode(false);
mcUsers.getProfile(player).setPickaxePreparationTicks(0);
}
int ticks = 2;
if(mcUsers.getProfile(player).getMiningInt() >= 50)
ticks++;
if(mcUsers.getProfile(player).getMiningInt() >= 150)
ticks++;
if(mcUsers.getProfile(player).getMiningInt() >= 250)
ticks++;
if(mcUsers.getProfile(player).getMiningInt() >= 350)
ticks++;
if(mcUsers.getProfile(player).getMiningInt() >= 450)
ticks++;
if(mcUsers.getProfile(player).getMiningInt() >= 550)
ticks++;
if(mcUsers.getProfile(player).getMiningInt() >= 650)
ticks++;
if(mcUsers.getProfile(player).getMiningInt() >= 750)
ticks++;
if(!mcUsers.getProfile(player).getSuperBreakerMode() && mcUsers.getProfile(player).getSuperBreakerCooldown() == 0){
player.sendMessage(ChatColor.GREEN+"**SUPER BREAKER ACTIVATED**");
mcUsers.getProfile(player).setSuperBreakerTicks(ticks * 2);
mcUsers.getProfile(player).setSuperBreakerMode(true);
}
}
}
public void blockProcSimulate(Block block){
Location loc = block.getLocation();
Material mat = Material.getMaterial(block.getTypeId());
byte damage = 0;
ItemStack item = new ItemStack(mat, 1, (byte)0, damage);
if(block.getTypeId() != 73 && block.getTypeId() != 74 && block.getTypeId() != 56 && block.getTypeId() != 21 && block.getTypeId() != 1 && block.getTypeId() != 16)
loc.getWorld().dropItemNaturally(loc, item);
//hurrdurr
if(block.getTypeId() != 89 && block.getTypeId() != 73 && block.getTypeId() != 74 && block.getTypeId() != 56 && block.getTypeId() != 21 && block.getTypeId() != 1 && block.getTypeId() != 16)
loc.getWorld().dropItemNaturally(loc, item);
if(block.getTypeId() == 89){
mat = Material.getMaterial(348);
item = new ItemStack(mat, 1, (byte)0, damage);
loc.getWorld().dropItemNaturally(loc, item);
}
if(block.getTypeId() == 73 || block.getTypeId() == 74){
mat = Material.getMaterial(331);
item = new ItemStack(mat, 1, (byte)0, damage);
@ -37,104 +77,224 @@ public class mcMining {
loc.getWorld().dropItemNaturally(loc, item);
}
}
if(block.getTypeId() == 21){
mat = Material.getMaterial(351);
item = new ItemStack(mat, 1, (byte)0,(byte)0x4);
loc.getWorld().dropItemNaturally(loc, item);
loc.getWorld().dropItemNaturally(loc, item);
loc.getWorld().dropItemNaturally(loc, item);
loc.getWorld().dropItemNaturally(loc, item);
}
if(block.getTypeId() == 56){
mat = Material.getMaterial(264);
item = new ItemStack(mat, 1, (byte)0, damage);
loc.getWorld().dropItemNaturally(loc, item);
}
if(block.getTypeId() == 1){
mat = Material.getMaterial(4);
item = new ItemStack(mat, 1, (byte)0, damage);
loc.getWorld().dropItemNaturally(loc, item);
}
if(block.getTypeId() == 16){
mat = Material.getMaterial(263);
item = new ItemStack(mat, 1, (byte)0, damage);
loc.getWorld().dropItemNaturally(loc, item);
}
if(block.getTypeId() == 21){
mat = Material.getMaterial(351);
item = new ItemStack(mat, 1, (byte)0,(byte)0x4);
loc.getWorld().dropItemNaturally(loc, item);
loc.getWorld().dropItemNaturally(loc, item);
loc.getWorld().dropItemNaturally(loc, item);
loc.getWorld().dropItemNaturally(loc, item);
}
if(block.getTypeId() == 56){
mat = Material.getMaterial(264);
item = new ItemStack(mat, 1, (byte)0, damage);
loc.getWorld().dropItemNaturally(loc, item);
}
if(block.getTypeId() == 1){
mat = Material.getMaterial(4);
item = new ItemStack(mat, 1, (byte)0, damage);
loc.getWorld().dropItemNaturally(loc, item);
}
if(block.getTypeId() == 16){
mat = Material.getMaterial(263);
item = new ItemStack(mat, 1, (byte)0, damage);
loc.getWorld().dropItemNaturally(loc, item);
}
}
public void blockProcCheck(Block block, Player player){
if(mcUsers.getProfile(player).getMiningInt() > 2000){
blockProcSimulate(block);
return;
}
if(mcUsers.getProfile(player).getMiningInt() > 1250){
if((Math.random() * 10) > 2){
blockProcSimulate(block);
return;
}
}
if(mcUsers.getProfile(player).getMiningInt() > 750){
if((Math.random() * 10) > 4){
blockProcSimulate(block);
return;
}
}
if(mcUsers.getProfile(player).getMiningInt() > 150){
if((Math.random() * 10) > 6){
blockProcSimulate(block);
return;
}
}
if(mcUsers.getProfile(player).getMiningInt() > 25){
if((Math.random() * 10) > 8){
if(player != null){
if(Math.random() * 1000 <= mcUsers.getProfile(player).getMiningInt()){
blockProcSimulate(block);
return;
}
}
}
public void miningBlockCheck(Player player, Block block){
if(block.getTypeId() == 1){
mcUsers.getProfile(player).addMiningGather(1);
int xp = 0;
if(block.getTypeId() == 1 || block.getTypeId() == 24){
xp += 3;
blockProcCheck(block, player);
}
//COAL
if(block.getTypeId() == 16){
mcUsers.getProfile(player).addMiningGather(5);
}
//NETHERRACK
if(block.getTypeId() == 87){
xp += 3;
blockProcCheck(block, player);
}
//GOLD
if(block.getTypeId() == 14){
mcUsers.getProfile(player).addMiningGather(35);
}
//GLOWSTONE
if(block.getTypeId() == 89){
xp += 3;
blockProcCheck(block, player);
}
//DIAMOND
if(block.getTypeId() == 56){
mcUsers.getProfile(player).addMiningGather(75);
}
//COAL
if(block.getTypeId() == 16){
xp += 10;
blockProcCheck(block, player);
}
//IRON
if(block.getTypeId() == 15){
mcUsers.getProfile(player).addMiningGather(20);
}
//GOLD
if(block.getTypeId() == 14){
xp += 35;
blockProcCheck(block, player);
}
//REDSTONE
if(block.getTypeId() == 73 || block.getTypeId() == 74){
mcUsers.getProfile(player).addMiningGather(15);
}
//DIAMOND
if(block.getTypeId() == 56){
xp += 75;
blockProcCheck(block, player);
}
//LAPUS
if(block.getTypeId() == 21){
mcUsers.getProfile(player).addMiningGather(40);
}
//IRON
if(block.getTypeId() == 15){
xp += 25;
blockProcCheck(block, player);
}
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++;
mcUsers.getProfile(player).removeMiningGather(mcUsers.getProfile(player).getXpToLevel("mining"));
mcUsers.getProfile(player).skillUpMining(1);
}
player.sendMessage(ChatColor.YELLOW+"Mining skill increased by "+skillups+"."+" Total ("+mcUsers.getProfile(player).getMining()+")");
}
}
//REDSTONE
if(block.getTypeId() == 73 || block.getTypeId() == 74){
xp += 15;
blockProcCheck(block, player);
}
//LAPUS
if(block.getTypeId() == 21){
xp += 40;
blockProcCheck(block, player);
}
mcUsers.getProfile(player).addMiningGather(xp * mcLoadProperties.xpGainMultiplier);
mcSkills.getInstance().XpCheck(player);
}
/*
* Handling SuperBreaker stuff
*/
public Boolean canBeSuperBroken(Block block){
int t = block.getTypeId();
if(t == 87 || t == 89 || t == 73 || t == 74 || t == 56 || t == 21 || t == 1 || t == 16 || t == 14 || t == 15){
return true;
} else {
return false;
}
}
public void SuperBreakerBlockCheck(Player player, Block block){
if(mcLoadProperties.toolsLoseDurabilityFromAbilities)
mcm.getInstance().damageTool(player, (short) mcLoadProperties.abilityDurabilityLoss);
Location loc = block.getLocation();
Material mat = Material.getMaterial(block.getTypeId());
int xp = 0;
byte damage = 0;
ItemStack item = new ItemStack(mat, 1, (byte)0, damage);
if(block.getTypeId() == 1 || block.getTypeId() == 24){
if(!mcConfig.getInstance().isBlockWatched(block)){
xp += 3;
blockProcCheck(block, player);
blockProcCheck(block, player);
}
if(block.getTypeId() == 1){
mat = Material.COBBLESTONE;
} else {
mat = Material.SANDSTONE;
}
item = new ItemStack(mat, 1, (byte)0, damage);
loc.getWorld().dropItemNaturally(loc, item);
block.setType(Material.AIR);
}
//NETHERRACK
if(block.getTypeId() == 87){
if(!mcConfig.getInstance().isBlockWatched(block)){
xp += 3;
blockProcCheck(block, player);
blockProcCheck(block, player);
}
mat = Material.getMaterial(87);
item = new ItemStack(mat, 1, (byte)0, damage);
loc.getWorld().dropItemNaturally(loc, item);
block.setType(Material.AIR);
}
//GLOWSTONE
if(block.getTypeId() == 89){
if(!mcConfig.getInstance().isBlockWatched(block)){
xp += 3;
blockProcCheck(block, player);
blockProcCheck(block, player);
}
mat = Material.getMaterial(348);
item = new ItemStack(mat, 1, (byte)0, damage);
loc.getWorld().dropItemNaturally(loc, item);
block.setType(Material.AIR);
}
//COAL
if(block.getTypeId() == 16){
if(!mcConfig.getInstance().isBlockWatched(block)){
xp += 10;
blockProcCheck(block, player);
blockProcCheck(block, player);
}
mat = Material.getMaterial(263);
item = new ItemStack(mat, 1, (byte)0, damage);
loc.getWorld().dropItemNaturally(loc, item);
block.setType(Material.AIR);
}
//GOLD
if(block.getTypeId() == 14 && mcm.getInstance().getTier(player) >= 3){
if(!mcConfig.getInstance().isBlockWatched(block)){
xp += 35;
blockProcCheck(block, player);
blockProcCheck(block, player);
}
item = new ItemStack(mat, 1, (byte)0, damage);
loc.getWorld().dropItemNaturally(loc, item);
block.setType(Material.AIR);
}
//DIAMOND
if(block.getTypeId() == 56 && mcm.getInstance().getTier(player) >= 3){
if(!mcConfig.getInstance().isBlockWatched(block)){
xp += 75;
blockProcCheck(block, player);
blockProcCheck(block, player);
}
mat = Material.getMaterial(264);
item = new ItemStack(mat, 1, (byte)0, damage);
loc.getWorld().dropItemNaturally(loc, item);
block.setType(Material.AIR);
}
//IRON
if(block.getTypeId() == 15 && mcm.getInstance().getTier(player) >= 2){
if(!mcConfig.getInstance().isBlockWatched(block)){
xp += 25;
blockProcCheck(block, player);
blockProcCheck(block, player);
}
item = new ItemStack(mat, 1, (byte)0, damage);
loc.getWorld().dropItemNaturally(loc, item);
block.setType(Material.AIR);
}
//REDSTONE
if((block.getTypeId() == 73 || block.getTypeId() == 74) && mcm.getInstance().getTier(player) >= 4){
if(!mcConfig.getInstance().isBlockWatched(block)){
xp += 15;
blockProcCheck(block, player);
blockProcCheck(block, player);
}
mat = Material.getMaterial(331);
item = new ItemStack(mat, 1, (byte)0, damage);
loc.getWorld().dropItemNaturally(loc, item);
loc.getWorld().dropItemNaturally(loc, item);
loc.getWorld().dropItemNaturally(loc, item);
if(Math.random() * 10 > 5){
loc.getWorld().dropItemNaturally(loc, item);
}
block.setType(Material.AIR);
}
//LAPUS
if(block.getTypeId() == 21 && mcm.getInstance().getTier(player) >= 3){
if(!mcConfig.getInstance().isBlockWatched(block)){
xp += 40;
blockProcCheck(block, player);
blockProcCheck(block, player);
}
mat = Material.getMaterial(351);
item = new ItemStack(mat, 1, (byte)0,(byte)0x4);
loc.getWorld().dropItemNaturally(loc, item);
loc.getWorld().dropItemNaturally(loc, item);
loc.getWorld().dropItemNaturally(loc, item);
loc.getWorld().dropItemNaturally(loc, item);
block.setType(Material.AIR);
}
mcUsers.getProfile(player).addMiningGather(xp * mcLoadProperties.xpGainMultiplier);
mcSkills.getInstance().XpCheck(player);
}
}

View File

@ -16,11 +16,19 @@ public class mcParty {
return instance;
}
public boolean inSameParty(Player playera, Player playerb){
if(mcUsers.getProfile(playera).getParty().equals(mcUsers.getProfile(playerb).getParty())){
return true;
} else {
return false;
}
if(mcUsers.getProfile(playera) == null || mcUsers.getProfile(playerb) == null){
mcUsers.addUser(playera);
mcUsers.addUser(playerb);
}
if(mcUsers.getProfile(playera).inParty() && mcUsers.getProfile(playerb).inParty()){
if(mcUsers.getProfile(playera).getParty().equals(mcUsers.getProfile(playerb).getParty())){
return true;
} else {
return false;
}
} else {
return false;
}
}
public int partyCount(Player player, Player[] players){
int x = 0;

View File

@ -30,6 +30,13 @@ public class mcPermissions {
private boolean permission(Player player, String string) {
return permissionsPlugin.Security.permission(player, string);
}
public boolean mcrefresh(Player player) {
if (permissionsEnabled) {
return permission(player, "mcmmo.tools.mcrefresh");
} else {
return true;
}
}
public boolean mmoedit(Player player) {
if (permissionsEnabled) {
return permission(player, "mcmmo.tools.mmoedit");
@ -37,7 +44,49 @@ public class mcPermissions {
return true;
}
}
public boolean woodcuttingability(Player player) {
public boolean excavationAbility(Player player){
if (permissionsEnabled) {
return permission(player, "mcmmo.ability.excavation");
} else {
return true;
}
}
public boolean unarmedAbility(Player player){
if (permissionsEnabled) {
return permission(player, "mcmmo.ability.unarmed");
} else {
return true;
}
}
public boolean chimaeraWing(Player player){
if (permissionsEnabled) {
return permission(player, "mcmmo.item.chimaerawing");
} else {
return true;
}
}
public boolean miningAbility(Player player){
if (permissionsEnabled) {
return permission(player, "mcmmo.ability.mining");
} else {
return true;
}
}
public boolean axesAbility(Player player){
if (permissionsEnabled) {
return permission(player, "mcmmo.ability.axes");
} else {
return true;
}
}
public boolean swordsAbility(Player player){
if (permissionsEnabled) {
return permission(player, "mcmmo.ability.swords");
} else {
return true;
}
}
public boolean woodCuttingAbility(Player player) {
if (permissionsEnabled) {
return permission(player, "mcmmo.ability.woodcutting");
} else {
@ -65,6 +114,13 @@ public class mcPermissions {
return true;
}
}
public boolean mcAbility(Player player) {
if (permissionsEnabled) {
return permission(player, "mcmmo.commands.ability");
} else {
return true;
}
}
public boolean mySpawn(Player player) {
if (permissionsEnabled) {
return permission(player, "mcmmo.commands.myspawn");
@ -79,6 +135,13 @@ public class mcPermissions {
return true;
}
}
public boolean setMySpawnOther(Player player) {
if (permissionsEnabled) {
return permission(player, "mcmmo.commands.setmyspawnother");
} else {
return true;
}
}
public boolean partyChat(Player player) {
if (permissionsEnabled) {
return permission(player, "mcmmo.chat.partychat");

View File

@ -5,6 +5,7 @@ import java.util.logging.Logger;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.event.player.PlayerChatEvent;
@ -60,7 +61,7 @@ public class mcPlayerListener extends PlayerListener {
public void onPlayerJoin(PlayerEvent event) {
Player player = event.getPlayer();
if(mcPermissions.getInstance().motd(player)){
player.sendMessage(ChatColor.BLUE + "This server is running mcMMO "+plugin.getDescription().getVersion()+" type /"+ChatColor.YELLOW+mcLoadProperties.mcmmo+ChatColor.BLUE+ " for help.");
player.sendMessage(ChatColor.BLUE + "This server is running mcMMO "+plugin.getDescription().getVersion()+" type /"+ChatColor.YELLOW+mcLoadProperties.mcmmo+ChatColor.BLUE+ " for help.");
}
}
//Check if string is a player
@ -69,15 +70,25 @@ public class mcPlayerListener extends PlayerListener {
Block block = event.getBlockClicked();
Player player = event.getPlayer();
ItemStack is = player.getItemInHand();
if(mcPermissions.getInstance().herbalism(player)){
//BREADCHECK, CHECKS HERBALISM SKILL FOR BREAD HP MODIFIERS
mcHerbalism.getInstance().breadCheck(player, is);
//STEW, CHECKS HERBALISM SKILL FOR BREAD HP MODIFIERS
mcHerbalism.getInstance().stewCheck(player, is);
/*
* ABILITY ACTIVATION CHECKS
*/
if(block != null){
if(mcm.getInstance().abilityBlockCheck(block))
mcSkills.getInstance().abilityActivationCheck(player, block);
} else {
mcSkills.getInstance().abilityActivationCheck(player, block);
}
if(block != null && player != null && mcPermissions.getInstance().repair(player) && block.getTypeId() == 42){
//REPAIRCHECK, CHECKS TO MAKE SURE PLAYER IS RIGHT CLICKING AN ANVIL, PLAYER HAS ENOUGH RESOURCES, AND THE ITEM IS NOT AT FULL DURABILITY.
mcRepair.getInstance().repairCheck(player, is, block);
/*
* ITEM INTERACTIONS
*/
mcItem.getInstance().itemChecks(player);
/*
* HERBALISM MODIFIERS
*/
if(mcPermissions.getInstance().herbalism(player)){
mcHerbalism.getInstance().breadCheck(player, is);
mcHerbalism.getInstance().stewCheck(player, is);
}
}
public void onPlayerCommandPreprocess(PlayerChatEvent event){
@ -86,6 +97,67 @@ 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.permissionsEnabled && split[0].equalsIgnoreCase("/"+mcLoadProperties.mcability)){
event.setCancelled(true);
if(mcUsers.getProfile(player).getAbilityUse()){
player.sendMessage("Ability use toggled off");
mcUsers.getProfile(player).toggleAbilityUse();
} else {
player.sendMessage("Ability use toggled on");
mcUsers.getProfile(player).toggleAbilityUse();
}
}
if(mcPermissions.getInstance().mcAbility(player) && split[0].equalsIgnoreCase("/"+mcLoadProperties.mcrefresh)){
event.setCancelled(true);
if(!mcPermissions.getInstance().mcrefresh(player)){
player.sendMessage(ChatColor.YELLOW+"[mcMMO]"+ChatColor.DARK_RED +" Insufficient permissions.");
return;
}
if(split.length >= 2 && isPlayer(split[1])){
player.sendMessage("You have refreshed "+split[1]+"'s cooldowns!");
player = getPlayer(split[1]);
}
/*
* AXE PREPARATION MODE
*/
mcUsers.getProfile(player).setAxePreparationMode(false);
mcUsers.getProfile(player).setAxePreparationTicks(0);
/*
* GIGA DRILL BREAKER
*/
mcUsers.getProfile(player).setGigaDrillBreakerCooldown(0);
mcUsers.getProfile(player).setGigaDrillBreakerMode(false);
mcUsers.getProfile(player).setGigaDrillBreakerTicks(0);
/*
* SERRATED STRIKE
*/
mcUsers.getProfile(player).setSerratedStrikesCooldown(0);
mcUsers.getProfile(player).setSerratedStrikesMode(false);
mcUsers.getProfile(player).setSerratedStrikesTicks(0);
/*
* SUPER BREAKER
*/
mcUsers.getProfile(player).setSuperBreakerCooldown(0);
mcUsers.getProfile(player).setSuperBreakerMode(false);
mcUsers.getProfile(player).setSuperBreakerTicks(0);
/*
* TREE FELLER
*/
mcUsers.getProfile(player).setTreeFellerCooldown(0);
mcUsers.getProfile(player).setTreeFellerMode(false);
mcUsers.getProfile(player).setTreeFellerTicks(0);
/*
* BERSERK
*/
mcUsers.getProfile(player).setBerserkCooldown(0);
mcUsers.getProfile(player).setBerserkMode(false);
mcUsers.getProfile(player).setBerserkTicks(0);
player.sendMessage(ChatColor.GREEN+"**ABILITIES REFRESHED!**");
}
if(split[0].equalsIgnoreCase("/"+mcLoadProperties.mcitem)){
}
/*
* GODMODE COMMAND
*/
@ -113,6 +185,7 @@ public class mcPlayerListener extends PlayerListener {
player.sendMessage(ChatColor.DARK_AQUA+"Myspawn is now cleared.");
}
if(mcPermissions.permissionsEnabled && split[0].equalsIgnoreCase("/"+mcLoadProperties.mmoedit)){
event.setCancelled(true);
if(!mcPermissions.getInstance().mmoedit(player)){
player.sendMessage(ChatColor.YELLOW+"[mcMMO]"+ChatColor.DARK_RED +" Insufficient permissions.");
return;
@ -135,9 +208,41 @@ public class mcPlayerListener extends PlayerListener {
player.sendMessage(ChatColor.RED+split[1]+" has been modified.");
}
} else {
player.sendMessage(ChatColor.RED+"Usage is /mmoedit playername skillname newvalue");
player.sendMessage(ChatColor.RED+"Usage is /"+mcLoadProperties.mmoedit+" playername skillname newvalue");
}
}
/*
* ADD EXPERIENCE COMMAND
*/
if(mcPermissions.permissionsEnabled && split[0].equalsIgnoreCase("/"+mcLoadProperties.addxp)){
event.setCancelled(true);
if(!mcPermissions.getInstance().mmoedit(player)){
player.sendMessage(ChatColor.YELLOW+"[mcMMO]"+ChatColor.DARK_RED +" Insufficient permissions.");
return;
}
if(split.length < 3){
player.sendMessage(ChatColor.RED+"Usage is /"+mcLoadProperties.addxp+" playername skillname xp");
return;
}
if(split.length == 4){
if(isPlayer(split[1]) && mcm.getInstance().isInt(split[3]) && mcSkills.getInstance().isSkill(split[2])){
int newvalue = Integer.valueOf(split[3]);
mcUsers.getProfile(getPlayer(split[1])).addXpToSkill(newvalue, split[2]);
getPlayer(split[1]).sendMessage(ChatColor.GREEN+"Experience granted!");
player.sendMessage(ChatColor.RED+split[2]+" has been modified.");
}
}
else if(split.length == 3){
if(mcm.getInstance().isInt(split[2]) && mcSkills.getInstance().isSkill(split[1])){
int newvalue = Integer.valueOf(split[2]);
mcUsers.getProfile(player).addXpToSkill(newvalue, split[1]);
player.sendMessage(ChatColor.RED+split[1]+" has been modified.");
}
} else {
player.sendMessage(ChatColor.RED+"Usage is /"+mcLoadProperties.addxp+" playername skillname xp");
}
}
if(mcUsers.getProfile(player).inParty() && split[0].equalsIgnoreCase("/"+mcLoadProperties.ptp)){
event.setCancelled(true);
if(!mcPermissions.getInstance().partyTeleport(player)){
@ -245,17 +350,21 @@ public class mcPlayerListener extends PlayerListener {
* SETMYSPAWN COMMAND
*/
if(split[0].equalsIgnoreCase("/"+mcLoadProperties.setmyspawn)){
event.setCancelled(true);
if(!mcPermissions.getInstance().setMySpawn(player)){
player.sendMessage(ChatColor.YELLOW+"[mcMMO]"+ChatColor.DARK_RED +" Insufficient permissions.");
return;
}
event.setCancelled(true);
if((mcPermissions.getInstance().setMySpawnOther(player) || player.isOp()) && split.length >= 2 && isPlayer(split[1])){
player.sendMessage("You have set "+split[1]+"'s spawn!");
player = getPlayer(split[1]);
}
double x = player.getLocation().getX();
double y = player.getLocation().getY();
double z = player.getLocation().getZ();
String myspawnworld = player.getWorld().getName();
mcUsers.getProfile(player).setMySpawn(x, y, z, myspawnworld);
player.sendMessage(ChatColor.DARK_AQUA + "Myspawn has been set to your current location.");
player.sendMessage(ChatColor.DARK_AQUA + "Myspawn has been set.");
}
/*
* STATS COMMAND
@ -264,7 +373,7 @@ public class mcPlayerListener extends PlayerListener {
event.setCancelled(true);
player.sendMessage(ChatColor.GREEN + "Your mcMMO Stats");
if(mcPermissions.getInstance().permissionsEnabled)
player.sendMessage(ChatColor.DARK_GRAY+"If you don't have access to a skill it will not be shown here.");
player.sendMessage(ChatColor.DARK_GRAY+"If you don't have access to a skill it will not be shown here.");
if(mcPermissions.getInstance().mining(player))
player.sendMessage(ChatColor.YELLOW + "Mining Skill: " + ChatColor.GREEN + mcUsers.getProfile(player).getMining()+ChatColor.DARK_AQUA
+ " XP("+mcUsers.getProfile(player).getMiningGather()
@ -320,6 +429,7 @@ public class mcPlayerListener extends PlayerListener {
}
//Invite Command
if(mcPermissions.getInstance().party(player) && split[0].equalsIgnoreCase("/"+mcLoadProperties.invite)){
event.setCancelled(true);
if(!mcUsers.getProfile(player).inParty()){
player.sendMessage(ChatColor.RED+"You are not in a party.");
return;
@ -332,12 +442,13 @@ public class mcPlayerListener extends PlayerListener {
Player target = getPlayer(split[1]);
mcUsers.getProfile(target).modifyInvite(mcUsers.getProfile(player).getParty());
player.sendMessage(ChatColor.GREEN+"Invite sent successfully");
target.sendMessage(ChatColor.RED+"ALERT: "+ChatColor.GREEN+"You have received a party invite for "+mcUsers.getProfile(target).getInvite());
target.sendMessage(ChatColor.RED+"ALERT: "+ChatColor.GREEN+"You have received a party invite for "+mcUsers.getProfile(target).getInvite()+" from "+player.getName());
target.sendMessage(ChatColor.YELLOW+"Type "+ChatColor.GREEN+"/"+mcLoadProperties.accept+ChatColor.YELLOW+" to accept the invite");
}
}
//Accept invite
if(mcPermissions.getInstance().party(player) && split[0].equalsIgnoreCase("/"+mcLoadProperties.accept)){
event.setCancelled(true);
if(mcUsers.getProfile(player).hasPartyInvite()){
if(mcUsers.getProfile(player).inParty()){
mcParty.getInstance().informPartyMembersQuit(player, getPlayersOnline());
@ -351,11 +462,11 @@ public class mcPlayerListener extends PlayerListener {
}
//Party command
if(split[0].equalsIgnoreCase("/"+mcLoadProperties.party)){
event.setCancelled(true);
if(!mcPermissions.getInstance().party(player)){
player.sendMessage(ChatColor.YELLOW+"[mcMMO]"+ChatColor.DARK_RED +" Insufficient permissions.");
return;
}
event.setCancelled(true);
if(split.length == 1 && !mcUsers.getProfile(player).inParty()){
player.sendMessage("Proper usage is "+"/"+mcLoadProperties.party+" <name> or 'q' to quit");
return;
@ -394,11 +505,11 @@ public class mcPlayerListener extends PlayerListener {
}
}
if(split[0].equalsIgnoreCase("/p")){
event.setCancelled(true);
if(!mcPermissions.getInstance().party(player)){
player.sendMessage(ChatColor.YELLOW+"[mcMMO]"+ChatColor.DARK_RED +" Insufficient permissions.");
return;
}
event.setCancelled(true);
if(mcConfig.getInstance().isAdminToggled(player.getName()))
mcConfig.getInstance().toggleAdminChat(playerName);
mcConfig.getInstance().togglePartyChat(playerName);
@ -427,11 +538,11 @@ public class mcPlayerListener extends PlayerListener {
* MYSPAWN
*/
if(split[0].equalsIgnoreCase("/"+mcLoadProperties.myspawn)){
event.setCancelled(true);
if(!mcPermissions.getInstance().mySpawn(player)){
player.sendMessage(ChatColor.YELLOW+"[mcMMO]"+ChatColor.DARK_RED +" Insufficient permissions.");
return;
}
event.setCancelled(true);
if(mcUsers.getProfile(player).getMySpawn(player) != null){
if(mcLoadProperties.myspawnclearsinventory)
player.getInventory().clear();

View File

@ -28,22 +28,22 @@ public class mcRepair {
/*
* DIAMOND ARMOR
*/
if(isDiamondArmor(is) && hasDiamond(player) && mcUsers.getProfile(player).getRepairInt() >= 50){
if(isDiamondArmor(is) && hasDiamond(player) && mcUsers.getProfile(player).getRepairInt() >= mcLoadProperties.repairdiamondlevel){
removeDiamond(player);
player.getItemInHand().setDurability(getArmorRepairAmount(is, player));
mcUsers.getProfile(player).addRepairGather(75);
mcUsers.getProfile(player).addRepairGather(75 * mcLoadProperties.xpGainMultiplier);
} else if (isIronArmor(is) && hasIron(player)){
/*
* IRON ARMOR
*/
removeIron(player);
player.getItemInHand().setDurability(getArmorRepairAmount(is, player));
mcUsers.getProfile(player).addRepairGather(20);
mcUsers.getProfile(player).addRepairGather(20 * mcLoadProperties.xpGainMultiplier);
//GOLD ARMOR
} else if (isGoldArmor(is) && hasGold(player)){
removeGold(player);
player.getItemInHand().setDurability(getArmorRepairAmount(is, player));
mcUsers.getProfile(player).addRepairGather(50);
mcUsers.getProfile(player).addRepairGather(50 * mcLoadProperties.xpGainMultiplier);
} else {
needMoreVespeneGas(is, player);
}
@ -58,18 +58,18 @@ public class mcRepair {
if(isIronTools(is) && hasIron(player)){
is.setDurability(getToolRepairAmount(is, player));
removeIron(player);
mcUsers.getProfile(player).addRepairGather(20);
} else if (isDiamondTools(is) && hasDiamond(player) && mcUsers.getProfile(player).getRepairInt() >= 50){ //Check if its diamond and the player has diamonds
mcUsers.getProfile(player).addRepairGather(20 * mcLoadProperties.xpGainMultiplier);
} else if (isDiamondTools(is) && hasDiamond(player) && mcUsers.getProfile(player).getRepairInt() >= mcLoadProperties.repairdiamondlevel){ //Check if its diamond and the player has diamonds
/*
* DIAMOND TOOLS
*/
is.setDurability(getToolRepairAmount(is, player));
removeDiamond(player);
mcUsers.getProfile(player).addRepairGather(75);
mcUsers.getProfile(player).addRepairGather(75 * mcLoadProperties.xpGainMultiplier);
} else if(isGoldTools(is) && hasGold(player)){
is.setDurability(getToolRepairAmount(is, player));
removeGold(player);
mcUsers.getProfile(player).addRepairGather(50);
mcUsers.getProfile(player).addRepairGather(50 * mcLoadProperties.xpGainMultiplier);
} else {
needMoreVespeneGas(is, player);
}
@ -82,15 +82,7 @@ public class mcRepair {
/*
* GIVE SKILL IF THERE IS ENOUGH XP
*/
if(mcUsers.getProfile(player).getRepairGatherInt() >= mcUsers.getProfile(player).getXpToLevel("repair")){
int skillups = 0;
while(mcUsers.getProfile(player).getRepairGatherInt() >= mcUsers.getProfile(player).getXpToLevel("repair")){
skillups++;
mcUsers.getProfile(player).removeRepairGather(mcUsers.getProfile(player).getXpToLevel("repair"));
mcUsers.getProfile(player).skillUpRepair(1);
}
player.sendMessage(ChatColor.YELLOW+"Repair skill increased by "+skillups+"."+" Total ("+mcUsers.getProfile(player).getRepair()+")");
}
mcSkills.getInstance().XpCheck(player);
}
}
public boolean isArmor(ItemStack is){
@ -234,100 +226,138 @@ public class mcRepair {
}
return false;
}
public short repairCalculate(Player player, short durability, short ramt){
float bonus = (mcUsers.getProfile(player).getRepairInt() / 500);
bonus = (ramt * bonus);
ramt = ramt+=bonus;
if(checkPlayerProcRepair(player)){
ramt = (short) (ramt * 2);
}
durability-=ramt;
if(durability < 0){
durability = 0;
}
return durability;
}
public short getToolRepairAmount(ItemStack is, Player player){
short durability = is.getDurability();
short ramt = 0;
switch(is.getTypeId())
{
//GOLD SHOVEL
case 284:
durability = 0;
ramt = 33;
break;
//IRON SHOVEL
case 256:
durability = 0;
ramt = 251;
break;
//DIAMOND SHOVEL
case 277:
durability = 0;
ramt = 1562;
break;
//IRON PICK
case 257:
durability -= 84;
ramt = 84;
break;
//IRON AXE
case 258:
durability -= 84;
ramt = 84;
break;
//IRON SWORD
case 267:
durability -= 84;
ramt = 126;
break;
//IRON HOE
case 292:
durability -= 84;
ramt = 126;
break;
//DIAMOND SWORD
case 276:
durability -= 509;
ramt = 781;
break;
//DIAMOND PICK
case 278:
durability -= 509;
ramt = 521;
break;
//DIAMOND AXE
case 279:
durability -= 509;
ramt = 521;
break;
//DIAMOND HOE
case 293:
durability -= 509;
ramt = 781;
break;
//GOLD SWORD
case 283:
durability -= 13;
ramt = 17;
break;
//GOLD PICK
case 285:
durability -= 13;
ramt = 11;
break;
//GOLD AXE
case 286:
durability -= 13;
ramt = 11;
break;
//GOLD HOE
case 294:
durability -= 13;
ramt = 17;
break;
}
if(durability < 0)
durability = 0;
if(checkPlayerProcRepair(player))
durability = 0;
return durability;
return repairCalculate(player, durability, ramt);
}
//This determines how much we repair
public short getArmorRepairAmount(ItemStack is, Player player){
short durability = is.getDurability();
short ramt = 0;
switch(is.getTypeId())
{
case 306:
durability -= 27;
break;
ramt = 27;
break;
case 310:
durability -= 55;
break;
ramt = 55;
break;
case 307:
durability -= 24;
break;
ramt = 24;
break;
case 311:
durability -= 48;
break;
ramt = 48;
break;
case 308:
durability -= 27;
break;
ramt = 27;
break;
case 312:
durability -= 53;
break;
ramt = 53;
break;
case 309:
durability -= 40;
break;
ramt = 40;
break;
case 313:
durability -= 80;
break;
ramt = 80;
break;
case 314:
ramt = 13;
break;
case 315:
ramt = 12;
break;
case 316:
ramt = 14;
break;
case 317:
ramt = 20;
break;
}
if(durability < 0)
durability = 0;
durability = 0;
if(checkPlayerProcRepair(player))
durability = 0;
return durability;
durability = 0;
return repairCalculate(player, durability, ramt);
}
public void needMoreVespeneGas(ItemStack is, Player player){
if ((isDiamondTools(is) || isDiamondArmor(is)) && mcUsers.getProfile(player).getRepairInt() < 50){
if ((isDiamondTools(is) || isDiamondArmor(is)) && mcUsers.getProfile(player).getRepairInt() < mcLoadProperties.repairdiamondlevel){
player.sendMessage(ChatColor.DARK_RED +"You're not adept enough to repair Diamond");
} else if (isDiamondTools(is) && !hasDiamond(player) || isIronTools(is) && !hasIron(player) || isGoldTools(is) && !hasGold(player)){
if(isDiamondTools(is) && !hasDiamond(player))
@ -345,27 +375,12 @@ public class mcRepair {
player.sendMessage(ChatColor.DARK_RED+"You need more "+ChatColor.GOLD+"Gold");
}
public boolean checkPlayerProcRepair(Player player){
if(mcUsers.getProfile(player).getRepairInt() >= 750){
if(Math.random() * 10 > 2){
player.sendMessage(ChatColor.GRAY + "That took no effort.");
return true;
}
} else if (mcUsers.getProfile(player).getRepairInt() >= 450 && mcUsers.getProfile(player).getRepairInt() < 750){
if(Math.random() * 10 > 4){
player.sendMessage(ChatColor.GRAY + "That felt really easy.");
return true;
}
} else if (mcUsers.getProfile(player).getRepairInt() >= 150 && mcUsers.getProfile(player).getRepairInt() < 450){
if(Math.random() * 10 > 6){
player.sendMessage(ChatColor.GRAY + "That felt pretty easy.");
return true;
}
} else if (mcUsers.getProfile(player).getRepairInt() >= 50 && mcUsers.getProfile(player).getRepairInt() < 150){
if(Math.random() * 10 > 8){
if(player != null){
if(Math.random() * 1000 <= mcUsers.getProfile(player).getRepairInt()){
player.sendMessage(ChatColor.GRAY + "That felt easy.");
return true;
}
}
return false;
}
}
}

View File

@ -1,5 +1,7 @@
package com.gmail.nossr50;
import org.bukkit.ChatColor;
import org.bukkit.block.Block;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
@ -32,6 +34,440 @@ public class mcSkills {
}
}
}
public void decreaseCooldowns(Player player){
if(mcUsers.getProfile(player).getTreeFellerCooldown() >= 1){
mcUsers.getProfile(player).decreaseTreeFellerCooldown();
if(mcUsers.getProfile(player).getTreeFellerCooldown() == 0){
player.sendMessage(ChatColor.GREEN+"Your "+ChatColor.YELLOW+"Tree Feller "+ChatColor.GREEN+"ability is refreshed!");
}
}
if(mcUsers.getProfile(player).getSuperBreakerCooldown() >= 1){
mcUsers.getProfile(player).decreaseSuperBreakerCooldown();
if(mcUsers.getProfile(player).getSuperBreakerCooldown() == 0){
player.sendMessage(ChatColor.GREEN+"Your "+ChatColor.YELLOW+"Super Breaker "+ChatColor.GREEN+"ability is refreshed!");
}
}
if(mcUsers.getProfile(player).getSerratedStrikesCooldown() >= 1){
mcUsers.getProfile(player).decreaseSerratedStrikesCooldown();
if(mcUsers.getProfile(player).getSerratedStrikesCooldown() == 0){
player.sendMessage(ChatColor.GREEN+"Your "+ChatColor.YELLOW+"Serrated Strikes "+ChatColor.GREEN+"ability is refreshed!");
}
}
if(mcUsers.getProfile(player).getBerserkCooldown() >= 1){
mcUsers.getProfile(player).decreaseBerserkCooldown();
if(mcUsers.getProfile(player).getBerserkCooldown() == 0){
player.sendMessage(ChatColor.GREEN+"Your "+ChatColor.YELLOW+"Berserk "+ChatColor.GREEN+"ability is refreshed!");
}
}
if(mcUsers.getProfile(player).getSkullSplitterCooldown() >= 1){
mcUsers.getProfile(player).decreaseSkullSplitterCooldown();
if(mcUsers.getProfile(player).getSkullSplitterCooldown() == 0){
player.sendMessage(ChatColor.GREEN+"Your "+ChatColor.YELLOW+"Skull Splitter "+ChatColor.GREEN+"ability is refreshed!");
}
}
if(mcUsers.getProfile(player).getGigaDrillBreakerCooldown() >= 1){
mcUsers.getProfile(player).decreaseGigaDrillBreakerCooldown();
if(mcUsers.getProfile(player).getGigaDrillBreakerCooldown() == 0){
player.sendMessage(ChatColor.GREEN+"Your "+ChatColor.YELLOW+"Giga Drill Breaker "+ChatColor.GREEN+"ability is refreshed!");
}
}
}
public void abilityActivationCheck(Player player, Block block){
if(!mcUsers.getProfile(player).getAbilityUse())
return;
if(mcPermissions.getInstance().miningAbility(player) && mcm.getInstance().isMiningPick(player.getItemInHand()) && !mcUsers.getProfile(player).getPickaxePreparationMode()){
if(!mcUsers.getProfile(player).getSuperBreakerMode() && mcUsers.getProfile(player).getSuperBreakerCooldown() >= 1){
player.sendMessage(ChatColor.RED+"You are too tired to use that ability again."+ChatColor.YELLOW+" ("
+mcUsers.getProfile(player).getSuperBreakerCooldown()+"s)");
return;
}
player.sendMessage(ChatColor.GREEN+"**YOU READY YOUR PICKAXE**");
mcUsers.getProfile(player).setPickaxePreparationTicks(4);
mcUsers.getProfile(player).setPickaxePreparationMode(true);
}
if(mcPermissions.getInstance().excavationAbility(player) && mcm.getInstance().isShovel(player.getItemInHand()) && !mcUsers.getProfile(player).getShovelPreparationMode()){
if(!mcUsers.getProfile(player).getGigaDrillBreakerMode() && mcUsers.getProfile(player).getGigaDrillBreakerCooldown() >= 1){
player.sendMessage(ChatColor.RED+"You are too tired to use that ability again."
+ChatColor.YELLOW+" ("+mcUsers.getProfile(player).getGigaDrillBreakerCooldown()+"s)");
return;
}
player.sendMessage(ChatColor.GREEN+"**YOU READY YOUR SHOVEL**");
mcUsers.getProfile(player).setShovelPreparationTicks(4);
mcUsers.getProfile(player).setShovelPreparationMode(true);
}
if(mcPermissions.getInstance().swordsAbility(player) && mcm.getInstance().isSwords(player.getItemInHand()) && !mcUsers.getProfile(player).getSwordsPreparationMode()){
if(!mcUsers.getProfile(player).getSerratedStrikesMode() && mcUsers.getProfile(player).getSerratedStrikesCooldown() >= 1){
player.sendMessage(ChatColor.RED+"You are too tired to use that ability again."
+ChatColor.YELLOW+" ("+mcUsers.getProfile(player).getSerratedStrikesCooldown()+"s)");
return;
}
player.sendMessage(ChatColor.GREEN+"**YOU READY YOUR SWORD**");
mcUsers.getProfile(player).setSwordsPreparationTicks(4);
mcUsers.getProfile(player).setSwordsPreparationMode(true);
}
if(mcPermissions.getInstance().unarmedAbility(player) && player.getItemInHand().getTypeId() == 0 && !mcUsers.getProfile(player).getFistsPreparationMode()){
if(!mcUsers.getProfile(player).getBerserkMode() && mcUsers.getProfile(player).getBerserkCooldown() >= 1){
player.sendMessage(ChatColor.RED+"You are too tired to use that ability again."
+ChatColor.YELLOW+" ("+mcUsers.getProfile(player).getBerserkCooldown()+"s)");
return;
}
player.sendMessage(ChatColor.GREEN+"**YOU READY YOUR FISTS**");
mcUsers.getProfile(player).setFistsPreparationTicks(4);
mcUsers.getProfile(player).setFistsPreparationMode(true);
}
if((mcPermissions.getInstance().axes(player) || mcPermissions.getInstance().woodcutting(player)) && !mcUsers.getProfile(player).getAxePreparationMode()){
if(mcm.getInstance().isAxes(player.getItemInHand())){
player.sendMessage(ChatColor.GREEN+"**YOU READY YOUR AXE**");
mcUsers.getProfile(player).setAxePreparationTicks(4);
mcUsers.getProfile(player).setAxePreparationMode(true);
}
}
}
public void serratedStrikesActivationCheck(Player player){
if(mcm.getInstance().isSwords(player.getItemInHand())){
if(mcUsers.getProfile(player).getSwordsPreparationMode()){
mcUsers.getProfile(player).setSwordsPreparationMode(false);
mcUsers.getProfile(player).setSwordsPreparationTicks(0);
}
int ticks = 2;
if(mcUsers.getProfile(player).getSwordsInt() >= 50)
ticks++;
if(mcUsers.getProfile(player).getSwordsInt() >= 150)
ticks++;
if(mcUsers.getProfile(player).getSwordsInt() >= 250)
ticks++;
if(mcUsers.getProfile(player).getSwordsInt() >= 350)
ticks++;
if(mcUsers.getProfile(player).getSwordsInt() >= 450)
ticks++;
if(mcUsers.getProfile(player).getSwordsInt() >= 550)
ticks++;
if(mcUsers.getProfile(player).getSwordsInt() >= 650)
ticks++;
if(mcUsers.getProfile(player).getSwordsInt() >= 750)
ticks++;
if(!mcUsers.getProfile(player).getSerratedStrikesMode() && mcUsers.getProfile(player).getSerratedStrikesCooldown() == 0){
player.sendMessage(ChatColor.GREEN+"**SERRATED STRIKES ACTIVATED**");
mcUsers.getProfile(player).setSerratedStrikesTicks(ticks * 2);
mcUsers.getProfile(player).setSerratedStrikesMode(true);
}
}
}
public void berserkActivationCheck(Player player){
if(player.getItemInHand().getTypeId() == 0){
if(mcUsers.getProfile(player).getFistsPreparationMode()){
mcUsers.getProfile(player).setFistsPreparationMode(false);
mcUsers.getProfile(player).setFistsPreparationTicks(0);
}
int ticks = 2;
if(mcUsers.getProfile(player).getUnarmedInt() >= 50)
ticks++;
if(mcUsers.getProfile(player).getUnarmedInt() >= 150)
ticks++;
if(mcUsers.getProfile(player).getUnarmedInt() >= 250)
ticks++;
if(mcUsers.getProfile(player).getUnarmedInt() >= 350)
ticks++;
if(mcUsers.getProfile(player).getUnarmedInt() >= 450)
ticks++;
if(mcUsers.getProfile(player).getUnarmedInt() >= 550)
ticks++;
if(mcUsers.getProfile(player).getUnarmedInt() >= 650)
ticks++;
if(mcUsers.getProfile(player).getUnarmedInt() >= 750)
ticks++;
if(!mcUsers.getProfile(player).getBerserkMode() && mcUsers.getProfile(player).getBerserkCooldown() == 0){
player.sendMessage(ChatColor.GREEN+"**BERSERK ACTIVATED**");
mcUsers.getProfile(player).setBerserkTicks(ticks * 2);
mcUsers.getProfile(player).setBerserkMode(true);
}
}
}
public void skullSplitterCheck(Player player){
if(mcm.getInstance().isAxes(player.getItemInHand())){
/*
* CHECK FOR AXE PREP MODE
*/
if(mcUsers.getProfile(player).getAxePreparationMode()){
mcUsers.getProfile(player).setAxePreparationMode(false);
mcUsers.getProfile(player).setAxePreparationTicks(0);
}
int ticks = 2;
if(mcUsers.getProfile(player).getAxesInt() >= 50)
ticks++;
if(mcUsers.getProfile(player).getAxesInt() >= 150)
ticks++;
if(mcUsers.getProfile(player).getAxesInt() >= 250)
ticks++;
if(mcUsers.getProfile(player).getAxesInt() >= 350)
ticks++;
if(mcUsers.getProfile(player).getAxesInt() >= 450)
ticks++;
if(mcUsers.getProfile(player).getAxesInt() >= 550)
ticks++;
if(mcUsers.getProfile(player).getAxesInt() >= 650)
ticks++;
if(mcUsers.getProfile(player).getAxesInt() >= 750)
ticks++;
if(!mcUsers.getProfile(player).getSkullSplitterMode() && mcUsers.getProfile(player).getSkullSplitterCooldown() == 0){
player.sendMessage(ChatColor.GREEN+"**SKULL SPLITTER ACTIVATED**");
mcUsers.getProfile(player).setSkullSplitterTicks(ticks * 2);
mcUsers.getProfile(player).setSkullSplitterMode(true);
}
if(!mcUsers.getProfile(player).getSkullSplitterMode() && mcUsers.getProfile(player).getSkullSplitterCooldown() >= 1){
player.sendMessage(ChatColor.RED+"You are too tired to use that ability again."
+ChatColor.YELLOW+" ("+mcUsers.getProfile(player).getSkullSplitterCooldown()+"s)");
}
}
}
public void monitorSkills(Player player){
/*
* AXE PREPARATION MODE
*/
if(mcUsers.getProfile(player) == null)
mcUsers.addUser(player);
if(mcUsers.getProfile(player).getAxePreparationMode()){
mcUsers.getProfile(player).decreaseAxePreparationTicks();
if(mcUsers.getProfile(player).getAxePreparationTicks() <= 0){
mcUsers.getProfile(player).setAxePreparationMode(false);
player.sendMessage(ChatColor.GRAY+"**YOU LOWER YOUR AXE**");
}
}
if(mcUsers.getProfile(player).getPickaxePreparationMode()){
mcUsers.getProfile(player).decreasePickaxePreparationTicks();
if(mcUsers.getProfile(player).getPickaxePreparationTicks() <= 0){
mcUsers.getProfile(player).setPickaxePreparationMode(false);
player.sendMessage(ChatColor.GRAY+"**YOU LOWER YOUR PICKAXE**");
}
}
if(mcUsers.getProfile(player).getSwordsPreparationMode()){
mcUsers.getProfile(player).decreaseSwordsPreparationTicks();
if(mcUsers.getProfile(player).getSwordsPreparationTicks() <= 0){
mcUsers.getProfile(player).setSwordsPreparationMode(false);
player.sendMessage(ChatColor.GRAY+"**YOU LOWER YOUR SWORD**");
}
}
if(mcUsers.getProfile(player).getFistsPreparationMode()){
mcUsers.getProfile(player).decreaseFistsPreparationTicks();
if(mcUsers.getProfile(player).getFistsPreparationTicks() <= 0){
mcUsers.getProfile(player).setFistsPreparationMode(false);
player.sendMessage(ChatColor.GRAY+"**YOU LOWER YOUR FISTS**");
}
}
if(mcUsers.getProfile(player).getShovelPreparationMode()){
mcUsers.getProfile(player).decreaseShovelPreparationTicks();
if(mcUsers.getProfile(player).getShovelPreparationTicks() <= 0){
mcUsers.getProfile(player).setShovelPreparationMode(false);
player.sendMessage(ChatColor.GRAY+"**YOU LOWER YOUR SHOVEL**");
}
}
/*
* AXES ABILITY
*/
if(mcPermissions.getInstance().axesAbility(player)){
//Monitor the length of Skull Splitter mode
if(mcUsers.getProfile(player).getSkullSplitterMode()){
mcUsers.getProfile(player).decreaseSkullSplitterTicks();
if(mcUsers.getProfile(player).getSkullSplitterTicks() <= 0){
mcUsers.getProfile(player).setSkullSplitterMode(false);
mcUsers.getProfile(player).setSkullSplitterCooldown(mcLoadProperties.skullSplitterCooldown);
player.sendMessage(ChatColor.RED+"**Skull Splitter has worn off**");
}
}
}
/*
* WOODCUTTING ABILITY
*/
if(mcPermissions.getInstance().woodCuttingAbility(player)){
if(mcUsers.getProfile(player).getTreeFellerMode()){
mcUsers.getProfile(player).decreaseTreeFellerTicks();
if(mcUsers.getProfile(player).getTreeFellerTicks() <= 0){
mcUsers.getProfile(player).setTreeFellerMode(false);
mcUsers.getProfile(player).setTreeFellerCooldown(mcLoadProperties.treeFellerCooldown);
player.sendMessage(ChatColor.RED+"**Tree Feller has worn off**");
}
}
}
/*
* MINING ABILITY
*/
if(mcPermissions.getInstance().miningAbility(player)){
if(mcUsers.getProfile(player).getSuperBreakerMode()){
mcUsers.getProfile(player).decreaseSuperBreakerTicks();
if(mcUsers.getProfile(player).getSuperBreakerTicks() <= 0){
mcUsers.getProfile(player).setSuperBreakerMode(false);
mcUsers.getProfile(player).setSuperBreakerCooldown(mcLoadProperties.superBreakerCooldown);
player.sendMessage(ChatColor.RED+"**Super Breaker has worn off**");
}
}
}
/*
* EXCAVATION ABILITY
*/
if(mcPermissions.getInstance().excavationAbility(player)){
if(mcUsers.getProfile(player).getGigaDrillBreakerMode()){
mcUsers.getProfile(player).decreaseGigaDrillBreakerTicks();
if(mcUsers.getProfile(player).getGigaDrillBreakerTicks() <= 0){
mcUsers.getProfile(player).setGigaDrillBreakerMode(false);
mcUsers.getProfile(player).setGigaDrillBreakerCooldown(mcLoadProperties.gigaDrillBreakerCooldown);
player.sendMessage(ChatColor.RED+"**You feel spiral energy leaving you**");
}
}
}
/*
* SWORDS ABILITY
*/
if(mcPermissions.getInstance().swordsAbility(player)){
if(mcUsers.getProfile(player).getSerratedStrikesMode()){
mcUsers.getProfile(player).decreaseSerratedStrikesTicks();
if(mcUsers.getProfile(player).getSerratedStrikesTicks() <= 0){
mcUsers.getProfile(player).setSerratedStrikesMode(false);
mcUsers.getProfile(player).setSerratedStrikesCooldown(mcLoadProperties.serratedStrikeCooldown);
player.sendMessage(ChatColor.RED+"**Serrated Strikes has worn off**");
}
}
}
/*
* UNARMED ABILITY
*/
if(mcPermissions.getInstance().unarmedAbility(player)){
if(mcUsers.getProfile(player).getBerserkMode()){
mcUsers.getProfile(player).decreaseBerserkTicks();
if(mcUsers.getProfile(player).getBerserkTicks() <= 0){
mcUsers.getProfile(player).setBerserkMode(false);
mcUsers.getProfile(player).setBerserkCooldown(mcLoadProperties.berserkCooldown);
player.sendMessage(ChatColor.RED+"**Berserk has worn off**");
}
}
}
}
public void XpCheck(Player player){
/*
* 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++;
mcUsers.getProfile(player).removeAcrobaticsGather(mcUsers.getProfile(player).getXpToLevel("acrobatics"));
mcUsers.getProfile(player).skillUpAcrobatics(1);
}
player.sendMessage(ChatColor.YELLOW+"Acrobatics skill increased by "+skillups+"."+" Total ("+mcUsers.getProfile(player).getAcrobatics()+")");
}
/*
* ARCHERY
*/
if(mcUsers.getProfile(player).getArcheryGatherInt() >= mcUsers.getProfile(player).getXpToLevel("archery")){
int skillups = 0;
while(mcUsers.getProfile(player).getArcheryGatherInt() >= mcUsers.getProfile(player).getXpToLevel("archery")){
skillups++;
mcUsers.getProfile(player).removeArcheryGather(mcUsers.getProfile(player).getXpToLevel("archery"));
mcUsers.getProfile(player).skillUpArchery(1);
}
player.sendMessage(ChatColor.YELLOW+"Archery skill increased by "+skillups+"."+" Total ("+mcUsers.getProfile(player).getArchery()+")");
}
/*
* SWORDS
*/
if(mcUsers.getProfile(player).getSwordsGatherInt() >= mcUsers.getProfile(player).getXpToLevel("swords")){
int skillups = 0;
while(mcUsers.getProfile(player).getSwordsGatherInt() >= mcUsers.getProfile(player).getXpToLevel("swords")){
skillups++;
mcUsers.getProfile(player).removeSwordsGather(mcUsers.getProfile(player).getXpToLevel("swords"));
mcUsers.getProfile(player).skillUpSwords(1);
}
player.sendMessage(ChatColor.YELLOW+"Swords skill increased by "+skillups+"."+" Total ("+mcUsers.getProfile(player).getSwords()+")");
}
/*
* AXES
*/
if(mcUsers.getProfile(player).getAxesGatherInt() >= mcUsers.getProfile(player).getXpToLevel("axes")){
int skillups = 0;
while(mcUsers.getProfile(player).getAxesGatherInt() >= mcUsers.getProfile(player).getXpToLevel("axes")){
skillups++;
mcUsers.getProfile(player).removeAxesGather(mcUsers.getProfile(player).getXpToLevel("axes"));
mcUsers.getProfile(player).skillUpAxes(1);
}
player.sendMessage(ChatColor.YELLOW+"Axes skill increased by "+skillups+"."+" Total ("+mcUsers.getProfile(player).getAxes()+")");
}
/*
* UNARMED
*/
if(mcUsers.getProfile(player).getUnarmedGatherInt() >= mcUsers.getProfile(player).getXpToLevel("unarmed")){
int skillups = 0;
while(mcUsers.getProfile(player).getUnarmedGatherInt() >= mcUsers.getProfile(player).getXpToLevel("unarmed")){
skillups++;
mcUsers.getProfile(player).removeUnarmedGather(mcUsers.getProfile(player).getXpToLevel("unarmed"));
mcUsers.getProfile(player).skillUpUnarmed(1);
}
player.sendMessage(ChatColor.YELLOW+"Unarmed skill increased by "+skillups+"."+" Total ("+mcUsers.getProfile(player).getUnarmed()+")");
}
/*
* HERBALISM
*/
if(mcUsers.getProfile(player).getHerbalismGatherInt() >= mcUsers.getProfile(player).getXpToLevel("herbalism")){
int skillups = 0;
while(mcUsers.getProfile(player).getHerbalismGatherInt() >= mcUsers.getProfile(player).getXpToLevel("herbalism")){
skillups++;
mcUsers.getProfile(player).removeHerbalismGather(mcUsers.getProfile(player).getXpToLevel("herbalism"));
mcUsers.getProfile(player).skillUpHerbalism(1);
}
player.sendMessage(ChatColor.YELLOW+"Herbalism skill increased by "+skillups+"."+" Total ("+mcUsers.getProfile(player).getHerbalism()+")");
}
/*
* 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++;
mcUsers.getProfile(player).removeMiningGather(mcUsers.getProfile(player).getXpToLevel("mining"));
mcUsers.getProfile(player).skillUpMining(1);
}
player.sendMessage(ChatColor.YELLOW+"Mining skill increased by "+skillups+"."+" Total ("+mcUsers.getProfile(player).getMining()+")");
}
/*
* WOODCUTTING
*/
if(player != null && mcUsers.getProfile(player).getWoodCuttingGatherInt() >= mcUsers.getProfile(player).getXpToLevel("woodcutting")){
int skillups = 0;
while(mcUsers.getProfile(player).getWoodCuttingGatherInt() >= mcUsers.getProfile(player).getXpToLevel("woodcutting")){
skillups++;
mcUsers.getProfile(player).removeWoodCuttingGather(mcUsers.getProfile(player).getXpToLevel("woodcutting"));
mcUsers.getProfile(player).skillUpWoodCutting(1);
}
player.sendMessage(ChatColor.YELLOW+"WoodCutting skill increased by "+skillups+"."+" Total ("+mcUsers.getProfile(player).getWoodCutting()+")");
}
/*
* REPAIR
*/
if(mcUsers.getProfile(player).getRepairGatherInt() >= mcUsers.getProfile(player).getXpToLevel("repair")){
int skillups = 0;
while(mcUsers.getProfile(player).getRepairGatherInt() >= mcUsers.getProfile(player).getXpToLevel("repair")){
skillups++;
mcUsers.getProfile(player).removeRepairGather(mcUsers.getProfile(player).getXpToLevel("repair"));
mcUsers.getProfile(player).skillUpRepair(1);
}
player.sendMessage(ChatColor.YELLOW+"Repair skill increased by "+skillups+"."+" Total ("+mcUsers.getProfile(player).getRepair()+")");
}
/*
* EXCAVATION
*/
if(mcUsers.getProfile(player).getExcavationGatherInt() >= mcUsers.getProfile(player).getXpToLevel("excavation")){
int skillups = 0;
while(mcUsers.getProfile(player).getExcavationGatherInt() >= mcUsers.getProfile(player).getXpToLevel("excavation")){
skillups++;
mcUsers.getProfile(player).removeExcavationGather(mcUsers.getProfile(player).getXpToLevel("excavation"));
mcUsers.getProfile(player).skillUpExcavation(1);
}
player.sendMessage(ChatColor.YELLOW+"Excavation skill increased by "+skillups+"."+" Total ("+mcUsers.getProfile(player).getExcavation()+")");
}
}
public boolean isSkill(String skillname){
if(skillname.equals("mining")){
return true;
@ -75,5 +511,6 @@ public class mcSkills {
x++;
}
}
mcConfig.getInstance().removeArrowTracked(entity);
}
}

View File

@ -1,6 +1,8 @@
package com.gmail.nossr50;
import java.awt.Color;
import java.util.TimerTask;
import org.bukkit.ChatColor;
import org.bukkit.entity.*;
public class mcTimer extends TimerTask{
@ -13,50 +15,70 @@ public class mcTimer extends TimerTask{
public void run() {
Player[] playerlist = plugin.getServer().getOnlinePlayers();
if(thecount == 5 || thecount == 10 || thecount == 15 || thecount == 20){
for(Player player : playerlist){
if(player != null &&
player.getHealth() > 0 && player.getHealth() < 20
&& mcUsers.getProfile(player).getPowerLevel() >= 1000
&& mcUsers.getProfile(player).getRecentlyHurt() == 0
&& mcPermissions.getInstance().regeneration(player)){
player.setHealth(mcm.getInstance().calculateHealth(player.getHealth(), 1));
}
}
}
if(thecount == 10 || thecount == 20){
for(Player player : playerlist){
if(player != null &&
player.getHealth() > 0 && player.getHealth() < 20
&& mcUsers.getProfile(player).getPowerLevel() >= 500
&& mcUsers.getProfile(player).getPowerLevel() < 1000
&& mcUsers.getProfile(player).getRecentlyHurt() == 0
&& mcPermissions.getInstance().regeneration(player)){
player.setHealth(mcm.getInstance().calculateHealth(player.getHealth(), 1));
}
}
}
if(thecount == 20){
for(Player player : playerlist){
if(player != null &&
player.getHealth() > 0 && player.getHealth() < 20
&& mcUsers.getProfile(player).getPowerLevel() < 500
&& mcUsers.getProfile(player).getRecentlyHurt() == 0
&& mcPermissions.getInstance().regeneration(player)){
player.setHealth(mcm.getInstance().calculateHealth(player.getHealth(), 1));
}
}
}
for(Player player : playerlist){
if(player != null && mcUsers.getProfile(player).getRecentlyHurt() >= 1){
mcUsers.getProfile(player).decreaseLastHurt();
if(player == null)
continue;
if(mcUsers.getProfile(player) == null)
mcUsers.addUser(player);
/*
* MONITOR SKILLS
*/
mcSkills.getInstance().monitorSkills(player);
/*
* COOLDOWN MONITORING
*/
mcSkills.getInstance().decreaseCooldowns(player);
/*
* PLAYER BLEED MONITORING
*/
if(thecount % 2 == 0 && player != null && mcUsers.getProfile(player).getBleedTicks() >= 1){
player.damage(2);
mcUsers.getProfile(player).decreaseBleedTicks();
}
if(mcPermissions.getInstance().regeneration(player)){
if(thecount == 10 || thecount == 20 || thecount == 30 || thecount == 40){
if(player != null &&
player.getHealth() > 0 && player.getHealth() < 20
&& mcUsers.getProfile(player).getPowerLevel(player) >= 1000
&& mcUsers.getProfile(player).getRecentlyHurt() == 0){
player.setHealth(mcm.getInstance().calculateHealth(player.getHealth(), 1));
}
}
if(thecount == 20 || thecount == 40){
if(player != null &&
player.getHealth() > 0 && player.getHealth() < 20
&& mcUsers.getProfile(player).getPowerLevel(player) >= 500
&& mcUsers.getProfile(player).getPowerLevel(player) < 1000
&& mcUsers.getProfile(player).getRecentlyHurt() == 0){
player.setHealth(mcm.getInstance().calculateHealth(player.getHealth(), 1));
}
}
if(thecount == 40){
if(player != null &&
player.getHealth() > 0 && player.getHealth() < 20
&& mcUsers.getProfile(player).getPowerLevel(player) < 500
&& mcUsers.getProfile(player).getRecentlyHurt() == 0){
player.setHealth(mcm.getInstance().calculateHealth(player.getHealth(), 1));
}
}
if(player != null && mcUsers.getProfile(player).getRecentlyHurt() >= 1){
mcUsers.getProfile(player).decreaseLastHurt();
}
}
}
if(thecount < 20){
thecount++;
/*
* NON-PLAYER BLEED MONITORING
*/
if(thecount % 2 == 0)
mcCombat.getInstance().bleedSimulate();
if(thecount < 40){
thecount++;
} else {
thecount = 1;
thecount = 1;
}
mcCombat.getInstance().bleedSimulate();
}
}

View File

@ -13,7 +13,7 @@ import org.bukkit.plugin.Plugin;
public class mcUsers {
private static volatile mcUsers instance;
protected static final Logger log = Logger.getLogger("Minecraft");
String location = "mcmmo.users";
String location = "plugins/mcMMO/mcmmo.users";
public static PlayerList players = new PlayerList();
private Properties properties = new Properties();
@ -156,12 +156,14 @@ class PlayerList
protected final Logger log = Logger.getLogger("Minecraft");
private String playerName, gather, wgather, woodcutting, repair, mining, party, myspawn, myspawnworld, unarmed, herbalism, excavation,
archery, swords, axes, invite, acrobatics, repairgather, unarmedgather, herbalismgather, excavationgather, archerygather, swordsgather, axesgather, acrobaticsgather;
private boolean dead;
private int recentlyhurt = 0, bleedticks = 0;
private boolean dead, abilityuse = true, treeFellerMode, superBreakerMode, gigaDrillBreakerMode, serratedStrikesMode, shovelPreparationMode, swordsPreparationMode, fistsPreparationMode, pickaxePreparationMode, axePreparationMode, skullSplitterMode, berserkMode;
private int recentlyhurt = 0, bleedticks = 0, gigaDrillBreakerCooldown = 0, gigaDrillBreakerTicks = 0, berserkTicks = 0, berserkCooldown = 0, superBreakerTicks = 0, superBreakerCooldown = 0,
serratedStrikesTicks = 0, skullSplitterTicks = 0, skullSplitterCooldown = 0, serratedStrikesCooldown = 0, treeFellerTicks = 0, treeFellerCooldown = 0,
axePreparationTicks = 0, pickaxePreparationTicks = 0, fistsPreparationTicks = 0, shovelPreparationTicks = 0, swordsPreparationTicks = 0;
Player thisplayer;
char defaultColor;
String location = "mcmmo.users";
String location = "plugins/mcMMO/mcmmo.users";
//=====================================================================
@ -206,7 +208,7 @@ class PlayerList
//gather = "0";
party = null;
dead = false;
treeFellerMode = false;
//Try to load the player and if they aren't found, append them
if(!load())
addPlayer();
@ -417,6 +419,16 @@ class PlayerList
{
return player.getName().equals(playerName);
}
public boolean getAbilityUse(){
return abilityuse;
}
public void toggleAbilityUse(){
if(abilityuse == false){
abilityuse = true;
} else {
abilityuse = false;
}
}
public void decreaseLastHurt(){
if(recentlyhurt >= 1){
recentlyhurt--;
@ -433,6 +445,303 @@ class PlayerList
public void setBleedTicks(Integer newvalue){
bleedticks = newvalue;
}
public void addBleedTicks(Integer newvalue){
bleedticks+=newvalue;
}
public Boolean hasCooldowns(){
if((treeFellerCooldown + superBreakerCooldown) >= 1){
return true;
} else {
return false;
}
}
/*
* SWORDS PREPARATION
*/
public boolean getSwordsPreparationMode(){
return swordsPreparationMode;
}
public void setSwordsPreparationMode(Boolean bool){
swordsPreparationMode = bool;
}
public Integer getSwordsPreparationTicks(){
return swordsPreparationTicks;
}
public void setSwordsPreparationTicks(Integer newvalue){
swordsPreparationTicks = newvalue;
}
public void decreaseSwordsPreparationTicks(){
if(swordsPreparationTicks >= 1){
swordsPreparationTicks--;
}
}
/*
* SHOVEL PREPARATION
*/
public boolean getShovelPreparationMode(){
return shovelPreparationMode;
}
public void setShovelPreparationMode(Boolean bool){
shovelPreparationMode = bool;
}
public Integer getShovelPreparationTicks(){
return shovelPreparationTicks;
}
public void setShovelPreparationTicks(Integer newvalue){
shovelPreparationTicks = newvalue;
}
public void decreaseShovelPreparationTicks(){
if(shovelPreparationTicks >= 1){
shovelPreparationTicks--;
}
}
/*
* FISTS PREPARATION
*/
public boolean getFistsPreparationMode(){
return fistsPreparationMode;
}
public void setFistsPreparationMode(Boolean bool){
fistsPreparationMode = bool;
}
public Integer getFistsPreparationTicks(){
return fistsPreparationTicks;
}
public void setFistsPreparationTicks(Integer newvalue){
fistsPreparationTicks = newvalue;
}
public void decreaseFistsPreparationTicks(){
if(fistsPreparationTicks >= 1){
fistsPreparationTicks--;
}
}
/*
* AXE PREPARATION
*/
public boolean getAxePreparationMode(){
return axePreparationMode;
}
public void setAxePreparationMode(Boolean bool){
axePreparationMode = bool;
}
public Integer getAxePreparationTicks(){
return axePreparationTicks;
}
public void setAxePreparationTicks(Integer newvalue){
axePreparationTicks = newvalue;
}
public void decreaseAxePreparationTicks(){
if(axePreparationTicks >= 1){
axePreparationTicks--;
}
}
/*
* PICKAXE PREPARATION
*/
public boolean getPickaxePreparationMode(){
return pickaxePreparationMode;
}
public void setPickaxePreparationMode(Boolean bool){
pickaxePreparationMode = bool;
}
public Integer getPickaxePreparationTicks(){
return pickaxePreparationTicks;
}
public void setPickaxePreparationTicks(Integer newvalue){
pickaxePreparationTicks = newvalue;
}
public void decreasePickaxePreparationTicks(){
if(pickaxePreparationTicks >= 1){
pickaxePreparationTicks--;
}
}
/*
* BERSERK MODE
*/
public boolean getBerserkMode(){
return berserkMode;
}
public void setBerserkMode(Boolean bool){
berserkMode = bool;
}
public Integer getBerserkTicks(){
return berserkTicks;
}
public void setBerserkTicks(Integer newvalue){
berserkTicks = newvalue;
}
public void decreaseBerserkTicks(){
if(berserkTicks >= 1){
berserkTicks--;
}
}
public void setBerserkCooldown(Integer newvalue){
berserkCooldown = newvalue;
}
public int getBerserkCooldown(){
return berserkCooldown;
}
public void decreaseBerserkCooldown(){
if(berserkCooldown >= 1){
berserkCooldown--;
}
}
/*
* SKULL SPLITTER
*/
public boolean getSkullSplitterMode(){
return skullSplitterMode;
}
public void setSkullSplitterMode(Boolean bool){
skullSplitterMode = bool;
}
public Integer getSkullSplitterTicks(){
return skullSplitterTicks;
}
public void setSkullSplitterTicks(Integer newvalue){
skullSplitterTicks = newvalue;
}
public void decreaseSkullSplitterTicks(){
if(skullSplitterTicks >= 1){
skullSplitterTicks--;
}
}
public void setSkullSplitterCooldown(Integer newvalue){
skullSplitterCooldown = newvalue;
}
public int getSkullSplitterCooldown(){
return skullSplitterCooldown;
}
public void decreaseSkullSplitterCooldown(){
if(skullSplitterCooldown >= 1){
skullSplitterCooldown--;
}
}
/*
* SERRATED STRIKES
*/
public boolean getSerratedStrikesMode(){
return serratedStrikesMode;
}
public void setSerratedStrikesMode(Boolean bool){
serratedStrikesMode = bool;
}
public Integer getSerratedStrikesTicks(){
return serratedStrikesTicks;
}
public void setSerratedStrikesTicks(Integer newvalue){
serratedStrikesTicks = newvalue;
}
public void decreaseSerratedStrikesTicks(){
if(serratedStrikesTicks >= 1){
serratedStrikesTicks--;
}
}
public void setSerratedStrikesCooldown(Integer newvalue){
serratedStrikesCooldown = newvalue;
}
public int getSerratedStrikesCooldown(){
return serratedStrikesCooldown;
}
public void decreaseSerratedStrikesCooldown(){
if(serratedStrikesCooldown >= 1){
serratedStrikesCooldown--;
}
}
/*
* GIGA DRILL BREAKER
*/
public boolean getGigaDrillBreakerMode(){
return gigaDrillBreakerMode;
}
public void setGigaDrillBreakerMode(Boolean bool){
gigaDrillBreakerMode = bool;
}
public Integer getGigaDrillBreakerTicks(){
return gigaDrillBreakerTicks;
}
public void setGigaDrillBreakerTicks(Integer newvalue){
gigaDrillBreakerTicks = newvalue;
}
public void decreaseGigaDrillBreakerTicks(){
if(gigaDrillBreakerTicks >= 1){
gigaDrillBreakerTicks--;
}
}
public void setGigaDrillBreakerCooldown(Integer newvalue){
gigaDrillBreakerCooldown = newvalue;
}
public int getGigaDrillBreakerCooldown(){
return gigaDrillBreakerCooldown;
}
public void decreaseGigaDrillBreakerCooldown(){
if(gigaDrillBreakerCooldown >= 1){
gigaDrillBreakerCooldown--;
}
}
/*
* TREE FELLER STUFF
*/
public boolean getTreeFellerMode(){
return treeFellerMode;
}
public void setTreeFellerMode(Boolean bool){
treeFellerMode = bool;
}
public Integer getTreeFellerTicks(){
return treeFellerTicks;
}
public void setTreeFellerTicks(Integer newvalue){
treeFellerTicks = newvalue;
}
public void decreaseTreeFellerTicks(){
if(treeFellerTicks >= 1){
treeFellerTicks--;
}
}
public void setTreeFellerCooldown(Integer newvalue){
treeFellerCooldown = newvalue;
}
public int getTreeFellerCooldown(){
return treeFellerCooldown;
}
public void decreaseTreeFellerCooldown(){
if(treeFellerCooldown >= 1){
treeFellerCooldown--;
}
}
/*
* MINING
*/
public boolean getSuperBreakerMode(){
return superBreakerMode;
}
public void setSuperBreakerMode(Boolean bool){
superBreakerMode = bool;
}
public Integer getSuperBreakerTicks(){
return superBreakerTicks;
}
public void setSuperBreakerTicks(Integer newvalue){
superBreakerTicks = newvalue;
}
public void decreaseSuperBreakerTicks(){
if(superBreakerTicks >= 1){
superBreakerTicks--;
}
}
public void setSuperBreakerCooldown(Integer newvalue){
superBreakerCooldown = newvalue;
}
public int getSuperBreakerCooldown(){
return superBreakerCooldown;
}
public void decreaseSuperBreakerCooldown(){
if(superBreakerCooldown >= 1){
superBreakerCooldown--;
}
}
public Integer getRecentlyHurt(){
return recentlyhurt;
}
@ -1129,35 +1438,68 @@ class PlayerList
return 0;
}
}
public void addXpToSkill(int newvalue, String skillname){
if(skillname.toLowerCase().equals("mining")){
gather = String.valueOf(Integer.valueOf(gather)+newvalue);
}
if(skillname.toLowerCase().equals("woodcutting")){
wgather = String.valueOf(Integer.valueOf(wgather)+newvalue);
}
if(skillname.toLowerCase().equals("repair")){
repairgather = String.valueOf(Integer.valueOf(repairgather)+newvalue);
}
if(skillname.toLowerCase().equals("herbalism")){
herbalismgather = String.valueOf(Integer.valueOf(herbalismgather)+newvalue);
}
if(skillname.toLowerCase().equals("acrobatics")){
acrobaticsgather = String.valueOf(Integer.valueOf(acrobaticsgather)+newvalue);
}
if(skillname.toLowerCase().equals("swords")){
swordsgather = String.valueOf(Integer.valueOf(swordsgather)+newvalue);
}
if(skillname.toLowerCase().equals("archery")){
archerygather = String.valueOf(Integer.valueOf(archerygather)+newvalue);
}
if(skillname.toLowerCase().equals("unarmed")){
unarmedgather = String.valueOf(Integer.valueOf(unarmedgather)+newvalue);
}
if(skillname.toLowerCase().equals("excavation")){
excavationgather = String.valueOf(Integer.valueOf(excavationgather)+newvalue);
}
if(skillname.toLowerCase().equals("axes")){
axesgather = String.valueOf(Integer.valueOf(axesgather)+newvalue);
}
save();
}
public void modifyskill(int newvalue, String skillname){
if(skillname.equals("mining")){
if(skillname.toLowerCase().equals("mining")){
mining = String.valueOf(newvalue);
}
if(skillname.equals("woodcutting")){
if(skillname.toLowerCase().equals("woodcutting")){
woodcutting = String.valueOf(newvalue);
}
if(skillname.equals("repair")){
if(skillname.toLowerCase().equals("repair")){
repair = String.valueOf(newvalue);
}
if(skillname.equals("herbalism")){
if(skillname.toLowerCase().equals("herbalism")){
herbalism = String.valueOf(newvalue);
}
if(skillname.equals("acrobatics")){
if(skillname.toLowerCase().equals("acrobatics")){
acrobatics = String.valueOf(newvalue);
}
if(skillname.equals("swords")){
if(skillname.toLowerCase().equals("swords")){
swords = String.valueOf(newvalue);
}
if(skillname.equals("archery")){
if(skillname.toLowerCase().equals("archery")){
archery = String.valueOf(newvalue);
}
if(skillname.equals("unarmed")){
if(skillname.toLowerCase().equals("unarmed")){
unarmed = String.valueOf(newvalue);
}
if(skillname.equals("excavation")){
if(skillname.toLowerCase().equals("excavation")){
excavation = String.valueOf(newvalue);
}
if(skillname.equals("axes")){
if(skillname.toLowerCase().equals("axes")){
axes = String.valueOf(newvalue);
}
save();
@ -1196,9 +1538,28 @@ class PlayerList
return 0;
}
}
public int getPowerLevel(){
public int getPowerLevel(Player player){
int x = 0;
x+=getMiningInt()+getRepairInt()+getWoodCuttingInt()+getUnarmedInt()+getHerbalismInt()+getExcavationInt()+getArcheryInt()+getSwordsInt()+getAxesInt()+getAcrobaticsInt();
if(mcPermissions.getInstance().mining(player))
x+=getMiningInt();
if(mcPermissions.getInstance().woodcutting(player))
x+=getWoodCuttingInt();
if(mcPermissions.getInstance().unarmed(player))
x+=getUnarmedInt();
if(mcPermissions.getInstance().herbalism(player))
x+=getHerbalismInt();
if(mcPermissions.getInstance().excavation(player))
x+=getExcavationInt();
if(mcPermissions.getInstance().archery(player))
x+=getArcheryInt();
if(mcPermissions.getInstance().swords(player))
x+=getSwordsInt();
if(mcPermissions.getInstance().axes(player))
x+=getAxesInt();
if(mcPermissions.getInstance().acrobatics(player))
x+=getAcrobaticsInt();
if(mcPermissions.getInstance().repair(player))
x+=getRepairInt();
return x;
}
public int getMiningGatherInt() {

View File

@ -1,5 +1,8 @@
package com.gmail.nossr50;
import java.util.ArrayList;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
@ -7,6 +10,8 @@ import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
public class mcWoodCutting {
int w = 0;
private boolean isdone = false;
private static mcMMO plugin;
public mcWoodCutting(mcMMO instance) {
plugin = instance;
@ -21,47 +26,119 @@ public class mcWoodCutting {
public void woodCuttingProcCheck(Player player, Block block, Location loc){
byte type = block.getData();
Material mat = Material.getMaterial(block.getTypeId());
byte damage = 0;
if(mcUsers.getProfile(player).getWoodCuttingInt() > 1000){
ItemStack item = new ItemStack(mat, 1, type, damage);
if(player != null){
if(Math.random() * 1000 <= mcUsers.getProfile(player).getWoodCuttingInt()){
ItemStack item = new ItemStack(mat, 1, (short) 0, type);
loc.getWorld().dropItemNaturally(loc, item);
return;
}
}
if(mcUsers.getProfile(player).getWoodCuttingInt() > 750){
if((Math.random() * 10) > 2){
ItemStack item = new ItemStack(mat, 1, type, damage);
loc.getWorld().dropItemNaturally(loc, item);
return;
}
}
if(mcUsers.getProfile(player).getWoodCuttingInt() > 300){
if((Math.random() * 10) > 4){
ItemStack item = new ItemStack(mat, 1, type, damage);
loc.getWorld().dropItemNaturally(loc, item);
return;
}
}
if(mcUsers.getProfile(player).getWoodCuttingInt() > 100){
if((Math.random() * 10) > 6){
ItemStack item = new ItemStack(mat, 1, type, damage);
loc.getWorld().dropItemNaturally(loc, item);
return;
}
}
if(mcUsers.getProfile(player).getWoodCuttingInt() > 10){
if((Math.random() * 10) > 8){
ItemStack item = new ItemStack(mat, 1, type, damage);
loc.getWorld().dropItemNaturally(loc, item);
return;
}
}
}
public void treeFeller(Block block){
Location loc = block.getLocation();
public void treeFellerCheck(Player player, Block block){
if(mcm.getInstance().isAxes(player.getItemInHand())){
if(block != null){
if(!mcm.getInstance().abilityBlockCheck(block))
return;
}
/*
* CHECK FOR AXE PREP MODE
*/
if(mcUsers.getProfile(player).getAxePreparationMode()){
mcUsers.getProfile(player).setAxePreparationMode(false);
mcUsers.getProfile(player).setAxePreparationTicks(0);
}
int ticks = 2;
if(mcUsers.getProfile(player).getWoodCuttingInt() >= 50)
ticks++;
if(mcUsers.getProfile(player).getWoodCuttingInt() >= 150)
ticks++;
if(mcUsers.getProfile(player).getWoodCuttingInt() >= 250)
ticks++;
if(mcUsers.getProfile(player).getWoodCuttingInt() >= 350)
ticks++;
if(mcUsers.getProfile(player).getWoodCuttingInt() >= 450)
ticks++;
if(mcUsers.getProfile(player).getWoodCuttingInt() >= 550)
ticks++;
if(mcUsers.getProfile(player).getWoodCuttingInt() >= 650)
ticks++;
if(mcUsers.getProfile(player).getWoodCuttingInt() >= 750)
ticks++;
if(!mcUsers.getProfile(player).getTreeFellerMode() && mcUsers.getProfile(player).getTreeFellerCooldown() == 0){
player.sendMessage(ChatColor.GREEN+"**TREE FELLING ACTIVATED**");
mcUsers.getProfile(player).setTreeFellerTicks(ticks * 2);
mcUsers.getProfile(player).setTreeFellerMode(true);
}
if(!mcUsers.getProfile(player).getTreeFellerMode() && mcUsers.getProfile(player).getTreeFellerCooldown() >= 1){
player.sendMessage(ChatColor.RED+"You are too tired to use that ability again."
+ChatColor.YELLOW+" ("+mcUsers.getProfile(player).getTreeFellerCooldown()+"s)");
}
}
}
public void treeFeller(Block block, Player player){
int radius = 1;
int typeid = 17;
if(mcm.getInstance().isBlockAround(loc, radius, typeid)){
if(mcUsers.getProfile(player).getWoodCuttingGatherInt() >= 500)
radius++;
if(mcUsers.getProfile(player).getWoodCuttingGatherInt() >= 950)
radius++;
ArrayList<Block> blocklist = new ArrayList<Block>();
ArrayList<Block> toAdd = new ArrayList<Block>();
if(block != null)
blocklist.add(block);
while(isdone == false){
addBlocksToTreeFelling(blocklist, toAdd, radius);
}
//This needs to be a hashmap too!
isdone = false;
/*
* Add blocks from the temporary 'toAdd' array list into the 'treeFeller' array list
* We use this temporary list to prevent concurrent modification exceptions
*/
for(Block x : toAdd){
if(!mcConfig.getInstance().isTreeFellerWatched(x))
mcConfig.getInstance().addTreeFeller(x);
}
toAdd.clear();
}
public void addBlocksToTreeFelling(ArrayList<Block> blocklist, ArrayList<Block> toAdd, Integer radius){
int u = 0;
for (Block x : blocklist){
u++;
if(toAdd.contains(x))
continue;
w = 0;
Location loc = x.getLocation();
int vx = x.getX();
int vy = x.getY();
int vz = x.getZ();
/*
* Run through the blocks around the broken block to see if they qualify to be 'felled'
*/
for (int cx = -radius; cx <= radius; cx++) {
for (int cy = -radius; cy <= radius; cy++) {
for (int cz = -radius; cz <= radius; cz++) {
Block blocktarget = loc.getWorld().getBlockAt(vx + cx, vy + cy, vz + cz);
if (!blocklist.contains(blocktarget) && !toAdd.contains(blocktarget) && (blocktarget.getTypeId() == 17 || blocktarget.getTypeId() == 18)) {
toAdd.add(blocktarget);
w++;
}
}
}
}
}
/*
* Add more blocks to blocklist so they can be 'felled'
*/
for(Block xx : toAdd){
if(!blocklist.contains(xx))
blocklist.add(xx);
}
if(u >= blocklist.size()){
isdone = true;
} else {
isdone = false;
}
}
}

View File

@ -9,9 +9,7 @@ import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.entity.*;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.entity.EntityDamageByProjectileEvent;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.player.PlayerChatEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.Plugin;
@ -29,12 +27,86 @@ public class mcm {
instance = new mcm(plugin);
}
return instance;
}
public boolean blockBreakSimulate(Block block, Player player, Plugin plugin){
BlockBreakEvent event = new BlockBreakEvent(block, player);
if(block != null && plugin != null && player != null){
plugin.getServer().getPluginManager().callEvent(event);
if(!event.isCancelled())
{
return true; //Return true if not cancelled
} else {
return false; //Return false if cancelled
}
} else {
return false; //Return false if something went wrong
}
public static double getDistance(Location loca, Location locb)
}
public void damageTool(Player player, short damage){
if(player.getItemInHand().getTypeId() == 0)
return;
player.getItemInHand().setDurability((short) (player.getItemInHand().getDurability() + damage));
if(player.getItemInHand().getDurability() >= getMaxDurability(mcm.getInstance().getTier(player), player.getItemInHand())){
ItemStack[] inventory = player.getInventory().getContents();
for(ItemStack x : inventory){
if(x.getTypeId() == player.getItemInHand().getTypeId() && x.getDurability() == player.getItemInHand().getDurability()){
x.setTypeId(0);
x.setAmount(0);
player.getInventory().setContents(inventory);
return;
}
}
}
}
public Integer getTier(Player player){
int i = player.getItemInHand().getTypeId();
if(i == 268 || i == 269 || i == 270 || i == 271 || i == 290){
return 1; //WOOD
} else if (i == 272 || i == 273 || i == 274 || i == 275 || i == 291){
return 2; //STONE
} else if (i == 256 || i == 257 || i == 258 || i == 267 || i == 292){
return 3; //IRON
} else if (i == 283 || i == 284 || i == 285 || i == 286 || i == 294){
return 1; //GOLD
} else if (i == 276 || i == 277 || i == 278 || i == 279 || i == 293){
return 4; //DIAMOND
} else {
return 1; //UNRECOGNIZED
}
}
public Integer getMaxDurability(Integer tier, ItemStack item){
int id = item.getTypeId();
if(tier == 1){
if((id == 276 || id == 277 || id == 278 || id == 279 || id == 293)){
return 33;
} else {
return 60;
}
} else if (tier == 2){
return 132;
} else if (tier == 3){
return 251;
} else if (tier == 4){
return 1562;
} else {
return 0;
}
}
public double getDistance(Location loca, Location locb)
{
return Math.sqrt(Math.pow(loca.getX() - locb.getX(), 2) + Math.pow(loca.getY() - locb.getY(), 2)
return Math.sqrt(Math.pow(loca.getX() - locb.getX(), 2) + Math.pow(loca.getY() - locb.getY(), 2)
+ Math.pow(loca.getZ() - locb.getZ(), 2));
}
public boolean abilityBlockCheck(Block block){
int i = block.getTypeId();
if(i == 68 || i == 355 || i == 323 || i == 25 || i == 54 || i == 69 || i == 92 || i == 77 || i == 58 || i == 61 || i == 62 || i == 42 || i == 71 || i == 64 || i == 84 || i == 324 || i == 330){
return false;
} else {
return true;
}
}
public boolean isBlockAround(Location loc, Integer radius, Integer typeid){
Block blockx = loc.getBlock();
int ox = blockx.getX();
@ -86,7 +158,7 @@ public class mcm {
}
public boolean shouldBeWatched(Block block){
int id = block.getTypeId();
if(id == 21 || id == 15 || id == 14 || id == 56 || id == 38 || id == 37 || id == 39 || id == 40){
if(id == 87 || id == 89 || id == 2 || id == 3 || id == 12 || id == 13 || id == 21 || id == 15 || id == 14 || id == 56 || id == 38 || id == 37 || id == 39 || id == 40 || id == 24){
return true;
} else {
return false;
@ -129,70 +201,6 @@ public class mcm {
}
return true;
}
public void simulateNaturalDrops(Entity entity){
Location loc = entity.getLocation();
if(entity instanceof Pig){
if(Math.random() * 3 > 2){
if(Math.random() * 2 > 1){
mcDropItem(loc, 319); //BACON
}
mcDropItem(loc, 319);
}
}
if(entity instanceof Spider){
if(Math.random() * 3 > 2){
if(Math.random() * 2 > 1){
mcDropItem(loc, 287); //SILK
}
mcDropItem(loc, 287);
}
}
if(entity instanceof Skeleton){
if(Math.random() * 3 > 2){
if(Math.random() * 2 > 1){
mcDropItem(loc, 262); //ARROWS
}
mcDropItem(loc, 262);
}
if(Math.random() * 3 > 2){
if(Math.random() * 2 > 1){
mcDropItem(loc, 352); //BONES
}
mcDropItem(loc, 352);
}
}
if(entity instanceof Zombie){
if(Math.random() * 3 > 2){
if(Math.random() * 2 > 1){
mcDropItem(loc, 288); //FEATHERS
}
mcDropItem(loc, 288);
}
}
if(entity instanceof Cow){
if(Math.random() * 3 > 2){
if(Math.random() * 2 > 1){
mcDropItem(loc, 334); //LEATHER
}
if(Math.random() * 2 > 1){
mcDropItem(loc, 334);
}
mcDropItem(loc, 334);
}
}
if(entity instanceof Squid){
if(Math.random() * 3 > 2){
if(Math.random() * 2 > 1){
mcDropItem(loc, 351); //INK SACS
}
if(Math.random() * 2 > 1){
mcDropItem(loc, 351);
}
mcDropItem(loc, 351);
}
}
mcSkills.getInstance().arrowRetrievalCheck(entity);
}
public void mcDropItem(Location loc, int id){
if(loc != null){
Material mat = Material.getMaterial(id);
@ -209,6 +217,13 @@ public class mcm {
return false;
}
}
public boolean isShovel(ItemStack is){
if(is.getTypeId() == 269 || is.getTypeId() == 273 || is.getTypeId() == 277 || is.getTypeId() == 284 || is.getTypeId() == 256){
return true;
} else {
return false;
}
}
public boolean isAxes(ItemStack is){
if(is.getTypeId() == 271 || is.getTypeId() == 258 || is.getTypeId() == 286 || is.getTypeId() == 279 || is.getTypeId() == 275){
return true;
@ -216,106 +231,395 @@ public class mcm {
return false;
}
}
public boolean isMiningPick(ItemStack is){
if(is.getTypeId() == 270 || is.getTypeId() == 274 || is.getTypeId() == 285 || is.getTypeId() == 257 || is.getTypeId() == 278){
return true;
} else {
return false;
}
}
public void mcmmoHelpCheck(String[] split, Player player, PlayerChatEvent event){
if(split[0].equalsIgnoreCase("/woodcutting")){
event.setCancelled(true);
float skillvalue = (float)mcUsers.getProfile(player).getWoodCuttingInt();
int ticks = 2;
if(mcUsers.getProfile(player).getWoodCuttingInt() >= 50)
ticks++;
if(mcUsers.getProfile(player).getWoodCuttingInt() >= 150)
ticks++;
if(mcUsers.getProfile(player).getWoodCuttingInt() >= 250)
ticks++;
if(mcUsers.getProfile(player).getWoodCuttingInt() >= 350)
ticks++;
if(mcUsers.getProfile(player).getWoodCuttingInt() >= 450)
ticks++;
if(mcUsers.getProfile(player).getWoodCuttingInt() >= 550)
ticks++;
if(mcUsers.getProfile(player).getWoodCuttingInt() >= 650)
ticks++;
if(mcUsers.getProfile(player).getWoodCuttingInt() >= 750)
ticks++;
ticks = ticks * 2;
String percentage = String.valueOf((skillvalue / 1000) * 100);
player.sendMessage(ChatColor.RED+"-----[]"+ChatColor.GREEN+"WOODCUTTING"+ChatColor.RED+"[]-----");
player.sendMessage(ChatColor.DARK_GRAY+"XP GAIN: "+ChatColor.WHITE+"Chopping down trees");
player.sendMessage(ChatColor.RED+"---[]"+ChatColor.GREEN+"EFFECTS"+ChatColor.RED+"[]---");
player.sendMessage(ChatColor.DARK_AQUA+"Double Drops: "+ChatColor.GREEN+"Double the normal loot");
player.sendMessage(ChatColor.DARK_AQUA+"Tree Feller (ABILITY): "+ChatColor.GREEN+"Make trees explode");
player.sendMessage(ChatColor.DARK_AQUA+"Double Drops: "+ChatColor.YELLOW+ChatColor.GREEN+"Double the normal loot");
player.sendMessage(ChatColor.RED+"---[]"+ChatColor.GREEN+"YOUR STATS"+ChatColor.RED+"[]---");
player.sendMessage(ChatColor.RED+"Double Drop Chance: "+ChatColor.YELLOW+percentage+"%");
player.sendMessage(ChatColor.RED+"Tree Feller Length: "+ChatColor.YELLOW+ticks+"s");
}
if(split[0].equalsIgnoreCase("/archery")){
event.setCancelled(true);
Integer rank = 0;
if(mcUsers.getProfile(player).getArcheryInt() >= 50)
rank++;
if(mcUsers.getProfile(player).getArcheryInt() >= 250)
rank++;
if(mcUsers.getProfile(player).getArcheryInt() >= 575)
rank++;
if(mcUsers.getProfile(player).getArcheryInt() >= 725)
rank++;
if(mcUsers.getProfile(player).getArcheryInt() >= 1000)
rank++;
float skillvalue = (float)mcUsers.getProfile(player).getArcheryInt();
String percentage = String.valueOf((skillvalue / 1000) * 100);
int ignition = 20;
if(mcUsers.getProfile(player).getArcheryInt() >= 200)
ignition+=20;
if(mcUsers.getProfile(player).getArcheryInt() >= 400)
ignition+=20;
if(mcUsers.getProfile(player).getArcheryInt() >= 600)
ignition+=20;
if(mcUsers.getProfile(player).getArcheryInt() >= 800)
ignition+=20;
if(mcUsers.getProfile(player).getArcheryInt() >= 1000)
ignition+=20;
String percentagedaze;
if(mcUsers.getProfile(player).getArcheryInt() < 1000){
percentagedaze = String.valueOf((skillvalue / 2000) * 100);
} else {
percentagedaze = "50";
}
player.sendMessage(ChatColor.RED+"-----[]"+ChatColor.GREEN+"ARCHERY"+ChatColor.RED+"[]-----");
player.sendMessage(ChatColor.DARK_GRAY+"XP GAIN: "+ChatColor.WHITE+"Attacking Monsters");
player.sendMessage(ChatColor.RED+"---[]"+ChatColor.GREEN+"EFFECTS"+ChatColor.RED+"[]---");
//player.sendMessage(ChatColor.DARK_AQUA+"Daze (Monsters): "+ChatColor.GREEN+"Enemies lose interest for 1 second");
player.sendMessage(ChatColor.DARK_AQUA+"Ignition: "+ChatColor.GREEN+"25% Chance Enemies will ignite");
player.sendMessage(ChatColor.DARK_AQUA+"Daze (Players): "+ChatColor.GREEN+"Disorients foes");
player.sendMessage(ChatColor.DARK_AQUA+"Damage+: "+ChatColor.GREEN+"Modifies Damage");
player.sendMessage(ChatColor.DARK_AQUA+"Arrow Retrieval: "+ChatColor.GREEN+"Chance to retrieve arrows from corpses");
player.sendMessage(ChatColor.RED+"---[]"+ChatColor.GREEN+"YOUR STATS"+ChatColor.RED+"[]---");
player.sendMessage(ChatColor.RED+"Chance to Daze: "+ChatColor.YELLOW+percentagedaze+"%");
player.sendMessage(ChatColor.RED+"Chance to Retrieve Arrows: "+ChatColor.YELLOW+percentage+"%");
player.sendMessage(ChatColor.RED+"Length of Ignition: "+ChatColor.YELLOW+(ignition / 20)+" seconds");
player.sendMessage(ChatColor.RED+"Damage+ (Rank"+rank+"): Bonus "+rank+" damage");
}
if(split[0].equalsIgnoreCase("/axes")){
event.setCancelled(true);
String percentage;
float skillvalue = (float)mcUsers.getProfile(player).getAxesInt();
if(mcUsers.getProfile(player).getAxesInt() < 750){
percentage = String.valueOf((skillvalue / 1000) * 100);
} else {
percentage = "75";
}
int ticks = 2;
if(mcUsers.getProfile(player).getAxesInt() >= 50)
ticks++;
if(mcUsers.getProfile(player).getAxesInt() >= 150)
ticks++;
if(mcUsers.getProfile(player).getAxesInt() >= 250)
ticks++;
if(mcUsers.getProfile(player).getAxesInt() >= 350)
ticks++;
if(mcUsers.getProfile(player).getAxesInt() >= 450)
ticks++;
if(mcUsers.getProfile(player).getAxesInt() >= 550)
ticks++;
if(mcUsers.getProfile(player).getAxesInt() >= 650)
ticks++;
if(mcUsers.getProfile(player).getAxesInt() >= 750)
ticks++;
ticks = ticks * 2;
player.sendMessage(ChatColor.RED+"-----[]"+ChatColor.GREEN+"AXES"+ChatColor.RED+"[]-----");
player.sendMessage(ChatColor.DARK_GRAY+"XP GAIN: "+ChatColor.WHITE+"Attacking Monsters");
player.sendMessage(ChatColor.RED+"---[]"+ChatColor.GREEN+"EFFECTS"+ChatColor.RED+"[]---");
player.sendMessage(ChatColor.DARK_AQUA+"Critical Strikes (Monster): "+ChatColor.GREEN+"Instant kill");
player.sendMessage(ChatColor.DARK_AQUA+"Critical Strikes (Players): "+ChatColor.GREEN+"Double Damage");
player.sendMessage(ChatColor.DARK_AQUA+"Skull Splitter (ABILITY): "+ChatColor.GREEN+"Deal AoE Damage");
player.sendMessage(ChatColor.DARK_AQUA+"Critical Strikes: "+ChatColor.GREEN+"Double Damage");
player.sendMessage(ChatColor.DARK_AQUA+"Axe Mastery (500 SKILL): "+ChatColor.GREEN+"Modifies Damage");
player.sendMessage(ChatColor.RED+"---[]"+ChatColor.GREEN+"YOUR STATS"+ChatColor.RED+"[]---");
player.sendMessage(ChatColor.RED+"Chance to crtically strike: "+ChatColor.YELLOW+percentage+"%");
if(mcUsers.getProfile(player).getAxesInt() < 500){
player.sendMessage(ChatColor.GRAY+"LOCKED UNTIL 500+ SKILL (AXEMASTERY)");
} else {
player.sendMessage(ChatColor.RED+"Axe Mastery:"+ChatColor.YELLOW+" Bonus 4 damage");
}
player.sendMessage(ChatColor.RED+"Skull Splitter Length: "+ChatColor.YELLOW+ticks+"s");
}
if(split[0].equalsIgnoreCase("/swords")){
event.setCancelled(true);
int bleedrank = 2;
String percentage, parrypercentage = null, counterattackpercentage;
float skillvalue = (float)mcUsers.getProfile(player).getSwordsInt();
if(mcUsers.getProfile(player).getSwordsInt() < 750){
percentage = String.valueOf((skillvalue / 1000) * 100);
} else {
percentage = "75";
}
if(skillvalue >= 750)
bleedrank+=1;
if(mcUsers.getProfile(player).getSwordsInt() <= 900){
parrypercentage = String.valueOf((skillvalue / 3000) * 100);
} else {
parrypercentage = "30";
}
if(mcUsers.getProfile(player).getSwordsInt() <= 600){
counterattackpercentage = String.valueOf((skillvalue / 2000) * 100);
} else {
counterattackpercentage = "30";
}
int ticks = 2;
if(mcUsers.getProfile(player).getSwordsInt() >= 50)
ticks++;
if(mcUsers.getProfile(player).getSwordsInt() >= 150)
ticks++;
if(mcUsers.getProfile(player).getSwordsInt() >= 250)
ticks++;
if(mcUsers.getProfile(player).getSwordsInt() >= 350)
ticks++;
if(mcUsers.getProfile(player).getSwordsInt() >= 450)
ticks++;
if(mcUsers.getProfile(player).getSwordsInt() >= 550)
ticks++;
if(mcUsers.getProfile(player).getSwordsInt() >= 650)
ticks++;
if(mcUsers.getProfile(player).getSwordsInt() >= 750)
ticks++;
ticks = ticks * 2;
player.sendMessage(ChatColor.RED+"-----[]"+ChatColor.GREEN+"SWORDS"+ChatColor.RED+"[]-----");
player.sendMessage(ChatColor.DARK_GRAY+"XP GAIN: "+ChatColor.WHITE+"Attacking Monsters");
player.sendMessage(ChatColor.RED+"---[]"+ChatColor.GREEN+"EFFECTS"+ChatColor.RED+"[]---");
player.sendMessage(ChatColor.DARK_AQUA+"Counter Attack: "+ChatColor.GREEN+"Reflect 50% of damage taken");
player.sendMessage(ChatColor.DARK_AQUA+"Serrated Strikes (ABILITY): "+ChatColor.GREEN+"25% DMG AoE, Bleed+ AoE");
player.sendMessage(ChatColor.DARK_GRAY+"Serrated Strikes Bleed+: "+ChatColor.GREEN+"5 Tick Bleed");
player.sendMessage(ChatColor.DARK_AQUA+"Parrying: "+ChatColor.GREEN+"Negates Damage");
player.sendMessage(ChatColor.DARK_AQUA+"Bleed: "+ChatColor.GREEN+"Apply a 2 second bleed DoT to enemies");
player.sendMessage(ChatColor.DARK_AQUA+"Bleed: "+ChatColor.GREEN+"Apply a bleed DoT");
player.sendMessage(ChatColor.RED+"---[]"+ChatColor.GREEN+"YOUR STATS"+ChatColor.RED+"[]---");
player.sendMessage(ChatColor.RED+"Counter Attack Chance: "+ChatColor.YELLOW+counterattackpercentage+"%");
player.sendMessage(ChatColor.RED+"Bleed Length: "+ChatColor.YELLOW+bleedrank+" ticks");
player.sendMessage(ChatColor.GRAY+"NOTE: "+ChatColor.YELLOW+"1 Tick happens every 2 seconds");
player.sendMessage(ChatColor.RED+"Bleed Chance: "+ChatColor.YELLOW+percentage+"%");
player.sendMessage(ChatColor.RED+"Parry Chance: "+ChatColor.YELLOW+parrypercentage+"%");
player.sendMessage(ChatColor.RED+"Serrated Strikes Length: "+ChatColor.YELLOW+ticks+"s");
}
if(split[0].equalsIgnoreCase("/acrobatics")){
event.setCancelled(true);
String dodgepercentage;
float skillvalue = (float)mcUsers.getProfile(player).getAcrobaticsInt();
String percentage = String.valueOf((skillvalue / 1000) * 100);
if(mcUsers.getProfile(player).getAcrobaticsInt() <= 800){
dodgepercentage = String.valueOf((skillvalue / 4000 * 100));
} else {
dodgepercentage = "20";
}
player.sendMessage(ChatColor.RED+"-----[]"+ChatColor.GREEN+"ACROBATICS"+ChatColor.RED+"[]-----");
player.sendMessage(ChatColor.DARK_GRAY+"XP GAIN: "+ChatColor.WHITE+"Falling");
player.sendMessage(ChatColor.RED+"---[]"+ChatColor.GREEN+"EFFECTS"+ChatColor.RED+"[]---");
player.sendMessage(ChatColor.DARK_AQUA+"Roll: "+ChatColor.GREEN+"Negates Damage");
player.sendMessage(ChatColor.DARK_AQUA+"Dodge: "+ChatColor.GREEN+"Reduce damage by half");
player.sendMessage(ChatColor.RED+"---[]"+ChatColor.GREEN+"YOUR STATS"+ChatColor.RED+"[]---");
player.sendMessage(ChatColor.RED+"Roll Chance: "+ChatColor.YELLOW+percentage+"%");
player.sendMessage(ChatColor.RED+"Dodge Chance: "+ChatColor.YELLOW+dodgepercentage+"%");
}
if(split[0].equalsIgnoreCase("/mining")){
float skillvalue = (float)mcUsers.getProfile(player).getMiningInt();
String percentage = String.valueOf((skillvalue / 1000) * 100);
int ticks = 2;
if(mcUsers.getProfile(player).getMiningInt() >= 50)
ticks++;
if(mcUsers.getProfile(player).getMiningInt() >= 150)
ticks++;
if(mcUsers.getProfile(player).getMiningInt() >= 250)
ticks++;
if(mcUsers.getProfile(player).getMiningInt() >= 350)
ticks++;
if(mcUsers.getProfile(player).getMiningInt() >= 450)
ticks++;
if(mcUsers.getProfile(player).getMiningInt() >= 550)
ticks++;
if(mcUsers.getProfile(player).getMiningInt() >= 650)
ticks++;
if(mcUsers.getProfile(player).getMiningInt() >= 750)
ticks++;
ticks = ticks * 2;
event.setCancelled(true);
player.sendMessage(ChatColor.RED+"-----[]"+ChatColor.GREEN+"MINING"+ChatColor.RED+"[]-----");
player.sendMessage(ChatColor.DARK_GRAY+"XP GAIN: "+ChatColor.WHITE+"Mining Stone & Ore");
player.sendMessage(ChatColor.RED+"---[]"+ChatColor.GREEN+"EFFECTS"+ChatColor.RED+"[]---");
player.sendMessage(ChatColor.DARK_AQUA+"Super Breaker (ABILITY): "+ChatColor.GREEN+"Speed+, Triple Drop Chance");
player.sendMessage(ChatColor.DARK_AQUA+"Double Drops: "+ChatColor.GREEN+"Double the normal loot");
player.sendMessage(ChatColor.RED+"---[]"+ChatColor.GREEN+"YOUR STATS"+ChatColor.RED+"[]---");
player.sendMessage(ChatColor.RED+"Double Drop Chance: "+ChatColor.YELLOW+percentage+"%");
player.sendMessage(ChatColor.RED+"Super Breaker Length: "+ChatColor.YELLOW+ticks+"s");
}
if(split[0].equalsIgnoreCase("/repair")){
float skillvalue = (float)mcUsers.getProfile(player).getRepairInt();
String percentage = String.valueOf((skillvalue / 1000) * 100);
String repairmastery = String.valueOf((skillvalue / 500) * 100);
event.setCancelled(true);
player.sendMessage(ChatColor.RED+"-----[]"+ChatColor.GREEN+"REPAIR"+ChatColor.RED+"[]-----");
player.sendMessage(ChatColor.DARK_GRAY+"XP GAIN: "+ChatColor.WHITE+"Repairing");
player.sendMessage(ChatColor.RED+"---[]"+ChatColor.GREEN+"EFFECTS"+ChatColor.RED+"[]---");
player.sendMessage(ChatColor.DARK_AQUA+"Repair: "+ChatColor.GREEN+"Repair Iron Tools & Armor");
player.sendMessage(ChatColor.DARK_AQUA+"Diamond Repair (50+ SKILL): "+ChatColor.GREEN+"Repair Diamond Tools & Armor");
player.sendMessage(ChatColor.DARK_AQUA+"Repair Mastery: "+ChatColor.GREEN+"Increased repair amount");
player.sendMessage(ChatColor.DARK_AQUA+"Super Repair: "+ChatColor.GREEN+"Double effectiveness");
player.sendMessage(ChatColor.DARK_AQUA+"Diamond Repair ("+mcLoadProperties.repairdiamondlevel+"+ SKILL): "+ChatColor.GREEN+"Repair Diamond Tools & Armor");
player.sendMessage(ChatColor.RED+"---[]"+ChatColor.GREEN+"YOUR STATS"+ChatColor.RED+"[]---");
player.sendMessage(ChatColor.RED+"Repair Mastery: "+ChatColor.YELLOW+"Extra "+repairmastery+"% durability restored");
player.sendMessage(ChatColor.RED+"Super Repair Chance: "+ChatColor.YELLOW+percentage+"%");
}
if(split[0].equalsIgnoreCase("/unarmed")){
event.setCancelled(true);
String percentage, arrowpercentage;
float skillvalue = (float)mcUsers.getProfile(player).getUnarmedInt();
if(mcUsers.getProfile(player).getUnarmedInt() < 1000){
percentage = String.valueOf((skillvalue / 4000) * 100);
} else {
percentage = "25";
}
if(mcUsers.getProfile(player).getUnarmedInt() < 1000){
arrowpercentage = String.valueOf(((skillvalue / 1000) * 100) / 2);
} else {
arrowpercentage = "50";
}
int ticks = 2;
if(mcUsers.getProfile(player).getUnarmedInt() >= 50)
ticks++;
if(mcUsers.getProfile(player).getUnarmedInt() >= 150)
ticks++;
if(mcUsers.getProfile(player).getUnarmedInt() >= 250)
ticks++;
if(mcUsers.getProfile(player).getUnarmedInt() >= 350)
ticks++;
if(mcUsers.getProfile(player).getUnarmedInt() >= 450)
ticks++;
if(mcUsers.getProfile(player).getUnarmedInt() >= 550)
ticks++;
if(mcUsers.getProfile(player).getUnarmedInt() >= 650)
ticks++;
if(mcUsers.getProfile(player).getUnarmedInt() >= 750)
ticks++;
ticks = ticks * 2;
player.sendMessage(ChatColor.RED+"-----[]"+ChatColor.GREEN+"UNARMED"+ChatColor.RED+"[]-----");
player.sendMessage(ChatColor.DARK_GRAY+"XP GAIN: "+ChatColor.WHITE+"Attacking Monsters");
player.sendMessage(ChatColor.RED+"---[]"+ChatColor.GREEN+"EFFECTS"+ChatColor.RED+"[]---");
player.sendMessage(ChatColor.DARK_AQUA+"Berserk (ABILITY): "+ChatColor.GREEN+"+50% DMG, Breaks weak materials");
player.sendMessage(ChatColor.DARK_AQUA+"Disarm (Players): "+ChatColor.GREEN+"Drops the foes item held in hand");
player.sendMessage(ChatColor.DARK_AQUA+"Damage+: "+ChatColor.GREEN+"Modifies Damage");
player.sendMessage(ChatColor.DARK_AQUA+"Unarmed Mastery: "+ChatColor.GREEN+"Large Damage Upgrade");
player.sendMessage(ChatColor.DARK_AQUA+"Unarmed Apprentice: "+ChatColor.GREEN+"Damage Upgrade");
player.sendMessage(ChatColor.DARK_AQUA+"Arrow Deflect: "+ChatColor.GREEN+"Deflect arrows");
player.sendMessage(ChatColor.RED+"---[]"+ChatColor.GREEN+"YOUR STATS"+ChatColor.RED+"[]---");
player.sendMessage(ChatColor.RED+"Arrow Deflect Chance: "+ChatColor.YELLOW+arrowpercentage+"%");
player.sendMessage(ChatColor.RED+"Disarm Chance: "+ChatColor.YELLOW+percentage+"%");
if(mcUsers.getProfile(player).getUnarmedInt() < 250){
player.sendMessage(ChatColor.GRAY+"LOCKED UNTIL 250+ SKILL (UNARMED APPRENTICE)");
} else if(mcUsers.getProfile(player).getUnarmedInt() >= 250 && mcUsers.getProfile(player).getUnarmedInt() < 500){
player.sendMessage(ChatColor.RED+"Unarmed Apprentice: "+ChatColor.YELLOW+"Damage Upgrade");
} else {
player.sendMessage(ChatColor.RED+"Unarmed Mastery: "+ChatColor.YELLOW+"Large Damage Upgrade");
}
player.sendMessage(ChatColor.RED+"Berserk Length: "+ChatColor.YELLOW+ticks+"s");
}
if(split[0].equalsIgnoreCase("/herbalism")){
event.setCancelled(true);
int rank = 0;
if(mcUsers.getProfile(player).getHerbalismInt() >= 50)
rank++;
if (mcUsers.getProfile(player).getHerbalismInt() >= 150)
rank++;
if (mcUsers.getProfile(player).getHerbalismInt() >= 250)
rank++;
if (mcUsers.getProfile(player).getHerbalismInt() >= 350)
rank++;
if (mcUsers.getProfile(player).getHerbalismInt() >= 450)
rank++;
if (mcUsers.getProfile(player).getHerbalismInt() >= 550)
rank++;
if (mcUsers.getProfile(player).getHerbalismInt() >= 650)
rank++;
if (mcUsers.getProfile(player).getHerbalismInt() >= 750)
rank++;
float skillvalue = (float)mcUsers.getProfile(player).getHerbalismInt();
String percentage = String.valueOf((skillvalue / 1000) * 100);
player.sendMessage(ChatColor.RED+"-----[]"+ChatColor.GREEN+"HERBALISM"+ChatColor.RED+"[]-----");
player.sendMessage(ChatColor.DARK_GRAY+"XP GAIN: "+ChatColor.WHITE+"Harvesting Herbs");
player.sendMessage(ChatColor.RED+"---[]"+ChatColor.GREEN+"EFFECTS"+ChatColor.RED+"[]---");
player.sendMessage(ChatColor.DARK_AQUA+"Food+: "+ChatColor.GREEN+"Modifies health received from bread/stew");
player.sendMessage(ChatColor.DARK_AQUA+"Double Drops (Wheat): "+ChatColor.GREEN+"Double the normal loot");
player.sendMessage(ChatColor.RED+"---[]"+ChatColor.GREEN+"YOUR STATS"+ChatColor.RED+"[]---");
player.sendMessage(ChatColor.RED+"Double Drop Chance: "+percentage+"%");
player.sendMessage(ChatColor.RED+"Food+ (Rank"+rank+"): Bonus "+rank+" healing");
}
if(split[0].equalsIgnoreCase("/excavation")){
event.setCancelled(true);
int ticks = 2;
if(mcUsers.getProfile(player).getExcavationInt() >= 50)
ticks++;
if(mcUsers.getProfile(player).getExcavationInt() >= 150)
ticks++;
if(mcUsers.getProfile(player).getExcavationInt() >= 250)
ticks++;
if(mcUsers.getProfile(player).getExcavationInt() >= 350)
ticks++;
if(mcUsers.getProfile(player).getExcavationInt() >= 450)
ticks++;
if(mcUsers.getProfile(player).getExcavationInt() >= 550)
ticks++;
if(mcUsers.getProfile(player).getExcavationInt() >= 650)
ticks++;
if(mcUsers.getProfile(player).getExcavationInt() >= 750)
ticks++;
ticks = ticks * 2;
player.sendMessage(ChatColor.RED+"-----[]"+ChatColor.GREEN+"EXCAVATION"+ChatColor.RED+"[]-----");
player.sendMessage(ChatColor.DARK_GRAY+"XP GAIN: "+ChatColor.WHITE+"Digging and finding treasures");
player.sendMessage(ChatColor.RED+"---[]"+ChatColor.GREEN+"EFFECTS"+ChatColor.RED+"[]---");
player.sendMessage(ChatColor.DARK_AQUA+"Giga Drill Breaker (ABILITY): "+ChatColor.GREEN+"3x Drop Rate, 3x EXP, +Speed");
player.sendMessage(ChatColor.DARK_AQUA+"Treasure Hunter: "+ChatColor.GREEN+"Ability to dig for treasure");
player.sendMessage(ChatColor.RED+"---[]"+ChatColor.GREEN+"YOUR STATS"+ChatColor.RED+"[]---");
player.sendMessage(ChatColor.RED+"Giga Drill Breaker Length: "+ChatColor.YELLOW+ticks+"s");
}
if(split[0].equalsIgnoreCase("/"+mcLoadProperties.mcmmo)){
event.setCancelled(true);
player.sendMessage(ChatColor.GRAY+"mcMMO is an RPG inspired plugin");
player.sendMessage(ChatColor.GRAY+"You can gain skills in several professions by");
player.sendMessage(ChatColor.GRAY+"doing things related to that profession.");
player.sendMessage(ChatColor.GRAY+"Mining for example will increase your mining XP.");
player.sendMessage(ChatColor.GRAY+"Wood Cutting will increase Wood Cutting, etc...");
player.sendMessage(ChatColor.GRAY+"Repairing is simple in mcMMO");
player.sendMessage(ChatColor.GRAY+"Say you want to repair an iron shovel");
player.sendMessage(ChatColor.GRAY+"start by making an anvil by combining 9 iron ingots");
player.sendMessage(ChatColor.GRAY+"on a workbench. Place the anvil and while holding the shovel");
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+"/"+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 /"+mcLoadProperties.mcc);
player.sendMessage(ChatColor.GREEN+"Appreciate the mod? ");
player.sendMessage(ChatColor.RED+"-----[]"+ChatColor.GREEN+"mcMMO"+ChatColor.RED+"[]-----");
player.sendMessage(ChatColor.YELLOW+"mcMMO is an RPG server mod for minecraft.");
player.sendMessage(ChatColor.YELLOW+"There are many skills added by mcMMO to minecraft.");
player.sendMessage(ChatColor.YELLOW+"They can do anything from giving a chance");
player.sendMessage(ChatColor.YELLOW+"for double drops to letting you break materials instantly.");
player.sendMessage(ChatColor.YELLOW+"For example, by harvesting logs from trees you will gain");
player.sendMessage(ChatColor.YELLOW+"Woodcutting xp and once you have enough xp you will gain");
player.sendMessage(ChatColor.YELLOW+"a skill level in Woodcutting. By raising this skill you will");
player.sendMessage(ChatColor.YELLOW+"be able to receive benefits like "+ChatColor.RED+"double drops");
player.sendMessage(ChatColor.YELLOW+"and increase the effects of the "+ChatColor.RED+"\"Tree Felling\""+ChatColor.YELLOW+" ability.");
player.sendMessage(ChatColor.YELLOW+"mcMMO has abilities related to the skill, skills normally");
player.sendMessage(ChatColor.YELLOW+"provide passive bonuses but they also have activated");
player.sendMessage(ChatColor.YELLOW+"abilities too. Each ability is activated by holding");
player.sendMessage(ChatColor.YELLOW+"the appropriate tool and "+ChatColor.RED+"right clicking.");
player.sendMessage(ChatColor.YELLOW+"For example, if you hold a Mining Pick and right click");
player.sendMessage(ChatColor.YELLOW+"you will ready your Pickaxe, attack mining materials");
player.sendMessage(ChatColor.YELLOW+"and then "+ChatColor.RED+"Super Breaker "+ChatColor.YELLOW+"will activate.");
player.sendMessage(ChatColor.GREEN+"Find out mcMMO commands with "+ChatColor.DARK_AQUA+"/"+mcLoadProperties.mcc);
player.sendMessage(ChatColor.GREEN+"You can donate via paypal to"+ChatColor.DARK_RED+" nossr50@gmail.com");
}
if(split[0].equalsIgnoreCase("/"+mcLoadProperties.mcc)){
@ -335,12 +639,14 @@ public class mcm {
}
if(mcPermissions.getInstance().mySpawn(player)){
player.sendMessage(ChatColor.GREEN+"--MYSPAWN COMMANDS--");
player.sendMessage("/"+mcLoadProperties.myspawn+" "+ChatColor.RED+"- Teleports you to your MySpawn");
player.sendMessage("/"+mcLoadProperties.myspawn+" "+ChatColor.RED+"- Clears inventory & teleports to myspawn");
player.sendMessage("/"+mcLoadProperties.clearmyspawn+" "+ChatColor.RED+"- Clears your MySpawn");
if(mcPermissions.getInstance().setMySpawn(player))
player.sendMessage("/"+mcLoadProperties.setmyspawn+" "+ChatColor.RED+"- Set your MySpawn");
}
player.sendMessage(ChatColor.GREEN+"--OTHER COMMANDS--");
if(mcPermissions.getInstance().mcAbility(player))
player.sendMessage("/"+mcLoadProperties.mcability+ChatColor.RED+" - Toggle ability activation with right click");
if(mcPermissions.getInstance().adminChat(player)){
player.sendMessage("/a "+ChatColor.RED+"- Toggle admin chat");
}

View File

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