├── .github └── workflows │ ├── javadoc_167.yml │ ├── main_167.yml │ └── publish_167.yml ├── .gitignore ├── LICENSE ├── README.md ├── bin └── main │ ├── com │ └── skillw │ │ ├── asahi │ │ ├── api │ │ │ ├── AsahiAPI.kt │ │ │ ├── AsahiManager.kt │ │ │ ├── Extension.kt │ │ │ ├── InlineAnalysis.kt │ │ │ ├── annotation │ │ │ │ ├── AsahiGetter.kt │ │ │ │ ├── AsahiInfix.kt │ │ │ │ ├── AsahiNamespace.kt │ │ │ │ ├── AsahiPrefix.kt │ │ │ │ ├── AsahiSetter.kt │ │ │ │ ├── AsahiTopParser.kt │ │ │ │ └── AsahiTypeParser.kt │ │ │ ├── member │ │ │ │ ├── AsahiRegistrable.kt │ │ │ │ ├── context │ │ │ │ │ ├── AsahiContext.kt │ │ │ │ │ ├── InfixContext.kt │ │ │ │ │ └── LoopContext.kt │ │ │ │ ├── lexer │ │ │ │ │ ├── AsahiDemand.kt │ │ │ │ │ ├── AsahiLexer.kt │ │ │ │ │ ├── JavaLexer.kt │ │ │ │ │ └── tokenizer │ │ │ │ │ │ ├── Line.kt │ │ │ │ │ │ └── ScriptTokenizer.kt │ │ │ │ ├── namespace │ │ │ │ │ ├── Namespace.kt │ │ │ │ │ ├── NamespaceContainer.kt │ │ │ │ │ ├── NamespaceHolder.kt │ │ │ │ │ └── Namespacing.kt │ │ │ │ ├── parser │ │ │ │ │ ├── infix │ │ │ │ │ │ ├── InfixParser.kt │ │ │ │ │ │ └── namespacing │ │ │ │ │ │ │ ├── BaseInfix.kt │ │ │ │ │ │ │ └── InfixExecutor.kt │ │ │ │ │ └── prefix │ │ │ │ │ │ ├── PrefixParser.kt │ │ │ │ │ │ ├── TopPrefixParser.kt │ │ │ │ │ │ ├── namespacing │ │ │ │ │ │ ├── BaseJavaPrefix.kt │ │ │ │ │ │ ├── BasePrefix.kt │ │ │ │ │ │ ├── PrefixCreator.kt │ │ │ │ │ │ └── PrefixParser.kt │ │ │ │ │ │ └── type │ │ │ │ │ │ ├── JavaTypeParser.kt │ │ │ │ │ │ └── TypeParser.kt │ │ │ │ └── quest │ │ │ │ │ ├── LazyQuester.kt │ │ │ │ │ ├── Quester.kt │ │ │ │ │ └── VarBeanQuester.kt │ │ │ └── script │ │ │ │ ├── AsahiCompiledScript.kt │ │ │ │ ├── AsahiEngine.kt │ │ │ │ ├── AsahiEngineFactory.kt │ │ │ │ ├── AsahiQuestException.kt │ │ │ │ ├── AsahiScriptException.kt │ │ │ │ └── linking │ │ │ │ ├── Invoker.kt │ │ │ │ ├── InvokerHolder.kt │ │ │ │ └── NativeFunction.kt │ │ ├── internal │ │ │ ├── AsahiLoader.kt │ │ │ ├── context │ │ │ │ ├── AsahiContextImpl.kt │ │ │ │ └── AsahiLoopContext.kt │ │ │ ├── function │ │ │ │ └── lang │ │ │ │ │ └── java │ │ │ │ │ ├── ExampleAction.class │ │ │ │ │ ├── ExampleFunction.class │ │ │ │ │ └── ExampleParser.class │ │ │ ├── lexer │ │ │ │ ├── AsahiDemandImpl.kt │ │ │ │ ├── AsahiLexerImpl.kt │ │ │ │ ├── InlineAnalysisImpl.kt │ │ │ │ └── Tokenizer.kt │ │ │ ├── namespace │ │ │ │ ├── Common.kt │ │ │ │ └── Lang.kt │ │ │ ├── namespacing │ │ │ │ ├── infix │ │ │ │ │ ├── InfixMatchResult.kt │ │ │ │ │ └── linking │ │ │ │ │ │ ├── InfixArray.kt │ │ │ │ │ │ ├── InfixBool.kt │ │ │ │ │ │ ├── InfixCompletableFuture.kt │ │ │ │ │ │ ├── InfixList.kt │ │ │ │ │ │ ├── InfixMap.kt │ │ │ │ │ │ └── InfixPair.kt │ │ │ │ └── prefix │ │ │ │ │ └── lang │ │ │ │ │ ├── Lang.kt │ │ │ │ │ ├── Script.kt │ │ │ │ │ ├── Variable.kt │ │ │ │ │ ├── linking │ │ │ │ │ └── Java.kt │ │ │ │ │ ├── math │ │ │ │ │ ├── Calculate.kt │ │ │ │ │ ├── Math.kt │ │ │ │ │ ├── Number.kt │ │ │ │ │ └── Random.kt │ │ │ │ │ ├── structure │ │ │ │ │ ├── Condition.kt │ │ │ │ │ └── Loop.kt │ │ │ │ │ └── util │ │ │ │ │ ├── Logger.kt │ │ │ │ │ ├── Logic.kt │ │ │ │ │ ├── PrefixDebug.kt │ │ │ │ │ ├── PrefixGson.kt │ │ │ │ │ ├── PrefixRegex.kt │ │ │ │ │ ├── String.kt │ │ │ │ │ └── Util.kt │ │ │ ├── parser │ │ │ │ ├── infix │ │ │ │ │ └── ActionParserImpl.kt │ │ │ │ └── prefix │ │ │ │ │ ├── top │ │ │ │ │ ├── NamespaceCallParser.kt │ │ │ │ │ ├── PrefixCallParser.kt │ │ │ │ │ ├── StringParser.kt │ │ │ │ │ ├── VarBeanParser.kt │ │ │ │ │ └── VarParser.kt │ │ │ │ │ └── type │ │ │ │ │ ├── Container.kt │ │ │ │ │ ├── Lambda.kt │ │ │ │ │ └── Util.kt │ │ │ ├── script │ │ │ │ ├── AsahiCompiledScriptImpl.kt │ │ │ │ ├── AsahiEngineImpl.kt │ │ │ │ └── NativeFunctionImpl.kt │ │ │ └── util │ │ │ │ ├── AsahiClassBean.class │ │ │ │ ├── Clock.kt │ │ │ │ ├── MapTemplate.kt │ │ │ │ └── Time.kt │ │ └── util │ │ │ ├── AsahiDataMap.kt │ │ │ ├── Deserialize.kt │ │ │ ├── Util.kt │ │ │ └── condition │ │ │ ├── ConditionOperator.kt │ │ │ └── ConditionParser.kt │ │ ├── particlelib │ │ ├── EffectBezier.kt │ │ ├── EffectData.kt │ │ ├── EffectGeneric.kt │ │ ├── EffectRenderer.kt │ │ ├── package-info.class │ │ ├── pobject │ │ │ ├── Arc.kt │ │ │ ├── Astroid.kt │ │ │ ├── Circle.kt │ │ │ ├── Cube.kt │ │ │ ├── EffectGroup.kt │ │ │ ├── FilledCircle.kt │ │ │ ├── Grid.kt │ │ │ ├── Heart.kt │ │ │ ├── Line.kt │ │ │ ├── Lotus.kt │ │ │ ├── ParticleObject.kt │ │ │ ├── Playable.kt │ │ │ ├── Polygon.kt │ │ │ ├── Ray.kt │ │ │ ├── ShowType.kt │ │ │ ├── Sphere.kt │ │ │ ├── Star.kt │ │ │ ├── Wing.kt │ │ │ ├── bezier │ │ │ │ ├── NRankBezierCurve.kt │ │ │ │ ├── ThreeRankBezierCurve.kt │ │ │ │ ├── TwoRankBezierCurve.kt │ │ │ │ └── package-info.kt │ │ │ ├── equation │ │ │ │ ├── Equations.kt │ │ │ │ ├── GeneralEquationRenderer.kt │ │ │ │ ├── ParametricEquationRenderer.kt │ │ │ │ ├── PolarEquationRenderer.kt │ │ │ │ └── package-info.kt │ │ │ └── package-info.kt │ │ └── utils │ │ │ ├── Icosahedron.kt │ │ │ ├── LocationUtils.kt │ │ │ ├── VectorUtils.kt │ │ │ ├── coordinate │ │ │ ├── Coordinate.kt │ │ │ ├── PlayerBackCoordinate.kt │ │ │ ├── PlayerFixedCoordinate.kt │ │ │ ├── PlayerFrontCoordinate.kt │ │ │ └── package-info.kt │ │ │ ├── matrix │ │ │ ├── Matrix.kt │ │ │ ├── Matrixs.kt │ │ │ └── package-info.kt │ │ │ ├── package-info.kt │ │ │ └── projector │ │ │ ├── ThreeDProjector.kt │ │ │ ├── TwoDProjector.kt │ │ │ └── package-info.kt │ │ └── pouvoir │ │ ├── Pouvoir.kt │ │ ├── api │ │ ├── PouvoirAPI.kt │ │ ├── feature │ │ │ ├── database │ │ │ │ ├── BaseContainer.kt │ │ │ │ ├── ContainerHolder.kt │ │ │ │ ├── DatabaseType.kt │ │ │ │ ├── UserBased.kt │ │ │ │ └── sql │ │ │ │ │ └── IPouTable.kt │ │ │ ├── handler │ │ │ │ ├── BaseDispatcher.kt │ │ │ │ └── BaseHandler.kt │ │ │ ├── hologram │ │ │ │ ├── HologramBuilder.kt │ │ │ │ └── IHologram.kt │ │ │ ├── placeholder │ │ │ │ └── PouPlaceHolder.kt │ │ │ ├── selector │ │ │ │ ├── BaseSelector.kt │ │ │ │ ├── EntityFlag.kt │ │ │ │ ├── SelectResult.kt │ │ │ │ ├── SimpleSelector.kt │ │ │ │ ├── Target.kt │ │ │ │ ├── Util.kt │ │ │ │ └── target │ │ │ │ │ ├── EntityTarget.kt │ │ │ │ │ └── LocTarget.kt │ │ │ └── trigger │ │ │ │ ├── BaseTrigger.kt │ │ │ │ ├── BukkitTrigger.kt │ │ │ │ └── TriggerController.kt │ │ ├── manager │ │ │ ├── ConfigManager.kt │ │ │ ├── Manager.kt │ │ │ ├── ManagerData.kt │ │ │ └── sub │ │ │ │ ├── DatabaseManager.kt │ │ │ │ ├── HologramManager.kt │ │ │ │ ├── ListenerManager.kt │ │ │ │ ├── PouPlaceholderManager.kt │ │ │ │ ├── SelectorManager.kt │ │ │ │ ├── TriggerHandlerManager.kt │ │ │ │ ├── TriggerManager.kt │ │ │ │ └── script │ │ │ │ ├── CompileManager.kt │ │ │ │ ├── ScriptAnnotationManager.kt │ │ │ │ ├── ScriptEngineManager.kt │ │ │ │ └── ScriptManager.kt │ │ ├── plugin │ │ │ ├── ManagerTime.kt │ │ │ ├── SubPouvoir.kt │ │ │ ├── TotalManager.kt │ │ │ ├── Util.kt │ │ │ ├── annotation │ │ │ │ ├── AutoRegister.kt │ │ │ │ └── PouManager.kt │ │ │ ├── handler │ │ │ │ └── ClassHandler.kt │ │ │ ├── map │ │ │ │ ├── BaseMap.kt │ │ │ │ ├── DataMap.kt │ │ │ │ ├── KeyMap.kt │ │ │ │ ├── LinkedKeyMap.kt │ │ │ │ ├── LinkedMap.kt │ │ │ │ ├── LowerKeyMap.kt │ │ │ │ ├── LowerMap.kt │ │ │ │ ├── MultiExecMap.kt │ │ │ │ ├── RegContainer.kt │ │ │ │ ├── SingleExecMap.kt │ │ │ │ └── component │ │ │ │ │ ├── Keyable.kt │ │ │ │ │ └── Registrable.kt │ │ │ ├── object │ │ │ │ ├── BaseObject.kt │ │ │ │ └── Releasable.kt │ │ │ └── package-info.class │ │ └── script │ │ │ ├── PouFileCompiledScript.kt │ │ │ ├── ProtocolTool.kt │ │ │ ├── ScriptTool.kt │ │ │ ├── annotation │ │ │ ├── ScriptAnnotation.kt │ │ │ └── ScriptAnnotationData.kt │ │ │ └── engine │ │ │ ├── PouScriptEngine.kt │ │ │ └── hook │ │ │ ├── PouCompiler.kt │ │ │ └── ScriptBridge.kt │ │ ├── internal │ │ ├── command │ │ │ ├── PouvoirCommand.kt │ │ │ └── sub │ │ │ │ ├── PouMirrorCommand.kt │ │ │ │ └── PouScriptCommand.kt │ │ ├── core │ │ │ ├── asahi │ │ │ │ ├── AsahiInject.kt │ │ │ │ ├── infix │ │ │ │ │ ├── bukkit │ │ │ │ │ │ ├── InfixBossBar.kt │ │ │ │ │ │ ├── InfixCancellable.kt │ │ │ │ │ │ ├── InfixEntity.kt │ │ │ │ │ │ ├── InfixLivingEntity.kt │ │ │ │ │ │ ├── InfixLocation.kt │ │ │ │ │ │ ├── InfixPlayer.kt │ │ │ │ │ │ └── InfixVector.kt │ │ │ │ │ └── database │ │ │ │ │ │ └── InfixContainerHolder.kt │ │ │ │ ├── linking │ │ │ │ │ └── js │ │ │ │ │ │ ├── NativeJSFunction.kt │ │ │ │ │ │ └── NativeJSFunctionImpl.kt │ │ │ │ ├── prefix │ │ │ │ │ ├── bukkit │ │ │ │ │ │ ├── Basic.kt │ │ │ │ │ │ ├── Item.kt │ │ │ │ │ │ ├── LivingEntity.kt │ │ │ │ │ │ ├── Player.kt │ │ │ │ │ │ ├── Selector.kt │ │ │ │ │ │ ├── Task.kt │ │ │ │ │ │ ├── World.kt │ │ │ │ │ │ └── particle │ │ │ │ │ │ │ ├── Particle.kt │ │ │ │ │ │ │ └── ParticleData.kt │ │ │ │ │ └── database │ │ │ │ │ │ ├── Database.kt │ │ │ │ │ │ ├── Redis.kt │ │ │ │ │ │ └── sql │ │ │ │ │ │ ├── Sql.kt │ │ │ │ │ │ └── Where.kt │ │ │ │ └── util │ │ │ │ │ ├── PlayerAsOp.kt │ │ │ │ │ └── Task.kt │ │ │ ├── plugin │ │ │ │ ├── PouManagerUtils.kt │ │ │ │ └── SubPouvoirHandler.kt │ │ │ └── script │ │ │ │ ├── asahi │ │ │ │ ├── AsahiBridge.kt │ │ │ │ └── PouAsahiScriptEngine.kt │ │ │ │ ├── common │ │ │ │ └── annotation │ │ │ │ │ ├── Annotation.kt │ │ │ │ │ ├── AsahiInfix.kt │ │ │ │ │ ├── AsahiPrefix.kt │ │ │ │ │ ├── Awake.kt │ │ │ │ │ ├── Listener.kt │ │ │ │ │ ├── Placeholder.kt │ │ │ │ │ ├── PouPlaceholder.kt │ │ │ │ │ ├── Selector.kt │ │ │ │ │ └── SimpleSelector.kt │ │ │ │ ├── groovy │ │ │ │ ├── GroovyBridge.kt │ │ │ │ └── PouGroovyScriptEngine.kt │ │ │ │ └── javascript │ │ │ │ ├── JSGlobal.kt │ │ │ │ ├── JSStaticClass.kt │ │ │ │ ├── PouJavaScriptEngine.kt │ │ │ │ └── impl │ │ │ │ ├── NashornLegacy.kt │ │ │ │ └── NashornNew.kt │ │ ├── feature │ │ │ ├── compat │ │ │ │ └── placeholder │ │ │ │ │ ├── PlaceholderAPIHooker.kt │ │ │ │ │ └── PouvoirHooker.kt │ │ │ ├── database │ │ │ │ ├── PouvoirContainer.kt │ │ │ │ ├── redis │ │ │ │ │ ├── Redis.kt │ │ │ │ │ ├── RedisContainer.kt │ │ │ │ │ ├── RedisContainerHolder.kt │ │ │ │ │ └── RedisUserContainer.kt │ │ │ │ └── sql │ │ │ │ │ ├── NormalContainer.kt │ │ │ │ │ ├── SQLTable.kt │ │ │ │ │ ├── UserContainer.kt │ │ │ │ │ ├── UserDatabase.kt │ │ │ │ │ ├── sql │ │ │ │ │ ├── SQL.kt │ │ │ │ │ └── SQLContainerHolder.kt │ │ │ │ │ └── sqlite │ │ │ │ │ ├── SQLite.kt │ │ │ │ │ └── SQLiteContainerHolder.kt │ │ │ ├── dispatcher │ │ │ │ ├── SimpleDispatcher.kt │ │ │ │ └── SimpleDispatcherBuilder.kt │ │ │ ├── handler │ │ │ │ ├── AsahiHandler.kt │ │ │ │ ├── AsahiHandlerBuilder.kt │ │ │ │ └── Native.kt │ │ │ ├── hologram │ │ │ │ ├── ConcurrentHashSet.kt │ │ │ │ ├── Hologram.kt │ │ │ │ ├── HologramLine.kt │ │ │ │ ├── PouHolo.kt │ │ │ │ └── impl │ │ │ │ │ ├── PouAdyHologramsLine.kt │ │ │ │ │ ├── PouDecentHologramsLine.kt │ │ │ │ │ └── PouEmptyHoloLine.kt │ │ │ ├── listener │ │ │ │ ├── CustomListener.kt │ │ │ │ └── Priority.kt │ │ │ ├── raytrace │ │ │ │ └── RayTrace.kt │ │ │ ├── selector │ │ │ │ ├── Amount.kt │ │ │ │ ├── Cone.kt │ │ │ │ ├── Flag.kt │ │ │ │ ├── Line.kt │ │ │ │ ├── LookAt.kt │ │ │ │ ├── Nearest.kt │ │ │ │ ├── Projectile.kt │ │ │ │ ├── Range.kt │ │ │ │ ├── Self.kt │ │ │ │ ├── Side.kt │ │ │ │ └── TargetHelper.kt │ │ │ └── trigger │ │ │ │ ├── Util.kt │ │ │ │ ├── bukkit │ │ │ │ ├── BukkitEventTrigger.kt │ │ │ │ ├── BukkitTriggerController.kt │ │ │ │ └── EventNameHandler.kt │ │ │ │ └── custom │ │ │ │ ├── CustomTrigger.kt │ │ │ │ ├── CustomTriggerController.kt │ │ │ │ └── CustomTriggerHandler.kt │ │ └── manager │ │ │ ├── CompileManagerImpl.kt │ │ │ ├── DatabaseManagerImpl.kt │ │ │ ├── HologramManagerImpl.kt │ │ │ ├── ListenerManagerImpl.kt │ │ │ ├── PouConfig.kt │ │ │ ├── PouPlaceholderManagerImpl.kt │ │ │ ├── ScriptAnnotationManagerImpl.kt │ │ │ ├── ScriptEngineManagerImpl.kt │ │ │ ├── ScriptManagerImpl.kt │ │ │ ├── SelectorManagerImpl.kt │ │ │ ├── TriggerHandlerManagerImpl.kt │ │ │ └── TriggerManagerImpl.kt │ │ ├── taboolib │ │ └── module │ │ │ └── ui │ │ │ ├── ClickEvent.kt │ │ │ ├── ClickListener.kt │ │ │ ├── ClickType.kt │ │ │ ├── ItemStacker$1.class │ │ │ ├── ItemStacker$AddResult.class │ │ │ ├── ItemStacker.class │ │ │ ├── Menu.kt │ │ │ ├── MenuBuilder.kt │ │ │ ├── MenuHolder.kt │ │ │ ├── VectorUtil.class │ │ │ └── type │ │ │ ├── Action.kt │ │ │ ├── ActionClick.kt │ │ │ ├── ActionKeyboard.kt │ │ │ ├── ActionQuickTake.kt │ │ │ ├── Basic.kt │ │ │ ├── Hopper.kt │ │ │ ├── Linked.kt │ │ │ └── Stored.kt │ │ └── util │ │ ├── BukkitAttribute.class │ │ ├── CalculationUtil.kt │ │ ├── ClassUtil.kt │ │ ├── EntityUtil.kt │ │ ├── FileUtil.kt │ │ ├── GsonUtil.kt │ │ ├── MapUtil.kt │ │ ├── NumberUtil.kt │ │ ├── PlayerUtil.kt │ │ ├── Run.kt │ │ ├── StringUtil.kt │ │ ├── TypeUtil.kt │ │ ├── VectorUtil.kt │ │ ├── calculate │ │ ├── CalcOperator.kt │ │ └── FormulaParser.kt │ │ ├── nms │ │ ├── NMS.kt │ │ └── NMSImpl.kt │ │ ├── package-info.class │ │ ├── plugin │ │ ├── Pair.kt │ │ └── PluginUtils.kt │ │ └── script │ │ ├── ColorUtil.kt │ │ ├── ItemUtil.kt │ │ └── MessageUtil.kt │ ├── config.yml │ ├── dispatchers │ └── custom-trigger.yml │ ├── handlers │ └── simple-handler.yml │ ├── lang │ ├── en_US.yml │ └── zh_CN.yml │ ├── script.yml │ └── scripts │ ├── core │ ├── asahi.js │ ├── basic.js │ └── util │ │ ├── color.js │ │ ├── container.js │ │ ├── menu.js │ │ ├── message.js │ │ ├── number.js │ │ ├── placeholder.js │ │ ├── player.js │ │ └── ray_trace.js │ ├── example.js │ ├── groovy.groovy │ └── test.asahi ├── build.gradle.kts ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── libs ├── AttributePlus.jar ├── DecentHolograms-2.5.2 (1).jar ├── Matrix_free.jar ├── PlaceholderAPI-2.10.9.jar ├── PouNashorn.jar ├── ProtocolLib.jar ├── Vault-1.7.3.jar ├── aac-api-5.0.0.jar ├── purpur-1.19.2.jar └── reflectasm-g-1.0-SNAPSHOT-all.jar ├── settings.gradle.kts └── src └── main ├── java └── com │ └── skillw │ ├── asahi │ └── internal │ │ ├── function │ │ └── lang │ │ │ └── java │ │ │ ├── ExampleAction.java │ │ │ ├── ExampleFunction.java │ │ │ └── ExampleParser.java │ │ └── util │ │ └── AsahiClassBean.java │ └── pouvoir │ └── util │ └── read │ ├── Char.java │ ├── Parser.java │ ├── Result.java │ ├── StrTrie.java │ ├── ValParser.java │ └── Value.java ├── kotlin └── com │ └── skillw │ ├── asahi │ ├── api │ │ ├── AsahiAPI.kt │ │ ├── AsahiManager.kt │ │ ├── Extension.kt │ │ ├── InlineAnalysis.kt │ │ ├── annotation │ │ │ ├── AsahiGetter.kt │ │ │ ├── AsahiInfix.kt │ │ │ ├── AsahiNamespace.kt │ │ │ ├── AsahiPrefix.kt │ │ │ ├── AsahiSetter.kt │ │ │ ├── AsahiTopParser.kt │ │ │ └── AsahiTypeParser.kt │ │ ├── member │ │ │ ├── AsahiRegistrable.kt │ │ │ ├── context │ │ │ │ ├── AsahiContext.kt │ │ │ │ ├── InfixContext.kt │ │ │ │ └── LoopContext.kt │ │ │ ├── lexer │ │ │ │ ├── AsahiDemand.kt │ │ │ │ ├── AsahiLexer.kt │ │ │ │ ├── JavaLexer.kt │ │ │ │ └── tokenizer │ │ │ │ │ ├── Line.kt │ │ │ │ │ └── ScriptTokenizer.kt │ │ │ ├── namespace │ │ │ │ ├── Namespace.kt │ │ │ │ ├── NamespaceContainer.kt │ │ │ │ ├── NamespaceHolder.kt │ │ │ │ └── Namespacing.kt │ │ │ ├── parser │ │ │ │ ├── infix │ │ │ │ │ ├── InfixParser.kt │ │ │ │ │ └── namespacing │ │ │ │ │ │ ├── BaseInfix.kt │ │ │ │ │ │ └── InfixExecutor.kt │ │ │ │ └── prefix │ │ │ │ │ ├── PrefixParser.kt │ │ │ │ │ ├── TopPrefixParser.kt │ │ │ │ │ ├── namespacing │ │ │ │ │ ├── BaseJavaPrefix.kt │ │ │ │ │ ├── BasePrefix.kt │ │ │ │ │ ├── PrefixCreator.kt │ │ │ │ │ └── PrefixParser.kt │ │ │ │ │ └── type │ │ │ │ │ ├── JavaTypeParser.kt │ │ │ │ │ └── TypeParser.kt │ │ │ └── quest │ │ │ │ ├── LazyQuester.kt │ │ │ │ ├── Quester.kt │ │ │ │ └── VarBeanQuester.kt │ │ └── script │ │ │ ├── AsahiCompiledScript.kt │ │ │ ├── AsahiEngine.kt │ │ │ ├── AsahiEngineFactory.kt │ │ │ ├── AsahiQuestException.kt │ │ │ ├── AsahiScriptException.kt │ │ │ └── linking │ │ │ ├── Invoker.kt │ │ │ ├── InvokerHolder.kt │ │ │ └── NativeFunction.kt │ ├── internal │ │ ├── AsahiLoader.kt │ │ ├── context │ │ │ ├── AsahiContextImpl.kt │ │ │ └── AsahiLoopContext.kt │ │ ├── lexer │ │ │ ├── AsahiDemandImpl.kt │ │ │ ├── AsahiLexerImpl.kt │ │ │ ├── InlineAnalysisImpl.kt │ │ │ └── Tokenizer.kt │ │ ├── namespace │ │ │ ├── Common.kt │ │ │ └── Lang.kt │ │ ├── namespacing │ │ │ ├── infix │ │ │ │ ├── InfixMatchResult.kt │ │ │ │ └── linking │ │ │ │ │ ├── InfixArray.kt │ │ │ │ │ ├── InfixBool.kt │ │ │ │ │ ├── InfixCompletableFuture.kt │ │ │ │ │ ├── InfixList.kt │ │ │ │ │ ├── InfixMap.kt │ │ │ │ │ └── InfixPair.kt │ │ │ └── prefix │ │ │ │ └── lang │ │ │ │ ├── Lang.kt │ │ │ │ ├── Script.kt │ │ │ │ ├── Variable.kt │ │ │ │ ├── linking │ │ │ │ └── Java.kt │ │ │ │ ├── math │ │ │ │ ├── Calculate.kt │ │ │ │ ├── Math.kt │ │ │ │ ├── Number.kt │ │ │ │ └── Random.kt │ │ │ │ ├── structure │ │ │ │ ├── Condition.kt │ │ │ │ └── Loop.kt │ │ │ │ └── util │ │ │ │ ├── Logger.kt │ │ │ │ ├── Logic.kt │ │ │ │ ├── PrefixDebug.kt │ │ │ │ ├── PrefixGson.kt │ │ │ │ ├── PrefixRegex.kt │ │ │ │ ├── String.kt │ │ │ │ └── Util.kt │ │ ├── parser │ │ │ ├── infix │ │ │ │ └── ActionParserImpl.kt │ │ │ └── prefix │ │ │ │ ├── top │ │ │ │ ├── NamespaceCallParser.kt │ │ │ │ ├── PrefixCallParser.kt │ │ │ │ ├── StringParser.kt │ │ │ │ ├── VarBeanParser.kt │ │ │ │ └── VarParser.kt │ │ │ │ └── type │ │ │ │ ├── Container.kt │ │ │ │ ├── Lambda.kt │ │ │ │ └── Util.kt │ │ ├── script │ │ │ ├── AsahiCompiledScriptImpl.kt │ │ │ ├── AsahiEngineImpl.kt │ │ │ └── NativeFunctionImpl.kt │ │ └── util │ │ │ ├── MapTemplate.kt │ │ │ └── Time.kt │ └── util │ │ ├── AsahiDataMap.kt │ │ ├── Deserialize.kt │ │ ├── Util.kt │ │ └── condition │ │ ├── ConditionOperator.kt │ │ └── ConditionParser.kt │ ├── particlelib │ ├── EffectBezier.kt │ ├── EffectData.kt │ ├── EffectGeneric.kt │ ├── EffectRenderer.kt │ ├── package-info.java │ ├── pobject │ │ ├── Arc.kt │ │ ├── Astroid.kt │ │ ├── Circle.kt │ │ ├── Cube.kt │ │ ├── EffectGroup.kt │ │ ├── FilledCircle.kt │ │ ├── Grid.kt │ │ ├── Heart.kt │ │ ├── Line.kt │ │ ├── Lotus.kt │ │ ├── ParticleObject.kt │ │ ├── Playable.kt │ │ ├── Polygon.kt │ │ ├── Ray.kt │ │ ├── ShowType.kt │ │ ├── Sphere.kt │ │ ├── Star.kt │ │ ├── Wing.kt │ │ ├── bezier │ │ │ ├── NRankBezierCurve.kt │ │ │ ├── ThreeRankBezierCurve.kt │ │ │ ├── TwoRankBezierCurve.kt │ │ │ └── package-info.kt │ │ ├── equation │ │ │ ├── Equations.kt │ │ │ ├── GeneralEquationRenderer.kt │ │ │ ├── ParametricEquationRenderer.kt │ │ │ ├── PolarEquationRenderer.kt │ │ │ └── package-info.kt │ │ └── package-info.kt │ └── utils │ │ ├── Icosahedron.kt │ │ ├── LocationUtils.kt │ │ ├── VectorUtils.kt │ │ ├── coordinate │ │ ├── Coordinate.kt │ │ ├── PlayerBackCoordinate.kt │ │ ├── PlayerFixedCoordinate.kt │ │ ├── PlayerFrontCoordinate.kt │ │ └── package-info.kt │ │ ├── matrix │ │ ├── Matrix.kt │ │ ├── Matrixs.kt │ │ └── package-info.kt │ │ ├── package-info.kt │ │ └── projector │ │ ├── ThreeDProjector.kt │ │ ├── TwoDProjector.kt │ │ └── package-info.kt │ └── pouvoir │ ├── Pouvoir.kt │ ├── api │ ├── PouvoirAPI.kt │ ├── feature │ │ ├── anticheat │ │ │ └── BypassCheat.kt │ │ ├── condition │ │ │ ├── BaseCondition.kt │ │ │ ├── Condition.kt │ │ │ ├── ConditionData.kt │ │ │ └── ConditionReader.kt │ │ ├── database │ │ │ ├── BaseContainer.kt │ │ │ ├── ContainerHolder.kt │ │ │ ├── DatabaseType.kt │ │ │ ├── UserBased.kt │ │ │ └── sql │ │ │ │ └── IPouTable.kt │ │ ├── handler │ │ │ ├── BaseDispatcher.kt │ │ │ └── BaseHandler.kt │ │ ├── hologram │ │ │ ├── HologramBuilder.kt │ │ │ └── IHologram.kt │ │ ├── operation │ │ │ ├── NumberOperation.kt │ │ │ ├── Operation.kt │ │ │ ├── OperationElement.kt │ │ │ └── StringOperation.kt │ │ ├── placeholder │ │ │ └── PouPlaceHolder.kt │ │ ├── realizer │ │ │ ├── BaseRealizer.kt │ │ │ ├── BaseRealizerManager.kt │ │ │ └── component │ │ │ │ ├── Awakeable.kt │ │ │ │ ├── Realizable.kt │ │ │ │ ├── ScheduledRealizer.kt │ │ │ │ ├── Switchable.kt │ │ │ │ ├── Sync.kt │ │ │ │ ├── Valuable.kt │ │ │ │ └── Vanillable.kt │ │ ├── selector │ │ │ ├── BaseSelector.kt │ │ │ ├── EntityFlag.kt │ │ │ ├── SelectResult.kt │ │ │ ├── SimpleSelector.kt │ │ │ ├── Target.kt │ │ │ ├── Util.kt │ │ │ └── target │ │ │ │ ├── EntityTarget.kt │ │ │ │ └── LocTarget.kt │ │ └── trigger │ │ │ ├── BaseTrigger.kt │ │ │ ├── BukkitTrigger.kt │ │ │ └── TriggerController.kt │ ├── manager │ │ ├── ConfigManager.kt │ │ ├── Manager.kt │ │ ├── ManagerData.kt │ │ └── sub │ │ │ ├── AntiCheatManager.kt │ │ │ ├── ConditionManager.kt │ │ │ ├── DatabaseManager.kt │ │ │ ├── HologramManager.kt │ │ │ ├── ListenerManager.kt │ │ │ ├── OperationManager.kt │ │ │ ├── PouPlaceholderManager.kt │ │ │ ├── SelectorManager.kt │ │ │ ├── TriggerHandlerManager.kt │ │ │ ├── TriggerManager.kt │ │ │ └── script │ │ │ ├── CompileManager.kt │ │ │ ├── ScriptAnnotationManager.kt │ │ │ ├── ScriptEngineManager.kt │ │ │ └── ScriptManager.kt │ ├── plugin │ │ ├── ManagerTime.kt │ │ ├── SubPouvoir.kt │ │ ├── TotalManager.kt │ │ ├── Util.kt │ │ ├── annotation │ │ │ ├── AutoRegister.kt │ │ │ └── PouManager.kt │ │ ├── handler │ │ │ └── ClassHandler.kt │ │ ├── map │ │ │ ├── BaseMap.kt │ │ │ ├── DataMap.kt │ │ │ ├── KeyMap.kt │ │ │ ├── LinkedKeyMap.kt │ │ │ ├── LinkedMap.kt │ │ │ ├── LowerKeyMap.kt │ │ │ ├── LowerMap.kt │ │ │ ├── MultiExecMap.kt │ │ │ ├── MultiMap.kt │ │ │ ├── RegContainer.kt │ │ │ ├── SingleExecMap.kt │ │ │ └── component │ │ │ │ ├── Keyable.kt │ │ │ │ └── Registrable.kt │ │ ├── object │ │ │ ├── BaseObject.kt │ │ │ └── Releasable.kt │ │ └── package-info.java │ └── script │ │ ├── PouFileCompiledScript.kt │ │ ├── ProtocolTool.kt │ │ ├── ScriptTool.kt │ │ ├── annotation │ │ ├── ScriptAnnotation.kt │ │ └── ScriptAnnotationData.kt │ │ └── engine │ │ ├── PouScriptEngine.kt │ │ └── hook │ │ ├── PouCompiler.kt │ │ └── ScriptBridge.kt │ ├── internal │ ├── command │ │ ├── PouvoirCommand.kt │ │ └── sub │ │ │ ├── PouMirrorCommand.kt │ │ │ └── PouScriptCommand.kt │ ├── core │ │ ├── asahi │ │ │ ├── AsahiInject.kt │ │ │ ├── infix │ │ │ │ ├── bukkit │ │ │ │ │ ├── InfixBossBar.kt │ │ │ │ │ ├── InfixCancellable.kt │ │ │ │ │ ├── InfixEntity.kt │ │ │ │ │ ├── InfixLivingEntity.kt │ │ │ │ │ ├── InfixLocation.kt │ │ │ │ │ ├── InfixPlayer.kt │ │ │ │ │ └── InfixVector.kt │ │ │ │ └── database │ │ │ │ │ └── InfixContainerHolder.kt │ │ │ ├── linking │ │ │ │ └── js │ │ │ │ │ ├── NativeJSFunction.kt │ │ │ │ │ └── NativeJSFunctionImpl.kt │ │ │ ├── prefix │ │ │ │ ├── bukkit │ │ │ │ │ ├── Basic.kt │ │ │ │ │ ├── Condition.kt │ │ │ │ │ ├── Item.kt │ │ │ │ │ ├── LivingEntity.kt │ │ │ │ │ ├── Player.kt │ │ │ │ │ ├── Selector.kt │ │ │ │ │ ├── Task.kt │ │ │ │ │ ├── World.kt │ │ │ │ │ └── particle │ │ │ │ │ │ ├── Particle.kt │ │ │ │ │ │ └── ParticleData.kt │ │ │ │ └── database │ │ │ │ │ ├── Database.kt │ │ │ │ │ ├── MongoDB.kt │ │ │ │ │ ├── Redis.kt │ │ │ │ │ └── sql │ │ │ │ │ ├── Sql.kt │ │ │ │ │ └── Where.kt │ │ │ └── util │ │ │ │ ├── PlayerAsOp.kt │ │ │ │ └── Task.kt │ │ ├── plugin │ │ │ ├── PouManagerUtils.kt │ │ │ └── SubPouvoirHandler.kt │ │ └── script │ │ │ ├── asahi │ │ │ ├── AsahiBridge.kt │ │ │ └── PouAsahiScriptEngine.kt │ │ │ ├── common │ │ │ └── annotation │ │ │ │ ├── Annotation.kt │ │ │ │ ├── AsahiInfix.kt │ │ │ │ ├── AsahiPrefix.kt │ │ │ │ ├── Awake.kt │ │ │ │ ├── Condition.kt │ │ │ │ ├── Listener.kt │ │ │ │ ├── NumberOperation.kt │ │ │ │ ├── Placeholder.kt │ │ │ │ ├── PouPlaceholder.kt │ │ │ │ ├── Selector.kt │ │ │ │ ├── SimpleSelector.kt │ │ │ │ └── StringOperation.kt │ │ │ ├── groovy │ │ │ ├── GroovyBridge.kt │ │ │ └── PouGroovyScriptEngine.kt │ │ │ └── javascript │ │ │ ├── JSGlobal.kt │ │ │ ├── JSStaticClass.kt │ │ │ ├── PouJavaScriptEngine.kt │ │ │ └── impl │ │ │ ├── NashornLegacy.kt │ │ │ └── NashornNew.kt │ ├── feature │ │ ├── compat │ │ │ └── placeholder │ │ │ │ ├── PlaceholderAPIHooker.kt │ │ │ │ └── PouvoirHooker.kt │ │ ├── database │ │ │ ├── PouvoirContainer.kt │ │ │ ├── mongodb │ │ │ │ ├── MongoContainer.kt │ │ │ │ ├── MongoContainerHolder.kt │ │ │ │ ├── MongoDB.kt │ │ │ │ └── MongoUserContainer.kt │ │ │ ├── redis │ │ │ │ ├── Redis.kt │ │ │ │ ├── RedisContainer.kt │ │ │ │ ├── RedisContainerHolder.kt │ │ │ │ └── RedisUserContainer.kt │ │ │ └── sql │ │ │ │ ├── NormalContainer.kt │ │ │ │ ├── SQLTable.kt │ │ │ │ ├── UserContainer.kt │ │ │ │ ├── UserDatabase.kt │ │ │ │ ├── sql │ │ │ │ ├── SQL.kt │ │ │ │ └── SQLContainerHolder.kt │ │ │ │ └── sqlite │ │ │ │ ├── SQLite.kt │ │ │ │ └── SQLiteContainerHolder.kt │ │ ├── dispatcher │ │ │ ├── SimpleDispatcher.kt │ │ │ └── SimpleDispatcherBuilder.kt │ │ ├── handler │ │ │ ├── AsahiHandler.kt │ │ │ ├── AsahiHandlerBuilder.kt │ │ │ └── Native.kt │ │ ├── hologram │ │ │ ├── ConcurrentHashSet.kt │ │ │ ├── Hologram.kt │ │ │ ├── HologramLine.kt │ │ │ ├── PouHolo.kt │ │ │ └── impl │ │ │ │ ├── PouAdyHologramsLine.kt │ │ │ │ ├── PouDecentHologramsLine.kt │ │ │ │ └── PouEmptyHoloLine.kt │ │ ├── listener │ │ │ ├── CustomListener.kt │ │ │ └── Priority.kt │ │ ├── operation │ │ │ ├── num │ │ │ │ ├── OperationMax.kt │ │ │ │ ├── OperationMin.kt │ │ │ │ ├── OperationPlus.kt │ │ │ │ ├── OperationReduce.kt │ │ │ │ └── OperationScalar.kt │ │ │ └── str │ │ │ │ ├── OperationAppend.kt │ │ │ │ └── OperationSkip.kt │ │ ├── raytrace │ │ │ └── RayTrace.kt │ │ ├── selector │ │ │ ├── Amount.kt │ │ │ ├── Cone.kt │ │ │ ├── Flag.kt │ │ │ ├── Line.kt │ │ │ ├── LookAt.kt │ │ │ ├── Nearest.kt │ │ │ ├── Projectile.kt │ │ │ ├── Range.kt │ │ │ ├── Self.kt │ │ │ ├── Side.kt │ │ │ └── TargetHelper.kt │ │ └── trigger │ │ │ ├── Util.kt │ │ │ ├── bukkit │ │ │ ├── BukkitEventTrigger.kt │ │ │ ├── BukkitTriggerController.kt │ │ │ └── EventNameHandler.kt │ │ │ └── custom │ │ │ ├── CustomTrigger.kt │ │ │ ├── CustomTriggerController.kt │ │ │ └── CustomTriggerHandler.kt │ └── manager │ │ ├── AntiCheatManagerImpl.kt │ │ ├── CompileManagerImpl.kt │ │ ├── ConditionManagerImpl.kt │ │ ├── DatabaseManagerImpl.kt │ │ ├── HologramManagerImpl.kt │ │ ├── ListenerManagerImpl.kt │ │ ├── OperationManagerImpl.kt │ │ ├── PouConfig.kt │ │ ├── PouPlaceholderManagerImpl.kt │ │ ├── ScriptAnnotationManagerImpl.kt │ │ ├── ScriptEngineManagerImpl.kt │ │ ├── ScriptManagerImpl.kt │ │ ├── SelectorManagerImpl.kt │ │ ├── TriggerHandlerManagerImpl.kt │ │ └── TriggerManagerImpl.kt │ └── util │ ├── CalculationUtil.kt │ ├── ClassUtil.kt │ ├── Coerce.kt │ ├── EntityUtil.kt │ ├── FileUtil.kt │ ├── GsonUtil.kt │ ├── MapUtil.kt │ ├── NumberUtil.kt │ ├── PlayerUtil.kt │ ├── RunUtil.kt │ ├── StringUtil.kt │ ├── Tick.kt │ ├── TypeUtil.kt │ ├── VectorUtil.kt │ ├── attribute │ ├── AttributeUtils.kt │ ├── BukkitAttribute.kt │ └── DefaultAttribute.kt │ ├── calculate │ ├── CalcOperator.kt │ └── FormulaParser.kt │ ├── legacy │ └── Mirror.kt │ ├── nms │ ├── NMS.kt │ └── NMSImpl.kt │ ├── package-info.java │ ├── plugin │ ├── Pair.kt │ └── PluginUtils.kt │ ├── read │ └── RegexUtil.kt │ └── script │ ├── ColorUtil.kt │ ├── ItemUtil.kt │ └── MessageUtil.kt └── resources ├── config.yml ├── dispatchers └── custom-trigger.yml ├── handlers └── simple-handler.yml ├── lang ├── en_US.yml └── zh_CN.yml ├── script.yml └── scripts ├── conditions ├── altitude.js ├── fire.js ├── food.js ├── ground.js ├── health.js ├── level.js ├── permission.js ├── player.js ├── water.js ├── weather.js └── world.js ├── core ├── asahi.js ├── basic.js └── util │ ├── Selector.js │ ├── color.js │ ├── container.js │ ├── message.js │ ├── number.js │ ├── placeholder.js │ ├── player.js │ └── ray_trace.js ├── example.js ├── groovy.groovy ├── operation └── str_roman.js └── test.asahi /.gitignore: -------------------------------------------------------------------------------- 1 | .gradle 2 | .idea 3 | build 4 | -------------------------------------------------------------------------------- /bin/main/com/skillw/asahi/api/InlineAnalysis.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.asahi.api 2 | 3 | import com.skillw.asahi.api.member.context.AsahiContext 4 | import com.skillw.asahi.api.member.namespace.NamespaceHolder 5 | import com.skillw.asahi.internal.lexer.InlineAnalysisImpl 6 | 7 | /** 8 | * @className InlineReaderImpl 9 | * 10 | * @author Glom 11 | * @date 2023/1/14 10:04 Copyright 2024 Glom. 12 | */ 13 | interface InlineAnalysis : NamespaceHolder { 14 | /** 15 | * 根据上下文解析内联文本 16 | * 17 | * @param context 上下文 18 | * @return 解析后的内联文本 19 | */ 20 | fun analysis(context: AsahiContext = AsahiContext.create()): String 21 | 22 | companion object { 23 | /** 24 | * 创建内联文本解释器对象 25 | * 26 | * @param string String 文本 27 | * @return InlineAnalysis 28 | */ 29 | 30 | fun of(string: String): InlineAnalysis { 31 | return InlineAnalysisImpl.of(string) 32 | } 33 | } 34 | } -------------------------------------------------------------------------------- /bin/main/com/skillw/asahi/api/annotation/AsahiGetter.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.asahi.api.annotation 2 | 3 | annotation class AsahiGetter() 4 | -------------------------------------------------------------------------------- /bin/main/com/skillw/asahi/api/annotation/AsahiInfix.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.asahi.api.annotation 2 | 3 | /** 4 | * Asahi Infix annotation 5 | * 6 | * 自动注册 7 | * 8 | * @constructor Asahi Infix annotation 9 | */ 10 | annotation class AsahiInfix 11 | -------------------------------------------------------------------------------- /bin/main/com/skillw/asahi/api/annotation/AsahiNamespace.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.asahi.api.annotation 2 | 3 | annotation class AsahiNamespace() 4 | -------------------------------------------------------------------------------- /bin/main/com/skillw/asahi/api/annotation/AsahiPrefix.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.asahi.api.annotation 2 | 3 | /** 4 | * Asahi Prefix annotation 5 | * 6 | * 自动注册 7 | * 8 | * @constructor Asahi Prefix annotation 9 | */ 10 | @Target(AnnotationTarget.CLASS, AnnotationTarget.FUNCTION, AnnotationTarget.FIELD) 11 | annotation class AsahiPrefix(val names: Array = [], val namespace: String = "common") 12 | -------------------------------------------------------------------------------- /bin/main/com/skillw/asahi/api/annotation/AsahiSetter.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.asahi.api.annotation 2 | 3 | annotation class AsahiSetter() 4 | -------------------------------------------------------------------------------- /bin/main/com/skillw/asahi/api/annotation/AsahiTopParser.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.asahi.api.annotation 2 | 3 | /** 4 | * Asahi Top Parser annotation 5 | * 6 | * 自动注册 7 | * 8 | * @constructor Asahi Top parser annotation 9 | */ 10 | @Target(AnnotationTarget.CLASS) 11 | annotation class AsahiTopParser 12 | -------------------------------------------------------------------------------- /bin/main/com/skillw/asahi/api/annotation/AsahiTypeParser.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.asahi.api.annotation 2 | 3 | /** 4 | * Asahi Type Parser annotation 5 | * 6 | * 自动注册 7 | * 8 | * @constructor Asahi Type parser annotation 9 | */ 10 | @Target(AnnotationTarget.CLASS, AnnotationTarget.FUNCTION, AnnotationTarget.FIELD) 11 | annotation class AsahiTypeParser 12 | -------------------------------------------------------------------------------- /bin/main/com/skillw/asahi/api/member/AsahiRegistrable.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.asahi.api.member 2 | 3 | /** 4 | * @className Registrable 5 | * 6 | * @author Glom 7 | * @date 2022/7/18 7:56 Copyright 2022 user. 8 | * 9 | * 可注册的类 10 | */ 11 | interface AsahiRegistrable { 12 | /** 键 */ 13 | val key: K 14 | fun register() 15 | } -------------------------------------------------------------------------------- /bin/main/com/skillw/asahi/api/member/context/LoopContext.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.asahi.api.member.context 2 | 3 | interface LoopContext { 4 | val label: String 5 | var isBreak: Boolean 6 | var isContinue: Boolean 7 | val parent: LoopContext? 8 | val subLoops: HashSet 9 | fun searchLabel(label: String): LoopContext 10 | 11 | enum class Result { 12 | BREAK, CONTINUE 13 | } 14 | } -------------------------------------------------------------------------------- /bin/main/com/skillw/asahi/api/member/lexer/AsahiDemand.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.asahi.api.member.lexer 2 | 3 | import com.skillw.asahi.internal.lexer.AsahiDemandImpl 4 | import com.skillw.asahi.util.AsahiDataMap 5 | import org.bukkit.entity.Entity 6 | 7 | /** 8 | * @className PouDemand 9 | * 10 | * @author Glom 11 | * @date 2023/1/14 12:38 Copyright 2024 Glom. 12 | */ 13 | abstract class AsahiDemand(val entity: Entity? = null) : AsahiDataMap() { 14 | companion object { 15 | fun of(string: String): AsahiDemand { 16 | return AsahiDemandImpl.of(string) 17 | } 18 | } 19 | 20 | abstract fun tag(tag: String): Boolean 21 | 22 | abstract fun tagAnyOf(vararg tags: String): Boolean 23 | 24 | abstract fun tagAllOf(vararg tags: String): Boolean 25 | 26 | abstract val args: ArrayList 27 | abstract val tags: LinkedHashSet 28 | } -------------------------------------------------------------------------------- /bin/main/com/skillw/asahi/api/member/lexer/JavaLexer.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.asahi.api.member.lexer 2 | 3 | import com.skillw.asahi.api.member.context.AsahiContext 4 | import com.skillw.asahi.api.member.quest.Quester 5 | 6 | /** 7 | * @className JavaFuncReader 8 | * 9 | * @author Glom 10 | * @date 2023/1/15 13:18 Copyright 2024 Glom. 11 | */ 12 | class JavaLexer(reader: AsahiLexer) : AsahiLexer by reader { 13 | /** 14 | * 加了一层类型转换的quest 15 | * 16 | * @param R 类型 17 | * @return 18 | */ 19 | fun questAs(): Quester { 20 | return questObj() as Quester 21 | } 22 | 23 | /** 24 | * 结果 25 | * 26 | * @param exec 结果内容 27 | * @param R 返回类型 28 | * @return 29 | * @receiver 30 | */ 31 | fun result(exec: AsahiContext.() -> R): Quester { 32 | return Quester { exec() } 33 | } 34 | } -------------------------------------------------------------------------------- /bin/main/com/skillw/asahi/api/member/lexer/tokenizer/Line.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.asahi.api.member.lexer.tokenizer 2 | 3 | data class Line(val lineNumber: Int, val range: IntRange) 4 | -------------------------------------------------------------------------------- /bin/main/com/skillw/asahi/api/member/namespace/Namespacing.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.asahi.api.member.namespace 2 | 3 | import com.skillw.asahi.api.AsahiManager 4 | 5 | /** 6 | * @className Namespacing 7 | * 8 | * 在命名空间中储藏的类 9 | * 10 | * @author Glom 11 | * @date 2023/1/20 10:12 Copyright 2024 Glom. 12 | */ 13 | interface Namespacing { 14 | /** 命名空间 */ 15 | val namespace: String 16 | 17 | /** 18 | * 命名空间对象 19 | * 20 | * @return 命名空间对象 21 | */ 22 | fun namespace(): Namespace { 23 | return AsahiManager.getNamespace(namespace) 24 | } 25 | } -------------------------------------------------------------------------------- /bin/main/com/skillw/asahi/api/member/parser/infix/namespacing/InfixExecutor.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.asahi.api.member.parser.infix.namespacing 2 | 3 | import com.skillw.asahi.api.member.context.InfixContext 4 | 5 | 6 | /** 7 | * @className InfixExecutor 8 | * 9 | * @author Glom 10 | * @date 2022年12月27日 8:36 Copyright 2022 user. 11 | */ 12 | fun interface InfixExecutor { 13 | /** 14 | * 执行中缀解释器执行内容 15 | * 16 | * @param obj 对象 17 | * @return 结果 18 | */ 19 | fun InfixContext.execute(obj: T): Any? 20 | 21 | /** 22 | * 执行中缀解释器执行内容 23 | * 24 | * @param context 上下文 25 | * @param obj 对象 26 | * @return 结果 27 | */ 28 | @Suppress("UNCHECKED_CAST") 29 | fun run(context: InfixContext, obj: Any): Any? { 30 | return context.run { execute(obj as? T ?: return null) } 31 | } 32 | } -------------------------------------------------------------------------------- /bin/main/com/skillw/asahi/api/member/parser/prefix/PrefixParser.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.asahi.api.member.parser.prefix 2 | 3 | import com.skillw.asahi.api.member.lexer.AsahiLexer 4 | import com.skillw.asahi.api.member.quest.Quester 5 | 6 | /** 7 | * @className Parser 8 | * 9 | * @author Glom 10 | * @date 2023/1/15 13:14 Copyright 2024 Glom. 11 | */ 12 | interface PrefixParser { 13 | /** 14 | * 前缀解释器执行内容 15 | * 16 | * @param lexer 词法器 17 | * @return 结果 18 | */ 19 | fun parseWith(lexer: AsahiLexer): Quester? 20 | } -------------------------------------------------------------------------------- /bin/main/com/skillw/asahi/api/member/parser/prefix/namespacing/BaseJavaPrefix.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.asahi.api.member.parser.prefix.namespacing 2 | 3 | import com.skillw.asahi.api.member.lexer.JavaLexer 4 | import com.skillw.asahi.api.member.quest.Quester 5 | 6 | 7 | /** 8 | * @className BaseJavaPrefix 9 | * 10 | * @author Glom 11 | * @date 2022/12/25 13:39 Copyright 2022 user. 12 | */ 13 | abstract class BaseJavaPrefix : PrefixCreator { 14 | /** 15 | * 解释器执行内容 16 | * 17 | * @return 18 | */ 19 | protected abstract fun JavaLexer.parse(): Quester 20 | override fun PrefixParser.parse(): Quester { 21 | return JavaLexer(this).parse() 22 | } 23 | } -------------------------------------------------------------------------------- /bin/main/com/skillw/asahi/api/member/parser/prefix/namespacing/PrefixParser.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.asahi.api.member.parser.prefix.namespacing 2 | 3 | import com.skillw.asahi.api.member.context.AsahiContext 4 | import com.skillw.asahi.api.member.lexer.AsahiLexer 5 | import com.skillw.asahi.api.member.quest.Quester 6 | 7 | /** 8 | * @className PrefixParser 9 | * 10 | * 前缀解释器的编译上下文 11 | * 12 | * @author Glom 13 | * @date 2022/12/27 19:31 Copyright 2022 user. 14 | */ 15 | class PrefixParser private constructor( 16 | reader: AsahiLexer, 17 | ) : AsahiLexer by reader { 18 | companion object { 19 | fun AsahiLexer.prefixParser(): PrefixParser { 20 | return PrefixParser(this) 21 | } 22 | } 23 | 24 | /** 25 | * 结果 26 | * 27 | * @param exec 结果内容 28 | * @param R 返回类型 29 | * @return 返回的结果 30 | * @receiver 31 | */ 32 | fun result(exec: AsahiContext.() -> R): Quester { 33 | return Quester { exec() } 34 | } 35 | } -------------------------------------------------------------------------------- /bin/main/com/skillw/asahi/api/member/parser/prefix/type/JavaTypeParser.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.asahi.api.member.parser.prefix.type 2 | 3 | import com.skillw.asahi.api.member.lexer.AsahiLexer 4 | import com.skillw.asahi.api.member.lexer.JavaLexer 5 | import com.skillw.asahi.api.member.quest.Quester 6 | import com.skillw.asahi.api.quester 7 | 8 | 9 | /** 10 | * @className JavaTypeParser 11 | * 12 | * @author Glom 13 | * @date 2022/12/25 13:39 Copyright 2022 user. 14 | */ 15 | abstract class JavaTypeParser( 16 | vararg types: Class<*>, 17 | ) : TypeParser(*types) { 18 | 19 | 20 | override fun AsahiLexer.parse(): Quester { 21 | return JavaLexer(this).parse() 22 | } 23 | 24 | /** 25 | * 类型解释器内容 26 | * 27 | * @return 解释结果 28 | */ 29 | protected abstract fun JavaLexer.parse(): Quester 30 | 31 | override fun parseWith(lexer: AsahiLexer): Quester { 32 | val parser = JavaLexer(lexer).parse() 33 | return quester { 34 | parser.get() 35 | } 36 | } 37 | } -------------------------------------------------------------------------------- /bin/main/com/skillw/asahi/api/member/quest/LazyQuester.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.asahi.api.member.quest 2 | 3 | /** 4 | * @className LazyQuester 5 | * 6 | * 懒人式对象获取器 7 | * 8 | * 将此对象的变量放到上下文中后,解释变量后会返回执行内容 9 | * 10 | * @author Glom 11 | * @date 2023/1/14 11:47 Copyright 2024 Glom. 12 | */ 13 | fun interface LazyQuester : Quester -------------------------------------------------------------------------------- /bin/main/com/skillw/asahi/api/member/quest/Quester.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.asahi.api.member.quest 2 | 3 | import com.skillw.asahi.api.member.context.AsahiContext 4 | 5 | fun interface Quester { 6 | /** 7 | * 在上下文中执行/获取 8 | * 9 | * @return R 10 | * @receiver AsahiContext 11 | */ 12 | fun AsahiContext.execute(): R 13 | 14 | fun run(context: AsahiContext): R { 15 | return context.run { execute() } 16 | } 17 | 18 | fun get(context: AsahiContext): R { 19 | return context.execute() 20 | } 21 | 22 | } -------------------------------------------------------------------------------- /bin/main/com/skillw/asahi/api/member/quest/VarBeanQuester.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.asahi.api.member.quest 2 | 3 | fun interface VarBeanQuester : Quester -------------------------------------------------------------------------------- /bin/main/com/skillw/asahi/api/script/AsahiQuestException.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.asahi.api.script 2 | 3 | class AsahiQuestException(message: String, throwable: Throwable? = null) : Exception(message, throwable) -------------------------------------------------------------------------------- /bin/main/com/skillw/asahi/api/script/AsahiScriptException.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.asahi.api.script 2 | 3 | /** 4 | * @className AsahiScriptException 5 | * 6 | * @author Glom 7 | * @date 2023/1/4 18:33 Copyright 2022 user. 8 | */ 9 | class AsahiScriptException(message: String, throwable: Throwable? = null) : Exception(message, throwable) 10 | -------------------------------------------------------------------------------- /bin/main/com/skillw/asahi/api/script/linking/Invoker.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.asahi.api.script.linking 2 | 3 | import com.skillw.asahi.api.member.context.AsahiContext 4 | 5 | /** 6 | * @className Invoker 7 | * 8 | * @author Glom 9 | * @date 2023/1/22 19:00 Copyright 2024 Glom. 10 | */ 11 | fun interface Invoker { 12 | fun invoke(context: AsahiContext, vararg params: Any?): Any? 13 | } -------------------------------------------------------------------------------- /bin/main/com/skillw/asahi/api/script/linking/InvokerHolder.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.asahi.api.script.linking 2 | 3 | /** 4 | * @className InvokerHolder 5 | * 6 | * @author Glom 7 | * @date 2023/1/22 19:06 Copyright 2024 Glom. 8 | */ 9 | interface InvokerHolder { 10 | /** 可调用对象 当前上下文中的可调用对象 */ 11 | val invokers: HashMap 12 | 13 | 14 | /** 15 | * Has invoker 16 | * 17 | * @param key 18 | * @return 19 | */ 20 | fun hasInvoker(key: String): Boolean { 21 | return invokers.containsKey(key) 22 | } 23 | 24 | /** 25 | * Add invoker 26 | * 27 | * @param key 28 | * @param invoker 29 | */ 30 | fun addInvoker(key: String, invoker: Invoker) { 31 | invokers[key] = invoker 32 | } 33 | } -------------------------------------------------------------------------------- /bin/main/com/skillw/asahi/internal/function/lang/java/ExampleAction.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Skillw/Pouvoir/955039bd3633a4481838fe85ecc122ee6b228ce7/bin/main/com/skillw/asahi/internal/function/lang/java/ExampleAction.class -------------------------------------------------------------------------------- /bin/main/com/skillw/asahi/internal/function/lang/java/ExampleFunction.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Skillw/Pouvoir/955039bd3633a4481838fe85ecc122ee6b228ce7/bin/main/com/skillw/asahi/internal/function/lang/java/ExampleFunction.class -------------------------------------------------------------------------------- /bin/main/com/skillw/asahi/internal/function/lang/java/ExampleParser.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Skillw/Pouvoir/955039bd3633a4481838fe85ecc122ee6b228ce7/bin/main/com/skillw/asahi/internal/function/lang/java/ExampleParser.class -------------------------------------------------------------------------------- /bin/main/com/skillw/asahi/internal/namespace/Common.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.asahi.internal.namespace 2 | 3 | import com.skillw.asahi.api.member.namespace.Namespace 4 | 5 | 6 | object Common : Namespace("common", true) -------------------------------------------------------------------------------- /bin/main/com/skillw/asahi/internal/namespace/Lang.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.asahi.internal.namespace 2 | 3 | import com.skillw.asahi.api.member.namespace.Namespace 4 | 5 | 6 | object Lang : Namespace("lang", true) -------------------------------------------------------------------------------- /bin/main/com/skillw/asahi/internal/namespacing/infix/InfixMatchResult.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.asahi.internal.namespacing.infix 2 | 3 | import com.skillw.asahi.api.annotation.AsahiInfix 4 | import com.skillw.asahi.api.member.parser.infix.namespacing.BaseInfix 5 | 6 | @AsahiInfix 7 | internal object InfixMatchResult : BaseInfix(MatchResult::class.java, "regex") { 8 | init { 9 | infix("value") { result -> 10 | result.value 11 | } 12 | infix("groups") { result -> 13 | if (expect("of")) { 14 | result.groups[parseString()]?.value 15 | } 16 | if (expect("at")) { 17 | result.groups[parseInt()]?.value 18 | } else 19 | result.groupValues 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /bin/main/com/skillw/asahi/internal/namespacing/infix/linking/InfixBool.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.asahi.internal.namespacing.infix.linking 2 | 3 | import com.skillw.asahi.api.annotation.AsahiInfix 4 | import com.skillw.asahi.api.member.parser.infix.namespacing.BaseInfix 5 | 6 | /** 7 | * @className ActionBool 8 | * 9 | * @author Glom 10 | * @date 2022年12月13日14点47分 Copyright 2022 user. 11 | */ 12 | @AsahiInfix 13 | internal object InfixBool : BaseInfix(Boolean::class.java) { 14 | init { 15 | infix("?") { bool -> 16 | if (bool) { 17 | val result = parse() 18 | expect(":") 19 | skip() 20 | result 21 | } else { 22 | skip() 23 | expect(":") 24 | parse() 25 | } 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /bin/main/com/skillw/asahi/internal/namespacing/infix/linking/InfixCompletableFuture.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.asahi.internal.namespacing.infix.linking 2 | 3 | import com.skillw.asahi.api.annotation.AsahiInfix 4 | import com.skillw.asahi.api.member.parser.infix.namespacing.BaseInfix 5 | import java.util.concurrent.CompletableFuture 6 | 7 | /** 8 | * @className ActionCompletableFuture 9 | * 10 | * @author Glom 11 | * @date 2023年1月16日23点47分 Copyright 2024 Glom. 12 | */ 13 | @AsahiInfix 14 | internal object InfixCompletableFuture : BaseInfix>(CompletableFuture::class.java) { 15 | init { 16 | infix("join") { future -> 17 | future.join() 18 | } 19 | } 20 | } -------------------------------------------------------------------------------- /bin/main/com/skillw/asahi/internal/namespacing/infix/linking/InfixPair.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.asahi.internal.namespacing.infix.linking 2 | 3 | import com.skillw.asahi.api.annotation.AsahiInfix 4 | import com.skillw.asahi.api.member.parser.infix.namespacing.BaseInfix 5 | 6 | /** 7 | * @className ActionPair 8 | * 9 | * @author Glom 10 | * @date 2022/8/9 16:26 Copyright 2022 user. 11 | */ 12 | @AsahiInfix 13 | internal object InfixPair : BaseInfix>(Pair::class.java) { 14 | init { 15 | "key" to { it.first } 16 | "value" to { it.second } 17 | } 18 | } -------------------------------------------------------------------------------- /bin/main/com/skillw/asahi/internal/namespacing/prefix/lang/util/String.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.asahi.internal.namespacing.prefix.lang.util 2 | 3 | import com.skillw.asahi.api.AsahiAPI.analysis 4 | import com.skillw.asahi.api.annotation.AsahiPrefix 5 | import com.skillw.asahi.api.prefixParser 6 | import com.skillw.asahi.api.quest 7 | 8 | /** 9 | * @className String 10 | * 11 | * @author Glom 12 | * @date 2023/1/17 15:37 Copyright 2024 Glom. 13 | */ 14 | @AsahiPrefix(["analysis", "inline"], "lang") 15 | private fun inline() = prefixParser { 16 | val text = if (expect("all")) questList() else quest() 17 | result { 18 | text.get().let { obj -> 19 | when (obj) { 20 | is Collection<*> -> obj.map { it.toString().analysis(this, *namespaceNames()) } 21 | else -> obj.toString().analysis(this, *namespaceNames()) 22 | } 23 | } 24 | } 25 | } 26 | 27 | 28 | -------------------------------------------------------------------------------- /bin/main/com/skillw/asahi/internal/util/AsahiClassBean.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Skillw/Pouvoir/955039bd3633a4481838fe85ecc122ee6b228ce7/bin/main/com/skillw/asahi/internal/util/AsahiClassBean.class -------------------------------------------------------------------------------- /bin/main/com/skillw/asahi/internal/util/Clock.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.asahi.internal.util 2 | 3 | import com.skillw.pouvoir.internal.feature.database.PouvoirContainer 4 | import taboolib.common.LifeCycle 5 | import taboolib.common.platform.Awake 6 | import taboolib.common.platform.function.submit 7 | import taboolib.common5.Coerce 8 | 9 | object Clock { 10 | var currentTick: Long = 0 11 | @Synchronized 12 | get 13 | private set 14 | 15 | @Awake(LifeCycle.ACTIVE) 16 | fun start() { 17 | currentTick = Coerce.toLong(PouvoirContainer["COMMON", "CLOCK_TICKS"]) 18 | submit(async = true, period = 1) { 19 | currentTick++ 20 | } 21 | } 22 | 23 | @Awake(LifeCycle.DISABLE) 24 | fun disable() { 25 | PouvoirContainer["COMMON", "CLOCK_TICKS"] = currentTick.toString() 26 | } 27 | } -------------------------------------------------------------------------------- /bin/main/com/skillw/asahi/internal/util/MapTemplate.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.asahi.internal.util 2 | 3 | data class MapTemplate(val keys: List) { 4 | fun build(values: List): MutableMap { 5 | return keys.zip(values).toMap().toMutableMap() 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /bin/main/com/skillw/asahi/internal/util/Time.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.asahi.internal.util 2 | 3 | import taboolib.common5.util.parseMillis 4 | 5 | /** 6 | * @className Time 7 | * 8 | * @author Glom 9 | * @date 2023/1/11 23:25 Copyright 2024 Glom. 10 | */ 11 | class Time(var millis: Long) { 12 | constructor(string: String) : this(string.parseMillis()) 13 | 14 | fun toTick(): Long = millis / 50 15 | 16 | companion object { 17 | 18 | val noTime = Time(-1) 19 | 20 | 21 | fun tick(tick: Long): Time { 22 | return Time(tick * 50) 23 | } 24 | } 25 | } -------------------------------------------------------------------------------- /bin/main/com/skillw/asahi/util/Deserialize.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.asahi.util 2 | 3 | import com.skillw.asahi.api.AsahiAPI.compile 4 | import com.skillw.asahi.api.lazyQuester 5 | import com.skillw.asahi.api.member.context.AsahiContext 6 | 7 | /** 8 | * @className Deserialize 9 | * 10 | * @author Glom 11 | * @date 2023/1/15 23:55 Copyright 2024 Glom. 12 | */ 13 | 14 | private fun Any?.mapValue(vararg namespaces: String): Any { 15 | return when (this) { 16 | is Map<*, *> -> toLazyMap() 17 | is List<*> -> map { it.mapValue(*namespaces) } 18 | is String -> compile(*namespaces).let { lazyQuester { it.get() } } 19 | else -> lazyQuester { this } 20 | } 21 | } 22 | 23 | fun Map<*, *>.toLazyMap(vararg namespaces: String): Map { 24 | return mapKeys { it.key.toString() }.mapValues { (_, value) -> 25 | value.mapValue(*namespaces) 26 | } 27 | } 28 | 29 | fun Map<*, *>.toLazyContext(vararg namespaces: String): Map { 30 | return AsahiContext.create(toLazyMap(*namespaces).toMutableMap()) 31 | } 32 | -------------------------------------------------------------------------------- /bin/main/com/skillw/particlelib/EffectData.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.particlelib 2 | 3 | import com.skillw.pouvoir.api.plugin.map.DataMap 4 | 5 | /** 6 | * @className EffectData 7 | * 8 | * @author Glom 9 | * @date 2023/1/21 15:48 Copyright 2024 Glom. 10 | */ 11 | class EffectData : DataMap() { 12 | 13 | } -------------------------------------------------------------------------------- /bin/main/com/skillw/particlelib/package-info.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Skillw/Pouvoir/955039bd3633a4481838fe85ecc122ee6b228ce7/bin/main/com/skillw/particlelib/package-info.class -------------------------------------------------------------------------------- /bin/main/com/skillw/particlelib/pobject/Circle.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.particlelib.pobject 2 | 3 | import taboolib.common.util.Location 4 | 5 | /** 6 | * 表示一个圆 7 | * 8 | * @author Zoyn IceCold 9 | */ 10 | class Circle 11 | /** 12 | * 构造一个圆 13 | * 14 | * @param origin 圆的圆点 15 | * @param radius 圆的半径 16 | * @param step 每个粒子的间隔(也即步长) 17 | * @param period 特效周期(如果需要可以使用) 18 | */(origin: Location, radius: Double = 1.0, step: Double = 1.0, period: Long = 20L) : 19 | Arc(origin, 0.0, 360.0, radius, step, period) -------------------------------------------------------------------------------- /bin/main/com/skillw/particlelib/pobject/Playable.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.particlelib.pobject 2 | 3 | /** 4 | * 代表一个特效对象是可播放的 5 | * 6 | * @author Zoyn 7 | */ 8 | interface Playable { 9 | fun play() 10 | fun playNextPoint() 11 | } -------------------------------------------------------------------------------- /bin/main/com/skillw/particlelib/pobject/ShowType.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.particlelib.pobject 2 | 3 | enum class ShowType { 4 | NONE, ALWAYS_SHOW, ALWAYS_SHOW_ASYNC, ALWAYS_PLAY, ALWAYS_PLAY_ASYNC 5 | } -------------------------------------------------------------------------------- /bin/main/com/skillw/particlelib/pobject/bezier/package-info.kt: -------------------------------------------------------------------------------- 1 | /** 存放关于贝塞尔曲线的特效对象 */ 2 | package com.skillw.particlelib.pobject.bezier 3 | 4 | -------------------------------------------------------------------------------- /bin/main/com/skillw/particlelib/pobject/equation/Equations.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.particlelib.pobject.equation 2 | 3 | import java.util.function.Function 4 | import kotlin.math.cos 5 | import kotlin.math.pow 6 | import kotlin.math.sin 7 | 8 | object Equations { 9 | /** 二次函数 */ 10 | val QUADRATIC_FUNCTION = Function { x: Double -> 11 | (x).pow(2.0) 12 | } 13 | 14 | /** 一次函数 */ 15 | val LINEAR_FUNCTION = Function { x: Double -> x } 16 | 17 | /** cos函数 */ 18 | val COS_FUNCTION = Function { a: Double -> cos(a) } 19 | 20 | /** sin函数 */ 21 | val SIN_FUNCTION = Function { a: Double -> sin(a) } 22 | 23 | /** 极坐标:四叶玫瑰线 */ 24 | val POLAR_FOUR_LEAVE_CURVE = Function { theta: Double -> 1.5 * sin(2 * theta) } 25 | } -------------------------------------------------------------------------------- /bin/main/com/skillw/particlelib/pobject/equation/package-info.kt: -------------------------------------------------------------------------------- 1 | /** 存放关于函数渲染器的特效对象 */ 2 | package com.skillw.particlelib.pobject.equation -------------------------------------------------------------------------------- /bin/main/com/skillw/particlelib/pobject/package-info.kt: -------------------------------------------------------------------------------- 1 | /** 存放着所有已经写好的特效对象 */ 2 | package com.skillw.particlelib.pobject 3 | -------------------------------------------------------------------------------- /bin/main/com/skillw/particlelib/utils/coordinate/Coordinate.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.particlelib.utils.coordinate 2 | 3 | import taboolib.common.util.Location 4 | 5 | /** 6 | * 表示一个坐标器 7 | * 8 | * @author Zoyn 9 | */ 10 | interface Coordinate { 11 | fun newLocation(x: Double, y: Double, z: Double): Location? 12 | } -------------------------------------------------------------------------------- /bin/main/com/skillw/particlelib/utils/coordinate/PlayerBackCoordinate.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.particlelib.utils.coordinate 2 | 3 | import taboolib.common.util.Location 4 | import com.skillw.particlelib.utils.LocationUtils 5 | 6 | /** 7 | * 表示一个玩家后背坐标系 8 | * 9 | * 将玩家背后转换为一个直角坐标系 10 | * 11 | * @author Zoyn 12 | */ 13 | class PlayerBackCoordinate(playerLocation: Location) : Coordinate { 14 | private val originDot: Location 15 | private val rotateAngle: Double 16 | 17 | init { 18 | // 旋转的角度 19 | rotateAngle = playerLocation.yaw.toDouble() 20 | originDot = playerLocation.clone() 21 | // 重设仰俯角 22 | originDot.pitch = 0f 23 | // 使原点与玩家有一点点距离 24 | originDot.add(originDot.direction.multiply(-0.3)) 25 | } 26 | 27 | override fun newLocation(x: Double, y: Double, z: Double): Location? { 28 | return LocationUtils.rotateLocationAboutPoint(originDot.clone().add(-x, y, z), rotateAngle, originDot) 29 | } 30 | } -------------------------------------------------------------------------------- /bin/main/com/skillw/particlelib/utils/coordinate/PlayerFixedCoordinate.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.particlelib.utils.coordinate 2 | 3 | import taboolib.common.util.Location 4 | import com.skillw.particlelib.utils.LocationUtils 5 | 6 | /** 7 | * 表示一个将X轴显示在玩家面前的坐标器 8 | * 9 | * 自动修正在XZ平面上的粒子朝向 10 | * 11 | * @author Zoyn 12 | */ 13 | class PlayerFixedCoordinate(playerLocation: Location) : Coordinate { 14 | /** 原点 */ 15 | private val originDot: Location 16 | 17 | /** 旋转角度 */ 18 | private val rotateAngle: Double 19 | 20 | init { 21 | // 旋转的角度 22 | rotateAngle = playerLocation.yaw.toDouble() 23 | originDot = playerLocation.clone() 24 | // 重设仰俯角, 防止出现仰头后旋转角度不正确的问题 25 | originDot.pitch = 0f 26 | } 27 | 28 | fun getOriginDot(): Location { 29 | return originDot 30 | } 31 | 32 | override fun newLocation(x: Double, y: Double, z: Double): Location? { 33 | return LocationUtils.rotateLocationAboutPoint(originDot.clone().add(-x, y, z), rotateAngle, originDot) 34 | } 35 | } -------------------------------------------------------------------------------- /bin/main/com/skillw/particlelib/utils/coordinate/PlayerFrontCoordinate.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.particlelib.utils.coordinate 2 | 3 | import taboolib.common.util.Location 4 | import com.skillw.particlelib.utils.LocationUtils 5 | 6 | /** 7 | * 表示一个玩家面前的坐标系 8 | * 9 | * 将玩家面前作为一个新坐标系 暂时不会受到仰俯角的控制 10 | * 11 | * @author Zoyn 12 | */ 13 | class PlayerFrontCoordinate(playerLocation: Location) : Coordinate { 14 | /** 原点 */ 15 | private val originDot: Location 16 | 17 | /** 旋转角度 */ 18 | private val rotateAngle: Double 19 | 20 | init { 21 | // 旋转的角度 22 | rotateAngle = playerLocation.yaw + 90.0 23 | originDot = playerLocation.clone() 24 | // 重设仰俯角, 防止出现仰头后旋转角度不正确的问题 25 | originDot.pitch = 0f 26 | } 27 | 28 | fun getOriginDot(): Location { 29 | return originDot 30 | } 31 | 32 | override fun newLocation(x: Double, y: Double, z: Double): Location? { 33 | return LocationUtils.rotateLocationAboutPoint(originDot.clone().add(y, z, x), rotateAngle, originDot) 34 | } 35 | } -------------------------------------------------------------------------------- /bin/main/com/skillw/particlelib/utils/coordinate/package-info.kt: -------------------------------------------------------------------------------- 1 | /** 存放关于坐标器的工具 */ 2 | package com.skillw.particlelib.utils.coordinate -------------------------------------------------------------------------------- /bin/main/com/skillw/particlelib/utils/matrix/package-info.kt: -------------------------------------------------------------------------------- 1 | /** 存放矩阵的工具类 */ 2 | package com.skillw.particlelib.utils.matrix -------------------------------------------------------------------------------- /bin/main/com/skillw/particlelib/utils/package-info.kt: -------------------------------------------------------------------------------- 1 | /** 存放特效相关的工具类 */ 2 | package com.skillw.particlelib.utils -------------------------------------------------------------------------------- /bin/main/com/skillw/particlelib/utils/projector/ThreeDProjector.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.particlelib.utils.projector 2 | 3 | import taboolib.common.util.Location 4 | import taboolib.common.util.Vector 5 | 6 | /** 7 | * 表示一个三维至三维投影器 8 | * 9 | * 算法由 @Bryan33 提供 10 | * 11 | * @author Zoyn 12 | * @since 2020/9/19 13 | */ 14 | class ThreeDProjector(private val origin: Location, n: Vector) { 15 | private val n1: Vector 16 | private val n2: Vector 17 | private val n3: Vector 18 | 19 | /** 20 | * @param origin 投影的原点 21 | * @param n 投影屏幕的法向量 22 | */ 23 | init { 24 | val t = n.clone() 25 | t.y = t.y + 1 26 | n1 = n.clone().crossProduct(t).normalize() 27 | n2 = n1.clone().crossProduct(n).normalize() 28 | n3 = n.clone().normalize() 29 | } 30 | 31 | fun apply(x: Double, y: Double, z: Double): Location { 32 | val r = n1.clone().multiply(x).add(n2.clone().multiply(z)).add(n3.clone().multiply(y)) 33 | return origin.clone().add(r) 34 | } 35 | } -------------------------------------------------------------------------------- /bin/main/com/skillw/particlelib/utils/projector/package-info.kt: -------------------------------------------------------------------------------- 1 | /** 存放关于投影器的工具 */ 2 | package com.skillw.particlelib.utils.projector -------------------------------------------------------------------------------- /bin/main/com/skillw/pouvoir/api/PouvoirAPI.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.api 2 | 3 | import com.skillw.pouvoir.Pouvoir 4 | import org.bukkit.entity.LivingEntity 5 | 6 | @Suppress("UNCHECKED_CAST") 7 | object PouvoirAPI { 8 | 9 | /** 10 | * 解析占位符(PouPAPI & PAPI) 11 | * 12 | * @param entity LivingEntity 实体 13 | * @param analysis Boolean 是否解析Asahi 14 | * @return String 解析后的文本 15 | * @receiver String 待解析的文本 16 | */ 17 | 18 | fun String.placeholder(entity: LivingEntity, analysis: Boolean = true): String { 19 | return Pouvoir.placeholderManager.replace(entity, this, analysis) 20 | } 21 | 22 | } -------------------------------------------------------------------------------- /bin/main/com/skillw/pouvoir/api/feature/database/BaseContainer.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.api.feature.database 2 | 3 | import com.skillw.pouvoir.api.plugin.map.component.Keyable 4 | 5 | /** 6 | * @className BaseContainer 7 | * 8 | * 数据库容器抽象基类,拥有独立生命周期 9 | * 10 | * 等同于SQL数据库中的一个Table 或者 Redis中的SingleRedisConnection 11 | * 12 | * @author Glom 13 | * @date 2023/1/12 18:35 Copyright 2024 Glom. 14 | */ 15 | abstract class BaseContainer( 16 | override val key: String, 17 | val holder: ContainerHolder<*>, 18 | ) : Keyable { 19 | open fun onEnable() {} 20 | open fun onActive() {} 21 | open fun onReload() {} 22 | open fun onDisable() {} 23 | } -------------------------------------------------------------------------------- /bin/main/com/skillw/pouvoir/api/feature/hologram/IHologram.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.api.feature.hologram 2 | 3 | import com.skillw.pouvoir.api.plugin.map.component.Keyable 4 | import org.bukkit.Location 5 | import org.bukkit.entity.Player 6 | 7 | /** 全息接口 */ 8 | interface IHologram : Keyable { 9 | 10 | /** 坐标 */ 11 | var location: Location 12 | 13 | /** 内容 */ 14 | val content: List 15 | 16 | /** 可看到的玩家 */ 17 | val viewers: MutableSet 18 | 19 | /** 20 | * 传送 21 | * 22 | * @param location 坐标 23 | */ 24 | fun teleport(location: Location) 25 | 26 | /** 27 | * 更新内容 28 | * 29 | * @param content 新内容 30 | */ 31 | fun update(content: List) 32 | 33 | /** 删除 */ 34 | fun delete() 35 | 36 | /** 销毁 */ 37 | fun destroy() 38 | } -------------------------------------------------------------------------------- /bin/main/com/skillw/pouvoir/api/feature/selector/Target.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.api.feature.selector 2 | 3 | import org.bukkit.Location 4 | 5 | /** 6 | * @className Target 7 | * 8 | * 目标抽象类 9 | * 10 | * @author Glom 11 | * @date 2023/1/9 7:32 Copyright 2024 Glom. 12 | */ 13 | abstract class Target(open val unique: String, val location: Location) { 14 | /** 是否有效 */ 15 | open val isPresent: Boolean 16 | get() = true 17 | 18 | override fun equals(other: Any?): Boolean { 19 | if (this === other) return true 20 | if (other !is Target) return false 21 | 22 | if (unique != other.unique) return false 23 | if (location != other.location) return false 24 | 25 | return true 26 | } 27 | 28 | override fun hashCode(): Int { 29 | var result = unique.hashCode() 30 | result = 31 * result + location.hashCode() 31 | return result 32 | } 33 | } -------------------------------------------------------------------------------- /bin/main/com/skillw/pouvoir/api/feature/selector/target/EntityTarget.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.api.feature.selector.target 2 | 3 | import org.bukkit.entity.Entity 4 | 5 | /** 6 | * @className EntityTarget 7 | * 8 | * @author Glom 9 | * @date 2023/1/9 7:36 Copyright 2024 Glom. 10 | */ 11 | @Suppress("UNCHECKED_CAST") 12 | class EntityTarget(val entity: Entity) : LocTarget(entity.targetLoc()) { 13 | override val unique: String = entity.uniqueId.toString() 14 | override val isPresent: Boolean 15 | get() = !entity.isDead && entity.isValid 16 | 17 | /** 18 | * 强制转换 19 | * 20 | * @param T 类型 21 | * @return 转换后的Target 22 | */ 23 | fun cast(): T = entity as T 24 | 25 | /** 26 | * 安全转换 27 | * 28 | * @param T 类型 29 | * @return 转换后的Target 30 | */ 31 | fun castSafely(): T? = entity as? T 32 | 33 | override fun toString(): String { 34 | return "EntityTarget( entity=$entity loc=$location)" 35 | } 36 | } -------------------------------------------------------------------------------- /bin/main/com/skillw/pouvoir/api/feature/trigger/BukkitTrigger.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.api.feature.trigger 2 | 3 | /** 4 | * Pou trigger 5 | * 6 | * 主要是将Bukkit事件名字格式化 7 | * 8 | * 如果Bukkit事件类上没有此注解或没有指定name 9 | * 10 | * 则其事件名称将会像这样格式化为触发器id: 11 | * 12 | * "PlayerMoveEvent" -> "player move" 13 | * 14 | * @constructor Create empty Pou trigger 15 | * @property name 16 | */ 17 | annotation class BukkitTrigger(val name: String = "") 18 | -------------------------------------------------------------------------------- /bin/main/com/skillw/pouvoir/api/manager/Manager.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.api.manager 2 | 3 | import com.skillw.pouvoir.api.plugin.SubPouvoir 4 | import com.skillw.pouvoir.api.plugin.map.component.Registrable 5 | 6 | interface Manager : Registrable, Comparable { 7 | val priority: Int 8 | val subPouvoir: SubPouvoir 9 | 10 | fun onLoad() { 11 | } 12 | 13 | fun onEnable() {} 14 | fun onActive() {} 15 | 16 | fun onReload() {} 17 | fun onDisable() {} 18 | 19 | override fun register() {} 20 | 21 | override fun compareTo(other: Manager): Int { 22 | return if (priority == other.priority) 0 23 | else if (priority > other.priority) 1 24 | else -1 25 | } 26 | 27 | } -------------------------------------------------------------------------------- /bin/main/com/skillw/pouvoir/api/manager/sub/DatabaseManager.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.api.manager.sub 2 | 3 | import com.skillw.pouvoir.api.feature.database.ContainerHolder 4 | import com.skillw.pouvoir.api.feature.database.DatabaseType 5 | import com.skillw.pouvoir.api.manager.Manager 6 | import com.skillw.pouvoir.api.plugin.map.DataMap 7 | import com.skillw.pouvoir.api.plugin.map.LowerKeyMap 8 | 9 | /** 10 | * @className DatabaseManager 11 | * 12 | * 数据库管理器 主要负责维护数据库类型 13 | * 14 | * @author Glom 15 | * @date 2023/1/12 18:57 Copyright 2024 Glom. 16 | */ 17 | abstract class DatabaseManager : Manager, LowerKeyMap>() { 18 | /** 19 | * 创建容器持有者 20 | * 21 | * @param data 参数 22 | * @return 容器持有者 23 | */ 24 | abstract fun containerHolder(data: DataMap): ContainerHolder<*>? 25 | } -------------------------------------------------------------------------------- /bin/main/com/skillw/pouvoir/api/manager/sub/HologramManager.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.api.manager.sub 2 | 3 | import com.skillw.pouvoir.api.feature.hologram.IHologram 4 | import com.skillw.pouvoir.api.manager.Manager 5 | import org.bukkit.Location 6 | 7 | /** 8 | * HologramManager 9 | * 10 | * @constructor Create empty Listener manager 11 | */ 12 | abstract class HologramManager : Manager { 13 | /** 14 | * Create hologram 15 | * 16 | * @param location 17 | * @param content 18 | * @return 19 | */ 20 | abstract fun createHologram(location: Location, content: List): IHologram 21 | } -------------------------------------------------------------------------------- /bin/main/com/skillw/pouvoir/api/manager/sub/ListenerManager.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.api.manager.sub 2 | 3 | import com.skillw.pouvoir.api.manager.Manager 4 | import com.skillw.pouvoir.api.plugin.map.LowerMap 5 | import taboolib.common.platform.event.ProxyListener 6 | 7 | /** 8 | * Listener manager Bukkit监听器管理器 9 | * 10 | * 维护热注册注销的监听器 11 | * 12 | * @constructor Create empty Listener manager 13 | */ 14 | abstract class ListenerManager : LowerMap(), Manager -------------------------------------------------------------------------------- /bin/main/com/skillw/pouvoir/api/manager/sub/SelectorManager.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.api.manager.sub 2 | 3 | import com.skillw.pouvoir.api.feature.selector.BaseSelector 4 | import com.skillw.pouvoir.api.manager.Manager 5 | import com.skillw.pouvoir.api.plugin.map.LowerKeyMap 6 | 7 | /** BaseSelector */ 8 | abstract class SelectorManager : LowerKeyMap(), Manager -------------------------------------------------------------------------------- /bin/main/com/skillw/pouvoir/api/manager/sub/TriggerHandlerManager.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.api.manager.sub 2 | 3 | import com.skillw.pouvoir.api.feature.handler.BaseHandler 4 | import com.skillw.pouvoir.api.manager.Manager 5 | import com.skillw.pouvoir.api.plugin.SubPouvoir 6 | import com.skillw.pouvoir.api.plugin.map.KeyMap 7 | import java.io.File 8 | 9 | /** TriggerManager 监听器处理器管理器,主要负责维护监听器处理器 */ 10 | abstract class TriggerHandlerManager : Manager, KeyMap>() { 11 | /** 12 | * 注销监听器处理器 13 | * 14 | * @param key 监听器处理器id 15 | */ 16 | abstract fun unregister(key: String) 17 | abstract fun addDataFolders(folder: File) 18 | abstract fun addSubPouvoir(subPouvoir: SubPouvoir) 19 | abstract fun reloadFolder(folder: File) 20 | } -------------------------------------------------------------------------------- /bin/main/com/skillw/pouvoir/api/manager/sub/script/ScriptAnnotationManager.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.api.manager.sub.script 2 | 3 | import com.skillw.pouvoir.api.manager.Manager 4 | import com.skillw.pouvoir.api.plugin.map.LowerKeyMap 5 | import com.skillw.pouvoir.api.script.annotation.ScriptAnnotation 6 | 7 | /** 脚本注解管理器 主要负责维护脚本注解 */ 8 | abstract class ScriptAnnotationManager : Manager, LowerKeyMap() -------------------------------------------------------------------------------- /bin/main/com/skillw/pouvoir/api/plugin/Util.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.api.plugin 2 | 3 | /** 4 | * @className Util 5 | * 6 | * @author Glom 7 | * @date 2023/1/22 22:50 Copyright 2024 Glom. 8 | */ 9 | -------------------------------------------------------------------------------- /bin/main/com/skillw/pouvoir/api/plugin/annotation/AutoRegister.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.api.plugin.annotation 2 | 3 | /** 4 | * Auto register 5 | * 6 | * 自动注册至对应的RegContainer 7 | * 8 | * @constructor test 检测类名,如果存在则自动注册 9 | */ 10 | @Target(AnnotationTarget.CLASS, AnnotationTarget.FIELD) 11 | @Retention(AnnotationRetention.RUNTIME) 12 | annotation class AutoRegister(val test: String = "") 13 | -------------------------------------------------------------------------------- /bin/main/com/skillw/pouvoir/api/plugin/annotation/PouManager.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.api.plugin.annotation 2 | 3 | /** 4 | * Pou manager 5 | * 6 | * @constructor 7 | */ 8 | @Target(AnnotationTarget.FIELD) 9 | @Retention(AnnotationRetention.RUNTIME) 10 | annotation class PouManager(val path: String = "") 11 | -------------------------------------------------------------------------------- /bin/main/com/skillw/pouvoir/api/plugin/handler/ClassHandler.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.api.plugin.handler 2 | 3 | import taboolib.library.reflex.ClassStructure 4 | 5 | /** 6 | * @className ClassHandler 7 | * 8 | * @author Glom 9 | * @date 2022/7/18 12:20 Copyright 2022 user. 10 | */ 11 | abstract class ClassHandler(val priority: Int) : Comparable { 12 | /** 13 | * Inject 14 | * 15 | * @param clazz 16 | * @param plugin 17 | */ 18 | abstract fun inject(clazz: ClassStructure) 19 | 20 | override fun compareTo(other: ClassHandler): Int = if (this.priority == other.priority) 0 21 | else if (this.priority > other.priority) 1 22 | else -1 23 | } -------------------------------------------------------------------------------- /bin/main/com/skillw/pouvoir/api/plugin/map/KeyMap.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.api.plugin.map 2 | 3 | import com.skillw.pouvoir.api.plugin.map.component.Keyable 4 | 5 | /** 6 | * ClassName : com.skillw.classsystem.api.plugin.map.KeyMap Created by 7 | * Glom_ on 2021-03-26 22:03:17 Copyright 2021 user. 8 | */ 9 | open class KeyMap> : BaseMap() { 10 | private fun getKey(value: V): K { 11 | return value.key 12 | } 13 | 14 | /** 15 | * Register 16 | * 17 | * @param value 18 | */ 19 | open fun register(value: V) { 20 | register(value.key, value) 21 | } 22 | 23 | /** 24 | * Remove by value 25 | * 26 | * @param value 27 | */ 28 | fun removeByValue(value: V) { 29 | val key = getKey(value) 30 | key.also { remove(key) } 31 | } 32 | } -------------------------------------------------------------------------------- /bin/main/com/skillw/pouvoir/api/plugin/map/LinkedKeyMap.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.api.plugin.map 2 | 3 | import com.skillw.pouvoir.api.plugin.map.component.Keyable 4 | 5 | /** 6 | * Linked key map 7 | * 8 | * @param K 9 | * @param V 10 | * @constructor Create empty Linked key map 11 | */ 12 | open class LinkedKeyMap> : LinkedMap() { 13 | private fun getKey(value: V): K { 14 | return value.key 15 | } 16 | 17 | /** 18 | * Register 19 | * 20 | * @param value 21 | */ 22 | open fun register(value: V) { 23 | register(value.key, value) 24 | } 25 | 26 | /** 27 | * Remove by value 28 | * 29 | * @param value 30 | */ 31 | fun removeByValue(value: V) { 32 | val key = getKey(value) 33 | key.also { remove(it) } 34 | } 35 | } -------------------------------------------------------------------------------- /bin/main/com/skillw/pouvoir/api/plugin/map/LinkedMap.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.api.plugin.map 2 | 3 | import java.util.concurrent.CopyOnWriteArrayList 4 | 5 | /** 6 | * Linked map 7 | * 8 | * @param K 9 | * @param V 10 | * @constructor Create empty Linked map 11 | */ 12 | open class LinkedMap : BaseMap() { 13 | /** List */ 14 | protected val list = CopyOnWriteArrayList() 15 | 16 | override fun put(key: K, value: V): V? { 17 | list.add(key) 18 | return super.put(key, value) 19 | } 20 | } -------------------------------------------------------------------------------- /bin/main/com/skillw/pouvoir/api/plugin/map/LowerKeyMap.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.api.plugin.map 2 | 3 | import com.skillw.pouvoir.api.plugin.map.component.Keyable 4 | 5 | 6 | /** 7 | * Lower key map 8 | * 9 | * @param V 10 | * @constructor Create empty Lower key map 11 | */ 12 | open class LowerKeyMap> : KeyMap() { 13 | 14 | override operator fun get(key: String): V? { 15 | return super.get(key.lowercase()) 16 | } 17 | 18 | override fun remove(key: String): V? { 19 | return super.remove(key.lowercase()) 20 | } 21 | 22 | override fun containsKey(key: String): Boolean { 23 | return super.containsKey(key.lowercase()) 24 | } 25 | 26 | override operator fun set(key: String, value: V): V? { 27 | return super.set(key.lowercase(), value) 28 | } 29 | 30 | override fun put(key: String, value: V): V? { 31 | return super.put(key.lowercase(), value) 32 | } 33 | } -------------------------------------------------------------------------------- /bin/main/com/skillw/pouvoir/api/plugin/map/LowerMap.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.api.plugin.map 2 | 3 | /** 4 | * Lower map 5 | * 6 | * @param V 7 | * @constructor Create empty Lower map 8 | */ 9 | open class LowerMap : BaseMap() { 10 | override fun get(key: String): V? { 11 | return super.get(key.lowercase()) 12 | } 13 | 14 | override fun containsKey(key: String): Boolean { 15 | return super.containsKey(key.lowercase()) 16 | } 17 | 18 | override fun put(key: String, value: V): V? { 19 | return super.put(key.lowercase(), value) 20 | } 21 | 22 | override fun remove(key: String): V? { 23 | return super.remove(key.lowercase()) 24 | } 25 | } -------------------------------------------------------------------------------- /bin/main/com/skillw/pouvoir/api/plugin/map/MultiExecMap.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.api.plugin.map 2 | 3 | /** 4 | * Multi exec map 5 | * 6 | * @constructor Create empty Multi exec map 7 | */ 8 | open class MultiExecMap : LowerMap() { 9 | /** 10 | * Run 11 | * 12 | * @param thing 13 | */ 14 | fun run(key: String) { 15 | map.filter { it.key == key.lowercase() }.forEach { it.value.invoke() } 16 | } 17 | } -------------------------------------------------------------------------------- /bin/main/com/skillw/pouvoir/api/plugin/map/SingleExecMap.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.api.plugin.map 2 | 3 | /** 4 | * Single exec map 5 | * 6 | * @constructor Create empty Single exec map 7 | */ 8 | open class SingleExecMap : LowerMap<() -> Unit>() { 9 | /** Invoke */ 10 | fun invoke() { 11 | values.forEach { function -> function.invoke() } 12 | } 13 | 14 | /** 15 | * Run 16 | * 17 | * @param thing 18 | */ 19 | open fun run(thing: String) { 20 | this[thing]?.run { invoke() } 21 | } 22 | } -------------------------------------------------------------------------------- /bin/main/com/skillw/pouvoir/api/plugin/map/component/Keyable.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.api.plugin.map.component 2 | 3 | /** 4 | * ClassName : com.skillw.classsystem.api.component.Keyable Created by 5 | * Glom_ on 2021-03-27 20:54:22 Copyright 2021 user. 6 | * 7 | * 有对应键的类 8 | */ 9 | interface Keyable { 10 | /** Key */ 11 | val key: K 12 | } -------------------------------------------------------------------------------- /bin/main/com/skillw/pouvoir/api/plugin/map/component/Registrable.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.api.plugin.map.component 2 | 3 | /** 4 | * @className Registrable 5 | * 6 | * @author Glom 7 | * @date 2022/7/18 7:56 Copyright 2022 user. 8 | * 9 | * 可注册的类 10 | */ 11 | interface Registrable : Keyable { 12 | fun register() 13 | } -------------------------------------------------------------------------------- /bin/main/com/skillw/pouvoir/api/plugin/object/BaseObject.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.api.plugin.`object` 2 | 3 | import com.skillw.pouvoir.api.plugin.map.component.Registrable 4 | import org.bukkit.configuration.serialization.ConfigurationSerializable 5 | 6 | /** 7 | * Base object 8 | * 9 | * @constructor Create empty Base object 10 | */ 11 | interface BaseObject : Registrable, 12 | Comparable, 13 | ConfigurationSerializable { 14 | override val key: String 15 | 16 | /** Priority */ 17 | val priority: Int 18 | override fun compareTo(other: BaseObject): Int = if (this.priority == other.priority) 0 19 | else if (this.priority > other.priority) 1 20 | else -1 21 | } -------------------------------------------------------------------------------- /bin/main/com/skillw/pouvoir/api/plugin/object/Releasable.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.api.plugin.`object` 2 | 3 | /** 4 | * @className Releasable 5 | * 6 | * @author Glom 7 | * @date 2023/1/22 22:56 Copyright 2024 Glom. 8 | */ 9 | interface Releasable { 10 | /** 是否在重载时注销 */ 11 | var release: Boolean 12 | 13 | fun unregister() 14 | } -------------------------------------------------------------------------------- /bin/main/com/skillw/pouvoir/api/plugin/package-info.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Skillw/Pouvoir/955039bd3633a4481838fe85ecc122ee6b228ce7/bin/main/com/skillw/pouvoir/api/plugin/package-info.class -------------------------------------------------------------------------------- /bin/main/com/skillw/pouvoir/api/script/annotation/ScriptAnnotation.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.api.script.annotation 2 | 3 | import com.skillw.pouvoir.Pouvoir 4 | import com.skillw.pouvoir.api.plugin.map.component.Registrable 5 | 6 | /** 7 | * Script annotation 8 | * 9 | * @constructor Create empty Script annotation 10 | * @property key 11 | * @property awakeWhenEnable 12 | */ 13 | abstract class ScriptAnnotation( 14 | override val key: String, 15 | val awakeWhenEnable: Boolean = false, 16 | val fileAnnotation: Boolean = false, 17 | ) : Registrable { 18 | override fun register() { 19 | Pouvoir.scriptAnnotationManager.register(this) 20 | } 21 | 22 | /** 23 | * Handle script annotation 24 | * 25 | * @param data 26 | */ 27 | abstract fun handle(data: ScriptAnnotationData) 28 | } -------------------------------------------------------------------------------- /bin/main/com/skillw/pouvoir/api/script/annotation/ScriptAnnotationData.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.api.script.annotation 2 | 3 | import com.skillw.pouvoir.api.script.PouFileCompiledScript 4 | 5 | 6 | /** 7 | * Script annotation data 8 | * 9 | * @constructor Create empty Script annotation data 10 | * @property annotation 脚本注解对象 11 | * @property script 预编译脚本对象 12 | * @property function 函数名 13 | * @property args 参数 14 | */ 15 | data class ScriptAnnotationData( 16 | val annotation: String, 17 | val script: PouFileCompiledScript, 18 | val function: String, 19 | val args: String, 20 | ) 21 | -------------------------------------------------------------------------------- /bin/main/com/skillw/pouvoir/api/script/engine/hook/PouCompiler.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.api.script.engine.hook 2 | 3 | import com.skillw.pouvoir.api.plugin.map.component.Registrable 4 | import com.skillw.pouvoir.api.script.PouFileCompiledScript 5 | import java.io.File 6 | import javax.script.CompiledScript 7 | 8 | /** 9 | * @className PouCompiler 10 | * 11 | * @author Glom 12 | * @date 2023/1/20 9:33 Copyright 2024 Glom. 13 | */ 14 | interface PouCompiler : Registrable { 15 | fun compile(file: File): PouFileCompiledScript? 16 | fun compile(script: String, vararg params: String): CompiledScript 17 | fun canCompile(script: String): Boolean 18 | } -------------------------------------------------------------------------------- /bin/main/com/skillw/pouvoir/api/script/engine/hook/ScriptBridge.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.api.script.engine.hook 2 | 3 | import javax.script.CompiledScript 4 | import javax.script.ScriptEngine 5 | 6 | interface ScriptBridge { 7 | fun getEngine(vararg args: String): ScriptEngine 8 | 9 | fun invoke( 10 | script: CompiledScript, 11 | function: String = "main", 12 | arguments: Map, 13 | vararg parameters: Any?, 14 | ): Any? 15 | 16 | } -------------------------------------------------------------------------------- /bin/main/com/skillw/pouvoir/internal/command/sub/PouMirrorCommand.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.internal.command.sub 2 | 3 | import com.skillw.pouvoir.internal.command.PouvoirCommand.soundSuccess 4 | import taboolib.common.platform.ProxyCommandSender 5 | import taboolib.common.platform.command.subCommand 6 | import taboolib.common5.Mirror 7 | import taboolib.module.lang.sendLang 8 | 9 | internal object PouMirrorCommand { 10 | val report = subCommand { 11 | execute { sender, _, _ -> 12 | sender.soundSuccess() 13 | Mirror.report(sender) 14 | } 15 | } 16 | 17 | val clear = subCommand { 18 | execute { sender, _, _ -> 19 | sender.soundSuccess() 20 | Mirror.mirrorData.clear() 21 | sender.sendLang("command-clear") 22 | } 23 | } 24 | } -------------------------------------------------------------------------------- /bin/main/com/skillw/pouvoir/internal/core/asahi/AsahiInject.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.internal.core.asahi 2 | 3 | import com.skillw.asahi.internal.AsahiLoader 4 | import com.skillw.pouvoir.api.plugin.handler.ClassHandler 5 | import taboolib.library.reflex.ClassStructure 6 | 7 | object AsahiInject : ClassHandler(0) { 8 | override fun inject(clazz: ClassStructure) { 9 | AsahiLoader.inject(clazz) 10 | } 11 | } -------------------------------------------------------------------------------- /bin/main/com/skillw/pouvoir/internal/core/asahi/infix/bukkit/InfixCancellable.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.internal.core.asahi.infix.bukkit 2 | 3 | import com.skillw.asahi.api.annotation.AsahiInfix 4 | import com.skillw.asahi.api.member.parser.infix.namespacing.BaseInfix 5 | import org.bukkit.event.Cancellable 6 | 7 | /** 8 | * @className ActionCancellable 9 | * 10 | * @author Glom 11 | * @date 2022/8/9 16:26 Copyright 2022 user. 12 | */ 13 | @AsahiInfix 14 | object InfixCancellable : BaseInfix(Cancellable::class.java, "bukkit") { 15 | init { 16 | "isCancelled" to { 17 | if (expect("to")) { 18 | it.isCancelled = parse() 19 | } 20 | it.isCancelled 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /bin/main/com/skillw/pouvoir/internal/core/asahi/infix/database/InfixContainerHolder.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.internal.core.asahi.infix.database 2 | 3 | import com.skillw.asahi.api.annotation.AsahiInfix 4 | import com.skillw.asahi.api.member.parser.infix.namespacing.BaseInfix 5 | import com.skillw.pouvoir.api.feature.database.ContainerHolder 6 | 7 | /** 8 | * @className ActionCancellable 9 | * 10 | * @author Glom 11 | * @date 2022/8/9 16:26 Copyright 2022 user. 12 | */ 13 | @AsahiInfix 14 | object InfixContainerHolder : BaseInfix>(ContainerHolder::class.java) { 15 | init { 16 | "container" to { 17 | val key = parseString() 18 | val user = !expect("normal") 19 | it.container(key, user) 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /bin/main/com/skillw/pouvoir/internal/core/asahi/prefix/bukkit/Item.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.internal.core.asahi.prefix.bukkit 2 | 3 | import com.skillw.asahi.api.annotation.AsahiPrefix 4 | import com.skillw.asahi.api.prefixParser 5 | import com.skillw.asahi.api.quest 6 | import org.bukkit.Material 7 | import taboolib.library.xseries.XMaterial 8 | 9 | /** 10 | * @className Item 11 | * 12 | * @author Glom 13 | * @date 2023/1/14 0:33 Copyright 2024 Glom. 14 | */ 15 | 16 | @AsahiPrefix 17 | private fun material() = prefixParser { 18 | val token = quest() 19 | result { 20 | val id = token.get() 21 | XMaterial.matchXMaterial(id) 22 | .run { if (this.isPresent) get().parseMaterial() else Material.matchMaterial(id) } 23 | ?: error("Material not found: $token") 24 | } 25 | } -------------------------------------------------------------------------------- /bin/main/com/skillw/pouvoir/internal/core/asahi/util/PlayerAsOp.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.internal.core.asahi.util 2 | 3 | import org.bukkit.entity.Player 4 | import taboolib.common.platform.ProxyCommandSender 5 | import taboolib.common.platform.function.adaptCommandSender 6 | 7 | /** 8 | * @className PlayerAsOp 9 | * 10 | * @author Glom 11 | * @date 2023/1/23 17:58 Copyright 2024 Glom. 12 | */ 13 | class PlayerAsOp(val player: Player) : ProxyCommandSender by adaptCommandSender(player) { 14 | override var isOp: Boolean 15 | get() = true 16 | set(value) {} 17 | } -------------------------------------------------------------------------------- /bin/main/com/skillw/pouvoir/internal/core/asahi/util/Task.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.internal.core.asahi.util 2 | 3 | import com.skillw.asahi.api.member.context.AsahiContext 4 | import taboolib.common.platform.function.isPrimaryThread 5 | import taboolib.common.platform.function.submit 6 | import java.util.concurrent.CompletableFuture 7 | 8 | /** 9 | * @className Task 10 | * 11 | * @author Glom 12 | * @date 2023/1/23 18:45 Copyright 2024 Glom. 13 | */ 14 | fun AsahiContext.delay(tick: Long) { 15 | val future = CompletableFuture() 16 | val task = submit(delay = tick, async = !isPrimaryThread) { 17 | future.complete(null) 18 | } 19 | onExit { task.cancel() } 20 | future.join() 21 | } -------------------------------------------------------------------------------- /bin/main/com/skillw/pouvoir/internal/core/plugin/SubPouvoirHandler.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.internal.core.plugin 2 | 3 | import com.skillw.pouvoir.api.plugin.SubPouvoir 4 | import com.skillw.pouvoir.api.plugin.TotalManager 5 | import org.bukkit.plugin.Plugin 6 | import taboolib.library.reflex.ClassStructure 7 | 8 | object SubPouvoirHandler { 9 | fun inject(clazz: ClassStructure, plugin: Plugin) { 10 | val owner = clazz.owner 11 | if (SubPouvoir::class.java.isAssignableFrom(owner) && clazz.simpleName != "SubPouvoir") 12 | TotalManager.pluginData[plugin] = PouManagerUtils.initPouManagers(owner) ?: return 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /bin/main/com/skillw/pouvoir/internal/core/script/asahi/AsahiBridge.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.internal.core.script.asahi 2 | 3 | import com.skillw.asahi.api.script.AsahiEngine 4 | import com.skillw.pouvoir.api.script.engine.hook.ScriptBridge 5 | import javax.script.CompiledScript 6 | import javax.script.Invocable 7 | import javax.script.ScriptEngine 8 | 9 | object AsahiBridge : ScriptBridge { 10 | override fun getEngine(vararg args: String): ScriptEngine = PouAsahiScriptEngine.engine 11 | override fun invoke( 12 | script: CompiledScript, 13 | function: String, 14 | arguments: Map, 15 | vararg parameters: Any?, 16 | ): Any? { 17 | (script.engine as AsahiEngine).context().putAll(arguments) 18 | return (script.engine as Invocable).invokeFunction( 19 | function, 20 | *parameters 21 | ) 22 | } 23 | } -------------------------------------------------------------------------------- /bin/main/com/skillw/pouvoir/internal/core/script/groovy/GroovyBridge.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.internal.core.script.groovy 2 | 3 | import com.skillw.pouvoir.api.script.engine.hook.ScriptBridge 4 | import javax.script.CompiledScript 5 | import javax.script.Invocable 6 | import javax.script.ScriptContext 7 | import javax.script.ScriptEngine 8 | 9 | object GroovyBridge : ScriptBridge { 10 | override fun getEngine(vararg args: String): ScriptEngine = PouGroovyScriptEngine.engine 11 | override fun invoke( 12 | script: CompiledScript, 13 | function: String, 14 | arguments: Map, 15 | vararg parameters: Any?, 16 | ): Any? { 17 | script.eval() 18 | script.engine.context.getBindings(ScriptContext.ENGINE_SCOPE).putAll(arguments) 19 | return (script.engine as Invocable).invokeFunction( 20 | function, 21 | *parameters 22 | ) 23 | } 24 | } -------------------------------------------------------------------------------- /bin/main/com/skillw/pouvoir/internal/feature/compat/placeholder/PlaceholderAPIHooker.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.internal.feature.compat.placeholder 2 | 3 | import com.skillw.pouvoir.Pouvoir 4 | import org.bukkit.entity.Player 5 | import taboolib.platform.compat.PlaceholderExpansion 6 | 7 | object PlaceholderAPIHooker : PlaceholderExpansion { 8 | override val identifier = "pou" 9 | override fun onPlaceholderRequest(player: Player?, args: String): String { 10 | player ?: return args 11 | return Pouvoir.placeholderManager.replace(player, "%pou_$args%") 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /bin/main/com/skillw/pouvoir/internal/feature/database/redis/RedisContainer.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.internal.feature.database.redis 2 | 3 | import com.skillw.pouvoir.api.feature.database.BaseContainer 4 | import taboolib.expansion.SingleRedisConnection 5 | 6 | /** 7 | * @className RedisContainer 8 | * 9 | * @author Glom 10 | * @date 2023/1/12 23:00 Copyright 2024 Glom. 11 | */ 12 | open class RedisContainer( 13 | override val key: String, 14 | holder: RedisContainerHolder, 15 | val connection: SingleRedisConnection, 16 | ) : BaseContainer(key, holder) -------------------------------------------------------------------------------- /bin/main/com/skillw/pouvoir/internal/feature/database/redis/RedisContainerHolder.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.internal.feature.database.redis 2 | 3 | import com.skillw.pouvoir.api.feature.database.ContainerHolder 4 | import taboolib.expansion.SingleRedisConnection 5 | 6 | /** 7 | * @className RedisContainerHolder 8 | * 9 | * @author Glom 10 | * @date 2023/1/20 17:29 Copyright 2024 Glom. 11 | */ 12 | class RedisContainerHolder(val connection: SingleRedisConnection) : ContainerHolder() { 13 | override fun createContainer(tableName: String, userKey: Boolean): RedisContainer { 14 | return RedisContainer(tableName, this, connection) 15 | } 16 | 17 | override fun disconnect() { 18 | connection.close() 19 | } 20 | 21 | } -------------------------------------------------------------------------------- /bin/main/com/skillw/pouvoir/internal/feature/database/redis/RedisUserContainer.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.internal.feature.database.redis 2 | 3 | import com.skillw.pouvoir.api.feature.database.UserBased 4 | import taboolib.expansion.SingleRedisConnection 5 | 6 | /** 7 | * @className RedisContainer 8 | * 9 | * @author Glom 10 | * @date 2023/1/12 23:00 Copyright 2024 Glom. 11 | */ 12 | class RedisUserContainer(key: String, holder: RedisContainerHolder, connection: SingleRedisConnection) : 13 | RedisContainer(key, holder, connection), UserBased { 14 | override fun get(user: String, key: String): String? { 15 | return connection["$user-$key"] 16 | } 17 | 18 | override fun delete(user: String, key: String) { 19 | connection.delete(key) 20 | } 21 | 22 | override fun set(user: String, key: String, value: String?) { 23 | connection["$user-$key"] = value 24 | } 25 | 26 | override fun contains(user: String, key: String): Boolean { 27 | return connection.contains("$user-$key") 28 | } 29 | } -------------------------------------------------------------------------------- /bin/main/com/skillw/pouvoir/internal/feature/database/sql/NormalContainer.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.internal.feature.database.sql 2 | 3 | import com.skillw.pouvoir.api.feature.database.BaseContainer 4 | import com.skillw.pouvoir.api.feature.database.ContainerHolder 5 | import com.skillw.pouvoir.api.feature.database.sql.IPouTable 6 | import taboolib.module.database.ColumnBuilder 7 | import taboolib.module.database.Host 8 | 9 | /** 10 | * @className NormalContainer 11 | * 12 | * @author Glom 13 | * @date 2023/1/12 20:51 Copyright 2024 Glom. 14 | */ 15 | open class NormalContainer, E : ColumnBuilder>( 16 | holder: ContainerHolder>, 17 | table: IPouTable, 18 | ) : BaseContainer(table.name, holder), IPouTable by table { 19 | override fun onDisable() { 20 | close() 21 | } 22 | } -------------------------------------------------------------------------------- /bin/main/com/skillw/pouvoir/internal/feature/handler/Native.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.internal.feature.handler 2 | 3 | import com.skillw.asahi.api.script.linking.Invoker 4 | import com.skillw.asahi.api.script.linking.NativeFunction 5 | import com.skillw.pouvoir.internal.core.asahi.linking.js.NativeJSFunction 6 | 7 | /** 8 | * @className Native 9 | * 10 | * @author Glom 11 | * @date 2023/1/22 22:00 Copyright 2024 Glom. 12 | */ 13 | fun Any.toInvoker(key: String, namespaces: Collection): Invoker? { 14 | return when (this) { 15 | is Map<*, *> -> { 16 | val func = this as Map 17 | when (func["type"].toString()) { 18 | "js" -> NativeJSFunction.deserialize(key, func) 19 | else -> NativeFunction.deserialize(key, func, *namespaces.toTypedArray()) 20 | } 21 | } 22 | 23 | is String -> { 24 | NativeFunction.deserialize(key, this, *namespaces.toTypedArray()) 25 | } 26 | 27 | else -> null 28 | } 29 | } -------------------------------------------------------------------------------- /bin/main/com/skillw/pouvoir/internal/feature/hologram/impl/PouEmptyHoloLine.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.internal.feature.hologram.impl 2 | 3 | import com.skillw.pouvoir.internal.feature.hologram.PouHolo 4 | import org.bukkit.Location 5 | import org.bukkit.entity.Player 6 | 7 | /** 8 | * @className PouEmptyHoloLine 9 | * 10 | * @author Glom 11 | * @date 2023/1/17 13:10 Copyright 2024 Glom. 12 | */ 13 | class PouEmptyHoloLine : PouHolo { 14 | override val isDeleted: Boolean 15 | get() = true 16 | 17 | override fun destroy() { 18 | 19 | } 20 | 21 | override fun respawn() { 22 | 23 | } 24 | 25 | override fun spawn(location: Location) { 26 | 27 | } 28 | 29 | override fun teleport(location: Location) { 30 | 31 | } 32 | 33 | override fun delete() { 34 | 35 | } 36 | 37 | override fun visible(viewer: Player, visible: Boolean) { 38 | 39 | } 40 | 41 | override fun update(line: String) { 42 | 43 | } 44 | } -------------------------------------------------------------------------------- /bin/main/com/skillw/pouvoir/internal/feature/listener/Priority.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.internal.feature.listener 2 | 3 | import taboolib.common.platform.event.EventPriority 4 | 5 | /** 6 | * @className Priority 7 | * 8 | * @author Glom 9 | * @date 2022/7/9 7:45 Copyright 2022 user. 10 | */ 11 | class Priority(val level: Int = 0) { 12 | 13 | fun toBukkit(): EventPriority = when (level) { 14 | 1 -> EventPriority.LOWEST 15 | 2 -> EventPriority.LOW 16 | 3 -> EventPriority.NORMAL 17 | 4 -> EventPriority.HIGH 18 | 5 -> EventPriority.HIGHEST 19 | 6 -> EventPriority.MONITOR 20 | else -> EventPriority.NORMAL 21 | } 22 | } -------------------------------------------------------------------------------- /bin/main/com/skillw/pouvoir/internal/feature/raytrace/RayTrace.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.internal.feature.raytrace 2 | 3 | import org.bukkit.entity.LivingEntity 4 | import org.bukkit.util.Vector 5 | 6 | class RayTrace(private val origin: Vector, private val direction: Vector) { 7 | 8 | constructor(entity: LivingEntity) : this( 9 | entity.eyeLocation.toVector(), 10 | entity.eyeLocation.direction 11 | ) 12 | 13 | fun traces(distance: Double, accuracy: Double): Set { 14 | return mutableSetOf().let { 15 | var process = 0.0 16 | while (process <= distance) { 17 | it.add(distance(process)) 18 | process += accuracy 19 | } 20 | it 21 | } 22 | } 23 | 24 | private fun distance(distance: Double): Vector { 25 | return origin.clone().add(direction.clone().multiply(distance)) 26 | } 27 | } -------------------------------------------------------------------------------- /bin/main/com/skillw/pouvoir/internal/feature/selector/Self.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.internal.feature.selector 2 | 3 | import com.skillw.pouvoir.api.feature.selector.SimpleSelector 4 | import com.skillw.pouvoir.api.feature.selector.Target 5 | import com.skillw.pouvoir.api.plugin.annotation.AutoRegister 6 | import com.skillw.pouvoir.api.plugin.map.DataMap 7 | 8 | @AutoRegister 9 | object Self : SimpleSelector("self") { 10 | override fun SelectorContext.getTargets(caster: Target): Collection { 11 | return setOf(caster) 12 | } 13 | 14 | override fun addParameter(dataMap: DataMap, vararg args: Any?) { 15 | 16 | } 17 | } -------------------------------------------------------------------------------- /bin/main/com/skillw/pouvoir/internal/feature/trigger/bukkit/BukkitEventTrigger.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.internal.feature.trigger.bukkit 2 | 3 | import com.skillw.pouvoir.api.feature.trigger.BaseTrigger 4 | import org.bukkit.event.Cancellable 5 | import org.bukkit.event.Event 6 | 7 | /** 8 | * @className CustomTrigger 9 | * 10 | * @author Glom 11 | * @date 2023/1/8 19:36 Copyright 2024 Glom. 12 | */ 13 | class BukkitEventTrigger(key: String, val event: Event) : BaseTrigger(key) { 14 | var isCancelled: Boolean = false 15 | get() = (event as? Cancellable)?.isCancelled ?: false 16 | set(value) { 17 | field = value 18 | (event as? Cancellable)?.isCancelled = value 19 | } 20 | 21 | } -------------------------------------------------------------------------------- /bin/main/com/skillw/pouvoir/internal/feature/trigger/custom/CustomTrigger.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.internal.feature.trigger.custom 2 | 3 | import com.skillw.pouvoir.api.feature.trigger.BaseTrigger 4 | import com.skillw.pouvoir.api.plugin.map.DataMap 5 | 6 | /** 7 | * @className CustomTrigger 8 | * 9 | * @author Glom 10 | * @date 2023/1/8 19:36 Copyright 2024 Glom. 11 | */ 12 | class CustomTrigger(key: String) : BaseTrigger(key) { 13 | val data = DataMap() 14 | 15 | constructor(key: String, data: Map = emptyMap()) : this(key) { 16 | this.data.putAll(data) 17 | } 18 | 19 | constructor(key: String, receiver: DataMap.() -> Unit) : this(key) { 20 | receiver(data) 21 | } 22 | } -------------------------------------------------------------------------------- /bin/main/com/skillw/pouvoir/internal/feature/trigger/custom/CustomTriggerHandler.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.internal.feature.trigger.custom 2 | 3 | import com.skillw.pouvoir.api.feature.handler.BaseHandler 4 | 5 | /** 6 | * @className CustomTriggerHandler 7 | * 8 | * @author Glom 9 | * @date 2023/1/22 20:01 Copyright 2024 Glom. 10 | */ 11 | class CustomTriggerHandler(key: String, priority: Int, val todo: (CustomTrigger) -> Unit) : 12 | BaseHandler(key, priority = priority) { 13 | override fun handle(trigger: CustomTrigger) { 14 | todo(trigger) 15 | } 16 | 17 | } -------------------------------------------------------------------------------- /bin/main/com/skillw/pouvoir/internal/manager/HologramManagerImpl.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.internal.manager 2 | 3 | import com.skillw.pouvoir.Pouvoir 4 | import com.skillw.pouvoir.api.feature.hologram.IHologram 5 | import com.skillw.pouvoir.api.manager.sub.HologramManager 6 | import com.skillw.pouvoir.internal.feature.hologram.Hologram 7 | import org.bukkit.Location 8 | 9 | internal object HologramManagerImpl : HologramManager() { 10 | override val key = "HologramManagerImpl" 11 | override val priority = 3 12 | override val subPouvoir = Pouvoir 13 | 14 | override fun createHologram(location: Location, content: List): IHologram { 15 | return Hologram(location, content) 16 | } 17 | } -------------------------------------------------------------------------------- /bin/main/com/skillw/pouvoir/internal/manager/ListenerManagerImpl.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.internal.manager 2 | 3 | import com.skillw.pouvoir.Pouvoir 4 | import com.skillw.pouvoir.api.manager.sub.ListenerManager 5 | import taboolib.common.platform.event.ProxyListener 6 | import taboolib.common.platform.function.unregisterListener 7 | 8 | internal object ListenerManagerImpl : ListenerManager() { 9 | override val key = "ListenerManager" 10 | override val priority = 3 11 | override val subPouvoir = Pouvoir 12 | 13 | override fun remove(key: String): ProxyListener? { 14 | get(key)?.let { unregisterListener(it) } 15 | return super.remove(key) 16 | } 17 | 18 | override fun onReload() { 19 | forEach { 20 | remove(it.key) 21 | } 22 | } 23 | 24 | } -------------------------------------------------------------------------------- /bin/main/com/skillw/pouvoir/internal/manager/ScriptAnnotationManagerImpl.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.internal.manager 2 | 3 | import com.skillw.pouvoir.Pouvoir 4 | import com.skillw.pouvoir.api.manager.sub.script.ScriptAnnotationManager 5 | 6 | internal object ScriptAnnotationManagerImpl : ScriptAnnotationManager() { 7 | override val key = "ScriptAnnotationManager" 8 | override val priority = 4 9 | override val subPouvoir = Pouvoir 10 | } -------------------------------------------------------------------------------- /bin/main/com/skillw/pouvoir/internal/manager/SelectorManagerImpl.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.internal.manager 2 | 3 | import com.skillw.pouvoir.Pouvoir 4 | import com.skillw.pouvoir.api.manager.sub.SelectorManager 5 | 6 | internal object SelectorManagerImpl : SelectorManager() { 7 | override val key = "SelectorManager" 8 | override val priority = 5 9 | override val subPouvoir = Pouvoir 10 | 11 | } -------------------------------------------------------------------------------- /bin/main/com/skillw/pouvoir/taboolib/module/ui/ClickType.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.taboolib.module.ui 2 | 3 | enum class ClickType { 4 | 5 | CLICK, DRAG 6 | } -------------------------------------------------------------------------------- /bin/main/com/skillw/pouvoir/taboolib/module/ui/ItemStacker$1.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Skillw/Pouvoir/955039bd3633a4481838fe85ecc122ee6b228ce7/bin/main/com/skillw/pouvoir/taboolib/module/ui/ItemStacker$1.class -------------------------------------------------------------------------------- /bin/main/com/skillw/pouvoir/taboolib/module/ui/ItemStacker$AddResult.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Skillw/Pouvoir/955039bd3633a4481838fe85ecc122ee6b228ce7/bin/main/com/skillw/pouvoir/taboolib/module/ui/ItemStacker$AddResult.class -------------------------------------------------------------------------------- /bin/main/com/skillw/pouvoir/taboolib/module/ui/ItemStacker.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Skillw/Pouvoir/955039bd3633a4481838fe85ecc122ee6b228ce7/bin/main/com/skillw/pouvoir/taboolib/module/ui/ItemStacker.class -------------------------------------------------------------------------------- /bin/main/com/skillw/pouvoir/taboolib/module/ui/Menu.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.taboolib.module.ui 2 | 3 | import org.bukkit.inventory.Inventory 4 | 5 | abstract class Menu(var title: String) { 6 | 7 | abstract fun build(): Inventory 8 | } -------------------------------------------------------------------------------- /bin/main/com/skillw/pouvoir/taboolib/module/ui/MenuHolder.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.taboolib.module.ui 2 | 3 | import org.bukkit.Bukkit 4 | import org.bukkit.inventory.Inventory 5 | import org.bukkit.inventory.InventoryHolder 6 | import com.skillw.pouvoir.taboolib.module.ui.type.Basic 7 | 8 | /** 9 | * @author 坏黑 10 | * @since 2019-05-21 20:28 11 | */ 12 | @Suppress("LeakingThis") 13 | open class MenuHolder(val menu: Basic) : InventoryHolder { 14 | 15 | private val inventory = 16 | Bukkit.createInventory(this, if (menu.rows > 0) menu.rows * 9 else menu.slots.size * 9, menu.title) 17 | 18 | override fun getInventory(): Inventory { 19 | return inventory 20 | } 21 | 22 | companion object { 23 | 24 | fun fromInventory(inventory: Inventory): Basic? { 25 | return (inventory.holder as? MenuHolder)?.menu 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /bin/main/com/skillw/pouvoir/taboolib/module/ui/VectorUtil.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Skillw/Pouvoir/955039bd3633a4481838fe85ecc122ee6b228ce7/bin/main/com/skillw/pouvoir/taboolib/module/ui/VectorUtil.class -------------------------------------------------------------------------------- /bin/main/com/skillw/pouvoir/taboolib/module/ui/type/Action.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.taboolib.module.ui.type 2 | 3 | import org.bukkit.inventory.ItemStack 4 | import taboolib.common.Isolated 5 | import com.skillw.pouvoir.taboolib.module.ui.ClickEvent 6 | 7 | 8 | abstract class Action { 9 | 10 | abstract fun getCursor(e: ClickEvent): ItemStack? 11 | 12 | abstract fun setCursor(e: ClickEvent, item: ItemStack?) 13 | 14 | abstract fun getCurrentSlot(e: ClickEvent): Int 15 | } -------------------------------------------------------------------------------- /bin/main/com/skillw/pouvoir/taboolib/module/ui/type/ActionClick.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.taboolib.module.ui.type 2 | 3 | import org.bukkit.inventory.ItemStack 4 | import taboolib.common.Isolated 5 | import com.skillw.pouvoir.taboolib.module.ui.ClickEvent 6 | 7 | 8 | class ActionClick : Action() { 9 | 10 | override fun getCursor(e: ClickEvent): ItemStack { 11 | return e.clicker.itemOnCursor 12 | } 13 | 14 | override fun setCursor(e: ClickEvent, item: ItemStack?) { 15 | e.clicker.setItemOnCursor(item) 16 | } 17 | 18 | override fun getCurrentSlot(e: ClickEvent): Int { 19 | return e.rawSlot 20 | } 21 | } -------------------------------------------------------------------------------- /bin/main/com/skillw/pouvoir/taboolib/module/ui/type/ActionKeyboard.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.taboolib.module.ui.type 2 | 3 | import org.bukkit.inventory.ItemStack 4 | import taboolib.common.Isolated 5 | import com.skillw.pouvoir.taboolib.module.ui.ClickEvent 6 | 7 | 8 | class ActionKeyboard : Action() { 9 | 10 | override fun getCursor(e: ClickEvent): ItemStack? { 11 | return e.clicker.inventory.getItem(e.clickEvent().hotbarButton) 12 | } 13 | 14 | override fun setCursor(e: ClickEvent, item: ItemStack?) { 15 | e.clicker.inventory.setItem(e.clickEvent().hotbarButton, item) 16 | } 17 | 18 | override fun getCurrentSlot(e: ClickEvent): Int { 19 | return e.rawSlot 20 | } 21 | } -------------------------------------------------------------------------------- /bin/main/com/skillw/pouvoir/taboolib/module/ui/type/ActionQuickTake.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.taboolib.module.ui.type 2 | 3 | import org.bukkit.inventory.ItemStack 4 | import taboolib.common.Isolated 5 | import com.skillw.pouvoir.taboolib.module.ui.ClickEvent 6 | import com.skillw.pouvoir.taboolib.module.ui.ItemStacker 7 | import taboolib.platform.util.isNotAir 8 | 9 | 10 | class ActionQuickTake : Action() { 11 | 12 | override fun getCursor(e: ClickEvent): ItemStack { 13 | return e.clicker.itemOnCursor 14 | } 15 | 16 | override fun setCursor(e: ClickEvent, item: ItemStack?) { 17 | if (item.isNotAir()) { 18 | ItemStacker.MINECRAFT.moveItemFromChest(item, e.clicker) 19 | } 20 | e.clicker.setItemOnCursor(null) 21 | } 22 | 23 | override fun getCurrentSlot(e: ClickEvent): Int { 24 | return e.rawSlot 25 | } 26 | } -------------------------------------------------------------------------------- /bin/main/com/skillw/pouvoir/taboolib/module/ui/type/Hopper.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.taboolib.module.ui.type 2 | 3 | import org.bukkit.Bukkit 4 | import org.bukkit.Material 5 | import org.bukkit.event.inventory.InventoryType 6 | import org.bukkit.inventory.Inventory 7 | import org.bukkit.inventory.ItemStack 8 | 9 | open class Hopper(title: String = "chest") : Basic(title) { 10 | 11 | override fun build(): Inventory { 12 | val inventory = Bukkit.createInventory(holderCallback(this), InventoryType.HOPPER, title) 13 | val line = slots[0] 14 | var cel = 0 15 | while (cel < line.size && cel < 5) { 16 | inventory.setItem(cel, items[line[cel]] ?: ItemStack(Material.AIR)) 17 | cel++ 18 | } 19 | return inventory 20 | } 21 | } -------------------------------------------------------------------------------- /bin/main/com/skillw/pouvoir/util/BukkitAttribute.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Skillw/Pouvoir/955039bd3633a4481838fe85ecc122ee6b228ce7/bin/main/com/skillw/pouvoir/util/BukkitAttribute.class -------------------------------------------------------------------------------- /bin/main/com/skillw/pouvoir/util/CalculationUtil.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.util 2 | 3 | import com.skillw.pouvoir.Pouvoir 4 | import com.skillw.pouvoir.util.calculate.calculate 5 | import org.bukkit.entity.LivingEntity 6 | 7 | /** 8 | * 计算工具类 9 | * 10 | * @constructor Create empty Calculation utils 11 | */ 12 | 13 | 14 | fun String.calculate(entity: LivingEntity? = null): Double { 15 | return calculate(Pouvoir.placeholderManager.replace(entity, this)) 16 | } 17 | 18 | fun String.calculateDouble(entity: LivingEntity? = null): Double { 19 | return calculate(entity) 20 | } 21 | 22 | 23 | fun calculate(input: String): Double { 24 | return input.calculate() 25 | } 26 | 27 | 28 | -------------------------------------------------------------------------------- /bin/main/com/skillw/pouvoir/util/GsonUtil.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.util 2 | 3 | import com.google.gson.GsonBuilder 4 | import com.skillw.pouvoir.util.Gson.gson 5 | import taboolib.common.env.RuntimeDependencies 6 | import taboolib.common.env.RuntimeDependency 7 | 8 | /** 9 | * Gson工具类 10 | * 11 | * @constructor Create empty Gson utils 12 | */ 13 | @RuntimeDependencies( 14 | RuntimeDependency("com.google.code.gson:gson:2.9.0", test = "com.google.gson.Gson") 15 | ) 16 | object Gson { 17 | val gson by lazy { 18 | GsonBuilder().disableJdkUnsafe().serializeNulls().create() 19 | } 20 | } 21 | 22 | 23 | inline fun T.encodeJson(): String { 24 | return gson.toJson(this) 25 | } 26 | 27 | 28 | inline fun String.decodeFromString(): T? { 29 | return gson.fromJson(this, T::class.java) 30 | } -------------------------------------------------------------------------------- /bin/main/com/skillw/pouvoir/util/nms/NMS.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.util.nms 2 | 3 | import com.skillw.pouvoir.util.BukkitAttribute 4 | import org.bukkit.attribute.AttributeInstance 5 | import org.bukkit.entity.LivingEntity 6 | import taboolib.module.nms.nmsProxy 7 | 8 | /** 9 | * @className NMS 10 | * 11 | * @author Glom 12 | * @date 2022/8/9 22:24 Copyright 2022 user. 13 | */ 14 | abstract class NMS { 15 | 16 | abstract fun getAttribute(entity: LivingEntity, attribute: BukkitAttribute): AttributeInstance? 17 | 18 | companion object { 19 | 20 | val INSTANCE by lazy { 21 | nmsProxy() 22 | } 23 | } 24 | 25 | } -------------------------------------------------------------------------------- /bin/main/com/skillw/pouvoir/util/nms/NMSImpl.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.util.nms 2 | 3 | import com.skillw.pouvoir.util.BukkitAttribute 4 | import org.bukkit.attribute.AttributeInstance 5 | import org.bukkit.craftbukkit.v1_12_R1.entity.CraftLivingEntity 6 | import org.bukkit.entity.LivingEntity 7 | import taboolib.module.nms.MinecraftVersion 8 | 9 | 10 | /** 11 | * @className NMS 12 | * 13 | * @author Glom 14 | * @date 2022/8/9 22:24 Copyright 2022 user. 15 | */ 16 | class NMSImpl : NMS() { 17 | override fun getAttribute(entity: LivingEntity, attribute: BukkitAttribute): AttributeInstance? { 18 | return if (MinecraftVersion.major <= 4) { 19 | val craftAttributes = (entity as CraftLivingEntity).handle.craftAttributes 20 | val bukkitAtt = attribute.toBukkit() 21 | craftAttributes.getAttribute(bukkitAtt) 22 | } else entity.getAttribute(attribute.toBukkit() ?: return null) 23 | } 24 | 25 | } -------------------------------------------------------------------------------- /bin/main/com/skillw/pouvoir/util/package-info.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Skillw/Pouvoir/955039bd3633a4481838fe85ecc122ee6b228ce7/bin/main/com/skillw/pouvoir/util/package-info.class -------------------------------------------------------------------------------- /bin/main/com/skillw/pouvoir/util/plugin/Pair.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.util.plugin 2 | 3 | // Kotlin's Pair will be relocated.... 4 | // So this class is here. 5 | data class Pair(val key: K, val value: V) 6 | 7 | infix fun A.to(that: B): Pair = Pair(this, that) -------------------------------------------------------------------------------- /bin/main/com/skillw/pouvoir/util/script/ColorUtil.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.util.script 2 | 3 | import taboolib.module.chat.colored 4 | import taboolib.module.chat.uncolored 5 | 6 | /** 7 | * 给脚本用的,颜色工具类 8 | * 9 | * Created by Glom_ on 2021-03-25 20:26:01 10 | * 11 | * Copyright 2021 user. 12 | */ 13 | object ColorUtil { 14 | 15 | fun colored(msg: String): String { 16 | return msg.colored() 17 | } 18 | 19 | 20 | fun colored(messages: List): List { 21 | return messages.colored() 22 | } 23 | 24 | 25 | fun uncolored(msg: String): String { 26 | return msg.uncolored() 27 | } 28 | 29 | 30 | fun uncolored(messages: List): List { 31 | return messages.uncolored() 32 | } 33 | 34 | 35 | fun String.decolored(): String { 36 | return this.replace("§", "&") 37 | } 38 | 39 | 40 | fun List.decolored(): List { 41 | return this.map { it.decolored() } 42 | } 43 | } -------------------------------------------------------------------------------- /bin/main/config.yml: -------------------------------------------------------------------------------- 1 | #数据库配置 2 | database: 3 | type: sqlite 4 | enable: false 5 | host: localhost 6 | port: 3306 7 | user: root 8 | password: root 9 | database: root 10 | table: my_database 11 | #每10分钟同步一次 12 | user-container-sync-time: 360000 13 | options: 14 | #调试模式 15 | debug: false 16 | #Asahi-调试模式 17 | debug-function: false 18 | #默认的数字格式 19 | #会影响Pouvoir的所有附属 20 | number-format: "#.##" 21 | #默认的小数精确位数 22 | #会影响Pouvoir的所有附属 23 | big-decimal-scale: 4 24 | message: 25 | default: 'CHAT' 26 | locked-to-default: false -------------------------------------------------------------------------------- /bin/main/dispatchers/custom-trigger.yml: -------------------------------------------------------------------------------- 1 | my trigger: 2 | triggers: [ async player chat ] 3 | context: 4 | player: "@event player" 5 | namespaces: [ bukkit ] 6 | baffle: 7 | based-on: player 8 | time: 5s 9 | pre-handle: |- 10 | tell &player '你说话了! (此消息每5秒只能触发一次)' 11 | post-handle: 12 | type: js 13 | content: |- 14 | this.context.player.sendMessage("处理完了!") 15 | exception: |- 16 | warning '触发器 my trigger 处理失败! 具体报错请看后台!' 17 | -------------------------------------------------------------------------------- /bin/main/handlers/simple-handler.yml: -------------------------------------------------------------------------------- 1 | custom-handler: 2 | triggers: [ async player chat ] 3 | when: 4 | - if: "'check &player name == 'Glom_'" 5 | goto: main1 6 | - else: main 7 | functions: 8 | main: |- 9 | tell &player 你说话了! 10 | main1: |- 11 | tell &player Glom说话了! -------------------------------------------------------------------------------- /bin/main/script.yml: -------------------------------------------------------------------------------- 1 | #全局静态类导入 2 | #格式: 3 | # 变量名: '类名' 4 | #在这里的静态类可以直接在脚本里调用 5 | static-classes: { } 6 | global-scripts: 7 | - "plugins/Pouvoir/scripts/core/" -------------------------------------------------------------------------------- /bin/main/scripts/core/util/color.js: -------------------------------------------------------------------------------- 1 | load("plugins/Pouvoir/scripts/core/basic.js"); 2 | 3 | /** 4 | * @description 给文本上色 "&6test" -> "§6test" 5 | * @author Glom 6 | * @date 2022/12/20 7 | * @param {*} str 含颜色代码的文本 8 | * @returns {*} 上色后的文本 9 | */ 10 | function color(str) { 11 | return ColorUtils.colored(str); 12 | } 13 | 14 | /** 15 | * @description 给文本去色 "&6test"/"§6test" -> "test" 16 | * @author Glom 17 | * @date 2022/12/20 18 | * @param {*} str 含颜色代码的文本 19 | * @returns {*} 去色后的文本 20 | */ 21 | function uncolor(str) { 22 | return ColorUtils.uncolored(str); 23 | } 24 | 25 | /** 26 | * @description 给文本去色,还原未上色的文本 "§6test" -> "&6test" 27 | * @author Glom 28 | * @date 2022/12/20 29 | * @param {*} str 含颜色代码的文本 30 | * @returns {*} 未上色的文本 31 | */ 32 | function decolor(str) { 33 | return ColorUtils.decolored(str); 34 | } 35 | -------------------------------------------------------------------------------- /bin/main/scripts/core/util/container.js: -------------------------------------------------------------------------------- 1 | load("plugins/Pouvoir/scripts/core/basic.js"); 2 | 3 | PouvoirContainer = static("PouvoirContainer"); 4 | 5 | /** @type {Container} 持久化容器 */ 6 | function container() { 7 | return PouvoirContainer.container 8 | } 9 | 10 | /** 11 | * 用法: 12 | * 13 | * 用户名,键,值 都可自定义,为字符串即可 14 | * (用户名建议为uuid或玩家名) 15 | * 16 | * 用户名 键 17 | * container().get(user,key) - 从容器中获取值 18 | * 用户名 键 19 | * container().delete(user,key) - 删除容器中的值 20 | * 用户名 键 值 21 | * container().set(user,key,value) - 设置容器中的值 22 | * 23 | */ 24 | -------------------------------------------------------------------------------- /bin/main/scripts/core/util/number.js: -------------------------------------------------------------------------------- 1 | load("plugins/Pouvoir/scripts/core/basic.js"); 2 | /** 3 | * @description 格式化数字 4 | * @author Glom 5 | * @date 2022/12/20 6 | * @param {*} number 数字 7 | * @param {*} format 格式 8 | * @returns {*} 格式化后的数字文本 9 | */ 10 | function format(number, format) { 11 | return NumberUtils.format(number, format); 12 | } 13 | 14 | /** 15 | * @description 计算公式并返回结果 16 | * @author Glom 17 | * @date 2022/12/20 18 | * @param {*} formula 公式 19 | * @param {*} entity 实体 20 | * @returns {BigDecimal} 计算结果 21 | */ 22 | function calculate(formula, entity) { 23 | return CalculationUtils.calculate(formula, entity, null); 24 | } 25 | 26 | /** 27 | * @description 计算公式并返回结果 28 | * @author Glom 29 | * @date 2022/12/20 30 | * @param {*} formula 公式 31 | * @param {*} entity 实体 32 | * @returns {Double} 计算结果 33 | */ 34 | function calculateDouble(formula, entity) { 35 | return CalculationUtils.calculateDouble(formula, entity, null); 36 | } 37 | -------------------------------------------------------------------------------- /bin/main/scripts/core/util/placeholder.js: -------------------------------------------------------------------------------- 1 | load("plugins/Pouvoir/scripts/core/basic.js"); 2 | PouvoirAPI = static("PouvoirAPI"); 3 | /** 4 | * @description 解析占位符(PouPAPI & PAPI) 5 | * @author Glom 6 | * @date 2022/12/20 7 | * @param {String} string 待解析的文本 8 | * @param {LivingEntity} entity 实体 9 | * @returns {String} 解析后的文本 10 | */ 11 | function placeholder(string, entity) { 12 | PouvoirAPI.placeholder(string, entity); 13 | } 14 | -------------------------------------------------------------------------------- /bin/main/scripts/core/util/ray_trace.js: -------------------------------------------------------------------------------- 1 | load("plugins/Pouvoir/scripts/core/basic.js"); 2 | /** 3 | * @description 获取实体视角所对的实体(可能为null) 4 | * @author Glom 5 | * @date 2022/12/20 6 | * @param {LivingEntity} entity 实体 7 | * @param {Double} distance 距离 8 | * @returns {LivingEntity} 实体视角所对的实体(可能为null) 9 | */ 10 | function getRayHit(entity, distance) { 11 | return EntityUtils.getEntityRayHit(entity, distance); 12 | } 13 | -------------------------------------------------------------------------------- /bin/main/scripts/example.js: -------------------------------------------------------------------------------- 1 | function example() { 2 | asahi("print 11111"); 3 | } 4 | -------------------------------------------------------------------------------- /bin/main/scripts/groovy.groovy: -------------------------------------------------------------------------------- 1 | // When u use the Script Annotation, don't delete '//' before it. 2 | ////@Listener(-event org.bukkit.event.player.PlayerChatEvent) 3 | //def hi() { 4 | // event.player.sendMessage 'Hi! I\'m groovy.groovy::hi' 5 | //} -------------------------------------------------------------------------------- /bin/main/scripts/test.asahi: -------------------------------------------------------------------------------- 1 | def test() { 2 | print 'test hhh' 3 | } -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | #Sun Dec 18 16:16:45 CST 2022 2 | version=1.6.8-alpha 3 | group=com.skillw.pouvoir -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Skillw/Pouvoir/955039bd3633a4481838fe85ecc122ee6b228ce7/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists -------------------------------------------------------------------------------- /libs/AttributePlus.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Skillw/Pouvoir/955039bd3633a4481838fe85ecc122ee6b228ce7/libs/AttributePlus.jar -------------------------------------------------------------------------------- /libs/DecentHolograms-2.5.2 (1).jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Skillw/Pouvoir/955039bd3633a4481838fe85ecc122ee6b228ce7/libs/DecentHolograms-2.5.2 (1).jar -------------------------------------------------------------------------------- /libs/Matrix_free.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Skillw/Pouvoir/955039bd3633a4481838fe85ecc122ee6b228ce7/libs/Matrix_free.jar -------------------------------------------------------------------------------- /libs/PlaceholderAPI-2.10.9.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Skillw/Pouvoir/955039bd3633a4481838fe85ecc122ee6b228ce7/libs/PlaceholderAPI-2.10.9.jar -------------------------------------------------------------------------------- /libs/PouNashorn.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Skillw/Pouvoir/955039bd3633a4481838fe85ecc122ee6b228ce7/libs/PouNashorn.jar -------------------------------------------------------------------------------- /libs/ProtocolLib.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Skillw/Pouvoir/955039bd3633a4481838fe85ecc122ee6b228ce7/libs/ProtocolLib.jar -------------------------------------------------------------------------------- /libs/Vault-1.7.3.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Skillw/Pouvoir/955039bd3633a4481838fe85ecc122ee6b228ce7/libs/Vault-1.7.3.jar -------------------------------------------------------------------------------- /libs/aac-api-5.0.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Skillw/Pouvoir/955039bd3633a4481838fe85ecc122ee6b228ce7/libs/aac-api-5.0.0.jar -------------------------------------------------------------------------------- /libs/purpur-1.19.2.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Skillw/Pouvoir/955039bd3633a4481838fe85ecc122ee6b228ce7/libs/purpur-1.19.2.jar -------------------------------------------------------------------------------- /libs/reflectasm-g-1.0-SNAPSHOT-all.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Skillw/Pouvoir/955039bd3633a4481838fe85ecc122ee6b228ce7/libs/reflectasm-g-1.0-SNAPSHOT-all.jar -------------------------------------------------------------------------------- /settings.gradle.kts: -------------------------------------------------------------------------------- 1 | rootProject.name = "Pouvoir" -------------------------------------------------------------------------------- /src/main/java/com/skillw/asahi/internal/function/lang/java/ExampleAction.java: -------------------------------------------------------------------------------- 1 | package com.skillw.asahi.internal.function.lang.java; 2 | 3 | import com.skillw.asahi.api.annotation.AsahiInfix; 4 | import com.skillw.asahi.api.member.parser.infix.namespacing.BaseInfix; 5 | 6 | @AsahiInfix 7 | public class ExampleAction extends BaseInfix { 8 | /** 9 | * 使用方法: 10 | * set str to "123" 11 | * str printStr 12 | */ 13 | public ExampleAction() { 14 | super(String.class, "common"); 15 | this.infix(new String[]{"printStr"}, (context, str) -> { 16 | System.out.println(str); 17 | return str; 18 | }); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/com/skillw/asahi/internal/function/lang/java/ExampleParser.java: -------------------------------------------------------------------------------- 1 | package com.skillw.asahi.internal.function.lang.java; 2 | 3 | import com.skillw.asahi.api.member.lexer.JavaLexer; 4 | import com.skillw.asahi.api.member.parser.prefix.type.JavaTypeParser; 5 | import com.skillw.asahi.api.member.quest.Quester; 6 | import org.jetbrains.annotations.NotNull; 7 | 8 | import static com.skillw.asahi.api.ExtensionKt.quester; 9 | 10 | //@AsahiParser 11 | public class ExampleParser extends JavaTypeParser { 12 | 13 | @NotNull 14 | @Override 15 | protected Quester parse(@NotNull JavaLexer reader) { 16 | String str = reader.next(); 17 | return quester((context) -> { 18 | System.out.println(str); 19 | return str; 20 | }); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/com/skillw/pouvoir/util/read/Char.java: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.util.read; 2 | 3 | public class Char { 4 | final char c; 5 | 6 | public Char(char c) { 7 | this.c = c; 8 | } 9 | 10 | @Override 11 | public int hashCode() { 12 | return this.c; 13 | } 14 | 15 | @Override 16 | public boolean equals(Object o) { 17 | return (o instanceof Char) && ((Char) o).c == this.c; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/com/skillw/pouvoir/util/read/Parser.java: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.util.read; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | public interface Parser { 6 | @NotNull 7 | Result parse(String text); 8 | } 9 | -------------------------------------------------------------------------------- /src/main/java/com/skillw/pouvoir/util/read/Value.java: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.util.read; 2 | 3 | public class Value { 4 | 5 | public double value; 6 | public char operator; 7 | 8 | public Value(double value, char operator) { 9 | this.value = value; 10 | this.operator = operator; 11 | } 12 | 13 | @Override 14 | public String toString() { 15 | return String.valueOf(this.operator) + this.value; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/main/kotlin/com/skillw/asahi/api/InlineAnalysis.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.asahi.api 2 | 3 | import com.skillw.asahi.api.member.context.AsahiContext 4 | import com.skillw.asahi.api.member.namespace.NamespaceHolder 5 | import com.skillw.asahi.internal.lexer.InlineAnalysisImpl 6 | 7 | /** 8 | * @className InlineReaderImpl 9 | * 10 | * @author Glom 11 | * @date 2023/1/14 10:04 Copyright 2024 Glom. 12 | */ 13 | interface InlineAnalysis : NamespaceHolder { 14 | /** 15 | * 根据上下文解析内联文本 16 | * 17 | * @param context 上下文 18 | * @return 解析后的内联文本 19 | */ 20 | fun analysis(context: AsahiContext = AsahiContext.create()): String 21 | 22 | companion object { 23 | /** 24 | * 创建内联文本解释器对象 25 | * 26 | * @param string String 文本 27 | * @return InlineAnalysis 28 | */ 29 | @JvmStatic 30 | fun of(string: String): InlineAnalysis { 31 | return InlineAnalysisImpl.of(string) 32 | } 33 | } 34 | } -------------------------------------------------------------------------------- /src/main/kotlin/com/skillw/asahi/api/annotation/AsahiGetter.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.asahi.api.annotation 2 | 3 | annotation class AsahiGetter() 4 | -------------------------------------------------------------------------------- /src/main/kotlin/com/skillw/asahi/api/annotation/AsahiInfix.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.asahi.api.annotation 2 | 3 | /** 4 | * Asahi Infix annotation 5 | * 6 | * 自动注册 7 | * 8 | * @constructor Asahi Infix annotation 9 | */ 10 | annotation class AsahiInfix 11 | -------------------------------------------------------------------------------- /src/main/kotlin/com/skillw/asahi/api/annotation/AsahiNamespace.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.asahi.api.annotation 2 | 3 | annotation class AsahiNamespace() 4 | -------------------------------------------------------------------------------- /src/main/kotlin/com/skillw/asahi/api/annotation/AsahiPrefix.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.asahi.api.annotation 2 | 3 | /** 4 | * Asahi Prefix annotation 5 | * 6 | * 自动注册 7 | * 8 | * @constructor Asahi Prefix annotation 9 | */ 10 | @Target(AnnotationTarget.CLASS, AnnotationTarget.FUNCTION, AnnotationTarget.FIELD) 11 | annotation class AsahiPrefix(val names: Array = [], val namespace: String = "common") 12 | -------------------------------------------------------------------------------- /src/main/kotlin/com/skillw/asahi/api/annotation/AsahiSetter.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.asahi.api.annotation 2 | 3 | annotation class AsahiSetter() 4 | -------------------------------------------------------------------------------- /src/main/kotlin/com/skillw/asahi/api/annotation/AsahiTopParser.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.asahi.api.annotation 2 | 3 | /** 4 | * Asahi Top Parser annotation 5 | * 6 | * 自动注册 7 | * 8 | * @constructor Asahi Top parser annotation 9 | */ 10 | @Target(AnnotationTarget.CLASS) 11 | annotation class AsahiTopParser 12 | -------------------------------------------------------------------------------- /src/main/kotlin/com/skillw/asahi/api/annotation/AsahiTypeParser.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.asahi.api.annotation 2 | 3 | /** 4 | * Asahi Type Parser annotation 5 | * 6 | * 自动注册 7 | * 8 | * @constructor Asahi Type parser annotation 9 | */ 10 | @Target(AnnotationTarget.CLASS, AnnotationTarget.FUNCTION, AnnotationTarget.FIELD) 11 | annotation class AsahiTypeParser 12 | -------------------------------------------------------------------------------- /src/main/kotlin/com/skillw/asahi/api/member/AsahiRegistrable.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.asahi.api.member 2 | 3 | /** 4 | * @className Registrable 5 | * 6 | * @author Glom 7 | * @date 2022/7/18 7:56 Copyright 2022 user. 8 | * 9 | * 可注册的类 10 | */ 11 | interface AsahiRegistrable { 12 | /** 键 */ 13 | val key: K 14 | fun register() 15 | } -------------------------------------------------------------------------------- /src/main/kotlin/com/skillw/asahi/api/member/context/LoopContext.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.asahi.api.member.context 2 | 3 | interface LoopContext { 4 | val label: String 5 | var isBreak: Boolean 6 | var isContinue: Boolean 7 | val parent: LoopContext? 8 | val subLoops: HashSet 9 | fun searchLabel(label: String): LoopContext 10 | 11 | enum class Result { 12 | BREAK, CONTINUE 13 | } 14 | } -------------------------------------------------------------------------------- /src/main/kotlin/com/skillw/asahi/api/member/lexer/AsahiDemand.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.asahi.api.member.lexer 2 | 3 | import com.skillw.asahi.internal.lexer.AsahiDemandImpl 4 | import com.skillw.asahi.util.AsahiDataMap 5 | import org.bukkit.entity.Entity 6 | 7 | /** 8 | * @className PouDemand 9 | * 10 | * @author Glom 11 | * @date 2023/1/14 12:38 Copyright 2024 Glom. 12 | */ 13 | abstract class AsahiDemand(val entity: Entity? = null) : AsahiDataMap() { 14 | companion object { 15 | fun of(string: String): AsahiDemand { 16 | return AsahiDemandImpl.of(string) 17 | } 18 | } 19 | 20 | abstract fun tag(tag: String): Boolean 21 | 22 | abstract fun tagAnyOf(vararg tags: String): Boolean 23 | 24 | abstract fun tagAllOf(vararg tags: String): Boolean 25 | 26 | abstract val args: ArrayList 27 | abstract val tags: LinkedHashSet 28 | } -------------------------------------------------------------------------------- /src/main/kotlin/com/skillw/asahi/api/member/lexer/JavaLexer.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.asahi.api.member.lexer 2 | 3 | import com.skillw.asahi.api.member.context.AsahiContext 4 | import com.skillw.asahi.api.member.quest.Quester 5 | 6 | /** 7 | * @className JavaFuncReader 8 | * 9 | * @author Glom 10 | * @date 2023/1/15 13:18 Copyright 2024 Glom. 11 | */ 12 | class JavaLexer(reader: AsahiLexer) : AsahiLexer by reader { 13 | /** 14 | * 加了一层类型转换的quest 15 | * 16 | * @param R 类型 17 | * @return 18 | */ 19 | fun questAs(): Quester { 20 | return questObj() as Quester 21 | } 22 | 23 | /** 24 | * 结果 25 | * 26 | * @param exec 结果内容 27 | * @param R 返回类型 28 | * @return 29 | * @receiver 30 | */ 31 | fun result(exec: AsahiContext.() -> R): Quester { 32 | return Quester { exec() } 33 | } 34 | } -------------------------------------------------------------------------------- /src/main/kotlin/com/skillw/asahi/api/member/lexer/tokenizer/Line.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.asahi.api.member.lexer.tokenizer 2 | 3 | data class Line(val lineNumber: Int, val range: IntRange) 4 | -------------------------------------------------------------------------------- /src/main/kotlin/com/skillw/asahi/api/member/namespace/Namespacing.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.asahi.api.member.namespace 2 | 3 | import com.skillw.asahi.api.AsahiManager 4 | 5 | /** 6 | * @className Namespacing 7 | * 8 | * 在命名空间中储藏的类 9 | * 10 | * @author Glom 11 | * @date 2023/1/20 10:12 Copyright 2024 Glom. 12 | */ 13 | interface Namespacing { 14 | /** 命名空间 */ 15 | val namespace: String 16 | 17 | /** 18 | * 命名空间对象 19 | * 20 | * @return 命名空间对象 21 | */ 22 | fun namespace(): Namespace { 23 | return AsahiManager.getNamespace(namespace) 24 | } 25 | } -------------------------------------------------------------------------------- /src/main/kotlin/com/skillw/asahi/api/member/parser/infix/namespacing/InfixExecutor.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.asahi.api.member.parser.infix.namespacing 2 | 3 | import com.skillw.asahi.api.member.context.InfixContext 4 | 5 | 6 | /** 7 | * @className InfixExecutor 8 | * 9 | * @author Glom 10 | * @date 2022年12月27日 8:36 Copyright 2022 user. 11 | */ 12 | fun interface InfixExecutor { 13 | /** 14 | * 执行中缀解释器执行内容 15 | * 16 | * @param obj 对象 17 | * @return 结果 18 | */ 19 | fun InfixContext.execute(obj: T): Any? 20 | 21 | /** 22 | * 执行中缀解释器执行内容 23 | * 24 | * @param context 上下文 25 | * @param obj 对象 26 | * @return 结果 27 | */ 28 | @Suppress("UNCHECKED_CAST") 29 | fun run(context: InfixContext, obj: Any): Any? { 30 | return context.run { execute(obj as? T ?: return null) } 31 | } 32 | } -------------------------------------------------------------------------------- /src/main/kotlin/com/skillw/asahi/api/member/parser/prefix/PrefixParser.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.asahi.api.member.parser.prefix 2 | 3 | import com.skillw.asahi.api.member.lexer.AsahiLexer 4 | import com.skillw.asahi.api.member.quest.Quester 5 | 6 | /** 7 | * @className Parser 8 | * 9 | * @author Glom 10 | * @date 2023/1/15 13:14 Copyright 2024 Glom. 11 | */ 12 | interface PrefixParser { 13 | /** 14 | * 前缀解释器执行内容 15 | * 16 | * @param lexer 词法器 17 | * @return 结果 18 | */ 19 | fun parseWith(lexer: AsahiLexer): Quester? 20 | } -------------------------------------------------------------------------------- /src/main/kotlin/com/skillw/asahi/api/member/parser/prefix/namespacing/BaseJavaPrefix.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.asahi.api.member.parser.prefix.namespacing 2 | 3 | import com.skillw.asahi.api.member.lexer.JavaLexer 4 | import com.skillw.asahi.api.member.quest.Quester 5 | 6 | 7 | /** 8 | * @className BaseJavaPrefix 9 | * 10 | * @author Glom 11 | * @date 2022/12/25 13:39 Copyright 2022 user. 12 | */ 13 | abstract class BaseJavaPrefix : PrefixCreator { 14 | /** 15 | * 解释器执行内容 16 | * 17 | * @return 18 | */ 19 | protected abstract fun JavaLexer.parse(): Quester 20 | override fun PrefixParser.parse(): Quester { 21 | return JavaLexer(this).parse() 22 | } 23 | } -------------------------------------------------------------------------------- /src/main/kotlin/com/skillw/asahi/api/member/parser/prefix/namespacing/PrefixParser.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.asahi.api.member.parser.prefix.namespacing 2 | 3 | import com.skillw.asahi.api.member.context.AsahiContext 4 | import com.skillw.asahi.api.member.lexer.AsahiLexer 5 | import com.skillw.asahi.api.member.quest.Quester 6 | 7 | /** 8 | * @className PrefixParser 9 | * 10 | * 前缀解释器的编译上下文 11 | * 12 | * @author Glom 13 | * @date 2022/12/27 19:31 Copyright 2022 user. 14 | */ 15 | class PrefixParser private constructor( 16 | reader: AsahiLexer, 17 | ) : AsahiLexer by reader { 18 | companion object { 19 | fun AsahiLexer.prefixParser(): PrefixParser { 20 | return PrefixParser(this) 21 | } 22 | } 23 | 24 | /** 25 | * 结果 26 | * 27 | * @param exec 结果内容 28 | * @param R 返回类型 29 | * @return 返回的结果 30 | * @receiver 31 | */ 32 | fun result(exec: AsahiContext.() -> R): Quester { 33 | return Quester { exec() } 34 | } 35 | } -------------------------------------------------------------------------------- /src/main/kotlin/com/skillw/asahi/api/member/parser/prefix/type/JavaTypeParser.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.asahi.api.member.parser.prefix.type 2 | 3 | import com.skillw.asahi.api.member.lexer.AsahiLexer 4 | import com.skillw.asahi.api.member.lexer.JavaLexer 5 | import com.skillw.asahi.api.member.quest.Quester 6 | import com.skillw.asahi.api.quester 7 | 8 | 9 | /** 10 | * @className JavaTypeParser 11 | * 12 | * @author Glom 13 | * @date 2022/12/25 13:39 Copyright 2022 user. 14 | */ 15 | abstract class JavaTypeParser( 16 | vararg types: Class<*>, 17 | ) : TypeParser(*types) { 18 | 19 | 20 | override fun AsahiLexer.parse(): Quester { 21 | return JavaLexer(this).parse() 22 | } 23 | 24 | /** 25 | * 类型解释器内容 26 | * 27 | * @return 解释结果 28 | */ 29 | protected abstract fun JavaLexer.parse(): Quester 30 | 31 | override fun parseWith(lexer: AsahiLexer): Quester { 32 | val parser = JavaLexer(lexer).parse() 33 | return quester { 34 | parser.get() 35 | } 36 | } 37 | } -------------------------------------------------------------------------------- /src/main/kotlin/com/skillw/asahi/api/member/quest/LazyQuester.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.asahi.api.member.quest 2 | 3 | /** 4 | * @className LazyQuester 5 | * 6 | * 懒人式对象获取器 7 | * 8 | * 将此对象的变量放到上下文中后,解释变量后会返回执行内容 9 | * 10 | * @author Glom 11 | * @date 2023/1/14 11:47 Copyright 2024 Glom. 12 | */ 13 | fun interface LazyQuester : Quester -------------------------------------------------------------------------------- /src/main/kotlin/com/skillw/asahi/api/member/quest/Quester.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.asahi.api.member.quest 2 | 3 | import com.skillw.asahi.api.member.context.AsahiContext 4 | 5 | fun interface Quester { 6 | 7 | /** 8 | * 在上下文中执行/获取 9 | * 10 | * @return R 11 | * @receiver AsahiContext 12 | */ 13 | fun AsahiContext.execute(): R 14 | 15 | fun run(context: AsahiContext): R { 16 | return context.run { execute() } 17 | } 18 | 19 | fun get(context: AsahiContext): R { 20 | return context.execute() 21 | } 22 | 23 | } -------------------------------------------------------------------------------- /src/main/kotlin/com/skillw/asahi/api/member/quest/VarBeanQuester.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.asahi.api.member.quest 2 | 3 | fun interface VarBeanQuester : Quester -------------------------------------------------------------------------------- /src/main/kotlin/com/skillw/asahi/api/script/AsahiQuestException.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.asahi.api.script 2 | 3 | class AsahiQuestException(message: String, throwable: Throwable? = null) : Exception(message, throwable) -------------------------------------------------------------------------------- /src/main/kotlin/com/skillw/asahi/api/script/AsahiScriptException.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.asahi.api.script 2 | 3 | /** 4 | * @className AsahiScriptException 5 | * 6 | * @author Glom 7 | * @date 2023/1/4 18:33 Copyright 2022 user. 8 | */ 9 | class AsahiScriptException(message: String, throwable: Throwable? = null) : Exception(message, throwable) 10 | -------------------------------------------------------------------------------- /src/main/kotlin/com/skillw/asahi/api/script/linking/Invoker.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.asahi.api.script.linking 2 | 3 | import com.skillw.asahi.api.member.context.AsahiContext 4 | 5 | /** 6 | * @className Invoker 7 | * 8 | * @author Glom 9 | * @date 2023/1/22 19:00 Copyright 2024 Glom. 10 | */ 11 | fun interface Invoker { 12 | fun invoke(context: AsahiContext, vararg params: Any?): Any? 13 | } -------------------------------------------------------------------------------- /src/main/kotlin/com/skillw/asahi/api/script/linking/InvokerHolder.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.asahi.api.script.linking 2 | 3 | /** 4 | * @className InvokerHolder 5 | * 6 | * @author Glom 7 | * @date 2023/1/22 19:06 Copyright 2024 Glom. 8 | */ 9 | interface InvokerHolder { 10 | /** 可调用对象 当前上下文中的可调用对象 */ 11 | val invokers: HashMap 12 | 13 | 14 | /** 15 | * Has invoker 16 | * 17 | * @param key 18 | * @return 19 | */ 20 | fun hasInvoker(key: String): Boolean { 21 | return invokers.containsKey(key) 22 | } 23 | 24 | /** 25 | * Add invoker 26 | * 27 | * @param key 28 | * @param invoker 29 | */ 30 | fun addInvoker(key: String, invoker: Invoker) { 31 | invokers[key] = invoker 32 | } 33 | } -------------------------------------------------------------------------------- /src/main/kotlin/com/skillw/asahi/internal/namespace/Common.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.asahi.internal.namespace 2 | 3 | import com.skillw.asahi.api.member.namespace.Namespace 4 | 5 | 6 | object Common : Namespace("common", true) -------------------------------------------------------------------------------- /src/main/kotlin/com/skillw/asahi/internal/namespace/Lang.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.asahi.internal.namespace 2 | 3 | import com.skillw.asahi.api.member.namespace.Namespace 4 | 5 | 6 | object Lang : Namespace("lang", true) -------------------------------------------------------------------------------- /src/main/kotlin/com/skillw/asahi/internal/namespacing/infix/InfixMatchResult.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.asahi.internal.namespacing.infix 2 | 3 | import com.skillw.asahi.api.annotation.AsahiInfix 4 | import com.skillw.asahi.api.member.parser.infix.namespacing.BaseInfix 5 | 6 | @AsahiInfix 7 | internal object InfixMatchResult : BaseInfix(MatchResult::class.java, "regex") { 8 | init { 9 | infix("value") { result -> 10 | result.value 11 | } 12 | infix("groups") { result -> 13 | if (expect("of")) { 14 | result.groups[parseString()]?.value 15 | } 16 | if (expect("at")) { 17 | result.groups[parseInt()]?.value 18 | } else 19 | result.groupValues 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/main/kotlin/com/skillw/asahi/internal/namespacing/infix/linking/InfixBool.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.asahi.internal.namespacing.infix.linking 2 | 3 | import com.skillw.asahi.api.annotation.AsahiInfix 4 | import com.skillw.asahi.api.member.parser.infix.namespacing.BaseInfix 5 | 6 | /** 7 | * @className ActionBool 8 | * 9 | * @author Glom 10 | * @date 2022年12月13日14点47分 Copyright 2022 user. 11 | */ 12 | @AsahiInfix 13 | internal object InfixBool : BaseInfix(Boolean::class.java) { 14 | init { 15 | infix("?") { bool -> 16 | if (bool) { 17 | val result = parse() 18 | expect(":") 19 | skip() 20 | result 21 | } else { 22 | skip() 23 | expect(":") 24 | parse() 25 | } 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /src/main/kotlin/com/skillw/asahi/internal/namespacing/infix/linking/InfixCompletableFuture.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.asahi.internal.namespacing.infix.linking 2 | 3 | import com.skillw.asahi.api.annotation.AsahiInfix 4 | import com.skillw.asahi.api.member.parser.infix.namespacing.BaseInfix 5 | import java.util.concurrent.CompletableFuture 6 | 7 | /** 8 | * @className ActionCompletableFuture 9 | * 10 | * @author Glom 11 | * @date 2023年1月16日23点47分 Copyright 2024 Glom. 12 | */ 13 | @AsahiInfix 14 | internal object InfixCompletableFuture : BaseInfix>(CompletableFuture::class.java) { 15 | init { 16 | infix("join") { future -> 17 | future.join() 18 | } 19 | } 20 | } -------------------------------------------------------------------------------- /src/main/kotlin/com/skillw/asahi/internal/namespacing/infix/linking/InfixPair.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.asahi.internal.namespacing.infix.linking 2 | 3 | import com.skillw.asahi.api.annotation.AsahiInfix 4 | import com.skillw.asahi.api.member.parser.infix.namespacing.BaseInfix 5 | 6 | /** 7 | * @className ActionPair 8 | * 9 | * @author Glom 10 | * @date 2022/8/9 16:26 Copyright 2022 user. 11 | */ 12 | @AsahiInfix 13 | internal object InfixPair : BaseInfix>(Pair::class.java) { 14 | init { 15 | "key" to { it.first } 16 | "value" to { it.second } 17 | } 18 | } -------------------------------------------------------------------------------- /src/main/kotlin/com/skillw/asahi/internal/namespacing/prefix/lang/util/String.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.asahi.internal.namespacing.prefix.lang.util 2 | 3 | import com.skillw.asahi.api.AsahiAPI.analysis 4 | import com.skillw.asahi.api.annotation.AsahiPrefix 5 | import com.skillw.asahi.api.prefixParser 6 | import com.skillw.asahi.api.quest 7 | 8 | /** 9 | * @className String 10 | * 11 | * @author Glom 12 | * @date 2023/1/17 15:37 Copyright 2024 Glom. 13 | */ 14 | @AsahiPrefix(["analysis", "inline"], "lang") 15 | private fun inline() = prefixParser { 16 | val text = if (expect("all")) questList() else quest() 17 | result { 18 | text.get().let { obj -> 19 | when (obj) { 20 | is Collection<*> -> obj.map { it.toString().analysis(this, *namespaceNames()) } 21 | else -> obj.toString().analysis(this, *namespaceNames()) 22 | } 23 | } 24 | } 25 | } 26 | 27 | 28 | -------------------------------------------------------------------------------- /src/main/kotlin/com/skillw/asahi/internal/util/MapTemplate.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.asahi.internal.util 2 | 3 | data class MapTemplate(val keys: List) { 4 | fun build(values: List): MutableMap { 5 | return keys.zip(values).toMap().toMutableMap() 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /src/main/kotlin/com/skillw/asahi/internal/util/Time.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.asahi.internal.util 2 | 3 | import taboolib.common5.util.parseMillis 4 | 5 | /** 6 | * @className Time 7 | * 8 | * @author Glom 9 | * @date 2023/1/11 23:25 Copyright 2024 Glom. 10 | */ 11 | class Time(var millis: Long) { 12 | constructor(string: String) : this(string.parseMillis()) 13 | 14 | fun toTick(): Long = millis / 50 15 | 16 | companion object { 17 | @JvmStatic 18 | val noTime = Time(-1) 19 | 20 | @JvmStatic 21 | fun tick(tick: Long): Time { 22 | return Time(tick * 50) 23 | } 24 | } 25 | } -------------------------------------------------------------------------------- /src/main/kotlin/com/skillw/particlelib/EffectData.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.particlelib 2 | 3 | import com.skillw.pouvoir.api.plugin.map.DataMap 4 | 5 | /** 6 | * @className EffectData 7 | * 8 | * @author Glom 9 | * @date 2023/1/21 15:48 Copyright 2024 Glom. 10 | */ 11 | class EffectData : DataMap() { 12 | 13 | } -------------------------------------------------------------------------------- /src/main/kotlin/com/skillw/particlelib/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * 非常感谢由莫老开发的粒子库 3 | *

4 | * https://github.com/602723113/ParticleLib 5 | *

6 | */ 7 | package com.skillw.particlelib; 8 | 9 | -------------------------------------------------------------------------------- /src/main/kotlin/com/skillw/particlelib/pobject/Circle.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.particlelib.pobject 2 | 3 | import taboolib.common.util.Location 4 | 5 | /** 6 | * 表示一个圆 7 | * 8 | * @author Zoyn IceCold 9 | */ 10 | class Circle 11 | /** 12 | * 构造一个圆 13 | * 14 | * @param origin 圆的圆点 15 | * @param radius 圆的半径 16 | * @param step 每个粒子的间隔(也即步长) 17 | * @param period 特效周期(如果需要可以使用) 18 | */(origin: Location, radius: Double = 1.0, step: Double = 1.0, period: Long = 20L) : 19 | Arc(origin, 0.0, 360.0, radius, step, period) -------------------------------------------------------------------------------- /src/main/kotlin/com/skillw/particlelib/pobject/Playable.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.particlelib.pobject 2 | 3 | /** 4 | * 代表一个特效对象是可播放的 5 | * 6 | * @author Zoyn 7 | */ 8 | interface Playable { 9 | fun play() 10 | fun playNextPoint() 11 | } -------------------------------------------------------------------------------- /src/main/kotlin/com/skillw/particlelib/pobject/ShowType.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.particlelib.pobject 2 | 3 | enum class ShowType { 4 | NONE, ALWAYS_SHOW, ALWAYS_SHOW_ASYNC, ALWAYS_PLAY, ALWAYS_PLAY_ASYNC 5 | } -------------------------------------------------------------------------------- /src/main/kotlin/com/skillw/particlelib/pobject/bezier/package-info.kt: -------------------------------------------------------------------------------- 1 | /** 存放关于贝塞尔曲线的特效对象 */ 2 | package com.skillw.particlelib.pobject.bezier 3 | 4 | -------------------------------------------------------------------------------- /src/main/kotlin/com/skillw/particlelib/pobject/equation/Equations.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.particlelib.pobject.equation 2 | 3 | import java.util.function.Function 4 | import kotlin.math.cos 5 | import kotlin.math.pow 6 | import kotlin.math.sin 7 | 8 | object Equations { 9 | /** 二次函数 */ 10 | val QUADRATIC_FUNCTION = Function { x: Double -> 11 | (x).pow(2.0) 12 | } 13 | 14 | /** 一次函数 */ 15 | val LINEAR_FUNCTION = Function { x: Double -> x } 16 | 17 | /** cos函数 */ 18 | val COS_FUNCTION = Function { a: Double -> cos(a) } 19 | 20 | /** sin函数 */ 21 | val SIN_FUNCTION = Function { a: Double -> sin(a) } 22 | 23 | /** 极坐标:四叶玫瑰线 */ 24 | val POLAR_FOUR_LEAVE_CURVE = Function { theta: Double -> 1.5 * sin(2 * theta) } 25 | } -------------------------------------------------------------------------------- /src/main/kotlin/com/skillw/particlelib/pobject/equation/package-info.kt: -------------------------------------------------------------------------------- 1 | /** 存放关于函数渲染器的特效对象 */ 2 | package com.skillw.particlelib.pobject.equation -------------------------------------------------------------------------------- /src/main/kotlin/com/skillw/particlelib/pobject/package-info.kt: -------------------------------------------------------------------------------- 1 | /** 存放着所有已经写好的特效对象 */ 2 | package com.skillw.particlelib.pobject 3 | -------------------------------------------------------------------------------- /src/main/kotlin/com/skillw/particlelib/utils/coordinate/Coordinate.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.particlelib.utils.coordinate 2 | 3 | import taboolib.common.util.Location 4 | 5 | /** 6 | * 表示一个坐标器 7 | * 8 | * @author Zoyn 9 | */ 10 | interface Coordinate { 11 | fun newLocation(x: Double, y: Double, z: Double): Location? 12 | } -------------------------------------------------------------------------------- /src/main/kotlin/com/skillw/particlelib/utils/coordinate/PlayerBackCoordinate.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.particlelib.utils.coordinate 2 | 3 | import taboolib.common.util.Location 4 | import com.skillw.particlelib.utils.LocationUtils 5 | 6 | /** 7 | * 表示一个玩家后背坐标系 8 | * 9 | * 将玩家背后转换为一个直角坐标系 10 | * 11 | * @author Zoyn 12 | */ 13 | class PlayerBackCoordinate(playerLocation: Location) : Coordinate { 14 | private val originDot: Location 15 | private val rotateAngle: Double 16 | 17 | init { 18 | // 旋转的角度 19 | rotateAngle = playerLocation.yaw.toDouble() 20 | originDot = playerLocation.clone() 21 | // 重设仰俯角 22 | originDot.pitch = 0f 23 | // 使原点与玩家有一点点距离 24 | originDot.add(originDot.direction.multiply(-0.3)) 25 | } 26 | 27 | override fun newLocation(x: Double, y: Double, z: Double): Location? { 28 | return LocationUtils.rotateLocationAboutPoint(originDot.clone().add(-x, y, z), rotateAngle, originDot) 29 | } 30 | } -------------------------------------------------------------------------------- /src/main/kotlin/com/skillw/particlelib/utils/coordinate/PlayerFixedCoordinate.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.particlelib.utils.coordinate 2 | 3 | import taboolib.common.util.Location 4 | import com.skillw.particlelib.utils.LocationUtils 5 | 6 | /** 7 | * 表示一个将X轴显示在玩家面前的坐标器 8 | * 9 | * 自动修正在XZ平面上的粒子朝向 10 | * 11 | * @author Zoyn 12 | */ 13 | class PlayerFixedCoordinate(playerLocation: Location) : Coordinate { 14 | /** 原点 */ 15 | private val originDot: Location 16 | 17 | /** 旋转角度 */ 18 | private val rotateAngle: Double 19 | 20 | init { 21 | // 旋转的角度 22 | rotateAngle = playerLocation.yaw.toDouble() 23 | originDot = playerLocation.clone() 24 | // 重设仰俯角, 防止出现仰头后旋转角度不正确的问题 25 | originDot.pitch = 0f 26 | } 27 | 28 | fun getOriginDot(): Location { 29 | return originDot 30 | } 31 | 32 | override fun newLocation(x: Double, y: Double, z: Double): Location? { 33 | return LocationUtils.rotateLocationAboutPoint(originDot.clone().add(-x, y, z), rotateAngle, originDot) 34 | } 35 | } -------------------------------------------------------------------------------- /src/main/kotlin/com/skillw/particlelib/utils/coordinate/PlayerFrontCoordinate.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.particlelib.utils.coordinate 2 | 3 | import taboolib.common.util.Location 4 | import com.skillw.particlelib.utils.LocationUtils 5 | 6 | /** 7 | * 表示一个玩家面前的坐标系 8 | * 9 | * 将玩家面前作为一个新坐标系 暂时不会受到仰俯角的控制 10 | * 11 | * @author Zoyn 12 | */ 13 | class PlayerFrontCoordinate(playerLocation: Location) : Coordinate { 14 | /** 原点 */ 15 | private val originDot: Location 16 | 17 | /** 旋转角度 */ 18 | private val rotateAngle: Double 19 | 20 | init { 21 | // 旋转的角度 22 | rotateAngle = playerLocation.yaw + 90.0 23 | originDot = playerLocation.clone() 24 | // 重设仰俯角, 防止出现仰头后旋转角度不正确的问题 25 | originDot.pitch = 0f 26 | } 27 | 28 | fun getOriginDot(): Location { 29 | return originDot 30 | } 31 | 32 | override fun newLocation(x: Double, y: Double, z: Double): Location? { 33 | return LocationUtils.rotateLocationAboutPoint(originDot.clone().add(y, z, x), rotateAngle, originDot) 34 | } 35 | } -------------------------------------------------------------------------------- /src/main/kotlin/com/skillw/particlelib/utils/coordinate/package-info.kt: -------------------------------------------------------------------------------- 1 | /** 存放关于坐标器的工具 */ 2 | package com.skillw.particlelib.utils.coordinate -------------------------------------------------------------------------------- /src/main/kotlin/com/skillw/particlelib/utils/matrix/package-info.kt: -------------------------------------------------------------------------------- 1 | /** 存放矩阵的工具类 */ 2 | package com.skillw.particlelib.utils.matrix -------------------------------------------------------------------------------- /src/main/kotlin/com/skillw/particlelib/utils/package-info.kt: -------------------------------------------------------------------------------- 1 | /** 存放特效相关的工具类 */ 2 | package com.skillw.particlelib.utils -------------------------------------------------------------------------------- /src/main/kotlin/com/skillw/particlelib/utils/projector/ThreeDProjector.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.particlelib.utils.projector 2 | 3 | import taboolib.common.util.Location 4 | import taboolib.common.util.Vector 5 | 6 | /** 7 | * 表示一个三维至三维投影器 8 | * 9 | * 算法由 @Bryan33 提供 10 | * 11 | * @author Zoyn 12 | * @since 2020/9/19 13 | */ 14 | class ThreeDProjector(private val origin: Location, n: Vector) { 15 | private val n1: Vector 16 | private val n2: Vector 17 | private val n3: Vector 18 | 19 | /** 20 | * @param origin 投影的原点 21 | * @param n 投影屏幕的法向量 22 | */ 23 | init { 24 | val t = n.clone() 25 | t.y = t.y + 1 26 | n1 = n.clone().crossProduct(t).normalize() 27 | n2 = n1.clone().crossProduct(n).normalize() 28 | n3 = n.clone().normalize() 29 | } 30 | 31 | fun apply(x: Double, y: Double, z: Double): Location { 32 | val r = n1.clone().multiply(x).add(n2.clone().multiply(z)).add(n3.clone().multiply(y)) 33 | return origin.clone().add(r) 34 | } 35 | } -------------------------------------------------------------------------------- /src/main/kotlin/com/skillw/particlelib/utils/projector/package-info.kt: -------------------------------------------------------------------------------- 1 | /** 存放关于投影器的工具 */ 2 | package com.skillw.particlelib.utils.projector -------------------------------------------------------------------------------- /src/main/kotlin/com/skillw/pouvoir/api/PouvoirAPI.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.api 2 | 3 | import com.skillw.pouvoir.Pouvoir 4 | import org.bukkit.entity.LivingEntity 5 | 6 | @Suppress("UNCHECKED_CAST") 7 | object PouvoirAPI { 8 | 9 | /** 10 | * 解析占位符(PouPAPI & PAPI) 11 | * 12 | * @param entity LivingEntity 实体 13 | * @param analysis Boolean 是否解析Asahi 14 | * @return String 解析后的文本 15 | * @receiver String 待解析的文本 16 | */ 17 | @JvmStatic 18 | fun String.placeholder(entity: LivingEntity, analysis: Boolean = true): String { 19 | return Pouvoir.placeholderManager.replace(entity, this, analysis) 20 | } 21 | 22 | } -------------------------------------------------------------------------------- /src/main/kotlin/com/skillw/pouvoir/api/feature/anticheat/BypassCheat.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.api.feature.anticheat 2 | 3 | import com.skillw.pouvoir.Pouvoir.antiCheatManager 4 | import com.skillw.pouvoir.api.plugin.map.component.Registrable 5 | import org.bukkit.entity.Player 6 | 7 | /** 8 | * @className BypassCheat 9 | * 10 | * @author Glom 11 | * @date 2023/8/6 20:54 Copyright 2024 Glom. 12 | */ 13 | interface BypassCheat : Registrable { 14 | fun bypass(player: Player) 15 | fun recover(player: Player) {} 16 | 17 | override fun register() { 18 | antiCheatManager.register(this) 19 | } 20 | } -------------------------------------------------------------------------------- /src/main/kotlin/com/skillw/pouvoir/api/feature/condition/Condition.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.api.feature.condition 2 | 3 | import org.bukkit.entity.LivingEntity 4 | 5 | /** 6 | * @className Condition 7 | * 8 | * @author Glom 9 | * @date 2022/7/18 23:55 Copyright 2022 user. 10 | */ 11 | fun interface Condition { 12 | /** 13 | * 验证条件 14 | * 15 | * @param entity 实体 (可为null) 16 | * @param parameters 参数 17 | * @return 是否满足条件 18 | */ 19 | fun condition( 20 | entity: LivingEntity?, 21 | parameters: Map, 22 | ): Boolean 23 | 24 | } -------------------------------------------------------------------------------- /src/main/kotlin/com/skillw/pouvoir/api/feature/condition/ConditionReader.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.api.feature.condition 2 | 3 | /** 4 | * @className ConditionReader 5 | * 6 | * 从字符串中读取条件的参数 7 | * 8 | * @author Glom 9 | * @date 2023/8/1 23:55 Copyright 2022 user. 10 | */ 11 | fun interface ConditionReader { 12 | 13 | /** 14 | * 从字符串中读取条件的参数 15 | * 16 | * @param text String 文本 17 | * @return Map 参数 18 | */ 19 | fun parameters( 20 | text: String, 21 | ): Map? 22 | 23 | } -------------------------------------------------------------------------------- /src/main/kotlin/com/skillw/pouvoir/api/feature/database/BaseContainer.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.api.feature.database 2 | 3 | import com.skillw.pouvoir.api.plugin.map.component.Keyable 4 | 5 | /** 6 | * @className BaseContainer 7 | * 8 | * 数据库容器抽象基类,拥有独立生命周期 9 | * 10 | * 等同于SQL数据库中的一个Table 或者 Redis中的SingleRedisConnection 11 | * 12 | * @author Glom 13 | * @date 2023/1/12 18:35 Copyright 2024 Glom. 14 | */ 15 | abstract class BaseContainer( 16 | override val key: String, 17 | val holder: ContainerHolder<*>, 18 | ) : Keyable { 19 | open fun onEnable() {} 20 | open fun onActive() {} 21 | open fun onReload() {} 22 | open fun onDisable() {} 23 | } -------------------------------------------------------------------------------- /src/main/kotlin/com/skillw/pouvoir/api/feature/hologram/IHologram.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.api.feature.hologram 2 | 3 | import com.skillw.pouvoir.api.plugin.map.component.Keyable 4 | import org.bukkit.Location 5 | 6 | /** 全息接口 */ 7 | interface IHologram : Keyable { 8 | 9 | /** 10 | * 传送 11 | * 12 | * @param location 坐标 13 | */ 14 | fun teleport(location: Location) 15 | 16 | /** 17 | * 更新内容 18 | * 19 | * @param content 新内容 20 | */ 21 | fun update(content: List) 22 | 23 | /** 删除 */ 24 | fun delete() 25 | 26 | /** 销毁 */ 27 | fun destroy() 28 | } -------------------------------------------------------------------------------- /src/main/kotlin/com/skillw/pouvoir/api/feature/operation/NumberOperation.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.api.feature.operation 2 | 3 | import com.skillw.pouvoir.Pouvoir.operationManager 4 | 5 | /** 6 | * Base operation 7 | * 8 | * @constructor Create empty Base operation 9 | * @property key 运算操作键 10 | */ 11 | abstract class NumberOperation(override val key: String, vararg val alias: String) : Operation { 12 | abstract override fun operate(a: Number, b: Number): Number 13 | 14 | override var release: Boolean = false 15 | 16 | /** 17 | * 构成运算元素 (可以理解成 运算符 + 数) 18 | * 19 | * @param number 20 | * @return 运算元素 21 | */ 22 | fun element(number: Number): OperationElement = OperationElement(this, number) 23 | 24 | override fun register() { 25 | arrayOf(key, *alias).forEach { 26 | operationManager.register(it, this) 27 | } 28 | } 29 | 30 | } -------------------------------------------------------------------------------- /src/main/kotlin/com/skillw/pouvoir/api/feature/operation/Operation.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.api.feature.operation 2 | 3 | import com.skillw.pouvoir.Pouvoir 4 | import com.skillw.pouvoir.api.plugin.map.component.Registrable 5 | 6 | /** 7 | * @className NumberOperation 8 | * 9 | * @author Glom 10 | * @date 2022/7/19 12:38 Copyright 2022 user. 11 | */ 12 | interface Operation : Registrable { 13 | /** 是否在重载时删除 */ 14 | var release: Boolean 15 | 16 | /** 17 | * 做运算 18 | * 19 | * @param a 对象a 20 | * @param b 对象b 21 | * @return 运算结果 22 | */ 23 | fun operate(a: T, b: T): T 24 | override fun register() { 25 | Pouvoir.operationManager.register(this) 26 | } 27 | } -------------------------------------------------------------------------------- /src/main/kotlin/com/skillw/pouvoir/api/feature/operation/OperationElement.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.api.feature.operation 2 | 3 | /** 4 | * @className OperationElement 5 | * 6 | * @author Glom 7 | * @date 2022/7/19 12:37 Copyright 2022 user. 8 | */ 9 | data class OperationElement(val numberOperation: NumberOperation, val number: Number) { 10 | /** 11 | * 做运算 12 | * 13 | * @param other 其他数字 14 | * @return 运算结果 15 | */ 16 | fun operate(other: Number): Number { 17 | return numberOperation.operate(other, number) 18 | } 19 | 20 | override fun toString(): String { 21 | return "Operation { ${numberOperation.key} $number }" 22 | } 23 | } -------------------------------------------------------------------------------- /src/main/kotlin/com/skillw/pouvoir/api/feature/operation/StringOperation.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.api.feature.operation 2 | 3 | /** 4 | * @className StringOperation 5 | * 6 | * @author Glom 7 | * @date 2022/8/9 11:01 Copyright 2022 user. 8 | */ 9 | abstract class StringOperation(override val key: String) : Operation { 10 | override var release: Boolean = false 11 | } -------------------------------------------------------------------------------- /src/main/kotlin/com/skillw/pouvoir/api/feature/realizer/BaseRealizer.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.api.feature.realizer 2 | 3 | import com.skillw.pouvoir.api.plugin.map.component.Registrable 4 | import java.io.File 5 | 6 | /** 7 | * @className BaseRealizer 8 | * 9 | * @author Glom 10 | * @date 2023/1/5 10:46 Copyright 2022 user. 11 | */ 12 | abstract class BaseRealizer(final override val key: String) : Registrable { 13 | 14 | //配置文件 15 | abstract val file: File 16 | abstract val manager: BaseRealizerManager 17 | 18 | // 配置 19 | val config = HashMap() 20 | 21 | // 每次重载时会补充缺失节点与注释,会忽略此集合中的节点 22 | val ignorePaths = HashSet() 23 | 24 | override fun register() { 25 | manager.register(this) 26 | } 27 | 28 | override fun toString(): String { 29 | return "BaseRealizer $key in ${manager.key}" 30 | } 31 | } -------------------------------------------------------------------------------- /src/main/kotlin/com/skillw/pouvoir/api/feature/realizer/component/Awakeable.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.api.feature.realizer.component 2 | 3 | 4 | /** 5 | * @className Realizable 6 | * 7 | * @author Glom 8 | * @date 2023/1/5 16:25 Copyright 2022 user. 9 | */ 10 | interface Awakeable { 11 | fun onLoad() {} 12 | fun onEnable() {} 13 | fun onActive() {} 14 | fun onReload() {} 15 | 16 | fun onDisable() {} 17 | } -------------------------------------------------------------------------------- /src/main/kotlin/com/skillw/pouvoir/api/feature/realizer/component/Realizable.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.api.feature.realizer.component 2 | 3 | 4 | import com.skillw.pouvoir.api.plugin.`object`.BaseObject 5 | import org.bukkit.entity.LivingEntity 6 | 7 | /** 8 | * @className Realizable 9 | * 10 | * @author Glom 11 | * @date 2023/1/5 16:25 Copyright 2022 user. 12 | */ 13 | interface Realizable { 14 | val priority: Int 15 | fun compareTo(other: BaseObject): Int = if (this.priority == other.priority) 0 16 | else if (this.priority > other.priority) 1 17 | else -1 18 | 19 | fun realize(entity: LivingEntity) 20 | fun unrealize(entity: LivingEntity) 21 | } -------------------------------------------------------------------------------- /src/main/kotlin/com/skillw/pouvoir/api/feature/realizer/component/Switchable.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.api.feature.realizer.component 2 | 3 | import com.skillw.pouvoir.api.feature.realizer.BaseRealizer 4 | 5 | import taboolib.common5.cbool 6 | 7 | /** 8 | * @className Realizable 9 | * 10 | * @author Glom 11 | * @date 2023/1/5 16:25 Copyright 2022 user. 12 | */ 13 | interface Switchable { 14 | 15 | val defaultEnable: Boolean 16 | 17 | fun isEnable(): Boolean = (this as? BaseRealizer)?.config?.get("enable")?.cbool ?: defaultEnable 18 | fun isDisable(): Boolean = !isEnable() 19 | 20 | fun whenEnable() {} 21 | fun whenDisable() {} 22 | 23 | } -------------------------------------------------------------------------------- /src/main/kotlin/com/skillw/pouvoir/api/feature/realizer/component/Sync.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.api.feature.realizer.component 2 | 3 | import org.bukkit.entity.LivingEntity 4 | 5 | /** 6 | * @className Sync 7 | * 8 | * @author Glom 9 | * @date 2023/8/4 21:32 Copyright 2024 Glom. 10 | */ 11 | interface Sync { 12 | fun newTask(entity: LivingEntity): (() -> Unit)? 13 | } -------------------------------------------------------------------------------- /src/main/kotlin/com/skillw/pouvoir/api/feature/realizer/component/Valuable.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.api.feature.realizer.component 2 | 3 | import com.skillw.pouvoir.api.feature.realizer.BaseRealizer 4 | 5 | import com.skillw.pouvoir.util.calculateDouble 6 | import org.bukkit.entity.LivingEntity 7 | 8 | /** 9 | * @className Realizable 10 | * 11 | * @author Glom 12 | * @date 2023/1/5 16:25 Copyright 2022 user. 13 | */ 14 | interface Valuable { 15 | val defaultValue: String 16 | 17 | fun value(entity: LivingEntity? = null): Double { 18 | return (this as? BaseRealizer)?.config?.getOrDefault("value", defaultValue).toString().calculateDouble(entity) 19 | } 20 | 21 | 22 | } -------------------------------------------------------------------------------- /src/main/kotlin/com/skillw/pouvoir/api/feature/realizer/component/Vanillable.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.api.feature.realizer.component 2 | 3 | import com.skillw.pouvoir.api.feature.realizer.BaseRealizer 4 | 5 | import taboolib.common5.cbool 6 | 7 | /** 8 | * @className Vanillable 9 | * 10 | * @author Glom 11 | * @date 2023/1/5 16:51 Copyright 2022 user. 12 | */ 13 | interface Vanillable { 14 | 15 | val defaultVanilla: Boolean 16 | fun isEnableVanilla(): Boolean = (this as? BaseRealizer)?.config?.get("vanilla")?.cbool ?: defaultVanilla 17 | 18 | } -------------------------------------------------------------------------------- /src/main/kotlin/com/skillw/pouvoir/api/feature/selector/Target.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.api.feature.selector 2 | 3 | import org.bukkit.Location 4 | 5 | /** 6 | * @className Target 7 | * 8 | * 目标抽象类 9 | * 10 | * @author Glom 11 | * @date 2023/1/9 7:32 Copyright 2024 Glom. 12 | */ 13 | abstract class Target(open val unique: String, val location: Location) { 14 | /** 是否有效 */ 15 | open val isPresent: Boolean 16 | get() = true 17 | 18 | override fun equals(other: Any?): Boolean { 19 | if (this === other) return true 20 | if (other !is Target) return false 21 | 22 | if (unique != other.unique) return false 23 | if (location != other.location) return false 24 | 25 | return true 26 | } 27 | 28 | override fun hashCode(): Int { 29 | var result = unique.hashCode() 30 | result = 31 * result + location.hashCode() 31 | return result 32 | } 33 | } -------------------------------------------------------------------------------- /src/main/kotlin/com/skillw/pouvoir/api/feature/selector/target/EntityTarget.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.api.feature.selector.target 2 | 3 | import org.bukkit.entity.Entity 4 | 5 | /** 6 | * @className EntityTarget 7 | * 8 | * @author Glom 9 | * @date 2023/1/9 7:36 Copyright 2024 Glom. 10 | */ 11 | @Suppress("UNCHECKED_CAST") 12 | class EntityTarget(val entity: Entity) : LocTarget(entity.targetLoc()) { 13 | override val unique: String = entity.uniqueId.toString() 14 | override val isPresent: Boolean 15 | get() = !entity.isDead && entity.isValid 16 | 17 | /** 18 | * 强制转换 19 | * 20 | * @param T 类型 21 | * @return 转换后的Target 22 | */ 23 | fun cast(): T = entity as T 24 | 25 | /** 26 | * 安全转换 27 | * 28 | * @param T 类型 29 | * @return 转换后的Target 30 | */ 31 | fun castSafely(): T? = entity as? T 32 | 33 | override fun toString(): String { 34 | return "EntityTarget( entity=$entity loc=$location)" 35 | } 36 | } -------------------------------------------------------------------------------- /src/main/kotlin/com/skillw/pouvoir/api/feature/trigger/BukkitTrigger.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.api.feature.trigger 2 | 3 | /** 4 | * Pou trigger 5 | * 6 | * 主要是将Bukkit事件名字格式化 7 | * 8 | * 如果Bukkit事件类上没有此注解或没有指定name 9 | * 10 | * 则其事件名称将会像这样格式化为触发器id: 11 | * 12 | * "PlayerMoveEvent" -> "player move" 13 | * 14 | * @constructor Create empty Pou trigger 15 | * @property name 16 | */ 17 | annotation class BukkitTrigger(val name: String = "") 18 | -------------------------------------------------------------------------------- /src/main/kotlin/com/skillw/pouvoir/api/manager/Manager.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.api.manager 2 | 3 | import com.skillw.pouvoir.api.plugin.SubPouvoir 4 | import com.skillw.pouvoir.api.plugin.map.component.Registrable 5 | 6 | interface Manager : Registrable, Comparable { 7 | val priority: Int 8 | val subPouvoir: SubPouvoir 9 | 10 | fun onLoad() { 11 | } 12 | 13 | fun onEnable() {} 14 | fun onActive() {} 15 | 16 | fun onReload() {} 17 | fun onDisable() {} 18 | 19 | override fun register() {} 20 | 21 | override fun compareTo(other: Manager): Int { 22 | return if (priority == other.priority) 0 23 | else if (priority > other.priority) 1 24 | else -1 25 | } 26 | 27 | } -------------------------------------------------------------------------------- /src/main/kotlin/com/skillw/pouvoir/api/manager/sub/AntiCheatManager.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.api.manager.sub 2 | 3 | import com.skillw.pouvoir.api.feature.anticheat.BypassCheat 4 | import com.skillw.pouvoir.api.manager.Manager 5 | import com.skillw.pouvoir.api.plugin.map.KeyMap 6 | import org.bukkit.entity.Player 7 | 8 | /** 9 | * 反作弊管理器 10 | * 11 | * @constructor Create empty Listener manager 12 | */ 13 | abstract class AntiCheatManager : KeyMap(), Manager { 14 | abstract fun bypass(player: Player) 15 | abstract fun recover(player: Player) 16 | } -------------------------------------------------------------------------------- /src/main/kotlin/com/skillw/pouvoir/api/manager/sub/DatabaseManager.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.api.manager.sub 2 | 3 | import com.skillw.pouvoir.api.feature.database.ContainerHolder 4 | import com.skillw.pouvoir.api.feature.database.DatabaseType 5 | import com.skillw.pouvoir.api.manager.Manager 6 | import com.skillw.pouvoir.api.plugin.map.DataMap 7 | import com.skillw.pouvoir.api.plugin.map.LowerKeyMap 8 | 9 | /** 10 | * @className DatabaseManager 11 | * 12 | * 数据库管理器 主要负责维护数据库类型 13 | * 14 | * @author Glom 15 | * @date 2023/1/12 18:57 Copyright 2024 Glom. 16 | */ 17 | abstract class DatabaseManager : Manager, LowerKeyMap>() { 18 | /** 19 | * 创建容器持有者 20 | * 21 | * @param data 参数 22 | * @return 容器持有者 23 | */ 24 | abstract fun containerHolder(data: DataMap): ContainerHolder<*>? 25 | } -------------------------------------------------------------------------------- /src/main/kotlin/com/skillw/pouvoir/api/manager/sub/HologramManager.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.api.manager.sub 2 | 3 | import com.skillw.pouvoir.api.feature.hologram.IHologram 4 | import com.skillw.pouvoir.api.manager.Manager 5 | import org.bukkit.Location 6 | import org.bukkit.entity.Player 7 | 8 | /** 9 | * HologramManager 10 | * 11 | * @constructor Create empty Listener manager 12 | */ 13 | abstract class HologramManager : Manager { 14 | /** 15 | * Create hologram 16 | * 17 | * @param location 18 | * @param content 19 | * @return 20 | */ 21 | abstract fun createHologram(location: Location, content: List, players: Set): IHologram 22 | } -------------------------------------------------------------------------------- /src/main/kotlin/com/skillw/pouvoir/api/manager/sub/ListenerManager.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.api.manager.sub 2 | 3 | import com.skillw.pouvoir.api.manager.Manager 4 | import com.skillw.pouvoir.api.plugin.map.LowerMap 5 | import taboolib.common.platform.event.ProxyListener 6 | 7 | /** 8 | * Listener manager Bukkit监听器管理器 9 | * 10 | * 维护热注册注销的监听器 11 | * 12 | * @constructor Create empty Listener manager 13 | */ 14 | abstract class ListenerManager : LowerMap(), Manager -------------------------------------------------------------------------------- /src/main/kotlin/com/skillw/pouvoir/api/manager/sub/OperationManager.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.api.manager.sub 2 | 3 | import com.skillw.pouvoir.api.feature.operation.Operation 4 | import com.skillw.pouvoir.api.manager.Manager 5 | import com.skillw.pouvoir.api.plugin.map.LowerKeyMap 6 | 7 | /** 8 | * NumberOperation manager 9 | * 10 | * @constructor Create empty NumberOperation manager 11 | */ 12 | abstract class OperationManager : LowerKeyMap>(), Manager 13 | -------------------------------------------------------------------------------- /src/main/kotlin/com/skillw/pouvoir/api/manager/sub/SelectorManager.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.api.manager.sub 2 | 3 | import com.skillw.pouvoir.api.feature.selector.BaseSelector 4 | import com.skillw.pouvoir.api.manager.Manager 5 | import com.skillw.pouvoir.api.plugin.map.LowerKeyMap 6 | 7 | /** BaseSelector */ 8 | abstract class SelectorManager : LowerKeyMap(), Manager -------------------------------------------------------------------------------- /src/main/kotlin/com/skillw/pouvoir/api/manager/sub/TriggerHandlerManager.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.api.manager.sub 2 | 3 | import com.skillw.pouvoir.api.feature.handler.BaseHandler 4 | import com.skillw.pouvoir.api.manager.Manager 5 | import com.skillw.pouvoir.api.plugin.SubPouvoir 6 | import com.skillw.pouvoir.api.plugin.map.KeyMap 7 | import java.io.File 8 | 9 | /** TriggerManager 监听器处理器管理器,主要负责维护监听器处理器 */ 10 | abstract class TriggerHandlerManager : Manager, KeyMap>() { 11 | /** 12 | * 注销监听器处理器 13 | * 14 | * @param key 监听器处理器id 15 | */ 16 | abstract fun unregister(key: String) 17 | abstract fun addDataFolders(folder: File) 18 | abstract fun addSubPouvoir(subPouvoir: SubPouvoir) 19 | abstract fun reloadFolder(folder: File) 20 | } -------------------------------------------------------------------------------- /src/main/kotlin/com/skillw/pouvoir/api/manager/sub/script/ScriptAnnotationManager.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.api.manager.sub.script 2 | 3 | import com.skillw.pouvoir.api.manager.Manager 4 | import com.skillw.pouvoir.api.plugin.map.KeyMap 5 | import com.skillw.pouvoir.api.script.annotation.ScriptAnnotation 6 | 7 | /** 脚本注解管理器 主要负责维护脚本注解 */ 8 | abstract class ScriptAnnotationManager : Manager, KeyMap() -------------------------------------------------------------------------------- /src/main/kotlin/com/skillw/pouvoir/api/plugin/Util.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.api.plugin 2 | 3 | /** 4 | * @className Util 5 | * 6 | * @author Glom 7 | * @date 2023/1/22 22:50 Copyright 2024 Glom. 8 | */ 9 | -------------------------------------------------------------------------------- /src/main/kotlin/com/skillw/pouvoir/api/plugin/annotation/AutoRegister.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.api.plugin.annotation 2 | 3 | /** 4 | * Auto register 5 | * 6 | * 自动注册至对应的RegContainer 7 | * 8 | * @constructor test 检测类名,如果存在则自动注册 9 | */ 10 | @Target(AnnotationTarget.CLASS, AnnotationTarget.FIELD) 11 | @Retention(AnnotationRetention.RUNTIME) 12 | annotation class AutoRegister(val test: String = "", val postLoad: Boolean = false) 13 | -------------------------------------------------------------------------------- /src/main/kotlin/com/skillw/pouvoir/api/plugin/annotation/PouManager.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.api.plugin.annotation 2 | 3 | /** 4 | * Pou manager 5 | * 6 | * @constructor 7 | */ 8 | @Target(AnnotationTarget.FIELD) 9 | @Retention(AnnotationRetention.RUNTIME) 10 | annotation class PouManager(val path: String = "") 11 | -------------------------------------------------------------------------------- /src/main/kotlin/com/skillw/pouvoir/api/plugin/handler/ClassHandler.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.api.plugin.handler 2 | 3 | import taboolib.library.reflex.ClassStructure 4 | 5 | /** 6 | * @className ClassHandler 7 | * 8 | * @author Glom 9 | * @date 2022/7/18 12:20 Copyright 2022 user. 10 | */ 11 | abstract class ClassHandler(val priority: Int) : Comparable { 12 | /** 13 | * Inject 14 | * 15 | * @param clazz 16 | * @param plugin 17 | */ 18 | abstract fun inject(clazz: ClassStructure) 19 | 20 | override fun compareTo(other: ClassHandler): Int = if (this.priority == other.priority) 0 21 | else if (this.priority > other.priority) 1 22 | else -1 23 | } -------------------------------------------------------------------------------- /src/main/kotlin/com/skillw/pouvoir/api/plugin/map/LinkedKeyMap.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.api.plugin.map 2 | 3 | import com.skillw.pouvoir.api.plugin.map.component.Keyable 4 | 5 | /** 6 | * Linked key map 7 | * 8 | * @param K 9 | * @param V 10 | * @constructor Create empty Linked key map 11 | */ 12 | open class LinkedKeyMap> : LinkedMap() { 13 | private fun getKey(value: V): K { 14 | return value.key 15 | } 16 | 17 | /** 18 | * Register 19 | * 20 | * @param value 21 | */ 22 | open fun register(value: V) { 23 | register(value.key, value) 24 | } 25 | 26 | /** 27 | * Remove by value 28 | * 29 | * @param value 30 | */ 31 | fun removeByValue(value: V) { 32 | val key = getKey(value) 33 | key.also { remove(it) } 34 | } 35 | } -------------------------------------------------------------------------------- /src/main/kotlin/com/skillw/pouvoir/api/plugin/map/LinkedMap.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.api.plugin.map 2 | 3 | import java.util.concurrent.CopyOnWriteArrayList 4 | 5 | /** 6 | * Linked map 7 | * 8 | * @param K 9 | * @param V 10 | * @constructor Create empty Linked map 11 | */ 12 | open class LinkedMap : BaseMap() { 13 | /** List */ 14 | protected val list = CopyOnWriteArrayList() 15 | 16 | override fun put(key: K, value: V): V? { 17 | list.add(key) 18 | return super.put(key, value) 19 | } 20 | } -------------------------------------------------------------------------------- /src/main/kotlin/com/skillw/pouvoir/api/plugin/map/MultiExecMap.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.api.plugin.map 2 | 3 | /** 4 | * Multi exec map 5 | * 6 | * @constructor Create empty Multi exec map 7 | */ 8 | open class MultiExecMap : LowerMap() { 9 | /** 10 | * Run 11 | * 12 | * @param thing 13 | */ 14 | fun run(key: String) { 15 | filter { it.key == key.lowercase() }.forEach { it.value.invoke() } 16 | } 17 | } -------------------------------------------------------------------------------- /src/main/kotlin/com/skillw/pouvoir/api/plugin/map/MultiMap.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.api.plugin.map 2 | 3 | /** 4 | * Multi exec map 5 | * 6 | * @constructor Create empty Multi exec map 7 | */ 8 | open class MultiMap : BaseMap>() { 9 | fun add(key: K, value: V): Boolean = (computeIfAbsent(key) { ArrayList() } as MutableList).add(value) 10 | fun remove(key: K, value: V): Boolean = (get(key) as MutableList?)?.remove(value) ?: false 11 | operator fun plusAssign(map: MultiMap) { 12 | addAll(map) 13 | } 14 | 15 | operator fun plusAssign(pair: Pair) { 16 | add(pair.first, pair.second) 17 | } 18 | 19 | fun addAll(map: MultiMap) { 20 | map.keys.forEach { key -> 21 | map[key]?.forEach { value -> 22 | add(key, value) 23 | } 24 | } 25 | } 26 | } -------------------------------------------------------------------------------- /src/main/kotlin/com/skillw/pouvoir/api/plugin/map/SingleExecMap.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.api.plugin.map 2 | 3 | /** 4 | * Single exec map 5 | * 6 | * @constructor Create empty Single exec map 7 | */ 8 | open class SingleExecMap : LowerMap<() -> Unit>() { 9 | /** Invoke */ 10 | fun invoke() { 11 | values.forEach { function -> function.invoke() } 12 | } 13 | 14 | /** 15 | * Run 16 | * 17 | * @param thing 18 | */ 19 | open fun run(thing: String) { 20 | this[thing]?.run { invoke() } 21 | } 22 | } -------------------------------------------------------------------------------- /src/main/kotlin/com/skillw/pouvoir/api/plugin/map/component/Keyable.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.api.plugin.map.component 2 | 3 | /** 4 | * ClassName : com.skillw.classsystem.api.component.Keyable Created by 5 | * Glom_ on 2021-03-27 20:54:22 Copyright 2021 user. 6 | * 7 | * 有对应键的类 8 | */ 9 | interface Keyable { 10 | /** Key */ 11 | val key: K 12 | } -------------------------------------------------------------------------------- /src/main/kotlin/com/skillw/pouvoir/api/plugin/map/component/Registrable.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.api.plugin.map.component 2 | 3 | /** 4 | * @className Registrable 5 | * 6 | * @author Glom 7 | * @date 2022/7/18 7:56 Copyright 2022 user. 8 | * 9 | * 可注册的类 10 | */ 11 | interface Registrable : Keyable { 12 | fun register() 13 | } -------------------------------------------------------------------------------- /src/main/kotlin/com/skillw/pouvoir/api/plugin/object/BaseObject.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.api.plugin.`object` 2 | 3 | import com.skillw.pouvoir.api.plugin.map.component.Registrable 4 | import org.bukkit.configuration.serialization.ConfigurationSerializable 5 | 6 | /** 7 | * Base object 8 | * 9 | * @constructor Create empty Base object 10 | */ 11 | interface BaseObject : Registrable, 12 | Comparable, 13 | ConfigurationSerializable { 14 | override val key: String 15 | 16 | /** Priority */ 17 | val priority: Int 18 | override fun compareTo(other: BaseObject): Int = if (this.priority == other.priority) 0 19 | else if (this.priority > other.priority) 1 20 | else -1 21 | } -------------------------------------------------------------------------------- /src/main/kotlin/com/skillw/pouvoir/api/plugin/object/Releasable.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.api.plugin.`object` 2 | 3 | /** 4 | * @className Releasable 5 | * 6 | * @author Glom 7 | * @date 2023/1/22 22:56 Copyright 2024 Glom. 8 | */ 9 | interface Releasable { 10 | /** 是否在重载时注销 */ 11 | var release: Boolean 12 | 13 | fun unregister() 14 | } -------------------------------------------------------------------------------- /src/main/kotlin/com/skillw/pouvoir/api/plugin/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * 这个包内是Pouvoir附属共用的容器及注解, 3 | *

4 | * 一般情况下,其他开发者用不上 所以就先不写注释了 5 | */ 6 | package com.skillw.pouvoir.api.plugin; -------------------------------------------------------------------------------- /src/main/kotlin/com/skillw/pouvoir/api/script/annotation/ScriptAnnotation.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.api.script.annotation 2 | 3 | import com.skillw.pouvoir.Pouvoir 4 | import com.skillw.pouvoir.api.plugin.map.component.Registrable 5 | 6 | /** 7 | * Script annotation 8 | * 9 | * @constructor Create empty Script annotation 10 | * @property key 11 | * @property awakeWhenEnable 12 | */ 13 | abstract class ScriptAnnotation( 14 | override val key: String, 15 | val awakeWhenEnable: Boolean = false, 16 | val fileAnnotation: Boolean = false, 17 | ) : Registrable { 18 | override fun register() { 19 | Pouvoir.scriptAnnotationManager.register(this) 20 | } 21 | 22 | /** 23 | * Handle script annotation 24 | * 25 | * @param data 26 | */ 27 | abstract fun handle(data: ScriptAnnotationData) 28 | } -------------------------------------------------------------------------------- /src/main/kotlin/com/skillw/pouvoir/api/script/annotation/ScriptAnnotationData.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.api.script.annotation 2 | 3 | import com.skillw.pouvoir.api.script.PouFileCompiledScript 4 | 5 | 6 | /** 7 | * Script annotation data 8 | * 9 | * @constructor Create empty Script annotation data 10 | * @property annotation 脚本注解对象 11 | * @property script 预编译脚本对象 12 | * @property function 函数名 13 | * @property args 参数 14 | */ 15 | data class ScriptAnnotationData( 16 | val annotation: String, 17 | val script: PouFileCompiledScript, 18 | val function: String, 19 | val args: String, 20 | ) 21 | -------------------------------------------------------------------------------- /src/main/kotlin/com/skillw/pouvoir/api/script/engine/hook/PouCompiler.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.api.script.engine.hook 2 | 3 | import com.skillw.pouvoir.api.plugin.map.component.Registrable 4 | import com.skillw.pouvoir.api.script.PouFileCompiledScript 5 | import java.io.File 6 | import javax.script.CompiledScript 7 | 8 | /** 9 | * @className PouCompiler 10 | * 11 | * @author Glom 12 | * @date 2023/1/20 9:33 Copyright 2024 Glom. 13 | */ 14 | interface PouCompiler : Registrable { 15 | fun compile(file: File): PouFileCompiledScript? 16 | fun compile(script: String, vararg params: String): CompiledScript 17 | fun canCompile(script: String): Boolean 18 | } -------------------------------------------------------------------------------- /src/main/kotlin/com/skillw/pouvoir/api/script/engine/hook/ScriptBridge.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.api.script.engine.hook 2 | 3 | import javax.script.CompiledScript 4 | import javax.script.ScriptEngine 5 | 6 | interface ScriptBridge { 7 | fun getEngine(vararg args: String): ScriptEngine 8 | 9 | fun invoke( 10 | script: CompiledScript, 11 | function: String = "main", 12 | arguments: Map, 13 | vararg parameters: Any?, 14 | ): Any? 15 | 16 | } -------------------------------------------------------------------------------- /src/main/kotlin/com/skillw/pouvoir/internal/command/sub/PouMirrorCommand.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.internal.command.sub 2 | 3 | import com.skillw.pouvoir.internal.command.PouvoirCommand.soundSuccess 4 | import com.skillw.pouvoir.util.legacy.Mirror 5 | import taboolib.common.platform.ProxyCommandSender 6 | import taboolib.common.platform.command.subCommand 7 | import taboolib.module.lang.sendLang 8 | 9 | internal object PouMirrorCommand { 10 | val report = subCommand { 11 | execute { sender, _, _ -> 12 | sender.soundSuccess() 13 | Mirror.report(sender) 14 | } 15 | } 16 | 17 | val clear = subCommand { 18 | execute { sender, _, _ -> 19 | sender.soundSuccess() 20 | Mirror.mirrorData.clear() 21 | sender.sendLang("command-clear") 22 | } 23 | } 24 | } -------------------------------------------------------------------------------- /src/main/kotlin/com/skillw/pouvoir/internal/core/asahi/AsahiInject.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.internal.core.asahi 2 | 3 | import com.skillw.asahi.internal.AsahiLoader 4 | import com.skillw.pouvoir.api.plugin.handler.ClassHandler 5 | import taboolib.library.reflex.ClassStructure 6 | 7 | object AsahiInject : ClassHandler(0) { 8 | override fun inject(clazz: ClassStructure) { 9 | AsahiLoader.inject(clazz) 10 | } 11 | } -------------------------------------------------------------------------------- /src/main/kotlin/com/skillw/pouvoir/internal/core/asahi/infix/bukkit/InfixCancellable.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.internal.core.asahi.infix.bukkit 2 | 3 | import com.skillw.asahi.api.annotation.AsahiInfix 4 | import com.skillw.asahi.api.member.parser.infix.namespacing.BaseInfix 5 | import org.bukkit.event.Cancellable 6 | 7 | /** 8 | * @className ActionCancellable 9 | * 10 | * @author Glom 11 | * @date 2022/8/9 16:26 Copyright 2022 user. 12 | */ 13 | @AsahiInfix 14 | object InfixCancellable : BaseInfix(Cancellable::class.java, "bukkit") { 15 | init { 16 | "isCancelled" to { 17 | if (expect("to")) { 18 | it.isCancelled = parse() 19 | } 20 | it.isCancelled 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /src/main/kotlin/com/skillw/pouvoir/internal/core/asahi/infix/database/InfixContainerHolder.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.internal.core.asahi.infix.database 2 | 3 | import com.skillw.asahi.api.annotation.AsahiInfix 4 | import com.skillw.asahi.api.member.parser.infix.namespacing.BaseInfix 5 | import com.skillw.pouvoir.api.feature.database.ContainerHolder 6 | 7 | /** 8 | * @className ActionCancellable 9 | * 10 | * @author Glom 11 | * @date 2022/8/9 16:26 Copyright 2022 user. 12 | */ 13 | @AsahiInfix 14 | object InfixContainerHolder : BaseInfix>(ContainerHolder::class.java) { 15 | init { 16 | "container" to { 17 | val key = parseString() 18 | val user = !expect("normal") 19 | it.container(key, user) 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/main/kotlin/com/skillw/pouvoir/internal/core/asahi/prefix/bukkit/Item.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.internal.core.asahi.prefix.bukkit 2 | 3 | import com.skillw.asahi.api.annotation.AsahiPrefix 4 | import com.skillw.asahi.api.prefixParser 5 | import com.skillw.asahi.api.quest 6 | import org.bukkit.Material 7 | import taboolib.library.xseries.XMaterial 8 | 9 | /** 10 | * @className Item 11 | * 12 | * @author Glom 13 | * @date 2023/1/14 0:33 Copyright 2024 Glom. 14 | */ 15 | 16 | @AsahiPrefix 17 | private fun material() = prefixParser { 18 | val token = quest() 19 | result { 20 | val id = token.get() 21 | XMaterial.matchXMaterial(id) 22 | .run { if (this.isPresent) get().parseMaterial() else Material.matchMaterial(id) } 23 | ?: error("Material not found: $token") 24 | } 25 | } -------------------------------------------------------------------------------- /src/main/kotlin/com/skillw/pouvoir/internal/core/asahi/util/PlayerAsOp.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.internal.core.asahi.util 2 | 3 | import org.bukkit.entity.Player 4 | import taboolib.common.platform.ProxyCommandSender 5 | import taboolib.common.platform.function.adaptCommandSender 6 | 7 | /** 8 | * @className PlayerAsOp 9 | * 10 | * @author Glom 11 | * @date 2023/1/23 17:58 Copyright 2024 Glom. 12 | */ 13 | class PlayerAsOp(val player: Player) : ProxyCommandSender by adaptCommandSender(player) { 14 | override var isOp: Boolean 15 | get() = true 16 | set(value) {} 17 | } -------------------------------------------------------------------------------- /src/main/kotlin/com/skillw/pouvoir/internal/core/asahi/util/Task.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.internal.core.asahi.util 2 | 3 | import com.skillw.asahi.api.member.context.AsahiContext 4 | import taboolib.common.platform.function.isPrimaryThread 5 | import taboolib.common.platform.function.submit 6 | import java.util.concurrent.CompletableFuture 7 | 8 | /** 9 | * @className Task 10 | * 11 | * @author Glom 12 | * @date 2023/1/23 18:45 Copyright 2024 Glom. 13 | */ 14 | fun AsahiContext.delay(tick: Long) { 15 | val future = CompletableFuture() 16 | val task = submit(delay = tick, async = !isPrimaryThread) { 17 | future.complete(null) 18 | } 19 | onExit { task.cancel() } 20 | future.join() 21 | } -------------------------------------------------------------------------------- /src/main/kotlin/com/skillw/pouvoir/internal/core/plugin/SubPouvoirHandler.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.internal.core.plugin 2 | 3 | import com.skillw.pouvoir.api.plugin.SubPouvoir 4 | import com.skillw.pouvoir.api.plugin.TotalManager 5 | import org.bukkit.plugin.Plugin 6 | import taboolib.library.reflex.ClassStructure 7 | 8 | object SubPouvoirHandler { 9 | fun inject(clazz: ClassStructure, plugin: Plugin) { 10 | val owner = clazz.owner 11 | if (SubPouvoir::class.java.isAssignableFrom(owner.instance) && clazz.simpleName != "SubPouvoir") 12 | TotalManager.pluginData[plugin] = PouManagerUtils.initPouManagers(owner.instance!!) ?: return 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/main/kotlin/com/skillw/pouvoir/internal/core/script/asahi/AsahiBridge.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.internal.core.script.asahi 2 | 3 | import com.skillw.asahi.api.script.AsahiEngine 4 | import com.skillw.pouvoir.api.script.engine.hook.ScriptBridge 5 | import javax.script.CompiledScript 6 | import javax.script.Invocable 7 | import javax.script.ScriptEngine 8 | 9 | object AsahiBridge : ScriptBridge { 10 | override fun getEngine(vararg args: String): ScriptEngine = PouAsahiScriptEngine.engine 11 | override fun invoke( 12 | script: CompiledScript, 13 | function: String, 14 | arguments: Map, 15 | vararg parameters: Any?, 16 | ): Any? { 17 | (script.engine as AsahiEngine).context().putAll(arguments) 18 | return (script.engine as Invocable).invokeFunction( 19 | function, 20 | *parameters 21 | ) 22 | } 23 | } -------------------------------------------------------------------------------- /src/main/kotlin/com/skillw/pouvoir/internal/core/script/groovy/GroovyBridge.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.internal.core.script.groovy 2 | 3 | import com.skillw.pouvoir.api.script.engine.hook.ScriptBridge 4 | import javax.script.CompiledScript 5 | import javax.script.Invocable 6 | import javax.script.ScriptContext 7 | import javax.script.ScriptEngine 8 | 9 | object GroovyBridge : ScriptBridge { 10 | override fun getEngine(vararg args: String): ScriptEngine = PouGroovyScriptEngine.engine 11 | override fun invoke( 12 | script: CompiledScript, 13 | function: String, 14 | arguments: Map, 15 | vararg parameters: Any?, 16 | ): Any? { 17 | script.eval() 18 | script.engine.context.getBindings(ScriptContext.ENGINE_SCOPE).putAll(arguments) 19 | return (script.engine as Invocable).invokeFunction( 20 | function, 21 | *parameters 22 | ) 23 | } 24 | } -------------------------------------------------------------------------------- /src/main/kotlin/com/skillw/pouvoir/internal/feature/compat/placeholder/PlaceholderAPIHooker.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.internal.feature.compat.placeholder 2 | 3 | import com.skillw.pouvoir.Pouvoir 4 | import org.bukkit.entity.Player 5 | import taboolib.platform.compat.PlaceholderExpansion 6 | 7 | object PlaceholderAPIHooker : PlaceholderExpansion { 8 | override val identifier = "pou" 9 | override fun onPlaceholderRequest(player: Player?, args: String): String { 10 | player ?: return args 11 | return Pouvoir.placeholderManager.replace(player, "%pou_$args%") 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/main/kotlin/com/skillw/pouvoir/internal/feature/database/mongodb/MongoContainerHolder.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.internal.feature.database.mongodb 2 | 3 | import com.mongodb.client.MongoClient 4 | import com.mongodb.client.MongoDatabase 5 | import com.skillw.pouvoir.api.feature.database.ContainerHolder 6 | 7 | /** 8 | * @className MongoContainerHolder 9 | * 10 | * @author Glom 11 | * @date 2023/8/11 22:49 Copyright 2024 Glom. 12 | */ 13 | class MongoContainerHolder(private val mongoClient: MongoClient, database: String) : ContainerHolder() { 14 | private val mongoDatabase: MongoDatabase = mongoClient.getDatabase(database) 15 | 16 | override fun createContainer(tableName: String, userKey: Boolean): MongoContainer { 17 | return MongoContainer(tableName, this, mongoDatabase) 18 | } 19 | 20 | override fun disconnect() { 21 | mongoClient.close() 22 | } 23 | 24 | } -------------------------------------------------------------------------------- /src/main/kotlin/com/skillw/pouvoir/internal/feature/database/redis/RedisContainer.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.internal.feature.database.redis 2 | 3 | //import com.skillw.pouvoir.api.feature.database.BaseContainer 4 | //import taboolib.expansion.SingleRedisConnection 5 | // 6 | ///** 7 | // * @className MongoContainer 8 | // * 9 | // * @author Glom 10 | // * @date 2023/1/12 23:00 Copyright 2024 Glom. 11 | // */ 12 | //open class RedisContainer( 13 | // override val key: String, 14 | // holder: RedisContainerHolder, 15 | // val connection: SingleRedisConnection, 16 | //) : BaseContainer(key, holder) -------------------------------------------------------------------------------- /src/main/kotlin/com/skillw/pouvoir/internal/feature/database/redis/RedisContainerHolder.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.internal.feature.database.redis 2 | // 3 | //import com.skillw.pouvoir.api.feature.database.ContainerHolder 4 | //import taboolib.expansion.SingleRedisConnection 5 | // 6 | ///** 7 | // * @className MongoContainerHolder 8 | // * 9 | // * @author Glom 10 | // * @date 2023/1/20 17:29 Copyright 2024 Glom. 11 | // */ 12 | //class RedisContainerHolder(val connection: SingleRedisConnection) : ContainerHolder() { 13 | // override fun createContainer(tableName: String, userKey: Boolean): RedisContainer = 14 | // if (!userKey) RedisContainer(tableName, this, connection) 15 | // else RedisUserContainer(tableName, this, connection) 16 | // 17 | // override fun disconnect() { 18 | // connection.close() 19 | // } 20 | // 21 | //} -------------------------------------------------------------------------------- /src/main/kotlin/com/skillw/pouvoir/internal/feature/database/sql/NormalContainer.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.internal.feature.database.sql 2 | 3 | import com.skillw.pouvoir.api.feature.database.BaseContainer 4 | import com.skillw.pouvoir.api.feature.database.ContainerHolder 5 | import com.skillw.pouvoir.api.feature.database.sql.IPouTable 6 | import taboolib.module.database.ColumnBuilder 7 | import taboolib.module.database.Host 8 | 9 | /** 10 | * @className NormalContainer 11 | * 12 | * @author Glom 13 | * @date 2023/1/12 20:51 Copyright 2024 Glom. 14 | */ 15 | open class NormalContainer, E : ColumnBuilder>( 16 | holder: ContainerHolder>, 17 | table: IPouTable, 18 | ) : BaseContainer(table.name, holder), IPouTable by table { 19 | override fun onDisable() { 20 | close() 21 | } 22 | } -------------------------------------------------------------------------------- /src/main/kotlin/com/skillw/pouvoir/internal/feature/handler/Native.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.internal.feature.handler 2 | 3 | import com.skillw.asahi.api.script.linking.Invoker 4 | import com.skillw.asahi.api.script.linking.NativeFunction 5 | import com.skillw.pouvoir.internal.core.asahi.linking.js.NativeJSFunction 6 | 7 | /** 8 | * @className Native 9 | * 10 | * @author Glom 11 | * @date 2023/1/22 22:00 Copyright 2024 Glom. 12 | */ 13 | fun Any.toInvoker(key: String, namespaces: Collection): Invoker? { 14 | return when (this) { 15 | is Map<*, *> -> { 16 | val func = this as Map 17 | when (func["type"].toString()) { 18 | "js" -> NativeJSFunction.deserialize(key, func) 19 | else -> NativeFunction.deserialize(key, func, *namespaces.toTypedArray()) 20 | } 21 | } 22 | 23 | is String -> { 24 | NativeFunction.deserialize(key, this, *namespaces.toTypedArray()) 25 | } 26 | 27 | else -> null 28 | } 29 | } -------------------------------------------------------------------------------- /src/main/kotlin/com/skillw/pouvoir/internal/feature/hologram/impl/PouEmptyHoloLine.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.internal.feature.hologram.impl 2 | 3 | import com.skillw.pouvoir.internal.feature.hologram.PouHolo 4 | import org.bukkit.Location 5 | import org.bukkit.entity.Player 6 | 7 | /** 8 | * @className PouEmptyHoloLine 9 | * 10 | * @author Glom 11 | * @date 2023/1/17 13:10 Copyright 2024 Glom. 12 | */ 13 | class PouEmptyHoloLine : PouHolo { 14 | override val isDeleted: Boolean 15 | get() = true 16 | 17 | override fun destroy() { 18 | 19 | } 20 | 21 | override fun respawn() { 22 | 23 | } 24 | 25 | override fun spawn() { 26 | 27 | } 28 | 29 | override fun teleport(location: Location) { 30 | 31 | } 32 | 33 | override fun delete() { 34 | 35 | } 36 | 37 | override fun visible(viewer: Player, visible: Boolean) { 38 | 39 | } 40 | 41 | override fun update(line: String) { 42 | 43 | } 44 | } -------------------------------------------------------------------------------- /src/main/kotlin/com/skillw/pouvoir/internal/feature/listener/Priority.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.internal.feature.listener 2 | 3 | import taboolib.common.platform.event.EventPriority 4 | 5 | /** 6 | * @className Priority 7 | * 8 | * @author Glom 9 | * @date 2022/7/9 7:45 Copyright 2022 user. 10 | */ 11 | class Priority(val level: Int = 0) { 12 | 13 | fun toBukkit(): EventPriority = when (level) { 14 | 1 -> EventPriority.LOWEST 15 | 2 -> EventPriority.LOW 16 | 3 -> EventPriority.NORMAL 17 | 4 -> EventPriority.HIGH 18 | 5 -> EventPriority.HIGHEST 19 | 6 -> EventPriority.MONITOR 20 | else -> EventPriority.NORMAL 21 | } 22 | } -------------------------------------------------------------------------------- /src/main/kotlin/com/skillw/pouvoir/internal/feature/operation/num/OperationMax.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.internal.feature.operation.num 2 | 3 | import com.skillw.pouvoir.api.feature.operation.NumberOperation 4 | import com.skillw.pouvoir.api.plugin.annotation.AutoRegister 5 | import kotlin.math.max 6 | 7 | @AutoRegister 8 | object OperationMax : NumberOperation("max", "<") { 9 | override fun operate(a: Number, b: Number): Number { 10 | return max(a.toDouble(), b.toDouble()) 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/main/kotlin/com/skillw/pouvoir/internal/feature/operation/num/OperationMin.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.internal.feature.operation.num 2 | 3 | import com.skillw.pouvoir.api.feature.operation.NumberOperation 4 | import com.skillw.pouvoir.api.plugin.annotation.AutoRegister 5 | import kotlin.math.min 6 | 7 | @AutoRegister 8 | object OperationMin : NumberOperation("min", ">") { 9 | override fun operate(a: Number, b: Number): Number { 10 | return min(a.toDouble(), b.toDouble()) 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/main/kotlin/com/skillw/pouvoir/internal/feature/operation/num/OperationPlus.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.internal.feature.operation.num 2 | 3 | import com.skillw.pouvoir.api.feature.operation.NumberOperation 4 | import com.skillw.pouvoir.api.plugin.annotation.AutoRegister 5 | 6 | @AutoRegister 7 | object OperationPlus : NumberOperation("plus", "+") { 8 | override fun operate(a: Number, b: Number): Number { 9 | return a.toDouble() + b.toDouble() 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/main/kotlin/com/skillw/pouvoir/internal/feature/operation/num/OperationReduce.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.internal.feature.operation.num 2 | 3 | import com.skillw.pouvoir.api.feature.operation.NumberOperation 4 | import com.skillw.pouvoir.api.plugin.annotation.AutoRegister 5 | 6 | @AutoRegister 7 | object OperationReduce : NumberOperation("reduce", "-") { 8 | override fun operate(a: Number, b: Number): Number { 9 | return a.toDouble() - b.toDouble() 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/main/kotlin/com/skillw/pouvoir/internal/feature/operation/num/OperationScalar.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.internal.feature.operation.num 2 | 3 | import com.skillw.pouvoir.api.feature.operation.NumberOperation 4 | import com.skillw.pouvoir.api.plugin.annotation.AutoRegister 5 | 6 | @AutoRegister 7 | object OperationScalar : NumberOperation("scalar", "*") { 8 | override fun operate(a: Number, b: Number): Number { 9 | return a.toDouble() * b.toDouble() 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/main/kotlin/com/skillw/pouvoir/internal/feature/operation/str/OperationAppend.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.internal.feature.operation.str 2 | 3 | import com.skillw.pouvoir.api.feature.operation.StringOperation 4 | import com.skillw.pouvoir.api.plugin.annotation.AutoRegister 5 | import com.skillw.pouvoir.internal.manager.PouConfig 6 | import taboolib.common.util.join 7 | 8 | @AutoRegister 9 | object OperationAppend : StringOperation("append") { 10 | override fun operate(a: String, b: String): String { 11 | return join(arrayOf(a, b), separator = PouConfig.strAppendSeparator) 12 | } 13 | 14 | } -------------------------------------------------------------------------------- /src/main/kotlin/com/skillw/pouvoir/internal/feature/operation/str/OperationSkip.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.internal.feature.operation.str 2 | 3 | import com.skillw.pouvoir.api.feature.operation.StringOperation 4 | import com.skillw.pouvoir.api.plugin.annotation.AutoRegister 5 | 6 | @AutoRegister 7 | object OperationSkip : StringOperation("skip") { 8 | override fun operate(a: String, b: String): String { 9 | return a 10 | } 11 | } -------------------------------------------------------------------------------- /src/main/kotlin/com/skillw/pouvoir/internal/feature/raytrace/RayTrace.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.internal.feature.raytrace 2 | 3 | import org.bukkit.entity.LivingEntity 4 | import org.bukkit.util.Vector 5 | 6 | class RayTrace(private val origin: Vector, private val direction: Vector) { 7 | 8 | constructor(entity: LivingEntity) : this( 9 | entity.eyeLocation.toVector(), 10 | entity.eyeLocation.direction 11 | ) 12 | 13 | fun traces(distance: Double, accuracy: Double): Set { 14 | return mutableSetOf().let { 15 | var process = 0.0 16 | while (process <= distance) { 17 | it.add(distance(process)) 18 | process += accuracy 19 | } 20 | it 21 | } 22 | } 23 | 24 | private fun distance(distance: Double): Vector { 25 | return origin.clone().add(direction.clone().multiply(distance)) 26 | } 27 | } -------------------------------------------------------------------------------- /src/main/kotlin/com/skillw/pouvoir/internal/feature/selector/Self.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.internal.feature.selector 2 | 3 | import com.skillw.pouvoir.api.feature.selector.SimpleSelector 4 | import com.skillw.pouvoir.api.feature.selector.Target 5 | import com.skillw.pouvoir.api.plugin.annotation.AutoRegister 6 | import com.skillw.pouvoir.api.plugin.map.DataMap 7 | 8 | @AutoRegister 9 | object Self : SimpleSelector("self") { 10 | override fun SelectorContext.getTargets(caster: Target): Collection { 11 | return setOf(caster) 12 | } 13 | 14 | override fun addParameter(dataMap: DataMap, vararg args: Any?) { 15 | 16 | } 17 | } -------------------------------------------------------------------------------- /src/main/kotlin/com/skillw/pouvoir/internal/feature/trigger/bukkit/BukkitEventTrigger.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.internal.feature.trigger.bukkit 2 | 3 | import com.skillw.pouvoir.api.feature.trigger.BaseTrigger 4 | import org.bukkit.event.Cancellable 5 | import org.bukkit.event.Event 6 | 7 | /** 8 | * @className CustomTrigger 9 | * 10 | * @author Glom 11 | * @date 2023/1/8 19:36 Copyright 2024 Glom. 12 | */ 13 | class BukkitEventTrigger(key: String, val event: Event) : BaseTrigger(key) { 14 | var isCancelled: Boolean = false 15 | get() = (event as? Cancellable)?.isCancelled ?: false 16 | set(value) { 17 | field = value 18 | (event as? Cancellable)?.isCancelled = value 19 | } 20 | 21 | } -------------------------------------------------------------------------------- /src/main/kotlin/com/skillw/pouvoir/internal/feature/trigger/custom/CustomTrigger.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.internal.feature.trigger.custom 2 | 3 | import com.skillw.pouvoir.api.feature.trigger.BaseTrigger 4 | import com.skillw.pouvoir.api.plugin.map.DataMap 5 | 6 | /** 7 | * @className CustomTrigger 8 | * 9 | * @author Glom 10 | * @date 2023/1/8 19:36 Copyright 2024 Glom. 11 | */ 12 | class CustomTrigger(key: String) : BaseTrigger(key) { 13 | val data = DataMap() 14 | 15 | constructor(key: String, data: Map = emptyMap()) : this(key) { 16 | this.data.putAll(data) 17 | } 18 | 19 | constructor(key: String, receiver: DataMap.() -> Unit) : this(key) { 20 | receiver(data) 21 | } 22 | } -------------------------------------------------------------------------------- /src/main/kotlin/com/skillw/pouvoir/internal/feature/trigger/custom/CustomTriggerHandler.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.internal.feature.trigger.custom 2 | 3 | import com.skillw.pouvoir.api.feature.handler.BaseHandler 4 | 5 | /** 6 | * @className CustomTriggerHandler 7 | * 8 | * @author Glom 9 | * @date 2023/1/22 20:01 Copyright 2024 Glom. 10 | */ 11 | class CustomTriggerHandler(key: String, priority: Int, val todo: (CustomTrigger) -> Unit) : 12 | BaseHandler(key, priority = priority) { 13 | override fun handle(trigger: CustomTrigger) { 14 | todo(trigger) 15 | } 16 | 17 | } -------------------------------------------------------------------------------- /src/main/kotlin/com/skillw/pouvoir/internal/manager/AntiCheatManagerImpl.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.internal.manager 2 | 3 | import com.skillw.pouvoir.Pouvoir 4 | import com.skillw.pouvoir.api.manager.sub.AntiCheatManager 5 | import org.bukkit.entity.Player 6 | 7 | internal object AntiCheatManagerImpl : AntiCheatManager() { 8 | override val key = "AntiCheatManager" 9 | override val priority = 5 10 | override val subPouvoir = Pouvoir 11 | override fun bypass(player: Player) { 12 | values.forEach { it.bypass(player) } 13 | } 14 | 15 | override fun recover(player: Player) { 16 | values.forEach { it.recover(player) } 17 | } 18 | } -------------------------------------------------------------------------------- /src/main/kotlin/com/skillw/pouvoir/internal/manager/HologramManagerImpl.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.internal.manager 2 | 3 | import com.skillw.pouvoir.Pouvoir 4 | import com.skillw.pouvoir.api.feature.hologram.IHologram 5 | import com.skillw.pouvoir.api.manager.sub.HologramManager 6 | import com.skillw.pouvoir.internal.feature.hologram.Hologram 7 | import org.bukkit.Location 8 | import org.bukkit.entity.Player 9 | 10 | internal object HologramManagerImpl : HologramManager() { 11 | override val key = "HologramManagerImpl" 12 | override val priority = 3 13 | override val subPouvoir = Pouvoir 14 | 15 | override fun createHologram(location: Location, content: List, players: Set): IHologram { 16 | return Hologram(location, content, players) 17 | } 18 | } -------------------------------------------------------------------------------- /src/main/kotlin/com/skillw/pouvoir/internal/manager/ListenerManagerImpl.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.internal.manager 2 | 3 | import com.skillw.pouvoir.Pouvoir 4 | import com.skillw.pouvoir.api.manager.sub.ListenerManager 5 | import taboolib.common.platform.event.ProxyListener 6 | import taboolib.common.platform.function.unregisterListener 7 | 8 | internal object ListenerManagerImpl : ListenerManager() { 9 | override val key = "ListenerManager" 10 | override val priority = 3 11 | override val subPouvoir = Pouvoir 12 | 13 | override fun remove(key: String): ProxyListener? { 14 | get(key)?.let { unregisterListener(it) } 15 | return super.remove(key) 16 | } 17 | 18 | override fun onReload() { 19 | forEach { 20 | remove(it.key) 21 | } 22 | } 23 | 24 | } -------------------------------------------------------------------------------- /src/main/kotlin/com/skillw/pouvoir/internal/manager/OperationManagerImpl.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.internal.manager 2 | 3 | import com.skillw.pouvoir.Pouvoir 4 | import com.skillw.pouvoir.api.manager.sub.OperationManager 5 | 6 | object OperationManagerImpl : OperationManager() { 7 | override val key = "OperationManager" 8 | override val priority: Int = 0 9 | override val subPouvoir = Pouvoir 10 | 11 | override fun onEnable() { 12 | onReload() 13 | } 14 | 15 | override fun onReload() { 16 | this.entries.filter { it.value.release }.forEach { this.remove(it.key) } 17 | } 18 | 19 | } 20 | 21 | -------------------------------------------------------------------------------- /src/main/kotlin/com/skillw/pouvoir/internal/manager/ScriptAnnotationManagerImpl.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.internal.manager 2 | 3 | import com.skillw.pouvoir.Pouvoir 4 | import com.skillw.pouvoir.api.manager.sub.script.ScriptAnnotationManager 5 | 6 | internal object ScriptAnnotationManagerImpl : ScriptAnnotationManager() { 7 | override val key = "ScriptAnnotationManager" 8 | override val priority = 4 9 | override val subPouvoir = Pouvoir 10 | } -------------------------------------------------------------------------------- /src/main/kotlin/com/skillw/pouvoir/internal/manager/SelectorManagerImpl.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.internal.manager 2 | 3 | import com.skillw.pouvoir.Pouvoir 4 | import com.skillw.pouvoir.api.manager.sub.SelectorManager 5 | 6 | internal object SelectorManagerImpl : SelectorManager() { 7 | override val key = "SelectorManager" 8 | override val priority = 5 9 | override val subPouvoir = Pouvoir 10 | 11 | } -------------------------------------------------------------------------------- /src/main/kotlin/com/skillw/pouvoir/util/GsonUtil.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.util 2 | 3 | import com.google.gson.Gson 4 | import com.google.gson.GsonBuilder 5 | 6 | /** 7 | * Gson工具类 8 | * 9 | * @constructor Create empty Gson utils 10 | */ 11 | 12 | val gson: Gson by lazy { 13 | GsonBuilder().serializeNulls().create() 14 | } 15 | 16 | inline fun T.encodeJson(): String { 17 | return gson.toJson(this) 18 | } 19 | 20 | 21 | inline fun String.decodeFromString(): T? { 22 | return gson.fromJson(this, T::class.java) 23 | } 24 | -------------------------------------------------------------------------------- /src/main/kotlin/com/skillw/pouvoir/util/Tick.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.util 2 | 3 | import com.skillw.pouvoir.internal.feature.database.PouvoirContainer 4 | import taboolib.common.LifeCycle 5 | import taboolib.common.platform.Awake 6 | import taboolib.common.platform.function.submit 7 | import taboolib.common5.Coerce 8 | 9 | object Tick { 10 | var currentTick: Long = 0 11 | @Synchronized 12 | get 13 | private set 14 | 15 | @Awake(LifeCycle.ACTIVE) 16 | fun start() { 17 | currentTick = Coerce.toLong(PouvoirContainer["COMMON", "CLOCK_TICKS"]) 18 | submit(async = true, period = 1, delay = 0) { 19 | currentTick++ 20 | } 21 | } 22 | 23 | @Awake(LifeCycle.DISABLE) 24 | fun disable() { 25 | PouvoirContainer["COMMON", "CLOCK_TICKS"] = currentTick.toString() 26 | } 27 | } -------------------------------------------------------------------------------- /src/main/kotlin/com/skillw/pouvoir/util/attribute/AttributeUtils.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.util.attribute 2 | 3 | import com.skillw.pouvoir.util.nms.NMS 4 | import org.bukkit.attribute.AttributeInstance 5 | import org.bukkit.entity.LivingEntity 6 | 7 | 8 | fun LivingEntity.getAttribute(attribute: BukkitAttribute): AttributeInstance? { 9 | return NMS.INSTANCE.getAttribute(this, attribute) 10 | } 11 | 12 | 13 | fun AttributeInstance.clear() { 14 | for (modifier in this.modifiers) { 15 | this.removeModifier(modifier) 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/main/kotlin/com/skillw/pouvoir/util/package-info.java: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.util; 2 | 3 | /** 4 | * 工具类,为SubPouvoir及脚本提供工具性函数 5 | * 有些类因脚本兼容性问题 只能以单例形式声明类 6 | */ -------------------------------------------------------------------------------- /src/main/kotlin/com/skillw/pouvoir/util/plugin/Pair.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.util.plugin 2 | 3 | // Kotlin's Pair will be relocated.... 4 | // So this class is here. 5 | data class Pair(val key: K, val value: V) 6 | 7 | infix fun A.to(that: B): Pair = Pair(this, that) -------------------------------------------------------------------------------- /src/main/kotlin/com/skillw/pouvoir/util/read/RegexUtil.kt: -------------------------------------------------------------------------------- 1 | package com.skillw.pouvoir.util.read 2 | 3 | import java.util.regex.Pattern 4 | 5 | /** 6 | * @className RegexUtil 7 | * 8 | * @author Glom 9 | * @date 2023/8/8 20:22 Copyright 2024 Glom. 10 | */ 11 | 12 | val groupPattern = "\\(\\?<([a-zA-Z][a-zA-Z0-9]*)>".toRegex() 13 | 14 | fun Pattern.groupNames(): Set = groupPattern.findAll(pattern()).map { it.groupValues[1] }.toSet() -------------------------------------------------------------------------------- /src/main/resources/config.yml: -------------------------------------------------------------------------------- 1 | #数据库配置 2 | database: 3 | type: sqlite 4 | # sqlite的path 5 | path: plugins/Pouvoir/database.db 6 | enable: false 7 | host: localhost 8 | port: 3306 9 | user: root 10 | password: root 11 | database: root 12 | table: my_database 13 | #每10分钟同步一次 (tick) 14 | user-container-sync-time: 12000 15 | options: 16 | #调试模式 17 | debug: false 18 | # Asahi-调试模式 19 | # debug-asahi: false 20 | # 会影响所有附属 21 | number-format: "#.##" 22 | operation: 23 | string-append-separator: ", " -------------------------------------------------------------------------------- /src/main/resources/dispatchers/custom-trigger.yml: -------------------------------------------------------------------------------- 1 | my trigger: 2 | triggers: [ async player chat ] 3 | context: 4 | player: "@event player" 5 | namespaces: [ bukkit ] 6 | baffle: 7 | based-on: player 8 | time: 5s 9 | pre-handle: |- 10 | tell &player '你说话了! (此消息每5秒只能触发一次) - 爱来自 plugins/Pouvoir/dispatchers/custom-trigger.yml' 11 | post-handle: 12 | type: js 13 | content: |- 14 | this.context.player.sendMessage("处理完了! - 爱来自 plugins/Pouvoir/dispatchers/custom-trigger.yml") 15 | exception: |- 16 | warning '触发器 my trigger 处理失败! 具体报错请看后台! - 爱来自 plugins/Pouvoir/dispatchers/custom-trigger.yml' 17 | -------------------------------------------------------------------------------- /src/main/resources/handlers/simple-handler.yml: -------------------------------------------------------------------------------- 1 | custom-handler: 2 | triggers: [ async player chat ] 3 | when: 4 | - if: "'check &player name == 'Glom_'" 5 | goto: main1 6 | - else: main 7 | functions: 8 | main: |- 9 | tell &player 你说话了! - 爱来自 plugins/Pouvoir/handlers/simple-handler.yml 10 | main1: |- 11 | tell &player Glom说话了! -------------------------------------------------------------------------------- /src/main/resources/script.yml: -------------------------------------------------------------------------------- 1 | #全局静态类导入 2 | #格式: 3 | # 变量名: '类名' 4 | #在这里的静态类可以直接在脚本里调用 5 | static-classes: { } 6 | global-scripts: 7 | - "plugins/Pouvoir/scripts/core/" -------------------------------------------------------------------------------- /src/main/resources/scripts/conditions/altitude.js: -------------------------------------------------------------------------------- 1 | //@Condition() 2 | 3 | Coerce = static("Coerce"); 4 | 5 | key = "altitude"; 6 | 7 | names = ["高度: (?\\d+)-(/\\d+)", "高度: (?\\d+)"]; 8 | 9 | function parameters(matcher, text) { 10 | const min = Coerce.toDouble(matcher.group("min")); 11 | let max = 10000; 12 | try { 13 | max = Coerce.toDouble(matcher.group("max")); 14 | } catch (ignored) {} 15 | return mapOf({ min: min, max: max }); 16 | } 17 | 18 | function condition(entity, map) { 19 | if (entity == null) return true; 20 | const min = Coerce.toDouble(map.get("min")); 21 | let max = 10000; 22 | try { 23 | max = Coerce.toDouble(map.get("max")); 24 | } catch (ignored) {} 25 | return entity.location.y >= min && entity.location.y <= max; 26 | } 27 | -------------------------------------------------------------------------------- /src/main/resources/scripts/conditions/fire.js: -------------------------------------------------------------------------------- 1 | //@Condition() 2 | 3 | Player = find("org.bukkit.entity.Player"); 4 | Coerce = static("Coerce"); 5 | 6 | key = "fire"; 7 | 8 | names = ["需要在燃烧", "需要不在燃烧"]; 9 | 10 | function parameters(matcher, text) { 11 | const isIn = !matcher.pattern().toString().contains("不"); 12 | return mapOf({ status: isIn }); 13 | } 14 | 15 | function condition(entity, map) { 16 | if (entity == null) return true; 17 | const isIn = Coerce.toBoolean(map.get("status")); 18 | return (isIn && entity.fireTicks > 0) || (!isIn && entity.fireTicks <= 0); 19 | } 20 | -------------------------------------------------------------------------------- /src/main/resources/scripts/conditions/food.js: -------------------------------------------------------------------------------- 1 | //@Condition() 2 | 3 | Player = find("org.bukkit.entity.Player"); 4 | Coerce = static("Coerce"); 5 | 6 | key = "food"; 7 | 8 | names = ["要求饱食度: (?\\d+)"]; 9 | 10 | function parameters(matcher, text) { 11 | const value = Coerce.toInteger(matcher.group("value")); 12 | return mapOf({ value: value }); 13 | } 14 | 15 | function condition(entity, map) { 16 | if (entity == null || !(entity instanceof Player)) return true; 17 | const level = Coerce.toInteger(map.get("value")); 18 | return entity.foodLevel >= level; 19 | } 20 | -------------------------------------------------------------------------------- /src/main/resources/scripts/conditions/ground.js: -------------------------------------------------------------------------------- 1 | //@Condition() 2 | 3 | Coerce = static("Coerce"); 4 | 5 | key = "ground"; 6 | 7 | names = ["要求在地面", "要求不在地面"]; 8 | 9 | function parameters(matcher, text) { 10 | const isIn = !matcher.pattern().toString().contains("不"); 11 | return mapOf({ status: isIn }); 12 | } 13 | 14 | function condition(entity, map) { 15 | if (entity == null) return true; 16 | const isIn = Coerce.toBoolean(map.get("status")); 17 | return (isIn && entity.isOnGround()) || (!isIn && !entity.isOnGround()); 18 | } 19 | -------------------------------------------------------------------------------- /src/main/resources/scripts/conditions/health.js: -------------------------------------------------------------------------------- 1 | //@Condition() 2 | 3 | Coerce = static("Coerce"); 4 | 5 | key = "health"; 6 | 7 | names = ["生命值需要: (?\\d+)-(?\\d+)", "生命值需要: (?\\d+)"]; 8 | 9 | function parameters(matcher, text) { 10 | const min = Coerce.toDouble(matcher.group("min")); 11 | let max = min; 12 | try { 13 | max = Coerce.toDouble(matcher.group("max")); 14 | } catch (ignored) {} 15 | return mapOf({ min: min, max: max }); 16 | } 17 | 18 | function condition(entity, map) { 19 | if (entity == null) return true; 20 | const min = Coerce.toDouble(map.get("min")); 21 | let max = min; 22 | try { 23 | max = Coerce.toDouble(map.get("max")); 24 | } catch (ignored) {} 25 | return entity.health >= min && entity.health <= max; 26 | } 27 | -------------------------------------------------------------------------------- /src/main/resources/scripts/conditions/level.js: -------------------------------------------------------------------------------- 1 | //@Condition() 2 | 3 | Player = find("org.bukkit.entity.Player"); 4 | Coerce = static("Coerce"); 5 | 6 | key = "level"; 7 | 8 | names = ["Lv.(?\\d+)", "等级限制:\\s?(?d+)"]; 9 | 10 | function parameters(matcher, text) { 11 | const value = Coerce.toInteger(matcher.group("value")); 12 | return mapOf({ value: value }); 13 | } 14 | 15 | function condition(entity, map) { 16 | if (entity == null || !(entity instanceof Player)) return true; 17 | const level = Coerce.toInteger(map.get("value")); 18 | return entity.level >= level; 19 | } 20 | -------------------------------------------------------------------------------- /src/main/resources/scripts/conditions/permission.js: -------------------------------------------------------------------------------- 1 | //@Condition() 2 | 3 | Player = find("org.bukkit.entity.Player"); 4 | 5 | key = "gm"; 6 | 7 | names = ["权限(:|:)?\\s?(?.*)"]; 8 | 9 | function parameters(matcher, text) { 10 | const permission = matcher.group("permission"); 11 | return mapOf({ permission: permission }); 12 | } 13 | 14 | function condition(entity, map) { 15 | if (entity == null || !(entity instanceof Player)) return true; 16 | const permission = map.get("permission").toString(); 17 | return entity.hasPermission(permission); 18 | } 19 | -------------------------------------------------------------------------------- /src/main/resources/scripts/conditions/player.js: -------------------------------------------------------------------------------- 1 | //@Condition() 2 | 3 | Coerce = static("Coerce"); 4 | 5 | key = "player"; 6 | 7 | names = ["持有者: (?.*)"]; 8 | 9 | function parameters(matcher, text) { 10 | const player = matcher.group("player"); 11 | return mapOf({ player: player }); 12 | } 13 | 14 | function condition(entity, map) { 15 | if (entity == null) return true; 16 | const player = map.get("player"); 17 | return entity.name == player; 18 | } 19 | -------------------------------------------------------------------------------- /src/main/resources/scripts/conditions/water.js: -------------------------------------------------------------------------------- 1 | //@Condition() 2 | 3 | Coerce = static("Coerce"); 4 | 5 | key = "water"; 6 | 7 | names = ["需要在水里", "需要不在水里"]; 8 | 9 | function parameters(matcher, text) { 10 | const isIn = !matcher.pattern().toString().contains("不"); 11 | return mapOf({ status: isIn }); 12 | } 13 | 14 | function condition(entity, map) { 15 | if (entity == null) return true; 16 | const isIn = Coerce.toBoolean(map.get("status")); 17 | var result = true; 18 | try { 19 | result = 20 | (isIn && entity.isInWaterOrRain()) || 21 | (!isIn && !entity.isInWaterOrRain()); 22 | } catch (e) { 23 | print(color("&c您的服务端不兼容 water(需要在水里) 条件! 已自动注销!")); 24 | AttributeSystem.conditionManager.remove(key); 25 | } 26 | return result; 27 | } 28 | -------------------------------------------------------------------------------- /src/main/resources/scripts/conditions/weather.js: -------------------------------------------------------------------------------- 1 | //@Condition() 2 | 3 | Coerce = static("Coerce"); 4 | 5 | Player = find("org.bukkit.entity.Player"); 6 | key = "weather"; 7 | 8 | names = ["需要天气: (?.*)", "需要不是天气: (?.*)"]; 9 | 10 | function parameters(matcher, text) { 11 | var weather = matcher.group("weather"); 12 | if (weather.contains("晴")) { 13 | weather = "CLEAR"; 14 | } else { 15 | weather = "DOWNFALL"; 16 | } 17 | const isIn = !matcher.pattern().toString().contains("不"); 18 | return mapOf({ weather: weather, status: isIn }); 19 | } 20 | 21 | function condition(entity, map) { 22 | if (entity == null || !(entity instanceof Player)) return true; 23 | const weather = map.get("weather"); 24 | const isIn = map.get("status"); 25 | return ( 26 | (isIn && entity.getPlayerWeather().name().equalsIgnoreCase(weather)) || 27 | (!isIn && !entity.getPlayerWeather().name().equalsIgnoreCase(weather)) 28 | ); 29 | } 30 | -------------------------------------------------------------------------------- /src/main/resources/scripts/conditions/world.js: -------------------------------------------------------------------------------- 1 | //@Condition() 2 | 3 | Coerce = static("Coerce"); 4 | 5 | key = "world"; 6 | 7 | names = ["要求世界: (?.*)", "需要不是世界: (?.*)"]; 8 | 9 | function parameters(matcher, text) { 10 | const world = matcher.group("world"); 11 | const isIn = !matcher.pattern().toString().contains("不"); 12 | return mapOf({ world: world, status: isIn }); 13 | } 14 | 15 | function condition(entity, map) { 16 | if (entity == null) return true; 17 | const world = map.get("world"); 18 | const isIn = map.get("status"); 19 | return ( 20 | (isIn && entity.location.world.name.equalsIgnoreCase(world)) || 21 | (!isIn && !entity.location.world.name.equalsIgnoreCase(world)) 22 | ); 23 | } 24 | -------------------------------------------------------------------------------- /src/main/resources/scripts/core/util/color.js: -------------------------------------------------------------------------------- 1 | load("plugins/Pouvoir/scripts/core/basic.js"); 2 | 3 | /** 4 | * @description 给文本上色 "&6test" -> "§6test" 5 | * @author Glom 6 | * @date 2022/12/20 7 | * @param {*} str 含颜色代码的文本 8 | * @returns {*} 上色后的文本 9 | */ 10 | function color(str) { 11 | return ColorUtils.colored(str); 12 | } 13 | 14 | /** 15 | * @description 给文本去色 "&6test"/"§6test" -> "test" 16 | * @author Glom 17 | * @date 2022/12/20 18 | * @param {*} str 含颜色代码的文本 19 | * @returns {*} 去色后的文本 20 | */ 21 | function uncolor(str) { 22 | return ColorUtils.uncolored(str); 23 | } 24 | 25 | /** 26 | * @description 给文本去色,还原未上色的文本 "§6test" -> "&6test" 27 | * @author Glom 28 | * @date 2022/12/20 29 | * @param {*} str 含颜色代码的文本 30 | * @returns {*} 未上色的文本 31 | */ 32 | function decolor(str) { 33 | return ColorUtils.decolored(str); 34 | } 35 | -------------------------------------------------------------------------------- /src/main/resources/scripts/core/util/container.js: -------------------------------------------------------------------------------- 1 | load("plugins/Pouvoir/scripts/core/basic.js"); 2 | 3 | PouvoirContainer = static("PouvoirContainer"); 4 | 5 | /** @type {Container} 持久化容器 */ 6 | function container() { 7 | return PouvoirContainer.container 8 | } 9 | 10 | /** 11 | * 用法: 12 | * 13 | * 用户名,键,值 都可自定义,为字符串即可 14 | * (用户名建议为uuid或玩家名) 15 | * 16 | * 用户名 键 17 | * container().get(user,key) - 从容器中获取值 18 | * 用户名 键 19 | * container().delete(user,key) - 删除容器中的值 20 | * 用户名 键 值 21 | * container().set(user,key,value) - 设置容器中的值 22 | * 23 | */ 24 | -------------------------------------------------------------------------------- /src/main/resources/scripts/core/util/number.js: -------------------------------------------------------------------------------- 1 | load("plugins/Pouvoir/scripts/core/basic.js"); 2 | /** 3 | * @description 格式化数字 4 | * @author Glom 5 | * @date 2022/12/20 6 | * @param {*} number 数字 7 | * @param {*} format 格式 8 | * @returns {*} 格式化后的数字文本 9 | */ 10 | function format(number, format) { 11 | return NumberUtils.format(number, format); 12 | } 13 | 14 | /** 15 | * @description 计算公式并返回结果 16 | * @author Glom 17 | * @date 2022/12/20 18 | * @param {*} formula 公式 19 | * @param {*} entity 实体 20 | * @returns {BigDecimal} 计算结果 21 | */ 22 | function calculate(formula, entity) { 23 | return CalculationUtils.calculate(formula, entity, null); 24 | } 25 | 26 | /** 27 | * @description 计算公式并返回结果 28 | * @author Glom 29 | * @date 2022/12/20 30 | * @param {*} formula 公式 31 | * @param {*} entity 实体 32 | * @returns {Double} 计算结果 33 | */ 34 | function calculateDouble(formula, entity) { 35 | return CalculationUtils.calculateDouble(formula, entity, null); 36 | } 37 | -------------------------------------------------------------------------------- /src/main/resources/scripts/core/util/placeholder.js: -------------------------------------------------------------------------------- 1 | load("plugins/Pouvoir/scripts/core/basic.js"); 2 | PouvoirAPI = static("PouvoirAPI"); 3 | /** 4 | * @description 解析占位符(PouPAPI & PAPI) 5 | * @author Glom 6 | * @date 2022/12/20 7 | * @param {String} string 待解析的文本 8 | * @param {LivingEntity} entity 实体 9 | * @returns {String} 解析后的文本 10 | */ 11 | function placeholder(string, entity) { 12 | return PouvoirAPI.placeholder(string, entity,true); 13 | } 14 | -------------------------------------------------------------------------------- /src/main/resources/scripts/core/util/ray_trace.js: -------------------------------------------------------------------------------- 1 | load("plugins/Pouvoir/scripts/core/basic.js"); 2 | /** 3 | * @description 获取实体视角所对的实体(可能为null) 4 | * @author Glom 5 | * @date 2022/12/20 6 | * @param {LivingEntity} entity 实体 7 | * @param {Double} distance 距离 8 | * @returns {LivingEntity} 实体视角所对的实体(可能为null) 9 | */ 10 | function getRayHit(entity, distance) { 11 | return EntityUtils.getEntityRayHit(entity, distance); 12 | } 13 | -------------------------------------------------------------------------------- /src/main/resources/scripts/example.js: -------------------------------------------------------------------------------- 1 | //this.sender表示发送者,是一个Entity 2 | function testFlag() { 3 | addFlag({ 4 | entity: this.sender, 5 | key: "test" 6 | }) 7 | } 8 | function a() { 9 | removeFlag(this.sender, "test") 10 | } 11 | 12 | function b() { 13 | print(getFlagEntities("test")) 14 | } -------------------------------------------------------------------------------- /src/main/resources/scripts/groovy.groovy: -------------------------------------------------------------------------------- 1 | // When u use the Script Annotation, don't delete '//' before it. 2 | ////@Listener(-event org.bukkit.event.player.PlayerChatEvent) 3 | //def hi() { 4 | // event.player.sendMessage 'Hi! I\'m groovy.groovy::hi' 5 | //} -------------------------------------------------------------------------------- /src/main/resources/scripts/operation/str_roman.js: -------------------------------------------------------------------------------- 1 | lookup = {M: 1000, CM: 900, D: 500, CD: 400, C: 100, XC: 90, L: 50, XL: 40, X: 10, IX: 9, V: 5, IV: 4, I: 1} 2 | 3 | function toInt(roman) { 4 | let i, num = 0; 5 | for (i in lookup) { 6 | while (roman.indexOf(i) === 0) { 7 | num += lookup[i]; 8 | roman = roman.replace(i, ''); 9 | } 10 | } 11 | return num; 12 | } 13 | 14 | function toRoman(num) { 15 | let roman = ''; 16 | for (let i in lookup) { 17 | while (num >= lookup[i]) { 18 | roman += i; 19 | num -= lookup[i]; 20 | } 21 | } 22 | return roman; 23 | } 24 | 25 | //@StringOperation(roman_num) 26 | function romanNum(a, b) { 27 | return toNum(toInt(a) + toInt(b)); 28 | } 29 | -------------------------------------------------------------------------------- /src/main/resources/scripts/test.asahi: -------------------------------------------------------------------------------- 1 | def test() { 2 | print 'test hhh' 3 | } --------------------------------------------------------------------------------