Archiviert
13
0

Particle #13

Manuell gemergt
YoyoNow hat 3 Commits von Particle nach master 2020-10-24 17:46:52 +02:00 zusammengeführt
4 geänderte Dateien mit 85 neuen und 10 gelöschten Zeilen

Datei anzeigen

@ -22,26 +22,27 @@ 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;
import org.bukkit.Particle;
import org.bukkit.entity.Player;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.regex.MatchResult;
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<String> lore = Arrays.asList("§aKlicken zum Auswählen");
private static SWInventory createInventory(Player player) {
LobbyPlayer lobbyPlayer = LobbyPlayer.getLobbyPlayer(player.getUniqueId());
UserGroup userGroup = SteamwarUser.get(player.getUniqueId()).getUserGroup();
List<String> lore = new ArrayList<>();
lore.add("§aKlicken zum Auswählen");
SteamwarUser steamwarUser = SteamwarUser.get(player.getUniqueId());
UserGroup userGroup = steamwarUser.getUserGroup();
SWInventory swInventory;
if (userGroup == UserGroup.Member) {
@ -67,7 +68,8 @@ 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, 31, player, lobbyPlayer);
add(swInventory, Material.BARRIER, "§8Keine Partikel", lore, null, 34, player, lobbyPlayer);
add(swInventory, 28, steamwarUser, 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);
@ -77,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.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);
Review

Evt. das man als Teammitglied diese Partikle auch so hat? Ohne die Onlinezeit?

Evt. das man als Teammitglied diese Partikle auch so hat? Ohne die Onlinezeit?
Review

Das ist Absicht, sodass auch Teammitglieder diesen Ansporn haben

Das ist Absicht, sodass auch Teammitglieder diesen Ansporn haben
}
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) {
SWItem swItem = new SWItem(material, name, lore, false, clickType -> {
lobbyPlayer.setParticle(particle, customVelocity);

Datei anzeigen

@ -24,7 +24,8 @@ import de.steamwar.lobby.inventories.LobbyInventory;
import de.steamwar.lobby.utils.LobbyPlayer;
import org.bukkit.Bukkit;
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.EventPriority;
import org.bukkit.event.Listener;

Datei anzeigen

@ -21,7 +21,9 @@ package de.steamwar.lobby.utils;
import org.bukkit.Particle;
import java.util.*;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
public class LobbyPlayer {

Datei anzeigen

@ -0,0 +1,38 @@
/*
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) {
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;
}
}