Skip to content

Commit d956a27

Browse files
committed
fix
1 parent 1e7351f commit d956a27

File tree

4 files changed

+29
-7
lines changed

4 files changed

+29
-7
lines changed

src/main/java/com/readonlydev/command/lists/ContextMenuList.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public static ContextMenuList from(Collection<ContextMenu> list)
4747

4848
private ContextMenuList(NoDuplicateList<ContextMenu> noDuplicateList)
4949
{
50-
super(noDuplicateList.collection());
50+
super(noDuplicateList.distinctCollection());
5151
this.commandNames = noDuplicateList.mapped(ContextMenu::getName);
5252
}
5353

src/main/java/com/readonlydev/command/lists/SlashCommandList.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public static SlashCommandList from(Collection<SlashCommand> list)
4747

4848
private SlashCommandList(NoDuplicateList<SlashCommand> noDuplicateList)
4949
{
50-
super(noDuplicateList.collection());
50+
super(noDuplicateList.distinctCollection());
5151
this.commandNames = noDuplicateList.mapped(SlashCommand::getName);
5252
}
5353

src/main/java/com/readonlydev/command/slash/SlashCommand.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,6 @@ public abstract class SlashCommand extends Command
118118
@Getter
119119
protected Map<DiscordLocale, String> descriptionLocalization = new HashMap<>();
120120

121-
@Setter
122121
protected String guildId = null;
123122

124123
@Getter
Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,27 @@
1+
/*
2+
* This file is part of JDATools, licensed under the MIT License (MIT).
3+
*
4+
* Copyright (c) ROMVoid95
5+
*
6+
* Permission is hereby granted, free of charge, to any person obtaining a copy
7+
* of this software and associated documentation files (the "Software"), to deal
8+
* in the Software without restriction, including without limitation the rights
9+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
* copies of the Software, and to permit persons to whom the Software is
11+
* furnished to do so, subject to the following conditions:
12+
*
13+
* The above copyright notice and this permission notice shall be included in
14+
* all copies or substantial portions of the Software.
15+
*
16+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22+
* THE SOFTWARE.
23+
*/
24+
125
package com.readonlydev.common.utils;
226

327
import java.util.Collection;
@@ -6,14 +30,13 @@
630

731
public record NoDuplicateList<T>(Collection<T> collection)
832
{
9-
@Override
10-
public Collection<T> collection()
33+
public Collection<T> distinctCollection()
1134
{
12-
return collection.stream().distinct().toList();
35+
return collection().stream().distinct().toList();
1336
}
1437

1538
public <R> List<R> mapped(Function<T, R> function)
1639
{
17-
return collection().stream().map(function).toList();
40+
return distinctCollection().stream().map(function).toList();
1841
}
1942
}

0 commit comments

Comments
 (0)