-
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.
refactor: fixed time bugs on
TaskContext
and externalized all sink …
…plugin options
- Loading branch information
1 parent
3b0458a
commit f3b9697
Showing
22 changed files
with
310 additions
and
143 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
2 changes: 1 addition & 1 deletion
2
src/main/java/com/github/arthurfiorette/sinklibrary/command/reflection/CommandReflector.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
3 changes: 2 additions & 1 deletion
3
...java/com/github/arthurfiorette/sinklibrary/command/reflection/SimpleCommandReflector.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
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
2 changes: 1 addition & 1 deletion
2
src/main/java/com/github/arthurfiorette/sinklibrary/components/ComponentManager.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
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
65 changes: 65 additions & 0 deletions
65
src/main/java/com/github/arthurfiorette/sinklibrary/core/SinkOptions.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,65 @@ | ||
package com.github.arthurfiorette.sinklibrary.core; | ||
|
||
import com.github.arthurfiorette.sinklibrary.components.ComponentManager; | ||
import com.github.arthurfiorette.sinklibrary.components.SimpleComponentManager; | ||
import com.github.arthurfiorette.sinklibrary.exception.BaseExceptionHandler; | ||
import com.github.arthurfiorette.sinklibrary.exception.SimpleExceptionHandler; | ||
import com.github.arthurfiorette.sinklibrary.logging.BaseLogger; | ||
import com.github.arthurfiorette.sinklibrary.logging.BukkitLogger; | ||
import com.github.arthurfiorette.sinklibrary.logging.Level; | ||
|
||
import java.util.concurrent.ExecutorService; | ||
import java.util.concurrent.ScheduledThreadPoolExecutor; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NonNull; | ||
|
||
@AllArgsConstructor | ||
@Builder(builderMethodName = "builder") | ||
public class SinkOptions { | ||
|
||
@Getter | ||
@NonNull | ||
private ComponentManager manager; | ||
|
||
@Getter | ||
@NonNull | ||
private BaseLogger baseLogger; | ||
|
||
@Getter | ||
@NonNull | ||
private ExecutorService executor; | ||
|
||
@Getter | ||
@NonNull | ||
private BaseExceptionHandler exceptionHandler; | ||
|
||
/** | ||
* Create a new builder for the provided {@link SinkPlugin} | ||
* | ||
* @param plugin the plugin owner | ||
* | ||
* @return the new builder | ||
*/ | ||
public static SinkOptionsBuilder builder(SinkPlugin plugin) { | ||
return new SinkOptionsBuilder(plugin); | ||
} | ||
|
||
/** | ||
* Class overrided to apply the default settings | ||
* | ||
* @author /~https://github.com/Hazork/sink-library/ | ||
*/ | ||
public static class SinkOptionsBuilder { | ||
private SinkOptionsBuilder(SinkPlugin plugin) { | ||
manager(new SimpleComponentManager(plugin)); | ||
baseLogger(new BukkitLogger(plugin, Level.ALL)); | ||
executor(new ScheduledThreadPoolExecutor(1)); | ||
exceptionHandler(new SimpleExceptionHandler(plugin)); | ||
} | ||
|
||
} | ||
|
||
} |
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
31 changes: 31 additions & 0 deletions
31
src/main/java/com/github/arthurfiorette/sinklibrary/exception/BaseExceptionHandler.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,31 @@ | ||
package com.github.arthurfiorette.sinklibrary.exception; | ||
|
||
import com.github.arthurfiorette.sinklibrary.interfaces.BaseComponent; | ||
|
||
public interface BaseExceptionHandler extends BaseComponent { | ||
|
||
public void handle(final Class<?> author, final Throwable exc, final String message, | ||
final Object... args); | ||
|
||
public void handle(final Class<?> author, final Throwable exc); | ||
|
||
// | ||
|
||
default void handle(final Object author, final Throwable exc, final String message, | ||
final Object... args) { | ||
this.handle(author.getClass(), exc, message, args); | ||
} | ||
|
||
default void handle(final Object author, final Throwable exc) { | ||
this.handle(author.getClass(), exc); | ||
} | ||
|
||
default void handle(final Throwable exc, final String message, final Object... args) { | ||
this.handle(getBasePlugin().getClass(), exc, message, args); | ||
} | ||
|
||
default void handle(final Throwable exc) { | ||
this.handle(getBasePlugin().getClass(), exc); | ||
} | ||
|
||
} |
Oops, something went wrong.