Skip to content
This repository was archived by the owner on Sep 2, 2021. It is now read-only.
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: TheBusyBiscuit/CS-CoreLib2
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 0.30.4
Choose a base ref
...
head repository: TheBusyBiscuit/CS-CoreLib2
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 0.31.0
Choose a head ref
  • 18 commits
  • 27 files changed
  • 4 contributors

Commits on Apr 10, 2021

  1. Copy the full SHA
    1a21e9b View commit details

Commits on Apr 11, 2021

  1. Merge pull request #171 from TheBusyBiscuit/renovate/com.github.anges…

    …chossen-landsapi-5.x
    
    Update dependency com.github.angeschossen:LandsAPI to v5.4.12
    TheBusyBiscuit authored Apr 11, 2021
    Copy the full SHA
    9f93744 View commit details

Commits on Apr 18, 2021

  1. Copy the full SHA
    c6a46db View commit details
  2. Copy the full SHA
    52dcff0 View commit details

Commits on Apr 19, 2021

  1. Merge pull request #173 from barpec12/master

    Update to FunnyGuilds 4.9.5
    TheBusyBiscuit authored Apr 19, 2021
    Copy the full SHA
    3d8aedd View commit details
  2. bump version

    TheBusyBiscuit authored Apr 19, 2021
    Copy the full SHA
    d4960a5 View commit details

Commits on Apr 21, 2021

  1. Copy the full SHA
    ae1e3ae View commit details
  2. Copy the full SHA
    daa2cfa View commit details
  3. Merge pull request #176 from TheBusyBiscuit/renovate/com.sk89q.worlde…

    …dit-worldedit-core-7.x
    
    Update dependency com.sk89q.worldedit:worldedit-core to v7.2.5
    TheBusyBiscuit authored Apr 21, 2021
    Copy the full SHA
    cb8c4c8 View commit details
  4. Merge pull request #175 from TheBusyBiscuit/renovate/com.sk89q.worlde…

    …dit-worldedit-bukkit-7.x
    
    Update dependency com.sk89q.worldedit:worldedit-bukkit to v7.2.5
    TheBusyBiscuit authored Apr 21, 2021
    Copy the full SHA
    b5337ab View commit details

Commits on Apr 22, 2021

  1. Copy the full SHA
    3cc5d7b View commit details

Commits on Apr 23, 2021

  1. Merge pull request #178 from TheBusyBiscuit/renovate/com.github.anges…

    …chossen-landsapi-5.x
    
    Update dependency com.github.angeschossen:LandsAPI to v5.5.5
    TheBusyBiscuit authored Apr 23, 2021
    Copy the full SHA
    12391d2 View commit details
  2. Copy the full SHA
    b4fffc1 View commit details

Commits on Apr 25, 2021

  1. Some refactoring

    TheBusyBiscuit committed Apr 25, 2021

    Verified

    This commit was signed with the committer’s verified signature.
    davidmc24 David M. Carr
    Copy the full SHA
    d3179b1 View commit details
  2. Merge pull request #179 from TheBusyBiscuit/renovate/com.github.anges…

    …chossen-landsapi-5.x
    
    Update dependency com.github.angeschossen:LandsAPI to v5.6.0
    TheBusyBiscuit authored Apr 25, 2021

    Verified

    This commit was signed with the committer’s verified signature.
    davidmc24 David M. Carr
    Copy the full SHA
    8208282 View commit details

Commits on May 3, 2021

  1. Copy the full SHA
    0ea93e5 View commit details
  2. Copy the full SHA
    c2b1139 View commit details
  3. Explicitly declare maven-source-plugin version

    Also update spigot-api to 1.16.5
    TheBusyBiscuit committed May 3, 2021
    Copy the full SHA
    ff633f5 View commit details
Showing with 140 additions and 181 deletions.
  1. +15 −24 pom.xml
  2. +13 −0 src/main/java/io/github/thebusybiscuit/cscorelib2/blocks/BlockPosition.java
  3. +6 −4 src/main/java/io/github/thebusybiscuit/cscorelib2/chat/ChatInput.java
  4. +4 −1 src/main/java/io/github/thebusybiscuit/cscorelib2/chat/{IChatInput.java → ChatInputHandler.java}
  5. +6 −6 src/main/java/io/github/thebusybiscuit/cscorelib2/chat/ChatInputListener.java
  6. +0 −15 src/main/java/io/github/thebusybiscuit/cscorelib2/config/Config.java
  7. +9 −3 src/main/java/io/github/thebusybiscuit/cscorelib2/config/Localization.java
  8. +21 −0 src/main/java/io/github/thebusybiscuit/cscorelib2/inventory/InvUtils.java
  9. +8 −10 src/main/java/io/github/thebusybiscuit/cscorelib2/protection/ProtectionManager.java
  10. +0 −55 src/main/java/io/github/thebusybiscuit/cscorelib2/protection/modules/ASkyBlockProtectionModule.java
  11. +2 −1 src/main/java/io/github/thebusybiscuit/cscorelib2/protection/modules/BentoBoxProtectionModule.java
  12. +2 −1 ...main/java/io/github/thebusybiscuit/cscorelib2/protection/modules/BlockLockerProtectionModule.java
  13. +2 −1 ...ain/java/io/github/thebusybiscuit/cscorelib2/protection/modules/ChestProtectProtectionModule.java
  14. +2 −1 ...ain/java/io/github/thebusybiscuit/cscorelib2/protection/modules/FactionsUUIDProtectionModule.java
  15. +24 −24 ...main/java/io/github/thebusybiscuit/cscorelib2/protection/modules/FunnyGuildsProtectionModule.java
  16. +2 −1 .../java/io/github/thebusybiscuit/cscorelib2/protection/modules/GriefPreventionProtectionModule.java
  17. +2 −1 src/main/java/io/github/thebusybiscuit/cscorelib2/protection/modules/LWCProtectionModule.java
  18. +6 −2 src/main/java/io/github/thebusybiscuit/cscorelib2/protection/modules/LandsProtectionModule.java
  19. +2 −1 src/main/java/io/github/thebusybiscuit/cscorelib2/protection/modules/LocketteProtectionModule.java
  20. +2 −1 ...ain/java/io/github/thebusybiscuit/cscorelib2/protection/modules/PlotSquared4ProtectionModule.java
  21. +2 −1 ...ain/java/io/github/thebusybiscuit/cscorelib2/protection/modules/PlotSquared5ProtectionModule.java
  22. +2 −1 ...n/java/io/github/thebusybiscuit/cscorelib2/protection/modules/PreciousStonesProtectionModule.java
  23. +2 −1 src/main/java/io/github/thebusybiscuit/cscorelib2/protection/modules/RedProtectProtectionModule.java
  24. +2 −1 src/main/java/io/github/thebusybiscuit/cscorelib2/protection/modules/TownyProtectionModule.java
  25. +2 −1 src/main/java/io/github/thebusybiscuit/cscorelib2/protection/modules/WorldGuardProtectionModule.java
  26. +0 −23 src/main/java/io/github/thebusybiscuit/cscorelib2/reflection/ReflectionUtils.java
  27. +2 −1 src/main/java/io/github/thebusybiscuit/cscorelib2/updater/UpdaterTask.java
39 changes: 15 additions & 24 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@
<groupId>com.github.thebusybiscuit</groupId>
<artifactId>cscorelib2</artifactId>

<version>0.30.4</version>
<version>0.31.0</version>

<packaging>jar</packaging>
<url>https://github.com/TheBusyBiscuit/CS-CoreLib2</url>
@@ -42,21 +42,16 @@
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
<repository>
<id>papermc</id>
<id>papermc-repo</id>
<url>https://papermc.io/repo/repository/maven-public/</url>
</repository>
<repository>
<id>minecraft-repo</id>
<url>https://libraries.minecraft.net/</url>
</repository>
<repository>
<id>bintray-tastybento-maven-repo</id>
<name>bintray</name>
<url>http://dl.bintray.com/tastybento/maven-repo</url>
</repository>
<repository>
<id>CodeMC</id>
<url>https://repo.codemc.org/repository/maven-public</url>
<id>tastybento-repo</id>
<url>https://dl.bintray.com/tastybento/maven-repo</url>
</repository>
<repository>
<id>coreprotect-repo</id>
@@ -71,16 +66,16 @@
<url>https://ci.ender.zone/job/FactionsUUID/122/maven-repository/repository</url>
</repository>
<repository>
<id>plotsquared</id>
<id>plotsquared-repo</id>
<url>https://plotsquared.com/mvn/</url>
</repository>
<repository>
<id>rutger-repo</id>
<url>http://www.rutgerkok.nl/repo</url>
<id>codemc-repo</id>
<url>https://repo.codemc.org/repository/maven-public/</url>
</repository>
<repository>
<id>worldedit-worldguard-repo</id>
<url>http://maven.sk89q.com/repo/</url>
<url>https://maven.sk89q.com/repo/</url>
</repository>
<repository>
<id>funnyguilds-repo</id>
@@ -96,6 +91,8 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.2.1</version>

<executions>
<execution>
<id>attach-sources</id>
@@ -113,7 +110,7 @@
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.16.4-R0.1-SNAPSHOT</version>
<version>1.16.5-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
@@ -134,13 +131,13 @@
<dependency>
<groupId>com.sk89q.worldedit</groupId>
<artifactId>worldedit-core</artifactId>
<version>7.2.3</version>
<version>7.2.5</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.sk89q.worldedit</groupId>
<artifactId>worldedit-bukkit</artifactId>
<version>7.2.4</version>
<version>7.2.5</version>
<scope>provided</scope>
</dependency>
<dependency>
@@ -179,12 +176,6 @@
<version>16.17.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.wasteofplastic</groupId>
<artifactId>askyblock</artifactId>
<version>3.0.9.4</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.github.dmulloy2.LWC</groupId>
<artifactId>lwc</artifactId>
@@ -248,7 +239,7 @@
<dependency>
<groupId>com.github.angeschossen</groupId>
<artifactId>LandsAPI</artifactId>
<version>5.4.0</version>
<version>5.6.0</version>
<scope>provided</scope>
</dependency>
<dependency>
@@ -260,7 +251,7 @@
<dependency>
<groupId>net.dzikoysk</groupId>
<artifactId>funnyguilds</artifactId>
<version>4.9.4</version>
<version>4.9.5</version>
<scope>provided</scope>
</dependency>
</dependencies>
Original file line number Diff line number Diff line change
@@ -162,6 +162,19 @@ public static long getAsLong(int x, int y, int z) {
return ((long) (x & 0x3FFFFFF) << 38) | ((long) (z & 0x3FFFFFF) << 12) | (long) (y & 0xFFF);
}

/**
* This compacts the three provided integers into one {@link Long}.
* This allows us to save a lot memory-wise.
*
* @param loc
* The {@link Location} to simplify.
*
* @return The compacted {@link Long}, ignoring the {@link World}
*/
public static long getAsLong(@NonNull Location loc) {
return getAsLong(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ());
}

/**
* {@inheritDoc}
*/
Original file line number Diff line number Diff line change
@@ -46,7 +46,7 @@ public static void waitForPlayer(@NonNull Plugin plugin, @NonNull Player p, @Non
* A callback to invoke when the Player has entered some text
*/
public static void waitForPlayer(@NonNull Plugin plugin, @NonNull Player p, @NonNull Predicate<String> predicate, @NonNull Consumer<String> handler) {
queue(plugin, p, new IChatInput() {
queue(plugin, p, new ChatInputHandler() {

@Override
public boolean test(String msg) {
@@ -92,7 +92,7 @@ public static void waitForPlayer(@NonNull Plugin plugin, @NonNull Player p, @Non
* A callback to invoke when the Player has entered some text
*/
public static void waitForPlayer(@NonNull Plugin plugin, @NonNull Player p, @NonNull Predicate<String> predicate, @NonNull BiConsumer<Player, String> handler) {
queue(plugin, p, new IChatInput() {
queue(plugin, p, new ChatInputHandler() {

@Override
public boolean test(String msg) {
@@ -107,9 +107,11 @@ public void onChat(Player p, String msg) {
});
}

public static void queue(@NonNull Plugin plugin, @NonNull Player p, @NonNull IChatInput callback) {
if (listener == null)
public static void queue(@NonNull Plugin plugin, @NonNull Player p, @NonNull ChatInputHandler callback) {
if (listener == null) {
listener = new ChatInputListener(plugin);
}

listener.addCallback(p.getUniqueId(), callback);
}

Original file line number Diff line number Diff line change
@@ -2,10 +2,13 @@

import java.util.function.Predicate;

import javax.annotation.ParametersAreNonnullByDefault;

import org.bukkit.entity.Player;

public interface IChatInput extends Predicate<String> {
public interface ChatInputHandler extends Predicate<String> {

@ParametersAreNonnullByDefault
void onChat(Player p, String msg);

}
Original file line number Diff line number Diff line change
@@ -23,7 +23,7 @@
class ChatInputListener implements Listener {

private Plugin plugin;
protected Map<UUID, Set<IChatInput>> handlers;
protected Map<UUID, Set<ChatInputHandler>> handlers;

protected ChatInputListener(Plugin plugin) {
this.plugin = plugin;
@@ -32,8 +32,8 @@ protected ChatInputListener(Plugin plugin) {
plugin.getServer().getPluginManager().registerEvents(this, plugin);
}

public void addCallback(UUID uuid, IChatInput input) {
Set<IChatInput> callbacks = handlers.computeIfAbsent(uuid, id -> new HashSet<>());
public void addCallback(UUID uuid, ChatInputHandler input) {
Set<ChatInputHandler> callbacks = handlers.computeIfAbsent(uuid, id -> new HashSet<>());
callbacks.add(input);
}

@@ -66,13 +66,13 @@ public void onComamnd(PlayerCommandPreprocessEvent e) {
}

private void checkInput(Cancellable e, Player p, String msg) {
Set<IChatInput> callbacks = handlers.get(p.getUniqueId());
Set<ChatInputHandler> callbacks = handlers.get(p.getUniqueId());

if (callbacks != null) {
Iterator<IChatInput> iterator = callbacks.iterator();
Iterator<ChatInputHandler> iterator = callbacks.iterator();

while (iterator.hasNext()) {
IChatInput handler = iterator.next();
ChatInputHandler handler = iterator.next();

if (handler.test(msg)) {
iterator.remove();
Original file line number Diff line number Diff line change
@@ -375,21 +375,6 @@ public long getLong(@NonNull String path) {
return Long.valueOf(String.valueOf(getValue(path)));
}

/**
* Returns the Sound at the specified path
*
* @deprecated This method is no longer supported.
*
* @param path
* The path in the Config File
*
* @return The Sound at that path
*/
@Deprecated
public Sound getSound(@NonNull String path) {
return Sound.valueOf(getString(path));
}

/**
* Returns the Date at the specified path
*
Original file line number Diff line number Diff line change
@@ -6,6 +6,9 @@
import java.util.function.UnaryOperator;
import java.util.stream.Collectors;

import javax.annotation.Nonnull;
import javax.annotation.Nullable;

import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
@@ -59,7 +62,7 @@ public Localization(@NonNull Plugin plugin, @NonNull String name) {
* Whether Unicodes are allowed
*/
public Localization(@NonNull Plugin plugin, @NonNull String name, boolean allowUnicodes) {
this.file = new File("plugins/" + plugin.getDescription().getName().replace(" ", "_") + "/" + name);
this.file = new File("plugins/" + plugin.getDescription().getName().replace(" ", "_") + '/' + name);
this.config = new Config(file);
this.allowUnicodes = allowUnicodes;
}
@@ -69,8 +72,10 @@ public Localization(@NonNull File file) {
this.config = new Config(file);
}

@Nonnull
public String getPrefix() {
return config.contains("prefix") ? getMessage("prefix") : "";
String prefix = getMessage("prefix");
return prefix != null ? prefix : "";
}

/**
@@ -252,7 +257,8 @@ public void save() {
config.save();
}

protected static String translateUnicodes(String str) {
@Nullable
protected static String translateUnicodes(@Nullable String str) {
if (str == null) {
return null;
}
Original file line number Diff line number Diff line change
@@ -26,12 +26,33 @@ private InvUtils() {}
*
* @param inv
* The Inventory to check
*
* @return Whether an empty slot exists
*/
public static boolean hasEmptySlot(@NonNull Inventory inv) {
return inv.firstEmpty() != 1;
}

/**
* This checks if the given {@link Inventory} is empty.
*
* @param inv
* The {@link Inventory} to check
*
* @return Whether that {@link Inventory} is empty
*/
public static boolean isEmpty(@NonNull Inventory inv) {
// Sadly Inventory#isEmpty() is not available everywhere

for (ItemStack item : inv) {
if (item != null && !item.getType().isAir()) {
return false;
}
}

return true;
}

/**
* This method checks both an ItemStack's and an Inventory's maxStackSize to determine
* if a given ItemStack can stack with another ItemStack in the given Inventory
Original file line number Diff line number Diff line change
@@ -7,7 +7,14 @@
import java.util.logging.LogRecord;
import java.util.logging.Logger;

import io.github.thebusybiscuit.cscorelib2.protection.modules.ASkyBlockProtectionModule;
import org.bukkit.Location;
import org.bukkit.OfflinePlayer;
import org.bukkit.Server;
import org.bukkit.block.Block;
import org.bukkit.plugin.Plugin;

import io.github.thebusybiscuit.cscorelib2.protection.loggers.CoreProtectLogger;
import io.github.thebusybiscuit.cscorelib2.protection.loggers.LogBlockLogger;
import io.github.thebusybiscuit.cscorelib2.protection.modules.BentoBoxProtectionModule;
import io.github.thebusybiscuit.cscorelib2.protection.modules.BlockLockerProtectionModule;
import io.github.thebusybiscuit.cscorelib2.protection.modules.ChestProtectProtectionModule;
@@ -23,14 +30,6 @@
import io.github.thebusybiscuit.cscorelib2.protection.modules.RedProtectProtectionModule;
import io.github.thebusybiscuit.cscorelib2.protection.modules.TownyProtectionModule;
import io.github.thebusybiscuit.cscorelib2.protection.modules.WorldGuardProtectionModule;
import org.bukkit.Location;
import org.bukkit.OfflinePlayer;
import org.bukkit.Server;
import org.bukkit.block.Block;
import org.bukkit.plugin.Plugin;

import io.github.thebusybiscuit.cscorelib2.protection.loggers.CoreProtectLogger;
import io.github.thebusybiscuit.cscorelib2.protection.loggers.LogBlockLogger;
import lombok.NonNull;

/**
@@ -62,7 +61,6 @@ public ProtectionManager(@NonNull Server server) {
registerModule(server, "WorldGuard", plugin -> new WorldGuardProtectionModule(plugin));
registerModule(server, "Towny", plugin -> new TownyProtectionModule(plugin));
registerModule(server, "GriefPrevention", plugin -> new GriefPreventionProtectionModule(plugin));
registerModule(server, "ASkyBlock", plugin -> new ASkyBlockProtectionModule(plugin));
registerModule(server, "LWC", plugin -> new LWCProtectionModule(plugin));
registerModule(server, "PreciousStones", plugin -> new PreciousStonesProtectionModule(plugin));
registerModule(server, "Lockette", plugin -> new LocketteProtectionModule(plugin));

This file was deleted.

Original file line number Diff line number Diff line change
@@ -9,6 +9,7 @@

import io.github.thebusybiscuit.cscorelib2.protection.ProtectableAction;
import io.github.thebusybiscuit.cscorelib2.protection.ProtectionModule;
import lombok.NonNull;
import world.bentobox.bentobox.BentoBox;
import world.bentobox.bentobox.api.flags.Flag;
import world.bentobox.bentobox.api.user.User;
@@ -30,7 +31,7 @@ public class BentoBoxProtectionModule implements ProtectionModule {

private final Plugin plugin;

public BentoBoxProtectionModule(Plugin plugin) {
public BentoBoxProtectionModule(@NonNull Plugin plugin) {
this.plugin = plugin;
}

Original file line number Diff line number Diff line change
@@ -8,6 +8,7 @@

import io.github.thebusybiscuit.cscorelib2.protection.ProtectableAction;
import io.github.thebusybiscuit.cscorelib2.protection.ProtectionModule;
import lombok.NonNull;
import nl.rutgerkok.blocklocker.BlockLockerAPIv2;
import nl.rutgerkok.blocklocker.BlockLockerPlugin;
import nl.rutgerkok.blocklocker.profile.Profile;
@@ -18,7 +19,7 @@ public class BlockLockerProtectionModule implements ProtectionModule {
private BlockLockerPlugin api;
private final Plugin plugin;

public BlockLockerProtectionModule(Plugin plugin) {
public BlockLockerProtectionModule(@NonNull Plugin plugin) {
this.plugin = plugin;
}

Original file line number Diff line number Diff line change
@@ -6,6 +6,7 @@

import io.github.thebusybiscuit.cscorelib2.protection.ProtectableAction;
import io.github.thebusybiscuit.cscorelib2.protection.ProtectionModule;
import lombok.NonNull;
import me.angeschossen.chestprotect.api.addons.ChestProtectAddon;
import me.angeschossen.chestprotect.api.objects.BlockProtection;

@@ -14,7 +15,7 @@ public class ChestProtectProtectionModule implements ProtectionModule {
private final Plugin plugin;
private ChestProtectAddon chestProtect;

public ChestProtectProtectionModule(Plugin plugin) {
public ChestProtectProtectionModule(@NonNull Plugin plugin) {
this.plugin = plugin;
}

Original file line number Diff line number Diff line change
@@ -11,13 +11,14 @@

import io.github.thebusybiscuit.cscorelib2.protection.ProtectableAction;
import io.github.thebusybiscuit.cscorelib2.protection.ProtectionModule;
import lombok.NonNull;

public class FactionsUUIDProtectionModule implements ProtectionModule {

private FPlayers api;
private final Plugin plugin;

public FactionsUUIDProtectionModule(Plugin plugin) {
public FactionsUUIDProtectionModule(@NonNull Plugin plugin) {
this.plugin = plugin;
}

Original file line number Diff line number Diff line change
@@ -16,29 +16,29 @@
*/
public class FunnyGuildsProtectionModule implements ProtectionModule {

private final Plugin plugin;

public FunnyGuildsProtectionModule(@NonNull Plugin plugin) {
this.plugin = plugin;
}

@Override
public Plugin getPlugin() {
return plugin;
}

@Override
public void load() {
// We don't need to load any APIs, everything is static
}

@Override
public boolean hasPermission(OfflinePlayer p, Location l, ProtectableAction action) {
return p instanceof Player && !ProtectionSystem.isProtected((Player) p, l, convert(action));
}

private boolean convert(ProtectableAction protectableAction) {
return protectableAction == ProtectableAction.PLACE_BLOCK;
}
private final Plugin plugin;

public FunnyGuildsProtectionModule(@NonNull Plugin plugin) {
this.plugin = plugin;
}

@Override
public Plugin getPlugin() {
return plugin;
}

@Override
public void load() {
// We don't need to load any APIs, everything is static
}

@Override
public boolean hasPermission(OfflinePlayer p, Location l, ProtectableAction action) {
return p instanceof Player && ProtectionSystem.isProtected((Player) p, l, convert(action)).isEmpty();
}

private boolean convert(ProtectableAction protectableAction) {
return protectableAction == ProtectableAction.PLACE_BLOCK;
}

}
Original file line number Diff line number Diff line change
@@ -7,6 +7,7 @@

import io.github.thebusybiscuit.cscorelib2.protection.ProtectableAction;
import io.github.thebusybiscuit.cscorelib2.protection.ProtectionModule;
import lombok.NonNull;
import me.ryanhamshire.GriefPrevention.Claim;
import me.ryanhamshire.GriefPrevention.DataStore;
import me.ryanhamshire.GriefPrevention.GriefPrevention;
@@ -16,7 +17,7 @@ public class GriefPreventionProtectionModule implements ProtectionModule {
private DataStore dataStore;
private final Plugin plugin;

public GriefPreventionProtectionModule(Plugin plugin) {
public GriefPreventionProtectionModule(@NonNull Plugin plugin) {
this.plugin = plugin;
}

Original file line number Diff line number Diff line change
@@ -9,13 +9,14 @@

import io.github.thebusybiscuit.cscorelib2.protection.ProtectableAction;
import io.github.thebusybiscuit.cscorelib2.protection.ProtectionModule;
import lombok.NonNull;

public class LWCProtectionModule implements ProtectionModule {

private LWC lwc;
private final Plugin plugin;

public LWCProtectionModule(Plugin plugin) {
public LWCProtectionModule(@NonNull Plugin plugin) {
this.plugin = plugin;
}

Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
package io.github.thebusybiscuit.cscorelib2.protection.modules;

import javax.annotation.Nonnull;

import org.bukkit.Location;
import org.bukkit.OfflinePlayer;
import org.bukkit.plugin.Plugin;

import io.github.thebusybiscuit.cscorelib2.protection.ProtectableAction;
import io.github.thebusybiscuit.cscorelib2.protection.ProtectionModule;
import lombok.NonNull;
import me.angeschossen.lands.api.integration.LandsIntegration;
import me.angeschossen.lands.api.land.Area;
import me.angeschossen.lands.api.land.LandWorld;
@@ -16,7 +19,7 @@ public class LandsProtectionModule implements ProtectionModule {
private LandsIntegration landsIntegration;
private final Plugin plugin;

public LandsProtectionModule(Plugin plugin) {
public LandsProtectionModule(@NonNull Plugin plugin) {
this.plugin = plugin;
}

@@ -42,7 +45,8 @@ public boolean hasPermission(OfflinePlayer p, Location l, ProtectableAction acti
return area == null || area.canSetting(p.getUniqueId(), convert(action));
}

private RoleSetting convert(ProtectableAction protectableAction) {
@Nonnull
private RoleSetting convert(@NonNull ProtectableAction protectableAction) {
switch (protectableAction) {
case PLACE_BLOCK:
return RoleSetting.BLOCK_PLACE;
Original file line number Diff line number Diff line change
@@ -10,12 +10,13 @@

import io.github.thebusybiscuit.cscorelib2.protection.ProtectableAction;
import io.github.thebusybiscuit.cscorelib2.protection.ProtectionModule;
import lombok.NonNull;

public class LocketteProtectionModule implements ProtectionModule {

private final Plugin plugin;

public LocketteProtectionModule(Plugin plugin) {
public LocketteProtectionModule(@NonNull Plugin plugin) {
this.plugin = plugin;
}

Original file line number Diff line number Diff line change
@@ -12,12 +12,13 @@

import io.github.thebusybiscuit.cscorelib2.protection.ProtectableAction;
import io.github.thebusybiscuit.cscorelib2.protection.ProtectionModule;
import lombok.NonNull;

public class PlotSquared4ProtectionModule implements ProtectionModule {

private final Plugin plugin;

public PlotSquared4ProtectionModule(Plugin plugin) {
public PlotSquared4ProtectionModule(@NonNull Plugin plugin) {
this.plugin = plugin;
}

Original file line number Diff line number Diff line change
@@ -12,12 +12,13 @@

import io.github.thebusybiscuit.cscorelib2.protection.ProtectableAction;
import io.github.thebusybiscuit.cscorelib2.protection.ProtectionModule;
import lombok.NonNull;

public class PlotSquared5ProtectionModule implements ProtectionModule {

private final Plugin plugin;

public PlotSquared5ProtectionModule(Plugin plugin) {
public PlotSquared5ProtectionModule(@NonNull Plugin plugin) {
this.plugin = plugin;
}

Original file line number Diff line number Diff line change
@@ -7,6 +7,7 @@

import io.github.thebusybiscuit.cscorelib2.protection.ProtectableAction;
import io.github.thebusybiscuit.cscorelib2.protection.ProtectionModule;
import lombok.NonNull;
import net.sacredlabyrinth.Phaed.PreciousStones.PreciousStones;
import net.sacredlabyrinth.Phaed.PreciousStones.api.IApi;
import net.sacredlabyrinth.Phaed.PreciousStones.field.FieldFlag;
@@ -16,7 +17,7 @@ public class PreciousStonesProtectionModule implements ProtectionModule {
private IApi api;
private final Plugin plugin;

public PreciousStonesProtectionModule(Plugin plugin) {
public PreciousStonesProtectionModule(@NonNull Plugin plugin) {
this.plugin = plugin;
}

Original file line number Diff line number Diff line change
@@ -10,13 +10,14 @@
import br.net.fabiozumbi12.RedProtect.Bukkit.API.RedProtectAPI;
import io.github.thebusybiscuit.cscorelib2.protection.ProtectableAction;
import io.github.thebusybiscuit.cscorelib2.protection.ProtectionModule;
import lombok.NonNull;

public class RedProtectProtectionModule implements ProtectionModule {

private RedProtectAPI api;
private final Plugin plugin;

public RedProtectProtectionModule(Plugin plugin) {
public RedProtectProtectionModule(@NonNull Plugin plugin) {
this.plugin = plugin;
}

Original file line number Diff line number Diff line change
@@ -10,12 +10,13 @@

import io.github.thebusybiscuit.cscorelib2.protection.ProtectableAction;
import io.github.thebusybiscuit.cscorelib2.protection.ProtectionModule;
import lombok.NonNull;

public class TownyProtectionModule implements ProtectionModule {

private final Plugin plugin;

public TownyProtectionModule(Plugin plugin) {
public TownyProtectionModule(@NonNull Plugin plugin) {
this.plugin = plugin;
}

Original file line number Diff line number Diff line change
@@ -19,6 +19,7 @@

import io.github.thebusybiscuit.cscorelib2.protection.ProtectableAction;
import io.github.thebusybiscuit.cscorelib2.protection.ProtectionModule;
import lombok.NonNull;

public class WorldGuardProtectionModule implements ProtectionModule {

@@ -28,7 +29,7 @@ public class WorldGuardProtectionModule implements ProtectionModule {

private final Plugin plugin;

public WorldGuardProtectionModule(Plugin plugin) {
public WorldGuardProtectionModule(@NonNull Plugin plugin) {
this.plugin = plugin;
}

Original file line number Diff line number Diff line change
@@ -338,29 +338,6 @@ public static boolean isUnitTestEnvironment() {
return getVersion().equals("mockbukkit");
}

/**
* This checks if {@link #getVersion()} is the given version
*
* @deprecated Use PaperLib :)
*
* @param prefixes
* The prefixes
*
* @return Whether it is one of those versions
*/
@Deprecated
public static boolean isVersion(String... prefixes) {
String version = getVersion();

for (String prefix : prefixes) {
if (version.startsWith(prefix)) {
return true;
}
}

return false;
}

/**
* Compares multiple Type Arrays
*
Original file line number Diff line number Diff line change
@@ -9,6 +9,7 @@
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
import java.nio.charset.StandardCharsets;
import java.util.logging.Level;

import javax.annotation.Nullable;
@@ -63,7 +64,7 @@ private UpdateInfo getLatestVersion(@NonNull URL url) {
connection.setDoOutput(true);

@Cleanup
BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream(), StandardCharsets.UTF_8));
return parse(reader.readLine());
} catch (IOException e) {
plugin.getLogger().log(Level.WARNING, "Could not connect to the updating site, is it down?", e);