Skip to content

Commit 2c16d2b

Browse files
committed
Merge branch 'master' into feature/sign-command-editor
2 parents aa76ccb + 046c0df commit 2c16d2b

File tree

151 files changed

+1882
-785
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

151 files changed

+1882
-785
lines changed

.github/HOW_USE_DI.md renamed to .github/HOW_USE_TO_DI.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ public class UserCommand {
109109
#### 7. Subscriber
110110
```java
111111
@Controller // <- marks a class that will be registered as an event subscriber.
112-
public class UserSubscriber implements Subscriber {
112+
public class UserSubscriber {
113113

114114
private final UserService exampleService;
115115

@@ -126,12 +126,12 @@ public class UserSubscriber implements Subscriber {
126126
}
127127
```
128128

129-
#### 8. BeanSetup
130-
BeanSetup is a class that allows you to register beans in the bean container.
129+
#### 8. Setup
130+
Setup is an annotation that allows you to register beans in the bean container.
131131
It is used to register dependencies that are cannot be registered in the bean container using annotations. e.g. MiniMessage, AdventureProvider, HikariDataSource, etc.
132132
```java
133133

134-
@BeanSetup // <- marks a class that will be registered as a bean holder.
134+
@Setup // <- marks a class that will be registered as a bean holder.
135135
public class UserBeanSetup {
136136

137137
@Bean // <- marks a method that will be registered as a bean. (dependency)

.github/workflows/gradle.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
fail-fast: false
1717
steps:
1818
- name: Checkout
19-
uses: actions/checkout@v4.2.1
19+
uses: actions/checkout@v4.2.2
2020
- name: 'Set up JDK ${{ matrix.java }}'
2121
uses: actions/setup-java@v4.6.0
2222
with:

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ EternalCore is your ultimate companion for enhancing your Minecraft server exper
1717

1818
## :information_source: Information
1919

20-
- EternalCore fully supports Minecraft's latest minor versions starting from each major version, starting from 1.17 onward, e.g. `1.17.1`, `1.18.2`, `1.19.4`, `1.20.6`, `1.21.1`.
21-
- Requires **Java 17 or later** to work properly. For older versions of Java, this may affect the functionality of the plugin.
20+
- EternalCore fully supports Minecraft's latest minor versions starting from each major version, starting from 1.17 onward, e.g. `1.17.1`, `1.18.2`, `1.19.4`, `1.20.6`, `1.21.4`.
21+
- Requires **Java 21 or later** to work properly. For older versions of Java, this may affect the functionality of the plugin.
2222
- If you have any questions, perhaps you will find a solution to them in our [documentation](https://docs.eternalcode.pl/eternalcore/introduction.html), you can also ask us about it on [discord](https://discord.gg/FQ7jmGBd6c).
2323

2424
## :hammer_and_wrench: Development Builds
@@ -80,15 +80,15 @@ For Maven projects use:
8080

8181
For Gradle projects use:
8282
```kts
83-
compileOnly("com.eternalcode:eternalcore-api:1.4.0")
83+
compileOnly("com.eternalcode:eternalcore-api:1.5.2")
8484
```
8585

8686
For Maven projects use:
8787
```xml
8888
<dependency>
8989
<groupId>com.eternalcode</groupId>
9090
<artifactId>eternalcore-api</artifactId>
91-
<version>1.4.0</version>
91+
<version>1.5.2</version>
9292
<scope>provided</scope>
9393
</dependency>
9494
```
@@ -97,7 +97,7 @@ For Maven projects use:
9797

9898
## :building_construction: Building
9999

100-
To build EternalCore, follow these steps (Make sure you have **JDK 17 or higher**):
100+
To build EternalCore, follow these steps (Make sure you have **JDK 21 or higher**):
101101

102102
```shell
103103
./gradlew clean eternalcore-plugin:shadowJar

buildSrc/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ repositories {
88

99
dependencies {
1010
implementation("net.kyori:blossom:1.3.1")
11-
implementation("com.gradleup.shadow:shadow-gradle-plugin:8.3.3")
11+
implementation("com.gradleup.shadow:shadow-gradle-plugin:8.3.5")
1212
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8:2.1.0")
1313
implementation("net.minecrell:plugin-yml:0.6.0")
1414
}

buildSrc/src/main/kotlin/Versions.kt

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
11
object Versions {
22

3-
const val SPIGOT_API = "1.19.4-R0.1-SNAPSHOT"
4-
const val PAPER_API = "1.19.4-R0.1-SNAPSHOT"
3+
const val SPIGOT_API = "1.21.3-R0.1-SNAPSHOT"
4+
const val PAPER_API = "1.21.3-R0.1-SNAPSHOT"
55

66
const val ETERNALCODE_COMMONS = "1.1.5"
77
const val MULTIFICATION = "1.2.1"
88

99
const val JETBRAINS_ANNOTATIONS = "26.0.1"
1010
const val PLACEHOLDER_API = "2.11.6"
11-
const val LOMBOK = "1.18.34"
11+
const val LOMBOK = "1.18.36"
1212
const val GIT_CHECK = "1.0.0"
1313

1414
const val PAPERLIB = "1.0.8"
1515
const val ADVENTURE_PLATFORM = "4.3.4"
16-
const val ADVENTURE_TEXT_MINIMESSAGE = "4.18.0-SNAPSHOT"
16+
const val ADVENTURE_TEXT_MINIMESSAGE = "4.18.0"
1717
const val ADVENTURE_PLATFORM_FACET = "4.3.4"
18-
const val CDN_CONFIGS = "1.14.5"
18+
const val CDN_CONFIGS = "1.14.6"
1919

2020
const val MARIA_DB = "3.5.1"
21-
const val POSTGRESQL = "42.7.4"
21+
const val POSTGRESQL = "42.7.5"
2222
const val H2 = "2.3.232"
2323
const val ORMLITE = "6.1"
2424
const val HIKARI_CP = "6.2.1"
@@ -33,21 +33,20 @@ object Versions {
3333
const val PANDA_UTILITIES = "0.5.3-alpha"
3434
const val APACHE_COMMONS = "2.18.0"
3535

36-
const val TRIUMPH_GUI = "3.1.10"
36+
const val TRIUMPH_GUI = "3.1.11"
3737

3838
const val BSTATS = "3.1.0"
39-
const val PIXEL_WIDTH = "1.1.0"
4039

41-
const val CAFFEINE = "3.1.8"
40+
const val CAFFEINE = "3.2.0"
4241

4342
const val SPOTIFY_COMPLETABLE_FUTURES = "0.3.6"
4443

4544
// tests
4645
const val EXPRESSIBLE_JUNIT = "1.3.6"
47-
const val GROOVY_ALL = "3.0.22"
48-
const val JUNIT_JUPITER_API = "5.11.2"
49-
const val JUNIT_JUPITER_PARAMS = "5.11.2"
50-
const val JUNIT_JUPITER_ENGINE = "5.11.2"
46+
const val GROOVY_ALL = "3.0.23"
47+
const val JUNIT_JUPITER_API = "5.11.4"
48+
const val JUNIT_JUPITER_PARAMS = "5.11.4"
49+
const val JUNIT_JUPITER_ENGINE = "5.11.4"
5150
const val MOCKITO_CORE = "5.15.2"
5251

5352
}

buildSrc/src/main/kotlin/eternalcode-java.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ plugins {
44
}
55

66
group = "com.eternalcode"
7-
version = "1.4.0"
7+
version = "1.5.2"
88

99
checkstyle {
1010
toolVersion = "10.21.1"
@@ -35,5 +35,5 @@ java {
3535
tasks.withType<JavaCompile>() {
3636
options.compilerArgs = listOf("-Xlint:deprecation", "-parameters")
3737
options.encoding = "UTF-8"
38-
options.release = 17
38+
options.release = 21
3939
}

buildSrc/src/main/kotlin/eternalcore-publish.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ plugins {
44
}
55

66
group = "com.eternalcode"
7-
version = "1.4.0"
7+
version = "1.5.2"
88

99
java {
1010
withSourcesJar()

eternalcore-api-example/src/main/java/com/eternalcode/example/feature/home/ApiHomeListener.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ void onHomeTeleport(HomeTeleportEvent event) {
100100

101101
player.sendMessage("Teleporting to home...");
102102

103-
if (player.hasPotionEffect(PotionEffectType.SLOW)) {
103+
if (player.hasPotionEffect(PotionEffectType.SLOWNESS)) {
104104
player.sendMessage("You are slowed down!");
105105
player.teleport(player.getWorld().getSpawnLocation());
106106
}

eternalcore-api/src/main/java/com/eternalcode/core/delay/Delay.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,6 @@ public class Delay<T> {
1313

1414
private final Supplier<Duration> delaySettings;
1515

16-
@Deprecated
17-
public Delay(DelaySettings delaySettings) {
18-
this((Supplier<Duration>) () -> delaySettings.delay());
19-
}
20-
2116
public Delay(Supplier<Duration> delayProvider) {
2217
this.delaySettings = delayProvider;
2318

eternalcore-api/src/main/java/com/eternalcode/core/delay/DelaySettings.java

Lines changed: 0 additions & 10 deletions
This file was deleted.
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
package com.eternalcode.core.feature.butcher;
2+
3+
import org.bukkit.entity.Entity;
4+
import org.bukkit.event.Cancellable;
5+
import org.bukkit.event.Event;
6+
import org.bukkit.event.HandlerList;
7+
8+
public class ButcherEntityRemoveEvent extends Event implements Cancellable {
9+
10+
private static final HandlerList HANDLER_LIST = new HandlerList();
11+
12+
private boolean cancelled;
13+
private final Entity entity;
14+
15+
public ButcherEntityRemoveEvent(Entity entity) {
16+
this.entity = entity;
17+
}
18+
19+
@Override
20+
public boolean isCancelled() {
21+
return cancelled;
22+
}
23+
24+
@Override
25+
public void setCancelled(boolean cancelled) {
26+
this.cancelled = cancelled;
27+
}
28+
29+
public Entity getEntity() {
30+
return entity;
31+
}
32+
33+
@Override
34+
public HandlerList getHandlers() {
35+
return HANDLER_LIST;
36+
}
37+
38+
public static HandlerList getHandlerList() {
39+
return HANDLER_LIST;
40+
}
41+
}

eternalcore-core/src/main/java/com/eternalcode/core/feature/language/Language.java renamed to eternalcore-api/src/main/java/com/eternalcode/core/feature/language/Language.java

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
package com.eternalcode.core.feature.language;
22

3-
import java.util.ArrayList;
43
import java.util.Collections;
4+
import java.util.LinkedHashSet;
55
import java.util.List;
66
import java.util.Locale;
77
import java.util.Objects;
8+
import java.util.Set;
89

910
public class Language {
1011

@@ -13,35 +14,37 @@ public class Language {
1314
public static final Language DEFAULT = Language.fromLocale(Locale.ROOT);
1415

1516
private final String lang;
16-
private final List<String> aliases;
17+
private final Set<String> aliases;
1718

1819
public Language(String lang, List<String> aliases) {
1920
this.lang = lang;
20-
this.aliases = new ArrayList<>(aliases);
21+
this.aliases = new LinkedHashSet<>(aliases);
2122
}
2223

2324
public String getLang() {
2425
return this.lang;
2526
}
2627

27-
public List<String> getAliases() {
28-
return Collections.unmodifiableList(this.aliases);
28+
public Set<String> getAliases() {
29+
return Collections.unmodifiableSet(this.aliases);
2930
}
3031

3132
public boolean isEquals(Language other) {
3233
if (this.lang.equals(other.lang)) {
3334
return true;
3435
}
3536

36-
for (String alias : this.aliases) {
37-
if (alias.equals(other.lang)) {
38-
return true;
39-
}
37+
if (this.lang.startsWith(other.lang) || other.lang.startsWith(this.lang)) {
38+
return true;
39+
}
4040

41-
for (String otherAlias : other.aliases) {
42-
if (alias.equals(otherAlias)) {
43-
return true;
44-
}
41+
if (this.aliases.contains(other.lang)) {
42+
return true;
43+
}
44+
45+
for (String otherAlias : other.aliases) {
46+
if (this.aliases.contains(otherAlias)) {
47+
return true;
4548
}
4649
}
4750

@@ -71,7 +74,7 @@ public static Language fromLocale(Locale locale) {
7174
}
7275

7376
public Locale toLocale() {
74-
return new Locale(this.lang);
77+
return Locale.of(this.lang);
7578
}
7679

7780
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package com.eternalcode.core.feature.language;
2+
3+
import java.util.UUID;
4+
5+
public interface LanguageProvider {
6+
7+
Language getDefaultLanguage(UUID player);
8+
9+
}
Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,20 @@
11
package com.eternalcode.core.feature.language;
22

3-
import java.util.Locale;
4-
import org.bukkit.entity.Player;
3+
import java.util.UUID;
4+
import java.util.concurrent.CompletableFuture;
55

66
public interface LanguageService {
77

8-
Locale getPlayerLanguage(Player player);
8+
void setDefaultProvider(LanguageProvider defaultProvider);
9+
10+
LanguageProvider getDefaultProvider();
11+
12+
CompletableFuture<Language> getLanguage(UUID playerUniqueId);
13+
14+
Language getLanguageNow(UUID playerUniqueId);
15+
16+
CompletableFuture<Void> setLanguage(UUID playerUniqueId, Language language);
17+
18+
CompletableFuture<Void> setDefaultLanguage(UUID playerUniqueId);
919

10-
void setPlayerLanguage(Player player, Locale locale);
1120
}

eternalcore-api/src/main/java/com/eternalcode/core/feature/warp/Warp.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,26 @@
22

33
import org.bukkit.Location;
44

5+
import java.util.List;
6+
import org.bukkit.permissions.Permissible;
7+
58
public interface Warp {
69

710
Location getLocation();
811

912
String getName();
1013

14+
List<String> getPermissions();
15+
16+
default boolean hasPermissions(Permissible permissible) {
17+
List<String> permissions = this.getPermissions();
18+
if (permissions.isEmpty()) {
19+
return true;
20+
}
21+
22+
return permissions
23+
.stream()
24+
.anyMatch(permission -> permissible.hasPermission(permission));
25+
}
26+
1127
}

0 commit comments

Comments
 (0)