Skip to content

Commit

Permalink
bug fix #30
Browse files Browse the repository at this point in the history
  • Loading branch information
iXanadu13 committed Jan 14, 2025
1 parent fb52519 commit 9938901
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import pers.xanadu.enderdragon.metadata.DragonInfo;
import pers.xanadu.enderdragon.reward.RewardDist;
import pers.xanadu.enderdragon.reward.SpecialLoot;
import pers.xanadu.enderdragon.util.CollectionUtil;
import pers.xanadu.enderdragon.util.ExtraPotionEffect;
import pers.xanadu.enderdragon.metadata.MyDragon;
import pers.xanadu.enderdragon.util.Version;
Expand Down Expand Up @@ -297,7 +298,7 @@ else if("exp".equals(type)){
if(target == null) continue;
if("%attacker%".equals(target)){
loot_mp.compute(0,(k,v)->{
if(v==null) return Collections.singletonList(specialLoot);
if(v==null) return CollectionUtil.vec(specialLoot);
v.add(specialLoot);
return v;
});
Expand All @@ -307,7 +308,7 @@ else if("exp".equals(type)){
if (matcher.find()) {
Integer rank = Integer.parseInt(matcher.group(1));
loot_mp.compute(rank,(k,v)->{
if(v==null) return Collections.singletonList(specialLoot);
if(v==null) return CollectionUtil.vec(specialLoot);
v.add(specialLoot);
return v;
});
Expand Down
11 changes: 11 additions & 0 deletions src/main/java/pers/xanadu/enderdragon/util/CollectionUtil.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package pers.xanadu.enderdragon.util;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

public final class CollectionUtil {
public static <T> List<T> vec(T ...elems) {
return Arrays.stream(elems).collect(Collectors.toList());
}
}
2 changes: 1 addition & 1 deletion src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: EnderDragon
version: 2.5.4
version: 2.5.5
main: pers.xanadu.enderdragon.EnderDragon
author: Xanadu13
api-version: 1.13
Expand Down

0 comments on commit 9938901

Please sign in to comment.