7070import org .spongepowered .plugin .PluginContainer ;
7171import org .spongepowered .plugin .builtin .jvm .Plugin ;
7272
73+ import java .lang .invoke .MethodHandles ;
7374import java .nio .file .Files ;
7475import java .nio .file .Path ;
7576import java .util .Collections ;
@@ -132,7 +133,8 @@ public void onPluginConstruction(ConstructPluginEvent event) {
132133
133134 event .game ().eventManager ().registerListeners (
134135 container ,
135- new CUIChannelHandler .RegistrationHandler ()
136+ new CUIChannelHandler .RegistrationHandler (),
137+ MethodHandles .lookup ()
136138 );
137139
138140 event .game ().eventManager ().registerListeners (
@@ -319,8 +321,8 @@ SpongeConfiguration getConfig() {
319321
320322 public Actor wrapCommandCause (CommandCause cause ) {
321323 Object rootCause = cause .root ();
322- if (rootCause instanceof ServerPlayer ) {
323- return SpongeAdapter .adapt (( ServerPlayer ) rootCause );
324+ if (rootCause instanceof ServerPlayer serverPlayer ) {
325+ return SpongeAdapter .adapt (serverPlayer );
324326 }
325327 if (rootCause instanceof LocatableBlock locatableBlock ) {
326328 Optional <? extends BlockEntity > optionalBlockEntity = locatableBlock .world ().blockEntity (locatableBlock .blockPosition ());
@@ -331,8 +333,8 @@ public Actor wrapCommandCause(CommandCause cause) {
331333 }
332334 }
333335 }
334- if (rootCause instanceof Audience ) {
335- return new SpongeCommandSender (( Audience ) rootCause );
336+ if (rootCause instanceof Audience audience ) {
337+ return new SpongeCommandSender (audience );
336338 }
337339
338340 throw new UnsupportedOperationException ("Cannot wrap " + rootCause .getClass ());
0 commit comments