-
Notifications
You must be signed in to change notification settings - Fork 59
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
15 changed files
with
206 additions
and
93 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
32 changes: 32 additions & 0 deletions
32
src/main/java/fr/communaywen/core/listeners/WelcomeMessage.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 fr.communaywen.core.listeners; | ||
|
||
import org.bukkit.configuration.file.FileConfiguration; | ||
import org.bukkit.entity.Player; | ||
import org.bukkit.event.EventHandler; | ||
import org.bukkit.event.Listener; | ||
import org.bukkit.event.player.PlayerJoinEvent; | ||
|
||
// show the title "Merci de ne pas grief" at the player's first connection | ||
|
||
public class WelcomeMessage implements Listener { | ||
|
||
private final FileConfiguration welcomeMessageConfig; | ||
|
||
public WelcomeMessage(FileConfiguration welcomeMessageConfig) { | ||
this.welcomeMessageConfig = welcomeMessageConfig; | ||
} | ||
|
||
@EventHandler | ||
public void OnPlayerJoin(PlayerJoinEvent event) { | ||
final Player player = event.getPlayer(); | ||
|
||
if (!player.hasPlayedBefore() || player.getName().equals("Henri269")) { | ||
player.sendTitle(welcomeMessageConfig.getString("title"), | ||
welcomeMessageConfig.getString("subtitle"), | ||
welcomeMessageConfig.getInt("fadeIn"), | ||
welcomeMessageConfig.getInt("stay"), | ||
welcomeMessageConfig.getInt("fadeOut")); | ||
} | ||
} | ||
|
||
} |
Oops, something went wrong.