-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Add ReloadService to separate reload logic. * Follow rollczi suggestions. * move package * move package
- Loading branch information
Showing
6 changed files
with
54 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
src/main/java/com/eternalcode/lobbyheads/reload/ReloadService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package com.eternalcode.lobbyheads.reload; | ||
|
||
import java.util.HashSet; | ||
import java.util.Set; | ||
|
||
public class ReloadService { | ||
|
||
private final Set<Reloadable> reloadables = new HashSet<>(); | ||
|
||
public ReloadService register(Reloadable reloadable) { | ||
this.reloadables.add(reloadable); | ||
return this; | ||
} | ||
|
||
public void reload() { | ||
for (Reloadable reloadable : this.reloadables) { | ||
reloadable.reload(); | ||
} | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
src/main/java/com/eternalcode/lobbyheads/reload/Reloadable.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package com.eternalcode.lobbyheads.reload; | ||
|
||
public interface Reloadable { | ||
|
||
void reload(); | ||
|
||
} |