Skip to content

Commit 4cd2c8a

Browse files
authored
Merge pull request #2414 from BentoBoxWorld/develop
Release 2.4.0
2 parents 8649afd + 59fd8d9 commit 4cd2c8a

File tree

212 files changed

+5108
-3658
lines changed

Some content is hidden

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

212 files changed

+5108
-3658
lines changed

.github/workflows/build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ jobs:
1313
- uses: actions/checkout@v3
1414
with:
1515
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
16-
- name: Set up JDK 17
16+
- name: Set up JDK 21
1717
uses: actions/setup-java@v3
1818
with:
1919
distribution: 'adopt'
20-
java-version: '17'
20+
java-version: '21'
2121
- name: Cache SonarCloud packages
2222
uses: actions/cache@v3
2323
with:

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
[![Discord](https://img.shields.io/discord/272499714048524288.svg?logo=discord)](https://discord.bentobox.world)
44
[![Build Status](https://ci.codemc.org/buildStatus/icon?job=BentoBoxWorld/BentoBox)](https://ci.codemc.org/job/BentoBoxWorld/job/BentoBox/)
5-
[![Lines of Code](https://sonarcloud.io/api/project_badges/measure?project=BentoBoxWorld_BentoBox&metric=ncloc)](https://sonarcloud.io/dashboard?id=BentoBoxWorld_BentoBox)
65
[![Maintainability Rating](https://sonarcloud.io/api/project_badges/measure?project=BentoBoxWorld_BentoBox&metric=sqale_rating)](https://sonarcloud.io/dashboard?id=BentoBoxWorld_BentoBox)
76
[![Reliability Rating](https://sonarcloud.io/api/project_badges/measure?project=BentoBoxWorld_BentoBox&metric=reliability_rating)](https://sonarcloud.io/dashboard?id=BentoBoxWorld_BentoBox)
87
[![Security Rating](https://sonarcloud.io/api/project_badges/measure?project=BentoBoxWorld_BentoBox&metric=security_rating)](https://sonarcloud.io/dashboard?id=BentoBoxWorld_BentoBox)
@@ -112,9 +111,10 @@ repositories {
112111
}
113112
114113
dependencies {
115-
compileOnly 'world.bentobox:bentobox:PUT-VERSION-HERE'
114+
compileOnly 'world.bentobox:bentobox:PUT-VERSION-HERE-SNAPSHOT'
116115
}
117116
```
117+
**Note:** Due to a Gradle issue with versions for Maven, you need to use -SNAPSHOT at the end.
118118

119119
### History
120120

pom.xml

Lines changed: 42 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,10 @@
7373
<postgresql.version>42.2.18</postgresql.version>
7474
<hikaricp.version>5.0.1</hikaricp.version>
7575
<!-- More visible way to change dependency versions -->
76-
<spigot.version>1.20.4-R0.1-SNAPSHOT</spigot.version>
76+
<spigot.version>1.20.5-R0.1-SNAPSHOT</spigot.version>
7777
<!-- Might differ from the last Spigot release for short periods
7878
of time -->
79-
<paper.version>1.20.4-R0.1-SNAPSHOT</paper.version>
79+
<paper.version>1.20.6-R0.1-SNAPSHOT</paper.version>
8080
<bstats.version>3.0.0</bstats.version>
8181
<vault.version>1.7.1</vault.version>
8282
<placeholderapi.version>2.10.9</placeholderapi.version>
@@ -88,7 +88,7 @@
8888
<!-- Do not change unless you want different name for local builds. -->
8989
<build.number>-LOCAL</build.number>
9090
<!-- This allows to change between versions. -->
91-
<build.version>2.3.0</build.version>
91+
<build.version>2.4.0</build.version>
9292
<sonar.organization>bentobox-world</sonar.organization>
9393
<sonar.host.url>https://sonarcloud.io</sonar.host.url>
9494
<server.jars>${project.basedir}/lib</server.jars>
@@ -145,6 +145,10 @@
145145
</pluginRepositories>
146146

147147
<repositories>
148+
<repository>
149+
<id>jitpack.io</id>
150+
<url>https://jitpack.io</url>
151+
</repository>
148152
<repository>
149153
<id>spigot-repo</id>
150154
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots</url>
@@ -153,10 +157,6 @@
153157
<id>codemc-repo</id>
154158
<url>https://repo.codemc.org/repository/maven-public</url>
155159
</repository>
156-
<repository>
157-
<id>jitpack.io</id>
158-
<url>https://jitpack.io</url>
159-
</repository>
160160
<repository>
161161
<id>placeholderapi-repo</id>
162162
<url>https://repo.extendedclip.com/content/repositories/placeholderapi/</url>
@@ -195,6 +195,11 @@
195195
<name>Lumine Releases</name>
196196
<url>https://mvn.lumine.io/repository/maven-public/</url>
197197
</repository>
198+
<!-- For Multipaper -->
199+
<repository>
200+
<id>clojars</id>
201+
<url>https://repo.clojars.org/</url>
202+
</repository>
198203
</repositories>
199204

200205
<dependencies>
@@ -223,13 +228,25 @@
223228
<version>3.11.1</version>
224229
<scope>test</scope>
225230
</dependency>
226-
<!-- Spigot API -->
231+
<!-- Spigot API -->
227232
<dependency>
228233
<groupId>org.spigotmc</groupId>
229234
<artifactId>spigot-api</artifactId>
230235
<version>${spigot.version}</version>
231236
<scope>provided</scope>
232237
</dependency>
238+
<dependency>
239+
<groupId>org.spigotmc.....</groupId>
240+
<artifactId>spigot</artifactId>
241+
<version>1.21-R0.1-SNAPSHOT</version>
242+
<scope>provided</scope>
243+
</dependency>
244+
<dependency>
245+
<groupId>org.spigotmc....</groupId>
246+
<artifactId>spigot</artifactId>
247+
<version>1.20.6-R0.1-SNAPSHOT</version>
248+
<scope>provided</scope>
249+
</dependency>
233250
<dependency>
234251
<groupId>org.spigotmc.</groupId>
235252
<artifactId>spigot</artifactId>
@@ -354,16 +371,23 @@
354371
<dependency>
355372
<groupId>com.github.Slimefun</groupId>
356373
<artifactId>Slimefun4</artifactId>
357-
<version>RC-36</version>
374+
<version>RC-37</version>
358375
<scope>provided</scope>
359376
</dependency>
360377
<!-- ItemsAdder -->
361378
<dependency>
362379
<groupId>com.github.LoneDev6</groupId>
363380
<artifactId>api-itemsadder</artifactId>
364-
<version>3.6.1</version>
381+
<version>3.6.3-beta-14</version>
365382
<scope>provided</scope>
366383
</dependency>
384+
<!-- Multipaper -->
385+
<dependency>
386+
<groupId>com.github.puregero</groupId>
387+
<artifactId>multilib</artifactId>
388+
<version>1.1.13</version>
389+
<scope>compile</scope>
390+
</dependency>
367391
</dependencies>
368392

369393
<build>
@@ -486,9 +510,10 @@
486510
<plugin>
487511
<groupId>org.apache.maven.plugins</groupId>
488512
<artifactId>maven-shade-plugin</artifactId>
489-
<version>3.3.1-SNAPSHOT</version>
513+
<version>3.4.0</version>
490514
<configuration>
491515
<minimizeJar>true</minimizeJar>
516+
<dependencyReducedPomLocation>${project.build.directory}/dependency-reduced-pom.xml</dependencyReducedPomLocation>
492517
<relocations>
493518
<relocation>
494519
<pattern>org.bstats</pattern>
@@ -500,9 +525,13 @@
500525
</relocation>
501526
<relocation>
502527
<pattern>io.papermc.lib</pattern>
503-
<shadedPattern>world.bentobox.bentobox.paperlib</shadedPattern> <!-- Replace this -->
528+
<shadedPattern>world.bentobox.bentobox.paperlib</shadedPattern>
529+
</relocation>
530+
<relocation>
531+
<pattern>com.github.puregero.multilib</pattern>
532+
<shadedPattern>world.bentobox.bentobox.multilib</shadedPattern>
504533
</relocation>
505-
</relocations>
534+
</relocations>
506535
<artifactSet>
507536
<excludes>
508537
<exclude>org.apache.maven.shared:*</exclude>

src/main/java/world/bentobox/bentobox/BStats.java

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,8 @@
1111
import org.bstats.charts.SimpleBarChart;
1212
import org.bstats.charts.SimplePie;
1313
import org.bstats.charts.SingleLineChart;
14-
import org.bukkit.Bukkit;
1514

1615
import world.bentobox.bentobox.api.addons.GameModeAddon;
17-
import world.bentobox.bentobox.api.flags.Flag;
1816

1917
/**
2018
* @author Poslovitch
@@ -59,7 +57,6 @@ private void registerCustomMetrics() {
5957
registerGameModeAddonsChart();
6058
registerHooksChart();
6159
registerPlayersPerServerChart();
62-
registerFlagsDisplayModeChart();
6360

6461
// Single Line charts
6562
registerIslandsCountChart();
@@ -171,27 +168,6 @@ private void registerPlayersPerServerChart() {
171168
}));
172169
}
173170

174-
/**
175-
* Sends the "flags display mode" of all the online players.
176-
* @since 1.6.0
177-
*/
178-
private void registerFlagsDisplayModeChart() {
179-
metrics.addCustomChart(new AdvancedPie("flagsDisplayMode", () -> {
180-
Map<String, Integer> values = new HashMap<>();
181-
182-
Bukkit.getOnlinePlayers().forEach(player -> {
183-
Flag.Mode mode = plugin.getPlayers().getFlagsDisplayMode(player.getUniqueId());
184-
if (values.containsKey(mode.name())) {
185-
values.put(mode.name(), values.get(mode.name()) + 1);
186-
} else {
187-
values.put(mode.name(), 1);
188-
}
189-
});
190-
191-
return values;
192-
}));
193-
}
194-
195171
/**
196172
* Sends the enabled addons (except GameModeAddons) of this server as bar chart.
197173
* @since 1.17.1

src/main/java/world/bentobox/bentobox/BentoBox.java

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import world.bentobox.bentobox.commands.BentoBoxCommand;
2626
import world.bentobox.bentobox.database.DatabaseSetup;
2727
import world.bentobox.bentobox.hooks.ItemsAdderHook;
28+
import world.bentobox.bentobox.hooks.MultipaperHook;
2829
import world.bentobox.bentobox.hooks.MultiverseCoreHook;
2930
import world.bentobox.bentobox.hooks.MyWorldsHook;
3031
import world.bentobox.bentobox.hooks.MythicMobsHook;
@@ -37,6 +38,7 @@
3738
import world.bentobox.bentobox.listeners.JoinLeaveListener;
3839
import world.bentobox.bentobox.listeners.PanelListenerManager;
3940
import world.bentobox.bentobox.listeners.PrimaryIslandListener;
41+
import world.bentobox.bentobox.listeners.SeedWorldMakerListener;
4042
import world.bentobox.bentobox.listeners.StandardSpawnProtectionListener;
4143
import world.bentobox.bentobox.listeners.teleports.EntityTeleportListener;
4244
import world.bentobox.bentobox.listeners.teleports.PlayerTeleportListener;
@@ -102,6 +104,8 @@ public class BentoBox extends JavaPlugin implements Listener {
102104

103105
@Override
104106
public void onEnable(){
107+
setInstance(this);
108+
105109
if (!ServerCompatibility.getInstance().checkCompatibility().isCanLaunch()) {
106110
// The server's most likely incompatible.
107111
// Show a warning
@@ -123,7 +127,6 @@ public void onEnable(){
123127

124128
// Save the default config from config.yml
125129
saveDefaultConfig();
126-
setInstance(this);
127130
// Load Flags
128131
flagsManager = new FlagsManager(this);
129132

@@ -184,6 +187,9 @@ public void onEnable(){
184187

185188
private void completeSetup(long loadTime) {
186189
final long enableStart = System.currentTimeMillis();
190+
191+
hooksManager.registerHook(new MultipaperHook());
192+
187193
hooksManager.registerHook(new VaultHook());
188194

189195
// MythicMobs
@@ -210,20 +216,6 @@ private void completeSetup(long loadTime) {
210216
return;
211217
}
212218

213-
// Save islands & players data every X minutes
214-
Bukkit.getScheduler().runTaskTimer(instance, () -> {
215-
if (!playersManager.isSaveTaskRunning()) {
216-
playersManager.saveAll(true);
217-
} else {
218-
getLogger().warning("Tried to start a player data save task while the previous auto save was still running!");
219-
}
220-
if (!islandsManager.isSaveTaskRunning()) {
221-
islandsManager.saveAll(true);
222-
} else {
223-
getLogger().warning("Tried to start a island data save task while the previous auto save was still running!");
224-
}
225-
}, getSettings().getDatabaseBackupPeriod() * 20 * 60L, getSettings().getDatabaseBackupPeriod() * 20 * 60L);
226-
227219
// Make sure all flag listeners are registered.
228220
flagsManager.registerListeners();
229221

@@ -323,6 +315,8 @@ private void registerListeners() {
323315
manager.registerEvents(islandDeletionManager, this);
324316
// Primary Island Listener
325317
manager.registerEvents(new PrimaryIslandListener(this), this);
318+
// Seed world chunk generator
319+
manager.registerEvents(new SeedWorldMakerListener(this), this);
326320
}
327321

328322
@Override
@@ -433,7 +427,7 @@ public FlagsManager getFlagsManager() {
433427
* @return the ranksManager
434428
* @deprecated Just use {@code RanksManager.getInstance()}
435429
*/
436-
@Deprecated(since = "2.0.0")
430+
@Deprecated(since = "2.0.0", forRemoval = true)
437431
public RanksManager getRanksManager() {
438432
return RanksManager.getInstance();
439433
}

src/main/java/world/bentobox/bentobox/api/addons/Addon.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,14 @@
2121
import org.bukkit.configuration.file.YamlConfiguration;
2222
import org.bukkit.event.Listener;
2323

24+
import com.github.puregero.multilib.MultiLib;
25+
2426
import world.bentobox.bentobox.BentoBox;
2527
import world.bentobox.bentobox.api.addons.request.AddonRequestHandler;
2628
import world.bentobox.bentobox.api.flags.Flag;
2729
import world.bentobox.bentobox.managers.IslandsManager;
2830
import world.bentobox.bentobox.managers.PlayersManager;
31+
import world.bentobox.bentobox.util.Util;
2932

3033
/**
3134
* Add-on class for BentoBox. Extend this to create an add-on. The operation
@@ -45,6 +48,10 @@ public abstract class Addon {
4548

4649
protected Addon() {
4750
state = State.DISABLED;
51+
if (!Util.inTest()) {
52+
// If the config is updated, update the config.
53+
MultiLib.onString(getPlugin(), "bentobox-config-update", v -> this.reloadConfig());
54+
}
4855
}
4956

5057
/**
@@ -275,7 +282,7 @@ public File saveResource(String jarResource, File destinationFolder, boolean rep
275282
}
276283
// There are two options, use the path of the resource or not
277284
File outFile = new File(destinationFolder,
278-
jarResource.replaceAll("/", Matcher.quoteReplacement(File.separator)));
285+
jarResource.replaceAll("/", Matcher.quoteReplacement(File.separator)));
279286

280287
if (noPath) {
281288
outFile = new File(destinationFolder, outFile.getName());
@@ -396,7 +403,7 @@ public PlayersManager getPlayers() {
396403
public IslandsManager getIslands() {
397404
return getPlugin().getIslands();
398405
}
399-
406+
400407
/**
401408
* Get Islands Manager
402409
* @return Islands manager

src/main/java/world/bentobox/bentobox/api/addons/GameModeAddon.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
import org.eclipse.jdt.annotation.NonNull;
99
import org.eclipse.jdt.annotation.Nullable;
1010

11+
import com.github.puregero.multilib.MultiLib;
12+
1113
import world.bentobox.bentobox.api.commands.CompositeCommand;
1214
import world.bentobox.bentobox.api.configuration.WorldSettings;
1315
import world.bentobox.bentobox.util.Util;
@@ -129,7 +131,10 @@ public Optional<CompositeCommand> getAdminCommand() {
129131
* in-game and need to be saved.
130132
* @since 1.4.0
131133
*/
132-
public abstract void saveWorldSettings();
134+
public void saveWorldSettings() {
135+
// Inform other servers
136+
MultiLib.notify("bentobox-config-update", "");
137+
}
133138

134139
/**
135140
* Defines if the game mode uses the latest {@link ChunkGenerator} API or

src/main/java/world/bentobox/bentobox/api/addons/Pladdon.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public void onLoad() {
2828
String parentFolder = getFile().getParent();
2929
if (parentFolder == null || !parentFolder.endsWith(ADDONS_FOLDER)) {
3030
// Jar is in the wrong place. Let's move it
31-
moveJar();
31+
//moveJar();
3232
}
3333
}
3434

src/main/java/world/bentobox/bentobox/api/commands/CompositeCommand.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -520,11 +520,11 @@ protected boolean hasSubCommands(boolean ignoreHelp) {
520520

521521
/**
522522
* Convenience method to check if a user has a team.
523+
* Consider checking the island itself {@link Island#inTeam(UUID)}
523524
*
524525
* @param world - the world to check
525526
* @param user - the User
526527
* @return true if player is in a team
527-
* @see Consider checking the island itself {@link Island#inTeam(UUID)}
528528
*/
529529
protected boolean inTeam(World world, User user) {
530530
return plugin.getIslands().inTeam(world, user.getUniqueId());

0 commit comments

Comments
 (0)