Paper icon indicating copy to clipboard operation
Paper copied to clipboard

Improve GameRule API

Open Machine-Maker opened this issue 3 years ago • 8 comments

Getting a gamerule's default value shouldn't be tied to needing a world instance since it's the same without a world. Also, the methods to get the gamerule's value for a world and default world should be notnull, so the methods I added to GameRule to get/set the world have an Objects.requireNonNull wrapped around them.

Machine-Maker avatar Jan 01 '22 23:01 Machine-Maker

I don't like how this duplicates all the methods for no real reason, the nullability change is just a confusing hack with the world method still being marked as nullable. Imo the getDefault in Server and the world methods in GameRule should be removed

kennytv avatar Jan 02 '22 08:01 kennytv

I don't like how this duplicates all the methods for no real reason, the nullability change is just a confusing hack with the world method still being marked as nullable. Imo the getDefault in Server and the world methods in GameRule should be removed

I need the getDefault in server to have a way of getting the default rule value without a reference to the world. currently, the only way to get the default rule value requires a world, which is totally unneeded.

Machine-Maker avatar Jan 02 '22 08:01 Machine-Maker

Ah I didn't see GameRule is not an interface implemented in CraftBukkit

kennytv avatar Jan 02 '22 08:01 kennytv

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Mar 03 '22 22:03 stale[bot]

Rebased for 1.18.2

Machine-Maker avatar Mar 30 '22 03:03 Machine-Maker

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar May 30 '22 21:05 stale[bot]

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Jul 30 '22 14:07 stale[bot]

Rebased for 1.19.1

Machine-Maker avatar Jul 31 '22 16:07 Machine-Maker