mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2025-01-26 01:51:30 +01:00
Merge branch 'develop' of https://github.com/BentoBoxWorld/BentoBox.git into develop
This commit is contained in:
commit
a7869832f1
4
pom.xml
4
pom.xml
@ -77,10 +77,10 @@
|
|||||||
<!-- Might differ from the last Spigot release for short periods
|
<!-- Might differ from the last Spigot release for short periods
|
||||||
of time -->
|
of time -->
|
||||||
<paper.version>1.19-R0.1-SNAPSHOT</paper.version>
|
<paper.version>1.19-R0.1-SNAPSHOT</paper.version>
|
||||||
<bstats.version>2.2.1</bstats.version>
|
<bstats.version>3.0.0</bstats.version>
|
||||||
<vault.version>1.7.1</vault.version>
|
<vault.version>1.7.1</vault.version>
|
||||||
<placeholderapi.version>2.10.9</placeholderapi.version>
|
<placeholderapi.version>2.10.9</placeholderapi.version>
|
||||||
<githubapi.version>25f6c5c571</githubapi.version>
|
<githubapi.version>d5f5e0bbd8</githubapi.version>
|
||||||
<dynmap.version>3.0-SNAPSHOT</dynmap.version>
|
<dynmap.version>3.0-SNAPSHOT</dynmap.version>
|
||||||
<myworlds.version>1.19-v2</myworlds.version>
|
<myworlds.version>1.19-v2</myworlds.version>
|
||||||
<!-- Revision variable removes warning about dynamic version -->
|
<!-- Revision variable removes warning about dynamic version -->
|
||||||
|
@ -28,9 +28,9 @@ import world.bentobox.bentobox.listeners.BlockEndDragon;
|
|||||||
import world.bentobox.bentobox.listeners.DeathListener;
|
import world.bentobox.bentobox.listeners.DeathListener;
|
||||||
import world.bentobox.bentobox.listeners.JoinLeaveListener;
|
import world.bentobox.bentobox.listeners.JoinLeaveListener;
|
||||||
import world.bentobox.bentobox.listeners.PanelListenerManager;
|
import world.bentobox.bentobox.listeners.PanelListenerManager;
|
||||||
|
import world.bentobox.bentobox.listeners.StandardSpawnProtectionListener;
|
||||||
import world.bentobox.bentobox.listeners.teleports.EntityTeleportListener;
|
import world.bentobox.bentobox.listeners.teleports.EntityTeleportListener;
|
||||||
import world.bentobox.bentobox.listeners.teleports.PlayerTeleportListener;
|
import world.bentobox.bentobox.listeners.teleports.PlayerTeleportListener;
|
||||||
import world.bentobox.bentobox.listeners.StandardSpawnProtectionListener;
|
|
||||||
import world.bentobox.bentobox.managers.AddonsManager;
|
import world.bentobox.bentobox.managers.AddonsManager;
|
||||||
import world.bentobox.bentobox.managers.BlueprintsManager;
|
import world.bentobox.bentobox.managers.BlueprintsManager;
|
||||||
import world.bentobox.bentobox.managers.CommandsManager;
|
import world.bentobox.bentobox.managers.CommandsManager;
|
||||||
|
@ -287,7 +287,7 @@ public final class AddonDescription {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "AddonDescription [" + (name != null ? "name=" + name + ", " : "")
|
return "AddonDescription [" + "name=" + name + ", "
|
||||||
+ "version=" + version + "]";
|
+ "version=" + version + "]";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,6 @@ import java.util.Optional;
|
|||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
@ -286,10 +285,10 @@ public abstract class CompositeCommand extends Command implements PluginIdentifi
|
|||||||
{
|
{
|
||||||
// Check perms, but only if this isn't the console
|
// Check perms, but only if this isn't the console
|
||||||
if (user.isPlayer() &&
|
if (user.isPlayer() &&
|
||||||
!user.isOp() &&
|
!user.isOp() &&
|
||||||
this.getPermission() != null &&
|
this.getPermission() != null &&
|
||||||
!this.getPermission().isEmpty() &&
|
!this.getPermission().isEmpty() &&
|
||||||
!user.hasPermission(this.getPermission()))
|
!user.hasPermission(this.getPermission()))
|
||||||
{
|
{
|
||||||
user.sendMessage("general.errors.no-permission", TextVariables.PERMISSION, this.getPermission());
|
user.sendMessage("general.errors.no-permission", TextVariables.PERMISSION, this.getPermission());
|
||||||
return false;
|
return false;
|
||||||
@ -519,7 +518,7 @@ public abstract class CompositeCommand extends Command implements PluginIdentifi
|
|||||||
* @param user - the User
|
* @param user - the User
|
||||||
* @return true if sender is a player
|
* @return true if sender is a player
|
||||||
* @deprecated use {@link User#isPlayer()}
|
* @deprecated use {@link User#isPlayer()}
|
||||||
* @forRemove 1.18.0
|
* @forRemoval 1.18.0
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
protected boolean isPlayer(User user) {
|
protected boolean isPlayer(User user) {
|
||||||
@ -663,7 +662,7 @@ public abstract class CompositeCommand extends Command implements PluginIdentifi
|
|||||||
/* ------------ */
|
/* ------------ */
|
||||||
|
|
||||||
String lastArg = args.length != 0 ? args[args.length - 1] : "";
|
String lastArg = args.length != 0 ? args[args.length - 1] : "";
|
||||||
return Util.tabLimit(options, lastArg).stream().sorted().collect(Collectors.toList());
|
return Util.tabLimit(options, lastArg).stream().sorted().toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -677,7 +676,7 @@ public abstract class CompositeCommand extends Command implements PluginIdentifi
|
|||||||
return command.getSubCommands().values().stream()
|
return command.getSubCommands().values().stream()
|
||||||
.filter(cmd -> !cmd.isHidden())
|
.filter(cmd -> !cmd.isHidden())
|
||||||
.filter(cmd -> !cmd.isOnlyPlayer() || sender.isOp() || (sender instanceof Player && cmd.getPermission() != null && (cmd.getPermission().isEmpty() || sender.hasPermission(cmd.getPermission()))) )
|
.filter(cmd -> !cmd.isOnlyPlayer() || sender.isOp() || (sender instanceof Player && cmd.getPermission() != null && (cmd.getPermission().isEmpty() || sender.hasPermission(cmd.getPermission()))) )
|
||||||
.map(CompositeCommand::getLabel).collect(Collectors.toList());
|
.map(CompositeCommand::getLabel).toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -83,7 +83,7 @@ public class AdminDeleteCommand extends ConfirmableCommand {
|
|||||||
// Remove them from this island (it still exists and will be deleted later)
|
// Remove them from this island (it still exists and will be deleted later)
|
||||||
getIslands().removePlayer(getWorld(), targetUUID);
|
getIslands().removePlayer(getWorld(), targetUUID);
|
||||||
if (target.isPlayer() && target.isOnline()) {
|
if (target.isPlayer() && target.isOnline()) {
|
||||||
cleanUp(user, target);
|
cleanUp(target);
|
||||||
}
|
}
|
||||||
vector = oldIsland.getCenter().toVector();
|
vector = oldIsland.getCenter().toVector();
|
||||||
getIslands().deleteIsland(oldIsland, true, targetUUID);
|
getIslands().deleteIsland(oldIsland, true, targetUUID);
|
||||||
@ -95,7 +95,7 @@ public class AdminDeleteCommand extends ConfirmableCommand {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void cleanUp(User user, User target) {
|
private void cleanUp(User target) {
|
||||||
// Remove money inventory etc.
|
// Remove money inventory etc.
|
||||||
if (getIWM().isOnLeaveResetEnderChest(getWorld())) {
|
if (getIWM().isOnLeaveResetEnderChest(getWorld())) {
|
||||||
target.getPlayer().getEnderChest().clear();
|
target.getPlayer().getEnderChest().clear();
|
||||||
|
@ -55,11 +55,11 @@ public class AdminDeleteHomesCommand extends ConfirmableCommand {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// Confirm
|
// Confirm
|
||||||
askConfirmation(user, user.getTranslation("commands.admin.deletehomes.warning"), () -> deleteHomes(user, targetUUID, island));
|
askConfirmation(user, user.getTranslation("commands.admin.deletehomes.warning"), () -> deleteHomes(user, island));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean deleteHomes(User user, UUID targetUUID, Island island) {
|
private boolean deleteHomes(User user, Island island) {
|
||||||
island.removeHomes();
|
island.removeHomes();
|
||||||
user.sendMessage("general.success");
|
user.sendMessage("general.success");
|
||||||
return true;
|
return true;
|
||||||
|
@ -3,7 +3,6 @@ package world.bentobox.bentobox.api.commands.admin;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -98,7 +97,7 @@ public class AdminGetrankCommand extends CompositeCommand {
|
|||||||
return Optional.empty();
|
return Optional.empty();
|
||||||
}
|
}
|
||||||
String lastArg = args.get(args.size() - 1);
|
String lastArg = args.get(args.size() - 1);
|
||||||
List<String> options = Bukkit.getOnlinePlayers().stream().map(Player::getName).collect(Collectors.toList());
|
List<String> options = Bukkit.getOnlinePlayers().stream().map(Player::getName).toList();
|
||||||
return Optional.of(Util.tabLimit(options, lastArg));
|
return Optional.of(Util.tabLimit(options, lastArg));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,6 @@ package world.bentobox.bentobox.api.commands.admin;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
import world.bentobox.bentobox.api.commands.CompositeCommand;
|
import world.bentobox.bentobox.api.commands.CompositeCommand;
|
||||||
import world.bentobox.bentobox.api.commands.ConfirmableCommand;
|
import world.bentobox.bentobox.api.commands.ConfirmableCommand;
|
||||||
@ -26,7 +25,7 @@ public class AdminResetFlagsCommand extends ConfirmableCommand {
|
|||||||
super(parent, "resetflags");
|
super(parent, "resetflags");
|
||||||
options = getPlugin().getFlagsManager().getFlags().stream()
|
options = getPlugin().getFlagsManager().getFlags().stream()
|
||||||
.filter(f -> f.getType().equals(Type.PROTECTION) || f.getType().equals(Type.SETTING))
|
.filter(f -> f.getType().equals(Type.PROTECTION) || f.getType().equals(Type.SETTING))
|
||||||
.map(Flag::getID).collect(Collectors.toList());
|
.map(Flag::getID).toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,10 +1,11 @@
|
|||||||
package world.bentobox.bentobox.api.commands.admin;
|
package world.bentobox.bentobox.api.commands.admin;
|
||||||
|
|
||||||
import org.eclipse.jdt.annotation.Nullable;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import org.eclipse.jdt.annotation.Nullable;
|
||||||
|
|
||||||
import world.bentobox.bentobox.api.commands.CompositeCommand;
|
import world.bentobox.bentobox.api.commands.CompositeCommand;
|
||||||
import world.bentobox.bentobox.api.localization.TextVariables;
|
import world.bentobox.bentobox.api.localization.TextVariables;
|
||||||
import world.bentobox.bentobox.api.user.User;
|
import world.bentobox.bentobox.api.user.User;
|
||||||
|
@ -50,7 +50,7 @@ public class AdminSetProtectionCenterCommand extends ConfirmableCommand
|
|||||||
public boolean canExecute(User user, String label, List<String> args) {
|
public boolean canExecute(User user, String label, List<String> args) {
|
||||||
if (args.size() == 3) {
|
if (args.size() == 3) {
|
||||||
// Get location
|
// Get location
|
||||||
targetLoc = getLocation(user, args);
|
targetLoc = getLocation(args);
|
||||||
} else {
|
} else {
|
||||||
targetLoc = new Location(getWorld(), user.getLocation().getBlockX(), user.getLocation().getBlockY(), user.getLocation().getBlockZ());
|
targetLoc = new Location(getWorld(), user.getLocation().getBlockX(), user.getLocation().getBlockY(), user.getLocation().getBlockZ());
|
||||||
}
|
}
|
||||||
@ -67,7 +67,7 @@ public class AdminSetProtectionCenterCommand extends ConfirmableCommand
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Location getLocation(User user, List<String> args) {
|
private Location getLocation(List<String> args) {
|
||||||
try {
|
try {
|
||||||
int x = Integer.parseInt(args.get(0));
|
int x = Integer.parseInt(args.get(0));
|
||||||
int y = Integer.parseInt(args.get(1));
|
int y = Integer.parseInt(args.get(1));
|
||||||
|
@ -4,7 +4,6 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
import org.eclipse.jdt.annotation.Nullable;
|
import org.eclipse.jdt.annotation.Nullable;
|
||||||
|
|
||||||
@ -140,7 +139,7 @@ public class AdminSetrankCommand extends CompositeCommand {
|
|||||||
return Optional.of(getPlugin().getRanksManager().getRanks()
|
return Optional.of(getPlugin().getRanksManager().getRanks()
|
||||||
.entrySet().stream()
|
.entrySet().stream()
|
||||||
.filter(entry -> entry.getValue() > RanksManager.VISITOR_RANK)
|
.filter(entry -> entry.getValue() > RanksManager.VISITOR_RANK)
|
||||||
.map(entry -> user.getTranslation(entry.getKey())).collect(Collectors.toList()));
|
.map(entry -> user.getTranslation(entry.getKey())).toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return the player names again for the optional island owner argument
|
// Return the player names again for the optional island owner argument
|
||||||
|
@ -8,7 +8,6 @@ import java.util.Locale;
|
|||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.eclipse.jdt.annotation.NonNull;
|
import org.eclipse.jdt.annotation.NonNull;
|
||||||
@ -192,19 +191,17 @@ public class AdminSettingsCommand extends CompositeCommand {
|
|||||||
// Command line setting
|
// Command line setting
|
||||||
flag.ifPresent(f -> {
|
flag.ifPresent(f -> {
|
||||||
switch (f.getType()) {
|
switch (f.getType()) {
|
||||||
case PROTECTION:
|
case PROTECTION -> {
|
||||||
island.setFlag(f, rank);
|
island.setFlag(f, rank);
|
||||||
getIslands().save(island);
|
getIslands().save(island);
|
||||||
break;
|
}
|
||||||
case SETTING:
|
case SETTING -> {
|
||||||
island.setSettingsFlag(f, activeState);
|
island.setSettingsFlag(f, activeState);
|
||||||
getIslands().save(island);
|
getIslands().save(island);
|
||||||
break;
|
}
|
||||||
case WORLD_SETTING:
|
case WORLD_SETTING -> f.setSetting(getWorld(), activeState);
|
||||||
f.setSetting(getWorld(), activeState);
|
default -> {
|
||||||
break;
|
}
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
user.sendMessage("general.success");
|
user.sendMessage("general.success");
|
||||||
@ -270,7 +267,7 @@ public class AdminSettingsCommand extends CompositeCommand {
|
|||||||
.getRanks().entrySet().stream()
|
.getRanks().entrySet().stream()
|
||||||
.filter(en -> en.getValue() > RanksManager.BANNED_RANK && en.getValue() <= RanksManager.OWNER_RANK)
|
.filter(en -> en.getValue() > RanksManager.BANNED_RANK && en.getValue() <= RanksManager.OWNER_RANK)
|
||||||
.map(Entry::getKey)
|
.map(Entry::getKey)
|
||||||
.map(user::getTranslation).collect(Collectors.toList());
|
.map(user::getTranslation).toList();
|
||||||
case SETTING -> Arrays.asList(active, disabled);
|
case SETTING -> Arrays.asList(active, disabled);
|
||||||
default -> Collections.<String>emptyList();
|
default -> Collections.<String>emptyList();
|
||||||
}).orElse(Collections.emptyList());
|
}).orElse(Collections.emptyList());
|
||||||
|
@ -9,7 +9,12 @@ import world.bentobox.bentobox.api.commands.admin.deaths.AdminDeathsCommand;
|
|||||||
import world.bentobox.bentobox.api.commands.admin.purge.AdminPurgeCommand;
|
import world.bentobox.bentobox.api.commands.admin.purge.AdminPurgeCommand;
|
||||||
import world.bentobox.bentobox.api.commands.admin.range.AdminRangeCommand;
|
import world.bentobox.bentobox.api.commands.admin.range.AdminRangeCommand;
|
||||||
import world.bentobox.bentobox.api.commands.admin.resets.AdminResetsCommand;
|
import world.bentobox.bentobox.api.commands.admin.resets.AdminResetsCommand;
|
||||||
import world.bentobox.bentobox.api.commands.admin.team.*;
|
import world.bentobox.bentobox.api.commands.admin.team.AdminTeamAddCommand;
|
||||||
|
import world.bentobox.bentobox.api.commands.admin.team.AdminTeamCommand;
|
||||||
|
import world.bentobox.bentobox.api.commands.admin.team.AdminTeamDisbandCommand;
|
||||||
|
import world.bentobox.bentobox.api.commands.admin.team.AdminTeamFixCommand;
|
||||||
|
import world.bentobox.bentobox.api.commands.admin.team.AdminTeamKickCommand;
|
||||||
|
import world.bentobox.bentobox.api.commands.admin.team.AdminTeamSetownerCommand;
|
||||||
import world.bentobox.bentobox.api.localization.TextVariables;
|
import world.bentobox.bentobox.api.localization.TextVariables;
|
||||||
import world.bentobox.bentobox.api.user.User;
|
import world.bentobox.bentobox.api.user.User;
|
||||||
|
|
||||||
|
@ -2,7 +2,6 @@ package world.bentobox.bentobox.api.commands.admin.blueprints;
|
|||||||
|
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
import world.bentobox.bentobox.api.commands.ConfirmableCommand;
|
import world.bentobox.bentobox.api.commands.ConfirmableCommand;
|
||||||
|
@ -2,13 +2,11 @@ package world.bentobox.bentobox.api.commands.admin.blueprints;
|
|||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
|
||||||
|
|
||||||
import world.bentobox.bentobox.api.commands.ConfirmableCommand;
|
import world.bentobox.bentobox.api.commands.ConfirmableCommand;
|
||||||
import world.bentobox.bentobox.api.localization.TextVariables;
|
import world.bentobox.bentobox.api.localization.TextVariables;
|
||||||
import world.bentobox.bentobox.api.user.User;
|
import world.bentobox.bentobox.api.user.User;
|
||||||
import world.bentobox.bentobox.blueprints.Blueprint;
|
import world.bentobox.bentobox.blueprints.Blueprint;
|
||||||
import world.bentobox.bentobox.blueprints.BlueprintClipboard;
|
|
||||||
import world.bentobox.bentobox.managers.BlueprintsManager;
|
import world.bentobox.bentobox.managers.BlueprintsManager;
|
||||||
import world.bentobox.bentobox.util.Util;
|
import world.bentobox.bentobox.util.Util;
|
||||||
|
|
||||||
|
@ -4,7 +4,6 @@ import java.util.List;
|
|||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Sound;
|
import org.bukkit.Sound;
|
||||||
@ -142,7 +141,7 @@ public class IslandBanCommand extends CompositeCommand {
|
|||||||
.filter(p -> !p.getUniqueId().equals(user.getUniqueId()))
|
.filter(p -> !p.getUniqueId().equals(user.getUniqueId()))
|
||||||
.filter(p -> !island.isBanned(p.getUniqueId()))
|
.filter(p -> !island.isBanned(p.getUniqueId()))
|
||||||
.filter(p -> user.getPlayer().canSee(p))
|
.filter(p -> user.getPlayer().canSee(p))
|
||||||
.map(Player::getName).collect(Collectors.toList());
|
.map(Player::getName).toList();
|
||||||
return Optional.of(Util.tabLimit(options, lastArg));
|
return Optional.of(Util.tabLimit(options, lastArg));
|
||||||
} else {
|
} else {
|
||||||
return Optional.empty();
|
return Optional.empty();
|
||||||
|
@ -3,7 +3,6 @@ package world.bentobox.bentobox.api.commands.island;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
import world.bentobox.bentobox.api.commands.CompositeCommand;
|
import world.bentobox.bentobox.api.commands.CompositeCommand;
|
||||||
import world.bentobox.bentobox.api.localization.TextVariables;
|
import world.bentobox.bentobox.api.localization.TextVariables;
|
||||||
@ -57,7 +56,7 @@ public class IslandBanlistCommand extends CompositeCommand {
|
|||||||
// Title
|
// Title
|
||||||
user.sendMessage("commands.island.banlist.the-following");
|
user.sendMessage("commands.island.banlist.the-following");
|
||||||
// Create a nicely formatted list
|
// Create a nicely formatted list
|
||||||
List<String> names = island.getBanned().stream().map(u -> getPlayers().getName(u)).sorted().collect(Collectors.toList());
|
List<String> names = island.getBanned().stream().map(u -> getPlayers().getName(u)).sorted().toList();
|
||||||
List<String> lines = new ArrayList<>();
|
List<String> lines = new ArrayList<>();
|
||||||
StringBuilder line = new StringBuilder();
|
StringBuilder line = new StringBuilder();
|
||||||
// Put the names into lines of no more than 40 characters long, separated by commas
|
// Put the names into lines of no more than 40 characters long, separated by commas
|
||||||
|
@ -4,7 +4,6 @@ import java.util.List;
|
|||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Sound;
|
import org.bukkit.Sound;
|
||||||
@ -156,7 +155,7 @@ public class IslandExpelCommand extends CompositeCommand {
|
|||||||
.filter(p -> !p.isOp()) // Not op
|
.filter(p -> !p.isOp()) // Not op
|
||||||
.filter(p -> !p.hasPermission(this.getPermissionPrefix() + "admin.noexpel"))
|
.filter(p -> !p.hasPermission(this.getPermissionPrefix() + "admin.noexpel"))
|
||||||
.filter(p -> !p.hasPermission(this.getPermissionPrefix() + "mod.bypassexpel"))
|
.filter(p -> !p.hasPermission(this.getPermissionPrefix() + "mod.bypassexpel"))
|
||||||
.map(Player::getName).collect(Collectors.toList());
|
.map(Player::getName).toList();
|
||||||
|
|
||||||
String lastArg = !args.isEmpty() ? args.get(args.size()-1) : "";
|
String lastArg = !args.isEmpty() ? args.get(args.size()-1) : "";
|
||||||
return Optional.of(Util.tabLimit(options, lastArg));
|
return Optional.of(Util.tabLimit(options, lastArg));
|
||||||
|
@ -4,7 +4,6 @@ import java.util.List;
|
|||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
import org.eclipse.jdt.annotation.Nullable;
|
import org.eclipse.jdt.annotation.Nullable;
|
||||||
|
|
||||||
@ -112,7 +111,7 @@ public class IslandUnbanCommand extends CompositeCommand {
|
|||||||
public Optional<List<String>> tabComplete(User user, String alias, List<String> args) {
|
public Optional<List<String>> tabComplete(User user, String alias, List<String> args) {
|
||||||
Island island = getIslands().getIsland(getWorld(), user.getUniqueId());
|
Island island = getIslands().getIsland(getWorld(), user.getUniqueId());
|
||||||
if (island != null) {
|
if (island != null) {
|
||||||
List<String> options = island.getBanned().stream().map(getPlayers()::getName).collect(Collectors.toList());
|
List<String> options = island.getBanned().stream().map(getPlayers()::getName).toList();
|
||||||
String lastArg = !args.isEmpty() ? args.get(args.size()-1) : "";
|
String lastArg = !args.isEmpty() ? args.get(args.size()-1) : "";
|
||||||
return Optional.of(Util.tabLimit(options, lastArg));
|
return Optional.of(Util.tabLimit(options, lastArg));
|
||||||
} else {
|
} else {
|
||||||
|
@ -7,7 +7,6 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.OfflinePlayer;
|
import org.bukkit.OfflinePlayer;
|
||||||
@ -108,7 +107,7 @@ public class IslandTeamCommand extends CompositeCommand {
|
|||||||
|
|
||||||
// We now need to get all online "members" of the island - incl. Trusted and coop
|
// We now need to get all online "members" of the island - incl. Trusted and coop
|
||||||
List<UUID> onlineMembers = island.getMemberSet(RanksManager.COOP_RANK).stream()
|
List<UUID> onlineMembers = island.getMemberSet(RanksManager.COOP_RANK).stream()
|
||||||
.filter(uuid -> Util.getOnlinePlayerList(user).contains(Bukkit.getOfflinePlayer(uuid).getName())).collect(Collectors.toList());
|
.filter(uuid -> Util.getOnlinePlayerList(user).contains(Bukkit.getOfflinePlayer(uuid).getName())).toList();
|
||||||
|
|
||||||
for (int rank : ranks) {
|
for (int rank : ranks) {
|
||||||
Set<UUID> players = island.getMemberSet(rank, false);
|
Set<UUID> players = island.getMemberSet(rank, false);
|
||||||
|
@ -4,7 +4,6 @@ import java.util.List;
|
|||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.OfflinePlayer;
|
import org.bukkit.OfflinePlayer;
|
||||||
@ -131,7 +130,7 @@ public class IslandTeamKickCommand extends ConfirmableCommand {
|
|||||||
List<String> options = island.getMemberSet().stream()
|
List<String> options = island.getMemberSet().stream()
|
||||||
.filter(uuid -> island.getRank(uuid) >= RanksManager.MEMBER_RANK)
|
.filter(uuid -> island.getRank(uuid) >= RanksManager.MEMBER_RANK)
|
||||||
.map(Bukkit::getOfflinePlayer)
|
.map(Bukkit::getOfflinePlayer)
|
||||||
.map(OfflinePlayer::getName).collect(Collectors.toList());
|
.map(OfflinePlayer::getName).toList();
|
||||||
|
|
||||||
String lastArg = !args.isEmpty() ? args.get(args.size()-1) : "";
|
String lastArg = !args.isEmpty() ? args.get(args.size()-1) : "";
|
||||||
return Optional.of(Util.tabLimit(options, lastArg));
|
return Optional.of(Util.tabLimit(options, lastArg));
|
||||||
|
@ -3,7 +3,6 @@ package world.bentobox.bentobox.api.commands.island.team;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.OfflinePlayer;
|
import org.bukkit.OfflinePlayer;
|
||||||
@ -125,7 +124,7 @@ public class IslandTeamPromoteCommand extends CompositeCommand {
|
|||||||
if (island != null) {
|
if (island != null) {
|
||||||
List<String> options = island.getMemberSet().stream()
|
List<String> options = island.getMemberSet().stream()
|
||||||
.map(Bukkit::getOfflinePlayer)
|
.map(Bukkit::getOfflinePlayer)
|
||||||
.map(OfflinePlayer::getName).collect(Collectors.toList());
|
.map(OfflinePlayer::getName).toList();
|
||||||
|
|
||||||
String lastArg = !args.isEmpty() ? args.get(args.size()-1) : "";
|
String lastArg = !args.isEmpty() ? args.get(args.size()-1) : "";
|
||||||
return Optional.of(Util.tabLimit(options, lastArg));
|
return Optional.of(Util.tabLimit(options, lastArg));
|
||||||
|
@ -4,7 +4,6 @@ import java.util.List;
|
|||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.OfflinePlayer;
|
import org.bukkit.OfflinePlayer;
|
||||||
@ -114,7 +113,7 @@ public class IslandTeamUncoopCommand extends CompositeCommand {
|
|||||||
List<String> options = island.getMembers().entrySet().stream()
|
List<String> options = island.getMembers().entrySet().stream()
|
||||||
.filter(e -> e.getValue() == RanksManager.COOP_RANK)
|
.filter(e -> e.getValue() == RanksManager.COOP_RANK)
|
||||||
.map(e -> Bukkit.getOfflinePlayer(e.getKey()))
|
.map(e -> Bukkit.getOfflinePlayer(e.getKey()))
|
||||||
.map(OfflinePlayer::getName).collect(Collectors.toList());
|
.map(OfflinePlayer::getName).toList();
|
||||||
String lastArg = !args.isEmpty() ? args.get(args.size()-1) : "";
|
String lastArg = !args.isEmpty() ? args.get(args.size()-1) : "";
|
||||||
return Optional.of(Util.tabLimit(options, lastArg));
|
return Optional.of(Util.tabLimit(options, lastArg));
|
||||||
} else {
|
} else {
|
||||||
|
@ -4,7 +4,6 @@ import java.util.List;
|
|||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.OfflinePlayer;
|
import org.bukkit.OfflinePlayer;
|
||||||
@ -114,7 +113,7 @@ public class IslandTeamUntrustCommand extends CompositeCommand {
|
|||||||
List<String> options = island.getMembers().entrySet().stream()
|
List<String> options = island.getMembers().entrySet().stream()
|
||||||
.filter(e -> e.getValue() == RanksManager.TRUSTED_RANK)
|
.filter(e -> e.getValue() == RanksManager.TRUSTED_RANK)
|
||||||
.map(e -> Bukkit.getOfflinePlayer(e.getKey()))
|
.map(e -> Bukkit.getOfflinePlayer(e.getKey()))
|
||||||
.map(OfflinePlayer::getName).collect(Collectors.toList());
|
.map(OfflinePlayer::getName).toList();
|
||||||
String lastArg = !args.isEmpty() ? args.get(args.size()-1) : "";
|
String lastArg = !args.isEmpty() ? args.get(args.size()-1) : "";
|
||||||
return Optional.of(Util.tabLimit(options, lastArg));
|
return Optional.of(Util.tabLimit(options, lastArg));
|
||||||
} else {
|
} else {
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
package world.bentobox.bentobox.api.flags.clicklisteners;
|
package world.bentobox.bentobox.api.flags.clicklisteners;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Sound;
|
import org.bukkit.Sound;
|
||||||
import org.bukkit.event.inventory.ClickType;
|
import org.bukkit.event.inventory.ClickType;
|
||||||
|
|
||||||
import java.util.Objects;
|
|
||||||
|
|
||||||
import world.bentobox.bentobox.BentoBox;
|
import world.bentobox.bentobox.BentoBox;
|
||||||
import world.bentobox.bentobox.api.addons.GameModeAddon;
|
import world.bentobox.bentobox.api.addons.GameModeAddon;
|
||||||
import world.bentobox.bentobox.api.events.flags.FlagProtectionChangeEvent;
|
import world.bentobox.bentobox.api.events.flags.FlagProtectionChangeEvent;
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
package world.bentobox.bentobox.api.flags.clicklisteners;
|
package world.bentobox.bentobox.api.flags.clicklisteners;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Sound;
|
import org.bukkit.Sound;
|
||||||
import org.bukkit.event.inventory.ClickType;
|
import org.bukkit.event.inventory.ClickType;
|
||||||
|
|
||||||
import java.util.Objects;
|
|
||||||
|
|
||||||
import world.bentobox.bentobox.BentoBox;
|
import world.bentobox.bentobox.BentoBox;
|
||||||
import world.bentobox.bentobox.api.addons.GameModeAddon;
|
import world.bentobox.bentobox.api.addons.GameModeAddon;
|
||||||
import world.bentobox.bentobox.api.events.flags.FlagSettingChangeEvent;
|
import world.bentobox.bentobox.api.events.flags.FlagSettingChangeEvent;
|
||||||
|
@ -8,7 +8,11 @@ package world.bentobox.bentobox.api.panels.builders;
|
|||||||
|
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.*;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.function.BiFunction;
|
import java.util.function.BiFunction;
|
||||||
|
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
|
@ -17,8 +17,6 @@ import org.bukkit.inventory.ItemStack;
|
|||||||
import org.eclipse.jdt.annotation.NonNull;
|
import org.eclipse.jdt.annotation.NonNull;
|
||||||
import org.eclipse.jdt.annotation.Nullable;
|
import org.eclipse.jdt.annotation.Nullable;
|
||||||
|
|
||||||
import world.bentobox.bentobox.api.panels.reader.ItemTemplateRecord.ActionRecords;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This Record contains all necessary information about Item Template that can be used to craft panel item.
|
* This Record contains all necessary information about Item Template that can be used to craft panel item.
|
||||||
@ -33,11 +31,11 @@ import world.bentobox.bentobox.api.panels.reader.ItemTemplateRecord.ActionRecord
|
|||||||
* @since 1.17.3
|
* @since 1.17.3
|
||||||
*/
|
*/
|
||||||
public record ItemTemplateRecord(@Nullable ItemStack icon,
|
public record ItemTemplateRecord(@Nullable ItemStack icon,
|
||||||
@Nullable String title,
|
@Nullable String title,
|
||||||
@Nullable String description,
|
@Nullable String description,
|
||||||
@NonNull List<ActionRecords> actions,
|
@NonNull List<ActionRecords> actions,
|
||||||
@NonNull Map<String, Object> dataMap,
|
@NonNull Map<String, Object> dataMap,
|
||||||
@Nullable ItemTemplateRecord fallback)
|
@Nullable ItemTemplateRecord fallback)
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Instantiates a new Item template record without actions and data map.
|
* Instantiates a new Item template record without actions and data map.
|
||||||
|
@ -15,7 +15,6 @@ import org.eclipse.jdt.annotation.NonNull;
|
|||||||
import org.eclipse.jdt.annotation.Nullable;
|
import org.eclipse.jdt.annotation.Nullable;
|
||||||
|
|
||||||
import world.bentobox.bentobox.api.panels.Panel;
|
import world.bentobox.bentobox.api.panels.Panel;
|
||||||
import world.bentobox.bentobox.api.panels.reader.PanelTemplateRecord.TemplateItem;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -98,10 +97,9 @@ public record PanelTemplateRecord(Panel.Type type,
|
|||||||
if (this == obj) {
|
if (this == obj) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (!(obj instanceof PanelTemplateRecord)) {
|
if (!(obj instanceof PanelTemplateRecord other)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
PanelTemplateRecord other = (PanelTemplateRecord) obj;
|
|
||||||
return Objects.equals(background, other.background) && Objects.equals(border, other.border)
|
return Objects.equals(background, other.background) && Objects.equals(border, other.border)
|
||||||
&& Arrays.deepEquals(content, other.content) && Arrays.equals(forcedRows, other.forcedRows)
|
&& Arrays.deepEquals(content, other.content) && Arrays.equals(forcedRows, other.forcedRows)
|
||||||
&& Objects.equals(title, other.title) && type == other.type;
|
&& Objects.equals(title, other.title) && type == other.type;
|
||||||
|
@ -6,6 +6,12 @@
|
|||||||
|
|
||||||
package world.bentobox.bentobox.api.panels.reader;
|
package world.bentobox.bentobox.api.panels.reader;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.configuration.ConfigurationSection;
|
import org.bukkit.configuration.ConfigurationSection;
|
||||||
import org.bukkit.configuration.InvalidConfigurationException;
|
import org.bukkit.configuration.InvalidConfigurationException;
|
||||||
@ -14,12 +20,6 @@ import org.bukkit.event.inventory.ClickType;
|
|||||||
import org.eclipse.jdt.annotation.NonNull;
|
import org.eclipse.jdt.annotation.NonNull;
|
||||||
import org.eclipse.jdt.annotation.Nullable;
|
import org.eclipse.jdt.annotation.Nullable;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import com.google.common.base.Enums;
|
import com.google.common.base.Enums;
|
||||||
|
|
||||||
import world.bentobox.bentobox.api.panels.Panel;
|
import world.bentobox.bentobox.api.panels.Panel;
|
||||||
|
@ -8,7 +8,6 @@ import java.util.Objects;
|
|||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
import org.apache.commons.lang.math.NumberUtils;
|
import org.apache.commons.lang.math.NumberUtils;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
@ -330,7 +329,7 @@ public class User implements MetaDataAble {
|
|||||||
.filter(PermissionAttachmentInfo::getValue) // Must be a positive permission, not a negative one
|
.filter(PermissionAttachmentInfo::getValue) // Must be a positive permission, not a negative one
|
||||||
.map(PermissionAttachmentInfo::getPermission)
|
.map(PermissionAttachmentInfo::getPermission)
|
||||||
.filter(permission -> permission.startsWith(permPrefix))
|
.filter(permission -> permission.startsWith(permPrefix))
|
||||||
.collect(Collectors.toList());
|
.toList();
|
||||||
|
|
||||||
if (permissions.isEmpty()) return defaultValue;
|
if (permissions.isEmpty()) return defaultValue;
|
||||||
|
|
||||||
@ -414,9 +413,7 @@ public class User implements MetaDataAble {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// If this is a prefix, just gather and return the translation
|
// If this is a prefix, just gather and return the translation
|
||||||
if (reference.startsWith("prefixes.")) {
|
if (!reference.startsWith("prefixes.")) {
|
||||||
return translation;
|
|
||||||
} else {
|
|
||||||
// Replace the prefixes
|
// Replace the prefixes
|
||||||
for (String prefix : plugin.getLocalesManager().getAvailablePrefixes(this)) {
|
for (String prefix : plugin.getLocalesManager().getAvailablePrefixes(this)) {
|
||||||
String prefixTranslation = getTranslation("prefixes." + prefix);
|
String prefixTranslation = getTranslation("prefixes." + prefix);
|
||||||
@ -441,8 +438,8 @@ public class User implements MetaDataAble {
|
|||||||
translation = plugin.getPlaceholdersManager().replacePlaceholders(player, translation);
|
translation = plugin.getPlaceholdersManager().replacePlaceholders(player, translation);
|
||||||
}
|
}
|
||||||
|
|
||||||
return translation;
|
|
||||||
}
|
}
|
||||||
|
return translation;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -605,67 +602,68 @@ public class User implements MetaDataAble {
|
|||||||
// Improve particle validation.
|
// Improve particle validation.
|
||||||
switch (particle)
|
switch (particle)
|
||||||
{
|
{
|
||||||
case REDSTONE ->
|
case REDSTONE ->
|
||||||
|
{
|
||||||
|
if (!(dustOptions instanceof Particle.DustOptions))
|
||||||
{
|
{
|
||||||
if (!(dustOptions instanceof Particle.DustOptions))
|
throw new IllegalArgumentException("A non-null Particle.DustOptions must be provided when using Particle.REDSTONE as particle.");
|
||||||
{
|
|
||||||
throw new IllegalArgumentException("A non-null Particle.DustOptions must be provided when using Particle.REDSTONE as particle.");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
case ITEM_CRACK ->
|
}
|
||||||
|
case ITEM_CRACK ->
|
||||||
|
{
|
||||||
|
if (!(dustOptions instanceof ItemStack))
|
||||||
{
|
{
|
||||||
if (!(dustOptions instanceof ItemStack))
|
throw new IllegalArgumentException("A non-null ItemStack must be provided when using Particle.ITEM_CRACK as particle.");
|
||||||
{
|
|
||||||
throw new IllegalArgumentException("A non-null ItemStack must be provided when using Particle.ITEM_CRACK as particle.");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
case BLOCK_CRACK, BLOCK_DUST, FALLING_DUST, BLOCK_MARKER ->
|
}
|
||||||
|
case BLOCK_CRACK, BLOCK_DUST, FALLING_DUST, BLOCK_MARKER ->
|
||||||
|
{
|
||||||
|
if (!(dustOptions instanceof BlockData))
|
||||||
{
|
{
|
||||||
if (!(dustOptions instanceof BlockData))
|
throw new IllegalArgumentException("A non-null BlockData must be provided when using Particle." + particle + " as particle.");
|
||||||
{
|
|
||||||
throw new IllegalArgumentException("A non-null BlockData must be provided when using Particle." + particle + " as particle.");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
case DUST_COLOR_TRANSITION ->
|
}
|
||||||
|
case DUST_COLOR_TRANSITION ->
|
||||||
|
{
|
||||||
|
if (!(dustOptions instanceof Particle.DustTransition))
|
||||||
{
|
{
|
||||||
if (!(dustOptions instanceof Particle.DustTransition))
|
throw new IllegalArgumentException("A non-null Particle.DustTransition must be provided when using Particle.DUST_COLOR_TRANSITION as particle.");
|
||||||
{
|
|
||||||
throw new IllegalArgumentException("A non-null Particle.DustTransition must be provided when using Particle.DUST_COLOR_TRANSITION as particle.");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
case VIBRATION ->
|
}
|
||||||
|
case VIBRATION ->
|
||||||
|
{
|
||||||
|
if (!(dustOptions instanceof Vibration))
|
||||||
{
|
{
|
||||||
if (!(dustOptions instanceof Vibration))
|
throw new IllegalArgumentException("A non-null Vibration must be provided when using Particle.VIBRATION as particle.");
|
||||||
{
|
|
||||||
throw new IllegalArgumentException("A non-null Vibration must be provided when using Particle.VIBRATION as particle.");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
case SCULK_CHARGE ->
|
}
|
||||||
|
case SCULK_CHARGE ->
|
||||||
|
{
|
||||||
|
if (!(dustOptions instanceof Float))
|
||||||
{
|
{
|
||||||
if (!(dustOptions instanceof Float))
|
throw new IllegalArgumentException("A non-null Float must be provided when using Particle.SCULK_CHARGE as particle.");
|
||||||
{
|
|
||||||
throw new IllegalArgumentException("A non-null Float must be provided when using Particle.SCULK_CHARGE as particle.");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
case SHRIEK ->
|
}
|
||||||
|
case SHRIEK ->
|
||||||
|
{
|
||||||
|
if (!(dustOptions instanceof Integer))
|
||||||
{
|
{
|
||||||
if (!(dustOptions instanceof Integer))
|
throw new IllegalArgumentException("A non-null Integer must be provided when using Particle.SHRIEK as particle.");
|
||||||
{
|
|
||||||
throw new IllegalArgumentException("A non-null Integer must be provided when using Particle.SHRIEK as particle.");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
case LEGACY_BLOCK_CRACK, LEGACY_BLOCK_DUST, LEGACY_FALLING_DUST ->
|
}
|
||||||
|
case LEGACY_BLOCK_CRACK, LEGACY_BLOCK_DUST, LEGACY_FALLING_DUST ->
|
||||||
|
{
|
||||||
|
if (!(dustOptions instanceof BlockData))
|
||||||
{
|
{
|
||||||
if (!(dustOptions instanceof BlockData))
|
throw new IllegalArgumentException("A non-null MaterialData must be provided when using Particle." + particle + " as particle.");
|
||||||
{
|
|
||||||
throw new IllegalArgumentException("A non-null MaterialData must be provided when using Particle." + particle + " as particle.");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
default -> throw new IllegalArgumentException("Unexpected value: " + particle);
|
||||||
|
}
|
||||||
|
|
||||||
// Check if this particle is beyond the viewing distance of the server
|
// Check if this particle is beyond the viewing distance of the server
|
||||||
if (this.player != null &&
|
if (this.player != null &&
|
||||||
this.player.getLocation().toVector().distanceSquared(new Vector(x, y, z)) <
|
this.player.getLocation().toVector().distanceSquared(new Vector(x, y, z)) <
|
||||||
(Bukkit.getServer().getViewDistance() * 256 * Bukkit.getServer().getViewDistance()))
|
(Bukkit.getServer().getViewDistance() * 256 * Bukkit.getServer().getViewDistance()))
|
||||||
{
|
{
|
||||||
if (particle.equals(Particle.REDSTONE))
|
if (particle.equals(Particle.REDSTONE))
|
||||||
|
@ -2,7 +2,6 @@ package world.bentobox.bentobox.blueprints;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
|
@ -8,7 +8,6 @@ import java.util.LinkedHashMap;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
@ -138,7 +137,7 @@ public class BlueprintClipboard {
|
|||||||
.filter(e -> new Vector(Math.rint(e.getLocation().getX()),
|
.filter(e -> new Vector(Math.rint(e.getLocation().getX()),
|
||||||
Math.rint(e.getLocation().getY()),
|
Math.rint(e.getLocation().getY()),
|
||||||
Math.rint(e.getLocation().getZ())).equals(v))
|
Math.rint(e.getLocation().getZ())).equals(v))
|
||||||
.collect(Collectors.toList());
|
.toList();
|
||||||
if (copyBlock(v.toLocation(world), copyAir, copyBiome, ents)) {
|
if (copyBlock(v.toLocation(world), copyAir, copyBiome, ents)) {
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,17 @@
|
|||||||
package world.bentobox.bentobox.blueprints;
|
package world.bentobox.bentobox.blueprints;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.math.RoundingMode;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Map.Entry;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.Optional;
|
||||||
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
@ -7,6 +19,7 @@ import org.bukkit.scheduler.BukkitTask;
|
|||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
import org.eclipse.jdt.annotation.NonNull;
|
import org.eclipse.jdt.annotation.NonNull;
|
||||||
import org.eclipse.jdt.annotation.Nullable;
|
import org.eclipse.jdt.annotation.Nullable;
|
||||||
|
|
||||||
import world.bentobox.bentobox.BentoBox;
|
import world.bentobox.bentobox.BentoBox;
|
||||||
import world.bentobox.bentobox.api.localization.TextVariables;
|
import world.bentobox.bentobox.api.localization.TextVariables;
|
||||||
import world.bentobox.bentobox.api.user.User;
|
import world.bentobox.bentobox.api.user.User;
|
||||||
@ -16,12 +29,6 @@ import world.bentobox.bentobox.database.objects.Island;
|
|||||||
import world.bentobox.bentobox.nms.PasteHandler;
|
import world.bentobox.bentobox.nms.PasteHandler;
|
||||||
import world.bentobox.bentobox.util.Util;
|
import world.bentobox.bentobox.util.Util;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.math.RoundingMode;
|
|
||||||
import java.util.*;
|
|
||||||
import java.util.Map.Entry;
|
|
||||||
import java.util.concurrent.CompletableFuture;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class pastes the clipboard it is given
|
* This class pastes the clipboard it is given
|
||||||
* @author tastybento
|
* @author tastybento
|
||||||
|
@ -8,7 +8,6 @@ import org.bukkit.entity.Player;
|
|||||||
import org.eclipse.jdt.annotation.NonNull;
|
import org.eclipse.jdt.annotation.NonNull;
|
||||||
import org.eclipse.jdt.annotation.Nullable;
|
import org.eclipse.jdt.annotation.Nullable;
|
||||||
|
|
||||||
import world.bentobox.bentobox.BentoBox;
|
|
||||||
import world.bentobox.bentobox.api.addons.GameModeAddon;
|
import world.bentobox.bentobox.api.addons.GameModeAddon;
|
||||||
import world.bentobox.bentobox.api.user.User;
|
import world.bentobox.bentobox.api.user.User;
|
||||||
import world.bentobox.bentobox.blueprints.Blueprint;
|
import world.bentobox.bentobox.blueprints.Blueprint;
|
||||||
|
@ -3,7 +3,6 @@ package world.bentobox.bentobox.blueprints.dataobjects;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.EnumMap;
|
import java.util.EnumMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
|
@ -26,7 +26,6 @@ import world.bentobox.bentobox.database.json.adapters.LocationTypeAdapter;
|
|||||||
import world.bentobox.bentobox.database.json.adapters.PotionEffectTypeAdapter;
|
import world.bentobox.bentobox.database.json.adapters.PotionEffectTypeAdapter;
|
||||||
import world.bentobox.bentobox.database.json.adapters.VectorTypeAdapter;
|
import world.bentobox.bentobox.database.json.adapters.VectorTypeAdapter;
|
||||||
import world.bentobox.bentobox.database.json.adapters.WorldTypeAdapter;
|
import world.bentobox.bentobox.database.json.adapters.WorldTypeAdapter;
|
||||||
import world.bentobox.bentobox.versions.ServerCompatibility;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -5,9 +5,6 @@ import com.google.gson.annotations.Expose;
|
|||||||
/**
|
/**
|
||||||
* Record for bonus ranges
|
* Record for bonus ranges
|
||||||
* @author tastybento
|
* @author tastybento
|
||||||
* @param id an id to identify this bonus
|
|
||||||
* @param range the additional bonus range
|
|
||||||
* @param message the reference key to a locale message related to this bonus. May be blank.
|
|
||||||
*/
|
*/
|
||||||
public class BonusRangeRecord {
|
public class BonusRangeRecord {
|
||||||
@Expose
|
@Expose
|
||||||
@ -17,9 +14,9 @@ public class BonusRangeRecord {
|
|||||||
@Expose
|
@Expose
|
||||||
private String message;
|
private String message;
|
||||||
/**
|
/**
|
||||||
* @param uniqueId
|
* @param uniqueId an id to identify this bonus
|
||||||
* @param range
|
* @param range the additional bonus range
|
||||||
* @param message
|
* @param message the reference key to a locale message related to this bonus. May be blank.
|
||||||
*/
|
*/
|
||||||
public BonusRangeRecord(String uniqueId, int range, String message) {
|
public BonusRangeRecord(String uniqueId, int range, String message) {
|
||||||
this.uniqueId = uniqueId;
|
this.uniqueId = uniqueId;
|
||||||
|
@ -16,9 +16,9 @@ import java.util.UUID;
|
|||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.GameMode;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.GameMode;
|
|
||||||
import org.bukkit.World.Environment;
|
import org.bukkit.World.Environment;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.util.BoundingBox;
|
import org.bukkit.util.BoundingBox;
|
||||||
@ -728,10 +728,10 @@ public class Island implements DataObject, MetaDataAble {
|
|||||||
@SuppressWarnings("ConstantConditions")
|
@SuppressWarnings("ConstantConditions")
|
||||||
public boolean inIslandSpace(Location location) {
|
public boolean inIslandSpace(Location location) {
|
||||||
return Util.sameWorld(this.world, location.getWorld()) &&
|
return Util.sameWorld(this.world, location.getWorld()) &&
|
||||||
(location.getWorld().getEnvironment().equals(Environment.NORMAL) ||
|
(location.getWorld().getEnvironment().equals(Environment.NORMAL) ||
|
||||||
this.getPlugin().getIWM().isIslandNether(location.getWorld()) ||
|
this.getPlugin().getIWM().isIslandNether(location.getWorld()) ||
|
||||||
this.getPlugin().getIWM().isIslandEnd(location.getWorld())) &&
|
this.getPlugin().getIWM().isIslandEnd(location.getWorld())) &&
|
||||||
this.inIslandSpace(location.getBlockX(), location.getBlockZ());
|
this.inIslandSpace(location.getBlockX(), location.getBlockZ());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -770,33 +770,33 @@ public class Island implements DataObject, MetaDataAble {
|
|||||||
{
|
{
|
||||||
// Return normal world bounding box.
|
// Return normal world bounding box.
|
||||||
boundingBox = new BoundingBox(this.getMinX(),
|
boundingBox = new BoundingBox(this.getMinX(),
|
||||||
this.world.getMinHeight(),
|
this.world.getMinHeight(),
|
||||||
this.getMinZ(),
|
this.getMinZ(),
|
||||||
this.getMaxX(),
|
this.getMaxX(),
|
||||||
this.world.getMaxHeight(),
|
this.world.getMaxHeight(),
|
||||||
this.getMaxZ());
|
this.getMaxZ());
|
||||||
}
|
}
|
||||||
else if (Environment.THE_END.equals(environment) && this.isEndIslandEnabled())
|
else if (Environment.THE_END.equals(environment) && this.isEndIslandEnabled())
|
||||||
{
|
{
|
||||||
// If end world is generated, return end island bounding box.
|
// If end world is generated, return end island bounding box.
|
||||||
//noinspection ConstantConditions
|
//noinspection ConstantConditions
|
||||||
boundingBox = new BoundingBox(this.getMinX(),
|
boundingBox = new BoundingBox(this.getMinX(),
|
||||||
this.getEndWorld().getMinHeight(),
|
this.getEndWorld().getMinHeight(),
|
||||||
this.getMinZ(),
|
this.getMinZ(),
|
||||||
this.getMaxX(),
|
this.getMaxX(),
|
||||||
this.getEndWorld().getMaxHeight(),
|
this.getEndWorld().getMaxHeight(),
|
||||||
this.getMaxZ());
|
this.getMaxZ());
|
||||||
}
|
}
|
||||||
else if (Environment.NETHER.equals(environment) && this.isNetherIslandEnabled())
|
else if (Environment.NETHER.equals(environment) && this.isNetherIslandEnabled())
|
||||||
{
|
{
|
||||||
// If nether world is generated, return nether island bounding box.
|
// If nether world is generated, return nether island bounding box.
|
||||||
//noinspection ConstantConditions
|
//noinspection ConstantConditions
|
||||||
boundingBox = new BoundingBox(this.getMinX(),
|
boundingBox = new BoundingBox(this.getMinX(),
|
||||||
this.getNetherWorld().getMinHeight(),
|
this.getNetherWorld().getMinHeight(),
|
||||||
this.getMinZ(),
|
this.getMinZ(),
|
||||||
this.getMaxX(),
|
this.getMaxX(),
|
||||||
this.getNetherWorld().getMaxHeight(),
|
this.getNetherWorld().getMaxHeight(),
|
||||||
this.getMaxZ());
|
this.getMaxZ());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -913,13 +913,13 @@ public class Island implements DataObject, MetaDataAble {
|
|||||||
@SuppressWarnings("ConstantConditions")
|
@SuppressWarnings("ConstantConditions")
|
||||||
public boolean onIsland(@NonNull Location target) {
|
public boolean onIsland(@NonNull Location target) {
|
||||||
return Util.sameWorld(this.world, target.getWorld()) &&
|
return Util.sameWorld(this.world, target.getWorld()) &&
|
||||||
(target.getWorld().getEnvironment().equals(Environment.NORMAL) ||
|
(target.getWorld().getEnvironment().equals(Environment.NORMAL) ||
|
||||||
this.getPlugin().getIWM().isIslandNether(target.getWorld()) ||
|
this.getPlugin().getIWM().isIslandNether(target.getWorld()) ||
|
||||||
this.getPlugin().getIWM().isIslandEnd(target.getWorld())) &&
|
this.getPlugin().getIWM().isIslandEnd(target.getWorld())) &&
|
||||||
target.getBlockX() >= this.getMinProtectedX() &&
|
target.getBlockX() >= this.getMinProtectedX() &&
|
||||||
target.getBlockX() < (this.getMinProtectedX() + this.protectionRange * 2) &&
|
target.getBlockX() < (this.getMinProtectedX() + this.protectionRange * 2) &&
|
||||||
target.getBlockZ() >= this.getMinProtectedZ() &&
|
target.getBlockZ() >= this.getMinProtectedZ() &&
|
||||||
target.getBlockZ() < (this.getMinProtectedZ() + this.protectionRange * 2);
|
target.getBlockZ() < (this.getMinProtectedZ() + this.protectionRange * 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -950,33 +950,33 @@ public class Island implements DataObject, MetaDataAble {
|
|||||||
{
|
{
|
||||||
// Return normal world bounding box.
|
// Return normal world bounding box.
|
||||||
boundingBox = new BoundingBox(this.getMinProtectedX(),
|
boundingBox = new BoundingBox(this.getMinProtectedX(),
|
||||||
this.world.getMinHeight(),
|
this.world.getMinHeight(),
|
||||||
this.getMinProtectedZ(),
|
this.getMinProtectedZ(),
|
||||||
this.getMaxProtectedX(),
|
this.getMaxProtectedX(),
|
||||||
this.world.getMaxHeight(),
|
this.world.getMaxHeight(),
|
||||||
this.getMaxProtectedZ());
|
this.getMaxProtectedZ());
|
||||||
}
|
}
|
||||||
else if (Environment.THE_END.equals(environment) && this.isEndIslandEnabled())
|
else if (Environment.THE_END.equals(environment) && this.isEndIslandEnabled())
|
||||||
{
|
{
|
||||||
// If end world is generated, return end island bounding box.
|
// If end world is generated, return end island bounding box.
|
||||||
//noinspection ConstantConditions
|
//noinspection ConstantConditions
|
||||||
boundingBox = new BoundingBox(this.getMinProtectedX(),
|
boundingBox = new BoundingBox(this.getMinProtectedX(),
|
||||||
this.getEndWorld().getMinHeight(),
|
this.getEndWorld().getMinHeight(),
|
||||||
this.getMinProtectedZ(),
|
this.getMinProtectedZ(),
|
||||||
this.getMaxProtectedX(),
|
this.getMaxProtectedX(),
|
||||||
this.getEndWorld().getMaxHeight(),
|
this.getEndWorld().getMaxHeight(),
|
||||||
this.getMaxProtectedZ());
|
this.getMaxProtectedZ());
|
||||||
}
|
}
|
||||||
else if (Environment.NETHER.equals(environment) && this.isNetherIslandEnabled())
|
else if (Environment.NETHER.equals(environment) && this.isNetherIslandEnabled())
|
||||||
{
|
{
|
||||||
// If nether world is generated, return nether island bounding box.
|
// If nether world is generated, return nether island bounding box.
|
||||||
//noinspection ConstantConditions
|
//noinspection ConstantConditions
|
||||||
boundingBox = new BoundingBox(this.getMinProtectedX(),
|
boundingBox = new BoundingBox(this.getMinProtectedX(),
|
||||||
this.getNetherWorld().getMinHeight(),
|
this.getNetherWorld().getMinHeight(),
|
||||||
this.getMinProtectedZ(),
|
this.getMinProtectedZ(),
|
||||||
this.getMaxProtectedX(),
|
this.getMaxProtectedX(),
|
||||||
this.getNetherWorld().getMaxHeight(),
|
this.getNetherWorld().getMaxHeight(),
|
||||||
this.getMaxProtectedZ());
|
this.getMaxProtectedZ());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1057,11 +1057,11 @@ public class Island implements DataObject, MetaDataAble {
|
|||||||
BentoBox plugin = BentoBox.getInstance();
|
BentoBox plugin = BentoBox.getInstance();
|
||||||
Map<String, Integer> result = new HashMap<>();
|
Map<String, Integer> result = new HashMap<>();
|
||||||
plugin.getFlagsManager().getFlags().stream().
|
plugin.getFlagsManager().getFlags().stream().
|
||||||
filter(f -> f.getType().equals(Flag.Type.PROTECTION)).
|
filter(f -> f.getType().equals(Flag.Type.PROTECTION)).
|
||||||
forEach(f -> result.put(f.getID(), plugin.getIWM().getDefaultIslandFlags(world).getOrDefault(f, f.getDefaultRank())));
|
forEach(f -> result.put(f.getID(), plugin.getIWM().getDefaultIslandFlags(world).getOrDefault(f, f.getDefaultRank())));
|
||||||
plugin.getFlagsManager().getFlags().stream().
|
plugin.getFlagsManager().getFlags().stream().
|
||||||
filter(f -> f.getType().equals(Flag.Type.SETTING)).
|
filter(f -> f.getType().equals(Flag.Type.SETTING)).
|
||||||
forEach(f -> result.put(f.getID(), plugin.getIWM().getDefaultIslandSettings(world).getOrDefault(f, f.getDefaultRank())));
|
forEach(f -> result.put(f.getID(), plugin.getIWM().getDefaultIslandSettings(world).getOrDefault(f, f.getDefaultRank())));
|
||||||
this.setFlags(result);
|
this.setFlags(result);
|
||||||
setChanged();
|
setChanged();
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,12 @@
|
|||||||
package world.bentobox.bentobox.database.objects.adapters;
|
package world.bentobox.bentobox.database.objects.adapters;
|
||||||
|
|
||||||
|
|
||||||
import org.bukkit.configuration.MemorySection;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
|
import org.bukkit.configuration.MemorySection;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This Serializer migrates Map of String, Boolean to Map of String, Integer in serialization process.
|
* This Serializer migrates Map of String, Boolean to Map of String, Integer in serialization process.
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
package world.bentobox.bentobox.database.sql;
|
package world.bentobox.bentobox.database.sql;
|
||||||
|
|
||||||
import com.zaxxer.hikari.HikariConfig;
|
|
||||||
import com.zaxxer.hikari.HikariDataSource;
|
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
@ -10,6 +8,9 @@ import java.util.Set;
|
|||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.eclipse.jdt.annotation.NonNull;
|
import org.eclipse.jdt.annotation.NonNull;
|
||||||
|
|
||||||
|
import com.zaxxer.hikari.HikariConfig;
|
||||||
|
import com.zaxxer.hikari.HikariDataSource;
|
||||||
|
|
||||||
import world.bentobox.bentobox.database.DatabaseConnectionSettingsImpl;
|
import world.bentobox.bentobox.database.DatabaseConnectionSettingsImpl;
|
||||||
import world.bentobox.bentobox.database.DatabaseConnector;
|
import world.bentobox.bentobox.database.DatabaseConnector;
|
||||||
|
|
||||||
|
@ -11,13 +11,14 @@ import java.util.Collections;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
|
||||||
|
import javax.sql.DataSource;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.eclipse.jdt.annotation.NonNull;
|
import org.eclipse.jdt.annotation.NonNull;
|
||||||
|
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.google.gson.JsonSyntaxException;
|
import com.google.gson.JsonSyntaxException;
|
||||||
|
|
||||||
import javax.sql.DataSource;
|
|
||||||
import world.bentobox.bentobox.BentoBox;
|
import world.bentobox.bentobox.BentoBox;
|
||||||
import world.bentobox.bentobox.database.DatabaseConnector;
|
import world.bentobox.bentobox.database.DatabaseConnector;
|
||||||
import world.bentobox.bentobox.database.json.AbstractJSONDatabaseHandler;
|
import world.bentobox.bentobox.database.json.AbstractJSONDatabaseHandler;
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
package world.bentobox.bentobox.database.sql.mariadb;
|
package world.bentobox.bentobox.database.sql.mariadb;
|
||||||
|
|
||||||
import com.zaxxer.hikari.HikariConfig;
|
|
||||||
import org.eclipse.jdt.annotation.NonNull;
|
import org.eclipse.jdt.annotation.NonNull;
|
||||||
|
|
||||||
|
import com.zaxxer.hikari.HikariConfig;
|
||||||
|
|
||||||
import world.bentobox.bentobox.database.DatabaseConnectionSettingsImpl;
|
import world.bentobox.bentobox.database.DatabaseConnectionSettingsImpl;
|
||||||
import world.bentobox.bentobox.database.sql.SQLDatabaseConnector;
|
import world.bentobox.bentobox.database.sql.SQLDatabaseConnector;
|
||||||
|
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
package world.bentobox.bentobox.database.sql.mysql;
|
package world.bentobox.bentobox.database.sql.mysql;
|
||||||
|
|
||||||
import com.zaxxer.hikari.HikariConfig;
|
|
||||||
import org.eclipse.jdt.annotation.NonNull;
|
import org.eclipse.jdt.annotation.NonNull;
|
||||||
|
|
||||||
|
import com.zaxxer.hikari.HikariConfig;
|
||||||
|
|
||||||
import world.bentobox.bentobox.database.DatabaseConnectionSettingsImpl;
|
import world.bentobox.bentobox.database.DatabaseConnectionSettingsImpl;
|
||||||
import world.bentobox.bentobox.database.sql.SQLDatabaseConnector;
|
import world.bentobox.bentobox.database.sql.SQLDatabaseConnector;
|
||||||
|
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
package world.bentobox.bentobox.database.sql.postgresql;
|
package world.bentobox.bentobox.database.sql.postgresql;
|
||||||
|
|
||||||
import com.zaxxer.hikari.HikariConfig;
|
|
||||||
import org.eclipse.jdt.annotation.NonNull;
|
import org.eclipse.jdt.annotation.NonNull;
|
||||||
|
|
||||||
|
import com.zaxxer.hikari.HikariConfig;
|
||||||
|
|
||||||
import world.bentobox.bentobox.database.DatabaseConnectionSettingsImpl;
|
import world.bentobox.bentobox.database.DatabaseConnectionSettingsImpl;
|
||||||
import world.bentobox.bentobox.database.sql.SQLDatabaseConnector;
|
import world.bentobox.bentobox.database.sql.SQLDatabaseConnector;
|
||||||
|
|
||||||
|
@ -151,9 +151,8 @@ public class YamlDatabaseConnector implements DatabaseConnector {
|
|||||||
for (Entry<String, String> e : commentMap.entrySet()) {
|
for (Entry<String, String> e : commentMap.entrySet()) {
|
||||||
if (nextLine.contains(e.getKey())) {
|
if (nextLine.contains(e.getKey())) {
|
||||||
// We want the comment to start at the same level as the entry
|
// We want the comment to start at the same level as the entry
|
||||||
String commentLine = " ".repeat(Math.max(0, nextLine.indexOf(e.getKey()))) +
|
nextLine = " ".repeat(Math.max(0, nextLine.indexOf(e.getKey()))) +
|
||||||
e.getValue();
|
e.getValue();
|
||||||
nextLine = commentLine;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -148,7 +148,7 @@ public class PortalTeleportationListener implements Listener {
|
|||||||
// Do nothing
|
// Do nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,7 +4,6 @@ import java.util.Arrays;
|
|||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
@ -39,7 +38,7 @@ public class GeoMobLimitTab implements Tab, ClickHandler {
|
|||||||
.filter(EntityType::isAlive)
|
.filter(EntityType::isAlive)
|
||||||
.filter(t -> !(t.equals(EntityType.PLAYER) || t.equals(EntityType.GIANT) || t.equals(EntityType.ARMOR_STAND)))
|
.filter(t -> !(t.equals(EntityType.PLAYER) || t.equals(EntityType.GIANT) || t.equals(EntityType.ARMOR_STAND)))
|
||||||
.sorted(Comparator.comparing(EntityType::name))
|
.sorted(Comparator.comparing(EntityType::name))
|
||||||
.collect(Collectors.toList()));
|
.toList());
|
||||||
|
|
||||||
public enum EntityLimitTabType {
|
public enum EntityLimitTabType {
|
||||||
GEO_LIMIT,
|
GEO_LIMIT,
|
||||||
@ -110,7 +109,7 @@ public class GeoMobLimitTab implements Tab, ClickHandler {
|
|||||||
@Override
|
@Override
|
||||||
public List<@Nullable PanelItem> getPanelItems() {
|
public List<@Nullable PanelItem> getPanelItems() {
|
||||||
// Make panel items
|
// Make panel items
|
||||||
return LIVING_ENTITY_TYPES.stream().map(c -> getPanelItem(c, user)).collect(Collectors.toList());
|
return LIVING_ENTITY_TYPES.stream().map(c -> getPanelItem(c, user)).toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package world.bentobox.bentobox.listeners.flags.protection;
|
package world.bentobox.bentobox.listeners.flags.protection;
|
||||||
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
|
@ -6,7 +6,6 @@ import org.bukkit.block.data.BlockData;
|
|||||||
import org.bukkit.entity.AbstractArrow;
|
import org.bukkit.entity.AbstractArrow;
|
||||||
import org.bukkit.entity.ArmorStand;
|
import org.bukkit.entity.ArmorStand;
|
||||||
import org.bukkit.entity.EnderCrystal;
|
import org.bukkit.entity.EnderCrystal;
|
||||||
import org.bukkit.entity.EntityType;
|
|
||||||
import org.bukkit.entity.ItemFrame;
|
import org.bukkit.entity.ItemFrame;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.entity.Projectile;
|
import org.bukkit.entity.Projectile;
|
||||||
|
@ -2,7 +2,15 @@ package world.bentobox.bentobox.listeners.flags.protection;
|
|||||||
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.entity.*;
|
import org.bukkit.entity.Allay;
|
||||||
|
import org.bukkit.entity.Animals;
|
||||||
|
import org.bukkit.entity.ArmorStand;
|
||||||
|
import org.bukkit.entity.Boat;
|
||||||
|
import org.bukkit.entity.ChestBoat;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.entity.Vehicle;
|
||||||
|
import org.bukkit.entity.Villager;
|
||||||
|
import org.bukkit.entity.WanderingTrader;
|
||||||
import org.bukkit.entity.minecart.HopperMinecart;
|
import org.bukkit.entity.minecart.HopperMinecart;
|
||||||
import org.bukkit.entity.minecart.PoweredMinecart;
|
import org.bukkit.entity.minecart.PoweredMinecart;
|
||||||
import org.bukkit.entity.minecart.RideableMinecart;
|
import org.bukkit.entity.minecart.RideableMinecart;
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package world.bentobox.bentobox.listeners.flags.protection;
|
package world.bentobox.bentobox.listeners.flags.protection;
|
||||||
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.Tag;
|
import org.bukkit.Tag;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.entity.Projectile;
|
import org.bukkit.entity.Projectile;
|
||||||
|
@ -90,10 +90,7 @@ public class PlaceBlocksListener extends FlagListener
|
|||||||
|
|
||||||
switch (e.getClickedBlock().getType())
|
switch (e.getClickedBlock().getType())
|
||||||
{
|
{
|
||||||
case FIREWORK_ROCKET ->
|
case FIREWORK_ROCKET -> this.checkIsland(e, e.getPlayer(), e.getClickedBlock().getLocation(), Flags.PLACE_BLOCKS);
|
||||||
{
|
|
||||||
this.checkIsland(e, e.getPlayer(), e.getClickedBlock().getLocation(), Flags.PLACE_BLOCKS);
|
|
||||||
}
|
|
||||||
case RAIL, POWERED_RAIL, DETECTOR_RAIL, ACTIVATOR_RAIL ->
|
case RAIL, POWERED_RAIL, DETECTOR_RAIL, ACTIVATOR_RAIL ->
|
||||||
{
|
{
|
||||||
if (e.getMaterial() == Material.MINECART ||
|
if (e.getMaterial() == Material.MINECART ||
|
||||||
|
@ -3,7 +3,8 @@ package world.bentobox.bentobox.listeners.flags.settings;
|
|||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.entity.*;
|
import org.bukkit.entity.Entity;
|
||||||
|
import org.bukkit.entity.PufferFish;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
import org.bukkit.event.entity.CreatureSpawnEvent;
|
import org.bukkit.event.entity.CreatureSpawnEvent;
|
||||||
|
@ -7,11 +7,12 @@
|
|||||||
package world.bentobox.bentobox.listeners.flags.worldsettings;
|
package world.bentobox.bentobox.listeners.flags.worldsettings;
|
||||||
|
|
||||||
|
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
import org.bukkit.event.raid.RaidTriggerEvent;
|
import org.bukkit.event.raid.RaidTriggerEvent;
|
||||||
import java.util.Optional;
|
|
||||||
|
|
||||||
import world.bentobox.bentobox.api.flags.FlagListener;
|
import world.bentobox.bentobox.api.flags.FlagListener;
|
||||||
import world.bentobox.bentobox.api.user.User;
|
import world.bentobox.bentobox.api.user.User;
|
||||||
|
@ -7,6 +7,13 @@
|
|||||||
package world.bentobox.bentobox.listeners.teleports;
|
package world.bentobox.bentobox.listeners.teleports;
|
||||||
|
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Optional;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
@ -14,7 +21,6 @@ import org.bukkit.World;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.eclipse.jdt.annotation.NonNull;
|
import org.eclipse.jdt.annotation.NonNull;
|
||||||
import org.eclipse.jdt.annotation.Nullable;
|
import org.eclipse.jdt.annotation.Nullable;
|
||||||
import java.util.*;
|
|
||||||
|
|
||||||
import world.bentobox.bentobox.BentoBox;
|
import world.bentobox.bentobox.BentoBox;
|
||||||
import world.bentobox.bentobox.api.addons.GameModeAddon;
|
import world.bentobox.bentobox.api.addons.GameModeAddon;
|
||||||
|
@ -7,6 +7,8 @@
|
|||||||
package world.bentobox.bentobox.listeners.teleports;
|
package world.bentobox.bentobox.listeners.teleports;
|
||||||
|
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
@ -22,8 +24,6 @@ import org.bukkit.event.entity.EntityPortalExitEvent;
|
|||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
import org.eclipse.jdt.annotation.NonNull;
|
import org.eclipse.jdt.annotation.NonNull;
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
import world.bentobox.bentobox.BentoBox;
|
import world.bentobox.bentobox.BentoBox;
|
||||||
import world.bentobox.bentobox.lists.Flags;
|
import world.bentobox.bentobox.lists.Flags;
|
||||||
import world.bentobox.bentobox.util.Util;
|
import world.bentobox.bentobox.util.Util;
|
||||||
|
@ -7,6 +7,9 @@
|
|||||||
package world.bentobox.bentobox.listeners.teleports;
|
package world.bentobox.bentobox.listeners.teleports;
|
||||||
|
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
@ -25,9 +28,6 @@ import org.bukkit.event.player.PlayerTeleportEvent;
|
|||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
import org.eclipse.jdt.annotation.NonNull;
|
import org.eclipse.jdt.annotation.NonNull;
|
||||||
|
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
import world.bentobox.bentobox.BentoBox;
|
import world.bentobox.bentobox.BentoBox;
|
||||||
import world.bentobox.bentobox.blueprints.Blueprint;
|
import world.bentobox.bentobox.blueprints.Blueprint;
|
||||||
import world.bentobox.bentobox.blueprints.BlueprintPaster;
|
import world.bentobox.bentobox.blueprints.BlueprintPaster;
|
||||||
@ -55,9 +55,9 @@ public class PlayerTeleportListener extends AbstractTeleportListener implements
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// ---------------------------------------------------------------------
|
// ---------------------------------------------------------------------
|
||||||
// Section: Listeners
|
// Section: Listeners
|
||||||
// ---------------------------------------------------------------------
|
// ---------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -76,8 +76,9 @@ public class PlayerTeleportListener extends AbstractTeleportListener implements
|
|||||||
{
|
{
|
||||||
switch (event.getCause())
|
switch (event.getCause())
|
||||||
{
|
{
|
||||||
case NETHER_PORTAL -> this.portalProcess(event, World.Environment.NETHER);
|
case NETHER_PORTAL -> this.portalProcess(event, World.Environment.NETHER);
|
||||||
case END_PORTAL, END_GATEWAY -> this.portalProcess(event, World.Environment.THE_END);
|
case END_PORTAL, END_GATEWAY -> this.portalProcess(event, World.Environment.THE_END);
|
||||||
|
default -> throw new IllegalArgumentException("Unexpected value: " + event.getCause());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -101,7 +102,7 @@ public class PlayerTeleportListener extends AbstractTeleportListener implements
|
|||||||
UUID uuid = entity.getUniqueId();
|
UUID uuid = entity.getUniqueId();
|
||||||
|
|
||||||
if (this.inPortal.contains(uuid) ||
|
if (this.inPortal.contains(uuid) ||
|
||||||
!this.plugin.getIWM().inWorld(Util.getWorld(event.getLocation().getWorld())))
|
!this.plugin.getIWM().inWorld(Util.getWorld(event.getLocation().getWorld())))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -120,12 +121,12 @@ public class PlayerTeleportListener extends AbstractTeleportListener implements
|
|||||||
{
|
{
|
||||||
// Create new PlayerPortalEvent
|
// Create new PlayerPortalEvent
|
||||||
PlayerPortalEvent en = new PlayerPortalEvent((Player) entity,
|
PlayerPortalEvent en = new PlayerPortalEvent((Player) entity,
|
||||||
event.getLocation(),
|
event.getLocation(),
|
||||||
null,
|
null,
|
||||||
PlayerTeleportEvent.TeleportCause.NETHER_PORTAL,
|
PlayerTeleportEvent.TeleportCause.NETHER_PORTAL,
|
||||||
0,
|
0,
|
||||||
false,
|
false,
|
||||||
0);
|
0);
|
||||||
|
|
||||||
this.portalProcess(en, World.Environment.NETHER);
|
this.portalProcess(en, World.Environment.NETHER);
|
||||||
}
|
}
|
||||||
@ -138,12 +139,12 @@ public class PlayerTeleportListener extends AbstractTeleportListener implements
|
|||||||
{
|
{
|
||||||
// Create new PlayerPortalEvent
|
// Create new PlayerPortalEvent
|
||||||
PlayerPortalEvent en = new PlayerPortalEvent((Player) entity,
|
PlayerPortalEvent en = new PlayerPortalEvent((Player) entity,
|
||||||
event.getLocation(),
|
event.getLocation(),
|
||||||
null,
|
null,
|
||||||
type.equals(Material.END_PORTAL) ? PlayerTeleportEvent.TeleportCause.END_PORTAL : PlayerTeleportEvent.TeleportCause.END_GATEWAY,
|
type.equals(Material.END_PORTAL) ? PlayerTeleportEvent.TeleportCause.END_PORTAL : PlayerTeleportEvent.TeleportCause.END_GATEWAY,
|
||||||
0,
|
0,
|
||||||
false,
|
false,
|
||||||
0);
|
0);
|
||||||
|
|
||||||
this.portalProcess(en, World.Environment.THE_END);
|
this.portalProcess(en, World.Environment.THE_END);
|
||||||
}
|
}
|
||||||
@ -212,24 +213,24 @@ public class PlayerTeleportListener extends AbstractTeleportListener implements
|
|||||||
event.setRespawnLocation(location);
|
event.setRespawnLocation(location);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
() -> {
|
() -> {
|
||||||
// Player does not an island. Try to get spawn island, and if that fails, use world spawn point.
|
// Player does not an island. Try to get spawn island, and if that fails, use world spawn point.
|
||||||
// If spawn point is not safe, do nothing. Let server handle it.
|
// If spawn point is not safe, do nothing. Let server handle it.
|
||||||
|
|
||||||
Location spawnLocation = this.getSpawnLocation(overWorld);
|
Location spawnLocation = this.getSpawnLocation(overWorld);
|
||||||
|
|
||||||
if (spawnLocation != null)
|
if (spawnLocation != null)
|
||||||
{
|
{
|
||||||
event.setRespawnLocation(spawnLocation);
|
event.setRespawnLocation(spawnLocation);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// ---------------------------------------------------------------------
|
// ---------------------------------------------------------------------
|
||||||
// Section: Processors
|
// Section: Processors
|
||||||
// ---------------------------------------------------------------------
|
// ---------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -286,7 +287,7 @@ public class PlayerTeleportListener extends AbstractTeleportListener implements
|
|||||||
|
|
||||||
// To the nether/end or overworld.
|
// To the nether/end or overworld.
|
||||||
World toWorld = !fromWorld.getEnvironment().equals(environment) ?
|
World toWorld = !fromWorld.getEnvironment().equals(environment) ?
|
||||||
this.getNetherEndWorld(overWorld, environment) : overWorld;
|
this.getNetherEndWorld(overWorld, environment) : overWorld;
|
||||||
|
|
||||||
// Set whether portals should be created or not
|
// Set whether portals should be created or not
|
||||||
event.setCanCreatePortal(this.isMakePortals(overWorld, environment));
|
event.setCanCreatePortal(this.isMakePortals(overWorld, environment));
|
||||||
@ -300,14 +301,14 @@ public class PlayerTeleportListener extends AbstractTeleportListener implements
|
|||||||
|
|
||||||
// Find the distance from edge of island's protection and set the search radius
|
// Find the distance from edge of island's protection and set the search radius
|
||||||
this.getIsland(event.getTo()).ifPresent(island ->
|
this.getIsland(event.getTo()).ifPresent(island ->
|
||||||
event.setSearchRadius(this.calculateSearchRadius(event.getTo(), island)));
|
event.setSearchRadius(this.calculateSearchRadius(event.getTo(), island)));
|
||||||
|
|
||||||
// Check if there is an island there or not
|
// Check if there is an island there or not
|
||||||
if (this.isPastingMissingIslands(overWorld) &&
|
if (this.isPastingMissingIslands(overWorld) &&
|
||||||
this.isAllowedInConfig(overWorld, environment) &&
|
this.isAllowedInConfig(overWorld, environment) &&
|
||||||
this.isIslandWorld(overWorld, environment) &&
|
this.isIslandWorld(overWorld, environment) &&
|
||||||
this.getNetherEndWorld(overWorld, environment) != null &&
|
this.getNetherEndWorld(overWorld, environment) != null &&
|
||||||
this.getIsland(event.getTo()).
|
this.getIsland(event.getTo()).
|
||||||
filter(island -> !this.hasPartnerIsland(island, environment)).
|
filter(island -> !this.hasPartnerIsland(island, environment)).
|
||||||
map(island -> {
|
map(island -> {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
@ -345,15 +346,15 @@ public class PlayerTeleportListener extends AbstractTeleportListener implements
|
|||||||
{
|
{
|
||||||
// Else manually teleport entity
|
// Else manually teleport entity
|
||||||
ClosestSafeSpotTeleport.builder(this.plugin).
|
ClosestSafeSpotTeleport.builder(this.plugin).
|
||||||
entity(event.getPlayer()).
|
entity(event.getPlayer()).
|
||||||
location(event.getTo()).
|
location(event.getTo()).
|
||||||
portal().
|
portal().
|
||||||
successRunnable(() -> {
|
successRunnable(() -> {
|
||||||
// Reset velocity just in case.
|
// Reset velocity just in case.
|
||||||
event.getPlayer().setVelocity(new Vector(0,0,0));
|
event.getPlayer().setVelocity(new Vector(0,0,0));
|
||||||
event.getPlayer().setFallDistance(0);
|
event.getPlayer().setFallDistance(0);
|
||||||
}).
|
}).
|
||||||
build();
|
build();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -366,15 +367,15 @@ public class PlayerTeleportListener extends AbstractTeleportListener implements
|
|||||||
* @param environment - environment involved
|
* @param environment - environment involved
|
||||||
*/
|
*/
|
||||||
private void handleToStandardNetherOrEnd(PlayerPortalEvent event,
|
private void handleToStandardNetherOrEnd(PlayerPortalEvent event,
|
||||||
World overWorld,
|
World overWorld,
|
||||||
World.Environment environment)
|
World.Environment environment)
|
||||||
{
|
{
|
||||||
World toWorld = Objects.requireNonNull(this.getNetherEndWorld(overWorld, environment));
|
World toWorld = Objects.requireNonNull(this.getNetherEndWorld(overWorld, environment));
|
||||||
Location spawnPoint = toWorld.getSpawnLocation();
|
Location spawnPoint = toWorld.getSpawnLocation();
|
||||||
|
|
||||||
// If going to the nether and nether portals are active then just teleport to approx location
|
// If going to the nether and nether portals are active then just teleport to approx location
|
||||||
if (environment.equals(World.Environment.NETHER) &&
|
if (environment.equals(World.Environment.NETHER) &&
|
||||||
this.plugin.getIWM().getWorldSettings(overWorld).isMakeNetherPortals())
|
this.plugin.getIWM().getWorldSettings(overWorld).isMakeNetherPortals())
|
||||||
{
|
{
|
||||||
spawnPoint = event.getFrom().toVector().toLocation(toWorld);
|
spawnPoint = event.getFrom().toVector().toLocation(toWorld);
|
||||||
}
|
}
|
||||||
@ -396,10 +397,10 @@ public class PlayerTeleportListener extends AbstractTeleportListener implements
|
|||||||
{
|
{
|
||||||
// Teleport to standard nether or end
|
// Teleport to standard nether or end
|
||||||
ClosestSafeSpotTeleport.builder(this.plugin).
|
ClosestSafeSpotTeleport.builder(this.plugin).
|
||||||
entity(event.getPlayer()).
|
entity(event.getPlayer()).
|
||||||
location(spawnPoint).
|
location(spawnPoint).
|
||||||
portal().
|
portal().
|
||||||
build();
|
build();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -413,14 +414,14 @@ public class PlayerTeleportListener extends AbstractTeleportListener implements
|
|||||||
private void handleFromStandardNetherOrEnd(PlayerPortalEvent event, World overWorld, World.Environment environment)
|
private void handleFromStandardNetherOrEnd(PlayerPortalEvent event, World overWorld, World.Environment environment)
|
||||||
{
|
{
|
||||||
if (environment.equals(World.Environment.NETHER) &&
|
if (environment.equals(World.Environment.NETHER) &&
|
||||||
this.plugin.getIWM().getWorldSettings(overWorld).isMakeNetherPortals())
|
this.plugin.getIWM().getWorldSettings(overWorld).isMakeNetherPortals())
|
||||||
{
|
{
|
||||||
// Set to location directly to the from location.
|
// Set to location directly to the from location.
|
||||||
event.setTo(event.getFrom().toVector().toLocation(overWorld));
|
event.setTo(event.getFrom().toVector().toLocation(overWorld));
|
||||||
|
|
||||||
// Update portal search radius.
|
// Update portal search radius.
|
||||||
this.getIsland(event.getTo()).ifPresent(island ->
|
this.getIsland(event.getTo()).ifPresent(island ->
|
||||||
event.setSearchRadius(this.calculateSearchRadius(event.getTo(), island)));
|
event.setSearchRadius(this.calculateSearchRadius(event.getTo(), island)));
|
||||||
|
|
||||||
event.setCanCreatePortal(true);
|
event.setCanCreatePortal(true);
|
||||||
// event.setCreationRadius(16); 16 is default creation radius.
|
// event.setCreationRadius(16); 16 is default creation radius.
|
||||||
@ -430,14 +431,14 @@ public class PlayerTeleportListener extends AbstractTeleportListener implements
|
|||||||
// Cannot be portal. Should recalculate position.
|
// Cannot be portal. Should recalculate position.
|
||||||
// TODO: Currently, it is always spawn location. However, default home must be assigned.
|
// TODO: Currently, it is always spawn location. However, default home must be assigned.
|
||||||
Location toLocation = this.getIsland(overWorld, event.getPlayer()).
|
Location toLocation = this.getIsland(overWorld, event.getPlayer()).
|
||||||
map(island -> island.getSpawnPoint(World.Environment.NORMAL)).
|
map(island -> island.getSpawnPoint(World.Environment.NORMAL)).
|
||||||
orElseGet(() -> {
|
orElseGet(() -> {
|
||||||
// If player do not have island, try spawn.
|
// If player do not have island, try spawn.
|
||||||
Location spawnLocation = this.getSpawnLocation(overWorld);
|
Location spawnLocation = this.getSpawnLocation(overWorld);
|
||||||
return spawnLocation == null ?
|
return spawnLocation == null ?
|
||||||
event.getFrom().toVector().toLocation(overWorld) :
|
event.getFrom().toVector().toLocation(overWorld) :
|
||||||
spawnLocation;
|
spawnLocation;
|
||||||
});
|
});
|
||||||
|
|
||||||
event.setTo(toLocation);
|
event.setTo(toLocation);
|
||||||
}
|
}
|
||||||
@ -449,10 +450,10 @@ public class PlayerTeleportListener extends AbstractTeleportListener implements
|
|||||||
|
|
||||||
// Teleport to standard nether or end
|
// Teleport to standard nether or end
|
||||||
ClosestSafeSpotTeleport.builder(this.plugin).
|
ClosestSafeSpotTeleport.builder(this.plugin).
|
||||||
entity(event.getPlayer()).
|
entity(event.getPlayer()).
|
||||||
location(event.getTo()).
|
location(event.getTo()).
|
||||||
portal().
|
portal().
|
||||||
build();
|
build();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -465,9 +466,9 @@ public class PlayerTeleportListener extends AbstractTeleportListener implements
|
|||||||
* @param environment - NETHER or THE_END
|
* @param environment - NETHER or THE_END
|
||||||
*/
|
*/
|
||||||
private void pasteNewIsland(Player player,
|
private void pasteNewIsland(Player player,
|
||||||
Location to,
|
Location to,
|
||||||
Island island,
|
Island island,
|
||||||
World.Environment environment)
|
World.Environment environment)
|
||||||
{
|
{
|
||||||
// Paste then teleport player
|
// Paste then teleport player
|
||||||
this.plugin.getIWM().getAddon(island.getWorld()).ifPresent(addon ->
|
this.plugin.getIWM().getAddon(island.getWorld()).ifPresent(addon ->
|
||||||
@ -478,13 +479,13 @@ public class PlayerTeleportListener extends AbstractTeleportListener implements
|
|||||||
if (blueprintBundle != null)
|
if (blueprintBundle != null)
|
||||||
{
|
{
|
||||||
Blueprint bluePrint = this.plugin.getBlueprintsManager().getBlueprints(addon).
|
Blueprint bluePrint = this.plugin.getBlueprintsManager().getBlueprints(addon).
|
||||||
get(blueprintBundle.getBlueprint(environment));
|
get(blueprintBundle.getBlueprint(environment));
|
||||||
|
|
||||||
if (bluePrint != null)
|
if (bluePrint != null)
|
||||||
{
|
{
|
||||||
new BlueprintPaster(this.plugin, bluePrint, to.getWorld(), island).
|
new BlueprintPaster(this.plugin, bluePrint, to.getWorld(), island).
|
||||||
paste().
|
paste().
|
||||||
thenAccept(state -> ClosestSafeSpotTeleport.builder(this.plugin).
|
thenAccept(state -> ClosestSafeSpotTeleport.builder(this.plugin).
|
||||||
entity(player).
|
entity(player).
|
||||||
location(island.getSpawnPoint(environment) == null ? to : island.getSpawnPoint(environment)).
|
location(island.getSpawnPoint(environment) == null ? to : island.getSpawnPoint(environment)).
|
||||||
portal().
|
portal().
|
||||||
@ -493,7 +494,7 @@ public class PlayerTeleportListener extends AbstractTeleportListener implements
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
this.plugin.logError("Could not paste default island in nether or end. " +
|
this.plugin.logError("Could not paste default island in nether or end. " +
|
||||||
"Is there a nether-island or end-island blueprint?");
|
"Is there a nether-island or end-island blueprint?");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -1,24 +1,73 @@
|
|||||||
package world.bentobox.bentobox.lists;
|
package world.bentobox.bentobox.lists;
|
||||||
|
|
||||||
import com.google.common.base.Enums;
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
|
|
||||||
|
import com.google.common.base.Enums;
|
||||||
|
|
||||||
import world.bentobox.bentobox.api.flags.Flag;
|
import world.bentobox.bentobox.api.flags.Flag;
|
||||||
import world.bentobox.bentobox.api.flags.Flag.Type;
|
import world.bentobox.bentobox.api.flags.Flag.Type;
|
||||||
import world.bentobox.bentobox.api.flags.clicklisteners.CycleClick;
|
import world.bentobox.bentobox.api.flags.clicklisteners.CycleClick;
|
||||||
import world.bentobox.bentobox.listeners.flags.clicklisteners.CommandRankClickListener;
|
import world.bentobox.bentobox.listeners.flags.clicklisteners.CommandRankClickListener;
|
||||||
import world.bentobox.bentobox.listeners.flags.clicklisteners.GeoLimitClickListener;
|
import world.bentobox.bentobox.listeners.flags.clicklisteners.GeoLimitClickListener;
|
||||||
import world.bentobox.bentobox.listeners.flags.clicklisteners.MobLimitClickListener;
|
import world.bentobox.bentobox.listeners.flags.clicklisteners.MobLimitClickListener;
|
||||||
import world.bentobox.bentobox.listeners.flags.protection.*;
|
import world.bentobox.bentobox.listeners.flags.protection.BlockInteractionListener;
|
||||||
|
import world.bentobox.bentobox.listeners.flags.protection.BreakBlocksListener;
|
||||||
|
import world.bentobox.bentobox.listeners.flags.protection.BreedingListener;
|
||||||
|
import world.bentobox.bentobox.listeners.flags.protection.BucketListener;
|
||||||
|
import world.bentobox.bentobox.listeners.flags.protection.DyeListener;
|
||||||
|
import world.bentobox.bentobox.listeners.flags.protection.EggListener;
|
||||||
|
import world.bentobox.bentobox.listeners.flags.protection.ElytraListener;
|
||||||
|
import world.bentobox.bentobox.listeners.flags.protection.EntityInteractListener;
|
||||||
|
import world.bentobox.bentobox.listeners.flags.protection.ExperiencePickupListener;
|
||||||
|
import world.bentobox.bentobox.listeners.flags.protection.FireListener;
|
||||||
|
import world.bentobox.bentobox.listeners.flags.protection.HurtingListener;
|
||||||
|
import world.bentobox.bentobox.listeners.flags.protection.InventoryListener;
|
||||||
|
import world.bentobox.bentobox.listeners.flags.protection.ItemDropPickUpListener;
|
||||||
|
import world.bentobox.bentobox.listeners.flags.protection.LeashListener;
|
||||||
|
import world.bentobox.bentobox.listeners.flags.protection.LecternListener;
|
||||||
|
import world.bentobox.bentobox.listeners.flags.protection.LockAndBanListener;
|
||||||
|
import world.bentobox.bentobox.listeners.flags.protection.PaperExperiencePickupListener;
|
||||||
|
import world.bentobox.bentobox.listeners.flags.protection.PhysicalInteractionListener;
|
||||||
|
import world.bentobox.bentobox.listeners.flags.protection.PlaceBlocksListener;
|
||||||
|
import world.bentobox.bentobox.listeners.flags.protection.PortalListener;
|
||||||
|
import world.bentobox.bentobox.listeners.flags.protection.SculkSensorListener;
|
||||||
|
import world.bentobox.bentobox.listeners.flags.protection.SculkShriekerListener;
|
||||||
|
import world.bentobox.bentobox.listeners.flags.protection.ShearingListener;
|
||||||
|
import world.bentobox.bentobox.listeners.flags.protection.TNTListener;
|
||||||
|
import world.bentobox.bentobox.listeners.flags.protection.TeleportationListener;
|
||||||
|
import world.bentobox.bentobox.listeners.flags.protection.ThrowingListener;
|
||||||
import world.bentobox.bentobox.listeners.flags.settings.DecayListener;
|
import world.bentobox.bentobox.listeners.flags.settings.DecayListener;
|
||||||
import world.bentobox.bentobox.listeners.flags.settings.MobSpawnListener;
|
import world.bentobox.bentobox.listeners.flags.settings.MobSpawnListener;
|
||||||
import world.bentobox.bentobox.listeners.flags.settings.PVPListener;
|
import world.bentobox.bentobox.listeners.flags.settings.PVPListener;
|
||||||
import world.bentobox.bentobox.listeners.flags.worldsettings.*;
|
import world.bentobox.bentobox.listeners.flags.worldsettings.ChestDamageListener;
|
||||||
|
import world.bentobox.bentobox.listeners.flags.worldsettings.CleanSuperFlatListener;
|
||||||
|
import world.bentobox.bentobox.listeners.flags.worldsettings.CoarseDirtTillingListener;
|
||||||
|
import world.bentobox.bentobox.listeners.flags.worldsettings.CreeperListener;
|
||||||
|
import world.bentobox.bentobox.listeners.flags.worldsettings.EnderChestListener;
|
||||||
|
import world.bentobox.bentobox.listeners.flags.worldsettings.EndermanListener;
|
||||||
|
import world.bentobox.bentobox.listeners.flags.worldsettings.EnterExitListener;
|
||||||
|
import world.bentobox.bentobox.listeners.flags.worldsettings.GeoLimitMobsListener;
|
||||||
|
import world.bentobox.bentobox.listeners.flags.worldsettings.InvincibleVisitorsListener;
|
||||||
|
import world.bentobox.bentobox.listeners.flags.worldsettings.IslandRespawnListener;
|
||||||
|
import world.bentobox.bentobox.listeners.flags.worldsettings.ItemFrameListener;
|
||||||
|
import world.bentobox.bentobox.listeners.flags.worldsettings.LimitMobsListener;
|
||||||
|
import world.bentobox.bentobox.listeners.flags.worldsettings.LiquidsFlowingOutListener;
|
||||||
|
import world.bentobox.bentobox.listeners.flags.worldsettings.NaturalSpawningOutsideRangeListener;
|
||||||
|
import world.bentobox.bentobox.listeners.flags.worldsettings.ObsidianScoopingListener;
|
||||||
|
import world.bentobox.bentobox.listeners.flags.worldsettings.OfflineGrowthListener;
|
||||||
|
import world.bentobox.bentobox.listeners.flags.worldsettings.OfflineRedstoneListener;
|
||||||
|
import world.bentobox.bentobox.listeners.flags.worldsettings.PetTeleportListener;
|
||||||
|
import world.bentobox.bentobox.listeners.flags.worldsettings.PistonPushListener;
|
||||||
|
import world.bentobox.bentobox.listeners.flags.worldsettings.RemoveMobsListener;
|
||||||
|
import world.bentobox.bentobox.listeners.flags.worldsettings.SpawnerSpawnEggsListener;
|
||||||
|
import world.bentobox.bentobox.listeners.flags.worldsettings.TreesGrowingOutsideRangeListener;
|
||||||
|
import world.bentobox.bentobox.listeners.flags.worldsettings.VisitorKeepInventoryListener;
|
||||||
|
import world.bentobox.bentobox.listeners.flags.worldsettings.VisitorsStartingRaidListener;
|
||||||
|
import world.bentobox.bentobox.listeners.flags.worldsettings.WitherListener;
|
||||||
import world.bentobox.bentobox.managers.RanksManager;
|
import world.bentobox.bentobox.managers.RanksManager;
|
||||||
import world.bentobox.bentobox.util.Util;
|
import world.bentobox.bentobox.util.Util;
|
||||||
|
|
||||||
@ -592,6 +641,6 @@ public final class Flags {
|
|||||||
Bukkit.getLogger().severe("Could not get Flag values " + e.getMessage());
|
Bukkit.getLogger().severe("Could not get Flag values " + e.getMessage());
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}).collect(Collectors.toList());
|
}).toList();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,6 @@ import java.util.Set;
|
|||||||
import java.util.jar.JarEntry;
|
import java.util.jar.JarEntry;
|
||||||
import java.util.jar.JarFile;
|
import java.util.jar.JarFile;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.configuration.ConfigurationSection;
|
import org.bukkit.configuration.ConfigurationSection;
|
||||||
@ -477,7 +476,7 @@ public class AddonsManager {
|
|||||||
return getEnabledAddons().stream()
|
return getEnabledAddons().stream()
|
||||||
.filter(GameModeAddon.class::isInstance)
|
.filter(GameModeAddon.class::isInstance)
|
||||||
.map(GameModeAddon.class::cast)
|
.map(GameModeAddon.class::cast)
|
||||||
.collect(Collectors.toList());
|
.toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -487,7 +486,7 @@ public class AddonsManager {
|
|||||||
*/
|
*/
|
||||||
@NonNull
|
@NonNull
|
||||||
public List<Addon> getLoadedAddons() {
|
public List<Addon> getLoadedAddons() {
|
||||||
return addons.stream().filter(addon -> addon.getState().equals(Addon.State.LOADED)).collect(Collectors.toList());
|
return addons.stream().filter(addon -> addon.getState().equals(Addon.State.LOADED)).toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -497,7 +496,7 @@ public class AddonsManager {
|
|||||||
*/
|
*/
|
||||||
@NonNull
|
@NonNull
|
||||||
public List<Addon> getEnabledAddons() {
|
public List<Addon> getEnabledAddons() {
|
||||||
return addons.stream().filter(addon -> addon.getState().equals(Addon.State.ENABLED)).collect(Collectors.toList());
|
return addons.stream().filter(addon -> addon.getState().equals(Addon.State.ENABLED)).toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
@ -535,7 +534,7 @@ public class AddonsManager {
|
|||||||
*/
|
*/
|
||||||
private void sortAddons() {
|
private void sortAddons() {
|
||||||
// Lists all available addons as names.
|
// Lists all available addons as names.
|
||||||
List<String> names = addons.stream().map(a -> a.getDescription().getName()).collect(Collectors.toList());
|
List<String> names = addons.stream().map(a -> a.getDescription().getName()).toList();
|
||||||
|
|
||||||
// Check that any dependencies exist
|
// Check that any dependencies exist
|
||||||
Iterator<Addon> addonsIterator = addons.iterator();
|
Iterator<Addon> addonsIterator = addons.iterator();
|
||||||
@ -556,7 +555,7 @@ public class AddonsManager {
|
|||||||
addons.stream().filter(a -> a.getDescription().getDependencies().isEmpty() && a.getDescription().getSoftDependencies().isEmpty())
|
addons.stream().filter(a -> a.getDescription().getDependencies().isEmpty() && a.getDescription().getSoftDependencies().isEmpty())
|
||||||
.forEach(a -> sortedAddons.put(a.getDescription().getName(), a));
|
.forEach(a -> sortedAddons.put(a.getDescription().getName(), a));
|
||||||
// Fill remaining
|
// Fill remaining
|
||||||
List<Addon> remaining = addons.stream().filter(a -> !sortedAddons.containsKey(a.getDescription().getName())).collect(Collectors.toList());
|
List<Addon> remaining = addons.stream().filter(a -> !sortedAddons.containsKey(a.getDescription().getName())).toList();
|
||||||
|
|
||||||
// Run through remaining addons
|
// Run through remaining addons
|
||||||
remaining.forEach(addon -> {
|
remaining.forEach(addon -> {
|
||||||
@ -587,7 +586,7 @@ public class AddonsManager {
|
|||||||
public ChunkGenerator getDefaultWorldGenerator(String worldName, String id) {
|
public ChunkGenerator getDefaultWorldGenerator(String worldName, String id) {
|
||||||
// Clean up world name
|
// Clean up world name
|
||||||
String w = worldName.replace("_nether", "").replace("_the_end", "").toLowerCase(Locale.ENGLISH);
|
String w = worldName.replace("_nether", "").replace("_the_end", "").toLowerCase(Locale.ENGLISH);
|
||||||
if (worldNames.containsKey(w)) {
|
if (worldNames.containsKey(w) && worldNames.get(w) != null) {
|
||||||
return worldNames.get(w).getDefaultWorldGenerator(worldName, id);
|
return worldNames.get(w).getDefaultWorldGenerator(worldName, id);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
@ -658,7 +657,7 @@ public class AddonsManager {
|
|||||||
.filter(DataObject.class::isAssignableFrom)
|
.filter(DataObject.class::isAssignableFrom)
|
||||||
// Do not include config files
|
// Do not include config files
|
||||||
.filter(c -> !ConfigObject.class.isAssignableFrom(c))
|
.filter(c -> !ConfigObject.class.isAssignableFrom(c))
|
||||||
.collect(Collectors.toList());
|
.toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,11 +1,24 @@
|
|||||||
package world.bentobox.bentobox.managers;
|
package world.bentobox.bentobox.managers;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.File;
|
||||||
|
import java.io.FileReader;
|
||||||
|
import java.io.FileWriter;
|
||||||
|
import java.io.IOException;
|
||||||
import java.lang.reflect.ParameterizedType;
|
import java.lang.reflect.ParameterizedType;
|
||||||
import java.lang.reflect.Type;
|
import java.lang.reflect.Type;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.util.*;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.EnumMap;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.InputMismatchException;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Optional;
|
||||||
|
import java.util.Set;
|
||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.jar.JarFile;
|
import java.util.jar.JarFile;
|
||||||
|
@ -71,8 +71,7 @@ public class IslandWorldManager {
|
|||||||
private void registerToWorldManagementPlugins(@NonNull World world, boolean islandWorld) {
|
private void registerToWorldManagementPlugins(@NonNull World world, boolean islandWorld) {
|
||||||
if (plugin.getHooks() != null) {
|
if (plugin.getHooks() != null) {
|
||||||
for (Hook hook : plugin.getHooks().getHooks()) {
|
for (Hook hook : plugin.getHooks().getHooks()) {
|
||||||
if (hook instanceof WorldManagementHook) {
|
if (hook instanceof final WorldManagementHook worldManagementHook) {
|
||||||
final WorldManagementHook worldManagementHook = (WorldManagementHook) hook;
|
|
||||||
if (Bukkit.isPrimaryThread()) {
|
if (Bukkit.isPrimaryThread()) {
|
||||||
worldManagementHook.registerWorld(world, islandWorld);
|
worldManagementHook.registerWorld(world, islandWorld);
|
||||||
} else {
|
} else {
|
||||||
@ -119,7 +118,7 @@ public class IslandWorldManager {
|
|||||||
*/
|
*/
|
||||||
public List<World> getOverWorlds() {
|
public List<World> getOverWorlds() {
|
||||||
return gameModes.keySet().stream().filter(w -> w.getEnvironment().equals(Environment.NORMAL))
|
return gameModes.keySet().stream().filter(w -> w.getEnvironment().equals(Environment.NORMAL))
|
||||||
.collect(Collectors.toList());
|
.toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1700,7 +1700,7 @@ public class IslandsManager {
|
|||||||
@NonNull
|
@NonNull
|
||||||
public List<Island> getQuarantinedIslandByUser(@NonNull World world, @Nullable UUID uuid) {
|
public List<Island> getQuarantinedIslandByUser(@NonNull World world, @Nullable UUID uuid) {
|
||||||
return quarantineCache.getOrDefault(uuid, Collections.emptyList()).stream()
|
return quarantineCache.getOrDefault(uuid, Collections.emptyList()).stream()
|
||||||
.filter(i -> i.getWorld().equals(world)).collect(Collectors.toList());
|
.filter(i -> i.getWorld().equals(world)).toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -8,7 +8,6 @@ import java.util.LinkedList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
import org.eclipse.jdt.annotation.NonNull;
|
import org.eclipse.jdt.annotation.NonNull;
|
||||||
import org.eclipse.jdt.annotation.Nullable;
|
import org.eclipse.jdt.annotation.Nullable;
|
||||||
@ -18,9 +17,9 @@ import com.google.gson.JsonObject;
|
|||||||
import com.google.gson.JsonParseException;
|
import com.google.gson.JsonParseException;
|
||||||
import com.google.gson.JsonParser;
|
import com.google.gson.JsonParser;
|
||||||
|
|
||||||
import io.github.thebusybiscuit.githubjavaapi.GitHubWebAPI;
|
import io.github.TheBusyBiscuit.GitHubWebAPI4Java.GitHubWebAPI;
|
||||||
import io.github.thebusybiscuit.githubjavaapi.objects.repositories.GitHubContributor;
|
import io.github.TheBusyBiscuit.GitHubWebAPI4Java.objects.repositories.GitHubContributor;
|
||||||
import io.github.thebusybiscuit.githubjavaapi.objects.repositories.GitHubRepository;
|
import io.github.TheBusyBiscuit.GitHubWebAPI4Java.objects.repositories.GitHubRepository;
|
||||||
import world.bentobox.bentobox.BentoBox;
|
import world.bentobox.bentobox.BentoBox;
|
||||||
import world.bentobox.bentobox.Settings;
|
import world.bentobox.bentobox.Settings;
|
||||||
import world.bentobox.bentobox.web.catalog.CatalogEntry;
|
import world.bentobox.bentobox.web.catalog.CatalogEntry;
|
||||||
@ -103,7 +102,7 @@ public class WebManager {
|
|||||||
repositories.addAll(plugin.getAddonsManager().getEnabledAddons()
|
repositories.addAll(plugin.getAddonsManager().getEnabledAddons()
|
||||||
.stream().map(addon -> addon.getDescription().getRepository())
|
.stream().map(addon -> addon.getDescription().getRepository())
|
||||||
.filter(repo -> !repo.isEmpty())
|
.filter(repo -> !repo.isEmpty())
|
||||||
.collect(Collectors.toList()));
|
.toList());
|
||||||
|
|
||||||
/* Download the contributors */
|
/* Download the contributors */
|
||||||
if (plugin.getSettings().isLogGithubDownloadData()) {
|
if (plugin.getSettings().isLogGithubDownloadData()) {
|
||||||
|
@ -192,14 +192,9 @@ public class NewIsland {
|
|||||||
event = event.getNewEvent().orElse(event);
|
event = event.getNewEvent().orElse(event);
|
||||||
// Get the new BlueprintBundle if it was changed
|
// Get the new BlueprintBundle if it was changed
|
||||||
switch (reason) {
|
switch (reason) {
|
||||||
case CREATE:
|
case CREATE -> name = ((IslandCreateEvent) event).getBlueprintBundle().getUniqueId();
|
||||||
name = ((IslandCreateEvent) event).getBlueprintBundle().getUniqueId();
|
case RESET -> name = ((IslandResetEvent) event).getBlueprintBundle().getUniqueId();
|
||||||
break;
|
default -> {}
|
||||||
case RESET:
|
|
||||||
name = ((IslandResetEvent) event).getBlueprintBundle().getUniqueId();
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Run task to run after creating the island in one tick if island is not being pasted
|
// Run task to run after creating the island in one tick if island is not being pasted
|
||||||
@ -318,14 +313,10 @@ public class NewIsland {
|
|||||||
// Fire exit event
|
// Fire exit event
|
||||||
Reason reasonDone = Reason.CREATED;
|
Reason reasonDone = Reason.CREATED;
|
||||||
switch (reason) {
|
switch (reason) {
|
||||||
case CREATE:
|
case CREATE -> reasonDone = Reason.CREATED;
|
||||||
reasonDone = Reason.CREATED;
|
case RESET -> reasonDone = Reason.RESETTED;
|
||||||
break;
|
default -> {
|
||||||
case RESET:
|
}
|
||||||
reasonDone = Reason.RESETTED;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
IslandEvent.builder()
|
IslandEvent.builder()
|
||||||
.involvedPlayer(user.getUniqueId())
|
.involvedPlayer(user.getUniqueId())
|
||||||
|
@ -1,15 +1,16 @@
|
|||||||
package world.bentobox.bentobox.nms;
|
package world.bentobox.bentobox.nms;
|
||||||
|
|
||||||
import org.bukkit.Location;
|
|
||||||
import org.bukkit.World;
|
|
||||||
import world.bentobox.bentobox.blueprints.dataobjects.BlueprintBlock;
|
|
||||||
import world.bentobox.bentobox.blueprints.dataobjects.BlueprintEntity;
|
|
||||||
import world.bentobox.bentobox.database.objects.Island;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.World;
|
||||||
|
|
||||||
|
import world.bentobox.bentobox.blueprints.dataobjects.BlueprintBlock;
|
||||||
|
import world.bentobox.bentobox.blueprints.dataobjects.BlueprintEntity;
|
||||||
|
import world.bentobox.bentobox.database.objects.Island;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A helper class for {@link world.bentobox.bentobox.blueprints.BlueprintPaster}
|
* A helper class for {@link world.bentobox.bentobox.blueprints.BlueprintPaster}
|
||||||
*/
|
*/
|
||||||
|
@ -1,6 +1,11 @@
|
|||||||
package world.bentobox.bentobox.nms;
|
package world.bentobox.bentobox.nms;
|
||||||
|
|
||||||
import io.papermc.lib.PaperLib;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Random;
|
||||||
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
|
||||||
import org.bukkit.Chunk;
|
import org.bukkit.Chunk;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.block.data.BlockData;
|
import org.bukkit.block.data.BlockData;
|
||||||
@ -10,17 +15,13 @@ import org.bukkit.generator.ChunkGenerator;
|
|||||||
import org.bukkit.inventory.InventoryHolder;
|
import org.bukkit.inventory.InventoryHolder;
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
import org.bukkit.util.BoundingBox;
|
import org.bukkit.util.BoundingBox;
|
||||||
|
|
||||||
|
import io.papermc.lib.PaperLib;
|
||||||
import world.bentobox.bentobox.BentoBox;
|
import world.bentobox.bentobox.BentoBox;
|
||||||
import world.bentobox.bentobox.api.addons.GameModeAddon;
|
import world.bentobox.bentobox.api.addons.GameModeAddon;
|
||||||
import world.bentobox.bentobox.database.objects.IslandDeletion;
|
import world.bentobox.bentobox.database.objects.IslandDeletion;
|
||||||
import world.bentobox.bentobox.util.MyBiomeGrid;
|
import world.bentobox.bentobox.util.MyBiomeGrid;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Random;
|
|
||||||
import java.util.concurrent.CompletableFuture;
|
|
||||||
|
|
||||||
public abstract class SimpleWorldRegenerator implements WorldRegenerator {
|
public abstract class SimpleWorldRegenerator implements WorldRegenerator {
|
||||||
private final BentoBox plugin;
|
private final BentoBox plugin;
|
||||||
|
|
||||||
|
@ -1,11 +1,12 @@
|
|||||||
package world.bentobox.bentobox.nms;
|
package world.bentobox.bentobox.nms;
|
||||||
|
|
||||||
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
|
|
||||||
import world.bentobox.bentobox.api.addons.GameModeAddon;
|
import world.bentobox.bentobox.api.addons.GameModeAddon;
|
||||||
import world.bentobox.bentobox.database.objects.IslandDeletion;
|
import world.bentobox.bentobox.database.objects.IslandDeletion;
|
||||||
|
|
||||||
import java.util.concurrent.CompletableFuture;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A world generator used by {@link world.bentobox.bentobox.util.DeleteIslandChunks}
|
* A world generator used by {@link world.bentobox.bentobox.util.DeleteIslandChunks}
|
||||||
*/
|
*/
|
||||||
|
@ -1,18 +1,19 @@
|
|||||||
package world.bentobox.bentobox.nms.fallback;
|
package world.bentobox.bentobox.nms.fallback;
|
||||||
|
|
||||||
import org.bukkit.Location;
|
|
||||||
import org.bukkit.World;
|
|
||||||
import world.bentobox.bentobox.blueprints.dataobjects.BlueprintBlock;
|
|
||||||
import world.bentobox.bentobox.blueprints.dataobjects.BlueprintEntity;
|
|
||||||
import world.bentobox.bentobox.database.objects.Island;
|
|
||||||
import world.bentobox.bentobox.nms.PasteHandler;
|
|
||||||
import world.bentobox.bentobox.util.DefaultPasteUtil;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.World;
|
||||||
|
|
||||||
|
import world.bentobox.bentobox.blueprints.dataobjects.BlueprintBlock;
|
||||||
|
import world.bentobox.bentobox.blueprints.dataobjects.BlueprintEntity;
|
||||||
|
import world.bentobox.bentobox.database.objects.Island;
|
||||||
|
import world.bentobox.bentobox.nms.PasteHandler;
|
||||||
|
import world.bentobox.bentobox.util.DefaultPasteUtil;
|
||||||
|
|
||||||
public class PasteHandlerImpl implements PasteHandler {
|
public class PasteHandlerImpl implements PasteHandler {
|
||||||
@Override
|
@Override
|
||||||
public CompletableFuture<Void> pasteBlocks(Island island, World world, Map<Location, BlueprintBlock> blockMap) {
|
public CompletableFuture<Void> pasteBlocks(Island island, World world, Map<Location, BlueprintBlock> blockMap) {
|
||||||
|
@ -2,6 +2,7 @@ package world.bentobox.bentobox.panels;
|
|||||||
|
|
||||||
import java.util.AbstractMap;
|
import java.util.AbstractMap;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -241,7 +242,7 @@ public class BlueprintManagementPanel {
|
|||||||
protected PanelItem getBundleIcon(BlueprintBundle bb) {
|
protected PanelItem getBundleIcon(BlueprintBundle bb) {
|
||||||
return new PanelItemBuilder()
|
return new PanelItemBuilder()
|
||||||
.name(t("edit-description"))
|
.name(t("edit-description"))
|
||||||
.description(bb.getDescription().stream().map(Util::translateColorCodes).collect(Collectors.toList()))
|
.description(bb.getDescription().stream().map(Util::translateColorCodes).toList())
|
||||||
.icon(bb.getIcon())
|
.icon(bb.getIcon())
|
||||||
.clickHandler((panel, u, clickType, slot) -> {
|
.clickHandler((panel, u, clickType, slot) -> {
|
||||||
u.closeInventory();
|
u.closeInventory();
|
||||||
@ -339,7 +340,7 @@ public class BlueprintManagementPanel {
|
|||||||
protected PanelItem getBlueprintItem(GameModeAddon addon, int pos, BlueprintBundle bb, Blueprint blueprint) {
|
protected PanelItem getBlueprintItem(GameModeAddon addon, int pos, BlueprintBundle bb, Blueprint blueprint) {
|
||||||
// Create description
|
// Create description
|
||||||
List<String> desc = blueprint.getDescription() == null ? new ArrayList<>() : blueprint.getDescription();
|
List<String> desc = blueprint.getDescription() == null ? new ArrayList<>() : blueprint.getDescription();
|
||||||
desc = desc.stream().map(Util::translateColorCodes).collect(Collectors.toList());
|
desc = desc.stream().map(Util::translateColorCodes).collect(Collectors.toList()); // Must be mutable
|
||||||
if ((!blueprint.equals(endBlueprint) && !blueprint.equals(normalBlueprint) && !blueprint.equals(netherBlueprint))) {
|
if ((!blueprint.equals(endBlueprint) && !blueprint.equals(normalBlueprint) && !blueprint.equals(netherBlueprint))) {
|
||||||
if ((pos > MIN_WORLD_SLOT && pos < MAX_WORLD_SLOT)) {
|
if ((pos > MIN_WORLD_SLOT && pos < MAX_WORLD_SLOT)) {
|
||||||
desc.add(t("remove"));
|
desc.add(t("remove"));
|
||||||
|
@ -3,7 +3,6 @@ package world.bentobox.bentobox.panels;
|
|||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
import org.eclipse.jdt.annotation.NonNull;
|
import org.eclipse.jdt.annotation.NonNull;
|
||||||
|
|
||||||
@ -40,7 +39,7 @@ public class IslandCreationPanel {
|
|||||||
// Get the bundles
|
// Get the bundles
|
||||||
Comparator<BlueprintBundle> sortByDisplayName = (p, o) -> p.getDisplayName().compareToIgnoreCase(o.getDisplayName());
|
Comparator<BlueprintBundle> sortByDisplayName = (p, o) -> p.getDisplayName().compareToIgnoreCase(o.getDisplayName());
|
||||||
List<BlueprintBundle> bbs = plugin.getBlueprintsManager().getBlueprintBundles(command.getAddon()).values()
|
List<BlueprintBundle> bbs = plugin.getBlueprintsManager().getBlueprintBundles(command.getAddon()).values()
|
||||||
.stream().sorted(sortByDisplayName).collect(Collectors.toList());
|
.stream().sorted(sortByDisplayName).toList();
|
||||||
// Loop through them and create items in the panel
|
// Loop through them and create items in the panel
|
||||||
for (BlueprintBundle bb : bbs) {
|
for (BlueprintBundle bb : bbs) {
|
||||||
String perm = command.getPermissionPrefix() + "island.create." + bb.getUniqueId();
|
String perm = command.getPermissionPrefix() + "island.create." + bb.getUniqueId();
|
||||||
@ -50,7 +49,7 @@ public class IslandCreationPanel {
|
|||||||
// Add an item
|
// Add an item
|
||||||
PanelItem item = new PanelItemBuilder()
|
PanelItem item = new PanelItemBuilder()
|
||||||
.name(bb.getDisplayName())
|
.name(bb.getDisplayName())
|
||||||
.description(bb.getDescription().stream().map(Util::translateColorCodes).collect(Collectors.toList()))
|
.description(bb.getDescription().stream().map(Util::translateColorCodes).toList())
|
||||||
.icon(bb.getIcon()).clickHandler((panel, user1, clickType, slot1) -> {
|
.icon(bb.getIcon()).clickHandler((panel, user1, clickType, slot1) -> {
|
||||||
user1.closeInventory();
|
user1.closeInventory();
|
||||||
command.execute(user1, label, Collections.singletonList(bb.getUniqueId()));
|
command.execute(user1, label, Collections.singletonList(bb.getUniqueId()));
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package world.bentobox.bentobox.panels;
|
package world.bentobox.bentobox.panels;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
@ -91,7 +90,7 @@ public class ManagementPanel {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
case ADDONS -> {
|
case ADDONS -> {
|
||||||
addons = plugin.getAddonsManager().getEnabledAddons().stream().filter(addon -> !(addon instanceof GameModeAddon)).collect(Collectors.toList());
|
addons = plugin.getAddonsManager().getEnabledAddons().stream().filter(addon -> !(addon instanceof GameModeAddon)).toList();
|
||||||
if (addons.isEmpty()) {
|
if (addons.isEmpty()) {
|
||||||
looksEmpty(builder, user);
|
looksEmpty(builder, user);
|
||||||
break;
|
break;
|
||||||
|
@ -4,7 +4,6 @@ import java.util.Comparator;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
@ -78,7 +77,7 @@ public class SettingsTab implements Tab, ClickHandler {
|
|||||||
List<Flag> flags = plugin.getFlagsManager().getFlags().stream().filter(f -> f.getType().equals(type))
|
List<Flag> flags = plugin.getFlagsManager().getFlags().stream().filter(f -> f.getType().equals(type))
|
||||||
// We're stripping colors to avoid weird sorting issues
|
// We're stripping colors to avoid weird sorting issues
|
||||||
.sorted(Comparator.comparing(flag -> ChatColor.stripColor(user.getTranslation(flag.getNameReference()))))
|
.sorted(Comparator.comparing(flag -> ChatColor.stripColor(user.getTranslation(flag.getNameReference()))))
|
||||||
.collect(Collectors.toList());
|
.toList();
|
||||||
// Remove any that are not for this game mode
|
// Remove any that are not for this game mode
|
||||||
plugin.getIWM().getAddon(world).ifPresent(gm -> flags.removeIf(f -> !f.getGameModes().isEmpty() && !f.getGameModes().contains(gm)));
|
plugin.getIWM().getAddon(world).ifPresent(gm -> flags.removeIf(f -> !f.getGameModes().isEmpty() && !f.getGameModes().contains(gm)));
|
||||||
// Remove any that are the wrong rank or that will be on the top row
|
// Remove any that are the wrong rank or that will be on the top row
|
||||||
@ -124,7 +123,7 @@ public class SettingsTab implements Tab, ClickHandler {
|
|||||||
plugin.getPlayers().setFlagsDisplayMode(user.getUniqueId(), plugin.getPlayers().getFlagsDisplayMode(user.getUniqueId()).getNext());
|
plugin.getPlayers().setFlagsDisplayMode(user.getUniqueId(), plugin.getPlayers().getFlagsDisplayMode(user.getUniqueId()).getNext());
|
||||||
flags = getFlags();
|
flags = getFlags();
|
||||||
}
|
}
|
||||||
return flags.stream().map((f -> f.toPanelItem(plugin, user, island, plugin.getIWM().getHiddenFlags(world).contains(f.getID())))).collect(Collectors.toList());
|
return flags.stream().map((f -> f.toPanelItem(plugin, user, island, plugin.getIWM().getHiddenFlags(world).contains(f.getID())))).toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -2,7 +2,6 @@ package world.bentobox.bentobox.panels.settings;
|
|||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
@ -82,7 +81,7 @@ public class WorldDefaultSettingsTab extends SettingsTab implements Tab {
|
|||||||
TextVariables.DESCRIPTION, user.getTranslation(f.getDescriptionReference()),
|
TextVariables.DESCRIPTION, user.getTranslation(f.getDescriptionReference()),
|
||||||
"[setting]", worldSetting).split("\n")));
|
"[setting]", worldSetting).split("\n")));
|
||||||
return i;
|
return i;
|
||||||
}).collect(Collectors.toList());
|
}).toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,16 +1,29 @@
|
|||||||
package world.bentobox.bentobox.util;
|
package world.bentobox.bentobox.util;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.Optional;
|
||||||
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.block.*;
|
import org.bukkit.block.Banner;
|
||||||
|
import org.bukkit.block.Block;
|
||||||
|
import org.bukkit.block.BlockFace;
|
||||||
|
import org.bukkit.block.BlockState;
|
||||||
|
import org.bukkit.block.CreatureSpawner;
|
||||||
|
import org.bukkit.block.Sign;
|
||||||
import org.bukkit.block.data.BlockData;
|
import org.bukkit.block.data.BlockData;
|
||||||
import org.bukkit.block.data.type.WallSign;
|
import org.bukkit.block.data.type.WallSign;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.Inventory;
|
import org.bukkit.inventory.Inventory;
|
||||||
import org.bukkit.inventory.InventoryHolder;
|
import org.bukkit.inventory.InventoryHolder;
|
||||||
|
|
||||||
import world.bentobox.bentobox.BentoBox;
|
import world.bentobox.bentobox.BentoBox;
|
||||||
import world.bentobox.bentobox.api.localization.TextVariables;
|
import world.bentobox.bentobox.api.localization.TextVariables;
|
||||||
import world.bentobox.bentobox.api.user.User;
|
import world.bentobox.bentobox.api.user.User;
|
||||||
@ -20,9 +33,6 @@ import world.bentobox.bentobox.blueprints.dataobjects.BlueprintEntity;
|
|||||||
import world.bentobox.bentobox.database.objects.Island;
|
import world.bentobox.bentobox.database.objects.Island;
|
||||||
import world.bentobox.bentobox.nms.PasteHandler;
|
import world.bentobox.bentobox.nms.PasteHandler;
|
||||||
|
|
||||||
import java.util.*;
|
|
||||||
import java.util.concurrent.CompletableFuture;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A utility class for {@link PasteHandler}
|
* A utility class for {@link PasteHandler}
|
||||||
*
|
*
|
||||||
|
@ -1,7 +1,11 @@
|
|||||||
package world.bentobox.bentobox.util;
|
package world.bentobox.bentobox.util;
|
||||||
|
|
||||||
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
|
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
|
|
||||||
import world.bentobox.bentobox.BentoBox;
|
import world.bentobox.bentobox.BentoBox;
|
||||||
import world.bentobox.bentobox.api.addons.GameModeAddon;
|
import world.bentobox.bentobox.api.addons.GameModeAddon;
|
||||||
import world.bentobox.bentobox.api.events.island.IslandEvent;
|
import world.bentobox.bentobox.api.events.island.IslandEvent;
|
||||||
@ -9,9 +13,6 @@ import world.bentobox.bentobox.api.events.island.IslandEvent.Reason;
|
|||||||
import world.bentobox.bentobox.database.objects.IslandDeletion;
|
import world.bentobox.bentobox.database.objects.IslandDeletion;
|
||||||
import world.bentobox.bentobox.nms.WorldRegenerator;
|
import world.bentobox.bentobox.nms.WorldRegenerator;
|
||||||
|
|
||||||
import java.util.concurrent.CompletableFuture;
|
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deletes islands chunk by chunk
|
* Deletes islands chunk by chunk
|
||||||
*
|
*
|
||||||
|
@ -2,13 +2,16 @@ package world.bentobox.bentobox.util;
|
|||||||
|
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.*;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.Enumeration;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
import java.util.jar.JarEntry;
|
import java.util.jar.JarEntry;
|
||||||
import java.util.jar.JarFile;
|
import java.util.jar.JarFile;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
import org.apache.commons.lang.Validate;
|
import org.apache.commons.lang.Validate;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
@ -21,7 +24,20 @@ import org.bukkit.World.Environment;
|
|||||||
import org.bukkit.attribute.Attribute;
|
import org.bukkit.attribute.Attribute;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.block.BlockFace;
|
import org.bukkit.block.BlockFace;
|
||||||
import org.bukkit.entity.*;
|
import org.bukkit.entity.Allay;
|
||||||
|
import org.bukkit.entity.Animals;
|
||||||
|
import org.bukkit.entity.Bat;
|
||||||
|
import org.bukkit.entity.EnderDragon;
|
||||||
|
import org.bukkit.entity.Entity;
|
||||||
|
import org.bukkit.entity.Flying;
|
||||||
|
import org.bukkit.entity.IronGolem;
|
||||||
|
import org.bukkit.entity.Monster;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.entity.PufferFish;
|
||||||
|
import org.bukkit.entity.Shulker;
|
||||||
|
import org.bukkit.entity.Slime;
|
||||||
|
import org.bukkit.entity.Snowman;
|
||||||
|
import org.bukkit.entity.WaterMob;
|
||||||
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
|
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
import org.eclipse.jdt.annotation.NonNull;
|
import org.eclipse.jdt.annotation.NonNull;
|
||||||
@ -171,10 +187,10 @@ public class Util {
|
|||||||
public static List<String> getOnlinePlayerList(User user) {
|
public static List<String> getOnlinePlayerList(User user) {
|
||||||
if (user == null || !user.isPlayer()) {
|
if (user == null || !user.isPlayer()) {
|
||||||
// Console and null get to see every player
|
// Console and null get to see every player
|
||||||
return Bukkit.getOnlinePlayers().stream().map(Player::getName).collect(Collectors.toList());
|
return Bukkit.getOnlinePlayers().stream().map(Player::getName).toList();
|
||||||
}
|
}
|
||||||
// Otherwise prevent invisible players from seeing
|
// Otherwise prevent invisible players from seeing
|
||||||
return Bukkit.getOnlinePlayers().stream().filter(p -> user.getPlayer().canSee(p)).map(Player::getName).collect(Collectors.toList());
|
return Bukkit.getOnlinePlayers().stream().filter(p -> user.getPlayer().canSee(p)).map(Player::getName).toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -7,6 +7,16 @@
|
|||||||
package world.bentobox.bentobox.util.teleport;
|
package world.bentobox.bentobox.util.teleport;
|
||||||
|
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Comparator;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.PriorityQueue;
|
||||||
|
import java.util.Queue;
|
||||||
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Chunk;
|
import org.bukkit.Chunk;
|
||||||
import org.bukkit.ChunkSnapshot;
|
import org.bukkit.ChunkSnapshot;
|
||||||
@ -21,15 +31,6 @@ import org.bukkit.scheduler.BukkitTask;
|
|||||||
import org.bukkit.util.BoundingBox;
|
import org.bukkit.util.BoundingBox;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
import org.eclipse.jdt.annotation.Nullable;
|
import org.eclipse.jdt.annotation.Nullable;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Comparator;
|
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.PriorityQueue;
|
|
||||||
import java.util.Queue;
|
|
||||||
import java.util.concurrent.CompletableFuture;
|
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
|
||||||
|
|
||||||
import world.bentobox.bentobox.BentoBox;
|
import world.bentobox.bentobox.BentoBox;
|
||||||
import world.bentobox.bentobox.api.user.User;
|
import world.bentobox.bentobox.api.user.User;
|
||||||
|
@ -22,7 +22,6 @@ import java.util.Map;
|
|||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -388,7 +387,7 @@ public class IslandBanCommandTest {
|
|||||||
args.add("d");
|
args.add("d");
|
||||||
result = ibc.tabComplete(user, "", args);
|
result = ibc.tabComplete(user, "", args);
|
||||||
assertTrue(result.isPresent());
|
assertTrue(result.isPresent());
|
||||||
List<String> r = result.get().stream().sorted().collect(Collectors.toList());
|
List<String> r = result.get().stream().sorted().toList();
|
||||||
// Compare the expected with the actual
|
// Compare the expected with the actual
|
||||||
String[] expectedName = {"dave"};
|
String[] expectedName = {"dave"};
|
||||||
assertTrue(Arrays.equals(expectedName, r.toArray()));
|
assertTrue(Arrays.equals(expectedName, r.toArray()));
|
||||||
@ -398,7 +397,7 @@ public class IslandBanCommandTest {
|
|||||||
args.add("fr");
|
args.add("fr");
|
||||||
result = ibc.tabComplete(user, "", args);
|
result = ibc.tabComplete(user, "", args);
|
||||||
assertTrue(result.isPresent());
|
assertTrue(result.isPresent());
|
||||||
r = result.get().stream().sorted().collect(Collectors.toList());
|
r = result.get().stream().sorted().toList();
|
||||||
// Compare the expected with the actual
|
// Compare the expected with the actual
|
||||||
String[] expected = {"frank", "freddy"};
|
String[] expected = {"frank", "freddy"};
|
||||||
assertTrue(Arrays.equals(expected, r.toArray()));
|
assertTrue(Arrays.equals(expected, r.toArray()));
|
||||||
|
@ -18,7 +18,6 @@ import java.util.List;
|
|||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.OfflinePlayer;
|
import org.bukkit.OfflinePlayer;
|
||||||
@ -472,7 +471,7 @@ public class IslandTeamKickCommandTest {
|
|||||||
// Get the tab-complete list with no argument
|
// Get the tab-complete list with no argument
|
||||||
Optional<List<String>> result = ibc.tabComplete(user, "", new LinkedList<>());
|
Optional<List<String>> result = ibc.tabComplete(user, "", new LinkedList<>());
|
||||||
assertTrue(result.isPresent());
|
assertTrue(result.isPresent());
|
||||||
List<String> r = result.get().stream().sorted().collect(Collectors.toList());
|
List<String> r = result.get().stream().sorted().toList();
|
||||||
// Compare the expected with the actual - first names in the list
|
// Compare the expected with the actual - first names in the list
|
||||||
String[] expectedNames = {"adam", "ben", "cara", "dave", "ed", "frank", "freddy", "george"};
|
String[] expectedNames = {"adam", "ben", "cara", "dave", "ed", "frank", "freddy", "george"};
|
||||||
int i = 0;
|
int i = 0;
|
||||||
@ -515,7 +514,7 @@ public class IslandTeamKickCommandTest {
|
|||||||
// Get the tab-complete list with argument
|
// Get the tab-complete list with argument
|
||||||
Optional<List<String>> result = ibc.tabComplete(user, "", Collections.singletonList("g"));
|
Optional<List<String>> result = ibc.tabComplete(user, "", Collections.singletonList("g"));
|
||||||
assertTrue(result.isPresent());
|
assertTrue(result.isPresent());
|
||||||
List<String> r = result.get().stream().sorted().collect(Collectors.toList());
|
List<String> r = result.get().stream().sorted().toList();
|
||||||
assertFalse(r.isEmpty());
|
assertFalse(r.isEmpty());
|
||||||
// Compare the expected with the actual
|
// Compare the expected with the actual
|
||||||
String[] expectedNames = {"george"};
|
String[] expectedNames = {"george"};
|
||||||
|
@ -18,7 +18,6 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.OfflinePlayer;
|
import org.bukkit.OfflinePlayer;
|
||||||
@ -282,7 +281,7 @@ public class IslandTeamUncoopCommandTest {
|
|||||||
// Get the tab-complete list with no argument
|
// Get the tab-complete list with no argument
|
||||||
Optional<List<String>> result = ibc.tabComplete(user, "", new LinkedList<>());
|
Optional<List<String>> result = ibc.tabComplete(user, "", new LinkedList<>());
|
||||||
assertTrue(result.isPresent());
|
assertTrue(result.isPresent());
|
||||||
List<String> r = result.get().stream().sorted().collect(Collectors.toList());
|
List<String> r = result.get().stream().sorted().toList();
|
||||||
// Compare the expected with the actual
|
// Compare the expected with the actual
|
||||||
String[] expectedNames = {"adam", "ben", "cara"};
|
String[] expectedNames = {"adam", "ben", "cara"};
|
||||||
|
|
||||||
@ -319,7 +318,7 @@ public class IslandTeamUncoopCommandTest {
|
|||||||
args.add("c");
|
args.add("c");
|
||||||
Optional<List<String>> result = ibc.tabComplete(user, "", args);
|
Optional<List<String>> result = ibc.tabComplete(user, "", args);
|
||||||
assertTrue(result.isPresent());
|
assertTrue(result.isPresent());
|
||||||
List<String> r = result.get().stream().sorted().collect(Collectors.toList());
|
List<String> r = result.get().stream().sorted().toList();
|
||||||
// Compare the expected with the actual
|
// Compare the expected with the actual
|
||||||
String[] expectedNames = {"cara"};
|
String[] expectedNames = {"cara"};
|
||||||
|
|
||||||
|
@ -17,7 +17,6 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.OfflinePlayer;
|
import org.bukkit.OfflinePlayer;
|
||||||
@ -281,7 +280,7 @@ public class IslandTeamUntrustCommandTest {
|
|||||||
// Get the tab-complete list with no argument
|
// Get the tab-complete list with no argument
|
||||||
Optional<List<String>> result = ibc.tabComplete(user, "", new LinkedList<>());
|
Optional<List<String>> result = ibc.tabComplete(user, "", new LinkedList<>());
|
||||||
assertTrue(result.isPresent());
|
assertTrue(result.isPresent());
|
||||||
List<String> r = result.get().stream().sorted().collect(Collectors.toList());
|
List<String> r = result.get().stream().sorted().toList();
|
||||||
// Compare the expected with the actual
|
// Compare the expected with the actual
|
||||||
String[] expectedNames = {"adam", "ben", "cara"};
|
String[] expectedNames = {"adam", "ben", "cara"};
|
||||||
|
|
||||||
@ -317,7 +316,7 @@ public class IslandTeamUntrustCommandTest {
|
|||||||
args.add("c");
|
args.add("c");
|
||||||
Optional<List<String>> result = ibc.tabComplete(user, "", args);
|
Optional<List<String>> result = ibc.tabComplete(user, "", args);
|
||||||
assertTrue(result.isPresent());
|
assertTrue(result.isPresent());
|
||||||
List<String> r = result.get().stream().sorted().collect(Collectors.toList());
|
List<String> r = result.get().stream().sorted().toList();
|
||||||
// Compare the expected with the actual
|
// Compare the expected with the actual
|
||||||
String[] expectedNames = {"cara"};
|
String[] expectedNames = {"cara"};
|
||||||
|
|
||||||
|
@ -24,7 +24,6 @@ import org.bukkit.Material;
|
|||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.World.Environment;
|
import org.bukkit.World.Environment;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.util.Vector;
|
|
||||||
import org.eclipse.jdt.annotation.NonNull;
|
import org.eclipse.jdt.annotation.NonNull;
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
|
@ -19,7 +19,12 @@ import java.util.Map;
|
|||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import org.bukkit.*;
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.Server;
|
||||||
|
import org.bukkit.Tag;
|
||||||
|
import org.bukkit.World;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.entity.Cow;
|
import org.bukkit.entity.Cow;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
|
@ -13,7 +13,6 @@ import java.util.Arrays;
|
|||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.GameMode;
|
import org.bukkit.GameMode;
|
||||||
@ -59,9 +58,9 @@ public class CoarseDirtTillingListenerTest {
|
|||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
private static final List<Material> HOES = Collections.unmodifiableList(Arrays.stream(Material.values())
|
private static final List<Material> HOES = Collections.unmodifiableList(Arrays.stream(Material.values())
|
||||||
.filter(m -> !m.isLegacy()).filter(m -> m.name().endsWith("_HOE")).collect(Collectors.toList()));
|
.filter(m -> !m.isLegacy()).filter(m -> m.name().endsWith("_HOE")).toList());
|
||||||
private static final List<Material> NOT_HOES = Collections.unmodifiableList(Arrays.stream(Material.values())
|
private static final List<Material> NOT_HOES = Collections.unmodifiableList(Arrays.stream(Material.values())
|
||||||
.filter(m -> !m.name().endsWith("_HOE")).collect(Collectors.toList()));
|
.filter(m -> !m.name().endsWith("_HOE")).toList());
|
||||||
|
|
||||||
// Class under test
|
// Class under test
|
||||||
private CoarseDirtTillingListener ctl;
|
private CoarseDirtTillingListener ctl;
|
||||||
|
@ -21,7 +21,6 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.GameMode;
|
import org.bukkit.GameMode;
|
||||||
@ -109,7 +108,7 @@ public class InvincibleVisitorsListenerTest {
|
|||||||
when(panel.getName()).thenReturn("panel");
|
when(panel.getName()).thenReturn("panel");
|
||||||
Map<Integer, PanelItem> map = new HashMap<>();
|
Map<Integer, PanelItem> map = new HashMap<>();
|
||||||
List<String> sortedNames = Arrays.stream(EntityDamageEvent.DamageCause.values()).map(DamageCause::name)
|
List<String> sortedNames = Arrays.stream(EntityDamageEvent.DamageCause.values()).map(DamageCause::name)
|
||||||
.map(Util::prettifyText).sorted().collect(Collectors.toList());
|
.map(Util::prettifyText).sorted().toList();
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (String name : sortedNames) {
|
for (String name : sortedNames) {
|
||||||
PanelItem pi = mock(PanelItem.class);
|
PanelItem pi = mock(PanelItem.class);
|
||||||
@ -220,7 +219,7 @@ public class InvincibleVisitorsListenerTest {
|
|||||||
// Test all damage causes to make sure they can be clicked on and off
|
// Test all damage causes to make sure they can be clicked on and off
|
||||||
for (int slot = 0; slot < DamageCause.values().length; slot++) {
|
for (int slot = 0; slot < DamageCause.values().length; slot++) {
|
||||||
// Get the damage type
|
// Get the damage type
|
||||||
DamageCause dc = Arrays.stream(EntityDamageEvent.DamageCause.values()).sorted(Comparator.comparing(DamageCause::name)).collect(Collectors.toList()).get(slot);
|
DamageCause dc = Arrays.stream(EntityDamageEvent.DamageCause.values()).sorted(Comparator.comparing(DamageCause::name)).toList().get(slot);
|
||||||
// IV settings should be empty
|
// IV settings should be empty
|
||||||
assertFalse(ivSettings.contains(dc.name()));
|
assertFalse(ivSettings.contains(dc.name()));
|
||||||
// Click on the icon
|
// Click on the icon
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package world.bentobox.bentobox.util;
|
package world.bentobox.bentobox.util;
|
||||||
|
|
||||||
import static org.junit.Assert.*;
|
import static org.junit.Assert.assertEquals;
|
||||||
|
import static org.junit.Assert.assertNull;
|
||||||
import static org.mockito.Mockito.mock;
|
import static org.mockito.Mockito.mock;
|
||||||
import static org.mockito.Mockito.when;
|
import static org.mockito.Mockito.when;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user