Merge remote-tracking branch 'origin/master'
Dieser Commit ist enthalten in:
Commit
008fe4f817
@ -22,25 +22,27 @@ 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;
|
||||||
import org.bukkit.Particle;
|
import org.bukkit.Particle;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class ParticleInventory {
|
public class ParticleInventory {
|
||||||
|
|
||||||
private 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<String> lore = Arrays.asList("§aKlicken zum Auswählen");
|
||||||
|
|
||||||
private static SWInventory createInventory(Player player) {
|
private static SWInventory createInventory(Player player) {
|
||||||
LobbyPlayer lobbyPlayer = LobbyPlayer.getLobbyPlayer(player.getUniqueId());
|
LobbyPlayer lobbyPlayer = LobbyPlayer.getLobbyPlayer(player.getUniqueId());
|
||||||
UserGroup userGroup = SteamwarUser.get(player.getUniqueId()).getUserGroup();
|
SteamwarUser steamwarUser = SteamwarUser.get(player.getUniqueId());
|
||||||
|
UserGroup userGroup = steamwarUser.getUserGroup();
|
||||||
List<String> lore = new ArrayList<>();
|
|
||||||
lore.add("§aKlicken zum Auswählen");
|
|
||||||
|
|
||||||
SWInventory swInventory;
|
SWInventory swInventory;
|
||||||
if (userGroup == UserGroup.Member) {
|
if (userGroup == UserGroup.Member) {
|
||||||
@ -66,7 +68,8 @@ public class ParticleInventory {
|
|||||||
add(swInventory, Material.ZOMBIE_HEAD, "§7Mob", lore, Particle.SPELL_MOB, 25, player, lobbyPlayer);
|
add(swInventory, Material.ZOMBIE_HEAD, "§7Mob", lore, Particle.SPELL_MOB, 25, player, lobbyPlayer);
|
||||||
|
|
||||||
if (userGroup == UserGroup.Member) {
|
if (userGroup == UserGroup.Member) {
|
||||||
add(swInventory, Material.BARRIER, "§8Keine Partikel", lore, null, 31, player, lobbyPlayer);
|
add(swInventory, Material.BARRIER, "§8Keine Partikel", lore, null, 34, player, lobbyPlayer);
|
||||||
|
add(swInventory, 28, steamwarUser, player, lobbyPlayer);
|
||||||
} else {
|
} 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.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);
|
add(swInventory, Material.EXPERIENCE_BOTTLE, "§5Hexe", lore, Particle.SPELL_WITCH, 29, player, lobbyPlayer);
|
||||||
@ -76,12 +79,44 @@ 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.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.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, 40, player, lobbyPlayer);
|
add(swInventory, Material.BARRIER, "§8Keine Partikel", lore, null, 43, player, lobbyPlayer);
|
||||||
|
add(swInventory, 37, steamwarUser, player, lobbyPlayer);
|
||||||
}
|
}
|
||||||
|
|
||||||
return swInventory;
|
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<String> lore, Particle particle, int slot, Player player, LobbyPlayer lobbyPlayer, boolean customVelocity, float vx, float vy, float vz, double time) {
|
private static void add(SWInventory swInventory, Material material, String name, List<String> 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 -> {
|
SWItem swItem = new SWItem(material, name, lore, false, clickType -> {
|
||||||
lobbyPlayer.setParticle(particle, customVelocity);
|
lobbyPlayer.setParticle(particle, customVelocity);
|
||||||
|
@ -24,7 +24,8 @@ import de.steamwar.lobby.inventories.LobbyInventory;
|
|||||||
import de.steamwar.lobby.utils.LobbyPlayer;
|
import de.steamwar.lobby.utils.LobbyPlayer;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Sound;
|
import org.bukkit.Sound;
|
||||||
import org.bukkit.entity.*;
|
import org.bukkit.entity.EnderPearl;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
|
@ -21,7 +21,9 @@ package de.steamwar.lobby.utils;
|
|||||||
|
|
||||||
import org.bukkit.Particle;
|
import org.bukkit.Particle;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
public class LobbyPlayer {
|
public class LobbyPlayer {
|
||||||
|
|
||||||
|
41
src/de/steamwar/sql/OnlineTime.java
Normale Datei
41
src/de/steamwar/sql/OnlineTime.java
Normale Datei
@ -0,0 +1,41 @@
|
|||||||
|
/*
|
||||||
|
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