From 70652aa6fe3b980e02a0b7085a060722b03cf09c Mon Sep 17 00:00:00 2001 From: jojo Date: Sun, 25 Oct 2020 08:49:42 +0100 Subject: [PATCH] Revert to before ParticleInventory changes --- .../lobby/inventories/ParticleInventory.java | 39 +----------------- src/de/steamwar/sql/OnlineTime.java | 41 ------------------- 2 files changed, 2 insertions(+), 78 deletions(-) delete mode 100644 src/de/steamwar/sql/OnlineTime.java diff --git a/src/de/steamwar/lobby/inventories/ParticleInventory.java b/src/de/steamwar/lobby/inventories/ParticleInventory.java index b3fb85b..15ca3ca 100644 --- a/src/de/steamwar/lobby/inventories/ParticleInventory.java +++ b/src/de/steamwar/lobby/inventories/ParticleInventory.java @@ -22,7 +22,6 @@ package de.steamwar.lobby.inventories; import de.steamwar.inventory.SWInventory; import de.steamwar.inventory.SWItem; import de.steamwar.lobby.utils.LobbyPlayer; -import de.steamwar.sql.OnlineTime; import de.steamwar.sql.SteamwarUser; import de.steamwar.sql.UserGroup; import org.bukkit.Material; @@ -36,7 +35,6 @@ public class ParticleInventory { private ParticleInventory() {} - private static SWItem mysteryParticle = new SWItem(Material.STRUCTURE_VOID, "§5§l???", Arrays.asList("§5Ein mysteriöses Partikel"), false, clickType -> {}); private static List lore = Arrays.asList("§aKlicken zum Auswählen"); private static SWInventory createInventory(Player player) { @@ -68,8 +66,7 @@ public class ParticleInventory { add(swInventory, Material.ZOMBIE_HEAD, "§7Mob", lore, Particle.SPELL_MOB, 25, player, lobbyPlayer); if (userGroup == UserGroup.Member) { - add(swInventory, Material.BARRIER, "§8Keine Partikel", lore, null, 34, player, lobbyPlayer); - add(swInventory, 28, steamwarUser, player, lobbyPlayer); + add(swInventory, Material.BARRIER, "§8Keine Partikel", lore, null, 31, player, lobbyPlayer); } else { add(swInventory, Material.SPIDER_EYE, "§5Damage", lore, Particle.DAMAGE_INDICATOR, 28, player, lobbyPlayer, true, 0.2F, 0F, 0.2F, 0.01); add(swInventory, Material.EXPERIENCE_BOTTLE, "§5Hexe", lore, Particle.SPELL_WITCH, 29, player, lobbyPlayer); @@ -79,44 +76,12 @@ public class ParticleInventory { add(swInventory, Material.TOTEM_OF_UNDYING, "§aTotem", lore, Particle.TOTEM, 33, player, lobbyPlayer, true, 0F, 0.2F, 0F, 0.2); add(swInventory, Material.END_ROD, "§fEnd Rod", lore, Particle.END_ROD, 34, player, lobbyPlayer, true, 0.2F, 0.2F, 0.2F, 0.01); - add(swInventory, Material.BARRIER, "§8Keine Partikel", lore, null, 43, player, lobbyPlayer); - add(swInventory, 37, steamwarUser, player, lobbyPlayer); + add(swInventory, Material.BARRIER, "§8Keine Partikel", lore, null, 40, player, lobbyPlayer); } return swInventory; } - private static void add(SWInventory swInventory, int slot, SteamwarUser steamwarUser, Player player, LobbyPlayer lobbyPlayer) { - swInventory.setItem(slot, mysteryParticle); - swInventory.setItem(slot + 1, mysteryParticle); - swInventory.setItem(slot + 2, mysteryParticle); - swInventory.setItem(slot + 3, mysteryParticle); - swInventory.setItem(slot + 4, mysteryParticle); - - double onlineTime = OnlineTime.getOnlinetime(steamwarUser) / 60 / 60; - - if (onlineTime < 100) { - return; - } - add(swInventory, Material.DRAGON_BREATH, "§5Dragon Breath", lore, Particle.DRAGON_BREATH, slot, player, lobbyPlayer); - if (onlineTime < 200) { - return; - } - add(swInventory, Material.DOLPHIN_SPAWN_EGG, "§bDelphin", lore, Particle.DOLPHIN, slot + 1, player, lobbyPlayer); - if (onlineTime < 300) { - return; - } - add(swInventory, Material.RED_CONCRETE, "§cInstant Spell", lore, Particle.SPELL_INSTANT, slot + 2, player, lobbyPlayer); - if (onlineTime < 400) { - return; - } - add(swInventory, Material.PURPLE_WOOL, "§5Portal", lore, Particle.PORTAL, slot + 3, player, lobbyPlayer); - if (onlineTime < 500) { - return; - } - add(swInventory, Material.WHITE_DYE, "§fFlash", lore, Particle.FLASH, slot + 4, player, lobbyPlayer); - } - private static void add(SWInventory swInventory, Material material, String name, List lore, Particle particle, int slot, Player player, LobbyPlayer lobbyPlayer, boolean customVelocity, float vx, float vy, float vz, double time) { SWItem swItem = new SWItem(material, name, lore, false, clickType -> { lobbyPlayer.setParticle(particle, customVelocity); diff --git a/src/de/steamwar/sql/OnlineTime.java b/src/de/steamwar/sql/OnlineTime.java deleted file mode 100644 index 35be024..0000000 --- a/src/de/steamwar/sql/OnlineTime.java +++ /dev/null @@ -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 . -*/ - -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; - } - -}