Fix OnlineTime with moving it to SteamwarUser in SpigotCore #14
@ -22,7 +22,6 @@ package de.steamwar.lobby.inventories;
|
|||||||
import de.steamwar.inventory.SWInventory;
|
import de.steamwar.inventory.SWInventory;
|
||||||
import de.steamwar.inventory.SWItem;
|
import de.steamwar.inventory.SWItem;
|
||||||
import de.steamwar.lobby.utils.LobbyPlayer;
|
import de.steamwar.lobby.utils.LobbyPlayer;
|
||||||
import de.steamwar.sql.OnlineTime;
|
|
||||||
import de.steamwar.sql.SteamwarUser;
|
import de.steamwar.sql.SteamwarUser;
|
||||||
import de.steamwar.sql.UserGroup;
|
import de.steamwar.sql.UserGroup;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
@ -93,7 +92,8 @@ public class ParticleInventory {
|
|||||||
swInventory.setItem(slot + 3, mysteryParticle);
|
swInventory.setItem(slot + 3, mysteryParticle);
|
||||||
swInventory.setItem(slot + 4, mysteryParticle);
|
swInventory.setItem(slot + 4, mysteryParticle);
|
||||||
|
|
||||||
double onlineTime = OnlineTime.getOnlinetime(steamwarUser) / 60 / 60;
|
|
||||||
|
double onlineTime = steamwarUser.getOnlineTime() / 60 / 60;
|
||||||
|
|
||||||
if (onlineTime < 100) {
|
if (onlineTime < 100) {
|
||||||
return;
|
return;
|
||||||
|
@ -1,41 +0,0 @@
|
|||||||
/*
|
|
||||||
This file is a part of the SteamWar software.
|
|
||||||
|
|
||||||
Copyright (C) 2020 SteamWar.de-Serverteam
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Affero General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Affero General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Affero General Public License
|
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.steamwar.sql;
|
|
||||||
|
|
||||||
import java.sql.ResultSet;
|
|
||||||
import java.sql.SQLException;
|
|
||||||
|
|
||||||
public class OnlineTime {
|
|
||||||
|
|
||||||
public static double getOnlinetime(SteamwarUser steamwarUser) {
|
|
||||||
if (true) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
ResultSet set = SQL.select("SELECT SUM(UNIX_TIMESTAMP(EndTime) - UNIX_TIMESTAMP(StartTime)) as Playtime FROM Session WHERE UserID = ?", steamwarUser.getId());
|
|
||||||
try {
|
|
||||||
set.next();
|
|
||||||
return set.getBigDecimal("Playtime").doubleValue();
|
|
||||||
} catch (SQLException throwables) {
|
|
||||||
throwables.printStackTrace();
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
In neuem Issue referenzieren
Einen Benutzer sperren