Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed message spam #127

Merged
merged 1 commit into from
May 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import org.bukkit.entity.Player
)
class ByPassCommand(private val plugin: ImprovedFactionsPlugin) : PlayerSubCommand("bypass") {
override fun options(): Options = Options.getFromConfig(plugin, label) { options, _ ->
options.opt(PlayerNameOption(0))
options.cmdOpt(PlayerNameOption(0))
}

override fun arguments(): Array<Argument<*>> = arrayOf(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import org.bukkit.entity.Player
)
class ClaimCommand(private val plugin: ImprovedFactionsPlugin) : PlayerSubCommand("claim") {
override fun options(): Options = Options.getFromConfig(plugin, "claim") { options, _ ->
options.opt(InFactionOption(true))
options.cmdOpt(InFactionOption(true))
.cmdOpt(FactionPermissionOption(Permissions.MANAGE_CLAIMS))
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import org.bukkit.entity.Player
)
class UnclaimCommand(private val plugin: ImprovedFactionsPlugin) : PlayerSubCommand("unclaim") {
override fun options(): Options = Options.getFromConfig(plugin, "unclaim") { options, _ ->
options.opt(InFactionOption(true))
options.cmdOpt(InFactionOption(true))
.cmdOpt(FactionPermissionOption(Permissions.MANAGE_CLAIMS))
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ import org.bukkit.entity.Player
)
class InviteAcceptCommand(private val plugin: ImprovedFactionsPlugin) : PlayerSubCommand("inviteaccept") {
override fun options(): Options = Options.getFromConfig(plugin, "inviteaccept") { options, _ ->
options.opt(InFactionOption(false)).opt(ArgLengthOption(1))
options.cmdOpt(InFactionOption(false))
.cmdOpt(ArgLengthOption(1))
}

override fun arguments(): Array<Argument<*>> = arrayOf(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import org.bukkit.entity.Player
class InviteCommand(private val plugin: ImprovedFactionsPlugin) : PlayerSubCommand("invite") {
override fun options(): Options = Options.getFromConfig(plugin, "invite") { options, _ ->
options.cmdOpt(InFactionOption(true))
.opt(PlayerNameOption(0))
.cmdOpt(PlayerNameOption(0))
.cmdOpt(RankNameOption(1))
.cmdOpt(CanManageRankOption(1))
.cmdOpt(ArgLengthOption(2))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import org.bukkit.entity.Player
)
class InviteDiscardCommand(private val plugin: ImprovedFactionsPlugin) : PlayerSubCommand("invitediscard") {
override fun options(): Options = Options.getFromConfig(plugin, "invitediscard") { options, _ ->
options.opt(ArgLengthOption(1))
options.cmdOpt(ArgLengthOption(1))
}

override fun arguments(): Array<Argument<*>> = arrayOf(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ import org.bukkit.entity.Player
class CreateCommand(private val plugin: ImprovedFactionsPlugin) : PlayerSubCommand("create") {
override fun options(): Options = Options.getFromConfig(plugin, "create") { options, _ ->
options
.opt(InFactionOption(false))
.cmdOpt(InFactionOption(false))
.addFactionNameOption(0)
.opt(ArgLengthOption(1))
.opt(FactionExistOption(0, false))
.cmdOpt(ArgLengthOption(1))
.cmdOpt(FactionExistOption(0, false))
}

override fun arguments(): Array<Argument<*>> = arrayOf(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import org.bukkit.entity.Player
)
class IconCommand(private val plugin: ImprovedFactionsPlugin) : PlayerSubCommand("icon") {
override fun options(): Options = Options.getFromConfig(plugin, "icon") { options, _ ->
options.opt(InFactionOption(true)).opt(IsFactionOwnerOption())
options.cmdOpt(InFactionOption(true)).cmdOpt(IsFactionOwnerOption())
.cmdOpt(FactionPermissionOption(Permissions.SET_ICON))
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ import org.bukkit.entity.Player
)
class RenameCommand(private val plugin: ImprovedFactionsPlugin) : PlayerSubCommand("rename") {
override fun options(): Options = Options.getFromConfig(plugin, "rename") { options, _ ->
options.opt(InFactionOption(true)).opt(IsFactionOwnerOption()).addFactionNameOption(0).opt(ArgLengthOption(1))
.opt(FactionExistOption(0, false))
options.cmdOpt(InFactionOption(true)).cmdOpt(IsFactionOwnerOption()).addFactionNameOption(0).cmdOpt(ArgLengthOption(1))
.cmdOpt(FactionExistOption(0, false))
.cmdOpt(FactionPermissionOption(Permissions.RENAME_FACTION))
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ import org.bukkit.entity.Player
)
class JoinCommand(private val plugin: ImprovedFactionsPlugin) : PlayerSubCommand("join") {
override fun options(): Options = Options.getFromConfig(plugin, "join") { options, _ ->
options.opt(InFactionOption(false))
options.cmdOpt(InFactionOption(false))
.addFactionNameOption(0)
.opt(ArgLengthOption(1))
.cmdOpt(ArgLengthOption(1))
.cmdOpt(FactionExistOption(0, true))
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import org.bukkit.entity.Player
)
class LeaveCommand(private val plugin: ImprovedFactionsPlugin) : PlayerSubCommand("leave") {
override fun options(): Options = Options.getFromConfig(plugin, "leave") { options, _ ->
options.cmdOpt(ConfirmOption()).opt(InFactionOption(true))
options.cmdOpt(ConfirmOption()).cmdOpt(InFactionOption(true))
}

override fun arguments(): Array<Argument<*>> = emptyArray()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ class MembersCommand(private val plugin: ImprovedFactionsPlugin) : PlayerSubComm
private val dateFormat = SimpleDateFormat("dd/MM/yyyy")

override fun options(): Options = Options.getFromConfig(plugin, label) { options, _ ->
options.opt(InFactionOption(true))
.opt(ArgLengthOption(0))
options.cmdOpt(InFactionOption(true))
.cmdOpt(ArgLengthOption(0))
}

override fun arguments(): Array<Argument<*>> = emptyArray()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import org.bukkit.entity.Player
)
class HomeSetCommand(private val plugin: ImprovedFactionsPlugin) : PlayerSubCommand("sethome") {
override fun options(): Options = Options.getFromConfig(plugin, label) { options, _ ->
options.opt(InFactionOption(true))
options.cmdOpt(InFactionOption(true))
.cmdOpt(FactionPermissionOption(Permissions.SET_HOME))
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import org.bukkit.entity.Player
)
class TeleportHomeCommand(private val plugin: ImprovedFactionsPlugin) : PlayerSubCommand("home") {
override fun options(): Options = Options.getFromConfig(plugin, label) { options, _ ->
options.opt(InFactionOption(true))
options.cmdOpt(InFactionOption(true))
.cmdOpt(FactionPermissionOption(Permissions.SET_HOME))
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class WildernessCommand(
override fun options() = Options.getFromConfig(plugin, label) { options, _ ->
options.cmdOpt(CooldownOption(plugin, cooldownManager))
.tabOpt(CooldownTabOption(cooldownManager, false))
.opt(UsageLimitOption(config.usageLimit, "wilderness"))
.cmdOpt(UsageLimitOption(config.usageLimit, "wilderness"))
}

override fun arguments() = arrayOf<Argument<*>>()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import io.github.toberocat.toberocore.command.options.MaxArgLengthOption
import io.github.toberocat.toberocore.command.options.Options

fun Options.addFactionNameOption(index: Int): Options {
opt(JoinedTextOption(index, Factions.maxSpacesInName))
opt(MaxArgLengthOption(index, Factions.maxNameLength))
opt(ArgRegexMatcherOption(index, Factions.nameRegex))
cmdOpt(JoinedTextOption(index, Factions.maxSpacesInName))
cmdOpt(MaxArgLengthOption(index, Factions.maxNameLength))
cmdOpt(ArgRegexMatcherOption(index, Factions.nameRegex))
return this
}
Loading