Skip to content

Commit 6912777

Browse files
committed
success build
1 parent a549570 commit 6912777

File tree

4 files changed

+7
-17
lines changed

4 files changed

+7
-17
lines changed

src/main/java/me/hsgamer/gamesinthebox/game/feature/MaterialProbabilityFeature.java

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
import org.jetbrains.annotations.NotNull;
2424
import org.jetbrains.annotations.Nullable;
2525

26-
import java.util.Iterator;
26+
import java.util.AbstractMap;
2727

2828
/**
2929
* The {@link Feature} that contains {@link ProbabilityCollection} of {@link XMaterial}
@@ -91,15 +91,9 @@ public ProbabilityCollection<XMaterial> getMaterialCollection() {
9191
*/
9292
public ProbabilityCollection<BlockData> getBlockDataCollection() {
9393
if (blockDataCollection == null) {
94-
blockDataCollection = new ProbabilityCollection<>();
95-
Iterator<ProbabilityCollection.ProbabilitySetElement<XMaterial>> iterator = materialCollection.iterator();
96-
while (iterator.hasNext()) {
97-
ProbabilityCollection.ProbabilitySetElement<XMaterial> element = iterator.next();
98-
BlockData blockData = BlockHandlerUtil.getBlockData(element.getObject());
99-
if (blockData != null) {
100-
blockDataCollection.add(blockData, element.getProbability());
101-
}
102-
}
94+
blockDataCollection = materialCollection.stream()
95+
.map(entry -> new AbstractMap.SimpleImmutableEntry<>(BlockHandlerUtil.getBlockData(entry.getKey()), entry.getValue()))
96+
.collect(ProbabilityCollection.collector());
10397
}
10498
return blockDataCollection;
10599
}

src/main/java/me/hsgamer/gamesinthebox/game/simple/feature/SimpleMaterialProbabilityFeature.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -243,11 +243,7 @@ protected Optional<Pair<XMaterial, Number>> parseValue(@NotNull CommandSender se
243243
public void migrate(MaterialProbabilityFeature feature) {
244244
materialMap.clear();
245245
if (!feature.isInitialEmpty()) {
246-
Iterator<ProbabilityCollection.ProbabilitySetElement<XMaterial>> iterator = feature.getMaterialCollection().iterator();
247-
while (iterator.hasNext()) {
248-
ProbabilityCollection.ProbabilitySetElement<XMaterial> element = iterator.next();
249-
materialMap.put(element.getObject(), element.getProbability());
250-
}
246+
feature.getMaterialCollection().stream().forEach(entry -> materialMap.put(entry.getKey(), entry.getValue()));
251247
}
252248
}
253249
}

src/main/java/me/hsgamer/gamesinthebox/game/simple/feature/SimpleParticleFeature.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ protected boolean performAction(@NotNull CommandSender sender, @NotNull Number v
280280
* @param particleFeature the feature
281281
*/
282282
public void migrate(ParticleFeature particleFeature) {
283-
display = particleFeature.getParticleDisplay().clone();
283+
display = particleFeature.getParticleDisplay().copy();
284284
}
285285
}
286286
}

src/main/java/me/hsgamer/gamesinthebox/util/SoundUtil.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public static void doSoundAction(@NotNull String sound, @NotNull Consumer<XSound
5050
return;
5151
}
5252

53-
XSound.Record clonedSoundRecord = soundRecord.clone();
53+
XSound.Record clonedSoundRecord = soundRecord.copy();
5454
soundRecordConsumer.accept(clonedSoundRecord);
5555
}
5656

0 commit comments

Comments
 (0)