1
mirror of https://github.com/StarWishsama/Slimefun4.git synced 2024-09-19 19:25:48 +00:00

Prevent Spigot from breaking everything...

This commit is contained in:
TheBusyBiscuit 2020-06-29 15:19:20 +02:00
parent fe63637281
commit 3713940512
2 changed files with 22 additions and 2 deletions

View File

@ -270,12 +270,20 @@ public final class SlimefunPlugin extends JavaPlugin implements SlimefunAddon {
// Clear the Slimefun Guide History upon Player Leaving
new PlayerProfileListener(this);
// Initiating various Stuff and all Items with a slightly delay (0ms after the Server finished loading)
// Initiating various Stuff and all items with a slight delay (0ms after the Server finished loading)
Slimefun.runSync(new SlimefunStartupTask(this, () -> {
protections = new ProtectionManager(getServer());
textureService.register(registry.getAllSlimefunItems(), true);
permissionsService.register(registry.getAllSlimefunItems(), true);
recipeService.refresh();
// This try/catch should prevent buggy Spigot builds from blocking item loading
try {
recipeService.refresh();
}
catch (Exception | LinkageError x) {
getLogger().log(Level.SEVERE, x, () -> "An Exception occured while iterating through the Recipe list on Minecraft Version " + minecraftVersion.getName() + " (Slimefun v" + getVersion() + ")");
}
}), 0);
// Setting up the command /sf and all subcommands

View File

@ -18,6 +18,7 @@ import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.entity.EntityPortalEnterEvent;
import org.bukkit.event.entity.ProjectileHitEvent;
import org.bukkit.event.hanging.HangingBreakByEntityEvent;
import org.bukkit.event.player.PlayerKickEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.util.Vector;
@ -99,6 +100,17 @@ public class GrapplingHookListener implements Listener {
invulnerability.remove(uuid);
}
@EventHandler
public void onLeave(PlayerKickEvent e) {
if (!isEnabled()) {
return;
}
UUID uuid = e.getPlayer().getUniqueId();
activeHooks.remove(uuid);
invulnerability.remove(uuid);
}
@EventHandler
public void onFallDamage(EntityDamageEvent e) {
if (!isEnabled()) {