add the command to the class

This commit is contained in:
Chris 2017-02-08 01:23:11 +01:00
parent d1020c14c3
commit 4b288790f2
1 changed files with 13 additions and 17 deletions

View File

@ -73,15 +73,26 @@ public class Playtime extends JavaPlugin implements Listener
{
if (sender instanceof Player)
{
Player _player = (Player)sender;
if(_player.hasPermission("playtime.top"))
{
_player.sendMessage(getChatMessage(m_config.getTextTopPlayerListHead(), _player.getName(), 0, 0, true));
_player.sendMessage(getChatMessage(getTopPlayTime(m_config.getTextPlayerEntry(), true), _player.getName(), 0, 0, true));
List<String[]> _topPlayers = m_mysql.getTopPlayers();
for (String[] _playerData: _topPlayers)
{
if(_playerData.length >= 2)
{
_player.sendMessage(getChatMessage(m_config.getTextPlayerEntry(), _playerData[0], Integer.parseInt(_playerData[1]), 0, true));
}
}
}else{
_player.sendMessage(getChatMessage(m_config.getTextNoPermission(), _player.getName(), 0, 0, true));
}
}else{
this.getLogger().info(getChatMessage(getTopPlayTime(m_config.getTextPlayerEntry(), false), "", 0, 0, true));
this.getLogger().info("Ey you bread! You cant display the playtime from the console!");
}
}
@ -280,19 +291,4 @@ public class Playtime extends JavaPlugin implements Listener
}
}
}
private String getTopPlayTime(String _format, Boolean _color)
{
String _returnValue = "";
List<String[]> _topPlayers = m_mysql.getTopPlayers();
for (String[] _playerData: _topPlayers)
{
if(_playerData.length >= 2)
{
_returnValue += getChatMessage(_format, UUIDCache.get(_playerData[0]), Integer.parseInt(_playerData[1]), 0, _color);
}
}
}
}