Skip to content
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
2 changes: 1 addition & 1 deletion src/core/featureRegistry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ export const featureRegistry = [
{ id: 'team', load: () => import('@features/team/index.js') as Promise<FeatureModule>, subfeatures: undefined },
{ id: 'teleport', load: () => import('@features/teleport/index.js') as Promise<FeatureModule>, subfeatures: undefined },
{ id: 'vote', load: () => import('@features/vote/index.js') as Promise<FeatureModule>, subfeatures: undefined },
{ id: 'ranks', load: () => import('@features/ranks/index.js') as Promise<FeatureModule>, subfeatures: undefined },
{ id: 'ranks', load: () => import('@features/ranks/index.js') as Promise<FeatureModule>, subfeatures: undefined }
];
136 changes: 53 additions & 83 deletions src/core/ui/panelRegistry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,129 +15,99 @@ export const panelDefinitions: Record<string, PanelDefinition> = {
parentPanelId: undefined,
items: [
{
id: 'games',
text: '§l§aGames',
icon: 'textures/ui/controller_icon',
id: 'shop',
text: '§l§2Shop',
icon: 'textures/ui/trade_icon',
permission: 'ui.panel.member',
actionType: 'openPanel',
actionValue: 'gamesMainPanel',
actionValue: 'shopMainPanel',
requiresFeature: 'shop.enabled',
sortId: 5
},
{
id: 'economy',
text: '§l§6Economy',
icon: 'textures/items/emerald',
id: 'auctionHouse',
text: '§l§6Auction House',
icon: 'textures/items/gold_ingot',
permission: 'ui.panel.member',
actionType: 'openPanel',
actionValue: 'economyMainPanel',
actionType: 'functionCall',
actionValue: 'openAuctionHouse',
sortId: 10
},
{
id: 'social',
text: '§l§dSocial',
icon: 'textures/ui/icon_multiplayer',
id: 'games',
text: '§l§aGames',
icon: 'textures/ui/controller_icon',
permission: 'ui.panel.member',
actionType: 'openPanel',
actionValue: 'socialMainPanel',
actionValue: 'gamesMainPanel',
sortId: 15
},
{
id: 'profile',
text: '§l§3Profile',
icon: 'textures/ui/profile_glyph_color',
id: 'playerList',
text: '§l§3Player List',
icon: 'textures/ui/icon_steve.png',
permission: 'ui.panel.member',
actionType: 'openPanel',
actionValue: 'profileMainPanel',
actionValue: 'playerListPanel',
sortId: 20
},
{
id: 'info',
text: '§l§bServer Info',
icon: 'textures/items/book_enchanted.png',
id: 'team',
text: '§l§1Team',
icon: 'textures/ui/icon_multiplayer.png',
permission: 'ui.panel.member',
actionType: 'openPanel',
actionValue: 'infoPanel',
sortId: 30
actionValue: 'teamMainPanel',
sortId: 25
},
{
id: 'staffDashboard',
text: '§l§4Staff Dashboard',
icon: 'textures/ui/op',
permission: 'ui.panel.mod', // Accessible to moderators (3) and up, items inside dictate further restrictions
actionType: 'openPanel',
actionValue: 'staffDashboardPanel',
sortId: 99
}
]
},
economyMainPanel: {
title: 'Economy',
parentPanelId: 'mainPanel',
items: [
{
id: 'shop',
text: '§2Shop',
icon: 'textures/ui/trade_icon',
id: 'friend',
text: '§l§5Friends',
icon: 'textures/ui/icon_steve',
permission: 'ui.panel.member',
actionType: 'openPanel',
actionValue: 'shopMainPanel',
requiresFeature: 'shop.enabled',
sortId: 10
},
{
id: 'auctionHouse',
text: '§6Auction House',
icon: 'textures/items/gold_ingot',
permission: 'ui.panel.member',
actionType: 'functionCall',
actionValue: 'openAuctionHouse',
// Assuming auctionHouse config exists similarly. Leaving without requiresFeature for now if unknown.
sortId: 15
actionValue: 'friendMainPanel',
sortId: 30
},
{
id: 'bountyList',
text: '§4Bounty List',
text: '§4Bounty List',
icon: 'textures/items/netherite_sword.png',
permission: 'ui.panel.member',
actionType: 'openPanel',
actionValue: 'bountyListPanel',
sortId: 30
}
]
},
socialMainPanel: {
title: 'Social',
parentPanelId: 'mainPanel',
items: [
sortId: 35
},
{
id: 'playerList',
text: '§2Player List',
icon: 'textures/ui/icon_steve.png',
id: 'profile',
text: '§l§3Profile',
icon: 'textures/ui/profile_glyph_color',
permission: 'ui.panel.member',
actionType: 'openPanel',
actionValue: 'playerListPanel',
sortId: 10
actionValue: 'profileMainPanel',
sortId: 40
},
{
id: 'team',
text: '§1Team',
icon: 'textures/ui/icon_multiplayer.png',
id: 'info',
text: '§l§bServer Info',
icon: 'textures/items/book_enchanted.png',
permission: 'ui.panel.member',
actionType: 'openPanel',
actionValue: 'teamMainPanel',
sortId: 20
actionValue: 'infoPanel',
sortId: 45
},
{
id: 'friend',
text: '§5Friends',
icon: 'textures/ui/icon_steve',
permission: 'ui.panel.member',
id: 'staffDashboard',
text: '§l§4Staff Dashboard',
icon: 'textures/ui/op',
permission: 'ui.panel.mod',
actionType: 'openPanel',
actionValue: 'friendMainPanel',
sortId: 25
actionValue: 'staffDashboardPanel',
sortId: 99
}
]
},

profileMainPanel: {
title: 'Profile',
parentPanelId: 'mainPanel',
Expand All @@ -164,7 +134,7 @@ export const panelDefinitions: Record<string, PanelDefinition> = {
},
friendMainPanel: {
title: 'Friend System',
parentPanelId: 'socialMainPanel',
parentPanelId: 'mainPanel',
items: [] // Dynamic
},
friendAddPanel: {
Expand Down Expand Up @@ -275,7 +245,7 @@ export const panelDefinitions: Record<string, PanelDefinition> = {
},
teamMainPanel: {
title: 'Team System',
parentPanelId: 'socialMainPanel',
parentPanelId: 'mainPanel',
items: [] // Dynamic: Shows Create/Join OR Team Info
},
teamCreatePanel: {
Expand Down Expand Up @@ -355,7 +325,7 @@ export const panelDefinitions: Record<string, PanelDefinition> = {
},
shopMainPanel: {
title: 'Shop Categories',
parentPanelId: 'economyMainPanel',
parentPanelId: 'mainPanel',
items: [] // Dynamically populated
},
configResetPanel: {
Expand Down Expand Up @@ -406,7 +376,7 @@ export const panelDefinitions: Record<string, PanelDefinition> = {
},
bountyListPanel: {
title: 'Bounty List',
parentPanelId: 'economyMainPanel',
parentPanelId: 'mainPanel',
items: [] // Dynamically populated
},
myStatsPanel: {
Expand Down Expand Up @@ -565,7 +535,7 @@ export const panelDefinitions: Record<string, PanelDefinition> = {
},
playerListPanel: {
title: 'Online Players',
parentPanelId: 'socialMainPanel',
parentPanelId: 'mainPanel',
items: [] // Dynamically populated
},
bountyActionsPanel: {
Expand Down
55 changes: 24 additions & 31 deletions src/core/ui/panels/configPanel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,40 +92,33 @@ export class ConfigPanelHandler implements IPanelHandler {
addBackButton(items, 'staffDashboardPanel');
const categories = getVisibleCategories(player);

if (hasPermission(player, 'ui.panel.owner')) {
categories.push({
id: 'resetSettings',
title: '§l§cReset Settings§r',
icon: 'textures/ui/wysiwyg_reset'
});
}

const paginated = getPaginatedItems(categories, (context.page as number) || 1);
for (const cat of paginated) {
if (!isDefined(cat)) continue;

if (cat.id === 'resetSettings') {
items.push({
id: 'resetSettings',
text: '§l§cReset Settings§r',
icon: 'textures/ui/wysiwyg_reset',
permission: 'ui.panel.owner',
actionType: 'openPanel',
actionValue: 'configResetPanel'
});
} else {
items.push({
id: cat.id,
text: cat.title,
icon: cat.icon,
permission: 'ui.panel.admin',
actionType: 'openPanel',
actionValue: `configSubCategoryPanel_${cat.id}`
});
}
items.push({
id: cat.id,
text: cat.title,
icon: cat.icon,
permission: 'ui.panel.admin',
actionType: 'openPanel',
actionValue: `configSubCategoryPanel_${cat.id}`
});
}

addPaginationItems(items, (context.page as number) || 1, categories.length, 'ui.panel.admin');

if (hasPermission(player, 'ui.panel.owner')) {
items.push({
id: 'resetSettings',
text: '§l§cReset Settings§r',
icon: 'textures/ui/wysiwyg_reset',
permission: 'ui.panel.owner',
actionType: 'openPanel',
actionValue: 'configResetPanel'
});
}

addPaginationItems(items, (context.page as number) || 1, categories.length);
return items;
}

Expand All @@ -145,7 +138,7 @@ export class ConfigPanelHandler implements IPanelHandler {
actionValue: sys.id
});
}
addPaginationItems(items, (context.page as number) || 1, systems.length);
addPaginationItems(items, (context.page as number) || 1, systems.length, 'ui.panel.admin');
return items;
}

Expand Down Expand Up @@ -185,7 +178,7 @@ export class ConfigPanelHandler implements IPanelHandler {
}
}

addPaginationItems(items, (context.page as number) || 1, categories.length);
addPaginationItems(items, (context.page as number) || 1, categories.length, 'ui.panel.admin');
return items;
}

Expand Down Expand Up @@ -215,7 +208,7 @@ export class ConfigPanelHandler implements IPanelHandler {
actionValue: `resetSystem_${sys.id}`
});
}
addPaginationItems(items, (context.page as number) || 1, systems.length);
addPaginationItems(items, (context.page as number) || 1, systems.length, 'ui.panel.admin');
return items;
}

Expand Down
9 changes: 1 addition & 8 deletions src/core/ui/panels/generalPanel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,7 @@ import { IPanelHandler } from '@ui/types.js';

export class GeneralPanelHandler implements IPanelHandler {
canHandle(panelId: string): boolean {
return (
panelId === 'mainPanel' ||
panelId === 'economyMainPanel' ||
panelId === 'socialMainPanel' ||
panelId === 'profileMainPanel' ||
panelId === 'bountyActionsPanel' ||
panelId === 'bountyListPanel'
);
return panelId === 'mainPanel' || panelId === 'profileMainPanel' || panelId === 'bountyActionsPanel' || panelId === 'bountyListPanel';
}

getItems(player: mc.Player, panelId: string, _context: UIContext): Promise<PanelItem[]> {
Expand Down
Loading