SteamWar/SpigotCore
Archiviert
13
0

Fixing 1.8 Skull issue

Dieser Commit ist enthalten in:
Lixfel 2019-11-11 19:57:17 +01:00
Ursprung ed452b2856
Commit ecb8eec074
4 geänderte Dateien mit 30 neuen und 2 gelöschten Zeilen

Datei anzeigen

@ -1,6 +1,8 @@
package de.steamwar.inventory; package de.steamwar.inventory;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.OfflinePlayer;
import org.bukkit.inventory.meta.SkullMeta;
class SWItem_v12 { class SWItem_v12 {
private SWItem_v12(){} private SWItem_v12(){}
@ -12,4 +14,8 @@ class SWItem_v12 {
static Material getDye(){ static Material getDye(){
return Material.INK_SACK; return Material.INK_SACK;
} }
static void setSkullOwner(OfflinePlayer player, SkullMeta meta){
meta.setOwningPlayer(player);
}
} }

Datei anzeigen

@ -0,0 +1,12 @@
package de.steamwar.inventory;
import org.bukkit.OfflinePlayer;
import org.bukkit.inventory.meta.SkullMeta;
class SWItem_v8 {
private SWItem_v8(){}
static void setSkullOwner(OfflinePlayer player, SkullMeta meta){
meta.setOwner(player.getName());
}
}

Datei anzeigen

@ -22,7 +22,13 @@ public class SWItem {
SWItem p = new SWItem(); SWItem p = new SWItem();
ItemStack head = new ItemStack(getMaterial("SKULL_ITEM"), 1, (short) 3); ItemStack head = new ItemStack(getMaterial("SKULL_ITEM"), 1, (short) 3);
SkullMeta headmeta = (SkullMeta) head.getItemMeta(); SkullMeta headmeta = (SkullMeta) head.getItemMeta();
headmeta.setOwningPlayer(player); switch(Core.getVersion()){
case 8:
SWItem_v8.setSkullOwner(player, headmeta);
break;
default:
SWItem_v12.setSkullOwner(player, headmeta);
}
headmeta.setDisplayName(player.getName()); headmeta.setDisplayName(player.getName());
head.setItemMeta(headmeta); head.setItemMeta(headmeta);
p.setItemStack(head); p.setItemStack(head);

Datei anzeigen

@ -16,7 +16,11 @@ public enum SchematicType {
CGearUp("CGU", Type.CHECK_TYPE), CGearUp("CGU", Type.CHECK_TYPE),
GearUp("GU", Type.FIGHT_TYPE, CGearUp), GearUp("GU", Type.FIGHT_TYPE, CGearUp),
CEiszeit("CEZ", Type.CHECK_TYPE), CEiszeit("CEZ", Type.CHECK_TYPE),
Eiszeit("EZ", Type.FIGHT_TYPE); Eiszeit("EZ", Type.FIGHT_TYPE),
CWarShip1_8("CWS1.8", Type.CHECK_TYPE),
CWarGear1_7("CWG1.7", Type.CHECK_TYPE),
WarShip1_8("WS1.8", Type.CHECK_TYPE),
WarGear1_7("WG1.7", Type.FIGHT_TYPE, CWarGear1_7);
private static Map<String, SchematicType> fromDB = new HashMap<>(); private static Map<String, SchematicType> fromDB = new HashMap<>();