Add Tridents/Xbows (WIP)

This commit is contained in:
nossr50
2023-04-03 17:57:33 -07:00
parent 02c5aa4628
commit 8bb50fb53c
32 changed files with 183 additions and 69 deletions

View File

@@ -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;

View File

@@ -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;
}

View File

@@ -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());
}

View File

@@ -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

View File

@@ -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());

View File

@@ -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;