Cleaned Up Party Menu.

This commit is contained in:
James Peters 2020-10-27 13:20:03 +00:00
parent 0d9b57c098
commit 2a48a07c52
6 changed files with 95 additions and 95 deletions

View File

@ -2,6 +2,7 @@ package com.jamesdpeters.minecraft.chests.commands;
import com.jamesdpeters.minecraft.chests.ChestsPlusPlus;
import com.jamesdpeters.minecraft.chests.lang.Message;
import com.jamesdpeters.minecraft.chests.menus.PartyMenu;
import com.jamesdpeters.minecraft.chests.misc.Messages;
import com.jamesdpeters.minecraft.chests.misc.Permissions;
import com.jamesdpeters.minecraft.chests.misc.Utils;
@ -28,6 +29,7 @@ public class AutoCraftCommand extends ServerCommand {
LIST("/autocraft list", Message.COMMAND_AUTOCRAFT_LIST.getString()),
MEMBER("/autocraft member [add/remove <group> <player>] or [list <group>]", Message.COMMAND_MEMBER.getString()),
OPEN("/autocraft open <Group>", Message.COMMAND_AUTOCRAFT_OPEN.getString()),
PARTY("/autocraft party", Message.COMMAND_PARTY.getString()),
REMOVE("/autocraft remove <Group>", Message.COMMAND_AUTOCRAFT_REMOVE.getString()),
RENAME("/autocraft rename <group> <new-name>", Message.COMMAND_AUTOCRAFT_RENAME.getString()),
SETPUBLIC("/autocraft setpublic <group> <true/false>", Message.COMMAND_AUTOCRAFT_SETPUBLIC.getString());
@ -168,6 +170,9 @@ public class AutoCraftCommand extends ServerCommand {
return true;
}
}
case PARTY:
PartyMenu.getMenu(player).getMenu().open(player);
return true;
}
} catch (IllegalArgumentException exception) {
return false;

View File

@ -3,6 +3,7 @@ package com.jamesdpeters.minecraft.chests.commands;
import com.jamesdpeters.minecraft.chests.ChestsPlusPlus;
import com.jamesdpeters.minecraft.chests.lang.Message;
import com.jamesdpeters.minecraft.chests.menus.ChestLinkMenu;
import com.jamesdpeters.minecraft.chests.menus.PartyMenu;
import com.jamesdpeters.minecraft.chests.misc.Messages;
import com.jamesdpeters.minecraft.chests.misc.Permissions;
import com.jamesdpeters.minecraft.chests.misc.Utils;
@ -31,6 +32,7 @@ public class ChestLinkCommand extends ServerCommand {
MEMBER("/chestlink member [add/remove <group> <player>] or [list <group>]", Message.COMMAND_MEMBER.getString()),
MENU("/chestlink menu", Message.COMMAND_CHESTLINK_MENU.getString()),
OPEN("/chestlink open <Group>", Message.COMMAND_CHESTLINK_OPEN.getString()),
PARTY("/chestlink party", Message.COMMAND_PARTY.getString()),
REMOVE("/chestlink remove <Group>", Message.COMMAND_CHESTLINK_REMOVE.getString()),
RENAME("/chestlink rename <group> <new-name>", Message.COMMAND_CHESTLINK_RENAME.getString()),
SETPUBLIC("/chestlink setpublic <group> <true/false>", Message.COMMAND_CHESTLINK_SETPUBLIC.getString()),
@ -190,6 +192,9 @@ public class ChestLinkCommand extends ServerCommand {
return true;
}
}
case PARTY:
PartyMenu.getMenu(player).getMenu().open(player);
return true;
}
} catch (IllegalArgumentException exception) {
return false;

View File

@ -20,7 +20,7 @@ public class ChestsPlusPlusCommand extends ServerCommand {
private enum OPTIONS {
VERSION("/chestsplusplus version", "Display the current version of the plugin."),
PARTY("/chestsplusplus party <create/delete/invite/remove-member/list>", "Create, delete or manage members of your party"),
PARTY("/chestsplusplus party", "Open the party menu to create, add, remove and invite parties and players."),
RELOAD("/chestsplusplus reload", "Reloads the plugin.");
String description, commandHelp;
@ -68,34 +68,8 @@ public class ChestsPlusPlusCommand extends ServerCommand {
return true;
case PARTY:
if (args.length > 1) {
switch (args[1].toLowerCase()) {
case "menu":
PartyMenu.getMenu(player).getMenu().open(player);
break;
case "create":
PartyMenu.getMenu(player).create(player);
break;
case "invite":
PartyMenu.getMenu(player).invite(player);
break;
case "remove-member":
PartyMenu.getMenu(player).removePlayer(player);
break;
case "list":
PartyMenu.getMenu(player).listParties(player);
break;
case "delete":
PartyMenu.getMenu(player).deleteParty(player);
break;
case "view-invites":
PartyMenu.getMenu(player).partyInvites(player);
break;
default:
return false;
}
return true;
}
PartyMenu.getMenu(player).getMenu().open(player);
return true;
default:
for (ChestsPlusPlusCommand.OPTIONS option : ChestsPlusPlusCommand.OPTIONS.values()) {

View File

@ -45,6 +45,7 @@ public enum Message {
//Commands
COMMAND_MEMBER("Add, remove or list members of a group"),
COMMAND_HELP("List of commands and their uses!"),
COMMAND_PARTY("Open the party menu, to allow other players to access all your Chests and AutoCrafters."),
//AutoCraft
COMMAND_AUTOCRAFT_ADD("Create/add a Crafting Table to an AutoCraft group"),

View File

@ -3,6 +3,8 @@ package com.jamesdpeters.minecraft.chests.menus;
import com.jamesdpeters.minecraft.chests.ChestsPlusPlus;
import com.jamesdpeters.minecraft.chests.lang.Message;
import com.jamesdpeters.minecraft.chests.misc.ItemBuilder;
import com.jamesdpeters.minecraft.chests.misc.Messages;
import com.jamesdpeters.minecraft.chests.misc.Permissions;
import com.jamesdpeters.minecraft.chests.misc.Utils;
import com.jamesdpeters.minecraft.chests.party.PartyUtils;
import fr.minuskube.inv.ClickableItem;
@ -130,6 +132,10 @@ public class PartyMenu implements InventoryProvider {
*/
public void create(Player player) {
if (!player.hasPermission(Permissions.PARTY_CREATE)){
Messages.NO_PERMISSION(player);
return;
}
TextInputUI.getInput(player, Message.PARTY_ENTER_NAME.getString(), (p, partyName) -> {
boolean result = PartyUtils.createParty(player, partyName);
if (result){
@ -144,6 +150,10 @@ public class PartyMenu implements InventoryProvider {
}
public void invite(Player player) {
if (!player.hasPermission(Permissions.PARTY_INVITE)){
Messages.NO_PERMISSION(player);
return;
}
PartySelectorMenu.open(player, getMenu(), PartySelectorMenu.Type.OWNED, (party, menu) -> {
List<OfflinePlayer> inviteablePlayers = Utils.getOnlinePlayersNotInList(party.getMembers());
inviteablePlayers.remove(party.getOwner());
@ -203,6 +213,10 @@ public class PartyMenu implements InventoryProvider {
}
public void partyInvites(Player player) {
if (!player.hasPermission(Permissions.PARTY_ACCEPT_INVITE)){
Messages.NO_PERMISSION(player);
return;
}
InvitesMenu.open(player, getMenu(), (invite, smartInventory) -> {
AcceptDialogMenu.open(player, Message.PARTY_JOIN.getString(invite.getParty().getOwner().getName(), invite.getParty().getPartyName()), Message.YES.getString(), Message.NO.getString(), aBoolean -> {
if (aBoolean) {

View File

@ -4,74 +4,75 @@
# It should be located in the 'lang' folder
# Then in config.yml 'language-file: default' would be renamed to 'language-file: en_US'
# To help contribute to the plugin and provide new language files you can create a pull-request at https://github.com/JamesPeters98/ChestsPlusPlus or join our Discord https://discord.gg/YRs3mP5
PARTY_ENTER_NAME=Enter a Party Name
PARTY_CREATED=Party {party_name} has been created\!
PARTY_DELETED=Party {party_name} has been deleted\!
COMMAND_CHESTLINK_LIST=Lists all ChestLinks that you own\!
ALREADY_EXISTS_ANVIL=Already exists\!
COMMAND_MEMBER=Add, remove or list members of a group
COMMAND_AUTOCRAFT_LIST=Lists all AutoCraft groups that you own\!
COMMAND_CHESTLINK_OPEN=Open the inventory of a ChestLink group
MUST_LOOK_AT_CHEST=You must be looking at the chest you want to ChestLink\!
COMMAND_AUTOCRAFT_OPEN=Open the workbench of an AutoCraft group
ITEM_FRAME_FILTER_DEFAULT=ItemFrame is in default filtering mode. Rotate Item Frame to change mode\!
PARTY_REMOVE_PLAYER=Choose a player to remove\!
ADDED_MEMBER_TO_ALL=Successfully added {player_name} to all {storage_type} groups
INVALID_CHESTLINK=Invalid ChestLink - You must place a sign on the front of a chest / you should ensure there is space for a sign on front of the chest\!
ADDED_MEMBER=Successfully added {player_name} to {storage_type} group {storage_identifier}
LIST_OF_CHESTLINK=List of your ChestLinks\:
OWNER_HAS_TOO_MANY_CHESTS=Owner\: {player_name} has reached the limit of groups allowed\!
SORT=Sort method for {storage_identifier} has been set to {sort_method}
YES=Yes
ITEM_FRAME_FILTER_DENY_ALL_TYPES=ItemFrame now prevents all types of this item from being accepted in the hopper\! e.g Enchanted Books.
NO_PERMISSION=You don't have permission to do that\!
COMMAND_CHESTLINK_SETPUBLIC=Set a ChestLink to be accessible by anyone.
PARTY_NO_INVITE=You currently have no pending party invites\!
CURRENT_MEMBERS=Current Members\: {player_list}
CANNOT_RENAME_GROUP_DOESNT_EXIST=Error renaming group\! {storage_identifier} doesn't exist\!
PARTY_LEAVE=Leave party\: {party_name}?
STORAGE_ADDED=Successfully added {storage_type} to group\: {storage_group} for {player_name}
REMOVED_MEMBER=Successfully removed {player_name} from {storage_type} group {storage_identifier}
REMOVED_GROUP=Successfully removed group {storage_group} from your {storage_type}'s\!
LIST_OF_AUTOCRAFTERS=List of your AutoCraft Stations\:
PARTY_JOIN=Join {player_name}'s party "{party_name}"
INVALID_AUTOCRAFTER=Invalid AutoCrafter - You must place a sign on any side of a Crafting Table, and it must not already by apart of a group\!
ITEM_FRAME_FILTER_DENY=ItemFrame now prevents this item from being accepted in the hopper\!
LIST_MEMBERS_OF_GROUP=Members of {storage_type} group {storage_identifier}\: {player_list}
REMOVE_MEMBER_FROM_ALL=Successfully removed {player_name} from all {storage_type} groups
PARTY_INVITE_PLAYER=Choose a player to invite\!
COMMAND_CHESTLINK_RENAME=Rename a ChestLink.
STORAGE_REMOVED=Successfully removed {storage_type} from group\: {storage_group} for {player_name}
PARTY_INVITE=You have been invited to join {player_name}''s party\: {party_name}
COMMAND_CHESTLINK_REMOVE=Delete a ChestLink and drop its inventory at your feet\!
COMMAND_CHESTLINK_MENU=Open the ChestLink menu to display all groups\!
GROUP_DOESNT_EXIST={storage_group} isn't a valid {storage_type} group to remove\!
COMMAND_CHESTLINK_SORT=Set the sorting option for the given ChestLink.
SET_PUBLICITY=There are no additional members in the group\: {storage_identifier}
CANNOT_RENAME_GROUP_ALREADY_EXISTS=Error renaming group\! {storage_identifier} already exists\!
NO_ADDITIONAL_MEMBERS=There are no additional members in the group\: {storage_identifier}
CHEST_HAD_OVERFLOW=Chest item's wouldn't all fit into ChestLink\!
COMMAND_AUTOCRAFT_ADD=Create/add a Crafting Table to an AutoCraft group
PARTY_ALREADY_EXISTS=Party {party_name} already exists, unable to create it\!
MUST_HOLD_SIGN=You must be holding a sign to do that\!
COMMAND_CHESTLINK_ADD=Create/add a chest to a ChestLink group
PARTY_DOESNT_EXIST=The party {party_name} doesn't exist\!
COMMAND_HELP=List of commands and their uses\!
PARTY_REMOVE_PLAYER_DIALOG=Remove player "{player_name}" ?
SET_PUBLICITY=There are no additional members in the group\: {storage_identifier}
LIST_MEMBERS_OF_GROUP=Members of {storage_type} group {storage_identifier}\: {player_list}
COMMAND_AUTOCRAFT_OPEN=Open the workbench of an AutoCraft group
UNABLE_TO_REMOVE_MEMBER=Unable to remove player {player_name} from {storage_type}\! Were they already removed?
STORAGE_REMOVED=Successfully removed {storage_type} from group\: {storage_group} for {player_name}
COMMAND_CHESTLINK_ADD=Create/add a chest to a ChestLink group
CURRENT_MEMBERS=Current Members\: {player_list}
COMMAND_PARTY=Open the party menu, to allow other players to access all your Chests and AutoCrafters.
ITEM_FRAME_FILTER_DENY=ItemFrame now prevents this item from being accepted in the hopper\!
PARTY_JOIN=Join {player_name}'s party "{party_name}"
CANNOT_RENAME_GROUP_ALREADY_EXISTS=Error renaming group\! {storage_identifier} already exists\!
NO_PERMISSION=You don't have permission to do that\!
FOUND_UNLINKED_STORAGE=This {storage_type} wasn't linked to your system\! It has been added under the {storage_identifier} group\!
COMMAND_CHESTLINK_MENU=Open the ChestLink menu to display all groups\!
PARTY_ACCEPT_INVITE=Click Here to accept the invite\!
COMMAND_CHESTLINK_LIST=Lists all ChestLinks that you own\!
ITEM_FRAME_FILTER_DEFAULT=ItemFrame is in default filtering mode. Rotate Item Frame to change mode\!
INVALID_ID=Invalid {storage_type} ID\! Must not contain a colon '\:' unless you are referencing another players group that you are a member of
ITEM_FRAME_FILTER_ALL_TYPES=ItemFrame now filters all types of this item\! e.g Enchanted Books.
MUST_HOLD_SIGN=You must be holding a sign to do that\!
PARTY_DELETED=Party {party_name} has been deleted\!
INVALID_CHESTLINK=Invalid ChestLink - You must place a sign on the front of a chest / you should ensure there is space for a sign on front of the chest\!
COMMAND_CHESTLINK_SORT=Set the sorting option for the given ChestLink.
COMMAND_CHESTLINK_OPEN=Open the inventory of a ChestLink group
COMMAND_CHESTLINK_RENAME=Rename a ChestLink.
ITEM_FRAME_FILTER_DENY_ALL_TYPES=ItemFrame now prevents all types of this item from being accepted in the hopper\! e.g Enchanted Books.
COMMAND_AUTOCRAFT_ADD=Create/add a Crafting Table to an AutoCraft group
REMOVED_MEMBER=Successfully removed {player_name} from {storage_type} group {storage_identifier}
INVALID_AUTOCRAFTER=Invalid AutoCrafter - You must place a sign on any side of a Crafting Table, and it must not already by apart of a group\!
YES=Yes
CANNOT_RENAME_GROUP_DOESNT_EXIST=Error renaming group\! {storage_identifier} doesn't exist\!
PARTY_DELETE=Delete party "{party_name}"?
COMMAND_CHESTLINK_REMOVE=Delete a ChestLink and drop its inventory at your feet\!
COMMAND_CHESTLINK_SETPUBLIC=Set a ChestLink to be accessible by anyone.
PARTY_ALREADY_EXISTS=Party {party_name} already exists, unable to create it\!
COMMAND_AUTOCRAFT_RENAME=Rename an AutoCraft group.
PARTY_INVITE_PLAYER=Choose a player to invite\!
PARTY_LEAVE=Leave party\: {party_name}?
GROUP_DOESNT_EXIST={storage_group} isn't a valid {storage_type} group to remove\!
ADDED_MEMBER_TO_ALL=Successfully added {player_name} to all {storage_type} groups
COMMAND_MEMBER=Add, remove or list members of a group
COMMAND_AUTOCRAFT_REMOVE=Delete an AutoCraft group and drop all the Crafting Tables\!
PARTY_REMOVE_PLAYER=Choose a player to remove\!
PARTY_JOINED=You have joined {player_name}''s party\: {party_name}
CHEST_HAD_OVERFLOW=Chest item's wouldn't all fit into ChestLink\!
ALREADY_EXISTS_ANVIL=Already exists\!
NO_ADDITIONAL_MEMBERS=There are no additional members in the group\: {storage_identifier}
ADDED_MEMBER=Successfully added {player_name} to {storage_type} group {storage_identifier}
OWNER_HAS_TOO_MANY_CHESTS=Owner\: {player_name} has reached the limit of groups allowed\!
PARTY_INVITE=You have been invited to join {player_name}''s party\: {party_name}
PARTY_INVITE_OWNER=You have invited {player_name} to join your party\: {party_name}
PARTY_OWNER=Owner
PARTY_MEMBERS={party_name} members
REMOVED_GROUP=Successfully removed group {storage_group} from your {storage_type}'s\!
PARTY_NO_INVITE=You currently have no pending party invites\!
PARTY_CREATED=Party {party_name} has been created\!
LIST_OF_AUTOCRAFTERS=List of your AutoCraft Stations\:
MUST_LOOK_AT_CRAFTING_TABLE=You must be looking at the Crafting Table you want to AutoCraft with\!
MUST_LOOK_AT_CHEST=You must be looking at the chest you want to ChestLink\!
PARTY_ENTER_NAME=Enter a Party Name
NO=No
UNABLE_TO_ADD_MEMBER_TO_ALL=Unable to add player {player_name} to {storage_type}\!
PARTY_JOINED=You have joined {player_name}''s party\: {party_name}
ITEM_FRAME_FILTER_ALL_TYPES=ItemFrame now filters all types of this item\! e.g Enchanted Books.
PARTY_DELETE=Delete party "{party_name}"?
PARTY_INVITE_OWNER=You have invited {player_name} to join your party\: {party_name}
COMMAND_AUTOCRAFT_RENAME=Rename an AutoCraft group.
MUST_LOOK_AT_CRAFTING_TABLE=You must be looking at the Crafting Table you want to AutoCraft with\!
COMMAND_AUTOCRAFT_REMOVE=Delete an AutoCraft group and drop all the Crafting Tables\!
UNABLE_TO_REMOVE_MEMBER=Unable to remove player {player_name} from {storage_type}\! Were they already removed?
PARTY_REMOVE_PLAYER_DIALOG=Remove player "{player_name}" ?
COMMAND_AUTOCRAFT_SETPUBLIC=Set an AutoCraft group to be accessible by anyone.
PARTY_OWNER=Owner
ALREADY_PART_OF_GROUP=This {storage_type} is already a part of a group\!
PARTY_MEMBERS={party_name} members
INVALID_ID=Invalid {storage_type} ID\! Must not contain a colon '\:' unless you are referencing another players group that you are a member of
PARTY_ACCEPT_INVITE=Click Here to accept the invite\!
FOUND_UNLINKED_STORAGE=This {storage_type} wasn't linked to your system\! It has been added under the {storage_identifier} group\!
PARTY_DOESNT_EXIST=The party {party_name} doesn't exist\!
SORT=Sort method for {storage_identifier} has been set to {sort_method}
STORAGE_ADDED=Successfully added {storage_type} to group\: {storage_group} for {player_name}
COMMAND_AUTOCRAFT_LIST=Lists all AutoCraft groups that you own\!
COMMAND_AUTOCRAFT_SETPUBLIC=Set an AutoCraft group to be accessible by anyone.
LIST_OF_CHESTLINK=List of your ChestLinks\: