-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #51 from FazziCLAY/pre-release
Pre release
- Loading branch information
Showing
283 changed files
with
8,243 additions
and
1,862 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 @@ | ||
/build |
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,12 @@ | ||
plugins { | ||
id 'java-library' | ||
} | ||
|
||
java { | ||
sourceCompatibility = JavaVersion.VERSION_17 | ||
targetCompatibility = JavaVersion.VERSION_17 | ||
} | ||
|
||
dependencies { | ||
implementation 'org.jetbrains:annotations:15.0' | ||
} |
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,4 @@ | ||
package com.fazziclay.opentoday.api; | ||
|
||
public interface Event { | ||
} |
19 changes: 19 additions & 0 deletions
19
api/src/main/java/com/fazziclay/opentoday/api/EventExceptionEvent.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,19 @@ | ||
package com.fazziclay.opentoday.api; | ||
|
||
public class EventExceptionEvent implements Event { | ||
private final Event event; | ||
private final Exception exception; | ||
|
||
public EventExceptionEvent(Event event, Exception e) { | ||
this.event = event; | ||
this.exception = e; | ||
} | ||
|
||
public Event getEvent() { | ||
return event; | ||
} | ||
|
||
public Exception getException() { | ||
return exception; | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
api/src/main/java/com/fazziclay/opentoday/api/EventHandler.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,15 @@ | ||
package com.fazziclay.opentoday.api; | ||
|
||
public class EventHandler { | ||
public static void call(Event event) { | ||
try { | ||
PluginManager.callEvent(event); | ||
} catch (Exception e) { | ||
PluginManager.callEvent(new EventExceptionEvent(event, e)); | ||
} | ||
} | ||
|
||
public void handle(Event event) { | ||
|
||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
api/src/main/java/com/fazziclay/opentoday/api/OpenTodayPlugin.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,10 @@ | ||
package com.fazziclay.opentoday.api; | ||
|
||
public abstract class OpenTodayPlugin { | ||
public void onEnable() {} | ||
public void onDisable() {} | ||
|
||
public EventHandler[] getEventHandlers() { | ||
return new EventHandler[0]; | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
api/src/main/java/com/fazziclay/opentoday/api/PluginException.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,33 @@ | ||
package com.fazziclay.opentoday.api; | ||
|
||
public class PluginException extends RuntimeException { | ||
private final OpenTodayPlugin plugin; | ||
|
||
public PluginException(OpenTodayPlugin plugin) { | ||
this.plugin = plugin; | ||
} | ||
|
||
public PluginException(String message, OpenTodayPlugin plugin) { | ||
super(message); | ||
this.plugin = plugin; | ||
} | ||
|
||
public PluginException(String message, Throwable cause, OpenTodayPlugin plugin) { | ||
super(message, cause); | ||
this.plugin = plugin; | ||
} | ||
|
||
public PluginException(Throwable cause, OpenTodayPlugin plugin) { | ||
super(cause); | ||
this.plugin = plugin; | ||
} | ||
|
||
public PluginException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace, OpenTodayPlugin plugin) { | ||
super(message, cause, enableSuppression, writableStackTrace); | ||
this.plugin = plugin; | ||
} | ||
|
||
public OpenTodayPlugin getPlugin() { | ||
return plugin; | ||
} | ||
} |
57 changes: 57 additions & 0 deletions
57
api/src/main/java/com/fazziclay/opentoday/api/PluginManager.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,57 @@ | ||
package com.fazziclay.opentoday.api; | ||
|
||
import java.util.HashMap; | ||
|
||
public class PluginManager { | ||
private static final HashMap<String, OpenTodayPlugin> activePlugins = new HashMap<>(); | ||
|
||
public static void loadPlugin(String packageId, OpenTodayPlugin plugin) { | ||
disablePlugin(packageId); | ||
activePlugins.put(packageId, plugin); | ||
plugin.onEnable(); | ||
} | ||
|
||
public static void disablePlugin(String packageId) { | ||
OpenTodayPlugin openTodayPlugin = activePlugins.get(packageId); | ||
if (openTodayPlugin != null) { | ||
openTodayPlugin.onDisable(); | ||
activePlugins.remove(packageId); | ||
} | ||
} | ||
|
||
public static void disableAllPlugins() { | ||
if (activePlugins.isEmpty()) return; | ||
for (String s : activePlugins.keySet()) { | ||
disablePlugin(s); | ||
} | ||
} | ||
|
||
public static void callEvent(Event event) { | ||
activePlugins.forEach((s, plugin) -> { | ||
try { | ||
for (EventHandler eventHandler : plugin.getEventHandlers()) { | ||
eventHandler.handle(event); | ||
} | ||
} catch (Exception e) { | ||
throw new PluginException("Exception while process eventHandlers in \"" + s + "\"(" + plugin + ") plugin", e, plugin); | ||
} | ||
}); | ||
} | ||
|
||
public static OpenTodayPlugin getActivePlugin(String key) { | ||
return activePlugins.get(key); | ||
} | ||
|
||
public static <T extends OpenTodayPlugin> T getActivePlugin(Class<T> clazz) { | ||
for (OpenTodayPlugin value : activePlugins.values()) { | ||
if (value.getClass() == clazz) { | ||
return (T) value; | ||
} | ||
} | ||
return null; | ||
} | ||
|
||
public static boolean isPluginActive(String key) { | ||
return getActivePlugin(key) != null; | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<resources> | ||
<string name="abc_launcherName" translatable="false">OpenToday (Debug)</string> | ||
<string name="abc_launcherName" translatable="false">OpenToday</string> | ||
</resources> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// default colors for OpenToday | ||
#ff0000;fully red | ||
#d19b29;оранжевый | ||
#808000;тёмно-ораньжевый | ||
#2adc0e;хакерский-зелёный | ||
#008000;тёмнозелёный | ||
#6bc6d1;голубой | ||
#008080;цвет блока гвардианов | ||
#e02271;малиновая лада | ||
#0c7a89;цвел блока гвардианов | ||
#6338d3;цвет фиолетово-курсовый | ||
#a290f7;светло фиолетовый-курсовый | ||
#7801d9;цвет курсы-фиолетово | ||
#ff00f0;sorry brother |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Oops, something went wrong.