Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public class ActionCollectionAdd implements SkyBlockEventClass {

@SkyBlockEvent(node = EventNodes.CUSTOM , requireDataLoaded = true)
public void run(CustomBlockBreakEvent event) {
if (SkyBlockConst.isIslandServer()) return;
if (event.getPlayerPlaced()) return;

SkyBlockPlayer player = event.getPlayer();
ItemType type = ItemType.fromMaterial(event.getMaterial());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ public class ActionSkillMiningHandler implements SkyBlockEventClass {

@SkyBlockEvent(node = EventNodes.CUSTOM , requireDataLoaded = true)
public void run(CustomBlockBreakEvent event) {
if (event.getPlayerPlaced()) return;

SkyBlockItem item = new SkyBlockItem(event.getMaterial());

if (!item.hasComponent(SkillableMineComponent.class)) return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,11 @@ else if (region != null) {
);

// Call custom break event
if (!(block.hasTag(Tag.Boolean("player_placed")) && block.getTag(Tag.Boolean("player_placed")))) {
SkyBlockEventHandler.callSkyBlockEvent(new CustomBlockBreakEvent(
player, material, event.getBlockPosition(), customDrops
));
}
boolean playerPlaced = block.hasTag(Tag.Boolean("player_placed")) && block.getTag(Tag.Boolean("player_placed"));

SkyBlockEventHandler.callSkyBlockEvent(new CustomBlockBreakEvent(
player, material, event.getBlockPosition(), customDrops, playerPlaced
));

// Process each drop with fortune multiplier
for (SkyBlockItem dropItem : customDrops) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,13 @@ public class CustomBlockBreakEvent implements PlayerInstanceEvent {
private final Material material;
private final Point point;
private final List<SkyBlockItem> drops;
private final Boolean playerPlaced;

public CustomBlockBreakEvent(SkyBlockPlayer player, Material material, Point point, List<SkyBlockItem> drops) {
public CustomBlockBreakEvent(SkyBlockPlayer player, Material material, Point point, List<SkyBlockItem> drops, Boolean playerPlaced) {
this.player = player;
this.material = material;
this.point = point;
this.drops = drops;
this.playerPlaced = playerPlaced;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
public class GUISkills extends SkyBlockInventoryGUI {
private final int[] displaySlots = {
20, 21, 22, 23, 24,
30, 32
30, 31, 32
};

public GUISkills() {
Expand Down Expand Up @@ -55,31 +55,40 @@ public ItemStack.Builder getItem(SkyBlockPlayer player) {
set(new GUIClickableItem(slot) {
@Override
public void run(InventoryPreClickEvent e, SkyBlockPlayer player) {
if (category == SkillCategories.CARPENTRY && !player.getMissionData().hasCompleted("give_wool_to_carpenter")) return;
new GUISkillCategory(category, 0).open(player);
}

@Override
public ItemStack.Builder getItem(SkyBlockPlayer player) {
ArrayList<String> lore = new ArrayList<>(skillCategory.getDescription());
lore.add(" ");
ArrayList<String> lore = new ArrayList<>();
if (category == SkillCategories.CARPENTRY && !player.getMissionData().hasCompleted("give_wool_to_carpenter")) {
lore.add("§7Unlock this skill by talking to the");
lore.add("§7Carpenter.");
lore.add("");
lore.add("§bNot unlocked!");
} else {
lore.addAll(skillCategory.getDescription());
lore.add(" ");

Integer nextLevel = player.getSkills().getNextLevel(category);
Integer nextLevel = player.getSkills().getNextLevel(category);

if (nextLevel != null) {
player.getSkills().getDisplay(lore, category, skillCategory.getRewards()[nextLevel - 1].requirement(),
"§7Progress to Level " + StringUtility.getAsRomanNumeral(nextLevel) + ": ");
lore.add(" ");
if (nextLevel != null) {
player.getSkills().getDisplay(lore, category, skillCategory.getRewards()[nextLevel - 1].requirement(),
"§7Progress to Level " + StringUtility.getAsRomanNumeral(nextLevel) + ": ");
lore.add(" ");

SkillCategory.SkillReward[] rewards = skillCategory.getRewards();
SkillCategory.SkillReward reward = rewards[nextLevel - 1];
SkillCategory.SkillReward[] rewards = skillCategory.getRewards();
SkillCategory.SkillReward reward = rewards[nextLevel - 1];

reward.getDisplay(lore);
} else {
lore.add("§cMax Level Reached!");
}
reward.getDisplay(lore);
} else {
lore.add("§cMax Level Reached!");
}

lore.add(" ");
lore.add("§eClick to view!");
lore.add(" ");
lore.add("§eClick to view!");
}

return ItemStackCreator.getStack(
"§a" + skillCategory.getName() + " " +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public enum MissionSet {
TIMBER(MissionTalkToLumberjack.class, MissionBreakOaklog.class, MissionTalkToLumberjackAgain.class),
FIRST_HARVEST(MissionTalkToFarmer.class, MissionCollectWheat.class, MissionTalkToFarmerAgain.class),
BACK_AT_THE_BARNYARD(MissionTalkToFarmHand.class, MissionCraftWheatMinion.class, MissionTalkToFarmhandAgain.class),
CARPENTRY(MissionGiveWoolToCarpenter.class),
;

private final Class<? extends SkyBlockMission>[] missions;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package net.swofty.types.generic.mission.missions;

import net.minestom.server.event.player.PlayerSpawnEvent;
import net.swofty.types.generic.SkyBlockConst;
import net.swofty.types.generic.event.EventNodes;
import net.swofty.types.generic.event.SkyBlockEvent;
import net.swofty.types.generic.event.custom.CustomBlockBreakEvent;
Expand All @@ -17,6 +18,8 @@
public class MissionBreakLog extends SkyBlockMission {
@SkyBlockEvent(node = EventNodes.CUSTOM, requireDataLoaded = false)
public void endMission(CustomBlockBreakEvent event) {
if (event.getPlayerPlaced()) return;

MissionData data = event.getPlayer().getMissionData();

if (!data.isCurrentlyActive(MissionBreakLog.class) || data.hasCompleted(MissionBreakLog.class)) return;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package net.swofty.types.generic.mission.missions;

import net.swofty.types.generic.mission.MissionData;
import net.swofty.types.generic.mission.SkyBlockMission;
import net.swofty.types.generic.region.RegionType;
import net.swofty.types.generic.user.SkyBlockPlayer;

import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;

//Opens Carpentry Table Recipe on mission complete

public class MissionGiveWoolToCarpenter extends SkyBlockMission {

@Override
public String getID() {
return "give_wool_to_carpenter";
}

@Override
public String getName() {
return "Give a stack of White Wool to Carpenter";
}

@Override
public Map<String, Object> onStart(SkyBlockPlayer player, MissionData.ActiveMission mission) {
mission.getNewObjectiveText().forEach(player::sendMessage);
return new HashMap<>();
}

@Override
public void onEnd(SkyBlockPlayer player, Map<String, Object> customData, MissionData.ActiveMission mission) {

}

@Override
public Set<RegionType> getValidRegions() {
return Collections.singleton(RegionType.VILLAGE);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ public enum SkillCategories {
FORAGING(ForagingSkill.class),
ENCHANTING(EnchantingSkill.class),
RUNECRAFTING(RunecraftingSkill.class),
CARPENTRY(CarpentrySkill.class),
;

private final Class<? extends SkillCategory> clazz;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
package net.swofty.type.hub.npcs;

import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.event.ClickEvent;
import net.minestom.server.coordinate.Pos;
import net.swofty.commons.item.ItemType;
import net.swofty.types.generic.entity.npc.NPCDialogue;
import net.swofty.types.generic.entity.npc.NPCParameters;
import net.swofty.types.generic.entity.npc.SkyBlockNPC;
import net.swofty.types.generic.mission.MissionData;
import net.swofty.types.generic.mission.missions.MissionGiveWoolToCarpenter;
import net.swofty.types.generic.user.SkyBlockPlayer;

public class NPCCarpenter extends SkyBlockNPC {
import java.util.List;

public class NPCCarpenter extends NPCDialogue {

public NPCCarpenter() {
super(new NPCParameters() {
@Override
public String[] holograms(SkyBlockPlayer player) {
return new String[]{"§9Carpenter", "§e§lCLICK"};
return new String[]{"§fCarpenter", "§e§lCLICK"};
}

@Override
Expand All @@ -40,8 +43,55 @@ public boolean looking() {

@Override
public void onClick(PlayerClickNPCEvent e) {
e.player().sendMessage(Component.text("§cThis Feature is not there yet. §aOpen a Pull request HERE to get it added quickly!")
.clickEvent(ClickEvent.clickEvent(ClickEvent.Action.OPEN_URL, "https://github.com/Swofty-Developments/HypixelSkyBlock")));
if (isInDialogue(e.player())) return;
MissionData data = e.player().getMissionData();

if (!data.isCurrentlyActive(MissionGiveWoolToCarpenter.class) && !data.hasCompleted(MissionGiveWoolToCarpenter.class)) {
setDialogue(e.player(), "initial-hello").thenRun(() -> {
data.startMission(MissionGiveWoolToCarpenter.class);
});
return;
}
if (!data.hasCompleted(MissionGiveWoolToCarpenter.class) && data.isCurrentlyActive(MissionGiveWoolToCarpenter.class)) {
if (e.player().getAmountInInventory(ItemType.WHITE_WOOL) >= 64) {
e.player().takeItem(ItemType.WHITE_WOOL, 64);
setDialogue(e.player(), "completed-quest").thenRun(() -> {
data.endMission(MissionGiveWoolToCarpenter.class);
});
} else {
e.player().sendMessage("§e[NPC] Carpenter§f: Come back with a stack of White Wool!");
}
return;
}
if (data.hasCompleted(MissionGiveWoolToCarpenter.class)) {
setDialogue(e.player(), "spoke-again");
}
}

@Override
public NPCDialogue.DialogueSet[] getDialogueSets(SkyBlockPlayer player) {
return List.of(
NPCDialogue.DialogueSet.builder()
.key("initial-hello").lines(new String[]{
"Hi, " + player.getUsername() + "! Welcome to the §aFurniture Shop§f.",
"Sales are too good right now, I can't keep up with the demand!",
"Could you bring a §astack of White Wool§f to help replenish my stock?",
"Sheep over in The Barn drop wool, but you can also purchase it from the §dWool Weaver§f.",
"She lives in a house not far from here - it's over by the water fountain."
}).build(),
NPCDialogue.DialogueSet.builder()
.key("completed-quest").lines(new String[]{
"Wow, thanks so much for the help!",
"Carpentry is my passion, I always love to teach others.",
"Here's the recipe for the §aCarpentry Table§f. You can place it in your world and craft furniture that you've unlocked!",
"You can now gain Carpentry XP by crafting items. Leveling your §aCarpentry Skill§f unlocks new furniture recipes!",
"Some furniture is available exclusively in the Furniture Shop downstairs. Check it out!"
}).build(),
NPCDialogue.DialogueSet.builder()
.key("spoke-again").lines(new String[]{
"Check out the Furniture Shop downstairs!",
"The Furniture Shop is downstairs. Purchase cool furniture down there!"
}).build()
).stream().toArray(NPCDialogue.DialogueSet[]::new);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -85,5 +85,4 @@ public DialogueSet[] getDialogueSets(SkyBlockPlayer player) {
}).build()
).stream().toArray(DialogueSet[]::new);
}

}
Loading