diff --git a/src/main/java/me/xginko/pumpkinpvpreloaded/modules/effects/DeathSoundEffects.java b/src/main/java/me/xginko/pumpkinpvpreloaded/modules/effects/DeathSoundEffects.java index b4882ca..25fe1cf 100644 --- a/src/main/java/me/xginko/pumpkinpvpreloaded/modules/effects/DeathSoundEffects.java +++ b/src/main/java/me/xginko/pumpkinpvpreloaded/modules/effects/DeathSoundEffects.java @@ -59,10 +59,11 @@ public DeathSoundEffects() { } }) .filter(Objects::nonNull) - .collect(Collectors.collectingAndThen(Collectors.toList(), ImmutableList::copyOf)); - if (this.death_sounds.isEmpty()) { - this.death_sounds.addAll(defaults.stream().map(Sound::valueOf).collect(Collectors.toList())); - } + .collect(Collectors.collectingAndThen(Collectors.toList(), list -> { + if (list.isEmpty()) + list.addAll(defaults.stream().map(Sound::valueOf).collect(Collectors.toList())); + return ImmutableList.copyOf(list); + })); } @Override diff --git a/src/main/java/me/xginko/pumpkinpvpreloaded/modules/effects/ExplodeSoundEffects.java b/src/main/java/me/xginko/pumpkinpvpreloaded/modules/effects/ExplodeSoundEffects.java index 486ae09..f96c43d 100644 --- a/src/main/java/me/xginko/pumpkinpvpreloaded/modules/effects/ExplodeSoundEffects.java +++ b/src/main/java/me/xginko/pumpkinpvpreloaded/modules/effects/ExplodeSoundEffects.java @@ -62,10 +62,11 @@ public ExplodeSoundEffects() { } }) .filter(Objects::nonNull) - .collect(Collectors.collectingAndThen(Collectors.toList(), ImmutableList::copyOf)); - if (this.explode_sounds.isEmpty()) { - this.explode_sounds.addAll(defaults.stream().map(Sound::valueOf).collect(Collectors.toList())); - } + .collect(Collectors.collectingAndThen(Collectors.toList(), list -> { + if (list.isEmpty()) + list.addAll(defaults.stream().map(Sound::valueOf).collect(Collectors.toList())); + return ImmutableList.copyOf(list); + })); } @Override diff --git a/src/main/java/me/xginko/pumpkinpvpreloaded/modules/effects/FireworkEffects.java b/src/main/java/me/xginko/pumpkinpvpreloaded/modules/effects/FireworkEffects.java index f87587b..5dd199e 100644 --- a/src/main/java/me/xginko/pumpkinpvpreloaded/modules/effects/FireworkEffects.java +++ b/src/main/java/me/xginko/pumpkinpvpreloaded/modules/effects/FireworkEffects.java @@ -1,5 +1,6 @@ package me.xginko.pumpkinpvpreloaded.modules.effects; +import com.google.common.collect.ImmutableList; import me.xginko.pumpkinpvpreloaded.PumpkinPVPReloaded; import me.xginko.pumpkinpvpreloaded.events.PostPumpkinExplodeEvent; import me.xginko.pumpkinpvpreloaded.events.PostPumpkinHeadEntityExplodeEvent; @@ -102,7 +103,7 @@ public FireworkEffects() { } } - this.firework_effects = parsedFireworkEffects.stream().distinct().collect(Collectors.toList()); + this.firework_effects = ImmutableList.copyOf(parsedFireworkEffects); } @Override diff --git a/src/main/java/me/xginko/pumpkinpvpreloaded/modules/mechanics/EnablePerWorld.java b/src/main/java/me/xginko/pumpkinpvpreloaded/modules/mechanics/EnablePerWorld.java index 026a92d..6db65db 100644 --- a/src/main/java/me/xginko/pumpkinpvpreloaded/modules/mechanics/EnablePerWorld.java +++ b/src/main/java/me/xginko/pumpkinpvpreloaded/modules/mechanics/EnablePerWorld.java @@ -1,5 +1,6 @@ package me.xginko.pumpkinpvpreloaded.modules.mechanics; +import com.google.common.collect.ImmutableSet; import me.xginko.pumpkinpvpreloaded.events.PrePumpkinExplodeEvent; import me.xginko.pumpkinpvpreloaded.modules.PumpkinPVPModule; import org.bukkit.event.EventHandler; @@ -9,7 +10,6 @@ import org.jetbrains.annotations.NotNull; import java.util.Arrays; -import java.util.HashSet; import java.util.Set; public class EnablePerWorld extends PumpkinPVPModule implements Listener { @@ -22,7 +22,7 @@ public EnablePerWorld() { "Add the names of the worlds you want this plugins features to be enabled in."); this.blacklist_mode = config.getBoolean(configPath + ".use-as-blacklist", false, "Make it so that the plugin's features are disabled in the listed worlds."); - this.active_worlds = new HashSet<>(config.getList(configPath + ".worlds", + this.active_worlds = ImmutableSet.copyOf(config.getList(configPath + ".worlds", Arrays.asList("world", "world_nether", "world_the_end"))); }