mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2024-11-22 18:55:17 +01:00
Code smell reduction
This commit is contained in:
parent
4f22df069b
commit
8eb45e817c
@ -158,7 +158,7 @@ public final class AddonDescription {
|
||||
* @return the permissions
|
||||
* @since 1.13.0
|
||||
*/
|
||||
public ConfigurationSection getPermissions() {
|
||||
public @Nullable ConfigurationSection getPermissions() {
|
||||
return permissions;
|
||||
}
|
||||
|
||||
|
@ -218,7 +218,7 @@ public abstract class CompositeCommand extends Command implements PluginIdentifi
|
||||
* subcommands until it finds the right object and then runs execute on it.
|
||||
*/
|
||||
@Override
|
||||
public boolean execute(CommandSender sender, String label, String[] args) {
|
||||
public boolean execute(@NonNull CommandSender sender, @NonNull String label, String[] args) {
|
||||
// Get the User instance for this sender
|
||||
User user = User.getInstance(sender);
|
||||
// Fire an event to see if this command should be cancelled
|
||||
@ -352,7 +352,7 @@ public abstract class CompositeCommand extends Command implements PluginIdentifi
|
||||
}
|
||||
|
||||
@Override
|
||||
public BentoBox getPlugin() {
|
||||
public @NonNull BentoBox getPlugin() {
|
||||
return plugin;
|
||||
}
|
||||
|
||||
@ -422,7 +422,7 @@ public abstract class CompositeCommand extends Command implements PluginIdentifi
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUsage() {
|
||||
public @NonNull String getUsage() {
|
||||
return "/" + usage;
|
||||
}
|
||||
|
||||
@ -521,7 +521,7 @@ public abstract class CompositeCommand extends Command implements PluginIdentifi
|
||||
* @return The instance of this {@link Command}.
|
||||
*/
|
||||
@Override
|
||||
public Command setDescription(String description) {
|
||||
public @NonNull Command setDescription(@NonNull String description) {
|
||||
super.setDescription(description);
|
||||
return this;
|
||||
}
|
||||
@ -575,7 +575,7 @@ public abstract class CompositeCommand extends Command implements PluginIdentifi
|
||||
* This creates the full linking chain of commands
|
||||
*/
|
||||
@Override
|
||||
public Command setUsage(String usage) {
|
||||
public @NonNull Command setUsage(@NonNull String usage) {
|
||||
// Go up the chain
|
||||
CompositeCommand parentCommand = getParent();
|
||||
StringBuilder u = new StringBuilder().append(getLabel()).append(" ").append(usage);
|
||||
@ -590,7 +590,7 @@ public abstract class CompositeCommand extends Command implements PluginIdentifi
|
||||
|
||||
@Override
|
||||
@NonNull
|
||||
public List<String> tabComplete(final CommandSender sender, final String alias, final String[] args) {
|
||||
public List<String> tabComplete(final @NonNull CommandSender sender, final @NonNull String alias, final String[] args) {
|
||||
List<String> options = new ArrayList<>();
|
||||
// Get command object based on args entered so far
|
||||
CompositeCommand command = getCommandFromArgs(args);
|
||||
|
@ -22,7 +22,7 @@ public class NamePrompt extends StringPrompt {
|
||||
private final String oldName;
|
||||
private final BentoBox plugin;
|
||||
|
||||
public NamePrompt(BentoBox plugin, @NonNull Island island, User user, String oldName) {
|
||||
public NamePrompt(BentoBox plugin, @NonNull Island island, @NonNull User user, String oldName) {
|
||||
this.plugin = plugin;
|
||||
this.island = island;
|
||||
this.user = user;
|
||||
@ -30,12 +30,12 @@ public class NamePrompt extends StringPrompt {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
public @NonNull String getPromptText(@NonNull ConversationContext context) {
|
||||
return user.getTranslation("commands.island.renamehome.enter-new-name");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Prompt acceptInput(ConversationContext context, String input) {
|
||||
public Prompt acceptInput(@NonNull ConversationContext context, String input) {
|
||||
if (island.renameHome(oldName, input)) {
|
||||
plugin.getIslands().save(island);
|
||||
Bukkit.getScheduler().runTask(plugin, () -> user.sendMessage("general.success"));
|
||||
|
@ -12,6 +12,7 @@ import java.util.Objects;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNull;
|
||||
import world.bentobox.bentobox.BentoBox;
|
||||
|
||||
/**
|
||||
@ -55,7 +56,7 @@ public abstract class BentoBoxEvent extends Event {
|
||||
*/
|
||||
@Override
|
||||
@Deprecated
|
||||
public HandlerList getHandlers() {
|
||||
public @NonNull HandlerList getHandlers() {
|
||||
return getHandlerList();
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
package world.bentobox.bentobox.api.events;
|
||||
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.eclipse.jdt.annotation.NonNull;
|
||||
|
||||
/**
|
||||
* Fired when plugin is ready to play and all files are loaded
|
||||
@ -12,7 +13,7 @@ public class BentoBoxReadyEvent extends BentoBoxEvent {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
public @NonNull HandlerList getHandlers() {
|
||||
return getHandlerList();
|
||||
}
|
||||
|
||||
|
@ -3,6 +3,7 @@ package world.bentobox.bentobox.api.events;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.eclipse.jdt.annotation.NonNull;
|
||||
|
||||
/**
|
||||
* Fired when a message is going to an offline player
|
||||
@ -16,7 +17,7 @@ public class OfflineMessageEvent extends BentoBoxEvent {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
public @NonNull HandlerList getHandlers() {
|
||||
return getHandlerList();
|
||||
}
|
||||
|
||||
|
@ -4,6 +4,7 @@ import java.util.Map;
|
||||
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNull;
|
||||
import world.bentobox.bentobox.api.addons.Addon;
|
||||
|
||||
/**
|
||||
@ -16,7 +17,7 @@ public class AddonDisableEvent extends AddonBaseEvent {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
public @NonNull HandlerList getHandlers() {
|
||||
return getHandlerList();
|
||||
}
|
||||
|
||||
|
@ -4,6 +4,7 @@ import java.util.Map;
|
||||
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNull;
|
||||
import world.bentobox.bentobox.api.addons.Addon;
|
||||
|
||||
/**
|
||||
@ -16,7 +17,7 @@ public class AddonEnableEvent extends AddonBaseEvent {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
public @NonNull HandlerList getHandlers() {
|
||||
return getHandlerList();
|
||||
}
|
||||
|
||||
|
@ -4,6 +4,7 @@ import java.util.Map;
|
||||
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNull;
|
||||
import world.bentobox.bentobox.api.addons.Addon;
|
||||
|
||||
/**
|
||||
@ -16,7 +17,7 @@ public class AddonGeneralEvent extends AddonBaseEvent {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
public @NonNull HandlerList getHandlers() {
|
||||
return getHandlerList();
|
||||
}
|
||||
|
||||
|
@ -4,6 +4,7 @@ import java.util.Map;
|
||||
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNull;
|
||||
import world.bentobox.bentobox.api.addons.Addon;
|
||||
|
||||
/**
|
||||
@ -16,7 +17,7 @@ public class AddonLoadEvent extends AddonBaseEvent {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
public @NonNull HandlerList getHandlers() {
|
||||
return getHandlerList();
|
||||
}
|
||||
|
||||
|
@ -6,6 +6,7 @@ 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;
|
||||
|
||||
/**
|
||||
@ -24,7 +25,7 @@ public class CommandEvent extends BentoBoxEvent implements Cancellable {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
public @NonNull HandlerList getHandlers() {
|
||||
return getHandlerList();
|
||||
}
|
||||
|
||||
|
@ -4,6 +4,7 @@ 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;
|
||||
|
||||
@ -18,7 +19,7 @@ public class FlagProtectionChangeEvent extends FlagChangeEvent {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
public @NonNull HandlerList getHandlers() {
|
||||
return getHandlerList();
|
||||
}
|
||||
|
||||
|
@ -4,6 +4,7 @@ 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;
|
||||
|
||||
@ -18,7 +19,7 @@ public class FlagSettingChangeEvent extends FlagChangeEvent {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
public @NonNull HandlerList getHandlers() {
|
||||
return getHandlerList();
|
||||
}
|
||||
|
||||
|
@ -5,6 +5,7 @@ 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;
|
||||
|
||||
/**
|
||||
@ -18,7 +19,7 @@ public class FlagWorldSettingChangeEvent extends FlagChangeEvent {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
public @NonNull HandlerList getHandlers() {
|
||||
return getHandlerList();
|
||||
}
|
||||
|
||||
|
@ -5,6 +5,7 @@ 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;
|
||||
|
||||
@ -19,7 +20,7 @@ public class IslandBanEvent extends IslandBaseEvent {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
public @NonNull HandlerList getHandlers() {
|
||||
return getHandlerList();
|
||||
}
|
||||
|
||||
|
@ -20,7 +20,7 @@ public class IslandCreateEvent extends IslandBaseEvent {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
public @NonNull HandlerList getHandlers() {
|
||||
return getHandlerList();
|
||||
}
|
||||
|
||||
|
@ -5,6 +5,7 @@ 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;
|
||||
|
||||
@ -16,7 +17,7 @@ public class IslandCreatedEvent extends IslandBaseEvent {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
public @NonNull HandlerList getHandlers() {
|
||||
return getHandlerList();
|
||||
}
|
||||
|
||||
|
@ -5,6 +5,7 @@ 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;
|
||||
@ -19,7 +20,7 @@ public class IslandDeleteChunksEvent extends IslandBaseEvent {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
public @NonNull HandlerList getHandlers() {
|
||||
return getHandlerList();
|
||||
}
|
||||
|
||||
|
@ -5,6 +5,7 @@ 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;
|
||||
|
||||
@ -17,7 +18,7 @@ public class IslandDeleteEvent extends IslandBaseEvent {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
public @NonNull HandlerList getHandlers() {
|
||||
return getHandlerList();
|
||||
}
|
||||
|
||||
|
@ -5,6 +5,7 @@ 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;
|
||||
@ -21,7 +22,7 @@ public class IslandDeletedEvent extends IslandBaseEvent {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
public @NonNull HandlerList getHandlers() {
|
||||
return getHandlerList();
|
||||
}
|
||||
|
||||
|
@ -5,6 +5,7 @@ import java.util.UUID;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.eclipse.jdt.annotation.NonNull;
|
||||
import org.eclipse.jdt.annotation.Nullable;
|
||||
|
||||
import world.bentobox.bentobox.api.events.IslandBaseEvent;
|
||||
@ -20,7 +21,7 @@ public class IslandEnterEvent extends IslandBaseEvent {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
public @NonNull HandlerList getHandlers() {
|
||||
return getHandlerList();
|
||||
}
|
||||
|
||||
@ -28,7 +29,7 @@ public class IslandEnterEvent extends IslandBaseEvent {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
IslandEnterEvent(Island island, UUID player, boolean admin, Location location, Island fromIsland, Event rawEvent) {
|
||||
IslandEnterEvent(Island island, UUID player, boolean admin, Location location, @Nullable Island fromIsland, Event rawEvent) {
|
||||
// Final variables have to be declared in the constructor
|
||||
super(island, player, admin, location, rawEvent);
|
||||
this.fromIsland = fromIsland;
|
||||
|
@ -26,7 +26,7 @@ public class IslandEvent extends IslandBaseEvent {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
public @NonNull HandlerList getHandlers() {
|
||||
return getHandlerList();
|
||||
}
|
||||
|
||||
@ -425,7 +425,7 @@ public class IslandEvent extends IslandBaseEvent {
|
||||
|
||||
private final @Nullable Island fromIsland;
|
||||
|
||||
private IslandEnterEvent(Island island, UUID player, boolean admin, Location location, Island fromIsland, Event rawEvent) {
|
||||
private IslandEnterEvent(Island island, UUID player, boolean admin, Location location, @Nullable Island fromIsland, Event rawEvent) {
|
||||
// Final variables have to be declared in the constructor
|
||||
super(island, player, admin, location, rawEvent);
|
||||
this.fromIsland = fromIsland;
|
||||
@ -448,7 +448,7 @@ public class IslandEvent extends IslandBaseEvent {
|
||||
private final @Nullable Island toIsland;
|
||||
|
||||
|
||||
private IslandExitEvent(Island island, UUID player, boolean admin, Location location, Island toIsland, Event rawEvent) {
|
||||
private IslandExitEvent(Island island, UUID player, boolean admin, Location location, @Nullable Island toIsland, Event rawEvent) {
|
||||
// Final variables have to be declared in the constructor
|
||||
super(island, player, admin, location, rawEvent);
|
||||
this.toIsland = toIsland;
|
||||
|
@ -5,6 +5,7 @@ import java.util.UUID;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.eclipse.jdt.annotation.NonNull;
|
||||
import org.eclipse.jdt.annotation.Nullable;
|
||||
|
||||
import world.bentobox.bentobox.api.events.IslandBaseEvent;
|
||||
@ -20,7 +21,7 @@ public class IslandExitEvent extends IslandBaseEvent {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
public @NonNull HandlerList getHandlers() {
|
||||
return getHandlerList();
|
||||
}
|
||||
|
||||
@ -28,7 +29,7 @@ public class IslandExitEvent extends IslandBaseEvent {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
IslandExitEvent(Island island, UUID player, boolean admin, Location location, Island toIsland, Event rawEvent) {
|
||||
IslandExitEvent(Island island, UUID player, boolean admin, Location location, @Nullable Island toIsland, Event rawEvent) {
|
||||
// Final variables have to be declared in the constructor
|
||||
super(island, player, admin, location, rawEvent);
|
||||
this.toIsland = toIsland;
|
||||
|
@ -5,6 +5,7 @@ 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;
|
||||
|
||||
@ -20,7 +21,7 @@ public class IslandExpelEvent extends IslandBaseEvent {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
public @NonNull HandlerList getHandlers() {
|
||||
return getHandlerList();
|
||||
}
|
||||
|
||||
|
@ -5,6 +5,7 @@ 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;
|
||||
|
||||
@ -17,7 +18,7 @@ public class IslandGeneralEvent extends IslandBaseEvent {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
public @NonNull HandlerList getHandlers() {
|
||||
return getHandlerList();
|
||||
}
|
||||
|
||||
|
@ -5,6 +5,7 @@ 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;
|
||||
|
||||
@ -17,7 +18,7 @@ public class IslandLockEvent extends IslandBaseEvent {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
public @NonNull HandlerList getHandlers() {
|
||||
return getHandlerList();
|
||||
}
|
||||
|
||||
|
@ -5,6 +5,7 @@ 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;
|
||||
|
||||
@ -17,7 +18,7 @@ public class IslandNewIslandEvent extends IslandBaseEvent {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
public @NonNull HandlerList getHandlers() {
|
||||
return getHandlerList();
|
||||
}
|
||||
|
||||
|
@ -4,6 +4,7 @@ import java.util.UUID;
|
||||
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNull;
|
||||
import world.bentobox.bentobox.api.events.IslandBaseEvent;
|
||||
|
||||
/**
|
||||
@ -16,7 +17,7 @@ public class IslandPreCreateEvent extends IslandBaseEvent {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
public @NonNull HandlerList getHandlers() {
|
||||
return getHandlerList();
|
||||
}
|
||||
|
||||
|
@ -19,7 +19,7 @@ public class IslandPreclearEvent extends IslandBaseEvent {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
public @NonNull HandlerList getHandlers() {
|
||||
return getHandlerList();
|
||||
}
|
||||
|
||||
|
@ -5,6 +5,7 @@ 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;
|
||||
|
||||
@ -17,7 +18,7 @@ public class IslandProtectionRangeChangeEvent extends IslandBaseEvent {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
public @NonNull HandlerList getHandlers() {
|
||||
return getHandlerList();
|
||||
}
|
||||
|
||||
|
@ -5,6 +5,7 @@ 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;
|
||||
|
||||
@ -20,7 +21,7 @@ public class IslandRankChangeEvent extends IslandBaseEvent {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
public @NonNull HandlerList getHandlers() {
|
||||
return getHandlerList();
|
||||
}
|
||||
|
||||
|
@ -5,6 +5,7 @@ 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;
|
||||
|
||||
@ -17,7 +18,7 @@ public class IslandRegisteredEvent extends IslandBaseEvent {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
public @NonNull HandlerList getHandlers() {
|
||||
return getHandlerList();
|
||||
}
|
||||
|
||||
|
@ -5,6 +5,7 @@ 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;
|
||||
|
||||
@ -17,7 +18,7 @@ public class IslandReservedEvent extends IslandBaseEvent {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
public @NonNull HandlerList getHandlers() {
|
||||
return getHandlerList();
|
||||
}
|
||||
|
||||
|
@ -21,7 +21,7 @@ public class IslandResetEvent extends IslandBaseEvent {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
public @NonNull HandlerList getHandlers() {
|
||||
return getHandlerList();
|
||||
}
|
||||
|
||||
|
@ -19,7 +19,7 @@ public class IslandResettedEvent extends IslandBaseEvent {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
public @NonNull HandlerList getHandlers() {
|
||||
return getHandlerList();
|
||||
}
|
||||
|
||||
|
@ -5,6 +5,7 @@ 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;
|
||||
|
||||
@ -20,7 +21,7 @@ public class IslandUnbanEvent extends IslandBaseEvent {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
public @NonNull HandlerList getHandlers() {
|
||||
return getHandlerList();
|
||||
}
|
||||
|
||||
|
@ -5,6 +5,7 @@ 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;
|
||||
|
||||
@ -17,7 +18,7 @@ public class IslandUnlockEvent extends IslandBaseEvent {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
public @NonNull HandlerList getHandlers() {
|
||||
return getHandlerList();
|
||||
}
|
||||
|
||||
|
@ -5,6 +5,7 @@ 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;
|
||||
|
||||
@ -17,7 +18,7 @@ public class IslandUnregisteredEvent extends IslandBaseEvent {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
public @NonNull HandlerList getHandlers() {
|
||||
return getHandlerList();
|
||||
}
|
||||
|
||||
|
@ -5,6 +5,7 @@ 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;
|
||||
|
||||
@ -13,7 +14,7 @@ public class TeamDeleteEvent extends IslandBaseEvent {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
public @NonNull HandlerList getHandlers() {
|
||||
return getHandlerList();
|
||||
}
|
||||
|
||||
|
@ -5,6 +5,7 @@ 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;
|
||||
|
||||
@ -13,7 +14,7 @@ public class TeamGeneralEvent extends IslandBaseEvent {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
public @NonNull HandlerList getHandlers() {
|
||||
return getHandlerList();
|
||||
}
|
||||
|
||||
|
@ -5,6 +5,7 @@ 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;
|
||||
|
||||
@ -13,7 +14,7 @@ public class TeamInfoEvent extends IslandBaseEvent {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
public @NonNull HandlerList getHandlers() {
|
||||
return getHandlerList();
|
||||
}
|
||||
|
||||
|
@ -5,6 +5,7 @@ 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;
|
||||
|
||||
@ -13,7 +14,7 @@ public class TeamInviteEvent extends IslandBaseEvent {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
public @NonNull HandlerList getHandlers() {
|
||||
return getHandlerList();
|
||||
}
|
||||
|
||||
|
@ -5,6 +5,7 @@ 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;
|
||||
|
||||
@ -13,7 +14,7 @@ public class TeamJoinEvent extends IslandBaseEvent {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
public @NonNull HandlerList getHandlers() {
|
||||
return getHandlerList();
|
||||
}
|
||||
|
||||
|
@ -5,6 +5,7 @@ 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;
|
||||
|
||||
@ -17,7 +18,7 @@ public class TeamJoinedEvent extends IslandBaseEvent {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
public @NonNull HandlerList getHandlers() {
|
||||
return getHandlerList();
|
||||
}
|
||||
|
||||
|
@ -5,6 +5,7 @@ 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;
|
||||
|
||||
@ -13,7 +14,7 @@ public class TeamKickEvent extends IslandBaseEvent {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
public @NonNull HandlerList getHandlers() {
|
||||
return getHandlerList();
|
||||
}
|
||||
|
||||
|
@ -5,6 +5,7 @@ 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;
|
||||
|
||||
@ -18,7 +19,7 @@ public class TeamLeaveEvent extends IslandBaseEvent {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
public @NonNull HandlerList getHandlers() {
|
||||
return getHandlerList();
|
||||
}
|
||||
|
||||
|
@ -5,6 +5,7 @@ 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;
|
||||
|
||||
@ -13,7 +14,7 @@ public class TeamRejectEvent extends IslandBaseEvent {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
public @NonNull HandlerList getHandlers() {
|
||||
return getHandlerList();
|
||||
}
|
||||
|
||||
|
@ -5,6 +5,7 @@ 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;
|
||||
|
||||
@ -19,7 +20,7 @@ public class TeamSetownerEvent extends IslandBaseEvent {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
public @NonNull HandlerList getHandlers() {
|
||||
return getHandlerList();
|
||||
}
|
||||
|
||||
|
@ -5,6 +5,7 @@ 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;
|
||||
|
||||
@ -13,7 +14,7 @@ public class TeamUninviteEvent extends IslandBaseEvent {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
public @NonNull HandlerList getHandlers() {
|
||||
return getHandlerList();
|
||||
}
|
||||
|
||||
|
@ -24,7 +24,7 @@ import world.bentobox.bentobox.util.Util;
|
||||
*/
|
||||
public class CycleClick implements PanelItem.ClickHandler {
|
||||
|
||||
protected BentoBox plugin = BentoBox.getInstance();
|
||||
protected final BentoBox plugin = BentoBox.getInstance();
|
||||
protected Island island;
|
||||
protected User user;
|
||||
protected boolean changeOccurred;
|
||||
|
@ -137,7 +137,7 @@ public class PanelItemBuilder {
|
||||
/**
|
||||
* @return the name
|
||||
*/
|
||||
public String getName() {
|
||||
public @Nullable String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
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 {
|
||||
@ -10,17 +11,17 @@ public class AddonPlaceholderExpansion extends BasicPlaceholderExpansion {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
public @NonNull String getName() {
|
||||
return addon.getDescription().getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAuthor() {
|
||||
public @NonNull String getAuthor() {
|
||||
return addon.getDescription().getAuthors().get(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getVersion() {
|
||||
public @NonNull String getVersion() {
|
||||
return addon.getDescription().getVersion();
|
||||
}
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ abstract class BasicPlaceholderExpansion extends PlaceholderExpansion {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getIdentifier() {
|
||||
public @NonNull String getIdentifier() {
|
||||
return getName().toLowerCase(Locale.ENGLISH);
|
||||
}
|
||||
|
||||
@ -42,7 +42,7 @@ abstract class BasicPlaceholderExpansion extends PlaceholderExpansion {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onPlaceholderRequest(Player p, String placeholder) {
|
||||
public String onPlaceholderRequest(Player p, @NonNull String placeholder) {
|
||||
if (placeholders.containsKey(placeholder)) {
|
||||
return placeholders.get(placeholder).onReplace(User.getInstance(p));
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package world.bentobox.bentobox.api.placeholders.placeholderapi;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNull;
|
||||
import world.bentobox.bentobox.BentoBox;
|
||||
|
||||
public class BentoBoxPlaceholderExpansion extends BasicPlaceholderExpansion {
|
||||
@ -11,17 +12,17 @@ public class BentoBoxPlaceholderExpansion extends BasicPlaceholderExpansion {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
public @NonNull String getName() {
|
||||
return plugin.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAuthor() {
|
||||
public @NonNull String getAuthor() {
|
||||
return "Tastybento and Poslovitch";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getVersion() {
|
||||
public @NonNull String getVersion() {
|
||||
return plugin.getDescription().getVersion();
|
||||
}
|
||||
}
|
@ -6,6 +6,7 @@ import java.util.concurrent.TimeUnit;
|
||||
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
|
||||
@ -26,7 +27,7 @@ public class Notifier {
|
||||
.build(
|
||||
new CacheLoader<>() {
|
||||
@Override
|
||||
public Notification load(User user) {
|
||||
public Notification load(@NonNull User user) {
|
||||
return new Notification(null, 0);
|
||||
}
|
||||
}
|
||||
|
@ -135,7 +135,7 @@ public class User implements MetaDataAble {
|
||||
|
||||
private Addon addon;
|
||||
|
||||
private User(CommandSender sender) {
|
||||
private User(@Nullable CommandSender sender) {
|
||||
player = null;
|
||||
playerUUID = null;
|
||||
this.sender = sender;
|
||||
|
@ -79,7 +79,7 @@ public class Blueprint {
|
||||
/**
|
||||
* @return the icon
|
||||
*/
|
||||
public Material getIcon() {
|
||||
public @NonNull Material getIcon() {
|
||||
return icon;
|
||||
}
|
||||
/**
|
||||
|
@ -398,7 +398,7 @@ public class BlueprintClipboard {
|
||||
/**
|
||||
* @return the blueprint
|
||||
*/
|
||||
public Blueprint getBlueprint() {
|
||||
public @Nullable Blueprint getBlueprint() {
|
||||
return blueprint;
|
||||
}
|
||||
|
||||
|
@ -8,6 +8,7 @@ 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;
|
||||
@ -33,7 +34,7 @@ public class DescriptionPrompt extends StringPrompt {
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
public @NonNull String getPromptText(ConversationContext context) {
|
||||
User user = User.getInstance((Player)context.getForWhom());
|
||||
if (context.getSessionData(DESCRIPTION) != null) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
@ -7,6 +7,7 @@ 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;
|
||||
@ -28,7 +29,7 @@ public class DescriptionSuccessPrompt extends MessagePrompt {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
public @NonNull String getPromptText(ConversationContext context) {
|
||||
User user = User.getInstance((Player)context.getForWhom());
|
||||
@SuppressWarnings("unchecked")
|
||||
List<String> description = (List<String>)context.getSessionData("description");
|
||||
@ -46,7 +47,7 @@ public class DescriptionSuccessPrompt extends MessagePrompt {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Prompt getNextPrompt(ConversationContext context) {
|
||||
protected Prompt getNextPrompt(@NonNull ConversationContext context) {
|
||||
return Prompt.END_OF_CONVERSATION;
|
||||
}
|
||||
|
||||
|
@ -4,12 +4,13 @@ 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 {
|
||||
|
||||
@Override
|
||||
public String getPrefix(ConversationContext context) {
|
||||
public @NonNull String getPrefix(ConversationContext context) {
|
||||
User user = User.getInstance((Player)context.getForWhom());
|
||||
return user.getTranslation("commands.admin.blueprint.management.name.conversation-prefix");
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ public class NamePrompt extends StringPrompt {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
public @NonNull String getPromptText(ConversationContext context) {
|
||||
User user = User.getInstance((Player)context.getForWhom());
|
||||
return user.getTranslation("commands.admin.blueprint.management.name.prompt");
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ public class NameSuccessPrompt extends MessagePrompt {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
public @NonNull String getPromptText(ConversationContext context) {
|
||||
String name = (String) context.getSessionData("name");
|
||||
String uniqueId = (String) context.getSessionData("uniqueId");
|
||||
User user = User.getInstance((Player)context.getForWhom());
|
||||
@ -65,7 +65,7 @@ public class NameSuccessPrompt extends MessagePrompt {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Prompt getNextPrompt(ConversationContext context) {
|
||||
protected Prompt getNextPrompt(@NonNull ConversationContext context) {
|
||||
return Prompt.END_OF_CONVERSATION;
|
||||
}
|
||||
|
||||
|
@ -33,7 +33,7 @@ import world.bentobox.bentobox.database.json.adapters.WorldTypeAdapter;
|
||||
*/
|
||||
public class BentoboxTypeAdapterFactory implements TypeAdapterFactory {
|
||||
|
||||
BentoBox plugin;
|
||||
final BentoBox plugin;
|
||||
|
||||
/**
|
||||
* @param plugin plugin
|
||||
|
@ -19,6 +19,7 @@ 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;
|
||||
@ -125,7 +126,7 @@ public class MongoDBDatabaseHandler<T> extends AbstractJSONDatabaseHandler<T> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public T loadObject(String uniqueId) {
|
||||
public T loadObject(@NonNull String uniqueId) {
|
||||
Document doc = collection.find(new Document(MONGO_ID, uniqueId)).limit(1).first();
|
||||
Gson gson = getGson();
|
||||
String json = JSON.serialize(doc).replaceFirst(MONGO_ID, UNIQUEID);
|
||||
|
@ -5,6 +5,7 @@ import java.lang.reflect.InvocationTargetException;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNull;
|
||||
import org.eclipse.jdt.annotation.Nullable;
|
||||
|
||||
import world.bentobox.bentobox.database.AbstractDatabaseHandler;
|
||||
@ -55,7 +56,7 @@ public class TransitionDatabaseHandler<T> extends AbstractDatabaseHandler<T> {
|
||||
* @see world.bentobox.bentobox.database.AbstractDatabaseHandler#loadObject(java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public T loadObject(String uniqueId) throws InstantiationException, IllegalAccessException, InvocationTargetException, ClassNotFoundException, IntrospectionException, NoSuchMethodException {
|
||||
public T loadObject(@NonNull String uniqueId) throws InstantiationException, IllegalAccessException, InvocationTargetException, ClassNotFoundException, IntrospectionException, NoSuchMethodException {
|
||||
// Try destination database
|
||||
@Nullable
|
||||
T object = toHandler.loadObject(uniqueId);
|
||||
|
@ -144,7 +144,7 @@ public class YamlDatabaseConnector implements DatabaseConnector {
|
||||
// Run through the file and add in the comments
|
||||
File commentedFile = new File(file.getPath() + ".tmp");
|
||||
List<String> newFile = new ArrayList<>();
|
||||
try (Scanner scanner = new Scanner(file, "UTF-8")) {
|
||||
try (Scanner scanner = new Scanner(file, StandardCharsets.UTF_8)) {
|
||||
while (scanner.hasNextLine()) {
|
||||
String nextLine = scanner.nextLine();
|
||||
// See if there are any comments in this line
|
||||
|
@ -80,7 +80,7 @@ public class YamlDatabaseHandler<T> extends AbstractDatabaseHandler<T> {
|
||||
* @see world.bentobox.bentobox.database.AbstractDatabaseHandler#loadObject(java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public T loadObject(String key) throws InstantiationException, IllegalAccessException, InvocationTargetException, ClassNotFoundException, IntrospectionException, NoSuchMethodException {
|
||||
public T loadObject(@NonNull String key) throws InstantiationException, IllegalAccessException, InvocationTargetException, ClassNotFoundException, IntrospectionException, NoSuchMethodException {
|
||||
// Objects are loaded from a folder named after the simple name of the class being stored
|
||||
String path = DATABASE_FOLDER_NAME + File.separator + dataObject.getSimpleName();
|
||||
// This path and key can be overridden by the StoreAt annotation in the code
|
||||
|
@ -32,7 +32,7 @@ public class PlaceholderAPIHook extends PlaceholderHook {
|
||||
|
||||
|
||||
public PlaceholderAPIHook() {
|
||||
super("PlaceholderAPI");
|
||||
super();
|
||||
this.addonsExpansions = new HashMap<>();
|
||||
this.bentoBoxPlaceholders = new HashSet<>();
|
||||
this.addonPlaceholders = new HashMap<>();
|
||||
|
@ -14,8 +14,8 @@ import world.bentobox.bentobox.api.placeholders.PlaceholderReplacer;
|
||||
*/
|
||||
public abstract class PlaceholderHook extends Hook {
|
||||
|
||||
protected PlaceholderHook(@NonNull String pluginName) {
|
||||
super(pluginName, Material.NAME_TAG);
|
||||
protected PlaceholderHook() {
|
||||
super("PlaceholderAPI", Material.NAME_TAG);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -40,15 +40,9 @@ public class BucketListener extends FlagListener {
|
||||
public void onBucketFill(final PlayerBucketFillEvent e) {
|
||||
// Check filling of various liquids
|
||||
switch (e.getItemStack().getType()) {
|
||||
case LAVA_BUCKET -> {
|
||||
checkIsland(e, e.getPlayer(), e.getBlockClicked().getLocation(), Flags.COLLECT_LAVA);
|
||||
}
|
||||
case WATER_BUCKET -> {
|
||||
checkIsland(e, e.getPlayer(), e.getBlockClicked().getLocation(), Flags.COLLECT_WATER);
|
||||
}
|
||||
case MILK_BUCKET -> {
|
||||
checkIsland(e, e.getPlayer(), e.getBlockClicked().getLocation(), Flags.MILKING);
|
||||
}
|
||||
case LAVA_BUCKET -> checkIsland(e, e.getPlayer(), e.getBlockClicked().getLocation(), Flags.COLLECT_LAVA);
|
||||
case WATER_BUCKET -> checkIsland(e, e.getPlayer(), e.getBlockClicked().getLocation(), Flags.COLLECT_WATER);
|
||||
case MILK_BUCKET -> checkIsland(e, e.getPlayer(), e.getBlockClicked().getLocation(), Flags.MILKING);
|
||||
default ->
|
||||
// Check general bucket use
|
||||
checkIsland(e, e.getPlayer(), e.getBlockClicked().getLocation(), Flags.BUCKET);
|
||||
|
@ -678,7 +678,7 @@ public class IslandWorldManager {
|
||||
* @return data folder file object or the plugin's data folder if none found
|
||||
*/
|
||||
public File getDataFolder(@NonNull World world) {
|
||||
return getAddon(world).map(GameModeAddon::getDataFolder).orElseGet(() -> plugin.getDataFolder());
|
||||
return getAddon(world).map(GameModeAddon::getDataFolder).orElseGet(plugin::getDataFolder);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -129,7 +129,7 @@ public class IslandsManager {
|
||||
* Used only for testing. Sets the database to a mock database.
|
||||
* @param handler - handler
|
||||
*/
|
||||
public void setHandler(Database<Island> handler) {
|
||||
public void setHandler(@NonNull Database<Island> handler) {
|
||||
this.handler = handler;
|
||||
}
|
||||
|
||||
|
@ -32,7 +32,7 @@ public class DefaultNewIslandLocationStrategy implements NewIslandLocationStrate
|
||||
ISLAND_FOUND, BLOCKS_IN_AREA, FREE
|
||||
}
|
||||
|
||||
protected BentoBox plugin = BentoBox.getInstance();
|
||||
protected final BentoBox plugin = BentoBox.getInstance();
|
||||
|
||||
@Override
|
||||
public Location getNextLocation(World world) {
|
||||
|
@ -7,6 +7,7 @@ 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;
|
||||
@ -68,7 +69,7 @@ public class WorldDefaultSettingsTab extends SettingsTab implements Tab {
|
||||
* @return list of all the panel items for this flag type
|
||||
*/
|
||||
@Override
|
||||
public List<PanelItem> getPanelItems() {
|
||||
public @NonNull List<PanelItem> getPanelItems() {
|
||||
// Different description and click handlers
|
||||
return getFlags().stream().map(f -> {
|
||||
PanelItem i = f.toPanelItem(plugin, user, null, false);
|
||||
|
@ -28,7 +28,7 @@ public class IslandInfo {
|
||||
|
||||
|
||||
/**
|
||||
* @param plugin
|
||||
* Get island Info
|
||||
* @param island Island to show info
|
||||
*/
|
||||
public IslandInfo(Island island) {
|
||||
|
@ -7,6 +7,7 @@ import org.bukkit.World.Environment;
|
||||
import org.bukkit.block.Biome;
|
||||
import org.bukkit.generator.ChunkGenerator.BiomeGrid;
|
||||
import org.bukkit.util.Vector;
|
||||
import org.eclipse.jdt.annotation.NonNull;
|
||||
|
||||
/**
|
||||
* A biome grid for generators
|
||||
@ -37,19 +38,19 @@ public class MyBiomeGrid implements BiomeGrid {
|
||||
|
||||
}
|
||||
@Override
|
||||
public Biome getBiome(int x, int z) {
|
||||
public @NonNull Biome getBiome(int x, int z) {
|
||||
return map.getOrDefault(new Vector(x,0,z), defaultBiome);
|
||||
}
|
||||
@Override
|
||||
public void setBiome(int x, int z, Biome bio) {
|
||||
public void setBiome(int x, int z, @NonNull Biome bio) {
|
||||
map.put(new Vector(x,0,z), bio);
|
||||
}
|
||||
@Override
|
||||
public Biome getBiome(int x, int y, int z) {
|
||||
public @NonNull Biome getBiome(int x, int y, int z) {
|
||||
return map.getOrDefault(new Vector(x,y,z), defaultBiome);
|
||||
}
|
||||
@Override
|
||||
public void setBiome(int x, int y, int z, Biome bio) {
|
||||
public void setBiome(int x, int y, int z, @NonNull Biome bio) {
|
||||
map.put(new Vector(x, y, z), bio);
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user