|
@@ -45,7 +45,7 @@ import java.io.File;
|
|
public class Missile {
|
|
public class Missile {
|
|
|
|
|
|
private final String schematic;
|
|
private final String schematic;
|
|
- @Getter private final String name;
|
|
|
|
|
|
+ private final String displayName;
|
|
private final EntityType egg;
|
|
private final EntityType egg;
|
|
private final int down;
|
|
private final int down;
|
|
private final int dist;
|
|
private final int dist;
|
|
@@ -77,17 +77,32 @@ public class Missile {
|
|
PasteProvider.getPaster().pasteMissile(getSchematic(), pastePos, rotation, loc.getWorld(),
|
|
PasteProvider.getPaster().pasteMissile(getSchematic(), pastePos, rotation, loc.getWorld(),
|
|
game.getPlayer(p).getTeam());
|
|
game.getPlayer(p).getTeam());
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
- Logger.ERROR.log("Could not load " + name);
|
|
|
|
|
|
+ Logger.ERROR.log("Could not load " + displayName);
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
public File getSchematic() {
|
|
public File getSchematic() {
|
|
File pluginDir = MissileWars.getInstance().getDataFolder();
|
|
File pluginDir = MissileWars.getInstance().getDataFolder();
|
|
- File file = new File(pluginDir, "missiles/" + schematic);
|
|
|
|
|
|
+ File file = new File(pluginDir, "missiles/" + getSchematicName(false));
|
|
return file;
|
|
return file;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ public String getSchematicName(boolean withoutExtension) {
|
|
|
|
+ if (withoutExtension) {
|
|
|
|
+ return schematic.replace(".schematic", "")
|
|
|
|
+ .replace(".schem", "");
|
|
|
|
+ }
|
|
|
|
+ return schematic;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public String getDisplayName() {
|
|
|
|
+ String name = displayName;
|
|
|
|
+ name = name.replace("%schematic_name%", getSchematicName(false))
|
|
|
|
+ .replace("%schematic_name_compact%", getSchematicName(true));
|
|
|
|
+ return name;
|
|
|
|
+ }
|
|
|
|
+
|
|
public EntityType getType() {
|
|
public EntityType getType() {
|
|
return egg;
|
|
return egg;
|
|
}
|
|
}
|
|
@@ -112,7 +127,7 @@ public class Missile {
|
|
is.setAmount(1);
|
|
is.setAmount(1);
|
|
}
|
|
}
|
|
ItemMeta im = is.getItemMeta();
|
|
ItemMeta im = is.getItemMeta();
|
|
- im.setDisplayName(name);
|
|
|
|
|
|
+ im.setDisplayName(getDisplayName());
|
|
is.setItemMeta(im);
|
|
is.setItemMeta(im);
|
|
return is;
|
|
return is;
|
|
}
|
|
}
|