Skip to content

Commit a66b518

Browse files
authored
Merge pull request #5 from TheNextLvl-net/create-group-overload
Add overloaded `createGroup` methods
2 parents 57d9469 + 3bf8cf7 commit a66b518

3 files changed

Lines changed: 43 additions & 3 deletions

File tree

api/src/main/java/net/thenextlvl/perworlds/GroupProvider.java

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,36 @@ public interface GroupProvider {
106106
@Contract(value = "_, _ -> new", mutates = "this")
107107
WorldGroup createGroup(String name, Collection<World> worlds) throws IllegalStateException;
108108

109+
/**
110+
* Creates a new {@link WorldGroup} with the specified name, data, and a collection of worlds.
111+
* The group must have a unique name and cannot conflict with already existing groups.
112+
*
113+
* @param name the name of the group to be created.
114+
* @param data a {@link Consumer} to configure the {@link GroupData} for the new group.
115+
* @param worlds an array of {@link World} instances that will be part of the group.
116+
* @return the created {@link WorldGroup} instance.
117+
* @throws IllegalStateException if a group with the specified name already exists,
118+
* or if a given world is already part of another group.
119+
* @since 1.0.2
120+
*/
121+
@Contract(value = "_, _, _ -> new", mutates = "this")
122+
WorldGroup createGroup(String name, Consumer<GroupData> data, World... worlds) throws IllegalStateException;
123+
124+
/**
125+
* Creates a new {@link WorldGroup} with the specified name, data, and a collection of worlds.
126+
* The group must have a unique name and cannot conflict with already existing groups.
127+
*
128+
* @param name the name of the group to be created.
129+
* @param data a {@link Consumer} to configure the {@link GroupData} for the new group.
130+
* @param worlds a collection of {@link World} instances that will be part of the group.
131+
* @return the created {@link WorldGroup} instance.
132+
* @throws IllegalStateException if a group with the specified name already exists,
133+
* or if a given world is already part of another group.
134+
* @since 1.0.2
135+
*/
136+
@Contract(value = "_, _, _ -> new", mutates = "this")
137+
WorldGroup createGroup(String name, Consumer<GroupData> data, Collection<World> worlds) throws IllegalStateException;
138+
109139
/**
110140
* Creates a new {@link WorldGroup} with the specified name, data, settings, and a collection of worlds.
111141
* The group must have a unique name and cannot conflict with already existing groups.

build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ tasks.compileJava {
2121
}
2222

2323
group = "net.thenextlvl.perworlds"
24-
version = "1.0.1"
24+
version = "1.0.2"
2525

2626
repositories {
2727
mavenCentral()

src/main/java/net/thenextlvl/perworlds/group/PaperGroupProvider.java

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,18 @@ public WorldGroup createGroup(String name, Consumer<GroupData> data, Consumer<Gr
184184
@Override
185185
public WorldGroup createGroup(String name, Collection<World> worlds) throws IllegalStateException {
186186
return createGroup(name, data -> {
187-
}, settings -> {
187+
}, worlds);
188+
}
189+
190+
@Override
191+
public WorldGroup createGroup(String name, Consumer<GroupData> data, World... worlds) throws IllegalStateException {
192+
return createGroup(name, data, settings -> {
193+
}, worlds);
194+
}
195+
196+
@Override
197+
public WorldGroup createGroup(String name, Consumer<GroupData> data, Collection<World> worlds) throws IllegalStateException {
198+
return createGroup(name, data, settings -> {
188199
}, worlds);
189200
}
190201

@@ -196,7 +207,6 @@ public WorldGroup createGroup(String name, Consumer<GroupData> data, Consumer<Gr
196207
@Override
197208
public WorldGroup createGroup(String name, World... worlds) throws IllegalStateException {
198209
return createGroup(name, data -> {
199-
}, settings -> {
200210
}, worlds);
201211
}
202212

0 commit comments

Comments
 (0)