generated from LabyMod/addon-template
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #50 from Global-Tags/feat/referrals
Implement referral bullet point
- Loading branch information
Showing
7 changed files
with
99 additions
and
7 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
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
39 changes: 39 additions & 0 deletions
39
core/src/main/java/com/rappytv/globaltags/interaction/ReferPlayerBulletPoint.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,39 @@ | ||
package com.rappytv.globaltags.interaction; | ||
|
||
import com.rappytv.globaltags.GlobalTagAddon; | ||
import com.rappytv.globaltags.api.ApiHandler; | ||
import com.rappytv.globaltags.types.PlayerInfo; | ||
import com.rappytv.globaltags.util.TagCache; | ||
import net.labymod.api.Laby; | ||
import net.labymod.api.client.component.Component; | ||
import net.labymod.api.client.entity.player.Player; | ||
import net.labymod.api.client.entity.player.interaction.BulletPoint; | ||
import net.labymod.api.client.gui.icon.Icon; | ||
|
||
public class ReferPlayerBulletPoint implements BulletPoint { | ||
|
||
@Override | ||
public Component getTitle() { | ||
return Component.translatable("globaltags.context.referral.name"); | ||
} | ||
|
||
@Override | ||
public Icon getIcon() { | ||
return null; | ||
} | ||
|
||
@Override | ||
public void execute(Player player) { | ||
ApiHandler.referPlayer(player.getUniqueId(), (response) -> Laby.references().chatExecutor().displayClientMessage( | ||
Component.empty() | ||
.append(GlobalTagAddon.prefix) | ||
.append(response.getMessage()) | ||
)); | ||
} | ||
|
||
@Override | ||
public boolean isVisible(Player player) { | ||
PlayerInfo executer = TagCache.get(Laby.labyAPI().getUniqueId()); | ||
return executer != null && !executer.hasReferred(); | ||
} | ||
} |
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