Fixes bugs and code smells from Sonarcloud.

This commit is contained in:
tastybento 2019-07-04 16:54:05 -07:00
parent cd4bea8a3e
commit b1f66eb31b
114 changed files with 477 additions and 399 deletions

View File

@ -4,6 +4,7 @@ import java.util.HashMap;
import java.util.Map;
import org.bstats.bukkit.Metrics;
import world.bentobox.bentobox.api.addons.GameModeAddon;
/**

View File

@ -19,11 +19,11 @@ import world.bentobox.bentobox.api.user.Notifier;
import world.bentobox.bentobox.api.user.User;
import world.bentobox.bentobox.commands.BentoBoxCommand;
import world.bentobox.bentobox.hooks.DynmapHook;
import world.bentobox.bentobox.hooks.MultiverseCoreHook;
import world.bentobox.bentobox.hooks.VaultHook;
import world.bentobox.bentobox.hooks.WorldEditHook;
import world.bentobox.bentobox.hooks.placeholders.MVdWPlaceholderAPIHook;
import world.bentobox.bentobox.hooks.MultiverseCoreHook;
import world.bentobox.bentobox.hooks.placeholders.PlaceholderAPIHook;
import world.bentobox.bentobox.hooks.VaultHook;
import world.bentobox.bentobox.listeners.BannedVisitorCommands;
import world.bentobox.bentobox.listeners.BlockEndDragon;
import world.bentobox.bentobox.listeners.DeathListener;

View File

@ -1,5 +1,10 @@
package world.bentobox.bentobox;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import world.bentobox.bentobox.api.configuration.ConfigComment;
import world.bentobox.bentobox.api.configuration.ConfigEntry;
import world.bentobox.bentobox.api.configuration.ConfigObject;
@ -7,11 +12,6 @@ import world.bentobox.bentobox.api.configuration.StoreAt;
import world.bentobox.bentobox.database.DatabaseSetup.DatabaseType;
import world.bentobox.bentobox.managers.RanksManager;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
/**
* All the plugin settings are here
* @author tastybento

View File

@ -1,16 +1,5 @@
package world.bentobox.bentobox.api.addons;
import org.bukkit.Bukkit;
import org.bukkit.Server;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.event.Listener;
import world.bentobox.bentobox.BentoBox;
import world.bentobox.bentobox.api.addons.request.AddonRequestHandler;
import world.bentobox.bentobox.api.flags.Flag;
import world.bentobox.bentobox.managers.IslandsManager;
import world.bentobox.bentobox.managers.PlayersManager;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
@ -21,6 +10,18 @@ import java.util.jar.JarEntry;
import java.util.jar.JarFile;
import java.util.logging.Logger;
import org.bukkit.Bukkit;
import org.bukkit.Server;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.event.Listener;
import world.bentobox.bentobox.BentoBox;
import world.bentobox.bentobox.api.addons.request.AddonRequestHandler;
import world.bentobox.bentobox.api.flags.Flag;
import world.bentobox.bentobox.managers.IslandsManager;
import world.bentobox.bentobox.managers.PlayersManager;
/**
* Add-on class for BentoBox. Extend this to create an add-on. The operation
* and methods are very similar to Bukkit's JavaPlugin.

View File

@ -1,18 +1,5 @@
package world.bentobox.bentobox.api.addons;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.permissions.PermissionDefault;
import org.bukkit.plugin.InvalidDescriptionException;
import org.bukkit.util.permissions.DefaultPermissions;
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
import world.bentobox.bentobox.api.addons.exceptions.InvalidAddonFormatException;
import world.bentobox.bentobox.api.addons.exceptions.InvalidAddonInheritException;
import world.bentobox.bentobox.managers.AddonsManager;
import java.io.File;
import java.lang.reflect.InvocationTargetException;
import java.net.MalformedURLException;
@ -23,6 +10,20 @@ import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.permissions.PermissionDefault;
import org.bukkit.plugin.InvalidDescriptionException;
import org.bukkit.util.permissions.DefaultPermissions;
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
import world.bentobox.bentobox.api.addons.exceptions.InvalidAddonFormatException;
import world.bentobox.bentobox.api.addons.exceptions.InvalidAddonInheritException;
import world.bentobox.bentobox.managers.AddonsManager;
/**
* Loads addons and sets up permissions
* @author Tastybento, ComminQ

View File

@ -1,12 +1,12 @@
package world.bentobox.bentobox.api.addons;
import org.bukkit.Material;
import org.eclipse.jdt.annotation.NonNull;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.bukkit.Material;
import org.eclipse.jdt.annotation.NonNull;
/**
* @author tastybento, Poslovitch
*/

View File

@ -1,11 +1,11 @@
package world.bentobox.bentobox.api.commands.admin;
import java.util.List;
import world.bentobox.bentobox.api.commands.CompositeCommand;
import world.bentobox.bentobox.api.commands.ConfirmableCommand;
import world.bentobox.bentobox.api.user.User;
import java.util.List;
/**
* @since 1.5.0
* @author tastybento

View File

@ -1,5 +1,6 @@
package world.bentobox.bentobox.api.commands.admin;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
@ -24,6 +25,7 @@ public class AdminSwitchtoCommand extends ConfirmableCommand {
*/
public AdminSwitchtoCommand(CompositeCommand parent) {
super(parent, "switchto");
islands = new ArrayList<>();
}
@Override

View File

@ -1,11 +1,11 @@
package world.bentobox.bentobox.api.commands.admin.blueprints;
import java.util.List;
import world.bentobox.bentobox.api.commands.CompositeCommand;
import world.bentobox.bentobox.api.user.User;
import world.bentobox.bentobox.blueprints.BlueprintClipboard;
import java.util.List;
public class AdminBlueprintCopyCommand extends CompositeCommand {
public AdminBlueprintCopyCommand(AdminBlueprintCommand parent) {

View File

@ -1,9 +1,5 @@
package world.bentobox.bentobox.api.commands.admin.blueprints;
import world.bentobox.bentobox.api.commands.CompositeCommand;
import world.bentobox.bentobox.api.user.User;
import world.bentobox.bentobox.managers.BlueprintsManager;
import java.io.File;
import java.io.FilenameFilter;
import java.util.Arrays;
@ -11,6 +7,10 @@ import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
import world.bentobox.bentobox.api.commands.CompositeCommand;
import world.bentobox.bentobox.api.user.User;
import world.bentobox.bentobox.managers.BlueprintsManager;
public class AdminBlueprintListCommand extends CompositeCommand {
public AdminBlueprintListCommand(AdminBlueprintCommand parent) {

View File

@ -1,14 +1,14 @@
package world.bentobox.bentobox.api.commands.admin.blueprints;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import world.bentobox.bentobox.api.commands.CompositeCommand;
import world.bentobox.bentobox.api.user.User;
import world.bentobox.bentobox.managers.BlueprintClipboardManager;
import world.bentobox.bentobox.util.Util;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
public class AdminBlueprintLoadCommand extends CompositeCommand {
public AdminBlueprintLoadCommand(AdminBlueprintCommand parent) {

View File

@ -1,14 +1,15 @@
package world.bentobox.bentobox.api.commands.admin.blueprints;
import java.util.List;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.block.Block;
import world.bentobox.bentobox.api.commands.CompositeCommand;
import world.bentobox.bentobox.api.user.User;
import world.bentobox.bentobox.blueprints.BlueprintClipboard;
import java.util.List;
public class AdminBlueprintOriginCommand extends CompositeCommand {
public AdminBlueprintOriginCommand(AdminBlueprintCommand parent) {

View File

@ -1,12 +1,12 @@
package world.bentobox.bentobox.api.commands.admin.blueprints;
import java.util.List;
import world.bentobox.bentobox.api.commands.CompositeCommand;
import world.bentobox.bentobox.api.user.User;
import world.bentobox.bentobox.blueprints.BlueprintClipboard;
import world.bentobox.bentobox.blueprints.BlueprintPaster;
import java.util.List;
public class AdminBlueprintPasteCommand extends CompositeCommand {
public AdminBlueprintPasteCommand(AdminBlueprintCommand parent) {

View File

@ -1,12 +1,12 @@
package world.bentobox.bentobox.api.commands.admin.blueprints;
import java.util.List;
import world.bentobox.bentobox.api.commands.CompositeCommand;
import world.bentobox.bentobox.api.user.User;
import world.bentobox.bentobox.blueprints.BlueprintClipboard;
import world.bentobox.bentobox.util.Util;
import java.util.List;
public class AdminBlueprintPos1Command extends CompositeCommand {
public AdminBlueprintPos1Command(AdminBlueprintCommand parent) {

View File

@ -1,12 +1,12 @@
package world.bentobox.bentobox.api.commands.admin.blueprints;
import java.util.List;
import world.bentobox.bentobox.api.commands.CompositeCommand;
import world.bentobox.bentobox.api.user.User;
import world.bentobox.bentobox.blueprints.BlueprintClipboard;
import world.bentobox.bentobox.util.Util;
import java.util.List;
public class AdminBlueprintPos2Command extends CompositeCommand {
public AdminBlueprintPos2Command(AdminBlueprintCommand parent) {

View File

@ -1,5 +1,9 @@
package world.bentobox.bentobox.api.commands.admin.blueprints;
import java.io.File;
import java.util.List;
import java.util.Locale;
import world.bentobox.bentobox.api.addons.GameModeAddon;
import world.bentobox.bentobox.api.commands.ConfirmableCommand;
import world.bentobox.bentobox.api.user.User;
@ -7,10 +11,6 @@ import world.bentobox.bentobox.blueprints.BlueprintClipboard;
import world.bentobox.bentobox.managers.BlueprintClipboardManager;
import world.bentobox.bentobox.managers.BlueprintsManager;
import java.io.File;
import java.util.List;
import java.util.Locale;
public class AdminBlueprintSaveCommand extends ConfirmableCommand {
public AdminBlueprintSaveCommand(AdminBlueprintCommand parent) {

View File

@ -1,13 +1,14 @@
package world.bentobox.bentobox.api.commands.admin.deaths;
import org.eclipse.jdt.annotation.NonNull;
import world.bentobox.bentobox.api.commands.CompositeCommand;
import world.bentobox.bentobox.api.localization.TextVariables;
import world.bentobox.bentobox.api.user.User;
import java.util.List;
import java.util.UUID;
import org.eclipse.jdt.annotation.NonNull;
import world.bentobox.bentobox.api.commands.CompositeCommand;
import world.bentobox.bentobox.api.localization.TextVariables;
import world.bentobox.bentobox.api.user.User;
/**
* @author Poslovitch
*/

View File

@ -1,14 +1,15 @@
package world.bentobox.bentobox.api.commands.admin.deaths;
import org.apache.commons.lang.math.NumberUtils;
import org.eclipse.jdt.annotation.NonNull;
import world.bentobox.bentobox.api.commands.CompositeCommand;
import world.bentobox.bentobox.api.localization.TextVariables;
import world.bentobox.bentobox.api.user.User;
import java.util.List;
import java.util.UUID;
import org.apache.commons.lang.math.NumberUtils;
import org.eclipse.jdt.annotation.NonNull;
import world.bentobox.bentobox.api.commands.CompositeCommand;
import world.bentobox.bentobox.api.localization.TextVariables;
import world.bentobox.bentobox.api.user.User;
/**
* @author Poslovitch
*/

View File

@ -1,6 +1,9 @@
package world.bentobox.bentobox.api.commands.admin.resets;
import java.util.*;
import java.util.Collections;
import java.util.List;
import java.util.Optional;
import java.util.UUID;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;

View File

@ -1,6 +1,10 @@
package world.bentobox.bentobox.api.commands.admin.team;
import java.util.List;
import java.util.UUID;
import org.bukkit.Bukkit;
import world.bentobox.bentobox.api.commands.CompositeCommand;
import world.bentobox.bentobox.api.events.IslandBaseEvent;
import world.bentobox.bentobox.api.events.team.TeamEvent;
@ -8,9 +12,6 @@ import world.bentobox.bentobox.api.localization.TextVariables;
import world.bentobox.bentobox.api.user.User;
import world.bentobox.bentobox.database.objects.Island;
import java.util.List;
import java.util.UUID;
public class AdminTeamAddCommand extends CompositeCommand {
public AdminTeamAddCommand(CompositeCommand parent) {

View File

@ -1,6 +1,10 @@
package world.bentobox.bentobox.api.commands.admin.team;
import java.util.List;
import java.util.UUID;
import org.bukkit.Bukkit;
import world.bentobox.bentobox.api.commands.CompositeCommand;
import world.bentobox.bentobox.api.events.IslandBaseEvent;
import world.bentobox.bentobox.api.events.team.TeamEvent;
@ -8,9 +12,6 @@ import world.bentobox.bentobox.api.localization.TextVariables;
import world.bentobox.bentobox.api.user.User;
import world.bentobox.bentobox.database.objects.Island;
import java.util.List;
import java.util.UUID;
public class AdminTeamDisbandCommand extends CompositeCommand {
public AdminTeamDisbandCommand(CompositeCommand parent) {

View File

@ -1,7 +1,11 @@
package world.bentobox.bentobox.api.commands.admin.team;
import java.util.List;
import java.util.UUID;
import org.bukkit.Bukkit;
import org.eclipse.jdt.annotation.NonNull;
import world.bentobox.bentobox.api.commands.CompositeCommand;
import world.bentobox.bentobox.api.events.IslandBaseEvent;
import world.bentobox.bentobox.api.events.team.TeamEvent;
@ -9,9 +13,6 @@ import world.bentobox.bentobox.api.localization.TextVariables;
import world.bentobox.bentobox.api.user.User;
import world.bentobox.bentobox.database.objects.Island;
import java.util.List;
import java.util.UUID;
/**
* Kicks the specified player from the island team.
* @author tastybento

View File

@ -1,6 +1,10 @@
package world.bentobox.bentobox.api.commands.admin.team;
import java.util.List;
import java.util.UUID;
import org.bukkit.Bukkit;
import world.bentobox.bentobox.api.commands.CompositeCommand;
import world.bentobox.bentobox.api.events.IslandBaseEvent;
import world.bentobox.bentobox.api.events.team.TeamEvent;
@ -8,9 +12,6 @@ import world.bentobox.bentobox.api.localization.TextVariables;
import world.bentobox.bentobox.api.user.User;
import world.bentobox.bentobox.database.objects.Island;
import java.util.List;
import java.util.UUID;
/**
* Sets the owner of an island.
* @author tastybento

View File

@ -1,9 +1,15 @@
package world.bentobox.bentobox.api.commands.island;
import java.util.List;
import java.util.Optional;
import java.util.UUID;
import java.util.stream.Collectors;
import org.bukkit.Bukkit;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import org.eclipse.jdt.annotation.NonNull;
import world.bentobox.bentobox.api.commands.CompositeCommand;
import world.bentobox.bentobox.api.events.IslandBaseEvent;
import world.bentobox.bentobox.api.events.island.IslandEvent;
@ -12,11 +18,6 @@ import world.bentobox.bentobox.api.user.User;
import world.bentobox.bentobox.database.objects.Island;
import world.bentobox.bentobox.util.Util;
import java.util.List;
import java.util.Optional;
import java.util.UUID;
import java.util.stream.Collectors;
public class IslandBanCommand extends CompositeCommand {
public IslandBanCommand(CompositeCommand islandCommand) {

View File

@ -1,7 +1,11 @@
package world.bentobox.bentobox.api.commands.island;
import java.util.List;
import java.util.UUID;
import org.bukkit.Sound;
import org.eclipse.jdt.annotation.Nullable;
import world.bentobox.bentobox.api.commands.CompositeCommand;
import world.bentobox.bentobox.api.events.IslandBaseEvent;
import world.bentobox.bentobox.api.events.island.IslandEvent;
@ -9,9 +13,6 @@ import world.bentobox.bentobox.api.localization.TextVariables;
import world.bentobox.bentobox.api.user.User;
import world.bentobox.bentobox.database.objects.Island;
import java.util.List;
import java.util.UUID;
/**
* @author tastybento
* @since 1.4.0

View File

@ -4,8 +4,8 @@ import java.io.IOException;
import java.util.List;
import org.bukkit.entity.Player;
import org.eclipse.jdt.annotation.NonNull;
import world.bentobox.bentobox.api.addons.GameModeAddon;
import world.bentobox.bentobox.api.commands.CompositeCommand;
import world.bentobox.bentobox.api.commands.ConfirmableCommand;

View File

@ -1,5 +1,10 @@
package world.bentobox.bentobox.api.commands.island;
import java.util.List;
import java.util.Optional;
import java.util.UUID;
import java.util.stream.Collectors;
import world.bentobox.bentobox.api.commands.CompositeCommand;
import world.bentobox.bentobox.api.events.IslandBaseEvent;
import world.bentobox.bentobox.api.events.island.IslandEvent;
@ -8,11 +13,6 @@ import world.bentobox.bentobox.api.user.User;
import world.bentobox.bentobox.database.objects.Island;
import world.bentobox.bentobox.util.Util;
import java.util.List;
import java.util.Optional;
import java.util.UUID;
import java.util.stream.Collectors;
public class IslandUnbanCommand extends CompositeCommand {
public IslandUnbanCommand(CompositeCommand islandCommand) {

View File

@ -1,6 +1,10 @@
package world.bentobox.bentobox.api.commands.island.team;
import java.util.List;
import java.util.UUID;
import org.bukkit.Bukkit;
import world.bentobox.bentobox.api.commands.CompositeCommand;
import world.bentobox.bentobox.api.commands.ConfirmableCommand;
import world.bentobox.bentobox.api.events.IslandBaseEvent;
@ -9,9 +13,6 @@ import world.bentobox.bentobox.api.localization.TextVariables;
import world.bentobox.bentobox.api.user.User;
import world.bentobox.bentobox.database.objects.Island;
import java.util.List;
import java.util.UUID;
public class IslandTeamKickCommand extends ConfirmableCommand {

View File

@ -4,10 +4,9 @@ import java.util.UUID;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.eclipse.jdt.annotation.NonNull;
import world.bentobox.bentobox.api.events.IslandBaseEvent;
import world.bentobox.bentobox.blueprints.Blueprint;
import world.bentobox.bentobox.blueprints.dataobjects.BlueprintBundle;
import world.bentobox.bentobox.database.objects.Island;
import world.bentobox.bentobox.database.objects.IslandDeletion;

View File

@ -1,10 +1,17 @@
package world.bentobox.bentobox.api.flags;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.event.Listener;
import org.bukkit.inventory.ItemStack;
import org.eclipse.jdt.annotation.NonNull;
import world.bentobox.bentobox.BentoBox;
import world.bentobox.bentobox.api.addons.Addon;
import world.bentobox.bentobox.api.addons.GameModeAddon;
@ -20,12 +27,6 @@ import world.bentobox.bentobox.database.objects.Island;
import world.bentobox.bentobox.managers.RanksManager;
import world.bentobox.bentobox.util.Util;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
public class Flag implements Comparable<Flag> {
/**

View File

@ -2,6 +2,7 @@ package world.bentobox.bentobox.api.flags.clicklisteners;
import org.bukkit.Sound;
import org.bukkit.event.inventory.ClickType;
import world.bentobox.bentobox.BentoBox;
import world.bentobox.bentobox.api.addons.GameModeAddon;
import world.bentobox.bentobox.api.localization.TextVariables;

View File

@ -2,6 +2,7 @@ package world.bentobox.bentobox.api.flags.clicklisteners;
import org.bukkit.Sound;
import org.bukkit.event.inventory.ClickType;
import world.bentobox.bentobox.BentoBox;
import world.bentobox.bentobox.api.addons.GameModeAddon;
import world.bentobox.bentobox.api.localization.TextVariables;

View File

@ -6,8 +6,8 @@ import java.util.Locale;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.inventory.ItemStack;
import org.eclipse.jdt.annotation.NonNull;
import world.bentobox.bentobox.util.ItemParser;
/**

View File

@ -11,8 +11,8 @@ import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.InventoryHolder;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import org.eclipse.jdt.annotation.NonNull;
import world.bentobox.bentobox.api.user.User;
import world.bentobox.bentobox.listeners.PanelListenerManager;
import world.bentobox.bentobox.util.heads.HeadGetter;

View File

@ -1,8 +1,9 @@
package world.bentobox.bentobox.api.panels.builders;
import org.bukkit.ChatColor;
import java.util.TreeMap;
import org.bukkit.ChatColor;
import world.bentobox.bentobox.api.panels.Panel;
import world.bentobox.bentobox.api.panels.PanelItem;
import world.bentobox.bentobox.api.panels.PanelListener;

View File

@ -1,17 +1,18 @@
package world.bentobox.bentobox.api.panels.builders;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.inventory.ItemStack;
import org.eclipse.jdt.annotation.Nullable;
import world.bentobox.bentobox.api.panels.PanelItem;
import world.bentobox.bentobox.api.panels.PanelItem.ClickHandler;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.inventory.ItemStack;
import org.eclipse.jdt.annotation.Nullable;
import world.bentobox.bentobox.api.panels.PanelItem;
import world.bentobox.bentobox.api.panels.PanelItem.ClickHandler;
public class PanelItemBuilder {
private ItemStack icon = new ItemStack(Material.AIR);
private @Nullable String name = "";

View File

@ -2,6 +2,7 @@ package world.bentobox.bentobox.api.placeholders;
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
import world.bentobox.bentobox.api.addons.GameModeAddon;
import world.bentobox.bentobox.api.user.User;
import world.bentobox.bentobox.database.objects.Island;

View File

@ -2,6 +2,7 @@ package world.bentobox.bentobox.api.placeholders;
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
import world.bentobox.bentobox.api.user.User;
@FunctionalInterface

View File

@ -1,15 +1,16 @@
package world.bentobox.bentobox.api.placeholders.placeholderapi;
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
import org.bukkit.entity.Player;
import org.eclipse.jdt.annotation.NonNull;
import world.bentobox.bentobox.api.placeholders.PlaceholderReplacer;
import world.bentobox.bentobox.api.user.User;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import org.bukkit.entity.Player;
import org.eclipse.jdt.annotation.NonNull;
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
import world.bentobox.bentobox.api.placeholders.PlaceholderReplacer;
import world.bentobox.bentobox.api.user.User;
/**
* @author Poslovitch
*/

View File

@ -1,5 +1,13 @@
package world.bentobox.bentobox.api.user;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
import java.util.stream.Collectors;
import org.apache.commons.lang.math.NumberUtils;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
@ -16,18 +24,11 @@ import org.bukkit.permissions.PermissionAttachmentInfo;
import org.bukkit.util.Vector;
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
import world.bentobox.bentobox.BentoBox;
import world.bentobox.bentobox.api.addons.Addon;
import world.bentobox.bentobox.api.events.OfflineMessageEvent;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
import java.util.stream.Collectors;
/**
* Combines {@link Player}, {@link OfflinePlayer} and {@link CommandSender} to provide convenience methods related to
* localization and generic interactions.

View File

@ -1,5 +1,15 @@
package world.bentobox.bentobox.blueprints;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.stream.Collectors;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
@ -24,6 +34,7 @@ import org.bukkit.util.BoundingBox;
import org.bukkit.util.Vector;
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
import world.bentobox.bentobox.BentoBox;
import world.bentobox.bentobox.api.localization.TextVariables;
import world.bentobox.bentobox.api.user.User;
@ -31,16 +42,6 @@ import world.bentobox.bentobox.blueprints.dataobjects.BlueprintBlock;
import world.bentobox.bentobox.blueprints.dataobjects.BlueprintCreatureSpawner;
import world.bentobox.bentobox.blueprints.dataobjects.BlueprintEntity;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.stream.Collectors;
/**
* The clipboard provides the holding spot for an active blueprint that is being
* manipulated by a user. It supports copying from the world and setting of coordinates

View File

@ -219,11 +219,9 @@ public class BlueprintPaster {
}
private void pasteEntity(World world, Location location, Entry<Vector, List<BlueprintEntity>> entry) {
System.out.println(location.toString());
int x = location.getBlockX() + entry.getKey().getBlockX();
int y = location.getBlockY() + entry.getKey().getBlockY();
int z = location.getBlockZ() + entry.getKey().getBlockZ();
System.out.println(x + " " + y + " " + z);
setEntity(new Location(world, x, y, z), entry.getValue());
}

View File

@ -1,5 +1,20 @@
package world.bentobox.bentobox.blueprints.worldedit;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Set;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Sets;
import com.google.gson.Gson;
@ -8,18 +23,11 @@ import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormat;
import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormats;
import com.sk89q.worldedit.extent.clipboard.io.ClipboardReader;
import com.sk89q.worldedit.extent.clipboard.io.ClipboardWriter;
import world.bentobox.bentobox.BentoBox;
import world.bentobox.bentobox.blueprints.Blueprint;
import world.bentobox.bentobox.database.json.BentoboxTypeAdapterFactory;
import java.io.*;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Set;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
/**
* @since 1.6.0
* @author CustomEntity
@ -59,18 +67,23 @@ public class BlueprintClipboardFormat implements ClipboardFormat {
File unzippedFile = new File(file.getParentFile(), file.getName());
try (FileReader fr = new FileReader(unzippedFile)) {
gson.fromJson(fr, Blueprint.class);
return true;
} catch (Exception e) {
return false;
}
return gsonCheck(gson, unzippedFile);
} catch (IOException e) {
e.printStackTrace();
BentoBox.getInstance().logStacktrace(e);
}
return false;
}
private boolean gsonCheck(Gson gson, File unzippedFile) {
try (FileReader fr = new FileReader(unzippedFile)) {
gson.fromJson(fr, Blueprint.class);
return true;
} catch (Exception e) {
return false;
}
}
@Override
public String getPrimaryFileExtension() {
return "blueprint";

View File

@ -1,11 +1,11 @@
package world.bentobox.bentobox.blueprints.worldedit;
import com.sk89q.worldedit.extent.clipboard.Clipboard;
import com.sk89q.worldedit.extent.clipboard.io.ClipboardReader;
import java.io.IOException;
import java.io.InputStream;
import com.sk89q.worldedit.extent.clipboard.Clipboard;
import com.sk89q.worldedit.extent.clipboard.io.ClipboardReader;
/**
* @since 1.6.0
* @author CustomEntity

View File

@ -1,11 +1,11 @@
package world.bentobox.bentobox.blueprints.worldedit;
import com.sk89q.worldedit.extent.clipboard.Clipboard;
import com.sk89q.worldedit.extent.clipboard.io.ClipboardWriter;
import java.io.IOException;
import java.io.OutputStream;
import com.sk89q.worldedit.extent.clipboard.Clipboard;
import com.sk89q.worldedit.extent.clipboard.io.ClipboardWriter;
/**
* @since 1.6.0
* @author CustomEntity

View File

@ -1,13 +1,14 @@
package world.bentobox.bentobox.blueprints.worldedit;
import com.sk89q.worldedit.extent.clipboard.Clipboard;
import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormats;
import world.bentobox.bentobox.BentoBox;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import com.sk89q.worldedit.extent.clipboard.Clipboard;
import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormats;
import world.bentobox.bentobox.BentoBox;
/**
* @since 1.6.0
* @author CustomEntity
@ -30,7 +31,7 @@ public class BlueprintSchematicConverter {
clipboard = ClipboardFormats.findByFile(blueprintFile).getReader(new FileInputStream(blueprintFile)).read();
} catch (IOException e) {
BentoBox.getInstance().logWarning("Error while trying to convert blueprint format to schematic format.");
e.printStackTrace();
BentoBox.getInstance().logStacktrace(e);
}
return clipboard;
}

View File

@ -1,11 +1,11 @@
package world.bentobox.bentobox.commands;
import java.util.List;
import world.bentobox.bentobox.api.commands.CompositeCommand;
import world.bentobox.bentobox.api.user.User;
import world.bentobox.bentobox.panels.CatalogPanel;
import java.util.List;
/**
* Displays the Addons Catalog.
*

View File

@ -1,10 +1,10 @@
package world.bentobox.bentobox.commands;
import java.util.List;
import world.bentobox.bentobox.api.commands.CompositeCommand;
import world.bentobox.bentobox.api.user.User;
import java.util.List;
public class BentoBoxCommand extends CompositeCommand {
/**

View File

@ -1,11 +1,11 @@
package world.bentobox.bentobox.commands;
import java.util.List;
import world.bentobox.bentobox.api.commands.CompositeCommand;
import world.bentobox.bentobox.api.commands.ConfirmableCommand;
import world.bentobox.bentobox.api.user.User;
import java.util.List;
/**
* Performs localization analysis.
*

View File

@ -1,11 +1,11 @@
package world.bentobox.bentobox.commands;
import java.util.List;
import world.bentobox.bentobox.api.commands.CompositeCommand;
import world.bentobox.bentobox.api.user.User;
import world.bentobox.bentobox.panels.ManagementPanel;
import java.util.List;
/**
* Displays the Management panel.
*

View File

@ -1,17 +1,18 @@
package world.bentobox.bentobox.commands;
import org.bukkit.Bukkit;
import world.bentobox.bentobox.api.addons.GameModeAddon;
import world.bentobox.bentobox.api.commands.CompositeCommand;
import world.bentobox.bentobox.api.localization.TextVariables;
import world.bentobox.bentobox.api.user.User;
import world.bentobox.bentobox.versions.ServerCompatibility;
import java.util.Comparator;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import org.bukkit.Bukkit;
import world.bentobox.bentobox.api.addons.GameModeAddon;
import world.bentobox.bentobox.api.commands.CompositeCommand;
import world.bentobox.bentobox.api.localization.TextVariables;
import world.bentobox.bentobox.api.user.User;
import world.bentobox.bentobox.versions.ServerCompatibility;
/**
* Displays information about Gamemodes, Addons and versioning.
*

View File

@ -21,7 +21,7 @@ public class Database<T> {
private AbstractDatabaseHandler<T> handler;
private Logger logger;
private static DatabaseSetup database;
private static DatabaseSetup databaseSetup = DatabaseSetup.getDatabase();
/**
* Construct a database
@ -30,7 +30,7 @@ public class Database<T> {
*/
public Database(BentoBox plugin, Class<T> type) {
this.logger = plugin.getLogger();
setup(type);
handler = databaseSetup.getHandler(type);
}
/**
@ -40,15 +40,7 @@ public class Database<T> {
*/
public Database(Addon addon, Class<T> type) {
this.logger = addon.getLogger();
setup(type);
}
private void setup(Class<T> type) {
// Only do this query once
if (database == null) {
database = DatabaseSetup.getDatabase();
}
handler = database.getHandler(type);
handler = databaseSetup.getHandler(type);
}
/**
@ -138,7 +130,6 @@ public class Database<T> {
* Close the database
*/
public void close() {
database = null;
handler.close();
}

View File

@ -1,5 +1,7 @@
package world.bentobox.bentobox.database;
import java.util.Arrays;
import world.bentobox.bentobox.BentoBox;
import world.bentobox.bentobox.database.json.JSONDatabase;
import world.bentobox.bentobox.database.mariadb.MariaDBDatabase;
@ -7,11 +9,23 @@ import world.bentobox.bentobox.database.mongodb.MongoDBDatabase;
import world.bentobox.bentobox.database.mysql.MySQLDatabase;
import world.bentobox.bentobox.database.postgresql.PostgreSQLDatabase;
import world.bentobox.bentobox.database.sqlite.SQLiteDatabase;
import world.bentobox.bentobox.database.transition.*;
import world.bentobox.bentobox.database.transition.Json2MariaDBDatabase;
import world.bentobox.bentobox.database.transition.Json2MongoDBDatabase;
import world.bentobox.bentobox.database.transition.Json2MySQLDatabase;
import world.bentobox.bentobox.database.transition.Json2PostgreSQLDatabase;
import world.bentobox.bentobox.database.transition.Json2SQLiteDatabase;
import world.bentobox.bentobox.database.transition.MariaDB2JsonDatabase;
import world.bentobox.bentobox.database.transition.MongoDB2JsonDatabase;
import world.bentobox.bentobox.database.transition.MySQL2JsonDatabase;
import world.bentobox.bentobox.database.transition.PostgreSQL2JsonDatabase;
import world.bentobox.bentobox.database.transition.SQLite2JsonDatabase;
import world.bentobox.bentobox.database.transition.Yaml2JsonDatabase;
import world.bentobox.bentobox.database.transition.Yaml2MariaDBDatabase;
import world.bentobox.bentobox.database.transition.Yaml2MongoDBDatabase;
import world.bentobox.bentobox.database.transition.Yaml2MySQLDatabase;
import world.bentobox.bentobox.database.transition.Yaml2SQLiteDatabase;
import world.bentobox.bentobox.database.yaml.YamlDatabase;
import java.util.Arrays;
/**
* @author Poslovitch, tastybento
*/

View File

@ -4,6 +4,7 @@ import java.io.File;
import java.util.UUID;
import org.eclipse.jdt.annotation.NonNull;
import world.bentobox.bentobox.BentoBox;
import world.bentobox.bentobox.database.DatabaseConnector;

View File

@ -17,6 +17,7 @@ import java.util.Locale;
import java.util.Objects;
import org.eclipse.jdt.annotation.NonNull;
import world.bentobox.bentobox.BentoBox;
import world.bentobox.bentobox.database.DatabaseConnector;
import world.bentobox.bentobox.database.objects.DataObject;

View File

@ -1,18 +1,19 @@
package world.bentobox.bentobox.database.json.adapters;
import com.google.gson.TypeAdapter;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
import org.bukkit.configuration.serialization.ConfigurationSerializable;
import org.bukkit.configuration.serialization.ConfigurationSerialization;
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
import static org.bukkit.configuration.serialization.ConfigurationSerialization.SERIALIZED_TYPE_KEY;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import static org.bukkit.configuration.serialization.ConfigurationSerialization.SERIALIZED_TYPE_KEY;
import org.bukkit.configuration.serialization.ConfigurationSerializable;
import org.bukkit.configuration.serialization.ConfigurationSerialization;
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
import com.google.gson.TypeAdapter;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
/**
* Handles {@link ConfigurationSerializable} types

View File

@ -5,8 +5,8 @@ import java.sql.DriverManager;
import java.sql.SQLException;
import org.bukkit.Bukkit;
import org.eclipse.jdt.annotation.NonNull;
import world.bentobox.bentobox.database.DatabaseConnectionSettingsImpl;
import world.bentobox.bentobox.database.DatabaseConnector;

View File

@ -1,12 +1,13 @@
package world.bentobox.bentobox.database.mongodb;
import org.eclipse.jdt.annotation.NonNull;
import com.mongodb.MongoClient;
import com.mongodb.MongoClientOptions;
import com.mongodb.MongoCredential;
import com.mongodb.ServerAddress;
import com.mongodb.client.MongoDatabase;
import org.eclipse.jdt.annotation.NonNull;
import world.bentobox.bentobox.database.DatabaseConnectionSettingsImpl;
import world.bentobox.bentobox.database.DatabaseConnector;

View File

@ -14,11 +14,11 @@ import java.util.concurrent.ConcurrentLinkedQueue;
import org.bukkit.Bukkit;
import org.bukkit.scheduler.BukkitTask;
import org.eclipse.jdt.annotation.NonNull;
import com.google.gson.Gson;
import com.google.gson.JsonSyntaxException;
import org.eclipse.jdt.annotation.NonNull;
import world.bentobox.bentobox.BentoBox;
import world.bentobox.bentobox.database.DatabaseConnector;
import world.bentobox.bentobox.database.json.AbstractJSONDatabaseHandler;

View File

@ -1,8 +1,17 @@
package world.bentobox.bentobox.database.objects;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.ImmutableSet.Builder;
import com.google.gson.annotations.Expose;
import java.util.Date;
import java.util.EnumMap;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import java.util.UUID;
import java.util.stream.Collectors;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
@ -13,6 +22,11 @@ import org.bukkit.util.BoundingBox;
import org.bukkit.util.Vector;
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.ImmutableSet.Builder;
import com.google.gson.annotations.Expose;
import world.bentobox.bentobox.BentoBox;
import world.bentobox.bentobox.api.configuration.WorldSettings;
import world.bentobox.bentobox.api.flags.Flag;
@ -28,18 +42,6 @@ import world.bentobox.bentobox.managers.RanksManager;
import world.bentobox.bentobox.util.Pair;
import world.bentobox.bentobox.util.Util;
import java.util.Date;
import java.util.EnumMap;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import java.util.UUID;
import java.util.stream.Collectors;
/**
* Stores all the info about an island
* Managed by IslandsManager

View File

@ -1,14 +1,15 @@
package world.bentobox.bentobox.database.postgresql;
import org.bukkit.Bukkit;
import org.eclipse.jdt.annotation.NonNull;
import world.bentobox.bentobox.database.DatabaseConnectionSettingsImpl;
import world.bentobox.bentobox.database.DatabaseConnector;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import org.bukkit.Bukkit;
import org.eclipse.jdt.annotation.NonNull;
import world.bentobox.bentobox.database.DatabaseConnectionSettingsImpl;
import world.bentobox.bentobox.database.DatabaseConnector;
/**
* @since 1.6.0
* @author Poslovitch

View File

@ -1,16 +1,5 @@
package world.bentobox.bentobox.database.postgresql;
import com.google.gson.Gson;
import com.google.gson.JsonSyntaxException;
import org.bukkit.Bukkit;
import org.bukkit.scheduler.BukkitTask;
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
import world.bentobox.bentobox.BentoBox;
import world.bentobox.bentobox.database.DatabaseConnector;
import world.bentobox.bentobox.database.json.AbstractJSONDatabaseHandler;
import world.bentobox.bentobox.database.objects.DataObject;
import java.beans.IntrospectionException;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
@ -25,6 +14,19 @@ import java.util.List;
import java.util.Queue;
import java.util.concurrent.ConcurrentLinkedQueue;
import org.bukkit.Bukkit;
import org.bukkit.scheduler.BukkitTask;
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
import com.google.gson.Gson;
import com.google.gson.JsonSyntaxException;
import world.bentobox.bentobox.BentoBox;
import world.bentobox.bentobox.database.DatabaseConnector;
import world.bentobox.bentobox.database.json.AbstractJSONDatabaseHandler;
import world.bentobox.bentobox.database.objects.DataObject;
/**
*
* @param <T>

View File

@ -1,15 +1,16 @@
package world.bentobox.bentobox.database.sqlite;
import org.bukkit.Bukkit;
import org.eclipse.jdt.annotation.NonNull;
import world.bentobox.bentobox.BentoBox;
import world.bentobox.bentobox.database.DatabaseConnector;
import java.io.File;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import org.bukkit.Bukkit;
import org.eclipse.jdt.annotation.NonNull;
import world.bentobox.bentobox.BentoBox;
import world.bentobox.bentobox.database.DatabaseConnector;
/**
* @since 1.6.0
* @author Poslovitch

View File

@ -1,15 +1,5 @@
package world.bentobox.bentobox.database.sqlite;
import com.google.gson.Gson;
import com.google.gson.JsonSyntaxException;
import org.bukkit.Bukkit;
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
import world.bentobox.bentobox.BentoBox;
import world.bentobox.bentobox.database.DatabaseConnector;
import world.bentobox.bentobox.database.json.AbstractJSONDatabaseHandler;
import world.bentobox.bentobox.database.objects.DataObject;
import java.beans.IntrospectionException;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
@ -22,6 +12,18 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import org.bukkit.Bukkit;
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
import com.google.gson.Gson;
import com.google.gson.JsonSyntaxException;
import world.bentobox.bentobox.BentoBox;
import world.bentobox.bentobox.database.DatabaseConnector;
import world.bentobox.bentobox.database.json.AbstractJSONDatabaseHandler;
import world.bentobox.bentobox.database.objects.DataObject;
/**
* @since 1.6.0
* @author Poslovitch

View File

@ -1,12 +1,13 @@
package world.bentobox.bentobox.database.transition;
import org.eclipse.jdt.annotation.Nullable;
import world.bentobox.bentobox.database.AbstractDatabaseHandler;
import java.beans.IntrospectionException;
import java.lang.reflect.InvocationTargetException;
import java.util.List;
import org.eclipse.jdt.annotation.Nullable;
import world.bentobox.bentobox.database.AbstractDatabaseHandler;
/**
* Class that transitions from one database type to another
*

View File

@ -24,10 +24,10 @@ import java.util.UUID;
import org.bukkit.configuration.InvalidConfigurationException;
import org.bukkit.configuration.file.YamlConfiguration;
import org.eclipse.jdt.annotation.NonNull;
import com.google.common.base.Charsets;
import org.eclipse.jdt.annotation.NonNull;
import world.bentobox.bentobox.BentoBox;
import world.bentobox.bentobox.database.DatabaseConnector;

View File

@ -1,18 +1,19 @@
package world.bentobox.bentobox.hooks;
import java.util.HashMap;
import java.util.Map;
import org.bukkit.Material;
import org.dynmap.DynmapAPI;
import org.dynmap.markers.MarkerAPI;
import org.dynmap.markers.MarkerSet;
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.hooks.Hook;
import java.util.HashMap;
import java.util.Map;
/**
* @author Poslovitch
* @since 1.5.0

View File

@ -3,6 +3,7 @@ package world.bentobox.bentobox.hooks;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.World;
import world.bentobox.bentobox.BentoBox;
import world.bentobox.bentobox.api.hooks.Hook;

View File

@ -1,10 +1,11 @@
package world.bentobox.bentobox.hooks;
import net.milkbowl.vault.economy.Economy;
import net.milkbowl.vault.economy.EconomyResponse;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.plugin.RegisteredServiceProvider;
import net.milkbowl.vault.economy.Economy;
import net.milkbowl.vault.economy.EconomyResponse;
import world.bentobox.bentobox.api.hooks.Hook;
import world.bentobox.bentobox.api.user.User;

View File

@ -14,8 +14,6 @@ import world.bentobox.bentobox.blueprints.worldedit.BlueprintClipboardFormat;
*/
public class WorldEditHook extends Hook {
private WorldEdit instance;
public WorldEditHook() {
super("WorldEdit", Material.WOODEN_AXE);
}
@ -23,6 +21,7 @@ public class WorldEditHook extends Hook {
@Override
public boolean hook() {
WorldEdit instance;
try {
instance = WorldEdit.getInstance();
new BlueprintClipboardFormat();

View File

@ -1,8 +1,9 @@
package world.bentobox.bentobox.hooks.placeholders;
import be.maximvdw.placeholderapi.PlaceholderAPI;
import org.bukkit.entity.Player;
import org.eclipse.jdt.annotation.NonNull;
import be.maximvdw.placeholderapi.PlaceholderAPI;
import world.bentobox.bentobox.BentoBox;
import world.bentobox.bentobox.api.addons.Addon;
import world.bentobox.bentobox.api.placeholders.PlaceholderReplacer;

View File

@ -3,6 +3,7 @@ package world.bentobox.bentobox.hooks.placeholders;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.eclipse.jdt.annotation.NonNull;
import world.bentobox.bentobox.api.addons.Addon;
import world.bentobox.bentobox.api.hooks.Hook;
import world.bentobox.bentobox.api.placeholders.PlaceholderReplacer;

View File

@ -15,10 +15,10 @@ import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
import org.eclipse.jdt.annotation.NonNull;
import world.bentobox.bentobox.BentoBox;
import world.bentobox.bentobox.util.Util;
import world.bentobox.bentobox.util.teleport.SafeSpotTeleport;
import world.bentobox.bentobox.blueprints.BlueprintPaster;
import world.bentobox.bentobox.database.objects.Island;
import world.bentobox.bentobox.util.Util;
import world.bentobox.bentobox.util.teleport.SafeSpotTeleport;
/**
* Handles teleportation via the Nether/End portals to the Nether and End dimensions of the worlds added by the GameModeAddons.

View File

@ -1,5 +1,8 @@
package world.bentobox.bentobox.listeners.flags.protection;
import java.util.Arrays;
import java.util.List;
import org.bukkit.Material;
import org.bukkit.entity.Animals;
import org.bukkit.event.EventHandler;
@ -7,12 +10,10 @@ import org.bukkit.event.EventPriority;
import org.bukkit.event.player.PlayerInteractAtEntityEvent;
import org.bukkit.inventory.EquipmentSlot;
import org.bukkit.inventory.ItemStack;
import world.bentobox.bentobox.api.flags.FlagListener;
import world.bentobox.bentobox.lists.Flags;
import java.util.Arrays;
import java.util.List;
/**
* Handles breeding protection
* Note - animal protection is done elsewhere.

View File

@ -9,6 +9,7 @@ import org.bukkit.event.EventPriority;
import org.bukkit.event.player.PlayerBucketEmptyEvent;
import org.bukkit.event.player.PlayerBucketFillEvent;
import org.bukkit.event.player.PlayerInteractEntityEvent;
import world.bentobox.bentobox.api.flags.FlagListener;
import world.bentobox.bentobox.lists.Flags;

View File

@ -6,6 +6,7 @@ import org.bukkit.event.EventPriority;
import org.bukkit.event.block.Action;
import org.bukkit.event.player.PlayerInteractEntityEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import world.bentobox.bentobox.api.flags.FlagListener;
import world.bentobox.bentobox.lists.Flags;
import world.bentobox.bentobox.versions.ServerCompatibility;

View File

@ -12,6 +12,7 @@ import org.bukkit.event.block.BlockIgniteEvent;
import org.bukkit.event.block.BlockSpreadEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.util.BlockIterator;
import world.bentobox.bentobox.api.flags.Flag;
import world.bentobox.bentobox.api.flags.FlagListener;
import world.bentobox.bentobox.lists.Flags;

View File

@ -1,5 +1,7 @@
package world.bentobox.bentobox.listeners.flags.protection;
import java.util.HashMap;
import org.bukkit.Material;
import org.bukkit.entity.ArmorStand;
import org.bukkit.entity.Entity;
@ -18,13 +20,12 @@ import org.bukkit.event.player.PlayerFishEvent;
import org.bukkit.event.player.PlayerInteractEntityEvent;
import org.bukkit.inventory.EquipmentSlot;
import org.bukkit.potion.PotionEffect;
import world.bentobox.bentobox.api.flags.Flag;
import world.bentobox.bentobox.api.flags.FlagListener;
import world.bentobox.bentobox.lists.Flags;
import world.bentobox.bentobox.util.Util;
import java.util.HashMap;
/**
* Handles hurting of monsters and animals directly and indirectly

View File

@ -6,6 +6,7 @@ import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.PlayerLeashEntityEvent;
import org.bukkit.event.hanging.HangingPlaceEvent;
import org.bukkit.event.player.PlayerUnleashEntityEvent;
import world.bentobox.bentobox.api.flags.FlagListener;
import world.bentobox.bentobox.lists.Flags;

View File

@ -7,6 +7,7 @@ import org.bukkit.event.EventPriority;
import org.bukkit.event.block.Action;
import org.bukkit.event.entity.EntityInteractEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import world.bentobox.bentobox.api.flags.FlagListener;
import world.bentobox.bentobox.lists.Flags;

View File

@ -10,6 +10,7 @@ import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.event.block.EntityBlockFormEvent;
import org.bukkit.event.player.PlayerInteractEntityEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import world.bentobox.bentobox.api.flags.FlagListener;
import world.bentobox.bentobox.lists.Flags;

View File

@ -1,5 +1,8 @@
package world.bentobox.bentobox.listeners.flags.protection;
import java.util.Arrays;
import java.util.List;
import org.bukkit.Material;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
@ -10,12 +13,10 @@ import org.bukkit.event.block.Action;
import org.bukkit.event.entity.EntityChangeBlockEvent;
import org.bukkit.event.entity.EntityExplodeEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import world.bentobox.bentobox.api.flags.FlagListener;
import world.bentobox.bentobox.lists.Flags;
import java.util.Arrays;
import java.util.List;
/**
* Protects islands from visitors blowing things up
* @author tastybento

View File

@ -4,6 +4,7 @@ import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.player.PlayerTeleportEvent;
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
import world.bentobox.bentobox.api.flags.FlagListener;
import world.bentobox.bentobox.lists.Flags;

View File

@ -1,14 +1,15 @@
package world.bentobox.bentobox.listeners.flags.settings;
import java.util.Optional;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.block.LeavesDecayEvent;
import world.bentobox.bentobox.api.flags.FlagListener;
import world.bentobox.bentobox.database.objects.Island;
import world.bentobox.bentobox.lists.Flags;
import java.util.Optional;
/**
* Handles {@link world.bentobox.bentobox.lists.Flags#LEAF_DECAY}.
* @author Poslovitch

View File

@ -1,17 +1,18 @@
package world.bentobox.bentobox.listeners.flags.settings;
import java.util.Optional;
import org.bukkit.entity.PufferFish;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.CreatureSpawnEvent;
import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason;
import world.bentobox.bentobox.api.flags.FlagListener;
import world.bentobox.bentobox.database.objects.Island;
import world.bentobox.bentobox.lists.Flags;
import world.bentobox.bentobox.util.Util;
import java.util.Optional;
/**
* Handles natural mob spawning.

View File

@ -1,5 +1,8 @@
package world.bentobox.bentobox.listeners.flags.settings;
import java.util.HashMap;
import java.util.UUID;
import org.bukkit.Bukkit;
import org.bukkit.World;
import org.bukkit.entity.Entity;
@ -16,14 +19,12 @@ import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.entity.LingeringPotionSplashEvent;
import org.bukkit.event.entity.PotionSplashEvent;
import org.bukkit.event.player.PlayerFishEvent;
import world.bentobox.bentobox.api.flags.Flag;
import world.bentobox.bentobox.api.flags.FlagListener;
import world.bentobox.bentobox.api.user.User;
import world.bentobox.bentobox.lists.Flags;
import java.util.HashMap;
import java.util.UUID;
/**
* Handles PVP
* @author tastybento

View File

@ -8,8 +8,8 @@ import org.bukkit.event.EventPriority;
import org.bukkit.event.player.PlayerMoveEvent;
import org.bukkit.event.player.PlayerTeleportEvent;
import org.bukkit.util.Vector;
import org.eclipse.jdt.annotation.NonNull;
import world.bentobox.bentobox.api.events.island.IslandEvent;
import world.bentobox.bentobox.api.flags.FlagListener;
import world.bentobox.bentobox.api.localization.TextVariables;

View File

@ -4,7 +4,6 @@ import java.util.Arrays;
import java.util.Comparator;
import java.util.stream.Collectors;
import org.bukkit.GameMode;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.World;

View File

@ -1,15 +1,15 @@
package world.bentobox.bentobox.lists;
import world.bentobox.bentobox.api.placeholders.GameModePlaceholderReplacer;
import world.bentobox.bentobox.database.objects.Island;
import world.bentobox.bentobox.managers.RanksManager;
import world.bentobox.bentobox.util.Util;
import java.text.DateFormat;
import java.time.Instant;
import java.util.Date;
import java.util.Optional;
import world.bentobox.bentobox.api.placeholders.GameModePlaceholderReplacer;
import world.bentobox.bentobox.database.objects.Island;
import world.bentobox.bentobox.managers.RanksManager;
import world.bentobox.bentobox.util.Util;
public enum GameModePlaceholder {
/* World-related */

View File

@ -1,21 +1,22 @@
package world.bentobox.bentobox.managers;
import org.bukkit.Bukkit;
import org.bukkit.event.HandlerList;
import org.bukkit.event.Listener;
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
import world.bentobox.bentobox.BentoBox;
import world.bentobox.bentobox.api.addons.Addon;
import world.bentobox.bentobox.api.flags.Flag;
import world.bentobox.bentobox.lists.Flags;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import org.bukkit.Bukkit;
import org.bukkit.event.HandlerList;
import org.bukkit.event.Listener;
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
import world.bentobox.bentobox.BentoBox;
import world.bentobox.bentobox.api.addons.Addon;
import world.bentobox.bentobox.api.flags.Flag;
import world.bentobox.bentobox.lists.Flags;
/**
* @author Poslovitch
* @author tastybento

View File

@ -2,6 +2,7 @@ package world.bentobox.bentobox.managers;
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.placeholders.PlaceholderReplacer;

View File

@ -1,13 +1,14 @@
package world.bentobox.bentobox.managers;
import org.eclipse.jdt.annotation.NonNull;
import world.bentobox.bentobox.BentoBox;
import world.bentobox.bentobox.api.hooks.Hook;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import org.eclipse.jdt.annotation.NonNull;
import world.bentobox.bentobox.BentoBox;
import world.bentobox.bentobox.api.hooks.Hook;
/**
* @author Poslovitch
*/

View File

@ -14,7 +14,6 @@ import java.util.UUID;
import java.util.stream.Collectors;
import org.bukkit.Bukkit;
import org.bukkit.GameMode;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.TreeSpecies;
@ -801,7 +800,7 @@ public class IslandsManager {
.filter(Objects::nonNull)
.filter(n -> !duplicatedUUIDRemovedSet.add(n))
.collect(Collectors.toSet());
if (duplicated.size() > 0) {
if (!duplicated.isEmpty()) {
plugin.logError("**** Owners that have more than one island = " + duplicated.size());
for (UUID uuid : duplicated) {
Set<Island> set = islandCache.getIslands().stream().filter(i -> uuid.equals(i.getOwner())).collect(Collectors.toSet());

View File

@ -1,15 +1,5 @@
package world.bentobox.bentobox.managers;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.configuration.file.YamlConfiguration;
import world.bentobox.bentobox.BentoBox;
import world.bentobox.bentobox.api.addons.Addon;
import world.bentobox.bentobox.api.localization.BentoBoxLocale;
import world.bentobox.bentobox.api.user.User;
import world.bentobox.bentobox.util.FileLister;
import world.bentobox.bentobox.util.Util;
import java.io.File;
import java.io.FilenameFilter;
import java.io.IOException;
@ -23,6 +13,17 @@ import java.util.Map;
import java.util.Objects;
import java.util.jar.JarFile;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.configuration.file.YamlConfiguration;
import world.bentobox.bentobox.BentoBox;
import world.bentobox.bentobox.api.addons.Addon;
import world.bentobox.bentobox.api.localization.BentoBoxLocale;
import world.bentobox.bentobox.api.user.User;
import world.bentobox.bentobox.util.FileLister;
import world.bentobox.bentobox.util.Util;
/**
* @author tastybento, Poslovitch
*/

View File

@ -1,8 +1,14 @@
package world.bentobox.bentobox.managers;
import java.util.Arrays;
import java.util.EnumMap;
import java.util.Map;
import java.util.Optional;
import org.bukkit.entity.Player;
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
import world.bentobox.bentobox.BentoBox;
import world.bentobox.bentobox.api.addons.Addon;
import world.bentobox.bentobox.api.addons.GameModeAddon;
@ -11,11 +17,6 @@ import world.bentobox.bentobox.hooks.placeholders.MVdWPlaceholderAPIHook;
import world.bentobox.bentobox.hooks.placeholders.PlaceholderAPIHook;
import world.bentobox.bentobox.lists.GameModePlaceholder;
import java.util.Arrays;
import java.util.EnumMap;
import java.util.Map;
import java.util.Optional;
/**
* Manages placeholder integration.
*

View File

@ -1,15 +1,5 @@
package world.bentobox.bentobox.managers;
import org.bukkit.Location;
import org.bukkit.World;
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
import world.bentobox.bentobox.BentoBox;
import world.bentobox.bentobox.api.user.User;
import world.bentobox.bentobox.database.Database;
import world.bentobox.bentobox.database.objects.Names;
import world.bentobox.bentobox.database.objects.Players;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
@ -18,6 +8,17 @@ import java.util.Map;
import java.util.Set;
import java.util.UUID;
import org.bukkit.Location;
import org.bukkit.World;
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
import world.bentobox.bentobox.BentoBox;
import world.bentobox.bentobox.api.user.User;
import world.bentobox.bentobox.database.Database;
import world.bentobox.bentobox.database.objects.Names;
import world.bentobox.bentobox.database.objects.Players;
public class PlayersManager {
private BentoBox plugin;

View File

@ -1,22 +1,24 @@
package world.bentobox.bentobox.managers;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import io.github.TheBusyBiscuit.GitHubWebAPI4Java.GitHubWebAPI;
import io.github.TheBusyBiscuit.GitHubWebAPI4Java.objects.repositories.GitHubRepository;
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
import world.bentobox.bentobox.BentoBox;
import world.bentobox.bentobox.Settings;
import world.bentobox.bentobox.web.catalog.CatalogEntry;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Base64;
import java.util.List;
import java.util.Optional;
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import io.github.TheBusyBiscuit.GitHubWebAPI4Java.GitHubWebAPI;
import io.github.TheBusyBiscuit.GitHubWebAPI4Java.objects.repositories.GitHubRepository;
import world.bentobox.bentobox.BentoBox;
import world.bentobox.bentobox.Settings;
import world.bentobox.bentobox.web.catalog.CatalogEntry;
/**
* Handles web-related stuff.
* Should be instantiated after all addons are loaded.
@ -84,7 +86,7 @@ public class WebManager {
// Register the tags translations in the locales
if (!tagsContent.isEmpty()) {
JsonObject tags = new JsonParser().parse(tagsContent).getAsJsonObject();
tags.entrySet().forEach((entry) -> plugin.getLocalesManager().getLanguages().values().forEach((locale) -> {
tags.entrySet().forEach(entry -> plugin.getLocalesManager().getLanguages().values().forEach(locale -> {
JsonElement translation = entry.getValue().getAsJsonObject().get(locale.toLanguageTag());
if (translation != null) {
locale.set("catalog.tags." + entry.getKey(), translation.getAsString());
@ -95,7 +97,7 @@ public class WebManager {
// Register the topics translations in the locales
if (!topicsContent.isEmpty()) {
JsonObject topics = new JsonParser().parse(topicsContent).getAsJsonObject();
topics.entrySet().forEach((entry) -> plugin.getLocalesManager().getLanguages().values().forEach((locale) -> {
topics.entrySet().forEach(entry -> plugin.getLocalesManager().getLanguages().values().forEach(locale -> {
JsonElement translation = entry.getValue().getAsJsonObject().get(locale.toLanguageTag());
if (translation != null) {
locale.set("catalog.topics." + entry.getKey(), translation.getAsString());

View File

@ -193,14 +193,14 @@ public class NewIsland {
// Get the new BlueprintBundle if it was changed
switch (reason) {
case CREATE:
name = ((IslandEvent.IslandCreateEvent) event).getBlueprintBundle().getUniqueId();
break;
case RESET:
name = ((IslandEvent.IslandResetEvent) event).getBlueprintBundle().getUniqueId();
break;
default:
break;
case CREATE:
name = ((IslandEvent.IslandCreateEvent) event).getBlueprintBundle().getUniqueId();
break;
case RESET:
name = ((IslandEvent.IslandResetEvent) event).getBlueprintBundle().getUniqueId();
break;
default:
break;
}
// Task to run after creating the island
@ -305,10 +305,11 @@ public class NewIsland {
int dist = plugin.getIWM().getIslandDistance(location.getWorld());
Set<Location> locs = new HashSet<>();
locs.add(location);
locs.add(new Location(location.getWorld(), location.getBlockX() - dist, 0, location.getBlockZ() - dist));
locs.add(new Location(location.getWorld(), location.getBlockX() - dist, 0, location.getBlockZ() + dist - 1));
locs.add(new Location(location.getWorld(), location.getBlockX() + dist - 1, 0, location.getBlockZ() - dist));
locs.add(new Location(location.getWorld(), location.getBlockX() + dist - 1, 0, location.getBlockZ() + dist - 1));
locs.add(new Location(location.getWorld(), location.getX() - dist, 0, location.getZ() - dist));
locs.add(new Location(location.getWorld(), location.getX() - dist, 0, location.getZ() + dist - 1));
locs.add(new Location(location.getWorld(), location.getX() + dist - 1, 0, location.getZ() - dist));
locs.add(new Location(location.getWorld(), location.getX() + dist - 1, 0, location.getZ() + dist - 1));
for (Location l : locs) {
if (plugin.getIslands().getIslandAt(l).isPresent() || plugin.getIslandDeletionManager().inDeletion(l)) {

View File

@ -1,9 +1,12 @@
package world.bentobox.bentobox.panels;
import java.util.List;
import org.apache.commons.lang.StringUtils;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.eclipse.jdt.annotation.NonNull;
import world.bentobox.bentobox.BentoBox;
import world.bentobox.bentobox.api.panels.PanelItem;
import world.bentobox.bentobox.api.panels.builders.PanelBuilder;
@ -11,8 +14,6 @@ import world.bentobox.bentobox.api.panels.builders.PanelItemBuilder;
import world.bentobox.bentobox.api.user.User;
import world.bentobox.bentobox.web.catalog.CatalogEntry;
import java.util.List;
/**
* @since 1.5.0
* @author Poslovitch

View File

@ -1,8 +1,11 @@
package world.bentobox.bentobox.panels;
import java.util.Locale;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.inventory.ItemStack;
import world.bentobox.bentobox.BentoBox;
import world.bentobox.bentobox.api.localization.BentoBoxLocale;
import world.bentobox.bentobox.api.localization.TextVariables;
@ -11,8 +14,6 @@ import world.bentobox.bentobox.api.panels.builders.PanelItemBuilder;
import world.bentobox.bentobox.api.user.User;
import world.bentobox.bentobox.managers.LocalesManager;
import java.util.Locale;
/**
* @author Poslovitch
*/

Some files were not shown because too many files have changed in this diff Show More