mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-25 06:36:45 +01:00
Static Abuse Removal - Party Commands
This commit is contained in:
parent
5fd93cea19
commit
762c3bd04e
@ -0,0 +1,10 @@
|
|||||||
|
package com.gmail.nossr50.commands;
|
||||||
|
|
||||||
|
import com.google.common.collect.ImmutableList;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class CommandConstants {
|
||||||
|
public static final List<String> TELEPORT_SUBCOMMANDS = ImmutableList.of("toggle", "accept", "acceptany", "acceptall");
|
||||||
|
public static final List<String> ALLIANCE_SUBCOMMANDS = ImmutableList.of("invite", "accept", "disband");
|
||||||
|
}
|
@ -1,6 +1,7 @@
|
|||||||
package com.gmail.nossr50.commands.party;
|
package com.gmail.nossr50.commands.party;
|
||||||
|
|
||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||||
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.util.player.UserManager;
|
import com.gmail.nossr50.util.player.UserManager;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandExecutor;
|
import org.bukkit.command.CommandExecutor;
|
||||||
@ -8,6 +9,13 @@ import org.bukkit.command.CommandSender;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
public class PartyAcceptCommand implements CommandExecutor {
|
public class PartyAcceptCommand implements CommandExecutor {
|
||||||
|
|
||||||
|
private mcMMO pluginRef;
|
||||||
|
|
||||||
|
public PartyAcceptCommand(mcMMO pluginRef) {
|
||||||
|
this.pluginRef = pluginRef;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||||
if (args.length == 1) {
|
if (args.length == 1) {
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.gmail.nossr50.commands.party;
|
package com.gmail.nossr50.commands.party;
|
||||||
|
|
||||||
import com.gmail.nossr50.datatypes.party.Party;
|
import com.gmail.nossr50.datatypes.party.Party;
|
||||||
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.util.player.UserManager;
|
import com.gmail.nossr50.util.player.UserManager;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandExecutor;
|
import org.bukkit.command.CommandExecutor;
|
||||||
@ -8,6 +9,13 @@ import org.bukkit.command.CommandSender;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
public class PartyChangePasswordCommand implements CommandExecutor {
|
public class PartyChangePasswordCommand implements CommandExecutor {
|
||||||
|
|
||||||
|
private mcMMO pluginRef;
|
||||||
|
|
||||||
|
public PartyChangePasswordCommand(mcMMO pluginRef) {
|
||||||
|
this.pluginRef = pluginRef;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||||
if (UserManager.getPlayer((Player) sender) == null) {
|
if (UserManager.getPlayer((Player) sender) == null) {
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.gmail.nossr50.commands.party;
|
package com.gmail.nossr50.commands.party;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.commands.CommandConstants;
|
||||||
import com.gmail.nossr50.commands.chat.PartyChatCommand;
|
import com.gmail.nossr50.commands.chat.PartyChatCommand;
|
||||||
import com.gmail.nossr50.commands.party.alliance.PartyAllianceCommand;
|
import com.gmail.nossr50.commands.party.alliance.PartyAllianceCommand;
|
||||||
import com.gmail.nossr50.commands.party.teleport.PtpCommand;
|
import com.gmail.nossr50.commands.party.teleport.PtpCommand;
|
||||||
@ -22,13 +23,51 @@ import java.util.Arrays;
|
|||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
//TODO: This class horrifies me, rewrite it at some point
|
||||||
public class PartyCommand implements TabExecutor {
|
public class PartyCommand implements TabExecutor {
|
||||||
|
|
||||||
private mcMMO pluginRef;
|
private mcMMO pluginRef;
|
||||||
|
private CommandExecutor partyJoinCommand;
|
||||||
|
private CommandExecutor partyAcceptCommand;
|
||||||
|
private CommandExecutor partyCreateCommand;
|
||||||
|
private CommandExecutor partyQuitCommand;
|
||||||
|
private CommandExecutor partyXpShareCommand;
|
||||||
|
private CommandExecutor partyItemShareCommand;
|
||||||
|
private CommandExecutor partyInviteCommand;
|
||||||
|
private CommandExecutor partyKickCommand;
|
||||||
|
private CommandExecutor partyDisbandCommand;
|
||||||
|
private CommandExecutor partyChangeOwnerCommand;
|
||||||
|
private CommandExecutor partyLockCommand;
|
||||||
|
private CommandExecutor partyChangePasswordCommand;
|
||||||
|
private CommandExecutor partyRenameCommand;
|
||||||
|
private CommandExecutor partyInfoCommand;
|
||||||
|
private CommandExecutor partyHelpCommand;
|
||||||
|
private CommandExecutor partyTeleportCommand;
|
||||||
|
private CommandExecutor partyChatCommand;
|
||||||
|
private CommandExecutor partyAllianceCommand;
|
||||||
|
|
||||||
public PartyCommand(mcMMO pluginRef) {
|
public PartyCommand(mcMMO pluginRef) {
|
||||||
this.pluginRef = pluginRef;
|
this.pluginRef = pluginRef;
|
||||||
initSubCommandList();
|
initSubCommandList();
|
||||||
|
|
||||||
|
partyJoinCommand = new PartyJoinCommand(pluginRef);
|
||||||
|
partyAcceptCommand = new PartyAcceptCommand(pluginRef);
|
||||||
|
partyCreateCommand = new PartyCreateCommand(pluginRef);
|
||||||
|
partyQuitCommand = new PartyQuitCommand(pluginRef);
|
||||||
|
partyXpShareCommand = new PartyXpShareCommand(pluginRef);
|
||||||
|
partyItemShareCommand = new PartyItemShareCommand(pluginRef);
|
||||||
|
partyInviteCommand = new PartyInviteCommand(pluginRef);
|
||||||
|
partyKickCommand = new PartyKickCommand(pluginRef);
|
||||||
|
partyDisbandCommand = new PartyDisbandCommand(pluginRef);
|
||||||
|
partyChangeOwnerCommand = new PartyChangeOwnerCommand(pluginRef);
|
||||||
|
partyLockCommand = new PartyLockCommand(pluginRef);
|
||||||
|
partyChangePasswordCommand = new PartyChangePasswordCommand(pluginRef);
|
||||||
|
partyRenameCommand = new PartyRenameCommand(pluginRef);
|
||||||
|
partyInfoCommand = new PartyInfoCommand(pluginRef);
|
||||||
|
partyHelpCommand = new PartyHelpCommand(pluginRef);
|
||||||
|
partyTeleportCommand = new PtpCommand(pluginRef);
|
||||||
|
partyChatCommand = new PartyChatCommand(pluginRef);
|
||||||
|
partyAllianceCommand = new PartyAllianceCommand(pluginRef);
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<String> PARTY_SUBCOMMANDS;
|
private List<String> PARTY_SUBCOMMANDS;
|
||||||
@ -46,24 +85,7 @@ public class PartyCommand implements TabExecutor {
|
|||||||
PARTY_SUBCOMMANDS = ImmutableList.copyOf(subcommands);
|
PARTY_SUBCOMMANDS = ImmutableList.copyOf(subcommands);
|
||||||
}
|
}
|
||||||
|
|
||||||
private CommandExecutor partyJoinCommand = new PartyJoinCommand();
|
|
||||||
private CommandExecutor partyAcceptCommand = new PartyAcceptCommand();
|
|
||||||
private CommandExecutor partyCreateCommand = new PartyCreateCommand();
|
|
||||||
private CommandExecutor partyQuitCommand = new PartyQuitCommand();
|
|
||||||
private CommandExecutor partyXpShareCommand = new PartyXpShareCommand();
|
|
||||||
private CommandExecutor partyItemShareCommand = new PartyItemShareCommand();
|
|
||||||
private CommandExecutor partyInviteCommand = new PartyInviteCommand();
|
|
||||||
private CommandExecutor partyKickCommand = new PartyKickCommand();
|
|
||||||
private CommandExecutor partyDisbandCommand = new PartyDisbandCommand();
|
|
||||||
private CommandExecutor partyChangeOwnerCommand = new PartyChangeOwnerCommand();
|
|
||||||
private CommandExecutor partyLockCommand = new PartyLockCommand();
|
|
||||||
private CommandExecutor partyChangePasswordCommand = new PartyChangePasswordCommand();
|
|
||||||
private CommandExecutor partyRenameCommand = new PartyRenameCommand();
|
|
||||||
private CommandExecutor partyInfoCommand = new PartyInfoCommand();
|
|
||||||
private CommandExecutor partyHelpCommand = new PartyHelpCommand();
|
|
||||||
private CommandExecutor partyTeleportCommand = new PtpCommand();
|
|
||||||
private CommandExecutor partyChatCommand = new PartyChatCommand();
|
|
||||||
private CommandExecutor partyAllianceCommand = new PartyAllianceCommand();
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||||
@ -210,7 +232,7 @@ public class PartyCommand implements TabExecutor {
|
|||||||
case PASSWORD:
|
case PASSWORD:
|
||||||
return StringUtil.copyPartialMatches(args[1], CommandUtils.RESET_OPTIONS, new ArrayList<>(CommandUtils.RESET_OPTIONS.size()));
|
return StringUtil.copyPartialMatches(args[1], CommandUtils.RESET_OPTIONS, new ArrayList<>(CommandUtils.RESET_OPTIONS.size()));
|
||||||
case TELEPORT:
|
case TELEPORT:
|
||||||
List<String> matches = StringUtil.copyPartialMatches(args[1], PtpCommand.TELEPORT_SUBCOMMANDS, new ArrayList<>(PtpCommand.TELEPORT_SUBCOMMANDS.size()));
|
List<String> matches = StringUtil.copyPartialMatches(args[1], CommandConstants.TELEPORT_SUBCOMMANDS, new ArrayList<>(CommandConstants.TELEPORT_SUBCOMMANDS.size()));
|
||||||
|
|
||||||
if (matches.size() == 0) {
|
if (matches.size() == 0) {
|
||||||
Player player = (Player) sender;
|
Player player = (Player) sender;
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.gmail.nossr50.commands.party;
|
package com.gmail.nossr50.commands.party;
|
||||||
|
|
||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||||
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.util.player.UserManager;
|
import com.gmail.nossr50.util.player.UserManager;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandExecutor;
|
import org.bukkit.command.CommandExecutor;
|
||||||
@ -8,6 +9,13 @@ import org.bukkit.command.CommandSender;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
public class PartyCreateCommand implements CommandExecutor {
|
public class PartyCreateCommand implements CommandExecutor {
|
||||||
|
|
||||||
|
private mcMMO pluginRef;
|
||||||
|
|
||||||
|
public PartyCreateCommand(mcMMO pluginRef) {
|
||||||
|
this.pluginRef = pluginRef;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||||
switch (args.length) {
|
switch (args.length) {
|
||||||
|
@ -2,6 +2,7 @@ package com.gmail.nossr50.commands.party;
|
|||||||
|
|
||||||
import com.gmail.nossr50.datatypes.party.Party;
|
import com.gmail.nossr50.datatypes.party.Party;
|
||||||
import com.gmail.nossr50.events.party.McMMOPartyChangeEvent.EventReason;
|
import com.gmail.nossr50.events.party.McMMOPartyChangeEvent.EventReason;
|
||||||
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.util.player.UserManager;
|
import com.gmail.nossr50.util.player.UserManager;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandExecutor;
|
import org.bukkit.command.CommandExecutor;
|
||||||
@ -9,6 +10,13 @@ import org.bukkit.command.CommandSender;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
public class PartyDisbandCommand implements CommandExecutor {
|
public class PartyDisbandCommand implements CommandExecutor {
|
||||||
|
|
||||||
|
private mcMMO pluginRef;
|
||||||
|
|
||||||
|
public PartyDisbandCommand(mcMMO pluginRef) {
|
||||||
|
this.pluginRef = pluginRef;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||||
switch (args.length) {
|
switch (args.length) {
|
||||||
|
@ -1,11 +1,18 @@
|
|||||||
package com.gmail.nossr50.commands.party;
|
package com.gmail.nossr50.commands.party;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.mcMMO;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandExecutor;
|
import org.bukkit.command.CommandExecutor;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
|
||||||
public class PartyHelpCommand implements CommandExecutor {
|
public class PartyHelpCommand implements CommandExecutor {
|
||||||
|
|
||||||
|
private mcMMO pluginRef;
|
||||||
|
|
||||||
|
public PartyHelpCommand(mcMMO pluginRef) {
|
||||||
|
this.pluginRef = pluginRef;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||||
switch (args.length) {
|
switch (args.length) {
|
||||||
|
@ -4,6 +4,7 @@ import com.gmail.nossr50.datatypes.party.Party;
|
|||||||
import com.gmail.nossr50.datatypes.party.PartyFeature;
|
import com.gmail.nossr50.datatypes.party.PartyFeature;
|
||||||
import com.gmail.nossr50.datatypes.party.ShareMode;
|
import com.gmail.nossr50.datatypes.party.ShareMode;
|
||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||||
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.util.player.UserManager;
|
import com.gmail.nossr50.util.player.UserManager;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
@ -15,6 +16,13 @@ import java.util.ArrayList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class PartyInfoCommand implements CommandExecutor {
|
public class PartyInfoCommand implements CommandExecutor {
|
||||||
|
|
||||||
|
private mcMMO pluginRef;
|
||||||
|
|
||||||
|
public PartyInfoCommand(mcMMO pluginRef) {
|
||||||
|
this.pluginRef = pluginRef;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||||
switch (args.length) {
|
switch (args.length) {
|
||||||
|
@ -2,6 +2,7 @@ package com.gmail.nossr50.commands.party;
|
|||||||
|
|
||||||
import com.gmail.nossr50.datatypes.party.Party;
|
import com.gmail.nossr50.datatypes.party.Party;
|
||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||||
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.util.commands.CommandUtils;
|
import com.gmail.nossr50.util.commands.CommandUtils;
|
||||||
import com.gmail.nossr50.util.player.UserManager;
|
import com.gmail.nossr50.util.player.UserManager;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
@ -10,6 +11,13 @@ import org.bukkit.command.CommandSender;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
public class PartyInviteCommand implements CommandExecutor {
|
public class PartyInviteCommand implements CommandExecutor {
|
||||||
|
|
||||||
|
private mcMMO pluginRef;
|
||||||
|
|
||||||
|
public PartyInviteCommand(mcMMO pluginRef) {
|
||||||
|
this.pluginRef = pluginRef;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||||
switch (args.length) {
|
switch (args.length) {
|
||||||
|
@ -4,6 +4,7 @@ import com.gmail.nossr50.datatypes.party.ItemShareType;
|
|||||||
import com.gmail.nossr50.datatypes.party.Party;
|
import com.gmail.nossr50.datatypes.party.Party;
|
||||||
import com.gmail.nossr50.datatypes.party.PartyFeature;
|
import com.gmail.nossr50.datatypes.party.PartyFeature;
|
||||||
import com.gmail.nossr50.datatypes.party.ShareMode;
|
import com.gmail.nossr50.datatypes.party.ShareMode;
|
||||||
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.util.StringUtils;
|
import com.gmail.nossr50.util.StringUtils;
|
||||||
import com.gmail.nossr50.util.commands.CommandUtils;
|
import com.gmail.nossr50.util.commands.CommandUtils;
|
||||||
import com.gmail.nossr50.util.player.UserManager;
|
import com.gmail.nossr50.util.player.UserManager;
|
||||||
@ -13,6 +14,13 @@ import org.bukkit.command.CommandSender;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
public class PartyItemShareCommand implements CommandExecutor {
|
public class PartyItemShareCommand implements CommandExecutor {
|
||||||
|
|
||||||
|
private mcMMO pluginRef;
|
||||||
|
|
||||||
|
public PartyItemShareCommand(mcMMO pluginRef) {
|
||||||
|
this.pluginRef = pluginRef;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||||
if (UserManager.getPlayer((Player) sender) == null) {
|
if (UserManager.getPlayer((Player) sender) == null) {
|
||||||
|
@ -2,6 +2,7 @@ package com.gmail.nossr50.commands.party;
|
|||||||
|
|
||||||
import com.gmail.nossr50.datatypes.party.Party;
|
import com.gmail.nossr50.datatypes.party.Party;
|
||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||||
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.util.commands.CommandUtils;
|
import com.gmail.nossr50.util.commands.CommandUtils;
|
||||||
import com.gmail.nossr50.util.player.UserManager;
|
import com.gmail.nossr50.util.player.UserManager;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
@ -10,6 +11,13 @@ import org.bukkit.command.CommandSender;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
public class PartyJoinCommand implements CommandExecutor {
|
public class PartyJoinCommand implements CommandExecutor {
|
||||||
|
|
||||||
|
private mcMMO pluginRef;
|
||||||
|
|
||||||
|
public PartyJoinCommand(mcMMO pluginRef) {
|
||||||
|
this.pluginRef = pluginRef;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||||
switch (args.length) {
|
switch (args.length) {
|
||||||
|
@ -2,6 +2,7 @@ package com.gmail.nossr50.commands.party;
|
|||||||
|
|
||||||
import com.gmail.nossr50.datatypes.party.Party;
|
import com.gmail.nossr50.datatypes.party.Party;
|
||||||
import com.gmail.nossr50.events.party.McMMOPartyChangeEvent.EventReason;
|
import com.gmail.nossr50.events.party.McMMOPartyChangeEvent.EventReason;
|
||||||
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.util.commands.CommandUtils;
|
import com.gmail.nossr50.util.commands.CommandUtils;
|
||||||
import com.gmail.nossr50.util.player.UserManager;
|
import com.gmail.nossr50.util.player.UserManager;
|
||||||
import org.bukkit.OfflinePlayer;
|
import org.bukkit.OfflinePlayer;
|
||||||
@ -11,6 +12,13 @@ import org.bukkit.command.CommandSender;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
public class PartyKickCommand implements CommandExecutor {
|
public class PartyKickCommand implements CommandExecutor {
|
||||||
|
|
||||||
|
private mcMMO pluginRef;
|
||||||
|
|
||||||
|
public PartyKickCommand(mcMMO pluginRef) {
|
||||||
|
this.pluginRef = pluginRef;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||||
switch (args.length) {
|
switch (args.length) {
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.gmail.nossr50.commands.party;
|
package com.gmail.nossr50.commands.party;
|
||||||
|
|
||||||
import com.gmail.nossr50.datatypes.party.Party;
|
import com.gmail.nossr50.datatypes.party.Party;
|
||||||
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.util.Permissions;
|
import com.gmail.nossr50.util.Permissions;
|
||||||
import com.gmail.nossr50.util.commands.CommandUtils;
|
import com.gmail.nossr50.util.commands.CommandUtils;
|
||||||
import com.gmail.nossr50.util.player.UserManager;
|
import com.gmail.nossr50.util.player.UserManager;
|
||||||
@ -10,6 +11,13 @@ import org.bukkit.command.CommandSender;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
public class PartyLockCommand implements CommandExecutor {
|
public class PartyLockCommand implements CommandExecutor {
|
||||||
|
|
||||||
|
private mcMMO pluginRef;
|
||||||
|
|
||||||
|
public PartyLockCommand(mcMMO pluginRef) {
|
||||||
|
this.pluginRef = pluginRef;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||||
switch (args.length) {
|
switch (args.length) {
|
||||||
|
@ -3,6 +3,7 @@ package com.gmail.nossr50.commands.party;
|
|||||||
import com.gmail.nossr50.datatypes.party.Party;
|
import com.gmail.nossr50.datatypes.party.Party;
|
||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||||
import com.gmail.nossr50.events.party.McMMOPartyChangeEvent.EventReason;
|
import com.gmail.nossr50.events.party.McMMOPartyChangeEvent.EventReason;
|
||||||
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.util.player.UserManager;
|
import com.gmail.nossr50.util.player.UserManager;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandExecutor;
|
import org.bukkit.command.CommandExecutor;
|
||||||
@ -10,6 +11,13 @@ import org.bukkit.command.CommandSender;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
public class PartyQuitCommand implements CommandExecutor {
|
public class PartyQuitCommand implements CommandExecutor {
|
||||||
|
|
||||||
|
private mcMMO pluginRef;
|
||||||
|
|
||||||
|
public PartyQuitCommand(mcMMO pluginRef) {
|
||||||
|
this.pluginRef = pluginRef;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||||
switch (args.length) {
|
switch (args.length) {
|
||||||
|
@ -3,6 +3,7 @@ package com.gmail.nossr50.commands.party;
|
|||||||
import com.gmail.nossr50.datatypes.party.Party;
|
import com.gmail.nossr50.datatypes.party.Party;
|
||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||||
import com.gmail.nossr50.events.party.McMMOPartyChangeEvent.EventReason;
|
import com.gmail.nossr50.events.party.McMMOPartyChangeEvent.EventReason;
|
||||||
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.util.player.UserManager;
|
import com.gmail.nossr50.util.player.UserManager;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandExecutor;
|
import org.bukkit.command.CommandExecutor;
|
||||||
@ -10,6 +11,13 @@ import org.bukkit.command.CommandSender;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
public class PartyRenameCommand implements CommandExecutor {
|
public class PartyRenameCommand implements CommandExecutor {
|
||||||
|
|
||||||
|
private mcMMO pluginRef;
|
||||||
|
|
||||||
|
public PartyRenameCommand(mcMMO pluginRef) {
|
||||||
|
this.pluginRef = pluginRef;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||||
switch (args.length) {
|
switch (args.length) {
|
||||||
|
@ -3,6 +3,7 @@ package com.gmail.nossr50.commands.party;
|
|||||||
import com.gmail.nossr50.datatypes.party.Party;
|
import com.gmail.nossr50.datatypes.party.Party;
|
||||||
import com.gmail.nossr50.datatypes.party.PartyFeature;
|
import com.gmail.nossr50.datatypes.party.PartyFeature;
|
||||||
import com.gmail.nossr50.datatypes.party.ShareMode;
|
import com.gmail.nossr50.datatypes.party.ShareMode;
|
||||||
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.util.StringUtils;
|
import com.gmail.nossr50.util.StringUtils;
|
||||||
import com.gmail.nossr50.util.commands.CommandUtils;
|
import com.gmail.nossr50.util.commands.CommandUtils;
|
||||||
import com.gmail.nossr50.util.player.UserManager;
|
import com.gmail.nossr50.util.player.UserManager;
|
||||||
@ -12,6 +13,13 @@ import org.bukkit.command.CommandSender;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
public class PartyXpShareCommand implements CommandExecutor {
|
public class PartyXpShareCommand implements CommandExecutor {
|
||||||
|
|
||||||
|
private mcMMO pluginRef;
|
||||||
|
|
||||||
|
public PartyXpShareCommand(mcMMO pluginRef) {
|
||||||
|
this.pluginRef = pluginRef;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||||
if (UserManager.getPlayer((Player) sender) == null) {
|
if (UserManager.getPlayer((Player) sender) == null) {
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.gmail.nossr50.commands.party.alliance;
|
package com.gmail.nossr50.commands.party.alliance;
|
||||||
|
|
||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||||
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.util.player.UserManager;
|
import com.gmail.nossr50.util.player.UserManager;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandExecutor;
|
import org.bukkit.command.CommandExecutor;
|
||||||
@ -8,6 +9,13 @@ import org.bukkit.command.CommandSender;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
public class PartyAllianceAcceptCommand implements CommandExecutor {
|
public class PartyAllianceAcceptCommand implements CommandExecutor {
|
||||||
|
|
||||||
|
private mcMMO pluginRef;
|
||||||
|
|
||||||
|
public PartyAllianceAcceptCommand(mcMMO pluginRef) {
|
||||||
|
this.pluginRef = pluginRef;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||||
switch (args.length) {
|
switch (args.length) {
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
package com.gmail.nossr50.commands.party.alliance;
|
package com.gmail.nossr50.commands.party.alliance;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.commands.CommandConstants;
|
||||||
import com.gmail.nossr50.datatypes.party.Party;
|
import com.gmail.nossr50.datatypes.party.Party;
|
||||||
import com.gmail.nossr50.datatypes.party.PartyFeature;
|
import com.gmail.nossr50.datatypes.party.PartyFeature;
|
||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||||
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.util.commands.CommandUtils;
|
import com.gmail.nossr50.util.commands.CommandUtils;
|
||||||
import com.gmail.nossr50.util.player.UserManager;
|
import com.gmail.nossr50.util.player.UserManager;
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
@ -18,13 +20,23 @@ import java.util.ArrayList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class PartyAllianceCommand implements TabExecutor {
|
public class PartyAllianceCommand implements TabExecutor {
|
||||||
public static final List<String> ALLIANCE_SUBCOMMANDS = ImmutableList.of("invite", "accept", "disband");
|
|
||||||
|
private mcMMO pluginRef;
|
||||||
private Player player;
|
private Player player;
|
||||||
private Party playerParty;
|
private Party playerParty;
|
||||||
private Party targetParty;
|
private Party targetParty;
|
||||||
private CommandExecutor partyAllianceInviteCommand = new PartyAllianceInviteCommand();
|
private CommandExecutor partyAllianceInviteCommand;
|
||||||
private CommandExecutor partyAllianceAcceptCommand = new PartyAllianceAcceptCommand();
|
private CommandExecutor partyAllianceAcceptCommand;
|
||||||
private CommandExecutor partyAllianceDisbandCommand = new PartyAllianceDisbandCommand();
|
private CommandExecutor partyAllianceDisbandCommand;
|
||||||
|
|
||||||
|
public PartyAllianceCommand(mcMMO pluginRef) {
|
||||||
|
this.pluginRef = pluginRef;
|
||||||
|
|
||||||
|
//Init SubCommands
|
||||||
|
partyAllianceInviteCommand = new PartyAllianceInviteCommand(pluginRef);
|
||||||
|
partyAllianceAcceptCommand = new PartyAllianceAcceptCommand(pluginRef);
|
||||||
|
partyAllianceDisbandCommand = new PartyAllianceDisbandCommand(pluginRef);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||||
@ -104,7 +116,7 @@ public class PartyAllianceCommand implements TabExecutor {
|
|||||||
public List<String> onTabComplete(CommandSender commandSender, Command command, String label, String[] args) {
|
public List<String> onTabComplete(CommandSender commandSender, Command command, String label, String[] args) {
|
||||||
switch (args.length) {
|
switch (args.length) {
|
||||||
case 1:
|
case 1:
|
||||||
List<String> matches = StringUtil.copyPartialMatches(args[0], ALLIANCE_SUBCOMMANDS, new ArrayList<>(ALLIANCE_SUBCOMMANDS.size()));
|
List<String> matches = StringUtil.copyPartialMatches(args[0], CommandConstants.ALLIANCE_SUBCOMMANDS, new ArrayList<>(CommandConstants.ALLIANCE_SUBCOMMANDS.size()));
|
||||||
|
|
||||||
if (matches.size() == 0) {
|
if (matches.size() == 0) {
|
||||||
List<String> playerNames = CommandUtils.getOnlinePlayerNames(commandSender);
|
List<String> playerNames = CommandUtils.getOnlinePlayerNames(commandSender);
|
||||||
|
@ -2,6 +2,7 @@ package com.gmail.nossr50.commands.party.alliance;
|
|||||||
|
|
||||||
import com.gmail.nossr50.datatypes.party.Party;
|
import com.gmail.nossr50.datatypes.party.Party;
|
||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||||
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.util.player.UserManager;
|
import com.gmail.nossr50.util.player.UserManager;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandExecutor;
|
import org.bukkit.command.CommandExecutor;
|
||||||
@ -9,6 +10,13 @@ import org.bukkit.command.CommandSender;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
public class PartyAllianceDisbandCommand implements CommandExecutor {
|
public class PartyAllianceDisbandCommand implements CommandExecutor {
|
||||||
|
|
||||||
|
private mcMMO pluginRef;
|
||||||
|
|
||||||
|
public PartyAllianceDisbandCommand(mcMMO pluginRef) {
|
||||||
|
this.pluginRef = pluginRef;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||||
switch (args.length) {
|
switch (args.length) {
|
||||||
|
@ -2,6 +2,7 @@ package com.gmail.nossr50.commands.party.alliance;
|
|||||||
|
|
||||||
import com.gmail.nossr50.datatypes.party.Party;
|
import com.gmail.nossr50.datatypes.party.Party;
|
||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||||
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.util.commands.CommandUtils;
|
import com.gmail.nossr50.util.commands.CommandUtils;
|
||||||
import com.gmail.nossr50.util.player.UserManager;
|
import com.gmail.nossr50.util.player.UserManager;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
@ -10,6 +11,13 @@ import org.bukkit.command.CommandSender;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
public class PartyAllianceInviteCommand implements CommandExecutor {
|
public class PartyAllianceInviteCommand implements CommandExecutor {
|
||||||
|
|
||||||
|
private mcMMO pluginRef;
|
||||||
|
|
||||||
|
public PartyAllianceInviteCommand(mcMMO pluginRef) {
|
||||||
|
this.pluginRef = pluginRef;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||||
switch (args.length) {
|
switch (args.length) {
|
||||||
|
@ -48,7 +48,7 @@ public class PtpAcceptCommand implements CommandExecutor {
|
|||||||
Player target = ptpRecord.getRequestor();
|
Player target = ptpRecord.getRequestor();
|
||||||
ptpRecord.removeRequest();
|
ptpRecord.removeRequest();
|
||||||
|
|
||||||
if (!PtpCommand.canTeleport(sender, player, target.getName())) {
|
if (!pluginRef.getPartyManager().canTeleport(sender, player, target.getName())) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -67,7 +67,7 @@ public class PtpAcceptCommand implements CommandExecutor {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PtpCommand.handleTeleportWarmup(target, player);
|
pluginRef.getPartyManager().handleTeleportWarmup(target, player);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.gmail.nossr50.commands.party.teleport;
|
package com.gmail.nossr50.commands.party.teleport;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.commands.CommandConstants;
|
||||||
import com.gmail.nossr50.config.WorldBlacklist;
|
import com.gmail.nossr50.config.WorldBlacklist;
|
||||||
import com.gmail.nossr50.datatypes.party.Party;
|
import com.gmail.nossr50.datatypes.party.Party;
|
||||||
import com.gmail.nossr50.datatypes.party.PartyFeature;
|
import com.gmail.nossr50.datatypes.party.PartyFeature;
|
||||||
@ -41,8 +42,6 @@ public class PtpCommand implements TabExecutor {
|
|||||||
ptpAcceptCommand = new PtpAcceptCommand(pluginRef);
|
ptpAcceptCommand = new PtpAcceptCommand(pluginRef);
|
||||||
}
|
}
|
||||||
|
|
||||||
public final List<String> TELEPORT_SUBCOMMANDS = ImmutableList.of("toggle", "accept", "acceptany", "acceptall");
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||||
if (CommandUtils.noConsoleUsage(sender)) {
|
if (CommandUtils.noConsoleUsage(sender)) {
|
||||||
@ -136,7 +135,7 @@ public class PtpCommand implements TabExecutor {
|
|||||||
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
|
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
|
||||||
switch (args.length) {
|
switch (args.length) {
|
||||||
case 1:
|
case 1:
|
||||||
List<String> matches = StringUtil.copyPartialMatches(args[0], TELEPORT_SUBCOMMANDS, new ArrayList<>(TELEPORT_SUBCOMMANDS.size()));
|
List<String> matches = StringUtil.copyPartialMatches(args[0], CommandConstants.TELEPORT_SUBCOMMANDS, new ArrayList<>(CommandConstants.TELEPORT_SUBCOMMANDS.size()));
|
||||||
|
|
||||||
if (matches.size() == 0) {
|
if (matches.size() == 0) {
|
||||||
if (UserManager.getPlayer((Player) sender) == null) {
|
if (UserManager.getPlayer((Player) sender) == null) {
|
||||||
|
Loading…
Reference in New Issue
Block a user