mirror of
https://github.com/songoda/FabledSkyBlock.git
synced 2025-02-04 05:41:30 +01:00
Changed stackableMaterials field to an EnumSet for better performance. Likewise, the getStackableMaterials() method had to have it's return type changed.
This commit is contained in:
parent
a3ee51d1d8
commit
4dfe31db16
@ -141,7 +141,7 @@ public class Interact implements Listener {
|
|||||||
|
|
||||||
if (event.getAction() == Action.RIGHT_CLICK_BLOCK) {
|
if (event.getAction() == Action.RIGHT_CLICK_BLOCK) {
|
||||||
if (stackableManager != null
|
if (stackableManager != null
|
||||||
&& stackableManager.getStackableMaterials().contains(event.getMaterial())
|
&& stackableManager.isStackableMaterial(event.getMaterial())
|
||||||
&& event.getClickedBlock().getType() == event.getMaterial()
|
&& event.getClickedBlock().getType() == event.getMaterial()
|
||||||
&& !player.isSneaking() && islandManager.hasPermission(player, block.getLocation(), "Place")
|
&& !player.isSneaking() && islandManager.hasPermission(player, block.getLocation(), "Place")
|
||||||
&& (!skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "config.yml")).getFileConfiguration().getBoolean("Island.Stackable.RequirePermission") || player.hasPermission("fabledskyblock.stackable"))) {
|
&& (!skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "config.yml")).getFileConfiguration().getBoolean("Island.Stackable.RequirePermission") || player.hasPermission("fabledskyblock.stackable"))) {
|
||||||
|
@ -15,7 +15,7 @@ public class StackableManager {
|
|||||||
//ToDO: Should pobably be a GUI for this
|
//ToDO: Should pobably be a GUI for this
|
||||||
|
|
||||||
private final SkyBlock skyblock;
|
private final SkyBlock skyblock;
|
||||||
private List<Material> stackableMaterials = new ArrayList<>();
|
private Set<Material> stackableMaterials = EnumSet.noneOf(Material.class);
|
||||||
private Map<Location, Stackable> stacks = new HashMap<>();
|
private Map<Location, Stackable> stacks = new HashMap<>();
|
||||||
|
|
||||||
public StackableManager(SkyBlock skyblock) {
|
public StackableManager(SkyBlock skyblock) {
|
||||||
@ -66,8 +66,8 @@ public class StackableManager {
|
|||||||
stackableMaterials.clear();
|
stackableMaterials.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Material> getStackableMaterials() {
|
public Set<Material> getStackableMaterials() {
|
||||||
return Collections.unmodifiableList(stackableMaterials);
|
return Collections.unmodifiableSet(stackableMaterials);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isStackableMaterial(Material material) {
|
public boolean isStackableMaterial(Material material) {
|
||||||
|
Loading…
Reference in New Issue
Block a user