File tree Expand file tree Collapse file tree
src/main/java/com/unfamoussoul/sapi Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11folia_version =1.21.11-R0.1-SNAPSHOT
2- version =1.2.4
2+ version =1.2.5
Original file line number Diff line number Diff line change 11package com .unfamoussoul .sapi ;
22
3+ import com .unfamoussoul .sapi .api .access .SAPIAccess ;
34import com .unfamoussoul .sapi .module .ModuleHandler ;
45import org .bukkit .command .CommandMap ;
56import org .bukkit .plugin .java .JavaPlugin ;
89 * Главный класс SAPI. Отсюда можно использовать JavaPlugin методы
910 */
1011@ SuppressWarnings ("unused" )
11- public abstract class SAPI extends JavaPlugin {
12+ public abstract class SAPI extends JavaPlugin implements SAPIAccess {
1213
1314 public abstract String getDefaultLanguage ();
1415
Original file line number Diff line number Diff line change 1+ package com .unfamoussoul .sapi .api .access ;
2+
3+ import org .bukkit .Server ;
4+
5+ import java .util .logging .Logger ;
6+
7+ /**
8+ * Пункт доступа к plugin переменной
9+ */
10+ @ SuppressWarnings ("unused" )
11+ public interface SAPIAccess {
12+
13+ /**
14+ * Получить язык сервера по умолчанию
15+ */
16+ String getDefaultLanguage ();
17+
18+ /**
19+ * Получить объект сервера
20+ */
21+ Server getServer ();
22+
23+ /**
24+ * Получить логгер. В контексте модуля — пишет от имени [SAPI:ModuleName]
25+ */
26+ Logger getLogger ();
27+ }
28+
Original file line number Diff line number Diff line change 11package com .unfamoussoul .sapi .locale ;
22
3+ import com .unfamoussoul .sapi .SAPI ;
34import net .kyori .adventure .text .Component ;
45import net .kyori .adventure .text .minimessage .tag .resolver .TagResolver ;
56import org .bukkit .command .CommandSender ;
@@ -17,6 +18,10 @@ protected Locale(ClassLoader loader) {
1718
1819 }
1920
21+ protected Locale (ClassLoader loader , SAPI plugin , String moduleName ) {
22+
23+ }
24+
2025 /**
2126 * Загрузить локализацию
2227 */
Original file line number Diff line number Diff line change 11package com .unfamoussoul .sapi .module ;
22
33import com .unfamoussoul .sapi .SAPI ;
4+ import com .unfamoussoul .sapi .api .access .SAPIAccess ;
45import com .unfamoussoul .sapi .api .command .DynamicCommand ;
56import com .unfamoussoul .sapi .api .config .ConfigHandler ;
67import com .unfamoussoul .sapi .locale .Locale ;
1011
1112import java .util .ArrayList ;
1213import java .util .List ;
14+ import java .util .logging .Logger ;
1315
1416/**
1517 * Абстрактный класс модуля для расширения функциональности SAPI.
@@ -82,6 +84,21 @@ protected SAPIModule(SAPI plugin) {
8284 */
8385 public native void savePersistentFields ();
8486
87+ /**
88+ * Получить имя модуля
89+ */
90+ public native String getModuleName ();
91+
92+ /**
93+ * Получить логгер модуля. префикс "[SAPI:ИмяМодуля]"
94+ */
95+ public native Logger getLogger ();
96+
97+ /**
98+ * Язык по умолчанию
99+ */
100+ public native String getDefaultLanguage ();
101+
85102 protected native void setKey (@ NotNull String key );
86103
87104 protected native void setVersion (int version );
@@ -90,5 +107,5 @@ protected SAPIModule(SAPI plugin) {
90107
91108 public native int getVersion ();
92109
93- public native SAPI getPlugin ();
110+ public native SAPIAccess getPlugin ();
94111}
You can’t perform that action at this time.
0 commit comments