Load Permissions synchronously

This commit is contained in:
Fabrizio La Rosa 2020-06-13 06:17:54 +02:00
parent 8cb8f9578f
commit a4e80241b9

View File

@ -26,86 +26,84 @@ public class PermissionManager {
public PermissionManager(SkyBlock plugin) { public PermissionManager(SkyBlock plugin) {
this.plugin = plugin; this.plugin = plugin;
Bukkit.getScheduler().runTaskLaterAsynchronously(plugin, () -> { // Load default permissions.
// Load default permissions. registerPermissions(
registerPermissions( //Listening
//Listening new StoragePermission(plugin),
new StoragePermission(plugin), new DragonEggUsePermission(plugin),
new DragonEggUsePermission(plugin), new BeaconPermission(plugin),
new BeaconPermission(plugin), new ProjectilePermission(plugin),
new ProjectilePermission(plugin), new DestroyPermission(plugin),
new DestroyPermission(plugin), new AnvilPermission(plugin),
new AnvilPermission(plugin), new BedPermission(plugin),
new BedPermission(plugin), new BrewingPermission(plugin),
new BrewingPermission(plugin), new WorkbenchPermission(plugin),
new WorkbenchPermission(plugin), new DoorPermission(plugin),
new DoorPermission(plugin), new EnchantPermission(plugin),
new EnchantPermission(plugin), new FurnacePermission(plugin),
new FurnacePermission(plugin), new LeverButtonPermission(plugin),
new LeverButtonPermission(plugin), new JukeboxPermission(plugin),
new JukeboxPermission(plugin), new HopperPermission(plugin),
new HopperPermission(plugin), new NoteblockPermission(plugin),
new NoteblockPermission(plugin), new RedstonePermission(plugin),
new RedstonePermission(plugin), new GatePermission(plugin),
new GatePermission(plugin), new DropperDispenserPermission(plugin),
new DropperDispenserPermission(plugin), new BucketPermission(plugin),
new BucketPermission(plugin), new WaterCollectionPermission(plugin),
new WaterCollectionPermission(plugin), new SpawnEggPermission(plugin),
new SpawnEggPermission(plugin), new EntityPlacementPermission(plugin),
new EntityPlacementPermission(plugin), new FirePermission(plugin),
new FirePermission(plugin), new TramplePermission(plugin),
new TramplePermission(plugin), new PressurePlatePermission(plugin),
new PressurePlatePermission(plugin), new CakePermission(plugin),
new CakePermission(plugin), new PlacePermission(plugin),
new PlacePermission(plugin), new LeashPermission(plugin),
new LeashPermission(plugin), new AnimalBreedingPermission(plugin),
new AnimalBreedingPermission(plugin), new MinecartPermission(plugin),
new MinecartPermission(plugin), new BoatPermission(plugin),
new BoatPermission(plugin), new TradingPermission(plugin),
new TradingPermission(plugin), new MilkingPermission(plugin),
new MilkingPermission(plugin), new ShearingPermission(plugin),
new ShearingPermission(plugin), new MobRidingPermission(plugin),
new MobRidingPermission(plugin), new HorseInventoryPermission(plugin),
new HorseInventoryPermission(plugin), new MobHurtingPermission(plugin),
new MobHurtingPermission(plugin), new ArmorStandUsePermission(plugin),
new ArmorStandUsePermission(plugin), new MonsterHurtingPermission(plugin),
new MonsterHurtingPermission(plugin), new PvpPermission(plugin),
new PvpPermission(plugin), new HangingDestroyPermission(plugin),
new HangingDestroyPermission(plugin), new DamagePermission(plugin),
new DamagePermission(plugin), new ExplosionsPermission(plugin),
new ExplosionsPermission(plugin), new MobTamingPermission(plugin),
new MobTamingPermission(plugin), new MobGriefingPermission(plugin),
new MobGriefingPermission(plugin), new ExperienceOrbPickupPermission(plugin),
new ExperienceOrbPickupPermission(plugin), new NaturalMobSpawningPermission(),
new NaturalMobSpawningPermission(), new HungerPermission(plugin),
new HungerPermission(plugin), new PortalPermission(plugin),
new PortalPermission(plugin), new ItemPickupPermission(),
new ItemPickupPermission(), new ItemDropPermission(),
new ItemDropPermission(), new FishingPermission(plugin),
new FishingPermission(plugin),
// Basic // Basic
new MemberPermission(), new MemberPermission(),
new VisitorPermission(), new VisitorPermission(),
new KickPermission(), new KickPermission(),
new BiomePermission(), new BiomePermission(),
new KeepItemsOnDeathPermission(), new KeepItemsOnDeathPermission(),
new UnbanPermission(), new UnbanPermission(),
new BanPermission(), new BanPermission(),
new BorderPermission(), new BorderPermission(),
new FireSpreadPermission(), new FireSpreadPermission(),
new CoopPlayersPermission(), new CoopPlayersPermission(),
new IslandPermission(), new IslandPermission(),
new LeafDecayPermission(), new LeafDecayPermission(),
new WeatherPermission(), new WeatherPermission(),
new MainSpawnPermission(), new MainSpawnPermission(),
new VisitorSpawnPermission()); new VisitorSpawnPermission());
registeredHandlers = registeredHandlers.stream().sorted(Comparator.comparingInt(h -> { registeredHandlers = registeredHandlers.stream().sorted(Comparator.comparingInt(h -> {
final PermissionHandler permissionHandler = h.getHandler().getAnnotation(PermissionHandler.class); final PermissionHandler permissionHandler = h.getHandler().getAnnotation(PermissionHandler.class);
return permissionHandler.priority().ordinal(); return permissionHandler.priority().ordinal();
})).collect(Collectors.toList()); })).collect(Collectors.toList());
}, 20L);
} }
public boolean registerPermission(BasicPermission permission) { public boolean registerPermission(BasicPermission permission) {