now working API, show me analog
Open
Nobody has claimed this yet.
type: feature
- Dominant language
- Shell
- Stars
- 4.4k
- Forks
- 623
- PR merge metrics
- No merged PRs in 30d
Description
Is your feature request related to a problem?
@EventHandler
public void onPlayerRespawn(PlayerRespawnEvent event) {
event.getPlayer().sendMessage(ChatColor.GREEN + "PlayerRespawnEvent executed");
}
@EventHandler
public void onPlayerTeleport(PlayerTeleportEvent event) {
event.getPlayer().sendMessage(ChatColor.GREEN + "PlayerTeleportEvent executed");
}
Describe the solution you'd like.
I figured out how to get around this (PlayerRespawnEvent event)
Map<String, ScheduledTask> playerTasks = new HashMap<>();
@EventHandler
public void onEntityDeath(EntityDeathEvent event) {
if (event.getEntity().getType() == EntityType.PLAYER) {
Player player = (Player) event.getEntity();
String playerName = player.getName();
ScheduledTask task = new FoliaTaskScheduler(plugin).runRepeating(player, () -> {
if (player.getHealth() != 0) {
//////////////////////////////////// Example ////////////////////////////////////////
event.getPlayer().sendMessage(ChatColor.GREEN + "PlayerRespawnEvent executed");
/////////////////////////////////////////////////////////////////////////////////////////////
ScheduledTask playerTask = playerTasks.remove(player);
if (playerTask != null) {
playerTask.cancel();
}
}
}, 1, 10 * 1);
playerTasks.put(playerName, task);
}
}
Describe alternatives you've considered.
I did not receive any message in the chat, following these steps, show me an analogue of this
Other
No response
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the PlayerRespawnEvent and PlayerTeleportEvent examples and the FoliaTaskScheduler usage shown in the issue. Determine whether the requested respawn-event analogue is an API change or documentation need, then verify the result with a minimal reproduction; done means providing a concrete supported analogue or clearly documenting that none exists.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- api
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100