mirror of
https://github.com/craftaro/EpicSpawners.git
synced 2025-01-09 03:57:40 +08:00
Added tab complete.
This commit is contained in:
parent
0f93f4a234
commit
24182366e3
@ -2,16 +2,17 @@ package com.songoda.epicspawners.command.commands;
|
||||
|
||||
import com.songoda.epicspawners.EpicSpawnersPlugin;
|
||||
import com.songoda.epicspawners.References;
|
||||
import com.songoda.epicspawners.api.spawner.SpawnerData;
|
||||
import com.songoda.epicspawners.boost.BoostData;
|
||||
import com.songoda.epicspawners.boost.BoostType;
|
||||
import com.songoda.epicspawners.command.AbstractCommand;
|
||||
import com.songoda.epicspawners.utils.Methods;
|
||||
import com.songoda.epicspawners.utils.SettingsManager;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
|
||||
public class CommandBoost extends AbstractCommand {
|
||||
|
||||
@ -126,9 +127,15 @@ public class CommandBoost extends AbstractCommand {
|
||||
|
||||
@Override
|
||||
protected List<String> onTab(EpicSpawnersPlugin instance, CommandSender sender, String... args) {
|
||||
if (args.length == 2) {
|
||||
return Arrays.asList("p:", "f:", "t:", "i:");
|
||||
} else if (args.length == 3) {
|
||||
return Arrays.asList("1", "2", "3", "4", "5");
|
||||
} else if (args.length == 4) {
|
||||
return Arrays.asList("m:", "h:", "d:", "y:");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPermissionNode() {
|
||||
return "epicspawners.admin";
|
||||
|
@ -8,12 +8,16 @@ import com.songoda.epicspawners.api.spawner.SpawnerStack;
|
||||
import com.songoda.epicspawners.command.AbstractCommand;
|
||||
import com.songoda.epicspawners.spawners.spawner.ESpawnerStack;
|
||||
import com.songoda.epicspawners.utils.Methods;
|
||||
import com.songoda.epicspawners.utils.SettingsManager;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class CommandChange extends AbstractCommand {
|
||||
@ -75,6 +79,13 @@ public class CommandChange extends AbstractCommand {
|
||||
|
||||
@Override
|
||||
protected List<String> onTab(EpicSpawnersPlugin instance, CommandSender sender, String... args) {
|
||||
if (args.length == 2) {
|
||||
List<String> spawners = new ArrayList<>();
|
||||
for (SpawnerData spawnerData : instance.getSpawnerManager().getAllSpawnerData()) {
|
||||
spawners.add(spawnerData.getIdentifyingName());
|
||||
}
|
||||
return spawners;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -6,14 +6,13 @@ import com.songoda.epicspawners.References;
|
||||
import com.songoda.epicspawners.api.spawner.SpawnerData;
|
||||
import com.songoda.epicspawners.command.AbstractCommand;
|
||||
import com.songoda.epicspawners.utils.Methods;
|
||||
import com.songoda.epicspawners.utils.SettingsManager;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.*;
|
||||
|
||||
public class CommandGive extends AbstractCommand {
|
||||
|
||||
@ -102,6 +101,29 @@ public class CommandGive extends AbstractCommand {
|
||||
|
||||
@Override
|
||||
protected List<String> onTab(EpicSpawnersPlugin instance, CommandSender sender, String... args) {
|
||||
if (args.length == 2) {
|
||||
List<String> players = new ArrayList<>();
|
||||
players.add("All");
|
||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||
players.add(player.getName());
|
||||
}
|
||||
return players;
|
||||
} else if (args.length == 3) {
|
||||
List<String> spawners = new ArrayList<>();
|
||||
spawners.add("Random");
|
||||
for (SpawnerData spawnerData : instance.getSpawnerManager().getAllSpawnerData()) {
|
||||
spawners.add(spawnerData.getIdentifyingName());
|
||||
}
|
||||
return spawners;
|
||||
} else if (args.length == 4) {
|
||||
List<String> values = new ArrayList<>();
|
||||
for (int i = 1; i <= SettingsManager.Setting.SPAWNERS_MAX.getInt(); i ++) {
|
||||
values.add(String.valueOf(i));
|
||||
}
|
||||
return values;
|
||||
} else if (args.length == 5) {
|
||||
return Arrays.asList("1", "2", "3", "4", "5");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user