diff --git a/pom.xml b/pom.xml
index 981054aa8..329505f39 100644
--- a/pom.xml
+++ b/pom.xml
@@ -83,7 +83,7 @@
-LOCAL
- 1.20.0
+ 1.20.1
bentobox-world
https://sonarcloud.io
diff --git a/src/main/java/world/bentobox/bentobox/api/commands/island/team/IslandTeamInviteAcceptCommand.java b/src/main/java/world/bentobox/bentobox/api/commands/island/team/IslandTeamInviteAcceptCommand.java
index ed543bce2..bc5ceb271 100644
--- a/src/main/java/world/bentobox/bentobox/api/commands/island/team/IslandTeamInviteAcceptCommand.java
+++ b/src/main/java/world/bentobox/bentobox/api/commands/island/team/IslandTeamInviteAcceptCommand.java
@@ -20,6 +20,7 @@ import world.bentobox.bentobox.util.Util;
*/
public class IslandTeamInviteAcceptCommand extends ConfirmableCommand {
+ private static final String INVALID_INVITE = "commands.island.team.invite.errors.invalid-invite";
private final IslandTeamCommand itc;
private UUID playerUUID;
private UUID prospectiveOwnerUUID;
@@ -47,7 +48,7 @@ public class IslandTeamInviteAcceptCommand extends ConfirmableCommand {
// Get the island owner
prospectiveOwnerUUID = itc.getInviter(playerUUID);
if (prospectiveOwnerUUID == null) {
- user.sendMessage("commands.island.team.invite.errors.invalid-invite");
+ user.sendMessage(INVALID_INVITE);
return false;
}
Invite invite = itc.getInvite(playerUUID);
@@ -56,7 +57,7 @@ public class IslandTeamInviteAcceptCommand extends ConfirmableCommand {
Island island = getIslands().getIsland(getWorld(), prospectiveOwnerUUID);
String inviteUsage = getParent().getSubCommand("invite").map(CompositeCommand::getUsage).orElse("");
if (island == null || island.getRank(prospectiveOwnerUUID) < island.getRankCommand(inviteUsage)) {
- user.sendMessage("commands.island.team.invite.errors.invalid-invite");
+ user.sendMessage(INVALID_INVITE);
itc.removeInvite(playerUUID);
return false;
}
@@ -149,7 +150,7 @@ public class IslandTeamInviteAcceptCommand extends ConfirmableCommand {
// Get the team's island
Island teamIsland = getIslands().getIsland(getWorld(), prospectiveOwnerUUID);
if (teamIsland == null) {
- user.sendMessage("commands.island.team.invite.errors.invalid-invite");
+ user.sendMessage(INVALID_INVITE);
return;
}
if (teamIsland.getMemberSet(RanksManager.MEMBER_RANK, true).size() > getIslands().getMaxMembers(teamIsland, RanksManager.MEMBER_RANK)) {
diff --git a/src/main/java/world/bentobox/bentobox/api/commands/island/team/IslandTeamKickCommand.java b/src/main/java/world/bentobox/bentobox/api/commands/island/team/IslandTeamKickCommand.java
index 2aab070fa..44ca46783 100644
--- a/src/main/java/world/bentobox/bentobox/api/commands/island/team/IslandTeamKickCommand.java
+++ b/src/main/java/world/bentobox/bentobox/api/commands/island/team/IslandTeamKickCommand.java
@@ -42,10 +42,6 @@ public class IslandTeamKickCommand extends ConfirmableCommand {
user.sendMessage("general.errors.no-team");
return false;
}
- if (!user.getUniqueId().equals(getOwner(getWorld(), user))) {
- user.sendMessage("general.errors.not-owner");
- return false;
- }
// Check rank to use command
Island island = getIslands().getIsland(getWorld(), user);
int rank = Objects.requireNonNull(island).getRank(user);
@@ -72,6 +68,14 @@ public class IslandTeamKickCommand extends ConfirmableCommand {
user.sendMessage("general.errors.not-in-team");
return false;
}
+
+ int targetRank = Objects.requireNonNull(island).getRank(targetUUID);
+ if (rank <= targetRank) {
+ user.sendMessage("commands.island.team.kick.cannot-kick-rank",
+ TextVariables.NAME, getPlayers().getName(targetUUID));
+ return false;
+ }
+
if (!getSettings().isKickConfirmation()) {
kick(user, targetUUID);
return true;
@@ -93,7 +97,9 @@ public class IslandTeamKickCommand extends ConfirmableCommand {
if (event.isCancelled()) {
return;
}
- target.sendMessage("commands.island.team.kick.owner-kicked", TextVariables.GAMEMODE, getAddon().getDescription().getName());
+ target.sendMessage("commands.island.team.kick.player-kicked",
+ TextVariables.GAMEMODE, getAddon().getDescription().getName(),
+ TextVariables.NAME, user.getName());
getIslands().removePlayer(getWorld(), targetUUID);
// Clean the target player
diff --git a/src/main/java/world/bentobox/bentobox/api/panels/reader/TemplateReader.java b/src/main/java/world/bentobox/bentobox/api/panels/reader/TemplateReader.java
index d98d501ad..4407ae8d2 100644
--- a/src/main/java/world/bentobox/bentobox/api/panels/reader/TemplateReader.java
+++ b/src/main/java/world/bentobox/bentobox/api/panels/reader/TemplateReader.java
@@ -41,6 +41,12 @@ public class TemplateReader
private static final String BORDER = "border";
private static final String FORCE_SHOWN = "force-shown";
private static final String FALLBACK = "fallback";
+ private static final String YML = ".yml";
+ private static final String ACTIONS = "actions";
+ private static final String TOOLTIP = "tooltip";
+ private static final String CLICK_TYPE = "click-type";
+ private static final String CONTENT = "content";
+ private static final String TYPE = "type";
/**
@@ -73,7 +79,7 @@ public class TemplateReader
return null;
}
- File file = new File(panelLocation, templateName.endsWith(".yml") ? templateName : templateName + ".yml");
+ File file = new File(panelLocation, templateName.endsWith(YML) ? templateName : templateName + YML);
if (!file.exists())
{
@@ -82,7 +88,7 @@ public class TemplateReader
}
final String panelKey = file.getAbsolutePath() + ":" + panelName;
-
+
// Check if panel is already crafted.
if (TemplateReader.loadedPanels.containsKey(panelKey))
{
@@ -125,7 +131,7 @@ public class TemplateReader
String title = configurationSection.getString(TITLE);
Panel.Type type =
- Enums.getIfPresent(Panel.Type.class, configurationSection.getString("type", "INVENTORY")).
+ Enums.getIfPresent(Panel.Type.class, configurationSection.getString(TYPE, "INVENTORY")).
or(Panel.Type.INVENTORY);
PanelTemplateRecord.TemplateItem borderItem = null;
@@ -194,7 +200,7 @@ public class TemplateReader
PanelTemplateRecord template = new PanelTemplateRecord(type, title, borderItem, backgroundItem, forcedRows);
// Read content
- ConfigurationSection content = configurationSection.getConfigurationSection("content");
+ ConfigurationSection content = configurationSection.getConfigurationSection(CONTENT);
if (content == null)
{
@@ -219,7 +225,7 @@ public class TemplateReader
// If it contains a section, then build a new button template from it.
template.addButtonTemplate(rowIndex,
columnIndex,
- readPanelItemTemplate(line.getConfigurationSection(String.valueOf(columnIndex + 1))));
+ readPanelItemTemplate(line.getConfigurationSection(String.valueOf(columnIndex + 1)), null, panelItemDataMap));
}
else if (line.isString(String.valueOf(columnIndex + 1)))
{
@@ -337,9 +343,9 @@ public class TemplateReader
}
// Read Click data
- if (section.isConfigurationSection("actions"))
+ if (section.isConfigurationSection(ACTIONS))
{
- ConfigurationSection actionSection = section.getConfigurationSection("actions");
+ ConfigurationSection actionSection = section.getConfigurationSection(ACTIONS);
if (actionSection != null)
{
@@ -354,9 +360,9 @@ public class TemplateReader
{
ItemTemplateRecord.ActionRecords actionData =
new ItemTemplateRecord.ActionRecords(clickType,
- actionDataSection.getString("type"),
- actionDataSection.getString("content"),
- actionDataSection.getString("tooltip"));
+ actionDataSection.getString(TYPE),
+ actionDataSection.getString(CONTENT),
+ actionDataSection.getString(TOOLTIP));
itemRecord.addAction(actionData);
}
}
@@ -364,42 +370,42 @@ public class TemplateReader
{
ConfigurationSection actionDataSection = actionSection.getConfigurationSection(actionKey);
- if (actionDataSection != null && actionDataSection.contains("click-type"))
+ if (actionDataSection != null && actionDataSection.contains(CLICK_TYPE))
{
clickType = Enums.getIfPresent(ClickType.class,
- actionDataSection.getString("click-type", "UNKNOWN").toUpperCase()).
- or(ClickType.UNKNOWN);
-
+ actionDataSection.getString(CLICK_TYPE, "UNKNOWN").toUpperCase()).
+ or(ClickType.UNKNOWN);
+
ItemTemplateRecord.ActionRecords actionData =
- new ItemTemplateRecord.ActionRecords(clickType,
- actionKey,
- actionDataSection.getString("content"),
- actionDataSection.getString("tooltip"));
+ new ItemTemplateRecord.ActionRecords(clickType,
+ actionKey,
+ actionDataSection.getString(CONTENT),
+ actionDataSection.getString(TOOLTIP));
itemRecord.addAction(actionData);
}
}
});
}
}
- else if (section.isList("actions"))
+ else if (section.isList(ACTIONS))
{
// Read Click data as list which allows to have duplicate click types.
- List