-
Notifications
You must be signed in to change notification settings - Fork 34
Non-static API #125
base: main
Are you sure you want to change the base?
Non-static API #125
Conversation
I'm probably down to merge this, but I will have to see of course |
Backwards compatibility could be kept if the static methods redirect to the first instance created. Kind of ugly, but that way there could be a deprecation phase to adapt. Not saying that this should be done, just pointing out options. |
I think it should probably just be done with another update like 1.20.5 or 1.21 which already may have breaking changes |
Now it's running! I look forward to reviews, criticism and suggestions for improvement 🙂 |
Small PR.... (I will start going through it soon) |
I'm skeptical of the need for |
I agree, I need to make an interface, otherwise this PR is useless :) |
9853e10
to
07ad6fd
Compare
I thought it would be much simpler, but there is still a huge amount of work since many mistakes were made when designing Minestom |
I think you can create a separate repository for this and call it minestom-ee 😄 |
I just barely started reviewing, but in no world is Lombok being added to Minestom. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I only got a small way through, will continue later.
@@ -187,24 +71,145 @@ public class PlayerInit { | |||
// System.out.println("load end"); | |||
// }); | |||
|
|||
inventory = new Inventory(InventoryType.CHEST_1_ROW, Component.text("Test inventory")); | |||
inventory = new Inventory(serverFacade.getGlobalEventHandler(), serverFacade.getServerSettings(), InventoryType.CHEST_1_ROW, Component.text("Test inventory")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inventory
should probably get the server references it needs from the player it is opened for
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
help needed
ItemStack droppedItem = event.getItemStack(); | ||
|
||
Pos playerPos = player.getPosition(); | ||
ItemEntity itemEntity = new ItemEntity(serverFacade, droppedItem); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are a lot of odd cases created now because you could try to spawn an entity in a level of server A while passing server B into the constructor. These probably need to be handled somewhere and I'm not sure they are (im still on like file 2 of review)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In theory, two different servers can have common components, for example a common ExceptionHandler
}).repeat(10, TimeUnit.SERVER_TICK); //.schedule(); | ||
final Component footer = BenchmarkManager.getCpuMonitoringMessage(benchmarkManager); | ||
serverFacade.getAudienceManager().players().sendPlayerListHeaderAndFooter(header, footer); | ||
}).repeat(10, TimeUnit.getServerTick(serverFacade.getServerSettings())); //.schedule(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO another method should be added to take a SERVER_TICKS constant which the scheduler can then get from the server rather than it being a TimeUnit and requiring a reference to the server here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SERVER_TICKS is no longer a constant, as it is a parameter that may differ between server instances
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes I mean there should be a constant to represent server ticks and converted when encountered
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
help needed
this.audienceManager = new AudienceManagerImpl(commandManager, this, this); | ||
this.ticker = new TickerImpl(this); | ||
this.serverStarter = new ServerStarter(this); | ||
this.mojangAuth = new MojangAuth(this, this); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should not be present unless used, perhaps it would be better to have some generic AuthProvider which this, velocity, bungee implement to prevent the confusion of enabling multiple at once.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree but I need help with this
import java.util.concurrent.atomic.AtomicBoolean; | ||
|
||
@RequiredArgsConstructor | ||
public class ServerStarter { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm a little unclear on the need for this class
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This class is needed to start the server (now renamed to ServerProcess). Since MinecraftServer is optional for running Minestom, there should be no logic in it, so the launch logic is in a separate class
build.gradle.kts
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tests will be fixed and enabled after other changes are approved
"The server from the Instance should be passed into the chunk supplier, this should remain a method reference."
@@ -58,40 +58,42 @@ default boolean isViewer(@NotNull Player player) { | |||
* | |||
* @param packet the packet to send to all viewers | |||
*/ | |||
default void sendPacketToViewers(@NotNull SendablePacket packet) { | |||
default void sendPacketToViewers(ServerSettingsProvider serverSettingsProvider, @NotNull SendablePacket packet) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like that ServerSettings is required here, but I don't know how to fix it
I need help with:
Who is interested in this pull request please help me 🥺 |
@MelonHell Hi, I think you can move some dependencies: we can do this by using interfaces to dependency inversion: Generally, this is a solution to this problem, but I also have a proposal to create a class "InventoryFactory"/"InventoryManager", which will create new inventory. This may help create new inventories that will need additional dependencies. |
I think this is a serious problem for Minestom and it needs to be addressed.
When this is completed, it will definitely break backwards compatibility, but the sooner it is fixed, the less painful it will be
will resolves #70 and #119