Fix Missle Info
Dieser Commit ist enthalten in:
Ursprung
16a69c0e41
Commit
c325244702
@ -33,7 +33,6 @@ import com.sk89q.worldedit.session.ClipboardHolder;
|
|||||||
import com.sk89q.worldedit.world.World;
|
import com.sk89q.worldedit.world.World;
|
||||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||||
import de.steamwar.misslewars.MissileWars;
|
import de.steamwar.misslewars.MissileWars;
|
||||||
import io.netty.handler.logging.LogLevel;
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
@ -55,9 +54,9 @@ public class Missile extends SpecialItem {
|
|||||||
|
|
||||||
static {
|
static {
|
||||||
try {
|
try {
|
||||||
tnt = WorldEdit.getInstance().getBlockFactory().parseFromListInput("tnt", new ParserContext());
|
tnt = WorldEdit.getInstance().getBlockFactory().parseFromListInput("[tnt]", new ParserContext());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
//Bukkit.getLogger().log(Level.SEVERE, e.getMessage(), e.getCause());
|
Bukkit.getLogger().log(Level.SEVERE, e.getMessage(), e.getCause());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -68,20 +67,32 @@ public class Missile extends SpecialItem {
|
|||||||
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];
|
||||||
if (!material.endsWith("_SPAWN_EGG")) {
|
if (!material.endsWith("_SPAWN_EGG")) material += "_SPAWN_EGG";
|
||||||
material += "_SPAWN_EGG";
|
|
||||||
}
|
|
||||||
Material itemType = Material.valueOf(material);
|
Material itemType = Material.valueOf(material);
|
||||||
|
|
||||||
List<String> lore = new ArrayList<>();
|
List<String> lore = new ArrayList<>();
|
||||||
if (strings.length > 3) {
|
if (strings.length > 2) {
|
||||||
try {
|
try {
|
||||||
lore.add(graph(Integer.parseInt(strings[2]), 7) + " §7Speed");
|
lore.add(graph(Integer.parseInt(strings[2]), 7) + " §7Speed");
|
||||||
lore.add(graph(Integer.parseInt(strings[3]), 7) + " §7Size");
|
|
||||||
// lore.add("§7TNT §8: " + count());
|
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
|
lore.add(graph(0, 7) + " §7Speed");
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
lore.add(graph(0, 7) + " §7Speed");
|
||||||
|
}
|
||||||
|
if (strings.length > 3) {
|
||||||
|
try {
|
||||||
|
lore.add(graph(Integer.parseInt(strings[3]), 7) + " §7Size");
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
lore.add(graph(0, 7) + " §7Size");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
lore.add(graph(0, 7) + " §7Size");
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
lore.add("§7TNT §8: §e" + count());
|
||||||
|
} catch (Exception e) {
|
||||||
|
lore.add("§7TNT §8: §e?");
|
||||||
}
|
}
|
||||||
|
|
||||||
ClipboardFormat format = ClipboardFormats.findByFile(missileFile);
|
ClipboardFormat format = ClipboardFormats.findByFile(missileFile);
|
||||||
@ -104,7 +115,9 @@ public class Missile extends SpecialItem {
|
|||||||
if (index > size) index = size;
|
if (index > size) index = size;
|
||||||
StringBuilder st = new StringBuilder();
|
StringBuilder st = new StringBuilder();
|
||||||
st.append("§8[§e");
|
st.append("§8[§e");
|
||||||
st.append(repeat(index));
|
if (index > 0) {
|
||||||
|
st.append(repeat(index));
|
||||||
|
}
|
||||||
st.append("§7");
|
st.append("§7");
|
||||||
st.append(repeat(size - index));
|
st.append(repeat(size - index));
|
||||||
st.append("§8]");
|
st.append("§8]");
|
||||||
@ -162,14 +175,12 @@ public class Missile extends SpecialItem {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void init(){
|
public static void init(){
|
||||||
File missileFolder = new File(MissileWars.getPlugin().getDataFolder(), "missiles");
|
File missileFolder = new File(MissileWars.getPlugin().getDataFolder(), "default-missles");
|
||||||
if(!missileFolder.exists() || !missileFolder.canRead() || !missileFolder.isDirectory()){
|
if(!missileFolder.exists() || !missileFolder.canRead() || !missileFolder.isDirectory()){
|
||||||
throw new SecurityException("Missiles could not be loaded");
|
throw new SecurityException("Missiles could not be loaded");
|
||||||
}
|
}
|
||||||
for(File missileFile : Objects.requireNonNull(missileFolder.listFiles())){
|
for(File missileFile : Objects.requireNonNull(missileFolder.listFiles())){
|
||||||
if(!missileFile.canRead() || !missileFile.isFile())
|
if(!missileFile.canRead() || !missileFile.isFile()) continue;
|
||||||
continue;
|
|
||||||
|
|
||||||
new Missile(missileFile);
|
new Missile(missileFile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren