-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add LeaderboardNPC + LB NPCs to the lobby + fgr leaderboard + ability…
… to "destroy" holograms (nulling instance ref), submit username to DB cache on login
Showing
15 changed files
with
146 additions
and
46 deletions.
There are no files selected for viewing
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
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
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
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 |
---|---|---|
|
@@ -36,4 +36,6 @@ public interface PaginatedHologram { | |
@NotNull Point location(); | ||
|
||
void clear(); | ||
|
||
void destroy(); | ||
} |
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
5 changes: 4 additions & 1 deletion
5
core/src/main/java/org/phantazm/core/leaderboard/Leaderboard.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 |
---|---|---|
@@ -1,7 +1,10 @@ | ||
package org.phantazm.core.leaderboard; | ||
|
||
import net.minestom.server.instance.Instance; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
public interface Leaderboard { | ||
void show(); | ||
void show(@NotNull Instance instance); | ||
|
||
void hide(); | ||
} |
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
59 changes: 59 additions & 0 deletions
59
core/src/main/java/org/phantazm/core/npc/LeaderboardNPC.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,59 @@ | ||
package org.phantazm.core.npc; | ||
|
||
import com.github.steanky.element.core.annotation.*; | ||
import net.minestom.server.entity.Player; | ||
import net.minestom.server.instance.Instance; | ||
import org.jetbrains.annotations.NotNull; | ||
import org.jetbrains.annotations.Nullable; | ||
import org.phantazm.commons.InjectionStore; | ||
import org.phantazm.commons.MonoComponent; | ||
import org.phantazm.core.leaderboard.Leaderboard; | ||
|
||
import java.util.UUID; | ||
|
||
@Model("npc.leaderboard") | ||
@Cache | ||
public class LeaderboardNPC implements MonoComponent<NPC> { | ||
private final MonoComponent<Leaderboard> leaderboard; | ||
|
||
@FactoryMethod | ||
public LeaderboardNPC(@NotNull @Child("leaderboard") MonoComponent<Leaderboard> leaderboard) { | ||
this.leaderboard = leaderboard; | ||
} | ||
|
||
@Override | ||
public @NotNull NPC apply(@NotNull InjectionStore injectionStore) { | ||
return new Impl(leaderboard.apply(injectionStore)); | ||
} | ||
|
||
@DataObject | ||
public record Data(@NotNull @ChildPath("leaderboard") String leaderboard) { | ||
} | ||
|
||
private record Impl(Leaderboard leaderboard) implements NPC { | ||
@Override | ||
public void handleInteraction(@NotNull Player interactor) { | ||
|
||
} | ||
|
||
@Override | ||
public void spawn(@NotNull Instance instance) { | ||
leaderboard.show(instance); | ||
} | ||
|
||
@Override | ||
public void despawn() { | ||
leaderboard.hide(); | ||
} | ||
|
||
@Override | ||
public @Nullable UUID uuid() { | ||
return null; | ||
} | ||
|
||
@Override | ||
public void tick(long time) { | ||
|
||
} | ||
} | ||
} |
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
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
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
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
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
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
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