-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
198 additions
and
67 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
package dev.efnilite.witp.hook; | ||
|
||
import dev.efnilite.witp.ParkourPlayer; | ||
import dev.efnilite.witp.WITP; | ||
import me.clip.placeholderapi.expansion.PlaceholderExpansion; | ||
import org.bukkit.entity.Player; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
public class PlaceholderHook extends PlaceholderExpansion { | ||
|
||
@Override | ||
public @NotNull String getIdentifier() { | ||
return "witp"; | ||
} | ||
|
||
@Override | ||
public @NotNull String getAuthor() { | ||
return "Efnilite"; | ||
} | ||
|
||
@Override | ||
public boolean canRegister(){ | ||
return true; | ||
} | ||
|
||
|
||
@Override | ||
public boolean persist(){ | ||
return true; | ||
} | ||
|
||
@Override | ||
public @NotNull String getVersion() { | ||
return WITP.getInstance().getDescription().getVersion(); | ||
} | ||
|
||
@Override | ||
public String onPlaceholderRequest(Player player, @NotNull String params) { | ||
if (player == null) { | ||
return "player doesn't exist"; | ||
} | ||
ParkourPlayer pp = ParkourPlayer.getPlayer(player); | ||
if (pp == null) { | ||
return "player is not registered"; | ||
} | ||
|
||
switch (params) { | ||
case "highscore": | ||
case "high_score": | ||
return Integer.toString(pp.highScore); | ||
case "score": | ||
case "current_score": | ||
return Integer.toString(pp.getGenerator().score); | ||
case "time": | ||
case "current_time": | ||
return pp.getGenerator().time; | ||
case "version": | ||
case "ver": | ||
return WITP.getInstance().getDescription().getVersion(); | ||
case "blocklead": | ||
case "lead": | ||
return Integer.toString(pp.blockLead); | ||
case "style": | ||
return pp.style; | ||
case "time_pref": | ||
case "time_preference": | ||
return pp.time; | ||
} | ||
|
||
return null; | ||
} | ||
} |
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
Oops, something went wrong.