From a5e906537a946e5b60666f78da6a5b177a07cd1c Mon Sep 17 00:00:00 2001 From: Lixfel Date: Tue, 31 Dec 2019 15:11:00 +0100 Subject: [PATCH] Changing to String ItemSkull --- .../src/de/steamwar/inventory/SWItem_10.java | 3 +- .../src/de/steamwar/inventory/SWItem_12.java | 11 +--- .../src/de/steamwar/inventory/SWItem_14.java | 7 ++- .../src/de/steamwar/inventory/SWItem_15.java | 3 +- .../src/de/steamwar/inventory/SWItem_8.java | 7 ++- .../src/de/steamwar/inventory/SWItem_9.java | 3 +- .../src/de/steamwar/inventory/SWItem.java | 16 +++--- .../src/de/steamwar/sql/FightStatistic.java | 53 +++++++++++++++++++ 8 files changed, 74 insertions(+), 29 deletions(-) create mode 100644 SpigotCore_Main/src/de/steamwar/sql/FightStatistic.java diff --git a/SpigotCore_10/src/de/steamwar/inventory/SWItem_10.java b/SpigotCore_10/src/de/steamwar/inventory/SWItem_10.java index dc90dbb..c5232e9 100644 --- a/SpigotCore_10/src/de/steamwar/inventory/SWItem_10.java +++ b/SpigotCore_10/src/de/steamwar/inventory/SWItem_10.java @@ -1,7 +1,6 @@ package de.steamwar.inventory; import org.bukkit.Material; -import org.bukkit.OfflinePlayer; import org.bukkit.inventory.ItemStack; class SWItem_10 { @@ -15,7 +14,7 @@ class SWItem_10 { return SWItem_8.getDye(); } - static ItemStack setSkullOwner(OfflinePlayer player){ + static ItemStack setSkullOwner(String player){ return SWItem_8.setSkullOwner(player); } } diff --git a/SpigotCore_12/src/de/steamwar/inventory/SWItem_12.java b/SpigotCore_12/src/de/steamwar/inventory/SWItem_12.java index 99cfdab..5aeef24 100644 --- a/SpigotCore_12/src/de/steamwar/inventory/SWItem_12.java +++ b/SpigotCore_12/src/de/steamwar/inventory/SWItem_12.java @@ -1,9 +1,7 @@ package de.steamwar.inventory; import org.bukkit.Material; -import org.bukkit.OfflinePlayer; import org.bukkit.inventory.ItemStack; -import org.bukkit.inventory.meta.SkullMeta; class SWItem_12 { private SWItem_12(){} @@ -16,12 +14,7 @@ class SWItem_12 { return SWItem_8.getDye(); } - static ItemStack setSkullOwner(OfflinePlayer player){ - ItemStack head = new ItemStack(Material.SKULL_ITEM, 1, (short) 3); - SkullMeta headmeta = (SkullMeta) head.getItemMeta(); - headmeta.setOwningPlayer(player); - headmeta.setDisplayName(player.getName()); - head.setItemMeta(headmeta); - return head; + static ItemStack setSkullOwner(String player){ + return SWItem_8.setSkullOwner(player); } } diff --git a/SpigotCore_14/src/de/steamwar/inventory/SWItem_14.java b/SpigotCore_14/src/de/steamwar/inventory/SWItem_14.java index 2038a91..684305d 100644 --- a/SpigotCore_14/src/de/steamwar/inventory/SWItem_14.java +++ b/SpigotCore_14/src/de/steamwar/inventory/SWItem_14.java @@ -1,7 +1,6 @@ package de.steamwar.inventory; import org.bukkit.Material; -import org.bukkit.OfflinePlayer; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.SkullMeta; @@ -49,12 +48,12 @@ class SWItem_14 { } } - static ItemStack setSkullOwner(OfflinePlayer player){ + static ItemStack setSkullOwner(String player){ ItemStack head = new ItemStack(Material.PLAYER_HEAD, 1); SkullMeta headmeta = (SkullMeta) head.getItemMeta(); assert headmeta != null; - headmeta.setOwningPlayer(player); - headmeta.setDisplayName(player.getName()); + headmeta.setOwner(player); + headmeta.setDisplayName(player); head.setItemMeta(headmeta); return head; } diff --git a/SpigotCore_15/src/de/steamwar/inventory/SWItem_15.java b/SpigotCore_15/src/de/steamwar/inventory/SWItem_15.java index 73af534..096369c 100644 --- a/SpigotCore_15/src/de/steamwar/inventory/SWItem_15.java +++ b/SpigotCore_15/src/de/steamwar/inventory/SWItem_15.java @@ -1,7 +1,6 @@ package de.steamwar.inventory; import org.bukkit.Material; -import org.bukkit.OfflinePlayer; import org.bukkit.inventory.ItemStack; class SWItem_15 { @@ -15,7 +14,7 @@ class SWItem_15 { return SWItem_14.getDye(colorCode); } - static ItemStack setSkullOwner(OfflinePlayer player){ + static ItemStack setSkullOwner(String player){ return SWItem_14.setSkullOwner(player); } } diff --git a/SpigotCore_8/src/de/steamwar/inventory/SWItem_8.java b/SpigotCore_8/src/de/steamwar/inventory/SWItem_8.java index a0348f8..69407ec 100644 --- a/SpigotCore_8/src/de/steamwar/inventory/SWItem_8.java +++ b/SpigotCore_8/src/de/steamwar/inventory/SWItem_8.java @@ -1,7 +1,6 @@ package de.steamwar.inventory; import org.bukkit.Material; -import org.bukkit.OfflinePlayer; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.SkullMeta; @@ -16,11 +15,11 @@ class SWItem_8 { return Material.INK_SACK; } - static ItemStack setSkullOwner(OfflinePlayer player){ + static ItemStack setSkullOwner(String player){ ItemStack head = new ItemStack(Material.SKULL_ITEM, 1, (short) 3); SkullMeta headmeta = (SkullMeta) head.getItemMeta(); - headmeta.setOwner(player.getName()); - headmeta.setDisplayName(player.getName()); + headmeta.setOwner(player); + headmeta.setDisplayName(player); head.setItemMeta(headmeta); return head; } diff --git a/SpigotCore_9/src/de/steamwar/inventory/SWItem_9.java b/SpigotCore_9/src/de/steamwar/inventory/SWItem_9.java index 25a179a..8e276da 100644 --- a/SpigotCore_9/src/de/steamwar/inventory/SWItem_9.java +++ b/SpigotCore_9/src/de/steamwar/inventory/SWItem_9.java @@ -1,7 +1,6 @@ package de.steamwar.inventory; import org.bukkit.Material; -import org.bukkit.OfflinePlayer; import org.bukkit.inventory.ItemStack; class SWItem_9 { @@ -15,7 +14,7 @@ class SWItem_9 { return SWItem_8.getDye(); } - static ItemStack setSkullOwner(OfflinePlayer player){ + static ItemStack setSkullOwner(String player){ return SWItem_8.setSkullOwner(player); } } diff --git a/SpigotCore_Main/src/de/steamwar/inventory/SWItem.java b/SpigotCore_Main/src/de/steamwar/inventory/SWItem.java index dae57c6..afd845b 100644 --- a/SpigotCore_Main/src/de/steamwar/inventory/SWItem.java +++ b/SpigotCore_Main/src/de/steamwar/inventory/SWItem.java @@ -18,26 +18,30 @@ public class SWItem { private InvCallback callback; public static SWItem getPlayerSkull(OfflinePlayer player){ + return getPlayerSkull(player.getName()); + } + + public static SWItem getPlayerSkull(String playerName){ SWItem p = new SWItem(); ItemStack head; switch(Core.getVersion()){ case 8: - head = SWItem_8.setSkullOwner(player); + head = SWItem_8.setSkullOwner(playerName); break; case 9: - head = SWItem_9.setSkullOwner(player); + head = SWItem_9.setSkullOwner(playerName); break; case 10: - head = SWItem_10.setSkullOwner(player); + head = SWItem_10.setSkullOwner(playerName); break; case 14: - head = SWItem_14.setSkullOwner(player); + head = SWItem_14.setSkullOwner(playerName); break; case 15: - head = SWItem_15.setSkullOwner(player); + head = SWItem_15.setSkullOwner(playerName); break; default: - head = SWItem_12.setSkullOwner(player); + head = SWItem_12.setSkullOwner(playerName); } p.setItemStack(head); return p; diff --git a/SpigotCore_Main/src/de/steamwar/sql/FightStatistic.java b/SpigotCore_Main/src/de/steamwar/sql/FightStatistic.java new file mode 100644 index 0000000..e218517 --- /dev/null +++ b/SpigotCore_Main/src/de/steamwar/sql/FightStatistic.java @@ -0,0 +1,53 @@ +package de.steamwar.sql; + +public class FightStatistic { + + private final int fightID; + private final int eventFightID; + private final String gamemode; + private final String arena; + private final int leaderBlue; + private final int schematicBlue; + private final int leaderRed; + private final int schematicRed; + private final int winner; // 0: even, 1: blue, 2: red + + public FightStatistic(int fightID, int eventFightID, String gamemode, String arena, int leaderBlue, int schematicBlue, int leaderRed, int schematicRed, int winner){ + this.fightID = fightID; + this.eventFightID = eventFightID; + this.gamemode = gamemode; + this.arena = arena; + this.leaderBlue = leaderBlue; + this.schematicBlue = schematicBlue; + this.leaderRed = leaderRed; + this.schematicRed = schematicRed; + this.winner = winner; + SQL.update("INSERT INTO FightStatistic (" + + "FightID, EventFightID, Gamemode, Arena, LeaderBlue, SchematicBlue, LeaderRed, SchematicRed, Winner" + + ") VALUES (" + + fightID + ", " + eventFightID + ", '" + gamemode + "', '" + arena + "', " + leaderBlue + ", " + ")"); + } + + public int getFightID() { + return fightID; + } + + public static class FightMember{ + private final int fightID; + private final int userID; + private final String kit; + private final int tntPlaced; //? + private final int kills; + private final boolean dead; + + public FightMember(int fightID, int userID, String kit, int tntPlaced, int kills, boolean dead) { + this.fightID = fightID; + this.userID = userID; + this.kit = kit; + this.tntPlaced = tntPlaced; + this.kills = kills; + this.dead = dead; + } + } +}