mirror of
https://github.com/webbukkit/dynmap.git
synced 2024-12-24 17:47:40 +01:00
added join and quit messages to chat
This commit is contained in:
parent
00485ddcc2
commit
7c917b729e
@ -40,6 +40,8 @@ web:
|
||||
showplayerfacesonmap: true
|
||||
showplayerfacesinmenu: true
|
||||
focuschatballoons: false
|
||||
joinmessage: %playername% joined
|
||||
quitmessage: %playername% quit
|
||||
|
||||
# The clock that is shown alongside the map.
|
||||
clock: timeofday
|
||||
|
@ -2,6 +2,7 @@ package org.dynmap;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.player.PlayerChatEvent;
|
||||
import org.bukkit.event.player.PlayerEvent;
|
||||
import org.bukkit.event.player.PlayerListener;
|
||||
import org.bukkit.util.config.ConfigurationNode;
|
||||
|
||||
@ -69,4 +70,19 @@ public class DynmapPlayerListener extends PlayerListener {
|
||||
public void onPlayerChat(PlayerChatEvent event) {
|
||||
mgr.pushUpdate(new Client.ChatMessage(event.getPlayer().getName(), event.getMessage()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when a player joins or quits the server
|
||||
*/
|
||||
public void onPlayerJoin(PlayerEvent event) {
|
||||
String joinMessage = configuration.getString("joinmessage", "%playername% joined");
|
||||
joinMessage = joinMessage.replaceAll("%playername%", event.getPlayer().getName());
|
||||
mgr.pushUpdate(new Client.ChatMessage("Server", joinMessage));
|
||||
}
|
||||
public void onPlayerQuit(PlayerEvent event) {
|
||||
String quitMessage = configuration.getString("quitmessage", "%playername% quit");
|
||||
quitMessage = quitMessage.replaceAll("%playername%", event.getPlayer().getName());
|
||||
mgr.pushUpdate(new Client.ChatMessage("Server", quitMessage));
|
||||
}
|
||||
|
||||
}
|
@ -64,7 +64,7 @@ public class DynmapPlugin extends JavaPlugin {
|
||||
|
||||
tilesDirectory = getFile(configuration.getString("tilespath", "web/tiles"));
|
||||
tilesDirectory.mkdirs();
|
||||
|
||||
|
||||
playerList = new PlayerList(getServer());
|
||||
playerList.load();
|
||||
|
||||
@ -127,6 +127,9 @@ public class DynmapPlugin extends JavaPlugin {
|
||||
PlayerListener playerListener = new DynmapPlayerListener(mapManager, playerList, configuration);
|
||||
getServer().getPluginManager().registerEvent(Event.Type.PLAYER_COMMAND, playerListener, Priority.Normal, this);
|
||||
getServer().getPluginManager().registerEvent(Event.Type.PLAYER_CHAT, playerListener, Priority.Normal, this);
|
||||
getServer().getPluginManager().registerEvent(Event.Type.PLAYER_LOGIN, playerListener, Priority.Normal, this);
|
||||
getServer().getPluginManager().registerEvent(Event.Type.PLAYER_JOIN, playerListener, Priority.Normal, this);
|
||||
getServer().getPluginManager().registerEvent(Event.Type.PLAYER_QUIT, playerListener, Priority.Normal, this);
|
||||
}
|
||||
|
||||
private static File combinePaths(File parent, String path) {
|
||||
|
Loading…
Reference in New Issue
Block a user