Skip to content

Commit

Permalink
Bump version to 1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
spnda committed Nov 30, 2021
1 parent 9ae3bbf commit e04811f
Show file tree
Hide file tree
Showing 30 changed files with 107 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@

import org.jetbrains.annotations.NotNull;

/**
* @since 1.0.0
*/
public abstract class ListStatisticItem<T, R> {
protected final @NotNull T value;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@

package de.sean.blockprot.nbt.stats;

/**
* @since 1.0.0
*/
public enum StatisticOnClickAction {
NONE,
/** A statistic that should be displayed through a separate list inventory. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@

package de.sean.blockprot.nbt.stats;

/**
* @since 1.0.0
*/
public enum StatisticType {
PLAYER, GLOBAL, ALL
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ public class SemanticVersion implements Comparable<SemanticVersion> {

/**
* The extension describing any pre-release or build metadata.
*
* @since 1.0.0
*/
private final String extension;

Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# --add-exports jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED \
# --add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED

blockProtVersion=1.0.0-beta.3
blockProtVersion=1.0.0
townyVersion=0.97.0.0
papiVersion=2.10.10
worldGuardVersion=7.0.5
2 changes: 1 addition & 1 deletion spigot/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ dependencies {
implementation(project(":common"))

// Spigot
compileOnly("org.spigotmc:spigot-api:1.17.1-R0.1-SNAPSHOT")
compileOnly("org.spigotmc:spigot-api:1.18-R0.1-SNAPSHOT")
compileOnly("org.apache.commons:commons-lang3:3.12.0")

// bStats
Expand Down
2 changes: 2 additions & 0 deletions spigot/src/main/java/de/sean/blockprot/bukkit/BlockProt.java
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,8 @@ public void onDisable() {

/**
* Reloads the config and the translation files (possibly changed through config).
*
* @since 1.0.0
*/
public void reloadConfigAndTranslations() {
this.reloadConfig();
Expand Down
2 changes: 2 additions & 0 deletions spigot/src/main/java/de/sean/blockprot/bukkit/Translator.java
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,8 @@ public static Locale getLocale() {

/**
* Clears all translations.
*
* @since 1.0.0
*/
public static void resetTranslations() {
values.clear();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,10 @@ public boolean lockOnPlaceByDefault() {
return this.config.getBoolean("lock_on_place_by_default");
}

/**
*
* @since 1.0.0
*/
@Nullable
public String getTranslationFallbackString() {
if (!this.config.contains("fallback_string")) return "";
Expand All @@ -224,6 +228,8 @@ public String getTranslationFallbackString() {
* JavaPlugin#reloadConfig sets the default values to the config inside
* the JAR, which are never edited by the player. We don't want this
* for the lists.
*
* @since 1.0.0
*/
public void removeBlockDefaults() {
Configuration defaults = this.config.getDefaults();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ public void setCancelled(final boolean cancel) {
* Whether the plugin should still check if the requesting player
* actually owns this block, or that the player has some privileges
* to be able to ignore any protections.
*
* @since 1.0.0
*/
public boolean shouldBypassProtections() {
return this.bypassProtections;
Expand All @@ -101,7 +103,9 @@ public boolean shouldBypassProtections() {
/**
* Set whether the player can bypass protections. Use this with caution,
* as some shady plugin might allow specific players to bypass any protections.
*
* @see #shouldBypassProtections()
* @since 1.0.0
*/
public void setBypassProtections(final boolean bypass) {
this.bypassProtections = bypass;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
/**
* Called when a player is trying to access a blocks lock menu.
* Can be cancelled to prevent the inventory from opening up.
*
* @since 1.0.0
*/
public final class BlockAccessMenuEvent extends BlockEvent implements Cancellable {
private static final HandlerList HANDLERS = new HandlerList();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@
import java.util.List;
import java.util.stream.Collectors;

/**
* BlockProt integration with PlaceholderAPI.
*
* @since 1.0.0
*/
public final class PlaceholderAPIIntegration extends PluginIntegration {
private BlockProtExpansion expansion;
private boolean enabled = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ public static ArrayList<OfflinePlayer> filterFriends(@NotNull final ArrayList<Of
/**
* Load and setup basic values for this plugin integration. No other
* plugins (including BlockProt) are enabled at this point.
*
* @since 1.0.0
*/
public void load() {

Expand All @@ -115,6 +117,8 @@ public void load() {
/**
* Load and setup this plugin integration. Should only be called
* once.
*
* @since 1.0.0
*/
public abstract void enable();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

/**
* BlockProt integration with WorldGuard to provide flags to enable/disable
* functionality.
*
* @since 1.0.0
*/
public final class WorldGuardIntegration extends PluginIntegration implements Listener {
private static final String FLAG_NAME = "allow-blockprot";
private static final String CONFIG_ENABLE_FLAG_FUNCTIONALITY = "enable_flag_functionality";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,11 @@ protected BlockNBTHandler getNbtHandlerOrNull(Block block) {
}
}

/**
* Get's the handler for the block opened/edited by the player.
*
* @since 1.0.0
*/
protected @Nullable FriendSupportingHandler<NBTCompound> getFriendSupportingHandler(@NotNull InventoryState.FriendSearchState state,
@Nullable Player player,
@Nullable Block block) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,11 @@ public final class InventoryConstants {
*/
public static final int tripleLine = 9 * 3;

/**
* The length of a six line inventory, similar
* to a double chest.
*
* @since 1.0.0
*/
public static final int sextupletLine = 9 * 6;
}
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ public final class InventoryState {
/**
* The current index of the page, if the inventory
* has any multi-page capabilities.
*
* @since 1.0.0
*/
public int currentPageIndex = 0;

Expand All @@ -80,6 +82,8 @@ public final class InventoryState {

/**
* The current cached menu permissions for this player.
*
* @since 1.0.0
*/
@NotNull
public Set<BlockAccessMenuEvent.MenuPermission> menuPermissions = new HashSet<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ public enum BlockAccessFlag {

/**
* The user is allowed to manage redstone settings and manage friends.
*
* @since 1.0.0
*/
MANAGER(TranslationKey.INVENTORIES__FRIENDS__PERMISSION__MANAGER);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ public boolean canWrite() {
* and edit friends of a block they have this permission on.
*
* @return True, if the player is such a manager.
* @since 1.0.0
*/
public boolean isManager() {
return getAccessFlags().contains(BlockAccessFlag.MANAGER);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@
import java.util.stream.Collectors;
import java.util.stream.Stream;

/**
* The backbone of any handler that supports adding a list of friends/players.
*
* @since 1.0.0
*/
public abstract class FriendSupportingHandler<T extends NBTCompound> extends NBTHandler<T> {
private final @NotNull String friendNbtKey;

Expand Down
11 changes: 11 additions & 0 deletions spigot/src/main/java/de/sean/blockprot/bukkit/nbt/NBTHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,24 @@ public String getName() {
*/
public void mergeHandler(@NotNull final NBTHandler<?> handler) {}

/**
* Get's a copy of this NBT inside of a {@link NBTContainer}.
* @since 1.0.0
*/
@NotNull
public NBTContainer getNbtCopy() {
NBTContainer copy = new NBTContainer();
copy.mergeCompound(this.container);
return copy;
}

/**
* Pastes given NBT into this container, potentially
* overriding everything.
*
* @param container The NBT to paste.
* @since 1.0.0
*/
public void pasteNbt(@NotNull NBTContainer container) {
this.container.mergeCompound(container);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
/**
* Serves as a clipboard database of configurations a player has copied
* and could paste to some other block.
*
* @since 1.0.0
*/
public final class PlayerInventoryClipboard {
@NotNull
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ public void setLockOnPlace(final boolean lockOnPlace) {
* We are switching to a similar system that {@link BlockNBTHandler}
* uses. To retain compatibility and upgradability with older versions
* we will try to remap the previous data to the new data structure.
*
* @since 1.0.0
*/
@Override
protected void preFriendReadCallback() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,10 @@
import java.util.stream.Stream;

/**
* StatHandler for statistic related NBT data.
* StatHandler for statistic related NBT data. Keeps track
* of every statistic and periodically saves it to disk.
*
* @since 1.0.0
*/
public final class StatHandler extends NBTHandler<NBTCompound> {
static final String STAT_FILE_NAME = "blockprot_stats.nbt";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@

import java.util.List;

/**
* A statistic that can keep a list of items.
*
* @since 1.0.0
*/
public abstract class BukkitListStatistic<V extends ListStatisticItem<IV, Material>, IV>
extends BukkitStatistic<List<V>> {
public abstract void add(@NotNull IV object);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@

/**
* A statistic.
*
* @param <V> The type of the value, e.g. {@link Integer} or {@link String}.
* @since 1.0.0
*/
public abstract class BukkitStatistic<V> extends NBTHandler<NBTCompound> implements Comparable<BukkitStatistic<V>> {
/** The key for getting the NBT for this statistic. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@

/**
* A base statistic backed by a single floating point number.
*
* @since 1.0.0
*/
public abstract class FloatStatistic extends BukkitStatistic<Float> {
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@

/**
* A base statistic backed by a single integer.
*
* @since 1.0.0
*/
public abstract class IntStatistic extends BukkitStatistic<Integer> {
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@
import java.util.Objects;
import java.util.stream.Collectors;

/**
* A statistic that keeps track of many {@link Location}s.
*
* @since 1.0.0
*/
public abstract class LocationListStatistic extends BukkitListStatistic<LocationListEntry, Location> {
private @NotNull Location parseLocationFromCompound(@NotNull NBTCompound c) {
return new Location(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@

import org.jetbrains.annotations.NotNull;

/** A base helper class for a statistic backed by a single String */
/**
* A base helper class for a statistic backed by a single String
*
* @since 1.0.0
*/
public abstract class StringStatistic extends BukkitStatistic<String> {
@Override
public @NotNull String toString() {
Expand Down

0 comments on commit e04811f

Please sign in to comment.