SteamWar/SpigotCore
Archiviert
13
0

Changing to String ItemSkull

Dieser Commit ist enthalten in:
Lixfel 2019-12-31 15:11:00 +01:00
Ursprung 5efe47a619
Commit a5e906537a
8 geänderte Dateien mit 74 neuen und 29 gelöschten Zeilen

Datei anzeigen

@ -1,7 +1,6 @@
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.ItemStack;
class SWItem_10 { class SWItem_10 {
@ -15,7 +14,7 @@ class SWItem_10 {
return SWItem_8.getDye(); return SWItem_8.getDye();
} }
static ItemStack setSkullOwner(OfflinePlayer player){ static ItemStack setSkullOwner(String player){
return SWItem_8.setSkullOwner(player); return SWItem_8.setSkullOwner(player);
} }
} }

Datei anzeigen

@ -1,9 +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.ItemStack;
import org.bukkit.inventory.meta.SkullMeta;
class SWItem_12 { class SWItem_12 {
private SWItem_12(){} private SWItem_12(){}
@ -16,12 +14,7 @@ class SWItem_12 {
return SWItem_8.getDye(); return SWItem_8.getDye();
} }
static ItemStack setSkullOwner(OfflinePlayer player){ static ItemStack setSkullOwner(String player){
ItemStack head = new ItemStack(Material.SKULL_ITEM, 1, (short) 3); return SWItem_8.setSkullOwner(player);
SkullMeta headmeta = (SkullMeta) head.getItemMeta();
headmeta.setOwningPlayer(player);
headmeta.setDisplayName(player.getName());
head.setItemMeta(headmeta);
return head;
} }
} }

Datei anzeigen

@ -1,7 +1,6 @@
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.ItemStack;
import org.bukkit.inventory.meta.SkullMeta; 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); ItemStack head = new ItemStack(Material.PLAYER_HEAD, 1);
SkullMeta headmeta = (SkullMeta) head.getItemMeta(); SkullMeta headmeta = (SkullMeta) head.getItemMeta();
assert headmeta != null; assert headmeta != null;
headmeta.setOwningPlayer(player); headmeta.setOwner(player);
headmeta.setDisplayName(player.getName()); headmeta.setDisplayName(player);
head.setItemMeta(headmeta); head.setItemMeta(headmeta);
return head; return head;
} }

Datei anzeigen

@ -1,7 +1,6 @@
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.ItemStack;
class SWItem_15 { class SWItem_15 {
@ -15,7 +14,7 @@ class SWItem_15 {
return SWItem_14.getDye(colorCode); return SWItem_14.getDye(colorCode);
} }
static ItemStack setSkullOwner(OfflinePlayer player){ static ItemStack setSkullOwner(String player){
return SWItem_14.setSkullOwner(player); return SWItem_14.setSkullOwner(player);
} }
} }

Datei anzeigen

@ -1,7 +1,6 @@
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.ItemStack;
import org.bukkit.inventory.meta.SkullMeta; import org.bukkit.inventory.meta.SkullMeta;
@ -16,11 +15,11 @@ class SWItem_8 {
return Material.INK_SACK; return Material.INK_SACK;
} }
static ItemStack setSkullOwner(OfflinePlayer player){ static ItemStack setSkullOwner(String player){
ItemStack head = new ItemStack(Material.SKULL_ITEM, 1, (short) 3); ItemStack head = new ItemStack(Material.SKULL_ITEM, 1, (short) 3);
SkullMeta headmeta = (SkullMeta) head.getItemMeta(); SkullMeta headmeta = (SkullMeta) head.getItemMeta();
headmeta.setOwner(player.getName()); headmeta.setOwner(player);
headmeta.setDisplayName(player.getName()); headmeta.setDisplayName(player);
head.setItemMeta(headmeta); head.setItemMeta(headmeta);
return head; return head;
} }

Datei anzeigen

@ -1,7 +1,6 @@
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.ItemStack;
class SWItem_9 { class SWItem_9 {
@ -15,7 +14,7 @@ class SWItem_9 {
return SWItem_8.getDye(); return SWItem_8.getDye();
} }
static ItemStack setSkullOwner(OfflinePlayer player){ static ItemStack setSkullOwner(String player){
return SWItem_8.setSkullOwner(player); return SWItem_8.setSkullOwner(player);
} }
} }

Datei anzeigen

@ -18,26 +18,30 @@ 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; ItemStack head;
switch(Core.getVersion()){ switch(Core.getVersion()){
case 8: case 8:
head = SWItem_8.setSkullOwner(player); head = SWItem_8.setSkullOwner(playerName);
break; break;
case 9: case 9:
head = SWItem_9.setSkullOwner(player); head = SWItem_9.setSkullOwner(playerName);
break; break;
case 10: case 10:
head = SWItem_10.setSkullOwner(player); head = SWItem_10.setSkullOwner(playerName);
break; break;
case 14: case 14:
head = SWItem_14.setSkullOwner(player); head = SWItem_14.setSkullOwner(playerName);
break; break;
case 15: case 15:
head = SWItem_15.setSkullOwner(player); head = SWItem_15.setSkullOwner(playerName);
break; break;
default: default:
head = SWItem_12.setSkullOwner(player); head = SWItem_12.setSkullOwner(playerName);
} }
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;
}
}
}