-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HCCore first pull request #176
Open
EmperorNumerius
wants to merge
10
commits into
hackclub:master
Choose a base branch
from
EmperorNumerius:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+138
−0
Open
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
e3e69b5
Update RunAFKMessage.java
EmperorNumerius fd7c5ea
Create Obsidianbyhand.java
EmperorNumerius c3e8220
Create MobSlayerAdv.java
EmperorNumerius 5801d9a
Update Obsidianbyhand.java
EmperorNumerius 96fc559
Create NoSleepAdv.java
EmperorNumerius 035e397
Update NoSleepAdv.java
EmperorNumerius 419b645
Update and rename Obsidianbyhand.java to ObsidianMinerAdv.java
EmperorNumerius 8916b6e
Rename MobSlayerAdv.java to MasterMobSlayerAdv.java
EmperorNumerius a00dbee
Update NoSleepAdv.java
EmperorNumerius 09bae74
Update RunAFKMessage.java
EmperorNumerius File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
74 changes: 74 additions & 0 deletions
74
src/main/java/com/hackclub/hccore/advancements/MasterMobSlayerAdv.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
package com.hackclub.hccore.advancements; | ||
|
||
import com.fren_gor.ultimateAdvancementAPI.advancement.Advancement; | ||
import com.fren_gor.ultimateAdvancementAPI.advancement.BaseAdvancement; | ||
import com.fren_gor.ultimateAdvancementAPI.advancement.display.AdvancementDisplay; | ||
import com.fren_gor.ultimateAdvancementAPI.advancement.display.AdvancementDisplayBuilder; | ||
import com.fren_gor.ultimateAdvancementAPI.util.AdvancementKey; | ||
import com.fren_gor.ultimateAdvancementAPI.util.CoordAdapter; | ||
import org.bukkit.Material; | ||
import org.bukkit.entity.EntityType; | ||
import org.bukkit.event.entity.EntityDeathEvent; | ||
|
||
public class MasterMobSlayerAdv extends BaseAdvancement { | ||
|
||
static final AdvancementDisplayBuilder<AdvancementDisplay.Builder, AdvancementDisplay> displayBuilder = new AdvancementDisplay.Builder( | ||
Material.NETHERITE_AXE, "Master Mob Slayer") | ||
.challengeFrame() | ||
.announceChat() | ||
.showToast() | ||
.description("Kill EVERY hostile Mob 10 times"); | ||
static final int maxProgression = 640; // 10 times for each of the 64 hostile mobs | ||
|
||
public MasterMobSlayerAdv(Advancement root, AdvancementKey key, | ||
CoordAdapter adapter) { | ||
super(key.getKey(), displayBuilder.coords(adapter, key).build(), root, maxProgression); | ||
|
||
registerEvent(EntityDeathEvent.class, e -> { | ||
if (isHostile(e.getEntityType())) { | ||
if (e.getEntity().getKiller() != null) { | ||
incrementProgression(e.getEntity().getKiller()); | ||
} | ||
} | ||
}); | ||
} | ||
|
||
private boolean isHostile(EntityType entityType) { | ||
switch (entityType) { | ||
case BLAZE: | ||
case CREEPER: | ||
case DROWNED: | ||
case ELDER_GUARDIAN: | ||
case ENDERMAN: | ||
case ENDERMITE: | ||
case EVOKER: | ||
case GHAST: | ||
case GUARDIAN: | ||
case HOGLIN: | ||
case HUSK: | ||
case MAGMA_CUBE: | ||
case PHANTOM: | ||
case PIGLIN: | ||
case PIGLIN_BRUTE: | ||
case PILLAGER: | ||
case RAVAGER: | ||
case SHULKER: | ||
case SILVERFISH: | ||
case SKELETON: | ||
case SLIME: | ||
case SPIDER: | ||
case STRAY: | ||
case VEX: | ||
case VINDICATOR: | ||
case WITCH: | ||
case WITHER_SKELETON: | ||
case ZOGLIN: | ||
case ZOMBIE: | ||
case ZOMBIE_VILLAGER: | ||
case ZOMBIFIED_PIGLIN: | ||
return true; | ||
default: | ||
return false; | ||
} | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
src/main/java/com/hackclub/hccore/advancements/NoSleepAdv.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package com.hackclub.hccore.advancements; | ||
|
||
import com.fren_gor.ultimateAdvancementAPI.advancement.Advancement; | ||
import com.fren_gor.ultimateAdvancementAPI.advancement.BaseAdvancement; | ||
import com.fren_gor.ultimateAdvancementAPI.advancement.display.AdvancementDisplay; | ||
import com.fren_gor.ultimateAdvancementAPI.advancement.display.AdvancementDisplayBuilder; | ||
import com.fren_gor.ultimateAdvancementAPI.util.AdvancementKey; | ||
import com.fren_gor.ultimateAdvancementAPI.util.CoordAdapter; | ||
import org.bukkit.Material; | ||
import org.bukkit.Statistic; | ||
import org.bukkit.event.player.PlayerBedEnterEvent; | ||
|
||
public class NoSleepAdv extends BaseAdvancement { | ||
static final AdvancementDisplayBuilder<AdvancementDisplay.Builder, AdvancementDisplay> displayBuilder = | ||
new AdvancementDisplay.Builder(Material.RED_BED, "Please Sleep") | ||
.challengeFrame() | ||
.announceChat() | ||
.showToast() | ||
.description("Go to bed after staying up for a full week"); | ||
static final int maxProgression = 1; | ||
|
||
public NoSleepAdv(Advancement root, AdvancementKey key, | ||
CoordAdapter adapter) { | ||
super(key.getKey(), displayBuilder.coords(adapter, key).build(), root, maxProgression); | ||
|
||
registerEvent(PlayerBedEnterEvent.class, e -> { | ||
456dev marked this conversation as resolved.
Show resolved
Hide resolved
|
||
if (e.getPlayer().getStatistic(Statistic.TIME_SINCE_REST) >= 20 * 60 * 60 * 24 * 7) { | ||
grant(e.getPlayer()); | ||
} | ||
}); | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
src/main/java/com/hackclub/hccore/advancements/ObsidianMinerAdv.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package com.hackclub.hccore.advancements; | ||
|
||
import com.fren_gor.ultimateAdvancementAPI.advancement.Advancement; | ||
import com.fren_gor.ultimateAdvancementAPI.advancement.BaseAdvancement; | ||
import com.fren_gor.ultimateAdvancementAPI.advancement.display.AdvancementDisplay; | ||
import com.fren_gor.ultimateAdvancementAPI.advancement.display.AdvancementDisplayBuilder; | ||
import com.fren_gor.ultimateAdvancementAPI.util.AdvancementKey; | ||
import com.fren_gor.ultimateAdvancementAPI.util.CoordAdapter; | ||
import org.bukkit.Material; | ||
import org.bukkit.Statistic; | ||
import org.bukkit.event.block.BlockBreakEvent; | ||
|
||
public class ObsidianMinerAdv extends BaseAdvancement { | ||
static final AdvancementDisplayBuilder<AdvancementDisplay.Builder, AdvancementDisplay> displayBuilder = | ||
new AdvancementDisplay.Builder(Material.OBSIDIAN, "Do your fingers hurt?") | ||
.challengeFrame() | ||
.announceChat() | ||
.showToast() | ||
.description("Mine 10 pieces of Obsidian by hand"); | ||
static final int maxProgression = 10; | ||
|
||
public ObsidianMinerAdv(Advancement root, AdvancementKey key, | ||
CoordAdapter adapter) { | ||
super(key.getKey(), displayBuilder.coords(adapter, key).build(), root, maxProgression); | ||
|
||
registerEvent(BlockBreakEvent.class, e -> { | ||
if (e.getBlock().getType() == Material.OBSIDIAN && e.getPlayer().getInventory().getItemInMainHand().getType() == Material.AIR) { | ||
incrementProgression(e.getPlayer()); | ||
} | ||
}); | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't this mean that I could just kill 640 endermen in a farm and get the advancement?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i dont know
i thought it meant that you need to kill 10 of each hostile mob to get the advancement
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm I haven't tested it, but from what I see, it's not tracking how many of each mob you've killed, just how many mobs in total
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@polypixeldev i dont know how to make it count 10 of each mob death tho...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, this is a bit of a tough one to do. The only way I can think of would be to add a map to the PlayerData class which stores how many of each mob they've killed, and update it accordingly in the EntityDeathEvent handler.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you don't really need a map as player stats are already stored