Skip to content

Commit 3b6348f

Browse files
authored
Merge pull request #561 from ItzKatze/master
cleaned up some things
2 parents 4a69fd3 + 9d36855 commit 3b6348f

17 files changed

Lines changed: 995 additions & 1685 deletions

File tree

commons/src/main/java/net/swofty/commons/item/attribute/ItemAttribute.java

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package net.swofty.commons.item.attribute;
22

3+
import lombok.Getter;
4+
import lombok.Setter;
35
import net.swofty.commons.statistics.ItemStatistics;
46
import org.jetbrains.annotations.Nullable;
57
import org.reflections.Reflections;
@@ -11,6 +13,8 @@
1113
import java.util.Set;
1214
import java.util.stream.Stream;
1315

16+
@Setter
17+
@Getter
1418
public abstract class ItemAttribute<T> {
1519
private static final ArrayList<ItemAttribute> attributes = new ArrayList<>();
1620

@@ -28,14 +32,6 @@ public ItemAttribute() {
2832

2933
public abstract String saveIntoString();
3034

31-
public T getValue() {
32-
return value;
33-
}
34-
35-
public void setValue(T value) {
36-
this.value = value;
37-
}
38-
3935
public static void registerItemAttributes() {
4036
loopThroughPackage(
4137
"net.swofty.commons.item.attribute.attributes", ItemAttribute.class

type.skyblockgeneric/src/main/java/net/swofty/type/skyblockgeneric/gui/inventories/sbmenu/stats/GUICombatStats.java

Lines changed: 285 additions & 462 deletions
Large diffs are not rendered by default.

type.skyblockgeneric/src/main/java/net/swofty/type/skyblockgeneric/gui/inventories/sbmenu/stats/GUIGatheringStats.java

Lines changed: 482 additions & 860 deletions
Large diffs are not rendered by default.

type.skyblockgeneric/src/main/java/net/swofty/type/skyblockgeneric/gui/inventories/sbmenu/stats/GUIMiscStats.java

Lines changed: 169 additions & 281 deletions
Large diffs are not rendered by default.

type.skyblockgeneric/src/main/java/net/swofty/type/skyblockgeneric/item/components/BowComponent.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public BowComponent(BiConsumer<SkyBlockPlayer, SkyBlockItem> shootHandler, boole
3030
}
3131

3232
public BowComponent(String handlerId, boolean shouldBeArrow) {
33-
this(BowRegistry.getHandler(handlerId).getShootHandler(), shouldBeArrow);
33+
this(BowRegistry.getHandler(handlerId).shootHandler(), shouldBeArrow);
3434
}
3535

3636
public void onBowShoot(SkyBlockPlayer player, SkyBlockItem item) {

type.skyblockgeneric/src/main/java/net/swofty/type/skyblockgeneric/item/handlers/ability/abilities/BuildersWandAbility.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ private static void fillConnectedFaces(SkyBlockPlayer player, Pos origin, BlockF
3636
List<Pos> blocksForUndo = new ArrayList<>(); // NOTE: To be used later
3737
blocks.add(origin);
3838
Instance w = player.getInstance();
39-
Vec[] check = null;
40-
Vec translate = null;
39+
Vec[] check;
40+
Vec translate;
4141
int blocksPlaced = 0;
4242

4343
check = switch (face) {
Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,11 @@
11
package net.swofty.type.skyblockgeneric.item.handlers.bow;
22

3-
import lombok.AllArgsConstructor;
43
import lombok.Builder;
5-
import lombok.Getter;
6-
import lombok.Setter;
74
import net.swofty.type.skyblockgeneric.item.SkyBlockItem;
85
import net.swofty.type.skyblockgeneric.user.SkyBlockPlayer;
96

107
import java.util.function.BiConsumer;
118

12-
@Getter
13-
@Setter
14-
@AllArgsConstructor
159
@Builder
16-
public class BowHandler {
17-
private final BiConsumer<SkyBlockPlayer, SkyBlockItem> shootHandler;
10+
public record BowHandler(BiConsumer<SkyBlockPlayer, SkyBlockItem> shootHandler) {
1811
}

type.skyblockgeneric/src/main/java/net/swofty/type/skyblockgeneric/item/handlers/lore/LoreRegistry.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,7 @@ public class LoreRegistry {
6969
"§e ",
7070
"§eClick to open!"
7171
), (item, player) -> "§aSkyBlock Menu §7(Click)"));
72-
register("HOT_POTATO_BOOK", new LoreConfig((item, player) -> {
73-
return PotatoType.allLores();
74-
}, null));
72+
register("HOT_POTATO_BOOK", new LoreConfig((item, player) -> PotatoType.allLores(), null));
7573
}
7674

7775
public static void register(String id, LoreConfig handler) {

type.skyblockgeneric/src/main/java/net/swofty/type/skyblockgeneric/item/handlers/orbs/ServerOrbRegistry.java

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,7 @@ public class ServerOrbRegistry {
1313
private static final Map<String, ServerOrbHandler> HANDLERS = new HashMap<>();
1414

1515
static {
16-
registerHandler("WHEAT_CRYSTAL_ORB_HANDLER", new ServerOrbHandler(crystalImpl -> {
17-
return Block.WHEAT;
18-
}));
16+
registerHandler("WHEAT_CRYSTAL_ORB_HANDLER", new ServerOrbHandler(crystalImpl -> Block.WHEAT));
1917
registerHandler("FLOWER_CRYSTAL_ORB_HANDLER", new ServerOrbHandler(crystalImpl -> {
2018
List<Material> flowers = Groups.FLOWERS;
2119
Material randomMaterial = flowers.get(new Random().nextInt(flowers.size()));
@@ -25,12 +23,8 @@ public class ServerOrbRegistry {
2523
boolean isPumpkin = new Random().nextBoolean();
2624
return isPumpkin ? Block.PUMPKIN : Block.MELON;
2725
}));
28-
registerHandler("POTATO_CRYSTAL_ORB_HANDLER", new ServerOrbHandler(crystalImpl -> {
29-
return Block.POTATOES;
30-
}));
31-
registerHandler("CARROT_CRYSTAL_ORB_HANDLER", new ServerOrbHandler(crystalImpl -> {
32-
return Block.CARROTS;
33-
}));
26+
registerHandler("POTATO_CRYSTAL_ORB_HANDLER", new ServerOrbHandler(crystalImpl -> Block.POTATOES));
27+
registerHandler("CARROT_CRYSTAL_ORB_HANDLER", new ServerOrbHandler(crystalImpl -> Block.CARROTS));
3428
}
3529

3630
public static void registerHandler(String id, ServerOrbHandler handler) {

type.skyblockgeneric/src/main/java/net/swofty/type/skyblockgeneric/item/handlers/place/PlaceEventRegistry.java

Lines changed: 27 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -18,49 +18,43 @@ public class PlaceEventRegistry {
1818
private static final Map<String, PlaceEventHandler> REGISTERED_HANDLERS = new HashMap<>();
1919

2020
static {
21-
register("minion", new PlaceEventHandler() {
22-
@Override
23-
public void onPlace(PlayerBlockPlaceEvent event, SkyBlockPlayer player, SkyBlockItem item) {
24-
if (!HypixelConst.isIslandServer()) {
25-
player.sendMessage("§cYou can only place minions on your island!");
26-
event.setCancelled(true);
27-
return;
28-
}
21+
register("minion", (event, player, item) -> {
22+
if (!HypixelConst.isIslandServer()) {
23+
player.sendMessage("§cYou can only place minions on your island!");
24+
event.setCancelled(true);
25+
return;
26+
}
2927

30-
DatapointMinionData.ProfileMinionData playerData = player.getSkyblockDataHandler().get(
31-
SkyBlockDataHandler.Data.MINION_DATA, DatapointMinionData.class
32-
).getValue();
28+
DatapointMinionData.ProfileMinionData playerData = player.getSkyblockDataHandler().get(
29+
SkyBlockDataHandler.Data.MINION_DATA, DatapointMinionData.class
30+
).getValue();
3331

34-
int slots = playerData.getSlots();
32+
int slots = playerData.getSlots();
3533

36-
IslandMinionData minionData = player.getSkyBlockIsland().getMinionData();
34+
IslandMinionData minionData = player.getSkyBlockIsland().getMinionData();
3735

38-
if (minionData.getMinions().size() >= slots) {
39-
player.sendMessage("§cYou have reached the maximum amount of minions you can place!");
40-
event.setCancelled(true);
41-
return;
42-
}
36+
if (minionData.getMinions().size() >= slots) {
37+
player.sendMessage("§cYou have reached the maximum amount of minions you can place!");
38+
event.setCancelled(true);
39+
return;
40+
}
4341

44-
MinionComponent component = item.toConfigurableItem().getComponent(MinionComponent.class);
42+
MinionComponent component = item.toConfigurableItem().getComponent(MinionComponent.class);
4543

46-
IslandMinionData.IslandMinion minion = minionData.initializeMinion(Pos.fromPoint(event.getBlockPosition()),
47-
component.getMinionRegistry(),
48-
item.getAttributeHandler().getMinionData(),
49-
item.getAttributeHandler().isMithrilInfused());
50-
minionData.spawn(minion);
44+
IslandMinionData.IslandMinion minion = minionData.initializeMinion(Pos.fromPoint(event.getBlockPosition()),
45+
component.getMinionRegistry(),
46+
item.getAttributeHandler().getMinionData(),
47+
item.getAttributeHandler().isMithrilInfused());
48+
minionData.spawn(minion);
5149

52-
event.setBlock(Block.AIR);
50+
event.setBlock(Block.AIR);
5351

54-
player.sendMessage(
55-
"§bYou placed a minion! (" + minionData.getMinions().size() + "/" + playerData.getSlots() + ")"
56-
);
57-
}
52+
player.sendMessage(
53+
"§bYou placed a minion! (" + minionData.getMinions().size() + "/" + playerData.getSlots() + ")"
54+
);
5855
});
59-
register("CARROT_CRYSTAL_PLACE", new PlaceEventHandler() {
60-
@Override
61-
public void onPlace(PlayerBlockPlaceEvent event, SkyBlockPlayer player, SkyBlockItem item) {
56+
register("CARROT_CRYSTAL_PLACE", (event, player, item) -> {
6257

63-
}
6458
});
6559
}
6660

0 commit comments

Comments
 (0)