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

@ -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,13 +14,7 @@ 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());
@ -39,4 +32,20 @@ public class ButtonFight implements CommandExecutor{
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,14 +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 ButtonLeave implements CommandExecutor{ public class ButtonLeave extends TBMCCommandBase {
private LobbyModule lobby; private LobbyModule lobby;
@ -17,12 +15,7 @@ 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))) {
@ -36,4 +29,20 @@ public class ButtonLeave implements CommandExecutor{
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,8 +15,24 @@ 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;
}
@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; return false;
} }