mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-25 22:56:45 +01:00
WIP of 0.8.11 v4
This commit is contained in:
parent
d0c4604896
commit
89cda9adf5
@ -1,5 +1,31 @@
|
|||||||
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 0.8.11
|
||||||
|
Performance improvements
|
||||||
|
Memory leak fixed
|
||||||
|
NPE error with MySpawn really fixed
|
||||||
|
Version 0.8.9
|
||||||
|
Fixed NPE for My Spawn
|
||||||
|
Fixed NPE for onBlockDamage
|
||||||
|
Bleed proc now correctly checks for Swords permissions
|
||||||
|
Version 0.8.8
|
||||||
|
Gold can now be repaired
|
||||||
|
Tweaked Mining XP gains
|
||||||
|
Reorganized code
|
||||||
|
Added /mcgod godmode command
|
||||||
|
Fixed the pvp toggle in the settings file
|
||||||
|
Version 0.8.7
|
||||||
|
Removed packet-sending stuff wasn't working anyways
|
||||||
|
Fixed another NPE with the TimerTask
|
||||||
|
Skills now only show up in /stats if you have permissions for them
|
||||||
|
Version 0.8.6
|
||||||
|
Added a null check in bleed simulation to prevent a NPE
|
||||||
|
Version 0.8.5
|
||||||
|
Players are now added to files when they connect (to fix a NPE)
|
||||||
|
onPlayerCommand stuff moved into onPlayerCommandPreprocess
|
||||||
|
Version 0.8.4
|
||||||
|
Fixed another nullpointer error for TimerTask
|
||||||
|
Fixed bug making regeneration take twice as long to kick in after combat
|
||||||
Version 0.8.3
|
Version 0.8.3
|
||||||
Modified the timer intervals (from 1 second to 2)
|
Modified the timer intervals (from 1 second to 2)
|
||||||
All skills now have an individual modifier (Set by default to 2)
|
All skills now have an individual modifier (Set by default to 2)
|
||||||
|
82
mcMMO/com/gmail/nossr50/mcAcrobatics.java
Normal file
82
mcMMO/com/gmail/nossr50/mcAcrobatics.java
Normal file
@ -0,0 +1,82 @@
|
|||||||
|
package com.gmail.nossr50;
|
||||||
|
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.entity.EntityDamageEvent;
|
||||||
|
|
||||||
|
public class mcAcrobatics {
|
||||||
|
private static volatile mcAcrobatics instance;
|
||||||
|
public static mcAcrobatics getInstance() {
|
||||||
|
if (instance == null) {
|
||||||
|
instance = new mcAcrobatics();
|
||||||
|
}
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
public void acrobaticsCheck(Player player, EntityDamageEvent event, Location loc, int xx, int y, int z){
|
||||||
|
if(mcUsers.getProfile(player).getAcrobaticsInt() >= 50
|
||||||
|
&& mcUsers.getProfile(player).getAcrobaticsInt() < 250
|
||||||
|
&& mcPermissions.getInstance().acrobatics(player)){
|
||||||
|
if(Math.random() * 10 > 8){
|
||||||
|
event.setCancelled(true);
|
||||||
|
player.sendMessage("**ROLLED**");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(mcUsers.getProfile(player).getAcrobaticsInt() >= 250
|
||||||
|
&& mcUsers.getProfile(player).getAcrobaticsInt() < 450
|
||||||
|
&& mcPermissions.getInstance().acrobatics(player)){
|
||||||
|
if(Math.random() * 10 > 6){
|
||||||
|
event.setCancelled(true);
|
||||||
|
player.sendMessage("**ROLLED**");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(mcUsers.getProfile(player).getAcrobaticsInt() >= 450
|
||||||
|
&& mcUsers.getProfile(player).getAcrobaticsInt() < 750
|
||||||
|
&& mcPermissions.getInstance().acrobatics(player)){
|
||||||
|
if(Math.random() * 10 > 4){
|
||||||
|
event.setCancelled(true);
|
||||||
|
player.sendMessage("**ROLLED**");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(mcUsers.getProfile(player).getAcrobaticsInt() >= 750
|
||||||
|
&& mcUsers.getProfile(player).getAcrobaticsInt() < 950
|
||||||
|
&& mcPermissions.getInstance().acrobatics(player)){
|
||||||
|
if(Math.random() * 10 > 2){
|
||||||
|
event.setCancelled(true);
|
||||||
|
player.sendMessage("**BARREL ROLLED**");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(mcUsers.getProfile(player).getAcrobaticsInt() >= 950
|
||||||
|
&& mcPermissions.getInstance().acrobatics(player)){
|
||||||
|
event.setCancelled(true);
|
||||||
|
player.sendMessage("**ROLLED... LIKE A BOSS**");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if(player.getHealth() - event.getDamage() <= 0)
|
||||||
|
return;
|
||||||
|
if(!mcConfig.getInstance().isBlockWatched(loc.getWorld().getBlockAt(xx, y, z))
|
||||||
|
&& mcPermissions.getInstance().acrobatics(player)){
|
||||||
|
mcUsers.getProfile(player).addAcrobaticsGather(event.getDamage() * 3);
|
||||||
|
if(mcUsers.getProfile(player).getAcrobaticsGatherInt() >= mcUsers.getProfile(player).getXpToLevel("acrobatics")){
|
||||||
|
int skillups = 0;
|
||||||
|
while(mcUsers.getProfile(player).getAcrobaticsGatherInt() >= mcUsers.getProfile(player).getXpToLevel("acrobatics")){
|
||||||
|
skillups++;
|
||||||
|
mcUsers.getProfile(player).removeAcrobaticsGather(mcUsers.getProfile(player).getXpToLevel("acrobatics"));
|
||||||
|
mcUsers.getProfile(player).skillUpAcrobatics(1);
|
||||||
|
}
|
||||||
|
player.sendMessage(ChatColor.YELLOW+"Acrobatics skill increased by "+skillups+"."+" Total ("+mcUsers.getProfile(player).getAcrobatics()+")");
|
||||||
|
}
|
||||||
|
mcConfig.getInstance().addBlockWatch(loc.getWorld().getBlockAt(xx, y, z));
|
||||||
|
if(player.getHealth() - event.getDamage() <= 0){
|
||||||
|
if(mcUsers.getProfile(player).isDead())
|
||||||
|
return;
|
||||||
|
mcUsers.getProfile(player).setDead(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -2,7 +2,6 @@ package com.gmail.nossr50;
|
|||||||
|
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -10,7 +9,6 @@ import org.bukkit.event.block.BlockDamageEvent;
|
|||||||
import org.bukkit.event.block.BlockFromToEvent;
|
import org.bukkit.event.block.BlockFromToEvent;
|
||||||
import org.bukkit.event.block.BlockListener;
|
import org.bukkit.event.block.BlockListener;
|
||||||
import org.bukkit.event.block.BlockPlaceEvent;
|
import org.bukkit.event.block.BlockPlaceEvent;
|
||||||
import org.bukkit.inventory.ItemStack;
|
|
||||||
|
|
||||||
public class mcBlockListener extends BlockListener {
|
public class mcBlockListener extends BlockListener {
|
||||||
private final mcMMO plugin;
|
private final mcMMO plugin;
|
||||||
@ -30,8 +28,8 @@ public class mcBlockListener extends BlockListener {
|
|||||||
int y = block.getY();
|
int y = block.getY();
|
||||||
int z = block.getZ();
|
int z = block.getZ();
|
||||||
String xyz = x+","+y+","+z;
|
String xyz = x+","+y+","+z;
|
||||||
|
if(mcm.getInstance().shouldBeWatched(block))
|
||||||
mcConfig.getInstance().addBlockWatch(block);
|
mcConfig.getInstance().addBlockWatch(block);
|
||||||
mcConfig.getInstance().addCoordsWatch(xyz);
|
|
||||||
if(block.getTypeId() == 42 && mcLoadProperties.anvilmessages)
|
if(block.getTypeId() == 42 && mcLoadProperties.anvilmessages)
|
||||||
event.getPlayer().sendMessage(ChatColor.DARK_RED+"You have placed an anvil, anvils can repair tools and armor.");
|
event.getPlayer().sendMessage(ChatColor.DARK_RED+"You have placed an anvil, anvils can repair tools and armor.");
|
||||||
}
|
}
|
||||||
@ -45,7 +43,6 @@ public class mcBlockListener extends BlockListener {
|
|||||||
int y = block.getY();
|
int y = block.getY();
|
||||||
int z = block.getZ();
|
int z = block.getZ();
|
||||||
String xyz = x+","+y+","+z;
|
String xyz = x+","+y+","+z;
|
||||||
int type = block.getTypeId();
|
|
||||||
Location loc = block.getLocation();
|
Location loc = block.getLocation();
|
||||||
int dmg = event.getDamageLevel().getLevel();
|
int dmg = event.getDamageLevel().getLevel();
|
||||||
/*
|
/*
|
||||||
@ -53,32 +50,31 @@ public class mcBlockListener extends BlockListener {
|
|||||||
*/
|
*/
|
||||||
if(dmg == 3){
|
if(dmg == 3){
|
||||||
if(mcPermissions.getInstance().herbalism(player))
|
if(mcPermissions.getInstance().herbalism(player))
|
||||||
mcm.getInstance().herbalismProcCheck(block, player);
|
mcHerbalism.getInstance().herbalismProcCheck(block, player);
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* MINING
|
* MINING
|
||||||
*/
|
*/
|
||||||
if(dmg == 2 && !mcConfig.getInstance().isBlockWatched(block) && !mcConfig.getInstance().isCoordsWatched(xyz)){
|
if(player != null && dmg == 2 && !mcConfig.getInstance().isBlockWatched(block)){
|
||||||
if(mcPermissions.getInstance().mining(player))
|
if(mcPermissions.getInstance().mining(player))
|
||||||
mcm.getInstance().miningBlockCheck(player, block);
|
mcMining.getInstance().miningBlockCheck(player, block);
|
||||||
/*
|
/*
|
||||||
* WOOD CUTTING
|
* WOOD CUTTING
|
||||||
*/
|
*/
|
||||||
if(block.getTypeId() == 17 && mcPermissions.getInstance().woodcutting(player)){
|
if(player != null && block.getTypeId() == 17 && mcPermissions.getInstance().woodcutting(player)){
|
||||||
mcm.getInstance().woodCuttingProcCheck(player, block, loc);
|
mcWoodCutting.getInstance().woodCuttingProcCheck(player, block, loc);
|
||||||
mcUsers.getProfile(player).addWoodcuttingGather(7);
|
mcUsers.getProfile(player).addWoodcuttingGather(7);
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* EXCAVATION
|
* EXCAVATION
|
||||||
*/
|
*/
|
||||||
if(mcPermissions.getInstance().excavation(player) && block != null && player != null)
|
if(mcPermissions.getInstance().excavation(player) && block != null && player != null)
|
||||||
mcm.getInstance().excavationProcCheck(block, player);
|
mcExcavation.getInstance().excavationProcCheck(block, player);
|
||||||
/*
|
/*
|
||||||
* EXPLOIT COUNTERMEASURES
|
* EXPLOIT COUNTERMEASURES
|
||||||
*/
|
*/
|
||||||
mcConfig.getInstance().addCoordsWatch(xyz);
|
|
||||||
mcConfig.getInstance().addBlockWatch(block);
|
mcConfig.getInstance().addBlockWatch(block);
|
||||||
if(mcUsers.getProfile(player).getWoodCuttingGatherInt() >= mcUsers.getProfile(player).getXpToLevel("woodcutting")){
|
if(player != null && mcUsers.getProfile(player).getWoodCuttingGatherInt() >= mcUsers.getProfile(player).getXpToLevel("woodcutting")){
|
||||||
int skillups = 0;
|
int skillups = 0;
|
||||||
while(mcUsers.getProfile(player).getWoodCuttingGatherInt() >= mcUsers.getProfile(player).getXpToLevel("woodcutting")){
|
while(mcUsers.getProfile(player).getWoodCuttingGatherInt() >= mcUsers.getProfile(player).getXpToLevel("woodcutting")){
|
||||||
skillups++;
|
skillups++;
|
||||||
|
935
mcMMO/com/gmail/nossr50/mcCombat.java
Normal file
935
mcMMO/com/gmail/nossr50/mcCombat.java
Normal file
@ -0,0 +1,935 @@
|
|||||||
|
package com.gmail.nossr50;
|
||||||
|
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.entity.Animals;
|
||||||
|
import org.bukkit.entity.Creeper;
|
||||||
|
import org.bukkit.entity.Entity;
|
||||||
|
import org.bukkit.entity.Monster;
|
||||||
|
import org.bukkit.entity.PigZombie;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.entity.Skeleton;
|
||||||
|
import org.bukkit.entity.Spider;
|
||||||
|
import org.bukkit.entity.Squid;
|
||||||
|
import org.bukkit.entity.Zombie;
|
||||||
|
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||||
|
import org.bukkit.event.entity.EntityDamageByProjectileEvent;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import org.bukkit.plugin.Plugin;
|
||||||
|
|
||||||
|
public class mcCombat {
|
||||||
|
private static mcMMO plugin;
|
||||||
|
public mcCombat(mcMMO instance) {
|
||||||
|
plugin = instance;
|
||||||
|
}
|
||||||
|
private static volatile mcCombat instance;
|
||||||
|
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(mcLoadProperties.pvp == false){
|
||||||
|
event.setCancelled(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Player defender = (Player)x;
|
||||||
|
if(mcUsers.getProfile(attacker).inParty() && mcUsers.getProfile(defender).inParty()){
|
||||||
|
if(mcParty.getInstance().inSameParty(defender, attacker)){
|
||||||
|
event.setCancelled(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
mcUsers.getProfile(defender).setRecentlyHurt(30);
|
||||||
|
/*
|
||||||
|
* AXE CRITICAL CHECK
|
||||||
|
*/
|
||||||
|
axeCriticalCheckPlayer(attacker, event, x, plugin);
|
||||||
|
if(!mcConfig.getInstance().isBleedTracked(x)){
|
||||||
|
bleedCheck(attacker, x);
|
||||||
|
}
|
||||||
|
int healthbefore = defender.getHealth();
|
||||||
|
if(mcPermissions.getInstance().unarmed(attacker) && attacker.getItemInHand().getTypeId() == 0){
|
||||||
|
//DMG MODIFIER
|
||||||
|
if(mcUsers.getProfile(attacker).getUnarmedInt() >= 50 && mcUsers.getProfile(attacker).getUnarmedInt() < 100){
|
||||||
|
defender.setHealth(calculateDamage(defender, 1));
|
||||||
|
} else if(mcUsers.getProfile(attacker).getUnarmedInt() >= 100 && mcUsers.getProfile(attacker).getUnarmedInt() < 200){
|
||||||
|
defender.setHealth(calculateDamage(defender, 2));
|
||||||
|
} else if(mcUsers.getProfile(attacker).getUnarmedInt() >= 200 && mcUsers.getProfile(attacker).getUnarmedInt() < 325){
|
||||||
|
defender.setHealth(calculateDamage(defender, 3));
|
||||||
|
} else if(mcUsers.getProfile(attacker).getUnarmedInt() >= 325 && mcUsers.getProfile(attacker).getUnarmedInt() < 475){
|
||||||
|
defender.setHealth(calculateDamage(defender, 4));
|
||||||
|
} else if(mcUsers.getProfile(attacker).getUnarmedInt() >= 475 && mcUsers.getProfile(attacker).getUnarmedInt() < 600){
|
||||||
|
defender.setHealth(calculateDamage(defender, 5));
|
||||||
|
} else if(mcUsers.getProfile(attacker).getUnarmedInt() >= 600 && mcUsers.getProfile(attacker).getUnarmedInt() < 775){
|
||||||
|
defender.setHealth(calculateDamage(defender, 6));
|
||||||
|
} else if(mcUsers.getProfile(attacker).getUnarmedInt() >= 775 && mcUsers.getProfile(attacker).getUnarmedInt() < 950){
|
||||||
|
defender.setHealth(calculateDamage(defender, 7));
|
||||||
|
} else if(mcUsers.getProfile(attacker).getUnarmedInt() >= 950){
|
||||||
|
defender.setHealth(calculateDamage(defender, 8));
|
||||||
|
}
|
||||||
|
if(mcUsers.getProfile(defender).isDead())
|
||||||
|
return;
|
||||||
|
//PROC
|
||||||
|
if(simulateUnarmedProc(attacker)){
|
||||||
|
Location loc = defender.getLocation();
|
||||||
|
if(defender.getItemInHand() != null && defender.getItemInHand().getTypeId() != 0){
|
||||||
|
attacker.sendMessage(ChatColor.DARK_RED+"You have hit with great force.");
|
||||||
|
defender.sendMessage(ChatColor.DARK_RED+"You have been disarmed!");
|
||||||
|
ItemStack item = defender.getItemInHand();
|
||||||
|
if(item != null){
|
||||||
|
loc.getWorld().dropItemNaturally(loc, item);
|
||||||
|
ItemStack itemx = null;
|
||||||
|
defender.setItemInHand(itemx);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* Make the defender drop items on death
|
||||||
|
*/
|
||||||
|
if(defender.getHealth()<= 0 && !mcUsers.getProfile(defender).isDead()){
|
||||||
|
mcUsers.getProfile(defender).setDead(true);
|
||||||
|
event.setCancelled(true); //SEE IF THIS HELPS
|
||||||
|
//If it only would've died from mcMMO damage modifiers
|
||||||
|
if(defender.getHealth() <= 0 && healthbefore - event.getDamage() >= 1){
|
||||||
|
mcm.getInstance().simulateNaturalDrops(defender);
|
||||||
|
}
|
||||||
|
for(ItemStack herp : defender.getInventory().getContents()){
|
||||||
|
if(herp != null && herp.getTypeId() != 0)
|
||||||
|
defender.getLocation().getWorld().dropItemNaturally(defender.getLocation(), herp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(mcUsers.getProfile(defender).isDead())
|
||||||
|
return;
|
||||||
|
if((mcUsers.getProfile(defender).inParty() && mcUsers.getProfile(attacker).inParty())&& mcUsers.getProfile(defender).getParty().equals(mcUsers.getProfile(attacker).getParty()))
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public void playerVersusSquidChecks(EntityDamageByEntityEvent event, Player attacker, Entity x, int type){
|
||||||
|
if(x instanceof Squid){
|
||||||
|
if(!mcConfig.getInstance().isBleedTracked(x)){
|
||||||
|
bleedCheck(attacker, x);
|
||||||
|
}
|
||||||
|
Squid defender = (Squid)event.getEntity();
|
||||||
|
if(mcm.getInstance().isSwords(attacker.getItemInHand()) && defender.getHealth() > 0 && mcPermissions.getInstance().swords(attacker)){
|
||||||
|
mcUsers.getProfile(attacker).addSwordsGather(10);
|
||||||
|
if(mcUsers.getProfile(attacker).getSwordsGatherInt() >= mcUsers.getProfile(attacker).getXpToLevel("swords")){
|
||||||
|
int skillups = 0;
|
||||||
|
while(mcUsers.getProfile(attacker).getSwordsGatherInt() >= mcUsers.getProfile(attacker).getXpToLevel("swords")){
|
||||||
|
skillups++;
|
||||||
|
mcUsers.getProfile(attacker).removeSwordsGather(mcUsers.getProfile(attacker).getXpToLevel("swords"));
|
||||||
|
mcUsers.getProfile(attacker).skillUpSwords(1);
|
||||||
|
}
|
||||||
|
attacker.sendMessage(ChatColor.YELLOW+"Swords skill increased by "+skillups+"."+" Total ("+mcUsers.getProfile(attacker).getSwords()+")");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(mcm.getInstance().isAxes(attacker.getItemInHand())
|
||||||
|
&& defender.getHealth() > 0
|
||||||
|
&& mcPermissions.getInstance().axes(attacker)){
|
||||||
|
mcUsers.getProfile(attacker).addAxesGather(10);
|
||||||
|
if(mcUsers.getProfile(attacker).getAxesGatherInt() >= mcUsers.getProfile(attacker).getXpToLevel("axes")){
|
||||||
|
int skillups = 0;
|
||||||
|
while(mcUsers.getProfile(attacker).getAxesGatherInt() >= mcUsers.getProfile(attacker).getXpToLevel("axes")){
|
||||||
|
skillups++;
|
||||||
|
mcUsers.getProfile(attacker).removeAxesGather(mcUsers.getProfile(attacker).getXpToLevel("axes"));
|
||||||
|
mcUsers.getProfile(attacker).skillUpAxes(1);
|
||||||
|
}
|
||||||
|
attacker.sendMessage(ChatColor.YELLOW+"Axes skill increased by "+skillups+"."+" Total ("+mcUsers.getProfile(attacker).getAxes()+")");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(mcm.getInstance().isAxes(attacker.getItemInHand()) && mcPermissions.getInstance().axes(attacker)){
|
||||||
|
if(defender.getHealth() <= 0)
|
||||||
|
return;
|
||||||
|
if(mcUsers.getProfile(attacker).getAxesInt() >= 500){
|
||||||
|
defender.setHealth(calculateDamage(defender, (4 - axeNerf(attacker.getItemInHand().getTypeId()))));
|
||||||
|
}
|
||||||
|
if(defender.getHealth() <= 0)
|
||||||
|
mcm.getInstance().simulateNaturalDrops(defender);
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* UNARMED VS SQUID
|
||||||
|
*/
|
||||||
|
if(type == 0 && mcPermissions.getInstance().unarmed(attacker)){
|
||||||
|
if(defender.getHealth() <= 0)
|
||||||
|
return;
|
||||||
|
if(mcUsers.getProfile(attacker).getUnarmedInt() >= 50 && mcUsers.getProfile(attacker).getUnarmedInt() < 100){
|
||||||
|
defender.setHealth(calculateDamage(defender, 1));
|
||||||
|
} else if(mcUsers.getProfile(attacker).getUnarmedInt() >= 100 && mcUsers.getProfile(attacker).getUnarmedInt() < 200){
|
||||||
|
defender.setHealth(calculateDamage(defender, 2));
|
||||||
|
} else if(mcUsers.getProfile(attacker).getUnarmedInt() >= 200 && mcUsers.getProfile(attacker).getUnarmedInt() < 325){
|
||||||
|
defender.setHealth(calculateDamage(defender, 3));
|
||||||
|
} else if(mcUsers.getProfile(attacker).getUnarmedInt() >= 325 && mcUsers.getProfile(attacker).getUnarmedInt() < 475){
|
||||||
|
defender.setHealth(calculateDamage(defender, 4));
|
||||||
|
} else if(mcUsers.getProfile(attacker).getUnarmedInt() >= 475 && mcUsers.getProfile(attacker).getUnarmedInt() < 600){
|
||||||
|
defender.setHealth(calculateDamage(defender, 5));
|
||||||
|
} else if(mcUsers.getProfile(attacker).getUnarmedInt() >= 600 && mcUsers.getProfile(attacker).getUnarmedInt() < 775){
|
||||||
|
defender.setHealth(calculateDamage(defender, 6));
|
||||||
|
} else if(mcUsers.getProfile(attacker).getUnarmedInt() >= 775 && mcUsers.getProfile(attacker).getUnarmedInt() < 950){
|
||||||
|
defender.setHealth(calculateDamage(defender, 7));
|
||||||
|
} else if(mcUsers.getProfile(attacker).getUnarmedInt() >= 950){
|
||||||
|
defender.setHealth(calculateDamage(defender, 8));
|
||||||
|
}
|
||||||
|
//XP
|
||||||
|
if(defender.getHealth() != 0){
|
||||||
|
mcUsers.getProfile(attacker).addUnarmedGather(10);
|
||||||
|
if(mcUsers.getProfile(attacker).getUnarmedGatherInt() >= mcUsers.getProfile(attacker).getXpToLevel("unarmed")){
|
||||||
|
int skillups = 0;
|
||||||
|
while(mcUsers.getProfile(attacker).getUnarmedGatherInt() >= mcUsers.getProfile(attacker).getXpToLevel("unarmed")){
|
||||||
|
skillups++;
|
||||||
|
mcUsers.getProfile(attacker).removeUnarmedGather(mcUsers.getProfile(attacker).getXpToLevel("unarmed"));
|
||||||
|
mcUsers.getProfile(attacker).skillUpUnarmed(1);
|
||||||
|
}
|
||||||
|
attacker.sendMessage(ChatColor.YELLOW+"Unarmed skill increased by "+skillups+"."+" Total ("+mcUsers.getProfile(attacker).getUnarmed()+")");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(defender.getHealth() <= 0)
|
||||||
|
mcm.getInstance().simulateNaturalDrops(defender);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public void playerVersusAnimalsChecks(Entity x, Player attacker, EntityDamageByEntityEvent event, int type){
|
||||||
|
if(x instanceof Animals){
|
||||||
|
if(!mcConfig.getInstance().isBleedTracked(x)){
|
||||||
|
bleedCheck(attacker, x);
|
||||||
|
}
|
||||||
|
Animals defender = (Animals)event.getEntity();
|
||||||
|
if(mcm.getInstance().isAxes(attacker.getItemInHand()) && mcPermissions.getInstance().axes(attacker)){
|
||||||
|
if(defender.getHealth() <= 0)
|
||||||
|
return;
|
||||||
|
if(mcUsers.getProfile(attacker).getAxesInt() >= 500){
|
||||||
|
defender.setHealth(calculateDamage(defender, (4 - axeNerf(attacker.getItemInHand().getTypeId()))));
|
||||||
|
}
|
||||||
|
if(defender.getHealth() <= 0)
|
||||||
|
mcm.getInstance().simulateNaturalDrops(defender);
|
||||||
|
}
|
||||||
|
if(type == 0 && mcPermissions.getInstance().unarmed(attacker)){
|
||||||
|
if(defender.getHealth() <= 0)
|
||||||
|
return;
|
||||||
|
if(mcUsers.getProfile(attacker).getUnarmedInt() >= 50 && mcUsers.getProfile(attacker).getUnarmedInt() < 100){
|
||||||
|
defender.setHealth(calculateDamage(defender, 1));
|
||||||
|
} else if(mcUsers.getProfile(attacker).getUnarmedInt() >= 100 && mcUsers.getProfile(attacker).getUnarmedInt() < 200){
|
||||||
|
defender.setHealth(calculateDamage(defender, 2));
|
||||||
|
} else if(mcUsers.getProfile(attacker).getUnarmedInt() >= 200 && mcUsers.getProfile(attacker).getUnarmedInt() < 325){
|
||||||
|
defender.setHealth(calculateDamage(defender, 3));
|
||||||
|
} else if(mcUsers.getProfile(attacker).getUnarmedInt() >= 325 && mcUsers.getProfile(attacker).getUnarmedInt() < 475){
|
||||||
|
defender.setHealth(calculateDamage(defender, 4));
|
||||||
|
} else if(mcUsers.getProfile(attacker).getUnarmedInt() >= 475 && mcUsers.getProfile(attacker).getUnarmedInt() < 600){
|
||||||
|
defender.setHealth(calculateDamage(defender, 5));
|
||||||
|
} else if(mcUsers.getProfile(attacker).getUnarmedInt() >= 600 && mcUsers.getProfile(attacker).getUnarmedInt() < 775){
|
||||||
|
defender.setHealth(calculateDamage(defender, 6));
|
||||||
|
} else if(mcUsers.getProfile(attacker).getUnarmedInt() >= 775 && mcUsers.getProfile(attacker).getUnarmedInt() < 950){
|
||||||
|
defender.setHealth(calculateDamage(defender, 7));
|
||||||
|
} else if(mcUsers.getProfile(attacker).getUnarmedInt() >= 950){
|
||||||
|
defender.setHealth(calculateDamage(defender, 8));
|
||||||
|
}
|
||||||
|
if(defender.getHealth() <= 0){
|
||||||
|
mcm.getInstance().simulateNaturalDrops(defender);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public void playerVersusMonsterChecks(EntityDamageByEntityEvent event, Player attacker, Entity x, int type){
|
||||||
|
if(x instanceof Monster){
|
||||||
|
/*
|
||||||
|
* AXE PROC CHECKS
|
||||||
|
*/
|
||||||
|
axeCriticalCheckMonster(attacker, event, x);
|
||||||
|
if(!mcConfig.getInstance().isBleedTracked(x)){
|
||||||
|
bleedCheck(attacker, x);
|
||||||
|
}
|
||||||
|
Monster defender = (Monster)event.getEntity();
|
||||||
|
if(mcm.getInstance().isSwords(attacker.getItemInHand())
|
||||||
|
&& defender.getHealth() > 0
|
||||||
|
&& mcPermissions.getInstance().swords(attacker)){
|
||||||
|
if(!mcConfig.getInstance().isMobSpawnTracked(x)){
|
||||||
|
if(x instanceof Creeper)
|
||||||
|
mcUsers.getProfile(attacker).addSwordsGather(10);
|
||||||
|
if(x instanceof Spider)
|
||||||
|
mcUsers.getProfile(attacker).addSwordsGather(7);
|
||||||
|
if(x instanceof Skeleton)
|
||||||
|
mcUsers.getProfile(attacker).addSwordsGather(5);
|
||||||
|
if(x instanceof Zombie)
|
||||||
|
mcUsers.getProfile(attacker).addSwordsGather(3);
|
||||||
|
if(x instanceof PigZombie)
|
||||||
|
mcUsers.getProfile(attacker).addSwordsGather(7);
|
||||||
|
}
|
||||||
|
if(mcUsers.getProfile(attacker).getSwordsGatherInt() >= mcUsers.getProfile(attacker).getXpToLevel("swords")){
|
||||||
|
int skillups = 0;
|
||||||
|
while(mcUsers.getProfile(attacker).getSwordsGatherInt() >= mcUsers.getProfile(attacker).getXpToLevel("swords")){
|
||||||
|
skillups++;
|
||||||
|
mcUsers.getProfile(attacker).removeSwordsGather(mcUsers.getProfile(attacker).getXpToLevel("swords"));
|
||||||
|
mcUsers.getProfile(attacker).skillUpSwords(1);
|
||||||
|
}
|
||||||
|
attacker.sendMessage(ChatColor.YELLOW+"Swords skill increased by "+skillups+"."+" Total ("+mcUsers.getProfile(attacker).getSwords()+")");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(mcm.getInstance().isAxes(attacker.getItemInHand())
|
||||||
|
&& defender.getHealth() > 0
|
||||||
|
&& mcPermissions.getInstance().axes(attacker)){
|
||||||
|
if(!mcConfig.getInstance().isMobSpawnTracked(x)){
|
||||||
|
mcUsers.getProfile(attacker).addAxesGather(1);
|
||||||
|
if(x instanceof Creeper)
|
||||||
|
mcUsers.getProfile(attacker).addAxesGather(10);
|
||||||
|
if(x instanceof Spider)
|
||||||
|
mcUsers.getProfile(attacker).addAxesGather(7);
|
||||||
|
if(x instanceof Skeleton)
|
||||||
|
mcUsers.getProfile(attacker).addAxesGather(5);
|
||||||
|
if(x instanceof Zombie)
|
||||||
|
mcUsers.getProfile(attacker).addAxesGather(3);
|
||||||
|
if(x instanceof PigZombie)
|
||||||
|
mcUsers.getProfile(attacker).addAxesGather(7);
|
||||||
|
}
|
||||||
|
if(mcUsers.getProfile(attacker).getAxesGatherInt() >= mcUsers.getProfile(attacker).getXpToLevel("axes")){
|
||||||
|
int skillups = 0;
|
||||||
|
while(mcUsers.getProfile(attacker).getAxesGatherInt() >= mcUsers.getProfile(attacker).getXpToLevel("axes")){
|
||||||
|
skillups++;
|
||||||
|
mcUsers.getProfile(attacker).removeAxesGather(mcUsers.getProfile(attacker).getXpToLevel("axes"));
|
||||||
|
mcUsers.getProfile(attacker).skillUpAxes(1);
|
||||||
|
}
|
||||||
|
attacker.sendMessage(ChatColor.YELLOW+"Axes skill increased by "+skillups+"."+" Total ("+mcUsers.getProfile(attacker).getAxes()+")");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* AXE DAMAGE SCALING && LOOT CHECKS
|
||||||
|
*/
|
||||||
|
if(mcm.getInstance().isAxes(attacker.getItemInHand()) && mcPermissions.getInstance().axes(attacker)){
|
||||||
|
if(defender.getHealth() <= 0)
|
||||||
|
return;
|
||||||
|
if(mcUsers.getProfile(attacker).getAxesInt() >= 500){
|
||||||
|
defender.setHealth(calculateDamage(defender, (4 - axeNerf(attacker.getItemInHand().getTypeId()))));
|
||||||
|
}
|
||||||
|
if(defender.getHealth() <= 0 || defender.getHealth() - event.getDamage() <= 0){
|
||||||
|
mcm.getInstance().simulateNaturalDrops(defender);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(type == 0 && mcPermissions.getInstance().unarmed(attacker)){
|
||||||
|
if(defender.getHealth() <= 0)
|
||||||
|
return;
|
||||||
|
if(mcUsers.getProfile(attacker).getUnarmedInt() >= 50 && mcUsers.getProfile(attacker).getUnarmedInt() < 100){
|
||||||
|
defender.setHealth(calculateDamage(defender, 1));
|
||||||
|
} else if(mcUsers.getProfile(attacker).getUnarmedInt() >= 100 && mcUsers.getProfile(attacker).getUnarmedInt() < 200){
|
||||||
|
defender.setHealth(calculateDamage(defender, 2));
|
||||||
|
} else if(mcUsers.getProfile(attacker).getUnarmedInt() >= 200 && mcUsers.getProfile(attacker).getUnarmedInt() < 325){
|
||||||
|
defender.setHealth(calculateDamage(defender, 3));
|
||||||
|
} else if(mcUsers.getProfile(attacker).getUnarmedInt() >= 325 && mcUsers.getProfile(attacker).getUnarmedInt() < 475){
|
||||||
|
defender.setHealth(calculateDamage(defender, 4));
|
||||||
|
} else if(mcUsers.getProfile(attacker).getUnarmedInt() >= 475 && mcUsers.getProfile(attacker).getUnarmedInt() < 600){
|
||||||
|
defender.setHealth(calculateDamage(defender, 5));
|
||||||
|
} else if(mcUsers.getProfile(attacker).getUnarmedInt() >= 600 && mcUsers.getProfile(attacker).getUnarmedInt() < 775){
|
||||||
|
defender.setHealth(calculateDamage(defender, 6));
|
||||||
|
} else if(mcUsers.getProfile(attacker).getUnarmedInt() >= 775 && mcUsers.getProfile(attacker).getUnarmedInt() < 950){
|
||||||
|
defender.setHealth(calculateDamage(defender, 7));
|
||||||
|
} else if(mcUsers.getProfile(attacker).getUnarmedInt() >= 950){
|
||||||
|
defender.setHealth(calculateDamage(defender, 8));
|
||||||
|
}
|
||||||
|
//XP
|
||||||
|
if(!mcConfig.getInstance().isMobSpawnTracked(x)){
|
||||||
|
if(x instanceof Creeper)
|
||||||
|
mcUsers.getProfile(attacker).addUnarmedGather(20);
|
||||||
|
if(x instanceof Spider)
|
||||||
|
mcUsers.getProfile(attacker).addUnarmedGather(15);
|
||||||
|
if(x instanceof Skeleton)
|
||||||
|
mcUsers.getProfile(attacker).addUnarmedGather(10);
|
||||||
|
if(x instanceof Zombie)
|
||||||
|
mcUsers.getProfile(attacker).addUnarmedGather(5);
|
||||||
|
if(x instanceof PigZombie)
|
||||||
|
mcUsers.getProfile(attacker).addUnarmedGather(15);
|
||||||
|
}
|
||||||
|
if(mcUsers.getProfile(attacker).getUnarmedGatherInt() >= mcUsers.getProfile(attacker).getXpToLevel("unarmed")){
|
||||||
|
int skillups = 0;
|
||||||
|
while(mcUsers.getProfile(attacker).getUnarmedGatherInt() >= mcUsers.getProfile(attacker).getXpToLevel("unarmed")){
|
||||||
|
skillups++;
|
||||||
|
mcUsers.getProfile(attacker).removeUnarmedGather(mcUsers.getProfile(attacker).getXpToLevel("unarmed"));
|
||||||
|
mcUsers.getProfile(attacker).skillUpUnarmed(1);
|
||||||
|
}
|
||||||
|
attacker.sendMessage(ChatColor.YELLOW+"Unarmed skill increased by "+skillups+"."+" Total ("+mcUsers.getProfile(attacker).getUnarmed()+")");
|
||||||
|
}
|
||||||
|
if(defender.getHealth() <= 0 || defender.getHealth() - event.getDamage() <= 0){
|
||||||
|
mcm.getInstance().simulateNaturalDrops(defender);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public void archeryCheck(EntityDamageByProjectileEvent event){
|
||||||
|
Entity y = event.getDamager();
|
||||||
|
Entity x = event.getEntity();
|
||||||
|
/*
|
||||||
|
* Defender is player
|
||||||
|
*/
|
||||||
|
if(y instanceof Player){
|
||||||
|
Player attacker = (Player)y;
|
||||||
|
if(event.getProjectile().toString().equals("CraftArrow") && mcPermissions.getInstance().archery(attacker)){
|
||||||
|
if(!mcConfig.getInstance().isTracked(x) && event.getDamage() > 0){
|
||||||
|
mcConfig.getInstance().addArrowTrack(x, 0);
|
||||||
|
if(mcUsers.getProfile(attacker).getArcheryInt() >= 50 && mcUsers.getProfile(attacker).getArcheryInt() < 200){
|
||||||
|
if(Math.random() * 10 > 8){
|
||||||
|
mcConfig.getInstance().addArrowCount(x, 1);
|
||||||
|
}
|
||||||
|
} else if(mcUsers.getProfile(attacker).getArcheryInt() >= 200 && mcUsers.getProfile(attacker).getArcheryInt() < 400){
|
||||||
|
if(Math.random() * 10 > 6){
|
||||||
|
mcConfig.getInstance().addArrowCount(x, 1);
|
||||||
|
}
|
||||||
|
} else if(mcUsers.getProfile(attacker).getArcheryInt() >= 400 && mcUsers.getProfile(attacker).getArcheryInt() < 600){
|
||||||
|
if(Math.random() * 10 > 4){
|
||||||
|
mcConfig.getInstance().addArrowCount(x, 1);
|
||||||
|
}
|
||||||
|
} else if(mcUsers.getProfile(attacker).getArcheryInt() >= 600 && mcUsers.getProfile(attacker).getArcheryInt() < 800){
|
||||||
|
if(Math.random() * 10 > 2){
|
||||||
|
mcConfig.getInstance().addArrowCount(x, 1);
|
||||||
|
}
|
||||||
|
} else if(mcUsers.getProfile(attacker).getArcheryInt() >= 800){
|
||||||
|
mcConfig.getInstance().addArrowCount(x, 1);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if(event.getDamage() > 0){
|
||||||
|
if(mcUsers.getProfile(attacker).getArcheryInt() >= 50 && mcUsers.getProfile(attacker).getArcheryInt() < 200){
|
||||||
|
if(Math.random() * 10 > 8){
|
||||||
|
mcConfig.getInstance().addArrowCount(x, 1);
|
||||||
|
}
|
||||||
|
} else if(mcUsers.getProfile(attacker).getArcheryInt() >= 200 && mcUsers.getProfile(attacker).getArcheryInt() < 400){
|
||||||
|
if(Math.random() * 10 > 6){
|
||||||
|
mcConfig.getInstance().addArrowCount(x, 1);
|
||||||
|
}
|
||||||
|
} else if(mcUsers.getProfile(attacker).getArcheryInt() >= 400 && mcUsers.getProfile(attacker).getArcheryInt() < 600){
|
||||||
|
if(Math.random() * 10 > 4){
|
||||||
|
mcConfig.getInstance().addArrowCount(x, 1);
|
||||||
|
}
|
||||||
|
} else if(mcUsers.getProfile(attacker).getArcheryInt() >= 600 && mcUsers.getProfile(attacker).getArcheryInt() < 800){
|
||||||
|
if(Math.random() * 10 > 2){
|
||||||
|
mcConfig.getInstance().addArrowCount(x, 1);
|
||||||
|
}
|
||||||
|
} else if(mcUsers.getProfile(attacker).getArcheryInt() >= 800){
|
||||||
|
mcConfig.getInstance().addArrowCount(x, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* Defender is Monster
|
||||||
|
*/
|
||||||
|
if(x instanceof Monster){
|
||||||
|
Monster defender = (Monster)x;
|
||||||
|
/*
|
||||||
|
* TRACK ARROWS USED AGAINST THE ENTITY
|
||||||
|
*/
|
||||||
|
int healthbefore = defender.getHealth();
|
||||||
|
if(mcUsers.getProfile(attacker).getArcheryInt() >= 50 && mcUsers.getProfile(attacker).getArcheryInt() < 250)
|
||||||
|
defender.setHealth(calculateDamage(defender, 1));
|
||||||
|
if(mcUsers.getProfile(attacker).getArcheryInt() >= 250 && mcUsers.getProfile(attacker).getArcheryInt() < 575)
|
||||||
|
defender.setHealth(calculateDamage(defender, 2));
|
||||||
|
if(mcUsers.getProfile(attacker).getArcheryInt() >= 575 && mcUsers.getProfile(attacker).getArcheryInt() < 725)
|
||||||
|
defender.setHealth(calculateDamage(defender, 3));
|
||||||
|
if(mcUsers.getProfile(attacker).getArcheryInt() >= 725 && mcUsers.getProfile(attacker).getArcheryInt() < 1000)
|
||||||
|
defender.setHealth(calculateDamage(defender, 4));
|
||||||
|
if(mcUsers.getProfile(attacker).getArcheryInt() >= 1000)
|
||||||
|
defender.setHealth(calculateDamage(defender, 5));
|
||||||
|
//If it only would've died from mcMMO damage modifiers
|
||||||
|
if(defender.getHealth() <= 0 && healthbefore - event.getDamage() >= 1){
|
||||||
|
mcm.getInstance().simulateNaturalDrops(defender);
|
||||||
|
}
|
||||||
|
//XP
|
||||||
|
if(!mcConfig.getInstance().isMobSpawnTracked(x)){
|
||||||
|
if(x instanceof Creeper)
|
||||||
|
mcUsers.getProfile(attacker).addArcheryGather(10);
|
||||||
|
if(x instanceof Spider)
|
||||||
|
mcUsers.getProfile(attacker).addArcheryGather(7);
|
||||||
|
if(x instanceof Skeleton)
|
||||||
|
mcUsers.getProfile(attacker).addArcheryGather(5);
|
||||||
|
if(x instanceof Zombie)
|
||||||
|
mcUsers.getProfile(attacker).addArcheryGather(3);
|
||||||
|
if(x instanceof PigZombie)
|
||||||
|
mcUsers.getProfile(attacker).addArcheryGather(7);
|
||||||
|
}
|
||||||
|
if(mcUsers.getProfile(attacker).getArcheryGatherInt() >= mcUsers.getProfile(attacker).getXpToLevel("archery")){
|
||||||
|
int skillups = 0;
|
||||||
|
while(mcUsers.getProfile(attacker).getArcheryGatherInt() >= mcUsers.getProfile(attacker).getXpToLevel("archery")){
|
||||||
|
skillups++;
|
||||||
|
mcUsers.getProfile(attacker).removeArcheryGather(mcUsers.getProfile(attacker).getXpToLevel("archery"));
|
||||||
|
mcUsers.getProfile(attacker).skillUpArchery(1);
|
||||||
|
}
|
||||||
|
attacker.sendMessage(ChatColor.YELLOW+"Archery skill increased by "+skillups+"."+" Total ("+mcUsers.getProfile(attacker).getArchery()+")");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* Defender is Animals
|
||||||
|
*/
|
||||||
|
if(x instanceof Animals){
|
||||||
|
Animals defender = (Animals)x;
|
||||||
|
int healthbefore = defender.getHealth();
|
||||||
|
if(mcUsers.getProfile(attacker).getArcheryInt() >= 50 && mcUsers.getProfile(attacker).getArcheryInt() < 250)
|
||||||
|
defender.setHealth(calculateDamage(defender, 1));
|
||||||
|
if(mcUsers.getProfile(attacker).getArcheryInt() >= 250 && mcUsers.getProfile(attacker).getArcheryInt() < 575)
|
||||||
|
defender.setHealth(calculateDamage(defender, 2));
|
||||||
|
if(mcUsers.getProfile(attacker).getArcheryInt() >= 575 && mcUsers.getProfile(attacker).getArcheryInt() < 725)
|
||||||
|
defender.setHealth(calculateDamage(defender, 3));
|
||||||
|
if(mcUsers.getProfile(attacker).getArcheryInt() >= 725 && mcUsers.getProfile(attacker).getArcheryInt() < 1000)
|
||||||
|
defender.setHealth(calculateDamage(defender, 4));
|
||||||
|
if(mcUsers.getProfile(attacker).getArcheryInt() >= 1000)
|
||||||
|
defender.setHealth(calculateDamage(defender, 5));
|
||||||
|
//If it only would've died from mcMMO damage modifiers
|
||||||
|
if(defender.getHealth() <= 0 && healthbefore - event.getDamage() >= 1){
|
||||||
|
mcm.getInstance().simulateNaturalDrops(defender);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* Defender is Squid
|
||||||
|
*/
|
||||||
|
if(x instanceof Squid){
|
||||||
|
Squid defender = (Squid)x;
|
||||||
|
int healthbefore = defender.getHealth();
|
||||||
|
if(mcUsers.getProfile(attacker).getArcheryInt() >= 50 && mcUsers.getProfile(attacker).getArcheryInt() < 250)
|
||||||
|
defender.setHealth(calculateDamage(defender, 1));
|
||||||
|
if(mcUsers.getProfile(attacker).getArcheryInt() >= 250 && mcUsers.getProfile(attacker).getArcheryInt() < 575)
|
||||||
|
defender.setHealth(calculateDamage(defender, 2));
|
||||||
|
if(mcUsers.getProfile(attacker).getArcheryInt() >= 575 && mcUsers.getProfile(attacker).getArcheryInt() < 725)
|
||||||
|
defender.setHealth(calculateDamage(defender, 3));
|
||||||
|
if(mcUsers.getProfile(attacker).getArcheryInt() >= 725 && mcUsers.getProfile(attacker).getArcheryInt() < 1000)
|
||||||
|
defender.setHealth(calculateDamage(defender, 4));
|
||||||
|
if(mcUsers.getProfile(attacker).getArcheryInt() >= 1000)
|
||||||
|
defender.setHealth(calculateDamage(defender, 5));
|
||||||
|
//If it only would've died from mcMMO damage modifiers
|
||||||
|
if(defender.getHealth() <= 0 && healthbefore - event.getDamage() >= 1){
|
||||||
|
mcm.getInstance().simulateNaturalDrops(defender);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* Attacker is Player
|
||||||
|
*/
|
||||||
|
if(x instanceof Player){
|
||||||
|
if(mcLoadProperties.pvp == false){
|
||||||
|
event.setCancelled(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Player defender = (Player)x;
|
||||||
|
/*
|
||||||
|
* Stuff for the daze proc
|
||||||
|
*/
|
||||||
|
if(mcUsers.getProfile(attacker).inParty() && mcUsers.getProfile(defender).inParty()){
|
||||||
|
if(mcParty.getInstance().inSameParty(defender, attacker)){
|
||||||
|
event.setCancelled(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Location loc = defender.getLocation();
|
||||||
|
if(Math.random() * 10 > 5){
|
||||||
|
loc.setPitch(90);
|
||||||
|
} else {
|
||||||
|
loc.setPitch(-90);
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* Check the proc
|
||||||
|
*/
|
||||||
|
if(mcUsers.getProfile(attacker).getArcheryInt() >= 300 && mcUsers.getProfile(attacker).getArcheryInt() < 400){
|
||||||
|
if(Math.random() * 10 > 7){
|
||||||
|
defender.teleportTo(loc);
|
||||||
|
defender.sendMessage(ChatColor.DARK_RED+"Touched Fuzzy. Felt Dizzy.");
|
||||||
|
attacker.sendMessage("Target was "+ChatColor.DARK_RED+"Dazed");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(mcUsers.getProfile(attacker).getArcheryInt() >= 600){
|
||||||
|
if(Math.random() * 10 > 4){
|
||||||
|
defender.teleportTo(loc);
|
||||||
|
defender.sendMessage(ChatColor.DARK_RED+"Touched Fuzzy. Felt Dizzy.");
|
||||||
|
attacker.sendMessage("Target was "+ChatColor.DARK_RED+"Dazed");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
int healthbefore = defender.getHealth();
|
||||||
|
if(mcUsers.getProfile(attacker).getArcheryInt() >= 50 && mcUsers.getProfile(attacker).getArcheryInt() < 250)
|
||||||
|
defender.setHealth(calculateDamage(defender, 1));
|
||||||
|
if(mcUsers.getProfile(attacker).getArcheryInt() >= 250 && mcUsers.getProfile(attacker).getArcheryInt() < 575)
|
||||||
|
defender.setHealth(calculateDamage(defender, 2));
|
||||||
|
if(mcUsers.getProfile(attacker).getArcheryInt() >= 575 && mcUsers.getProfile(attacker).getArcheryInt() < 725)
|
||||||
|
defender.setHealth(calculateDamage(defender, 3));
|
||||||
|
if(mcUsers.getProfile(attacker).getArcheryInt() >= 725 && mcUsers.getProfile(attacker).getArcheryInt() < 1000)
|
||||||
|
defender.setHealth(calculateDamage(defender, 4));
|
||||||
|
if(mcUsers.getProfile(attacker).getArcheryInt() >= 1000)
|
||||||
|
defender.setHealth(calculateDamage(defender, 5));
|
||||||
|
//If it only would've died from mcMMO damage modifiers
|
||||||
|
if(defender.getHealth() <= 0 && healthbefore - event.getDamage() >= 1){
|
||||||
|
mcm.getInstance().simulateNaturalDrops(defender);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public boolean simulateUnarmedProc(Player player){
|
||||||
|
if(mcUsers.getProfile(player).getUnarmedInt() >= 750){
|
||||||
|
if(Math.random() * 10 > 4){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}if(mcUsers.getProfile(player).getUnarmedInt() >= 350 && mcUsers.getProfile(player).getUnarmedInt() < 750){
|
||||||
|
if(Math.random() * 10 > 4){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
public void bleedCheck(Player attacker, Entity x){
|
||||||
|
if(mcPermissions.getInstance().swords(attacker) && mcm.getInstance().isSwords(attacker.getItemInHand()) && !mcConfig.getInstance().isBleedTracked(x)){
|
||||||
|
if(mcUsers.getProfile(attacker).getSwordsInt() >= 50 && mcUsers.getProfile(attacker).getSwordsInt() < 200){
|
||||||
|
if(Math.random() * 10 > 8){
|
||||||
|
mcConfig.getInstance().addBleedTrack(x);
|
||||||
|
if(x instanceof Player){
|
||||||
|
Player target = (Player)x;
|
||||||
|
mcUsers.getProfile(target).setBleedTicks(4);
|
||||||
|
}
|
||||||
|
attacker.sendMessage(ChatColor.RED+"**Your target is bleeding**");
|
||||||
|
}
|
||||||
|
} else if(mcUsers.getProfile(attacker).getSwordsInt() >= 200 && mcUsers.getProfile(attacker).getSwordsInt() < 600){
|
||||||
|
if(Math.random() * 10 > 6){
|
||||||
|
mcConfig.getInstance().addBleedTrack(x);
|
||||||
|
if(x instanceof Player){
|
||||||
|
Player target = (Player)x;
|
||||||
|
mcUsers.getProfile(target).setBleedTicks(4);
|
||||||
|
}
|
||||||
|
attacker.sendMessage(ChatColor.RED+"**Your target is bleeding**");
|
||||||
|
}
|
||||||
|
} else if(mcUsers.getProfile(attacker).getSwordsInt() >= 600 && mcUsers.getProfile(attacker).getSwordsInt() < 900){
|
||||||
|
if(Math.random() * 10 > 4){
|
||||||
|
mcConfig.getInstance().addBleedTrack(x);
|
||||||
|
if(x instanceof Player){
|
||||||
|
Player target = (Player)x;
|
||||||
|
mcUsers.getProfile(target).setBleedTicks(6);
|
||||||
|
}
|
||||||
|
attacker.sendMessage(ChatColor.RED+"**Your target is bleeding**");
|
||||||
|
}
|
||||||
|
} else if(mcUsers.getProfile(attacker).getSwordsInt() >= 900){
|
||||||
|
if(Math.random() * 100 > 25){
|
||||||
|
mcConfig.getInstance().addBleedTrack(x);
|
||||||
|
if(x instanceof Player){
|
||||||
|
Player target = (Player)x;
|
||||||
|
mcUsers.getProfile(target).setBleedTicks(6);
|
||||||
|
}
|
||||||
|
attacker.sendMessage(ChatColor.RED+"**Your target is bleeding**");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public int axeNerf(int type){
|
||||||
|
//GOLD OR WOOD
|
||||||
|
if(type == 271 || type == 286){
|
||||||
|
return 3;
|
||||||
|
} else if (type == 258){
|
||||||
|
return 1;
|
||||||
|
} else if (type == 275){
|
||||||
|
return 1;
|
||||||
|
} else {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public int calculateDamage(Player player, int dmg){
|
||||||
|
int health = player.getHealth();
|
||||||
|
if(health - dmg <0){
|
||||||
|
return 0;
|
||||||
|
} else {
|
||||||
|
health-= dmg;
|
||||||
|
return health;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public int calculateDamage(Squid squid, int dmg){
|
||||||
|
int health = squid.getHealth();
|
||||||
|
if(health - dmg <0){
|
||||||
|
return 0;
|
||||||
|
} else {
|
||||||
|
health-= dmg;
|
||||||
|
return health;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public int calculateDamage(Monster monster, int dmg){
|
||||||
|
int health = monster.getHealth();
|
||||||
|
if(health - dmg <0){
|
||||||
|
return 0;
|
||||||
|
} else {
|
||||||
|
health-= dmg;
|
||||||
|
return health;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public int calculateDamage(Animals animal, int dmg){
|
||||||
|
int health = animal.getHealth();
|
||||||
|
if(health - dmg <0){
|
||||||
|
return 0;
|
||||||
|
} else {
|
||||||
|
health-= dmg;
|
||||||
|
return health;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public void axeCriticalCheckAnimals(Player attacker, EntityDamageByEntityEvent event, Entity x){
|
||||||
|
if(mcm.getInstance().isAxes(attacker.getItemInHand()) && mcPermissions.getInstance().axes(attacker)){
|
||||||
|
if(mcUsers.getProfile(attacker).getAxesInt() >= 50 && mcUsers.getProfile(attacker).getAxesInt() < 250){
|
||||||
|
if(Math.random() * 100 > 95){
|
||||||
|
if(x instanceof Animals){
|
||||||
|
Animals animal = (Animals)x;
|
||||||
|
animal.setHealth(0);
|
||||||
|
mcm.getInstance().simulateNaturalDrops(x);
|
||||||
|
attacker.sendMessage(ChatColor.RED+"CRITICAL HIT!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(mcUsers.getProfile(attacker).getAxesInt() >= 250 && mcUsers.getProfile(attacker).getAxesInt() < 500){
|
||||||
|
if(Math.random() * 10 > 9){
|
||||||
|
if(x instanceof Animals){
|
||||||
|
Animals animal = (Animals)x;
|
||||||
|
animal.setHealth(0);
|
||||||
|
mcm.getInstance().simulateNaturalDrops(x);
|
||||||
|
attacker.sendMessage(ChatColor.RED+"CRITICAL HIT!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(mcUsers.getProfile(attacker).getAxesInt() >= 500 && mcUsers.getProfile(attacker).getAxesInt() < 750){
|
||||||
|
if(Math.random() * 10 > 8){
|
||||||
|
if(x instanceof Animals){
|
||||||
|
Animals animal = (Animals)x;
|
||||||
|
animal.setHealth(0);
|
||||||
|
mcm.getInstance().simulateNaturalDrops(x);
|
||||||
|
attacker.sendMessage(ChatColor.RED+"CRITICAL HIT!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(mcUsers.getProfile(attacker).getAxesInt() >= 750 && mcUsers.getProfile(attacker).getAxesInt() < 1000){
|
||||||
|
if(Math.random() * 10 > 7){
|
||||||
|
if(x instanceof Animals){
|
||||||
|
Animals animal = (Animals)x;
|
||||||
|
animal.setHealth(0);
|
||||||
|
mcm.getInstance().simulateNaturalDrops(x);
|
||||||
|
attacker.sendMessage(ChatColor.RED+"CRITICAL HIT!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(mcUsers.getProfile(attacker).getAxesInt() >= 1000){
|
||||||
|
if(Math.random() * 10 > 6){
|
||||||
|
if(x instanceof Animals){
|
||||||
|
Animals animal = (Animals)x;
|
||||||
|
animal.setHealth(0);
|
||||||
|
mcm.getInstance().simulateNaturalDrops(x);
|
||||||
|
attacker.sendMessage(ChatColor.RED+"CRITICAL HIT!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public void axeCriticalCheckMonster(Player attacker, EntityDamageByEntityEvent event, Entity x){
|
||||||
|
if(mcm.getInstance().isAxes(attacker.getItemInHand()) && mcPermissions.getInstance().axes(attacker)){
|
||||||
|
if(mcUsers.getProfile(attacker).getAxesInt() >= 50 && mcUsers.getProfile(attacker).getAxesInt() < 250){
|
||||||
|
if(Math.random() * 100 > 95){
|
||||||
|
if(x instanceof Monster){
|
||||||
|
Monster monster = (Monster)x;
|
||||||
|
monster.setHealth(0);
|
||||||
|
mcm.getInstance().simulateNaturalDrops(x);
|
||||||
|
attacker.sendMessage(ChatColor.RED+"CRITICAL HIT!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(mcUsers.getProfile(attacker).getAxesInt() >= 250 && mcUsers.getProfile(attacker).getAxesInt() < 500){
|
||||||
|
if(Math.random() * 10 > 9){
|
||||||
|
if(x instanceof Monster){
|
||||||
|
Monster monster = (Monster)x;
|
||||||
|
monster.setHealth(0);
|
||||||
|
mcm.getInstance().simulateNaturalDrops(x);
|
||||||
|
attacker.sendMessage(ChatColor.RED+"CRITICAL HIT!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(mcUsers.getProfile(attacker).getAxesInt() >= 500 && mcUsers.getProfile(attacker).getAxesInt() < 750){
|
||||||
|
if(Math.random() * 10 > 8){
|
||||||
|
if(x instanceof Monster){
|
||||||
|
Monster monster = (Monster)x;
|
||||||
|
monster.setHealth(0);
|
||||||
|
mcm.getInstance().simulateNaturalDrops(x);
|
||||||
|
attacker.sendMessage(ChatColor.RED+"CRITICAL HIT!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(mcUsers.getProfile(attacker).getAxesInt() >= 750 && mcUsers.getProfile(attacker).getAxesInt() < 1000){
|
||||||
|
if(Math.random() * 10 > 7){
|
||||||
|
if(x instanceof Monster){
|
||||||
|
Monster monster = (Monster)x;
|
||||||
|
monster.setHealth(0);
|
||||||
|
mcm.getInstance().simulateNaturalDrops(x);
|
||||||
|
attacker.sendMessage(ChatColor.RED+"CRITICAL HIT!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(mcUsers.getProfile(attacker).getAxesInt() >= 1000){
|
||||||
|
if(Math.random() * 10 > 6){
|
||||||
|
if(x instanceof Monster){
|
||||||
|
Monster monster = (Monster)x;
|
||||||
|
monster.setHealth(0);
|
||||||
|
mcm.getInstance().simulateNaturalDrops(x);
|
||||||
|
attacker.sendMessage(ChatColor.RED+"CRITICAL HIT!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public void axeCriticalCheckPlayer(Player attacker, EntityDamageByEntityEvent event, Entity x, Plugin plugin){
|
||||||
|
if(mcm.getInstance().isAxes(attacker.getItemInHand()) && mcPermissions.getInstance().axes(attacker)){
|
||||||
|
if(mcUsers.getProfile(attacker).getAxesInt() >= 50 && mcUsers.getProfile(attacker).getAxesInt() < 250){
|
||||||
|
if(Math.random() * 100 > 95){
|
||||||
|
if(x instanceof Player){
|
||||||
|
Player player = (Player)x;
|
||||||
|
player.setHealth(calculateDamage(player, (player.getHealth() - event.getDamage())));
|
||||||
|
attacker.sendMessage(ChatColor.RED+"CRITICAL HIT!");
|
||||||
|
player.sendMessage(ChatColor.DARK_RED + "You were CRITICALLY hit!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(mcUsers.getProfile(attacker).getAxesInt() >= 250 && mcUsers.getProfile(attacker).getAxesInt() < 500){
|
||||||
|
if(Math.random() * 10 > 9){
|
||||||
|
if(x instanceof Player){
|
||||||
|
Player player = (Player)x;
|
||||||
|
player.setHealth(calculateDamage(player, (player.getHealth() - event.getDamage())));
|
||||||
|
attacker.sendMessage(ChatColor.RED+"CRITICAL HIT!");
|
||||||
|
player.sendMessage(ChatColor.DARK_RED + "You were CRITICALLY hit!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(mcUsers.getProfile(attacker).getAxesInt() >= 500 && mcUsers.getProfile(attacker).getAxesInt() < 750){
|
||||||
|
if(Math.random() * 10 > 8){
|
||||||
|
if(x instanceof Player){
|
||||||
|
Player player = (Player)x;
|
||||||
|
player.setHealth(calculateDamage(player, (player.getHealth() - event.getDamage())));
|
||||||
|
attacker.sendMessage(ChatColor.RED+"CRITICAL HIT!");
|
||||||
|
player.sendMessage(ChatColor.DARK_RED + "You were CRITICALLY hit!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(mcUsers.getProfile(attacker).getAxesInt() >= 750 && mcUsers.getProfile(attacker).getAxesInt() < 1000){
|
||||||
|
if(Math.random() * 10 > 7){
|
||||||
|
if(x instanceof Player){
|
||||||
|
Player player = (Player)x;
|
||||||
|
player.setHealth(calculateDamage(player, (player.getHealth() - event.getDamage())));
|
||||||
|
attacker.sendMessage(ChatColor.RED+"CRITICAL HIT!");
|
||||||
|
player.sendMessage(ChatColor.DARK_RED + "You were CRITICALLY hit!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(mcUsers.getProfile(attacker).getAxesInt() >= 1000){
|
||||||
|
if(Math.random() * 10 > 6){
|
||||||
|
if(x instanceof Player){
|
||||||
|
Player player = (Player)x;
|
||||||
|
player.setHealth(calculateDamage(player, (player.getHealth() - event.getDamage())));
|
||||||
|
attacker.sendMessage(ChatColor.RED+"CRITICAL HIT!");
|
||||||
|
player.sendMessage(ChatColor.DARK_RED + "You were CRITICALLY hit!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(x instanceof Player){
|
||||||
|
Player defender = (Player)x;
|
||||||
|
if(defender.getHealth()<= 0 && !mcUsers.getProfile(defender).isDead()){
|
||||||
|
mcUsers.getProfile(defender).setDead(true);
|
||||||
|
event.setCancelled(true); //SEE IF THIS HELPS
|
||||||
|
for(ItemStack herp : defender.getInventory().getContents()){
|
||||||
|
if(herp != null && herp.getTypeId() != 0)
|
||||||
|
defender.getLocation().getWorld().dropItemNaturally(defender.getLocation(), herp);
|
||||||
|
}
|
||||||
|
for(Player derp : plugin.getServer().getOnlinePlayers()){
|
||||||
|
derp.sendMessage(ChatColor.GRAY+attacker.getName() + " has " +ChatColor.DARK_RED+"chopped "+ChatColor.GRAY+defender.getName() + " to death.");
|
||||||
|
mcUsers.getProfile(defender).setDead(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public void parryCheck(Player defender, EntityDamageByEntityEvent event, Entity y){
|
||||||
|
if(mcm.getInstance().isSwords(defender.getItemInHand())
|
||||||
|
&& event.getDamage() > 0
|
||||||
|
&& mcPermissions.getInstance().swords(defender)){
|
||||||
|
if(mcUsers.getProfile(defender).getSwordsInt() >= 50 && mcUsers.getProfile(defender).getSwordsInt() < 250){
|
||||||
|
if(Math.random() * 100 > 95){
|
||||||
|
event.setCancelled(true);
|
||||||
|
defender.sendMessage(ChatColor.YELLOW+"*CLANG* SUCCESSFUL PARRY *CLANG*");
|
||||||
|
defender.getItemInHand().setDurability((short) (defender.getItemInHand().getDurability() + 1));
|
||||||
|
if(y instanceof Player){
|
||||||
|
Player attacker = (Player)y;
|
||||||
|
attacker.sendMessage(ChatColor.DARK_RED+"**TARGET HAS PARRIED THAT ATTACK**");
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(mcUsers.getProfile(defender).getSwordsInt() >= 250 && mcUsers.getProfile(defender).getSwordsInt() < 450){
|
||||||
|
if(Math.random() * 100 > 90){
|
||||||
|
event.setCancelled(true);
|
||||||
|
defender.sendMessage(ChatColor.YELLOW+"*CLANG* SUCCESSFUL PARRY *CLANG*");
|
||||||
|
defender.getItemInHand().setDurability((short) (defender.getItemInHand().getDurability() + 1));
|
||||||
|
if(y instanceof Player){
|
||||||
|
Player attacker = (Player)y;
|
||||||
|
attacker.sendMessage(ChatColor.DARK_RED+"**TARGET HAS PARRIED THAT ATTACK**");
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(mcUsers.getProfile(defender).getSwordsInt() >= 450 && mcUsers.getProfile(defender).getSwordsInt() < 775){
|
||||||
|
if(Math.random() * 100 > 85){
|
||||||
|
event.setCancelled(true);
|
||||||
|
defender.sendMessage(ChatColor.YELLOW+"*CLANG* SUCCESSFUL PARRY *CLANG*");
|
||||||
|
defender.getItemInHand().setDurability((short) (defender.getItemInHand().getDurability() + 1));
|
||||||
|
if(y instanceof Player){
|
||||||
|
Player attacker = (Player)y;
|
||||||
|
attacker.sendMessage(ChatColor.DARK_RED+"**TARGET HAS PARRIED THAT ATTACK**");
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(mcUsers.getProfile(defender).getSwordsInt() >= 775){
|
||||||
|
if(Math.random() * 100 > 80){
|
||||||
|
event.setCancelled(true);
|
||||||
|
defender.sendMessage(ChatColor.YELLOW+"*CLANG* SUCCESSFUL PARRY *CLANG*");
|
||||||
|
defender.getItemInHand().setDurability((short) (defender.getItemInHand().getDurability() + 1));
|
||||||
|
if(y instanceof Player){
|
||||||
|
Player attacker = (Player)y;
|
||||||
|
attacker.sendMessage(ChatColor.DARK_RED+"**TARGET HAS PARRIED THAT ATTACK**");
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public void bleedSimulate(){
|
||||||
|
for(Entity x : mcConfig.getInstance().getBleedTracked()){
|
||||||
|
if(x == null)
|
||||||
|
continue;
|
||||||
|
if(mcm.getInstance().getHealth(x) <= 0)
|
||||||
|
continue;
|
||||||
|
if(x instanceof Animals){
|
||||||
|
Animals animals = (Animals)x;
|
||||||
|
if(animals.getHealth() >= 1){
|
||||||
|
animals.setHealth(mcm.getInstance().calculateMinusHealth(animals.getHealth(), 2));
|
||||||
|
}
|
||||||
|
if(animals.getHealth() <= 0){
|
||||||
|
mcm.getInstance().simulateNaturalDrops(x);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(x instanceof Monster){
|
||||||
|
Monster monster = (Monster)x;
|
||||||
|
if(monster.getHealth() >= 1){
|
||||||
|
monster.setHealth(mcm.getInstance().calculateMinusHealth(monster.getHealth(), 2));
|
||||||
|
}
|
||||||
|
if(monster.getHealth() <= 0){
|
||||||
|
mcm.getInstance().simulateNaturalDrops(x);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(x instanceof Player){
|
||||||
|
Player player = (Player)x;
|
||||||
|
if(player.getHealth() >= 1 && mcUsers.getProfile(player).getBleedTicks() >= 1){
|
||||||
|
player.setHealth(mcm.getInstance().calculateMinusHealth(player.getHealth(), 1));
|
||||||
|
player.sendMessage(ChatColor.RED+"**BLEED**");
|
||||||
|
if(player.getHealth() <= 0){
|
||||||
|
mcUsers.getProfile(player).setBleedTicks(0);
|
||||||
|
for(ItemStack items : player.getInventory().getContents()){
|
||||||
|
if(items.getTypeId() != 0)
|
||||||
|
player.getLocation().getWorld().dropItemNaturally(player.getLocation(), items);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(mcUsers.getProfile(player).getBleedTicks() >= 1){
|
||||||
|
mcUsers.getProfile(player).setBleedTicks(mcUsers.getProfile(player).getBleedTicks() - 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -1,34 +1,24 @@
|
|||||||
package com.gmail.nossr50;
|
package com.gmail.nossr50;
|
||||||
|
|
||||||
import java.io.*;
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.logging.Level;
|
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
import org.bukkit.Location;
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.inventory.ItemStack;
|
|
||||||
import java.util.Map.Entry;
|
|
||||||
|
|
||||||
public class mcConfig {
|
public class mcConfig {
|
||||||
private static volatile mcConfig instance;
|
private static volatile mcConfig instance;
|
||||||
String location = "mcmmo.properties";
|
String location = "mcmmo.properties";
|
||||||
protected static final Logger log = Logger.getLogger("Minecraft");
|
protected static final Logger log = Logger.getLogger("Minecraft");
|
||||||
static ArrayList<String> adminChatList = new ArrayList<String>();
|
static ArrayList<String> adminChatList = new ArrayList<String>();
|
||||||
static ArrayList<String> coordsWatchList = new ArrayList<String>();
|
|
||||||
static ArrayList<Block> blockWatchList = new ArrayList<Block>();
|
static ArrayList<Block> blockWatchList = new ArrayList<Block>();
|
||||||
static ArrayList<String> partyChatList = new ArrayList<String>();
|
static ArrayList<String> partyChatList = new ArrayList<String>();
|
||||||
|
static ArrayList<String> godModeList = new ArrayList<String>();
|
||||||
HashMap<Entity, Integer> arrowTracker = new HashMap<Entity, Integer>();
|
HashMap<Entity, Integer> arrowTracker = new HashMap<Entity, Integer>();
|
||||||
static ArrayList<Entity> bleedTracker = new ArrayList<Entity>();
|
static ArrayList<Entity> bleedTracker = new ArrayList<Entity>();
|
||||||
static ArrayList<Entity> mobSpawnTracker = new ArrayList<Entity>();
|
static ArrayList<Entity> mobSpawnTracker = new ArrayList<Entity>();
|
||||||
public boolean isBlockWatched(Block block) {return blockWatchList.contains(block);}
|
public boolean isBlockWatched(Block block) {return blockWatchList.contains(block);}
|
||||||
public boolean isCoordsWatched(String xyz) {return coordsWatchList.contains(xyz);}
|
|
||||||
public void removeBlockWatch(Block block) {blockWatchList.remove(blockWatchList.indexOf(block));}
|
public void removeBlockWatch(Block block) {blockWatchList.remove(blockWatchList.indexOf(block));}
|
||||||
public void removeCoordsWatch(String xyz) {coordsWatchList.remove(coordsWatchList.indexOf(xyz));}
|
|
||||||
public void addBlockWatch(Block block) {blockWatchList.add(block);}
|
public void addBlockWatch(Block block) {blockWatchList.add(block);}
|
||||||
public void addCoordsWatch(String xyz) {coordsWatchList.add(xyz);}
|
|
||||||
public void addBleedTrack(Entity entity) {bleedTracker.add(entity);}
|
public void addBleedTrack(Entity entity) {bleedTracker.add(entity);}
|
||||||
public void addMobSpawnTrack(Entity entity) {mobSpawnTracker.add(entity);}
|
public void addMobSpawnTrack(Entity entity) {mobSpawnTracker.add(entity);}
|
||||||
public ArrayList<Entity> getBleedTracked() {return bleedTracker;}
|
public ArrayList<Entity> getBleedTracked() {return bleedTracker;}
|
||||||
@ -66,8 +56,11 @@ public class mcConfig {
|
|||||||
}
|
}
|
||||||
public boolean isAdminToggled(String playerName) {return adminChatList.contains(playerName);}
|
public boolean isAdminToggled(String playerName) {return adminChatList.contains(playerName);}
|
||||||
public boolean isPartyToggled(String playerName) {return partyChatList.contains(playerName);}
|
public boolean isPartyToggled(String playerName) {return partyChatList.contains(playerName);}
|
||||||
|
public boolean isGodModeToggled(String playerName) {return godModeList.contains(playerName);}
|
||||||
|
public void removeGodModeToggled(String playerName) {godModeList.remove(godModeList.indexOf(playerName));}
|
||||||
public void removePartyToggled(String playerName) {partyChatList.remove(partyChatList.indexOf(playerName));}
|
public void removePartyToggled(String playerName) {partyChatList.remove(partyChatList.indexOf(playerName));}
|
||||||
public void removeAdminToggled(String playerName) {adminChatList.remove(adminChatList.indexOf(playerName));}
|
public void removeAdminToggled(String playerName) {adminChatList.remove(adminChatList.indexOf(playerName));}
|
||||||
|
public void addGodModeToggled(String playerName) {godModeList.add(playerName);}
|
||||||
public void addPartyToggled(String playerName) {partyChatList.add(playerName);}
|
public void addPartyToggled(String playerName) {partyChatList.add(playerName);}
|
||||||
public void addAdminToggled(String playerName) {adminChatList.add(playerName);}
|
public void addAdminToggled(String playerName) {adminChatList.add(playerName);}
|
||||||
|
|
||||||
@ -84,6 +77,13 @@ public class mcConfig {
|
|||||||
addAdminToggled(playerName);
|
addAdminToggled(playerName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public void toggleGodMode(String playerName){
|
||||||
|
if(isGodModeToggled(playerName)){
|
||||||
|
removeGodModeToggled(playerName);
|
||||||
|
} else {
|
||||||
|
addGodModeToggled(playerName);
|
||||||
|
}
|
||||||
|
}
|
||||||
public void togglePartyChat(String playerName){
|
public void togglePartyChat(String playerName){
|
||||||
if(isPartyToggled(playerName)){
|
if(isPartyToggled(playerName)){
|
||||||
removePartyToggled(playerName);
|
removePartyToggled(playerName);
|
||||||
|
@ -1,23 +1,11 @@
|
|||||||
package com.gmail.nossr50;
|
package com.gmail.nossr50;
|
||||||
|
|
||||||
import org.bukkit.ChatColor;
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.block.Block;
|
|
||||||
import org.bukkit.entity.Animals;
|
import org.bukkit.entity.Animals;
|
||||||
import org.bukkit.entity.Creature;
|
|
||||||
import org.bukkit.entity.Creeper;
|
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.MobType;
|
|
||||||
import org.bukkit.entity.Monster;
|
import org.bukkit.entity.Monster;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.entity.Skeleton;
|
|
||||||
import org.bukkit.entity.Spider;
|
|
||||||
import org.bukkit.entity.Squid;
|
|
||||||
import org.bukkit.entity.Zombie;
|
|
||||||
import org.bukkit.event.Event;
|
|
||||||
import org.bukkit.event.entity.CreatureSpawnEvent;
|
import org.bukkit.event.entity.CreatureSpawnEvent;
|
||||||
import org.bukkit.event.entity.EntityDamageByBlockEvent;
|
|
||||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||||
import org.bukkit.event.entity.EntityDamageByProjectileEvent;
|
import org.bukkit.event.entity.EntityDamageByProjectileEvent;
|
||||||
import org.bukkit.event.entity.EntityDamageEvent;
|
import org.bukkit.event.entity.EntityDamageEvent;
|
||||||
@ -59,7 +47,7 @@ public class mcEntityListener extends EntityListener {
|
|||||||
int y = loc.getBlockY();
|
int y = loc.getBlockY();
|
||||||
int z = loc.getBlockZ();
|
int z = loc.getBlockZ();
|
||||||
if(type == DamageCause.FALL){
|
if(type == DamageCause.FALL){
|
||||||
mcm.getInstance().acrobaticsCheck(player, event, loc, xx, y, z);
|
mcAcrobatics.getInstance().acrobaticsCheck(player, event, loc, xx, y, z);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
@ -67,7 +55,7 @@ public class mcEntityListener extends EntityListener {
|
|||||||
*/
|
*/
|
||||||
if(event instanceof EntityDamageByProjectileEvent){
|
if(event instanceof EntityDamageByProjectileEvent){
|
||||||
EntityDamageByProjectileEvent c = (EntityDamageByProjectileEvent)event;
|
EntityDamageByProjectileEvent c = (EntityDamageByProjectileEvent)event;
|
||||||
mcm.getInstance().archeryCheck(c);
|
mcCombat.getInstance().archeryCheck(c);
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* Entity Damage by Entity checks
|
* Entity Damage by Entity checks
|
||||||
@ -81,22 +69,15 @@ public class mcEntityListener extends EntityListener {
|
|||||||
*/
|
*/
|
||||||
if(e instanceof Player){
|
if(e instanceof Player){
|
||||||
Player defender = (Player)e;
|
Player defender = (Player)e;
|
||||||
|
if(mcConfig.getInstance().isGodModeToggled(defender.getName()))
|
||||||
|
event.setCancelled(true);
|
||||||
if(f instanceof Monster){
|
if(f instanceof Monster){
|
||||||
mcUsers.getProfile(defender).setRecentlyHurt(30);
|
mcUsers.getProfile(defender).setRecentlyHurt(30);
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* PARRYING CHECK, CHECK TO SEE IF ITS A SUCCESSFUL PARRY OR NOT
|
* PARRYING CHECK, CHECK TO SEE IF ITS A SUCCESSFUL PARRY OR NOT
|
||||||
*/
|
*/
|
||||||
mcm.getInstance().parryCheck(defender, eventb, f);
|
mcCombat.getInstance().parryCheck(defender, eventb, f);
|
||||||
/*
|
|
||||||
* PLAYER DEATH BY MONSTER MESSAGE CHECK, CHECKS TO SEE IF TO REPORT THE DEATH OR NOT
|
|
||||||
*/
|
|
||||||
//mcm.getInstance().playerDeathByMonsterMessageCheck(y, defender, plugin);
|
|
||||||
/*
|
|
||||||
* CHECKS IF THE PLAYER DIES, IF SO DROP HIS SHIT BECAUSE OF THE DAMAGE MODIFIERS
|
|
||||||
* MIGHT BE A BIT BUGGY, IT SEEMS TO WORK RIGHT NOW AT LEAST...
|
|
||||||
*/
|
|
||||||
|
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* IF ATTACKER IS PLAYER
|
* IF ATTACKER IS PLAYER
|
||||||
@ -108,20 +89,36 @@ 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.
|
||||||
*/
|
*/
|
||||||
mcm.getInstance().playerVersusMonsterChecks(eventb, attacker, e, typeid);
|
mcCombat.getInstance().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.
|
||||||
*/
|
*/
|
||||||
mcm.getInstance().playerVersusSquidChecks(eventb, attacker, e, typeid);
|
mcCombat.getInstance().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.getInstance().isPvpEnabled())
|
||||||
mcm.getInstance().playerVersusPlayerChecks(e, attacker, eventb, plugin);
|
mcCombat.getInstance().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
|
||||||
*/
|
*/
|
||||||
mcm.getInstance().playerVersusAnimalsChecks(e, attacker, eventb, typeid);
|
mcCombat.getInstance().playerVersusAnimalsChecks(e, attacker, eventb, typeid);
|
||||||
|
}
|
||||||
|
if(f instanceof Player && e instanceof Player && !mcLoadProperties.pvp)
|
||||||
|
event.setCancelled(true);
|
||||||
|
if(e instanceof Monster || e instanceof Animals){
|
||||||
|
if(e instanceof Monster){
|
||||||
|
Monster monster = (Monster)e;
|
||||||
|
if(monster.getHealth() <= 0){
|
||||||
|
mcConfig.getInstance().removeBleedTrack(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(e instanceof Animals){
|
||||||
|
Animals animals = (Animals)e;
|
||||||
|
if(animals.getHealth() <= 0){
|
||||||
|
mcConfig.getInstance().removeBleedTrack(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
157
mcMMO/com/gmail/nossr50/mcExcavation.java
Normal file
157
mcMMO/com/gmail/nossr50/mcExcavation.java
Normal file
@ -0,0 +1,157 @@
|
|||||||
|
package com.gmail.nossr50;
|
||||||
|
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.block.Block;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
|
public class mcExcavation {
|
||||||
|
private static mcMMO plugin;
|
||||||
|
public mcExcavation(mcMMO instance) {
|
||||||
|
plugin = instance;
|
||||||
|
}
|
||||||
|
private static volatile mcExcavation instance;
|
||||||
|
public static mcExcavation getInstance() {
|
||||||
|
if (instance == null) {
|
||||||
|
instance = new mcExcavation(plugin);
|
||||||
|
}
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void excavationProcCheck(Block block, Player player){
|
||||||
|
int type = block.getTypeId();
|
||||||
|
Location loc = block.getLocation();
|
||||||
|
ItemStack is = null;
|
||||||
|
Material mat = null;
|
||||||
|
if(type == 2 && mcUsers.getProfile(player).getExcavationInt() > 250){
|
||||||
|
//CHANCE TO GET EGGS
|
||||||
|
if(mcLoadProperties.eggs == true && Math.random() * 100 > 99){
|
||||||
|
mcUsers.getProfile(player).addExcavationGather(10);
|
||||||
|
mat = Material.getMaterial(344);
|
||||||
|
is = new ItemStack(mat, 1, (byte)0, (byte)0);
|
||||||
|
loc.getWorld().dropItemNaturally(loc, is);
|
||||||
|
}
|
||||||
|
//CHANCE TO GET APPLES
|
||||||
|
if(mcLoadProperties.apples == true && Math.random() * 100 > 99){
|
||||||
|
mcUsers.getProfile(player).addExcavationGather(10);
|
||||||
|
mat = Material.getMaterial(260);
|
||||||
|
is = new ItemStack(mat, 1, (byte)0, (byte)0);
|
||||||
|
loc.getWorld().dropItemNaturally(loc, is);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//DIRT SAND OR GRAVEL
|
||||||
|
if(type == 3 || type == 13 || type == 2 || type == 12){
|
||||||
|
mcUsers.getProfile(player).addExcavationGather(3);
|
||||||
|
if(mcUsers.getProfile(player).getExcavationInt() > 750){
|
||||||
|
//CHANCE TO GET CAKE
|
||||||
|
if(mcLoadProperties.cake == true && Math.random() * 2000 > 1999){
|
||||||
|
mcUsers.getProfile(player).addExcavationGather(300);
|
||||||
|
mat = Material.getMaterial(354);
|
||||||
|
is = new ItemStack(mat, 1, (byte)0, (byte)0);
|
||||||
|
loc.getWorld().dropItemNaturally(loc, is);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(mcUsers.getProfile(player).getExcavationInt() > 150){
|
||||||
|
//CHANCE TO GET MUSIC
|
||||||
|
if(mcLoadProperties.music == true && Math.random() * 2000 > 1999){
|
||||||
|
mcUsers.getProfile(player).addExcavationGather(300);
|
||||||
|
mat = Material.getMaterial(2256);
|
||||||
|
is = new ItemStack(mat, 1, (byte)0, (byte)0);
|
||||||
|
loc.getWorld().dropItemNaturally(loc, is);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
if(mcUsers.getProfile(player).getExcavationInt() > 350){
|
||||||
|
//CHANCE TO GET DIAMOND
|
||||||
|
if(mcLoadProperties.diamond == true && Math.random() * 500 > 499){
|
||||||
|
mcUsers.getProfile(player).addExcavationGather(100);
|
||||||
|
mat = Material.getMaterial(264);
|
||||||
|
is = new ItemStack(mat, 1, (byte)0, (byte)0);
|
||||||
|
loc.getWorld().dropItemNaturally(loc, is);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(mcUsers.getProfile(player).getExcavationInt() > 250){
|
||||||
|
//CHANCE TO GET MUSIC
|
||||||
|
if(mcLoadProperties.music == true && Math.random() * 2000 > 1999){
|
||||||
|
mcUsers.getProfile(player).addExcavationGather(300);
|
||||||
|
mat = Material.getMaterial(2257);
|
||||||
|
is = new ItemStack(mat, 1, (byte)0, (byte)0);
|
||||||
|
loc.getWorld().dropItemNaturally(loc, is);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//SAND
|
||||||
|
if(type == 12){
|
||||||
|
//CHANCE TO GET GLOWSTONE
|
||||||
|
if(mcLoadProperties.glowstone == true && mcUsers.getProfile(player).getExcavationInt() > 50 && Math.random() * 100 > 95){
|
||||||
|
mcUsers.getProfile(player).addExcavationGather(3);
|
||||||
|
mat = Material.getMaterial(348);
|
||||||
|
is = new ItemStack(mat, 1, (byte)0, (byte)0);
|
||||||
|
loc.getWorld().dropItemNaturally(loc, is);
|
||||||
|
}
|
||||||
|
//CHANCE TO GET SLOWSAND
|
||||||
|
if(mcLoadProperties.slowsand == true && mcUsers.getProfile(player).getExcavationInt() > 650 && Math.random() * 200 > 199){
|
||||||
|
mcUsers.getProfile(player).addExcavationGather(5);
|
||||||
|
mat = Material.getMaterial(88);
|
||||||
|
is = new ItemStack(mat, 1, (byte)0, (byte)0);
|
||||||
|
loc.getWorld().dropItemNaturally(loc, is);
|
||||||
|
}
|
||||||
|
//CHANCE TO GET DIAMOND
|
||||||
|
if(mcLoadProperties.diamond == true && mcUsers.getProfile(player).getExcavationInt() > 500 && Math.random() * 500 > 499){
|
||||||
|
mcUsers.getProfile(player).addExcavationGather(100);
|
||||||
|
mat = Material.getMaterial(264);
|
||||||
|
is = new ItemStack(mat, 1, (byte)0, (byte)0);
|
||||||
|
loc.getWorld().dropItemNaturally(loc, is);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//GRASS OR DIRT
|
||||||
|
if((type == 2 || type == 3) && mcUsers.getProfile(player).getExcavationInt() > 25){
|
||||||
|
//CHANCE TO GET GLOWSTONE
|
||||||
|
if(mcLoadProperties.glowstone == true && Math.random() * 100 > 95){
|
||||||
|
mcUsers.getProfile(player).addExcavationGather(5);
|
||||||
|
mat = Material.getMaterial(348);
|
||||||
|
is = new ItemStack(mat, 1, (byte)0, (byte)0);
|
||||||
|
loc.getWorld().dropItemNaturally(loc, is);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//GRAVEL
|
||||||
|
if(type == 13){
|
||||||
|
//CHANCE TO GET NETHERRACK
|
||||||
|
if(mcLoadProperties.netherrack == true && mcUsers.getProfile(player).getExcavationInt() > 850 && Math.random() * 200 > 199){
|
||||||
|
mcUsers.getProfile(player).addExcavationGather(3);
|
||||||
|
mat = Material.getMaterial(87);
|
||||||
|
is = new ItemStack(mat, 1, (byte)0, (byte)0);
|
||||||
|
loc.getWorld().dropItemNaturally(loc, is);
|
||||||
|
}
|
||||||
|
//CHANCE TO GET SULPHUR
|
||||||
|
if(mcLoadProperties.sulphur == true && mcUsers.getProfile(player).getExcavationInt() > 75){
|
||||||
|
if(Math.random() * 10 > 9){
|
||||||
|
mcUsers.getProfile(player).addExcavationGather(3);
|
||||||
|
mat = Material.getMaterial(289);
|
||||||
|
is = new ItemStack(mat, 1, (byte)0, (byte)0);
|
||||||
|
loc.getWorld().dropItemNaturally(loc, is);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//CHANCE TO GET BONES
|
||||||
|
if(mcLoadProperties.bones == true && mcUsers.getProfile(player).getExcavationInt() > 175){
|
||||||
|
if(Math.random() * 10 > 6){
|
||||||
|
mcUsers.getProfile(player).addExcavationGather(3);
|
||||||
|
mat = Material.getMaterial(352);
|
||||||
|
is = new ItemStack(mat, 1, (byte)0, (byte)0);
|
||||||
|
loc.getWorld().dropItemNaturally(loc, is);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(mcUsers.getProfile(player).getExcavationGatherInt() >= mcUsers.getProfile(player).getXpToLevel("excavation")){
|
||||||
|
int skillups = 0;
|
||||||
|
while(mcUsers.getProfile(player).getExcavationGatherInt() >= mcUsers.getProfile(player).getXpToLevel("excavation")){
|
||||||
|
skillups++;
|
||||||
|
mcUsers.getProfile(player).removeExcavationGather(mcUsers.getProfile(player).getXpToLevel("excavation"));
|
||||||
|
mcUsers.getProfile(player).skillUpExcavation(1);
|
||||||
|
}
|
||||||
|
player.sendMessage(ChatColor.YELLOW+"Excavation skill increased by "+skillups+"."+" Total ("+mcUsers.getProfile(player).getExcavation()+")");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
113
mcMMO/com/gmail/nossr50/mcHerbalism.java
Normal file
113
mcMMO/com/gmail/nossr50/mcHerbalism.java
Normal file
@ -0,0 +1,113 @@
|
|||||||
|
package com.gmail.nossr50;
|
||||||
|
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.block.Block;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
|
public class mcHerbalism {
|
||||||
|
private static mcMMO plugin;
|
||||||
|
public mcHerbalism(mcMMO instance) {
|
||||||
|
plugin = instance;
|
||||||
|
}
|
||||||
|
private static volatile mcHerbalism instance;
|
||||||
|
public static mcHerbalism getInstance() {
|
||||||
|
if (instance == null) {
|
||||||
|
instance = new mcHerbalism(plugin);
|
||||||
|
}
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
public void herbalismProcCheck(Block block, Player player){
|
||||||
|
int type = block.getTypeId();
|
||||||
|
Location loc = block.getLocation();
|
||||||
|
ItemStack is = null;
|
||||||
|
Material mat = null;
|
||||||
|
//player.sendMessage("mcMMO DEBUG: Data ("+block.getData()+")"+" TYPEID ("+block.getTypeId()+")");
|
||||||
|
if(type == 59 && block.getData() == (byte) 0x7){
|
||||||
|
mat = Material.getMaterial(296);
|
||||||
|
is = new ItemStack(mat, 1, (byte)0, (byte)0);
|
||||||
|
mcUsers.getProfile(player).addHerbalismGather(5);
|
||||||
|
if(mcUsers.getProfile(player).getHerbalismInt() >= 50 && mcUsers.getProfile(player).getHerbalismInt() < 150){
|
||||||
|
if(Math.random() * 10 > 8)
|
||||||
|
loc.getWorld().dropItemNaturally(loc, is);
|
||||||
|
}
|
||||||
|
if(mcUsers.getProfile(player).getHerbalismInt() >= 150 && mcUsers.getProfile(player).getHerbalismInt() < 350 ){
|
||||||
|
if(Math.random() * 10 > 6)
|
||||||
|
loc.getWorld().dropItemNaturally(loc, is);
|
||||||
|
}
|
||||||
|
if(mcUsers.getProfile(player).getHerbalismInt() >= 350 && mcUsers.getProfile(player).getHerbalismInt() < 500 ){
|
||||||
|
if(Math.random() * 10 > 4)
|
||||||
|
loc.getWorld().dropItemNaturally(loc, is);
|
||||||
|
}
|
||||||
|
if(mcUsers.getProfile(player).getHerbalismInt() >= 500 && mcUsers.getProfile(player).getHerbalismInt() < 750 ){
|
||||||
|
if(Math.random() * 10 > 2)
|
||||||
|
loc.getWorld().dropItemNaturally(loc, is);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* We need to check not-wheat stuff for if it was placed by the player or not
|
||||||
|
*/
|
||||||
|
if(!mcConfig.getInstance().isBlockWatched(block)){
|
||||||
|
//player.sendMessage("DEBUG CODE 2");
|
||||||
|
if(type == 39 || type == 40){
|
||||||
|
mcUsers.getProfile(player).addHerbalismGather(10);
|
||||||
|
}
|
||||||
|
if(type == 37 || type == 38){
|
||||||
|
mcUsers.getProfile(player).addHerbalismGather(3);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(mcUsers.getProfile(player).getHerbalismGatherInt() >= mcUsers.getProfile(player).getXpToLevel("herbalism")){
|
||||||
|
int skillups = 0;
|
||||||
|
while(mcUsers.getProfile(player).getHerbalismGatherInt() >= mcUsers.getProfile(player).getXpToLevel("herbalism")){
|
||||||
|
skillups++;
|
||||||
|
mcUsers.getProfile(player).removeHerbalismGather(mcUsers.getProfile(player).getXpToLevel("herbalism"));
|
||||||
|
mcUsers.getProfile(player).skillUpHerbalism(1);
|
||||||
|
}
|
||||||
|
player.sendMessage(ChatColor.YELLOW+"Herbalism skill increased by "+skillups+"."+" Total ("+mcUsers.getProfile(player).getHerbalism()+")");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public void breadCheck(Player player, ItemStack is){
|
||||||
|
if(is.getTypeId() == 297){
|
||||||
|
if(mcUsers.getProfile(player).getHerbalismInt() >= 50 && mcUsers.getProfile(player).getHerbalismInt() < 150){
|
||||||
|
player.setHealth(player.getHealth() + 1);
|
||||||
|
} else if (mcUsers.getProfile(player).getHerbalismInt() >= 150 && mcUsers.getProfile(player).getHerbalismInt() < 250){
|
||||||
|
player.setHealth(player.getHealth() + 2);
|
||||||
|
} else if (mcUsers.getProfile(player).getHerbalismInt() >= 250 && mcUsers.getProfile(player).getHerbalismInt() < 350){
|
||||||
|
player.setHealth(player.getHealth() + 3);
|
||||||
|
} else if (mcUsers.getProfile(player).getHerbalismInt() >= 350 && mcUsers.getProfile(player).getHerbalismInt() < 450){
|
||||||
|
player.setHealth(player.getHealth() + 4);
|
||||||
|
} else if (mcUsers.getProfile(player).getHerbalismInt() >= 450 && mcUsers.getProfile(player).getHerbalismInt() < 550){
|
||||||
|
player.setHealth(player.getHealth() + 5);
|
||||||
|
} else if (mcUsers.getProfile(player).getHerbalismInt() >= 550 && mcUsers.getProfile(player).getHerbalismInt() < 650){
|
||||||
|
player.setHealth(player.getHealth() + 6);
|
||||||
|
} else if (mcUsers.getProfile(player).getHerbalismInt() >= 650 && mcUsers.getProfile(player).getHerbalismInt() < 750){
|
||||||
|
player.setHealth(player.getHealth() + 7);
|
||||||
|
} else if (mcUsers.getProfile(player).getHerbalismInt() >= 750){
|
||||||
|
player.setHealth(player.getHealth() + 8);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public void stewCheck(Player player, ItemStack is){
|
||||||
|
if(is.getTypeId() == 282){
|
||||||
|
if(mcUsers.getProfile(player).getHerbalismInt() >= 50 && mcUsers.getProfile(player).getHerbalismInt() < 150){
|
||||||
|
player.setHealth(player.getHealth() + 1);
|
||||||
|
} else if (mcUsers.getProfile(player).getHerbalismInt() >= 150 && mcUsers.getProfile(player).getHerbalismInt() < 250){
|
||||||
|
player.setHealth(player.getHealth() + 2);
|
||||||
|
} else if (mcUsers.getProfile(player).getHerbalismInt() >= 250 && mcUsers.getProfile(player).getHerbalismInt() < 350){
|
||||||
|
player.setHealth(player.getHealth() + 3);
|
||||||
|
} else if (mcUsers.getProfile(player).getHerbalismInt() >= 350 && mcUsers.getProfile(player).getHerbalismInt() < 450){
|
||||||
|
player.setHealth(player.getHealth() + 4);
|
||||||
|
} else if (mcUsers.getProfile(player).getHerbalismInt() >= 450 && mcUsers.getProfile(player).getHerbalismInt() < 550){
|
||||||
|
player.setHealth(player.getHealth() + 5);
|
||||||
|
} else if (mcUsers.getProfile(player).getHerbalismInt() >= 550 && mcUsers.getProfile(player).getHerbalismInt() < 650){
|
||||||
|
player.setHealth(player.getHealth() + 6);
|
||||||
|
} else if (mcUsers.getProfile(player).getHerbalismInt() >= 650 && mcUsers.getProfile(player).getHerbalismInt() < 750){
|
||||||
|
player.setHealth(player.getHealth() + 7);
|
||||||
|
} else if (mcUsers.getProfile(player).getHerbalismInt() >= 750){
|
||||||
|
player.setHealth(player.getHealth() + 8);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -2,7 +2,7 @@ package com.gmail.nossr50;
|
|||||||
|
|
||||||
public class mcLoadProperties {
|
public class mcLoadProperties {
|
||||||
public static Boolean pvp, eggs, apples, myspawnclearsinventory, cake, music, diamond, glowstone, slowsand, sulphur, netherrack, bones, coal, clay, anvilmessages;
|
public static Boolean pvp, eggs, apples, myspawnclearsinventory, cake, music, diamond, glowstone, slowsand, sulphur, netherrack, bones, coal, clay, anvilmessages;
|
||||||
public static String mcmmo, mcc, stats, mmoedit, ptp, party, myspawn, setmyspawn, whois, invite, accept, clearmyspawn;
|
public static String mcmmo, mcc, mcgod, stats, mmoedit, ptp, party, myspawn, setmyspawn, whois, invite, accept, clearmyspawn;
|
||||||
public static int globalxpmodifier, miningxpmodifier, repairxpmodifier, woodcuttingxpmodifier, unarmedxpmodifier, herbalismxpmodifier, excavationxpmodifier, archeryxpmodifier, swordsxpmodifier, axesxpmodifier, acrobaticsxpmodifier;
|
public static int globalxpmodifier, miningxpmodifier, repairxpmodifier, woodcuttingxpmodifier, unarmedxpmodifier, herbalismxpmodifier, excavationxpmodifier, archeryxpmodifier, swordsxpmodifier, axesxpmodifier, acrobaticsxpmodifier;
|
||||||
|
|
||||||
public static void loadMain(){
|
public static void loadMain(){
|
||||||
@ -52,6 +52,7 @@ public class mcLoadProperties {
|
|||||||
*/
|
*/
|
||||||
mcmmo = properties.getString("/mcmmo", "mcmmo");
|
mcmmo = properties.getString("/mcmmo", "mcmmo");
|
||||||
mcc = properties.getString("/mcc", "mcc");
|
mcc = properties.getString("/mcc", "mcc");
|
||||||
|
mcgod = properties.getString("/mcgod", "mcgod");
|
||||||
stats = properties.getString("/stats", "stats");
|
stats = properties.getString("/stats", "stats");
|
||||||
mmoedit = properties.getString("/mmoedit", "mmoedit");
|
mmoedit = properties.getString("/mmoedit", "mmoedit");
|
||||||
ptp = properties.getString("/ptp", "ptp");
|
ptp = properties.getString("/ptp", "ptp");
|
||||||
|
@ -2,22 +2,16 @@ package com.gmail.nossr50;
|
|||||||
import com.nijikokun.bukkit.Permissions.Permissions;
|
import com.nijikokun.bukkit.Permissions.Permissions;
|
||||||
import com.nijiko.Messaging;
|
import com.nijiko.Messaging;
|
||||||
import com.nijiko.permissions.PermissionHandler;
|
import com.nijiko.permissions.PermissionHandler;
|
||||||
import com.nijiko.permissions.Control;
|
|
||||||
import com.nijikokun.bukkit.Permissions.Permissions;
|
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileWriter;
|
import java.io.FileWriter;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Timer;
|
import java.util.Timer;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
import org.bukkit.event.player.*;
|
|
||||||
import org.bukkit.Server;
|
|
||||||
import org.bukkit.event.Event.Priority;
|
import org.bukkit.event.Event.Priority;
|
||||||
import org.bukkit.event.Event;
|
import org.bukkit.event.Event;
|
||||||
import org.bukkit.plugin.PluginDescriptionFile;
|
import org.bukkit.plugin.PluginDescriptionFile;
|
||||||
import org.bukkit.plugin.PluginLoader;
|
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
import org.bukkit.plugin.PluginManager;
|
import org.bukkit.plugin.PluginManager;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -30,8 +24,7 @@ public class mcMMO extends JavaPlugin {
|
|||||||
private final mcPlayerListener playerListener = new mcPlayerListener(this);
|
private final mcPlayerListener playerListener = new mcPlayerListener(this);
|
||||||
private final mcBlockListener blockListener = new mcBlockListener(this);
|
private final mcBlockListener blockListener = new mcBlockListener(this);
|
||||||
private final mcEntityListener entityListener = new mcEntityListener(this);
|
private final mcEntityListener entityListener = new mcEntityListener(this);
|
||||||
private final mcServerListener serverListener = new mcServerListener(this);
|
//private final mcServerListener serverListener = new mcServerListener(this);
|
||||||
private final HashMap<Player, Boolean> debugees = new HashMap<Player, Boolean>();
|
|
||||||
private final String name = "mcMMO";
|
private final String name = "mcMMO";
|
||||||
public static PermissionHandler PermissionsHandler = null;
|
public static PermissionHandler PermissionsHandler = null;
|
||||||
private Permissions permissions;
|
private Permissions permissions;
|
||||||
@ -71,7 +64,6 @@ public class mcMMO extends JavaPlugin {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
//Load the file
|
//Load the file
|
||||||
//sup
|
|
||||||
mcLoadProperties.loadMain();
|
mcLoadProperties.loadMain();
|
||||||
mcUsers.getInstance().loadUsers();
|
mcUsers.getInstance().loadUsers();
|
||||||
PluginManager pm = getServer().getPluginManager();
|
PluginManager pm = getServer().getPluginManager();
|
||||||
@ -120,7 +112,6 @@ public class mcMMO extends JavaPlugin {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Permissions getPermissions() {
|
public Permissions getPermissions() {
|
||||||
return permissions;
|
return permissions;
|
||||||
}
|
}
|
||||||
|
140
mcMMO/com/gmail/nossr50/mcMining.java
Normal file
140
mcMMO/com/gmail/nossr50/mcMining.java
Normal file
@ -0,0 +1,140 @@
|
|||||||
|
package com.gmail.nossr50;
|
||||||
|
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.block.Block;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
|
public class mcMining {
|
||||||
|
private static mcMMO plugin;
|
||||||
|
public mcMining(mcMMO instance) {
|
||||||
|
plugin = instance;
|
||||||
|
}
|
||||||
|
private static volatile mcMining instance;
|
||||||
|
public static mcMining getInstance() {
|
||||||
|
if (instance == null) {
|
||||||
|
instance = new mcMining(plugin);
|
||||||
|
}
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
public void blockProcSimulate(Block block){
|
||||||
|
Location loc = block.getLocation();
|
||||||
|
Material mat = Material.getMaterial(block.getTypeId());
|
||||||
|
byte damage = 0;
|
||||||
|
ItemStack item = new ItemStack(mat, 1, (byte)0, damage);
|
||||||
|
if(block.getTypeId() != 73 && block.getTypeId() != 74 && block.getTypeId() != 56 && block.getTypeId() != 21 && block.getTypeId() != 1 && block.getTypeId() != 16)
|
||||||
|
loc.getWorld().dropItemNaturally(loc, item);
|
||||||
|
//hurrdurr
|
||||||
|
if(block.getTypeId() == 73 || block.getTypeId() == 74){
|
||||||
|
mat = Material.getMaterial(331);
|
||||||
|
item = new ItemStack(mat, 1, (byte)0, damage);
|
||||||
|
loc.getWorld().dropItemNaturally(loc, item);
|
||||||
|
loc.getWorld().dropItemNaturally(loc, item);
|
||||||
|
loc.getWorld().dropItemNaturally(loc, item);
|
||||||
|
if(Math.random() * 10 > 5){
|
||||||
|
loc.getWorld().dropItemNaturally(loc, item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(block.getTypeId() == 21){
|
||||||
|
mat = Material.getMaterial(351);
|
||||||
|
item = new ItemStack(mat, 1, (byte)0,(byte)0x4);
|
||||||
|
loc.getWorld().dropItemNaturally(loc, item);
|
||||||
|
loc.getWorld().dropItemNaturally(loc, item);
|
||||||
|
loc.getWorld().dropItemNaturally(loc, item);
|
||||||
|
loc.getWorld().dropItemNaturally(loc, item);
|
||||||
|
}
|
||||||
|
if(block.getTypeId() == 56){
|
||||||
|
mat = Material.getMaterial(264);
|
||||||
|
item = new ItemStack(mat, 1, (byte)0, damage);
|
||||||
|
loc.getWorld().dropItemNaturally(loc, item);
|
||||||
|
}
|
||||||
|
if(block.getTypeId() == 1){
|
||||||
|
mat = Material.getMaterial(4);
|
||||||
|
item = new ItemStack(mat, 1, (byte)0, damage);
|
||||||
|
loc.getWorld().dropItemNaturally(loc, item);
|
||||||
|
}
|
||||||
|
if(block.getTypeId() == 16){
|
||||||
|
mat = Material.getMaterial(263);
|
||||||
|
item = new ItemStack(mat, 1, (byte)0, damage);
|
||||||
|
loc.getWorld().dropItemNaturally(loc, item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public void blockProcCheck(Block block, Player player){
|
||||||
|
if(mcUsers.getProfile(player).getMiningInt() > 2000){
|
||||||
|
blockProcSimulate(block);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if(mcUsers.getProfile(player).getMiningInt() > 1250){
|
||||||
|
if((Math.random() * 10) > 2){
|
||||||
|
blockProcSimulate(block);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(mcUsers.getProfile(player).getMiningInt() > 750){
|
||||||
|
if((Math.random() * 10) > 4){
|
||||||
|
blockProcSimulate(block);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(mcUsers.getProfile(player).getMiningInt() > 150){
|
||||||
|
if((Math.random() * 10) > 6){
|
||||||
|
blockProcSimulate(block);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(mcUsers.getProfile(player).getMiningInt() > 25){
|
||||||
|
if((Math.random() * 10) > 8){
|
||||||
|
blockProcSimulate(block);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public void miningBlockCheck(Player player, Block block){
|
||||||
|
if(block.getTypeId() == 1){
|
||||||
|
mcUsers.getProfile(player).addMiningGather(1);
|
||||||
|
blockProcCheck(block, player);
|
||||||
|
}
|
||||||
|
//COAL
|
||||||
|
if(block.getTypeId() == 16){
|
||||||
|
mcUsers.getProfile(player).addMiningGather(5);
|
||||||
|
blockProcCheck(block, player);
|
||||||
|
}
|
||||||
|
//GOLD
|
||||||
|
if(block.getTypeId() == 14){
|
||||||
|
mcUsers.getProfile(player).addMiningGather(35);
|
||||||
|
blockProcCheck(block, player);
|
||||||
|
}
|
||||||
|
//DIAMOND
|
||||||
|
if(block.getTypeId() == 56){
|
||||||
|
mcUsers.getProfile(player).addMiningGather(75);
|
||||||
|
blockProcCheck(block, player);
|
||||||
|
}
|
||||||
|
//IRON
|
||||||
|
if(block.getTypeId() == 15){
|
||||||
|
mcUsers.getProfile(player).addMiningGather(20);
|
||||||
|
blockProcCheck(block, player);
|
||||||
|
}
|
||||||
|
//REDSTONE
|
||||||
|
if(block.getTypeId() == 73 || block.getTypeId() == 74){
|
||||||
|
mcUsers.getProfile(player).addMiningGather(15);
|
||||||
|
blockProcCheck(block, player);
|
||||||
|
}
|
||||||
|
//LAPUS
|
||||||
|
if(block.getTypeId() == 21){
|
||||||
|
mcUsers.getProfile(player).addMiningGather(40);
|
||||||
|
blockProcCheck(block, player);
|
||||||
|
}
|
||||||
|
if(mcUsers.getProfile(player).getMiningGatherInt() >= mcUsers.getProfile(player).getXpToLevel("mining")){
|
||||||
|
int skillups = 0;
|
||||||
|
while(mcUsers.getProfile(player).getMiningGatherInt() >= mcUsers.getProfile(player).getXpToLevel("mining")){
|
||||||
|
skillups++;
|
||||||
|
mcUsers.getProfile(player).removeMiningGather(mcUsers.getProfile(player).getXpToLevel("mining"));
|
||||||
|
mcUsers.getProfile(player).skillUpMining(1);
|
||||||
|
}
|
||||||
|
player.sendMessage(ChatColor.YELLOW+"Mining skill increased by "+skillups+"."+" Total ("+mcUsers.getProfile(player).getMining()+")");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
58
mcMMO/com/gmail/nossr50/mcParty.java
Normal file
58
mcMMO/com/gmail/nossr50/mcParty.java
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
package com.gmail.nossr50;
|
||||||
|
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
public class mcParty {
|
||||||
|
private static mcMMO plugin;
|
||||||
|
public mcParty(mcMMO instance) {
|
||||||
|
plugin = instance;
|
||||||
|
}
|
||||||
|
private static volatile mcParty instance;
|
||||||
|
public static mcParty getInstance() {
|
||||||
|
if (instance == null) {
|
||||||
|
instance = new mcParty(plugin);
|
||||||
|
}
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
public boolean inSameParty(Player playera, Player playerb){
|
||||||
|
if(mcUsers.getProfile(playera).getParty().equals(mcUsers.getProfile(playerb).getParty())){
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public int partyCount(Player player, Player[] players){
|
||||||
|
int x = 0;
|
||||||
|
for(Player hurrdurr : players){
|
||||||
|
if(player != null && hurrdurr != null){
|
||||||
|
if(mcUsers.getProfile(player).getParty().equals(mcUsers.getProfile(hurrdurr).getParty()))
|
||||||
|
x++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return x;
|
||||||
|
}
|
||||||
|
public void informPartyMembers(Player player, Player[] players){
|
||||||
|
int x = 0;
|
||||||
|
for(Player p : players){
|
||||||
|
if(player != null && p != null){
|
||||||
|
if(inSameParty(player, p) && !p.getName().equals(player.getName())){
|
||||||
|
p.sendMessage(player.getName() + ChatColor.GREEN + " has joined your party");
|
||||||
|
x++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public void informPartyMembersQuit(Player player, Player[] players){
|
||||||
|
int x = 0;
|
||||||
|
for(Player p : players){
|
||||||
|
if(player != null && p != null){
|
||||||
|
if(inSameParty(player, p) && !p.getName().equals(player.getName())){
|
||||||
|
p.sendMessage(player.getName() + ChatColor.GREEN + " has left your party");
|
||||||
|
x++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -37,6 +37,13 @@ public class mcPermissions {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public boolean mcgod(Player player) {
|
||||||
|
if (permissionsEnabled) {
|
||||||
|
return permission(player, "mcmmo.tools.mcgod");
|
||||||
|
} else {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
public boolean regeneration(Player player){
|
public boolean regeneration(Player player){
|
||||||
if (permissionsEnabled) {
|
if (permissionsEnabled) {
|
||||||
return permission(player, "mcmmo.regeneration");
|
return permission(player, "mcmmo.regeneration");
|
||||||
|
@ -5,22 +5,16 @@ import java.util.logging.Logger;
|
|||||||
|
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.World;
|
|
||||||
import org.bukkit.World.Environment;
|
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.player.PlayerChatEvent;
|
import org.bukkit.event.player.PlayerChatEvent;
|
||||||
import org.bukkit.event.player.PlayerEvent;
|
import org.bukkit.event.player.PlayerEvent;
|
||||||
import org.bukkit.event.player.PlayerItemEvent;
|
import org.bukkit.event.player.PlayerItemEvent;
|
||||||
import org.bukkit.event.player.PlayerItemHeldEvent;
|
|
||||||
import org.bukkit.event.player.PlayerListener;
|
import org.bukkit.event.player.PlayerListener;
|
||||||
import org.bukkit.event.player.PlayerLoginEvent;
|
import org.bukkit.event.player.PlayerLoginEvent;
|
||||||
import org.bukkit.plugin.*;
|
|
||||||
import org.bukkit.event.player.PlayerRespawnEvent;
|
import org.bukkit.event.player.PlayerRespawnEvent;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
import com.nijikokun.bukkit.Permissions.Permissions;
|
|
||||||
|
|
||||||
public class mcPlayerListener extends PlayerListener {
|
public class mcPlayerListener extends PlayerListener {
|
||||||
protected static final Logger log = Logger.getLogger("Minecraft");
|
protected static final Logger log = Logger.getLogger("Minecraft");
|
||||||
public Location spawn = null;
|
public Location spawn = null;
|
||||||
@ -30,16 +24,15 @@ public class mcPlayerListener extends PlayerListener {
|
|||||||
plugin = instance;
|
plugin = instance;
|
||||||
}
|
}
|
||||||
public void onPlayerRespawn(PlayerRespawnEvent event) {
|
public void onPlayerRespawn(PlayerRespawnEvent event) {
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
|
if(player != null){
|
||||||
Location mySpawn = mcUsers.getProfile(player).getMySpawn(player);
|
Location mySpawn = mcUsers.getProfile(player).getMySpawn(player);
|
||||||
if(mcUsers.getProfile(player).getMySpawnWorld() != null && !mcUsers.getProfile(player).getMySpawnWorld().equals("")){
|
if(mcUsers.getProfile(player).getMySpawnWorld(plugin) != null && !mcUsers.getProfile(player).getMySpawnWorld(plugin).equals("") && plugin.getServer().getWorld(mcUsers.getProfile(player).getMySpawnWorld(plugin)) != null)
|
||||||
if(plugin.getServer().getWorld(mcUsers.getProfile(player).getMySpawnWorld()) != null)
|
mySpawn.setWorld(plugin.getServer().getWorld(mcUsers.getProfile(player).getMySpawnWorld(plugin)));
|
||||||
mySpawn.setWorld(plugin.getServer().getWorld(mcUsers.getProfile(player).getMySpawnWorld()));
|
if(mcPermissions.getInstance().mySpawn(player) && mySpawn != null){
|
||||||
}
|
|
||||||
if(mcPermissions.getInstance().mySpawn(player)){
|
|
||||||
if(mcUsers.getProfile(player).getMySpawn(player) != null)
|
|
||||||
event.setRespawnLocation(mySpawn);
|
event.setRespawnLocation(mySpawn);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
public Player[] getPlayersOnline() {
|
public Player[] getPlayersOnline() {
|
||||||
return plugin.getServer().getOnlinePlayers();
|
return plugin.getServer().getOnlinePlayers();
|
||||||
@ -60,32 +53,6 @@ public class mcPlayerListener extends PlayerListener {
|
|||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
public int partyCount(Player player){
|
|
||||||
int x = 0;
|
|
||||||
for(Player hurrdurr: getPlayersOnline()){
|
|
||||||
if(mcUsers.getProfile(player).getParty().equals(mcUsers.getProfile(hurrdurr).getParty()))
|
|
||||||
x++;
|
|
||||||
}
|
|
||||||
return x;
|
|
||||||
}
|
|
||||||
public void informPartyMembers(Player player){
|
|
||||||
int x = 0;
|
|
||||||
for(Player p : getPlayersOnline()){
|
|
||||||
if(mcm.getInstance().inSameParty(player, p) && !p.getName().equals(player.getName())){
|
|
||||||
p.sendMessage(player.getName() + ChatColor.GREEN + " has joined your party");
|
|
||||||
x++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public void informPartyMembersQuit(Player player){
|
|
||||||
int x = 0;
|
|
||||||
for(Player p : getPlayersOnline()){
|
|
||||||
if(mcm.getInstance().inSameParty(player, p) && !p.getName().equals(player.getName())){
|
|
||||||
p.sendMessage(player.getName() + ChatColor.GREEN + " has left your party");
|
|
||||||
x++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public void onPlayerLogin(PlayerLoginEvent event) {
|
public void onPlayerLogin(PlayerLoginEvent event) {
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
mcUsers.addUser(player);
|
mcUsers.addUser(player);
|
||||||
@ -104,13 +71,13 @@ public class mcPlayerListener extends PlayerListener {
|
|||||||
ItemStack is = player.getItemInHand();
|
ItemStack is = player.getItemInHand();
|
||||||
if(mcPermissions.getInstance().herbalism(player)){
|
if(mcPermissions.getInstance().herbalism(player)){
|
||||||
//BREADCHECK, CHECKS HERBALISM SKILL FOR BREAD HP MODIFIERS
|
//BREADCHECK, CHECKS HERBALISM SKILL FOR BREAD HP MODIFIERS
|
||||||
mcm.getInstance().breadCheck(player, is);
|
mcHerbalism.getInstance().breadCheck(player, is);
|
||||||
//STEW, CHECKS HERBALISM SKILL FOR BREAD HP MODIFIERS
|
//STEW, CHECKS HERBALISM SKILL FOR BREAD HP MODIFIERS
|
||||||
mcm.getInstance().stewCheck(player, is);
|
mcHerbalism.getInstance().stewCheck(player, is);
|
||||||
}
|
}
|
||||||
if(mcPermissions.getInstance().repair(player)){
|
if(mcPermissions.getInstance().repair(player)){
|
||||||
//REPAIRCHECK, CHECKS TO MAKE SURE PLAYER IS RIGHT CLICKING AN ANVIL, PLAYER HAS ENOUGH RESOURCES, AND THE ITEM IS NOT AT FULL DURABILITY.
|
//REPAIRCHECK, CHECKS TO MAKE SURE PLAYER IS RIGHT CLICKING AN ANVIL, PLAYER HAS ENOUGH RESOURCES, AND THE ITEM IS NOT AT FULL DURABILITY.
|
||||||
mcm.getInstance().repairCheck(player, is, block);
|
mcRepair.getInstance().repairCheck(player, is, block);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public void onPlayerCommandPreprocess(PlayerChatEvent event){
|
public void onPlayerCommandPreprocess(PlayerChatEvent event){
|
||||||
@ -120,8 +87,22 @@ public class mcPlayerListener extends PlayerListener {
|
|||||||
//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.getInstance().mcmmoHelpCheck(split, player, event);
|
||||||
/*
|
/*
|
||||||
* MMOEDIT COMMAND
|
* GODMODE COMMAND
|
||||||
*/
|
*/
|
||||||
|
if(mcPermissions.permissionsEnabled && split[0].equalsIgnoreCase("/"+mcLoadProperties.mcgod)){
|
||||||
|
event.setCancelled(true);
|
||||||
|
if(!mcPermissions.getInstance().mcgod(player)){
|
||||||
|
player.sendMessage(ChatColor.YELLOW+"[mcMMO]"+ChatColor.DARK_RED +" Insufficient permissions.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if(mcConfig.getInstance().isGodModeToggled(playerName)){
|
||||||
|
player.sendMessage(ChatColor.YELLOW+"mcMMO Godmode Disabled");
|
||||||
|
mcConfig.getInstance().toggleGodMode(playerName);
|
||||||
|
} else {
|
||||||
|
player.sendMessage(ChatColor.YELLOW+"mcMMO Godmode Enabled");
|
||||||
|
mcConfig.getInstance().toggleGodMode(playerName);
|
||||||
|
}
|
||||||
|
}
|
||||||
if(mcPermissions.getInstance().mySpawn(player) && split[0].equalsIgnoreCase("/"+mcLoadProperties.clearmyspawn)){
|
if(mcPermissions.getInstance().mySpawn(player) && split[0].equalsIgnoreCase("/"+mcLoadProperties.clearmyspawn)){
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
double x = plugin.getServer().getWorlds().get(0).getSpawnLocation().getX();
|
double x = plugin.getServer().getWorlds().get(0).getSpawnLocation().getX();
|
||||||
@ -141,14 +122,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]) && mcm.getInstance().isSkill(split[2])){
|
if(isPlayer(split[1]) && mcm.getInstance().isInt(split[3]) && mcSkills.getInstance().isSkill(split[2])){
|
||||||
int newvalue = Integer.valueOf(split[3]);
|
int newvalue = Integer.valueOf(split[3]);
|
||||||
mcUsers.getProfile(getPlayer(split[1])).modifyskill(newvalue, split[2]);
|
mcUsers.getProfile(getPlayer(split[1])).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]) && mcm.getInstance().isSkill(split[1])){
|
if(mcm.getInstance().isInt(split[2]) && mcSkills.getInstance().isSkill(split[1])){
|
||||||
int newvalue = Integer.valueOf(split[2]);
|
int newvalue = Integer.valueOf(split[2]);
|
||||||
mcUsers.getProfile(player).modifyskill(newvalue, split[1]);
|
mcUsers.getProfile(player).modifyskill(newvalue, split[1]);
|
||||||
player.sendMessage(ChatColor.RED+split[1]+" has been modified.");
|
player.sendMessage(ChatColor.RED+split[1]+" has been modified.");
|
||||||
@ -198,34 +179,44 @@ public class mcPlayerListener extends PlayerListener {
|
|||||||
player.sendMessage("Party: "+mcUsers.getProfile(target).getParty());
|
player.sendMessage("Party: "+mcUsers.getProfile(target).getParty());
|
||||||
player.sendMessage("Health: "+target.getHealth()+ChatColor.GRAY+" (20 is full health)");
|
player.sendMessage("Health: "+target.getHealth()+ChatColor.GRAY+" (20 is full health)");
|
||||||
player.sendMessage("OP: " + target.isOp());
|
player.sendMessage("OP: " + target.isOp());
|
||||||
player.sendMessage(ChatColor.GREEN+"~~mcMMO stats~~");
|
player.sendMessage(ChatColor.GREEN+"mcMMO Stats for "+ChatColor.YELLOW+target.getName());
|
||||||
|
if(mcPermissions.getInstance().mining(target))
|
||||||
player.sendMessage(ChatColor.YELLOW + "Mining Skill: " + ChatColor.GREEN + mcUsers.getProfile(target).getMining()+ChatColor.DARK_AQUA
|
player.sendMessage(ChatColor.YELLOW + "Mining Skill: " + ChatColor.GREEN + mcUsers.getProfile(target).getMining()+ChatColor.DARK_AQUA
|
||||||
+ " XP("+mcUsers.getProfile(target).getMiningGather()
|
+ " XP("+mcUsers.getProfile(target).getMiningGather()
|
||||||
+"/"+mcUsers.getProfile(target).getXpToLevel("mining")+")");
|
+"/"+mcUsers.getProfile(target).getXpToLevel("mining")+")");
|
||||||
|
if(mcPermissions.getInstance().repair(target))
|
||||||
player.sendMessage(ChatColor.YELLOW + "Repair Skill: "+ ChatColor.GREEN + mcUsers.getProfile(target).getRepair()+ChatColor.DARK_AQUA
|
player.sendMessage(ChatColor.YELLOW + "Repair Skill: "+ ChatColor.GREEN + mcUsers.getProfile(target).getRepair()+ChatColor.DARK_AQUA
|
||||||
+ " XP("+mcUsers.getProfile(target).getRepairGather()
|
+ " XP("+mcUsers.getProfile(target).getRepairGather()
|
||||||
+"/"+mcUsers.getProfile(target).getXpToLevel("repair")+")");
|
+"/"+mcUsers.getProfile(target).getXpToLevel("repair")+")");
|
||||||
|
if(mcPermissions.getInstance().woodcutting(target))
|
||||||
player.sendMessage(ChatColor.YELLOW + "Woodcutting Skill: "+ ChatColor.GREEN + mcUsers.getProfile(target).getWoodCutting()+ChatColor.DARK_AQUA
|
player.sendMessage(ChatColor.YELLOW + "Woodcutting Skill: "+ ChatColor.GREEN + mcUsers.getProfile(target).getWoodCutting()+ChatColor.DARK_AQUA
|
||||||
+ " XP("+mcUsers.getProfile(target).getWoodCuttingGather()
|
+ " XP("+mcUsers.getProfile(target).getWoodCuttingGather()
|
||||||
+"/"+mcUsers.getProfile(target).getXpToLevel("woodcutting")+")");
|
+"/"+mcUsers.getProfile(target).getXpToLevel("woodcutting")+")");
|
||||||
|
if(mcPermissions.getInstance().unarmed(target))
|
||||||
player.sendMessage(ChatColor.YELLOW + "Unarmed Skill: " + ChatColor.GREEN + mcUsers.getProfile(target).getUnarmed()+ChatColor.DARK_AQUA
|
player.sendMessage(ChatColor.YELLOW + "Unarmed Skill: " + ChatColor.GREEN + mcUsers.getProfile(target).getUnarmed()+ChatColor.DARK_AQUA
|
||||||
+ " XP("+mcUsers.getProfile(target).getUnarmedGather()
|
+ " XP("+mcUsers.getProfile(target).getUnarmedGather()
|
||||||
+"/"+mcUsers.getProfile(target).getXpToLevel("unarmed")+")");
|
+"/"+mcUsers.getProfile(target).getXpToLevel("unarmed")+")");
|
||||||
|
if(mcPermissions.getInstance().herbalism(target))
|
||||||
player.sendMessage(ChatColor.YELLOW + "Herbalism Skill: "+ ChatColor.GREEN + mcUsers.getProfile(target).getHerbalism()+ChatColor.DARK_AQUA
|
player.sendMessage(ChatColor.YELLOW + "Herbalism Skill: "+ ChatColor.GREEN + mcUsers.getProfile(target).getHerbalism()+ChatColor.DARK_AQUA
|
||||||
+ " XP("+mcUsers.getProfile(target).getHerbalismGather()
|
+ " XP("+mcUsers.getProfile(target).getHerbalismGather()
|
||||||
+"/"+mcUsers.getProfile(target).getXpToLevel("herbalism")+")");
|
+"/"+mcUsers.getProfile(target).getXpToLevel("herbalism")+")");
|
||||||
|
if(mcPermissions.getInstance().excavation(target))
|
||||||
player.sendMessage(ChatColor.YELLOW + "Excavation Skill: "+ ChatColor.GREEN + mcUsers.getProfile(target).getExcavation()+ChatColor.DARK_AQUA
|
player.sendMessage(ChatColor.YELLOW + "Excavation Skill: "+ ChatColor.GREEN + mcUsers.getProfile(target).getExcavation()+ChatColor.DARK_AQUA
|
||||||
+ " XP("+mcUsers.getProfile(target).getExcavationGather()
|
+ " XP("+mcUsers.getProfile(target).getExcavationGather()
|
||||||
+"/"+mcUsers.getProfile(target).getXpToLevel("excavation")+")");
|
+"/"+mcUsers.getProfile(target).getXpToLevel("excavation")+")");
|
||||||
|
if(mcPermissions.getInstance().archery(target))
|
||||||
player.sendMessage(ChatColor.YELLOW + "Archery Skill: " + ChatColor.GREEN + mcUsers.getProfile(target).getArchery()+ChatColor.DARK_AQUA
|
player.sendMessage(ChatColor.YELLOW + "Archery Skill: " + ChatColor.GREEN + mcUsers.getProfile(target).getArchery()+ChatColor.DARK_AQUA
|
||||||
+ " XP("+mcUsers.getProfile(target).getArcheryGather()
|
+ " XP("+mcUsers.getProfile(target).getArcheryGather()
|
||||||
+"/"+mcUsers.getProfile(target).getXpToLevel("archery")+")");
|
+"/"+mcUsers.getProfile(target).getXpToLevel("archery")+")");
|
||||||
|
if(mcPermissions.getInstance().swords(target))
|
||||||
player.sendMessage(ChatColor.YELLOW + "Swords Skill: " + ChatColor.GREEN + mcUsers.getProfile(target).getSwords()+ChatColor.DARK_AQUA
|
player.sendMessage(ChatColor.YELLOW + "Swords Skill: " + ChatColor.GREEN + mcUsers.getProfile(target).getSwords()+ChatColor.DARK_AQUA
|
||||||
+ " XP("+mcUsers.getProfile(target).getSwordsGather()
|
+ " XP("+mcUsers.getProfile(target).getSwordsGather()
|
||||||
+"/"+mcUsers.getProfile(target).getXpToLevel("swords")+")");
|
+"/"+mcUsers.getProfile(target).getXpToLevel("swords")+")");
|
||||||
|
if(mcPermissions.getInstance().axes(target))
|
||||||
player.sendMessage(ChatColor.YELLOW + "Axes Skill: " + ChatColor.GREEN + mcUsers.getProfile(target).getAxes()+ChatColor.DARK_AQUA
|
player.sendMessage(ChatColor.YELLOW + "Axes Skill: " + ChatColor.GREEN + mcUsers.getProfile(target).getAxes()+ChatColor.DARK_AQUA
|
||||||
+ " XP("+mcUsers.getProfile(target).getAxesGather()
|
+ " XP("+mcUsers.getProfile(target).getAxesGather()
|
||||||
+"/"+mcUsers.getProfile(target).getXpToLevel("axes")+")");
|
+"/"+mcUsers.getProfile(target).getXpToLevel("axes")+")");
|
||||||
|
if(mcPermissions.getInstance().acrobatics(target))
|
||||||
player.sendMessage(ChatColor.YELLOW + "Acrobatics Skill: " + ChatColor.GREEN + mcUsers.getProfile(target).getAcrobatics()+ChatColor.DARK_AQUA
|
player.sendMessage(ChatColor.YELLOW + "Acrobatics Skill: " + ChatColor.GREEN + mcUsers.getProfile(target).getAcrobatics()+ChatColor.DARK_AQUA
|
||||||
+ " XP("+mcUsers.getProfile(target).getAcrobaticsGather()
|
+ " XP("+mcUsers.getProfile(target).getAcrobaticsGather()
|
||||||
+"/"+mcUsers.getProfile(target).getXpToLevel("acrobatics")+")");
|
+"/"+mcUsers.getProfile(target).getXpToLevel("acrobatics")+")");
|
||||||
@ -268,34 +259,46 @@ public class mcPlayerListener extends PlayerListener {
|
|||||||
*/
|
*/
|
||||||
if(split[0].equalsIgnoreCase("/"+mcLoadProperties.stats)){
|
if(split[0].equalsIgnoreCase("/"+mcLoadProperties.stats)){
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
player.sendMessage(ChatColor.DARK_RED + "mcMMO stats");
|
player.sendMessage(ChatColor.GREEN + "Your mcMMO Stats");
|
||||||
|
if(mcPermissions.getInstance().permissionsEnabled)
|
||||||
|
player.sendMessage(ChatColor.DARK_GRAY+"If you don't have access to a skill it will not be shown here.");
|
||||||
|
if(mcPermissions.getInstance().mining(player))
|
||||||
player.sendMessage(ChatColor.YELLOW + "Mining Skill: " + ChatColor.GREEN + mcUsers.getProfile(player).getMining()+ChatColor.DARK_AQUA
|
player.sendMessage(ChatColor.YELLOW + "Mining Skill: " + ChatColor.GREEN + mcUsers.getProfile(player).getMining()+ChatColor.DARK_AQUA
|
||||||
+ " XP("+mcUsers.getProfile(player).getMiningGather()
|
+ " XP("+mcUsers.getProfile(player).getMiningGather()
|
||||||
+"/"+mcUsers.getProfile(player).getXpToLevel("mining")+")");
|
+"/"+mcUsers.getProfile(player).getXpToLevel("mining")+")");
|
||||||
|
if(mcPermissions.getInstance().repair(player))
|
||||||
player.sendMessage(ChatColor.YELLOW + "Repair Skill: "+ ChatColor.GREEN + mcUsers.getProfile(player).getRepair()+ChatColor.DARK_AQUA
|
player.sendMessage(ChatColor.YELLOW + "Repair Skill: "+ ChatColor.GREEN + mcUsers.getProfile(player).getRepair()+ChatColor.DARK_AQUA
|
||||||
+ " XP("+mcUsers.getProfile(player).getRepairGather()
|
+ " XP("+mcUsers.getProfile(player).getRepairGather()
|
||||||
+"/"+mcUsers.getProfile(player).getXpToLevel("repair")+")");
|
+"/"+mcUsers.getProfile(player).getXpToLevel("repair")+")");
|
||||||
|
if(mcPermissions.getInstance().woodcutting(player))
|
||||||
player.sendMessage(ChatColor.YELLOW + "Woodcutting Skill: "+ ChatColor.GREEN + mcUsers.getProfile(player).getWoodCutting()+ChatColor.DARK_AQUA
|
player.sendMessage(ChatColor.YELLOW + "Woodcutting Skill: "+ ChatColor.GREEN + mcUsers.getProfile(player).getWoodCutting()+ChatColor.DARK_AQUA
|
||||||
+ " XP("+mcUsers.getProfile(player).getWoodCuttingGather()
|
+ " XP("+mcUsers.getProfile(player).getWoodCuttingGather()
|
||||||
+"/"+mcUsers.getProfile(player).getXpToLevel("woodcutting")+")");
|
+"/"+mcUsers.getProfile(player).getXpToLevel("woodcutting")+")");
|
||||||
|
if(mcPermissions.getInstance().unarmed(player))
|
||||||
player.sendMessage(ChatColor.YELLOW + "Unarmed Skill: " + ChatColor.GREEN + mcUsers.getProfile(player).getUnarmed()+ChatColor.DARK_AQUA
|
player.sendMessage(ChatColor.YELLOW + "Unarmed Skill: " + ChatColor.GREEN + mcUsers.getProfile(player).getUnarmed()+ChatColor.DARK_AQUA
|
||||||
+ " XP("+mcUsers.getProfile(player).getUnarmedGather()
|
+ " XP("+mcUsers.getProfile(player).getUnarmedGather()
|
||||||
+"/"+mcUsers.getProfile(player).getXpToLevel("unarmed")+")");
|
+"/"+mcUsers.getProfile(player).getXpToLevel("unarmed")+")");
|
||||||
|
if(mcPermissions.getInstance().herbalism(player))
|
||||||
player.sendMessage(ChatColor.YELLOW + "Herbalism Skill: "+ ChatColor.GREEN + mcUsers.getProfile(player).getHerbalism()+ChatColor.DARK_AQUA
|
player.sendMessage(ChatColor.YELLOW + "Herbalism Skill: "+ ChatColor.GREEN + mcUsers.getProfile(player).getHerbalism()+ChatColor.DARK_AQUA
|
||||||
+ " XP("+mcUsers.getProfile(player).getHerbalismGather()
|
+ " XP("+mcUsers.getProfile(player).getHerbalismGather()
|
||||||
+"/"+mcUsers.getProfile(player).getXpToLevel("herbalism")+")");
|
+"/"+mcUsers.getProfile(player).getXpToLevel("herbalism")+")");
|
||||||
|
if(mcPermissions.getInstance().excavation(player))
|
||||||
player.sendMessage(ChatColor.YELLOW + "Excavation Skill: "+ ChatColor.GREEN + mcUsers.getProfile(player).getExcavation()+ChatColor.DARK_AQUA
|
player.sendMessage(ChatColor.YELLOW + "Excavation Skill: "+ ChatColor.GREEN + mcUsers.getProfile(player).getExcavation()+ChatColor.DARK_AQUA
|
||||||
+ " XP("+mcUsers.getProfile(player).getExcavationGather()
|
+ " XP("+mcUsers.getProfile(player).getExcavationGather()
|
||||||
+"/"+mcUsers.getProfile(player).getXpToLevel("excavation")+")");
|
+"/"+mcUsers.getProfile(player).getXpToLevel("excavation")+")");
|
||||||
|
if(mcPermissions.getInstance().archery(player))
|
||||||
player.sendMessage(ChatColor.YELLOW + "Archery Skill: " + ChatColor.GREEN + mcUsers.getProfile(player).getArchery()+ChatColor.DARK_AQUA
|
player.sendMessage(ChatColor.YELLOW + "Archery Skill: " + ChatColor.GREEN + mcUsers.getProfile(player).getArchery()+ChatColor.DARK_AQUA
|
||||||
+ " XP("+mcUsers.getProfile(player).getArcheryGather()
|
+ " XP("+mcUsers.getProfile(player).getArcheryGather()
|
||||||
+"/"+mcUsers.getProfile(player).getXpToLevel("archery")+")");
|
+"/"+mcUsers.getProfile(player).getXpToLevel("archery")+")");
|
||||||
|
if(mcPermissions.getInstance().swords(player))
|
||||||
player.sendMessage(ChatColor.YELLOW + "Swords Skill: " + ChatColor.GREEN + mcUsers.getProfile(player).getSwords()+ChatColor.DARK_AQUA
|
player.sendMessage(ChatColor.YELLOW + "Swords Skill: " + ChatColor.GREEN + mcUsers.getProfile(player).getSwords()+ChatColor.DARK_AQUA
|
||||||
+ " XP("+mcUsers.getProfile(player).getSwordsGather()
|
+ " XP("+mcUsers.getProfile(player).getSwordsGather()
|
||||||
+"/"+mcUsers.getProfile(player).getXpToLevel("swords")+")");
|
+"/"+mcUsers.getProfile(player).getXpToLevel("swords")+")");
|
||||||
|
if(mcPermissions.getInstance().axes(player))
|
||||||
player.sendMessage(ChatColor.YELLOW + "Axes Skill: " + ChatColor.GREEN + mcUsers.getProfile(player).getAxes()+ChatColor.DARK_AQUA
|
player.sendMessage(ChatColor.YELLOW + "Axes Skill: " + ChatColor.GREEN + mcUsers.getProfile(player).getAxes()+ChatColor.DARK_AQUA
|
||||||
+ " XP("+mcUsers.getProfile(player).getAxesGather()
|
+ " XP("+mcUsers.getProfile(player).getAxesGather()
|
||||||
+"/"+mcUsers.getProfile(player).getXpToLevel("axes")+")");
|
+"/"+mcUsers.getProfile(player).getXpToLevel("axes")+")");
|
||||||
|
if(mcPermissions.getInstance().acrobatics(player))
|
||||||
player.sendMessage(ChatColor.YELLOW + "Acrobatics Skill: " + ChatColor.GREEN + mcUsers.getProfile(player).getAcrobatics()+ChatColor.DARK_AQUA
|
player.sendMessage(ChatColor.YELLOW + "Acrobatics Skill: " + ChatColor.GREEN + mcUsers.getProfile(player).getAcrobatics()+ChatColor.DARK_AQUA
|
||||||
+ " XP("+mcUsers.getProfile(player).getAcrobaticsGather()
|
+ " XP("+mcUsers.getProfile(player).getAcrobaticsGather()
|
||||||
+"/"+mcUsers.getProfile(player).getXpToLevel("acrobatics")+")");
|
+"/"+mcUsers.getProfile(player).getXpToLevel("acrobatics")+")");
|
||||||
@ -334,10 +337,10 @@ public class mcPlayerListener extends PlayerListener {
|
|||||||
if(mcPermissions.getInstance().party(player) && split[0].equalsIgnoreCase("/"+mcLoadProperties.accept)){
|
if(mcPermissions.getInstance().party(player) && split[0].equalsIgnoreCase("/"+mcLoadProperties.accept)){
|
||||||
if(mcUsers.getProfile(player).hasPartyInvite()){
|
if(mcUsers.getProfile(player).hasPartyInvite()){
|
||||||
if(mcUsers.getProfile(player).inParty()){
|
if(mcUsers.getProfile(player).inParty()){
|
||||||
informPartyMembersQuit(player);
|
mcParty.getInstance().informPartyMembersQuit(player, getPlayersOnline());
|
||||||
}
|
}
|
||||||
mcUsers.getProfile(player).acceptInvite();
|
mcUsers.getProfile(player).acceptInvite();
|
||||||
informPartyMembers(player);
|
mcParty.getInstance().informPartyMembers(player, getPlayersOnline());
|
||||||
player.sendMessage(ChatColor.GREEN+"Invite accepted. You have joined party ("+mcUsers.getProfile(player).getParty()+")");
|
player.sendMessage(ChatColor.GREEN+"Invite accepted. You have joined party ("+mcUsers.getProfile(player).getParty()+")");
|
||||||
} else {
|
} else {
|
||||||
player.sendMessage(ChatColor.RED+"You have no invites at this time");
|
player.sendMessage(ChatColor.RED+"You have no invites at this time");
|
||||||
@ -360,11 +363,11 @@ public class mcPlayerListener extends PlayerListener {
|
|||||||
for(Player p : plugin.getServer().getOnlinePlayers())
|
for(Player p : plugin.getServer().getOnlinePlayers())
|
||||||
{
|
{
|
||||||
if(mcUsers.getProfile(player).getParty().equals(mcUsers.getProfile(p).getParty())){
|
if(mcUsers.getProfile(player).getParty().equals(mcUsers.getProfile(p).getParty())){
|
||||||
if(p != null && x+1 >= partyCount(player)){
|
if(p != null && x+1 >= mcParty.getInstance().partyCount(player, getPlayersOnline())){
|
||||||
tempList+= p.getName();
|
tempList+= p.getName();
|
||||||
x++;
|
x++;
|
||||||
}
|
}
|
||||||
if(p != null && x < partyCount(player)){
|
if(p != null && x < mcParty.getInstance().partyCount(player, getPlayersOnline())){
|
||||||
tempList+= p.getName() +", ";
|
tempList+= p.getName() +", ";
|
||||||
x++;
|
x++;
|
||||||
}
|
}
|
||||||
@ -374,18 +377,18 @@ public class mcPlayerListener extends PlayerListener {
|
|||||||
player.sendMessage(ChatColor.GREEN + "Party Members ("+ChatColor.WHITE+tempList+ChatColor.GREEN+")");
|
player.sendMessage(ChatColor.GREEN + "Party Members ("+ChatColor.WHITE+tempList+ChatColor.GREEN+")");
|
||||||
}
|
}
|
||||||
if(split.length > 1 && split[1].equals("q") && mcUsers.getProfile(player).inParty()){
|
if(split.length > 1 && split[1].equals("q") && mcUsers.getProfile(player).inParty()){
|
||||||
informPartyMembersQuit(player);
|
mcParty.getInstance().informPartyMembersQuit(player, getPlayersOnline());
|
||||||
mcUsers.getProfile(player).removeParty();
|
mcUsers.getProfile(player).removeParty();
|
||||||
player.sendMessage(ChatColor.RED + "You have left that party");
|
player.sendMessage(ChatColor.RED + "You have left that party");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(split.length >= 2){
|
if(split.length >= 2){
|
||||||
if(mcUsers.getProfile(player).inParty())
|
if(mcUsers.getProfile(player).inParty())
|
||||||
informPartyMembersQuit(player);
|
mcParty.getInstance().informPartyMembersQuit(player, getPlayersOnline());
|
||||||
mcUsers.getProfile(player).setParty(split[1]);
|
mcUsers.getProfile(player).setParty(split[1]);
|
||||||
player.sendMessage("Joined Party: " + split[1]);
|
player.sendMessage("Joined Party: " + split[1]);
|
||||||
informPartyMembers(player);
|
mcParty.getInstance().informPartyMembers(player, getPlayersOnline());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(split[0].equalsIgnoreCase("/p")){
|
if(split[0].equalsIgnoreCase("/p")){
|
||||||
if(!mcPermissions.getInstance().party(player)){
|
if(!mcPermissions.getInstance().party(player)){
|
||||||
@ -432,8 +435,8 @@ public class mcPlayerListener extends PlayerListener {
|
|||||||
player.setHealth(20);
|
player.setHealth(20);
|
||||||
Location mySpawn = mcUsers.getProfile(player).getMySpawn(player);
|
Location mySpawn = mcUsers.getProfile(player).getMySpawn(player);
|
||||||
//player.sendMessage("mcMMO DEBUG CODE 1");
|
//player.sendMessage("mcMMO DEBUG CODE 1");
|
||||||
if(mcUsers.getProfile(player).getMySpawnWorld() != null && !mcUsers.getProfile(player).getMySpawnWorld().equals("")){
|
if(mcUsers.getProfile(player).getMySpawnWorld(plugin) != null && !mcUsers.getProfile(player).getMySpawnWorld(plugin).equals("")){
|
||||||
mySpawn.setWorld(plugin.getServer().getWorld(mcUsers.getProfile(player).getMySpawnWorld()));
|
mySpawn.setWorld(plugin.getServer().getWorld(mcUsers.getProfile(player).getMySpawnWorld(plugin)));
|
||||||
//player.sendMessage("mcMMO DEBUG CODE 2");
|
//player.sendMessage("mcMMO DEBUG CODE 2");
|
||||||
} else {
|
} else {
|
||||||
//player.sendMessage("mcMMO DEBUG CODE 5");
|
//player.sendMessage("mcMMO DEBUG CODE 5");
|
||||||
@ -459,7 +462,7 @@ public class mcPlayerListener extends PlayerListener {
|
|||||||
log.log(Level.INFO, "[P]("+mcUsers.getProfile(player).getParty()+")"+"<"+player.getName()+"> "+event.getMessage());
|
log.log(Level.INFO, "[P]("+mcUsers.getProfile(player).getParty()+")"+"<"+player.getName()+"> "+event.getMessage());
|
||||||
for(Player herp : plugin.getServer().getOnlinePlayers()){
|
for(Player herp : plugin.getServer().getOnlinePlayers()){
|
||||||
if(mcUsers.getProfile(herp).inParty()){
|
if(mcUsers.getProfile(herp).inParty()){
|
||||||
if(mcm.getInstance().inSameParty(herp, player)){
|
if(mcParty.getInstance().inSameParty(herp, player)){
|
||||||
herp.sendMessage(x+event.getMessage());
|
herp.sendMessage(x+event.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
375
mcMMO/com/gmail/nossr50/mcRepair.java
Normal file
375
mcMMO/com/gmail/nossr50/mcRepair.java
Normal file
@ -0,0 +1,375 @@
|
|||||||
|
package com.gmail.nossr50;
|
||||||
|
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
|
import org.bukkit.block.Block;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
|
public class mcRepair {
|
||||||
|
private static mcMMO plugin;
|
||||||
|
public mcRepair(mcMMO instance) {
|
||||||
|
plugin = instance;
|
||||||
|
}
|
||||||
|
private static volatile mcRepair instance;
|
||||||
|
public static mcRepair getInstance() {
|
||||||
|
if (instance == null) {
|
||||||
|
instance = new mcRepair(plugin);
|
||||||
|
}
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
public void repairCheck(Player player, ItemStack is, Block block){
|
||||||
|
if(block != null
|
||||||
|
&& block.getTypeId() == 42
|
||||||
|
&& mcPermissions.getInstance().repair(player)){
|
||||||
|
if(player.getItemInHand().getDurability() > 0){
|
||||||
|
/*
|
||||||
|
* ARMOR
|
||||||
|
*/
|
||||||
|
if(isArmor(is) && block.getTypeId() == 42){
|
||||||
|
/*
|
||||||
|
* DIAMOND ARMOR
|
||||||
|
*/
|
||||||
|
if(isDiamondArmor(is) && hasDiamond(player) && mcUsers.getProfile(player).getRepairInt() >= 50){
|
||||||
|
removeDiamond(player);
|
||||||
|
player.getItemInHand().setDurability(getArmorRepairAmount(is, player));
|
||||||
|
mcUsers.getProfile(player).addRepairGather(75);
|
||||||
|
} else if (isIronArmor(is) && hasIron(player)){
|
||||||
|
/*
|
||||||
|
* IRON ARMOR
|
||||||
|
*/
|
||||||
|
removeIron(player);
|
||||||
|
player.getItemInHand().setDurability(getArmorRepairAmount(is, player));
|
||||||
|
/*
|
||||||
|
* DISTRIBUTE REPAIR XP
|
||||||
|
*/
|
||||||
|
mcUsers.getProfile(player).addRepairGather(20);
|
||||||
|
//GOLD ARMOR
|
||||||
|
} else if (isGoldArmor(is) && hasGold(player)){
|
||||||
|
removeGold(player);
|
||||||
|
player.getItemInHand().setDurability(getArmorRepairAmount(is, player));
|
||||||
|
mcUsers.getProfile(player).addRepairGather(50);
|
||||||
|
} else {
|
||||||
|
needMoreVespeneGas(is, player);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* TOOLS
|
||||||
|
*/
|
||||||
|
if(isTools(is) && block.getTypeId() == 42){
|
||||||
|
/*
|
||||||
|
* IRON TOOLS
|
||||||
|
*/
|
||||||
|
if(isIronTools(is) && hasIron(player)){
|
||||||
|
is.setDurability(getToolRepairAmount(is, player));
|
||||||
|
removeIron(player);
|
||||||
|
mcUsers.getProfile(player).addRepairGather(20);
|
||||||
|
} else if (isDiamondTools(is) && hasDiamond(player) && mcUsers.getProfile(player).getRepairInt() >= 50){ //Check if its diamond and the player has diamonds
|
||||||
|
/*
|
||||||
|
* DIAMOND TOOLS
|
||||||
|
*/
|
||||||
|
is.setDurability(getToolRepairAmount(is, player));
|
||||||
|
removeDiamond(player);
|
||||||
|
mcUsers.getProfile(player).addRepairGather(75);
|
||||||
|
} else if(isGoldTools(is) && hasGold(player)){
|
||||||
|
is.setDurability(getToolRepairAmount(is, player));
|
||||||
|
removeGold(player);
|
||||||
|
mcUsers.getProfile(player).addRepairGather(50);
|
||||||
|
} else {
|
||||||
|
needMoreVespeneGas(is, player);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
player.sendMessage("That is at full durability.");
|
||||||
|
}
|
||||||
|
player.updateInventory();
|
||||||
|
/*
|
||||||
|
* GIVE SKILL IF THERE IS ENOUGH XP
|
||||||
|
*/
|
||||||
|
if(mcUsers.getProfile(player).getRepairGatherInt() >= mcUsers.getProfile(player).getXpToLevel("repair")){
|
||||||
|
int skillups = 0;
|
||||||
|
while(mcUsers.getProfile(player).getRepairGatherInt() >= mcUsers.getProfile(player).getXpToLevel("repair")){
|
||||||
|
skillups++;
|
||||||
|
mcUsers.getProfile(player).removeRepairGather(mcUsers.getProfile(player).getXpToLevel("repair"));
|
||||||
|
mcUsers.getProfile(player).skillUpRepair(1);
|
||||||
|
}
|
||||||
|
player.sendMessage(ChatColor.YELLOW+"Repair skill increased by "+skillups+"."+" Total ("+mcUsers.getProfile(player).getRepair()+")");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public boolean isArmor(ItemStack is){
|
||||||
|
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() == 314 || is.getTypeId() == 315 || is.getTypeId() == 316 || is.getTypeId() == 317){
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public boolean isGoldArmor(ItemStack is){
|
||||||
|
if(is.getTypeId() == 314 || is.getTypeId() == 315 || is.getTypeId() == 316 || is.getTypeId() == 317){
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public boolean isIronArmor(ItemStack is){
|
||||||
|
if(is.getTypeId() == 306 || is.getTypeId() == 307 || is.getTypeId() == 308 || is.getTypeId() == 309)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public boolean isDiamondArmor(ItemStack is){
|
||||||
|
if(is.getTypeId() == 310 || is.getTypeId() == 311 || is.getTypeId() == 312 || is.getTypeId() == 313)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public boolean isTools(ItemStack is){
|
||||||
|
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() == 283 || is.getTypeId() == 285 || is.getTypeId() == 286 || is.getTypeId() == 284) //GOLD
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public boolean isGoldTools(ItemStack is){
|
||||||
|
if(is.getTypeId() == 283 || is.getTypeId() == 285 || is.getTypeId() == 286 || is.getTypeId() == 284 || is.getTypeId() == 294){
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public boolean isIronTools(ItemStack is){
|
||||||
|
if(is.getTypeId() == 256 || is.getTypeId() == 257 || is.getTypeId() == 258 || is.getTypeId() == 267 || is.getTypeId() == 292)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isDiamondTools(ItemStack is){
|
||||||
|
if(is.getTypeId() == 276 || is.getTypeId() == 277 || is.getTypeId() == 278 || is.getTypeId() == 279 || is.getTypeId() == 293)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public void removeIron(Player player){
|
||||||
|
ItemStack[] inventory = player.getInventory().getContents();
|
||||||
|
for(ItemStack x : inventory){
|
||||||
|
if(x.getTypeId() == 265){
|
||||||
|
if(x.getAmount() == 1){
|
||||||
|
x.setTypeId(0);
|
||||||
|
x.setAmount(0);
|
||||||
|
player.getInventory().setContents(inventory);
|
||||||
|
} else{
|
||||||
|
x.setAmount(x.getAmount() - 1);
|
||||||
|
player.getInventory().setContents(inventory);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public void removeGold(Player player){
|
||||||
|
ItemStack[] inventory = player.getInventory().getContents();
|
||||||
|
for(ItemStack x : inventory){
|
||||||
|
if(x.getTypeId() == 266){
|
||||||
|
if(x.getAmount() == 1){
|
||||||
|
x.setTypeId(0);
|
||||||
|
x.setAmount(0);
|
||||||
|
player.getInventory().setContents(inventory);
|
||||||
|
} else{
|
||||||
|
x.setAmount(x.getAmount() - 1);
|
||||||
|
player.getInventory().setContents(inventory);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public void removeDiamond(Player player){
|
||||||
|
ItemStack[] inventory = player.getInventory().getContents();
|
||||||
|
for(ItemStack x : inventory){
|
||||||
|
if(x.getTypeId() == 264){
|
||||||
|
if(x.getAmount() == 1){
|
||||||
|
x.setTypeId(0);
|
||||||
|
x.setAmount(0);
|
||||||
|
player.getInventory().setContents(inventory);
|
||||||
|
} else{
|
||||||
|
x.setAmount(x.getAmount() - 1);
|
||||||
|
player.getInventory().setContents(inventory);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public boolean hasGold(Player player){
|
||||||
|
ItemStack[] inventory = player.getInventory().getContents();
|
||||||
|
for(ItemStack x : inventory){
|
||||||
|
if(x.getTypeId() == 266){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
public boolean hasDiamond(Player player){
|
||||||
|
ItemStack[] inventory = player.getInventory().getContents();
|
||||||
|
for(ItemStack x : inventory){
|
||||||
|
if(x.getTypeId() == 264){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
public boolean hasIron(Player player){
|
||||||
|
ItemStack[] inventory = player.getInventory().getContents();
|
||||||
|
for(ItemStack x : inventory){
|
||||||
|
if(x.getTypeId() == 265){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
public short getToolRepairAmount(ItemStack is, Player player){
|
||||||
|
short durability = is.getDurability();
|
||||||
|
switch(is.getTypeId())
|
||||||
|
{
|
||||||
|
case 284:
|
||||||
|
durability = 0;
|
||||||
|
break;
|
||||||
|
case 256:
|
||||||
|
durability = 0;
|
||||||
|
break;
|
||||||
|
case 277:
|
||||||
|
durability = 0;
|
||||||
|
break;
|
||||||
|
case 257:
|
||||||
|
durability -= 84;
|
||||||
|
break;
|
||||||
|
case 258:
|
||||||
|
durability -= 84;
|
||||||
|
break;
|
||||||
|
case 267:
|
||||||
|
durability -= 84;
|
||||||
|
break;
|
||||||
|
case 292:
|
||||||
|
durability -= 84;
|
||||||
|
break;
|
||||||
|
case 276:
|
||||||
|
durability -= 509;
|
||||||
|
break;
|
||||||
|
case 278:
|
||||||
|
durability -= 509;
|
||||||
|
break;
|
||||||
|
case 279:
|
||||||
|
durability -= 509;
|
||||||
|
break;
|
||||||
|
case 293:
|
||||||
|
durability -= 509;
|
||||||
|
break;
|
||||||
|
case 283:
|
||||||
|
durability -= 13;
|
||||||
|
break;
|
||||||
|
case 285:
|
||||||
|
durability -= 13;
|
||||||
|
break;
|
||||||
|
case 286:
|
||||||
|
durability -= 13;
|
||||||
|
break;
|
||||||
|
case 294:
|
||||||
|
durability -= 13;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if(durability < 0)
|
||||||
|
durability = 0;
|
||||||
|
if(checkPlayerProcRepair(player))
|
||||||
|
durability = 0;
|
||||||
|
return durability;
|
||||||
|
}
|
||||||
|
//This determines how much we repair
|
||||||
|
public short getArmorRepairAmount(ItemStack is, Player player){
|
||||||
|
short durability = is.getDurability();
|
||||||
|
switch(is.getTypeId())
|
||||||
|
{
|
||||||
|
case 306:
|
||||||
|
durability -= 27;
|
||||||
|
break;
|
||||||
|
case 310:
|
||||||
|
durability -= 55;
|
||||||
|
break;
|
||||||
|
case 307:
|
||||||
|
durability -= 24;
|
||||||
|
break;
|
||||||
|
case 311:
|
||||||
|
durability -= 48;
|
||||||
|
break;
|
||||||
|
case 308:
|
||||||
|
durability -= 27;
|
||||||
|
break;
|
||||||
|
case 312:
|
||||||
|
durability -= 53;
|
||||||
|
break;
|
||||||
|
case 309:
|
||||||
|
durability -= 40;
|
||||||
|
break;
|
||||||
|
case 313:
|
||||||
|
durability -= 80;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if(durability < 0)
|
||||||
|
durability = 0;
|
||||||
|
if(checkPlayerProcRepair(player))
|
||||||
|
durability = 0;
|
||||||
|
return durability;
|
||||||
|
}
|
||||||
|
public void needMoreVespeneGas(ItemStack is, Player player){
|
||||||
|
if ((isDiamondTools(is) || isDiamondArmor(is)) && mcUsers.getProfile(player).getRepairInt() < 50){
|
||||||
|
player.sendMessage(ChatColor.DARK_RED +"You're not adept enough to repair Diamond");
|
||||||
|
} else if (isDiamondTools(is) && !hasDiamond(player) || isIronTools(is) && !hasIron(player) || isGoldTools(is) && !hasGold(player)){
|
||||||
|
if(isDiamondTools(is) && !hasDiamond(player))
|
||||||
|
player.sendMessage(ChatColor.DARK_RED+"You need more "+ChatColor.BLUE+ "Diamonds");
|
||||||
|
if(isIronTools(is) && !hasIron(player))
|
||||||
|
player.sendMessage(ChatColor.DARK_RED+"You need more "+ChatColor.GRAY+ "Iron");
|
||||||
|
//herp
|
||||||
|
if(isGoldTools(is) && !hasGold(player))
|
||||||
|
player.sendMessage(ChatColor.DARK_RED+"You need more "+ChatColor.GOLD+"Gold");
|
||||||
|
} else if (isDiamondArmor(is) && !hasDiamond(player)){
|
||||||
|
player.sendMessage(ChatColor.DARK_RED+"You need more "+ChatColor.BLUE+ "Diamonds");
|
||||||
|
} else if (isIronArmor(is) && !hasIron(player)){
|
||||||
|
player.sendMessage(ChatColor.DARK_RED+"You need more "+ChatColor.GRAY+ "Iron");
|
||||||
|
} else if (isGoldArmor(is) && !hasGold(player))
|
||||||
|
player.sendMessage(ChatColor.DARK_RED+"You need more "+ChatColor.GOLD+"Gold");
|
||||||
|
}
|
||||||
|
public boolean checkPlayerProcRepair(Player player){
|
||||||
|
if(mcUsers.getProfile(player).getRepairInt() >= 750){
|
||||||
|
if(Math.random() * 10 > 2){
|
||||||
|
player.sendMessage(ChatColor.GRAY + "That took no effort.");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
} else if (mcUsers.getProfile(player).getRepairInt() >= 450 && mcUsers.getProfile(player).getRepairInt() < 750){
|
||||||
|
if(Math.random() * 10 > 4){
|
||||||
|
player.sendMessage(ChatColor.GRAY + "That felt really easy.");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
} else if (mcUsers.getProfile(player).getRepairInt() >= 150 && mcUsers.getProfile(player).getRepairInt() < 450){
|
||||||
|
if(Math.random() * 10 > 6){
|
||||||
|
player.sendMessage(ChatColor.GRAY + "That felt pretty easy.");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
} else if (mcUsers.getProfile(player).getRepairInt() >= 50 && mcUsers.getProfile(player).getRepairInt() < 150){
|
||||||
|
if(Math.random() * 10 > 8){
|
||||||
|
player.sendMessage(ChatColor.GRAY + "That felt easy.");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
79
mcMMO/com/gmail/nossr50/mcSkills.java
Normal file
79
mcMMO/com/gmail/nossr50/mcSkills.java
Normal file
@ -0,0 +1,79 @@
|
|||||||
|
package com.gmail.nossr50;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Entity;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
|
public class mcSkills {
|
||||||
|
private static mcMMO plugin;
|
||||||
|
public mcSkills(mcMMO instance) {
|
||||||
|
plugin = instance;
|
||||||
|
}
|
||||||
|
private static volatile mcSkills instance;
|
||||||
|
public static mcSkills getInstance() {
|
||||||
|
if (instance == null) {
|
||||||
|
instance = new mcSkills(plugin);
|
||||||
|
}
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
public boolean hasArrows(Player player){
|
||||||
|
for(ItemStack x : player.getInventory().getContents()){
|
||||||
|
if (x.getTypeId() == 262){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
public void addArrows(Player player){
|
||||||
|
for(ItemStack x : player.getInventory().getContents()){
|
||||||
|
if (x.getTypeId() == 262){
|
||||||
|
x.setAmount(x.getAmount() + 1);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public boolean isSkill(String skillname){
|
||||||
|
if(skillname.equals("mining")){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else if(skillname.equals("woodcutting")){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else if(skillname.equals("excavation")){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else if(skillname.equals("repair")){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else if(skillname.equals("herbalism")){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else if(skillname.equals("acrobatics")){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else if(skillname.equals("swords")){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else if(skillname.equals("archery")){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else if(skillname.equals("unarmed")){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else if(skillname.equals("axes")){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public void arrowRetrievalCheck(Entity entity){
|
||||||
|
if(mcConfig.getInstance().isTracked(entity)){
|
||||||
|
Integer x = 0;
|
||||||
|
while(x < mcConfig.getInstance().getArrowCount(entity)){
|
||||||
|
mcm.getInstance().mcDropItem(entity.getLocation(), 262);
|
||||||
|
x++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,12 +1,7 @@
|
|||||||
package com.gmail.nossr50;
|
package com.gmail.nossr50;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Timer;
|
|
||||||
import java.util.TimerTask;
|
import java.util.TimerTask;
|
||||||
|
|
||||||
import org.bukkit.ChatColor;
|
|
||||||
import org.bukkit.World;
|
|
||||||
import org.bukkit.entity.*;
|
import org.bukkit.entity.*;
|
||||||
import org.bukkit.inventory.ItemStack;
|
|
||||||
|
|
||||||
public class mcTimer extends TimerTask{
|
public class mcTimer extends TimerTask{
|
||||||
private final mcMMO plugin;
|
private final mcMMO plugin;
|
||||||
@ -16,8 +11,9 @@ public class mcTimer extends TimerTask{
|
|||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
}
|
}
|
||||||
public void run() {
|
public void run() {
|
||||||
|
Player[] playerlist = plugin.getServer().getOnlinePlayers();
|
||||||
if(thecount == 5 || thecount == 10 || thecount == 15 || thecount == 20){
|
if(thecount == 5 || thecount == 10 || thecount == 15 || thecount == 20){
|
||||||
for(Player player : plugin.getServer().getOnlinePlayers()){
|
for(Player player : playerlist){
|
||||||
if(player != null &&
|
if(player != null &&
|
||||||
player.getHealth() > 0 && player.getHealth() < 20
|
player.getHealth() > 0 && player.getHealth() < 20
|
||||||
&& mcUsers.getProfile(player).getPowerLevel() >= 1000
|
&& mcUsers.getProfile(player).getPowerLevel() >= 1000
|
||||||
@ -28,7 +24,7 @@ public class mcTimer extends TimerTask{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(thecount == 10 || thecount == 20){
|
if(thecount == 10 || thecount == 20){
|
||||||
for(Player player : plugin.getServer().getOnlinePlayers()){
|
for(Player player : playerlist){
|
||||||
if(player != null &&
|
if(player != null &&
|
||||||
player.getHealth() > 0 && player.getHealth() < 20
|
player.getHealth() > 0 && player.getHealth() < 20
|
||||||
&& mcUsers.getProfile(player).getPowerLevel() >= 500
|
&& mcUsers.getProfile(player).getPowerLevel() >= 500
|
||||||
@ -40,7 +36,7 @@ public class mcTimer extends TimerTask{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(thecount == 20){
|
if(thecount == 20){
|
||||||
for(Player player : plugin.getServer().getOnlinePlayers()){
|
for(Player player : playerlist){
|
||||||
if(player != null &&
|
if(player != null &&
|
||||||
player.getHealth() > 0 && player.getHealth() < 20
|
player.getHealth() > 0 && player.getHealth() < 20
|
||||||
&& mcUsers.getProfile(player).getPowerLevel() < 500
|
&& mcUsers.getProfile(player).getPowerLevel() < 500
|
||||||
@ -50,8 +46,8 @@ public class mcTimer extends TimerTask{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for(Player player : plugin.getServer().getOnlinePlayers()){
|
for(Player player : playerlist){
|
||||||
if(player != null){
|
if(player != null && mcUsers.getProfile(player).getRecentlyHurt() >= 1){
|
||||||
mcUsers.getProfile(player).decreaseLastHurt();
|
mcUsers.getProfile(player).decreaseLastHurt();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -63,6 +59,6 @@ public class mcTimer extends TimerTask{
|
|||||||
} else {
|
} else {
|
||||||
thecount = 1;
|
thecount = 1;
|
||||||
}
|
}
|
||||||
mcm.getInstance().bleedSimulate(plugin);
|
mcCombat.getInstance().bleedSimulate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,7 @@ import java.util.logging.Logger;
|
|||||||
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.entity.*;
|
import org.bukkit.entity.*;
|
||||||
|
import org.bukkit.plugin.Plugin;
|
||||||
|
|
||||||
public class mcUsers {
|
public class mcUsers {
|
||||||
private static volatile mcUsers instance;
|
private static volatile mcUsers instance;
|
||||||
@ -1239,8 +1240,12 @@ class PlayerList
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public String getMySpawnWorld(){
|
public String getMySpawnWorld(Plugin plugin){
|
||||||
return myspawnworld;
|
if(myspawnworld != null && !myspawnworld.equals("") && !myspawnworld.equals("null")){
|
||||||
|
return myspawnworld;
|
||||||
|
} else {
|
||||||
|
return plugin.getServer().getWorlds().get(0).toString();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
//Save a users spawn location
|
//Save a users spawn location
|
||||||
public void setMySpawn(double x, double y, double z, String myspawnworldlocation){
|
public void setMySpawn(double x, double y, double z, String myspawnworldlocation){
|
||||||
|
59
mcMMO/com/gmail/nossr50/mcWoodCutting.java
Normal file
59
mcMMO/com/gmail/nossr50/mcWoodCutting.java
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
package com.gmail.nossr50;
|
||||||
|
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.block.Block;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
|
public class mcWoodCutting {
|
||||||
|
private static mcMMO plugin;
|
||||||
|
public mcWoodCutting(mcMMO instance) {
|
||||||
|
plugin = instance;
|
||||||
|
}
|
||||||
|
private static volatile mcWoodCutting instance;
|
||||||
|
public static mcWoodCutting getInstance() {
|
||||||
|
if (instance == null) {
|
||||||
|
instance = new mcWoodCutting(plugin);
|
||||||
|
}
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
public void woodCuttingProcCheck(Player player, Block block, Location loc){
|
||||||
|
byte type = block.getData();
|
||||||
|
Material mat = Material.getMaterial(block.getTypeId());
|
||||||
|
byte damage = 0;
|
||||||
|
if(mcUsers.getProfile(player).getWoodCuttingInt() > 1000){
|
||||||
|
ItemStack item = new ItemStack(mat, 1, type, damage);
|
||||||
|
loc.getWorld().dropItemNaturally(loc, item);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if(mcUsers.getProfile(player).getWoodCuttingInt() > 750){
|
||||||
|
if((Math.random() * 10) > 2){
|
||||||
|
ItemStack item = new ItemStack(mat, 1, type, damage);
|
||||||
|
loc.getWorld().dropItemNaturally(loc, item);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(mcUsers.getProfile(player).getWoodCuttingInt() > 300){
|
||||||
|
if((Math.random() * 10) > 4){
|
||||||
|
ItemStack item = new ItemStack(mat, 1, type, damage);
|
||||||
|
loc.getWorld().dropItemNaturally(loc, item);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(mcUsers.getProfile(player).getWoodCuttingInt() > 100){
|
||||||
|
if((Math.random() * 10) > 6){
|
||||||
|
ItemStack item = new ItemStack(mat, 1, type, damage);
|
||||||
|
loc.getWorld().dropItemNaturally(loc, item);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(mcUsers.getProfile(player).getWoodCuttingInt() > 10){
|
||||||
|
if((Math.random() * 10) > 8){
|
||||||
|
ItemStack item = new ItemStack(mat, 1, type, damage);
|
||||||
|
loc.getWorld().dropItemNaturally(loc, item);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
File diff suppressed because it is too large
Load Diff
@ -1,3 +1,3 @@
|
|||||||
name: mcMMO
|
name: mcMMO
|
||||||
main: com.gmail.nossr50.mcMMO
|
main: com.gmail.nossr50.mcMMO
|
||||||
version: 0.8.6
|
version: 0.8.11 WIP no. 4
|
Loading…
Reference in New Issue
Block a user