Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spigot server support #37

Open
Gaming32 opened this issue Feb 24, 2022 · 15 comments
Open

Spigot server support #37

Gaming32 opened this issue Feb 24, 2022 · 15 comments

Comments

@Gaming32
Copy link

It would be great if this mod had the ability to install it on the Spigot server (or a derivative, such as Paper). I may work on this myself, although I think it would probably be better as a separate repository.

@nnnik
Copy link
Member

nnnik commented Feb 26, 2022

Hey thanks - glad that you like the mod.
I wouldn't recommend making a Spigot fork atm as the codebase is a total mess.
I took an do then think approach at first with this mod to overcome my past habit of overthinking things.
Sadly this has led to some seriously muddy code in certain areas.

@Gaming32
Copy link
Author

It wasn't gonna be a fork (the API is to different, a fork wouldn't work). It was gonna be a server-side rewrite that implements the protocol.

@commandblock2
Copy link

any update?

@Gaming32
Copy link
Author

Nope

@Muska-Ami
Copy link

同求,BBOR Mod有CraftBukkit插件,可以参考它的代码去写一个(Purpur用户没有这玩意是真的难受)

@nnnik
Copy link
Member

nnnik commented Jan 16, 2023

Thanks for the tip. I'll have a look at this

@s-yh-china
Copy link

if I have time, I will do it like bbor

@s-yh-china
Copy link

s-yh-china commented Sep 1, 2023

制定一个协议标准接口,只要服务端能接收协议并处理这个数据包能力就可以实现。当然有了协议标准,这不一定需要MC服务端,也可以进行实现。

从当前的协议数据包应该是这样的,首先是数据包格式:Identifier(Type) + PacketByteBuf(Data)。

这些数据是根据PacketType进行读取数据的。

至于数据格式我不了解,因为这是我的朋友发给我issues uri,所以我只是稍微的看了一下代码

Develop a protocol standard interface, as long as the server can receive the protocol and process this packet ability can be achieved. Of course, with the protocol standard, this does not necessarily require an MC server, and it can also be implemented.

From the current protocol the packet should look like this, first [packet format] (https://github.com/End-Tech/syncmatica/blob/master/src/main/java/ch/endte/syncmatica/mixin/MixinCustomPayloadC2SPacket.java) :Identifier(Type) + PacketByteBuf(Data)。

These data are based on PacketType Read data.

As for the data format I don't know, because this is the issues URI that my friend sent me, so I just took a slight look at the code

https://github.com/LeavesMC/Leaves/blob/master/patches/server/0060-Syncmatica-Protocol.patch
实际上是已经实现的,但是我暂时没有时间和心情将它制作为一个插件

@s-yh-china
Copy link

https://github.com/LeavesMC/Leaves/blob/master/patches/server/0060-Syncmatica-Protocol.patch 实际上是已经实现的,但是我暂时没有时间和心情将它制作为一个插件

对了,我希望您能提供非fabric服务端数据包通道。

数据包类型:

  1. 上线通知服务端该用户是syncmatica使用者,用于服务端投影变更相关的分发通知。
  2. 上传syncmatica数据。
  3. 删除syncmatica数据。
  4. 查询syncmatica是否已存在

1使用者上线通知(syncmatica)数据格式:

  1. 玩家UUID(使用者就传一个UUID就行,服务端用于通知syncmatica用户)

2上传syncmatica数据数据包格式

  1. 上传的玩家UUID。用于管理
  2. 上传的syncmatica标识(可以根据文件名命名)。用于管理
  3. 上传的syncmatica标识或者说是数据(文件)唯一标识类似MD5,用于校验是否变更。用于管理
  4. 其他玩家是否可以变更投影。用于管理
  5. 数据(可以为JSON数据或二进制,反正服务端不进行解析)。

3删除syncmatica数据

  1. 执行者玩家UUID。用于校验
  2. 待删除的syncmatica标识(可以根据文件名命名)。用于管理

4查询syncmatica是否已存在

  1. syncmatica标识(可以根据文件名命名)。用于管理

注意:该数据服务端不参与解包,服务端原封不动的分发给syncmatica使用者,因为服务端的数据格式有很多缺失或不一致,不易解包,所以服务端只是进行syncmatica数据管理,数据转发给syncmatica使用者,让syncmatica自己解析内容。操作枚举标识只需要上传和删除,更新有标识,或许在增加一个查询是否已经存在标识,

它的意义何在呢,现有的协议已经实现了你所说的全部功能,我认为你需要仔细阅读源码以后再来提问。
并且mc的所有mod通信都是用的一个mojang提供的包,任何类型的服务端都可以使用这个包进行通信

@s-yh-china
Copy link

服务端仅用于管理数据与分发,没有必要让服务端进行解包储存,我觉得syncmatica可以直接弄客户端数据收发的解析器,服务端就只进行管理和转发数据即可,避免重写一大堆类,工作量很大,比如BlockPos类型,等等,在bukkit中是不存在的。

对了,最好在增加一个上传数据大小的限制,这个限制可以先询问服务端插件配置,然后返回给syncmatica,然后syncmatica根据这个设置提示说原理图文件过大,这是为了避免有人恶意上传超大的原理图用来攻击服务端。

服务器从来没有进行解包,服务器只存储客户端发来的数据。
如果你仔细阅读你会发现 这是一个用于存储投影位置和上传者等信息的类 而非进行解包 请完整阅读源码
不要进行片段的理解

@s-yh-china
Copy link

Fabric Api网络相关的文档:https://fabricmc.net/wiki/tutorial:networking

我没看懂你的意思 并且我认为issue不是一个聊天的好地方
如果你愿意 可以加我的discord violetc_

@bunnyi116
Copy link
Contributor

我想表达的是MixinClientPlayNetworkHandler.Class中

    @Inject(method = "onCustomPayload", at = @At("HEAD"), cancellable = true)
    private void handlePacket(final CustomPayloadS2CPacket packet, final CallbackInfo ci) {
        if (!MinecraftClient.getInstance().isOnThread()) {
            return; //only execute packet on main thread
        }
        ActorClientPlayNetworkHandler.getInstance().packetEvent((ClientPlayNetworkHandler) (Object) this, packet, ci);
    }

这个方法它并没有接收到,来自spigot的PluginChannel的数据包,导致无法通讯,而我使用Fabric Api,它可以接收到来自spigot的插件通道的数据包

@bunnyi116
Copy link
Contributor

视乎是通道需要注册的原因吧,具体我也不清楚

@s-yh-china
Copy link

s-yh-china commented Sep 2, 2023

很高兴你找到了方法但是有两个问题
首先 这个mod并非我开发的
其次 我不建议将issue作为聊天的地方

@bunnyi116
Copy link
Contributor

bunnyi116 commented Sep 4, 2023

https://github.com/bunnyi116/fabric-syncmatica
https://github.com/bunnyi116/bukkit-syncmatica

The plugin has been implemented, because the original author did not register the plugin channel, so it cannot communicate with the plugin channel, which is the branch I modified.

Note: I don't know if there is an error!! Currently the test is up and running.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants