mirror of
https://github.com/ViaVersion/ViaVersion.git
synced 2024-12-23 08:57:39 +01:00
Added that fancy message when 1.9 clients try to enter a Minecart :)
This commit is contained in:
parent
fd0bd53826
commit
1e873c123c
@ -16,6 +16,7 @@ import org.bukkit.plugin.java.JavaPlugin;
|
|||||||
import us.myles.ViaVersion.api.ViaVersion;
|
import us.myles.ViaVersion.api.ViaVersion;
|
||||||
import us.myles.ViaVersion.api.ViaVersionAPI;
|
import us.myles.ViaVersion.api.ViaVersionAPI;
|
||||||
import us.myles.ViaVersion.handlers.ViaVersionInitializer;
|
import us.myles.ViaVersion.handlers.ViaVersionInitializer;
|
||||||
|
import us.myles.ViaVersion.listeners.MinecartListener;
|
||||||
import us.myles.ViaVersion.util.ReflectionUtil;
|
import us.myles.ViaVersion.util.ReflectionUtil;
|
||||||
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
@ -52,6 +53,7 @@ public class ViaVersionPlugin extends JavaPlugin implements ViaVersionAPI {
|
|||||||
setPorted(e.getPlayer().getUniqueId(), false);
|
setPorted(e.getPlayer().getUniqueId(), false);
|
||||||
}
|
}
|
||||||
}, this);
|
}, this);
|
||||||
|
Bukkit.getPluginManager().registerEvents(new MinecartListener(),this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void injectPacketHandler() throws Exception {
|
public void injectPacketHandler() throws Exception {
|
||||||
|
@ -0,0 +1,25 @@
|
|||||||
|
package us.myles.ViaVersion.listeners;
|
||||||
|
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.Listener;
|
||||||
|
import org.bukkit.event.vehicle.VehicleEnterEvent;
|
||||||
|
import us.myles.ViaVersion.api.ViaVersion;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by fillefilip8 on 2016-03-02.
|
||||||
|
*/
|
||||||
|
public class MinecartListener implements Listener {
|
||||||
|
@EventHandler
|
||||||
|
public void onMinecartEnter(VehicleEnterEvent e){
|
||||||
|
if(e.getEntered() instanceof Player) {
|
||||||
|
Player player = (Player) e.getEntered();
|
||||||
|
if(ViaVersion.getInstance().isPorted(player)){
|
||||||
|
e.setCancelled(true);
|
||||||
|
e.getEntered().sendMessage(ChatColor.RED + "Minecarts are not supported. Due to changes on minecarts in 1.9");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user