Git Product home page Git Product logo

scriptagent4mindustryext's Introduction

For Mindustry Lang CN Support 7.5 GitHub Releases BuildPlugin CheckScript

ScriptAgent for Mindustry

一个强大的Mindustry脚本插件,基于kts定义的DSL

A strong script plugin for Mindustry by kts(for english README see me)

本仓库包含加载器及大量功能性脚本(可使用或做例子),包括 投票/换图/权限/等级/机器人 等(所有服务器需要的基础功能)

This repository contains the loader and lots of feature scripts(use or for example)
including vote/map/permission/level/bot and much more (all essitials for server)

插件特性(Plugin Features)

  • 强大,基于kotlin,可以访问所有Java接口(所有插件能干的,脚本都能干)
  • 快速,脚本加载完成后,转换为jvm字节码,和java插件没有性能差距
  • 灵活,模块与脚本都有完整的生命周期,随时可进行热加载和热重载
  • 快速,一大堆开发常用的辅助函数,无需编译,即可快速部署到服务器
  • 智能,开发时,拥有IDEA(或AndroidStudio)的智能补全
  • 可定制,插件除核心部分外,均使用脚本实现,可根据自己需要进行修改,另外,模块定义脚本也可以为脚本扩充DSL

具体功能(Scripts Features)

本仓库共含6个模块

  • coreLib为该框架的标准库
  • core为针对mindustry的具体实现
  • main模块可用来存放简单脚本
  • wayzer模块为一套完整的Mindustry服务器基础插件(By: WayZer)
    • 插件测试服务器: mdt.wayzer.cf
    • 交流QQ群: 1033116078 或者直接在Discussions讨论
  • mapScript 一套专为MDT设计的特殊脚本,脚本生命周期与单局游戏绑定,脚本仅在地图需要时加载。
  • mirai为qq机器人库mirai的脚本封装(因为上游不可控因素,计划移除)

快速开始,功能介绍等请查阅Wiki

功能预览(Preview)

客户端(User/Client)

image image

服务器后台(Server)

image image image

版权(License)

  • 插件本体:未经许可禁止转载和用作其他用途 Plugin jar: No reproduction or use for other purposes(like modify) without permission.
  • 脚本:归属脚本制作者,本仓库脚本转载需注明本页面链接 Scripts(kts): keep all right without noting. Reproduction needs to indicate this page link.
    • 脚本默认允许私人修改并使用,不允许修改原作者版权信息,公开请folk或引用该仓库(脚本作者声明优先) This repository scripts are free for use, and allow privately modify. Reproduction need keep license and please fork or reference to this repository. (Additional notes from the script author will be given priority.)
    • mirai模块及依赖该模块的所有代码,遵循AGPLv3协议 mirai module and all depends on it, follow AGPLv3 license.

scriptagent4mindustryext's People

Contributors

deng-rui avatar way-zer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

scriptagent4mindustryext's Issues

JDK16 无法加载

[10-04-2021 14:50:43] [E] Failed to load mod file config/mods/ScriptAgent4Mindustry-2.9.jar. Skipping.
[10-04-2021 14:50:43] [E] java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499)
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:480)
at mindustry.mod.Mods.loadMod(Mods.java:789)
at mindustry.mod.Mods.loadMod(Mods.java:702)
at mindustry.mod.Mods.load(Mods.java:356)
at mindustry.Vars.init(Vars.java:305)
at mindustry.server.ServerLauncher.init(ServerLauncher.java:47)
at arc.backend.headless.HeadlessApplication.mainLoop(HeadlessApplication.java:65)
at arc.backend.headless.HeadlessApplication$1.run(HeadlessApplication.java:53)
Caused by: cf.wayzer.libraryManager.LibraryLoadException: load to ClassLoader fail:
at cf.wayzer.libraryManager.LibraryManager.loadToClassLoader(LibraryManager.java:116)
at cf.wayzer.scriptAgent.ScriptAgent.load(ScriptAgent.kt:33)
at cf.wayzer.scriptAgent.ScriptAgent.load$default(ScriptAgent.kt:26)
at cf.wayzer.ScriptAgent4Mindustry.(ScriptAgent4Mindustry.kt:26)
... 12 more
Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make protected void java.net.URLClassLoader.addURL(java.net.URL) accessible: module java.base does not "opens java.net" to unnamed module @9303fa1
at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:354)
at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:297)
at java.base/java.lang.reflect.Method.checkCanSetAccessible(Method.java:199)
at java.base/java.lang.reflect.Method.setAccessible(Method.java:193)
at cf.wayzer.libraryManager.LibraryManager.loadToClassLoader(LibraryManager.java:111)
... 15 more

建议升级Mirai

建议升级Mirai版本,在2.0-M1中,mirai升级了qq协议,可解决部分人群的登陆问题

About translation

About translation

All texts in scripts are hard-coded and dynamicly replaced, so it can only collect after use. I have provided api when a untranslated message used, and using machine translate to auto translate.

I think manual polishing is a must. However, in this way, I think it's hard to share with other.

possible resolution

  • A online service to publish translation, can be use by others. (may be hard to implement and maintain. and different servers may have different scripts.)
  • A script to extract all text from scripts. (may be difficult to ensure completeness, easier to maintain)
  • or ...

Can't download ScriptAgent library

Time to ask this issue.
The library in issue is this https://maven.tinylake.tk/cf/wayzer/ScriptAgent/1.10.1.2/ScriptAgent-1.10.1.2.jar

Downloads are terribly slow or can't connect.
I'm suggested to use jitpack after uploading the library or source to Github.

I thought it was just my internet problem, but now it doesn't seem to be.

bug通告: v2.4.1-v2.4.3中任何玩家可使用vote kick直接踢人

原因

71d8789 中为vote指令添加权限节点,并给予默认权限wayzer.vote.*
与管理员踢人权限wayzer.vote.ban冲突

解决方案

  • 升级到2.5.0
  • 临时解决方案,使用如下权限代替默认权限wayzer.vote.*
  "wayzer.vote.text"
  "wayzer.vote.clear"
  "wayzer.vote.gameover"
  "wayzer.vote.skipwave"
  "wayzer.vote.rollback"
  "wayzer.vote.kick"
  "wayzer.vote.map"
  • 后台指令
permission @default remove wayzer.vote.*
permission @default add wayzer.vote.text
permission @default add wayzer.vote.clear
permission @default add wayzer.vote.gameover
permission @default add wayzer.vote.skipwave
permission @default add wayzer.vote.rollback
permission @default add wayzer.vote.kick
permission @default add wayzer.vote.map

经常服务端闪退并报错 java.lang.IllegalStateException: No transaction in context.

[02-01-2021 00:37:20] [E] java.lang.IllegalStateException: No transaction in context.
at org.jetbrains.exposed.sql.transactions.TransactionManager$Companion.current(TransactionApi.kt:108)
at org.jetbrains.exposed.sql.Query.getTransaction(Query.kt:16)
at org.jetbrains.exposed.sql.Query.iterator(Query.kt:218)
at kotlin.collections.CollectionsKt___CollectionsKt.firstOrNull(_Collections.kt:237)
at org.jetbrains.exposed.dao.Entity.getReadValues(Entity.kt:25)
at org.jetbrains.exposed.dao.Entity.lookup(Entity.kt:106)
at org.jetbrains.exposed.dao.Entity.getValue(Entity.kt:88)
at wayzer.lib.dao.PlayerData.getProfileId(PlayerData.kt)
at wayzer.lib.dao.PlayerData.secure(PlayerData.kt:55)
at wayzer.lib.dao.PlayerData.secureProfile(PlayerData.kt:59)
at wayzer.user.Level$3$1.run(level.kts:63)
at arc.util.TaskQueue.run(TaskQueue.java:17)
at arc.backend.headless.HeadlessApplication.mainLoop(HeadlessApplication.java:83)
at arc.backend.headless.HeadlessApplication$1.run(HeadlessApplication.java:54)

[已查明bug] 3.0.0的scripts在v140.4下,玩家无法聊天

现象:玩家聊天内容会当作指令执行
涉及范围: v140.4新安装,且只使用了scripts(未使用precompile或allinone)

原因

Anuke更新了CommandHandler接口
Snipaste_2022-11-20_20-38-07
precompile使用的是旧的getPrefix接口,在子类已重写,实现正确,故不受影响。
使用v140.4编译运行,编译器会使用prefix字段导致bug

解决方案

涉及脚本coreMindustry/lib/CommandImpl.kt

方案1(未来修复)

Snipaste_2022-11-20_20-39-39
不再覆写,直接使用父类实现

方案2

强制使用子类实现
将2处prefix改成prefix0
@DF31@Z_7IR4R4FU_94MJ`1

Random Diconnect when play

image
image

Version Lastest (Build) 7.5
i Cant join server again when disconnect(timeout) but in server there is no indicate error or something but i diconnect because timeout, but after a minute i can join again and again...

jdk-17 启动出错

jdk版本

java version "17" 2021-09-14 LTS
Java(TM) SE Runtime Environment (build 17+35-LTS-2724)
Java HotSpot(TM) 64-Bit Server VM (build 17+35-LTS-2724, mixed mode, sharing)

启动日志

[2021-10-10 | 18:40:50 | 信息] [LibraryManager] Start load dependencies,please be patient
[2021-10-10 | 18:40:50 | 信息] [LibraryManager] Load kotlin-reflect-1.5.20.jar from local
[2021-10-10 | 18:40:50 | 信息] [LibraryManager] Load kotlin-stdlib-1.5.20.jar from local
[10-10-2021 18:40:50] [E] Failed to load mod file config/mods/ScriptAgent4Mindustry-2.9.jar. Skipping.
[10-10-2021 18:40:50] [E] java.lang.reflect.InvocationTargetException
        at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:77)
        at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499)
        at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:480)
        at mindustry.mod.Mods.loadMod(Mods.java:806)
        at mindustry.mod.Mods.loadMod(Mods.java:708)
        at mindustry.mod.Mods.load(Mods.java:362)
        at mindustry.Vars.init(Vars.java:305)
        at mindustry.server.ServerLauncher.init(ServerLauncher.java:47)
        at arc.backend.headless.HeadlessApplication.mainLoop(HeadlessApplication.java:65)
        at arc.backend.headless.HeadlessApplication$1.run(HeadlessApplication.java:53)
Caused by: cf.wayzer.libraryManager.LibraryLoadException: load to ClassLoader fail:
        at cf.wayzer.libraryManager.LibraryManager.loadToClassLoader(LibraryManager.java:116)
        at cf.wayzer.scriptAgent.ScriptAgent.load(ScriptAgent.kt:33)
        at cf.wayzer.scriptAgent.ScriptAgent.load$default(ScriptAgent.kt:26)
        at cf.wayzer.ScriptAgent4Mindustry.<init>(ScriptAgent4Mindustry.kt:26)
        ... 12 more
Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make protected void java.net.URLClassLoader.addURL(java.net.URL) accessible: module java.base does not "opens java.net" to unnamed module @25578e2d
        at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:354)
        at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:297)
        at java.base/java.lang.reflect.Method.checkCanSetAccessible(Method.java:199)
        at java.base/java.lang.reflect.Method.setAccessible(Method.java:193)
        at cf.wayzer.libraryManager.LibraryManager.loadToClassLoader(LibraryManager.java:111)
        ... 15 more

[10-10-2021 18:40:51] [I] Server loaded. Type 'help' for help.

Suggestions

Translate

Plugin

  • Command
  • Texts

Github

  • English wiki (Translate service isn't perfectly)
  • readme (write last line)

Experiences

  • using player name instead uuid if possible
    First, search Groups.player -> if not exists -> find name in netServer.admins -> is not exists -> search uuid
  • Find players using ID number (useful if player name is complex)
    Use player.id()

Bugs

  • Fix command not visiable from Windows Terminal system (legacy is working but new terminal isn't work)

I going to lunch 😄

加载wayzer/user/ext/rank时发生错误

pgsql版本:14.10.1
driver版本:42.7.1
[DefaultDispatcher-worker-4] WARN Exposed - Transaction attempt #1 failed: org.postgresql.util.PSQLException: 错误: 当前事务被终止, 事务块结束之前的查询被忽略. Statement(s): DELETE FROM busy
org.jetbrains.exposed.exceptions.ExposedSQLException: org.postgresql.util.PSQLException: 错误: 函数 current_week() 不存在
Hint: 没有匹配指定名称和参数类型的函数. 您也许需要增加明确的类型转换.
Position: 255
SQL: [CREATE TABLE IF NOT EXISTS rankdata (id INT NOT NULL, "name" VARCHAR(36) DEFAULT 'UNKNOWN' NOT NULL, "onlineTime" INT DEFAULT 0 NOT NULL, "exp" INT DEFAULT 0 NOT NULL, played INT DEFAULT 0 NOT NULL, win INT DEFAULT 0 NOT NULL, "weekUpdate" DATE DEFAULT (current_week()) NOT NULL, "onlineTimeWeek" INT DEFAULT 0 NOT NULL, "expWeek" INT DEFAULT 0 NOT NULL, "playedWeek" INT DEFAULT 0 NOT NULL, "winWeek" INT DEFAULT 0 NOT NULL, CONSTRAINT fk_rankdata_id__id FOREIGN KEY (id) REFERENCES playerprofile(id) ON DELETE CASCADE ON UPDATE RESTRICT)][]

gpl

Plugin:Reprinting and other uses (including decompiling not for use) are prohibited without permission

Mindustry is GPLv3 and since you compile against it, this plugin is also GPLv3.

Save error

When creating save 105, the following appears:

[02-28-2024 17:48:32] [E] java.lang.NoSuchFieldError: Class mindustry.core.GameS
tate does not have member field 'boolean serverPaused'
        at cn.pisceskkk.ServerAutoSave.saveGame(ServerAutoSave.java:204)
        at cn.pisceskkk.ServerAutoSave.lambda$init$0(ServerAutoSave.java:41)
        at arc.Events.fire(Events.java:53)
        at arc.Events.fire(Events.java:43)
        at mindustry.core.Logic.runWave(Logic.java:268)
        at mindustry.core.Logic.update(Logic.java:475)
        at arc.backend.headless.HeadlessApplication.mainLoop(HeadlessApplication
.java:87)
        at arc.backend.headless.HeadlessApplication$1.run(HeadlessApplication.ja
va:52)

Version 7.5

地图未显示

在 v3.1.2 插件中,地图不会显示在 /maps 命令中,但可以通过 /vote 地图进行更改。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.