Skip to content

Commit

Permalink
Changed /is members and /is visitors to be commands of their own (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
OmerBenGera committed Oct 13, 2022
1 parent 9b856ff commit 4bcb220
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 5 deletions.
@@ -1,6 +1,10 @@
package com.bgsoftware.superiorskyblock.commands.player;

import com.bgsoftware.superiorskyblock.SuperiorSkyblockPlugin;
import com.bgsoftware.superiorskyblock.api.island.Island;
import com.bgsoftware.superiorskyblock.api.wrappers.SuperiorPlayer;
import com.bgsoftware.superiorskyblock.commands.arguments.CommandArguments;
import com.bgsoftware.superiorskyblock.commands.arguments.IslandArgument;
import com.bgsoftware.superiorskyblock.core.messages.Message;
import com.bgsoftware.superiorskyblock.commands.ISuperiorCommand;
import org.bukkit.command.CommandSender;
Expand Down Expand Up @@ -47,7 +51,16 @@ public boolean canBeExecutedByConsole() {

@Override
public void execute(SuperiorSkyblockPlugin plugin, CommandSender sender, String[] args) {
plugin.getCommands().dispatchSubCommand(sender, "panel", "members");
IslandArgument arguments = CommandArguments.getSenderIsland(plugin, sender);

Island island = arguments.getIsland();

if (island == null)
return;

SuperiorPlayer superiorPlayer = arguments.getSuperiorPlayer();

plugin.getMenus().openMembers(superiorPlayer, null, island);
}

@Override
Expand Down
Expand Up @@ -64,10 +64,10 @@ public void execute(SuperiorSkyblockPlugin plugin, CommandSender sender, String[

if (args.length > 1) {
if (args[1].equalsIgnoreCase("members")) {
plugin.getMenus().openMembers(superiorPlayer, null, island);
plugin.getCommands().dispatchSubCommand(sender, "members");
return;
} else if (args[1].equalsIgnoreCase("visitors")) {
plugin.getMenus().openVisitors(superiorPlayer, null, island);
plugin.getCommands().dispatchSubCommand(sender, "visitors");
return;
} else if (args[1].equalsIgnoreCase("toggle")) {
if (!plugin.getEventsBus().callPlayerTogglePanelEvent(superiorPlayer))
Expand Down
@@ -1,8 +1,12 @@
package com.bgsoftware.superiorskyblock.commands.player;

import com.bgsoftware.superiorskyblock.SuperiorSkyblockPlugin;
import com.bgsoftware.superiorskyblock.core.messages.Message;
import com.bgsoftware.superiorskyblock.api.island.Island;
import com.bgsoftware.superiorskyblock.api.wrappers.SuperiorPlayer;
import com.bgsoftware.superiorskyblock.commands.ISuperiorCommand;
import com.bgsoftware.superiorskyblock.commands.arguments.CommandArguments;
import com.bgsoftware.superiorskyblock.commands.arguments.IslandArgument;
import com.bgsoftware.superiorskyblock.core.messages.Message;
import org.bukkit.command.CommandSender;

import java.util.Collections;
Expand Down Expand Up @@ -47,7 +51,16 @@ public boolean canBeExecutedByConsole() {

@Override
public void execute(SuperiorSkyblockPlugin plugin, CommandSender sender, String[] args) {
plugin.getCommands().dispatchSubCommand(sender, "panel", "visitors");
IslandArgument arguments = CommandArguments.getSenderIsland(plugin, sender);

Island island = arguments.getIsland();

if (island == null)
return;

SuperiorPlayer superiorPlayer = arguments.getSuperiorPlayer();

plugin.getMenus().openVisitors(superiorPlayer, null, island);
}

@Override
Expand Down

0 comments on commit 4bcb220

Please sign in to comment.