mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-06-27 11:14:44 +02:00
New skill 'Knock On Wood', changes to axe readying messages
This commit is contained in:
@ -11,6 +11,7 @@ import com.gmail.nossr50.skills.salvage.Salvage;
|
||||
import com.gmail.nossr50.util.random.RandomChanceSkill;
|
||||
import com.gmail.nossr50.util.random.RandomChanceUtil;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.block.data.Ageable;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
@ -179,6 +180,10 @@ public final class BlockUtils {
|
||||
return mcMMO.getMaterialMapStore().isTreeFellerDestructible(blockState.getType());
|
||||
}
|
||||
|
||||
public static boolean isNonWoodPartOfTree(Material material) {
|
||||
return mcMMO.getMaterialMapStore().isTreeFellerDestructible(material);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if a given block should be affected by Flux Mining
|
||||
*
|
||||
@ -274,4 +279,8 @@ public final class BlockUtils {
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static boolean isPartOfTree(Block rayCast) {
|
||||
return hasWoodcuttingXP(rayCast.getState()) || isNonWoodPartOfTree(rayCast.getType());
|
||||
}
|
||||
}
|
||||
|
@ -12,6 +12,7 @@ import org.bukkit.Material;
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.entity.*;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
import org.bukkit.util.Vector;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@ -310,4 +311,37 @@ public final class Misc {
|
||||
public static boolean isPartyLeader(@NotNull McMMOPlayer mmoPlayer) {
|
||||
return mmoPlayer.getParty().getLeader().getUniqueId().equals(mmoPlayer.getPlayer().getUniqueId());
|
||||
}
|
||||
|
||||
// public static void spawnExperienceOrb(@NotNull Location location, int orbAmount, int experienceValue) {
|
||||
// for (int i = 0; i < orbAmount; i++) {
|
||||
// new SpawnOrbTask(location, experienceValue).runTaskLater(mcMMO.p, 20);
|
||||
// }
|
||||
// }
|
||||
|
||||
public static void spawnExperienceOrb(@NotNull Location location, int experienceValue) {
|
||||
if(location.getWorld() == null)
|
||||
return;
|
||||
|
||||
ExperienceOrb experienceOrb = (ExperienceOrb) location.getWorld().spawnEntity(location, EntityType.EXPERIENCE_ORB);
|
||||
experienceOrb.setExperience(experienceValue);
|
||||
}
|
||||
|
||||
private static class SpawnOrbTask extends BukkitRunnable {
|
||||
private final Location location;
|
||||
private int orbExpValue;
|
||||
|
||||
private SpawnOrbTask(Location location, int orbExpValue) {
|
||||
this.location = location;
|
||||
this.orbExpValue = orbExpValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
if(location == null || location.getWorld() == null)
|
||||
return;
|
||||
|
||||
ExperienceOrb experienceOrb = (ExperienceOrb) location.getWorld().spawnEntity(location, EntityType.EXPERIENCE_ORB);
|
||||
experienceOrb.setExperience(orbExpValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user