Complete command completion implementation
Minor console log fixes (No more French! :D)
This commit is contained in:
parent
b579e75da7
commit
dc4f3244df
@ -192,6 +192,8 @@ public abstract class Arena {
|
|||||||
_minplayer = min;
|
_minplayer = min;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public abstract List<String> getSpawnIndexList(String team);
|
||||||
|
|
||||||
public Location str2loc(String loc) {
|
public Location str2loc(String loc) {
|
||||||
if (loc == null) {
|
if (loc == null) {
|
||||||
return null;
|
return null;
|
||||||
|
@ -33,8 +33,6 @@ public class ArenaManager {
|
|||||||
if(f.getName().endsWith(".yml")) {
|
if(f.getName().endsWith(".yml")) {
|
||||||
String name = f.getName().replaceAll(".yml", "");
|
String name = f.getName().replaceAll(".yml", "");
|
||||||
Maps.add(name);
|
Maps.add(name);
|
||||||
|
|
||||||
_plugin.getLogger().info("Loading: [" + f.getName() + "]");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(Maps.isEmpty())
|
if(Maps.isEmpty())
|
||||||
|
@ -8,6 +8,7 @@ import java.util.ArrayList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
import java.util.Formatter;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Color;
|
import org.bukkit.Color;
|
||||||
@ -77,6 +78,7 @@ public class SArena extends Arena {
|
|||||||
_potions = l;
|
_potions = l;
|
||||||
if(config.contains("Nombre"))
|
if(config.contains("Nombre"))
|
||||||
saveConfig();
|
saveConfig();
|
||||||
|
_plugin.getLogger().info("Arena loading [" + _name + "]...");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -110,7 +112,7 @@ public class SArena extends Arena {
|
|||||||
try {
|
try {
|
||||||
config.save(new File(_plugin.getDataFolder(), "/arenas/" + _name + ".yml"));
|
config.save(new File(_plugin.getDataFolder(), "/arenas/" + _name + ".yml"));
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
_plugin.getLogger().warning("save default de " + _name + " impossible !");
|
_plugin.getLogger().warning("Save default of" + _name + " impossible!");
|
||||||
disable();
|
disable();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@ -119,6 +121,7 @@ public class SArena extends Arena {
|
|||||||
@Override
|
@Override
|
||||||
public Boolean saveConfig() {
|
public Boolean saveConfig() {
|
||||||
YamlConfiguration config = YamlConfiguration.loadConfiguration((File)new File(_plugin.getDataFolder(), "/arenas/" + _name + ".yml"));
|
YamlConfiguration config = YamlConfiguration.loadConfiguration((File)new File(_plugin.getDataFolder(), "/arenas/" + _name + ".yml"));
|
||||||
|
_plugin.getLogger().info("Save of " + _name + " ...");
|
||||||
config.set("Name", _name);
|
config.set("Name", _name);
|
||||||
config.set("Type", "Solo");
|
config.set("Type", "Solo");
|
||||||
config.set("Map", _map);
|
config.set("Map", _map);
|
||||||
@ -145,7 +148,7 @@ public class SArena extends Arena {
|
|||||||
config.save(new File(_plugin.getDataFolder(), "/arenas/" + _name + ".yml"));
|
config.save(new File(_plugin.getDataFolder(), "/arenas/" + _name + ".yml"));
|
||||||
_plugin.saveConfig();
|
_plugin.saveConfig();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
_plugin.getLogger().warning("save de " + _name + "impossible !");
|
_plugin.getLogger().warning("Save of" + _name + "impossible!");
|
||||||
disable();
|
disable();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -308,6 +311,17 @@ public class SArena extends Arena {
|
|||||||
_spawns.remove(Integer.parseInt(args));
|
_spawns.remove(Integer.parseInt(args));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<String> getSpawnIndexList(String team) {
|
||||||
|
List<String> list = new ArrayList();
|
||||||
|
String format= "%0" + String.valueOf(_spawns.size()).length() + "d";
|
||||||
|
|
||||||
|
for (int i = 0; i < _spawns.size(); i++) {
|
||||||
|
list.add(String.format( format, i));
|
||||||
|
}
|
||||||
|
return(list);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void win(final Player player) {
|
public void win(final Player player) {
|
||||||
getGainWin(player);
|
getGainWin(player);
|
||||||
|
@ -77,7 +77,7 @@ public class TArena extends Arena {
|
|||||||
l.add(StrToPo(popo));
|
l.add(StrToPo(popo));
|
||||||
}
|
}
|
||||||
_potions = l;
|
_potions = l;
|
||||||
_plugin.getLogger().info("load de " + _name);
|
_plugin.getLogger().info("Arena loading [" + _name + "]...");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -113,7 +113,7 @@ public class TArena extends Arena {
|
|||||||
config.save(new File(_plugin.getDataFolder(), "/arenas/" + _name + ".yml"));
|
config.save(new File(_plugin.getDataFolder(), "/arenas/" + _name + ".yml"));
|
||||||
}
|
}
|
||||||
catch (IOException e) {
|
catch (IOException e) {
|
||||||
_plugin.getLogger().warning("save default de " + _name + " impossible !");
|
_plugin.getLogger().warning("Save default of " + _name + " impossible!");
|
||||||
disable();
|
disable();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@ -122,7 +122,7 @@ public class TArena extends Arena {
|
|||||||
@Override
|
@Override
|
||||||
public Boolean saveConfig() {
|
public Boolean saveConfig() {
|
||||||
YamlConfiguration config = YamlConfiguration.loadConfiguration((File)new File(_plugin.getDataFolder(), "/arenas/" + _name + ".yml"));
|
YamlConfiguration config = YamlConfiguration.loadConfiguration((File)new File(_plugin.getDataFolder(), "/arenas/" + _name + ".yml"));
|
||||||
_plugin.getLogger().info("save de " + _name);
|
_plugin.getLogger().info("Save of " + _name + " ...");
|
||||||
config.set("Version", Quake._version);
|
config.set("Version", Quake._version);
|
||||||
config.set("Name", _name);
|
config.set("Name", _name);
|
||||||
config.set("Type", "Team");
|
config.set("Type", "Team");
|
||||||
@ -161,7 +161,7 @@ public class TArena extends Arena {
|
|||||||
config.save(new File(_plugin.getDataFolder(), "/arenas/" + _name + ".yml"));
|
config.save(new File(_plugin.getDataFolder(), "/arenas/" + _name + ".yml"));
|
||||||
_plugin.saveConfig();
|
_plugin.saveConfig();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
_plugin.getLogger().warning("save de " + _name + "impossible !");
|
_plugin.getLogger().warning("Save of " + _name + "impossible!");
|
||||||
disable();
|
disable();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -461,6 +461,29 @@ public class TArena extends Arena {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<String> getSpawnIndexList(String team) {
|
||||||
|
List<String> list = new ArrayList();
|
||||||
|
List<Location> spawns;
|
||||||
|
|
||||||
|
if (team.equalsIgnoreCase("Blue")) {
|
||||||
|
spawns= _spawns_B;
|
||||||
|
} else {
|
||||||
|
if (team.equalsIgnoreCase("Red")) {
|
||||||
|
spawns= _spawns_B;
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
String format= "%0" + String.valueOf(spawns.size()).length() + "d";
|
||||||
|
|
||||||
|
for (int i = 0; i < spawns.size(); i++) {
|
||||||
|
list.add(String.format( format, i));
|
||||||
|
}
|
||||||
|
return(list);
|
||||||
|
}
|
||||||
|
|
||||||
public void win(ATeam team) {
|
public void win(ATeam team) {
|
||||||
_finished = true;
|
_finished = true;
|
||||||
nbroadcast(ChatColor.GOLD + "#" + ChatColor.GRAY + "--------------------" + ChatColor.GOLD + "#");
|
nbroadcast(ChatColor.GOLD + "#" + ChatColor.GRAY + "--------------------" + ChatColor.GOLD + "#");
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.Geekpower14.Quake.Commands;
|
package com.Geekpower14.Quake.Commands;
|
||||||
|
|
||||||
import com.Geekpower14.Quake.Quake;
|
import com.Geekpower14.Quake.Quake;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
@ -37,8 +38,8 @@ implements BasicCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> getCompletionList(String[] args) {
|
public List<String> getCompletionList(Player player, String[] args) {
|
||||||
List<String> list = null;
|
List<String> list = new ArrayList();
|
||||||
|
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
@ -64,16 +64,19 @@ public class AddSpawnCommand implements BasicCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> getCompletionList(String[] args) {
|
public List<String> getCompletionList(Player player, String[] args) {
|
||||||
List<String> list = null;
|
List<String> list;
|
||||||
|
|
||||||
if( args.length <= 2) {
|
if( args.length == 2) {
|
||||||
list = _plugin._am.getArenaNameList();
|
list = _plugin._am.getArenaNameList();
|
||||||
} else {
|
} else {
|
||||||
list = new ArrayList();
|
list = new ArrayList();
|
||||||
|
Arena arena = _plugin._am.getArenabyName(args[1]);
|
||||||
|
|
||||||
list.add(" ");
|
if ( (arena != null) && (arena instanceof TArena)) {
|
||||||
list.add("TEAM");
|
list.add("Blue");
|
||||||
|
list.add("Red");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return list;
|
return list;
|
||||||
|
@ -16,6 +16,6 @@ public interface BasicCommand {
|
|||||||
|
|
||||||
public String help(Player var1);
|
public String help(Player var1);
|
||||||
|
|
||||||
public List<String> getCompletionList(String[] args);
|
public List<String> getCompletionList(Player player, String[] args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@ import com.Geekpower14.Quake.Arena.Arena;
|
|||||||
import com.Geekpower14.Quake.Arena.SArena;
|
import com.Geekpower14.Quake.Arena.SArena;
|
||||||
import com.Geekpower14.Quake.Arena.TArena;
|
import com.Geekpower14.Quake.Arena.TArena;
|
||||||
import com.Geekpower14.Quake.Quake;
|
import com.Geekpower14.Quake.Quake;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -55,8 +56,19 @@ public class ChangeTeamCommand implements BasicCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> getCompletionList(String[] args) {
|
public List<String> getCompletionList(Player player, String[] args) {
|
||||||
List<String> list = null;
|
List<String> list = new ArrayList();
|
||||||
|
Arena arena = _plugin._am.getArenabyPlayer(player);
|
||||||
|
|
||||||
|
if( ( arena != null) && ( arena instanceof TArena)) {
|
||||||
|
TArena ta = (TArena)arena;
|
||||||
|
|
||||||
|
if( ta.getTeam(player).getName() == "Red") {
|
||||||
|
list.add("Blue");
|
||||||
|
} else {
|
||||||
|
list.add("Red");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
@ -50,12 +50,10 @@ public class CreateCommand implements BasicCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> getCompletionList(String[] args) {
|
public List<String> getCompletionList(Player player, String[] args) {
|
||||||
List<String> list = null;
|
List<String> list = new ArrayList();
|
||||||
|
|
||||||
if( args.length == 3) {
|
if( args.length == 3) {
|
||||||
list = new ArrayList();
|
|
||||||
|
|
||||||
list.add("Solo");
|
list.add("Solo");
|
||||||
list.add("Team");
|
list.add("Team");
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@ package com.Geekpower14.Quake.Commands;
|
|||||||
|
|
||||||
import com.Geekpower14.Quake.Arena.Arena;
|
import com.Geekpower14.Quake.Arena.Arena;
|
||||||
import com.Geekpower14.Quake.Quake;
|
import com.Geekpower14.Quake.Quake;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -65,11 +66,13 @@ public class JoinCommand implements BasicCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> getCompletionList(String[] args) {
|
public List<String> getCompletionList(Player player, String[] args) {
|
||||||
List<String> list = null;
|
List<String> list;
|
||||||
|
|
||||||
if( args.length <= 2) {
|
if( args.length <= 2) {
|
||||||
list = _plugin._am.getArenaNameList();
|
list = _plugin._am.getArenaNameList();
|
||||||
|
} else {
|
||||||
|
list = new ArrayList();
|
||||||
}
|
}
|
||||||
|
|
||||||
return list;
|
return list;
|
||||||
|
@ -2,6 +2,7 @@ package com.Geekpower14.Quake.Commands;
|
|||||||
|
|
||||||
import com.Geekpower14.Quake.Arena.Arena;
|
import com.Geekpower14.Quake.Arena.Arena;
|
||||||
import com.Geekpower14.Quake.Quake;
|
import com.Geekpower14.Quake.Quake;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
@ -41,8 +42,8 @@ public class LeaveCommand implements BasicCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> getCompletionList(String[] args) {
|
public List<String> getCompletionList(Player player, String[] args) {
|
||||||
List<String> list = null;
|
List<String> list = new ArrayList();
|
||||||
|
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
@ -84,11 +84,10 @@ public class MoneyCommand implements BasicCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> getCompletionList(String[] args) {
|
public List<String> getCompletionList(Player player, String[] args) {
|
||||||
List<String> list = null;
|
List<String> list = new ArrayList();
|
||||||
|
|
||||||
if( args.length <= 2) {
|
if( args.length <= 2) {
|
||||||
list = new ArrayList();
|
|
||||||
|
|
||||||
list.add("set");
|
list.add("set");
|
||||||
list.add("add");
|
list.add("add");
|
||||||
|
@ -100,7 +100,7 @@ public class MyCommandExecutor implements CommandExecutor {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<String> getCompletionList(String[] args) {
|
public List<String> getCompletionList(Player player, String[] args) {
|
||||||
List<String> list = null;
|
List<String> list = null;
|
||||||
|
|
||||||
if( args.length <= 1) {
|
if( args.length <= 1) {
|
||||||
@ -110,7 +110,7 @@ public class MyCommandExecutor implements CommandExecutor {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if(_commands.containsKey(args[0])) {
|
if(_commands.containsKey(args[0])) {
|
||||||
list = _commands.get(args[0]).getCompletionList(args);
|
list = _commands.get(args[0]).getCompletionList(player, args);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,6 +5,8 @@ import java.util.ArrayList;
|
|||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
import java.util.stream.Stream;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
@ -22,11 +24,16 @@ public class MyTabCompleter implements TabCompleter
|
|||||||
@Override
|
@Override
|
||||||
public List<String> onTabComplete (CommandSender sender, Command cmd, String label, String[] args) {
|
public List<String> onTabComplete (CommandSender sender, Command cmd, String label, String[] args) {
|
||||||
List<String> list = new ArrayList<>();
|
List<String> list = new ArrayList<>();
|
||||||
// _plugin.getLogger().info("MTC [" + cmd + "] [" + label + "] [" + args.length + "]");
|
_plugin.getLogger().info("MTC [" + cmd + "] [" + label + "] [" + args.length + "] [[" + Arrays.toString(args) + "]] ["+ args[args.length - 1] + "]");
|
||||||
|
|
||||||
if(cmd.getName().equalsIgnoreCase("quake") && args.length >= 0){
|
if(cmd.getName().equalsIgnoreCase("quake") && args.length >= 0){
|
||||||
if(sender instanceof Player){
|
if(sender instanceof Player){
|
||||||
list = _plugin._ce.getCompletionList(args);
|
list = _plugin._ce.getCompletionList((Player)sender, args);
|
||||||
|
|
||||||
|
if( (list != null ) && (args[args.length - 1] != "")) {
|
||||||
|
Stream<String> s = list.stream().filter(name -> name.startsWith(args[args.length - 1]));
|
||||||
|
list = s.collect(Collectors.toList());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return list;
|
return list;
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.Geekpower14.Quake.Commands;
|
package com.Geekpower14.Quake.Commands;
|
||||||
|
|
||||||
import com.Geekpower14.Quake.Quake;
|
import com.Geekpower14.Quake.Quake;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -41,8 +42,8 @@ public class ReloadCommand implements BasicCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> getCompletionList(String[] args) {
|
public List<String> getCompletionList(Player player, String[] args) {
|
||||||
List<String> list = null;
|
List<String> list = new ArrayList();
|
||||||
|
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@ package com.Geekpower14.Quake.Commands;
|
|||||||
|
|
||||||
import com.Geekpower14.Quake.Arena.Arena;
|
import com.Geekpower14.Quake.Arena.Arena;
|
||||||
import com.Geekpower14.Quake.Quake;
|
import com.Geekpower14.Quake.Quake;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -54,11 +55,13 @@ public class RemoveCommand implements BasicCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> getCompletionList(String[] args) {
|
public List<String> getCompletionList(Player player, String[] args) {
|
||||||
List<String> list = null;
|
List<String> list;
|
||||||
|
|
||||||
if( args.length <= 2) {
|
if( args.length <= 2) {
|
||||||
list = _plugin._am.getArenaNameList();
|
list = _plugin._am.getArenaNameList();
|
||||||
|
} else {
|
||||||
|
list = new ArrayList();
|
||||||
}
|
}
|
||||||
|
|
||||||
return list;
|
return list;
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
package com.Geekpower14.Quake.Commands;
|
package com.Geekpower14.Quake.Commands;
|
||||||
|
|
||||||
import com.Geekpower14.Quake.Quake;
|
import com.Geekpower14.Quake.Quake;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -50,8 +51,15 @@ public class RemoveLobbyCommand implements BasicCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> getCompletionList(String[] args) {
|
public List<String> getCompletionList(Player player, String[] args) {
|
||||||
List<String> list = null;
|
List<String> list;
|
||||||
|
|
||||||
|
if( args.length <= 2) {
|
||||||
|
|
||||||
|
list = _plugin._lobby.getLobbyIndexList();
|
||||||
|
} else {
|
||||||
|
list = new ArrayList();
|
||||||
|
}
|
||||||
|
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,8 @@ import com.Geekpower14.Quake.Arena.Arena;
|
|||||||
import com.Geekpower14.Quake.Arena.SArena;
|
import com.Geekpower14.Quake.Arena.SArena;
|
||||||
import com.Geekpower14.Quake.Arena.TArena;
|
import com.Geekpower14.Quake.Arena.TArena;
|
||||||
import com.Geekpower14.Quake.Quake;
|
import com.Geekpower14.Quake.Quake;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -27,7 +29,7 @@ public class RemoveSpawnCommand implements BasicCommand {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (arena == null) {
|
if (arena == null) {
|
||||||
player.sendMessage(ChatColor.RED + "Please type a good arena name ! !");
|
player.sendMessage(ChatColor.RED + "Please type a good arena name!");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (args.length != 2) {
|
if (args.length != 2) {
|
||||||
@ -44,7 +46,7 @@ public class RemoveSpawnCommand implements BasicCommand {
|
|||||||
int nb = ta.removespawn(args[1], args[2]);
|
int nb = ta.removespawn(args[1], args[2]);
|
||||||
player.sendMessage(ChatColor.GREEN + "Spawn number " + (nb - 1) + " removed!");
|
player.sendMessage(ChatColor.GREEN + "Spawn number " + (nb - 1) + " removed!");
|
||||||
} else {
|
} else {
|
||||||
player.sendMessage(ChatColor.RED + "Please type a team name ! !");
|
player.sendMessage(ChatColor.RED + "Please type a team name!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
arena.saveConfig();
|
arena.saveConfig();
|
||||||
@ -62,19 +64,42 @@ public class RemoveSpawnCommand implements BasicCommand {
|
|||||||
@Override
|
@Override
|
||||||
public String help(Player p) {
|
public String help(Player p) {
|
||||||
if (Quake.hasPermission(p, getPermission())) {
|
if (Quake.hasPermission(p, getPermission())) {
|
||||||
return "/quake removespawn [Arena] [Number] - Remove a spawn of the arena.";
|
return "/quake removespawn [Arena] [TEAM|Only for team arena] [Number] - Remove a spawn of the arena.";
|
||||||
}
|
}
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> getCompletionList(String[] args) {
|
public List<String> getCompletionList(Player player, String[] args) {
|
||||||
List<String> list = null;
|
List<String> list;
|
||||||
|
|
||||||
if( args.length <= 2) {
|
if( args.length <= 2) {
|
||||||
list = _plugin._am.getArenaNameList();
|
list = _plugin._am.getArenaNameList();
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
list = new ArrayList();
|
||||||
|
Arena arena = _plugin._am._ARENAS.get(args[1]);
|
||||||
|
|
||||||
|
if( arena != null) {
|
||||||
|
if (arena instanceof SArena) {
|
||||||
|
if( args.length == 3) {
|
||||||
|
list = arena.getSpawnIndexList("");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if( args.length == 3) {
|
||||||
|
|
||||||
|
list.add("Blue");
|
||||||
|
list.add("Red");
|
||||||
|
} else {
|
||||||
|
if( args[2].equalsIgnoreCase("Blue") || args[2].equalsIgnoreCase("Red")) {
|
||||||
|
if( args.length == 4) {
|
||||||
|
list = arena.getSpawnIndexList( args[2]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,7 @@ package com.Geekpower14.Quake.Commands;
|
|||||||
|
|
||||||
import com.Geekpower14.Quake.Arena.Arena;
|
import com.Geekpower14.Quake.Arena.Arena;
|
||||||
import com.Geekpower14.Quake.Quake;
|
import com.Geekpower14.Quake.Quake;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -57,11 +58,13 @@ public class SaveCommand implements BasicCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> getCompletionList(String[] args) {
|
public List<String> getCompletionList(Player player, String[] args) {
|
||||||
List<String> list = null;
|
List<String> list;
|
||||||
|
|
||||||
if( args.length <= 2) {
|
if( args.length <= 2) {
|
||||||
list = _plugin._am.getArenaNameList();
|
list = _plugin._am.getArenaNameList();
|
||||||
|
} else {
|
||||||
|
list = new ArrayList();
|
||||||
}
|
}
|
||||||
|
|
||||||
return list;
|
return list;
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
package com.Geekpower14.Quake.Commands;
|
package com.Geekpower14.Quake.Commands;
|
||||||
|
|
||||||
import com.Geekpower14.Quake.Quake;
|
import com.Geekpower14.Quake.Quake;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -45,8 +46,8 @@ public class SetLobbySpawnCommand implements BasicCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> getCompletionList(String[] args) {
|
public List<String> getCompletionList(Player player, String[] args) {
|
||||||
List<String> list = null;
|
List<String> list = new ArrayList();
|
||||||
|
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,7 @@ package com.Geekpower14.Quake.Commands;
|
|||||||
|
|
||||||
import com.Geekpower14.Quake.Arena.Arena;
|
import com.Geekpower14.Quake.Arena.Arena;
|
||||||
import com.Geekpower14.Quake.Quake;
|
import com.Geekpower14.Quake.Quake;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -62,11 +63,13 @@ public class SetMapCommand implements BasicCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> getCompletionList(String[] args) {
|
public List<String> getCompletionList(Player player, String[] args) {
|
||||||
List<String> list = null;
|
List<String> list;
|
||||||
|
|
||||||
if( args.length <= 2) {
|
if( args.length <= 2) {
|
||||||
list = _plugin._am.getArenaNameList();
|
list = _plugin._am.getArenaNameList();
|
||||||
|
} else {
|
||||||
|
list = new ArrayList();
|
||||||
}
|
}
|
||||||
|
|
||||||
return list;
|
return list;
|
||||||
|
@ -9,6 +9,7 @@ package com.Geekpower14.Quake.Commands;
|
|||||||
|
|
||||||
import com.Geekpower14.Quake.Arena.Arena;
|
import com.Geekpower14.Quake.Arena.Arena;
|
||||||
import com.Geekpower14.Quake.Quake;
|
import com.Geekpower14.Quake.Quake;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -62,11 +63,13 @@ public class SetMaxCommand implements BasicCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> getCompletionList(String[] args) {
|
public List<String> getCompletionList(Player player, String[] args) {
|
||||||
List<String> list = null;
|
List<String> list;
|
||||||
|
|
||||||
if( args.length <= 2) {
|
if( args.length <= 2) {
|
||||||
list = _plugin._am.getArenaNameList();
|
list = _plugin._am.getArenaNameList();
|
||||||
|
} else {
|
||||||
|
list = new ArrayList();
|
||||||
}
|
}
|
||||||
|
|
||||||
return list;
|
return list;
|
||||||
|
@ -9,6 +9,7 @@ package com.Geekpower14.Quake.Commands;
|
|||||||
|
|
||||||
import com.Geekpower14.Quake.Arena.Arena;
|
import com.Geekpower14.Quake.Arena.Arena;
|
||||||
import com.Geekpower14.Quake.Quake;
|
import com.Geekpower14.Quake.Quake;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -62,11 +63,13 @@ public class SetMinCommand implements BasicCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> getCompletionList(String[] args) {
|
public List<String> getCompletionList(Player player, String[] args) {
|
||||||
List<String> list = null;
|
List<String> list;
|
||||||
|
|
||||||
if( args.length <= 2) {
|
if( args.length <= 2) {
|
||||||
list = _plugin._am.getArenaNameList();
|
list = _plugin._am.getArenaNameList();
|
||||||
|
} else {
|
||||||
|
list = new ArrayList();
|
||||||
}
|
}
|
||||||
|
|
||||||
return list;
|
return list;
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
package com.Geekpower14.Quake.Commands;
|
package com.Geekpower14.Quake.Commands;
|
||||||
|
|
||||||
import com.Geekpower14.Quake.Quake;
|
import com.Geekpower14.Quake.Quake;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
@ -42,8 +43,8 @@ public class ShopCommand implements BasicCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> getCompletionList(String[] args) {
|
public List<String> getCompletionList(Player player, String[] args) {
|
||||||
List<String> list = null;
|
List<String> list = new ArrayList();
|
||||||
|
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,7 @@ package com.Geekpower14.Quake.Commands;
|
|||||||
|
|
||||||
import com.Geekpower14.Quake.Arena.Arena;
|
import com.Geekpower14.Quake.Arena.Arena;
|
||||||
import com.Geekpower14.Quake.Quake;
|
import com.Geekpower14.Quake.Quake;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -57,11 +58,13 @@ public class StartCommand implements BasicCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> getCompletionList(String[] args) {
|
public List<String> getCompletionList(Player player, String[] args) {
|
||||||
List<String> list = null;
|
List<String> list;
|
||||||
|
|
||||||
if( args.length <= 2) {
|
if( args.length <= 2) {
|
||||||
list = _plugin._am.getArenaNameList();
|
list = _plugin._am.getArenaNameList();
|
||||||
|
} else {
|
||||||
|
list = new ArrayList();
|
||||||
}
|
}
|
||||||
|
|
||||||
return list;
|
return list;
|
||||||
|
@ -9,6 +9,7 @@ package com.Geekpower14.Quake.Commands;
|
|||||||
|
|
||||||
import com.Geekpower14.Quake.Arena.Arena;
|
import com.Geekpower14.Quake.Arena.Arena;
|
||||||
import com.Geekpower14.Quake.Quake;
|
import com.Geekpower14.Quake.Quake;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -59,11 +60,13 @@ public class StopCommand implements BasicCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> getCompletionList(String[] args) {
|
public List<String> getCompletionList(Player player, String[] args) {
|
||||||
List<String> list = null;
|
List<String> list;
|
||||||
|
|
||||||
if( args.length <= 2) {
|
if( args.length <= 2) {
|
||||||
list = _plugin._am.getArenaNameList();
|
list = _plugin._am.getArenaNameList();
|
||||||
|
} else {
|
||||||
|
list = new ArrayList();
|
||||||
}
|
}
|
||||||
|
|
||||||
return list;
|
return list;
|
||||||
|
@ -9,6 +9,7 @@ package com.Geekpower14.Quake.Commands;
|
|||||||
import com.Geekpower14.Quake.Arena.APlayer;
|
import com.Geekpower14.Quake.Arena.APlayer;
|
||||||
import com.Geekpower14.Quake.Arena.Arena;
|
import com.Geekpower14.Quake.Arena.Arena;
|
||||||
import com.Geekpower14.Quake.Quake;
|
import com.Geekpower14.Quake.Quake;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
@ -53,8 +54,8 @@ public class UtilsCommand implements BasicCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> getCompletionList(String[] args) {
|
public List<String> getCompletionList(Player player, String[] args) {
|
||||||
List<String> list = null;
|
List<String> list = new ArrayList();
|
||||||
|
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
@ -53,7 +53,7 @@ public class LobbyManager {
|
|||||||
_locmax.put("lobby" + i, str2loc(nom));
|
_locmax.put("lobby" + i, str2loc(nom));
|
||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
_plugin.getLogger().info("load des Lobby ");
|
_plugin.getLogger().info("Lobby loading (" + nombre + ")...");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void saveconfig() {
|
public void saveconfig() {
|
||||||
@ -81,7 +81,7 @@ public class LobbyManager {
|
|||||||
} catch (IOException l) {
|
} catch (IOException l) {
|
||||||
// empty catch block
|
// empty catch block
|
||||||
}
|
}
|
||||||
_plugin.getLogger().info("save des Lobby ");
|
_plugin.getLogger().info("Lobby saving...");
|
||||||
}
|
}
|
||||||
|
|
||||||
public Location str2loc(String loc) {
|
public Location str2loc(String loc) {
|
||||||
@ -133,6 +133,13 @@ public class LobbyManager {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List getLobbyIndexList() {
|
||||||
|
List<String> list = new ArrayList();
|
||||||
|
|
||||||
|
return new ArrayList<>(_locmin.keySet());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public Boolean initsign() {
|
public Boolean initsign() {
|
||||||
int index = 0;
|
int index = 0;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user