mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-29 16:46:46 +01:00
/flex. 0.3 baby!
This commit is contained in:
parent
d87cc62822
commit
b3a2f5b036
@ -42,9 +42,9 @@ public class mcBlockListener extends BlockListener {
|
|||||||
if(block.getTypeId() == 17){
|
if(block.getTypeId() == 17){
|
||||||
mcm.getInstance().woodCuttingProcCheck(player, block, loc);
|
mcm.getInstance().woodCuttingProcCheck(player, block, loc);
|
||||||
}
|
}
|
||||||
mcm.getInstance().herbalismProcCheck(block, player);
|
|
||||||
mcm.getInstance().excavationProcCheck(block, player);
|
mcm.getInstance().excavationProcCheck(block, player);
|
||||||
}
|
}
|
||||||
|
mcm.getInstance().herbalismProcCheck(block, player); //You place the blocks so we wont check if they are being watched
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -47,10 +47,12 @@ public class mcEntityListener extends EntityListener {
|
|||||||
}
|
}
|
||||||
//XP
|
//XP
|
||||||
if(attacker.getItemInHand().getTypeId() == 0 && Math.random() * 10 > 8){
|
if(attacker.getItemInHand().getTypeId() == 0 && Math.random() * 10 > 8){
|
||||||
|
if(defender.getHealth() != 0){
|
||||||
mcUsers.getProfile(attacker).skillUpUnarmed(1);
|
mcUsers.getProfile(attacker).skillUpUnarmed(1);
|
||||||
attacker.sendMessage(ChatColor.YELLOW+"Unarmed skill increased by 1. Total ("+mcUsers.getProfile(attacker).getUnarmed()+")");
|
attacker.sendMessage(ChatColor.YELLOW+"Unarmed skill increased by 1. Total ("+mcUsers.getProfile(attacker).getUnarmed()+")");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if(x instanceof Animals){
|
if(x instanceof Animals){
|
||||||
Animals defender = (Animals)event.getEntity();
|
Animals defender = (Animals)event.getEntity();
|
||||||
if(mcUsers.getProfile(attacker).getUnarmedInt() >= 50 && mcUsers.getProfile(attacker).getUnarmedInt() < 100){
|
if(mcUsers.getProfile(attacker).getUnarmedInt() >= 50 && mcUsers.getProfile(attacker).getUnarmedInt() < 100){
|
||||||
@ -76,7 +78,7 @@ public class mcEntityListener extends EntityListener {
|
|||||||
Player defender = (Player)x;
|
Player defender = (Player)x;
|
||||||
if(attacker.getItemInHand().getTypeId() == 0){
|
if(attacker.getItemInHand().getTypeId() == 0){
|
||||||
//DMG MODIFIER
|
//DMG MODIFIER
|
||||||
if((mcUsers.getProfile(defender).inParty() && mcUsers.getProfile(attacker).inParty())&& !mcUsers.getProfile(defender).getParty().equals(mcUsers.getProfile(attacker).getParty())) {
|
if((mcUsers.getProfile(defender).inParty() && mcUsers.getProfile(attacker).inParty())&& !mcUsers.getProfile(defender).getParty().equals(mcUsers.getProfile(attacker).getParty()) && !mcUsers.getProfile(defender).getParty().equals(mcUsers.getProfile(attacker).getParty())) {
|
||||||
if(mcUsers.getProfile(attacker).getUnarmedInt() >= 50 && mcUsers.getProfile(attacker).getUnarmedInt() < 100){
|
if(mcUsers.getProfile(attacker).getUnarmedInt() >= 50 && mcUsers.getProfile(attacker).getUnarmedInt() < 100){
|
||||||
defender.setHealth(calculateDamage(defender, 1));
|
defender.setHealth(calculateDamage(defender, 1));
|
||||||
} else if(mcUsers.getProfile(attacker).getUnarmedInt() >= 100 && mcUsers.getProfile(attacker).getUnarmedInt() < 200){
|
} else if(mcUsers.getProfile(attacker).getUnarmedInt() >= 100 && mcUsers.getProfile(attacker).getUnarmedInt() < 200){
|
||||||
@ -96,12 +98,13 @@ public class mcEntityListener extends EntityListener {
|
|||||||
}
|
}
|
||||||
if(mcUsers.getProfile(defender).isDead())
|
if(mcUsers.getProfile(defender).isDead())
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
//XP
|
//XP
|
||||||
if(attacker.getItemInHand().getTypeId() == 0 && Math.random() * 10 > 9){
|
if(attacker.getItemInHand().getTypeId() == 0 && Math.random() * 10 > 9){
|
||||||
|
if(defender.getHealth() != 0){
|
||||||
mcUsers.getProfile(attacker).skillUpUnarmed(1);
|
mcUsers.getProfile(attacker).skillUpUnarmed(1);
|
||||||
attacker.sendMessage(ChatColor.YELLOW+"Unarmed skill increased by 1. Total ("+mcUsers.getProfile(attacker).getUnarmed()+")");
|
attacker.sendMessage(ChatColor.YELLOW+"Unarmed skill increased by 1. Total ("+mcUsers.getProfile(attacker).getUnarmed()+")");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
//PROC
|
//PROC
|
||||||
if(simulateUnarmedProc(attacker)){
|
if(simulateUnarmedProc(attacker)){
|
||||||
attacker.sendMessage(ChatColor.DARK_RED+"You have hit with great force.");
|
attacker.sendMessage(ChatColor.DARK_RED+"You have hit with great force.");
|
||||||
@ -116,6 +119,7 @@ public class mcEntityListener extends EntityListener {
|
|||||||
mcUsers.getProfile(defender).setDead(true);
|
mcUsers.getProfile(defender).setDead(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(mcUsers.getProfile(defender).isDead())
|
if(mcUsers.getProfile(defender).isDead())
|
||||||
|
@ -108,7 +108,7 @@ public class mcPlayerListener extends PlayerListener {
|
|||||||
player.setHealth(player.getHealth() + 6);
|
player.setHealth(player.getHealth() + 6);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(block != null && block.getTypeId() == 42 && player.getItemInHand().getDurability() <= 0){
|
if(block != null && block.getTypeId() == 42 && player.getItemInHand().getDurability() <= 0 && (mcm.getInstance().isTools(is)) || mcm.getInstance().isArmor(is)){
|
||||||
player.sendMessage(ChatColor.YELLOW+"That is at full durability.");
|
player.sendMessage(ChatColor.YELLOW+"That is at full durability.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -163,6 +163,60 @@ public class mcPlayerListener extends PlayerListener {
|
|||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
String[] split = event.getMessage().split(" ");
|
String[] split = event.getMessage().split(" ");
|
||||||
String playerName = player.getName();
|
String playerName = player.getName();
|
||||||
|
if(split[0].equalsIgnoreCase("/woodcutting")){
|
||||||
|
event.setCancelled(true);
|
||||||
|
player.sendMessage(ChatColor.GREEN+"~~WOODCUTTING INFO~~");
|
||||||
|
player.sendMessage(ChatColor.GREEN+"Gaining Skill: "+ChatColor.DARK_GRAY+"Chop down trees.");
|
||||||
|
player.sendMessage(ChatColor.GREEN+"~~EFFECTS~~");
|
||||||
|
player.sendMessage(ChatColor.GRAY+"Double Drops start to happen at 10 woodcutting skill");
|
||||||
|
player.sendMessage(ChatColor.GRAY+"it gets more frequent from there.");
|
||||||
|
}
|
||||||
|
if(split[0].equalsIgnoreCase("/mining")){
|
||||||
|
event.setCancelled(true);
|
||||||
|
player.sendMessage(ChatColor.GREEN+"~~MINING INFO~~");
|
||||||
|
player.sendMessage(ChatColor.GREEN+"Gaining Skill: "+ChatColor.DARK_GRAY+"Mining ore and stone,");
|
||||||
|
player.sendMessage(ChatColor.DARK_GRAY+"the xp rate depends entirely upon the rarity of what you're harvesting.");
|
||||||
|
player.sendMessage(ChatColor.GREEN+"~~EFFECTS~~");
|
||||||
|
player.sendMessage(ChatColor.GRAY+"Double Drops start to happen at 25 Mining skill,");
|
||||||
|
player.sendMessage(ChatColor.GRAY+"and the chance for it increases with skill.");
|
||||||
|
}
|
||||||
|
if(split[0].equalsIgnoreCase("/repair")){
|
||||||
|
event.setCancelled(true);
|
||||||
|
player.sendMessage(ChatColor.GREEN+"~~REPAIR INFO~~");
|
||||||
|
player.sendMessage(ChatColor.GREEN+"Gaining Skill: "+ChatColor.DARK_GRAY+"Repairing tools and armor.");
|
||||||
|
player.sendMessage(ChatColor.GREEN+"~~EFFECTS~~");
|
||||||
|
player.sendMessage(ChatColor.GRAY+"High skill levels make a proc to fully repair items happen more often.");
|
||||||
|
player.sendMessage(ChatColor.GREEN+"~~USE~~");
|
||||||
|
player.sendMessage(ChatColor.GRAY+"Approach an Anvil (Iron Block) with the item you wish ");
|
||||||
|
player.sendMessage(ChatColor.GRAY+"to repair in hand, right click to consume resources of the");
|
||||||
|
player.sendMessage(ChatColor.GRAY+"same type to repair it. This does not work for stone/wood/gold");
|
||||||
|
}
|
||||||
|
if(split[0].equalsIgnoreCase("/unarmed")){
|
||||||
|
event.setCancelled(true);
|
||||||
|
player.sendMessage(ChatColor.GREEN+"~~UNARMED INFO~~");
|
||||||
|
player.sendMessage(ChatColor.GREEN+"Gaining Skill: "+ChatColor.DARK_GRAY+"Punching monsters and players.");
|
||||||
|
player.sendMessage(ChatColor.GREEN+"~~EFFECTS~~");
|
||||||
|
player.sendMessage(ChatColor.GRAY+"Damage scales with unarmed skill. The first damage increase happens");
|
||||||
|
player.sendMessage(ChatColor.DARK_GRAY+" at 50 skill. At very high skill levels, you will gain a proc");
|
||||||
|
player.sendMessage(ChatColor.DARK_GRAY+"to disarm opponents on hit");
|
||||||
|
}
|
||||||
|
if(split[0].equalsIgnoreCase("/herbalism")){
|
||||||
|
event.setCancelled(true);
|
||||||
|
player.sendMessage(ChatColor.GREEN+"~~HERBALISM INFO~~");
|
||||||
|
player.sendMessage(ChatColor.GREEN+"Gaining Skill: "+ChatColor.DARK_GRAY+"Farming and picking herbs.");
|
||||||
|
player.sendMessage(ChatColor.GREEN+"~~EFFECTS~~");
|
||||||
|
player.sendMessage(ChatColor.GRAY+"Increases healing effects of bread and stew.");
|
||||||
|
player.sendMessage(ChatColor.GRAY+"Allows for chance to receive double drops based on skill");
|
||||||
|
}
|
||||||
|
if(split[0].equalsIgnoreCase("/excavation")){
|
||||||
|
event.setCancelled(true);
|
||||||
|
player.sendMessage(ChatColor.GREEN+"~~EXCAVATION INFO~~");
|
||||||
|
player.sendMessage(ChatColor.GREEN+"Gaining Skill: "+ChatColor.DARK_GRAY+"Digging.");
|
||||||
|
player.sendMessage(ChatColor.GREEN+"~~EFFECTS~~");
|
||||||
|
player.sendMessage(ChatColor.GRAY+"You will find treasures while digging based on your excavation,");
|
||||||
|
player.sendMessage(ChatColor.GRAY+"and at high levels the rewards are quite nice. The item you get");
|
||||||
|
player.sendMessage(ChatColor.GRAY+"depend on the block you're digging. They all give diffrent stuff.");
|
||||||
|
}
|
||||||
if(split[0].equalsIgnoreCase("/mcmmo")){
|
if(split[0].equalsIgnoreCase("/mcmmo")){
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
player.sendMessage(ChatColor.GRAY+"mcMMO is an RPG inspired plugin");
|
player.sendMessage(ChatColor.GRAY+"mcMMO is an RPG inspired plugin");
|
||||||
@ -195,6 +249,12 @@ public class mcPlayerListener extends PlayerListener {
|
|||||||
player.sendMessage(ChatColor.GRAY+"/setspawn - Server ops can designate a 'spawn'");
|
player.sendMessage(ChatColor.GRAY+"/setspawn - Server ops can designate a 'spawn'");
|
||||||
player.sendMessage(ChatColor.GRAY+"/spawn - Travel to the op designated spawn");
|
player.sendMessage(ChatColor.GRAY+"/spawn - Travel to the op designated spawn");
|
||||||
player.sendMessage(ChatColor.GRAY+"/whois - view detailed info about a player (req op)");
|
player.sendMessage(ChatColor.GRAY+"/whois - view detailed info about a player (req op)");
|
||||||
|
player.sendMessage(ChatColor.GRAY+"/woodcutting - displays info about the skill");
|
||||||
|
player.sendMessage(ChatColor.GRAY+"/mining - displays info about the skill");
|
||||||
|
player.sendMessage(ChatColor.GRAY+"/repair - displays info about the skill");
|
||||||
|
player.sendMessage(ChatColor.GRAY+"/unarmed - displays info about the skill");
|
||||||
|
player.sendMessage(ChatColor.GRAY+"/herbalist - displays info about the skill");
|
||||||
|
player.sendMessage(ChatColor.GRAY+"/excavation - displays info about the skill");
|
||||||
}
|
}
|
||||||
if(mcUsers.getProfile(player).inParty() && split[0].equalsIgnoreCase("/ptp")){
|
if(mcUsers.getProfile(player).inParty() && split[0].equalsIgnoreCase("/ptp")){
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
@ -231,6 +231,8 @@ class PlayerList
|
|||||||
herbalism = character[9];
|
herbalism = character[9];
|
||||||
if(character.length > 10)
|
if(character.length > 10)
|
||||||
repair = character[10];
|
repair = character[10];
|
||||||
|
if(character.length > 11)
|
||||||
|
excavation = character[11];
|
||||||
in.close();
|
in.close();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -93,7 +93,7 @@ public class mcm {
|
|||||||
return 0; //full repair
|
return 0; //full repair
|
||||||
}
|
}
|
||||||
//IRON TOOLS
|
//IRON TOOLS
|
||||||
if(is.getTypeId() == 257 || is.getTypeId() == 258 || is.getTypeId() == 267){
|
if(is.getTypeId() == 257 || is.getTypeId() == 258 || is.getTypeId() == 267 || is.getTypeId() == 292){
|
||||||
if(durability < 84){
|
if(durability < 84){
|
||||||
return 0;
|
return 0;
|
||||||
}else {
|
}else {
|
||||||
@ -102,7 +102,7 @@ public class mcm {
|
|||||||
return (short) (durability-84);
|
return (short) (durability-84);
|
||||||
}
|
}
|
||||||
//DIAMOND TOOLS
|
//DIAMOND TOOLS
|
||||||
} else if(is.getTypeId() == 276 || is.getTypeId() == 278 || is.getTypeId() == 279){
|
} else if(is.getTypeId() == 276 || is.getTypeId() == 278 || is.getTypeId() == 279 || is.getTypeId() == 293){
|
||||||
if(durability < 509){
|
if(durability < 509){
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
@ -225,6 +225,9 @@ public class mcm {
|
|||||||
}
|
}
|
||||||
public void herbalismProcCheck(Block block, Player player){
|
public void herbalismProcCheck(Block block, Player player){
|
||||||
int type = block.getTypeId();
|
int type = block.getTypeId();
|
||||||
|
Location loc = block.getLocation();
|
||||||
|
ItemStack is = null;
|
||||||
|
Material mat = null;
|
||||||
if(type == 39 || type == 40){
|
if(type == 39 || type == 40){
|
||||||
mcUsers.getProfile(player).skillUpHerbalism(3);
|
mcUsers.getProfile(player).skillUpHerbalism(3);
|
||||||
player.sendMessage(ChatColor.YELLOW+"Herbalism skill increased by 3. Total ("+mcUsers.getProfile(player).getHerbalismInt()+")");
|
player.sendMessage(ChatColor.YELLOW+"Herbalism skill increased by 3. Total ("+mcUsers.getProfile(player).getHerbalismInt()+")");
|
||||||
@ -238,6 +241,34 @@ public class mcm {
|
|||||||
if(type == 59){
|
if(type == 59){
|
||||||
mcUsers.getProfile(player).skillUpHerbalism(1);
|
mcUsers.getProfile(player).skillUpHerbalism(1);
|
||||||
player.sendMessage(ChatColor.YELLOW+"Herbalism skill increased by 1. Total ("+mcUsers.getProfile(player).getHerbalismInt()+")");
|
player.sendMessage(ChatColor.YELLOW+"Herbalism skill increased by 1. Total ("+mcUsers.getProfile(player).getHerbalismInt()+")");
|
||||||
|
if(mcUsers.getProfile(player).getHerbalismInt() >= 50 && mcUsers.getProfile(player).getHerbalismInt() < 150){
|
||||||
|
if(Math.random() * 10 > 8){
|
||||||
|
mat = Material.getMaterial(59);
|
||||||
|
is = new ItemStack(mat, 1, (byte)0, (byte)0);
|
||||||
|
loc.getWorld().dropItemNaturally(loc, is);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(mcUsers.getProfile(player).getHerbalismInt() >= 150 && mcUsers.getProfile(player).getHerbalismInt() < 350 ){
|
||||||
|
if(Math.random() * 10 > 6){
|
||||||
|
mat = Material.getMaterial(59);
|
||||||
|
is = new ItemStack(mat, 1, (byte)0, (byte)0);
|
||||||
|
loc.getWorld().dropItemNaturally(loc, is);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(mcUsers.getProfile(player).getHerbalismInt() >= 150 && mcUsers.getProfile(player).getHerbalismInt() < 500 ){
|
||||||
|
if(Math.random() * 10 > 4){
|
||||||
|
mat = Material.getMaterial(59);
|
||||||
|
is = new ItemStack(mat, 1, (byte)0, (byte)0);
|
||||||
|
loc.getWorld().dropItemNaturally(loc, is);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(mcUsers.getProfile(player).getHerbalismInt() >= 150 && mcUsers.getProfile(player).getHerbalismInt() < 750 ){
|
||||||
|
if(Math.random() * 10 > 2){
|
||||||
|
mat = Material.getMaterial(59);
|
||||||
|
is = new ItemStack(mat, 1, (byte)0, (byte)0);
|
||||||
|
loc.getWorld().dropItemNaturally(loc, is);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public void excavationProcCheck(Block block, Player player){
|
public void excavationProcCheck(Block block, Player player){
|
||||||
@ -404,8 +435,8 @@ public class mcm {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
public boolean isTools(ItemStack is){
|
public boolean isTools(ItemStack is){
|
||||||
if(is.getTypeId() == 256 || is.getTypeId() == 257 || is.getTypeId() == 258 || is.getTypeId() == 267 || //IRON
|
if(is.getTypeId() == 256 || is.getTypeId() == 257 || is.getTypeId() == 258 || is.getTypeId() == 267 || is.getTypeId() == 292 ||//IRON
|
||||||
is.getTypeId() == 276 || is.getTypeId() == 277 || is.getTypeId() == 278 || is.getTypeId() == 279) //DIAMOND
|
is.getTypeId() == 276 || is.getTypeId() == 277 || is.getTypeId() == 278 || is.getTypeId() == 279 || is.getTypeId() == 293) //DIAMOND
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
@ -414,7 +445,7 @@ public class mcm {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean isIronTools(ItemStack is){
|
public boolean isIronTools(ItemStack is){
|
||||||
if(is.getTypeId() == 256 || is.getTypeId() == 257 || is.getTypeId() == 258 || is.getTypeId() == 267)
|
if(is.getTypeId() == 256 || is.getTypeId() == 257 || is.getTypeId() == 258 || is.getTypeId() == 267 || is.getTypeId() == 292)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
@ -423,7 +454,7 @@ public class mcm {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean isDiamondTools(ItemStack is){
|
public boolean isDiamondTools(ItemStack is){
|
||||||
if(is.getTypeId() == 276 || is.getTypeId() == 277 || is.getTypeId() == 278 || is.getTypeId() == 279)
|
if(is.getTypeId() == 276 || is.getTypeId() == 277 || is.getTypeId() == 278 || is.getTypeId() == 279 || is.getTypeId() == 293)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user