mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-08-01 20:15:28 +02:00
Add Tridents/Xbows (WIP)
This commit is contained in:
@@ -44,8 +44,6 @@ import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.entity.EntityDamageEvent;
|
||||
import org.bukkit.event.player.PlayerAnimationEvent;
|
||||
import org.bukkit.event.player.PlayerAnimationType;
|
||||
import org.bukkit.event.player.PlayerFishEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
@@ -22,7 +22,6 @@ import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
public final class ItemUtils {
|
||||
/**
|
||||
@@ -45,6 +44,10 @@ public final class ItemUtils {
|
||||
return mcMMO.getMaterialMapStore().isCrossbow(item.getType().getKey().getKey());
|
||||
}
|
||||
|
||||
public static boolean isTrident(@NotNull ItemStack item) {
|
||||
return mcMMO.getMaterialMapStore().isTrident(item.getType().getKey().getKey());
|
||||
}
|
||||
|
||||
public static boolean hasItemInEitherHand(@NotNull Player player, Material material) {
|
||||
return player.getInventory().getItemInMainHand().getType() == material || player.getInventory().getItemInOffHand().getType() == material;
|
||||
}
|
||||
|
@@ -10,9 +10,6 @@ import java.util.Locale;
|
||||
/**
|
||||
* Stores hash tables for item and block names
|
||||
* This allows for better support across multiple versions of Minecraft
|
||||
*
|
||||
* This is a temporary class, mcMMO is spaghetti and I'l clean it up later
|
||||
*
|
||||
*/
|
||||
public class MaterialMapStore {
|
||||
|
||||
@@ -52,7 +49,6 @@ public class MaterialMapStore {
|
||||
private final @NotNull HashSet<String> bows;
|
||||
private final @NotNull HashSet<String> crossbows;
|
||||
private final @NotNull HashSet<String> tools;
|
||||
|
||||
private final @NotNull HashSet<String> enchantables;
|
||||
|
||||
private final @NotNull HashSet<String> ores;
|
||||
@@ -819,6 +815,14 @@ public class MaterialMapStore {
|
||||
return crossbows.contains(id);
|
||||
}
|
||||
|
||||
public boolean isTrident(@NotNull Material material) {
|
||||
return isTrident(material.getKey().getKey());
|
||||
}
|
||||
|
||||
public boolean isTrident(@NotNull String id) {
|
||||
return tridents.contains(id);
|
||||
}
|
||||
|
||||
public boolean isLeatherArmor(@NotNull Material material) {
|
||||
return isLeatherArmor(material.getKey().getKey());
|
||||
}
|
||||
|
@@ -5,7 +5,6 @@ import com.gmail.nossr50.datatypes.skills.ItemType;
|
||||
import com.gmail.nossr50.datatypes.skills.MaterialType;
|
||||
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
||||
import com.gmail.nossr50.datatypes.skills.subskills.AbstractSubSkill;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.util.skills.RankUtils;
|
||||
import org.bukkit.Material;
|
||||
@@ -226,6 +225,8 @@ public final class Permissions {
|
||||
|
||||
/* WOODCUTTING */
|
||||
public static boolean treeFeller(Permissible permissible) { return permissible.hasPermission("mcmmo.ability.woodcutting.treefeller"); }
|
||||
/* CROSSBOWS */
|
||||
public static boolean superShotgun(Permissible permissible) { return permissible.hasPermission("mcmmo.ability.crossbows.supershotgun"); }
|
||||
|
||||
/*
|
||||
* PARTY
|
||||
|
@@ -61,6 +61,9 @@ public final class CommandRegistrationManager {
|
||||
case AXES:
|
||||
command.setExecutor(new AxesCommand());
|
||||
break;
|
||||
case CROSSBOWS:
|
||||
command.setExecutor(new CrossbowsCommand());
|
||||
break;
|
||||
|
||||
case EXCAVATION:
|
||||
command.setExecutor(new ExcavationCommand());
|
||||
@@ -97,6 +100,9 @@ public final class CommandRegistrationManager {
|
||||
case TAMING:
|
||||
command.setExecutor(new TamingCommand());
|
||||
break;
|
||||
case TRIDENTS:
|
||||
// TODO: Implement
|
||||
break;
|
||||
|
||||
case UNARMED:
|
||||
command.setExecutor(new UnarmedCommand());
|
||||
|
@@ -1,7 +1,6 @@
|
||||
package com.gmail.nossr50.util.random;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.VisibleForTesting;
|
||||
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
|
||||
|
Reference in New Issue
Block a user