Skip to content

Commit

Permalink
Added menu filling FILL, BORDER
Browse files Browse the repository at this point in the history
  • Loading branch information
Devlrxxh committed Feb 4, 2024
1 parent d722494 commit 8c4b957
Show file tree
Hide file tree
Showing 20 changed files with 136 additions and 56 deletions.
3 changes: 2 additions & 1 deletion src/main/java/me/funky/praxi/Praxi.java
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,8 @@ private void registerCommands() {
new MainCommand(),
new KitCommand(),
new FlyCommand(),
new SettingsCommand()
new SettingsCommand(),
new HostCommand()
).forEach(command -> paperCommandManager.registerCommand(command));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class EventAddMapCommand {
public void execute(Player player, @CPL("event") Event event, @CPL("map") EventGameMap gameMap) {
if (event == null) {
player.sendMessage(CC.RED + "An event type by that name does not exist.");
player.sendMessage(CC.RED + "Types: sumo, corners");
player.sendMessage(CC.RED + "Types: sumo");
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class EventRemoveMapCommand {
public void execute(Player player, @CPL("event") Event event, @CPL("map") EventGameMap gameMap) {
if (event == null) {
player.sendMessage(CC.RED + "An event type by that name does not exist.");
player.sendMessage(CC.RED + "Types: sumo, corners");
player.sendMessage(CC.RED + "Types: sumo");
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public void execute(Player player, @CPL("event") Event event) {

if (event == null) {
player.sendMessage(CC.RED + "That type of event does not exist.");
player.sendMessage(CC.RED + "Types: sumo, corners");
player.sendMessage(CC.RED + "Types: sumo");
return;
}

Expand Down Expand Up @@ -103,7 +103,7 @@ public void execute(Player player, @CPL("event") Event event, Integer slots) {

if (event == null) {
player.sendMessage(CC.RED + "That type of event does not exist.");
player.sendMessage(CC.RED + "Types: sumo, corners");
player.sendMessage(CC.RED + "Types: sumo");
return;
}

Expand Down
17 changes: 17 additions & 0 deletions src/main/java/me/funky/praxi/commands/event/user/HostCommand.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package me.funky.praxi.commands.event.user;

import co.aikar.commands.BaseCommand;
import co.aikar.commands.annotation.CommandAlias;
import co.aikar.commands.annotation.Default;
import co.aikar.commands.annotation.Description;
import me.funky.praxi.event.game.menu.EventHostMenu;
import org.bukkit.entity.Player;

@CommandAlias("hosts")
@Description("Host Events.")
public class HostCommand extends BaseCommand {
@Default
public void open(Player player) {
new EventHostMenu().openMenu(player);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import me.funky.praxi.util.ItemBuilder;
import me.funky.praxi.util.menu.Button;
import me.funky.praxi.util.menu.Menu;
import me.funky.praxi.util.menu.filters.Filters;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
Expand All @@ -29,8 +30,8 @@ public int getSize() {
}

@Override
public boolean getFill() {
return true;
public Filters getFilter() {
return Filters.valueOf(Praxi.getInstance().getMenusConfig().getString("DUEL.FILTER"));
}

@Override
Expand Down
6 changes: 4 additions & 2 deletions src/main/java/me/funky/praxi/duel/menu/DuelSelectKitMenu.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import me.funky.praxi.util.ItemBuilder;
import me.funky.praxi.util.menu.Button;
import me.funky.praxi.util.menu.Menu;
import me.funky.praxi.util.menu.filters.Filters;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import org.bukkit.inventory.ItemStack;
Expand All @@ -28,10 +29,11 @@ public int getSize() {
}

@Override
public boolean getFill() {
return true;
public Filters getFilter() {
return Filters.valueOf(Praxi.getInstance().getMenusConfig().getString("DUEL.FILTER"));
}


@Override
public Map<Integer, Button> getButtons(Player player) {
Map<Integer, Button> buttons = new HashMap<>();
Expand Down
7 changes: 2 additions & 5 deletions src/main/java/me/funky/praxi/event/EventTypeAdapter.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@
import me.funky.praxi.event.impl.sumo.SumoEvent;
import me.funky.praxi.util.command.command.adapter.CommandTypeAdapter;

import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;

public class EventTypeAdapter implements CommandTypeAdapter {

Expand All @@ -24,7 +21,7 @@ public <T> T convert(String string, Class<T> type) {

@Override
public <T> List<String> tabComplete(String string, Class<T> type) {
return Arrays.asList("Sumo", "Corners");
return Collections.singletonList("Sumo");
}

}
27 changes: 15 additions & 12 deletions src/main/java/me/funky/praxi/event/game/menu/EventHostMenu.java
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
package me.funky.praxi.event.game.menu;

import lombok.AllArgsConstructor;
import me.funky.praxi.Praxi;
import me.funky.praxi.event.Event;
import me.funky.praxi.util.CC;
import me.funky.praxi.util.ItemBuilder;
import me.funky.praxi.util.TextSplitter;
import me.funky.praxi.util.menu.Button;
import me.funky.praxi.util.menu.Menu;
import me.funky.praxi.util.menu.button.DisplayButton;
import me.funky.praxi.util.menu.filters.Filters;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.entity.Player;
Expand All @@ -18,6 +20,7 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.logging.Filter;

public class EventHostMenu extends Menu {

Expand All @@ -27,26 +30,26 @@ public class EventHostMenu extends Menu {

@Override
public String getTitle(Player player) {
return "&6Select an Event";
return Praxi.getInstance().getMenusConfig().getString("EVENTS.TITLE");
}

@Override
public int getSize() {
return Praxi.getInstance().getMenusConfig().getInteger("EVENTS.SIZE");
}

@Override
public Filters getFilter() {
return Filters.valueOf(Praxi.getInstance().getMenusConfig().getString("EVENTS.FILTER"));
}

@Override
public Map<Integer, Button> getButtons(Player player) {
Map<Integer, Button> buttons = new HashMap<>();

int pos = 10;

for (Event event : Event.events) {
buttons.put(pos++, new SelectEventButton(event));
buttons.put(13, new SelectEventButton(event));
}

if (pos <= 16) {
for (int i = pos; i < 16; i++) {
buttons.put(i, new DisplayButton(new ItemBuilder(Material.STAINED_GLASS_PANE)
.durability(7).name(" ").build(), true));
}
}

return buttons;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import me.funky.praxi.util.ItemBuilder;
import me.funky.praxi.util.menu.Button;
import me.funky.praxi.util.menu.Menu;
import me.funky.praxi.util.menu.filters.Filters;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import org.bukkit.inventory.ItemStack;
Expand All @@ -30,8 +31,8 @@ public int getSize() {
}

@Override
public boolean getFill() {
return true;
public Filters getFilter() {
return Filters.valueOf(Praxi.getInstance().getMenusConfig().getString("KIT-EDITOR.FILTER"));
}

@Override
Expand Down
18 changes: 15 additions & 3 deletions src/main/java/me/funky/praxi/party/menu/OtherPartiesMenu.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
import me.funky.praxi.util.CC;
import me.funky.praxi.util.ItemBuilder;
import me.funky.praxi.util.menu.Button;
import me.funky.praxi.util.menu.Menu;
import me.funky.praxi.util.menu.filters.Filters;
import me.funky.praxi.util.menu.pagination.PaginatedMenu;
import org.bukkit.ChatColor;
import org.bukkit.Material;
Expand All @@ -19,15 +21,25 @@
import java.util.List;
import java.util.Map;

public class OtherPartiesMenu extends PaginatedMenu {
public class OtherPartiesMenu extends Menu {

@Override
public String getPrePaginatedTitle(Player player) {
public String getTitle(Player player) {
return Praxi.getInstance().getMenusConfig().getString("PARTY.OTHER-PARTIES.TITLE");
}
@Override
public int getSize() {
return Praxi.getInstance().getMenusConfig().getInteger("PARTY.OTHER-PARTIES.SIZE");
}

@Override
public Filters getFilter() {
return Filters.valueOf(Praxi.getInstance().getMenusConfig().getString("PARTY.FILTER"));
}


@Override
public Map<Integer, Button> getAllPagesButtons(Player player) {
public Map<Integer, Button> getButtons(Player player) {
Profile profile = Profile.getByUuid(player.getUniqueId());

Map<Integer, Button> buttons = new HashMap<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import me.funky.praxi.util.ItemBuilder;
import me.funky.praxi.util.menu.Button;
import me.funky.praxi.util.menu.Menu;
import me.funky.praxi.util.menu.filters.Filters;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
Expand All @@ -29,8 +30,8 @@ public int getSize() {
}

@Override
public boolean getFill() {
return true;
public Filters getFilter() {
return Filters.valueOf(Praxi.getInstance().getMenusConfig().getString("PARTY.EVENTS.FILTER"));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import me.funky.praxi.util.ItemBuilder;
import me.funky.praxi.util.menu.Button;
import me.funky.praxi.util.menu.Menu;
import me.funky.praxi.util.menu.filters.Filters;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import org.bukkit.inventory.ItemStack;
Expand All @@ -29,12 +30,13 @@ public class QueueSelectKitMenu extends Menu {

@Override
public int getSize() {
return 36;
return Praxi.getInstance().getMenusConfig().getInteger("QUEUES-MENUS.SIZE");
}

@Override
public boolean getFill() {
return true;
public Filters getFilter() {
System.out.println(Praxi.getInstance().getMenusConfig().getString("QUEUES-MENUS.FILTER"));
return Filters.valueOf(Praxi.getInstance().getMenusConfig().getString("QUEUES-MENUS.FILTER"));
}

@Override
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/me/funky/praxi/setting/SettingsCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
import co.aikar.commands.annotation.Description;
import org.bukkit.entity.Player;

@CommandAlias(value = "settings")
@Description(value = "Settings Command.")
@CommandAlias("settings")
@Description("Settings Command.")
public class SettingsCommand extends BaseCommand {
@Default
public void open(Player player) {
Expand Down
6 changes: 4 additions & 2 deletions src/main/java/me/funky/praxi/setting/SettingsMenu.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import me.funky.praxi.util.assemble.events.AssembleBoardDestroyEvent;
import me.funky.praxi.util.menu.Button;
import me.funky.praxi.util.menu.Menu;
import me.funky.praxi.util.menu.filters.Filters;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
Expand All @@ -35,10 +36,11 @@ public int getSize() {
}

@Override
public boolean getFill() {
return true;
public Filters getFilter() {
return Filters.valueOf(Praxi.getInstance().getMenusConfig().getString("SETTINGS.FILTER"));
}


@Override
public Map<Integer, Button> getButtons(Player player) {
HashMap<Integer, Button> buttons = new HashMap<>();
Expand Down
Loading

0 comments on commit 8c4b957

Please sign in to comment.