mirror of
https://github.com/RonanPlugins/BetterRTP.git
synced 2025-08-17 17:15:47 +00:00
api fix + first addon added!
This commit is contained in:
parent
b7b408e3d8
commit
08607beef4
@ -1,25 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
|
||||||
<parent>
|
|
||||||
<artifactId>BetterRTP</artifactId>
|
|
||||||
<groupId>me.SuperRonanCraft</groupId>
|
|
||||||
<version>2.14.5</version>
|
|
||||||
</parent>
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
|
||||||
|
|
||||||
<artifactId>Addon-FlashBack</artifactId>
|
|
||||||
<version>1.0</version>
|
|
||||||
<build>
|
|
||||||
<finalName>${project.parent.artifactId}-${project.name}-${project.version}</finalName>
|
|
||||||
</build>
|
|
||||||
|
|
||||||
<dependencies>
|
|
||||||
<dependency>
|
|
||||||
<groupId>me.SuperRonanCraft</groupId>
|
|
||||||
<artifactId>Main</artifactId>
|
|
||||||
<version>2.14.5</version>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
</project>
|
|
@ -1,12 +0,0 @@
|
|||||||
package me.SuperRonanCraft.BetterRTP.Addon.FlashBack;
|
|
||||||
|
|
||||||
import me.SuperRonanCraft.BetterRTP.player.events.RTPEventListener;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
public class Events implements RTPEventListener {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void teleportedEvent(Player p) {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,12 +0,0 @@
|
|||||||
package me.SuperRonanCraft.BetterRTP.Addon.FlashBack;
|
|
||||||
|
|
||||||
import me.SuperRonanCraft.BetterRTP.BetterRTP;
|
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
|
||||||
|
|
||||||
public class Main extends JavaPlugin {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onEnable() {
|
|
||||||
BetterRTP.getInstance().getEvents().addListener(new Events());
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,6 +0,0 @@
|
|||||||
main: me.SuperRonanCraft.BetterRTP.Addon.FlashBack
|
|
||||||
version: 1.0
|
|
||||||
api-version: '1.13'
|
|
||||||
name: BetterRTP-Addon-FlashBack
|
|
||||||
depend: [BetterRTP]
|
|
||||||
|
|
94
BetterRTPAddons/pom.xml
Normal file
94
BetterRTPAddons/pom.xml
Normal file
@ -0,0 +1,94 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
<groupId>me.SuperRonanCraft</groupId>
|
||||||
|
<artifactId>BetterRTPAddons</artifactId>
|
||||||
|
<packaging>jar</packaging>
|
||||||
|
<version>1.0</version>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<maven.compiler.source>1.8</maven.compiler.source>
|
||||||
|
<maven.compiler.target>1.8</maven.compiler.target>
|
||||||
|
</properties>
|
||||||
|
<build>
|
||||||
|
<finalName>${project.artifactId}-${project.version}</finalName>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<!-- Shade PaperLib into project -->
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-shade-plugin</artifactId>
|
||||||
|
<version>3.1.1</version>
|
||||||
|
<configuration>
|
||||||
|
<dependencyReducedPomLocation>${project.build.directory}/dependency-reduced-pom.xml</dependencyReducedPomLocation>
|
||||||
|
<relocations>
|
||||||
|
<relocation>
|
||||||
|
<pattern>io.papermc.lib</pattern>
|
||||||
|
<shadedPattern>me.SuperRonanCraft.BetterRTPAddons.paperlib</shadedPattern>
|
||||||
|
</relocation>
|
||||||
|
</relocations>
|
||||||
|
</configuration>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<phase>package</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>shade</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<!-- Local Server Building -->
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-jar-plugin</artifactId>
|
||||||
|
<version>3.2.0</version>
|
||||||
|
<configuration>
|
||||||
|
<outputDirectory>../../../Java/plugins</outputDirectory>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
|
||||||
|
<repositories>
|
||||||
|
<repository>
|
||||||
|
<id>spigot-repo</id>
|
||||||
|
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
|
||||||
|
</repository>
|
||||||
|
<!-- PaperMC Repo -->
|
||||||
|
<repository>
|
||||||
|
<id>papermc</id>
|
||||||
|
<url>https://papermc.io/repo/repository/maven-public/</url>
|
||||||
|
</repository>
|
||||||
|
</repositories>
|
||||||
|
<dependencies>
|
||||||
|
<!--Spigot API-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.spigotmc</groupId>
|
||||||
|
<artifactId>spigot-api</artifactId>
|
||||||
|
<version>1.8.8-R0.1-SNAPSHOT</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
<!-- Spigot Stuff -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.spigotmc</groupId>
|
||||||
|
<artifactId>spigot</artifactId>
|
||||||
|
<version>1.8.8-R0.1-SNAPSHOT</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
<!-- Paper Library for Async Chunk/Teleport -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.papermc</groupId>
|
||||||
|
<artifactId>paperlib</artifactId>
|
||||||
|
<version>1.0.5</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>me.SuperRonanCraft</groupId>
|
||||||
|
<artifactId>BetterRTP</artifactId>
|
||||||
|
<version>2.14.5</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</project>
|
@ -0,0 +1,20 @@
|
|||||||
|
package me.SuperRonanCraft.BetterRTPAddons;
|
||||||
|
|
||||||
|
import me.SuperRonanCraft.BetterRTP.references.customEvents.RTP_TeleportEvent;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.Listener;
|
||||||
|
|
||||||
|
public class Events implements Listener {
|
||||||
|
|
||||||
|
void load() {
|
||||||
|
Bukkit.getPluginManager().registerEvents(this, Main.getInstance());
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
void onTeleport(RTP_TeleportEvent e) {
|
||||||
|
System.out.println("Player " + e.getPlayer().getName() + " was rtp'd!");
|
||||||
|
new PlayerFlashback(e.getPlayer(), e.getOldLocation(), 20L * 10);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,23 @@
|
|||||||
|
package me.SuperRonanCraft.BetterRTPAddons;
|
||||||
|
|
||||||
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
|
public class Main extends JavaPlugin {
|
||||||
|
|
||||||
|
private static Main instance;
|
||||||
|
private final Events events = new Events();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onEnable() {
|
||||||
|
instance = this;
|
||||||
|
load();
|
||||||
|
}
|
||||||
|
|
||||||
|
void load() {
|
||||||
|
events.load();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Main getInstance() {
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,25 @@
|
|||||||
|
package me.SuperRonanCraft.BetterRTPAddons;
|
||||||
|
|
||||||
|
import io.papermc.lib.PaperLib;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
public class PlayerFlashback {
|
||||||
|
|
||||||
|
Player p;
|
||||||
|
Location oldLoc;
|
||||||
|
|
||||||
|
PlayerFlashback(Player p, Location oldLoc, Long delayInTicks) {
|
||||||
|
this.p = p;
|
||||||
|
this.oldLoc = oldLoc;
|
||||||
|
Bukkit.getScheduler().runTaskLater(Main.getInstance(), getTimedFlash(), delayInTicks);
|
||||||
|
}
|
||||||
|
|
||||||
|
private Runnable getTimedFlash() {
|
||||||
|
return () -> {
|
||||||
|
System.out.println("Player teleported back to old spot!");
|
||||||
|
PaperLib.teleportAsync(p, oldLoc);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
6
BetterRTPAddons/src/main/resources/ideas.yml
Normal file
6
BetterRTPAddons/src/main/resources/ideas.yml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
- Pre-rtp effects
|
||||||
|
- Mute/Disable chat feature
|
||||||
|
- More post-rtp effects
|
||||||
|
- gui with configured/dynamic parameters
|
||||||
|
- save previous rtps in database and show in gui
|
||||||
|
- gui all the things!
|
6
BetterRTPAddons/src/main/resources/plugin.yml
Normal file
6
BetterRTPAddons/src/main/resources/plugin.yml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
main: me.SuperRonanCraft.BetterRTPAddons.Main
|
||||||
|
version: 1.0
|
||||||
|
api-version: '1.13'
|
||||||
|
name: BetterRTPAddons
|
||||||
|
depend: [BetterRTP]
|
||||||
|
|
66
Main/pom.xml
66
Main/pom.xml
@ -1,66 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
|
||||||
<parent>
|
|
||||||
<artifactId>BetterRTP</artifactId>
|
|
||||||
<groupId>me.SuperRonanCraft</groupId>
|
|
||||||
<version>2.14.5</version>
|
|
||||||
</parent>
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
|
||||||
|
|
||||||
<artifactId>Main</artifactId>
|
|
||||||
|
|
||||||
<build>
|
|
||||||
<finalName>${project.parent.artifactId}-${project.parent.version}</finalName>
|
|
||||||
<plugins>
|
|
||||||
<plugin>
|
|
||||||
<!-- Shade PaperLib into project -->
|
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
|
||||||
<artifactId>maven-shade-plugin</artifactId>
|
|
||||||
<version>3.1.1</version>
|
|
||||||
<configuration>
|
|
||||||
<dependencyReducedPomLocation>${project.build.directory}/dependency-reduced-pom.xml</dependencyReducedPomLocation>
|
|
||||||
<relocations>
|
|
||||||
<relocation>
|
|
||||||
<pattern>io.papermc.lib</pattern>
|
|
||||||
<shadedPattern>me.SuperRonanCraft.BetterRTP.paperlib</shadedPattern>
|
|
||||||
</relocation>
|
|
||||||
</relocations>
|
|
||||||
</configuration>
|
|
||||||
<executions>
|
|
||||||
<execution>
|
|
||||||
<phase>package</phase>
|
|
||||||
<goals>
|
|
||||||
<goal>shade</goal>
|
|
||||||
</goals>
|
|
||||||
</execution>
|
|
||||||
</executions>
|
|
||||||
</plugin>
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
|
||||||
<artifactId>maven-install-plugin</artifactId>
|
|
||||||
<executions>
|
|
||||||
<execution>
|
|
||||||
<id>hack-binary</id>
|
|
||||||
<phase>clean</phase>
|
|
||||||
<configuration>
|
|
||||||
<file>${basedir}/../LocalJars/Residence4.9.1.9.jar</file>
|
|
||||||
<repositoryLayout>default</repositoryLayout>
|
|
||||||
<groupId>com.bekvon.bukkit</groupId>
|
|
||||||
<artifactId>residence</artifactId>
|
|
||||||
<version>4.9.1.9</version>
|
|
||||||
<packaging>jar</packaging>
|
|
||||||
<generatePom>true</generatePom>
|
|
||||||
</configuration>
|
|
||||||
<goals>
|
|
||||||
<goal>install-file</goal>
|
|
||||||
</goals>
|
|
||||||
</execution>
|
|
||||||
</executions>
|
|
||||||
</plugin>
|
|
||||||
</plugins>
|
|
||||||
|
|
||||||
</build>
|
|
||||||
|
|
||||||
</project>
|
|
@ -1,22 +0,0 @@
|
|||||||
package me.SuperRonanCraft.BetterRTP.player.events;
|
|
||||||
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class RTPEventInitiator {
|
|
||||||
private final List<RTPEventListener> listeners = new ArrayList<>();
|
|
||||||
|
|
||||||
public void addListener(RTPEventListener toAdd) {
|
|
||||||
listeners.add(toAdd);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void eventCall_Teleport(Player p) {
|
|
||||||
System.out.println("Hello!!");
|
|
||||||
|
|
||||||
// Notify everybody that may be interested.
|
|
||||||
for (RTPEventListener l : listeners)
|
|
||||||
l.teleportedEvent(p);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,9 +0,0 @@
|
|||||||
package me.SuperRonanCraft.BetterRTP.player.events;
|
|
||||||
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
public interface RTPEventListener {
|
|
||||||
|
|
||||||
void teleportedEvent(Player p);
|
|
||||||
|
|
||||||
}
|
|
67
pom.xml
67
pom.xml
@ -6,28 +6,69 @@
|
|||||||
|
|
||||||
<groupId>me.SuperRonanCraft</groupId>
|
<groupId>me.SuperRonanCraft</groupId>
|
||||||
<artifactId>BetterRTP</artifactId>
|
<artifactId>BetterRTP</artifactId>
|
||||||
<packaging>pom</packaging>
|
<packaging>jar</packaging>
|
||||||
<version>2.14.5</version>
|
<version>2.14.5</version>
|
||||||
|
|
||||||
<modules>
|
|
||||||
<module>Addon-FlashBack</module>
|
|
||||||
<module>Main</module>
|
|
||||||
</modules>
|
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<maven.compiler.source>1.8</maven.compiler.source>
|
<maven.compiler.source>1.8</maven.compiler.source>
|
||||||
<maven.compiler.target>1.8</maven.compiler.target>
|
<maven.compiler.target>1.8</maven.compiler.target>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
<finalName>${project.artifactId}-${project.version}</finalName>
|
||||||
<plugins>
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-install-plugin</artifactId>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>hack-binary</id>
|
||||||
|
<phase>clean</phase>
|
||||||
|
<configuration>
|
||||||
|
<file>${basedir}/LocalJars/Residence4.9.1.9.jar</file>
|
||||||
|
<repositoryLayout>default</repositoryLayout>
|
||||||
|
<groupId>com.bekvon.bukkit</groupId>
|
||||||
|
<artifactId>residence</artifactId>
|
||||||
|
<version>4.9.1.9</version>
|
||||||
|
<packaging>jar</packaging>
|
||||||
|
<generatePom>true</generatePom>
|
||||||
|
</configuration>
|
||||||
|
<goals>
|
||||||
|
<goal>install-file</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<!-- Shade PaperLib into project -->
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-shade-plugin</artifactId>
|
||||||
|
<version>3.1.1</version>
|
||||||
|
<configuration>
|
||||||
|
<dependencyReducedPomLocation>${project.build.directory}/dependency-reduced-pom.xml</dependencyReducedPomLocation>
|
||||||
|
<relocations>
|
||||||
|
<relocation>
|
||||||
|
<pattern>io.papermc.lib</pattern>
|
||||||
|
<shadedPattern>me.SuperRonanCraft.BetterRTP.paperlib</shadedPattern>
|
||||||
|
</relocation>
|
||||||
|
</relocations>
|
||||||
|
</configuration>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<phase>package</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>shade</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
<!-- Local Server Building -->
|
<!-- Local Server Building -->
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-jar-plugin</artifactId>
|
<artifactId>maven-jar-plugin</artifactId>
|
||||||
<version>3.2.0</version>
|
<version>3.2.0</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<outputDirectory>../../../Java/plugins</outputDirectory>
|
<outputDirectory>../../Java/plugins</outputDirectory>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
@ -103,12 +144,6 @@
|
|||||||
<version>1.0.5</version>
|
<version>1.0.5</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!-- Particles Library -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>xyz.xenondevs</groupId>
|
|
||||||
<artifactId>particle</artifactId>
|
|
||||||
<version>1.5.1</version>
|
|
||||||
</dependency>
|
|
||||||
<!-- Worldguard (https://dev.bukkit.org/projects/worldguard) -->
|
<!-- Worldguard (https://dev.bukkit.org/projects/worldguard) -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.sk89q.worldguard</groupId>
|
<groupId>com.sk89q.worldguard</groupId>
|
||||||
@ -116,6 +151,12 @@
|
|||||||
<version>7.0.3</version>
|
<version>7.0.3</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<!-- Particles Library -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>xyz.xenondevs</groupId>
|
||||||
|
<artifactId>particle</artifactId>
|
||||||
|
<version>1.5.1</version>
|
||||||
|
</dependency>
|
||||||
<!-- GriefPrevention (https://www.spigotmc.org/resources/griefprevention.1884/) -->
|
<!-- GriefPrevention (https://www.spigotmc.org/resources/griefprevention.1884/) -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.github.TechFortress</groupId>
|
<groupId>com.github.TechFortress</groupId>
|
||||||
|
@ -3,7 +3,6 @@ package me.SuperRonanCraft.BetterRTP;
|
|||||||
import me.SuperRonanCraft.BetterRTP.player.PlayerInfo;
|
import me.SuperRonanCraft.BetterRTP.player.PlayerInfo;
|
||||||
import me.SuperRonanCraft.BetterRTP.player.commands.Commands;
|
import me.SuperRonanCraft.BetterRTP.player.commands.Commands;
|
||||||
import me.SuperRonanCraft.BetterRTP.player.events.Listener;
|
import me.SuperRonanCraft.BetterRTP.player.events.Listener;
|
||||||
import me.SuperRonanCraft.BetterRTP.player.events.RTPEventInitiator;
|
|
||||||
import me.SuperRonanCraft.BetterRTP.player.rtp.RTP;
|
import me.SuperRonanCraft.BetterRTP.player.rtp.RTP;
|
||||||
import me.SuperRonanCraft.BetterRTP.references.Permissions;
|
import me.SuperRonanCraft.BetterRTP.references.Permissions;
|
||||||
import me.SuperRonanCraft.BetterRTP.references.depends.DepEconomy;
|
import me.SuperRonanCraft.BetterRTP.references.depends.DepEconomy;
|
||||||
@ -31,7 +30,7 @@ public class BetterRTP extends JavaPlugin {
|
|||||||
private final RTPInventories invs = new RTPInventories();
|
private final RTPInventories invs = new RTPInventories();
|
||||||
private final PlayerInfo pInfo = new PlayerInfo();
|
private final PlayerInfo pInfo = new PlayerInfo();
|
||||||
private final Settings settings = new Settings();
|
private final Settings settings = new Settings();
|
||||||
private final RTPEventInitiator events = new RTPEventInitiator();
|
private final RTPEventRegistry events = new RTPEventRegistry();
|
||||||
|
|
||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
instance = this;
|
instance = this;
|
||||||
@ -124,7 +123,7 @@ public class BetterRTP extends JavaPlugin {
|
|||||||
getInstance().getLogger().info(str);
|
getInstance().getLogger().info(str);
|
||||||
}
|
}
|
||||||
|
|
||||||
public RTPEventInitiator getEvents() {
|
public RTPEventRegistry getEvents() {
|
||||||
return events;
|
return events;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -15,7 +15,7 @@ public class CmdTest implements RTPCommand, RTPCommandHelpable {
|
|||||||
public void execute(CommandSender sendi, String label, String[] args) {
|
public void execute(CommandSender sendi, String label, String[] args) {
|
||||||
if (sendi instanceof Player) {
|
if (sendi instanceof Player) {
|
||||||
Player p = (Player) sendi;
|
Player p = (Player) sendi;
|
||||||
BetterRTP.getInstance().getRTP().getTeleport().afterTeleport(p, p.getLocation(), 0, 0);
|
BetterRTP.getInstance().getRTP().getTeleport().afterTeleport(p, p.getLocation(), 0, 0, p.getLocation());
|
||||||
} else
|
} else
|
||||||
sendi.sendMessage("Console is not able to execute this command! Try '/rtp help'");
|
sendi.sendMessage("Console is not able to execute this command! Try '/rtp help'");
|
||||||
}
|
}
|
@ -2,6 +2,7 @@ package me.SuperRonanCraft.BetterRTP.player.rtp;
|
|||||||
|
|
||||||
import io.papermc.lib.PaperLib;
|
import io.papermc.lib.PaperLib;
|
||||||
import me.SuperRonanCraft.BetterRTP.BetterRTP;
|
import me.SuperRonanCraft.BetterRTP.BetterRTP;
|
||||||
|
import me.SuperRonanCraft.BetterRTP.references.customEvents.RTP_TeleportEvent;
|
||||||
import org.bukkit.Chunk;
|
import org.bukkit.Chunk;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
@ -42,6 +43,7 @@ public class RTPTeleport {
|
|||||||
|
|
||||||
void sendPlayer(final CommandSender sendi, final Player p, final Location loc, final int price,
|
void sendPlayer(final CommandSender sendi, final Player p, final Location loc, final int price,
|
||||||
final int attempts) throws NullPointerException {
|
final int attempts) throws NullPointerException {
|
||||||
|
Location oldLoc = p.getLocation();
|
||||||
loadingTeleport(p, sendi); //Send loading message to player who requested
|
loadingTeleport(p, sendi); //Send loading message to player who requested
|
||||||
List<CompletableFuture<Chunk>> asyncChunks = getChunks(loc); //Get a list of chunks
|
List<CompletableFuture<Chunk>> asyncChunks = getChunks(loc); //Get a list of chunks
|
||||||
//playerLoads.put(p, asyncChunks);
|
//playerLoads.put(p, asyncChunks);
|
||||||
@ -53,7 +55,7 @@ public class RTPTeleport {
|
|||||||
PaperLib.teleportAsync(p, loc).thenRun(new BukkitRunnable() { //Async teleport
|
PaperLib.teleportAsync(p, loc).thenRun(new BukkitRunnable() { //Async teleport
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
afterTeleport(p, loc, price, attempts);
|
afterTeleport(p, loc, price, attempts, oldLoc);
|
||||||
if (sendi != p) //Tell player who requested that the player rtp'd
|
if (sendi != p) //Tell player who requested that the player rtp'd
|
||||||
sendSuccessMsg(sendi, p.getName(), loc, price, false, attempts);
|
sendSuccessMsg(sendi, p.getName(), loc, price, false, attempts);
|
||||||
getPl().getCmd().rtping.remove(p.getUniqueId()); //No longer rtp'ing
|
getPl().getCmd().rtping.remove(p.getUniqueId()); //No longer rtp'ing
|
||||||
@ -74,14 +76,14 @@ public class RTPTeleport {
|
|||||||
|
|
||||||
//Effects
|
//Effects
|
||||||
|
|
||||||
public void afterTeleport(Player p, Location loc, int price, int attempts) { //Only a successful rtp should run this OR '/rtp test'
|
public void afterTeleport(Player p, Location loc, int price, int attempts, Location oldLoc) { //Only a successful rtp should run this OR '/rtp test'
|
||||||
eSounds.playTeleport(p);
|
eSounds.playTeleport(p);
|
||||||
eParticles.display(p);
|
eParticles.display(p);
|
||||||
ePotions.giveEffects(p);
|
ePotions.giveEffects(p);
|
||||||
eTitles.showTitle(RTPTitles.RTP_TITLE_TYPE.TELEPORT, p, loc, attempts, 0);
|
eTitles.showTitle(RTPTitles.RTP_TITLE_TYPE.TELEPORT, p, loc, attempts, 0);
|
||||||
if (eTitles.sendMsg(RTPTitles.RTP_TITLE_TYPE.TELEPORT))
|
if (eTitles.sendMsg(RTPTitles.RTP_TITLE_TYPE.TELEPORT))
|
||||||
sendSuccessMsg(p, p.getName(), loc, price, true, attempts);
|
sendSuccessMsg(p, p.getName(), loc, price, true, attempts);
|
||||||
getPl().getEvents().eventCall_Teleport(p);
|
getPl().getServer().getPluginManager().callEvent(new RTP_TeleportEvent(p, loc, oldLoc));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void beforeTeleportInstant(CommandSender sendi, Player p) {
|
public void beforeTeleportInstant(CommandSender sendi, Player p) {
|
@ -0,0 +1,41 @@
|
|||||||
|
package me.SuperRonanCraft.BetterRTP.references.customEvents;
|
||||||
|
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.Event;
|
||||||
|
import org.bukkit.event.HandlerList;
|
||||||
|
|
||||||
|
public class RTP_TeleportEvent extends Event {
|
||||||
|
|
||||||
|
Player p;
|
||||||
|
Location loc;
|
||||||
|
Location oldLoc;
|
||||||
|
private static final HandlerList handler = new HandlerList();
|
||||||
|
|
||||||
|
public RTP_TeleportEvent(Player p, Location loc, Location oldLoc) {
|
||||||
|
this.p = p;
|
||||||
|
this.loc = loc;
|
||||||
|
this.oldLoc = oldLoc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Player getPlayer() {
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Location getLocation() {
|
||||||
|
return loc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Location getOldLocation() {
|
||||||
|
return oldLoc;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public HandlerList getHandlers() {
|
||||||
|
return handler;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static HandlerList getHandlerList() {
|
||||||
|
return handler;
|
||||||
|
}
|
||||||
|
}
|
@ -1,4 +1,4 @@
|
|||||||
main: me.SuperRonanCraft.BetterRTP.Main
|
main: me.SuperRonanCraft.BetterRTP.BetterRTP
|
||||||
version: '2.14.4'
|
version: '2.14.4'
|
||||||
name: BetterRTP
|
name: BetterRTP
|
||||||
author: SuperRonanCraft
|
author: SuperRonanCraft
|
Loading…
x
Reference in New Issue
Block a user