Skip to content

Commit 90cade0

Browse files
committed
2.4.14
1 parent 13fb59f commit 90cade0

File tree

6 files changed

+126
-129
lines changed

6 files changed

+126
-129
lines changed

build.gradle

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

77
group = 'com.github.getplusm'
8-
version = '2.4.13'
8+
version = '2.4.14'
99
description = 'PLAZMER-ENGINE'
1010

1111
allprojects {

engine/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ dependencies {
2828
compileOnly group: 'com.sk89q.worldguard', name: 'worldguard-bukkit', version: '7.0.7'
2929

3030
// PAPI
31-
compileOnly 'me.clip:placeholderapi:2.11.5'
31+
compileOnly 'me.clip:placeholderapi:2.11.6'
3232

3333
// Lombok
3434
compileOnly 'org.projectlombok:lombok:1.18.36'

engine/src/main/java/t/me/p1azmer/engine/Version.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,15 @@ public enum Version {
2727
V1_19_R2("1.19.3", Status.OUTDATED),
2828
V1_19_R3("1.19.4", Status.OUTDATED),
2929
V1_20_R1("1.20.1", Status.OUTDATED),
30-
V1_20_R2("1.20.2", Status.OUTDATED),
30+
V1_20_R2("1.20.2"),
3131
V1_20_R3("1.20.4"),
3232
MC_1_20_6("1.20.6"),
3333
MC_1_21_0("1.21"),
3434
MC_1_21("1.21.1"),
3535
MC_1_21_2("1.21.2"),
3636
MC_1_21_3("1.21.3"),
3737
MC_1_21_4("1.21.4"),
38+
MC_1_21_5("1.21.5"),
3839

3940
UNKNOWN("Unknown");
4041

engine/src/main/java/t/me/p1azmer/engine/api/placeholder/PlaceholderExpansion.java

Lines changed: 93 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -12,100 +12,100 @@
1212

1313
public class PlaceholderExpansion<P extends NexPlugin<P>> extends me.clip.placeholderapi.expansion.PlaceholderExpansion implements Relational {
1414

15-
public final List<Placeholder<P>> placeholders = new ArrayList<>();
16-
17-
public final P plugin;
18-
19-
public PlaceholderExpansion(@NotNull P plugin) {
20-
this.plugin = plugin;
21-
}
22-
23-
public Map<String, CachedPlaceholder<P>> placeholderCache = new HashMap<>();
24-
25-
@Override
26-
public String onPlaceholderRequest(@Nullable Player player, @NotNull String params) {
27-
CachedPlaceholder<P> cachedPlaceholder = placeholderCache.computeIfAbsent(params, s -> {
28-
for (Placeholder<P> placeholder : placeholders.stream()
29-
.filter(founder -> founder instanceof AbstractPlaceholder<P>)
30-
.toList()) {
31-
Matcher matcher = placeholder.getPattern().matcher(params);
32-
if (!matcher.matches()) continue;
33-
return new CachedPlaceholder<>(matcher, placeholder);
34-
}
35-
return null;
36-
});
37-
38-
if (cachedPlaceholder == null) return "";
39-
if (cachedPlaceholder.getPlaceholder() instanceof AbstractPlaceholder<P> placeholder) {
40-
return placeholder.parse(cachedPlaceholder.getMatcher(), player);
15+
public final List<Placeholder<P>> placeholders = new ArrayList<>();
16+
17+
public final P plugin;
18+
19+
public PlaceholderExpansion(@NotNull P plugin) {
20+
this.plugin = plugin;
21+
}
22+
23+
public Map<String, CachedPlaceholder<P>> placeholderCache = new HashMap<>();
24+
25+
@Override
26+
public String onPlaceholderRequest(@Nullable Player player, @NotNull String params) {
27+
CachedPlaceholder<P> cachedPlaceholder = placeholderCache.computeIfAbsent(params, s -> {
28+
for (Placeholder<P> placeholder : placeholders.stream()
29+
.filter(founder -> founder instanceof AbstractPlaceholder<P>)
30+
.toList()) {
31+
Matcher matcher = placeholder.getPattern().matcher(params);
32+
if (!matcher.matches()) continue;
33+
return new CachedPlaceholder<>(matcher, placeholder);
34+
}
35+
return null;
36+
});
37+
38+
if (cachedPlaceholder == null) return "";
39+
if (cachedPlaceholder.getPlaceholder() instanceof AbstractPlaceholder<P> placeholder) {
40+
return placeholder.parse(cachedPlaceholder.getMatcher(), player);
41+
}
42+
43+
return "";
44+
}
45+
46+
@Override
47+
public @NotNull String getIdentifier() {
48+
return plugin.getName();
49+
}
50+
51+
@Override
52+
public @NotNull String getAuthor() {
53+
return "plazmer";
54+
}
55+
56+
@Override
57+
public @NotNull String getVersion() {
58+
return plugin.getDescription().getVersion();
59+
}
60+
61+
@Override
62+
public boolean persist() {
63+
return true;
4164
}
4265

43-
return "";
44-
}
45-
46-
@Override
47-
public @NotNull String getIdentifier() {
48-
return plugin.getName();
49-
}
50-
51-
@Override
52-
public @NotNull String getAuthor() {
53-
return "plazmer";
54-
}
55-
56-
@Override
57-
public @NotNull String getVersion() {
58-
return plugin.getDescription().getVersion();
59-
}
60-
61-
@Override
62-
public boolean persist() {
63-
return true;
64-
}
65-
66-
@Override
67-
public boolean canRegister() {
68-
return true;
69-
}
70-
71-
public void setup() {
72-
super.register();
73-
this.plugin.warn("Register self (" + this.placeholders.size() + ") PAPI expansions");
74-
}
75-
76-
public void shutdown() {
77-
super.unregister();
78-
this.plugin.warn("Unregister self (" + this.placeholders.size() + ") PAPI expansions");
79-
}
80-
81-
@Deprecated
82-
public boolean unRegister() {
83-
return super.unregister();
84-
}
85-
86-
@SafeVarargs
87-
public final PlaceholderExpansion<P> addPlaceholder(@NotNull Placeholder<P>... placeholders) {
88-
this.placeholders.addAll(Arrays.stream(placeholders).toList());
89-
return this;
90-
}
91-
92-
93-
@Override
94-
public String onPlaceholderRequest(@Nullable Player one, @Nullable Player two, @NotNull String params) {
95-
CachedPlaceholder<P> cachedPlaceholder = placeholderCache.computeIfAbsent(params, s -> {
96-
for (Placeholder<P> placeholder : placeholders.stream()
97-
.filter(founder -> founder instanceof AbstractRelationalPlaceholder<P>)
98-
.toList()) {
99-
Matcher matcher = placeholder.getPattern().matcher(params);
100-
if (!matcher.matches()) continue;
101-
return new CachedPlaceholder<>(matcher, placeholder);
102-
}
103-
return null;
104-
});
105-
if (cachedPlaceholder == null) return "";
106-
if (cachedPlaceholder.getPlaceholder() instanceof AbstractRelationalPlaceholder<P> placeholder) {
107-
return placeholder.parse(cachedPlaceholder.getMatcher(), one, two);
66+
@Override
67+
public boolean canRegister() {
68+
return true;
69+
}
70+
71+
public void setup() {
72+
super.register();
73+
this.plugin.warn("Register self (" + this.placeholders.size() + ") PAPI expansions");
74+
}
75+
76+
public void shutdown() {
77+
super.unregister();
78+
this.plugin.warn("Unregister self (" + this.placeholders.size() + ") PAPI expansions");
79+
}
80+
81+
@Deprecated
82+
public boolean unRegister() {
83+
return super.unregister();
84+
}
85+
86+
@SafeVarargs
87+
public final PlaceholderExpansion<P> addPlaceholder(@NotNull Placeholder<P>... placeholders) {
88+
this.placeholders.addAll(Arrays.stream(placeholders).toList());
89+
return this;
90+
}
91+
92+
93+
@Override
94+
public String onPlaceholderRequest(@Nullable Player one, @Nullable Player two, @NotNull String params) {
95+
CachedPlaceholder<P> cachedPlaceholder = placeholderCache.computeIfAbsent(params, s -> {
96+
for (Placeholder<P> placeholder : placeholders.stream()
97+
.filter(founder -> founder instanceof AbstractRelationalPlaceholder<P>)
98+
.toList()) {
99+
Matcher matcher = placeholder.getPattern().matcher(params);
100+
if (!matcher.matches()) continue;
101+
return new CachedPlaceholder<>(matcher, placeholder);
102+
}
103+
return null;
104+
});
105+
if (cachedPlaceholder == null) return "";
106+
if (cachedPlaceholder.getPlaceholder() instanceof AbstractRelationalPlaceholder<P> placeholder) {
107+
return placeholder.parse(cachedPlaceholder.getMatcher(), one, two);
108+
}
109+
return "";
108110
}
109-
return "";
110-
}
111111
}
Lines changed: 25 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
package t.me.p1azmer.engine.command;
22

3+
import lombok.AccessLevel;
4+
import lombok.Getter;
5+
import lombok.experimental.FieldDefaults;
36
import org.jetbrains.annotations.NotNull;
47
import org.jetbrains.annotations.Nullable;
58
import t.me.p1azmer.engine.NexPlugin;
@@ -12,82 +15,73 @@
1215
import java.util.HashSet;
1316
import java.util.Set;
1417

18+
@Getter
19+
@FieldDefaults(level = AccessLevel.PRIVATE)
1520
public class CommandManager<P extends NexPlugin<P>> extends AbstractManager<P> {
1621

17-
private Set<GeneralCommand<P>> commands;
18-
private PluginMainCommand<P> mainCommand;
22+
final Set<GeneralCommand<P>> commands = new HashSet<>();
23+
PluginMainCommand<P> mainCommand;
1924

2025
public CommandManager(@NotNull P plugin) {
2126
super(plugin);
2227
}
2328

2429
@Override
2530
public void onLoad() {
26-
this.commands = new HashSet<>();
27-
if (this.plugin.getConfigManager().commandAliases == null || this.plugin.getConfigManager().commandAliases.length == 0) {
28-
this.plugin.error("Could not register plugin commands!");
31+
if (plugin.getConfigManager().commandAliases == null || plugin.getConfigManager().commandAliases.length == 0) {
32+
plugin.error("Could not register plugin commands!");
2933
return;
3034
}
3135

3236
// Create main plugin command and attach help sub-command as a default executor.
33-
this.mainCommand = new PluginMainCommand<>(this.plugin);
34-
this.mainCommand.addDefaultCommand(new HelpSubCommand<>(this.plugin));
37+
mainCommand = new PluginMainCommand<>(plugin);
38+
mainCommand.addDefaultCommand(new HelpSubCommand<>(plugin));
3539

3640
// Register child plugin sub-commands to the main plugin command.
37-
this.plugin.registerCommands(this.mainCommand);
41+
plugin.registerCommands(mainCommand);
3842

39-
if (!this.plugin.isEngine()) {
40-
this.mainCommand.addChildren(new AboutSubCommand<>(this.plugin));
43+
if (!plugin.isEngine()) {
44+
mainCommand.addChildren(new AboutSubCommand<>(plugin));
4145
}
4246

4347
// Register main command as a bukkit command.
44-
this.registerCommand(this.mainCommand);
48+
registerCommand(mainCommand);
4549
}
4650

4751
@Override
4852
public void onShutdown() {
49-
for (GeneralCommand<P> command : new HashSet<>(this.commands)) {
50-
this.unregisterCommand(command);
53+
for (GeneralCommand<P> command : new HashSet<>(commands)) {
54+
unregisterCommand(command);
5155
command.getChildrens().clear();
5256
}
53-
this.commands.clear();
54-
}
55-
56-
@NotNull
57-
public Set<GeneralCommand<P>> getCommands() {
58-
return this.commands;
59-
}
60-
61-
@NotNull
62-
public PluginMainCommand<P> getMainCommand() {
63-
return this.mainCommand;
57+
commands.clear();
6458
}
6559

6660
@Nullable
6761
public GeneralCommand<P> getCommand(@NotNull String alias) {
68-
return this.getCommands().stream()
62+
return getCommands().stream()
6963
.filter(command -> ArrayUtil.contains(command.getAliases(), alias))
7064
.findFirst().orElse(null);
7165
}
7266

7367
public void registerCommand(@NotNull GeneralCommand<P> command) {
74-
if (this.commands.add(command)) {
75-
CommandRegister.register(this.plugin, command);
68+
if (commands.add(command)) {
69+
CommandRegister.register(plugin, command);
7670
}
7771
}
7872

7973
public boolean unregisterCommand(@NotNull String alias) {
80-
GeneralCommand<P> command = this.getCommand(alias);
74+
GeneralCommand<P> command = getCommand(alias);
8175
if (command != null) {
82-
return this.unregisterCommand(command);
76+
return unregisterCommand(command);
8377
}
8478
return false;
8579
}
8680

8781
public boolean unregisterCommand(@NotNull GeneralCommand<P> command) {
88-
if (this.commands.remove(command)) {
82+
if (commands.remove(command)) {
8983
return CommandRegister.unregister(command.getAliases()[0]);
9084
}
9185
return false;
9286
}
93-
}
87+
}

engine/src/main/resources/plugin.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@ version: ${version}
33
main: t.me.p1azmer.engine.NexEngine
44
author: "plazmer"
55
website: "t.me/p1azmer"
6-
description: "Plugin Engine"
6+
description: "The root plugin for all the other plugins from plazmer"
77
api-version: 1.17
8-
softdepend: [ Vault ]
8+
softdepend:
9+
- Vault
10+
- PlaceholderAPI
911
load: STARTUP
1012
folia-supported: true
1113
libraries:

0 commit comments

Comments
 (0)