mirror of
https://github.com/RonanPlugins/BetterRTP.git
synced 2025-08-17 17:15:47 +00:00
command after fix for addons reload + locations finalized
This commit is contained in:
parent
a218104e56
commit
300f97b522
@ -109,7 +109,7 @@
|
||||
<dependency>
|
||||
<groupId>me.SuperRonanCraft</groupId>
|
||||
<artifactId>BetterRTP</artifactId>
|
||||
<version>3.2.4</version>
|
||||
<version>3.3.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<!-- ProtocolLib -->
|
||||
|
@ -2,6 +2,7 @@ package me.SuperRonanCraft.BetterRTPAddons;
|
||||
|
||||
import me.SuperRonanCraft.BetterRTPAddons.util.Files;
|
||||
import me.SuperRonanCraft.BetterRTPAddons.util.ReloadListener;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
public class Main extends JavaPlugin {
|
||||
@ -10,11 +11,12 @@ public class Main extends JavaPlugin {
|
||||
private final AddonsHandler addonsHandler = new AddonsHandler();
|
||||
private final Files files = new Files();
|
||||
public final AddonMessages msgs = new AddonMessages();
|
||||
private final ReloadListener reloadListener = new ReloadListener();
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
instance = this;
|
||||
new ReloadListener(this);
|
||||
Bukkit.getPluginManager().registerEvents(reloadListener, this);
|
||||
load();
|
||||
}
|
||||
|
||||
|
@ -2,6 +2,7 @@ package me.SuperRonanCraft.BetterRTPAddons.util;
|
||||
|
||||
import me.SuperRonanCraft.BetterRTP.player.commands.types.CmdReload;
|
||||
import me.SuperRonanCraft.BetterRTP.references.customEvents.RTP_CommandEvent;
|
||||
import me.SuperRonanCraft.BetterRTP.references.customEvents.RTP_CommandEvent_After;
|
||||
import me.SuperRonanCraft.BetterRTPAddons.Main;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.event.EventHandler;
|
||||
@ -9,12 +10,8 @@ import org.bukkit.event.Listener;
|
||||
|
||||
public class ReloadListener implements Listener {
|
||||
|
||||
public ReloadListener(Main pl) {
|
||||
Bukkit.getPluginManager().registerEvents(this, pl);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
void reload(RTP_CommandEvent e) {
|
||||
void reload(RTP_CommandEvent_After e) {
|
||||
if (e.getCmd() instanceof CmdReload)
|
||||
Main.getInstance().load();
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package me.SuperRonanCraft.BetterRTP.player.commands;
|
||||
|
||||
import me.SuperRonanCraft.BetterRTP.BetterRTP;
|
||||
import me.SuperRonanCraft.BetterRTP.player.commands.types.CmdTeleport;
|
||||
import me.SuperRonanCraft.BetterRTP.references.customEvents.RTP_CommandEvent_After;
|
||||
import me.SuperRonanCraft.BetterRTP.references.helpers.HelperRTP;
|
||||
import me.SuperRonanCraft.BetterRTP.references.rtpinfo.CooldownData;
|
||||
import me.SuperRonanCraft.BetterRTP.references.rtpinfo.CooldownHandler;
|
||||
@ -50,6 +51,7 @@ public class Commands {
|
||||
Bukkit.getServer().getPluginManager().callEvent(event);
|
||||
if (!event.isCancelled())
|
||||
cmd.execute(sendi, label, args);
|
||||
Bukkit.getServer().getPluginManager().callEvent(new RTP_CommandEvent_After(sendi, cmd));
|
||||
} else
|
||||
pl.getText().getNoPermission(sendi);
|
||||
return;
|
||||
|
@ -12,6 +12,7 @@ public class RTP_CommandEvent extends RTPEvent implements Cancellable {
|
||||
RTPCommand cmd;
|
||||
private static final HandlerList handler = new HandlerList();
|
||||
|
||||
//Called before a command is executed
|
||||
public RTP_CommandEvent(CommandSender sendi, RTPCommand cmd) {
|
||||
this.sendi = sendi;
|
||||
this.cmd = cmd;
|
||||
|
@ -0,0 +1,14 @@
|
||||
package me.SuperRonanCraft.BetterRTP.references.customEvents;
|
||||
|
||||
import me.SuperRonanCraft.BetterRTP.player.commands.RTPCommand;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
public class RTP_CommandEvent_After extends RTP_CommandEvent {
|
||||
|
||||
//Executed after a command was executed
|
||||
public RTP_CommandEvent_After(CommandSender sendi, RTPCommand cmd) {
|
||||
super(sendi, cmd);
|
||||
}
|
||||
}
|
@ -11,7 +11,7 @@
|
||||
|
||||
Enabled: false #enable the locations feature
|
||||
RequirePermission: false #Require players to have `betterrtp.location.<world_name>`
|
||||
UseLocationIfAvailable: false #Will choose a location upon `/rtp` if location(s) is available in the world
|
||||
UseLocationIfAvailable: true #Will choose a location upon `/rtp` if location(s) is available in the world
|
||||
#OnlyAllowInWorld: true #Only allow players to use locations that correspond to the world they are standing in
|
||||
|
||||
Locations:
|
||||
|
Loading…
x
Reference in New Issue
Block a user