Fixed Javadoc building and removed instance of ACBM and FBM

This commit is contained in:
stijnb1234 2021-04-07 10:57:35 +02:00
parent a4dd2aebbe
commit 4f5ef2cee5
4 changed files with 10 additions and 36 deletions

View file

@ -120,8 +120,8 @@
<version>3.2.0</version>
<configuration>
<sourceFileIncludes>
<include>nl/SBDeveloper/V10Lift/API/*.java</include>
<include>nl/SBDeveloper/V10Lift/API/Objects/*.java</include>
<include>nl/SBDeveloper/V10Lift/api/*.java</include>
<include>nl/SBDeveloper/V10Lift/api/objects/*.java</include>
</sourceFileIncludes>
</configuration>
</plugin>

View file

@ -5,7 +5,6 @@ import nl.SBDeveloper.V10Lift.V10LiftPlugin;
import nl.SBDeveloper.V10Lift.api.objects.*;
import nl.SBDeveloper.V10Lift.api.runnables.DoorCloser;
import nl.SBDeveloper.V10Lift.api.runnables.MoveLift;
import nl.SBDeveloper.V10Lift.managers.AntiCopyBlockManager;
import nl.SBDeveloper.V10Lift.managers.DataManager;
import nl.SBDeveloper.V10Lift.managers.ForbiddenBlockManager;
import nl.SBDeveloper.V10Lift.sbutils.LocationSerializer;
@ -26,33 +25,6 @@ import java.util.*;
/** The Main API class, for all the API methods */
public class V10LiftAPI {
/* Load managers... */
private static ForbiddenBlockManager fbm;
private static AntiCopyBlockManager acbm;
public V10LiftAPI() {
fbm = new ForbiddenBlockManager();
acbm = new AntiCopyBlockManager();
}
/**
* Get the ForbiddenBlockManager, to check if a material is forbidden
*
* @return {@link ForbiddenBlockManager}
*/
public ForbiddenBlockManager getFBM() {
return fbm;
}
/**
* Get the AntiCopyBlockManager, to check if we can copy a material
*
* @return {@link AntiCopyBlockManager}
*/
public AntiCopyBlockManager getACBM() {
return acbm;
}
/* Private API methods */
private void sortFloors(@Nonnull Lift lift) {
ArrayList<Map.Entry<String, Floor>> as = new ArrayList<>(lift.getFloors().entrySet());
@ -236,7 +208,7 @@ public class V10LiftAPI {
* @return 0 if added, -2 if forbidden, -3 if already added
*/
public int addBlockToLift(@Nonnull Set<LiftBlock> blocks, @Nonnull LiftBlock block) {
if (getFBM().isForbidden(block.getMat())) return -2;
if (ForbiddenBlockManager.isForbidden(block.getMat())) return -2;
if (blocks.contains(block)) return -3;
blocks.add(block);
return 0;
@ -310,7 +282,7 @@ public class V10LiftAPI {
public int switchBlockAtLift(TreeSet<LiftBlock> blocks, Block block) {
if (blocks == null || block == null) return -1;
Material type = block.getType();
if (getFBM().isForbidden(type)) return -2;
if (ForbiddenBlockManager.isForbidden(type)) return -2;
LiftBlock lb;
if (XMaterial.isNewVersion()) {
if (type.toString().contains("SIGN")) {
@ -906,7 +878,7 @@ public class V10LiftAPI {
Block block = world.getBlockAt(x, minY, z);
if (isRope(block)) return -3;
Material mat = block.getType();
if (getFBM().isForbidden(mat)) return -4;
if (ForbiddenBlockManager.isForbidden(mat)) return -4;
for (int i = minY + 1; i <= maxY; i++) {
block = world.getBlockAt(x, i, z);

View file

@ -4,6 +4,7 @@ import com.cryptomorin.xseries.XMaterial;
import com.cryptomorin.xseries.XSound;
import nl.SBDeveloper.V10Lift.V10LiftPlugin;
import nl.SBDeveloper.V10Lift.api.objects.*;
import nl.SBDeveloper.V10Lift.managers.AntiCopyBlockManager;
import nl.SBDeveloper.V10Lift.managers.DataManager;
import nl.SBDeveloper.V10Lift.sbutils.LocationSerializer;
import nl.SBDeveloper.V10Lift.utils.ConfigUtil;
@ -176,7 +177,7 @@ public class MoveLift implements Runnable {
iter = lift.getBlocks().iterator();
while (iter.hasNext()) {
lb = iter.next();
if (V10LiftPlugin.getAPI().getACBM().isAntiCopy(lb.getMat())) {
if (AntiCopyBlockManager.isAntiCopy(lb.getMat())) {
tb.add(lb);
iter.remove();
block = Objects.requireNonNull(Bukkit.getWorld(lb.getWorld()), "World is null at MoveLift").getBlockAt(lb.getX(), lb.getY(), lb.getZ());
@ -322,7 +323,7 @@ public class MoveLift implements Runnable {
iter = lift.getBlocks().iterator();
while (iter.hasNext()) {
lb = iter.next();
if (V10LiftPlugin.getAPI().getACBM().isAntiCopy(lb.getMat())) {
if (AntiCopyBlockManager.isAntiCopy(lb.getMat())) {
tb.add(lb);
iter.remove();
block = Objects.requireNonNull(Bukkit.getWorld(lb.getWorld()), "World is null at MoveLift").getBlockAt(lb.getX(), lb.getY(), lb.getZ());

View file

@ -6,6 +6,7 @@ import nl.SBDeveloper.V10Lift.api.objects.Floor;
import nl.SBDeveloper.V10Lift.api.objects.Lift;
import nl.SBDeveloper.V10Lift.api.objects.LiftBlock;
import nl.SBDeveloper.V10Lift.managers.DataManager;
import nl.SBDeveloper.V10Lift.managers.ForbiddenBlockManager;
import nl.SBDeveloper.V10Lift.managers.VaultManager;
import nl.SBDeveloper.V10Lift.utils.ConfigUtil;
import nl.SBDeveloper.V10Lift.utils.DoorUtil;
@ -276,7 +277,7 @@ public class PlayerInteractListener implements Listener {
if (e.getAction() != Action.RIGHT_CLICK_BLOCK) return;
e.setCancelled(true);
Block block = e.getClickedBlock();
if (V10LiftPlugin.getAPI().getFBM().isForbidden(block.getType())) {
if (ForbiddenBlockManager.isForbidden(block.getType())) {
ConfigUtil.sendMessage(e.getPlayer(), "Door.BlacklistedMaterial", Collections.singletonMap("%Name%", e.getClickedBlock().getType().toString().toLowerCase()));
return;
}