mirror of
https://github.com/BentoBoxWorld/Boxed.git
synced 2024-12-10 14:33:32 +01:00
Bring up to 1.21.1 and fix ender pearl operation. #91
This commit is contained in:
parent
315a762b84
commit
fc71cc934e
11
pom.xml
11
pom.xml
@ -58,7 +58,7 @@
|
||||
<!-- Non-minecraft related dependencies -->
|
||||
<powermock.version>2.0.9</powermock.version>
|
||||
<!-- More visible way how to change dependency versions -->
|
||||
<spigot.version>1.21-R0.1-SNAPSHOT</spigot.version>
|
||||
<spigot.version>1.21.1-R0.1-SNAPSHOT</spigot.version>
|
||||
<bentobox.version>2.5.0-SNAPSHOT</bentobox.version>
|
||||
<!-- Revision variable removes warning about dynamic version -->
|
||||
<revision>${build.version}-SNAPSHOT</revision>
|
||||
@ -173,7 +173,7 @@
|
||||
</dependency>
|
||||
<!-- Spigot NMS. Used for chunk deletion and pasting. -->
|
||||
|
||||
<dependency>
|
||||
<dependency>
|
||||
<groupId>org.spigotmc....</groupId>
|
||||
<artifactId>spigot</artifactId>
|
||||
<version>1.20.6-R0.1-SNAPSHOT</version>
|
||||
@ -191,7 +191,12 @@
|
||||
<version>1.21-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.spigotmc......</groupId>
|
||||
<artifactId>spigot</artifactId>
|
||||
<version>1.21.1-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.spigotmc.</groupId>
|
||||
<artifactId>spigot</artifactId>
|
||||
|
@ -1,6 +1,8 @@
|
||||
package world.bentobox.boxed.listeners;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
@ -15,6 +17,7 @@ import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.entity.ProjectileHitEvent;
|
||||
import org.bukkit.event.player.PlayerTeleportEvent;
|
||||
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
|
||||
|
||||
import world.bentobox.bentobox.api.user.User;
|
||||
import world.bentobox.bentobox.database.objects.Island;
|
||||
@ -29,6 +32,7 @@ import world.bentobox.boxed.Boxed;
|
||||
public class EnderPearlListener implements Listener {
|
||||
|
||||
private final Boxed addon;
|
||||
private Set<Player> movingPlayer = new HashSet<>();
|
||||
|
||||
/**
|
||||
* @param addon addon
|
||||
@ -39,6 +43,10 @@ public class EnderPearlListener implements Listener {
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
|
||||
public void onPlayerTeleport(PlayerTeleportEvent e) {
|
||||
if (e.getCause() == TeleportCause.ENDER_PEARL && movingPlayer.contains(e.getPlayer())) {
|
||||
movingPlayer.remove(e.getPlayer());
|
||||
return; // Allow the teleport this one time
|
||||
}
|
||||
if (!addon.inWorld(e.getFrom()) || !e.getPlayer().getGameMode().equals(GameMode.SURVIVAL)
|
||||
|| (e.getTo() != null && !addon.inWorld(e.getTo()))
|
||||
|| addon.getIslands().getSpawn(e.getFrom().getWorld()).map(spawn -> spawn.onIsland(e.getTo())).orElse(false)
|
||||
@ -91,7 +99,7 @@ public class EnderPearlListener implements Listener {
|
||||
if (!toIsland.onIsland(l)) {
|
||||
// Moving is allowed
|
||||
moveBox(u, fromIsland, l);
|
||||
Util.teleportAsync(player, l);
|
||||
Util.teleportAsync(player, l, TeleportCause.ENDER_PEARL);
|
||||
}
|
||||
} else {
|
||||
// Different box. This is never allowed. Cancel the throw
|
||||
@ -117,6 +125,7 @@ public class EnderPearlListener implements Listener {
|
||||
fromIsland.setProtectionCenter(l);
|
||||
fromIsland.setSpawnPoint(l.getWorld().getEnvironment(), l);
|
||||
u.getPlayer().playSound(l, Sound.ENTITY_GENERIC_EXPLODE, 2F, 2F);
|
||||
movingPlayer.add(u.getPlayer());
|
||||
} catch (IOException e1) {
|
||||
addon.logError("Could not move box " + e1.getMessage());
|
||||
}
|
||||
|
@ -635,8 +635,7 @@ public class NewAreaListener implements Listener {
|
||||
throw new IllegalStateException("Class " + clazz.getName() + " does not implement AbstractGetMetaData");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
BentoBox.getInstance().logWarning("No metadata handler found for " + bukkitVersion + " in Boxed.");
|
||||
BentoBox.getInstance().logError("No metadata handler found for " + bukkitVersion + " in Boxed (yet).");
|
||||
handler = new world.bentobox.boxed.nms.fallback.GetMetaData();
|
||||
}
|
||||
return handler.nmsData(block);
|
||||
|
@ -0,0 +1,5 @@
|
||||
package world.bentobox.boxed.nms.v1_21_1_R0_1_SNAPSHOT;
|
||||
|
||||
public class GetMetaData extends world.bentobox.boxed.nms.v1_21_R0_1_SNAPSHOT.GetMetaData {
|
||||
// Identical to 1.21
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
name: Boxed
|
||||
main: world.bentobox.boxed.Boxed
|
||||
version: ${version}${build.number}
|
||||
api-version: 2.5.0
|
||||
api-version: 2.5.1
|
||||
metrics: true
|
||||
icon: "COMPOSTER"
|
||||
repository: "BentoBoxWorld/Boxed"
|
||||
|
Loading…
Reference in New Issue
Block a user