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) {
setAliLink = new SetAliLink(plugin);
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.events.uhc.commands.AddToUHC;
import alisolarflare.events.uhc.memory.MatchState;
import alisolarflare.events.uhc.commands.StartMatch;
import alisolarflare.events.uhc.memory.UHCMatch;
import buttondevteam.lib.chat.TBMCChatAPI;
@ -12,16 +13,17 @@ public class UHCModule extends Module {
public UHCMatch match;
public void register(JavaPlugin plugin) {
registerMemoryUnits(plugin);
registerCommands(plugin);
registerListeners(plugin);
registerMemoryUnits(plugin);
}
private void registerListeners(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) {

View file

@ -3,11 +3,9 @@ package alisolarflare.magic;
import org.bukkit.plugin.java.JavaPlugin;
import alisolarflare.Module;
import alisolarflare.events.uhc.commands.AddToUHC;
import alisolarflare.magic.aliarrow.AliArrowListener;
import alisolarflare.magic.boombow.BoomBowListener;
import buttondevteam.lib.TBMCCoreAPI;
import buttondevteam.lib.chat.TBMCChatAPI;
public class MagicModule extends Module{
@ -15,7 +13,6 @@ public class MagicModule extends Module{
public void register(JavaPlugin plugin) {
TBMCCoreAPI.RegisterEventsForExceptions(new AliArrowListener(plugin), 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.ButtonLeave;
import alisolarflare.minigames.lobby.commands.ListFighters;
import buttondevteam.lib.chat.TBMCChatAPI;
public class LobbyModule extends Module{
public List<String> fighters;
@ -20,8 +21,8 @@ public class LobbyModule extends Module{
}
private void registerCommands(JavaPlugin plugin) {
plugin.getCommand("buttonfight").setExecutor(new ButtonFight(this));
plugin.getCommand("buttonleave").setExecutor(new ButtonLeave(this));
plugin.getCommand("listfighters").setExecutor(new ListFighters(this));
TBMCChatAPI.AddCommands(plugin, ButtonFight.class);
TBMCChatAPI.AddCommands(plugin, ButtonLeave.class);
TBMCChatAPI.AddCommands(plugin, ListFighters.class);
}
}

View file

@ -1,13 +1,12 @@
package alisolarflare.minigames.lobby.commands;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import alisolarflare.minigames.lobby.LobbyModule;
import buttondevteam.lib.chat.TBMCCommandBase;
public class ButtonFight implements CommandExecutor{
public class ButtonFight extends TBMCCommandBase {
private LobbyModule lobby;
public ButtonFight(LobbyModule lobby) {
@ -15,28 +14,38 @@ public class ButtonFight implements CommandExecutor{
}
@Override
public boolean onCommand(CommandSender sender, Command arg1, String arg2, String[] arg3) {
if(!(sender instanceof Player)){
sender.sendMessage("You must be a player to be using this command!");
return false;
}
public boolean OnCommand(CommandSender sender, String arg2, String[] arg3) {
Player player = (Player) sender;
player.sendMessage(player.toString());
String name = player.getName();
if(lobby.fighters.contains(name)){
if (lobby.fighters.contains(name)) {
player.sendMessage("You are already in the button fight!");
return false;
}
lobby.fighters.add(name);
if(lobby.fighters.contains(name)){
if (lobby.fighters.contains(name)) {
player.sendMessage("You have joined the fighters category!");
}
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;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import alisolarflare.minigames.lobby.LobbyModule;
import buttondevteam.lib.chat.TBMCCommandBase;
public class ButtonLeave implements CommandExecutor{
public class ButtonLeave extends TBMCCommandBase {
private LobbyModule lobby;
@ -17,23 +15,34 @@ public class ButtonLeave implements CommandExecutor{
}
@Override
public boolean onCommand(CommandSender sender, Command arg1, String arg2, String[] arg3) {
if(!(sender instanceof Player)){
sender.sendMessage("You must be a player to be using this command!");
return false;
}
public boolean OnCommand(CommandSender sender, String arg2, String[] arg3) {
Player player = (Player) sender;
String name = player.getName();
if (!(lobby.fighters.contains(name))){
if (!(lobby.fighters.contains(name))) {
player.sendMessage("You are not fighting!");
return false;
}
lobby.fighters.remove(name);
if(!(lobby.fighters.contains(name))){
if (!(lobby.fighters.contains(name))) {
player.sendMessage("You have left the fighters category!");
}
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;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import java.util.stream.Collectors;
import org.bukkit.command.CommandSender;
import alisolarflare.minigames.lobby.LobbyModule;
import buttondevteam.lib.chat.TBMCCommandBase;
public class ListFighters implements CommandExecutor{
public class ListFighters extends TBMCCommandBase {
private LobbyModule lobby;
public ListFighters(LobbyModule lobby) {
@ -14,8 +15,24 @@ public class ListFighters implements CommandExecutor{
}
@Override
public boolean onCommand(CommandSender sender, Command arg1, String arg2, String[] arg3) {
sender.sendMessage(lobby.fighters.toString());
public boolean OnCommand(CommandSender sender, String arg2, String[] arg3) {
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;
}