A wip of 0.9.11, not recommended for use

This commit is contained in:
nossr50 2011-03-27 19:49:43 -07:00
parent ad46df0b9d
commit b0f6e6267a
21 changed files with 1107 additions and 2603 deletions

View File

@ -1,153 +1,5 @@
Changelog:
#Versions without changelogs probably had very small misc fixes, like tweaks to the source code#
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,5 +1,6 @@
package com.gmail.nossr50;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import org.bukkit.event.entity.EntityDamageEvent;
@ -13,33 +14,68 @@ public class mcAcrobatics {
return instance;
}
public void acrobaticsCheck(Player player, EntityDamageEvent event, Location loc, int xx, int y, int z){
if(player != null){
if(Math.random() * 1000 <= mcUsers.getProfile(player).getAcrobaticsInt()){
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);
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)){
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);
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);
}
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,18 +2,13 @@ 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.craftbukkit.entity.CraftEntity;
import org.bukkit.entity.Player;
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;
import org.bukkit.plugin.Plugin;
public class mcBlockListener extends BlockListener {
private final mcMMO plugin;
@ -23,175 +18,78 @@ public class mcBlockListener extends BlockListener {
}
public void onBlockPlace(BlockPlaceEvent event) {
Block block;
Player player = event.getPlayer();
if (event.getBlock() != null && event.getBlockReplacedState() != null && event.getBlockReplacedState().getTypeId() == 78) {
if (event.getBlockReplacedState().getTypeId() == 78) {
block = event.getBlockAgainst();
}
else {
block = event.getBlock();
}
if(player != null && mcm.getInstance().shouldBeWatched(block))
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(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) {
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(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(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)){
//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();
/*
* 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
*/
* HERBALISM
*/
if(dmg == 3){
if(mcPermissions.getInstance().herbalism(player))
mcHerbalism.getInstance().herbalismProcCheck(block, player);
}
/*
* 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)){
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(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, type);
if(Math.random() * 10 > 8)
blockx.getLocation().getWorld().dropItemNaturally(blockx.getLocation(), item);
}
blockx.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);
}
}
/*
* 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()+")");
}
}
}
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

@ -15,11 +15,9 @@ public class mcConfig {
static ArrayList<String> partyChatList = new ArrayList<String>();
static ArrayList<String> godModeList = new ArrayList<String>();
HashMap<Entity, Integer> arrowTracker = new HashMap<Entity, Integer>();
//HashMap<Entity, Player, String[]> xptracker = new HashMap<Entity, Player, String[]>();
static ArrayList<Entity> bleedTracker = new ArrayList<Entity>();
static ArrayList<Entity> mobSpawnTracker = new ArrayList<Entity>();
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);}
@ -27,21 +25,12 @@ 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,9 +1,6 @@
package com.gmail.nossr50;
import net.minecraft.server.EntityLiving;
import org.bukkit.Location;
import org.bukkit.craftbukkit.entity.CraftEntity;
import org.bukkit.entity.Animals;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Monster;
@ -16,7 +13,6 @@ 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;
@ -39,14 +35,6 @@ 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();
/*
@ -62,30 +50,20 @@ public class mcEntityListener extends EntityListener {
mcAcrobatics.getInstance().acrobaticsCheck(player, event, loc, xx, y, z);
}
}
/*
* ARCHERY CHECKS
*/
if(event instanceof EntityDamageByProjectileEvent && event.getDamage() >= 1){
if(event instanceof EntityDamageByProjectileEvent){
EntityDamageByProjectileEvent c = (EntityDamageByProjectileEvent)event;
mcCombat.getInstance().archeryCheck(c);
}
/*
* Entity Damage by Entity checks
*/
if(event instanceof EntityDamageByEntityEvent && event.getDamage() >= 1){
if(event.isCancelled()){
return;
}
if(event instanceof EntityDamageByEntityEvent){
EntityDamageByEntityEvent eventb = (EntityDamageByEntityEvent)event;
Entity e = eventb.getEntity(); //Defender
Entity f = eventb.getDamager(); //Attacker
/*
* CHECK FOR PVP INTERACTIONS
*/
if(f instanceof Player && e instanceof Player && !mcLoadProperties.pvp)
event.setCancelled(true);
/*
* IF DEFENDER IS PLAYER
*/
@ -93,6 +71,9 @@ public class mcEntityListener extends EntityListener {
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
*/
@ -105,17 +86,6 @@ public class mcEntityListener extends EntityListener {
//((Player) f).sendMessage("DEBUG: EntityDamageByEntity cast correctly!");
int typeid = ((Player) f).getItemInHand().getTypeId();
Player attacker = (Player)f;
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.
*/
@ -133,15 +103,9 @@ public class mcEntityListener extends EntityListener {
* 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().applyAoeDamage(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;
@ -157,24 +121,9 @@ public class mcEntityListener extends EntityListener {
}
}
}
/*
* 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();
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()){

View File

@ -19,98 +19,44 @@ 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);
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){
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);
}
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);
}
}
//DIRT SAND OR GRAVEL
if(type == 3 || type == 13 || type == 2 || type == 12){
mcUsers.getProfile(player).addExcavationGather(4);
mcUsers.getProfile(player).addExcavationGather(3);
if(mcUsers.getProfile(player).getExcavationInt() > 750){
//CHANCE TO GET CAKE
if(mcLoadProperties.cake == true && Math.random() * 2000 > 1999){
mcUsers.getProfile(player).addExcavationGather(300 * mcLoadProperties.xpGainMultiplier);
mcUsers.getProfile(player).addExcavationGather(300);
mat = Material.getMaterial(354);
is = new ItemStack(mat, 1, (byte)0, (byte)0);
loc.getWorld().dropItemNaturally(loc, is);
}
}
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(mcUsers.getProfile(player).getExcavationInt() > 150){
//CHANCE TO GET MUSIC
if(mcLoadProperties.music == true && Math.random() * 2000 > 1999){
mcUsers.getProfile(player).addExcavationGather(300 * mcLoadProperties.xpGainMultiplier);
mcUsers.getProfile(player).addExcavationGather(300);
mat = Material.getMaterial(2256);
is = new ItemStack(mat, 1, (byte)0, (byte)0);
loc.getWorld().dropItemNaturally(loc, is);
@ -118,9 +64,18 @@ public class mcExcavation {
}
if(mcUsers.getProfile(player).getExcavationInt() > 350){
//CHANCE TO GET GREEN MUSIC
//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
if(mcLoadProperties.music == true && Math.random() * 2000 > 1999){
mcUsers.getProfile(player).addExcavationGather(300 * mcLoadProperties.xpGainMultiplier);
mcUsers.getProfile(player).addExcavationGather(300);
mat = Material.getMaterial(2257);
is = new ItemStack(mat, 1, (byte)0, (byte)0);
loc.getWorld().dropItemNaturally(loc, is);
@ -131,35 +86,31 @@ 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(8 * mcLoadProperties.xpGainMultiplier);
mcUsers.getProfile(player).addExcavationGather(3);
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(8 * mcLoadProperties.xpGainMultiplier);
mcUsers.getProfile(player).addExcavationGather(5);
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){
//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);
}
if((type == 2 || type == 3) && mcUsers.getProfile(player).getExcavationInt() > 25){
//CHANCE TO GET GLOWSTONE
if(mcLoadProperties.glowstone == true && mcUsers.getProfile(player).getExcavationInt() > 25 && Math.random() * 100 > 95){
mcUsers.getProfile(player).addExcavationGather(8 * mcLoadProperties.xpGainMultiplier);
if(mcLoadProperties.glowstone == true && Math.random() * 100 > 95){
mcUsers.getProfile(player).addExcavationGather(5);
mat = Material.getMaterial(348);
is = new ItemStack(mat, 1, (byte)0, (byte)0);
loc.getWorld().dropItemNaturally(loc, is);
@ -169,30 +120,38 @@ 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 * mcLoadProperties.xpGainMultiplier);
mcUsers.getProfile(player).addExcavationGather(3);
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 * mcLoadProperties.xpGainMultiplier);
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);
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 > 9){
mcUsers.getProfile(player).addExcavationGather(3 * mcLoadProperties.xpGainMultiplier);
if(Math.random() * 10 > 6){
mcUsers.getProfile(player).addExcavationGather(3);
mat = Material.getMaterial(352);
is = new ItemStack(mat, 1, (byte)0, (byte)0);
loc.getWorld().dropItemNaturally(loc, is);
}
}
}
}
mcSkills.getInstance().XpCheck(player);
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()+")");
}
}
}

View File

@ -24,44 +24,49 @@ 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 * mcLoadProperties.xpGainMultiplier);
if(player != null){
if(Math.random() * 1000 <= mcUsers.getProfile(player).getHerbalismInt()){
loc.getWorld().dropItemNaturally(loc, is);
}
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);
}
}
/*
* We need to check not-wheat stuff for if it was placed by the player or not
*/
if(!mcConfig.getInstance().isBlockWatched(block)){
//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);
}
//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);
}
mcSkills.getInstance().XpCheck(player);
}
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()+")");
}
}
public void breadCheck(Player player, ItemStack is){
if(is.getTypeId() == 297){

View File

@ -1,81 +1,55 @@
package com.gmail.nossr50;
public class mcLoadProperties {
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 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 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 void loadMain(){
String propertiesFile = mcMMO.maindirectory + "mcmmo.properties";
mcProperties properties = new mcProperties(propertiesFile);
properties.load();
/*
* COOLDOWN CONTROL
*/
superBreakerCooldown = properties.getInteger("superBreakerCooldown", 120);
gigaDrillBreakerCooldown = properties.getInteger("gigaDrillBreakerCooldown", 120);
treeFellerCooldown = properties.getInteger("treeFellerCooldown", 120);
berserkCooldown = properties.getInteger("berserkCooldown", 120);
serratedStrikeCooldown = properties.getInteger("serratedStrikeCooldown", 120);
skullSplitterCooldown = properties.getInteger("skullSplitterCooldown", 120);
/*
* 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
*/
mushrooms = properties.getBoolean("canExcavateMushrooms", true);
glowstone = properties.getBoolean("canExcavateGlowstone", true);
myspawnclearsinventory = properties.getBoolean("myspawnclearsinventory", 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
*/
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 = "plugins/mcMMO/";
static String maindirectory = "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,8 +30,9 @@ 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)(2000));
//Make the directory if it does not exist
new File(maindirectory).mkdir();
//Make the file if it does not exist
@ -60,23 +61,19 @@ 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.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.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.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.Highest, this);
pm.registerEvent(Event.Type.BLOCK_RIGHTCLICKED, blockListener, Priority.Normal, this);
pm.registerEvent(Event.Type.ENTITY_DAMAGED, entityListener, Priority.Normal, this);
//pm.registerEvent(Event.Type.CREATURE_SPAWN, entityListener, Priority.Normal, this);
//Displays a message when plugin is loaded
PluginDescriptionFile pdfFile = this.getDescription();
@ -101,17 +98,6 @@ 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,54 +19,14 @@ 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 miningticks = 2;
if(mcUsers.getProfile(player).getMiningInt() >= 50)
miningticks++;
if(mcUsers.getProfile(player).getMiningInt() >= 150)
miningticks++;
if(mcUsers.getProfile(player).getMiningInt() >= 250)
miningticks++;
if(mcUsers.getProfile(player).getMiningInt() >= 350)
miningticks++;
if(mcUsers.getProfile(player).getMiningInt() >= 450)
miningticks++;
if(mcUsers.getProfile(player).getMiningInt() >= 550)
miningticks++;
if(mcUsers.getProfile(player).getMiningInt() >= 650)
miningticks++;
if(mcUsers.getProfile(player).getMiningInt() >= 750)
miningticks++;
if(!mcUsers.getProfile(player).getSuperBreakerMode() && mcUsers.getProfile(player).getSuperBreakerCooldown() == 0){
player.sendMessage(ChatColor.GREEN+"**SUPER BREAKER ACTIVATED**");
mcUsers.getProfile(player).setSuperBreakerTicks(miningticks);
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() != 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 && block.getTypeId() != 56 && block.getTypeId() != 21 && block.getTypeId() != 1 && block.getTypeId() != 16)
loc.getWorld().dropItemNaturally(loc, item);
//hurrdurr
if(block.getTypeId() == 73 || block.getTypeId() == 74){
mat = Material.getMaterial(331);
item = new ItemStack(mat, 1, (byte)0, damage);
@ -77,224 +37,104 @@ 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(player != null){
if(Math.random() * 1000 <= mcUsers.getProfile(player).getMiningInt()){
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){
blockProcSimulate(block);
return;
}
}
}
public void miningBlockCheck(Player player, Block block){
int xp = 0;
if(block.getTypeId() == 1 || block.getTypeId() == 24){
xp += 3;
if(block.getTypeId() == 1){
mcUsers.getProfile(player).addMiningGather(1);
blockProcCheck(block, player);
}
//NETHERRACK
if(block.getTypeId() == 87){
xp += 3;
}
//COAL
if(block.getTypeId() == 16){
mcUsers.getProfile(player).addMiningGather(5);
blockProcCheck(block, player);
}
//GLOWSTONE
if(block.getTypeId() == 89){
xp += 3;
}
//GOLD
if(block.getTypeId() == 14){
mcUsers.getProfile(player).addMiningGather(35);
blockProcCheck(block, player);
}
//COAL
if(block.getTypeId() == 16){
xp += 10;
}
//DIAMOND
if(block.getTypeId() == 56){
mcUsers.getProfile(player).addMiningGather(75);
blockProcCheck(block, player);
}
//GOLD
if(block.getTypeId() == 14){
xp += 35;
}
//IRON
if(block.getTypeId() == 15){
mcUsers.getProfile(player).addMiningGather(20);
blockProcCheck(block, player);
}
//DIAMOND
if(block.getTypeId() == 56){
xp += 75;
}
//REDSTONE
if(block.getTypeId() == 73 || block.getTypeId() == 74){
mcUsers.getProfile(player).addMiningGather(15);
blockProcCheck(block, player);
}
//IRON
if(block.getTypeId() == 15){
xp += 25;
}
//LAPUS
if(block.getTypeId() == 21){
mcUsers.getProfile(player).addMiningGather(40);
blockProcCheck(block, player);
}
//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);
}
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()+")");
}
}
}

View File

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

View File

@ -30,13 +30,6 @@ 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");
@ -44,49 +37,7 @@ public class mcPermissions {
return true;
}
}
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) {
public boolean woodcuttingability(Player player) {
if (permissionsEnabled) {
return permission(player, "mcmmo.ability.woodcutting");
} else {
@ -114,13 +65,6 @@ 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");
@ -135,13 +79,6 @@ 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,7 +5,6 @@ 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;
@ -61,7 +60,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
@ -70,25 +69,15 @@ public class mcPlayerListener extends PlayerListener {
Block block = event.getBlockClicked();
Player player = event.getPlayer();
ItemStack is = player.getItemInHand();
/*
* ABILITY ACTIVATION CHECKS
*/
if(block != null){
if(mcm.getInstance().abilityBlockCheck(block))
mcSkills.getInstance().abilityActivationCheck(player, block);
} else {
mcSkills.getInstance().abilityActivationCheck(player, block);
}
/*
* ITEM INTERACTIONS
*/
mcItem.getInstance().itemChecks(player);
/*
* HERBALISM MODIFIERS
*/
if(mcPermissions.getInstance().herbalism(player)){
mcHerbalism.getInstance().breadCheck(player, is);
mcHerbalism.getInstance().stewCheck(player, is);
//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);
}
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);
}
}
public void onPlayerCommandPreprocess(PlayerChatEvent event){
@ -97,67 +86,6 @@ 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
*/
@ -185,7 +113,6 @@ 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;
@ -318,21 +245,17 @@ 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;
}
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]);
}
event.setCancelled(true);
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.");
player.sendMessage(ChatColor.DARK_AQUA + "Myspawn has been set to your current location.");
}
/*
* STATS COMMAND
@ -341,7 +264,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()
@ -397,7 +320,6 @@ 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;
@ -410,13 +332,12 @@ 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()+" from "+player.getName());
target.sendMessage(ChatColor.RED+"ALERT: "+ChatColor.GREEN+"You have received a party invite for "+mcUsers.getProfile(target).getInvite());
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());
@ -430,11 +351,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;
@ -473,11 +394,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);
@ -506,11 +427,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() >= mcLoadProperties.repairdiamondlevel){
if(isDiamondArmor(is) && hasDiamond(player) && mcUsers.getProfile(player).getRepairInt() >= 50){
removeDiamond(player);
player.getItemInHand().setDurability(getArmorRepairAmount(is, player));
mcUsers.getProfile(player).addRepairGather(75 * mcLoadProperties.xpGainMultiplier);
mcUsers.getProfile(player).addRepairGather(75);
} else if (isIronArmor(is) && hasIron(player)){
/*
* IRON ARMOR
*/
removeIron(player);
player.getItemInHand().setDurability(getArmorRepairAmount(is, player));
mcUsers.getProfile(player).addRepairGather(20 * mcLoadProperties.xpGainMultiplier);
mcUsers.getProfile(player).addRepairGather(20);
//GOLD ARMOR
} else if (isGoldArmor(is) && hasGold(player)){
removeGold(player);
player.getItemInHand().setDurability(getArmorRepairAmount(is, player));
mcUsers.getProfile(player).addRepairGather(50 * mcLoadProperties.xpGainMultiplier);
mcUsers.getProfile(player).addRepairGather(50);
} 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 * mcLoadProperties.xpGainMultiplier);
} else if (isDiamondTools(is) && hasDiamond(player) && mcUsers.getProfile(player).getRepairInt() >= mcLoadProperties.repairdiamondlevel){ //Check if its diamond and the player has diamonds
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
/*
* DIAMOND TOOLS
*/
is.setDurability(getToolRepairAmount(is, player));
removeDiamond(player);
mcUsers.getProfile(player).addRepairGather(75 * mcLoadProperties.xpGainMultiplier);
mcUsers.getProfile(player).addRepairGather(75);
} else if(isGoldTools(is) && hasGold(player)){
is.setDurability(getToolRepairAmount(is, player));
removeGold(player);
mcUsers.getProfile(player).addRepairGather(50 * mcLoadProperties.xpGainMultiplier);
mcUsers.getProfile(player).addRepairGather(50);
} else {
needMoreVespeneGas(is, player);
}
@ -82,7 +82,15 @@ public class mcRepair {
/*
* GIVE SKILL IF THERE IS ENOUGH XP
*/
mcSkills.getInstance().XpCheck(player);
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()+")");
}
}
}
public boolean isArmor(ItemStack is){
@ -288,50 +296,38 @@ public class mcRepair {
switch(is.getTypeId())
{
case 306:
durability -= 27;
break;
durability -= 27;
break;
case 310:
durability -= 55;
break;
durability -= 55;
break;
case 307:
durability -= 24;
break;
durability -= 24;
break;
case 311:
durability -= 48;
break;
durability -= 48;
break;
case 308:
durability -= 27;
break;
durability -= 27;
break;
case 312:
durability -= 53;
break;
durability -= 53;
break;
case 309:
durability -= 40;
break;
durability -= 40;
break;
case 313:
durability -= 80;
break;
case 314:
durability -= 13;
break;
case 315:
durability -= 12;
break;
case 316:
durability -= 14;
break;
case 317:
durability -= 20;
break;
durability -= 80;
break;
}
if(durability < 0)
durability = 0;
durability = 0;
if(checkPlayerProcRepair(player))
durability = 0;
durability = 0;
return durability;
}
public void needMoreVespeneGas(ItemStack is, Player player){
if ((isDiamondTools(is) || isDiamondArmor(is)) && mcUsers.getProfile(player).getRepairInt() < mcLoadProperties.repairdiamondlevel){
if ((isDiamondTools(is) || isDiamondArmor(is)) && mcUsers.getProfile(player).getRepairInt() < 50){
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))
@ -349,12 +345,27 @@ public class mcRepair {
player.sendMessage(ChatColor.DARK_RED+"You need more "+ChatColor.GOLD+"Gold");
}
public boolean checkPlayerProcRepair(Player player){
if(player != null){
if(Math.random() * 1000 <= mcUsers.getProfile(player).getRepairInt()){
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){
player.sendMessage(ChatColor.GRAY + "That felt easy.");
return true;
}
}
return false;
}
}
}

View File

@ -1,7 +1,5 @@
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;
@ -34,440 +32,6 @@ 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() * 2)+"s)");
return;
}
player.sendMessage(ChatColor.GREEN+"**YOU READY YOUR PICKAXE**");
mcUsers.getProfile(player).setPickaxePreparationTicks(2);
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() * 2)+"s)");
return;
}
player.sendMessage(ChatColor.GREEN+"**YOU READY YOUR SHOVEL**");
mcUsers.getProfile(player).setShovelPreparationTicks(2);
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() * 2)+"s)");
return;
}
player.sendMessage(ChatColor.GREEN+"**YOU READY YOUR SWORD**");
mcUsers.getProfile(player).setSwordsPreparationTicks(2);
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() * 2)+"s)");
return;
}
player.sendMessage(ChatColor.GREEN+"**YOU READY YOUR FISTS**");
mcUsers.getProfile(player).setFistsPreparationTicks(2);
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(2);
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);
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);
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);
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() * 2)+"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;
@ -511,6 +75,5 @@ public class mcSkills {
x++;
}
}
mcConfig.getInstance().removeArrowTracked(entity);
}
}

View File

@ -1,8 +1,6 @@
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{
@ -15,59 +13,50 @@ 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)
continue;
if(mcUsers.getProfile(player) == null)
mcUsers.addUser(player);
/*
* MONITOR SKILLS
*/
mcSkills.getInstance().monitorSkills(player);
/*
* COOLDOWN MONITORING
*/
mcSkills.getInstance().decreaseCooldowns(player);
if(mcPermissions.getInstance().regeneration(player)){
if(thecount == 5 || thecount == 10 || thecount == 15 || thecount == 20){
if(player != null &&
player.getHealth() > 0 && player.getHealth() < 20
&& mcUsers.getProfile(player).getPowerLevel() >= 1000
&& mcUsers.getProfile(player).getRecentlyHurt() == 0){
player.setHealth(mcm.getInstance().calculateHealth(player.getHealth(), 1));
}
}
if(thecount == 10 || thecount == 20){
if(player != null &&
player.getHealth() > 0 && player.getHealth() < 20
&& mcUsers.getProfile(player).getPowerLevel() >= 500
&& mcUsers.getProfile(player).getPowerLevel() < 1000
&& mcUsers.getProfile(player).getRecentlyHurt() == 0){
player.setHealth(mcm.getInstance().calculateHealth(player.getHealth(), 1));
}
}
if(thecount == 20){
if(player != null &&
player.getHealth() > 0 && player.getHealth() < 20
&& mcUsers.getProfile(player).getPowerLevel() < 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(player != null && mcUsers.getProfile(player).getRecentlyHurt() >= 1){
mcUsers.getProfile(player).decreaseLastHurt();
}
}
if(thecount < 20){
thecount++;
thecount++;
} else {
thecount = 1;
thecount = 1;
}
/*
* BLEED MONITORING
*/
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 = "plugins/mcMMO/mcmmo.users";
String location = "mcmmo.users";
public static PlayerList players = new PlayerList();
private Properties properties = new Properties();
@ -156,14 +156,12 @@ 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, 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;
private boolean dead;
private int recentlyhurt = 0, bleedticks = 0;
Player thisplayer;
char defaultColor;
String location = "plugins/mcMMO/mcmmo.users";
String location = "mcmmo.users";
//=====================================================================
@ -208,7 +206,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();
@ -419,16 +417,6 @@ 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--;
@ -445,300 +433,6 @@ class PlayerList
public void setBleedTicks(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;
}
@ -1436,34 +1130,34 @@ class PlayerList
}
}
public void modifyskill(int newvalue, String skillname){
if(skillname.toLowerCase().equals("mining")){
if(skillname.equals("mining")){
mining = String.valueOf(newvalue);
}
if(skillname.toLowerCase().equals("woodcutting")){
if(skillname.equals("woodcutting")){
woodcutting = String.valueOf(newvalue);
}
if(skillname.toLowerCase().equals("repair")){
if(skillname.equals("repair")){
repair = String.valueOf(newvalue);
}
if(skillname.toLowerCase().equals("herbalism")){
if(skillname.equals("herbalism")){
herbalism = String.valueOf(newvalue);
}
if(skillname.toLowerCase().equals("acrobatics")){
if(skillname.equals("acrobatics")){
acrobatics = String.valueOf(newvalue);
}
if(skillname.toLowerCase().equals("swords")){
if(skillname.equals("swords")){
swords = String.valueOf(newvalue);
}
if(skillname.toLowerCase().equals("archery")){
if(skillname.equals("archery")){
archery = String.valueOf(newvalue);
}
if(skillname.toLowerCase().equals("unarmed")){
if(skillname.equals("unarmed")){
unarmed = String.valueOf(newvalue);
}
if(skillname.toLowerCase().equals("excavation")){
if(skillname.equals("excavation")){
excavation = String.valueOf(newvalue);
}
if(skillname.toLowerCase().equals("axes")){
if(skillname.equals("axes")){
axes = String.valueOf(newvalue);
}
save();

View File

@ -1,8 +1,5 @@
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;
@ -10,8 +7,6 @@ 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;
@ -26,119 +21,47 @@ public class mcWoodCutting {
public void woodCuttingProcCheck(Player player, Block block, Location loc){
byte type = block.getData();
Material mat = Material.getMaterial(block.getTypeId());
if(player != null){
if(Math.random() * 1000 <= mcUsers.getProfile(player).getWoodCuttingInt()){
ItemStack item = new ItemStack(mat, 1, (short) 0, type);
byte damage = 0;
if(mcUsers.getProfile(player).getWoodCuttingInt() > 1000){
ItemStack item = new ItemStack(mat, 1, type, damage);
loc.getWorld().dropItemNaturally(loc, item);
return;
}
}
}
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 treefellticks = 2;
if(mcUsers.getProfile(player).getWoodCuttingInt() >= 50)
treefellticks++;
if(mcUsers.getProfile(player).getWoodCuttingInt() >= 150)
treefellticks++;
if(mcUsers.getProfile(player).getWoodCuttingInt() >= 250)
treefellticks++;
if(mcUsers.getProfile(player).getWoodCuttingInt() >= 350)
treefellticks++;
if(mcUsers.getProfile(player).getWoodCuttingInt() >= 450)
treefellticks++;
if(mcUsers.getProfile(player).getWoodCuttingInt() >= 550)
treefellticks++;
if(mcUsers.getProfile(player).getWoodCuttingInt() >= 650)
treefellticks++;
if(mcUsers.getProfile(player).getWoodCuttingInt() >= 750)
treefellticks++;
if(!mcUsers.getProfile(player).getTreeFellerMode() && mcUsers.getProfile(player).getTreeFellerCooldown() == 0){
player.sendMessage(ChatColor.GREEN+"**TREE FELLING ACTIVATED**");
mcUsers.getProfile(player).setTreeFellerTicks(treefellticks);
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() * 2)+"s)");
}
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, Player player){
public void treeFeller(Block block){
Location loc = block.getLocation();
int radius = 1;
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();
int typeid = 17;
if(mcm.getInstance().isBlockAround(loc, radius, typeid)){
/*
* 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

@ -30,69 +30,11 @@ public class mcm {
}
return instance;
}
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)
public static 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();
@ -144,7 +86,7 @@ public class mcm {
}
public boolean shouldBeWatched(Block block){
int id = block.getTypeId();
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){
if(id == 21 || id == 15 || id == 14 || id == 56 || id == 38 || id == 37 || id == 39 || id == 40){
return true;
} else {
return false;
@ -187,6 +129,70 @@ 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);
@ -203,13 +209,6 @@ 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;
@ -217,367 +216,106 @@ 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 treefellticks = 2;
if(mcUsers.getProfile(player).getWoodCuttingInt() >= 50)
treefellticks++;
if(mcUsers.getProfile(player).getWoodCuttingInt() >= 150)
treefellticks++;
if(mcUsers.getProfile(player).getWoodCuttingInt() >= 250)
treefellticks++;
if(mcUsers.getProfile(player).getWoodCuttingInt() >= 350)
treefellticks++;
if(mcUsers.getProfile(player).getWoodCuttingInt() >= 450)
treefellticks++;
if(mcUsers.getProfile(player).getWoodCuttingInt() >= 550)
treefellticks++;
if(mcUsers.getProfile(player).getWoodCuttingInt() >= 650)
treefellticks++;
if(mcUsers.getProfile(player).getWoodCuttingInt() >= 750)
treefellticks++;
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+"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+(treefellticks * 2)+"s");
player.sendMessage(ChatColor.DARK_AQUA+"Double Drops: "+ChatColor.GREEN+"Double the normal loot");
}
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);
String percentagefire = String.valueOf((skillvalue / 1500) * 100);
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+"Ignition: "+ChatColor.GREEN+"Enemies will catch on fire");
//player.sendMessage(ChatColor.DARK_AQUA+"Daze (Monsters): "+ChatColor.GREEN+"Enemies lose interest for 1 second");
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+"Chance for Ignition: "+ChatColor.YELLOW+percentagefire+"%");
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++;
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+"Skull Splitter (ABILITY): "+ChatColor.GREEN+"Deal AoE Damage");
player.sendMessage(ChatColor.DARK_AQUA+"Critical Strikes: "+ChatColor.GREEN+"Double Damage");
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+"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.GREEN+"Axe Mastery - Bonus 4 damage");
}
player.sendMessage(ChatColor.RED+"Skull Splitter Length: "+ChatColor.YELLOW+(ticks * 2)+"s");
}
if(split[0].equalsIgnoreCase("/swords")){
event.setCancelled(true);
String percentage, parrypercentage = null;
float skillvalue = (float)mcUsers.getProfile(player).getSwordsInt();
if(mcUsers.getProfile(player).getSwordsInt() < 750){
percentage = String.valueOf((skillvalue / 1000) * 100);
} else {
percentage = "75";
}
if(mcUsers.getProfile(player).getSwordsInt() >= 775){
parrypercentage = "20";
} else if (mcUsers.getProfile(player).getSwordsInt() >= 445){
parrypercentage = "15";
} else if (mcUsers.getProfile(player).getSwordsInt() >= 250){
parrypercentage = "10";
} else if (mcUsers.getProfile(player).getSwordsInt() >= 25){
parrypercentage = "5";
} else {
parrypercentage = "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++;
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+"Serrated Strikes (ABILITY): "+ChatColor.GREEN+"25% DMG AoE, Bleed+ AoE");
player.sendMessage(ChatColor.DARK_GRAY+"Serrated Strikes Bleed+: "+ChatColor.GREEN+"Enemies Bleed Longer");
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.RED+"---[]"+ChatColor.GREEN+"YOUR STATS"+ChatColor.RED+"[]---");
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 * 2)+"s");
}
if(split[0].equalsIgnoreCase("/acrobatics")){
event.setCancelled(true);
float skillvalue = (float)mcUsers.getProfile(player).getAcrobaticsInt();
String percentage = String.valueOf((skillvalue / 1000) * 100);
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.RED+"---[]"+ChatColor.GREEN+"YOUR STATS"+ChatColor.RED+"[]---");
player.sendMessage(ChatColor.RED+"Roll Chance: "+ChatColor.YELLOW+percentage+"%");
}
if(split[0].equalsIgnoreCase("/mining")){
float skillvalue = (float)mcUsers.getProfile(player).getMiningInt();
String percentage = String.valueOf((skillvalue / 1000) * 100);
int miningticks = 2;
if(mcUsers.getProfile(player).getMiningInt() >= 50)
miningticks++;
if(mcUsers.getProfile(player).getMiningInt() >= 150)
miningticks++;
if(mcUsers.getProfile(player).getMiningInt() >= 250)
miningticks++;
if(mcUsers.getProfile(player).getMiningInt() >= 350)
miningticks++;
if(mcUsers.getProfile(player).getMiningInt() >= 450)
miningticks++;
if(mcUsers.getProfile(player).getMiningInt() >= 550)
miningticks++;
if(mcUsers.getProfile(player).getMiningInt() >= 650)
miningticks++;
if(mcUsers.getProfile(player).getMiningInt() >= 750)
miningticks++;
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+(miningticks * 2)+"s");
}
if(split[0].equalsIgnoreCase("/repair")){
float skillvalue = (float)mcUsers.getProfile(player).getRepairInt();
String percentage = String.valueOf((skillvalue / 1000) * 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+"Super Repair: "+ChatColor.GREEN+"Fully Repair an item");
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+"Super Repair Chance: "+ChatColor.YELLOW+percentage+"%");
player.sendMessage(ChatColor.DARK_AQUA+"Diamond Repair (50+ SKILL): "+ChatColor.GREEN+"Repair Diamond Tools & Armor");
}
if(split[0].equalsIgnoreCase("/unarmed")){
event.setCancelled(true);
int rank = 0;
String percentage, arrowpercentage;
float skillvalue = (float)mcUsers.getProfile(player).getUnarmedInt();
if(mcUsers.getProfile(player).getUnarmedInt() < 750){
percentage = String.valueOf((skillvalue / 1000) * 100);
} else {
percentage = "75";
}
if(mcUsers.getProfile(player).getUnarmedInt() < 1000){
arrowpercentage = String.valueOf(((skillvalue / 1000) * 100) / 2);
} else {
arrowpercentage = "50";
}
if(mcUsers.getProfile(player).getUnarmedInt() >= 50)
rank++;
if(mcUsers.getProfile(player).getUnarmedInt() >= 100)
rank++;
if(mcUsers.getProfile(player).getUnarmedInt() >= 200)
rank++;
if(mcUsers.getProfile(player).getUnarmedInt() >= 325)
rank++;
if(mcUsers.getProfile(player).getUnarmedInt() >= 475)
rank++;
if(mcUsers.getProfile(player).getUnarmedInt() >= 600)
rank++;
if(mcUsers.getProfile(player).getUnarmedInt() >= 775)
rank++;
if(mcUsers.getProfile(player).getUnarmedInt() >= 950)
rank++;
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++;
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+"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+"%");
player.sendMessage(ChatColor.RED+"Damage+ (Rank"+rank+"): Bonus "+rank+" damage");
player.sendMessage(ChatColor.RED+"Berserk Length: "+ChatColor.YELLOW+(ticks * 2)+"s");
}
if(split[0].equalsIgnoreCase("/herbalism")){
event.setCancelled(true);
int rank = 0;
if(mcUsers.getProfile(player).getHerbalismInt() >= 50){
rank++;
} else if (mcUsers.getProfile(player).getHerbalismInt() >= 150){
rank++;
} else if (mcUsers.getProfile(player).getHerbalismInt() >= 250){
rank++;
} else if (mcUsers.getProfile(player).getHerbalismInt() >= 350){
rank++;
} else if (mcUsers.getProfile(player).getHerbalismInt() >= 450){
rank++;
} else if (mcUsers.getProfile(player).getHerbalismInt() >= 550){
rank++;
} else if (mcUsers.getProfile(player).getHerbalismInt() >= 650){
rank++;
} else 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++;
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 * 2)+"s");
}
if(split[0].equalsIgnoreCase("/"+mcLoadProperties.mcmmo)){
event.setCancelled(true);
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.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.GREEN+"You can donate via paypal to"+ChatColor.DARK_RED+" nossr50@gmail.com");
}
if(split[0].equalsIgnoreCase("/"+mcLoadProperties.mcc)){
@ -603,8 +341,6 @@ public class mcm {
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.9.10
version: 0.8.11 WIP B17