mirror of
https://github.com/EngineHub/WorldGuard.git
synced 2024-12-25 10:37:41 +01:00
More compat for 1.14.
This commit is contained in:
parent
75bb0adbe6
commit
11c95861f9
@ -945,7 +945,7 @@ public void onBlockDispense(BlockDispenseEvent event) {
|
||||
@EventHandler(ignoreCancelled = true)
|
||||
public void onLingeringSplash(LingeringPotionSplashEvent event) {
|
||||
AreaEffectCloud aec = event.getAreaEffectCloud();
|
||||
LingeringPotion potion = event.getEntity();
|
||||
ThrownPotion potion = event.getEntity();
|
||||
World world = potion.getWorld();
|
||||
Cause cause = create(event.getEntity());
|
||||
|
||||
|
@ -102,6 +102,9 @@ public WorldGuardEntityListener(WorldGuardPlugin plugin) {
|
||||
*/
|
||||
public void registerEvents() {
|
||||
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)
|
||||
@ -666,15 +669,17 @@ public void onCreatureSpawn(CreatureSpawnEvent event) {
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
|
||||
public void onCreatePortal(EntityCreatePortalEvent event) {
|
||||
ConfigurationManager cfg = WorldGuard.getInstance().getPlatform().getGlobalStateManager();
|
||||
WorldConfiguration wcfg = cfg.get(BukkitAdapter.adapt(event.getEntity().getWorld()));
|
||||
private static class UselessIn114Listener implements Listener {
|
||||
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
|
||||
public void onCreatePortal(EntityCreatePortalEvent event) {
|
||||
ConfigurationManager cfg = WorldGuard.getInstance().getPlatform().getGlobalStateManager();
|
||||
WorldConfiguration wcfg = cfg.get(BukkitAdapter.adapt(event.getEntity().getWorld()));
|
||||
|
||||
switch (event.getEntityType()) {
|
||||
case ENDER_DRAGON:
|
||||
if (wcfg.blockEnderDragonPortalCreation) event.setCancelled(true);
|
||||
break;
|
||||
switch (event.getEntityType()) {
|
||||
case ENDER_DRAGON:
|
||||
if (wcfg.blockEnderDragonPortalCreation) event.setCancelled(true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -437,7 +437,11 @@ public void onPlayerPortal(PlayerPortalEvent event) {
|
||||
if (event.getCause() != TeleportCause.NETHER_PORTAL) {
|
||||
return;
|
||||
}
|
||||
if (!event.useTravelAgent()) { // either end travel (even though we checked cause) or another plugin is fucking with us, shouldn't create a portal though
|
||||
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
|
||||
return;
|
||||
}
|
||||
} catch (NoSuchMethodError ignored) {
|
||||
return;
|
||||
}
|
||||
TravelAgent pta = event.getPortalTravelAgent();
|
||||
|
@ -30,8 +30,11 @@ public ServerReport() {
|
||||
|
||||
Server server = Bukkit.getServer();
|
||||
|
||||
append("Server ID", server.getServerId());
|
||||
append("Server Name", server.getServerName());
|
||||
try {
|
||||
append("Server ID", server.getServerId());
|
||||
append("Server Name", server.getServerName());
|
||||
} catch (NoSuchMethodError ignored) {
|
||||
}
|
||||
append("Bukkit Version", server.getBukkitVersion());
|
||||
append("Implementation", server.getVersion());
|
||||
append("Player Count", "%d/%d", Bukkit.getOnlinePlayers().size(), server.getMaxPlayers());
|
||||
|
Loading…
Reference in New Issue
Block a user