Class TownCommand

java.lang.Object
com.palmergames.bukkit.towny.command.BaseCommand
com.palmergames.bukkit.towny.command.TownCommand
All Implemented Interfaces:
org.bukkit.command.CommandExecutor, org.bukkit.command.TabCompleter

public class TownCommand extends BaseCommand implements org.bukkit.command.CommandExecutor
Send a list of all town help commands to player Command: /town
  • Field Details

    • townTabCompletes

      @VisibleForTesting public static final List<String> townTabCompletes
    • townSetTabCompletes

      @VisibleForTesting public static final List<String> townSetTabCompletes
    • townUnclaimTabCompletes

      public static final List<String> townUnclaimTabCompletes
  • Constructor Details

    • TownCommand

      public TownCommand(Towny instance)
  • Method Details

    • onTabComplete

      public List<String> onTabComplete(org.bukkit.command.CommandSender sender, org.bukkit.command.Command command, String alias, String[] args)
      Specified by:
      onTabComplete in interface org.bukkit.command.TabCompleter
      Overrides:
      onTabComplete in class BaseCommand
    • onCommand

      public boolean onCommand(@NotNull @NotNull org.bukkit.command.CommandSender sender, @NotNull @NotNull org.bukkit.command.Command cmd, @NotNull @NotNull String label, String[] args)
      Specified by:
      onCommand in interface org.bukkit.command.CommandExecutor
    • parseTownOutlawCommand

      public static void parseTownOutlawCommand(org.bukkit.command.CommandSender sender, String[] split, boolean admin, Town town) throws TownyException
      Throws:
      TownyException
    • listTowns

      public void listTowns(org.bukkit.command.CommandSender sender, String[] split) throws TownyException
      Send a list of all towns in the universe to player Command: /town list
      Parameters:
      sender - - Sender (player or console.)
      split - - Current command arguments.
      Throws:
      TownyException - when a player lacks the permission node.
    • townToggle

      public static void townToggle(org.bukkit.command.CommandSender sender, String[] split, boolean admin, Town town) throws TownyException
      Throws:
      TownyException
    • townRank

      public void townRank(org.bukkit.entity.Player player, String[] split) throws TownyException
      Throws:
      TownyException
    • townSet

      public static void townSet(org.bukkit.command.CommandSender sender, String[] split, boolean admin, Town town) throws TownyException
      Throws:
      TownyException
    • townSetBoard

      public static void townSetBoard(org.bukkit.command.CommandSender sender, String board, Town town) throws TownyException
      Throws:
      TownyException
    • townSetTitle

      public static void townSetTitle(@NotNull @NotNull org.bukkit.command.CommandSender sender, @NotNull @NotNull String[] split, boolean admin) throws TownyException
      Throws:
      TownyException
    • townSetSurname

      public static void townSetSurname(org.bukkit.command.CommandSender sender, String[] split, boolean admin) throws TownyException
      Throws:
      TownyException
    • townSetMayor

      public static void townSetMayor(org.bukkit.command.CommandSender sender, String[] split, boolean admin, Town town, Resident resident) throws TownyException
      Throws:
      TownyException
    • townSetTaxes

      public static void townSetTaxes(org.bukkit.command.CommandSender sender, String[] split, boolean admin, Town town) throws TownyException
      Throws:
      TownyException
    • townSetPlotTax

      public static void townSetPlotTax(org.bukkit.command.CommandSender sender, String[] split, boolean admin, Town town) throws TownyException
      Throws:
      TownyException
    • townSetShopTax

      public static void townSetShopTax(org.bukkit.command.CommandSender sender, String[] split, boolean admin, Town town) throws TownyException
      Throws:
      TownyException
    • townSetEmbassyTax

      public static void townSetEmbassyTax(org.bukkit.command.CommandSender sender, String[] split, boolean admin, Town town) throws TownyException
      Throws:
      TownyException
    • townSetPlotPrice

      public static void townSetPlotPrice(org.bukkit.command.CommandSender sender, String[] split, boolean admin, Town town) throws TownyException
      Throws:
      TownyException
    • townSetShopPrice

      public static void townSetShopPrice(org.bukkit.command.CommandSender sender, String[] split, boolean admin, Town town) throws TownyException
      Throws:
      TownyException
    • townSetEmbassyPrice

      public static void townSetEmbassyPrice(org.bukkit.command.CommandSender sender, String[] split, boolean admin, Town town) throws TownyException
      Throws:
      TownyException
    • townSetSpawnCost

      public static void townSetSpawnCost(org.bukkit.command.CommandSender sender, String[] split, boolean admin, Town town) throws TownyException
      Throws:
      TownyException
    • townSetName

      public static void townSetName(org.bukkit.command.CommandSender sender, String[] split, Town town) throws TownyException
      Throws:
      TownyException
    • townSetTag

      public static void townSetTag(org.bukkit.command.CommandSender sender, String[] split, boolean admin, Town town) throws TownyException
      Throws:
      TownyException
    • townSetHomeblock

      public static void townSetHomeblock(org.bukkit.command.CommandSender sender, Town town) throws TownyException
      Throws:
      TownyException
    • townSetSpawn

      public static void townSetSpawn(org.bukkit.command.CommandSender sender, Town town, boolean admin) throws TownyException
      Throws:
      TownyException
    • townSetOutpost

      public static void townSetOutpost(org.bukkit.command.CommandSender sender, Town town) throws TownyException
      Throws:
      TownyException
    • townSetPrimaryJail

      public static void townSetPrimaryJail(org.bukkit.command.CommandSender sender, Town town) throws TownyException
      Throws:
      TownyException
    • townSetMapColor

      public static void townSetMapColor(org.bukkit.command.CommandSender sender, String[] split, Town town) throws TownyException
      Throws:
      TownyException
    • townSetTaxPercent

      public static void townSetTaxPercent(org.bukkit.command.CommandSender sender, String[] split, Town town) throws TownyException
      Throws:
      TownyException
    • townBuy

      public static void townBuy(org.bukkit.command.CommandSender sender, String[] split, @Nullable @Nullable Town town, boolean admin) throws TownyException
      Throws:
      TownyException
    • townBuyBonus

      public static void townBuyBonus(Town town, String[] split, org.bukkit.command.CommandSender sender) throws TownyException
      Town tries to buy bonus blocks or checks the cost and increase.
      Parameters:
      town - - Towm object.
      split - - List of command arguments.
      sender - - Player.
      Throws:
      TownyException - - Exception.
    • townBuyBonusTownBlocks

      public static void townBuyBonusTownBlocks(Town town, int inputN, org.bukkit.command.CommandSender sender) throws TownyException
      Town buys bonus blocks after checking the configured maximum.
      Parameters:
      town - - Towm object.
      inputN - - Number of townblocks being bought.
      sender - - Player.
      Throws:
      TownyException - - Exception.
    • newTown

      public static void newTown(org.bukkit.entity.Player player, String name, Resident resident, boolean noCharge) throws TownyException
      Create a new town. Command: /town new [town]
      Parameters:
      player - - Player.
      name - - name of town
      resident - - The resident in charge of the town.
      noCharge - - charging for creation - /ta town new NAME MAYOR has no charge.
      Throws:
      TownyException - when a new town isn't allowed.
    • newTown

      public static void newTown(org.bukkit.entity.Player player, String name, Resident resident, boolean noCharge, boolean adminCreated) throws TownyException
      Create a new town. Command: /town new [townname] or /ta town new [townname]
      Parameters:
      player - Player using the command.
      name - Name of town
      resident - The resident in charge of the town.
      noCharge - Charging for creation - /ta town new NAME MAYOR has no charge.
      adminCreated - true when an admin has used /ta town new [NAME].
      Throws:
      TownyException - when a new town isn't allowed.
    • newTown

      public static Town newTown(TownyWorld world, String name, Resident resident, Coord key, org.bukkit.Location spawn, org.bukkit.entity.Player player) throws TownyException
      Throws:
      TownyException
    • newTown

      public static Town newTown(TownyWorld world, String name, Resident resident, Coord key, org.bukkit.Location spawn, org.bukkit.entity.Player player, double cost) throws TownyException
      Throws:
      TownyException
    • townRename

      public static void townRename(org.bukkit.command.CommandSender sender, Town town, String newName)
    • townLeave

      public void townLeave(org.bukkit.entity.Player player) throws TownyException
      Throws:
      TownyException
    • townSpawn

      public static void townSpawn(org.bukkit.entity.Player player, String[] split, Boolean outpost, boolean ignoreWarning) throws TownyException
      Wrapper for the townSpawn() method. All calls should be through here unless bypassing for admins.
      Parameters:
      player - - Player.
      split - - Current command arguments.
      outpost - - Whether this in an outpost or not.
      ignoreWarning - - Whether to ignore cost warning and pay automatically.
      Throws:
      TownyException - - Exception.
    • townDelete

      public void townDelete(org.bukkit.entity.Player player, String[] split) throws TownyException
      Throws:
      TownyException
    • townAddResidents

      public static void townAddResidents(org.bukkit.command.CommandSender sender, Town town, List<Resident> invited) throws TownyException
      Throws:
      TownyException
    • townAddResident

      public static void townAddResident(Town town, Resident resident) throws AlreadyRegisteredException
      Throws:
      AlreadyRegisteredException
    • townKick

      public static void townKick(org.bukkit.entity.Player player, String[] names) throws TownyException
      Transforms a list of names into a list of residents to be kicked. Command: /town kick [resident] .. [resident]
      Parameters:
      player - - Player who initiated the kick command.
      names - - List of names to kick.
      Throws:
      TownyException - on error.
    • townAdd

      public static void townAdd(org.bukkit.command.CommandSender sender, Town specifiedTown, String[] names) throws TownyException
      Checks if the player is allowed to handle adding invites, then checks through a list of names to be invited, or to have their invites revoked. Will dispatch invites and/or revoke invites from names beginning with -.
      Parameters:
      sender - Sender.
      specifiedTown - Town to add to if not null.
      names - Names to add.
      Throws:
      TownyException - Thrown when an the invites are not allowed because of lack of permissions, ruined/bankruptcy, or the town having no spawn set.
    • setTownBlockOwnerPermissions

      public static void setTownBlockOwnerPermissions(org.bukkit.command.CommandSender sender, Town town, String[] split) throws TownyException
      Throws:
      TownyException
    • setTownBlockPermissions

      public static void setTownBlockPermissions(org.bukkit.command.CommandSender sender, TownBlockOwner townBlockOwner, TownyPermission perm, String[] split, boolean friend)
    • parseTownClaimCommand

      public static void parseTownClaimCommand(org.bukkit.entity.Player player, String[] split) throws TownyException
      Throws:
      TownyException
    • parseTownUnclaimCommand

      public static void parseTownUnclaimCommand(org.bukkit.entity.Player player, String[] split) throws TownyException
      Throws:
      TownyException
    • parseTownMergeCommand

      public static void parseTownMergeCommand(org.bukkit.entity.Player player, String[] args) throws TownyException
      Throws:
      TownyException
    • parseTownMergeCommand

      public static void parseTownMergeCommand(org.bukkit.command.CommandSender sender, String[] args, @NotNull @NotNull Town remainingTown, boolean admin) throws TownyException
      Throws:
      TownyException
    • isEdgeBlock

      public static boolean isEdgeBlock(TownBlockOwner owner, List<WorldCoord> worldCoords)
    • isEdgeBlock

      public static boolean isEdgeBlock(TownBlockOwner owner, WorldCoord worldCoord, List<WorldCoord> visited)
    • parseTownTrustCommand

      public static void parseTownTrustCommand(org.bukkit.command.CommandSender sender, String[] args, @Nullable @Nullable Town town) throws TownyException
      Throws:
      TownyException
    • parseTownTrustTownCommand

      public static void parseTownTrustTownCommand(org.bukkit.command.CommandSender sender, String[] args, @Nullable @Nullable Town town) throws TownyException
      Throws:
      TownyException
    • getTrustedResidentsFromResident

      public static List<String> getTrustedResidentsFromResident(org.bukkit.entity.Player player)
    • getTrustedTownsFromResident

      public static List<String> getTrustedTownsFromResident(org.bukkit.entity.Player player)
    • setTownForSale

      public static void setTownForSale(Town town, double price, boolean admin)
    • setTownNotForSale

      public static void setTownNotForSale(Town town, boolean admin)