More compat for 1.14.

This commit is contained in:
wizjany 2019-06-11 20:16:16 -04:00
parent 75bb0adbe6
commit 11c95861f9
4 changed files with 24 additions and 12 deletions

View File

@ -945,7 +945,7 @@ public void onBlockDispense(BlockDispenseEvent event) {
@EventHandler(ignoreCancelled = true) @EventHandler(ignoreCancelled = true)
public void onLingeringSplash(LingeringPotionSplashEvent event) { public void onLingeringSplash(LingeringPotionSplashEvent event) {
AreaEffectCloud aec = event.getAreaEffectCloud(); AreaEffectCloud aec = event.getAreaEffectCloud();
LingeringPotion potion = event.getEntity(); ThrownPotion potion = event.getEntity();
World world = potion.getWorld(); World world = potion.getWorld();
Cause cause = create(event.getEntity()); Cause cause = create(event.getEntity());

View File

@ -102,6 +102,9 @@ public WorldGuardEntityListener(WorldGuardPlugin plugin) {
*/ */
public void registerEvents() { public void registerEvents() {
plugin.getServer().getPluginManager().registerEvents(this, plugin); plugin.getServer().getPluginManager().registerEvents(this, plugin);
if (!EntityCreatePortalEvent.class.isAnnotationPresent(Deprecated.class)) {
plugin.getServer().getPluginManager().registerEvents(new UselessIn114Listener(), plugin);
}
} }
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true) @EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
@ -666,6 +669,7 @@ public void onCreatureSpawn(CreatureSpawnEvent event) {
} }
} }
private static class UselessIn114Listener implements Listener {
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true) @EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
public void onCreatePortal(EntityCreatePortalEvent event) { public void onCreatePortal(EntityCreatePortalEvent event) {
ConfigurationManager cfg = WorldGuard.getInstance().getPlatform().getGlobalStateManager(); ConfigurationManager cfg = WorldGuard.getInstance().getPlatform().getGlobalStateManager();
@ -677,6 +681,7 @@ public void onCreatePortal(EntityCreatePortalEvent event) {
break; break;
} }
} }
}
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true) @EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
public void onPigZap(PigZapEvent event) { public void onPigZap(PigZapEvent event) {

View File

@ -437,9 +437,13 @@ public void onPlayerPortal(PlayerPortalEvent event) {
if (event.getCause() != TeleportCause.NETHER_PORTAL) { if (event.getCause() != TeleportCause.NETHER_PORTAL) {
return; return;
} }
try {
if (!event.useTravelAgent()) { // either end travel (even though we checked cause) or another plugin is fucking with us, shouldn't create a portal though if (!event.useTravelAgent()) { // either end travel (even though we checked cause) or another plugin is fucking with us, shouldn't create a portal though
return; return;
} }
} catch (NoSuchMethodError ignored) {
return;
}
TravelAgent pta = event.getPortalTravelAgent(); TravelAgent pta = event.getPortalTravelAgent();
if (pta == null) { // possible, but shouldn't create a portal if (pta == null) { // possible, but shouldn't create a portal
return; return;

View File

@ -30,8 +30,11 @@ public ServerReport() {
Server server = Bukkit.getServer(); Server server = Bukkit.getServer();
try {
append("Server ID", server.getServerId()); append("Server ID", server.getServerId());
append("Server Name", server.getServerName()); append("Server Name", server.getServerName());
} catch (NoSuchMethodError ignored) {
}
append("Bukkit Version", server.getBukkitVersion()); append("Bukkit Version", server.getBukkitVersion());
append("Implementation", server.getVersion()); append("Implementation", server.getVersion());
append("Player Count", "%d/%d", Bukkit.getOnlinePlayers().size(), server.getMaxPlayers()); append("Player Count", "%d/%d", Bukkit.getOnlinePlayers().size(), server.getMaxPlayers());