commit 0c0963b3e66c40e7959e3e21c93ca24b9b364a87
parent 9f9461f40eba21f126ab9cc5365caf3131a4939a
Author: typable <typable.dev@gmail.com>
Date: Sat, 28 Nov 2020 12:01:04 +0100
Fixed chair sitting
Diffstat:
2 files changed, 17 insertions(+), 2 deletions(-)
diff --git a/src/de/typable/minecrafthub/event/ChairListener.java b/src/de/typable/minecrafthub/event/ChairListener.java
@@ -3,6 +3,7 @@ package de.typable.minecrafthub.event;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
+import org.bukkit.block.data.Bisected.Half;
import org.bukkit.block.data.type.Stairs;
import org.bukkit.entity.AbstractArrow.PickupStatus;
import org.bukkit.entity.Arrow;
@@ -36,7 +37,7 @@ public class ChairListener implements Listener
{
if(event.getAction() == Action.RIGHT_CLICK_BLOCK)
{
- if(event.getClickedBlock() != null)
+ if(event.getClickedBlock() != null && !event.getPlayer().isSneaking())
{
Block block = event.getClickedBlock();
@@ -94,12 +95,17 @@ public class ChairListener implements Listener
private boolean isCompatible(Stairs stairs)
{
+ if(stairs.getHalf() != Half.BOTTOM)
+ {
+ return false;
+ }
+
if(stairs.isWaterlogged())
{
return false;
}
- if(stairs.getShape() != Stairs.Shape.STRAIGHT)
+ if(stairs.getShape() == Stairs.Shape.INNER_RIGHT || stairs.getShape() == Stairs.Shape.INNER_LEFT)
{
return false;
}
diff --git a/src/de/typable/minecrafthub/event/EventListener.java b/src/de/typable/minecrafthub/event/EventListener.java
@@ -1,10 +1,12 @@
package de.typable.minecrafthub.event;
+import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.Action;
import org.bukkit.event.entity.EntityExplodeEvent;
+import org.bukkit.event.player.AsyncPlayerChatEvent;
import org.bukkit.event.player.PlayerInteractEvent;
public class EventListener implements Listener
@@ -26,4 +28,11 @@ public class EventListener implements Listener
{
event.blockList().clear();
}
+
+ @EventHandler
+ public void onChat(AsyncPlayerChatEvent event)
+ {
+ String format = ChatColor.WHITE + event.getPlayer().getName() + ": " + ChatColor.GRAY + event.getMessage();
+ event.setFormat(format);
+ }
}