Add all Missiles back
Dieser Commit ist enthalten in:
Ursprung
1ea911437b
Commit
8140ad4072
@ -52,13 +52,12 @@ public class Missile extends SpecialItem {
|
||||
private static final BlockType TNT = BlockTypes.TNT;
|
||||
private static final int GRAPH_SIZE = 7;
|
||||
private static final Random r = new Random();
|
||||
public static final List<String> specialMissiles = new ArrayList<>();
|
||||
|
||||
private final Clipboard clipboard;
|
||||
private final ItemStack item;
|
||||
private final int tntCount;
|
||||
|
||||
private Missile(File missileFile, boolean special) {
|
||||
private Missile(File missileFile) {
|
||||
String[] strings = missileFile.getName().split("\\.");
|
||||
String name = strings[0];
|
||||
String material = strings[1];
|
||||
@ -85,8 +84,7 @@ public class Missile extends SpecialItem {
|
||||
tntCount = count;
|
||||
lore.add("§7TNT §8: §e" + tntCount);
|
||||
|
||||
item = createItem(itemType, "§c" + name, 1, lore, special);
|
||||
if (special) specialMissiles.add(name);
|
||||
item = createItem(itemType, "§c" + name, 1, lore, false);
|
||||
}
|
||||
|
||||
private void lore(List<String> lore, String[] args, int index, String tag) {
|
||||
@ -175,7 +173,20 @@ public class Missile extends SpecialItem {
|
||||
}
|
||||
for (File missileFile : Objects.requireNonNull(missileFolder.listFiles())) {
|
||||
if (!missileFile.canRead() || !missileFile.isFile()) continue;
|
||||
new Missile(missileFile, false);
|
||||
new Missile(missileFile);
|
||||
}
|
||||
|
||||
otherInit();
|
||||
}
|
||||
|
||||
public static void otherInit() {
|
||||
File missileFolder = new File(MissileWars.getPlugin().getDataFolder(), "missiles");
|
||||
if (!missileFolder.exists() || !missileFolder.canRead() || !missileFolder.isDirectory()) {
|
||||
throw new SecurityException("Missiles could not be loaded");
|
||||
}
|
||||
for (File missileFile : Objects.requireNonNull(missileFolder.listFiles())) {
|
||||
if (!missileFile.canRead() || !missileFile.isFile()) continue;
|
||||
new Missile(missileFile);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -39,10 +39,10 @@ public abstract class SpecialItem {
|
||||
SpecialItem() {
|
||||
if (this.isMissile()) {
|
||||
missileItems.add(this);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
supportItems.add(this);
|
||||
}
|
||||
}
|
||||
|
||||
public abstract ItemStack getItem();
|
||||
public abstract boolean handleUse(Player p);
|
||||
@ -54,7 +54,7 @@ public abstract class SpecialItem {
|
||||
return createItem(material, name, amount, new ArrayList<>(), false);
|
||||
}
|
||||
|
||||
public ItemStack createItem(Material material, String name, int amount, List<String> lore, boolean special) {
|
||||
public ItemStack createItem(Material material, String name, int amount, List<String> lore, boolean enchanted) {
|
||||
ItemStack item = new ItemStack(material, amount);
|
||||
ItemMeta meta = item.getItemMeta();
|
||||
assert meta != null;
|
||||
@ -62,7 +62,7 @@ public abstract class SpecialItem {
|
||||
meta.setLore(lore);
|
||||
meta.setDisplayName(name);
|
||||
item.setItemMeta(meta);
|
||||
if (special) item.addUnsafeEnchantment(Enchantment.PROTECTION_FALL, 1);
|
||||
if (enchanted) item.addUnsafeEnchantment(Enchantment.PROTECTION_FALL, 1);
|
||||
return item;
|
||||
}
|
||||
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren