Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 3.0.1 #2564

Merged
merged 48 commits into from
Nov 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
12109eb
Fix parrot interaction condition
Dreeam-qwq Oct 30, 2024
4747c90
Update de.yml
Archerymaister Nov 3, 2024
2c9865d
Update de.yml
Archerymaister Nov 4, 2024
51b9f47
Update de.yml
Archerymaister Nov 5, 2024
6dd87f6
Update to 1.21.3
tastybento Nov 6, 2024
ab47870
Version 2.7.1
tastybento Nov 6, 2024
e761d65
Merge pull request #2543 from Dreeam-qwq/fix/parrot-interact
tastybento Nov 6, 2024
6863f28
Shift API to 1.21 only.
tastybento Nov 6, 2024
9d7dbb7
Merge pull request #2548 from BentoBoxWorld/1.21.3_update
tastybento Nov 6, 2024
d8a7385
Update de.yml
Archerymaister Nov 6, 2024
36a60fa
Merge branch 'BentoBoxWorld:develop' into develop
Archerymaister Nov 6, 2024
cd40d27
Switch distribution management for CI codemc
tastybento Nov 6, 2024
c71bb8a
Merge branch 'develop' into develop
Archerymaister Nov 7, 2024
058fb6e
Use custom server to handle new enums
tastybento Nov 8, 2024
04ebe61
Add a slash to the end of the deploy
tastybento Nov 8, 2024
c77da07
Merge pull request #2550 from BentoBoxWorld/custom_server
tastybento Nov 8, 2024
d5219ed
Merge branch 'develop' into develop
Archerymaister Nov 8, 2024
6b095ab
Rename distro
tastybento Nov 8, 2024
57ce3c5
Merge pull request #2549 from Archerymaister/develop
tastybento Nov 8, 2024
44593bf
Remove debug
tastybento Nov 8, 2024
2ee6d60
Merge branch 'develop' of https://github.com/BentoBoxWorld/BentoBox.g…
tastybento Nov 8, 2024
4008815
Update to use BentoBox logging.
tastybento Nov 9, 2024
6a1561a
Deployment POM changes
tastybento Nov 9, 2024
d339edf
Change to 3.0.0
tastybento Nov 11, 2024
b135484
Adds island history for team members adding and removing
tastybento Nov 11, 2024
3870b20
Merge pull request #2553 from BentoBoxWorld/more_island_history
tastybento Nov 11, 2024
9fcee44
Fix tests
tastybento Nov 11, 2024
626b215
Make island info show min and max world heights
tastybento Nov 13, 2024
f19ca99
Explicitly save panels from Jar.
tastybento Nov 15, 2024
d665398
Save panels explicitly
tastybento Nov 15, 2024
471b198
Merge pull request #2552 from BentoBoxWorld/2.7.0_Short_term_stable
tastybento Nov 15, 2024
48aef16
Merge branch 'develop' into 3.0.0-update
tastybento Nov 15, 2024
0410ddb
Add the protection flag for eggHit.
Noogear Nov 16, 2024
01eaea9
Merge pull request #2555 from BentoBoxWorld/3.0.0-update
tastybento Nov 17, 2024
50b5118
Admin kick to kick from all teams
tastybento Nov 17, 2024
1f822f2
Merge pull request #2557 from Noogear/fix/eggHit
tastybento Nov 17, 2024
aac7963
Merge branch 'develop' into multi_island_aware_admin_team_commands
tastybento Nov 18, 2024
62c0d71
Prevent an error throw with UNKNOWN
tastybento Nov 23, 2024
02d69b8
Added test cases.
tastybento Nov 23, 2024
58dfca6
Fix for #2546. Default unnamed home was being counted in the number
tastybento Nov 23, 2024
8e3a6ab
Merge pull request #2561 from BentoBoxWorld/2546_Max_homes_limit_for_…
tastybento Nov 23, 2024
48a9053
Added backwards compatibility for the logging
tastybento Nov 25, 2024
fe08e37
Added more log entry types
tastybento Nov 25, 2024
d0cdeb1
Another log entry RESET_ALL
tastybento Nov 25, 2024
1b75a2a
Okay, back to allowing custom types
tastybento Nov 25, 2024
74312b2
Version 3.0.1
tastybento Nov 26, 2024
2fedb88
Merge pull request #2559 from BentoBoxWorld/multi_island_aware_admin_…
tastybento Nov 26, 2024
55daa72
Change admin kick command to just kick from all teams.
tastybento Nov 26, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,9 @@
</issueManagement>

<distributionManagement>
<snapshotRepository>
<id>codemc-snapshots</id>
<url>https://repo.codemc.org/repository/maven-snapshots</url>
</snapshotRepository>
<repository>
<id>codemc-releases</id>
<url>https://repo.codemc.org/repository/maven-releases</url>
<id>bentoboxworld</id>
<url>https://repo.codemc.org/repository/bentoboxworld/</url>
</repository>
</distributionManagement>

Expand Down Expand Up @@ -88,7 +84,7 @@
<!-- Do not change unless you want different name for local builds. -->
<build.number>-LOCAL</build.number>
<!-- This allows to change between versions. -->
<build.version>2.7.0</build.version>
<build.version>3.0.1</build.version>
<sonar.organization>bentobox-world</sonar.organization>
<sonar.host.url>https://sonarcloud.io</sonar.host.url>
<server.jars>${project.basedir}/lib</server.jars>
Expand Down
28 changes: 28 additions & 0 deletions src/main/java/world/bentobox/bentobox/BentoBox.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package world.bentobox.bentobox;

import java.nio.file.Files;
import java.nio.file.Path;
import java.util.List;
import java.util.Optional;

Expand Down Expand Up @@ -464,6 +466,32 @@ public boolean loadSettings() {
getPluginLoader().disablePlugin(this);
return false;
}
log("Saving default panels...");

if (!Files.exists(Path.of(this.getDataFolder().getPath(), "panels", "island_creation_panel.yml"))) {
log("Saving default island_creation_panel...");
this.saveResource("panels/island_creation_panel.yml", false);
}

if (!Files.exists(Path.of(this.getDataFolder().getPath(), "panels", "language_panel.yml"))) {
log("Saving default language_panel...");
this.saveResource("panels/language_panel.yml", false);
}

if (!Files.exists(Path.of(this.getDataFolder().getPath(), "panels", "island_homes_panel.yml"))) {
log("Saving default island_homes_panel...");
this.saveResource("panels/island_homes_panel.yml", false);
}

if (!Files.exists(Path.of(this.getDataFolder().getPath(), "panels", "team_invite_panel.yml"))) {
log("Saving default team_invite_panel...");
this.saveResource("panels/team_invite_panel.yml", false);
}

if (!Files.exists(Path.of(this.getDataFolder().getPath(), "panels", "team_panel.yml"))) {
log("Saving default team_panel...");
this.saveResource("panels/team_panel.yml", false);
}

return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import world.bentobox.bentobox.api.events.island.IslandEvent;
import world.bentobox.bentobox.api.localization.TextVariables;
import world.bentobox.bentobox.api.logs.LogEntry;
import world.bentobox.bentobox.api.logs.LogEntry.LogType;
import world.bentobox.bentobox.api.user.User;
import world.bentobox.bentobox.database.objects.Island;
import world.bentobox.bentobox.managers.RanksManager;
Expand Down Expand Up @@ -115,10 +116,10 @@ void unregisterIsland(User user) {
// Remove all island players that reference this island
targetIsland.getMembers().clear();
if (user.isPlayer()) {
targetIsland.log(new LogEntry.Builder("UNREGISTER").data("player", targetUUID.toString())
targetIsland.log(new LogEntry.Builder(LogType.UNREGISTER).data("player", targetUUID.toString())
.data("admin", user.getUniqueId().toString()).build());
} else {
targetIsland.log(new LogEntry.Builder("UNREGISTER").data("player", targetUUID.toString())
targetIsland.log(new LogEntry.Builder(LogType.UNREGISTER).data("player", targetUUID.toString())
.data("admin", "console").build());
}
user.sendMessage("commands.admin.unregister.unregistered-island", TextVariables.XYZ, Util.xyz(targetIsland.getCenter().toVector()),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import world.bentobox.bentobox.api.user.User;
import world.bentobox.bentobox.database.objects.Island;
import world.bentobox.bentobox.managers.RanksManager;
import world.bentobox.bentobox.util.IslandInfo;
import world.bentobox.bentobox.util.Util;

/**
Expand Down Expand Up @@ -59,35 +58,28 @@ public boolean canExecute(User user, String label, List<String> args) {

@Override
public boolean execute(User user, String label, @NonNull List<String> args) {
Island island = getIslands().getIsland(getWorld(), targetUUID);
if (island == null) {
List<Island> islands = getIslands().getIslands(getWorld(), targetUUID);
if (islands.isEmpty()) {
return false;
}
if (targetUUID.equals(island.getOwner())) {
user.sendMessage("commands.admin.team.kick.cannot-kick-owner");
new IslandInfo(island).showMembers(user);
return false;
}
User target = User.getInstance(targetUUID);
target.sendMessage("commands.admin.team.kick.admin-kicked");
islands.forEach(island -> {
if (!user.getUniqueId().equals(island.getOwner())) {
User target = User.getInstance(targetUUID);
target.sendMessage("commands.admin.team.kick.admin-kicked");

getIslands().removePlayer(island, targetUUID);
user.sendMessage("commands.admin.team.kick.success", TextVariables.NAME, target.getName(), "[owner]", getPlayers().getName(island.getOwner()));
getIslands().removePlayer(island, targetUUID);
user.sendMessage("commands.admin.team.kick.success", TextVariables.NAME, target.getName(), "[owner]",
getPlayers().getName(island.getOwner()));
// Fire event so add-ons know
TeamEvent.builder().island(island).reason(TeamEvent.Reason.KICK).involvedPlayer(targetUUID).admin(true)
.build();
IslandEvent.builder().island(island).involvedPlayer(targetUUID).admin(true)
.reason(IslandEvent.Reason.RANK_CHANGE)
.rankChange(island.getRank(target), RanksManager.VISITOR_RANK).build();
}
});
user.sendMessage("commands.admin.team.kick.success-all");

// Fire event so add-ons know
TeamEvent.builder()
.island(island)
.reason(TeamEvent.Reason.KICK)
.involvedPlayer(targetUUID)
.admin(true)
.build();
IslandEvent.builder()
.island(island)
.involvedPlayer(targetUUID)
.admin(true)
.reason(IslandEvent.Reason.RANK_CHANGE)
.rankChange(island.getRank(target), RanksManager.VISITOR_RANK)
.build();
return true;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ public boolean canExecute(User user, String label, List<String> args) {
// Check number of homes

int maxHomes = getIslands().getMaxHomes(island);
if (getIslands().getNumberOfHomesIfAdded(island, String.join(" ", args)) > maxHomes) {
// The + 1 is for the default home
if (getIslands().getNumberOfHomesIfAdded(island, String.join(" ", args)) > maxHomes + 1) {
user.sendMessage("commands.island.sethome.too-many-homes", TextVariables.NUMBER, String.valueOf(maxHomes));
user.sendMessage("commands.island.sethome.homes-are");
getIslands().getIslands(getWorld(), user).forEach(is ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
import world.bentobox.bentobox.api.events.island.IslandEvent;
import world.bentobox.bentobox.api.events.team.TeamEvent;
import world.bentobox.bentobox.api.localization.TextVariables;
import world.bentobox.bentobox.api.logs.LogEntry;
import world.bentobox.bentobox.api.logs.LogEntry.LogType;
import world.bentobox.bentobox.api.user.User;
import world.bentobox.bentobox.database.objects.Island;
import world.bentobox.bentobox.database.objects.TeamInvite;
Expand Down Expand Up @@ -120,6 +122,9 @@ void acceptTrustInvite(User user, TeamInvite invite) {
user.sendMessage("commands.island.team.trust.you-are-trusted", TextVariables.NAME, inviter.getName(),
TextVariables.DISPLAY_NAME, inviter.getDisplayName());
}
// Add historu record
island.log(new LogEntry.Builder(LogType.TRUSTED).data(user.getUniqueId().toString(), "trusted")
.data(invite.getInviter().toString(), "trusted by").build());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
import world.bentobox.bentobox.api.events.island.IslandEvent;
import world.bentobox.bentobox.api.events.team.TeamEvent;
import world.bentobox.bentobox.api.localization.TextVariables;
import world.bentobox.bentobox.api.logs.LogEntry;
import world.bentobox.bentobox.api.logs.LogEntry.LogType;
import world.bentobox.bentobox.api.user.User;
import world.bentobox.bentobox.database.objects.Island;
import world.bentobox.bentobox.managers.RanksManager;
Expand Down Expand Up @@ -91,6 +93,9 @@ protected boolean setOwner(User user, @NonNull UUID targetUUID2) {
IslandEvent.builder().island(island).involvedPlayer(user.getUniqueId()).admin(false)
.reason(IslandEvent.Reason.RANK_CHANGE).rankChange(RanksManager.OWNER_RANK, RanksManager.SUB_OWNER_RANK)
.build();
// Add historu record
island.log(new LogEntry.Builder(LogType.NEWOWNER).data(targetUUID2.toString(), "new owner")
.data(user.getUniqueId().toString(), "old owner").build());
return true;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@

import world.bentobox.bentobox.api.commands.CompositeCommand;
import world.bentobox.bentobox.api.localization.TextVariables;
import world.bentobox.bentobox.api.logs.LogEntry;
import world.bentobox.bentobox.api.logs.LogEntry.LogType;
import world.bentobox.bentobox.api.user.User;
import world.bentobox.bentobox.database.objects.Island;
import world.bentobox.bentobox.database.objects.TeamInvite.Type;
Expand Down Expand Up @@ -110,6 +112,10 @@ public boolean execute(User user, String label, List<String> args) {
island.setRank(target, RanksManager.TRUSTED_RANK);
user.sendMessage("commands.island.team.trust.success", TextVariables.NAME, target.getName(), TextVariables.DISPLAY_NAME, target.getDisplayName());
target.sendMessage("commands.island.team.trust.you-are-trusted", TextVariables.NAME, user.getName(), TextVariables.DISPLAY_NAME, user.getDisplayName());
// Add historu record
island.log(new LogEntry.Builder(LogType.TRUSTED).data(targetUUID.toString(), "trusted")
.data(user.getUniqueId().toString(), "trusted by").build());

}
return true;
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import java.util.List;
import java.util.logging.Logger;

import org.apache.commons.lang.exception.ExceptionUtils;
import org.eclipse.jdt.annotation.Nullable;

import world.bentobox.bentobox.BentoBox;
Expand Down Expand Up @@ -64,9 +63,9 @@ public T loadConfigObject(String uniqueId) {
return handler.loadObject(uniqueId);
} catch (InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException
| ClassNotFoundException | IntrospectionException | NoSuchMethodException | SecurityException e) {
logger.severe(() -> "Could not load config object! " + e.getMessage());
BentoBox.getInstance().logError("Could not load config object! " + e.getMessage());
// Required for debugging
logger.severe(ExceptionUtils.getStackTrace(e));
e.printStackTrace();
}

return null;
Expand Down
107 changes: 100 additions & 7 deletions src/main/java/world/bentobox/bentobox/api/logs/LogEntry.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package world.bentobox.bentobox.api.logs;

import java.util.LinkedHashMap;
import java.util.Locale;
import java.util.Map;

import org.eclipse.jdt.annotation.NonNull;
Expand All @@ -15,28 +14,110 @@
* An {@link world.bentobox.bentobox.database.objects.adapters.AdapterInterface AdapterInterface} is provided to be able to save/retrieve
* a list of instances of this object to/from the database: {@link world.bentobox.bentobox.database.objects.adapters.LogEntryListAdapter LogEntryListAdapter}.
*
* @author Poslovitch
* @author Poslovitch, tastybento
*
*/
public class LogEntry {
@Expose
private final long timestamp;
@Expose
private final String type;
private final LogType type;
@Expose
private final String customType;
@Expose
private final Map<String, String> data;

/**
* This is a log enum. If you are a developer and need more make a PR. Or use the string one.
*/
public enum LogType {
/**
* Something removed
*/
REMOVE,
/**
* Something added
*/
ADD,
/**
* Island unregistered
*/
UNREGISTER,
/**
* Player banned
*/
BAN,
/**
* Something was completed
*/
COMPELTE,
/**
* Island became unowned
*/
UNOWNED,
/**
* Island became spawn
*/
SPAWN,
/**
* Player unbanned
*/
UNBAN,
/**
* Player joined
*/
JOINED,
/**
* New owner made
*/
NEWOWNER,
/**
* Player trusted
*/
TRUSTED,
/**
* Player cooped
*/
COOP,
/**
* Unknown reason
*/
UNKNOWN,
/**
* Island reset or a reset of some kind
*/
RESET,
/**
* Everything was reset
*/
RESET_ALL,
/**
* New thing
*/
NEW,
/**
* Something duplicated
*/
DUPLICATE,
/**
* General info
*/
INFO,
}

private LogEntry(@NonNull Builder builder) {
this.timestamp = builder.timestamp;
this.type = builder.type;
this.data = builder.data;
this.customType = builder.customType;
}

public long getTimestamp() {
return timestamp;
}

@NonNull
public String getType() {
public LogType getType() {
return type;
}

Expand All @@ -47,13 +128,25 @@ public Map<String, String> getData() {

public static class Builder {
private long timestamp;
private final String type;
private final LogType type;
private Map<String, String> data;
private final String customType;

public Builder(@NonNull String type) {
public Builder(LogType type) {
this.timestamp = System.currentTimeMillis();
this.type = type;
this.data = new LinkedHashMap<>();
this.customType = null;
}

/**
* @param customType log type
*/
public Builder(String customType) {
this.timestamp = System.currentTimeMillis();
this.type = type.toUpperCase(Locale.ENGLISH);
this.type = LogType.UNKNOWN;
this.data = new LinkedHashMap<>();
this.customType = customType;
}

public Builder timestamp(long timestamp) {
Expand Down
Loading