3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-12-27 00:22:51 +01:00

* One JavaDoc to the api XD

* Added faster way to change version number.
Dieser Commit ist enthalten in:
fillefilip8 2016-03-03 14:28:26 +01:00
Ursprung bb42cda4a8
Commit ef118a3a64
6 geänderte Dateien mit 14 neuen und 60 gelöschten Zeilen

Datei anzeigen

@ -6,7 +6,7 @@
<groupId>us.myles</groupId> <groupId>us.myles</groupId>
<artifactId>ViaVersion</artifactId> <artifactId>ViaVersion</artifactId>
<version>1.0-SNAPSHOT</version> <version>0.4.6</version>
<build> <build>
<plugins> <plugins>
<plugin> <plugin>
@ -18,6 +18,12 @@
</configuration> </configuration>
</plugin> </plugin>
</plugins> </plugins>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
</build> </build>
<dependencies> <dependencies>
<dependency> <dependency>

Datei anzeigen

@ -16,7 +16,6 @@ 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.VehicleListener;
import us.myles.ViaVersion.util.ReflectionUtil; import us.myles.ViaVersion.util.ReflectionUtil;
import java.util.Collections; import java.util.Collections;
@ -39,7 +38,7 @@ public class ViaVersionPlugin extends JavaPlugin implements ViaVersionAPI {
return; return;
} }
getLogger().info("ViaVersion enabled, injecting. (Allows 1.8 to be accessed via 1.9)"); getLogger().info("ViaVersion " + getDescription().getVersion() + " is now enabled, injecting. (Allows 1.8 to be accessed via 1.9)");
try { try {
injectPacketHandler(); injectPacketHandler();
System.setProperty("ViaVersion", getDescription().getVersion()); System.setProperty("ViaVersion", getDescription().getVersion());
@ -53,7 +52,6 @@ public class ViaVersionPlugin extends JavaPlugin implements ViaVersionAPI {
setPorted(e.getPlayer().getUniqueId(), false); setPorted(e.getPlayer().getUniqueId(), false);
} }
}, this); }, this);
Bukkit.getPluginManager().registerEvents(new VehicleListener(),this);
} }
public void injectPacketHandler() throws Exception { public void injectPacketHandler() throws Exception {

Datei anzeigen

@ -3,6 +3,10 @@ package us.myles.ViaVersion.api;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
public interface ViaVersionAPI { public interface ViaVersionAPI {
/**
* Is player using 1.9?
* @param player
* @return
*/
boolean isPorted(Player player); boolean isPorted(Player player);
} }

Datei anzeigen

@ -1,15 +0,0 @@
package us.myles.ViaVersion.listeners;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerInteractEvent;
/**
* Created by fillefilip8 on 2016-03-03.
*/
public class InteractListener implements Listener {
@EventHandler
public void onSwordBlock(PlayerInteractEvent e){
}
}

Datei anzeigen

@ -1,39 +0,0 @@
package us.myles.ViaVersion.listeners;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.entity.Boat;
import org.bukkit.entity.Minecart;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerToggleSneakEvent;
import org.bukkit.event.vehicle.VehicleEnterEvent;
import org.bukkit.event.vehicle.VehicleExitEvent;
import us.myles.ViaVersion.api.ViaVersion;
/**
* Created by fillefilip8 on 2016-03-02.
*/
public class VehicleListener implements Listener {
@EventHandler
public void onVehicleEnter(VehicleEnterEvent e){
if(e.getEntered() instanceof Player) {
Player player = (Player) e.getEntered();
if(ViaVersion.getInstance().isPorted(player)){
if(e.getVehicle() instanceof Minecart){
e.getEntered().sendMessage(ChatColor.RED + "Minecarts are not supported. Due to changes on minecarts in 1.9");
e.setCancelled(true);
}else if(e.getVehicle() instanceof Boat){
e.getEntered().sendMessage(ChatColor.RED + "Boats are not supported. Due to changes on boats in 1.9");
e.setCancelled(true);
}
}
}
}
}

Datei anzeigen

@ -1,6 +1,6 @@
name: ViaVersion name: ViaVersion
main: us.myles.ViaVersion.ViaVersionPlugin main: us.myles.ViaVersion.ViaVersionPlugin
author: _MylesC author: _MylesC
version: 0.4.6 version: ${version}
load: startup load: startup
loadbefore: [ProtocolLib, ProxyPipe] loadbefore: [ProtocolLib, ProxyPipe]