mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2024-11-27 05:05:18 +01:00
Merge branch 'develop' into 1.16.5_lts
This commit is contained in:
commit
c210df44cf
@ -30,7 +30,20 @@ import world.bentobox.bentobox.listeners.JoinLeaveListener;
|
||||
import world.bentobox.bentobox.listeners.PanelListenerManager;
|
||||
import world.bentobox.bentobox.listeners.PortalTeleportationListener;
|
||||
import world.bentobox.bentobox.listeners.StandardSpawnProtectionListener;
|
||||
import world.bentobox.bentobox.managers.*;
|
||||
import world.bentobox.bentobox.managers.AddonsManager;
|
||||
import world.bentobox.bentobox.managers.BlueprintsManager;
|
||||
import world.bentobox.bentobox.managers.CommandsManager;
|
||||
import world.bentobox.bentobox.managers.FlagsManager;
|
||||
import world.bentobox.bentobox.managers.HooksManager;
|
||||
import world.bentobox.bentobox.managers.IslandChunkDeletionManager;
|
||||
import world.bentobox.bentobox.managers.IslandDeletionManager;
|
||||
import world.bentobox.bentobox.managers.IslandWorldManager;
|
||||
import world.bentobox.bentobox.managers.IslandsManager;
|
||||
import world.bentobox.bentobox.managers.LocalesManager;
|
||||
import world.bentobox.bentobox.managers.PlaceholdersManager;
|
||||
import world.bentobox.bentobox.managers.PlayersManager;
|
||||
import world.bentobox.bentobox.managers.RanksManager;
|
||||
import world.bentobox.bentobox.managers.WebManager;
|
||||
import world.bentobox.bentobox.util.heads.HeadGetter;
|
||||
import world.bentobox.bentobox.versions.ServerCompatibility;
|
||||
|
||||
|
@ -3,8 +3,8 @@ package world.bentobox.bentobox.api.events.addon;
|
||||
import java.util.Map;
|
||||
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNull;
|
||||
|
||||
import world.bentobox.bentobox.api.addons.Addon;
|
||||
|
||||
/**
|
||||
|
@ -3,8 +3,8 @@ package world.bentobox.bentobox.api.events.addon;
|
||||
import java.util.Map;
|
||||
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNull;
|
||||
|
||||
import world.bentobox.bentobox.api.addons.Addon;
|
||||
|
||||
/**
|
||||
|
@ -3,8 +3,8 @@ package world.bentobox.bentobox.api.events.addon;
|
||||
import java.util.Map;
|
||||
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNull;
|
||||
|
||||
import world.bentobox.bentobox.api.addons.Addon;
|
||||
|
||||
/**
|
||||
|
@ -3,8 +3,8 @@ package world.bentobox.bentobox.api.events.addon;
|
||||
import java.util.Map;
|
||||
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNull;
|
||||
|
||||
import world.bentobox.bentobox.api.addons.Addon;
|
||||
|
||||
/**
|
||||
|
@ -5,8 +5,8 @@ import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNull;
|
||||
|
||||
import world.bentobox.bentobox.api.events.BentoBoxEvent;
|
||||
|
||||
/**
|
||||
|
@ -3,8 +3,8 @@ package world.bentobox.bentobox.api.events.flags;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNull;
|
||||
|
||||
import world.bentobox.bentobox.api.flags.Flag;
|
||||
import world.bentobox.bentobox.database.objects.Island;
|
||||
|
||||
|
@ -3,8 +3,8 @@ package world.bentobox.bentobox.api.events.flags;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNull;
|
||||
|
||||
import world.bentobox.bentobox.api.flags.Flag;
|
||||
import world.bentobox.bentobox.database.objects.Island;
|
||||
|
||||
|
@ -4,8 +4,8 @@ import java.util.UUID;
|
||||
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNull;
|
||||
|
||||
import world.bentobox.bentobox.api.flags.Flag;
|
||||
|
||||
/**
|
||||
|
@ -4,8 +4,8 @@ import java.util.UUID;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNull;
|
||||
|
||||
import world.bentobox.bentobox.api.events.IslandBaseEvent;
|
||||
import world.bentobox.bentobox.database.objects.Island;
|
||||
|
||||
|
@ -4,8 +4,8 @@ import java.util.UUID;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNull;
|
||||
|
||||
import world.bentobox.bentobox.api.events.IslandBaseEvent;
|
||||
import world.bentobox.bentobox.database.objects.Island;
|
||||
|
||||
|
@ -4,8 +4,8 @@ import java.util.UUID;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNull;
|
||||
|
||||
import world.bentobox.bentobox.api.events.IslandBaseEvent;
|
||||
import world.bentobox.bentobox.database.objects.Island;
|
||||
import world.bentobox.bentobox.database.objects.IslandDeletion;
|
||||
|
@ -4,8 +4,8 @@ import java.util.UUID;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNull;
|
||||
|
||||
import world.bentobox.bentobox.api.events.IslandBaseEvent;
|
||||
import world.bentobox.bentobox.database.objects.Island;
|
||||
|
||||
|
@ -4,8 +4,8 @@ import java.util.UUID;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNull;
|
||||
|
||||
import world.bentobox.bentobox.api.events.IslandBaseEvent;
|
||||
import world.bentobox.bentobox.database.objects.Island;
|
||||
import world.bentobox.bentobox.database.objects.IslandDeletion;
|
||||
|
@ -4,8 +4,8 @@ import java.util.UUID;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNull;
|
||||
|
||||
import world.bentobox.bentobox.api.events.IslandBaseEvent;
|
||||
import world.bentobox.bentobox.database.objects.Island;
|
||||
|
||||
|
@ -4,8 +4,8 @@ import java.util.UUID;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNull;
|
||||
|
||||
import world.bentobox.bentobox.api.events.IslandBaseEvent;
|
||||
import world.bentobox.bentobox.database.objects.Island;
|
||||
|
||||
|
@ -4,8 +4,8 @@ import java.util.UUID;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNull;
|
||||
|
||||
import world.bentobox.bentobox.api.events.IslandBaseEvent;
|
||||
import world.bentobox.bentobox.database.objects.Island;
|
||||
|
||||
|
@ -4,8 +4,8 @@ import java.util.UUID;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNull;
|
||||
|
||||
import world.bentobox.bentobox.api.events.IslandBaseEvent;
|
||||
import world.bentobox.bentobox.database.objects.Island;
|
||||
|
||||
|
@ -3,8 +3,8 @@ package world.bentobox.bentobox.api.events.island;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNull;
|
||||
|
||||
import world.bentobox.bentobox.api.events.IslandBaseEvent;
|
||||
|
||||
/**
|
||||
|
@ -4,8 +4,8 @@ import java.util.UUID;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNull;
|
||||
|
||||
import world.bentobox.bentobox.api.events.IslandBaseEvent;
|
||||
import world.bentobox.bentobox.database.objects.Island;
|
||||
|
||||
|
@ -4,8 +4,8 @@ import java.util.UUID;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNull;
|
||||
|
||||
import world.bentobox.bentobox.api.events.IslandBaseEvent;
|
||||
import world.bentobox.bentobox.database.objects.Island;
|
||||
|
||||
|
@ -4,8 +4,8 @@ import java.util.UUID;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNull;
|
||||
|
||||
import world.bentobox.bentobox.api.events.IslandBaseEvent;
|
||||
import world.bentobox.bentobox.database.objects.Island;
|
||||
|
||||
|
@ -4,8 +4,8 @@ import java.util.UUID;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNull;
|
||||
|
||||
import world.bentobox.bentobox.api.events.IslandBaseEvent;
|
||||
import world.bentobox.bentobox.database.objects.Island;
|
||||
|
||||
|
@ -4,8 +4,8 @@ import java.util.UUID;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNull;
|
||||
|
||||
import world.bentobox.bentobox.api.events.IslandBaseEvent;
|
||||
import world.bentobox.bentobox.database.objects.Island;
|
||||
|
||||
|
@ -4,8 +4,8 @@ import java.util.UUID;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNull;
|
||||
|
||||
import world.bentobox.bentobox.api.events.IslandBaseEvent;
|
||||
import world.bentobox.bentobox.database.objects.Island;
|
||||
|
||||
|
@ -4,8 +4,8 @@ import java.util.UUID;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNull;
|
||||
|
||||
import world.bentobox.bentobox.api.events.IslandBaseEvent;
|
||||
import world.bentobox.bentobox.database.objects.Island;
|
||||
|
||||
|
@ -4,8 +4,8 @@ import java.util.UUID;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNull;
|
||||
|
||||
import world.bentobox.bentobox.api.events.IslandBaseEvent;
|
||||
import world.bentobox.bentobox.database.objects.Island;
|
||||
|
||||
|
@ -4,8 +4,8 @@ import java.util.UUID;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNull;
|
||||
|
||||
import world.bentobox.bentobox.api.events.IslandBaseEvent;
|
||||
import world.bentobox.bentobox.database.objects.Island;
|
||||
|
||||
|
@ -4,8 +4,8 @@ import java.util.UUID;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNull;
|
||||
|
||||
import world.bentobox.bentobox.api.events.IslandBaseEvent;
|
||||
import world.bentobox.bentobox.database.objects.Island;
|
||||
|
||||
|
@ -4,8 +4,8 @@ import java.util.UUID;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNull;
|
||||
|
||||
import world.bentobox.bentobox.api.events.IslandBaseEvent;
|
||||
import world.bentobox.bentobox.database.objects.Island;
|
||||
|
||||
|
@ -4,8 +4,8 @@ import java.util.UUID;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNull;
|
||||
|
||||
import world.bentobox.bentobox.api.events.IslandBaseEvent;
|
||||
import world.bentobox.bentobox.database.objects.Island;
|
||||
|
||||
|
@ -4,8 +4,8 @@ import java.util.UUID;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNull;
|
||||
|
||||
import world.bentobox.bentobox.api.events.IslandBaseEvent;
|
||||
import world.bentobox.bentobox.database.objects.Island;
|
||||
|
||||
|
@ -4,8 +4,8 @@ import java.util.UUID;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNull;
|
||||
|
||||
import world.bentobox.bentobox.api.events.IslandBaseEvent;
|
||||
import world.bentobox.bentobox.database.objects.Island;
|
||||
|
||||
|
@ -4,8 +4,8 @@ import java.util.UUID;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNull;
|
||||
|
||||
import world.bentobox.bentobox.api.events.IslandBaseEvent;
|
||||
import world.bentobox.bentobox.database.objects.Island;
|
||||
|
||||
|
@ -4,8 +4,8 @@ import java.util.UUID;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNull;
|
||||
|
||||
import world.bentobox.bentobox.api.events.IslandBaseEvent;
|
||||
import world.bentobox.bentobox.database.objects.Island;
|
||||
|
||||
|
@ -4,8 +4,8 @@ import java.util.UUID;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNull;
|
||||
|
||||
import world.bentobox.bentobox.api.events.IslandBaseEvent;
|
||||
import world.bentobox.bentobox.database.objects.Island;
|
||||
|
||||
|
@ -4,8 +4,8 @@ import java.util.UUID;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNull;
|
||||
|
||||
import world.bentobox.bentobox.api.events.IslandBaseEvent;
|
||||
import world.bentobox.bentobox.database.objects.Island;
|
||||
|
||||
|
@ -7,10 +7,13 @@
|
||||
package world.bentobox.bentobox.api.panels;
|
||||
|
||||
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.function.BiFunction;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNull;
|
||||
import org.eclipse.jdt.annotation.Nullable;
|
||||
import java.util.*;
|
||||
import java.util.function.BiFunction;
|
||||
|
||||
import world.bentobox.bentobox.BentoBox;
|
||||
import world.bentobox.bentobox.api.panels.builders.PanelItemBuilder;
|
||||
|
@ -7,12 +7,13 @@
|
||||
package world.bentobox.bentobox.api.panels.builders;
|
||||
|
||||
|
||||
import org.bukkit.World;
|
||||
import java.io.File;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.function.BiFunction;
|
||||
|
||||
import org.bukkit.World;
|
||||
|
||||
import world.bentobox.bentobox.api.panels.PanelItem;
|
||||
import world.bentobox.bentobox.api.panels.PanelListener;
|
||||
import world.bentobox.bentobox.api.panels.TemplatedPanel;
|
||||
|
@ -7,15 +7,16 @@
|
||||
package world.bentobox.bentobox.api.panels.reader;
|
||||
|
||||
|
||||
import org.bukkit.event.inventory.ClickType;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.eclipse.jdt.annotation.NonNull;
|
||||
import org.eclipse.jdt.annotation.Nullable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.bukkit.event.inventory.ClickType;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.eclipse.jdt.annotation.NonNull;
|
||||
import org.eclipse.jdt.annotation.Nullable;
|
||||
|
||||
|
||||
/**
|
||||
* This Record contains all necessary information about Item Template that can be used to craft panel item.
|
||||
@ -30,11 +31,11 @@ import java.util.Map;
|
||||
* @since 1.17.3
|
||||
*/
|
||||
public record ItemTemplateRecord(@Nullable ItemStack icon,
|
||||
@Nullable String title,
|
||||
@Nullable String description,
|
||||
@NonNull List<ActionRecords> actions,
|
||||
@NonNull Map<String, Object> dataMap,
|
||||
@Nullable ItemTemplateRecord fallback)
|
||||
@Nullable String title,
|
||||
@Nullable String description,
|
||||
@NonNull List<ActionRecords> actions,
|
||||
@NonNull Map<String, Object> dataMap,
|
||||
@Nullable ItemTemplateRecord fallback)
|
||||
{
|
||||
/**
|
||||
* Instantiates a new Item template record without actions and data map.
|
||||
|
@ -7,7 +7,11 @@
|
||||
package world.bentobox.bentobox.api.panels.reader;
|
||||
|
||||
|
||||
import com.google.common.base.Enums;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.configuration.InvalidConfigurationException;
|
||||
@ -15,10 +19,8 @@ import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.event.inventory.ClickType;
|
||||
import org.eclipse.jdt.annotation.NonNull;
|
||||
import org.eclipse.jdt.annotation.Nullable;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import com.google.common.base.Enums;
|
||||
|
||||
import world.bentobox.bentobox.api.panels.Panel;
|
||||
import world.bentobox.bentobox.util.ItemParser;
|
||||
|
@ -1,6 +1,7 @@
|
||||
package world.bentobox.bentobox.api.placeholders.placeholderapi;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNull;
|
||||
|
||||
import world.bentobox.bentobox.api.addons.Addon;
|
||||
|
||||
public class AddonPlaceholderExpansion extends BasicPlaceholderExpansion {
|
||||
|
@ -1,6 +1,7 @@
|
||||
package world.bentobox.bentobox.api.placeholders.placeholderapi;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNull;
|
||||
|
||||
import world.bentobox.bentobox.BentoBox;
|
||||
|
||||
public class BentoBoxPlaceholderExpansion extends BasicPlaceholderExpansion {
|
||||
|
@ -3,10 +3,11 @@ package world.bentobox.bentobox.api.user;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNull;
|
||||
|
||||
import com.google.common.cache.CacheBuilder;
|
||||
import com.google.common.cache.CacheLoader;
|
||||
import com.google.common.cache.LoadingCache;
|
||||
import org.eclipse.jdt.annotation.NonNull;
|
||||
|
||||
/**
|
||||
* Utilities class that helps to avoid spamming the User with potential repeated messages
|
||||
|
@ -7,8 +7,8 @@ import org.bukkit.conversations.ConversationContext;
|
||||
import org.bukkit.conversations.Prompt;
|
||||
import org.bukkit.conversations.StringPrompt;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNull;
|
||||
|
||||
import world.bentobox.bentobox.api.addons.GameModeAddon;
|
||||
import world.bentobox.bentobox.api.localization.TextVariables;
|
||||
import world.bentobox.bentobox.api.user.User;
|
||||
|
@ -6,8 +6,8 @@ import org.bukkit.conversations.ConversationContext;
|
||||
import org.bukkit.conversations.MessagePrompt;
|
||||
import org.bukkit.conversations.Prompt;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNull;
|
||||
|
||||
import world.bentobox.bentobox.BentoBox;
|
||||
import world.bentobox.bentobox.api.addons.GameModeAddon;
|
||||
import world.bentobox.bentobox.api.user.User;
|
||||
|
@ -3,8 +3,8 @@ package world.bentobox.bentobox.blueprints.conversation;
|
||||
import org.bukkit.conversations.ConversationContext;
|
||||
import org.bukkit.conversations.ConversationPrefix;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNull;
|
||||
|
||||
import world.bentobox.bentobox.api.user.User;
|
||||
|
||||
public class NameConversationPrefix implements ConversationPrefix {
|
||||
|
@ -17,7 +17,15 @@ import com.google.gson.reflect.TypeToken;
|
||||
|
||||
import world.bentobox.bentobox.BentoBox;
|
||||
import world.bentobox.bentobox.api.flags.Flag;
|
||||
import world.bentobox.bentobox.database.json.adapters.*;
|
||||
import world.bentobox.bentobox.database.json.adapters.BiomeTypeAdapter;
|
||||
import world.bentobox.bentobox.database.json.adapters.BukkitObjectTypeAdapter;
|
||||
import world.bentobox.bentobox.database.json.adapters.EnumTypeAdapter;
|
||||
import world.bentobox.bentobox.database.json.adapters.FlagTypeAdapter;
|
||||
import world.bentobox.bentobox.database.json.adapters.ItemStackTypeAdapter;
|
||||
import world.bentobox.bentobox.database.json.adapters.LocationTypeAdapter;
|
||||
import world.bentobox.bentobox.database.json.adapters.PotionEffectTypeAdapter;
|
||||
import world.bentobox.bentobox.database.json.adapters.VectorTypeAdapter;
|
||||
import world.bentobox.bentobox.database.json.adapters.WorldTypeAdapter;
|
||||
import world.bentobox.bentobox.versions.ServerCompatibility;
|
||||
|
||||
|
||||
|
@ -6,15 +6,6 @@
|
||||
|
||||
package world.bentobox.bentobox.database.json.adapters;
|
||||
|
||||
|
||||
import com.google.common.base.Enums;
|
||||
import com.google.gson.TypeAdapter;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import com.google.gson.stream.JsonToken;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
import org.bukkit.block.Biome;
|
||||
import org.eclipse.jdt.annotation.Nullable;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
@ -22,6 +13,15 @@ import java.util.HashMap;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
import org.bukkit.block.Biome;
|
||||
import org.eclipse.jdt.annotation.Nullable;
|
||||
|
||||
import com.google.common.base.Enums;
|
||||
import com.google.gson.TypeAdapter;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import com.google.gson.stream.JsonToken;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
|
||||
|
||||
/**
|
||||
* Minecraft 1.18 reworked their biomes, and a lot of things were renamed or removed.
|
||||
|
@ -7,6 +7,7 @@ import java.util.concurrent.CompletableFuture;
|
||||
import org.bson.Document;
|
||||
import org.bson.conversions.Bson;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.eclipse.jdt.annotation.NonNull;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.mongodb.MongoClientException;
|
||||
@ -19,7 +20,6 @@ import com.mongodb.client.model.IndexOptions;
|
||||
import com.mongodb.client.model.Indexes;
|
||||
import com.mongodb.util.JSON;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNull;
|
||||
import world.bentobox.bentobox.BentoBox;
|
||||
import world.bentobox.bentobox.database.DatabaseConnector;
|
||||
import world.bentobox.bentobox.database.json.AbstractJSONDatabaseHandler;
|
||||
|
@ -1,6 +1,9 @@
|
||||
package world.bentobox.bentobox.hooks;
|
||||
|
||||
import com.meowj.langutils.lang.LanguageHelper;
|
||||
import java.util.Locale;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.bukkit.DyeColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Biome;
|
||||
@ -18,15 +21,14 @@ import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
import org.bukkit.potion.PotionType;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import com.meowj.langutils.lang.LanguageHelper;
|
||||
|
||||
import world.bentobox.bentobox.BentoBox;
|
||||
import world.bentobox.bentobox.api.hooks.Hook;
|
||||
import world.bentobox.bentobox.api.user.User;
|
||||
import world.bentobox.bentobox.util.Util;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
/**
|
||||
* @author ApacheZy
|
||||
* @since 1.6.0
|
||||
|
@ -395,6 +395,10 @@ public class PortalTeleportationListener implements Listener {
|
||||
if (fromWorld.getEnvironment() != env) {
|
||||
World toWorld = Objects.requireNonNull(getNetherEndWorld(overWorld, env));
|
||||
Location spawnPoint = toWorld.getSpawnLocation();
|
||||
// If going to the nether and nether portals are active then just teleport to approx location
|
||||
if (env.equals(Environment.NETHER) && plugin.getIWM().getWorldSettings(overWorld).isMakeNetherPortals()) {
|
||||
spawnPoint = e.getFrom().toVector().toLocation(toWorld);
|
||||
}
|
||||
// If spawn is set as 0,63,0 in the End then move it to 100, 50 ,0.
|
||||
if (env.equals(Environment.THE_END) && spawnPoint.getBlockX() == 0 && spawnPoint.getBlockZ() == 0) {
|
||||
// Set to the default end spawn
|
||||
|
@ -109,6 +109,10 @@ public class StandardSpawnProtectionListener implements Listener {
|
||||
* @return true if in the spawn area, false if not
|
||||
*/
|
||||
private boolean atSpawn(@NonNull Location location) {
|
||||
if (plugin.getIWM().getWorldSettings(location.getWorld()).isMakeNetherPortals()) {
|
||||
// If nether portals are active, there is no common spawn
|
||||
return false;
|
||||
}
|
||||
Vector p = location.toVector().multiply(new Vector(1, 0, 1));
|
||||
Vector spawn = location.getWorld().getSpawnLocation().toVector().multiply(new Vector(1, 0, 1));
|
||||
int radius = plugin.getIWM().getNetherSpawnRadius(location.getWorld());
|
||||
@ -118,6 +122,7 @@ public class StandardSpawnProtectionListener implements Listener {
|
||||
|
||||
/**
|
||||
* If the player is not in the standard nether or standard end or op, do nothing.
|
||||
* If portal making is true, then do not protect spawn.
|
||||
* Used to protect the standard spawn for nether or end.
|
||||
*
|
||||
* @param player - the player
|
||||
@ -127,6 +132,8 @@ public class StandardSpawnProtectionListener implements Listener {
|
||||
return (player.isOp() || player.getWorld().getEnvironment().equals(World.Environment.NORMAL)
|
||||
|| !plugin.getIWM().inWorld(Util.getWorld(player.getWorld()))
|
||||
|| (player.getWorld().getEnvironment().equals(World.Environment.NETHER) && plugin.getIWM().isNetherIslands(player.getWorld()))
|
||||
|| (player.getWorld().getEnvironment().equals(World.Environment.NETHER) && plugin.getIWM().getWorldSettings(player.getWorld()).isMakeNetherPortals())
|
||||
|| (player.getWorld().getEnvironment().equals(World.Environment.THE_END) && plugin.getIWM().isEndIslands(player.getWorld())));
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -13,7 +13,6 @@ import org.bukkit.event.inventory.ClickType;
|
||||
import org.eclipse.jdt.annotation.NonNull;
|
||||
import org.eclipse.jdt.annotation.Nullable;
|
||||
|
||||
|
||||
import world.bentobox.bentobox.BentoBox;
|
||||
import world.bentobox.bentobox.api.addons.GameModeAddon;
|
||||
import world.bentobox.bentobox.api.panels.Panel;
|
||||
|
@ -48,8 +48,8 @@ public class FireListener extends FlagListener {
|
||||
* @param e - event
|
||||
*/
|
||||
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
||||
public boolean onBlockBurn(BlockBurnEvent e) {
|
||||
return checkFire(e, e.getBlock().getLocation(), Flags.FIRE_BURNING);
|
||||
public void onBlockBurn(BlockBurnEvent e) {
|
||||
checkFire(e, e.getBlock().getLocation(), Flags.FIRE_BURNING);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -57,8 +57,10 @@ public class FireListener extends FlagListener {
|
||||
* @param e - event
|
||||
*/
|
||||
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
||||
public boolean onBlockSpread(BlockSpreadEvent e) {
|
||||
return e.getSource().getType().equals(Material.FIRE) && checkFire(e, e.getBlock().getLocation(), Flags.FIRE_SPREAD);
|
||||
public void onBlockSpread(BlockSpreadEvent e) {
|
||||
if (e.getSource().getType().equals(Material.FIRE)) {
|
||||
checkFire(e, e.getBlock().getLocation(), Flags.FIRE_SPREAD);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -66,9 +68,11 @@ public class FireListener extends FlagListener {
|
||||
* @param e - event
|
||||
*/
|
||||
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
||||
public boolean onBlockIgnite(BlockIgniteEvent e) {
|
||||
public void onBlockIgnite(BlockIgniteEvent e) {
|
||||
// Check if this is a portal lighting - that is allowed any time
|
||||
return !e.getBlock().getType().equals(Material.OBSIDIAN) && checkFire(e, e.getBlock().getLocation(), Flags.FIRE_IGNITE);
|
||||
if (!e.getBlock().getType().equals(Material.OBSIDIAN)) {
|
||||
checkFire(e, e.getBlock().getLocation(), Flags.FIRE_IGNITE);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -95,7 +99,7 @@ public class FireListener extends FlagListener {
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||
public void onLightningStrikeEvent(LightningStrikeEvent e) {
|
||||
checkFire(e, e.getLightning().getLocation(), Flags.FIRE_IGNITE);
|
||||
}
|
||||
|
@ -43,10 +43,10 @@ public class TNTListener extends FlagListener {
|
||||
* @param e - event
|
||||
*/
|
||||
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||
public boolean onTNTDamage(EntityChangeBlockEvent e) {
|
||||
public void onTNTDamage(EntityChangeBlockEvent e) {
|
||||
// Check world
|
||||
if (!e.getBlock().getType().equals(Material.TNT) || !getIWM().inWorld(e.getBlock().getLocation())) {
|
||||
return false;
|
||||
return;
|
||||
}
|
||||
// Stop TNT from being damaged if it is being caused by a visitor with a flaming arrow
|
||||
if (e.getEntity() instanceof Projectile projectile) {
|
||||
@ -56,10 +56,8 @@ public class TNTListener extends FlagListener {
|
||||
// Remove the arrow
|
||||
projectile.remove();
|
||||
e.setCancelled(true);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -21,6 +21,15 @@ import world.bentobox.bentobox.util.Util;
|
||||
*/
|
||||
public class MobSpawnListener extends FlagListener {
|
||||
|
||||
/**
|
||||
* Prevents mobs spawning naturally
|
||||
*
|
||||
* @param e - event
|
||||
*/
|
||||
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
||||
public void onMobSpawnEvent(CreatureSpawnEvent e) {
|
||||
onMobSpawn(e);
|
||||
}
|
||||
/**
|
||||
* Prevents mobs spawning naturally
|
||||
*
|
||||
@ -28,7 +37,7 @@ public class MobSpawnListener extends FlagListener {
|
||||
* @return true if cancelled
|
||||
*/
|
||||
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
||||
public boolean onMobSpawn(CreatureSpawnEvent e) {
|
||||
boolean onMobSpawn(CreatureSpawnEvent e) {
|
||||
// If not in the right world, or spawning is not natural return
|
||||
if (!getIWM().inWorld(e.getEntity().getLocation())) {
|
||||
return false;
|
||||
|
@ -33,10 +33,18 @@ public class ObsidianScoopingListener extends FlagListener {
|
||||
* Enables changing of obsidian back into lava
|
||||
*
|
||||
* @param e event
|
||||
* @return false if obsidian not scooped, true if scooped
|
||||
*/
|
||||
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||
public boolean onPlayerInteract(final PlayerInteractEvent e) {
|
||||
public void onPlayerInteractEvent(final PlayerInteractEvent e) {
|
||||
onPlayerInteract(e);
|
||||
}
|
||||
/**
|
||||
* Enables changing of obsidian back into lava
|
||||
*
|
||||
* @param e event
|
||||
* @return false if obsidian not scooped, true if scooped
|
||||
*/
|
||||
boolean onPlayerInteract(final PlayerInteractEvent e) {
|
||||
if (!getIWM().inWorld(e.getPlayer().getLocation())
|
||||
|| !Flags.OBSIDIAN_SCOOPING.isSetForWorld(e.getPlayer().getWorld())
|
||||
|| !e.getPlayer().getGameMode().equals(GameMode.SURVIVAL)
|
||||
|
@ -1,17 +1,18 @@
|
||||
package world.bentobox.bentobox.listeners.flags.worldsettings;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.entity.PlayerDeathEvent;
|
||||
|
||||
import world.bentobox.bentobox.api.flags.FlagListener;
|
||||
import world.bentobox.bentobox.api.user.User;
|
||||
import world.bentobox.bentobox.database.objects.Island;
|
||||
import world.bentobox.bentobox.lists.Flags;
|
||||
import world.bentobox.bentobox.util.Util;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* Prevents visitors from losing their items if they
|
||||
* die on an island in which they are a visitor.
|
||||
|
@ -1,6 +1,10 @@
|
||||
package world.bentobox.bentobox.managers;
|
||||
|
||||
import java.io.*;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
|
@ -1,13 +1,13 @@
|
||||
package world.bentobox.bentobox.managers;
|
||||
|
||||
import world.bentobox.bentobox.BentoBox;
|
||||
import world.bentobox.bentobox.database.objects.IslandDeletion;
|
||||
import world.bentobox.bentobox.util.DeleteIslandChunks;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.Queue;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
import world.bentobox.bentobox.BentoBox;
|
||||
import world.bentobox.bentobox.database.objects.IslandDeletion;
|
||||
import world.bentobox.bentobox.util.DeleteIslandChunks;
|
||||
|
||||
/**
|
||||
* Manages the queue of island chunks to be deleted.
|
||||
*/
|
||||
|
@ -6,8 +6,8 @@ import java.util.stream.Collectors;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNull;
|
||||
|
||||
import world.bentobox.bentobox.api.flags.Flag.Type;
|
||||
import world.bentobox.bentobox.api.flags.clicklisteners.WorldToggleClick;
|
||||
import world.bentobox.bentobox.api.localization.TextVariables;
|
||||
|
@ -1,6 +1,12 @@
|
||||
package world.bentobox.bentobox.util;
|
||||
|
||||
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 java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Chunk;
|
||||
import org.bukkit.World;
|
||||
@ -10,6 +16,8 @@ import org.bukkit.generator.ChunkGenerator;
|
||||
import org.bukkit.generator.ChunkGenerator.ChunkData;
|
||||
import org.bukkit.inventory.InventoryHolder;
|
||||
import org.bukkit.scheduler.BukkitTask;
|
||||
|
||||
import io.papermc.lib.PaperLib;
|
||||
import world.bentobox.bentobox.BentoBox;
|
||||
import world.bentobox.bentobox.api.addons.GameModeAddon;
|
||||
import world.bentobox.bentobox.api.events.island.IslandEvent;
|
||||
@ -17,13 +25,6 @@ import world.bentobox.bentobox.api.events.island.IslandEvent.Reason;
|
||||
import world.bentobox.bentobox.database.objects.IslandDeletion;
|
||||
import world.bentobox.bentobox.nms.NMSAbstraction;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
/**
|
||||
* Deletes islands chunk by chunk
|
||||
*
|
||||
|
@ -1,21 +1,26 @@
|
||||
package world.bentobox.bentobox.util;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import com.mojang.authlib.properties.Property;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.MissingFormatArgumentException;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.DyeColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.banner.Pattern;
|
||||
import org.bukkit.block.banner.PatternType;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.*;
|
||||
import org.bukkit.inventory.meta.BannerMeta;
|
||||
import org.bukkit.inventory.meta.Damageable;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.bukkit.inventory.meta.PotionMeta;
|
||||
import org.bukkit.inventory.meta.SkullMeta;
|
||||
import org.bukkit.potion.PotionData;
|
||||
import org.bukkit.potion.PotionType;
|
||||
import org.eclipse.jdt.annotation.Nullable;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.MissingFormatArgumentException;
|
||||
import java.util.UUID;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import com.mojang.authlib.properties.Property;
|
||||
|
||||
import world.bentobox.bentobox.BentoBox;
|
||||
|
||||
|
@ -1,19 +1,5 @@
|
||||
package world.bentobox.bentobox.util.teleport;
|
||||
|
||||
import org.bukkit.*;
|
||||
import org.bukkit.World.Environment;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.scheduler.BukkitTask;
|
||||
import org.bukkit.util.Vector;
|
||||
import org.eclipse.jdt.annotation.Nullable;
|
||||
import world.bentobox.bentobox.BentoBox;
|
||||
import world.bentobox.bentobox.api.user.User;
|
||||
import world.bentobox.bentobox.database.objects.Island;
|
||||
import world.bentobox.bentobox.util.Pair;
|
||||
import world.bentobox.bentobox.util.Util;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
@ -21,6 +7,26 @@ import java.util.Objects;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Chunk;
|
||||
import org.bukkit.ChunkSnapshot;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.World.Environment;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.scheduler.BukkitTask;
|
||||
import org.bukkit.util.Vector;
|
||||
import org.eclipse.jdt.annotation.Nullable;
|
||||
|
||||
import world.bentobox.bentobox.BentoBox;
|
||||
import world.bentobox.bentobox.api.user.User;
|
||||
import world.bentobox.bentobox.database.objects.Island;
|
||||
import world.bentobox.bentobox.util.Pair;
|
||||
import world.bentobox.bentobox.util.Util;
|
||||
|
||||
/**
|
||||
* A class that calculates finds a safe spot asynchronously and then teleports the player there.
|
||||
*
|
||||
|
@ -1,9 +1,12 @@
|
||||
package world.bentobox.bentobox.api.commands.admin;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.mockito.ArgumentMatchers.eq;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.when;
|
||||
import static org.mockito.Mockito.*;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
|
@ -1,6 +1,8 @@
|
||||
package world.bentobox.bentobox.api.commands.island.team;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.ArgumentMatchers.anyString;
|
||||
import static org.mockito.ArgumentMatchers.eq;
|
||||
|
@ -110,6 +110,7 @@ public class PortalTeleportationListenerTest {
|
||||
when(iwm.inWorld(any(World.class))).thenReturn(true);
|
||||
when(iwm.inWorld(any(Location.class))).thenReturn(true);
|
||||
when(iwm.getNetherSpawnRadius(any())).thenReturn(100);
|
||||
when(iwm.getWorldSettings(any())).thenReturn(ws);
|
||||
when(plugin.getIWM()).thenReturn(iwm);
|
||||
|
||||
PowerMockito.mockStatic(Util.class, Mockito.RETURNS_MOCKS);
|
||||
@ -186,6 +187,9 @@ public class PortalTeleportationListenerTest {
|
||||
// Player
|
||||
when(player.getType()).thenReturn(EntityType.PLAYER);
|
||||
|
||||
// Bukkit
|
||||
when(Bukkit.getAllowNether()).thenReturn(true);
|
||||
when(Bukkit.getAllowEnd()).thenReturn(true);
|
||||
}
|
||||
|
||||
@After
|
||||
@ -465,6 +469,29 @@ public class PortalTeleportationListenerTest {
|
||||
assertTrue(np.onIslandPortal(e));
|
||||
// Verify
|
||||
assertFalse(e.isCancelled());
|
||||
// We are not going to 1,2,3
|
||||
assertFalse(e.getTo().toString().contains("x=1.0,y=2.0,z=3.0"));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link PortalTeleportationListener#onIslandPortal(org.bukkit.event.player.PlayerPortalEvent)}.
|
||||
*/
|
||||
@Test
|
||||
public void testonIslandPortalFromWorldToNetherStandardMakePortals() {
|
||||
when(ws.isMakeNetherPortals()).thenReturn(true);
|
||||
PortalTeleportationListener np = new PortalTeleportationListener(plugin);
|
||||
Location from = mock(Location.class);
|
||||
// Teleport from world to nether
|
||||
when(from.getWorld()).thenReturn(world);
|
||||
when(from.toVector()).thenReturn(new Vector(1,2,3));
|
||||
PlayerPortalEvent e = new PlayerPortalEvent(player, from, null, TeleportCause.NETHER_PORTAL);
|
||||
// Nether islands inactive
|
||||
when(iwm.isNetherIslands(any())).thenReturn(false);
|
||||
when(iwm.isNetherGenerate(any())).thenReturn(true);
|
||||
assertTrue(np.onIslandPortal(e));
|
||||
// Verify
|
||||
assertFalse(e.isCancelled());
|
||||
assertTrue(e.getTo().toString().contains("x=1.0,y=2.0,z=3.0"));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -40,6 +40,7 @@ import org.powermock.modules.junit4.PowerMockRunner;
|
||||
import org.powermock.reflect.Whitebox;
|
||||
|
||||
import world.bentobox.bentobox.BentoBox;
|
||||
import world.bentobox.bentobox.api.configuration.WorldSettings;
|
||||
import world.bentobox.bentobox.api.user.User;
|
||||
import world.bentobox.bentobox.managers.IslandWorldManager;
|
||||
import world.bentobox.bentobox.managers.IslandsManager;
|
||||
@ -82,6 +83,8 @@ public class StandardSpawnProtectionListenerTest {
|
||||
private BlockState blockState;
|
||||
@Mock
|
||||
private Location spawnLocation;
|
||||
@Mock
|
||||
private WorldSettings ws;
|
||||
|
||||
/**
|
||||
* @throws java.lang.Exception
|
||||
@ -105,6 +108,7 @@ public class StandardSpawnProtectionListenerTest {
|
||||
when(iwm.isEndIslands(any())).thenReturn(false);
|
||||
when(iwm.inWorld(any(World.class))).thenReturn(true);
|
||||
when(iwm.getNetherSpawnRadius(any())).thenReturn(25);
|
||||
when(iwm.getWorldSettings(any())).thenReturn(ws);
|
||||
// Util
|
||||
PowerMockito.mockStatic(Util.class);
|
||||
when(Util.getWorld(any())).thenReturn(world);
|
||||
@ -157,6 +161,18 @@ public class StandardSpawnProtectionListenerTest {
|
||||
verify(player).sendMessage("protection.spawn-protected");
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link world.bentobox.bentobox.listeners.StandardSpawnProtectionListener#onBlockPlace(org.bukkit.event.block.BlockPlaceEvent)}.
|
||||
*/
|
||||
@Test
|
||||
public void testOnBlockPlaceDisallowedNoProtection() {
|
||||
when(iwm.isNetherIslands(any())).thenReturn(true);
|
||||
BlockPlaceEvent e = new BlockPlaceEvent(block, blockState, null, null, player, true, EquipmentSlot.HAND);
|
||||
ssp.onBlockPlace(e);
|
||||
assertFalse(e.isCancelled());
|
||||
verify(player, never()).sendMessage("protection.spawn-protected");
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link world.bentobox.bentobox.listeners.StandardSpawnProtectionListener#onBlockPlace(org.bukkit.event.block.BlockPlaceEvent)}.
|
||||
*/
|
||||
@ -232,6 +248,18 @@ public class StandardSpawnProtectionListenerTest {
|
||||
verify(player).sendMessage("protection.spawn-protected");
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link world.bentobox.bentobox.listeners.StandardSpawnProtectionListener#onBlockBreak(org.bukkit.event.block.BlockBreakEvent)}.
|
||||
*/
|
||||
@Test
|
||||
public void testOnBlockBreakDisallowedNoProtection() {
|
||||
when(ws.isMakeNetherPortals()).thenReturn(true);
|
||||
BlockBreakEvent e = new BlockBreakEvent(block, player);
|
||||
ssp.onBlockBreak(e);
|
||||
assertFalse(e.isCancelled());
|
||||
verify(player, never()).sendMessage("protection.spawn-protected");
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link world.bentobox.bentobox.listeners.StandardSpawnProtectionListener#onBlockBreak(org.bukkit.event.block.BlockBreakEvent)}.
|
||||
*/
|
||||
@ -267,6 +295,32 @@ public class StandardSpawnProtectionListenerTest {
|
||||
assertEquals(1, blockList.size());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Test method for {@link world.bentobox.bentobox.listeners.StandardSpawnProtectionListener#onExplosion(org.bukkit.event.entity.EntityExplodeEvent)}.
|
||||
*/
|
||||
@Test
|
||||
public void testOnExplosionNoProtection() {
|
||||
when(ws.isMakeNetherPortals()).thenReturn(true);
|
||||
List<Block> blockList = new ArrayList<>();
|
||||
blockList.add(block);
|
||||
blockList.add(block);
|
||||
blockList.add(block);
|
||||
blockList.add(block);
|
||||
blockList.add(block);
|
||||
// Make some inside and outside spawn
|
||||
when(location.toVector()).thenReturn(new Vector(0,0,0),
|
||||
new Vector(0,0,0),
|
||||
new Vector(0,0,0),
|
||||
new Vector(0,0,0),
|
||||
new Vector(10000,0,0));
|
||||
EntityExplodeEvent e = new EntityExplodeEvent(player, location, blockList, 0);
|
||||
ssp.onExplosion(e);
|
||||
// No blocks should be removed
|
||||
assertEquals(5, blockList.size());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Test method for {@link world.bentobox.bentobox.listeners.StandardSpawnProtectionListener#onBucketEmpty(org.bukkit.event.player.PlayerBucketEmptyEvent)}.
|
||||
*/
|
||||
@ -278,6 +332,18 @@ public class StandardSpawnProtectionListenerTest {
|
||||
verify(player).sendMessage("protection.spawn-protected");
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link world.bentobox.bentobox.listeners.StandardSpawnProtectionListener#onBucketEmpty(org.bukkit.event.player.PlayerBucketEmptyEvent)}.
|
||||
*/
|
||||
@Test
|
||||
public void testOnBucketEmptyDisallowedNoProtection() {
|
||||
when(ws.isMakeNetherPortals()).thenReturn(true);
|
||||
PlayerBucketEmptyEvent e = new PlayerBucketEmptyEvent(player, block, block, BlockFace.DOWN, null, null);
|
||||
ssp.onBucketEmpty(e);
|
||||
assertFalse(e.isCancelled());
|
||||
verify(player, never()).sendMessage("protection.spawn-protected");
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link world.bentobox.bentobox.listeners.StandardSpawnProtectionListener#onBucketEmpty(org.bukkit.event.player.PlayerBucketEmptyEvent)}.
|
||||
*/
|
||||
|
@ -128,12 +128,12 @@ public class FireListenerTest {
|
||||
|
||||
// Player name
|
||||
PlayersManager pm = mock(PlayersManager.class);
|
||||
when(pm.getName(Mockito.any())).thenReturn("tastybento");
|
||||
when(pm.getName(any())).thenReturn("tastybento");
|
||||
when(plugin.getPlayers()).thenReturn(pm);
|
||||
|
||||
// World Settings
|
||||
WorldSettings ws = mock(WorldSettings.class);
|
||||
when(iwm.getWorldSettings(Mockito.any())).thenReturn(ws);
|
||||
when(iwm.getWorldSettings(any())).thenReturn(ws);
|
||||
|
||||
when(ws.getWorldFlags()).thenReturn(worldFlags);
|
||||
GameModeAddon gma = mock(GameModeAddon.class);
|
||||
@ -141,7 +141,7 @@ public class FireListenerTest {
|
||||
when(iwm.getAddon(any())).thenReturn(opGma);
|
||||
|
||||
PowerMockito.mockStatic(Util.class);
|
||||
when(Util.getWorld(Mockito.any())).thenReturn(mock(World.class));
|
||||
when(Util.getWorld(any())).thenReturn(mock(World.class));
|
||||
}
|
||||
|
||||
@After
|
||||
@ -168,16 +168,16 @@ public class FireListenerTest {
|
||||
listener.setPlugin(plugin);
|
||||
|
||||
// Disallow fire
|
||||
when(island.isAllowed(Mockito.any())).thenReturn(false);
|
||||
when(island.isAllowed(Mockito.any(), Mockito.any())).thenReturn(false);
|
||||
when(island.isAllowed(any())).thenReturn(false);
|
||||
when(island.isAllowed(any(), any())).thenReturn(false);
|
||||
Flags.FLINT_AND_STEEL.setDefaultSetting(false);
|
||||
assertTrue(listener.checkFire(e, location, Flags.FLINT_AND_STEEL));
|
||||
Flags.FLINT_AND_STEEL.setDefaultSetting(true);
|
||||
assertTrue(listener.checkFire(e, location, Flags.FLINT_AND_STEEL));
|
||||
|
||||
// Allow fire
|
||||
when(island.isAllowed(Mockito.any())).thenReturn(true);
|
||||
when(island.isAllowed(Mockito.any(), Mockito.any())).thenReturn(true);
|
||||
when(island.isAllowed(any())).thenReturn(true);
|
||||
when(island.isAllowed(any(), any())).thenReturn(true);
|
||||
Flags.FLINT_AND_STEEL.setDefaultSetting(false);
|
||||
assertFalse(listener.checkFire(e, location, Flags.FLINT_AND_STEEL));
|
||||
Flags.FLINT_AND_STEEL.setDefaultSetting(true);
|
||||
@ -211,20 +211,24 @@ public class FireListenerTest {
|
||||
listener.setPlugin(plugin);
|
||||
|
||||
// Disallow fire
|
||||
when(island.isAllowed(Mockito.any())).thenReturn(false);
|
||||
when(island.isAllowed(Mockito.any(), Mockito.any())).thenReturn(false);
|
||||
when(island.isAllowed(any())).thenReturn(false);
|
||||
when(island.isAllowed(any(), any())).thenReturn(false);
|
||||
Flags.FIRE_BURNING.setDefaultSetting(false);
|
||||
assertTrue(listener.onBlockBurn(e));
|
||||
listener.onBlockBurn(e);
|
||||
assertTrue(e.isCancelled());
|
||||
Flags.FIRE_BURNING.setDefaultSetting(true);
|
||||
assertTrue(listener.onBlockBurn(e));
|
||||
listener.onBlockBurn(e);
|
||||
assertTrue(e.isCancelled());
|
||||
|
||||
// Allow fire
|
||||
when(island.isAllowed(Mockito.any())).thenReturn(true);
|
||||
when(island.isAllowed(Mockito.any(), Mockito.any())).thenReturn(true);
|
||||
when(island.isAllowed(any())).thenReturn(true);
|
||||
when(island.isAllowed(any(), any())).thenReturn(true);
|
||||
Flags.FIRE_BURNING.setDefaultSetting(false);
|
||||
assertFalse(listener.onBlockBurn(e));
|
||||
listener.onBlockBurn(e);
|
||||
assertFalse(e.isCancelled());
|
||||
Flags.FIRE_BURNING.setDefaultSetting(true);
|
||||
assertFalse(listener.onBlockBurn(e));
|
||||
listener.onBlockBurn(e);
|
||||
assertFalse(e.isCancelled());
|
||||
|
||||
// Check with no island
|
||||
e = new BlockBurnEvent(block, block);
|
||||
@ -235,7 +239,8 @@ public class FireListenerTest {
|
||||
assertTrue(e.isCancelled());
|
||||
// Fire allowed
|
||||
Flags.FIRE_BURNING.setDefaultSetting(true);
|
||||
assertFalse(listener.onBlockBurn(e));
|
||||
listener.onBlockBurn(e);
|
||||
assertFalse(e.isCancelled());
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -261,29 +266,35 @@ public class FireListenerTest {
|
||||
listener.setPlugin(plugin);
|
||||
|
||||
// Disallow fire
|
||||
when(island.isAllowed(Mockito.any())).thenReturn(false);
|
||||
when(island.isAllowed(Mockito.any(), Mockito.any())).thenReturn(false);
|
||||
when(island.isAllowed(any())).thenReturn(false);
|
||||
when(island.isAllowed(any(), any())).thenReturn(false);
|
||||
Flags.FIRE_SPREAD.setDefaultSetting(false);
|
||||
assertTrue(listener.onBlockSpread(e));
|
||||
listener.onBlockSpread(e);
|
||||
assertTrue(e.isCancelled());
|
||||
Flags.FIRE_SPREAD.setDefaultSetting(true);
|
||||
assertTrue(listener.onBlockSpread(e));
|
||||
listener.onBlockSpread(e);
|
||||
assertTrue(e.isCancelled());
|
||||
|
||||
// Allow fire spread
|
||||
when(island.isAllowed(Mockito.any())).thenReturn(true);
|
||||
when(island.isAllowed(Mockito.any(), Mockito.any())).thenReturn(true);
|
||||
when(island.isAllowed(any())).thenReturn(true);
|
||||
when(island.isAllowed(any(), any())).thenReturn(true);
|
||||
Flags.FIRE_SPREAD.setDefaultSetting(false);
|
||||
assertFalse(listener.onBlockSpread(e));
|
||||
listener.onBlockSpread(e);
|
||||
assertFalse(e.isCancelled());
|
||||
Flags.FIRE_SPREAD.setDefaultSetting(true);
|
||||
assertFalse(listener.onBlockSpread(e));
|
||||
listener.onBlockSpread(e);
|
||||
assertFalse(e.isCancelled());
|
||||
|
||||
// Check with no island
|
||||
when(im.getIslandAt(any())).thenReturn(Optional.empty());
|
||||
// Fire spread is not allowed, so should be cancelled
|
||||
Flags.FIRE_SPREAD.setDefaultSetting(false);
|
||||
assertTrue(listener.onBlockSpread(e));
|
||||
listener.onBlockSpread(e);
|
||||
assertTrue(e.isCancelled());
|
||||
// Fire allowed
|
||||
Flags.FIRE_SPREAD.setDefaultSetting(true);
|
||||
assertFalse(listener.onBlockSpread(e));
|
||||
listener.onBlockSpread(e);
|
||||
assertFalse(e.isCancelled());
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -307,34 +318,41 @@ public class FireListenerTest {
|
||||
listener.setPlugin(plugin);
|
||||
|
||||
// Obsidian is okay to ignite
|
||||
assertFalse(listener.onBlockIgnite(e));
|
||||
listener.onBlockIgnite(e);
|
||||
assertFalse(e.isCancelled());
|
||||
|
||||
// Now set to something flammable
|
||||
when(block.getType()).thenReturn(Material.OAK_PLANKS);
|
||||
|
||||
// Disallow fire
|
||||
when(island.isAllowed(Mockito.any())).thenReturn(false);
|
||||
when(island.isAllowed(Mockito.any(), Mockito.any())).thenReturn(false);
|
||||
when(island.isAllowed(any())).thenReturn(false);
|
||||
when(island.isAllowed(any(), any())).thenReturn(false);
|
||||
Flags.FIRE_IGNITE.setDefaultSetting(false);
|
||||
assertTrue(listener.onBlockIgnite(e));
|
||||
listener.onBlockIgnite(e);
|
||||
assertTrue(e.isCancelled());
|
||||
Flags.FIRE_IGNITE.setDefaultSetting(true);
|
||||
assertTrue(listener.onBlockIgnite(e));
|
||||
listener.onBlockIgnite(e);
|
||||
assertTrue(e.isCancelled());
|
||||
|
||||
// Allow fire spread
|
||||
when(island.isAllowed(Mockito.any())).thenReturn(true);
|
||||
when(island.isAllowed(Mockito.any(), Mockito.any())).thenReturn(true);
|
||||
when(island.isAllowed(any())).thenReturn(true);
|
||||
when(island.isAllowed(any(), any())).thenReturn(true);
|
||||
Flags.FIRE_IGNITE.setDefaultSetting(false);
|
||||
assertFalse(listener.onBlockIgnite(e));
|
||||
listener.onBlockIgnite(e);
|
||||
assertFalse(e.isCancelled());
|
||||
Flags.FIRE_IGNITE.setDefaultSetting(true);
|
||||
assertFalse(listener.onBlockIgnite(e));
|
||||
listener.onBlockIgnite(e);
|
||||
assertFalse(e.isCancelled());
|
||||
|
||||
// Check with no island
|
||||
when(im.getIslandAt(any())).thenReturn(Optional.empty());
|
||||
// Fire spread is not allowed, so should be cancelled
|
||||
Flags.FIRE_IGNITE.setDefaultSetting(false);
|
||||
assertTrue(listener.onBlockIgnite(e));
|
||||
listener.onBlockIgnite(e);
|
||||
assertTrue(e.isCancelled());
|
||||
// Fire allowed
|
||||
Flags.FIRE_IGNITE.setDefaultSetting(true);
|
||||
assertFalse(listener.onBlockIgnite(e));
|
||||
listener.onBlockIgnite(e);
|
||||
assertFalse(e.isCancelled());
|
||||
}
|
||||
}
|
||||
|
@ -152,7 +152,7 @@ public class TNTListenerTest extends AbstractCommonSetup {
|
||||
when(block.getType()).thenReturn(Material.TNT);
|
||||
// Entity is not a projectile
|
||||
EntityChangeBlockEvent e = new EntityChangeBlockEvent(player, block, Material.AIR.createBlockData());
|
||||
assertFalse(listener.onTNTDamage(e));
|
||||
listener.onTNTDamage(e);
|
||||
assertFalse(e.isCancelled());
|
||||
|
||||
}
|
||||
@ -163,7 +163,7 @@ public class TNTListenerTest extends AbstractCommonSetup {
|
||||
// Out of world
|
||||
when(iwm.inWorld(any(Location.class))).thenReturn(false);
|
||||
EntityChangeBlockEvent e = new EntityChangeBlockEvent(player, block, Material.AIR.createBlockData());
|
||||
assertFalse(listener.onTNTDamage(e));
|
||||
listener.onTNTDamage(e);
|
||||
assertFalse(e.isCancelled());
|
||||
}
|
||||
@Test
|
||||
@ -173,7 +173,7 @@ public class TNTListenerTest extends AbstractCommonSetup {
|
||||
// Out of world
|
||||
when(iwm.inWorld(any(Location.class))).thenReturn(false);
|
||||
EntityChangeBlockEvent e = new EntityChangeBlockEvent(player, block, Material.AIR.createBlockData());
|
||||
assertFalse(listener.onTNTDamage(e));
|
||||
listener.onTNTDamage(e);
|
||||
assertFalse(e.isCancelled());
|
||||
}
|
||||
|
||||
@ -191,7 +191,7 @@ public class TNTListenerTest extends AbstractCommonSetup {
|
||||
when(arrow.getFireTicks()).thenReturn(10);
|
||||
|
||||
EntityChangeBlockEvent e = new EntityChangeBlockEvent(arrow, block, Material.AIR.createBlockData());
|
||||
assertFalse(listener.onTNTDamage(e));
|
||||
listener.onTNTDamage(e);
|
||||
assertFalse(e.isCancelled());
|
||||
verify(arrow, never()).remove();
|
||||
}
|
||||
@ -209,7 +209,7 @@ public class TNTListenerTest extends AbstractCommonSetup {
|
||||
when(arrow.getFireTicks()).thenReturn(0);
|
||||
|
||||
EntityChangeBlockEvent e = new EntityChangeBlockEvent(arrow, block, Material.AIR.createBlockData());
|
||||
assertFalse(listener.onTNTDamage(e));
|
||||
listener.onTNTDamage(e);
|
||||
assertFalse(e.isCancelled());
|
||||
verify(arrow, never()).remove();
|
||||
|
||||
@ -228,7 +228,7 @@ public class TNTListenerTest extends AbstractCommonSetup {
|
||||
when(arrow.getFireTicks()).thenReturn(10);
|
||||
|
||||
EntityChangeBlockEvent e = new EntityChangeBlockEvent(arrow, block, Material.AIR.createBlockData());
|
||||
assertTrue(listener.onTNTDamage(e));
|
||||
listener.onTNTDamage(e);
|
||||
assertTrue(e.isCancelled());
|
||||
verify(arrow).remove();
|
||||
|
||||
@ -249,7 +249,7 @@ public class TNTListenerTest extends AbstractCommonSetup {
|
||||
when(island.isAllowed(any(), eq(Flags.TNT_PRIMING))).thenReturn(true);
|
||||
|
||||
EntityChangeBlockEvent e = new EntityChangeBlockEvent(arrow, block, Material.AIR.createBlockData());
|
||||
assertFalse(listener.onTNTDamage(e));
|
||||
listener.onTNTDamage(e);
|
||||
assertFalse(e.isCancelled());
|
||||
verify(arrow, never()).remove();
|
||||
|
||||
@ -270,7 +270,7 @@ public class TNTListenerTest extends AbstractCommonSetup {
|
||||
when(arrow.getFireTicks()).thenReturn(10);
|
||||
|
||||
EntityChangeBlockEvent e = new EntityChangeBlockEvent(arrow, block, Material.AIR.createBlockData());
|
||||
assertTrue(listener.onTNTDamage(e));
|
||||
listener.onTNTDamage(e);
|
||||
assertTrue(e.isCancelled());
|
||||
verify(arrow).remove();
|
||||
|
||||
@ -291,7 +291,7 @@ public class TNTListenerTest extends AbstractCommonSetup {
|
||||
when(arrow.getFireTicks()).thenReturn(10);
|
||||
|
||||
EntityChangeBlockEvent e = new EntityChangeBlockEvent(arrow, block, Material.AIR.createBlockData());
|
||||
assertFalse(listener.onTNTDamage(e));
|
||||
listener.onTNTDamage(e);
|
||||
assertFalse(e.isCancelled());
|
||||
verify(arrow, never()).remove();
|
||||
|
||||
|
@ -2,12 +2,11 @@ package world.bentobox.bentobox.listeners.flags.worldsettings;
|
||||
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
import static org.mockito.Mockito.*;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.AnimalTamer;
|
||||
|
@ -8,8 +8,8 @@ import static org.mockito.ArgumentMatchers.anyString;
|
||||
import static org.mockito.ArgumentMatchers.eq;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.never;
|
||||
import static org.mockito.Mockito.when;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
|
Loading…
Reference in New Issue
Block a user