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 BlockType TNT = BlockTypes.TNT;
|
||||||
private static final int GRAPH_SIZE = 7;
|
private static final int GRAPH_SIZE = 7;
|
||||||
private static final Random r = new Random();
|
private static final Random r = new Random();
|
||||||
public static final List<String> specialMissiles = new ArrayList<>();
|
|
||||||
|
|
||||||
private final Clipboard clipboard;
|
private final Clipboard clipboard;
|
||||||
private final ItemStack item;
|
private final ItemStack item;
|
||||||
private final int tntCount;
|
private final int tntCount;
|
||||||
|
|
||||||
private Missile(File missileFile, boolean special) {
|
private Missile(File missileFile) {
|
||||||
String[] strings = missileFile.getName().split("\\.");
|
String[] strings = missileFile.getName().split("\\.");
|
||||||
String name = strings[0];
|
String name = strings[0];
|
||||||
String material = strings[1];
|
String material = strings[1];
|
||||||
@ -85,8 +84,7 @@ public class Missile extends SpecialItem {
|
|||||||
tntCount = count;
|
tntCount = count;
|
||||||
lore.add("§7TNT §8: §e" + tntCount);
|
lore.add("§7TNT §8: §e" + tntCount);
|
||||||
|
|
||||||
item = createItem(itemType, "§c" + name, 1, lore, special);
|
item = createItem(itemType, "§c" + name, 1, lore, false);
|
||||||
if (special) specialMissiles.add(name);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void lore(List<String> lore, String[] args, int index, String tag) {
|
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())) {
|
for (File missileFile : Objects.requireNonNull(missileFolder.listFiles())) {
|
||||||
if (!missileFile.canRead() || !missileFile.isFile()) continue;
|
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,9 +39,9 @@ public abstract class SpecialItem {
|
|||||||
SpecialItem() {
|
SpecialItem() {
|
||||||
if (this.isMissile()) {
|
if (this.isMissile()) {
|
||||||
missileItems.add(this);
|
missileItems.add(this);
|
||||||
return;
|
} else {
|
||||||
|
supportItems.add(this);
|
||||||
}
|
}
|
||||||
supportItems.add(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract ItemStack getItem();
|
public abstract ItemStack getItem();
|
||||||
@ -54,7 +54,7 @@ public abstract class SpecialItem {
|
|||||||
return createItem(material, name, amount, new ArrayList<>(), false);
|
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);
|
ItemStack item = new ItemStack(material, amount);
|
||||||
ItemMeta meta = item.getItemMeta();
|
ItemMeta meta = item.getItemMeta();
|
||||||
assert meta != null;
|
assert meta != null;
|
||||||
@ -62,7 +62,7 @@ public abstract class SpecialItem {
|
|||||||
meta.setLore(lore);
|
meta.setLore(lore);
|
||||||
meta.setDisplayName(name);
|
meta.setDisplayName(name);
|
||||||
item.setItemMeta(meta);
|
item.setItemMeta(meta);
|
||||||
if (special) item.addUnsafeEnchantment(Enchantment.PROTECTION_FALL, 1);
|
if (enchanted) item.addUnsafeEnchantment(Enchantment.PROTECTION_FALL, 1);
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren