Skip to content

Commit

Permalink
1.6.7
Browse files Browse the repository at this point in the history
  • Loading branch information
ancap-kun committed Feb 18, 2023
1 parent ce85459 commit 36a22a4
Show file tree
Hide file tree
Showing 16 changed files with 198 additions and 31 deletions.
34 changes: 33 additions & 1 deletion AncapPluginAPI/dependency-reduced-pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
<dependency>
<groupId>ru.ancap</groupId>
<artifactId>DatabaseAPI</artifactId>
<version>1.4</version>
<version>1.4.1</version>
<scope>provided</scope>
</dependency>
<dependency>
Expand Down Expand Up @@ -141,5 +141,37 @@
<version>4.2.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.2</version>
<scope>test</scope>
<exclusions>
<exclusion>
<artifactId>hamcrest-core</artifactId>
<groupId>org.hamcrest</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>5.8.0</version>
<scope>test</scope>
<exclusions>
<exclusion>
<artifactId>junit-jupiter-api</artifactId>
<groupId>org.junit.jupiter</groupId>
</exclusion>
<exclusion>
<artifactId>junit-jupiter-params</artifactId>
<groupId>org.junit.jupiter</groupId>
</exclusion>
<exclusion>
<artifactId>junit-jupiter-engine</artifactId>
<groupId>org.junit.jupiter</groupId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
</project>
2 changes: 1 addition & 1 deletion AncapPluginAPI/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
<dependency>
<groupId>ru.ancap</groupId>
<artifactId>DatabaseAPI</artifactId>
<version>1.4</version>
<version>1.4.1</version>
<scope>provided</scope>
</dependency>

Expand Down
34 changes: 33 additions & 1 deletion Artifex/dependency-reduced-pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<modelVersion>4.0.0</modelVersion>
<artifactId>Artifex</artifactId>
<name>Artifex</name>
<version>1.6.6</version>
<version>1.6.7</version>
<description>AncapAPI runtime part</description>
<build>
<finalName>artifex-v${version}</finalName>
Expand Down Expand Up @@ -106,6 +106,38 @@
<version>LATEST</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.2</version>
<scope>test</scope>
<exclusions>
<exclusion>
<artifactId>hamcrest-core</artifactId>
<groupId>org.hamcrest</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>5.8.0</version>
<scope>test</scope>
<exclusions>
<exclusion>
<artifactId>junit-jupiter-api</artifactId>
<groupId>org.junit.jupiter</groupId>
</exclusion>
<exclusion>
<artifactId>junit-jupiter-params</artifactId>
<groupId>org.junit.jupiter</groupId>
</exclusion>
<exclusion>
<artifactId>junit-jupiter-engine</artifactId>
<groupId>org.junit.jupiter</groupId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
<properties>
<adventure-api.version>4.12.0</adventure-api.version>
Expand Down
7 changes: 4 additions & 3 deletions Artifex/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<packaging>jar</packaging>

<artifactId>Artifex</artifactId>
<version>1.6.6</version>
<version>1.6.7</version>

<name>Artifex</name>

Expand All @@ -22,6 +22,7 @@
<properties>
<adventure-api.version>4.12.0</adventure-api.version>
<adventure-platform.version>4.2.0</adventure-platform.version>
<adventure-platform.version>4.2.0</adventure-platform.version>
</properties>

<build>
Expand Down Expand Up @@ -144,7 +145,7 @@
<dependency>
<groupId>ru.ancap</groupId>
<artifactId>DatabaseAPI</artifactId>
<version>1.4</version>
<version>1.4.1</version>
<scope>compile</scope>
</dependency>

Expand Down Expand Up @@ -193,7 +194,7 @@
<dependency>
<groupId>ru.ancap</groupId>
<artifactId>ConfigurationAPI</artifactId>
<version>1.0</version>
<version>1.0.1</version>
<scope>compile</scope>
</dependency>

Expand Down
32 changes: 32 additions & 0 deletions BukkitPlus/WorldIteratorAPI/dependency-reduced-pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,38 @@
<version>4.2.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.2</version>
<scope>test</scope>
<exclusions>
<exclusion>
<artifactId>hamcrest-core</artifactId>
<groupId>org.hamcrest</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>5.8.0</version>
<scope>test</scope>
<exclusions>
<exclusion>
<artifactId>junit-jupiter-api</artifactId>
<groupId>org.junit.jupiter</groupId>
</exclusion>
<exclusion>
<artifactId>junit-jupiter-params</artifactId>
<groupId>org.junit.jupiter</groupId>
</exclusion>
<exclusion>
<artifactId>junit-jupiter-engine</artifactId>
<groupId>org.junit.jupiter</groupId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
<properties>
<java.version>17</java.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import org.bukkit.command.CommandSender;
import ru.ancap.framework.command.api.commands.object.tab.TabCompletion;
import ru.ancap.framework.command.api.commands.operator.arguments.extractor.ArgumentExtractor;
import ru.ancap.framework.communicate.message.CallableMessage;

import java.util.List;
import java.util.function.Function;
Expand Down Expand Up @@ -44,5 +43,6 @@ public boolean optional() {
public Function<CommandSender, List<TabCompletion>> help() {
return this.help;
}



}
2 changes: 1 addition & 1 deletion ConfigurationAPI/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@
</parent>

<artifactId>ConfigurationAPI</artifactId>
<version>1.0</version>
<version>1.0.1</version>

</project>
Original file line number Diff line number Diff line change
Expand Up @@ -15,43 +15,44 @@ public class AnnotationConfiguration {

@Getter(value = AccessLevel.PRIVATE)
private static final Map<Class<?>, TriFunction<Field, ConfigurationSection, String, ?>> specialExtractors = Map.of(
List.class, (field, section, path) -> {
List.class, (field, master, path) -> {
Class<?> type = field.getAnnotation(GenericType.class).value();
List<String> list = section.getStringList(path);
List<String> list = master.getStringList(path);
List<Object> returnList = new ArrayList<>();
Function<String, ?> converter = AnnotationConfiguration.getConverters().get(type);
list.forEach((string) -> returnList.add(converter.apply(string)));
return returnList;
},
Map.class, (field, section, path) -> {
Map.class, (field, master, path) -> {
ConfigurationSection mapSection = master.getConfigurationSection(path);
Map<String, Object> map = new HashMap<>();
Set<String> keys = section.getKeys(false);
Set<String> keys = mapSection.getKeys(false);
Class<?> type = field.getAnnotation(GenericType.class).value();
for (String key : keys) {
map.put(key, AnnotationConfiguration.getConverters().get(type).apply(key));
map.put(key, AnnotationConfiguration.getConverters().get(type).apply(mapSection.getString(key)));
}
return map;
},
ConfigurationSection.class, (field, section, path) -> section.getConfigurationSection(path)
ConfigurationSection.class, (field, master, path) -> master.getConfigurationSection(path)
);

@Getter(value = AccessLevel.PRIVATE)
private static final Map<Class<?>, Function<String, ?>> converters = Map.of(
Material.class, (string) -> Material.getMaterial(string.toUpperCase()),
Long.class, Long::valueOf,
Boolean.class, Boolean::valueOf,
Double.class, Double::valueOf

Double.class, Double::valueOf,
String.class, string -> string
);

@SneakyThrows
public static void load(Class<?> config, ConfigurationSection section) {
Field[] fields = config.getDeclaredFields();
for (Field field : fields) {
Configure configure = field.getAnnotation(Configure.class);
if (configure == null) continue;
Class<?> type = field.getType();
String path = configure.value().equals("") ? field.getName() : configure.value();
String path = (configure == null || configure.value().equals("")) ? field.getName() : configure.value();
path = Case.camelToKebab(path);
field.setAccessible(true);
Object value;
var extractor = AnnotationConfiguration.getSpecialExtractors().get(type);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package ru.ancap.framework.configuration;

public class Case {

public static String camelToKebab(String str) {
return str.replaceAll("([a-z])([A-Z]+)", "$1-$2").toLowerCase();
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package ru.ancap.framework.config.test;

import org.junit.Test;
import ru.ancap.framework.configuration.Case;

import static org.junit.Assert.assertEquals;

public class CaseTest {

@Test
public void testCase() {
assertEquals("example-text-in-this-case", Case.camelToKebab("exampleTextInThisCase"));
assertEquals("lowercase", Case.camelToKebab("lowercase"));
assertEquals("uppercase", Case.camelToKebab("UPPERCASE"));
assertEquals("example123in-this-case", Case.camelToKebab("example123InThisCase"));
assertEquals("example!text@in-this#case", Case.camelToKebab("example!Text@InThis#Case"));
assertEquals("foo-bar", Case.camelToKebab("FooBar"));
}

}
34 changes: 33 additions & 1 deletion DatabaseAPI/dependency-reduced-pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>DatabaseAPI</artifactId>
<version>1.4</version>
<version>1.4.1</version>
<build>
<plugins>
<plugin>
Expand Down Expand Up @@ -98,6 +98,38 @@
<version>4.2.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.2</version>
<scope>test</scope>
<exclusions>
<exclusion>
<artifactId>hamcrest-core</artifactId>
<groupId>org.hamcrest</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>5.8.0</version>
<scope>test</scope>
<exclusions>
<exclusion>
<artifactId>junit-jupiter-api</artifactId>
<groupId>org.junit.jupiter</groupId>
</exclusion>
<exclusion>
<artifactId>junit-jupiter-params</artifactId>
<groupId>org.junit.jupiter</groupId>
</exclusion>
<exclusion>
<artifactId>junit-jupiter-engine</artifactId>
<groupId>org.junit.jupiter</groupId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
<properties>
<hikaricp.version>5.0.1</hikaricp.version>
Expand Down
2 changes: 1 addition & 1 deletion DatabaseAPI/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<modelVersion>4.0.0</modelVersion>

<artifactId>DatabaseAPI</artifactId>
<version>1.4</version>
<version>1.4.1</version>

<properties>
<ormlite.version>6.1</ormlite.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ public class DatabaseFromConfig {
Map.entry("maria-db", new DatabaseInfo("mariadb", "org.mariadb.jdbc.Driver", new MariaDbDatabaseType(), DatabaseLocation.PUBLIC)),
Map.entry("postgresql", new DatabaseInfo("postgresql", "org.postgresql.Driver", new PostgresDatabaseType(), DatabaseLocation.PUBLIC)),
Map.entry("oracle", new DatabaseInfo("oracle", "oracle.jdbc.driver.OracleDriver", new OracleDatabaseType(), DatabaseLocation.PUBLIC)),
Map.entry("sql-server", new DatabaseInfo("sqlserver", "com.microsoft.sqlserver.jdbc.SQLServerDriver", new SqlServerDatabaseType(), DatabaseLocation.PUBLIC)),
Map.entry("sql-server-jtdc", new DatabaseInfo("jtds", "net.sourceforge.jtds.jdbc.Driver", new SqlServerJtdsDatabaseType(), DatabaseLocation.PUBLIC)),
Map.entry("derby-local", new DatabaseInfo("derby", "org.apache.derby.jdbc.EmbeddedDriver", new DerbyEmbeddedDatabaseType(), DatabaseLocation.LOCAL)),
Map.entry("derby-server", new DatabaseInfo("derby", "org.apache.derby.jdbc.ClientDriver", new DerbyClientServerDatabaseType(), DatabaseLocation.PUBLIC)),
Map.entry("hsqldb", new DatabaseInfo("hsqldb", "org.hsqldb.jdbcDriver", new HsqldbDatabaseType(), DatabaseLocation.PUBLIC)),
Expand Down
3 changes: 3 additions & 0 deletions Jigsaw/ArtifexDatabaseDrivers/install.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
set JAVA_HOME=C:\Program Files\BellSoft\LibericaJDK-19-Full
call mvn clean install
pause
9 changes: 1 addition & 8 deletions Jigsaw/ArtifexDatabaseDrivers/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</parent>

<artifactId>ArtifexDatabaseDrivers</artifactId>
<version>1.0</version>
<version>1.1</version>
<packaging>jar</packaging>

<name>Artifex Database Drivers</name>
Expand Down Expand Up @@ -97,13 +97,6 @@
<scope>compile</scope>
</dependency>

<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
<version>12.2.0.jre11</version>
<scope>compile</scope>
</dependency>

<dependency>
<groupId>org.apache.derby</groupId>
<artifactId>derby</artifactId>
Expand Down
Loading

0 comments on commit 36a22a4

Please sign in to comment.