diff --git a/core/pom.xml b/core/pom.xml
index 7ea40b74..817bf059 100644
--- a/core/pom.xml
+++ b/core/pom.xml
@@ -9,7 +9,7 @@
dev.geco.gsit
GSit
- 1.9.3
+ 1.9.5
diff --git a/core/src/main/java/dev/geco/gsit/events/PlayerSitEvents.java b/core/src/main/java/dev/geco/gsit/events/PlayerSitEvents.java
index 56585b03..e4ab8d81 100644
--- a/core/src/main/java/dev/geco/gsit/events/PlayerSitEvents.java
+++ b/core/src/main/java/dev/geco/gsit/events/PlayerSitEvents.java
@@ -64,8 +64,6 @@ public void PIntAEE(PlayerInteractAtEntityEvent Event) {
if(GPM.getCManager().FEATUREFLAGS.contains("DISABLE_PLAYERSIT_ELYTRA") && player.isGliding()) return;
- if((player.getGameMode() == GameMode.CREATIVE && player.getOpenInventory().getType() != InventoryType.CREATIVE) || (player.getGameMode() != GameMode.CREATIVE && player.getOpenInventory().getType() != InventoryType.CRAFTING)) return;
-
if(GPM.getCrawlManager().isCrawling(player)) return;
double distance = GPM.getCManager().PS_MAX_DISTANCE;
diff --git a/core/src/main/java/dev/geco/gsit/manager/CrawlManager.java b/core/src/main/java/dev/geco/gsit/manager/CrawlManager.java
index 726e910b..3d469977 100644
--- a/core/src/main/java/dev/geco/gsit/manager/CrawlManager.java
+++ b/core/src/main/java/dev/geco/gsit/manager/CrawlManager.java
@@ -51,6 +51,8 @@ public IGCrawl startCrawl(Player Player) {
if(preEvent.isCancelled()) return null;
+ if(GPM.getCManager().CUSTOM_MESSAGE) GPM.getMManager().sendActionBarMessage(Player, "Messages.action-crawl-info");
+
IGCrawl crawl = GPM.getEntityUtil().createCrawlObject(Player);
crawl.start();
diff --git a/dist/pom.xml b/dist/pom.xml
index 4477883c..428d6ef1 100644
--- a/dist/pom.xml
+++ b/dist/pom.xml
@@ -9,7 +9,7 @@
dev.geco.gsit
GSit
- 1.9.3
+ 1.9.5
diff --git a/mcv1_17/pom.xml b/mcv1_17/pom.xml
index da328be6..7701e1f3 100644
--- a/mcv1_17/pom.xml
+++ b/mcv1_17/pom.xml
@@ -9,7 +9,7 @@
dev.geco.gsit
GSit
- 1.9.3
+ 1.9.5
diff --git a/mcv1_17_1/pom.xml b/mcv1_17_1/pom.xml
index 0b079e61..6ee02c4b 100644
--- a/mcv1_17_1/pom.xml
+++ b/mcv1_17_1/pom.xml
@@ -9,7 +9,7 @@
dev.geco.gsit
GSit
- 1.9.3
+ 1.9.5
diff --git a/mcv1_18/pom.xml b/mcv1_18/pom.xml
index 58209063..9c173a63 100644
--- a/mcv1_18/pom.xml
+++ b/mcv1_18/pom.xml
@@ -9,7 +9,7 @@
dev.geco.gsit
GSit
- 1.9.3
+ 1.9.5
diff --git a/mcv1_18_2/pom.xml b/mcv1_18_2/pom.xml
index 1105e28d..1315aa9c 100644
--- a/mcv1_18_2/pom.xml
+++ b/mcv1_18_2/pom.xml
@@ -9,7 +9,7 @@
dev.geco.gsit
GSit
- 1.9.3
+ 1.9.5
diff --git a/mcv1_19/pom.xml b/mcv1_19/pom.xml
index cab74cfe..0ab008e4 100644
--- a/mcv1_19/pom.xml
+++ b/mcv1_19/pom.xml
@@ -9,7 +9,7 @@
dev.geco.gsit
GSit
- 1.9.3
+ 1.9.5
diff --git a/mcv1_19_1/pom.xml b/mcv1_19_1/pom.xml
index 2a533e5f..5ffa7716 100644
--- a/mcv1_19_1/pom.xml
+++ b/mcv1_19_1/pom.xml
@@ -9,7 +9,7 @@
dev.geco.gsit
GSit
- 1.9.3
+ 1.9.5
diff --git a/mcv1_19_3/pom.xml b/mcv1_19_3/pom.xml
index a5f3e011..86c87f53 100644
--- a/mcv1_19_3/pom.xml
+++ b/mcv1_19_3/pom.xml
@@ -9,7 +9,7 @@
dev.geco.gsit
GSit
- 1.9.3
+ 1.9.5
diff --git a/mcv1_19_4/pom.xml b/mcv1_19_4/pom.xml
index 8d208ab1..52861271 100644
--- a/mcv1_19_4/pom.xml
+++ b/mcv1_19_4/pom.xml
@@ -9,7 +9,7 @@
dev.geco.gsit
GSit
- 1.9.3
+ 1.9.5
diff --git a/mcv1_20/pom.xml b/mcv1_20/pom.xml
index 3860c9fe..31ee0d66 100644
--- a/mcv1_20/pom.xml
+++ b/mcv1_20/pom.xml
@@ -9,7 +9,7 @@
dev.geco.gsit
GSit
- 1.9.3
+ 1.9.5
diff --git a/mcv1_20_2/pom.xml b/mcv1_20_2/pom.xml
index 582c293e..643ebca2 100644
--- a/mcv1_20_2/pom.xml
+++ b/mcv1_20_2/pom.xml
@@ -9,7 +9,7 @@
dev.geco.gsit
GSit
- 1.9.3
+ 1.9.5
diff --git a/mcv1_20_3/pom.xml b/mcv1_20_3/pom.xml
index d0f25edd..a0649cd0 100644
--- a/mcv1_20_3/pom.xml
+++ b/mcv1_20_3/pom.xml
@@ -9,7 +9,7 @@
dev.geco.gsit
GSit
- 1.9.3
+ 1.9.5
diff --git a/mcv1_20_5/pom.xml b/mcv1_20_5/pom.xml
index 02cc6840..74c54782 100644
--- a/mcv1_20_5/pom.xml
+++ b/mcv1_20_5/pom.xml
@@ -9,7 +9,7 @@
dev.geco.gsit
GSit
- 1.9.3
+ 1.9.5
diff --git a/mcv1_21/pom.xml b/mcv1_21/pom.xml
index a5c8c534..ace9a863 100644
--- a/mcv1_21/pom.xml
+++ b/mcv1_21/pom.xml
@@ -9,7 +9,7 @@
dev.geco.gsit
GSit
- 1.9.3
+ 1.9.5
diff --git a/mcv1_21/src/main/java/dev/geco/gsit/mcv/x/objects/GCrawl.java b/mcv1_21/src/main/java/dev/geco/gsit/mcv/x/objects/GCrawl.java
new file mode 100644
index 00000000..eb24af22
--- /dev/null
+++ b/mcv1_21/src/main/java/dev/geco/gsit/mcv/x/objects/GCrawl.java
@@ -0,0 +1,218 @@
+package dev.geco.gsit.mcv.x.objects;
+
+import org.bukkit.*;
+import org.bukkit.block.*;
+import org.bukkit.block.data.*;
+import org.bukkit.event.*;
+import org.bukkit.event.entity.*;
+import org.bukkit.event.player.*;
+import org.bukkit.entity.*;
+import org.bukkit.inventory.*;
+import org.bukkit.craftbukkit.v1_21_R1.entity.*;
+
+import net.minecraft.network.protocol.game.*;
+import net.minecraft.server.level.*;
+
+import dev.geco.gsit.GSitMain;
+import dev.geco.gsit.objects.*;
+
+public class GCrawl implements IGCrawl {
+
+ private final GSitMain GPM = GSitMain.getInstance();
+
+ private final Player player;
+
+ private final ServerPlayer serverPlayer;
+
+ protected final BoxEntity boxEntity;
+
+ private Location blockLocation;
+
+ private boolean boxPresent;
+
+ protected final BlockData blockData = Material.BARRIER.createBlockData();
+
+ private final Listener listener;
+ private final Listener moveListener;
+ private final Listener stopListener;
+
+ private final long spawnTime = System.nanoTime();
+
+ public GCrawl(Player Player) {
+
+ player = Player;
+
+ serverPlayer = ((CraftPlayer) player).getHandle();
+
+ boxEntity = new BoxEntity(player.getLocation());
+
+ listener = new Listener() {
+
+ @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
+ public void ETogSE(EntityToggleSwimEvent Event) { if(Event.getEntity() == player) Event.setCancelled(true); }
+
+ @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
+ public void PIntE(PlayerInteractEvent Event) {
+
+ if(!Event.isAsynchronous() && Event.getPlayer() == player && blockLocation != null && Event.getClickedBlock().equals(blockLocation.getBlock()) && Event.getHand() == EquipmentSlot.HAND) {
+
+ Event.setCancelled(true);
+
+ GPM.getTManager().run(() -> {
+
+ buildBlock(blockLocation);
+ }, false, player);
+ }
+ }
+ };
+
+ moveListener = new Listener() {
+
+ @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
+ public void PMovE(PlayerMoveEvent Event) {
+
+ if(!Event.isAsynchronous() && Event.getPlayer() == player) {
+
+ Location locationFrom = Event.getFrom(), locationTo = Event.getTo();
+
+ if(locationFrom.getX() != locationTo.getX() || locationFrom.getZ() != locationTo.getZ() || locationFrom.getY() != locationTo.getY()) tick(locationFrom);
+ }
+ }
+ };
+
+ stopListener = new Listener() {
+
+ @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
+ public void PTogSE(PlayerToggleSneakEvent Event) { if(!Event.isAsynchronous() && Event.getPlayer() == player && Event.isSneaking()) GPM.getCrawlManager().stopCrawl(player, GetUpReason.GET_UP); }
+ };
+ }
+
+ public void start() {
+
+ player.setSwimming(true);
+
+ Bukkit.getPluginManager().registerEvents(listener, GPM);
+
+ GPM.getTManager().runDelayed(() -> {
+
+ Bukkit.getPluginManager().registerEvents(moveListener, GPM);
+
+ if(GPM.getCManager().C_GET_UP_SNEAK) Bukkit.getPluginManager().registerEvents(stopListener, GPM);
+
+ tick(player.getLocation());
+ }, false, player, 1);
+ }
+
+ private void tick(Location Location) {
+
+ if(!checkCrawlValid()) return;
+
+ Location location = Location.clone();
+
+ Block locationBlock = location.getBlock();
+
+ int blockSize = (int) ((location.getY() - location.getBlockY()) * 100);
+
+ location.setY(location.getBlockY() + (blockSize >= 40 ? 2.49 : 1.49));
+
+ Block aboveBlock = location.getBlock();
+
+ boolean aboveBlockSolid = aboveBlock.getBoundingBox().contains(location.toVector()) && !aboveBlock.getCollisionShape().getBoundingBoxes().isEmpty();
+ boolean canPlaceBlock = isValidArea(locationBlock.getRelative(BlockFace.UP), aboveBlock, blockLocation != null ? blockLocation.getBlock() : null);
+ boolean canSetBarrier = canPlaceBlock && (aboveBlock.getType().isAir() || aboveBlockSolid);
+
+ if(blockLocation == null || !aboveBlock.equals(blockLocation.getBlock())) {
+
+ destoryBlock();
+
+ if(canSetBarrier && !aboveBlockSolid) buildBlock(location);
+ }
+
+ if(!canSetBarrier && !aboveBlockSolid) {
+
+ Location playerLocation = Location.clone();
+
+ GPM.getTManager().run(() -> {
+
+ int height = locationBlock.getBoundingBox().getHeight() >= 0.4 || playerLocation.getY() % 0.015625 == 0.0 ? (player.getFallDistance() > 0.7 ? 0 : blockSize) : 0;
+
+ playerLocation.setY(playerLocation.getY() + (height >= 40 ? 1.5 : 0.5));
+
+ boxEntity.setRawPeekAmount(height >= 40 ? 100 - height : 0);
+
+ if(boxPresent) {
+
+ serverPlayer.connection.send(new ClientboundSetEntityDataPacket(boxEntity.getId(), boxEntity.getEntityData().getNonDefaultValues()));
+ boxEntity.teleportTo(playerLocation.getX(), playerLocation.getY(), playerLocation.getZ());
+ serverPlayer.connection.send(new ClientboundTeleportEntityPacket(boxEntity));
+ } else {
+
+ boxEntity.setPos(playerLocation.getX(), playerLocation.getY(), playerLocation.getZ());
+ serverPlayer.connection.send(new ClientboundAddEntityPacket(boxEntity.getId(), boxEntity.getUUID(), boxEntity.getX(), boxEntity.getY(), boxEntity.getZ(), boxEntity.getXRot(), boxEntity.getYRot(), boxEntity.getType(), 0, boxEntity.getDeltaMovement(), boxEntity.getYHeadRot()));
+ boxPresent = true;
+ serverPlayer.connection.send(new ClientboundSetEntityDataPacket(boxEntity.getId(), boxEntity.getEntityData().getNonDefaultValues()));
+ }
+ }, true, playerLocation);
+ } else destoryEntity();
+ }
+
+ public void stop() {
+
+ HandlerList.unregisterAll(listener);
+ HandlerList.unregisterAll(moveListener);
+ HandlerList.unregisterAll(stopListener);
+
+ player.setSwimming(false);
+
+ if(blockLocation != null) player.sendBlockChange(blockLocation, blockLocation.getBlock().getBlockData());
+
+ serverPlayer.connection.send(new ClientboundRemoveEntitiesPacket(boxEntity.getId()));
+ }
+
+ private void buildBlock(Location Location) {
+
+ blockLocation = Location;
+
+ player.sendBlockChange(blockLocation, blockData);
+ }
+
+ private void destoryBlock() {
+
+ if(blockLocation != null) player.sendBlockChange(blockLocation, blockLocation.getBlock().getBlockData());
+
+ blockLocation = null;
+ }
+
+ private void destoryEntity() {
+
+ if(!boxPresent) return;
+
+ serverPlayer.connection.send(new ClientboundRemoveEntitiesPacket(boxEntity.getId()));
+
+ boxPresent = false;
+ }
+
+ private boolean checkCrawlValid() {
+
+ if(serverPlayer.isInWater() || player.isFlying()) {
+
+ GPM.getTManager().run(() -> {
+
+ GPM.getCrawlManager().stopCrawl(player, GetUpReason.ACTION);
+ }, true, blockLocation != null ? blockLocation : player.getLocation());
+
+ return false;
+ }
+
+ return true;
+ }
+
+ private boolean isValidArea(Block BlockUp, Block AboveBlock, Block LocationBlock) { return BlockUp.equals(AboveBlock) || BlockUp.equals(LocationBlock); }
+
+ public Player getPlayer() { return player; }
+
+ public long getNano() { return System.nanoTime() - spawnTime; }
+
+ public String toString() { return boxEntity.getUUID().toString(); }
+
+}
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index 8fd8e0a5..03645ceb 100644
--- a/pom.xml
+++ b/pom.xml
@@ -7,7 +7,7 @@
dev.geco.gsit
GSit
GSit
- 1.9.3
+ 1.9.5
Relax with other players on nice seats!
https://www.spigotmc.org/resources/62325
2018
diff --git a/v1_17/pom.xml b/v1_17/pom.xml
index c845bfb0..2da12d20 100644
--- a/v1_17/pom.xml
+++ b/v1_17/pom.xml
@@ -9,7 +9,7 @@
dev.geco.gsit
GSit
- 1.9.3
+ 1.9.5
diff --git a/v1_17_1/pom.xml b/v1_17_1/pom.xml
index 684e8ef5..d8a22f5c 100644
--- a/v1_17_1/pom.xml
+++ b/v1_17_1/pom.xml
@@ -9,7 +9,7 @@
dev.geco.gsit
GSit
- 1.9.3
+ 1.9.5
diff --git a/v1_18/pom.xml b/v1_18/pom.xml
index 4e0ea783..43326ffe 100644
--- a/v1_18/pom.xml
+++ b/v1_18/pom.xml
@@ -9,7 +9,7 @@
dev.geco.gsit
GSit
- 1.9.3
+ 1.9.5
diff --git a/v1_18_2/pom.xml b/v1_18_2/pom.xml
index 2c72694a..937952ad 100644
--- a/v1_18_2/pom.xml
+++ b/v1_18_2/pom.xml
@@ -9,7 +9,7 @@
dev.geco.gsit
GSit
- 1.9.3
+ 1.9.5
diff --git a/v1_19/pom.xml b/v1_19/pom.xml
index 7717d1f2..0cd39682 100644
--- a/v1_19/pom.xml
+++ b/v1_19/pom.xml
@@ -9,7 +9,7 @@
dev.geco.gsit
GSit
- 1.9.3
+ 1.9.5
diff --git a/v1_19_1/pom.xml b/v1_19_1/pom.xml
index a9bc9757..6d148886 100644
--- a/v1_19_1/pom.xml
+++ b/v1_19_1/pom.xml
@@ -9,7 +9,7 @@
dev.geco.gsit
GSit
- 1.9.3
+ 1.9.5
diff --git a/v1_19_3/pom.xml b/v1_19_3/pom.xml
index 161fd5f9..251878d2 100644
--- a/v1_19_3/pom.xml
+++ b/v1_19_3/pom.xml
@@ -9,7 +9,7 @@
dev.geco.gsit
GSit
- 1.9.3
+ 1.9.5
diff --git a/v1_19_4/pom.xml b/v1_19_4/pom.xml
index 571902c8..6690b880 100644
--- a/v1_19_4/pom.xml
+++ b/v1_19_4/pom.xml
@@ -9,7 +9,7 @@
dev.geco.gsit
GSit
- 1.9.3
+ 1.9.5
diff --git a/v1_20/pom.xml b/v1_20/pom.xml
index d5b7d773..2aca11a6 100644
--- a/v1_20/pom.xml
+++ b/v1_20/pom.xml
@@ -9,7 +9,7 @@
dev.geco.gsit
GSit
- 1.9.3
+ 1.9.5
diff --git a/v1_20_2/pom.xml b/v1_20_2/pom.xml
index d2dc1639..14c89664 100644
--- a/v1_20_2/pom.xml
+++ b/v1_20_2/pom.xml
@@ -9,7 +9,7 @@
dev.geco.gsit
GSit
- 1.9.3
+ 1.9.5
diff --git a/v1_20_3/pom.xml b/v1_20_3/pom.xml
index c3ed931d..3f85500e 100644
--- a/v1_20_3/pom.xml
+++ b/v1_20_3/pom.xml
@@ -9,7 +9,7 @@
dev.geco.gsit
GSit
- 1.9.3
+ 1.9.5
diff --git a/v1_20_5/pom.xml b/v1_20_5/pom.xml
index 75132524..12550aa5 100644
--- a/v1_20_5/pom.xml
+++ b/v1_20_5/pom.xml
@@ -9,7 +9,7 @@
dev.geco.gsit
GSit
- 1.9.3
+ 1.9.5
diff --git a/v1_21/pom.xml b/v1_21/pom.xml
index ff640c06..5bce0663 100644
--- a/v1_21/pom.xml
+++ b/v1_21/pom.xml
@@ -9,7 +9,7 @@
dev.geco.gsit
GSit
- 1.9.3
+ 1.9.5