mirror of
https://github.com/Auxilor/EcoEnchants.git
synced 2024-12-23 19:57:36 +01:00
Fixed HashMap over Map
This commit is contained in:
parent
a8186c0dd7
commit
a9bcd29949
@ -21,7 +21,7 @@ public final class FastGetEnchants implements FastGetEnchantsProxy {
|
|||||||
final boolean checkStored) {
|
final boolean checkStored) {
|
||||||
net.minecraft.server.v1_16_R3.ItemStack nmsStack = CraftItemStack.asNMSCopy(itemStack);
|
net.minecraft.server.v1_16_R3.ItemStack nmsStack = CraftItemStack.asNMSCopy(itemStack);
|
||||||
NBTTagList enchantmentNBT = checkStored && nmsStack.getItem() == Items.ENCHANTED_BOOK ? ItemEnchantedBook.d(nmsStack) : nmsStack.getEnchantments();
|
NBTTagList enchantmentNBT = checkStored && nmsStack.getItem() == Items.ENCHANTED_BOOK ? ItemEnchantedBook.d(nmsStack) : nmsStack.getEnchantments();
|
||||||
HashMap<Enchantment, Integer> foundEnchantments = new HashMap<>();
|
Map<Enchantment, Integer> foundEnchantments = new HashMap<>();
|
||||||
|
|
||||||
for (NBTBase base : enchantmentNBT) {
|
for (NBTBase base : enchantmentNBT) {
|
||||||
NBTTagCompound compound = (NBTTagCompound) base;
|
NBTTagCompound compound = (NBTTagCompound) base;
|
||||||
|
@ -21,7 +21,7 @@ public final class FastGetEnchants implements FastGetEnchantsProxy {
|
|||||||
final boolean checkStored) {
|
final boolean checkStored) {
|
||||||
net.minecraft.world.item.ItemStack nmsStack = CraftItemStack.asNMSCopy(itemStack);
|
net.minecraft.world.item.ItemStack nmsStack = CraftItemStack.asNMSCopy(itemStack);
|
||||||
NBTTagList enchantmentNBT = checkStored && itemStack.getType() == Material.ENCHANTED_BOOK ? ItemEnchantedBook.d(nmsStack) : nmsStack.getEnchantments();
|
NBTTagList enchantmentNBT = checkStored && itemStack.getType() == Material.ENCHANTED_BOOK ? ItemEnchantedBook.d(nmsStack) : nmsStack.getEnchantments();
|
||||||
HashMap<Enchantment, Integer> foundEnchantments = new HashMap<>();
|
Map<Enchantment, Integer> foundEnchantments = new HashMap<>();
|
||||||
|
|
||||||
for (NBTBase base : enchantmentNBT) {
|
for (NBTBase base : enchantmentNBT) {
|
||||||
NBTTagCompound compound = (NBTTagCompound) base;
|
NBTTagCompound compound = (NBTTagCompound) base;
|
||||||
|
@ -24,6 +24,7 @@ import java.util.ArrayList;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* All methods and fields pertaining to showing players the enchantments on their items.
|
* All methods and fields pertaining to showing players the enchantments on their items.
|
||||||
@ -119,7 +120,7 @@ public class EnchantDisplay extends DisplayModule {
|
|||||||
List<Enchantment> unsorted = new ArrayList<>();
|
List<Enchantment> unsorted = new ArrayList<>();
|
||||||
enchantments.forEach((enchantment, integer) -> unsorted.add(enchantment));
|
enchantments.forEach((enchantment, integer) -> unsorted.add(enchantment));
|
||||||
|
|
||||||
HashMap<Enchantment, Integer> tempEnchantments = new HashMap<>(enchantments);
|
Map<Enchantment, Integer> tempEnchantments = new HashMap<>(enchantments);
|
||||||
|
|
||||||
options.getSorter().sortEnchantments(unsorted);
|
options.getSorter().sortEnchantments(unsorted);
|
||||||
|
|
||||||
|
@ -18,9 +18,10 @@ import org.bukkit.util.Vector;
|
|||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
public class CallingCurse extends EcoEnchant implements TimedRunnable {
|
public class CallingCurse extends EcoEnchant implements TimedRunnable {
|
||||||
private final HashMap<Player, Integer> players = new HashMap<>();
|
private final Map<Player, Integer> players = new HashMap<>();
|
||||||
private double distance = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "distance");
|
private double distance = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "distance");
|
||||||
|
|
||||||
public CallingCurse() {
|
public CallingCurse() {
|
||||||
|
@ -16,9 +16,10 @@ import org.bukkit.event.player.PlayerQuitEvent;
|
|||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
public class Forcefield extends EcoEnchant implements TimedRunnable {
|
public class Forcefield extends EcoEnchant implements TimedRunnable {
|
||||||
private final HashMap<Player, Integer> players = new HashMap<>();
|
private final Map<Player, Integer> players = new HashMap<>();
|
||||||
private double initialDistance = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "initial-distance");
|
private double initialDistance = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "initial-distance");
|
||||||
private double bonus = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "bonus-per-level");
|
private double bonus = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "bonus-per-level");
|
||||||
private double damagePerPoint = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "damage-per-level");
|
private double damagePerPoint = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "damage-per-level");
|
||||||
|
@ -28,10 +28,11 @@ import java.util.Collection;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
public class InfernalTouch extends EcoEnchant {
|
public class InfernalTouch extends EcoEnchant {
|
||||||
private static final HashMap<Material, Pair<Material, Integer>> RECIPES = new HashMap<>();
|
private static final Map<Material, Pair<Material, Integer>> RECIPES = new HashMap<>();
|
||||||
private static final Set<Material> FORTUNE_MATERIALS = new HashSet<>(
|
private static final Set<Material> FORTUNE_MATERIALS = new HashSet<>(
|
||||||
Arrays.asList(
|
Arrays.asList(
|
||||||
Material.GOLD_INGOT,
|
Material.GOLD_INGOT,
|
||||||
|
@ -18,9 +18,10 @@ import org.bukkit.util.Vector;
|
|||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
public class Magnetic extends EcoEnchant implements TimedRunnable {
|
public class Magnetic extends EcoEnchant implements TimedRunnable {
|
||||||
private final HashMap<Player, Integer> players = new HashMap<>();
|
private final Map<Player, Integer> players = new HashMap<>();
|
||||||
private double initialDistance = 1;
|
private double initialDistance = 1;
|
||||||
private double bonus = 1;
|
private double bonus = 1;
|
||||||
|
|
||||||
|
@ -17,6 +17,7 @@ import org.bukkit.inventory.ItemStack;
|
|||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
@ -24,7 +25,7 @@ public class AnvilListeners extends PluginDependent<EcoPlugin> implements Listen
|
|||||||
/**
|
/**
|
||||||
* Map to prevent incrementing cost several times as inventory events are fired 3 times.
|
* Map to prevent incrementing cost several times as inventory events are fired 3 times.
|
||||||
*/
|
*/
|
||||||
private static final HashMap<UUID, Integer> ANTI_REPEAT = new HashMap<>();
|
private static final Map<UUID, Integer> ANTI_REPEAT = new HashMap<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class for AnvilGUI wrappers to ignore them.
|
* Class for AnvilGUI wrappers to ignore them.
|
||||||
|
@ -23,6 +23,7 @@ import org.jetbrains.annotations.NotNull;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
|
|
||||||
@ -74,7 +75,7 @@ public class LootPopulator extends BlockPopulator {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
HashMap<Enchantment, Integer> toAdd = new HashMap<>();
|
Map<Enchantment, Integer> toAdd = new HashMap<>();
|
||||||
|
|
||||||
ArrayList<EcoEnchant> enchantments = new ArrayList<>(EcoEnchants.values());
|
ArrayList<EcoEnchant> enchantments = new ArrayList<>(EcoEnchants.values());
|
||||||
Collections.shuffle(enchantments); // Prevent list bias towards early enchantments like telekinesis
|
Collections.shuffle(enchantments); // Prevent list bias towards early enchantments like telekinesis
|
||||||
|
Loading…
Reference in New Issue
Block a user