add playtime Checker

This commit is contained in:
Chris 2017-02-07 22:59:17 +01:00
parent 1debfcf709
commit 612c30a106
1 changed files with 16 additions and 0 deletions

View File

@ -24,6 +24,7 @@ import com.earth2me.essentials.Essentials;
import com.earth2me.essentials.User;
import li.inc.PlaytimeReloaded.DataStore.Config;
import li.inc.PlaytimeReloaded.DataStore.DB.MySQL;
import li.inc.PlaytimeReloaded.DataStore.TimeCommand;
import li.inc.PlaytimeReloaded.DataStore.UUIDCache;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
@ -154,6 +155,8 @@ public class Playtime extends JavaPlugin implements Listener
_spielerPlaytime = _spielerPlaytime + _time;
m_mysql.update(_playerUUID, _spielerPlaytime);
checkPlaytimeCommand(_playerUUID, _spielerPlaytime);
}
private UUID getPlayerUUID(String _playerName)
@ -239,4 +242,17 @@ public class Playtime extends JavaPlugin implements Listener
return returnText;
}
private void checkPlaytimeCommand(UUID _player, int _time)
{
List<TimeCommand> _timeCommands = m_config.getTimeCommandList();
for (TimeCommand _tc: _timeCommands)
{
if(_tc.getTime() == _time)
{
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), _tc.getCommand());
}
}
}
}