mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2024-11-26 04:35:43 +01:00
Fix to avoid admins becoming subowners when registering an island.
This commit is contained in:
parent
0e0c502e1d
commit
54a7b8b0f2
@ -79,7 +79,7 @@ public class AdminRegisterCommand extends ConfirmableCommand {
|
|||||||
// Register island if it exists
|
// Register island if it exists
|
||||||
if (!island.map(i -> {
|
if (!island.map(i -> {
|
||||||
// Island exists
|
// Island exists
|
||||||
getIslands().setOwner(user, targetUUID, i);
|
getIslands().setOwner(user, targetUUID, i, RanksManager.VISITOR_RANK);
|
||||||
if (i.isSpawn()) {
|
if (i.isSpawn()) {
|
||||||
getIslands().clearSpawn(i.getWorld());
|
getIslands().clearSpawn(i.getWorld());
|
||||||
}
|
}
|
||||||
@ -111,7 +111,7 @@ public class AdminRegisterCommand extends ConfirmableCommand {
|
|||||||
user.sendMessage("commands.admin.register.cannot-make-island");
|
user.sendMessage("commands.admin.register.cannot-make-island");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
getIslands().setOwner(user, targetUUID, i);
|
getIslands().setOwner(user, targetUUID, i, RanksManager.VISITOR_RANK);
|
||||||
i.setReserved(true);
|
i.setReserved(true);
|
||||||
i.getCenter().getBlock().setType(Material.BEDROCK);
|
i.getCenter().getBlock().setType(Material.BEDROCK);
|
||||||
user.sendMessage("commands.admin.register.reserved-island", TextVariables.XYZ, Util.xyz(i.getCenter().toVector()),
|
user.sendMessage("commands.admin.register.reserved-island", TextVariables.XYZ, Util.xyz(i.getCenter().toVector()),
|
||||||
|
@ -1515,9 +1515,9 @@ public class IslandsManager {
|
|||||||
Location sp = spawn.get(w).getSpawnPoint(w.getEnvironment());
|
Location sp = spawn.get(w).getSpawnPoint(w.getEnvironment());
|
||||||
if (sp != null) {
|
if (sp != null) {
|
||||||
PaperLib.teleportAsync(p, sp);
|
PaperLib.teleportAsync(p, sp);
|
||||||
} else {
|
} else {
|
||||||
plugin.logWarning("Spawn exists but its location is null!");
|
plugin.logWarning("Spawn exists but its location is null!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -1630,7 +1630,7 @@ public class IslandsManager {
|
|||||||
* owner
|
* owner
|
||||||
*/
|
*/
|
||||||
public void setOwner(World world, User user, UUID targetUUID) {
|
public void setOwner(World world, User user, UUID targetUUID) {
|
||||||
setOwner(user, targetUUID, getIsland(world, user.getUniqueId()));
|
setOwner(user, targetUUID, getIsland(world, user.getUniqueId()), RanksManager.SUB_OWNER_RANK);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1639,11 +1639,14 @@ public class IslandsManager {
|
|||||||
* @param user previous owner
|
* @param user previous owner
|
||||||
* @param targetUUID new owner
|
* @param targetUUID new owner
|
||||||
* @param island island to register
|
* @param island island to register
|
||||||
|
* @param rank rank to which to set old owner.
|
||||||
*/
|
*/
|
||||||
public void setOwner(User user, UUID targetUUID, Island island) {
|
public void setOwner(User user, UUID targetUUID, Island island, int rank) {
|
||||||
islandCache.setOwner(island, targetUUID);
|
islandCache.setOwner(island, targetUUID);
|
||||||
// Set old owner as sub-owner on island.
|
// Set old owner as sub-owner on island.
|
||||||
island.setRank(user, RanksManager.SUB_OWNER_RANK);
|
if (rank > RanksManager.VISITOR_RANK) {
|
||||||
|
island.setRank(user, rank);
|
||||||
|
}
|
||||||
|
|
||||||
user.sendMessage("commands.island.team.setowner.name-is-the-owner", "[name]",
|
user.sendMessage("commands.island.team.setowner.name-is-the-owner", "[name]",
|
||||||
plugin.getPlayers().getName(targetUUID));
|
plugin.getPlayers().getName(targetUUID));
|
||||||
|
Loading…
Reference in New Issue
Block a user