Skip to content

Commit

Permalink
Add more block-related conditions
Browse files Browse the repository at this point in the history
  • Loading branch information
TonytheMacaroni committed Dec 15, 2023
1 parent 8db69b7 commit efb3d0f
Show file tree
Hide file tree
Showing 7 changed files with 186 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package com.nisovin.magicspells.castmodifiers.conditions;

import org.bukkit.Location;
import org.bukkit.entity.LivingEntity;

import com.nisovin.magicspells.castmodifiers.Condition;

public class BuildableCondition extends Condition {

@Override
public boolean initialize(String var) {
return true;
}

@Override
public boolean check(LivingEntity livingEntity) {
return false;
}

@Override
public boolean check(LivingEntity livingEntity, LivingEntity target) {
return false;
}

@Override
public boolean check(LivingEntity livingEntity, Location location) {
return location.getBlock().isBuildable();
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package com.nisovin.magicspells.castmodifiers.conditions;

import org.bukkit.Location;
import org.bukkit.entity.LivingEntity;

import com.nisovin.magicspells.castmodifiers.Condition;

public class BurnableCondition extends Condition {

@Override
public boolean initialize(String var) {
return true;
}

@Override
public boolean check(LivingEntity livingEntity) {
return false;
}

@Override
public boolean check(LivingEntity livingEntity, LivingEntity target) {
return false;
}

@Override
public boolean check(LivingEntity livingEntity, Location location) {
return location.getBlock().isBurnable();
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package com.nisovin.magicspells.castmodifiers.conditions;

import org.bukkit.Location;
import org.bukkit.entity.LivingEntity;

import com.nisovin.magicspells.castmodifiers.Condition;

public class CollidableCondition extends Condition {

@Override
public boolean initialize(String var) {
return true;
}

@Override
public boolean check(LivingEntity livingEntity) {
return false;
}

@Override
public boolean check(LivingEntity livingEntity, LivingEntity target) {
return false;
}

@Override
public boolean check(LivingEntity livingEntity, Location location) {
return location.getBlock().isCollidable();
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package com.nisovin.magicspells.castmodifiers.conditions;

import org.bukkit.Location;
import org.bukkit.entity.LivingEntity;

import com.nisovin.magicspells.castmodifiers.Condition;

public class PassableCondition extends Condition {

@Override
public boolean initialize(String var) {
return true;
}

@Override
public boolean check(LivingEntity livingEntity) {
return false;
}

@Override
public boolean check(LivingEntity livingEntity, LivingEntity target) {
return false;
}

@Override
public boolean check(LivingEntity livingEntity, Location location) {
return location.getBlock().isPassable();
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package com.nisovin.magicspells.castmodifiers.conditions;

import org.bukkit.Location;
import org.bukkit.entity.LivingEntity;

import com.nisovin.magicspells.castmodifiers.Condition;

public class ReplaceableCondition extends Condition {

@Override
public boolean initialize(String var) {
return true;
}

@Override
public boolean check(LivingEntity livingEntity) {
return false;
}

@Override
public boolean check(LivingEntity livingEntity, LivingEntity target) {
return false;
}

@Override
public boolean check(LivingEntity livingEntity, Location location) {
return location.getBlock().isReplaceable();
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package com.nisovin.magicspells.castmodifiers.conditions;

import org.bukkit.Location;
import org.bukkit.entity.LivingEntity;

import com.nisovin.magicspells.castmodifiers.Condition;

public class SolidCondition extends Condition {

@Override
public boolean initialize(String var) {
return true;
}

@Override
public boolean check(LivingEntity livingEntity) {
return false;
}

@Override
public boolean check(LivingEntity livingEntity, LivingEntity target) {
return false;
}

@Override
public boolean check(LivingEntity livingEntity, Location location) {
return location.getBlock().isSolid();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,12 @@ private void initialize() {
addCondition("ownedloopactive", OwnedLoopActiveCondition.class);
addCondition("always", AlwaysCondition.class);
addCondition("velocityactive", VelocityActiveCondition.class);
addCondition("buildable", BuildableCondition.class);
addCondition("burnable", BurnableCondition.class);
addCondition("collidable", CollidableCondition.class);
addCondition("passable", PassableCondition.class);
addCondition("replaceable", ReplaceableCondition.class);
addCondition("solid", SolidCondition.class);
}

}

0 comments on commit efb3d0f

Please sign in to comment.