Skip to content

Commit

Permalink
Prevents attempting to sit on lit fire.
Browse files Browse the repository at this point in the history
  • Loading branch information
ShakeforProtein committed Sep 28, 2021
1 parent eb69318 commit 1968e89
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>me.shakeforprotein</groupId>
<artifactId>ShakeSeats</artifactId>
<version>0.0.3 - SpMc1.13.2</version>
<version>0.0.5</version>
<packaging>jar</packaging>

<name>ShakeSeats</name>
Expand Down Expand Up @@ -69,7 +69,7 @@
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.13.2-R0.1-SNAPSHOT</version>
<version>1.16.5-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
Expand Down
10 changes: 9 additions & 1 deletion src/main/java/Listeners/SeatListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.block.data.Bisected;
import org.bukkit.block.data.type.Campfire;
import org.bukkit.block.data.type.Leaves;
import org.bukkit.block.data.type.Slab;
import org.bukkit.block.data.type.Stairs;
import org.bukkit.entity.ArmorStand;
Expand All @@ -15,6 +17,7 @@
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.Action;
import org.bukkit.event.block.LeavesDecayEvent;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerQuitEvent;
Expand Down Expand Up @@ -73,7 +76,11 @@ public void PlayerRightClickBlock(PlayerInteractEvent e) {
} else if (e.getClickedBlock().getType().name().toLowerCase().contains("carpet")) {
armorStand = (ArmorStand) e.getPlayer().getWorld().spawnEntity(e.getClickedBlock().getLocation().subtract(-0.5, 1.7, -0.5), EntityType.ARMOR_STAND);
} else if(e.getClickedBlock().getType().name().toLowerCase().contains("campfire")){
armorStand = (ArmorStand) e.getPlayer().getWorld().spawnEntity(e.getClickedBlock().getLocation().subtract(-0.5, 1.2, -0.5), EntityType.ARMOR_STAND);
Campfire campfire = (Campfire) e.getClickedBlock().getState().getBlockData();

if(!campfire.isLit()) {
armorStand = (ArmorStand) e.getPlayer().getWorld().spawnEntity(e.getClickedBlock().getLocation().subtract(-0.5, 1.2, -0.5), EntityType.ARMOR_STAND);
}
}

if (armorStand != null) {
Expand Down Expand Up @@ -123,6 +130,7 @@ public void PlayerDismountArmorStand(EntityDismountEvent e) {
if (e.getDismounted() instanceof ArmorStand && e.getEntity() instanceof Player && pl.standHash.containsKey((ArmorStand) e.getDismounted()) && pl.standHash.get((ArmorStand) e.getDismounted()) != null && pl.standHash.get((ArmorStand) e.getDismounted()) == e.getEntity()) {
pl.standHash.remove((ArmorStand) e.getDismounted());
e.getDismounted().remove();
e.getEntity().teleport(e.getEntity().getLocation().add(0,1,0));
}
}

Expand Down

0 comments on commit 1968e89

Please sign in to comment.