Skip to content

Commit fa99b29

Browse files
authored
chore: Add missing Paper permissions and restructure permission data (#524)
1 parent caf0824 commit fa99b29

File tree

2 files changed

+154
-115
lines changed

2 files changed

+154
-115
lines changed

src/components/permission/PermissionSpec.tsx

Lines changed: 131 additions & 99 deletions
Original file line numberDiff line numberDiff line change
@@ -105,120 +105,152 @@ export const paperCommands: CommandData = {
105105
};
106106

107107
export const vanillaPermissions: PermissionData = {
108-
permissionPrefix: "minecraft",
109-
permissions: [
108+
sections: [
110109
{
111-
permission: "",
112-
description: "Gives the user the ability to use all vanilla utilities and commands.",
113-
opLevel: 4,
114-
},
115-
{
116-
permission: "admin.command_feedback",
117-
description: "Receive command broadcasts when sendCommandFeedback is true.",
118-
opLevel: 4,
119-
},
120-
{
121-
permission: "nbt.place",
122-
description: "Gives the user the ability to place restricted blocks with NBT in creative.",
123-
opLevel: 4,
124-
},
125-
{
126-
permission: "nbt.copy",
127-
description: "Gives the user the ability to copy NBT in creative.",
128-
opLevel: 0,
129-
},
130-
{
131-
permission: "debugstick",
132-
description: "Gives the user the ability to use the debug stick in creative.",
133-
opLevel: 4,
134-
},
135-
{
136-
permission: "debugstick.always",
137-
description: "Gives the user the ability to use the debug stick in all game modes.",
138-
requiresOp: false,
139-
},
140-
{
141-
permission: "commandblock",
142-
description: "Gives the user the ability to use command blocks.",
143-
opLevel: 4,
110+
permissionPrefix: "minecraft",
111+
permissions: [
112+
{
113+
permission: "",
114+
description: "Gives the user the ability to use all vanilla utilities and commands.",
115+
opLevel: 4,
116+
},
117+
{
118+
permission: "admin.command_feedback",
119+
description: "Receive command broadcasts when sendCommandFeedback is true.",
120+
opLevel: 4,
121+
},
122+
{
123+
permission: "nbt.place",
124+
description:
125+
"Gives the user the ability to place restricted blocks with NBT in creative.",
126+
opLevel: 4,
127+
},
128+
{
129+
permission: "nbt.copy",
130+
description: "Gives the user the ability to copy NBT in creative.",
131+
opLevel: 0,
132+
},
133+
{
134+
permission: "debugstick",
135+
description: "Gives the user the ability to use the debug stick in creative.",
136+
opLevel: 4,
137+
},
138+
{
139+
permission: "debugstick.always",
140+
description: "Gives the user the ability to use the debug stick in all game modes.",
141+
requiresOp: false,
142+
},
143+
{
144+
permission: "commandblock",
145+
description: "Gives the user the ability to use command blocks.",
146+
opLevel: 4,
147+
},
148+
],
144149
},
145150
],
146151
};
147152

148153
export const bukkitPermissions: PermissionData = {
149-
permissionPrefix: "bukkit",
150-
permissions: [
151-
{
152-
permission: "broadcast",
153-
description: "Allows the user to receive all broadcast messages",
154-
opLevel: 4,
155-
},
156-
{
157-
permission: "broadcast.admin",
158-
description: "Allows the user to receive administrative broadcasts",
159-
opLevel: 4,
160-
},
154+
sections: [
161155
{
162-
permission: "broadcast.user",
163-
description: "Allows the user to receive user broadcasts",
164-
opLevel: 0,
156+
permissionPrefix: "bukkit",
157+
permissions: [
158+
{
159+
permission: "broadcast",
160+
description: "Allows the user to receive all broadcast messages",
161+
opLevel: 4,
162+
},
163+
{
164+
permission: "broadcast.admin",
165+
description: "Allows the user to receive administrative broadcasts",
166+
opLevel: 4,
167+
},
168+
{
169+
permission: "broadcast.user",
170+
description: "Allows the user to receive user broadcasts",
171+
opLevel: 0,
172+
},
173+
],
165174
},
166175
],
167176
};
168177

169178
export const paperPermissions: PermissionData = {
170-
permissionPrefix: "bukkit.command.paper",
171-
permissions: [
172-
{ permission: "heap", description: "Allows the user to run the heap sub command", opLevel: 4 },
173-
{
174-
permission: "entity",
175-
description: "Allows the user to run the entity sub command",
176-
opLevel: 4,
177-
},
178-
{
179-
permission: "reload",
180-
description: "Allows the user to run the reload sub command",
181-
opLevel: 4,
182-
},
183-
{
184-
permission: "version",
185-
description: "Allows the user to run the version sub command",
186-
opLevel: 4,
187-
},
188-
{
189-
permission: "dumpplugins",
190-
description: "Allows the user to run the dumpplugins sub command",
191-
opLevel: 4,
192-
},
193-
{
194-
permission: "syncloadinfo",
195-
description: "Allows the user to run the syncloadinfo sub command",
196-
opLevel: 4,
197-
},
198-
{
199-
permission: "dumpitem",
200-
description: "Allows the user to run the dumpitem sub command",
201-
opLevel: 4,
202-
},
203-
{
204-
permission: "mobcaps",
205-
description: "Allows the user to run the mobcaps sub command",
206-
opLevel: 4,
207-
},
208-
{
209-
permission: "dumplisteners",
210-
description: "Allows the user to run the dumplisteners sub command",
211-
opLevel: 4,
212-
},
179+
sections: [
213180
{
214-
permission: "fixlight",
215-
description: "Allows the user to run the fixlight sub command",
216-
opLevel: 4,
181+
permissionPrefix: "bukkit.command.paper",
182+
permissions: [
183+
{
184+
permission: "heap",
185+
description: "Allows the user to run the heap sub command",
186+
opLevel: 4,
187+
},
188+
{
189+
permission: "entity",
190+
description: "Allows the user to run the entity sub command",
191+
opLevel: 4,
192+
},
193+
{
194+
permission: "reload",
195+
description: "Allows the user to run the reload sub command",
196+
opLevel: 4,
197+
},
198+
{
199+
permission: "version",
200+
description: "Allows the user to run the version sub command",
201+
opLevel: 4,
202+
},
203+
{
204+
permission: "dumpplugins",
205+
description: "Allows the user to run the dumpplugins sub command",
206+
opLevel: 4,
207+
},
208+
{
209+
permission: "syncloadinfo",
210+
description: "Allows the user to run the syncloadinfo sub command",
211+
opLevel: 4,
212+
},
213+
{
214+
permission: "dumpitem",
215+
description: "Allows the user to run the dumpitem sub command",
216+
opLevel: 4,
217+
},
218+
{
219+
permission: "mobcaps",
220+
description: "Allows the user to run the mobcaps sub command",
221+
opLevel: 4,
222+
},
223+
{
224+
permission: "dumplisteners",
225+
description: "Allows the user to run the dumplisteners sub command",
226+
opLevel: 4,
227+
},
228+
{
229+
permission: "fixlight",
230+
description: "Allows the user to run the fixlight sub command",
231+
opLevel: 4,
232+
},
233+
{
234+
permission: "debug",
235+
description: "Allows the user to run the debug sub command",
236+
opLevel: 4,
237+
},
238+
],
217239
},
218240
{
219-
permission: "debug",
220-
description: "Allows the user to run the debug sub command",
221-
opLevel: 4,
241+
permissionPrefix: "paper",
242+
permissions: [
243+
{
244+
permission: "antixray.bypass",
245+
description: "Allows the user to bypass anti-xray if use-permission is enabled",
246+
opLevel: 4,
247+
},
248+
{
249+
permission: "bypass-visibility.tab-completion",
250+
description: "Allows the user to see hidden players in command tab completions",
251+
opLevel: 4,
252+
},
253+
],
222254
},
223255
],
224256
};

src/components/permission/Permissions.tsx

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,11 @@ interface Permission {
4343
}
4444

4545
export interface PermissionData {
46+
/** Sections containing a prefix*/
47+
sections: PermissionSection[];
48+
}
49+
50+
export interface PermissionSection {
4651
/** The permission node prefix. */
4752
permissionPrefix: string;
4853
/** List of all permissions under the prefix*/
@@ -113,23 +118,25 @@ export function PermissionsTable({ data }: PermissionTableProps): JSX.Element {
113118
<th>Description</th>
114119
<th>Players Have Permission By Default?</th>
115120
</tr>
116-
{data.permissions.map((permission) => (
117-
<tr>
118-
<td>{`${data.permissionPrefix}${permission.permission === "" ? "" : "." + permission.permission}`}</td>
119-
<td>{permission.description}</td>
120-
<td>
121-
{permission.opLevel === undefined
122-
? permission.requiresOp === undefined
123-
? permission.defaultComment
124-
: permission.requiresOp
121+
{data.sections.map((section) =>
122+
section.permissions.map((permission) => (
123+
<tr>
124+
<td>{`${section.permissionPrefix}${permission.permission === "" ? "" : "." + permission.permission}`}</td>
125+
<td>{permission.description}</td>
126+
<td>
127+
{permission.opLevel === undefined
128+
? permission.requiresOp === undefined
129+
? permission.defaultComment
130+
: permission.requiresOp
131+
? "Yes"
132+
: "No"
133+
: permission.opLevel == 0
125134
? "Yes"
126-
: "No"
127-
: permission.opLevel == 0
128-
? "Yes"
129-
: "No"}
130-
</td>
131-
</tr>
132-
))}
135+
: "No"}
136+
</td>
137+
</tr>
138+
))
139+
)}
133140
</table>
134141
);
135142
}

0 commit comments

Comments
 (0)