SteamWar/SpigotCore
Archiviert
13
0

Merge branch 'skullItemFix' of SteamWar/SpigotCore into master

Dieser Commit ist enthalten in:
Lixfel 2019-12-31 15:47:44 +01:00 committet von Gitea
Commit 82bba933b3
8 geänderte Dateien mit 93 neuen und 33 gelöschten Zeilen

Datei anzeigen

@ -1,8 +1,7 @@
package de.steamwar.inventory; package de.steamwar.inventory;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.OfflinePlayer; import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.SkullMeta;
class SWItem_10 { class SWItem_10 {
private SWItem_10(){} private SWItem_10(){}
@ -15,7 +14,7 @@ class SWItem_10 {
return SWItem_8.getDye(); return SWItem_8.getDye();
} }
static void setSkullOwner(OfflinePlayer player, SkullMeta meta){ static ItemStack setSkullOwner(String player){
SWItem_8.setSkullOwner(player, meta); return SWItem_8.setSkullOwner(player);
} }
} }

Datei anzeigen

@ -1,8 +1,7 @@
package de.steamwar.inventory; package de.steamwar.inventory;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.OfflinePlayer; import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.SkullMeta;
class SWItem_12 { class SWItem_12 {
private SWItem_12(){} private SWItem_12(){}
@ -15,7 +14,7 @@ class SWItem_12 {
return SWItem_8.getDye(); return SWItem_8.getDye();
} }
static void setSkullOwner(OfflinePlayer player, SkullMeta meta){ static ItemStack setSkullOwner(String player){
meta.setOwningPlayer(player); return SWItem_8.setSkullOwner(player);
} }
} }

Datei anzeigen

@ -1,7 +1,7 @@
package de.steamwar.inventory; package de.steamwar.inventory;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.OfflinePlayer; import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.SkullMeta; import org.bukkit.inventory.meta.SkullMeta;
class SWItem_14 { class SWItem_14 {
@ -48,7 +48,13 @@ class SWItem_14 {
} }
} }
static void setSkullOwner(OfflinePlayer player, SkullMeta meta){ static ItemStack setSkullOwner(String player){
SWItem_12.setSkullOwner(player, meta); ItemStack head = new ItemStack(Material.PLAYER_HEAD, 1);
SkullMeta headmeta = (SkullMeta) head.getItemMeta();
assert headmeta != null;
headmeta.setOwner(player);
headmeta.setDisplayName(player);
head.setItemMeta(headmeta);
return head;
} }
} }

Datei anzeigen

@ -1,8 +1,7 @@
package de.steamwar.inventory; package de.steamwar.inventory;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.OfflinePlayer; import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.SkullMeta;
class SWItem_15 { class SWItem_15 {
private SWItem_15(){} private SWItem_15(){}
@ -15,7 +14,7 @@ class SWItem_15 {
return SWItem_14.getDye(colorCode); return SWItem_14.getDye(colorCode);
} }
static void setSkullOwner(OfflinePlayer player, SkullMeta meta){ static ItemStack setSkullOwner(String player){
SWItem_12.setSkullOwner(player, meta); return SWItem_14.setSkullOwner(player);
} }
} }

Datei anzeigen

@ -1,7 +1,7 @@
package de.steamwar.inventory; package de.steamwar.inventory;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.OfflinePlayer; import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.SkullMeta; import org.bukkit.inventory.meta.SkullMeta;
class SWItem_8 { class SWItem_8 {
@ -15,7 +15,12 @@ class SWItem_8 {
return Material.INK_SACK; return Material.INK_SACK;
} }
static void setSkullOwner(OfflinePlayer player, SkullMeta meta){ static ItemStack setSkullOwner(String player){
meta.setOwner(player.getName()); ItemStack head = new ItemStack(Material.SKULL_ITEM, 1, (short) 3);
SkullMeta headmeta = (SkullMeta) head.getItemMeta();
headmeta.setOwner(player);
headmeta.setDisplayName(player);
head.setItemMeta(headmeta);
return head;
} }
} }

Datei anzeigen

@ -1,8 +1,7 @@
package de.steamwar.inventory; package de.steamwar.inventory;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.OfflinePlayer; import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.SkullMeta;
class SWItem_9 { class SWItem_9 {
private SWItem_9(){} private SWItem_9(){}
@ -15,7 +14,7 @@ class SWItem_9 {
return SWItem_8.getDye(); return SWItem_8.getDye();
} }
static void setSkullOwner(OfflinePlayer player, SkullMeta meta){ static ItemStack setSkullOwner(String player){
SWItem_8.setSkullOwner(player, meta); return SWItem_8.setSkullOwner(player);
} }
} }

Datei anzeigen

@ -7,7 +7,6 @@ import org.bukkit.enchantments.Enchantment;
import org.bukkit.inventory.ItemFlag; import org.bukkit.inventory.ItemFlag;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta; import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.inventory.meta.SkullMeta;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -19,30 +18,31 @@ public class SWItem {
private InvCallback callback; private InvCallback callback;
public static SWItem getPlayerSkull(OfflinePlayer player){ public static SWItem getPlayerSkull(OfflinePlayer player){
return getPlayerSkull(player.getName());
}
public static SWItem getPlayerSkull(String playerName){
SWItem p = new SWItem(); SWItem p = new SWItem();
ItemStack head = new ItemStack(getMaterial("SKULL_ITEM"), 1, (short) 3); ItemStack head;
SkullMeta headmeta = (SkullMeta) head.getItemMeta();
switch(Core.getVersion()){ switch(Core.getVersion()){
case 8: case 8:
SWItem_8.setSkullOwner(player, headmeta); head = SWItem_8.setSkullOwner(playerName);
break; break;
case 9: case 9:
SWItem_9.setSkullOwner(player, headmeta); head = SWItem_9.setSkullOwner(playerName);
break; break;
case 10: case 10:
SWItem_10.setSkullOwner(player, headmeta); head = SWItem_10.setSkullOwner(playerName);
break; break;
case 14: case 14:
SWItem_14.setSkullOwner(player, headmeta); head = SWItem_14.setSkullOwner(playerName);
break; break;
case 15: case 15:
SWItem_15.setSkullOwner(player, headmeta); head = SWItem_15.setSkullOwner(playerName);
break; break;
default: default:
SWItem_12.setSkullOwner(player, headmeta); head = SWItem_12.setSkullOwner(playerName);
} }
headmeta.setDisplayName(player.getName());
head.setItemMeta(headmeta);
p.setItemStack(head); p.setItemStack(head);
return p; return p;
} }

Datei anzeigen

@ -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;
}
}
}