Add SpecialMissile Info in Sidebar
Dieser Commit ist enthalten in:
Ursprung
d5dfd56113
Commit
9e15b267fa
@ -19,11 +19,14 @@
|
||||
|
||||
package de.steamwar.misslewars;
|
||||
|
||||
import de.steamwar.misslewars.items.Missile;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.scoreboard.DisplaySlot;
|
||||
import org.bukkit.scoreboard.Objective;
|
||||
import org.bukkit.scoreboard.Scoreboard;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
@ -52,7 +55,7 @@ class FightScoreboard {
|
||||
|
||||
teamScoreboard(MissileWars.getBlueTeam());
|
||||
teamScoreboard(MissileWars.getRedTeam());
|
||||
|
||||
specialMissiles();
|
||||
|
||||
Bukkit.getOnlinePlayers().forEach(player -> player.setScoreboard(scoreboard));
|
||||
}, 0, 200);
|
||||
@ -65,4 +68,12 @@ class FightScoreboard {
|
||||
private static void teamScoreboard(MWTeam fightTeam){
|
||||
fightTeam.getPlayers().forEach(p -> objective.getScore(fightTeam.getPrefix() + p.getName()).setScore(1));
|
||||
}
|
||||
|
||||
private static void specialMissiles() {
|
||||
objective.getScore("§3").setScore(0);
|
||||
objective.getScore("§eSpecial Missles").setScore(-1);
|
||||
for (String missile : Missile.specialMissiles) {
|
||||
objective.getScore("§7- §e" + missile).setScore(-2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -70,6 +70,7 @@ public class MissileWars extends JavaPlugin {
|
||||
FightScoreboard.init();
|
||||
|
||||
Missile.init();
|
||||
Missile.randomInit();
|
||||
new Arrows();
|
||||
new Fireball();
|
||||
new Shield();
|
||||
|
@ -45,10 +45,7 @@ import org.bukkit.inventory.meta.ItemMeta;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Random;
|
||||
import java.util.*;
|
||||
import java.util.logging.Level;
|
||||
|
||||
public class Missile extends SpecialItem {
|
||||
@ -57,6 +54,7 @@ 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;
|
||||
@ -86,18 +84,19 @@ public class Missile extends SpecialItem {
|
||||
}
|
||||
|
||||
item = createItem(itemType, "§c" + name, 1, lore, special);
|
||||
specialMissiles.add(name);
|
||||
}
|
||||
|
||||
private void lore(List<String> lore, String[] args, int index, String tag) {
|
||||
if (args.length > index) {
|
||||
try {
|
||||
lore.add(graph(Integer.parseInt(args[index]), 7) + tag);
|
||||
lore.add(graph(Integer.parseInt(args[index]), GRAPH_SIZE) + tag);
|
||||
return;
|
||||
} catch (NumberFormatException e) {
|
||||
// Ignored
|
||||
}
|
||||
}
|
||||
lore.add(graph(0, 7) + tag);
|
||||
lore.add(graph(0, GRAPH_SIZE) + tag);
|
||||
}
|
||||
|
||||
private String graph(int index, int size) {
|
||||
@ -186,9 +185,7 @@ public class Missile extends SpecialItem {
|
||||
return;
|
||||
}
|
||||
List<File> pool = new ArrayList<>(files.length);
|
||||
for (File missileFile : files) {
|
||||
pool.add(missileFile);
|
||||
}
|
||||
pool.addAll(Arrays.asList(files));
|
||||
|
||||
for (int i = 0; i < 4; i++) {
|
||||
File missileFile = pool.remove(r.nextInt(pool.size()));
|
||||
@ -196,4 +193,5 @@ public class Missile extends SpecialItem {
|
||||
new Missile(missileFile, true);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren