|
@@ -1,5 +1,7 @@
|
|
package com.gmail.nossr50.skills;
|
|
package com.gmail.nossr50.skills;
|
|
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
|
+
|
|
import org.bukkit.Location;
|
|
import org.bukkit.Location;
|
|
import org.bukkit.Material;
|
|
import org.bukkit.Material;
|
|
import org.bukkit.block.Block;
|
|
import org.bukkit.block.Block;
|
|
@@ -66,45 +68,84 @@ public class Excavation
|
|
public static void excavationProcCheck(byte data, int type, Location loc, Player player)
|
|
public static void excavationProcCheck(byte data, int type, Location loc, Player player)
|
|
{
|
|
{
|
|
PlayerProfile PP = Users.getProfile(player);
|
|
PlayerProfile PP = Users.getProfile(player);
|
|
- ItemStack is = null;
|
|
|
|
- Material mat = null;
|
|
|
|
- if(data == (byte) 5)
|
|
|
|
- return;
|
|
|
|
|
|
+ ArrayList<ItemStack> is = new ArrayList<ItemStack>();
|
|
|
|
+
|
|
|
|
+ int xp = 0;
|
|
|
|
|
|
- if(type == 2)
|
|
|
|
|
|
+ switch(type)
|
|
{
|
|
{
|
|
|
|
+ case 2:
|
|
if(PP.getSkillLevel(SkillType.EXCAVATION) >= 250)
|
|
if(PP.getSkillLevel(SkillType.EXCAVATION) >= 250)
|
|
{
|
|
{
|
|
//CHANCE TO GET EGGS
|
|
//CHANCE TO GET EGGS
|
|
if(LoadProperties.eggs == true && Math.random() * 100 > 99)
|
|
if(LoadProperties.eggs == true && Math.random() * 100 > 99)
|
|
{
|
|
{
|
|
- PP.addXP(SkillType.EXCAVATION, LoadProperties.meggs * LoadProperties.xpGainMultiplier);
|
|
|
|
- mat = Material.getMaterial(344);
|
|
|
|
- is = new ItemStack(mat, 1, (byte)0, (byte)0);
|
|
|
|
- loc.getWorld().dropItemNaturally(loc, is);
|
|
|
|
|
|
+ xp+= LoadProperties.meggs * LoadProperties.xpGainMultiplier;
|
|
|
|
+ is.add(new ItemStack(Material.EGG, 1, (byte)0, (byte)0));
|
|
}
|
|
}
|
|
//CHANCE TO GET APPLES
|
|
//CHANCE TO GET APPLES
|
|
if(LoadProperties.apples == true && Math.random() * 100 > 99)
|
|
if(LoadProperties.apples == true && Math.random() * 100 > 99)
|
|
{
|
|
{
|
|
- PP.addXP(SkillType.EXCAVATION, LoadProperties.mapple * LoadProperties.xpGainMultiplier);
|
|
|
|
- mat = Material.getMaterial(260);
|
|
|
|
- is = new ItemStack(mat, 1, (byte)0, (byte)0);
|
|
|
|
- loc.getWorld().dropItemNaturally(loc, is);
|
|
|
|
|
|
+ xp+= LoadProperties.mapple * LoadProperties.xpGainMultiplier;
|
|
|
|
+ is.add(new ItemStack(Material.APPLE, 1, (byte)0, (byte)0));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ break;
|
|
|
|
+ case 3:
|
|
|
|
+ //CHANCE TO GET NETHERRACK
|
|
|
|
+ if(LoadProperties.netherrack == true && PP.getSkillLevel(SkillType.EXCAVATION) >= 850 && Math.random() * 200 > 199)
|
|
|
|
+ {
|
|
|
|
+ xp+= LoadProperties.mnetherrack * LoadProperties.xpGainMultiplier;
|
|
|
|
+ is.add(new ItemStack(Material.NETHERRACK, 1, (byte)0, (byte)0));
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ //CHANCE TO GET SULPHUR
|
|
|
|
+ if(LoadProperties.sulphur == true && PP.getSkillLevel(SkillType.EXCAVATION) >= 75)
|
|
|
|
+ {
|
|
|
|
+ if(Math.random() * 10 > 9)
|
|
|
|
+ {
|
|
|
|
+ xp+= LoadProperties.msulphur * LoadProperties.xpGainMultiplier;
|
|
|
|
+ is.add(new ItemStack(Material.SULPHUR, 1, (byte)0, (byte)0));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ //CHANCE TO GET BONES
|
|
|
|
+ if(LoadProperties.bones == true && PP.getSkillLevel(SkillType.EXCAVATION) >= 175)
|
|
|
|
+ {
|
|
|
|
+ if(Math.random() * 10 > 9)
|
|
|
|
+ {
|
|
|
|
+ xp+= LoadProperties.mbones * LoadProperties.xpGainMultiplier;
|
|
|
|
+ is.add(new ItemStack(Material.BONE, 1, (byte)0, (byte)0));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ break;
|
|
|
|
+ case 12:
|
|
|
|
+ //CHANCE TO GET GLOWSTONE
|
|
|
|
+ if(LoadProperties.glowstone == true && PP.getSkillLevel(SkillType.EXCAVATION) >= 50 && Math.random() * 100 > 95)
|
|
|
|
+ {
|
|
|
|
+ xp+= LoadProperties.mglowstone2 * LoadProperties.xpGainMultiplier;
|
|
|
|
+ is.add(new ItemStack(Material.GLOWSTONE_DUST, 1, (byte)0, (byte)0));
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ //CHANCE TO GET SOUL SAND
|
|
|
|
+ if(LoadProperties.slowsand == true && PP.getSkillLevel(SkillType.EXCAVATION) >= 650 && Math.random() * 200 > 199)
|
|
|
|
+ {
|
|
|
|
+ xp+= LoadProperties.mslowsand * LoadProperties.xpGainMultiplier;
|
|
|
|
+ is.add(new ItemStack(Material.SOUL_SAND, 1, (byte)0, (byte)0));
|
|
|
|
+ }
|
|
|
|
+ break;
|
|
}
|
|
}
|
|
|
|
+
|
|
//DIRT SAND OR GRAVEL
|
|
//DIRT SAND OR GRAVEL
|
|
if(type == 3 || type == 13 || type == 2 || type == 12)
|
|
if(type == 3 || type == 13 || type == 2 || type == 12)
|
|
{
|
|
{
|
|
- PP.addXP(SkillType.EXCAVATION, LoadProperties.mbase * LoadProperties.xpGainMultiplier);
|
|
|
|
- if(PP.getSkillLevel(SkillType.EXCAVATION) >= 750){
|
|
|
|
|
|
+ xp+= LoadProperties.mbase * LoadProperties.xpGainMultiplier;
|
|
|
|
+ if(PP.getSkillLevel(SkillType.EXCAVATION) >= 750)
|
|
|
|
+ {
|
|
//CHANCE TO GET CAKE
|
|
//CHANCE TO GET CAKE
|
|
if(LoadProperties.cake == true && Math.random() * 2000 > 1999)
|
|
if(LoadProperties.cake == true && Math.random() * 2000 > 1999)
|
|
{
|
|
{
|
|
- PP.addXP(SkillType.EXCAVATION, LoadProperties.mcake * LoadProperties.xpGainMultiplier);
|
|
|
|
- mat = Material.getMaterial(354);
|
|
|
|
- is = new ItemStack(mat, 1, (byte)0, (byte)0);
|
|
|
|
- loc.getWorld().dropItemNaturally(loc, is);
|
|
|
|
|
|
+ xp+= LoadProperties.mcake * LoadProperties.xpGainMultiplier;
|
|
|
|
+ is.add(new ItemStack(Material.CAKE, 1, (byte)0, (byte)0));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if(PP.getSkillLevel(SkillType.EXCAVATION) >= 350)
|
|
if(PP.getSkillLevel(SkillType.EXCAVATION) >= 350)
|
|
@@ -112,10 +153,8 @@ public class Excavation
|
|
//CHANCE TO GET DIAMOND
|
|
//CHANCE TO GET DIAMOND
|
|
if(LoadProperties.diamond == true && Math.random() * 750 > 749)
|
|
if(LoadProperties.diamond == true && Math.random() * 750 > 749)
|
|
{
|
|
{
|
|
- PP.addXP(SkillType.EXCAVATION, LoadProperties.mdiamond2 * LoadProperties.xpGainMultiplier);
|
|
|
|
- mat = Material.getMaterial(264);
|
|
|
|
- is = new ItemStack(mat, 1, (byte)0, (byte)0);
|
|
|
|
- loc.getWorld().dropItemNaturally(loc, is);
|
|
|
|
|
|
+ xp+= LoadProperties.mdiamond2 * LoadProperties.xpGainMultiplier;
|
|
|
|
+ is.add(new ItemStack(Material.DIAMOND, 1, (byte)0, (byte)0));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if(PP.getSkillLevel(SkillType.EXCAVATION) >= 250)
|
|
if(PP.getSkillLevel(SkillType.EXCAVATION) >= 250)
|
|
@@ -123,45 +162,21 @@ public class Excavation
|
|
//CHANCE TO GET YELLOW MUSIC
|
|
//CHANCE TO GET YELLOW MUSIC
|
|
if(LoadProperties.music == true && Math.random() * 2000 > 1999)
|
|
if(LoadProperties.music == true && Math.random() * 2000 > 1999)
|
|
{
|
|
{
|
|
- PP.addXP(SkillType.EXCAVATION, LoadProperties.mmusic * LoadProperties.xpGainMultiplier);
|
|
|
|
- mat = Material.getMaterial(2256);
|
|
|
|
- is = new ItemStack(mat, 1, (byte)0, (byte)0);
|
|
|
|
- loc.getWorld().dropItemNaturally(loc, is);
|
|
|
|
|
|
+ xp+= LoadProperties.mmusic * LoadProperties.xpGainMultiplier;
|
|
|
|
+ is.add(new ItemStack(Material.GOLD_RECORD, 1, (byte)0, (byte)0));
|
|
}
|
|
}
|
|
-
|
|
|
|
}
|
|
}
|
|
if(PP.getSkillLevel(SkillType.EXCAVATION) >= 350)
|
|
if(PP.getSkillLevel(SkillType.EXCAVATION) >= 350)
|
|
{
|
|
{
|
|
//CHANCE TO GET GREEN MUSIC
|
|
//CHANCE TO GET GREEN MUSIC
|
|
if(LoadProperties.music == true && Math.random() * 2000 > 1999)
|
|
if(LoadProperties.music == true && Math.random() * 2000 > 1999)
|
|
{
|
|
{
|
|
- PP.addXP(SkillType.EXCAVATION, LoadProperties.mmusic * LoadProperties.xpGainMultiplier);
|
|
|
|
- mat = Material.getMaterial(2257);
|
|
|
|
- is = new ItemStack(mat, 1, (byte)0, (byte)0);
|
|
|
|
- loc.getWorld().dropItemNaturally(loc, is);
|
|
|
|
|
|
+ xp+= LoadProperties.mmusic * LoadProperties.xpGainMultiplier;
|
|
|
|
+ is.add(new ItemStack(Material.GREEN_RECORD, 1, (byte)0, (byte)0));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- //SAND
|
|
|
|
- if(type == 12)
|
|
|
|
- {
|
|
|
|
- //CHANCE TO GET GLOWSTONE
|
|
|
|
- if(LoadProperties.glowstone == true && PP.getSkillLevel(SkillType.EXCAVATION) >= 50 && Math.random() * 100 > 95)
|
|
|
|
- {
|
|
|
|
- PP.addXP(SkillType.EXCAVATION, LoadProperties.mglowstone2 * LoadProperties.xpGainMultiplier);
|
|
|
|
- mat = Material.getMaterial(348);
|
|
|
|
- is = new ItemStack(mat, 1, (byte)0, (byte)0);
|
|
|
|
- loc.getWorld().dropItemNaturally(loc, is);
|
|
|
|
- }
|
|
|
|
- //CHANCE TO GET SLOWSAND
|
|
|
|
- if(LoadProperties.slowsand == true && PP.getSkillLevel(SkillType.EXCAVATION) >= 650 && Math.random() * 200 > 199)
|
|
|
|
- {
|
|
|
|
- PP.addXP(SkillType.EXCAVATION, LoadProperties.mslowsand * LoadProperties.xpGainMultiplier);
|
|
|
|
- mat = Material.getMaterial(88);
|
|
|
|
- is = new ItemStack(mat, 1, (byte)0, (byte)0);
|
|
|
|
- loc.getWorld().dropItemNaturally(loc, is);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+
|
|
//GRASS OR DIRT
|
|
//GRASS OR DIRT
|
|
if(type == 2 || type == 3)
|
|
if(type == 2 || type == 3)
|
|
{
|
|
{
|
|
@@ -170,68 +185,42 @@ public class Excavation
|
|
//CHANCE FOR COCOA BEANS
|
|
//CHANCE FOR COCOA BEANS
|
|
if(LoadProperties.cocoabeans == true && Math.random() * 75 > 74)
|
|
if(LoadProperties.cocoabeans == true && Math.random() * 75 > 74)
|
|
{
|
|
{
|
|
- PP.addXP(SkillType.EXCAVATION, LoadProperties.mcocoa * LoadProperties.xpGainMultiplier);
|
|
|
|
- mat = Material.getMaterial(351);
|
|
|
|
- is = new ItemStack(mat, 1, (byte)0, (byte)0);
|
|
|
|
- is.setDurability((byte) 3); //COCOA
|
|
|
|
- loc.getWorld().dropItemNaturally(loc, is);
|
|
|
|
|
|
+ xp+= LoadProperties.mcocoa * LoadProperties.xpGainMultiplier;
|
|
|
|
+ is.add(new ItemStack(Material.getMaterial(351), 1, (short)3, (byte)0));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
//CHANCE FOR SHROOMS
|
|
//CHANCE FOR SHROOMS
|
|
if(LoadProperties.mushrooms == true && PP.getSkillLevel(SkillType.EXCAVATION) >= 500 && Math.random() * 200 > 199)
|
|
if(LoadProperties.mushrooms == true && PP.getSkillLevel(SkillType.EXCAVATION) >= 500 && Math.random() * 200 > 199)
|
|
{
|
|
{
|
|
- PP.addXP(SkillType.EXCAVATION, LoadProperties.mmushroom2 * LoadProperties.xpGainMultiplier);
|
|
|
|
- if(Math.random() * 10 > 5){
|
|
|
|
- mat = Material.getMaterial(39);
|
|
|
|
- } else {
|
|
|
|
- mat = Material.getMaterial(40);
|
|
|
|
|
|
+ xp+= LoadProperties.mmushroom2 * LoadProperties.xpGainMultiplier;
|
|
|
|
+ switch((int) Math.random() * 1)
|
|
|
|
+ {
|
|
|
|
+ case 0:
|
|
|
|
+ is.add(new ItemStack(Material.BROWN_MUSHROOM, 1, (byte)0, (byte)0));
|
|
|
|
+ break;
|
|
|
|
+ case 1:
|
|
|
|
+ is.add(new ItemStack(Material.RED_MUSHROOM, 1, (byte)0, (byte)0));
|
|
|
|
+ break;
|
|
}
|
|
}
|
|
- is = new ItemStack(mat, 1, (byte)0, (byte)0);
|
|
|
|
- loc.getWorld().dropItemNaturally(loc, is);
|
|
|
|
|
|
+
|
|
}
|
|
}
|
|
//CHANCE TO GET GLOWSTONE
|
|
//CHANCE TO GET GLOWSTONE
|
|
if(LoadProperties.glowstone == true && PP.getSkillLevel(SkillType.EXCAVATION) >= 25 && Math.random() * 100 > 95)
|
|
if(LoadProperties.glowstone == true && PP.getSkillLevel(SkillType.EXCAVATION) >= 25 && Math.random() * 100 > 95)
|
|
{
|
|
{
|
|
- PP.addXP(SkillType.EXCAVATION, LoadProperties.mglowstone2 * LoadProperties.xpGainMultiplier);
|
|
|
|
- mat = Material.getMaterial(348);
|
|
|
|
- is = new ItemStack(mat, 1, (byte)0, (byte)0);
|
|
|
|
- loc.getWorld().dropItemNaturally(loc, is);
|
|
|
|
|
|
+ xp+= LoadProperties.mglowstone2 * LoadProperties.xpGainMultiplier;
|
|
|
|
+ is.add(new ItemStack(Material.GLOWSTONE_DUST, 1, (byte)0, (byte)0));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- //GRAVEL
|
|
|
|
- if(type == 13)
|
|
|
|
|
|
+
|
|
|
|
+ //Drop items
|
|
|
|
+ for(ItemStack x : is)
|
|
{
|
|
{
|
|
- //CHANCE TO GET NETHERRACK
|
|
|
|
- if(LoadProperties.netherrack == true && PP.getSkillLevel(SkillType.EXCAVATION) >= 850 && Math.random() * 200 > 199)
|
|
|
|
- {
|
|
|
|
- PP.addXP(SkillType.EXCAVATION, LoadProperties.mnetherrack * LoadProperties.xpGainMultiplier);
|
|
|
|
- mat = Material.getMaterial(87);
|
|
|
|
- is = new ItemStack(mat, 1, (byte)0, (byte)0);
|
|
|
|
- loc.getWorld().dropItemNaturally(loc, is);
|
|
|
|
- }
|
|
|
|
- //CHANCE TO GET SULPHUR
|
|
|
|
- if(LoadProperties.sulphur == true && PP.getSkillLevel(SkillType.EXCAVATION) >= 75)
|
|
|
|
- {
|
|
|
|
- if(Math.random() * 10 > 9)
|
|
|
|
- {
|
|
|
|
- PP.addXP(SkillType.EXCAVATION, LoadProperties.msulphur * LoadProperties.xpGainMultiplier);
|
|
|
|
- mat = Material.getMaterial(289);
|
|
|
|
- is = new ItemStack(mat, 1, (byte)0, (byte)0);
|
|
|
|
- loc.getWorld().dropItemNaturally(loc, is);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- //CHANCE TO GET BONES
|
|
|
|
- if(LoadProperties.bones == true && PP.getSkillLevel(SkillType.EXCAVATION) >= 175)
|
|
|
|
- {
|
|
|
|
- if(Math.random() * 10 > 9)
|
|
|
|
- {
|
|
|
|
- PP.addXP(SkillType.EXCAVATION, LoadProperties.mbones * LoadProperties.xpGainMultiplier);
|
|
|
|
- mat = Material.getMaterial(352);
|
|
|
|
- is = new ItemStack(mat, 1, (byte)0, (byte)0);
|
|
|
|
- loc.getWorld().dropItemNaturally(loc, is);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+ if(x != null)
|
|
|
|
+ loc.getWorld().dropItemNaturally(loc, x);
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ //Handle XP related tasks
|
|
|
|
+ PP.addXP(SkillType.EXCAVATION, xp);
|
|
Skills.XpCheckSkill(SkillType.EXCAVATION, player);
|
|
Skills.XpCheckSkill(SkillType.EXCAVATION, player);
|
|
}
|
|
}
|
|
}
|
|
}
|