Commits vergleichen
1 Commits
master
...
item_giver
Autor | SHA1 | Datum | |
---|---|---|---|
|
fcde18f0c8 |
@ -21,6 +21,7 @@ package de.steamwar.misslewars;
|
||||
|
||||
import de.steamwar.misslewars.commands.CommandAcceptDecline;
|
||||
import de.steamwar.misslewars.commands.CommandInvite;
|
||||
import de.steamwar.misslewars.commands.CommandItems;
|
||||
import de.steamwar.misslewars.commands.CommandSpectate;
|
||||
import de.steamwar.misslewars.countdowns.EndCountdown;
|
||||
import de.steamwar.misslewars.countdowns.ItemCountdown;
|
||||
@ -93,6 +94,9 @@ public class MissileWars extends JavaPlugin {
|
||||
StateDependent.setupState(fightState);
|
||||
|
||||
Bukkit.getScheduler().runTaskTimer(this, new FightInfoPacketSender(), 20, 20);
|
||||
if(Config.test()) {
|
||||
new CommandItems();
|
||||
}
|
||||
}
|
||||
|
||||
public static void waiting() {
|
||||
|
24
src/de/steamwar/misslewars/commands/CommandItems.java
Normale Datei
24
src/de/steamwar/misslewars/commands/CommandItems.java
Normale Datei
@ -0,0 +1,24 @@
|
||||
package de.steamwar.misslewars.commands;
|
||||
|
||||
import de.steamwar.command.SWCommand;
|
||||
import de.steamwar.inventory.SWItem;
|
||||
import de.steamwar.inventory.SWListInv;
|
||||
import de.steamwar.misslewars.items.SpecialItem;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class CommandItems extends SWCommand {
|
||||
public CommandItems() {
|
||||
super("give");
|
||||
}
|
||||
|
||||
public void genericCommand(Player player, String[] args) {
|
||||
SWListInv<ItemStack> inv = new SWListInv<>(player, "Misslewars Items", SpecialItem.getAllItems().stream().map(item -> new SWListInv.SWListEntry<>(new SWItem(item.getType(), item.getItemMeta().getDisplayName()), item)).collect(Collectors.toList()), (clickType, itemStack) -> {
|
||||
player.closeInventory();
|
||||
player.getInventory().addItem(itemStack);
|
||||
});
|
||||
inv.open();
|
||||
}
|
||||
}
|
@ -117,4 +117,13 @@ public abstract class SpecialItem {
|
||||
lastItemWasSupportItem = false;
|
||||
return missileItems.get(random.nextInt(missileItems.size())).getItem();
|
||||
}
|
||||
|
||||
public static List<ItemStack> getAllItems() {
|
||||
List<ItemStack> items = new ArrayList<>();
|
||||
for (SpecialItem specialItem : supportItems)
|
||||
items.add(specialItem.getItem());
|
||||
for (SpecialItem specialItem : missileItems)
|
||||
items.add(specialItem.getItem());
|
||||
return items;
|
||||
}
|
||||
}
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren