mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-22 21:26:46 +01:00
1.0 WIP
This commit is contained in:
parent
bc0c3c7a57
commit
3352a74765
@ -1,5 +1,10 @@
|
|||||||
Changelog:
|
Changelog:
|
||||||
#Versions without changelogs probably had very small misc fixes, like tweaks to the source code#
|
#Versions without changelogs probably had very small misc fixes, like tweaks to the source code#
|
||||||
|
Version 1.0
|
||||||
|
Taming Skill
|
||||||
|
Leaderboards
|
||||||
|
Players won't hand out XP if they died within the last 5 seconds
|
||||||
|
|
||||||
Version 0.9.29
|
Version 0.9.29
|
||||||
Fixes critical bug involving water turning anything into clay
|
Fixes critical bug involving water turning anything into clay
|
||||||
|
|
||||||
|
6
mcMMO/com/gmail/nossr50/PlayerStat.java
Normal file
6
mcMMO/com/gmail/nossr50/PlayerStat.java
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
package com.gmail.nossr50;
|
||||||
|
|
||||||
|
public class PlayerStat {
|
||||||
|
public String name;
|
||||||
|
public int statVal = 0;
|
||||||
|
}
|
@ -6,11 +6,11 @@ import org.bukkit.entity.Player;
|
|||||||
|
|
||||||
public class Tree {
|
public class Tree {
|
||||||
|
|
||||||
TreeNode root;
|
TreeNode root = null;
|
||||||
|
|
||||||
public Tree(){}
|
public Tree(){}
|
||||||
|
|
||||||
public void add(Player p, int in )
|
public void add(String p, int in)
|
||||||
{
|
{
|
||||||
if(root == null)
|
if(root == null)
|
||||||
root = new TreeNode(p, in);
|
root = new TreeNode(p, in);
|
||||||
@ -18,9 +18,10 @@ public class Tree {
|
|||||||
root.add(p,in);
|
root.add(p,in);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Player[] inOrder()
|
public PlayerStat[] inOrder()
|
||||||
{
|
{
|
||||||
return (Player[]) root.inOrder(new ArrayList<Player>()).toArray();
|
ArrayList<PlayerStat> order = root.inOrder(new ArrayList<PlayerStat>());
|
||||||
|
return order.toArray(new PlayerStat[order.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -7,20 +7,19 @@ import org.bukkit.entity.Player;
|
|||||||
public class TreeNode {
|
public class TreeNode {
|
||||||
TreeNode left = null
|
TreeNode left = null
|
||||||
, right = null;
|
, right = null;
|
||||||
Player player;
|
PlayerStat ps = new PlayerStat();
|
||||||
int stat;
|
|
||||||
|
|
||||||
public TreeNode(Player p, int in) {stat = in; player = p;}
|
public TreeNode(String p, int in) {ps.statVal = in; ps.name = p;}
|
||||||
|
|
||||||
public void add (Player p, int in) {
|
public void add (String p, int in) {
|
||||||
if (in <= stat)
|
if (in >= ps.statVal)
|
||||||
{
|
{
|
||||||
if (left == null)
|
if (left == null)
|
||||||
left = new TreeNode(p,in);
|
left = new TreeNode(p,in);
|
||||||
else
|
else
|
||||||
left.add(p, in);
|
left.add(p, in);
|
||||||
}
|
}
|
||||||
else if(in > stat)
|
else if(in < ps.statVal)
|
||||||
{
|
{
|
||||||
if (right == null)
|
if (right == null)
|
||||||
right = new TreeNode(p,in);
|
right = new TreeNode(p,in);
|
||||||
@ -29,12 +28,12 @@ public class TreeNode {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArrayList<Player> inOrder(ArrayList<Player> a)
|
public ArrayList<PlayerStat> inOrder(ArrayList<PlayerStat> a)
|
||||||
{
|
{
|
||||||
if(left != null)
|
if(left != null)
|
||||||
a = left.inOrder(a);
|
a = left.inOrder(a);
|
||||||
|
|
||||||
a.add(player);
|
a.add(ps);
|
||||||
|
|
||||||
if(right != null)
|
if(right != null)
|
||||||
a = right.inOrder(a);
|
a = right.inOrder(a);
|
||||||
|
@ -35,7 +35,7 @@ public class mcAcrobatics {
|
|||||||
if(player.getHealth() - newDamage >= 1){
|
if(player.getHealth() - newDamage >= 1){
|
||||||
if(!event.isCancelled())
|
if(!event.isCancelled())
|
||||||
PP.addAcrobaticsXP((event.getDamage() * 8) * mcLoadProperties.xpGainMultiplier);
|
PP.addAcrobaticsXP((event.getDamage() * 8) * mcLoadProperties.xpGainMultiplier);
|
||||||
mcSkills.getInstance().XpCheck(player);
|
mcSkills.XpCheck(player);
|
||||||
event.setDamage(newDamage);
|
event.setDamage(newDamage);
|
||||||
if(event.getDamage() <= 0)
|
if(event.getDamage() <= 0)
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
@ -48,7 +48,7 @@ public class mcAcrobatics {
|
|||||||
} else if (!event.isCancelled()){
|
} else if (!event.isCancelled()){
|
||||||
if(player.getHealth() - event.getDamage() >= 1){
|
if(player.getHealth() - event.getDamage() >= 1){
|
||||||
PP.addAcrobaticsXP((event.getDamage() * 12) * mcLoadProperties.xpGainMultiplier);
|
PP.addAcrobaticsXP((event.getDamage() * 12) * mcLoadProperties.xpGainMultiplier);
|
||||||
mcSkills.getInstance().XpCheck(player);
|
mcSkills.XpCheck(player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,7 @@ public class mcBlockListener extends BlockListener {
|
|||||||
else {
|
else {
|
||||||
block = event.getBlock();
|
block = event.getBlock();
|
||||||
}
|
}
|
||||||
if(player != null && mcm.getInstance().shouldBeWatched(block)){
|
if(player != null && mcm.shouldBeWatched(block)){
|
||||||
if(block.getTypeId() != 17)
|
if(block.getTypeId() != 17)
|
||||||
block.setData((byte) 5); //Change the byte
|
block.setData((byte) 5); //Change the byte
|
||||||
if(block.getTypeId() == 17)
|
if(block.getTypeId() == 17)
|
||||||
@ -53,18 +53,18 @@ public class mcBlockListener extends BlockListener {
|
|||||||
/*
|
/*
|
||||||
* Check if the Timer is doing its job
|
* Check if the Timer is doing its job
|
||||||
*/
|
*/
|
||||||
mcSkills.getInstance().monitorSkills(player);
|
mcSkills.monitorSkills(player);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* HERBALISM
|
* HERBALISM
|
||||||
*/
|
*/
|
||||||
if(PP.getHoePreparationMode() && mcPermissions.getInstance().herbalismAbility(player) && block.getTypeId() == 59 && block.getData() == (byte) 0x07){
|
if(PP.getHoePreparationMode() && mcPermissions.getInstance().herbalismAbility(player) && block.getTypeId() == 59 && block.getData() == (byte) 0x07){
|
||||||
mcHerbalism.getInstance().greenTerraCheck(player, block, plugin);
|
mcHerbalism.greenTerraCheck(player, block, plugin);
|
||||||
}
|
}
|
||||||
//Wheat && Triple drops
|
//Wheat && Triple drops
|
||||||
if(PP.getGreenTerraMode() && mcHerbalism.getInstance().canBeGreenTerra(block)){
|
if(PP.getGreenTerraMode() && mcHerbalism.canBeGreenTerra(block)){
|
||||||
mcHerbalism.getInstance().herbalismProcCheck(block, player, event);
|
mcHerbalism.herbalismProcCheck(block, player, event);
|
||||||
mcHerbalism.getInstance().greenTerraWheat(player, block, event);
|
mcHerbalism.greenTerraWheat(player, block, event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -73,10 +73,10 @@ public class mcBlockListener extends BlockListener {
|
|||||||
*/
|
*/
|
||||||
if(mcPermissions.getInstance().mining(player)){
|
if(mcPermissions.getInstance().mining(player)){
|
||||||
if(mcLoadProperties.miningrequirespickaxe){
|
if(mcLoadProperties.miningrequirespickaxe){
|
||||||
if(mcm.getInstance().isMiningPick(inhand))
|
if(mcm.isMiningPick(inhand))
|
||||||
mcMining.getInstance().miningBlockCheck(player, block);
|
mcMining.miningBlockCheck(player, block);
|
||||||
} else {
|
} else {
|
||||||
mcMining.getInstance().miningBlockCheck(player, block);
|
mcMining.miningBlockCheck(player, block);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
@ -85,19 +85,19 @@ public class mcBlockListener extends BlockListener {
|
|||||||
|
|
||||||
if(player != null && block.getTypeId() == 17 && mcPermissions.getInstance().woodcutting(player)){
|
if(player != null && block.getTypeId() == 17 && mcPermissions.getInstance().woodcutting(player)){
|
||||||
if(mcLoadProperties.woodcuttingrequiresaxe){
|
if(mcLoadProperties.woodcuttingrequiresaxe){
|
||||||
if(mcm.getInstance().isAxes(inhand)){
|
if(mcm.isAxes(inhand)){
|
||||||
if(!mcConfig.getInstance().isBlockWatched(block)){
|
if(!mcConfig.getInstance().isBlockWatched(block)){
|
||||||
mcWoodCutting.getInstance().woodCuttingProcCheck(player, block);
|
mcWoodCutting.woodCuttingProcCheck(player, block);
|
||||||
PP.addWoodcuttingXP(7 * mcLoadProperties.xpGainMultiplier);
|
PP.addWoodcuttingXP(7 * mcLoadProperties.xpGainMultiplier);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if(block.getData() != 5){
|
if(block.getData() != 5){
|
||||||
mcWoodCutting.getInstance().woodCuttingProcCheck(player, block);
|
mcWoodCutting.woodCuttingProcCheck(player, block);
|
||||||
PP.addWoodcuttingXP(7 * mcLoadProperties.xpGainMultiplier);
|
PP.addWoodcuttingXP(7 * mcLoadProperties.xpGainMultiplier);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mcSkills.getInstance().XpCheck(player);
|
mcSkills.XpCheck(player);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* IF PLAYER IS USING TREEFELLER
|
* IF PLAYER IS USING TREEFELLER
|
||||||
@ -105,9 +105,9 @@ public class mcBlockListener extends BlockListener {
|
|||||||
if(mcPermissions.getInstance().woodCuttingAbility(player)
|
if(mcPermissions.getInstance().woodCuttingAbility(player)
|
||||||
&& PP.getTreeFellerMode()
|
&& PP.getTreeFellerMode()
|
||||||
&& block.getTypeId() == 17
|
&& block.getTypeId() == 17
|
||||||
&& mcm.getInstance().blockBreakSimulate(block, player, plugin)){
|
&& mcm.blockBreakSimulate(block, player, plugin)){
|
||||||
|
|
||||||
mcWoodCutting.getInstance().treeFeller(block, player);
|
mcWoodCutting.treeFeller(block, player);
|
||||||
for(Block blockx : mcConfig.getInstance().getTreeFeller()){
|
for(Block blockx : mcConfig.getInstance().getTreeFeller()){
|
||||||
if(blockx != null){
|
if(blockx != null){
|
||||||
Material mat = Material.getMaterial(block.getTypeId());
|
Material mat = Material.getMaterial(block.getTypeId());
|
||||||
@ -119,7 +119,7 @@ public class mcBlockListener extends BlockListener {
|
|||||||
blockx.getLocation().getWorld().dropItemNaturally(blockx.getLocation(), item);
|
blockx.getLocation().getWorld().dropItemNaturally(blockx.getLocation(), item);
|
||||||
//XP WOODCUTTING
|
//XP WOODCUTTING
|
||||||
if(!mcConfig.getInstance().isBlockWatched(block)){
|
if(!mcConfig.getInstance().isBlockWatched(block)){
|
||||||
mcWoodCutting.getInstance().woodCuttingProcCheck(player, blockx);
|
mcWoodCutting.woodCuttingProcCheck(player, blockx);
|
||||||
PP.addWoodcuttingXP(7);
|
PP.addWoodcuttingXP(7);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -133,7 +133,7 @@ public class mcBlockListener extends BlockListener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(mcLoadProperties.toolsLoseDurabilityFromAbilities)
|
if(mcLoadProperties.toolsLoseDurabilityFromAbilities)
|
||||||
mcm.getInstance().damageTool(player, (short) mcLoadProperties.abilityDurabilityLoss);
|
mcm.damageTool(player, (short) mcLoadProperties.abilityDurabilityLoss);
|
||||||
mcConfig.getInstance().clearTreeFeller();
|
mcConfig.getInstance().clearTreeFeller();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -141,15 +141,15 @@ public class mcBlockListener extends BlockListener {
|
|||||||
* EXCAVATION
|
* EXCAVATION
|
||||||
*/
|
*/
|
||||||
if(mcPermissions.getInstance().excavation(player) && block.getData() != (byte) 5)
|
if(mcPermissions.getInstance().excavation(player) && block.getData() != (byte) 5)
|
||||||
mcExcavation.getInstance().excavationProcCheck(block, player);
|
mcExcavation.excavationProcCheck(block, player);
|
||||||
/*
|
/*
|
||||||
* HERBALISM
|
* HERBALISM
|
||||||
*/
|
*/
|
||||||
if(PP.getHoePreparationMode() && mcPermissions.getInstance().herbalism(player) && mcHerbalism.getInstance().canBeGreenTerra(block)){
|
if(PP.getHoePreparationMode() && mcPermissions.getInstance().herbalism(player) && mcHerbalism.canBeGreenTerra(block)){
|
||||||
mcHerbalism.getInstance().greenTerraCheck(player, block, plugin);
|
mcHerbalism.greenTerraCheck(player, block, plugin);
|
||||||
}
|
}
|
||||||
if(mcPermissions.getInstance().herbalism(player) && block.getData() != (byte) 5)
|
if(mcPermissions.getInstance().herbalism(player) && block.getData() != (byte) 5)
|
||||||
mcHerbalism.getInstance().herbalismProcCheck(block, player, event);
|
mcHerbalism.herbalismProcCheck(block, player, event);
|
||||||
|
|
||||||
//Change the byte back when broken
|
//Change the byte back when broken
|
||||||
if(block.getData() == 5)
|
if(block.getData() == 5)
|
||||||
@ -165,41 +165,41 @@ public class mcBlockListener extends BlockListener {
|
|||||||
/*
|
/*
|
||||||
* Check if the Timer is doing its job
|
* Check if the Timer is doing its job
|
||||||
*/
|
*/
|
||||||
mcSkills.getInstance().monitorSkills(player);
|
mcSkills.monitorSkills(player);
|
||||||
/*
|
/*
|
||||||
* ABILITY PREPARATION CHECKS
|
* ABILITY PREPARATION CHECKS
|
||||||
*/
|
*/
|
||||||
if(PP.getHoePreparationMode() && mcHerbalism.getInstance().canBeGreenTerra(block))
|
if(PP.getHoePreparationMode() && mcHerbalism.canBeGreenTerra(block))
|
||||||
mcHerbalism.getInstance().greenTerraCheck(player, block, plugin);
|
mcHerbalism.greenTerraCheck(player, block, plugin);
|
||||||
if(PP.getAxePreparationMode() && block.getTypeId() == 17)
|
if(PP.getAxePreparationMode() && block.getTypeId() == 17)
|
||||||
mcWoodCutting.getInstance().treeFellerCheck(player, block, plugin);
|
mcWoodCutting.treeFellerCheck(player, block, plugin);
|
||||||
if(PP.getPickaxePreparationMode())
|
if(PP.getPickaxePreparationMode())
|
||||||
mcMining.getInstance().superBreakerCheck(player, block, plugin);
|
mcMining.superBreakerCheck(player, block, plugin);
|
||||||
if(PP.getShovelPreparationMode() && mcExcavation.getInstance().canBeGigaDrillBroken(block))
|
if(PP.getShovelPreparationMode() && mcExcavation.canBeGigaDrillBroken(block))
|
||||||
mcExcavation.getInstance().gigaDrillBreakerActivationCheck(player, block, plugin);
|
mcExcavation.gigaDrillBreakerActivationCheck(player, block, plugin);
|
||||||
if(PP.getFistsPreparationMode() && mcExcavation.getInstance().canBeGigaDrillBroken(block))
|
if(PP.getFistsPreparationMode() && mcExcavation.canBeGigaDrillBroken(block))
|
||||||
mcSkills.getInstance().berserkActivationCheck(player, plugin);
|
mcSkills.berserkActivationCheck(player, plugin);
|
||||||
/*
|
/*
|
||||||
* GREEN TERRA STUFF
|
* GREEN TERRA STUFF
|
||||||
*/
|
*/
|
||||||
if(PP.getGreenTerraMode() && mcPermissions.getInstance().herbalismAbility(player) && PP.getGreenTerraMode()){
|
if(PP.getGreenTerraMode() && mcPermissions.getInstance().herbalismAbility(player) && PP.getGreenTerraMode()){
|
||||||
mcHerbalism.getInstance().greenTerra(player, block);
|
mcHerbalism.greenTerra(player, block);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* GIGA DRILL BREAKER CHECKS
|
* GIGA DRILL BREAKER CHECKS
|
||||||
*/
|
*/
|
||||||
if(PP.getGigaDrillBreakerMode()
|
if(PP.getGigaDrillBreakerMode()
|
||||||
&& mcm.getInstance().blockBreakSimulate(block, player, plugin)
|
&& mcm.blockBreakSimulate(block, player, plugin)
|
||||||
&& mcExcavation.getInstance().canBeGigaDrillBroken(block)
|
&& mcExcavation.canBeGigaDrillBroken(block)
|
||||||
&& mcm.getInstance().isShovel(inhand)){
|
&& mcm.isShovel(inhand)){
|
||||||
|
|
||||||
if(mcm.getInstance().getTier(player) >= 2)
|
if(mcm.getTier(player) >= 2)
|
||||||
mcExcavation.getInstance().excavationProcCheck(block, player);
|
mcExcavation.excavationProcCheck(block, player);
|
||||||
if(mcm.getInstance().getTier(player) >= 3)
|
if(mcm.getTier(player) >= 3)
|
||||||
mcExcavation.getInstance().excavationProcCheck(block, player);
|
mcExcavation.excavationProcCheck(block, player);
|
||||||
if(mcm.getInstance().getTier(player) >= 4)
|
if(mcm.getTier(player) >= 4)
|
||||||
mcExcavation.getInstance().excavationProcCheck(block, player);
|
mcExcavation.excavationProcCheck(block, player);
|
||||||
Material mat = Material.getMaterial(block.getTypeId());
|
Material mat = Material.getMaterial(block.getTypeId());
|
||||||
if(block.getTypeId() == 2)
|
if(block.getTypeId() == 2)
|
||||||
mat = Material.DIRT;
|
mat = Material.DIRT;
|
||||||
@ -207,16 +207,16 @@ public class mcBlockListener extends BlockListener {
|
|||||||
ItemStack item = new ItemStack(mat, 1, (byte)0, type);
|
ItemStack item = new ItemStack(mat, 1, (byte)0, type);
|
||||||
block.setType(Material.AIR);
|
block.setType(Material.AIR);
|
||||||
if(mcLoadProperties.toolsLoseDurabilityFromAbilities)
|
if(mcLoadProperties.toolsLoseDurabilityFromAbilities)
|
||||||
mcm.getInstance().damageTool(player, (short) mcLoadProperties.abilityDurabilityLoss);
|
mcm.damageTool(player, (short) mcLoadProperties.abilityDurabilityLoss);
|
||||||
block.getLocation().getWorld().dropItemNaturally(block.getLocation(), item);
|
block.getLocation().getWorld().dropItemNaturally(block.getLocation(), item);
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* BERSERK MODE CHECKS
|
* BERSERK MODE CHECKS
|
||||||
*/
|
*/
|
||||||
if(PP.getBerserkMode()
|
if(PP.getBerserkMode()
|
||||||
&& mcm.getInstance().blockBreakSimulate(block, player, plugin)
|
&& mcm.blockBreakSimulate(block, player, plugin)
|
||||||
&& player.getItemInHand().getTypeId() == 0
|
&& player.getItemInHand().getTypeId() == 0
|
||||||
&& mcExcavation.getInstance().canBeGigaDrillBroken(block)){
|
&& mcExcavation.canBeGigaDrillBroken(block)){
|
||||||
Material mat = Material.getMaterial(block.getTypeId());
|
Material mat = Material.getMaterial(block.getTypeId());
|
||||||
if(block.getTypeId() == 2)
|
if(block.getTypeId() == 2)
|
||||||
mat = Material.DIRT;
|
mat = Material.DIRT;
|
||||||
@ -230,14 +230,14 @@ public class mcBlockListener extends BlockListener {
|
|||||||
* SUPER BREAKER CHECKS
|
* SUPER BREAKER CHECKS
|
||||||
*/
|
*/
|
||||||
if(PP.getSuperBreakerMode()
|
if(PP.getSuperBreakerMode()
|
||||||
&& mcMining.getInstance().canBeSuperBroken(block)
|
&& mcMining.canBeSuperBroken(block)
|
||||||
&& mcm.getInstance().blockBreakSimulate(block, player, plugin)){
|
&& mcm.blockBreakSimulate(block, player, plugin)){
|
||||||
|
|
||||||
if(mcLoadProperties.miningrequirespickaxe){
|
if(mcLoadProperties.miningrequirespickaxe){
|
||||||
if(mcm.getInstance().isMiningPick(inhand))
|
if(mcm.isMiningPick(inhand))
|
||||||
mcMining.getInstance().SuperBreakerBlockCheck(player, block);
|
mcMining.SuperBreakerBlockCheck(player, block);
|
||||||
} else {
|
} else {
|
||||||
mcMining.getInstance().SuperBreakerBlockCheck(player, block);
|
mcMining.SuperBreakerBlockCheck(player, block);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,14 +26,7 @@ public class mcCombat {
|
|||||||
public mcCombat(mcMMO instance) {
|
public mcCombat(mcMMO instance) {
|
||||||
plugin = instance;
|
plugin = instance;
|
||||||
}
|
}
|
||||||
private static volatile mcCombat instance;
|
public static void playerVersusPlayerChecks(Entity x, Player attacker, EntityDamageByEntityEvent event){
|
||||||
public static mcCombat getInstance() {
|
|
||||||
if (instance == null) {
|
|
||||||
instance = new mcCombat(plugin);
|
|
||||||
}
|
|
||||||
return instance;
|
|
||||||
}
|
|
||||||
public void playerVersusPlayerChecks(Entity x, Player attacker, EntityDamageByEntityEvent event){
|
|
||||||
if(x instanceof Player){
|
if(x instanceof Player){
|
||||||
if(mcLoadProperties.pvp == false){
|
if(mcLoadProperties.pvp == false){
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
@ -92,37 +85,39 @@ public class mcCombat {
|
|||||||
if(attacker != null && defender != null && mcLoadProperties.pvpxp){
|
if(attacker != null && defender != null && mcLoadProperties.pvpxp){
|
||||||
if(PPd.inParty() && PPa.inParty() && mcParty.getInstance().inSameParty(attacker, defender))
|
if(PPd.inParty() && PPa.inParty() && mcParty.getInstance().inSameParty(attacker, defender))
|
||||||
return;
|
return;
|
||||||
if(mcm.getInstance().isAxes(attacker.getItemInHand()))
|
if(System.currentTimeMillis() >= PPd.getRespawnATS() + 5000 && defender.getHealth() >= 1){
|
||||||
|
if(mcm.isAxes(attacker.getItemInHand()))
|
||||||
PPa.addAxesXP((event.getDamage() * 3) * mcLoadProperties.pvpxprewardmodifier);
|
PPa.addAxesXP((event.getDamage() * 3) * mcLoadProperties.pvpxprewardmodifier);
|
||||||
if(mcm.getInstance().isSwords(attacker.getItemInHand()))
|
if(mcm.isSwords(attacker.getItemInHand()))
|
||||||
PPa.addSwordsXP((event.getDamage() * 3) * mcLoadProperties.pvpxprewardmodifier);
|
PPa.addSwordsXP((event.getDamage() * 3) * mcLoadProperties.pvpxprewardmodifier);
|
||||||
if(attacker.getItemInHand().getTypeId() == 0)
|
if(attacker.getItemInHand().getTypeId() == 0)
|
||||||
PPa.addUnarmedXP((event.getDamage() * 3) * mcLoadProperties.pvpxprewardmodifier);
|
PPa.addUnarmedXP((event.getDamage() * 3) * mcLoadProperties.pvpxprewardmodifier);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
/*
|
/*
|
||||||
* CHECK FOR LEVEL UPS
|
* CHECK FOR LEVEL UPS
|
||||||
*/
|
*/
|
||||||
mcSkills.getInstance().XpCheck(attacker);
|
mcSkills.XpCheck(attacker);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public void playerVersusSquidChecks(EntityDamageByEntityEvent event, Player attacker, Entity x, int type){
|
public static void playerVersusSquidChecks(EntityDamageByEntityEvent event, Player attacker, Entity x, int type){
|
||||||
PlayerProfile PPa = mcUsers.getProfile(attacker.getName());
|
PlayerProfile PPa = mcUsers.getProfile(attacker.getName());
|
||||||
if(x instanceof Squid){
|
if(x instanceof Squid){
|
||||||
if(!mcConfig.getInstance().isBleedTracked(x)){
|
if(!mcConfig.getInstance().isBleedTracked(x)){
|
||||||
bleedCheck(attacker, x);
|
bleedCheck(attacker, x);
|
||||||
}
|
}
|
||||||
Squid defender = (Squid)event.getEntity();
|
Squid defender = (Squid)event.getEntity();
|
||||||
if(mcm.getInstance().isSwords(attacker.getItemInHand()) && defender.getHealth() > 0 && mcPermissions.getInstance().swords(attacker)){
|
if(mcm.isSwords(attacker.getItemInHand()) && defender.getHealth() > 0 && mcPermissions.getInstance().swords(attacker)){
|
||||||
PPa.addSwordsXP(10 * mcLoadProperties.xpGainMultiplier);
|
PPa.addSwordsXP(10 * mcLoadProperties.xpGainMultiplier);
|
||||||
}
|
}
|
||||||
mcSkills.getInstance().XpCheck(attacker);
|
mcSkills.XpCheck(attacker);
|
||||||
if(mcm.getInstance().isAxes(attacker.getItemInHand())
|
if(mcm.isAxes(attacker.getItemInHand())
|
||||||
&& defender.getHealth() > 0
|
&& defender.getHealth() > 0
|
||||||
&& mcPermissions.getInstance().axes(attacker)){
|
&& mcPermissions.getInstance().axes(attacker)){
|
||||||
PPa.addAxesXP(10 * mcLoadProperties.xpGainMultiplier);
|
PPa.addAxesXP(10 * mcLoadProperties.xpGainMultiplier);
|
||||||
mcSkills.getInstance().XpCheck(attacker);
|
mcSkills.XpCheck(attacker);
|
||||||
}
|
}
|
||||||
if(mcm.getInstance().isAxes(attacker.getItemInHand()) && mcPermissions.getInstance().axes(attacker)){
|
if(mcm.isAxes(attacker.getItemInHand()) && mcPermissions.getInstance().axes(attacker)){
|
||||||
if(PPa.getAxesInt() >= 500){
|
if(PPa.getAxesInt() >= 500){
|
||||||
event.setDamage(calculateDamage(event, 4));
|
event.setDamage(calculateDamage(event, 4));
|
||||||
}
|
}
|
||||||
@ -145,19 +140,19 @@ public class mcCombat {
|
|||||||
//XP
|
//XP
|
||||||
if(defender.getHealth() != 0){
|
if(defender.getHealth() != 0){
|
||||||
PPa.addUnarmedXP(10 * mcLoadProperties.xpGainMultiplier);
|
PPa.addUnarmedXP(10 * mcLoadProperties.xpGainMultiplier);
|
||||||
mcSkills.getInstance().XpCheck(attacker);
|
mcSkills.XpCheck(attacker);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public void playerVersusAnimalsChecks(Entity x, Player attacker, EntityDamageByEntityEvent event, int type){
|
public static void playerVersusAnimalsChecks(Entity x, Player attacker, EntityDamageByEntityEvent event, int type){
|
||||||
PlayerProfile PPa = mcUsers.getProfile(attacker.getName());
|
PlayerProfile PPa = mcUsers.getProfile(attacker.getName());
|
||||||
if(x instanceof Animals){
|
if(x instanceof Animals){
|
||||||
if(!mcConfig.getInstance().isBleedTracked(x)){
|
if(!mcConfig.getInstance().isBleedTracked(x)){
|
||||||
bleedCheck(attacker, x);
|
bleedCheck(attacker, x);
|
||||||
}
|
}
|
||||||
Animals defender = (Animals)event.getEntity();
|
Animals defender = (Animals)event.getEntity();
|
||||||
if(mcm.getInstance().isAxes(attacker.getItemInHand()) && mcPermissions.getInstance().axes(attacker)){
|
if(mcm.isAxes(attacker.getItemInHand()) && mcPermissions.getInstance().axes(attacker)){
|
||||||
if(defender.getHealth() <= 0)
|
if(defender.getHealth() <= 0)
|
||||||
return;
|
return;
|
||||||
if(PPa.getAxesInt() >= 500){
|
if(PPa.getAxesInt() >= 500){
|
||||||
@ -175,7 +170,7 @@ public class mcCombat {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public void playerVersusMonsterChecks(EntityDamageByEntityEvent event, Player attacker, Entity x, int type){
|
public static void playerVersusMonsterChecks(EntityDamageByEntityEvent event, Player attacker, Entity x, int type){
|
||||||
PlayerProfile PPa = mcUsers.getProfile(attacker.getName());
|
PlayerProfile PPa = mcUsers.getProfile(attacker.getName());
|
||||||
if(x instanceof Monster){
|
if(x instanceof Monster){
|
||||||
/*
|
/*
|
||||||
@ -186,7 +181,7 @@ public class mcCombat {
|
|||||||
bleedCheck(attacker, x);
|
bleedCheck(attacker, x);
|
||||||
}
|
}
|
||||||
Monster defender = (Monster)event.getEntity();
|
Monster defender = (Monster)event.getEntity();
|
||||||
if(mcm.getInstance().isSwords(attacker.getItemInHand())
|
if(mcm.isSwords(attacker.getItemInHand())
|
||||||
&& defender.getHealth() > 0
|
&& defender.getHealth() > 0
|
||||||
&& mcPermissions.getInstance().swords(attacker)){
|
&& mcPermissions.getInstance().swords(attacker)){
|
||||||
if(!mcConfig.getInstance().isMobSpawnTracked(x)){
|
if(!mcConfig.getInstance().isMobSpawnTracked(x)){
|
||||||
@ -201,9 +196,9 @@ public class mcCombat {
|
|||||||
if(x instanceof PigZombie)
|
if(x instanceof PigZombie)
|
||||||
PPa.addSwordsXP((event.getDamage() * 3) * mcLoadProperties.xpGainMultiplier);
|
PPa.addSwordsXP((event.getDamage() * 3) * mcLoadProperties.xpGainMultiplier);
|
||||||
}
|
}
|
||||||
mcSkills.getInstance().XpCheck(attacker);
|
mcSkills.XpCheck(attacker);
|
||||||
}
|
}
|
||||||
if(mcm.getInstance().isAxes(attacker.getItemInHand())
|
if(mcm.isAxes(attacker.getItemInHand())
|
||||||
&& defender.getHealth() > 0
|
&& defender.getHealth() > 0
|
||||||
&& mcPermissions.getInstance().axes(attacker)){
|
&& mcPermissions.getInstance().axes(attacker)){
|
||||||
if(!mcConfig.getInstance().isMobSpawnTracked(x)){
|
if(!mcConfig.getInstance().isMobSpawnTracked(x)){
|
||||||
@ -218,12 +213,12 @@ public class mcCombat {
|
|||||||
if(x instanceof PigZombie)
|
if(x instanceof PigZombie)
|
||||||
PPa.addAxesXP((event.getDamage() * 3) * mcLoadProperties.xpGainMultiplier);
|
PPa.addAxesXP((event.getDamage() * 3) * mcLoadProperties.xpGainMultiplier);
|
||||||
}
|
}
|
||||||
mcSkills.getInstance().XpCheck(attacker);
|
mcSkills.XpCheck(attacker);
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* AXE DAMAGE SCALING && LOOT CHECKS
|
* AXE DAMAGE SCALING && LOOT CHECKS
|
||||||
*/
|
*/
|
||||||
if(mcm.getInstance().isAxes(attacker.getItemInHand()) && mcPermissions.getInstance().axes(attacker)){
|
if(mcm.isAxes(attacker.getItemInHand()) && mcPermissions.getInstance().axes(attacker)){
|
||||||
if(PPa.getAxesInt() >= 500){
|
if(PPa.getAxesInt() >= 500){
|
||||||
event.setDamage(calculateDamage(event, 4));
|
event.setDamage(calculateDamage(event, 4));
|
||||||
}
|
}
|
||||||
@ -253,11 +248,11 @@ public class mcCombat {
|
|||||||
if(x instanceof PigZombie)
|
if(x instanceof PigZombie)
|
||||||
PPa.addUnarmedXP((event.getDamage() * 3) * mcLoadProperties.xpGainMultiplier);
|
PPa.addUnarmedXP((event.getDamage() * 3) * mcLoadProperties.xpGainMultiplier);
|
||||||
}
|
}
|
||||||
mcSkills.getInstance().XpCheck(attacker);
|
mcSkills.XpCheck(attacker);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public void archeryCheck(EntityDamageByProjectileEvent event){
|
public static void archeryCheck(EntityDamageByProjectileEvent event){
|
||||||
Entity y = event.getDamager();
|
Entity y = event.getDamager();
|
||||||
Entity x = event.getEntity();
|
Entity x = event.getEntity();
|
||||||
if(event.getProjectile().toString().equals("CraftArrow") && x instanceof Player){
|
if(event.getProjectile().toString().equals("CraftArrow") && x instanceof Player){
|
||||||
@ -450,10 +445,10 @@ public class mcCombat {
|
|||||||
event.setDamage(calculateDamage(event, 5));
|
event.setDamage(calculateDamage(event, 5));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mcSkills.getInstance().XpCheck(attacker);
|
mcSkills.XpCheck(attacker);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public boolean simulateUnarmedProc(Player player){
|
public static boolean simulateUnarmedProc(Player player){
|
||||||
PlayerProfile PP = mcUsers.getProfile(player.getName());
|
PlayerProfile PP = mcUsers.getProfile(player.getName());
|
||||||
if(PP.getUnarmedInt() >= 1000){
|
if(PP.getUnarmedInt() >= 1000){
|
||||||
if(Math.random() * 4000 <= 1000){
|
if(Math.random() * 4000 <= 1000){
|
||||||
@ -466,9 +461,9 @@ public class mcCombat {
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
public void bleedCheck(Player attacker, Entity x){
|
public static void bleedCheck(Player attacker, Entity x){
|
||||||
PlayerProfile PPa = mcUsers.getProfile(attacker.getName());
|
PlayerProfile PPa = mcUsers.getProfile(attacker.getName());
|
||||||
if(mcPermissions.getInstance().swords(attacker) && mcm.getInstance().isSwords(attacker.getItemInHand())){
|
if(mcPermissions.getInstance().swords(attacker) && mcm.isSwords(attacker.getItemInHand())){
|
||||||
if(PPa.getSwordsInt() >= 750){
|
if(PPa.getSwordsInt() >= 750){
|
||||||
if(Math.random() * 1000 >= 750){
|
if(Math.random() * 1000 >= 750){
|
||||||
if(!(x instanceof Player))
|
if(!(x instanceof Player))
|
||||||
@ -490,10 +485,10 @@ public class mcCombat {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public int calculateDamage(EntityDamageEvent event, int dmg){
|
public static int calculateDamage(EntityDamageEvent event, int dmg){
|
||||||
return event.getDamage() + dmg;
|
return event.getDamage() + dmg;
|
||||||
}
|
}
|
||||||
public void dealDamage(Entity target, int dmg){
|
public static void dealDamage(Entity target, int dmg){
|
||||||
if(target instanceof Player){
|
if(target instanceof Player){
|
||||||
((Player) target).damage(dmg);
|
((Player) target).damage(dmg);
|
||||||
}
|
}
|
||||||
@ -504,11 +499,11 @@ public class mcCombat {
|
|||||||
((Monster) target).damage(dmg);
|
((Monster) target).damage(dmg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public void applyAoeDamage(Player attacker, EntityDamageByEntityEvent event, Entity x){
|
public static void applyAoeDamage(Player attacker, EntityDamageByEntityEvent event, Entity x){
|
||||||
int targets = 0;
|
int targets = 0;
|
||||||
targets = mcm.getInstance().getTier(attacker);
|
targets = mcm.getTier(attacker);
|
||||||
for(Entity derp : x.getWorld().getEntities()){
|
for(Entity derp : x.getWorld().getEntities()){
|
||||||
if(mcm.getInstance().getDistance(x.getLocation(), derp.getLocation()) < 5){
|
if(mcm.getDistance(x.getLocation(), derp.getLocation()) < 5){
|
||||||
if(derp instanceof Player){
|
if(derp instanceof Player){
|
||||||
Player target = (Player)derp;
|
Player target = (Player)derp;
|
||||||
if(mcParty.getInstance().inSameParty(attacker, target))
|
if(mcParty.getInstance().inSameParty(attacker, target))
|
||||||
@ -535,11 +530,11 @@ public class mcCombat {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public void applySerratedStrikes(Player attacker, EntityDamageByEntityEvent event, Entity x){
|
public static void applySerratedStrikes(Player attacker, EntityDamageByEntityEvent event, Entity x){
|
||||||
int targets = 0;
|
int targets = 0;
|
||||||
targets = mcm.getInstance().getTier(attacker);
|
targets = mcm.getTier(attacker);
|
||||||
for(Entity derp : x.getWorld().getEntities()){
|
for(Entity derp : x.getWorld().getEntities()){
|
||||||
if(mcm.getInstance().getDistance(x.getLocation(), derp.getLocation()) < 5){
|
if(mcm.getDistance(x.getLocation(), derp.getLocation()) < 5){
|
||||||
if(derp instanceof Player){
|
if(derp instanceof Player){
|
||||||
Player target = (Player)derp;
|
Player target = (Player)derp;
|
||||||
if(mcParty.getInstance().inSameParty(attacker, target))
|
if(mcParty.getInstance().inSameParty(attacker, target))
|
||||||
@ -569,12 +564,12 @@ public class mcCombat {
|
|||||||
targets--;
|
targets--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//attacker.sendMessage(ChatColor.GREEN+"**SERRATED STRIKES HIT "+(mcm.getInstance().getTier(attacker)-targets)+" FOES**");
|
//attacker.sendMessage(ChatColor.GREEN+"**SERRATED STRIKES HIT "+(mcm.getTier(attacker)-targets)+" FOES**");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public void axeCriticalCheck(Player attacker, EntityDamageByEntityEvent event, Entity x){
|
public static void axeCriticalCheck(Player attacker, EntityDamageByEntityEvent event, Entity x){
|
||||||
PlayerProfile PPa = mcUsers.getProfile(attacker.getName());
|
PlayerProfile PPa = mcUsers.getProfile(attacker.getName());
|
||||||
if(mcm.getInstance().isAxes(attacker.getItemInHand()) && mcPermissions.getInstance().axes(attacker)){
|
if(mcm.isAxes(attacker.getItemInHand()) && mcPermissions.getInstance().axes(attacker)){
|
||||||
if(PPa.getAxesInt() >= 750){
|
if(PPa.getAxesInt() >= 750){
|
||||||
if(Math.random() * 1000 <= 750){
|
if(Math.random() * 1000 <= 750){
|
||||||
if(x instanceof Player){
|
if(x instanceof Player){
|
||||||
@ -602,9 +597,9 @@ public class mcCombat {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public void parryCheck(Player defender, EntityDamageByEntityEvent event, Entity y){
|
public static void parryCheck(Player defender, EntityDamageByEntityEvent event, Entity y){
|
||||||
PlayerProfile PPd = mcUsers.getProfile(defender.getName());
|
PlayerProfile PPd = mcUsers.getProfile(defender.getName());
|
||||||
if(defender != null && mcm.getInstance().isSwords(defender.getItemInHand())
|
if(defender != null && mcm.isSwords(defender.getItemInHand())
|
||||||
&& mcPermissions.getInstance().swords(defender)){
|
&& mcPermissions.getInstance().swords(defender)){
|
||||||
if(PPd.getSwordsInt() >= 900){
|
if(PPd.getSwordsInt() >= 900){
|
||||||
if(Math.random() * 3000 <= 900){
|
if(Math.random() * 3000 <= 900){
|
||||||
@ -629,7 +624,7 @@ public class mcCombat {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public void bleedSimulate(){
|
public static void bleedSimulate(){
|
||||||
|
|
||||||
//Add items from Que list to BleedTrack list
|
//Add items from Que list to BleedTrack list
|
||||||
for(Entity x : mcConfig.getInstance().getBleedQue()){
|
for(Entity x : mcConfig.getInstance().getBleedQue()){
|
||||||
@ -652,7 +647,7 @@ public class mcCombat {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(mcm.getInstance().getHealth(x) <= 0){
|
if(mcm.getHealth(x) <= 0){
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ public class mcEntityListener extends EntityListener {
|
|||||||
public void onCreatureSpawn(CreatureSpawnEvent event) {
|
public void onCreatureSpawn(CreatureSpawnEvent event) {
|
||||||
Location loc = event.getLocation();
|
Location loc = event.getLocation();
|
||||||
Entity spawnee = event.getEntity();
|
Entity spawnee = event.getEntity();
|
||||||
if(mcm.getInstance().isBlockAround(loc, 5, 52)){
|
if(mcm.isBlockAround(loc, 5, 52)){
|
||||||
mcConfig.getInstance().addMobSpawnTrack(spawnee);
|
mcConfig.getInstance().addMobSpawnTrack(spawnee);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -90,7 +90,7 @@ public class mcEntityListener extends EntityListener {
|
|||||||
/*
|
/*
|
||||||
* PARRYING CHECK, CHECK TO SEE IF ITS A SUCCESSFUL PARRY OR NOT
|
* PARRYING CHECK, CHECK TO SEE IF ITS A SUCCESSFUL PARRY OR NOT
|
||||||
*/
|
*/
|
||||||
mcCombat.getInstance().parryCheck(defender, eventb, f);
|
mcCombat.parryCheck(defender, eventb, f);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -98,7 +98,7 @@ public class mcEntityListener extends EntityListener {
|
|||||||
*/
|
*/
|
||||||
if(!event.isCancelled() && event instanceof EntityDamageByProjectileEvent && event.getDamage() >= 1){
|
if(!event.isCancelled() && event instanceof EntityDamageByProjectileEvent && event.getDamage() >= 1){
|
||||||
EntityDamageByProjectileEvent c = (EntityDamageByProjectileEvent)event;
|
EntityDamageByProjectileEvent c = (EntityDamageByProjectileEvent)event;
|
||||||
mcCombat.getInstance().archeryCheck(c);
|
mcCombat.archeryCheck(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -117,18 +117,18 @@ public class mcEntityListener extends EntityListener {
|
|||||||
/*
|
/*
|
||||||
* Check if the Timer is doing its job
|
* Check if the Timer is doing its job
|
||||||
*/
|
*/
|
||||||
mcSkills.getInstance().monitorSkills(attacker);
|
mcSkills.monitorSkills(attacker);
|
||||||
|
|
||||||
PlayerProfile PPa = mcUsers.getProfile(attacker.getName());
|
PlayerProfile PPa = mcUsers.getProfile(attacker.getName());
|
||||||
/*
|
/*
|
||||||
* ACTIVATE ABILITIES
|
* ACTIVATE ABILITIES
|
||||||
*/
|
*/
|
||||||
if(PPa.getAxePreparationMode())
|
if(PPa.getAxePreparationMode())
|
||||||
mcSkills.getInstance().skullSplitterCheck(attacker, plugin);
|
mcSkills.skullSplitterCheck(attacker, plugin);
|
||||||
if(PPa.getSwordsPreparationMode())
|
if(PPa.getSwordsPreparationMode())
|
||||||
mcSkills.getInstance().serratedStrikesActivationCheck(attacker, plugin);
|
mcSkills.serratedStrikesActivationCheck(attacker, plugin);
|
||||||
if(PPa.getFistsPreparationMode())
|
if(PPa.getFistsPreparationMode())
|
||||||
mcSkills.getInstance().berserkActivationCheck(attacker, plugin);
|
mcSkills.berserkActivationCheck(attacker, plugin);
|
||||||
/*
|
/*
|
||||||
* BERSERK DAMAGE MODIFIER
|
* BERSERK DAMAGE MODIFIER
|
||||||
*/
|
*/
|
||||||
@ -137,29 +137,29 @@ public class mcEntityListener extends EntityListener {
|
|||||||
/*
|
/*
|
||||||
* Player versus Monster checks, this handles all skill damage modifiers and any procs.
|
* Player versus Monster checks, this handles all skill damage modifiers and any procs.
|
||||||
*/
|
*/
|
||||||
mcCombat.getInstance().playerVersusMonsterChecks(eventb, attacker, e, typeid);
|
mcCombat.playerVersusMonsterChecks(eventb, attacker, e, typeid);
|
||||||
/*
|
/*
|
||||||
* Player versus Squid checks, this handles all skill damage modifiers and any procs.
|
* Player versus Squid checks, this handles all skill damage modifiers and any procs.
|
||||||
*/
|
*/
|
||||||
mcCombat.getInstance().playerVersusSquidChecks(eventb, attacker, e, typeid);
|
mcCombat.playerVersusSquidChecks(eventb, attacker, e, typeid);
|
||||||
/*
|
/*
|
||||||
* Player versus Player checks, these checks make sure players are not in the same party, etc. They also check for any procs from skills and handle damage modifiers.
|
* Player versus Player checks, these checks make sure players are not in the same party, etc. They also check for any procs from skills and handle damage modifiers.
|
||||||
*/
|
*/
|
||||||
if(mcm.getInstance().isPvpEnabled())
|
if(mcm.isPvpEnabled())
|
||||||
mcCombat.getInstance().playerVersusPlayerChecks(e, attacker, eventb);
|
mcCombat.playerVersusPlayerChecks(e, attacker, eventb);
|
||||||
/*
|
/*
|
||||||
* Player versus Animals checks, these checks handle any skill modifiers or procs
|
* Player versus Animals checks, these checks handle any skill modifiers or procs
|
||||||
*/
|
*/
|
||||||
mcCombat.getInstance().playerVersusAnimalsChecks(e, attacker, eventb, typeid);
|
mcCombat.playerVersusAnimalsChecks(e, attacker, eventb, typeid);
|
||||||
/*
|
/*
|
||||||
* This will do AOE damage from the axes ability
|
* This will do AOE damage from the axes ability
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if(!event.isCancelled() && PPa.getSkullSplitterMode() && mcm.getInstance().isAxes(attacker.getItemInHand())){
|
if(!event.isCancelled() && PPa.getSkullSplitterMode() && mcm.isAxes(attacker.getItemInHand())){
|
||||||
mcCombat.getInstance().applyAoeDamage(attacker, eventb, x);
|
mcCombat.applyAoeDamage(attacker, eventb, x);
|
||||||
}
|
}
|
||||||
if(!event.isCancelled() && PPa.getSerratedStrikesMode() && mcm.getInstance().isSwords(attacker.getItemInHand())){
|
if(!event.isCancelled() && PPa.getSerratedStrikesMode() && mcm.isSwords(attacker.getItemInHand())){
|
||||||
mcCombat.getInstance().applySerratedStrikes(attacker, eventb, x);
|
mcCombat.applySerratedStrikes(attacker, eventb, x);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
@ -179,7 +179,7 @@ public class mcEntityListener extends EntityListener {
|
|||||||
* COUNTER ATTACK STUFF
|
* COUNTER ATTACK STUFF
|
||||||
*/
|
*/
|
||||||
if(mcPermissions.getInstance().swords(defender)
|
if(mcPermissions.getInstance().swords(defender)
|
||||||
&& mcm.getInstance().isSwords(defender.getItemInHand())){
|
&& mcm.isSwords(defender.getItemInHand())){
|
||||||
boolean isArrow = false;
|
boolean isArrow = false;
|
||||||
if (event instanceof EntityDamageByProjectileEvent) {
|
if (event instanceof EntityDamageByProjectileEvent) {
|
||||||
final EntityDamageByProjectileEvent realEvent =
|
final EntityDamageByProjectileEvent realEvent =
|
||||||
@ -190,13 +190,13 @@ public class mcEntityListener extends EntityListener {
|
|||||||
//defender.sendMessage("isArrow ="+isArrow);
|
//defender.sendMessage("isArrow ="+isArrow);
|
||||||
if(PPd.getSwordsInt() >= 600){
|
if(PPd.getSwordsInt() >= 600){
|
||||||
if(Math.random() * 2000 <= 600){
|
if(Math.random() * 2000 <= 600){
|
||||||
mcCombat.getInstance().dealDamage(f, event.getDamage() / 2);
|
mcCombat.dealDamage(f, event.getDamage() / 2);
|
||||||
defender.sendMessage(ChatColor.GREEN+"**COUNTER-ATTACKED**");
|
defender.sendMessage(ChatColor.GREEN+"**COUNTER-ATTACKED**");
|
||||||
if(f instanceof Player)
|
if(f instanceof Player)
|
||||||
((Player) f).sendMessage(ChatColor.DARK_RED+"Hit with counterattack!");
|
((Player) f).sendMessage(ChatColor.DARK_RED+"Hit with counterattack!");
|
||||||
}
|
}
|
||||||
} else if (Math.random() * 2000 <= PPd.getSwordsInt()){
|
} else if (Math.random() * 2000 <= PPd.getSwordsInt()){
|
||||||
mcCombat.getInstance().dealDamage(f, event.getDamage() / 2);
|
mcCombat.dealDamage(f, event.getDamage() / 2);
|
||||||
defender.sendMessage(ChatColor.GREEN+"**COUNTER-ATTACKED**");
|
defender.sendMessage(ChatColor.GREEN+"**COUNTER-ATTACKED**");
|
||||||
if(f instanceof Player)
|
if(f instanceof Player)
|
||||||
((Player) f).sendMessage(ChatColor.DARK_RED+"Hit with counterattack!");
|
((Player) f).sendMessage(ChatColor.DARK_RED+"Hit with counterattack!");
|
||||||
@ -210,8 +210,10 @@ public class mcEntityListener extends EntityListener {
|
|||||||
if(PPd.getAcrobaticsInt() <= 800){
|
if(PPd.getAcrobaticsInt() <= 800){
|
||||||
if(Math.random() * 4000 <= PPd.getAcrobaticsInt()){
|
if(Math.random() * 4000 <= PPd.getAcrobaticsInt()){
|
||||||
defender.sendMessage(ChatColor.GREEN+"**DODGE**");
|
defender.sendMessage(ChatColor.GREEN+"**DODGE**");
|
||||||
|
if(System.currentTimeMillis() >= 5000 + PPd.getRespawnATS() && defender.getHealth() >= 1){
|
||||||
PPd.addAcrobaticsXP(event.getDamage() * 12);
|
PPd.addAcrobaticsXP(event.getDamage() * 12);
|
||||||
mcSkills.getInstance().XpCheck(defender);
|
mcSkills.XpCheck(defender);
|
||||||
|
}
|
||||||
event.setDamage(event.getDamage() / 2);
|
event.setDamage(event.getDamage() / 2);
|
||||||
//Needs to do minimal damage
|
//Needs to do minimal damage
|
||||||
if(event.getDamage() <= 0)
|
if(event.getDamage() <= 0)
|
||||||
@ -219,8 +221,10 @@ public class mcEntityListener extends EntityListener {
|
|||||||
}
|
}
|
||||||
} else if(Math.random() * 4000 <= 800) {
|
} else if(Math.random() * 4000 <= 800) {
|
||||||
defender.sendMessage(ChatColor.GREEN+"**DODGE**");
|
defender.sendMessage(ChatColor.GREEN+"**DODGE**");
|
||||||
|
if(System.currentTimeMillis() >= 5000 + PPd.getRespawnATS() && defender.getHealth() >= 1){
|
||||||
PPd.addAcrobaticsXP(event.getDamage() * 12);
|
PPd.addAcrobaticsXP(event.getDamage() * 12);
|
||||||
mcSkills.getInstance().XpCheck(defender);
|
mcSkills.XpCheck(defender);
|
||||||
|
}
|
||||||
event.setDamage(event.getDamage() / 2);
|
event.setDamage(event.getDamage() / 2);
|
||||||
//Needs to do minimal damage
|
//Needs to do minimal damage
|
||||||
if(event.getDamage() <= 0)
|
if(event.getDamage() <= 0)
|
||||||
@ -233,7 +237,7 @@ public class mcEntityListener extends EntityListener {
|
|||||||
*/
|
*/
|
||||||
if(f instanceof Wolf){
|
if(f instanceof Wolf){
|
||||||
Wolf theWolf = (Wolf)f;
|
Wolf theWolf = (Wolf)f;
|
||||||
if(mcTaming.getInstance().hasOwner(theWolf, plugin)){
|
if(mcTaming.hasOwner(theWolf, plugin) && mcTaming.getInstance().getOwner(theWolf, plugin) != null){
|
||||||
Player wolfMaster = mcTaming.getInstance().getOwner(theWolf, plugin);
|
Player wolfMaster = mcTaming.getInstance().getOwner(theWolf, plugin);
|
||||||
if(!event.isCancelled()){
|
if(!event.isCancelled()){
|
||||||
mcUsers.getProfile(wolfMaster.getName()).addXpToSkill(event.getDamage(), "Taming");
|
mcUsers.getProfile(wolfMaster.getName()).addXpToSkill(event.getDamage(), "Taming");
|
||||||
@ -262,7 +266,7 @@ public class mcEntityListener extends EntityListener {
|
|||||||
if(mcConfig.getInstance().isBleedTracked(x))
|
if(mcConfig.getInstance().isBleedTracked(x))
|
||||||
mcConfig.getInstance().addToBleedRemovalQue(x);
|
mcConfig.getInstance().addToBleedRemovalQue(x);
|
||||||
|
|
||||||
mcSkills.getInstance().arrowRetrievalCheck(x);
|
mcSkills.arrowRetrievalCheck(x);
|
||||||
if(mcConfig.getInstance().isMobSpawnTracked(x)){
|
if(mcConfig.getInstance().isMobSpawnTracked(x)){
|
||||||
mcConfig.getInstance().removeMobSpawnTrack(x);
|
mcConfig.getInstance().removeMobSpawnTrack(x);
|
||||||
}
|
}
|
||||||
|
@ -16,18 +16,11 @@ public class mcExcavation {
|
|||||||
public mcExcavation(mcMMO instance) {
|
public mcExcavation(mcMMO instance) {
|
||||||
plugin = instance;
|
plugin = instance;
|
||||||
}
|
}
|
||||||
private static volatile mcExcavation instance;
|
public static void gigaDrillBreakerActivationCheck(Player player, Block block, Plugin pluginx){
|
||||||
public static mcExcavation getInstance() {
|
|
||||||
if (instance == null) {
|
|
||||||
instance = new mcExcavation(plugin);
|
|
||||||
}
|
|
||||||
return instance;
|
|
||||||
}
|
|
||||||
public void gigaDrillBreakerActivationCheck(Player player, Block block, Plugin pluginx){
|
|
||||||
PlayerProfile PP = mcUsers.getProfile(player.getName());
|
PlayerProfile PP = mcUsers.getProfile(player.getName());
|
||||||
if(mcm.getInstance().isShovel(player.getItemInHand())){
|
if(mcm.isShovel(player.getItemInHand())){
|
||||||
if(block != null){
|
if(block != null){
|
||||||
if(!mcm.getInstance().abilityBlockCheck(block))
|
if(!mcm.abilityBlockCheck(block))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(PP.getShovelPreparationMode()){
|
if(PP.getShovelPreparationMode()){
|
||||||
@ -43,7 +36,7 @@ public class mcExcavation {
|
|||||||
if(!PP.getGigaDrillBreakerMode() && PP.getGigaDrillBreakerCooldown() == 0){
|
if(!PP.getGigaDrillBreakerMode() && PP.getGigaDrillBreakerCooldown() == 0){
|
||||||
player.sendMessage(ChatColor.GREEN+"**GIGA DRILL BREAKER ACTIVATED**");
|
player.sendMessage(ChatColor.GREEN+"**GIGA DRILL BREAKER ACTIVATED**");
|
||||||
for(Player y : pluginx.getServer().getOnlinePlayers()){
|
for(Player y : pluginx.getServer().getOnlinePlayers()){
|
||||||
if(y != null && y != player && mcm.getInstance().getDistance(player.getLocation(), y.getLocation()) < 10)
|
if(y != null && y != player && mcm.getDistance(player.getLocation(), y.getLocation()) < 10)
|
||||||
y.sendMessage(ChatColor.GREEN+player.getName()+ChatColor.DARK_GREEN+" has used "+ChatColor.RED+"Giga Drill Breaker!");
|
y.sendMessage(ChatColor.GREEN+player.getName()+ChatColor.DARK_GREEN+" has used "+ChatColor.RED+"Giga Drill Breaker!");
|
||||||
}
|
}
|
||||||
PP.setGigaDrillBreakerTicks(ticks * 1000);
|
PP.setGigaDrillBreakerTicks(ticks * 1000);
|
||||||
@ -53,7 +46,7 @@ public class mcExcavation {
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public boolean canBeGigaDrillBroken(Block block){
|
public static boolean canBeGigaDrillBroken(Block block){
|
||||||
int i = block.getTypeId();
|
int i = block.getTypeId();
|
||||||
if(i == 2||i == 3||i == 12||i == 13){
|
if(i == 2||i == 3||i == 12||i == 13){
|
||||||
return true;
|
return true;
|
||||||
@ -61,7 +54,7 @@ public class mcExcavation {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public void excavationProcCheck(Block block, Player player){
|
public static void excavationProcCheck(Block block, Player player){
|
||||||
PlayerProfile PP = mcUsers.getProfile(player.getName());
|
PlayerProfile PP = mcUsers.getProfile(player.getName());
|
||||||
int type = block.getTypeId();
|
int type = block.getTypeId();
|
||||||
Location loc = block.getLocation();
|
Location loc = block.getLocation();
|
||||||
@ -205,6 +198,6 @@ public class mcExcavation {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mcSkills.getInstance().XpCheck(player);
|
mcSkills.XpCheck(player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,14 +18,8 @@ public class mcHerbalism {
|
|||||||
public mcHerbalism(mcMMO instance) {
|
public mcHerbalism(mcMMO instance) {
|
||||||
plugin = instance;
|
plugin = instance;
|
||||||
}
|
}
|
||||||
private static volatile mcHerbalism instance;
|
|
||||||
public static mcHerbalism getInstance() {
|
public static void greenTerraWheat(Player player, Block block, BlockBreakEvent event){
|
||||||
if (instance == null) {
|
|
||||||
instance = new mcHerbalism(plugin);
|
|
||||||
}
|
|
||||||
return instance;
|
|
||||||
}
|
|
||||||
public void greenTerraWheat(Player player, Block block, BlockBreakEvent event){
|
|
||||||
if(block.getType() == Material.WHEAT && block.getData() == (byte) 0x07){
|
if(block.getType() == Material.WHEAT && block.getData() == (byte) 0x07){
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
PlayerProfile PP = mcUsers.getProfile(player.getName());
|
PlayerProfile PP = mcUsers.getProfile(player.getName());
|
||||||
@ -39,7 +33,7 @@ public class mcHerbalism {
|
|||||||
block.setData((byte) 0x03);
|
block.setData((byte) 0x03);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public void greenTerra(Player player, Block block){
|
public static void greenTerra(Player player, Block block){
|
||||||
if(block.getType() == Material.COBBLESTONE || block.getType() == Material.DIRT){
|
if(block.getType() == Material.COBBLESTONE || block.getType() == Material.DIRT){
|
||||||
if(!hasSeeds(player))
|
if(!hasSeeds(player))
|
||||||
player.sendMessage("You need more seeds to spread Green Terra");
|
player.sendMessage("You need more seeds to spread Green Terra");
|
||||||
@ -52,7 +46,7 @@ public class mcHerbalism {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public Boolean canBeGreenTerra(Block block){
|
public static Boolean canBeGreenTerra(Block block){
|
||||||
int t = block.getTypeId();
|
int t = block.getTypeId();
|
||||||
if(t == 4 || t == 3 || t == 59 || t == 81 || t == 83 || t == 91 || t == 86 || t == 39 || t == 46 || t == 37 || t == 38){
|
if(t == 4 || t == 3 || t == 59 || t == 81 || t == 83 || t == 91 || t == 86 || t == 39 || t == 46 || t == 37 || t == 38){
|
||||||
return true;
|
return true;
|
||||||
@ -60,7 +54,7 @@ public class mcHerbalism {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public boolean hasSeeds(Player player){
|
public static boolean hasSeeds(Player player){
|
||||||
ItemStack[] inventory = player.getInventory().getContents();
|
ItemStack[] inventory = player.getInventory().getContents();
|
||||||
for(ItemStack x : inventory){
|
for(ItemStack x : inventory){
|
||||||
if(x != null && x.getTypeId() == 295){
|
if(x != null && x.getTypeId() == 295){
|
||||||
@ -69,7 +63,7 @@ public class mcHerbalism {
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
public void removeSeeds(Player player){
|
public static void removeSeeds(Player player){
|
||||||
ItemStack[] inventory = player.getInventory().getContents();
|
ItemStack[] inventory = player.getInventory().getContents();
|
||||||
for(ItemStack x : inventory){
|
for(ItemStack x : inventory){
|
||||||
if(x != null && x.getTypeId() == 295){
|
if(x != null && x.getTypeId() == 295){
|
||||||
@ -85,11 +79,11 @@ public class mcHerbalism {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public void greenTerraCheck(Player player, Block block, Plugin pluginx){
|
public static void greenTerraCheck(Player player, Block block, Plugin pluginx){
|
||||||
PlayerProfile PP = mcUsers.getProfile(player.getName());
|
PlayerProfile PP = mcUsers.getProfile(player.getName());
|
||||||
if(mcm.getInstance().isHoe(player.getItemInHand())){
|
if(mcm.isHoe(player.getItemInHand())){
|
||||||
if(block != null){
|
if(block != null){
|
||||||
if(!mcm.getInstance().abilityBlockCheck(block))
|
if(!mcm.abilityBlockCheck(block))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(PP.getHoePreparationMode()){
|
if(PP.getHoePreparationMode()){
|
||||||
@ -102,10 +96,10 @@ public class mcHerbalism {
|
|||||||
ticks++;
|
ticks++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!PP.getGreenTerraMode() && mcSkills.getInstance().cooldownOver(player, PP.getGreenTerraDeactivatedTimeStamp(), mcLoadProperties.greenTerraCooldown)){
|
if(!PP.getGreenTerraMode() && mcSkills.cooldownOver(player, PP.getGreenTerraDeactivatedTimeStamp(), mcLoadProperties.greenTerraCooldown)){
|
||||||
player.sendMessage(ChatColor.GREEN+"**GREEN TERRA ACTIVATED**");
|
player.sendMessage(ChatColor.GREEN+"**GREEN TERRA ACTIVATED**");
|
||||||
for(Player y : pluginx.getServer().getOnlinePlayers()){
|
for(Player y : pluginx.getServer().getOnlinePlayers()){
|
||||||
if(y != null && y != player && mcm.getInstance().getDistance(player.getLocation(), y.getLocation()) < 10)
|
if(y != null && y != player && mcm.getDistance(player.getLocation(), y.getLocation()) < 10)
|
||||||
y.sendMessage(ChatColor.GREEN+player.getName()+ChatColor.DARK_GREEN+" has used "+ChatColor.RED+"Green Terra!");
|
y.sendMessage(ChatColor.GREEN+player.getName()+ChatColor.DARK_GREEN+" has used "+ChatColor.RED+"Green Terra!");
|
||||||
}
|
}
|
||||||
PP.setGreenTerraTicks(ticks * 1000);
|
PP.setGreenTerraTicks(ticks * 1000);
|
||||||
@ -115,7 +109,7 @@ public class mcHerbalism {
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public void herbalismProcCheck(Block block, Player player, BlockBreakEvent event){
|
public static void herbalismProcCheck(Block block, Player player, BlockBreakEvent event){
|
||||||
PlayerProfile PP = mcUsers.getProfile(player.getName());
|
PlayerProfile PP = mcUsers.getProfile(player.getName());
|
||||||
int type = block.getTypeId();
|
int type = block.getTypeId();
|
||||||
Location loc = block.getLocation();
|
Location loc = block.getLocation();
|
||||||
@ -218,9 +212,9 @@ public class mcHerbalism {
|
|||||||
PP.addHerbalismXP(10 * mcLoadProperties.xpGainMultiplier);
|
PP.addHerbalismXP(10 * mcLoadProperties.xpGainMultiplier);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mcSkills.getInstance().XpCheck(player);
|
mcSkills.XpCheck(player);
|
||||||
}
|
}
|
||||||
public void breadCheck(Player player, ItemStack is){
|
public static void breadCheck(Player player, ItemStack is){
|
||||||
PlayerProfile PP = mcUsers.getProfile(player.getName());
|
PlayerProfile PP = mcUsers.getProfile(player.getName());
|
||||||
if(is.getTypeId() == 297){
|
if(is.getTypeId() == 297){
|
||||||
if(PP.getHerbalismInt() >= 50 && PP.getHerbalismInt() < 150){
|
if(PP.getHerbalismInt() >= 50 && PP.getHerbalismInt() < 150){
|
||||||
@ -242,7 +236,7 @@ public class mcHerbalism {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public void stewCheck(Player player, ItemStack is){
|
public static void stewCheck(Player player, ItemStack is){
|
||||||
PlayerProfile PP = mcUsers.getProfile(player.getName());
|
PlayerProfile PP = mcUsers.getProfile(player.getName());
|
||||||
if(is.getTypeId() == 282){
|
if(is.getTypeId() == 282){
|
||||||
if(PP.getHerbalismInt() >= 50 && PP.getHerbalismInt() < 150){
|
if(PP.getHerbalismInt() >= 50 && PP.getHerbalismInt() < 150){
|
||||||
|
@ -12,29 +12,19 @@ import com.gmail.nossr50.PlayerList.PlayerProfile;
|
|||||||
|
|
||||||
|
|
||||||
public class mcItem {
|
public class mcItem {
|
||||||
private static mcMMO plugin;
|
|
||||||
public mcItem(mcMMO instance) {
|
public static void itemChecks(Player player, Plugin plugin){
|
||||||
plugin = instance;
|
|
||||||
}
|
|
||||||
private static volatile mcItem instance;
|
|
||||||
public static mcItem getInstance() {
|
|
||||||
if (instance == null) {
|
|
||||||
instance = new mcItem(plugin);
|
|
||||||
}
|
|
||||||
return instance;
|
|
||||||
}
|
|
||||||
public void itemChecks(Player player, Plugin pluginx){
|
|
||||||
ItemStack inhand = player.getItemInHand();
|
ItemStack inhand = player.getItemInHand();
|
||||||
if(inhand.getTypeId() == 288){
|
if(inhand.getTypeId() == 288){
|
||||||
chimaerawing(player, pluginx);
|
chimaerawing(player, plugin);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public void chimaerawing(Player player, Plugin pluginx){
|
public static void chimaerawing(Player player, Plugin plugin){
|
||||||
PlayerProfile PP = mcUsers.getProfile(player.getName());
|
PlayerProfile PP = mcUsers.getProfile(player.getName());
|
||||||
ItemStack is = player.getItemInHand();
|
ItemStack is = player.getItemInHand();
|
||||||
Block block = player.getLocation().getBlock();
|
Block block = player.getLocation().getBlock();
|
||||||
if(mcPermissions.getInstance().chimaeraWing(player) && is.getTypeId() == 288){
|
if(mcPermissions.getInstance().chimaeraWing(player) && is.getTypeId() == 288){
|
||||||
if(mcSkills.getInstance().cooldownOver(player, PP.getRecentlyHurt(), 60) && is.getAmount() >= mcLoadProperties.feathersConsumedByChimaeraWing){
|
if(mcSkills.cooldownOver(player, PP.getRecentlyHurt(), 60) && is.getAmount() >= mcLoadProperties.feathersConsumedByChimaeraWing){
|
||||||
Block derp = player.getLocation().getBlock();
|
Block derp = player.getLocation().getBlock();
|
||||||
int y = derp.getY();
|
int y = derp.getY();
|
||||||
ItemStack[] inventory = player.getInventory().getContents();
|
ItemStack[] inventory = player.getInventory().getContents();
|
||||||
@ -66,8 +56,8 @@ public class mcItem {
|
|||||||
}
|
}
|
||||||
if(PP.getMySpawn(player) != null){
|
if(PP.getMySpawn(player) != null){
|
||||||
Location mySpawn = PP.getMySpawn(player);
|
Location mySpawn = PP.getMySpawn(player);
|
||||||
if(mySpawn != null && pluginx.getServer().getWorld(PP.getMySpawnWorld(pluginx)) != null)
|
if(mySpawn != null && plugin.getServer().getWorld(PP.getMySpawnWorld(plugin)) != null)
|
||||||
mySpawn.setWorld(pluginx.getServer().getWorld(PP.getMySpawnWorld(pluginx)));
|
mySpawn.setWorld(plugin.getServer().getWorld(PP.getMySpawnWorld(plugin)));
|
||||||
if(mySpawn != null){
|
if(mySpawn != null){
|
||||||
player.teleportTo(mySpawn);//Do it twice to prevent weird stuff
|
player.teleportTo(mySpawn);//Do it twice to prevent weird stuff
|
||||||
player.teleportTo(mySpawn);
|
player.teleportTo(mySpawn);
|
||||||
@ -76,9 +66,9 @@ public class mcItem {
|
|||||||
player.teleportTo(player.getWorld().getSpawnLocation());
|
player.teleportTo(player.getWorld().getSpawnLocation());
|
||||||
}
|
}
|
||||||
player.sendMessage("**CHIMAERA WING**");
|
player.sendMessage("**CHIMAERA WING**");
|
||||||
} else if (!mcSkills.getInstance().cooldownOver(player, PP.getRecentlyHurt(), 60) && is.getAmount() >= 10) {
|
} else if (!mcSkills.cooldownOver(player, PP.getRecentlyHurt(), 60) && is.getAmount() >= 10) {
|
||||||
player.sendMessage("You were injured recently and must wait to use this."
|
player.sendMessage("You were injured recently and must wait to use this."
|
||||||
+ChatColor.YELLOW+" ("+mcSkills.getInstance().calculateTimeLeft(player, PP.getRecentlyHurt(), 60)+"s)");
|
+ChatColor.YELLOW+" ("+mcSkills.calculateTimeLeft(player, PP.getRecentlyHurt(), 60)+"s)");
|
||||||
} else if (is.getTypeId() == 288 && is.getAmount() <= 9){
|
} else if (is.getTypeId() == 288 && is.getAmount() <= 9){
|
||||||
player.sendMessage("You need more of that to use it");
|
player.sendMessage("You need more of that to use it");
|
||||||
}
|
}
|
||||||
|
237
mcMMO/com/gmail/nossr50/mcLeaderboard.java
Normal file
237
mcMMO/com/gmail/nossr50/mcLeaderboard.java
Normal file
@ -0,0 +1,237 @@
|
|||||||
|
package com.gmail.nossr50;
|
||||||
|
|
||||||
|
import java.io.BufferedReader;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileReader;
|
||||||
|
import java.io.FileWriter;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.logging.Level;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
|
public class mcLeaderboard {
|
||||||
|
static String location = "plugins/mcMMO/mcmmo.users";
|
||||||
|
protected static final Logger log = Logger.getLogger("Minecraft");
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Read from the file
|
||||||
|
*/
|
||||||
|
public static void makeLeaderboards(){
|
||||||
|
//Make Trees
|
||||||
|
Tree Mining = new Tree();
|
||||||
|
Tree WoodCutting = new Tree();
|
||||||
|
Tree Herbalism = new Tree();
|
||||||
|
Tree Excavation = new Tree();
|
||||||
|
Tree Acrobatics = new Tree();
|
||||||
|
Tree Repair = new Tree();
|
||||||
|
Tree Swords = new Tree();
|
||||||
|
Tree Axes = new Tree();
|
||||||
|
Tree Archery = new Tree();
|
||||||
|
Tree Unarmed = new Tree();
|
||||||
|
Tree Taming = new Tree();
|
||||||
|
Tree PowerLevel = new Tree();
|
||||||
|
|
||||||
|
//Add Data To Trees
|
||||||
|
try {
|
||||||
|
//Open the user file
|
||||||
|
FileReader file = new FileReader(location);
|
||||||
|
BufferedReader in = new BufferedReader(file);
|
||||||
|
String line = "";
|
||||||
|
while((line = in.readLine()) != null)
|
||||||
|
{
|
||||||
|
String[] character = line.split(":");
|
||||||
|
String p = character[0];
|
||||||
|
|
||||||
|
|
||||||
|
int Plvl = 0;
|
||||||
|
|
||||||
|
if(character.length > 1 && isInt(character[1]))
|
||||||
|
{
|
||||||
|
Mining.add(p, Integer.valueOf(character[1]));
|
||||||
|
Plvl += Integer.valueOf(character[1]);
|
||||||
|
}
|
||||||
|
if(character.length > 5 && isInt(character[5])){
|
||||||
|
WoodCutting.add(p, Integer.valueOf(character[5]));
|
||||||
|
Plvl += Integer.valueOf(character[5]);
|
||||||
|
}
|
||||||
|
if(character.length > 7 && isInt(character[7])){
|
||||||
|
Repair.add(p, Integer.valueOf(character[7]));
|
||||||
|
Plvl += Integer.valueOf(character[7]);
|
||||||
|
}
|
||||||
|
if(character.length > 8 && isInt(character[8])){
|
||||||
|
Unarmed.add(p, Integer.valueOf(character[8]));
|
||||||
|
Plvl += Integer.valueOf(character[8]);
|
||||||
|
}
|
||||||
|
if(character.length > 9 && isInt(character[9])){
|
||||||
|
Herbalism.add(p, Integer.valueOf(character[9]));
|
||||||
|
Plvl += Integer.valueOf(character[9]);
|
||||||
|
}
|
||||||
|
if(character.length > 10 && isInt(character[10])){
|
||||||
|
Excavation.add(p, Integer.valueOf(character[10]));
|
||||||
|
Plvl += Integer.valueOf(character[10]);
|
||||||
|
}
|
||||||
|
if(character.length > 11 && isInt(character[11])){
|
||||||
|
Archery.add(p, Integer.valueOf(character[11]));
|
||||||
|
Plvl += Integer.valueOf(character[11]);
|
||||||
|
}
|
||||||
|
if(character.length > 12 && isInt(character[12])){
|
||||||
|
Swords.add(p, Integer.valueOf(character[12]));
|
||||||
|
Plvl += Integer.valueOf(character[12]);
|
||||||
|
}
|
||||||
|
if(character.length > 13 && isInt(character[13])){
|
||||||
|
Axes.add(p, Integer.valueOf(character[13]));
|
||||||
|
Plvl += Integer.valueOf(character[13]);
|
||||||
|
}
|
||||||
|
if(character.length > 14 && isInt(character[14])){
|
||||||
|
Acrobatics.add(p, Integer.valueOf(character[14]));
|
||||||
|
Plvl += Integer.valueOf(character[14]);
|
||||||
|
}
|
||||||
|
if(character.length > 24 && isInt(character[24])){
|
||||||
|
Taming.add(p, Integer.valueOf(character[24]));
|
||||||
|
Plvl += Integer.valueOf(character[24]);
|
||||||
|
}
|
||||||
|
|
||||||
|
PowerLevel.add(p, Plvl);
|
||||||
|
}
|
||||||
|
in.close();
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.log(Level.SEVERE, "Exception while reading "
|
||||||
|
+ location + " (Are you sure you formatted it correctly?)", e);
|
||||||
|
}
|
||||||
|
//Write the leader board files
|
||||||
|
leaderWrite(Mining.inOrder(), "mining");
|
||||||
|
leaderWrite(WoodCutting.inOrder(), "woodcutting");
|
||||||
|
leaderWrite(Repair.inOrder(), "repair");
|
||||||
|
leaderWrite(Unarmed.inOrder(), "unarmed");
|
||||||
|
leaderWrite(Herbalism.inOrder(), "herbalism");
|
||||||
|
leaderWrite(Excavation.inOrder(), "excavation");
|
||||||
|
leaderWrite(Archery.inOrder(), "archery");
|
||||||
|
leaderWrite(Swords.inOrder(), "swords");
|
||||||
|
leaderWrite(Axes.inOrder(), "axes");
|
||||||
|
leaderWrite(Acrobatics.inOrder(), "acrobatics");
|
||||||
|
leaderWrite(Taming.inOrder(), "taming");
|
||||||
|
leaderWrite(PowerLevel.inOrder(), "powerlevel");
|
||||||
|
}
|
||||||
|
public static void leaderWrite(PlayerStat[] ps, String statName)
|
||||||
|
{
|
||||||
|
String theLocation = "plugins/mcMMO/" + statName + ".mcmmo";
|
||||||
|
//CHECK IF THE FILE EXISTS
|
||||||
|
File theDir = new File(theLocation);
|
||||||
|
if(!theDir.exists()){
|
||||||
|
//properties = new PropertiesFile(location);
|
||||||
|
FileWriter writer = null;
|
||||||
|
try {
|
||||||
|
writer = new FileWriter(theLocation);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.log(Level.SEVERE, "Exception while creating " + theLocation, e);
|
||||||
|
} finally {
|
||||||
|
try {
|
||||||
|
if (writer != null) {
|
||||||
|
writer.close();
|
||||||
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
log.log(Level.SEVERE, "Exception while closing writer for " + theLocation, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
FileReader file = new FileReader(theLocation);
|
||||||
|
|
||||||
|
//HERP
|
||||||
|
BufferedReader in = new BufferedReader(file);
|
||||||
|
StringBuilder writer = new StringBuilder();
|
||||||
|
String line = "";
|
||||||
|
for(PlayerStat p : ps)
|
||||||
|
{
|
||||||
|
writer.append(p.name + ":" + p.statVal);
|
||||||
|
writer.append("\r\n");
|
||||||
|
}
|
||||||
|
in.close();
|
||||||
|
//Write the new file
|
||||||
|
FileWriter out = new FileWriter(theLocation);
|
||||||
|
out.write(writer.toString());
|
||||||
|
out.close();
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.log(Level.SEVERE, "Exception while writing to " + theLocation + " (Are you sure you formatted it correctly?)", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//Create/open the file
|
||||||
|
//Loop through backward writing each player
|
||||||
|
//Close the file
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String[] retrieveInfo(String statName, int pagenumber){
|
||||||
|
String theLocation = "plugins/mcMMO/" + statName + ".mcmmo";
|
||||||
|
try {
|
||||||
|
FileReader file = new FileReader(theLocation);
|
||||||
|
BufferedReader in = new BufferedReader(file);
|
||||||
|
|
||||||
|
int destination = (pagenumber - 1) * 10; //How many lines to skip through
|
||||||
|
int x = 0; //how many lines we've gone through
|
||||||
|
int y = 0; //going through the lines
|
||||||
|
String line = "";
|
||||||
|
String[] info = new String[10]; //what to return
|
||||||
|
while((line = in.readLine()) != null && y < 10)
|
||||||
|
{
|
||||||
|
x++;
|
||||||
|
if(x >= destination && y < 10){
|
||||||
|
info[y] = line.toString();
|
||||||
|
y++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
in.close();
|
||||||
|
return info;
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.log(Level.SEVERE, "Exception while reading "
|
||||||
|
+ theLocation + " (Are you sure you formatted it correctly?)", e);
|
||||||
|
}
|
||||||
|
return null; //Shouldn't get here
|
||||||
|
}
|
||||||
|
public static void updateLeaderboard(PlayerStat ps, String statName){
|
||||||
|
String theLocation = "plugins/mcMMO/" + statName + ".mcmmo";
|
||||||
|
try {
|
||||||
|
//Open the file
|
||||||
|
FileReader file = new FileReader(theLocation);
|
||||||
|
BufferedReader in = new BufferedReader(file);
|
||||||
|
StringBuilder writer = new StringBuilder();
|
||||||
|
String line = "";
|
||||||
|
Boolean inserted = false;
|
||||||
|
//While not at the end of the file
|
||||||
|
while((line = in.readLine()) != null)
|
||||||
|
{
|
||||||
|
//Insert the player into the line before it finds a smaller one
|
||||||
|
if(Integer.valueOf(line.split(":")[1]) < ps.statVal && !inserted)
|
||||||
|
{
|
||||||
|
writer.append(ps.name + ":" + ps.statVal).append("\r\n");
|
||||||
|
inserted = true;
|
||||||
|
}
|
||||||
|
//Write anything that isn't the player already in the file so we remove the duplicate
|
||||||
|
if(!line.split(":")[0].equalsIgnoreCase(ps.name))
|
||||||
|
{
|
||||||
|
writer.append(line).append("\r\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!inserted)
|
||||||
|
{
|
||||||
|
writer.append(ps.name + ":" + ps.statVal).append("\r\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
in.close();
|
||||||
|
//Write the new file
|
||||||
|
FileWriter out = new FileWriter(theLocation);
|
||||||
|
out.write(writer.toString());
|
||||||
|
out.close();
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.log(Level.SEVERE, "Exception while writing to " + theLocation + " (Are you sure you formatted it correctly?)", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public static boolean isInt(String string){
|
||||||
|
try {
|
||||||
|
int x = Integer.parseInt(string);
|
||||||
|
}
|
||||||
|
catch(NumberFormatException nFE) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
@ -2,7 +2,7 @@ package com.gmail.nossr50;
|
|||||||
|
|
||||||
public class mcLoadProperties {
|
public class mcLoadProperties {
|
||||||
public static Boolean cocoabeans, archeryFireRateLimit, mushrooms, toolsLoseDurabilityFromAbilities, pvpxp, miningrequirespickaxe, woodcuttingrequiresaxe, pvp, eggs, apples, myspawnclearsinventory, cake, music, diamond, glowstone, slowsand, sulphur, netherrack, bones, coal, clay, anvilmessages;
|
public static Boolean cocoabeans, archeryFireRateLimit, mushrooms, toolsLoseDurabilityFromAbilities, pvpxp, miningrequirespickaxe, woodcuttingrequiresaxe, pvp, eggs, apples, myspawnclearsinventory, cake, music, diamond, glowstone, slowsand, sulphur, netherrack, bones, coal, clay, anvilmessages;
|
||||||
public static String addxp, mcability, mcmmo, mcc, mcrefresh, mcitem, mcgod, stats, mmoedit, ptp, party, myspawn, setmyspawn, whois, invite, accept, clearmyspawn;
|
public static String mctop, addxp, mcability, mcmmo, mcc, mcrefresh, mcitem, mcgod, stats, mmoedit, ptp, party, myspawn, setmyspawn, whois, invite, accept, clearmyspawn;
|
||||||
public static int xpGainMultiplier, superBreakerCooldown, greenTerraCooldown, gigaDrillBreakerCooldown, treeFellerCooldown, berserkCooldown, serratedStrikeCooldown, skullSplitterCooldown, abilityDurabilityLoss, feathersConsumedByChimaeraWing, pvpxprewardmodifier, repairdiamondlevel, globalxpmodifier, tamingxpmodifier, miningxpmodifier, repairxpmodifier, woodcuttingxpmodifier, unarmedxpmodifier, herbalismxpmodifier, excavationxpmodifier, archeryxpmodifier, swordsxpmodifier, axesxpmodifier, acrobaticsxpmodifier;
|
public static int xpGainMultiplier, superBreakerCooldown, greenTerraCooldown, gigaDrillBreakerCooldown, treeFellerCooldown, berserkCooldown, serratedStrikeCooldown, skullSplitterCooldown, abilityDurabilityLoss, feathersConsumedByChimaeraWing, pvpxprewardmodifier, repairdiamondlevel, globalxpmodifier, tamingxpmodifier, miningxpmodifier, repairxpmodifier, woodcuttingxpmodifier, unarmedxpmodifier, herbalismxpmodifier, excavationxpmodifier, archeryxpmodifier, swordsxpmodifier, axesxpmodifier, acrobaticsxpmodifier;
|
||||||
|
|
||||||
public static void loadMain(){
|
public static void loadMain(){
|
||||||
@ -77,6 +77,7 @@ public class mcLoadProperties {
|
|||||||
/*
|
/*
|
||||||
* CUSTOM COMMANDS
|
* CUSTOM COMMANDS
|
||||||
*/
|
*/
|
||||||
|
mctop = properties.getString("/mctop", "mctop");
|
||||||
addxp = properties.getString("/addxp", "addxp");
|
addxp = properties.getString("/addxp", "addxp");
|
||||||
mcability = properties.getString("/mcability", "mcability");
|
mcability = properties.getString("/mcability", "mcability");
|
||||||
mcrefresh = properties.getString("/mcrefresh", "mcrefresh");
|
mcrefresh = properties.getString("/mcrefresh", "mcrefresh");
|
||||||
|
@ -84,6 +84,7 @@ public class mcMMO extends JavaPlugin {
|
|||||||
|
|
||||||
PluginDescriptionFile pdfFile = this.getDescription();
|
PluginDescriptionFile pdfFile = this.getDescription();
|
||||||
mcPermissions.initialize(getServer());
|
mcPermissions.initialize(getServer());
|
||||||
|
mcLeaderboard.makeLeaderboards(); //Make the leaderboards
|
||||||
System.out.println( pdfFile.getName() + " version " + pdfFile.getVersion() + " is enabled!" );
|
System.out.println( pdfFile.getName() + " version " + pdfFile.getVersion() + " is enabled!" );
|
||||||
}
|
}
|
||||||
public void setupPermissions() {
|
public void setupPermissions() {
|
||||||
@ -118,7 +119,7 @@ public class mcMMO extends JavaPlugin {
|
|||||||
public void addXp(Player player, String skillname, Integer newvalue){
|
public void addXp(Player player, String skillname, Integer newvalue){
|
||||||
PlayerProfile PP = mcUsers.getProfile(player.getName());
|
PlayerProfile PP = mcUsers.getProfile(player.getName());
|
||||||
PP.addXpToSkill(newvalue, skillname);
|
PP.addXpToSkill(newvalue, skillname);
|
||||||
mcSkills.getInstance().XpCheck(player);
|
mcSkills.XpCheck(player);
|
||||||
}
|
}
|
||||||
public void modifySkill(Player player, String skillname, Integer newvalue){
|
public void modifySkill(Player player, String skillname, Integer newvalue){
|
||||||
PlayerProfile PP = mcUsers.getProfile(player.getName());
|
PlayerProfile PP = mcUsers.getProfile(player.getName());
|
||||||
|
@ -15,20 +15,13 @@ public class mcMining {
|
|||||||
private static mcMMO plugin;
|
private static mcMMO plugin;
|
||||||
public mcMining(mcMMO instance) {
|
public mcMining(mcMMO instance) {
|
||||||
plugin = instance;
|
plugin = instance;
|
||||||
}
|
|
||||||
private static volatile mcMining instance;
|
|
||||||
public static mcMining getInstance() {
|
|
||||||
if (instance == null) {
|
|
||||||
instance = new mcMining(plugin);
|
|
||||||
}
|
|
||||||
return instance;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void superBreakerCheck(Player player, Block block, Plugin pluginx){
|
public static void superBreakerCheck(Player player, Block block, Plugin pluginx){
|
||||||
PlayerProfile PP = mcUsers.getProfile(player.getName());
|
PlayerProfile PP = mcUsers.getProfile(player.getName());
|
||||||
if(mcm.getInstance().isMiningPick(player.getItemInHand())){
|
if(mcm.isMiningPick(player.getItemInHand())){
|
||||||
if(block != null){
|
if(block != null){
|
||||||
if(!mcm.getInstance().abilityBlockCheck(block))
|
if(!mcm.abilityBlockCheck(block))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(PP.getPickaxePreparationMode()){
|
if(PP.getPickaxePreparationMode()){
|
||||||
@ -41,10 +34,10 @@ public class mcMining {
|
|||||||
ticks++;
|
ticks++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!PP.getSuperBreakerMode() && mcSkills.getInstance().cooldownOver(player, PP.getSuperBreakerDeactivatedTimeStamp(), mcLoadProperties.superBreakerCooldown)){
|
if(!PP.getSuperBreakerMode() && mcSkills.cooldownOver(player, PP.getSuperBreakerDeactivatedTimeStamp(), mcLoadProperties.superBreakerCooldown)){
|
||||||
player.sendMessage(ChatColor.GREEN+"**SUPER BREAKER ACTIVATED**");
|
player.sendMessage(ChatColor.GREEN+"**SUPER BREAKER ACTIVATED**");
|
||||||
for(Player y : pluginx.getServer().getOnlinePlayers()){
|
for(Player y : pluginx.getServer().getOnlinePlayers()){
|
||||||
if(y != null && y != player && mcm.getInstance().getDistance(player.getLocation(), y.getLocation()) < 10)
|
if(y != null && y != player && mcm.getDistance(player.getLocation(), y.getLocation()) < 10)
|
||||||
y.sendMessage(ChatColor.GREEN+player.getName()+ChatColor.DARK_GREEN+" has used "+ChatColor.RED+"Super Breaker!");
|
y.sendMessage(ChatColor.GREEN+player.getName()+ChatColor.DARK_GREEN+" has used "+ChatColor.RED+"Super Breaker!");
|
||||||
}
|
}
|
||||||
PP.setSuperBreakerTicks(ticks * 1000);
|
PP.setSuperBreakerTicks(ticks * 1000);
|
||||||
@ -54,7 +47,7 @@ public class mcMining {
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public void blockProcSimulate(Block block){
|
public static void blockProcSimulate(Block block){
|
||||||
Location loc = block.getLocation();
|
Location loc = block.getLocation();
|
||||||
Material mat = Material.getMaterial(block.getTypeId());
|
Material mat = Material.getMaterial(block.getTypeId());
|
||||||
byte damage = 0;
|
byte damage = 0;
|
||||||
@ -100,7 +93,7 @@ public class mcMining {
|
|||||||
loc.getWorld().dropItemNaturally(loc, item);
|
loc.getWorld().dropItemNaturally(loc, item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public void blockProcCheck(Block block, Player player){
|
public static void blockProcCheck(Block block, Player player){
|
||||||
PlayerProfile PP = mcUsers.getProfile(player.getName());
|
PlayerProfile PP = mcUsers.getProfile(player.getName());
|
||||||
if(player != null){
|
if(player != null){
|
||||||
if(Math.random() * 1000 <= PP.getMiningInt()){
|
if(Math.random() * 1000 <= PP.getMiningInt()){
|
||||||
@ -109,7 +102,7 @@ public class mcMining {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public void miningBlockCheck(Player player, Block block){
|
public static void miningBlockCheck(Player player, Block block){
|
||||||
PlayerProfile PP = mcUsers.getProfile(player.getName());
|
PlayerProfile PP = mcUsers.getProfile(player.getName());
|
||||||
if(mcConfig.getInstance().isBlockWatched(block) || block.getData() == (byte) 5)
|
if(mcConfig.getInstance().isBlockWatched(block) || block.getData() == (byte) 5)
|
||||||
return;
|
return;
|
||||||
@ -164,12 +157,12 @@ public class mcMining {
|
|||||||
blockProcCheck(block, player);
|
blockProcCheck(block, player);
|
||||||
}
|
}
|
||||||
PP.addMiningXP(xp * mcLoadProperties.xpGainMultiplier);
|
PP.addMiningXP(xp * mcLoadProperties.xpGainMultiplier);
|
||||||
mcSkills.getInstance().XpCheck(player);
|
mcSkills.XpCheck(player);
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* Handling SuperBreaker stuff
|
* Handling SuperBreaker stuff
|
||||||
*/
|
*/
|
||||||
public Boolean canBeSuperBroken(Block block){
|
public static Boolean canBeSuperBroken(Block block){
|
||||||
int t = block.getTypeId();
|
int t = block.getTypeId();
|
||||||
if(t == 49 || t == 87 || t == 89 || t == 73 || t == 74 || t == 56 || t == 21 || t == 1 || t == 16 || t == 14 || t == 15){
|
if(t == 49 || t == 87 || t == 89 || t == 73 || t == 74 || t == 56 || t == 21 || t == 1 || t == 16 || t == 14 || t == 15){
|
||||||
return true;
|
return true;
|
||||||
@ -177,10 +170,10 @@ public class mcMining {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public void SuperBreakerBlockCheck(Player player, Block block){
|
public static void SuperBreakerBlockCheck(Player player, Block block){
|
||||||
PlayerProfile PP = mcUsers.getProfile(player.getName());
|
PlayerProfile PP = mcUsers.getProfile(player.getName());
|
||||||
if(mcLoadProperties.toolsLoseDurabilityFromAbilities)
|
if(mcLoadProperties.toolsLoseDurabilityFromAbilities)
|
||||||
mcm.getInstance().damageTool(player, (short) mcLoadProperties.abilityDurabilityLoss);
|
mcm.damageTool(player, (short) mcLoadProperties.abilityDurabilityLoss);
|
||||||
Location loc = block.getLocation();
|
Location loc = block.getLocation();
|
||||||
Material mat = Material.getMaterial(block.getTypeId());
|
Material mat = Material.getMaterial(block.getTypeId());
|
||||||
int xp = 0;
|
int xp = 0;
|
||||||
@ -238,7 +231,7 @@ public class mcMining {
|
|||||||
block.setType(Material.AIR);
|
block.setType(Material.AIR);
|
||||||
}
|
}
|
||||||
//GOLD
|
//GOLD
|
||||||
if(block.getTypeId() == 14 && mcm.getInstance().getTier(player) >= 3){
|
if(block.getTypeId() == 14 && mcm.getTier(player) >= 3){
|
||||||
if(!mcConfig.getInstance().isBlockWatched(block)&& block.getData() != (byte) 5){
|
if(!mcConfig.getInstance().isBlockWatched(block)&& block.getData() != (byte) 5){
|
||||||
xp += 35;
|
xp += 35;
|
||||||
blockProcCheck(block, player);
|
blockProcCheck(block, player);
|
||||||
@ -249,9 +242,9 @@ public class mcMining {
|
|||||||
block.setType(Material.AIR);
|
block.setType(Material.AIR);
|
||||||
}
|
}
|
||||||
//OBSIDIAN
|
//OBSIDIAN
|
||||||
if(block.getTypeId() == 49 && mcm.getInstance().getTier(player) >= 4){
|
if(block.getTypeId() == 49 && mcm.getTier(player) >= 4){
|
||||||
if(mcLoadProperties.toolsLoseDurabilityFromAbilities)
|
if(mcLoadProperties.toolsLoseDurabilityFromAbilities)
|
||||||
mcm.getInstance().damageTool(player, (short) 104);
|
mcm.damageTool(player, (short) 104);
|
||||||
if(!mcConfig.getInstance().isBlockWatched(block)&& block.getData() != (byte) 5){
|
if(!mcConfig.getInstance().isBlockWatched(block)&& block.getData() != (byte) 5){
|
||||||
xp += 15;
|
xp += 15;
|
||||||
blockProcCheck(block, player);
|
blockProcCheck(block, player);
|
||||||
@ -263,7 +256,7 @@ public class mcMining {
|
|||||||
block.setType(Material.AIR);
|
block.setType(Material.AIR);
|
||||||
}
|
}
|
||||||
//DIAMOND
|
//DIAMOND
|
||||||
if(block.getTypeId() == 56 && mcm.getInstance().getTier(player) >= 3){
|
if(block.getTypeId() == 56 && mcm.getTier(player) >= 3){
|
||||||
if(!mcConfig.getInstance().isBlockWatched(block)&& block.getData() != (byte) 5){
|
if(!mcConfig.getInstance().isBlockWatched(block)&& block.getData() != (byte) 5){
|
||||||
xp += 75;
|
xp += 75;
|
||||||
blockProcCheck(block, player);
|
blockProcCheck(block, player);
|
||||||
@ -275,7 +268,7 @@ public class mcMining {
|
|||||||
block.setType(Material.AIR);
|
block.setType(Material.AIR);
|
||||||
}
|
}
|
||||||
//IRON
|
//IRON
|
||||||
if(block.getTypeId() == 15 && mcm.getInstance().getTier(player) >= 2){
|
if(block.getTypeId() == 15 && mcm.getTier(player) >= 2){
|
||||||
if(!mcConfig.getInstance().isBlockWatched(block)&& block.getData() != (byte) 5){
|
if(!mcConfig.getInstance().isBlockWatched(block)&& block.getData() != (byte) 5){
|
||||||
xp += 25;
|
xp += 25;
|
||||||
blockProcCheck(block, player);
|
blockProcCheck(block, player);
|
||||||
@ -286,7 +279,7 @@ public class mcMining {
|
|||||||
block.setType(Material.AIR);
|
block.setType(Material.AIR);
|
||||||
}
|
}
|
||||||
//REDSTONE
|
//REDSTONE
|
||||||
if((block.getTypeId() == 73 || block.getTypeId() == 74) && mcm.getInstance().getTier(player) >= 4){
|
if((block.getTypeId() == 73 || block.getTypeId() == 74) && mcm.getTier(player) >= 4){
|
||||||
if(!mcConfig.getInstance().isBlockWatched(block)&& block.getData() != (byte) 5){
|
if(!mcConfig.getInstance().isBlockWatched(block)&& block.getData() != (byte) 5){
|
||||||
xp += 15;
|
xp += 15;
|
||||||
blockProcCheck(block, player);
|
blockProcCheck(block, player);
|
||||||
@ -303,7 +296,7 @@ public class mcMining {
|
|||||||
block.setType(Material.AIR);
|
block.setType(Material.AIR);
|
||||||
}
|
}
|
||||||
//LAPUS
|
//LAPUS
|
||||||
if(block.getTypeId() == 21 && mcm.getInstance().getTier(player) >= 3){
|
if(block.getTypeId() == 21 && mcm.getTier(player) >= 3){
|
||||||
if(!mcConfig.getInstance().isBlockWatched(block)&& block.getData() != (byte) 5){
|
if(!mcConfig.getInstance().isBlockWatched(block)&& block.getData() != (byte) 5){
|
||||||
xp += 40;
|
xp += 40;
|
||||||
blockProcCheck(block, player);
|
blockProcCheck(block, player);
|
||||||
@ -319,6 +312,6 @@ public class mcMining {
|
|||||||
}
|
}
|
||||||
if(block.getData() != (byte) 5)
|
if(block.getData() != (byte) 5)
|
||||||
PP.addMiningXP(xp * mcLoadProperties.xpGainMultiplier);
|
PP.addMiningXP(xp * mcLoadProperties.xpGainMultiplier);
|
||||||
mcSkills.getInstance().XpCheck(player);
|
mcSkills.XpCheck(player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,7 @@ public class mcPermissions {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean permission(Player player, String string) {
|
private static boolean permission(Player player, String string) {
|
||||||
return permissionsPlugin.Security.permission(player, string);
|
return permissionsPlugin.Security.permission(player, string);
|
||||||
}
|
}
|
||||||
public boolean mcrefresh(Player player) {
|
public boolean mcrefresh(Player player) {
|
||||||
@ -204,7 +204,7 @@ public class mcPermissions {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public boolean repair(Player player) {
|
public static boolean repair(Player player) {
|
||||||
if (permissionsEnabled) {
|
if (permissionsEnabled) {
|
||||||
return permission(player, "mcmmo.skills.repair");
|
return permission(player, "mcmmo.skills.repair");
|
||||||
} else {
|
} else {
|
||||||
|
@ -29,10 +29,12 @@ public class mcPlayerListener extends PlayerListener {
|
|||||||
public mcPlayerListener(mcMMO instance) {
|
public mcPlayerListener(mcMMO instance) {
|
||||||
plugin = instance;
|
plugin = instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onPlayerRespawn(PlayerRespawnEvent event) {
|
public void onPlayerRespawn(PlayerRespawnEvent event) {
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
PlayerProfile PP = mcUsers.getProfile(player.getName());
|
PlayerProfile PP = mcUsers.getProfile(player.getName());
|
||||||
if(player != null){
|
if(player != null){
|
||||||
|
PP.setRespawnATS(System.currentTimeMillis());
|
||||||
Location mySpawn = PP.getMySpawn(player);
|
Location mySpawn = PP.getMySpawn(player);
|
||||||
if(mySpawn != null && plugin.getServer().getWorld(PP.getMySpawnWorld(plugin)) != null)
|
if(mySpawn != null && plugin.getServer().getWorld(PP.getMySpawnWorld(plugin)) != null)
|
||||||
mySpawn.setWorld(plugin.getServer().getWorld(PP.getMySpawnWorld(plugin)));
|
mySpawn.setWorld(plugin.getServer().getWorld(PP.getMySpawnWorld(plugin)));
|
||||||
@ -80,8 +82,8 @@ public class mcPlayerListener extends PlayerListener {
|
|||||||
if(player.getItemInHand().getTypeId() == 261 && mcLoadProperties.archeryFireRateLimit){
|
if(player.getItemInHand().getTypeId() == 261 && mcLoadProperties.archeryFireRateLimit){
|
||||||
if(System.currentTimeMillis() < PP.getArcheryShotATS() + 1000){
|
if(System.currentTimeMillis() < PP.getArcheryShotATS() + 1000){
|
||||||
/*
|
/*
|
||||||
if(mcm.getInstance().hasArrows(player))
|
if(mcm.hasArrows(player))
|
||||||
mcm.getInstance().addArrows(player);
|
mcm.addArrows(player);
|
||||||
*/
|
*/
|
||||||
player.updateInventory();
|
player.updateInventory();
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
@ -104,22 +106,22 @@ public class mcPlayerListener extends PlayerListener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(block != null && player != null && mcPermissions.getInstance().repair(player) && event.getClickedBlock().getTypeId() == 42){
|
if(block != null && player != null && mcPermissions.getInstance().repair(player) && event.getClickedBlock().getTypeId() == 42){
|
||||||
mcRepair.getInstance().repairCheck(player, is, event.getClickedBlock());
|
mcRepair.repairCheck(player, is, event.getClickedBlock());
|
||||||
}
|
}
|
||||||
|
|
||||||
if(mcm.getInstance().abilityBlockCheck(block))
|
if(mcm.abilityBlockCheck(block))
|
||||||
{
|
{
|
||||||
if(block != null && mcm.getInstance().isHoe(player.getItemInHand()) && block.getTypeId() != 3 && block.getTypeId() != 2 && block.getTypeId() != 60){
|
if(block != null && mcm.isHoe(player.getItemInHand()) && block.getTypeId() != 3 && block.getTypeId() != 2 && block.getTypeId() != 60){
|
||||||
mcSkills.getInstance().hoeReadinessCheck(player);
|
mcSkills.hoeReadinessCheck(player);
|
||||||
}
|
}
|
||||||
mcSkills.getInstance().abilityActivationCheck(player);
|
mcSkills.abilityActivationCheck(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
//GREEN THUMB
|
//GREEN THUMB
|
||||||
if(block != null && (block.getType() == Material.COBBLESTONE || block.getType() == Material.DIRT) && player.getItemInHand().getType() == Material.SEEDS){
|
if(block != null && (block.getType() == Material.COBBLESTONE || block.getType() == Material.DIRT) && player.getItemInHand().getType() == Material.SEEDS){
|
||||||
boolean pass = false;
|
boolean pass = false;
|
||||||
if(mcHerbalism.getInstance().hasSeeds(player)){
|
if(mcHerbalism.hasSeeds(player)){
|
||||||
mcHerbalism.getInstance().removeSeeds(player);
|
mcHerbalism.removeSeeds(player);
|
||||||
if(block.getType() == Material.COBBLESTONE && Math.random() * 1500 <= PP.getHerbalismInt()){
|
if(block.getType() == Material.COBBLESTONE && Math.random() * 1500 <= PP.getHerbalismInt()){
|
||||||
player.sendMessage(ChatColor.GREEN+"**GREEN THUMB**");
|
player.sendMessage(ChatColor.GREEN+"**GREEN THUMB**");
|
||||||
block.setType(Material.MOSSY_COBBLESTONE);
|
block.setType(Material.MOSSY_COBBLESTONE);
|
||||||
@ -137,25 +139,25 @@ public class mcPlayerListener extends PlayerListener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(action == Action.RIGHT_CLICK_AIR){
|
if(action == Action.RIGHT_CLICK_AIR){
|
||||||
mcSkills.getInstance().hoeReadinessCheck(player);
|
mcSkills.hoeReadinessCheck(player);
|
||||||
mcSkills.getInstance().abilityActivationCheck(player);
|
mcSkills.abilityActivationCheck(player);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* HERBALISM MODIFIERS
|
* HERBALISM MODIFIERS
|
||||||
*/
|
*/
|
||||||
if(mcPermissions.getInstance().herbalism(player)){
|
if(mcPermissions.getInstance().herbalism(player)){
|
||||||
mcHerbalism.getInstance().breadCheck(player, player.getItemInHand());
|
mcHerbalism.breadCheck(player, player.getItemInHand());
|
||||||
mcHerbalism.getInstance().stewCheck(player, player.getItemInHand());
|
mcHerbalism.stewCheck(player, player.getItemInHand());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* ITEM CHECKS
|
* ITEM CHECKS
|
||||||
*/
|
*/
|
||||||
if(action == Action.RIGHT_CLICK_AIR)
|
if(action == Action.RIGHT_CLICK_AIR)
|
||||||
mcItem.getInstance().itemChecks(player, plugin);
|
mcItem.itemChecks(player, plugin);
|
||||||
if(action == Action.RIGHT_CLICK_BLOCK){
|
if(action == Action.RIGHT_CLICK_BLOCK){
|
||||||
if(mcm.getInstance().abilityBlockCheck(event.getClickedBlock()))
|
if(mcm.abilityBlockCheck(event.getClickedBlock()))
|
||||||
mcItem.getInstance().itemChecks(player, plugin);
|
mcItem.itemChecks(player, plugin);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event) {
|
public void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event) {
|
||||||
@ -164,7 +166,7 @@ public class mcPlayerListener extends PlayerListener {
|
|||||||
String[] split = event.getMessage().split(" ");
|
String[] split = event.getMessage().split(" ");
|
||||||
String playerName = player.getName();
|
String playerName = player.getName();
|
||||||
//Check if the command is an mcMMO related help command
|
//Check if the command is an mcMMO related help command
|
||||||
mcm.getInstance().mcmmoHelpCheck(split, player, event);
|
mcm.mcmmoHelpCheck(split, player, event);
|
||||||
if(mcPermissions.permissionsEnabled && split[0].equalsIgnoreCase("/"+mcLoadProperties.mcability)){
|
if(mcPermissions.permissionsEnabled && split[0].equalsIgnoreCase("/"+mcLoadProperties.mcability)){
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
if(PP.getAbilityUse()){
|
if(PP.getAbilityUse()){
|
||||||
@ -175,6 +177,102 @@ public class mcPlayerListener extends PlayerListener {
|
|||||||
PP.toggleAbilityUse();
|
PP.toggleAbilityUse();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
|
* LEADER BOARD COMMAND
|
||||||
|
*/
|
||||||
|
|
||||||
|
if(split[0].equalsIgnoreCase("/"+mcLoadProperties.mctop)){
|
||||||
|
event.setCancelled(true);
|
||||||
|
//Format: /mctop <skillname> <pagenumber>
|
||||||
|
|
||||||
|
/*
|
||||||
|
* POWER LEVEL INFO RETRIEVAL
|
||||||
|
*/
|
||||||
|
if(split.length == 1){
|
||||||
|
int p = 1;
|
||||||
|
String[] info = mcLeaderboard.retrieveInfo("powerlevel", p);
|
||||||
|
player.sendMessage(ChatColor.YELLOW+"--mcMMO"+ChatColor.BLUE+" Power Level "+ChatColor.YELLOW+"Leaderboard--");
|
||||||
|
int n = 1 * p; //Position
|
||||||
|
for(String x : info){
|
||||||
|
if(x != null){
|
||||||
|
String digit = String.valueOf(n);
|
||||||
|
if(n < 10)
|
||||||
|
digit ="0"+String.valueOf(n);
|
||||||
|
String[] splitx = x.split(":");
|
||||||
|
//Format: 1. Playername - skill value
|
||||||
|
player.sendMessage(digit+". "+ChatColor.GREEN+splitx[1]+" - "+ChatColor.WHITE+splitx[0]);
|
||||||
|
n++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(split.length >= 2 && mcLeaderboard.isInt(split[1])){
|
||||||
|
int p = 1;
|
||||||
|
//Grab page value if specified
|
||||||
|
if(split.length >= 2){
|
||||||
|
if(mcLeaderboard.isInt(split[1])){
|
||||||
|
p = Integer.valueOf(split[1]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
int pt = p;
|
||||||
|
if(p > 1){
|
||||||
|
pt -= 1;
|
||||||
|
pt += (pt * 10);
|
||||||
|
pt = 10;
|
||||||
|
}
|
||||||
|
String[] info = mcLeaderboard.retrieveInfo("powerlevel", p);
|
||||||
|
player.sendMessage("--mcMMO Power Level Leaderboard--");
|
||||||
|
int n = 1 * pt; //Position
|
||||||
|
for(String x : info){
|
||||||
|
if(x != null){
|
||||||
|
String digit = String.valueOf(n);
|
||||||
|
if(n < 10)
|
||||||
|
digit ="0"+String.valueOf(n);
|
||||||
|
String[] splitx = x.split(":");
|
||||||
|
//Format: 1. Playername - skill value
|
||||||
|
player.sendMessage(digit+". "+ChatColor.GREEN+splitx[1]+" - "+ChatColor.WHITE+splitx[0]);
|
||||||
|
n++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* SKILL SPECIFIED INFO RETRIEVAL
|
||||||
|
*/
|
||||||
|
if(split.length >= 2 && mcSkills.isSkill(split[1])){
|
||||||
|
int p = 1;
|
||||||
|
//Grab page value if specified
|
||||||
|
if(split.length >= 3){
|
||||||
|
if(mcLeaderboard.isInt(split[2])){
|
||||||
|
p = Integer.valueOf(split[2]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
int pt = p;
|
||||||
|
if(p > 1){
|
||||||
|
pt -= 1;
|
||||||
|
pt += (pt * 10);
|
||||||
|
pt = 10;
|
||||||
|
}
|
||||||
|
String firstLetter = split[1].substring(0,1); // Get first letter
|
||||||
|
String remainder = split[1].substring(1); // Get remainder of word.
|
||||||
|
String capitalized = firstLetter.toUpperCase() + remainder.toLowerCase();
|
||||||
|
|
||||||
|
String[] info = mcLeaderboard.retrieveInfo(split[1].toLowerCase(), p);
|
||||||
|
player.sendMessage(ChatColor.YELLOW+"--mcMMO "+ChatColor.BLUE+capitalized+ChatColor.YELLOW+" Leaderboard--");
|
||||||
|
int n = 1 * pt; //Position
|
||||||
|
for(String x : info){
|
||||||
|
if(x != null){
|
||||||
|
String digit = String.valueOf(n);
|
||||||
|
if(n < 10)
|
||||||
|
digit ="0"+String.valueOf(n);
|
||||||
|
String[] splitx = x.split(":");
|
||||||
|
//Format: 1. Playername - skill value
|
||||||
|
player.sendMessage(digit+". "+ChatColor.GREEN+splitx[1]+" - "+ChatColor.WHITE+splitx[0]);
|
||||||
|
n++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
if(split[0].equalsIgnoreCase("/mutechat")){
|
if(split[0].equalsIgnoreCase("/mutechat")){
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
@ -278,14 +376,14 @@ public class mcPlayerListener extends PlayerListener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(split.length == 4){
|
if(split.length == 4){
|
||||||
if(isPlayer(split[1]) && mcm.getInstance().isInt(split[3]) && mcSkills.getInstance().isSkill(split[2])){
|
if(isPlayer(split[1]) && mcm.isInt(split[3]) && mcSkills.isSkill(split[2])){
|
||||||
int newvalue = Integer.valueOf(split[3]);
|
int newvalue = Integer.valueOf(split[3]);
|
||||||
mcUsers.getProfile(getPlayer(split[1]).getName()).modifyskill(newvalue, split[2]);
|
mcUsers.getProfile(getPlayer(split[1]).getName()).modifyskill(newvalue, split[2]);
|
||||||
player.sendMessage(ChatColor.RED+split[2]+" has been modified.");
|
player.sendMessage(ChatColor.RED+split[2]+" has been modified.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(split.length == 3){
|
else if(split.length == 3){
|
||||||
if(mcm.getInstance().isInt(split[2]) && mcSkills.getInstance().isSkill(split[1])){
|
if(mcm.isInt(split[2]) && mcSkills.isSkill(split[1])){
|
||||||
int newvalue = Integer.valueOf(split[2]);
|
int newvalue = Integer.valueOf(split[2]);
|
||||||
PP.modifyskill(newvalue, split[1]);
|
PP.modifyskill(newvalue, split[1]);
|
||||||
player.sendMessage(ChatColor.RED+split[1]+" has been modified.");
|
player.sendMessage(ChatColor.RED+split[1]+" has been modified.");
|
||||||
@ -308,7 +406,7 @@ public class mcPlayerListener extends PlayerListener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(split.length == 4){
|
if(split.length == 4){
|
||||||
if(isPlayer(split[1]) && mcm.getInstance().isInt(split[3]) && mcSkills.getInstance().isSkill(split[2])){
|
if(isPlayer(split[1]) && mcm.isInt(split[3]) && mcSkills.isSkill(split[2])){
|
||||||
int newvalue = Integer.valueOf(split[3]);
|
int newvalue = Integer.valueOf(split[3]);
|
||||||
mcUsers.getProfile(getPlayer(split[1]).getName()).addXpToSkill(newvalue, split[2]);
|
mcUsers.getProfile(getPlayer(split[1]).getName()).addXpToSkill(newvalue, split[2]);
|
||||||
getPlayer(split[1]).sendMessage(ChatColor.GREEN+"Experience granted!");
|
getPlayer(split[1]).sendMessage(ChatColor.GREEN+"Experience granted!");
|
||||||
@ -316,7 +414,7 @@ public class mcPlayerListener extends PlayerListener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(split.length == 3){
|
else if(split.length == 3){
|
||||||
if(mcm.getInstance().isInt(split[2]) && mcSkills.getInstance().isSkill(split[1])){
|
if(mcm.isInt(split[2]) && mcSkills.isSkill(split[1])){
|
||||||
int newvalue = Integer.valueOf(split[2]);
|
int newvalue = Integer.valueOf(split[2]);
|
||||||
PP.addXpToSkill(newvalue, split[1]);
|
PP.addXpToSkill(newvalue, split[1]);
|
||||||
player.sendMessage(ChatColor.RED+split[1]+" has been modified.");
|
player.sendMessage(ChatColor.RED+split[1]+" has been modified.");
|
||||||
@ -417,7 +515,7 @@ public class mcPlayerListener extends PlayerListener {
|
|||||||
player.sendMessage(ChatColor.YELLOW + "Acrobatics Skill: " + ChatColor.GREEN + PPt.getAcrobatics()+ChatColor.DARK_AQUA
|
player.sendMessage(ChatColor.YELLOW + "Acrobatics Skill: " + ChatColor.GREEN + PPt.getAcrobatics()+ChatColor.DARK_AQUA
|
||||||
+ " XP("+PPt.getAcrobaticsXP()
|
+ " XP("+PPt.getAcrobaticsXP()
|
||||||
+"/"+PPt.getXpToLevel("acrobatics")+")");
|
+"/"+PPt.getXpToLevel("acrobatics")+")");
|
||||||
player.sendMessage(ChatColor.DARK_RED+"POWER LEVEL: "+ChatColor.GREEN+(mcm.getInstance().getPowerLevel(target)));
|
player.sendMessage(ChatColor.DARK_RED+"POWER LEVEL: "+ChatColor.GREEN+(mcm.getPowerLevel(target)));
|
||||||
player.sendMessage(ChatColor.GREEN+"~~COORDINATES~~");
|
player.sendMessage(ChatColor.GREEN+"~~COORDINATES~~");
|
||||||
player.sendMessage("X: "+x);
|
player.sendMessage("X: "+x);
|
||||||
player.sendMessage("Y: "+y);
|
player.sendMessage("Y: "+y);
|
||||||
@ -477,7 +575,7 @@ public class mcPlayerListener extends PlayerListener {
|
|||||||
player.sendMessage(ChatColor.YELLOW + "Acrobatics Skill: " + ChatColor.GREEN + PP.getAcrobatics()+ChatColor.DARK_AQUA
|
player.sendMessage(ChatColor.YELLOW + "Acrobatics Skill: " + ChatColor.GREEN + PP.getAcrobatics()+ChatColor.DARK_AQUA
|
||||||
+ " XP("+PP.getAcrobaticsXP()
|
+ " XP("+PP.getAcrobaticsXP()
|
||||||
+"/"+PP.getXpToLevel("acrobatics")+")");
|
+"/"+PP.getXpToLevel("acrobatics")+")");
|
||||||
player.sendMessage(ChatColor.DARK_RED+"POWER LEVEL: "+ChatColor.GREEN+(mcm.getInstance().getPowerLevel(player)));
|
player.sendMessage(ChatColor.DARK_RED+"POWER LEVEL: "+ChatColor.GREEN+(mcm.getPowerLevel(player)));
|
||||||
}
|
}
|
||||||
//Invite Command
|
//Invite Command
|
||||||
if(mcPermissions.getInstance().party(player) && split[0].equalsIgnoreCase("/"+mcLoadProperties.invite)){
|
if(mcPermissions.getInstance().party(player) && split[0].equalsIgnoreCase("/"+mcLoadProperties.invite)){
|
||||||
|
@ -14,19 +14,14 @@ public class mcRepair {
|
|||||||
plugin = instance;
|
plugin = instance;
|
||||||
}
|
}
|
||||||
private static volatile mcRepair instance;
|
private static volatile mcRepair instance;
|
||||||
public static mcRepair getInstance() {
|
|
||||||
if (instance == null) {
|
public static void repairCheck(Player player, ItemStack is, Block block){
|
||||||
instance = new mcRepair(plugin);
|
|
||||||
}
|
|
||||||
return instance;
|
|
||||||
}
|
|
||||||
public void repairCheck(Player player, ItemStack is, Block block){
|
|
||||||
PlayerProfile PP = mcUsers.getProfile(player.getName());
|
PlayerProfile PP = mcUsers.getProfile(player.getName());
|
||||||
short durabilityBefore = player.getItemInHand().getDurability();
|
short durabilityBefore = player.getItemInHand().getDurability();
|
||||||
short durabilityAfter = 0;
|
short durabilityAfter = 0;
|
||||||
short dif = 0;
|
short dif = 0;
|
||||||
if(block != null
|
if(block != null
|
||||||
&& mcPermissions.getInstance().repair(player)){
|
&& mcPermissions.repair(player)){
|
||||||
if(player.getItemInHand().getDurability() > 0 && player.getItemInHand().getAmount() < 2){
|
if(player.getItemInHand().getDurability() > 0 && player.getItemInHand().getAmount() < 2){
|
||||||
/*
|
/*
|
||||||
* ARMOR
|
* ARMOR
|
||||||
@ -80,11 +75,11 @@ public class mcRepair {
|
|||||||
player.getItemInHand().setDurability(getToolRepairAmount(is, player));
|
player.getItemInHand().setDurability(getToolRepairAmount(is, player));
|
||||||
durabilityAfter = player.getItemInHand().getDurability();
|
durabilityAfter = player.getItemInHand().getDurability();
|
||||||
dif = (short) (durabilityBefore - durabilityAfter);
|
dif = (short) (durabilityBefore - durabilityAfter);
|
||||||
if(mcm.getInstance().isShovel(is))
|
if(mcm.isShovel(is))
|
||||||
dif = (short) (dif / 3);
|
dif = (short) (dif / 3);
|
||||||
if(mcm.getInstance().isSwords(is))
|
if(mcm.isSwords(is))
|
||||||
dif = (short) (dif / 2);
|
dif = (short) (dif / 2);
|
||||||
if(mcm.getInstance().isHoe(is))
|
if(mcm.isHoe(is))
|
||||||
dif = (short) (dif / 2);
|
dif = (short) (dif / 2);
|
||||||
PP.addRepairXP(dif * mcLoadProperties.xpGainMultiplier);
|
PP.addRepairXP(dif * mcLoadProperties.xpGainMultiplier);
|
||||||
} else if (isDiamondTools(is) && hasDiamond(player) && PP.getRepairInt() >= mcLoadProperties.repairdiamondlevel){ //Check if its diamond and the player has diamonds
|
} else if (isDiamondTools(is) && hasDiamond(player) && PP.getRepairInt() >= mcLoadProperties.repairdiamondlevel){ //Check if its diamond and the player has diamonds
|
||||||
@ -95,11 +90,11 @@ public class mcRepair {
|
|||||||
removeDiamond(player);
|
removeDiamond(player);
|
||||||
durabilityAfter = player.getItemInHand().getDurability();
|
durabilityAfter = player.getItemInHand().getDurability();
|
||||||
dif = (short) (durabilityBefore - durabilityAfter);
|
dif = (short) (durabilityBefore - durabilityAfter);
|
||||||
if(mcm.getInstance().isShovel(is))
|
if(mcm.isShovel(is))
|
||||||
dif = (short) (dif / 3);
|
dif = (short) (dif / 3);
|
||||||
if(mcm.getInstance().isSwords(is))
|
if(mcm.isSwords(is))
|
||||||
dif = (short) (dif / 2);
|
dif = (short) (dif / 2);
|
||||||
if(mcm.getInstance().isHoe(is))
|
if(mcm.isHoe(is))
|
||||||
dif = (short) (dif / 2);
|
dif = (short) (dif / 2);
|
||||||
PP.addRepairXP(dif * mcLoadProperties.xpGainMultiplier);
|
PP.addRepairXP(dif * mcLoadProperties.xpGainMultiplier);
|
||||||
} else if(isGoldTools(is) && hasGold(player)){
|
} else if(isGoldTools(is) && hasGold(player)){
|
||||||
@ -108,11 +103,11 @@ public class mcRepair {
|
|||||||
durabilityAfter = player.getItemInHand().getDurability();
|
durabilityAfter = player.getItemInHand().getDurability();
|
||||||
dif = (short) (durabilityBefore - durabilityAfter);
|
dif = (short) (durabilityBefore - durabilityAfter);
|
||||||
dif = (short) (dif * 7.6); //Boost XP for Gold to that of around Iron
|
dif = (short) (dif * 7.6); //Boost XP for Gold to that of around Iron
|
||||||
if(mcm.getInstance().isShovel(is))
|
if(mcm.isShovel(is))
|
||||||
dif = (short) (dif / 3);
|
dif = (short) (dif / 3);
|
||||||
if(mcm.getInstance().isSwords(is))
|
if(mcm.isSwords(is))
|
||||||
dif = (short) (dif / 2);
|
dif = (short) (dif / 2);
|
||||||
if(mcm.getInstance().isHoe(is))
|
if(mcm.isHoe(is))
|
||||||
dif = (short) (dif / 2);
|
dif = (short) (dif / 2);
|
||||||
PP.addRepairXP(dif * mcLoadProperties.xpGainMultiplier);
|
PP.addRepairXP(dif * mcLoadProperties.xpGainMultiplier);
|
||||||
} else {
|
} else {
|
||||||
@ -127,10 +122,10 @@ public class mcRepair {
|
|||||||
/*
|
/*
|
||||||
* GIVE SKILL IF THERE IS ENOUGH XP
|
* GIVE SKILL IF THERE IS ENOUGH XP
|
||||||
*/
|
*/
|
||||||
mcSkills.getInstance().XpCheck(player);
|
mcSkills.XpCheck(player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public boolean isArmor(ItemStack is){
|
public static boolean isArmor(ItemStack is){
|
||||||
if(is.getTypeId() == 306 || is.getTypeId() == 307 ||is.getTypeId() == 308 ||is.getTypeId() == 309 ||
|
if(is.getTypeId() == 306 || is.getTypeId() == 307 ||is.getTypeId() == 308 ||is.getTypeId() == 309 ||
|
||||||
is.getTypeId() == 310 ||is.getTypeId() == 311 ||is.getTypeId() == 312 ||is.getTypeId() == 313 ||
|
is.getTypeId() == 310 ||is.getTypeId() == 311 ||is.getTypeId() == 312 ||is.getTypeId() == 313 ||
|
||||||
is.getTypeId() == 314 || is.getTypeId() == 315 || is.getTypeId() == 316 || is.getTypeId() == 317){
|
is.getTypeId() == 314 || is.getTypeId() == 315 || is.getTypeId() == 316 || is.getTypeId() == 317){
|
||||||
@ -139,14 +134,14 @@ public class mcRepair {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public boolean isGoldArmor(ItemStack is){
|
public static boolean isGoldArmor(ItemStack is){
|
||||||
if(is.getTypeId() == 314 || is.getTypeId() == 315 || is.getTypeId() == 316 || is.getTypeId() == 317){
|
if(is.getTypeId() == 314 || is.getTypeId() == 315 || is.getTypeId() == 316 || is.getTypeId() == 317){
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public boolean isIronArmor(ItemStack is){
|
public static boolean isIronArmor(ItemStack is){
|
||||||
if(is.getTypeId() == 306 || is.getTypeId() == 307 || is.getTypeId() == 308 || is.getTypeId() == 309)
|
if(is.getTypeId() == 306 || is.getTypeId() == 307 || is.getTypeId() == 308 || is.getTypeId() == 309)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
@ -154,7 +149,7 @@ public class mcRepair {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public boolean isDiamondArmor(ItemStack is){
|
public static boolean isDiamondArmor(ItemStack is){
|
||||||
if(is.getTypeId() == 310 || is.getTypeId() == 311 || is.getTypeId() == 312 || is.getTypeId() == 313)
|
if(is.getTypeId() == 310 || is.getTypeId() == 311 || is.getTypeId() == 312 || is.getTypeId() == 313)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
@ -162,7 +157,7 @@ public class mcRepair {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public boolean isTools(ItemStack is){
|
public static boolean isTools(ItemStack is){
|
||||||
if(is.getTypeId() == 256 || is.getTypeId() == 257 || is.getTypeId() == 258 || is.getTypeId() == 267 || is.getTypeId() == 292 || //IRON
|
if(is.getTypeId() == 256 || is.getTypeId() == 257 || is.getTypeId() == 258 || is.getTypeId() == 267 || is.getTypeId() == 292 || //IRON
|
||||||
is.getTypeId() == 276 || is.getTypeId() == 277 || is.getTypeId() == 278 || is.getTypeId() == 279 || is.getTypeId() == 293 || //DIAMOND
|
is.getTypeId() == 276 || is.getTypeId() == 277 || is.getTypeId() == 278 || is.getTypeId() == 279 || is.getTypeId() == 293 || //DIAMOND
|
||||||
is.getTypeId() == 283 || is.getTypeId() == 285 || is.getTypeId() == 286 || is.getTypeId() == 284) //GOLD
|
is.getTypeId() == 283 || is.getTypeId() == 285 || is.getTypeId() == 286 || is.getTypeId() == 284) //GOLD
|
||||||
@ -172,14 +167,14 @@ public class mcRepair {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public boolean isGoldTools(ItemStack is){
|
public static boolean isGoldTools(ItemStack is){
|
||||||
if(is.getTypeId() == 283 || is.getTypeId() == 285 || is.getTypeId() == 286 || is.getTypeId() == 284 || is.getTypeId() == 294){
|
if(is.getTypeId() == 283 || is.getTypeId() == 285 || is.getTypeId() == 286 || is.getTypeId() == 284 || is.getTypeId() == 294){
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public boolean isIronTools(ItemStack is){
|
public static boolean isIronTools(ItemStack is){
|
||||||
if(is.getTypeId() == 256 || is.getTypeId() == 257 || is.getTypeId() == 258 || is.getTypeId() == 267 || is.getTypeId() == 292)
|
if(is.getTypeId() == 256 || is.getTypeId() == 257 || is.getTypeId() == 258 || is.getTypeId() == 267 || is.getTypeId() == 292)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
@ -188,7 +183,7 @@ public class mcRepair {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isDiamondTools(ItemStack is){
|
public static boolean isDiamondTools(ItemStack is){
|
||||||
if(is.getTypeId() == 276 || is.getTypeId() == 277 || is.getTypeId() == 278 || is.getTypeId() == 279 || is.getTypeId() == 293)
|
if(is.getTypeId() == 276 || is.getTypeId() == 277 || is.getTypeId() == 278 || is.getTypeId() == 279 || is.getTypeId() == 293)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
@ -196,7 +191,7 @@ public class mcRepair {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public void removeIron(Player player){
|
public static void removeIron(Player player){
|
||||||
ItemStack[] inventory = player.getInventory().getContents();
|
ItemStack[] inventory = player.getInventory().getContents();
|
||||||
for(ItemStack x : inventory){
|
for(ItemStack x : inventory){
|
||||||
if(x != null && x.getTypeId() == 265){
|
if(x != null && x.getTypeId() == 265){
|
||||||
@ -212,7 +207,7 @@ public class mcRepair {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public void removeGold(Player player){
|
public static void removeGold(Player player){
|
||||||
ItemStack[] inventory = player.getInventory().getContents();
|
ItemStack[] inventory = player.getInventory().getContents();
|
||||||
for(ItemStack x : inventory){
|
for(ItemStack x : inventory){
|
||||||
if(x != null && x.getTypeId() == 266){
|
if(x != null && x.getTypeId() == 266){
|
||||||
@ -228,7 +223,7 @@ public class mcRepair {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public void removeDiamond(Player player){
|
public static void removeDiamond(Player player){
|
||||||
ItemStack[] inventory = player.getInventory().getContents();
|
ItemStack[] inventory = player.getInventory().getContents();
|
||||||
for(ItemStack x : inventory){
|
for(ItemStack x : inventory){
|
||||||
if(x != null && x.getTypeId() == 264){
|
if(x != null && x.getTypeId() == 264){
|
||||||
@ -244,7 +239,7 @@ public class mcRepair {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public boolean hasGold(Player player){
|
public static boolean hasGold(Player player){
|
||||||
ItemStack[] inventory = player.getInventory().getContents();
|
ItemStack[] inventory = player.getInventory().getContents();
|
||||||
for(ItemStack x : inventory){
|
for(ItemStack x : inventory){
|
||||||
if(x != null && x.getTypeId() == 266){
|
if(x != null && x.getTypeId() == 266){
|
||||||
@ -253,7 +248,7 @@ public class mcRepair {
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
public boolean hasDiamond(Player player){
|
public static boolean hasDiamond(Player player){
|
||||||
ItemStack[] inventory = player.getInventory().getContents();
|
ItemStack[] inventory = player.getInventory().getContents();
|
||||||
for(ItemStack x : inventory){
|
for(ItemStack x : inventory){
|
||||||
if(x != null && x.getTypeId() == 264){
|
if(x != null && x.getTypeId() == 264){
|
||||||
@ -262,7 +257,7 @@ public class mcRepair {
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
public boolean hasIron(Player player){
|
public static boolean hasIron(Player player){
|
||||||
ItemStack[] inventory = player.getInventory().getContents();
|
ItemStack[] inventory = player.getInventory().getContents();
|
||||||
for(ItemStack x : inventory){
|
for(ItemStack x : inventory){
|
||||||
if(x != null && x.getTypeId() == 265){
|
if(x != null && x.getTypeId() == 265){
|
||||||
@ -271,7 +266,7 @@ public class mcRepair {
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
public short repairCalculate(Player player, short durability, short ramt){
|
public static short repairCalculate(Player player, short durability, short ramt){
|
||||||
PlayerProfile PP = mcUsers.getProfile(player.getName());
|
PlayerProfile PP = mcUsers.getProfile(player.getName());
|
||||||
float bonus = (PP.getRepairInt() / 500);
|
float bonus = (PP.getRepairInt() / 500);
|
||||||
bonus = (ramt * bonus);
|
bonus = (ramt * bonus);
|
||||||
@ -285,7 +280,7 @@ public class mcRepair {
|
|||||||
}
|
}
|
||||||
return durability;
|
return durability;
|
||||||
}
|
}
|
||||||
public short getToolRepairAmount(ItemStack is, Player player){
|
public static short getToolRepairAmount(ItemStack is, Player player){
|
||||||
short durability = is.getDurability();
|
short durability = is.getDurability();
|
||||||
short ramt = 0;
|
short ramt = 0;
|
||||||
switch(is.getTypeId())
|
switch(is.getTypeId())
|
||||||
@ -354,7 +349,7 @@ public class mcRepair {
|
|||||||
return repairCalculate(player, durability, ramt);
|
return repairCalculate(player, durability, ramt);
|
||||||
}
|
}
|
||||||
//This determines how much we repair
|
//This determines how much we repair
|
||||||
public short getArmorRepairAmount(ItemStack is, Player player){
|
public static short getArmorRepairAmount(ItemStack is, Player player){
|
||||||
short durability = is.getDurability();
|
short durability = is.getDurability();
|
||||||
short ramt = 0;
|
short ramt = 0;
|
||||||
switch(is.getTypeId())
|
switch(is.getTypeId())
|
||||||
@ -400,7 +395,7 @@ public class mcRepair {
|
|||||||
durability = 0;
|
durability = 0;
|
||||||
return repairCalculate(player, durability, ramt);
|
return repairCalculate(player, durability, ramt);
|
||||||
}
|
}
|
||||||
public void needMoreVespeneGas(ItemStack is, Player player){
|
public static void needMoreVespeneGas(ItemStack is, Player player){
|
||||||
PlayerProfile PP = mcUsers.getProfile(player.getName());
|
PlayerProfile PP = mcUsers.getProfile(player.getName());
|
||||||
if ((isDiamondTools(is) || isDiamondArmor(is)) && PP.getRepairInt() < mcLoadProperties.repairdiamondlevel){
|
if ((isDiamondTools(is) || isDiamondArmor(is)) && PP.getRepairInt() < mcLoadProperties.repairdiamondlevel){
|
||||||
player.sendMessage(ChatColor.DARK_RED +"You're not adept enough to repair Diamond");
|
player.sendMessage(ChatColor.DARK_RED +"You're not adept enough to repair Diamond");
|
||||||
@ -421,7 +416,7 @@ public class mcRepair {
|
|||||||
} else if (is.getAmount() > 1)
|
} else if (is.getAmount() > 1)
|
||||||
player.sendMessage(ChatColor.DARK_RED+"You can't repair stacked items");
|
player.sendMessage(ChatColor.DARK_RED+"You can't repair stacked items");
|
||||||
}
|
}
|
||||||
public boolean checkPlayerProcRepair(Player player){
|
public static boolean checkPlayerProcRepair(Player player){
|
||||||
PlayerProfile PP = mcUsers.getProfile(player.getName());
|
PlayerProfile PP = mcUsers.getProfile(player.getName());
|
||||||
if(player != null){
|
if(player != null){
|
||||||
if(Math.random() * 1000 <= PP.getRepairInt()){
|
if(Math.random() * 1000 <= PP.getRepairInt()){
|
||||||
|
@ -16,13 +16,8 @@ public class mcSkills {
|
|||||||
plugin = instance;
|
plugin = instance;
|
||||||
}
|
}
|
||||||
private static volatile mcSkills instance;
|
private static volatile mcSkills instance;
|
||||||
public static mcSkills getInstance() {
|
|
||||||
if (instance == null) {
|
public static boolean cooldownOver(Player player, long oldTime, int cooldown){
|
||||||
instance = new mcSkills(plugin);
|
|
||||||
}
|
|
||||||
return instance;
|
|
||||||
}
|
|
||||||
public boolean cooldownOver(Player player, long oldTime, int cooldown){
|
|
||||||
long currentTime = System.currentTimeMillis();
|
long currentTime = System.currentTimeMillis();
|
||||||
if(currentTime - oldTime >= (cooldown * 1000)){
|
if(currentTime - oldTime >= (cooldown * 1000)){
|
||||||
return true;
|
return true;
|
||||||
@ -46,7 +41,7 @@ public class mcSkills {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public int calculateTimeLeft(Player player, long deactivatedTimeStamp, int cooldown){
|
public static int calculateTimeLeft(Player player, long deactivatedTimeStamp, int cooldown){
|
||||||
long currentTime = System.currentTimeMillis();
|
long currentTime = System.currentTimeMillis();
|
||||||
int x = 0;
|
int x = 0;
|
||||||
while(currentTime < deactivatedTimeStamp + (cooldown * 1000)){
|
while(currentTime < deactivatedTimeStamp + (cooldown * 1000)){
|
||||||
@ -55,7 +50,7 @@ public class mcSkills {
|
|||||||
}
|
}
|
||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
public void watchCooldowns(Player player){
|
public static void watchCooldowns(Player player){
|
||||||
PlayerProfile PP = mcUsers.getProfile(player.getName());
|
PlayerProfile PP = mcUsers.getProfile(player.getName());
|
||||||
if(!PP.getGreenTerraInformed() && System.currentTimeMillis() - PP.getGreenTerraDeactivatedTimeStamp() >= (mcLoadProperties.greenTerraCooldown * 1000)){
|
if(!PP.getGreenTerraInformed() && System.currentTimeMillis() - PP.getGreenTerraDeactivatedTimeStamp() >= (mcLoadProperties.greenTerraCooldown * 1000)){
|
||||||
PP.setGreenTerraInformed(true);
|
PP.setGreenTerraInformed(true);
|
||||||
@ -86,9 +81,9 @@ public class mcSkills {
|
|||||||
player.sendMessage(ChatColor.GREEN+"Your "+ChatColor.YELLOW+"Giga Drill Breaker "+ChatColor.GREEN+"ability is refreshed!");
|
player.sendMessage(ChatColor.GREEN+"Your "+ChatColor.YELLOW+"Giga Drill Breaker "+ChatColor.GREEN+"ability is refreshed!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public void hoeReadinessCheck(Player player){
|
public static void hoeReadinessCheck(Player player){
|
||||||
PlayerProfile PP = mcUsers.getProfile(player.getName());
|
PlayerProfile PP = mcUsers.getProfile(player.getName());
|
||||||
if(mcPermissions.getInstance().herbalismAbility(player) && mcm.getInstance().isHoe(player.getItemInHand()) && !PP.getHoePreparationMode()){
|
if(mcPermissions.getInstance().herbalismAbility(player) && mcm.isHoe(player.getItemInHand()) && !PP.getHoePreparationMode()){
|
||||||
if(!PP.getGreenTerraMode() && !cooldownOver(player, PP.getGreenTerraDeactivatedTimeStamp(), mcLoadProperties.greenTerraCooldown)){
|
if(!PP.getGreenTerraMode() && !cooldownOver(player, PP.getGreenTerraDeactivatedTimeStamp(), mcLoadProperties.greenTerraCooldown)){
|
||||||
player.sendMessage(ChatColor.RED+"You are too tired to use that ability again."
|
player.sendMessage(ChatColor.RED+"You are too tired to use that ability again."
|
||||||
+ChatColor.YELLOW+" ("+calculateTimeLeft(player, PP.getGreenTerraDeactivatedTimeStamp(), mcLoadProperties.greenTerraCooldown)+"s)");
|
+ChatColor.YELLOW+" ("+calculateTimeLeft(player, PP.getGreenTerraDeactivatedTimeStamp(), mcLoadProperties.greenTerraCooldown)+"s)");
|
||||||
@ -99,11 +94,11 @@ public class mcSkills {
|
|||||||
PP.setHoePreparationMode(true);
|
PP.setHoePreparationMode(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public void abilityActivationCheck(Player player){
|
public static void abilityActivationCheck(Player player){
|
||||||
PlayerProfile PP = mcUsers.getProfile(player.getName());
|
PlayerProfile PP = mcUsers.getProfile(player.getName());
|
||||||
if(!PP.getAbilityUse())
|
if(!PP.getAbilityUse())
|
||||||
return;
|
return;
|
||||||
if(mcPermissions.getInstance().miningAbility(player) && mcm.getInstance().isMiningPick(player.getItemInHand()) && !PP.getPickaxePreparationMode()){
|
if(mcPermissions.getInstance().miningAbility(player) && mcm.isMiningPick(player.getItemInHand()) && !PP.getPickaxePreparationMode()){
|
||||||
if(!PP.getSuperBreakerMode() && !cooldownOver(player, PP.getSuperBreakerDeactivatedTimeStamp(), mcLoadProperties.superBreakerCooldown)){
|
if(!PP.getSuperBreakerMode() && !cooldownOver(player, PP.getSuperBreakerDeactivatedTimeStamp(), mcLoadProperties.superBreakerCooldown)){
|
||||||
player.sendMessage(ChatColor.RED+"You are too tired to use that ability again."
|
player.sendMessage(ChatColor.RED+"You are too tired to use that ability again."
|
||||||
+ChatColor.YELLOW+" ("+calculateTimeLeft(player, PP.getSuperBreakerDeactivatedTimeStamp(), mcLoadProperties.superBreakerCooldown)+"s)");
|
+ChatColor.YELLOW+" ("+calculateTimeLeft(player, PP.getSuperBreakerDeactivatedTimeStamp(), mcLoadProperties.superBreakerCooldown)+"s)");
|
||||||
@ -113,7 +108,7 @@ public class mcSkills {
|
|||||||
PP.setPickaxePreparationATS(System.currentTimeMillis());
|
PP.setPickaxePreparationATS(System.currentTimeMillis());
|
||||||
PP.setPickaxePreparationMode(true);
|
PP.setPickaxePreparationMode(true);
|
||||||
}
|
}
|
||||||
if(mcPermissions.getInstance().excavationAbility(player) && mcm.getInstance().isShovel(player.getItemInHand()) && !PP.getShovelPreparationMode()){
|
if(mcPermissions.getInstance().excavationAbility(player) && mcm.isShovel(player.getItemInHand()) && !PP.getShovelPreparationMode()){
|
||||||
if(!PP.getGigaDrillBreakerMode() && !cooldownOver(player, PP.getGigaDrillBreakerDeactivatedTimeStamp(), mcLoadProperties.gigaDrillBreakerCooldown)){
|
if(!PP.getGigaDrillBreakerMode() && !cooldownOver(player, PP.getGigaDrillBreakerDeactivatedTimeStamp(), mcLoadProperties.gigaDrillBreakerCooldown)){
|
||||||
player.sendMessage(ChatColor.RED+"You are too tired to use that ability again."
|
player.sendMessage(ChatColor.RED+"You are too tired to use that ability again."
|
||||||
+ChatColor.YELLOW+" ("+calculateTimeLeft(player, PP.getGigaDrillBreakerDeactivatedTimeStamp(), mcLoadProperties.gigaDrillBreakerCooldown)+"s)");
|
+ChatColor.YELLOW+" ("+calculateTimeLeft(player, PP.getGigaDrillBreakerDeactivatedTimeStamp(), mcLoadProperties.gigaDrillBreakerCooldown)+"s)");
|
||||||
@ -123,7 +118,7 @@ public class mcSkills {
|
|||||||
PP.setShovelPreparationATS(System.currentTimeMillis());
|
PP.setShovelPreparationATS(System.currentTimeMillis());
|
||||||
PP.setShovelPreparationMode(true);
|
PP.setShovelPreparationMode(true);
|
||||||
}
|
}
|
||||||
if(mcPermissions.getInstance().swordsAbility(player) && mcm.getInstance().isSwords(player.getItemInHand()) && !PP.getSwordsPreparationMode()){
|
if(mcPermissions.getInstance().swordsAbility(player) && mcm.isSwords(player.getItemInHand()) && !PP.getSwordsPreparationMode()){
|
||||||
if(!PP.getSerratedStrikesMode() && !cooldownOver(player, PP.getSerratedStrikesDeactivatedTimeStamp(), mcLoadProperties.serratedStrikeCooldown)){
|
if(!PP.getSerratedStrikesMode() && !cooldownOver(player, PP.getSerratedStrikesDeactivatedTimeStamp(), mcLoadProperties.serratedStrikeCooldown)){
|
||||||
player.sendMessage(ChatColor.RED+"You are too tired to use that ability again."
|
player.sendMessage(ChatColor.RED+"You are too tired to use that ability again."
|
||||||
+ChatColor.YELLOW+" ("+calculateTimeLeft(player, PP.getSerratedStrikesDeactivatedTimeStamp(), mcLoadProperties.serratedStrikeCooldown)+"s)");
|
+ChatColor.YELLOW+" ("+calculateTimeLeft(player, PP.getSerratedStrikesDeactivatedTimeStamp(), mcLoadProperties.serratedStrikeCooldown)+"s)");
|
||||||
@ -144,16 +139,16 @@ public class mcSkills {
|
|||||||
PP.setFistsPreparationMode(true);
|
PP.setFistsPreparationMode(true);
|
||||||
}
|
}
|
||||||
if((mcPermissions.getInstance().axes(player) || mcPermissions.getInstance().woodcutting(player)) && !PP.getAxePreparationMode()){
|
if((mcPermissions.getInstance().axes(player) || mcPermissions.getInstance().woodcutting(player)) && !PP.getAxePreparationMode()){
|
||||||
if(mcm.getInstance().isAxes(player.getItemInHand())){
|
if(mcm.isAxes(player.getItemInHand())){
|
||||||
player.sendMessage(ChatColor.GREEN+"**YOU READY YOUR AXE**");
|
player.sendMessage(ChatColor.GREEN+"**YOU READY YOUR AXE**");
|
||||||
PP.setAxePreparationATS(System.currentTimeMillis());
|
PP.setAxePreparationATS(System.currentTimeMillis());
|
||||||
PP.setAxePreparationMode(true);
|
PP.setAxePreparationMode(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public void serratedStrikesActivationCheck(Player player, Plugin pluginx){
|
public static void serratedStrikesActivationCheck(Player player, Plugin pluginx){
|
||||||
PlayerProfile PP = mcUsers.getProfile(player.getName());
|
PlayerProfile PP = mcUsers.getProfile(player.getName());
|
||||||
if(mcm.getInstance().isSwords(player.getItemInHand())){
|
if(mcm.isSwords(player.getItemInHand())){
|
||||||
if(PP.getSwordsPreparationMode()){
|
if(PP.getSwordsPreparationMode()){
|
||||||
PP.setSwordsPreparationMode(false);
|
PP.setSwordsPreparationMode(false);
|
||||||
}
|
}
|
||||||
@ -167,7 +162,7 @@ public class mcSkills {
|
|||||||
if(!PP.getSerratedStrikesMode() && PP.getSerratedStrikesCooldown() == 0){
|
if(!PP.getSerratedStrikesMode() && PP.getSerratedStrikesCooldown() == 0){
|
||||||
player.sendMessage(ChatColor.GREEN+"**SERRATED STRIKES ACTIVATED**");
|
player.sendMessage(ChatColor.GREEN+"**SERRATED STRIKES ACTIVATED**");
|
||||||
for(Player y : pluginx.getServer().getOnlinePlayers()){
|
for(Player y : pluginx.getServer().getOnlinePlayers()){
|
||||||
if(y != null && y != player && mcm.getInstance().getDistance(player.getLocation(), y.getLocation()) < 10)
|
if(y != null && y != player && mcm.getDistance(player.getLocation(), y.getLocation()) < 10)
|
||||||
y.sendMessage(ChatColor.GREEN+player.getName()+ChatColor.DARK_GREEN+" has used "+ChatColor.RED+"Serrated Strikes!");
|
y.sendMessage(ChatColor.GREEN+player.getName()+ChatColor.DARK_GREEN+" has used "+ChatColor.RED+"Serrated Strikes!");
|
||||||
}
|
}
|
||||||
PP.setSerratedStrikesTicks((ticks * 2) * 1000);
|
PP.setSerratedStrikesTicks((ticks * 2) * 1000);
|
||||||
@ -177,7 +172,7 @@ public class mcSkills {
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public void berserkActivationCheck(Player player, Plugin pluginx){
|
public static void berserkActivationCheck(Player player, Plugin pluginx){
|
||||||
PlayerProfile PP = mcUsers.getProfile(player.getName());
|
PlayerProfile PP = mcUsers.getProfile(player.getName());
|
||||||
if(player.getItemInHand().getTypeId() == 0){
|
if(player.getItemInHand().getTypeId() == 0){
|
||||||
if(PP.getFistsPreparationMode()){
|
if(PP.getFistsPreparationMode()){
|
||||||
@ -193,7 +188,7 @@ public class mcSkills {
|
|||||||
if(!PP.getBerserkMode() && cooldownOver(player, PP.getBerserkDeactivatedTimeStamp(), mcLoadProperties.berserkCooldown)){
|
if(!PP.getBerserkMode() && cooldownOver(player, PP.getBerserkDeactivatedTimeStamp(), mcLoadProperties.berserkCooldown)){
|
||||||
player.sendMessage(ChatColor.GREEN+"**BERSERK ACTIVATED**");
|
player.sendMessage(ChatColor.GREEN+"**BERSERK ACTIVATED**");
|
||||||
for(Player y : pluginx.getServer().getOnlinePlayers()){
|
for(Player y : pluginx.getServer().getOnlinePlayers()){
|
||||||
if(y != null && y != player && mcm.getInstance().getDistance(player.getLocation(), y.getLocation()) < 10)
|
if(y != null && y != player && mcm.getDistance(player.getLocation(), y.getLocation()) < 10)
|
||||||
y.sendMessage(ChatColor.GREEN+player.getName()+ChatColor.DARK_GREEN+" has used "+ChatColor.RED+"Berserk!");
|
y.sendMessage(ChatColor.GREEN+player.getName()+ChatColor.DARK_GREEN+" has used "+ChatColor.RED+"Berserk!");
|
||||||
}
|
}
|
||||||
PP.setBerserkTicks(ticks * 1000);
|
PP.setBerserkTicks(ticks * 1000);
|
||||||
@ -202,9 +197,9 @@ public class mcSkills {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public void skullSplitterCheck(Player player, Plugin pluginx){
|
public static void skullSplitterCheck(Player player, Plugin pluginx){
|
||||||
PlayerProfile PP = mcUsers.getProfile(player.getName());
|
PlayerProfile PP = mcUsers.getProfile(player.getName());
|
||||||
if(mcm.getInstance().isAxes(player.getItemInHand()) && mcPermissions.getInstance().axesAbility(player)){
|
if(mcm.isAxes(player.getItemInHand()) && mcPermissions.getInstance().axesAbility(player)){
|
||||||
/*
|
/*
|
||||||
* CHECK FOR AXE PREP MODE
|
* CHECK FOR AXE PREP MODE
|
||||||
*/
|
*/
|
||||||
@ -221,7 +216,7 @@ public class mcSkills {
|
|||||||
if(!PP.getSkullSplitterMode() && cooldownOver(player, PP.getSkullSplitterDeactivatedTimeStamp(), mcLoadProperties.skullSplitterCooldown)){
|
if(!PP.getSkullSplitterMode() && cooldownOver(player, PP.getSkullSplitterDeactivatedTimeStamp(), mcLoadProperties.skullSplitterCooldown)){
|
||||||
player.sendMessage(ChatColor.GREEN+"**SKULL SPLITTER ACTIVATED**");
|
player.sendMessage(ChatColor.GREEN+"**SKULL SPLITTER ACTIVATED**");
|
||||||
for(Player y : pluginx.getServer().getOnlinePlayers()){
|
for(Player y : pluginx.getServer().getOnlinePlayers()){
|
||||||
if(y != null && y != player && mcm.getInstance().getDistance(player.getLocation(), y.getLocation()) < 10)
|
if(y != null && y != player && mcm.getDistance(player.getLocation(), y.getLocation()) < 10)
|
||||||
y.sendMessage(ChatColor.GREEN+player.getName()+ChatColor.DARK_GREEN+" has used "+ChatColor.RED+"Skull Splitter!");
|
y.sendMessage(ChatColor.GREEN+player.getName()+ChatColor.DARK_GREEN+" has used "+ChatColor.RED+"Skull Splitter!");
|
||||||
}
|
}
|
||||||
PP.setSkullSplitterTicks(ticks * 1000);
|
PP.setSkullSplitterTicks(ticks * 1000);
|
||||||
@ -234,7 +229,7 @@ public class mcSkills {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public void monitorSkills(Player player){
|
public static void monitorSkills(Player player){
|
||||||
PlayerProfile PP = mcUsers.getProfile(player.getName());
|
PlayerProfile PP = mcUsers.getProfile(player.getName());
|
||||||
if(PP == null)
|
if(PP == null)
|
||||||
mcUsers.addUser(player);
|
mcUsers.addUser(player);
|
||||||
@ -340,7 +335,7 @@ public class mcSkills {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public void XpCheck(Player player){
|
public static void XpCheck(Player player){
|
||||||
PlayerProfile PP = mcUsers.getProfile(player.getName());
|
PlayerProfile PP = mcUsers.getProfile(player.getName());
|
||||||
/*
|
/*
|
||||||
* TAMING
|
* TAMING
|
||||||
@ -352,6 +347,13 @@ public class mcSkills {
|
|||||||
PP.removeTamingXP(PP.getXpToLevel("taming"));
|
PP.removeTamingXP(PP.getXpToLevel("taming"));
|
||||||
PP.skillUpTaming(1);
|
PP.skillUpTaming(1);
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
|
* Leaderboard updating stuff
|
||||||
|
*/
|
||||||
|
PlayerStat ps = new PlayerStat();
|
||||||
|
ps.statVal = PP.getTamingInt();
|
||||||
|
ps.name = player.getName();
|
||||||
|
mcLeaderboard.updateLeaderboard(ps, "taming");
|
||||||
if(player != null && PP.getTaming() != null)
|
if(player != null && PP.getTaming() != null)
|
||||||
player.sendMessage(ChatColor.YELLOW+"Taming skill increased by "+skillups+"."+" Total ("+PP.getTaming()+")");
|
player.sendMessage(ChatColor.YELLOW+"Taming skill increased by "+skillups+"."+" Total ("+PP.getTaming()+")");
|
||||||
}
|
}
|
||||||
@ -365,6 +367,14 @@ public class mcSkills {
|
|||||||
PP.removeAcrobaticsXP(PP.getXpToLevel("acrobatics"));
|
PP.removeAcrobaticsXP(PP.getXpToLevel("acrobatics"));
|
||||||
PP.skillUpAcrobatics(1);
|
PP.skillUpAcrobatics(1);
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
|
* Leaderboard updating stuff
|
||||||
|
*/
|
||||||
|
PlayerStat ps = new PlayerStat();
|
||||||
|
ps.statVal = PP.getAcrobaticsInt();
|
||||||
|
ps.name = player.getName();
|
||||||
|
mcLeaderboard.updateLeaderboard(ps, "acrobatics");
|
||||||
|
|
||||||
if(player != null && PP.getAcrobatics() != null)
|
if(player != null && PP.getAcrobatics() != null)
|
||||||
player.sendMessage(ChatColor.YELLOW+"Acrobatics skill increased by "+skillups+"."+" Total ("+PP.getAcrobatics()+")");
|
player.sendMessage(ChatColor.YELLOW+"Acrobatics skill increased by "+skillups+"."+" Total ("+PP.getAcrobatics()+")");
|
||||||
}
|
}
|
||||||
@ -378,6 +388,14 @@ public class mcSkills {
|
|||||||
PP.removeArcheryXP(PP.getXpToLevel("archery"));
|
PP.removeArcheryXP(PP.getXpToLevel("archery"));
|
||||||
PP.skillUpArchery(1);
|
PP.skillUpArchery(1);
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
|
* Leaderboard updating stuff
|
||||||
|
*/
|
||||||
|
PlayerStat ps = new PlayerStat();
|
||||||
|
ps.statVal = PP.getArcheryInt();
|
||||||
|
ps.name = player.getName();
|
||||||
|
mcLeaderboard.updateLeaderboard(ps, "archery");
|
||||||
|
|
||||||
if(player != null && PP.getArchery() != null)
|
if(player != null && PP.getArchery() != null)
|
||||||
player.sendMessage(ChatColor.YELLOW+"Archery skill increased by "+skillups+"."+" Total ("+PP.getArchery()+")");
|
player.sendMessage(ChatColor.YELLOW+"Archery skill increased by "+skillups+"."+" Total ("+PP.getArchery()+")");
|
||||||
}
|
}
|
||||||
@ -391,6 +409,14 @@ public class mcSkills {
|
|||||||
PP.removeSwordsXP(PP.getXpToLevel("swords"));
|
PP.removeSwordsXP(PP.getXpToLevel("swords"));
|
||||||
PP.skillUpSwords(1);
|
PP.skillUpSwords(1);
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
|
* Leaderboard updating stuff
|
||||||
|
*/
|
||||||
|
PlayerStat ps = new PlayerStat();
|
||||||
|
ps.statVal = PP.getSwordsInt();
|
||||||
|
ps.name = player.getName();
|
||||||
|
mcLeaderboard.updateLeaderboard(ps, "swords");
|
||||||
|
|
||||||
if(player != null && PP.getSwords() != null)
|
if(player != null && PP.getSwords() != null)
|
||||||
player.sendMessage(ChatColor.YELLOW+"Swords skill increased by "+skillups+"."+" Total ("+PP.getSwords()+")");
|
player.sendMessage(ChatColor.YELLOW+"Swords skill increased by "+skillups+"."+" Total ("+PP.getSwords()+")");
|
||||||
}
|
}
|
||||||
@ -404,6 +430,14 @@ public class mcSkills {
|
|||||||
PP.removeAxesXP(PP.getXpToLevel("axes"));
|
PP.removeAxesXP(PP.getXpToLevel("axes"));
|
||||||
PP.skillUpAxes(1);
|
PP.skillUpAxes(1);
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
|
* Leaderboard updating stuff
|
||||||
|
*/
|
||||||
|
PlayerStat ps = new PlayerStat();
|
||||||
|
ps.statVal = PP.getAxesInt();
|
||||||
|
ps.name = player.getName();
|
||||||
|
mcLeaderboard.updateLeaderboard(ps, "axes");
|
||||||
|
|
||||||
if(player != null && PP.getAxes() != null)
|
if(player != null && PP.getAxes() != null)
|
||||||
player.sendMessage(ChatColor.YELLOW+"Axes skill increased by "+skillups+"."+" Total ("+PP.getAxes()+")");
|
player.sendMessage(ChatColor.YELLOW+"Axes skill increased by "+skillups+"."+" Total ("+PP.getAxes()+")");
|
||||||
}
|
}
|
||||||
@ -417,6 +451,14 @@ public class mcSkills {
|
|||||||
PP.removeUnarmedXP(PP.getXpToLevel("unarmed"));
|
PP.removeUnarmedXP(PP.getXpToLevel("unarmed"));
|
||||||
PP.skillUpUnarmed(1);
|
PP.skillUpUnarmed(1);
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
|
* Leaderboard updating stuff
|
||||||
|
*/
|
||||||
|
PlayerStat ps = new PlayerStat();
|
||||||
|
ps.statVal = PP.getUnarmedInt();
|
||||||
|
ps.name = player.getName();
|
||||||
|
mcLeaderboard.updateLeaderboard(ps, "unarmed");
|
||||||
|
|
||||||
if(player != null && PP.getUnarmed() != null)
|
if(player != null && PP.getUnarmed() != null)
|
||||||
player.sendMessage(ChatColor.YELLOW+"Unarmed skill increased by "+skillups+"."+" Total ("+PP.getUnarmed()+")");
|
player.sendMessage(ChatColor.YELLOW+"Unarmed skill increased by "+skillups+"."+" Total ("+PP.getUnarmed()+")");
|
||||||
}
|
}
|
||||||
@ -430,6 +472,14 @@ public class mcSkills {
|
|||||||
PP.removeHerbalismXP(PP.getXpToLevel("herbalism"));
|
PP.removeHerbalismXP(PP.getXpToLevel("herbalism"));
|
||||||
PP.skillUpHerbalism(1);
|
PP.skillUpHerbalism(1);
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
|
* Leaderboard updating stuff
|
||||||
|
*/
|
||||||
|
PlayerStat ps = new PlayerStat();
|
||||||
|
ps.statVal = PP.getHerbalismInt();
|
||||||
|
ps.name = player.getName();
|
||||||
|
mcLeaderboard.updateLeaderboard(ps, "herbalism");
|
||||||
|
|
||||||
if(player != null && PP.getHerbalism() != null)
|
if(player != null && PP.getHerbalism() != null)
|
||||||
player.sendMessage(ChatColor.YELLOW+"Herbalism skill increased by "+skillups+"."+" Total ("+PP.getHerbalism()+")");
|
player.sendMessage(ChatColor.YELLOW+"Herbalism skill increased by "+skillups+"."+" Total ("+PP.getHerbalism()+")");
|
||||||
}
|
}
|
||||||
@ -443,6 +493,14 @@ public class mcSkills {
|
|||||||
PP.removeMiningXP(PP.getXpToLevel("mining"));
|
PP.removeMiningXP(PP.getXpToLevel("mining"));
|
||||||
PP.skillUpMining(1);
|
PP.skillUpMining(1);
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
|
* Leaderboard updating stuff
|
||||||
|
*/
|
||||||
|
PlayerStat ps = new PlayerStat();
|
||||||
|
ps.statVal = PP.getMiningInt();
|
||||||
|
ps.name = player.getName();
|
||||||
|
mcLeaderboard.updateLeaderboard(ps, "mining");
|
||||||
|
|
||||||
if(player != null && PP.getMining() != null)
|
if(player != null && PP.getMining() != null)
|
||||||
player.sendMessage(ChatColor.YELLOW+"Mining skill increased by "+skillups+"."+" Total ("+PP.getMining()+")");
|
player.sendMessage(ChatColor.YELLOW+"Mining skill increased by "+skillups+"."+" Total ("+PP.getMining()+")");
|
||||||
}
|
}
|
||||||
@ -456,6 +514,14 @@ public class mcSkills {
|
|||||||
PP.removeWoodCuttingXP(PP.getXpToLevel("woodcutting"));
|
PP.removeWoodCuttingXP(PP.getXpToLevel("woodcutting"));
|
||||||
PP.skillUpWoodCutting(1);
|
PP.skillUpWoodCutting(1);
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
|
* Leaderboard updating stuff
|
||||||
|
*/
|
||||||
|
PlayerStat ps = new PlayerStat();
|
||||||
|
ps.statVal = PP.getWoodCuttingInt();
|
||||||
|
ps.name = player.getName();
|
||||||
|
mcLeaderboard.updateLeaderboard(ps, "woodcutting");
|
||||||
|
|
||||||
if(player != null && PP.getWoodCutting() != null)
|
if(player != null && PP.getWoodCutting() != null)
|
||||||
player.sendMessage(ChatColor.YELLOW+"WoodCutting skill increased by "+skillups+"."+" Total ("+PP.getWoodCutting()+")");
|
player.sendMessage(ChatColor.YELLOW+"WoodCutting skill increased by "+skillups+"."+" Total ("+PP.getWoodCutting()+")");
|
||||||
}
|
}
|
||||||
@ -469,6 +535,14 @@ public class mcSkills {
|
|||||||
PP.removeRepairXP(PP.getXpToLevel("repair"));
|
PP.removeRepairXP(PP.getXpToLevel("repair"));
|
||||||
PP.skillUpRepair(1);
|
PP.skillUpRepair(1);
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
|
* Leaderboard updating stuff
|
||||||
|
*/
|
||||||
|
PlayerStat ps = new PlayerStat();
|
||||||
|
ps.statVal = PP.getRepairInt();
|
||||||
|
ps.name = player.getName();
|
||||||
|
mcLeaderboard.updateLeaderboard(ps, "repair");
|
||||||
|
|
||||||
if(player != null && PP.getRepair() != null)
|
if(player != null && PP.getRepair() != null)
|
||||||
player.sendMessage(ChatColor.YELLOW+"Repair skill increased by "+skillups+"."+" Total ("+PP.getRepair()+")");
|
player.sendMessage(ChatColor.YELLOW+"Repair skill increased by "+skillups+"."+" Total ("+PP.getRepair()+")");
|
||||||
}
|
}
|
||||||
@ -482,11 +556,26 @@ public class mcSkills {
|
|||||||
PP.removeExcavationXP(PP.getXpToLevel("excavation"));
|
PP.removeExcavationXP(PP.getXpToLevel("excavation"));
|
||||||
PP.skillUpExcavation(1);
|
PP.skillUpExcavation(1);
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
|
* Leaderboard updating stuff
|
||||||
|
*/
|
||||||
|
PlayerStat ps = new PlayerStat();
|
||||||
|
ps.statVal = PP.getExcavationInt();
|
||||||
|
ps.name = player.getName();
|
||||||
|
mcLeaderboard.updateLeaderboard(ps, "excavation");
|
||||||
|
|
||||||
if(player != null && PP.getExcavation() != null)
|
if(player != null && PP.getExcavation() != null)
|
||||||
player.sendMessage(ChatColor.YELLOW+"Excavation skill increased by "+skillups+"."+" Total ("+PP.getExcavation()+")");
|
player.sendMessage(ChatColor.YELLOW+"Excavation skill increased by "+skillups+"."+" Total ("+PP.getExcavation()+")");
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
|
* Leaderboard updating stuff
|
||||||
|
*/
|
||||||
|
PlayerStat ps = new PlayerStat();
|
||||||
|
ps.statVal = mcm.getPowerLevel(player);
|
||||||
|
ps.name = player.getName();
|
||||||
|
mcLeaderboard.updateLeaderboard(ps, "powerlevel");
|
||||||
}
|
}
|
||||||
public boolean isSkill(String skillname){
|
public static boolean isSkill(String skillname){
|
||||||
skillname = skillname.toLowerCase();
|
skillname = skillname.toLowerCase();
|
||||||
if(skillname.equals("all")){
|
if(skillname.equals("all")){
|
||||||
return true;
|
return true;
|
||||||
@ -528,11 +617,11 @@ public class mcSkills {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public void arrowRetrievalCheck(Entity entity){
|
public static void arrowRetrievalCheck(Entity entity){
|
||||||
if(mcConfig.getInstance().isTracked(entity)){
|
if(mcConfig.getInstance().isTracked(entity)){
|
||||||
Integer x = 0;
|
Integer x = 0;
|
||||||
while(x < mcConfig.getInstance().getArrowCount(entity)){
|
while(x < mcConfig.getInstance().getArrowCount(entity)){
|
||||||
mcm.getInstance().mcDropItem(entity.getLocation(), 262);
|
mcm.mcDropItem(entity.getLocation(), 262);
|
||||||
x++;
|
x++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,20 +15,14 @@ public class mcTaming {
|
|||||||
|
|
||||||
private static volatile mcTaming instance;
|
private static volatile mcTaming instance;
|
||||||
|
|
||||||
public static mcTaming getInstance() {
|
public static String getOwnerName(Entity theWolf){
|
||||||
if (instance == null) {
|
|
||||||
instance = new mcTaming(plugin);
|
|
||||||
}
|
|
||||||
return instance;
|
|
||||||
}
|
|
||||||
public String getOwnerName(Entity theWolf){
|
|
||||||
CraftWolf cWolf = (CraftWolf)theWolf;
|
CraftWolf cWolf = (CraftWolf)theWolf;
|
||||||
EntityWolf eWolf = (EntityWolf)cWolf.getHandle();
|
EntityWolf eWolf = (EntityWolf)cWolf.getHandle();
|
||||||
|
|
||||||
String playerName = eWolf.v();
|
String playerName = eWolf.v();
|
||||||
return playerName;
|
return playerName;
|
||||||
}
|
}
|
||||||
public boolean hasOwner(Entity theWolf, Plugin pluginx){
|
public static boolean hasOwner(Entity theWolf, Plugin pluginx){
|
||||||
for(Player x : pluginx.getServer().getOnlinePlayers()){
|
for(Player x : pluginx.getServer().getOnlinePlayers()){
|
||||||
if(x != null && x.getName().equals(getOwnerName(theWolf))){
|
if(x != null && x.getName().equals(getOwnerName(theWolf))){
|
||||||
return true;
|
return true;
|
||||||
@ -44,4 +38,8 @@ public class mcTaming {
|
|||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
public static mcTaming getInstance() {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -27,11 +27,11 @@ public class mcTimer extends TimerTask{
|
|||||||
/*
|
/*
|
||||||
* MONITOR SKILLS
|
* MONITOR SKILLS
|
||||||
*/
|
*/
|
||||||
mcSkills.getInstance().monitorSkills(player);
|
mcSkills.monitorSkills(player);
|
||||||
/*
|
/*
|
||||||
* COOLDOWN MONITORING
|
* COOLDOWN MONITORING
|
||||||
*/
|
*/
|
||||||
mcSkills.getInstance().watchCooldowns(player);
|
mcSkills.watchCooldowns(player);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* PLAYER BLEED MONITORING
|
* PLAYER BLEED MONITORING
|
||||||
@ -45,23 +45,23 @@ public class mcTimer extends TimerTask{
|
|||||||
if(thecount == 10 || thecount == 20 || thecount == 30 || thecount == 40){
|
if(thecount == 10 || thecount == 20 || thecount == 30 || thecount == 40){
|
||||||
if(player != null &&
|
if(player != null &&
|
||||||
player.getHealth() > 0 && player.getHealth() < 20
|
player.getHealth() > 0 && player.getHealth() < 20
|
||||||
&& mcm.getInstance().getPowerLevel(player) >= 1000){
|
&& mcm.getPowerLevel(player) >= 1000){
|
||||||
player.setHealth(mcm.getInstance().calculateHealth(player.getHealth(), 1));
|
player.setHealth(mcm.calculateHealth(player.getHealth(), 1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(thecount == 20 || thecount == 40){
|
if(thecount == 20 || thecount == 40){
|
||||||
if(player != null &&
|
if(player != null &&
|
||||||
player.getHealth() > 0 && player.getHealth() < 20
|
player.getHealth() > 0 && player.getHealth() < 20
|
||||||
&& mcm.getInstance().getPowerLevel(player) >= 500
|
&& mcm.getPowerLevel(player) >= 500
|
||||||
&& mcm.getInstance().getPowerLevel(player) < 1000){
|
&& mcm.getPowerLevel(player) < 1000){
|
||||||
player.setHealth(mcm.getInstance().calculateHealth(player.getHealth(), 1));
|
player.setHealth(mcm.calculateHealth(player.getHealth(), 1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(thecount == 40){
|
if(thecount == 40){
|
||||||
if(player != null &&
|
if(player != null &&
|
||||||
player.getHealth() > 0 && player.getHealth() < 20
|
player.getHealth() > 0 && player.getHealth() < 20
|
||||||
&& mcm.getInstance().getPowerLevel(player) < 500){
|
&& mcm.getPowerLevel(player) < 500){
|
||||||
player.setHealth(mcm.getInstance().calculateHealth(player.getHealth(), 1));
|
player.setHealth(mcm.calculateHealth(player.getHealth(), 1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -71,7 +71,7 @@ public class mcTimer extends TimerTask{
|
|||||||
* NON-PLAYER BLEED MONITORING
|
* NON-PLAYER BLEED MONITORING
|
||||||
*/
|
*/
|
||||||
if(thecount % 2 == 0)
|
if(thecount % 2 == 0)
|
||||||
mcCombat.getInstance().bleedSimulate();
|
mcCombat.bleedSimulate();
|
||||||
|
|
||||||
if(thecount < 40){
|
if(thecount < 40){
|
||||||
thecount++;
|
thecount++;
|
||||||
|
@ -160,7 +160,7 @@ class PlayerList
|
|||||||
private boolean greenTerraMode, partyChatOnly = false, greenTerraInformed = true, berserkInformed = true, skullSplitterInformed = true, gigaDrillBreakerInformed = true, superBreakerInformed = true, serratedStrikesInformed = true, treeFellerInformed = true, dead, abilityuse = true, treeFellerMode, superBreakerMode, gigaDrillBreakerMode, serratedStrikesMode, hoePreparationMode, shovelPreparationMode, swordsPreparationMode, fistsPreparationMode, pickaxePreparationMode, axePreparationMode, skullSplitterMode, berserkMode;
|
private boolean greenTerraMode, partyChatOnly = false, greenTerraInformed = true, berserkInformed = true, skullSplitterInformed = true, gigaDrillBreakerInformed = true, superBreakerInformed = true, serratedStrikesInformed = true, treeFellerInformed = true, dead, abilityuse = true, treeFellerMode, superBreakerMode, gigaDrillBreakerMode, serratedStrikesMode, hoePreparationMode, shovelPreparationMode, swordsPreparationMode, fistsPreparationMode, pickaxePreparationMode, axePreparationMode, skullSplitterMode, berserkMode;
|
||||||
private long gigaDrillBreakerCooldown = 0, berserkCooldown = 0, superBreakerCooldown = 0, skullSplitterCooldown = 0, serratedStrikesCooldown = 0,
|
private long gigaDrillBreakerCooldown = 0, berserkCooldown = 0, superBreakerCooldown = 0, skullSplitterCooldown = 0, serratedStrikesCooldown = 0,
|
||||||
greenTerraCooldown = 0, treeFellerCooldown = 0, recentlyHurt = 0, archeryShotATS = 0, berserkATS = 0, berserkDATS = 0, gigaDrillBreakerATS = 0, gigaDrillBreakerDATS = 0,
|
greenTerraCooldown = 0, treeFellerCooldown = 0, recentlyHurt = 0, archeryShotATS = 0, berserkATS = 0, berserkDATS = 0, gigaDrillBreakerATS = 0, gigaDrillBreakerDATS = 0,
|
||||||
mySpawnATS = 0, greenTerraATS = 0, greenTerraDATS = 0, superBreakerATS = 0, superBreakerDATS = 0, serratedStrikesATS = 0, serratedStrikesDATS = 0, treeFellerATS = 0, treeFellerDATS = 0,
|
respawnATS = 0, mySpawnATS = 0, greenTerraATS = 0, greenTerraDATS = 0, superBreakerATS = 0, superBreakerDATS = 0, serratedStrikesATS = 0, serratedStrikesDATS = 0, treeFellerATS = 0, treeFellerDATS = 0,
|
||||||
skullSplitterATS = 0, skullSplitterDATS = 0, hoePreparationATS = 0, axePreparationATS = 0, pickaxePreparationATS = 0, fistsPreparationATS = 0, shovelPreparationATS = 0, swordsPreparationATS = 0;
|
skullSplitterATS = 0, skullSplitterDATS = 0, hoePreparationATS = 0, axePreparationATS = 0, pickaxePreparationATS = 0, fistsPreparationATS = 0, shovelPreparationATS = 0, swordsPreparationATS = 0;
|
||||||
private int berserkTicks = 0, bleedticks = 0, greenTerraTicks = 0, gigaDrillBreakerTicks = 0, superBreakerTicks = 0, serratedStrikesTicks = 0, skullSplitterTicks = 0, treeFellerTicks = 0;
|
private int berserkTicks = 0, bleedticks = 0, greenTerraTicks = 0, gigaDrillBreakerTicks = 0, superBreakerTicks = 0, serratedStrikesTicks = 0, skullSplitterTicks = 0, treeFellerTicks = 0;
|
||||||
//ATS = (Time of) Activation Time Stamp
|
//ATS = (Time of) Activation Time Stamp
|
||||||
@ -221,23 +221,6 @@ class PlayerList
|
|||||||
addPlayer();
|
addPlayer();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void scoreBoard()
|
|
||||||
{
|
|
||||||
try {
|
|
||||||
//Open the user file
|
|
||||||
FileReader file = new FileReader(location);
|
|
||||||
BufferedReader in = new BufferedReader(file);
|
|
||||||
String line = "";
|
|
||||||
while((line = in.readLine()) != null)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
in.close();
|
|
||||||
} catch (Exception e) {
|
|
||||||
log.log(Level.SEVERE, "Exception while reading "
|
|
||||||
+ location + " (Are you sure you formatted it correctly?)", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public boolean load()
|
public boolean load()
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
@ -473,6 +456,12 @@ class PlayerList
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
|
* EXPLOIT PREVENTION
|
||||||
|
*/
|
||||||
|
public long getRespawnATS() {return respawnATS;}
|
||||||
|
public void setRespawnATS(long newvalue) {respawnATS = newvalue;}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* ARCHERY NERF STUFF
|
* ARCHERY NERF STUFF
|
||||||
*/
|
*/
|
||||||
@ -1607,7 +1596,7 @@ class PlayerList
|
|||||||
axesXP = String.valueOf(Integer.valueOf(axesXP)+newvalue);
|
axesXP = String.valueOf(Integer.valueOf(axesXP)+newvalue);
|
||||||
}
|
}
|
||||||
save();
|
save();
|
||||||
mcSkills.getInstance().XpCheck(thisplayer);
|
mcSkills.XpCheck(thisplayer);
|
||||||
}
|
}
|
||||||
public void modifyskill(int newvalue, String skillname){
|
public void modifyskill(int newvalue, String skillname){
|
||||||
if(skillname.toLowerCase().equals("taming")){
|
if(skillname.toLowerCase().equals("taming")){
|
||||||
|
@ -14,20 +14,14 @@ import com.gmail.nossr50.PlayerList.PlayerProfile;
|
|||||||
|
|
||||||
|
|
||||||
public class mcWoodCutting {
|
public class mcWoodCutting {
|
||||||
int w = 0;
|
static int w = 0;
|
||||||
private boolean isdone = false;
|
private static boolean isdone = false;
|
||||||
private static mcMMO plugin;
|
private static mcMMO plugin;
|
||||||
public mcWoodCutting(mcMMO instance) {
|
public mcWoodCutting(mcMMO instance) {
|
||||||
plugin = instance;
|
plugin = instance;
|
||||||
}
|
}
|
||||||
private static volatile mcWoodCutting instance;
|
|
||||||
public static mcWoodCutting getInstance() {
|
public static void woodCuttingProcCheck(Player player, Block block){
|
||||||
if (instance == null) {
|
|
||||||
instance = new mcWoodCutting(plugin);
|
|
||||||
}
|
|
||||||
return instance;
|
|
||||||
}
|
|
||||||
public void woodCuttingProcCheck(Player player, Block block){
|
|
||||||
PlayerProfile PP = mcUsers.getProfile(player.getName());
|
PlayerProfile PP = mcUsers.getProfile(player.getName());
|
||||||
byte type = block.getData();
|
byte type = block.getData();
|
||||||
Material mat = Material.getMaterial(block.getTypeId());
|
Material mat = Material.getMaterial(block.getTypeId());
|
||||||
@ -38,11 +32,11 @@ public class mcWoodCutting {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public void treeFellerCheck(Player player, Block block, Plugin pluginx){
|
public static void treeFellerCheck(Player player, Block block, Plugin pluginx){
|
||||||
PlayerProfile PP = mcUsers.getProfile(player.getName());
|
PlayerProfile PP = mcUsers.getProfile(player.getName());
|
||||||
if(mcm.getInstance().isAxes(player.getItemInHand())){
|
if(mcm.isAxes(player.getItemInHand())){
|
||||||
if(block != null){
|
if(block != null){
|
||||||
if(!mcm.getInstance().abilityBlockCheck(block))
|
if(!mcm.abilityBlockCheck(block))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
@ -58,23 +52,23 @@ public class mcWoodCutting {
|
|||||||
ticks++;
|
ticks++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!PP.getTreeFellerMode() && mcSkills.getInstance().cooldownOver(player, PP.getTreeFellerDeactivatedTimeStamp(), mcLoadProperties.treeFellerCooldown)){
|
if(!PP.getTreeFellerMode() && mcSkills.cooldownOver(player, PP.getTreeFellerDeactivatedTimeStamp(), mcLoadProperties.treeFellerCooldown)){
|
||||||
player.sendMessage(ChatColor.GREEN+"**TREE FELLING ACTIVATED**");
|
player.sendMessage(ChatColor.GREEN+"**TREE FELLING ACTIVATED**");
|
||||||
for(Player y : pluginx.getServer().getOnlinePlayers()){
|
for(Player y : pluginx.getServer().getOnlinePlayers()){
|
||||||
if(y != null && y != player && mcm.getInstance().getDistance(player.getLocation(), y.getLocation()) < 10)
|
if(y != null && y != player && mcm.getDistance(player.getLocation(), y.getLocation()) < 10)
|
||||||
y.sendMessage(ChatColor.GREEN+player.getName()+ChatColor.DARK_GREEN+" has used "+ChatColor.RED+"Tree Feller!");
|
y.sendMessage(ChatColor.GREEN+player.getName()+ChatColor.DARK_GREEN+" has used "+ChatColor.RED+"Tree Feller!");
|
||||||
}
|
}
|
||||||
PP.setTreeFellerTicks(ticks * 1000);
|
PP.setTreeFellerTicks(ticks * 1000);
|
||||||
PP.setTreeFellerActivatedTimeStamp(System.currentTimeMillis());
|
PP.setTreeFellerActivatedTimeStamp(System.currentTimeMillis());
|
||||||
PP.setTreeFellerMode(true);
|
PP.setTreeFellerMode(true);
|
||||||
}
|
}
|
||||||
if(!PP.getTreeFellerMode() && !mcSkills.getInstance().cooldownOver(player, PP.getTreeFellerDeactivatedTimeStamp(), mcLoadProperties.treeFellerCooldown)){
|
if(!PP.getTreeFellerMode() && !mcSkills.cooldownOver(player, PP.getTreeFellerDeactivatedTimeStamp(), mcLoadProperties.treeFellerCooldown)){
|
||||||
player.sendMessage(ChatColor.RED+"You are too tired to use that ability again."
|
player.sendMessage(ChatColor.RED+"You are too tired to use that ability again."
|
||||||
+ChatColor.YELLOW+" ("+mcSkills.getInstance().calculateTimeLeft(player, PP.getTreeFellerDeactivatedTimeStamp(), mcLoadProperties.treeFellerCooldown)+"s)");
|
+ChatColor.YELLOW+" ("+mcSkills.calculateTimeLeft(player, PP.getTreeFellerDeactivatedTimeStamp(), mcLoadProperties.treeFellerCooldown)+"s)");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public void treeFeller(Block block, Player player){
|
public static void treeFeller(Block block, Player player){
|
||||||
PlayerProfile PP = mcUsers.getProfile(player.getName());
|
PlayerProfile PP = mcUsers.getProfile(player.getName());
|
||||||
int radius = 1;
|
int radius = 1;
|
||||||
if(PP.getWoodCuttingXPInt() >= 500)
|
if(PP.getWoodCuttingXPInt() >= 500)
|
||||||
@ -100,7 +94,7 @@ public class mcWoodCutting {
|
|||||||
}
|
}
|
||||||
toAdd.clear();
|
toAdd.clear();
|
||||||
}
|
}
|
||||||
public void addBlocksToTreeFelling(ArrayList<Block> blocklist, ArrayList<Block> toAdd, Integer radius){
|
public static void addBlocksToTreeFelling(ArrayList<Block> blocklist, ArrayList<Block> toAdd, Integer radius){
|
||||||
int u = 0;
|
int u = 0;
|
||||||
for (Block x : blocklist){
|
for (Block x : blocklist){
|
||||||
u++;
|
u++;
|
||||||
|
@ -25,15 +25,8 @@ public class mcm {
|
|||||||
public mcm(mcMMO instance) {
|
public mcm(mcMMO instance) {
|
||||||
plugin = instance;
|
plugin = instance;
|
||||||
}
|
}
|
||||||
private static volatile mcm instance;
|
|
||||||
public static mcm getInstance() {
|
|
||||||
if (instance == null) {
|
|
||||||
instance = new mcm(plugin);
|
|
||||||
}
|
|
||||||
return instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getPowerLevel(Player player){
|
public static int getPowerLevel(Player player){
|
||||||
PlayerProfile PP = mcUsers.getProfile(player.getName());
|
PlayerProfile PP = mcUsers.getProfile(player.getName());
|
||||||
int x = 0;
|
int x = 0;
|
||||||
if(mcPermissions.getInstance().mining(player))
|
if(mcPermissions.getInstance().mining(player))
|
||||||
@ -58,7 +51,7 @@ public class mcm {
|
|||||||
x+=PP.getRepairInt();
|
x+=PP.getRepairInt();
|
||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
public boolean blockBreakSimulate(Block block, Player player, Plugin plugin){
|
public static boolean blockBreakSimulate(Block block, Player player, Plugin plugin){
|
||||||
|
|
||||||
FakeBlockBreakEvent event = new FakeBlockBreakEvent(block, player);
|
FakeBlockBreakEvent event = new FakeBlockBreakEvent(block, player);
|
||||||
if(block != null && plugin != null && player != null){
|
if(block != null && plugin != null && player != null){
|
||||||
@ -74,11 +67,11 @@ public class mcm {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void damageTool(Player player, short damage){
|
public static void damageTool(Player player, short damage){
|
||||||
if(player.getItemInHand().getTypeId() == 0)
|
if(player.getItemInHand().getTypeId() == 0)
|
||||||
return;
|
return;
|
||||||
player.getItemInHand().setDurability((short) (player.getItemInHand().getDurability() + damage));
|
player.getItemInHand().setDurability((short) (player.getItemInHand().getDurability() + damage));
|
||||||
if(player.getItemInHand().getDurability() >= getMaxDurability(mcm.getInstance().getTier(player), player.getItemInHand())){
|
if(player.getItemInHand().getDurability() >= getMaxDurability(getTier(player), player.getItemInHand())){
|
||||||
ItemStack[] inventory = player.getInventory().getContents();
|
ItemStack[] inventory = player.getInventory().getContents();
|
||||||
for(ItemStack x : inventory){
|
for(ItemStack x : inventory){
|
||||||
if(x != null && x.getTypeId() == player.getItemInHand().getTypeId() && x.getDurability() == player.getItemInHand().getDurability()){
|
if(x != null && x.getTypeId() == player.getItemInHand().getTypeId() && x.getDurability() == player.getItemInHand().getDurability()){
|
||||||
@ -109,7 +102,7 @@ public class mcm {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public Integer getTier(Player player){
|
public static Integer getTier(Player player){
|
||||||
int i = player.getItemInHand().getTypeId();
|
int i = player.getItemInHand().getTypeId();
|
||||||
if(i == 268 || i == 269 || i == 270 || i == 271 || i == 290){
|
if(i == 268 || i == 269 || i == 270 || i == 271 || i == 290){
|
||||||
return 1; //WOOD
|
return 1; //WOOD
|
||||||
@ -125,7 +118,7 @@ public class mcm {
|
|||||||
return 1; //UNRECOGNIZED
|
return 1; //UNRECOGNIZED
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public Integer getMaxDurability(Integer tier, ItemStack item){
|
public static Integer getMaxDurability(Integer tier, ItemStack item){
|
||||||
int id = item.getTypeId();
|
int id = item.getTypeId();
|
||||||
if(tier == 1){
|
if(tier == 1){
|
||||||
if((id == 276 || id == 277 || id == 278 || id == 279 || id == 293)){
|
if((id == 276 || id == 277 || id == 278 || id == 279 || id == 293)){
|
||||||
@ -143,12 +136,12 @@ public class mcm {
|
|||||||
return 0;
|
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));
|
+ Math.pow(loca.getZ() - locb.getZ(), 2));
|
||||||
}
|
}
|
||||||
public boolean abilityBlockCheck(Block block){
|
public static boolean abilityBlockCheck(Block block){
|
||||||
int i = block.getTypeId();
|
int i = block.getTypeId();
|
||||||
if(i == 68 || i == 355 || i == 26 || 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){
|
if(i == 68 || i == 355 || i == 26 || 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;
|
return false;
|
||||||
@ -156,7 +149,7 @@ public class mcm {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public boolean isBlockAround(Location loc, Integer radius, Integer typeid){
|
public static boolean isBlockAround(Location loc, Integer radius, Integer typeid){
|
||||||
Block blockx = loc.getBlock();
|
Block blockx = loc.getBlock();
|
||||||
int ox = blockx.getX();
|
int ox = blockx.getX();
|
||||||
int oy = blockx.getY();
|
int oy = blockx.getY();
|
||||||
@ -174,7 +167,7 @@ public class mcm {
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
public boolean isPvpEnabled(){
|
public static boolean isPvpEnabled(){
|
||||||
String propertyName = "pvp";
|
String propertyName = "pvp";
|
||||||
FileReader fr = null;
|
FileReader fr = null;
|
||||||
try {
|
try {
|
||||||
@ -205,7 +198,7 @@ public class mcm {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public boolean shouldBeWatched(Block block){
|
public static boolean shouldBeWatched(Block block){
|
||||||
int id = block.getTypeId();
|
int id = block.getTypeId();
|
||||||
if(id == 49 || id == 81 || id == 83 || id == 86 || id == 91 || id == 1 || id == 17 || id == 42 || 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 == 49 || id == 81 || id == 83 || id == 86 || id == 91 || id == 1 || id == 17 || id == 42 || id == 87 || id == 89 || id == 2 || id == 3 || id == 12 || id == 13 || id == 21 || id == 15 || id == 14 || id == 56 || id == 38 || id == 37 || id == 39 || id == 40 || id == 24){
|
||||||
return true;
|
return true;
|
||||||
@ -213,7 +206,7 @@ public class mcm {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public Integer calculateHealth(Integer health, Integer newvalue){
|
public static Integer calculateHealth(Integer health, Integer newvalue){
|
||||||
if((health + newvalue) > 20){
|
if((health + newvalue) > 20){
|
||||||
return 20;
|
return 20;
|
||||||
} else {
|
} else {
|
||||||
@ -227,7 +220,7 @@ public class mcm {
|
|||||||
return health-newvalue;
|
return health-newvalue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public Integer getHealth(Entity entity){
|
public static Integer getHealth(Entity entity){
|
||||||
if(entity instanceof Monster){
|
if(entity instanceof Monster){
|
||||||
Monster monster = (Monster)entity;
|
Monster monster = (Monster)entity;
|
||||||
return monster.getHealth();
|
return monster.getHealth();
|
||||||
@ -241,7 +234,7 @@ public class mcm {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public boolean isInt(String string){
|
public static boolean isInt(String string){
|
||||||
try {
|
try {
|
||||||
int x = Integer.parseInt(string);
|
int x = Integer.parseInt(string);
|
||||||
}
|
}
|
||||||
@ -250,7 +243,7 @@ public class mcm {
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
public void mcDropItem(Location loc, int id){
|
public static void mcDropItem(Location loc, int id){
|
||||||
if(loc != null){
|
if(loc != null){
|
||||||
Material mat = Material.getMaterial(id);
|
Material mat = Material.getMaterial(id);
|
||||||
byte damage = 0;
|
byte damage = 0;
|
||||||
@ -259,14 +252,14 @@ public class mcm {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isSwords(ItemStack is){
|
public static boolean isSwords(ItemStack is){
|
||||||
if(is.getTypeId() == 268 || is.getTypeId() == 267 || is.getTypeId() == 272 || is.getTypeId() == 283 || is.getTypeId() == 276){
|
if(is.getTypeId() == 268 || is.getTypeId() == 267 || is.getTypeId() == 272 || is.getTypeId() == 283 || is.getTypeId() == 276){
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public boolean isHoe(ItemStack is){
|
public static boolean isHoe(ItemStack is){
|
||||||
int id = is.getTypeId();
|
int id = is.getTypeId();
|
||||||
if(id == 290 || id == 291 || id == 292 || id == 293 || id == 294){
|
if(id == 290 || id == 291 || id == 292 || id == 293 || id == 294){
|
||||||
return true;
|
return true;
|
||||||
@ -274,21 +267,21 @@ public class mcm {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public boolean isShovel(ItemStack is){
|
public static boolean isShovel(ItemStack is){
|
||||||
if(is.getTypeId() == 269 || is.getTypeId() == 273 || is.getTypeId() == 277 || is.getTypeId() == 284 || is.getTypeId() == 256){
|
if(is.getTypeId() == 269 || is.getTypeId() == 273 || is.getTypeId() == 277 || is.getTypeId() == 284 || is.getTypeId() == 256){
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public boolean isAxes(ItemStack is){
|
public static boolean isAxes(ItemStack is){
|
||||||
if(is.getTypeId() == 271 || is.getTypeId() == 258 || is.getTypeId() == 286 || is.getTypeId() == 279 || is.getTypeId() == 275){
|
if(is.getTypeId() == 271 || is.getTypeId() == 258 || is.getTypeId() == 286 || is.getTypeId() == 279 || is.getTypeId() == 275){
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public boolean isMiningPick(ItemStack is){
|
public static boolean isMiningPick(ItemStack is){
|
||||||
if(is.getTypeId() == 270 || is.getTypeId() == 274 || is.getTypeId() == 285 || is.getTypeId() == 257 || is.getTypeId() == 278){
|
if(is.getTypeId() == 270 || is.getTypeId() == 274 || is.getTypeId() == 285 || is.getTypeId() == 257 || is.getTypeId() == 278){
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
@ -303,7 +296,7 @@ public class mcm {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public void mcmmoHelpCheck(String[] split, Player player, PlayerChatEvent event){
|
public static void mcmmoHelpCheck(String[] split, Player player, PlayerChatEvent event){
|
||||||
PlayerProfile PP = mcUsers.getProfile(player.getName());
|
PlayerProfile PP = mcUsers.getProfile(player.getName());
|
||||||
if(split[0].equalsIgnoreCase("/woodcutting")){
|
if(split[0].equalsIgnoreCase("/woodcutting")){
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
@ -665,6 +658,7 @@ public class mcm {
|
|||||||
player.sendMessage("/"+mcLoadProperties.clearmyspawn+" "+ChatColor.RED+"- Clears your MySpawn");
|
player.sendMessage("/"+mcLoadProperties.clearmyspawn+" "+ChatColor.RED+"- Clears your MySpawn");
|
||||||
}
|
}
|
||||||
player.sendMessage(ChatColor.GREEN+"--OTHER COMMANDS--");
|
player.sendMessage(ChatColor.GREEN+"--OTHER COMMANDS--");
|
||||||
|
player.sendMessage("/mctop <skillname> <page> "+ChatColor.RED+"- Leaderboards");
|
||||||
if(mcPermissions.getInstance().mcAbility(player))
|
if(mcPermissions.getInstance().mcAbility(player))
|
||||||
player.sendMessage("/"+mcLoadProperties.mcability+ChatColor.RED+" - Toggle ability activation with right click");
|
player.sendMessage("/"+mcLoadProperties.mcability+ChatColor.RED+" - Toggle ability activation with right click");
|
||||||
if(mcPermissions.getInstance().adminChat(player)){
|
if(mcPermissions.getInstance().adminChat(player)){
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
name: mcMMO
|
name: mcMMO
|
||||||
main: com.gmail.nossr50.mcMMO
|
main: com.gmail.nossr50.mcMMO
|
||||||
version: 0.9.30 WIP
|
version: 1.0 WIP
|
Loading…
Reference in New Issue
Block a user