Merge remote-tracking branch 'origin/master'

# Conflicts:
#	src/alisolarflare/events/uhc/UHCModule.java
This commit is contained in:
alisolarflare 2016-11-03 15:21:50 -04:00
commit ae01b1d250
8 changed files with 81 additions and 45 deletions

View file

@ -17,6 +17,7 @@ public class AliLinkModule extends Module {
public void register(JavaPlugin plugin) { public void register(JavaPlugin plugin) {
setAliLink = new SetAliLink(plugin); setAliLink = new SetAliLink(plugin);
TBMCChatAPI.AddCommands(plugin, PressAliLink.class); TBMCChatAPI.AddCommands(plugin, PressAliLink.class);
TBMCChatAPI.AddCommands(plugin, SetAliLink.class);
} }

View file

@ -5,6 +5,7 @@ import org.bukkit.plugin.java.JavaPlugin;
import alisolarflare.Module; import alisolarflare.Module;
import alisolarflare.events.uhc.commands.AddToUHC; import alisolarflare.events.uhc.commands.AddToUHC;
import alisolarflare.events.uhc.memory.MatchState; import alisolarflare.events.uhc.memory.MatchState;
import alisolarflare.events.uhc.commands.StartMatch;
import alisolarflare.events.uhc.memory.UHCMatch; import alisolarflare.events.uhc.memory.UHCMatch;
import buttondevteam.lib.chat.TBMCChatAPI; import buttondevteam.lib.chat.TBMCChatAPI;
@ -12,16 +13,17 @@ public class UHCModule extends Module {
public UHCMatch match; public UHCMatch match;
public void register(JavaPlugin plugin) { public void register(JavaPlugin plugin) {
registerMemoryUnits(plugin);
registerCommands(plugin); registerCommands(plugin);
registerListeners(plugin); registerListeners(plugin);
registerMemoryUnits(plugin);
} }
private void registerListeners(JavaPlugin plugin) { private void registerListeners(JavaPlugin plugin) {
} }
private void registerCommands(JavaPlugin plugin) { private void registerCommands(JavaPlugin plugin) {
TBMCChatAPI.AddCommands(plugin, AddToUHC.class); TBMCChatAPI.AddCommand(plugin, AddToUHC.class, match);
TBMCChatAPI.AddCommand(plugin, new StartMatch(match));
} }
private void registerMemoryUnits(JavaPlugin plugin) { private void registerMemoryUnits(JavaPlugin plugin) {

View file

@ -3,11 +3,9 @@ package alisolarflare.magic;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
import alisolarflare.Module; import alisolarflare.Module;
import alisolarflare.events.uhc.commands.AddToUHC;
import alisolarflare.magic.aliarrow.AliArrowListener; import alisolarflare.magic.aliarrow.AliArrowListener;
import alisolarflare.magic.boombow.BoomBowListener; import alisolarflare.magic.boombow.BoomBowListener;
import buttondevteam.lib.TBMCCoreAPI; import buttondevteam.lib.TBMCCoreAPI;
import buttondevteam.lib.chat.TBMCChatAPI;
public class MagicModule extends Module{ public class MagicModule extends Module{
@ -15,7 +13,6 @@ public class MagicModule extends Module{
public void register(JavaPlugin plugin) { public void register(JavaPlugin plugin) {
TBMCCoreAPI.RegisterEventsForExceptions(new AliArrowListener(plugin), plugin); TBMCCoreAPI.RegisterEventsForExceptions(new AliArrowListener(plugin), plugin);
TBMCCoreAPI.RegisterEventsForExceptions(new BoomBowListener(), plugin); TBMCCoreAPI.RegisterEventsForExceptions(new BoomBowListener(), plugin);
TBMCChatAPI.AddCommands(plugin, AddToUHC.class);
} }

View file

@ -22,7 +22,7 @@ public class FreeForAllModule extends Module{
} }
private void registerCommands(JavaPlugin plugin) { private void registerCommands(JavaPlugin plugin) {
TBMCChatAPI.AddCommands(plugin, SetFFAS.class); TBMCChatAPI.AddCommands(plugin, SetFFAS.class);
} }
private void registerMemory() { private void registerMemory() {
this.spawnSet = new SpawnSet(); this.spawnSet = new SpawnSet();

View file

@ -8,6 +8,7 @@ import alisolarflare.Module;
import alisolarflare.minigames.lobby.commands.ButtonFight; import alisolarflare.minigames.lobby.commands.ButtonFight;
import alisolarflare.minigames.lobby.commands.ButtonLeave; import alisolarflare.minigames.lobby.commands.ButtonLeave;
import alisolarflare.minigames.lobby.commands.ListFighters; import alisolarflare.minigames.lobby.commands.ListFighters;
import buttondevteam.lib.chat.TBMCChatAPI;
public class LobbyModule extends Module{ public class LobbyModule extends Module{
public List<String> fighters; public List<String> fighters;
@ -20,8 +21,8 @@ public class LobbyModule extends Module{
} }
private void registerCommands(JavaPlugin plugin) { private void registerCommands(JavaPlugin plugin) {
plugin.getCommand("buttonfight").setExecutor(new ButtonFight(this)); TBMCChatAPI.AddCommands(plugin, ButtonFight.class);
plugin.getCommand("buttonleave").setExecutor(new ButtonLeave(this)); TBMCChatAPI.AddCommands(plugin, ButtonLeave.class);
plugin.getCommand("listfighters").setExecutor(new ListFighters(this)); TBMCChatAPI.AddCommands(plugin, ListFighters.class);
} }
} }

View file

@ -1,13 +1,12 @@
package alisolarflare.minigames.lobby.commands; package alisolarflare.minigames.lobby.commands;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import alisolarflare.minigames.lobby.LobbyModule; import alisolarflare.minigames.lobby.LobbyModule;
import buttondevteam.lib.chat.TBMCCommandBase;
public class ButtonFight implements CommandExecutor{ public class ButtonFight extends TBMCCommandBase {
private LobbyModule lobby; private LobbyModule lobby;
public ButtonFight(LobbyModule lobby) { public ButtonFight(LobbyModule lobby) {
@ -15,28 +14,38 @@ public class ButtonFight implements CommandExecutor{
} }
@Override @Override
public boolean onCommand(CommandSender sender, Command arg1, String arg2, String[] arg3) { public boolean OnCommand(CommandSender sender, String arg2, String[] arg3) {
if(!(sender instanceof Player)){
sender.sendMessage("You must be a player to be using this command!");
return false;
}
Player player = (Player) sender; Player player = (Player) sender;
player.sendMessage(player.toString()); player.sendMessage(player.toString());
String name = player.getName(); String name = player.getName();
if(lobby.fighters.contains(name)){ if (lobby.fighters.contains(name)) {
player.sendMessage("You are already in the button fight!"); player.sendMessage("You are already in the button fight!");
return false; return false;
} }
lobby.fighters.add(name); lobby.fighters.add(name);
if(lobby.fighters.contains(name)){ if (lobby.fighters.contains(name)) {
player.sendMessage("You have joined the fighters category!"); player.sendMessage("You have joined the fighters category!");
} }
return false; return false;
} }
@Override
public String[] GetHelpText(String alias) {
// TODO Auto-generated method stub
return null;
}
@Override
public boolean GetPlayerOnly() {
return true;
}
@Override
public boolean GetModOnly() {
return false;
}
} }

View file

@ -1,15 +1,13 @@
package alisolarflare.minigames.lobby.commands; package alisolarflare.minigames.lobby.commands;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import alisolarflare.minigames.lobby.LobbyModule; import alisolarflare.minigames.lobby.LobbyModule;
import buttondevteam.lib.chat.TBMCCommandBase;
public class ButtonLeave extends TBMCCommandBase {
public class ButtonLeave implements CommandExecutor{
private LobbyModule lobby; private LobbyModule lobby;
public ButtonLeave(LobbyModule lobby) { public ButtonLeave(LobbyModule lobby) {
@ -17,23 +15,34 @@ public class ButtonLeave implements CommandExecutor{
} }
@Override @Override
public boolean onCommand(CommandSender sender, Command arg1, String arg2, String[] arg3) { public boolean OnCommand(CommandSender sender, String arg2, String[] arg3) {
if(!(sender instanceof Player)){
sender.sendMessage("You must be a player to be using this command!");
return false;
}
Player player = (Player) sender; Player player = (Player) sender;
String name = player.getName(); String name = player.getName();
if (!(lobby.fighters.contains(name))){ if (!(lobby.fighters.contains(name))) {
player.sendMessage("You are not fighting!"); player.sendMessage("You are not fighting!");
return false; return false;
} }
lobby.fighters.remove(name); lobby.fighters.remove(name);
if(!(lobby.fighters.contains(name))){ if (!(lobby.fighters.contains(name))) {
player.sendMessage("You have left the fighters category!"); player.sendMessage("You have left the fighters category!");
} }
return false; return false;
} }
@Override
public String[] GetHelpText(String alias) {
// TODO Auto-generated method stub
return null;
}
@Override
public boolean GetPlayerOnly() {
return true;
}
@Override
public boolean GetModOnly() {
return false;
}
} }

View file

@ -1,12 +1,13 @@
package alisolarflare.minigames.lobby.commands; package alisolarflare.minigames.lobby.commands;
import org.bukkit.command.Command; import java.util.stream.Collectors;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import alisolarflare.minigames.lobby.LobbyModule; import alisolarflare.minigames.lobby.LobbyModule;
import buttondevteam.lib.chat.TBMCCommandBase;
public class ListFighters implements CommandExecutor{ public class ListFighters extends TBMCCommandBase {
private LobbyModule lobby; private LobbyModule lobby;
public ListFighters(LobbyModule lobby) { public ListFighters(LobbyModule lobby) {
@ -14,9 +15,25 @@ public class ListFighters implements CommandExecutor{
} }
@Override @Override
public boolean onCommand(CommandSender sender, Command arg1, String arg2, String[] arg3) { public boolean OnCommand(CommandSender sender, String arg2, String[] arg3) {
sender.sendMessage(lobby.fighters.toString()); sender.sendMessage(lobby.fighters.stream().map(Object::toString).collect(Collectors.joining(", ")));
return false; return false;
} }
@Override
public String[] GetHelpText(String alias) {
// TODO Auto-generated method stub
return null;
}
@Override
public boolean GetPlayerOnly() {
return false;
}
@Override
public boolean GetModOnly() {
return false;
}
} }