mirror of
https://github.com/ViaVersion/ViaVersion.git
synced 2024-11-28 21:15:51 +01:00
Merge branch 'master' into dev
This commit is contained in:
commit
4714a3f03a
@ -53,7 +53,6 @@ public class ViaVersionPlugin extends JavaPlugin implements ViaPlatform<Player>
|
|||||||
// Init platform
|
// Init platform
|
||||||
BukkitViaInjector injector = new BukkitViaInjector();
|
BukkitViaInjector injector = new BukkitViaInjector();
|
||||||
injector.setProtocolLib(Bukkit.getPluginManager().getPlugin("ProtocolLib") != null);
|
injector.setProtocolLib(Bukkit.getPluginManager().getPlugin("ProtocolLib") != null);
|
||||||
Bukkit.getPluginManager().registerEvents(new ProtocolLibEnableListener(injector), this);
|
|
||||||
|
|
||||||
Via.init(ViaManager.builder()
|
Via.init(ViaManager.builder()
|
||||||
.platform(this)
|
.platform(this)
|
||||||
@ -117,6 +116,8 @@ public class ViaVersionPlugin extends JavaPlugin implements ViaPlatform<Player>
|
|||||||
getCommand("viaversion").setExecutor(commandHandler);
|
getCommand("viaversion").setExecutor(commandHandler);
|
||||||
getCommand("viaversion").setTabCompleter(commandHandler);
|
getCommand("viaversion").setTabCompleter(commandHandler);
|
||||||
|
|
||||||
|
getServer().getPluginManager().registerEvents(new ProtocolLibEnableListener(), this);
|
||||||
|
|
||||||
// Warn them if they have anti-xray on and they aren't using spigot
|
// Warn them if they have anti-xray on and they aren't using spigot
|
||||||
if (conf.isAntiXRay() && !spigot) {
|
if (conf.isAntiXRay() && !spigot) {
|
||||||
getLogger().info("You have anti-xray on in your config, since you're not using spigot it won't fix xray!");
|
getLogger().info("You have anti-xray on in your config, since you're not using spigot it won't fix xray!");
|
||||||
|
@ -4,26 +4,22 @@ import org.bukkit.event.EventHandler;
|
|||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.server.PluginDisableEvent;
|
import org.bukkit.event.server.PluginDisableEvent;
|
||||||
import org.bukkit.event.server.PluginEnableEvent;
|
import org.bukkit.event.server.PluginEnableEvent;
|
||||||
|
import us.myles.ViaVersion.api.Via;
|
||||||
import us.myles.ViaVersion.bukkit.platform.BukkitViaInjector;
|
import us.myles.ViaVersion.bukkit.platform.BukkitViaInjector;
|
||||||
|
|
||||||
public class ProtocolLibEnableListener implements Listener {
|
public class ProtocolLibEnableListener implements Listener {
|
||||||
private final BukkitViaInjector injector;
|
|
||||||
|
|
||||||
public ProtocolLibEnableListener(BukkitViaInjector injector) {
|
|
||||||
this.injector = injector;
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPluginEnable(PluginEnableEvent e) {
|
public void onPluginEnable(PluginEnableEvent e) {
|
||||||
if (e.getPlugin().getName().equals("ProtocolLib")) {
|
if (e.getPlugin().getName().equals("ProtocolLib")) {
|
||||||
injector.setProtocolLib(true);
|
((BukkitViaInjector) Via.getManager().getInjector()).setProtocolLib(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPluginDisable(PluginDisableEvent e) {
|
public void onPluginDisable(PluginDisableEvent e) {
|
||||||
if (e.getPlugin().getName().equals("ProtocolLib")) {
|
if (e.getPlugin().getName().equals("ProtocolLib")) {
|
||||||
injector.setProtocolLib(false);
|
((BukkitViaInjector) Via.getManager().getInjector()).setProtocolLib(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user