File tree 3 files changed +47
-0
lines changed
java/cat/nyaa/nyaacore/utils
3 files changed +47
-0
lines changed Original file line number Diff line number Diff line change @@ -32,12 +32,20 @@ repositories {
32
32
name ' nu-langchecker'
33
33
url ' https://raw.githubusercontent.com/Librazy/NyaaUtilsLangChecker/maven-repo'
34
34
}
35
+
36
+ maven {
37
+ name ' ess-repo'
38
+ url ' http://repo.ess3.net/content/groups/essentials'
39
+ }
35
40
}
36
41
37
42
dependencies {
38
43
compile ' org.spigotmc:spigot-api:1.12-R0.1-SNAPSHOT'
39
44
compile ' net.milkbowl.vault:VaultAPI:1.6'
40
45
compile ' org.librazy:NyaaUtilsLangChecker:1.0-SNAPSHOT'
46
+ compile(' net.ess3:Essentials:2.13-SNAPSHOT' ) {
47
+ transitive = false
48
+ }
41
49
}
42
50
43
51
compileJava {
Original file line number Diff line number Diff line change
1
+ package cat .nyaa .nyaacore .utils ;
2
+
3
+ import com .earth2me .essentials .Essentials ;
4
+ import org .bukkit .Bukkit ;
5
+ import org .bukkit .Location ;
6
+ import org .bukkit .entity .Player ;
7
+ import org .bukkit .event .player .PlayerTeleportEvent ;
8
+
9
+ import java .util .List ;
10
+
11
+ public class TeleportUtils {
12
+
13
+ public void Teleport (Player player , Location loc ) {
14
+ if (!player .isOnline ()) {
15
+ return ;
16
+ }
17
+ Essentials ess = null ;
18
+ if (Bukkit .getServer ().getPluginManager ().getPlugin ("Essentials" ) != null ) {
19
+ ess = (Essentials ) Bukkit .getServer ().getPluginManager ().getPlugin ("Essentials" );
20
+ }
21
+ if (ess != null ) {
22
+ try {
23
+ ess .getUser (player ).getTeleport ().now (loc , false , PlayerTeleportEvent .TeleportCause .PLUGIN );
24
+ return ;
25
+ } catch (Exception e ) {
26
+ e .printStackTrace ();
27
+ }
28
+ player .setFallDistance (0 );
29
+ player .teleport (loc , PlayerTeleportEvent .TeleportCause .PLUGIN );
30
+ }
31
+ }
32
+
33
+ public void Teleport (List <Player > players , Location loc ) {
34
+ for (Player p : players ) {
35
+ Teleport (p , loc );
36
+ }
37
+ }
38
+ }
Original file line number Diff line number Diff line change @@ -3,5 +3,6 @@ main: cat.nyaa.nyaacore.NyaaCoreLoader
3
3
description : " Code infrastructure for all NyaaCat plugins."
4
4
version : 3.0
5
5
depend : [Vault]
6
+ softdepend : [Essentials]
6
7
authors : [RecursiveG,Librazy]
7
8
website : " https://github.com/NyaaCat/NyaaCore"
You can’t perform that action at this time.
0 commit comments