Skip to content
This repository was archived by the owner on Jul 7, 2021. It is now read-only.

Commit dd27dcc

Browse files
committed
Update to latest BentoBox 1.12 API changes.
2 parents d53bb90 + 5c9cb4b commit dd27dcc

File tree

61 files changed

+3196
-2062
lines changed

Some content is hidden

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

61 files changed

+3196
-2062
lines changed

pom.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
<mongodb.version>3.8.0</mongodb.version>
7070
<!-- More visible way to change dependency versions -->
7171
<spigot.version>1.13.2-R0.1-SNAPSHOT</spigot.version>
72-
<bstats.version>1.5</bstats.version>
72+
<bstats.version>1.7</bstats.version>
7373
<vault.version>1.7</vault.version>
7474
<placeholderapi.version>2.10.4</placeholderapi.version>
7575
<mvdwplaceholderapi.version>master-SNAPSHOT</mvdwplaceholderapi.version>
@@ -81,7 +81,7 @@
8181
<!-- Do not change unless you want different name for local builds. -->
8282
<build.number>-1.13.2-LOCAL</build.number>
8383
<!-- This allows to change between versions. -->
84-
<build.version>1.11.1</build.version>
84+
<build.version>1.12.0</build.version>
8585
</properties>
8686

8787
<!-- Profiles will allow to automatically change build version. -->

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

+5-2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
*/
1515
public class BStats {
1616

17+
private static final int BSTATS_ID = 3555;
18+
1719
private final BentoBox plugin;
1820
private Metrics metrics;
1921

@@ -30,7 +32,7 @@ public class BStats {
3032

3133
void registerMetrics() {
3234
if (metrics == null) {
33-
metrics = new Metrics(plugin);
35+
metrics = new Metrics(plugin, BSTATS_ID);
3436
registerCustomMetrics();
3537
}
3638
}
@@ -133,7 +135,8 @@ private void registerPlayersPerServerChart() {
133135
else if (players <= 30) return "11-30";
134136
else if (players <= 50) return "31-50";
135137
else if (players <= 100) return "51-100";
136-
else if (players <= 200) return "101-200";
138+
else if (players <= 150) return "101-150";
139+
else if (players <= 200) return "151-200";
137140
else return "201+";
138141
}));
139142
}

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

+2-4
Original file line numberDiff line numberDiff line change
@@ -195,10 +195,8 @@ public void onEnable(){
195195
flagsManager.registerListeners();
196196

197197
// Load metrics
198-
if (settings.isMetrics()) {
199-
metrics = new BStats(this);
200-
metrics.registerMetrics();
201-
}
198+
metrics = new BStats(this);
199+
metrics.registerMetrics();
202200

203201
// Register Multiverse hook - MV loads AFTER BentoBox
204202
// Make sure all worlds are already registered to Multiverse.

src/main/java/world/bentobox/bentobox/Settings.java

+23-15
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
@ConfigComment("This configuration file contains settings that mainly apply to or manage the following elements:")
2020
@ConfigComment(" * Data storage")
2121
@ConfigComment(" * Gamemodes (commands, ...)")
22-
@ConfigComment(" * Internet connectivity (metrics, web-based content-enriched features, ...)")
22+
@ConfigComment(" * Internet connectivity (web-based content-enriched features, ...)")
2323
@ConfigComment("")
2424
@ConfigComment("Note that this configuration file is dynamic:")
2525
@ConfigComment(" * It gets updated with the newest settings and comments after BentoBox loaded its settings from it.")
@@ -93,6 +93,10 @@ public class Settings implements ConfigObject {
9393
@ConfigEntry(path = "general.database.backup-period")
9494
private int databaseBackupPeriod = 5;
9595

96+
@ConfigComment("Enable SSL connection to MongoDB, MariaDB, MySQL and PostgreSQL databases.")
97+
@ConfigEntry(path = "general.database.use-ssl", since = "1.12.0")
98+
private boolean useSSL = false;
99+
96100
@ConfigComment("Allow FTB Autonomous Activator to work (will allow a pseudo player [CoFH] to place and break blocks and hang items)")
97101
@ConfigComment("Add other fake player names here if required")
98102
@ConfigEntry(path = "general.fakeplayers", experimental = true)
@@ -223,12 +227,6 @@ public class Settings implements ConfigObject {
223227
private boolean autoOwnershipTransferIgnoreRanks = false;
224228

225229
/* WEB */
226-
@ConfigComment("BentoBox uses bStats.org to get global data about the plugin to help improving it.")
227-
@ConfigComment("bStats has nearly no effect on your server's performance and the sent data is completely")
228-
@ConfigComment("anonymous so please consider twice if you really want to disable it.")
229-
@ConfigEntry(path = "web.metrics")
230-
private boolean metrics = true;
231-
232230
@ConfigComment("Toggle whether BentoBox can connect to GitHub to get data about updates and addons.")
233231
@ConfigComment("Disabling this will result in the deactivation of the update checker and of some other")
234232
@ConfigComment("features that rely on the data downloaded from the GitHub API.")
@@ -252,14 +250,6 @@ public class Settings implements ConfigObject {
252250
// ---------------------------------------------
253251
// Getters and setters
254252

255-
public boolean isMetrics() {
256-
return metrics;
257-
}
258-
259-
public void setMetrics(boolean metrics) {
260-
this.metrics = metrics;
261-
}
262-
263253
public String getDefaultLanguage() {
264254
return defaultLanguage;
265255
}
@@ -296,6 +286,24 @@ public int getDatabasePort() {
296286
return databasePort;
297287
}
298288

289+
/**
290+
* This method returns the useSSL value.
291+
* @return the value of useSSL.
292+
* @since 1.12.0
293+
*/
294+
public boolean isUseSSL() {
295+
return useSSL;
296+
}
297+
298+
/**
299+
* This method sets the useSSL value.
300+
* @param useSSL the useSSL new value.
301+
* @since 1.12.0
302+
*/
303+
public void setUseSSL(boolean useSSL) {
304+
this.useSSL = useSSL;
305+
}
306+
299307
public void setDatabasePort(int databasePort) {
300308
this.databasePort = databasePort;
301309
}

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

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import java.io.IOException;
55
import java.io.InputStream;
66
import java.io.InputStreamReader;
7+
import java.nio.file.StandardCopyOption;
78
import java.util.HashMap;
89
import java.util.Map;
910
import java.util.Optional;
@@ -270,7 +271,7 @@ public File saveResource(String jarResource, File destinationFolder, boolean rep
270271
// Make any dirs that need to be made
271272
outFile.getParentFile().mkdirs();
272273
if (!outFile.exists() || replace) {
273-
java.nio.file.Files.copy(in, outFile.toPath());
274+
java.nio.file.Files.copy(in, outFile.toPath(), StandardCopyOption.REPLACE_EXISTING);
274275
}
275276
return outFile;
276277
}

src/main/java/world/bentobox/bentobox/api/commands/admin/AdminDeleteCommand.java

+10
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010

1111
import world.bentobox.bentobox.api.commands.CompositeCommand;
1212
import world.bentobox.bentobox.api.commands.ConfirmableCommand;
13+
import world.bentobox.bentobox.api.events.island.IslandEvent;
14+
import world.bentobox.bentobox.api.events.island.IslandEvent.Reason;
1315
import world.bentobox.bentobox.api.localization.TextVariables;
1416
import world.bentobox.bentobox.api.user.User;
1517
import world.bentobox.bentobox.database.objects.Island;
@@ -72,6 +74,14 @@ private void deletePlayer(User user, UUID targetUUID) {
7274
Island oldIsland = getIslands().getIsland(getWorld(), targetUUID);
7375
Vector vector = null;
7476
if (oldIsland != null) {
77+
// Fire island preclear event
78+
IslandEvent.builder()
79+
.involvedPlayer(user.getUniqueId())
80+
.reason(Reason.PRECLEAR)
81+
.island(oldIsland)
82+
.oldIsland(oldIsland)
83+
.location(oldIsland.getCenter())
84+
.build();
7585
// Check if player is online and on the island
7686
User target = User.getInstance(targetUUID);
7787
// Remove them from this island (it still exists and will be deleted later)

src/main/java/world/bentobox/bentobox/api/commands/admin/AdminSetspawnCommand.java

+2
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ private void setSpawn(User user, Island i) {
7272
}
7373
getIslands().setSpawn(i);
7474
i.setSpawnPoint(World.Environment.NORMAL, user.getLocation());
75+
// Set the island's range to the full island space because it is spawn
76+
i.setProtectionRange(i.getRange());
7577
user.sendMessage("commands.admin.setspawn.success");
7678
}
7779
}

src/main/java/world/bentobox/bentobox/api/commands/admin/AdminVersionCommand.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
public class AdminVersionCommand extends CompositeCommand {
1010

1111
public AdminVersionCommand(CompositeCommand adminCommand) {
12-
super(adminCommand, "version", "v");
12+
super(adminCommand, "version", "v", "ver");
1313
}
1414

1515
@Override

src/main/java/world/bentobox/bentobox/api/commands/admin/team/AdminTeamDisbandCommand.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public boolean execute(User user, String label, List<String> args) {
5757
TeamEvent.builder()
5858
.island(island)
5959
.reason(TeamEvent.Reason.KICK)
60-
.involvedPlayer(targetUUID)
60+
.involvedPlayer(m)
6161
.admin(true)
6262
.build();
6363
}

src/main/java/world/bentobox/bentobox/api/commands/island/IslandResetCommand.java

+13-2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import world.bentobox.bentobox.api.addons.GameModeAddon;
1010
import world.bentobox.bentobox.api.commands.CompositeCommand;
1111
import world.bentobox.bentobox.api.commands.ConfirmableCommand;
12+
import world.bentobox.bentobox.api.events.island.IslandEvent;
1213
import world.bentobox.bentobox.api.events.island.IslandEvent.Reason;
1314
import world.bentobox.bentobox.api.events.team.TeamEvent;
1415
import world.bentobox.bentobox.api.localization.TextVariables;
@@ -115,11 +116,21 @@ private void selectBundle(@NonNull User user, @NonNull String label) {
115116
}
116117

117118
private boolean resetIsland(User user, String name) {
118-
// Reset the island
119-
user.sendMessage("commands.island.create.creating-island");
120119
// Get the player's old island
121120
Island oldIsland = getIslands().getIsland(getWorld(), user);
122121

122+
// Fire island preclear event
123+
IslandEvent.builder()
124+
.involvedPlayer(user.getUniqueId())
125+
.reason(Reason.PRECLEAR)
126+
.island(oldIsland)
127+
.oldIsland(oldIsland)
128+
.location(oldIsland.getCenter())
129+
.build();
130+
131+
// Reset the island
132+
user.sendMessage("commands.island.create.creating-island");
133+
123134
// Kick all island members (including the owner)
124135
kickMembers(oldIsland);
125136

src/main/java/world/bentobox/bentobox/api/configuration/ConfigEntry.java

+7
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,11 @@
3030
* @since 1.5.3
3131
*/
3232
String video() default "";
33+
34+
/**
35+
* Sets whether this config entry requires restarting the server in order to take changes into account.
36+
* @return {@code true} if this config entry requires restarting the server in order to take changes into account, {@code false} otherwise.
37+
* @since 1.12.0
38+
*/
39+
boolean needsRestart() default false;
3340
}

src/main/java/world/bentobox/bentobox/api/configuration/WorldSettings.java

+11
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package world.bentobox.bentobox.api.configuration;
22

3+
import java.util.ArrayList;
34
import java.util.Collections;
45
import java.util.List;
56
import java.util.Map;
@@ -313,6 +314,15 @@ default List<String> getFallingBannedCommands() {
313314
*/
314315
List<String> getGeoLimitSettings();
315316

317+
/**
318+
* Get list of entities that should not spawn in this game mode
319+
* @return list of entities that should NOT spawn
320+
* @since 1.12.0
321+
*/
322+
default List<String> getMobLimitSettings() {
323+
return new ArrayList<>();
324+
}
325+
316326
/**
317327
* @return reset limit for world
318328
*/
@@ -440,4 +450,5 @@ default boolean isPasteMissingIslands() {
440450
default boolean isTeleportPlayerToIslandUponIslandCreation() {
441451
return true;
442452
}
453+
443454
}

0 commit comments

Comments
 (0)