Skip to content

Commit

Permalink
Teleport async, i love you
Browse files Browse the repository at this point in the history
  • Loading branch information
Anon8281 committed Jun 25, 2023
1 parent 85124ef commit fc52e46
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 12 deletions.
28 changes: 19 additions & 9 deletions plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@
<groupId>com.github.Anon8281</groupId>
<artifactId>UniversalScheduler</artifactId>
</dependency>

<dependency>
<groupId>io.papermc</groupId>
<artifactId>paperlib</artifactId>
</dependency>
</dependencies>

<build>
Expand Down Expand Up @@ -131,15 +136,16 @@
<configuration>
<createDependencyReducedPom>false</createDependencyReducedPom>
<shadedArtifactAttached>false</shadedArtifactAttached>
<artifactSet>
<includes>
<include>${project.groupId}:*</include>
<include>org.bstats</include>
<include>me.filoghost.updatechecker</include>
<include>me.filoghost.fcommons</include>
<include>com.github.Anon8281:UniversalScheduler</include>
</includes>
</artifactSet>
<!-- <artifactSet>-->
<!-- <includes>-->
<!-- <include>${project.groupId}:*</include>-->
<!-- <include>org.bstats</include>-->
<!-- <include>me.filoghost.updatechecker</include>-->
<!-- <include>me.filoghost.fcommons</include>-->
<!-- <include>com.github.Anon8281:UniversalScheduler</include>-->
<!-- <include>io.papermc.lib:*</include>-->
<!-- </includes>-->
<!-- </artifactSet>-->
<filters>
<filter>
<artifact>*:*</artifact>
Expand All @@ -165,6 +171,10 @@
<pattern>com.github.Anon8281.universalScheduler</pattern>
<shadedPattern>me.filoghost.holographicdisplays.plugin.lib.universalScheduler</shadedPattern>
</relocation>
<relocation>
<pattern>io.papermc.lib</pattern>
<shadedPattern>me.filoghost.holographicdisplays.plugin.lib.paperlib</shadedPattern>
</relocation>
</relocations>
</configuration>
<executions>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@
*/
package me.filoghost.holographicdisplays.plugin.commands;

import io.papermc.lib.PaperLib;
import me.filoghost.fcommons.Strings;
import me.filoghost.fcommons.command.validation.CommandException;
import me.filoghost.fcommons.command.validation.CommandValidate;
import me.filoghost.fcommons.logging.Log;
import me.filoghost.holographicdisplays.api.Position;
import me.filoghost.holographicdisplays.plugin.HolographicDisplays;
import me.filoghost.holographicdisplays.plugin.config.ConfigManager;
Expand All @@ -19,6 +21,7 @@
import me.filoghost.holographicdisplays.plugin.internal.hologram.InternalHologramManager;
import me.filoghost.holographicdisplays.plugin.util.FileUtils;
import org.bukkit.Location;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
import org.jetbrains.annotations.NotNull;
Expand Down Expand Up @@ -86,10 +89,8 @@ public void saveChanges(InternalHologram hologram, ChangeType changeType) {
}

public void teleportLookingDown(Player player, Location location) {
HolographicDisplays.getScheduler().runTask(()->{
location.setPitch(90); // Look down
player.teleport(location, TeleportCause.PLUGIN);
});
PaperLib.teleportAsync(player, location, TeleportCause.PLUGIN);
}

public Path getUserReadableFile(String fileName) throws CommandException {
Expand Down
12 changes: 12 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,11 @@
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>

<repository>
<id>papermc</id>
<url>https://papermc.io/repo/repository/maven-public/</url>
</repository>
</repositories>

<dependencyManagement>
Expand Down Expand Up @@ -256,6 +261,13 @@
<version>0.1.3</version>
<scope>compile</scope>
</dependency>

<dependency>
<groupId>io.papermc</groupId>
<artifactId>paperlib</artifactId>
<version>1.0.7</version>
<scope>compile</scope>
</dependency>
</dependencies>
</dependencyManagement>

Expand Down

0 comments on commit fc52e46

Please sign in to comment.