From b95c6932e8be6091a954307d87544188002a4cd8 Mon Sep 17 00:00:00 2001 From: Zoriot Date: Mon, 5 Jan 2026 18:06:58 +0100 Subject: [PATCH 01/23] =?UTF-8?q?[WIP]=20feat(build):=20=E2=9C=A8=20add=20?= =?UTF-8?q?Gradle=20build=20system=20and=20update=20project=20configuratio?= =?UTF-8?q?n?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 33 +++ build.gradle.kts | 149 +++++++++++ gradle.properties | 4 + gradle/libs.versions.toml | 46 ++++ gradle/wrapper/gradle-wrapper.jar | Bin 0 -> 45457 bytes gradle/wrapper/gradle-wrapper.properties | 7 + gradlew | 251 ++++++++++++++++++ gradlew.bat | 94 +++++++ pom.xml | 6 +- settings.gradle.kts | 5 + .../net/buildtheearth/BuildTeamTools.java | 3 - .../net/buildtheearth/modules/Module.java | 14 - .../buildtheearth/modules/ModuleHandler.java | 2 +- .../generator/components/field/Field.java | 3 +- .../components/field/FieldScripts.java | 4 +- .../generator/model/GeneratorCollections.java | 2 +- .../modules/network/api/NetworkAPI.java | 4 +- .../net/buildtheearth/utils/ChatHelper.java | 2 +- .../java/net/buildtheearth/utils/Item.java | 62 ++++- src/main/resources/config.yml | 5 +- src/main/resources/plugin.yml | 20 +- 21 files changed, 662 insertions(+), 54 deletions(-) create mode 100644 build.gradle.kts create mode 100644 gradle.properties create mode 100644 gradle/libs.versions.toml create mode 100644 gradle/wrapper/gradle-wrapper.jar create mode 100644 gradle/wrapper/gradle-wrapper.properties create mode 100644 gradlew create mode 100644 gradlew.bat create mode 100644 settings.gradle.kts diff --git a/.gitignore b/.gitignore index 94606739..9fad66dd 100644 --- a/.gitignore +++ b/.gitignore @@ -112,3 +112,36 @@ buildNumber.properties # Common working directory run/ .vscode/settings.json + +# Created by https://www.toptal.com/developers/gitignore/api/gradle +# Edit at https://www.toptal.com/developers/gitignore?templates=gradle + +### Gradle ### +.gradle +**/build/ +!src/**/build/ + +# Ignore Gradle GUI config +gradle-app.setting + +# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored) +!gradle-wrapper.jar + +# Avoid ignore Gradle wrappper properties +!gradle-wrapper.properties + +# Cache of project +.gradletasknamecache + +# Eclipse Gradle plugin generated files +# Eclipse Core +.project +# JDT-specific (Eclipse Java Development Tools) +.classpath + +### Gradle Patch ### +# Java heap dump +*.hprof + +# End of https://www.toptal.com/developers/gitignore/api/gradle + diff --git a/build.gradle.kts b/build.gradle.kts new file mode 100644 index 00000000..8fe34276 --- /dev/null +++ b/build.gradle.kts @@ -0,0 +1,149 @@ +/* + * This file was generated by the Gradle 'init' task. + */ + +plugins { + java + alias(libs.plugins.lombok) + alias(libs.plugins.git.version) + alias(libs.plugins.shadow) +} + +repositories { + //mavenLocal() // NEVER use in Production/Commits! + mavenCentral() + maven { + url = uri("https://repo.papermc.io/repository/maven-public/") + } + + maven { + url = uri("https://maven.buildtheearth.net/releases") + } + + maven { + url = uri("https://hub.spigotmc.org/nexus/content/repositories/snapshots/") + } + + maven { + url = uri("https://mvn.alps-bte.com/repository/alps-bte/") + } + + maven { + url = uri("https://repo.onarandombox.com/content/groups/public/") + } + + maven { + url = uri("https://repo.codemc.io/repository/maven-snapshots/") + } + + maven { + url = uri("https://repo.codemc.io/repository/maven-public/") + } + + maven { + url = uri("https://jitpack.io") + } + + maven { + url = uri("https://repo.dmulloy2.net/repository/public/") + } + + maven { + url = uri("https://maven.daporkchop.net/") + } + + maven { + url = uri("https://download.java.net/maven/2") + } + + maven { + url = uri("https://maven.enginehub.org/repo/") + } +} + +dependencies { + implementation(libs.com.alpsbte.alpslib.alpslib.libpsterra) + implementation(libs.com.alpsbte.canvas) + implementation(libs.net.daporkchop.lib.binary) + implementation(libs.com.github.cryptomorin.xseries) + implementation(libs.net.wesjd.anvilgui) + implementation(libs.micycle.clipper2) + implementation(libs.org.json.json) + implementation(libs.com.google.code.gson.gson) + implementation(libs.com.google.guava.guava) + implementation(libs.com.squareup.okhttp3.okhttp.jvm) + implementation(libs.de.micromata.jak.javaapiforkml) + implementation(libs.com.googlecode.json.simple) + compileOnly(libs.io.papermc.paper.paper.api) + compileOnly(libs.com.mojang.authlib) + compileOnly(libs.com.fastasyncworldedit.fastasyncworldedit.core) + compileOnly(libs.com.fastasyncworldedit.fastasyncworldedit.bukkit) +} + +val versionDetails: groovy.lang.Closure by extra +val details = versionDetails() + +group = "net.buildtheearth" +version = "0.2.0" + "-" + details.commitDistance + "-" + details.gitHash + "-SNAPSHOT" +description = "BuildTeamTools" +java.sourceCompatibility = JavaVersion.VERSION_21 +java.targetCompatibility = JavaVersion.VERSION_21 + +tasks.withType { + options.encoding = "UTF-8" +} + +tasks.withType { + options.encoding = "UTF-8" +} + +tasks.shadowJar { + // Exclude annotation classes (e.g. org.jetbrains.annotations) + exclude("org/jetbrains/annotations/**") + // Exclude slf4j classes + exclude("org/slf4j/**") + exclude("META-INF/**") + // Exclude duplicate com.sun.* classes + exclude("com/sun/codemodel/**") + exclude("com/sun/tools/xjc/**") + exclude("com/sun/xml/xsom/**") + archiveClassifier = "" + + val relocationPrefix = "net.buildtheearth.buildteamtools.shaded" + relocate("com.alpsbte.alpslib", "$relocationPrefix.alpslib") + relocate("org.mariadb.jdbc", "$relocationPrefix.jdbc") + relocate("com.zaxxer.hikari", "$relocationPrefix.hikari") + relocate("net.wesjd.anvilgui", "$relocationPrefix.anvilgui") + relocate("com.cryptomorin.xseries", "$relocationPrefix.xseries") + relocate("org.ipvp.canvas", "$relocationPrefix.canvas") + relocate("net.daporkchop.lib.binary", "$relocationPrefix.binary") + relocate("clipper2", "$relocationPrefix.clipper2") + relocate("com.google.gson", "$relocationPrefix.gson") + relocate("de.micromata.jak", "$relocationPrefix.jak") + relocate("org.json", "$relocationPrefix.json") + relocate("com.google.guava", "$relocationPrefix.guava") + relocate("com.squareup.okhttp3", "$relocationPrefix.okhttp3") +} + +tasks.assemble { + dependsOn(tasks.shadowJar) // Ensure that the shadowJar task runs before the build task +} + +tasks.jar { + enabled = false // Disable the default jar task since we are using shadowJar +} + +tasks.processResources { + // work around IDEA-296490 + duplicatesStrategy = DuplicatesStrategy.INCLUDE + with(copySpec { + from("src/main/resources/plugin.yml") { + expand( + mapOf( + "version" to project.version, + "description" to project.description + ) + ) + } + }) +} diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 00000000..6b91bb53 --- /dev/null +++ b/gradle.properties @@ -0,0 +1,4 @@ +# This file was generated by the Gradle 'init' task. +# https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_configuration_properties +org.gradle.configuration-cache=true + diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml new file mode 100644 index 00000000..419eb437 --- /dev/null +++ b/gradle/libs.versions.toml @@ -0,0 +1,46 @@ +# This file was generated by the Gradle 'init' task. +# https://docs.gradle.org/current/userguide/platforms.html#sub::toml-dependencies-format + +[versions] +com-alpsbte-alpslib-alpslib-libpsterra = "1.1.3" +com-alpsbte-canvas = "1.3" +com-fastasyncworldedit-fastasyncworldedit-bukkit = "2.12.3" +com-fastasyncworldedit-fastasyncworldedit-core = "2.12.3" +com-github-cryptomorin-xseries = "13.4.0" +com-google-code-gson-gson = "2.13.1" +com-google-guava-guava = "33.4.8-jre" +com-mojang-authlib = "7.0.61" +com-squareup-okhttp3-okhttp-jvm = "5.1.0" +de-micromata-jak-javaapiforkml = "2.2.1" +io-papermc-paper-paper-api = "1.21.10-R0.1-SNAPSHOT" +micycle-clipper2 = "1.2.2" +net-daporkchop-lib-binary = "0.5.7-SNAPSHOT" +net-wesjd-anvilgui = "1.10.8-SNAPSHOT" +org-json-json = "20251224" # https://mvnrepository.com/artifact/org.json/json/20251224 +io-freefair-lombok = "9.1.0" +com-googlecode-json-simple = "1.1.1" # https://mvnrepository.com/artifact/com.googlecode.json-simple/json-simple +com-palantir-git-version = "4.0.0" +com-gradleup-shadow = "9.3.0" + +[libraries] +com-alpsbte-alpslib-alpslib-libpsterra = { module = "com.alpsbte.alpslib:alpslib-libpsterra", version.ref = "com-alpsbte-alpslib-alpslib-libpsterra" } +com-alpsbte-canvas = { module = "com.alpsbte:canvas", version.ref = "com-alpsbte-canvas" } +com-fastasyncworldedit-fastasyncworldedit-bukkit = { module = "com.fastasyncworldedit:FastAsyncWorldEdit-Bukkit", version.ref = "com-fastasyncworldedit-fastasyncworldedit-bukkit" } +com-fastasyncworldedit-fastasyncworldedit-core = { module = "com.fastasyncworldedit:FastAsyncWorldEdit-Core", version.ref = "com-fastasyncworldedit-fastasyncworldedit-core" } +com-github-cryptomorin-xseries = { module = "com.github.cryptomorin:XSeries", version.ref = "com-github-cryptomorin-xseries" } +com-google-code-gson-gson = { module = "com.google.code.gson:gson", version.ref = "com-google-code-gson-gson" } +com-google-guava-guava = { module = "com.google.guava:guava", version.ref = "com-google-guava-guava" } +com-mojang-authlib = { module = "com.mojang:authlib", version.ref = "com-mojang-authlib" } +com-squareup-okhttp3-okhttp-jvm = { module = "com.squareup.okhttp3:okhttp-jvm", version.ref = "com-squareup-okhttp3-okhttp-jvm" } +de-micromata-jak-javaapiforkml = { module = "de.micromata.jak:JavaAPIforKml", version.ref = "de-micromata-jak-javaapiforkml" } +io-papermc-paper-paper-api = { module = "io.papermc.paper:paper-api", version.ref = "io-papermc-paper-paper-api" } +micycle-clipper2 = { module = "micycle:clipper2", version.ref = "micycle-clipper2" } +net-daporkchop-lib-binary = { module = "net.daporkchop.lib:binary", version.ref = "net-daporkchop-lib-binary" } +net-wesjd-anvilgui = { module = "net.wesjd:anvilgui", version.ref = "net-wesjd-anvilgui" } +org-json-json = { module = "org.json:json", version.ref = "org-json-json" } +com-googlecode-json-simple = { module = "com.googlecode.json-simple:json-simple", version.ref = "com-googlecode-json-simple" } + +[plugins] +lombok = { id = "io.freefair.lombok", version.ref = "io-freefair-lombok" } +git-version = { id = "com.palantir.git-version", version.ref = "com-palantir-git-version" } +shadow = { id = "com.gradleup.shadow", version.ref = "com-gradleup-shadow" } \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000000000000000000000000000000000000..8bdaf60c75ab801e22807dde59e12a8735a34077 GIT binary patch literal 45457 zcma&NW0YlEwk;ePwr$(aux;D69T}N{9ky*d!_2U4+qUuIRNZ#Jck8}7U+vcB{`IjNZqX3eq5;s6ddAkU&5{L|^Ow`ym2B0m+K02+~Q)i807X3X94qi>j)C0e$=H zm31v`=T&y}ACuKx7G~yWSYncG=NFB>O2);i9EmJ(9jSamq?Crj$g~1l3m-4M7;BWn zau2S&sSA0b0Rhg>6YlVLQa;D#)1yw+eGs~36Q$}5?avIRne3TQZXb<^e}?T69w<9~ zUmx1cG0uZ?Kd;Brd$$>r>&MrY*3$t^PWF1+J+G_xmpHW=>mly$<>~wHH+Bt3mzN7W zhR)g{_veH6>*KxLJ~~s{9HZm!UeC86d_>42NRqd$ev8zSMq4kt)q*>8kJ8p|^wuKx zq2Is_HJPoQ_apSoT?zJj7vXBp!xejBc^7F|zU0rhy%Ub*Dy#jJs!>1?CmJ-gulPVX zKit>RVmjL=G?>jytf^U@mfnC*1-7EVag@%ROu*#kA+)Rxq?MGK0v-dp^kM?nyMngb z_poL>GLThB7xAO*I7&?4^Nj`<@O@>&0M-QxIi zD@n}s%CYI4Be19C$lAb9Bbm6!R{&A;=yh=#fnFyb`s7S5W3?arZf?$khCwkGN!+GY~GT8-`!6pFr zbFBVEF`kAgtecfjJ`flN2Z!$$8}6hV>Tu;+rN%$X^t8fI>tXQnRn^$UhXO8Gu zt$~QON8`doV&{h}=2!}+xJKrNPcIQid?WuHUC-i%P^F(^z#XB`&&`xTK&L+i8a3a@ zkV-Jy;AnyQ`N=&KONV_^-0WJA{b|c#_l=v!19U@hS~M-*ix16$r01GN3#naZ|DxY2 z76nbjbOnFcx4bKbEoH~^=EikiZ)_*kOb>nW6>_vjf-UCf0uUy~QBb7~WfVO6qN@ns zz=XEG0s5Yp`mlmUad)8!(QDgIzY=OK%_hhPStbyYYd|~zDIc3J4 zy9y%wZOW>}eG4&&;Z>vj&Mjg+>4gL! z(@oCTFf-I^54t=*4AhKRoE-0Ky=qg3XK2Mu!Bmw@z>y(|a#(6PcfbVTw-dUqyx4x4 z3O#+hW1ANwSv-U+9otHE#U9T>(nWx>^7RO_aI>${jvfZQ{mUwiaxHau!H z0Nc}ucJu+bKux?l!dQ2QA(r@(5KZl(Or=U!=2K*8?D=ZT-IAcAX!5OI3w@`sF@$($ zbDk0p&3X0P%B0aKdijO|s})70K&mk1DC|P##b=k@fcJ|lo@JNWRUc>KL?6dJpvtSUK zxR|w8Bo6K&y~Bd}gvuz*3z z@sPJr{(!?mi@okhudaM{t3gp9TJ!|@j4eO1C&=@h#|QLCUKLaKVL z!lls$%N&ZG7yO#jK?U>bJ+^F@K#A4d&Jz4boGmptagnK!Qu{Ob>%+60xRYK>iffd_ z>6%0K)p!VwP$^@Apm%NrS6TpKJwj_Q=k~?4=_*NIe~eh_QtRaqX4t-rJAGYdB{pGq zSXX)-dR8mQ)X|;8@_=J6Dk7MfMp;x)^aZeCtScHs12t3vL+p-6!qhPkOM1OYQ z8YXW5tWp)Th(+$m7SnV_hNGKAP`JF4URkkNc@YV9}FK$9k zR&qgi$Cj#4bC1VK%#U)f%(+oQJ+EqvV{uAq1YG0riLvGxW@)m;*ayU-BSW61COFy0 z(-l>GJqYl;*x1PnRZ(p3Lm}* zlkpWyCoYtg9pAZ5RU^%w=vN{3Y<6WImxj(*SCcJsFj?o6CZ~>cWW^foliM#qN#We{ zwsL!u1$rzC1#4~bILZm*a!T{^kCci$XOJADm)P;y^%x5)#G#_!2uNp^S;cE`*ASCn;}H7pP^RRA z6lfXK(r4dy<_}R|(7%Lyo>QFP#s31E8zsYA${gSUykUV@?lyDNF=KhTeF^*lu7C*{ zBCIjy;bIE;9inJ$IT8_jL%)Q{7itmncYlkf2`lHl(gTwD%LmEPo^gskydVxMd~Do` zO8EzF!yn!r|BEgPjhW#>g(unY#n}=#4J;3FD2ThN5LpO0tI2~pqICaFAGT%%;3Xx$ z>~Ng(64xH-RV^Rj4=A_q1Ee8kcF}8HN{5kjYX0ADh}jq{q18x(pV!23pVsK5S}{M#p8|+LvfKx|_3;9{+6cu7%5o-+R@z>TlTft#kcJ`s2-j zUe4dgpInZU!<}aTGuwgdWJZ#8TPiV9QW<-o!ibBn&)?!ZDomECehvT7GSCRyF#VN2&5GShch9*}4p;8TX~cW*<#( zv-HmU7&+YUWO__NN3UbTFJ&^#3vxW4U9q5=&ORa+2M$4rskA4xV$rFSEYBGy55b{z z!)$_fYXiY?-GWDhGZXgTw}#ilrw=BiN(DGO*W7Vw(} zjUexksYLt_Nq?pl_nVa@c1W#edQKbT>VSN1NK?DulHkFpI-LXl7{;dl@z0#v?x%U& z8k8M1X6%TwR4BQ_eEWJASvMTy?@fQubBU__A_US567I-~;_VcX^NJ-E(ZPR^NASj1 zVP!LIf8QKtcdeH#w6ak50At)e={eF_Ns6J2Iko6dn8Qwa6!NQHZMGsD zhzWeSFK<{hJV*!cIHxjgR+e#lkUHCss-j)$g zF}DyS531TUXKPPIoePo{yH%qEr-dLMOhv^sC&@9YI~uvl?rBp^A-57{aH_wLg0&a|UxKLlYZQ24fpb24Qjil`4OCyt0<1eu>5i1Acv zaZtQRF)Q;?Aw3idg;8Yg9Cb#)03?pQ@O*bCloG zC^|TnJl`GXN*8iI;Ql&_QIY0ik}rqB;cNZ-qagp=qmci9eScHsRXG$zRNdf4SleJ} z7||<#PCW~0>3u8PP=-DjNhD(^(B0AFF+(oKOiQyO5#v4nI|v_D5@c2;zE`}DK!%;H zUn|IZ6P;rl*5`E(srr6@-hpae!jW=-G zC<*R?RLwL;#+hxN4fJ!oP4fX`vC3&)o!#l4y@MrmbmL{t;VP%7tMA-&vju_L zhtHbOL4`O;h*5^e3F{b9(mDwY6JwL8w`oi28xOyj`pVo!75hngQDNg7^D$h4t&1p2 ziWD_!ap3GM(S)?@UwWk=Szym^eDxSx3NaR}+l1~(@0car6tfP#sZRTb~w!WAS{+|SgUN3Tv`J4OMf z9ta_f>-`!`I@KA=CXj_J>CE7T`yGmej0}61sE(%nZa1WC_tV6odiysHA5gzfWN-`uXF46mhJGLpvNTBmx$!i zF67bAz~E|P{L6t1B+K|Cutp&h$fDjyq9JFy$7c_tB(Q$sR)#iMQH3{Og1AyD^lyQwX6#B|*ecl{-_;*B>~WSFInaRE_q6 zpK#uCprrCb`MU^AGddA#SS{P7-OS9h%+1`~9v-s^{s8faWNpt*Pmk_ECjt(wrpr{C_xdAqR(@!ERTSs@F%^DkE@No}wqol~pS^e7>ksF_NhL0?6R4g`P- zk8lMrVir~b(KY+hk5LQngwm`ZQT5t1^7AzHB2My6o)_ejR0{VxU<*r-Gld`l6tfA` zKoj%x9=>Ce|1R|1*aC}|F0R32^KMLAHN}MA<8NNaZ^j?HKxSwxz`N2hK8lEb{jE0& zg4G_6F@#NyDN?=i@=)eidKhlg!nQoA{`PgaH{;t|M#5z}a`u?^gy{5L~I2smLR z*4RmNxHqf9>D>sXSemHK!h4uPwMRb+W`6F>Q6j@isZ>-F=)B2*sTCD9A^jjUy)hjAw71B&$u}R(^R; zY9H3k8$|ounk>)EOi_;JAKV8U8ICSD@NrqB!&=)Ah_5hzp?L9Sw@c>>#f_kUhhm=p z1jRz8X7)~|VwO(MF3PS(|CL++1n|KT3*dhGjg!t_vR|8Yg($ z+$S$K=J`K6eG#^(J54=4&X#+7Car=_aeAuC>dHE+%v9HFu>r%ry|rwkrO-XPhR_#K zS{2Unv!_CvS7}Mb6IIT$D4Gq5v$Pvi5nbYB+1Yc&RY;3;XDihlvhhIG6AhAHsBYsm zK@MgSzs~y|+f|j-lsXKT0(%E2SkEb)p+|EkV5w8=F^!r1&0#0^tGhf9yPZ)iLJ^ zIXOg)HW_Vt{|r0W(`NmMLF$?3ZQpq+^OtjR-DaVLHpz%1+GZ7QGFA?(BIqBlVQ;)k zu)oO|KG&++gD9oL7aK4Zwjwi~5jqk6+w%{T$1`2>3Znh=OFg|kZ z>1cn>CZ>P|iQO%-Pic8wE9c*e%=3qNYKJ+z1{2=QHHFe=u3rqCWNhV_N*qzneN8A5 zj`1Ir7-5`33rjDmyIGvTx4K3qsks(I(;Kgmn%p#p3K zn8r9H8kQu+n@D$<#RZtmp$*T4B&QvT{K&qx(?>t@mX%3Lh}sr?gI#vNi=vV5d(D<=Cp5-y!a{~&y|Uz*PU{qe zI7g}mt!txT)U(q<+Xg_sSY%1wVHy;Dv3uze zJ>BIdSB2a|aK+?o63lR8QZhhP)KyQvV`J3)5q^j1-G}fq=E4&){*&hiam>ssYm!ya z#PsY0F}vT#twY1mXkGYmdd%_Uh12x0*6lN-HS-&5XWbJ^%su)-vffvKZ%rvLHVA<; zJP=h13;x?$v30`T)M)htph`=if#r#O5iC^ZHeXc6J8gewn zL!49!)>3I-q6XOZRG0=zjyQc`tl|RFCR}f-sNtc)I^~?Vv2t7tZZHvgU2Mfc9$LqG z!(iz&xb=q#4otDBO4p)KtEq}8NaIVcL3&pbvm@0Kk-~C@y3I{K61VDF_=}c`VN)3P z+{nBy^;=1N`A=xH$01dPesY_na*zrcnssA}Ix60C=sWg9EY=2>-yH&iqhhm28qq9Z z;}znS4ktr40Lf~G@6D5QxW&?q^R|=1+h!1%G4LhQs54c2Wo~4% zCA||d==lv2bP=9%hd0Dw_a$cz9kk)(Vo}NpSPx!vnV*0Bh9$CYP~ia#lEoLRJ8D#5 zSJS?}ABn1LX>8(Mfg&eefX*c0I5bf4<`gCy6VC{e>$&BbwFSJ0CgVa;0-U7=F81R+ zUmzz&c;H|%G&mSQ0K16Vosh?sjJW(Gp+1Yw+Yf4qOi|BFVbMrdO6~-U8Hr|L@LHeZ z0ALmXHsVm137&xnt#yYF$H%&AU!lf{W436Wq87nC16b%)p?r z70Wua59%7Quak50G7m3lOjtvcS>5}YL_~?Pti_pfAfQ!OxkX$arHRg|VrNx>R_Xyi z`N|Y7KV`z3(ZB2wT9{Dl8mtl zg^UOBv~k>Z(E)O>Z;~Z)W&4FhzwiPjUHE9&T#nlM)@hvAZL>cha-< zQ8_RL#P1?&2Qhk#c9fK9+xM#AneqzE-g(>chLp_Q2Xh$=MAsW z2ScEKr+YOD*R~mzy{bOJjs;X2y1}DVFZi7d_df^~((5a2%p%^4cf>vM_4Sn@@ssVJ z9ChGhs zbanJ+h74)3tWOviXI|v!=HU2mE%3Th$Mpx&lEeGFEBWRy8ogJY`BCXj@7s~bjrOY! z4nIU5S>_NrpN}|waZBC)$6ST8x91U2n?FGV8lS{&LFhHbuHU?SVU{p7yFSP_f#Eyh zJhI@o9lAeEwbZYC=~<(FZ$sJx^6j@gtl{yTOAz`Gj!Ab^y})eG&`Qt2cXdog2^~oOH^K@oHcE(L;wu2QiMv zJuGdhNd+H{t#Tjd<$PknMSfbI>L1YIdZ+uFf*Z=BEM)UPG3oDFe@8roB0h(*XAqRc zoxw`wQD@^nxGFxQXN9@GpkLqd?9@(_ZRS@EFRCO8J5{iuNAQO=!Lo5cCsPtt4=1qZN8z`EA2{ge@SjTyhiJE%ttk{~`SEl%5>s=9E~dUW0uws>&~3PwXJ!f>ShhP~U9dLvE8ElNt3g(6-d zdgtD;rgd^>1URef?*=8BkE&+HmzXD-4w61(p6o~Oxm`XexcHmnR*B~5a|u-Qz$2lf zXc$p91T~E4psJxhf^rdR!b_XmNv*?}!PK9@-asDTaen;p{Rxsa=1E}4kZ*}yQPoT0 zvM}t!CpJvk<`m~^$^1C^o1yM(BzY-Wz2q7C^+wfg-?}1bF?5Hk?S{^#U%wX4&lv0j zkNb)byI+nql(&65xV?_L<0tj!KMHX8Hmh2(udEG>@OPQ}KPtdwEuEb$?acp~yT1&r z|7YU<(v!0as6Xff5^XbKQIR&MpjSE)pmub+ECMZzn7c!|hnm_Rl&H_oXWU2!h7hhf zo&-@cLkZr#eNgUN9>b=QLE1V^b`($EX3RQIyg#45A^=G!jMY`qJ z8qjZ$*-V|?y0=zIM>!2q!Gi*t4J5Otr^OT3XzQ_GjATc(*eM zqllux#QtHhc>YtnswBNiS^t(dTDn|RYSI%i%-|sv1wh&|9jfeyx|IHowW)6uZWR<%n8I}6NidBm zJ>P7#5m`gnXLu;?7jQZ!PwA80d|AS*+mtrU6z+lzms6^vc4)6Zf+$l+Lk3AsEK7`_ zQ9LsS!2o#-pK+V`g#3hC$6*Z~PD%cwtOT8;7K3O=gHdC=WLK-i_DjPO#WN__#YLX|Akw3LnqUJUw8&7pUR;K zqJ98?rKMXE(tnmT`#080w%l1bGno7wXHQbl?QFU=GoK@d!Ov=IgsdHd-iIs4ahcgSj(L@F96=LKZ zeb5cJOVlcKBudawbz~AYk@!^p+E=dT^UhPE`96Q5J~cT-8^tp`J43nLbFD*Nf!w;6 zs>V!5#;?bwYflf0HtFvX_6_jh4GEpa0_s8UUe02@%$w^ym&%wI5_APD?9S4r9O@4m zq^Z5Br8#K)y@z*fo08@XCs;wKBydn+60ks4Z>_+PFD+PVTGNPFPg-V-|``!0l|XrTyUYA@mY?#bJYvD>jX&$o9VAbo?>?#Z^c+Y4Dl zXU9k`s74Sb$OYh7^B|SAVVz*jEW&GWG^cP<_!hW+#Qp|4791Od=HJcesFo?$#0eWD z8!Ib_>H1WQE}shsQiUNk!uWOyAzX>r(-N7;+(O333_ES7*^6z4{`p&O*q8xk{0xy@ zB&9LkW_B}_Y&?pXP-OYNJfqEWUVAPBk)pTP^;f+75Wa(W>^UO_*J05f1k{ zd-}j!4m@q#CaC6mLsQHD1&7{tJ*}LtE{g9LB>sIT7)l^ucm8&+L0=g1E_6#KHfS>A_Z?;pFP96*nX=1&ejZ+XvZ=ML`@oVu>s^WIjn^SY}n zboeP%`O9|dhzvnw%?wAsCw*lvVcv%bmO5M4cas>b%FHd;A6Z%Ej%;jgPuvL$nk=VQ=$-OTwslYg zJQtDS)|qkIs%)K$+r*_NTke8%Rv&w^v;|Ajh5QXaVh}ugccP}3E^(oGC5VO*4`&Q0 z&)z$6i_aKI*CqVBglCxo#9>eOkDD!voCJRFkNolvA2N&SAp^4<8{Y;#Kr5740 za|G`dYGE!9NGU3Ge6C)YByb6Wy#}EN`Ao#R!$LQ&SM#hifEvZp>1PAX{CSLqD4IuO z4#N4AjMj5t2|!yTMrl5r)`_{V6DlqVeTwo|tq4MHLZdZc5;=v9*ibc;IGYh+G|~PB zx2}BAv6p$}?7YpvhqHu7L;~)~Oe^Y)O(G(PJQB<&2AhwMw!(2#AHhjSsBYUd8MDeM z+UXXyV@@cQ`w}mJ2PGs>=jHE{%i44QsPPh(=yorg>jHic+K+S*q3{th6Ik^j=@%xo zXfa9L_<|xTL@UZ?4H`$vt9MOF`|*z&)!mECiuenMW`Eo2VE#|2>2ET7th6+VAmU(o zq$Fz^TUB*@a<}kr6I>r;6`l%8NWtVtkE?}Q<<$BIm*6Z(1EhDtA29O%5d1$0q#C&f zFhFrrss{hOsISjYGDOP*)j&zZUf9`xvR8G)gwxE$HtmKsezo`{Ta~V5u+J&Tg+{bh zhLlNbdzJNF6m$wZNblWNbP6>dTWhngsu=J{);9D|PPJ96aqM4Lc?&6H-J1W15uIpQ ziO{&pEc2}-cqw+)w$`p(k(_yRpmbp-Xcd`*;Y$X=o(v2K+ISW)B1(ZnkV`g4rHQ=s z+J?F9&(||&86pi}snC07Lxi1ja>6kvnut;|Ql3fD)%k+ASe^S|lN69+Ek3UwsSx=2EH)t}K>~ z`Mz-SSVH29@DWyl`ChuGAkG>J;>8ZmLhm>uEmUvLqar~vK3lS;4s<{+ehMsFXM(l- zRt=HT>h9G)JS*&(dbXrM&z;)66C=o{=+^}ciyt8|@e$Y}IREAyd_!2|CqTg=eu}yG z@sI9T;Tjix*%v)c{4G84|0j@8wX^Iig_JsPU|T%(J&KtJ>V zsAR+dcmyT5k&&G{!)VXN`oRS{n;3qd`BgAE9r?%AHy_Gf8>$&X$=>YD7M911?<{qX zkJ;IOfY$nHdy@kKk_+X%g3`T(v|jS;>`pz`?>fqMZ>Fvbx1W=8nvtuve&y`JBfvU~ zr+5pF!`$`TUVsx3^<)48&+XT92U0DS|^X6FwSa-8yviRkZ*@Wu|c*lX!m?8&$0~4T!DB0@)n}ey+ew}T1U>|fH3=W5I!=nfoNs~OkzTY7^x^G&h>M7ewZqmZ=EL0}3#ikWg+(wuoA{7hm|7eJz zNz78l-K81tP16rai+fvXtspOhN-%*RY3IzMX6~8k9oFlXWgICx9dp;`)?Toz`fxV@&m8< z{lzWJG_Y(N1nOox>yG^uDr}kDX_f`lMbtxfP`VD@l$HR*B(sDeE(+T831V-3d3$+% zDKzKnK_W(gLwAK{Saa2}zaV?1QmcuhDu$)#;*4gU(l&rgNXB^WcMuuTki*rt>|M)D zoI;l$FTWIUp}euuZjDidpVw6AS-3dal2TJJaVMGj#CROWr|;^?q>PAo2k^u-27t~v zCv10IL~E)o*|QgdM!GJTaT&|A?oW)m9qk2{=y*7qb@BIAlYgDIe)k(qVH@)#xx6%7 z@)l%aJwz5Joc84Q2jRp71d;=a@NkjSdMyN%L6OevML^(L0_msbef>ewImS=+DgrTk z4ON%Y$mYgcZ^44O*;ctP>_7=}=pslsu>~<-bw=C(jeQ-X`kUo^BS&JDHy%#L32Cj_ zXRzDCfCXKXxGSW9yOGMMOYqPKnU zTF6gDj47!7PoL%z?*{1eyc2IVF*RXX?mj1RS}++hZg_%b@6&PdO)VzvmkXxJ*O7H} z6I7XmJqwX3<>z%M@W|GD%(X|VOZ7A+=@~MxMt8zhDw`yz?V>H%C0&VY+ZZ>9AoDVZeO1c~z$r~!H zA`N_9p`X?z>jm!-leBjW1R13_i2(0&aEY2$l_+-n#powuRO;n2Fr#%jp{+3@`h$c< zcFMr;18Z`UN#spXv+3Ks_V_tSZ1!FY7H(tdAk!v}SkoL9RPYSD3O5w>A3%>7J+C-R zZfDmu=9<1w1CV8rCMEm{qyErCUaA3Q zRYYw_z!W7UDEK)8DF}la9`}8z*?N32-6c-Bwx^Jf#Muwc67sVW24 zJ4nab%>_EM8wPhL=MAN)xx1tozAl zmhXN;*-X%)s>(L=Q@vm$qmuScku>PV(W_x-6E?SFRjSk)A1xVqnml_92fbj0m};UC zcV}lRW-r*wY106|sshV`n#RN{)D9=!>XVH0vMh>od=9!1(U+sWF%#B|eeaKI9RpaW z8Ol_wAJX%j0h5fkvF)WMZ1}?#R(n-OT0CtwsL)|qk;*(!a)5a5ku2nCR9=E*iOZ`9 zy4>LHKt-BgHL@R9CBSG!v4wK zvjF8DORRva)@>nshE~VM@i2c$PKw?3nz(6-iVde;-S~~7R<5r2t$0U8k2_<5C0!$j zQg#lsRYtI#Q1YRs(-%(;F-K7oY~!m&zhuU4LL}>jbLC>B`tk8onRRcmIm{{0cpkD|o@Ixu#x9Wm5J)3oFkbfi62BX8IX1}VTe#{C(d@H|#gy5#Sa#t>sH@8v1h8XFgNGs?)tyF_S^ueJX_-1%+LR`1X@C zS3Oc)o)!8Z9!u9d!35YD^!aXtH;IMNzPp`NS|EcdaQw~<;z`lmkg zE|tQRF7!S!UCsbag%XlQZXmzAOSs= zIUjgY2jcN9`xA6mzG{m|Zw=3kZC4@XY=Bj%k8%D&iadvne$pYNfZI$^2BAB|-MnZW zU4U?*qE3`ZDx-bH})>wz~)a z_SWM!E=-BS#wdrfh;EfPNOS*9!;*+wp-zDthj<>P0a2n?$xfe;YmX~5a;(mNV5nKx zYR86%WtAPsOMIg&*o9uUfD!v&4(mpS6P`bFohPP<&^fZzfA|SvVzPQgbtwwM>IO>Z z75ejU$1_SB1tn!Y-9tajZ~F=Fa~{cnj%Y|$;%z6fJV1XC0080f)Pj|87j142q6`i>#)BCIi+x&jAH9|H#iMvS~?w;&E`y zoarJ)+5HWmZ{&OqlzbdQU=SE3GKmnQq zI{h6f$C@}Mbqf#JDsJyi&7M0O2ORXtEB`#cZ;#AcB zkao0`&|iH8XKvZ_RH|VaK@tAGKMq9x{sdd%p-o`!cJzmd&hb86N!KKxp($2G?#(#BJn5%hF0(^`= z2qRg5?82({w-HyjbffI>eqUXavp&|D8(I6zMOfM}0;h%*D_Dr@+%TaWpIEQX3*$vQ z8_)wkNMDi{rW`L+`yN^J*Gt(l7PExu3_hrntgbW0s}7m~1K=(mFymoU87#{|t*fJ?w8&>Uh zcS$Ny$HNRbT!UCFldTSp2*;%EoW+yhJD8<3FUt8@XSBeJM2dSEz+5}BWmBvdYK(OA zlm`nDDsjKED{$v*jl(&)H7-+*#jWI)W|_X)!em1qpjS_CBbAiyMt;tx*+0P%*m&v< zxV9rlslu8#cS!of#^1O$(ds8aviMFiT`6W+FzMHW{YS+SieJ^?TQb%NT&pasw^kbc znd`=%(bebvrNx3#7vq@vAX-G`4|>cY0svIXopH02{v;GZ{wJM#psz4!m8(IZu<)9D zqR~U7@cz-6H{724_*}-DWwE8Sk+dYBb*O-=c z+wdchFcm6$$^Z0_qGnv0P`)h1=D$_eg8!2-|7Y;o*c)4ax!Me0*EVcioh{wI#!qcb z1&xhOotXMrlo7P6{+C8m;E#4*=8(2y!r0d<6 zKi$d2X;O*zS(&Xiz_?|`ympxITf|&M%^WHp=694g6W@k+BL_T1JtSYX0OZ}o%?Pzu zJ{%P8A$uq?4F!NWGtq>_GLK3*c6dIcGH)??L`9Av&0k$A*14ED9!e9z_SZd3OH6ER zg%5^)3^gw;4DFw(RC;~r`bPJOR}H}?2n60=g4ESUTud$bkBLPyI#4#Ye{5x3@Yw<* z;P5Up>Yn(QdP#momCf=kOzZYzg9E330=67WOPbCMm2-T1%8{=or9L8+HGL{%83lri zODB;Y|LS`@mn#Wmez7t6-x`a2{}U9hE|xY7|BVcFCqoAZQzsEi=dYHB z(bqG3J5?teVSBqTj{aiqe<9}}CEc$HdsJSMp#I;4(EXRy_k|Y8X#5hwkqAaIGKARF zX?$|UO{>3-FU;IlFi80O^t+WMNw4So2nsg}^T1`-Ox&C%Gn_AZ-49Nir=2oYX6 z`uVke@L5PVh)YsvAgFMZfKi{DuSgWnlAaag{RN6t6oLm6{4)H~4xg#Xfcq-e@ALk& z@UP4;uCe(Yjg4jaJZ4pu*+*?4#+XCi%sTrqaT*jNY7|WQ!oR;S8nt)cI27W$Sz!94 z01zoTW`C*P3E?1@6thPe(QpIue$A54gp#C7pmfwRj}GxIw$!!qQetn`nvuwIvMBQ; zfF8K-D~O4aJKmLbNRN1?AZsWY&rp?iy`LP^3KT0UcGNy=Z@7qVM(#5u#Du#w>a&Bs z@f#zU{wk&5n!YF%D11S9*CyaI8%^oX=vq$Ei9cL1&kvv9|8vZD;Mhs1&slm`$A%ED zvz6SQ8aty~`IYp2Xd~G$z%Jf4zwVPKkCtqObrnc2gHKj^jg&-NH|xdNK_;+2d4ZXw zN9j)`jcp7y65&6P@}LsD_OLSi(#GW#hC*qF5KpmeXuQDNS%ZYpuW<;JI<>P6ln!p@ z>KPAM>8^cX|2!n@tV=P)f2Euv?!}UM`^RJ~nTT@W>KC2{{}xXS{}WH{|3najkiEUj z7l;fUWDPCtzQ$?(f)6RvzW~Tqan$bXibe%dv}**BqY!d4J?`1iX`-iy8nPo$s4^mQ z5+@=3xuZAl#KoDF*%>bJ4UrEB2EE8m7sQn!r7Z-ggig`?yy`p~3;&NFukc$`_>?}a z?LMo2LV^n>m!fv^HKKRrDn|2|zk?~S6i|xOHt%K(*TGWkq3{~|9+(G3M-L=;U-YRa zp{kIXZ8P!koE;BN2A;nBx!={yg4v=-xGOMC#~MA07zfR)yZtSF_2W^pDLcXg->*WD zY7Sz5%<_k+lbS^`y)=vX|KaN!gEMQob|(`%nP6huwr$%^?%0^vwr$(CZQD*Jc5?E( zb-q9E`OfoWSJ$rUs$ILfSFg3Mb*-!Ozgaz^%7ZkX@=3km0G;?+e?FQT_l5A9vKr<> z_CoemDo@6YIyl57l*gnJ^7+8xLW5oEGzjLv2P8vj*Q%O1^KOfrsC6eHvk{+$BMLGu z%goP8UY?J7Lj=@jcI$4{m2Sw?1E%_0C7M$lj}w{E#hM4%3QX|;tH6>RJf-TI_1A0w z@KcTEFx(@uitbo?UMMqUaSgt=n`Bu*;$4@cbg9JIS})3#2T;B7S

Z?HZkSa`=MM?n)?|XcM)@e1qmzJ$_4K^?-``~Oi&38`2}sjmP?kK z$yT)K(UU3fJID@~3R;)fU%k%9*4f>oq`y>#t90$(y*sZTzWcW$H=Xv|%^u^?2*n)Csx;35O0v7Nab-REgxDZNf5`cI69k$` zx(&pP6zVxlK5Apn5hAhui}b)(IwZD}D?&)_{_yTL7QgTxL|_X!o@A`)P#!%t9al+# zLD(Rr+?HHJEOl545~m1)cwawqY>cf~9hu-L`crI^5p~-9Mgp9{U5V&dJSwolnl_CM zwAMM1Tl$D@>v?LN2PLe0IZrQL1M zcA%i@Lc)URretFJhtw7IaZXYC6#8slg|*HfUF2Z5{3R_tw)YQ94=dprT`SFAvHB+7 z)-Hd1yE8LB1S+4H7iy$5XruPxq6pc_V)+VO{seA8^`o5{T5s<8bJ`>I3&m%R4cm1S z`hoNk%_=KU2;+#$Y!x7L%|;!Nxbu~TKw?zSP(?H0_b8Qqj4EPrb@~IE`~^#~C%D9k zvJ=ERh`xLgUwvusQbo6S=I5T+?lITYsVyeCCwT9R>DwQa&$e(PxF<}RpLD9Vm2vV# zI#M%ksVNFG1U?;QR{Kx2sf>@y$7sop6SOnBC4sv8S0-`gEt0eHJ{`QSW(_06Uwg*~ zIw}1dZ9c=K$a$N?;j`s3>)AqC$`ld?bOs^^stmYmsWA$XEVhUtGlx&OyziN1~2 z)s5fD(d@gq7htIGX!GCxKT=8aAOHW&DAP=$MpZ)SpeEZhk83}K) z0(Uv)+&pE?|4)D2PX4r6gOGHDY}$8FSg$3eDb*nEVmkFQ#lFpcH~IPeatiH3nPTkP z*xDN7l}r2GM9jwSsl=*!547nRPCS0pb;uE#myTqV+=se>bU=#e)f2}wCp%f-cIrh`FHA$2`monVy?qvJ~o2B6I7IE28bCY4=c#^){*essLG zXUH50W&SWmi{RIG9G^p;PohSPtC}djjXSoC)kyA8`o+L}SjE{i?%;Vh=h;QC{s`T7 zLmmHCr8F}#^O8_~lR)^clv$mMe`e*{MW#Sxd`rDckCnFBo9sC*vw2)dA9Q3lUi*Fy zgDsLt`xt|7G=O6+ms=`_FpD4}37uvelFLc^?snyNUNxbdSj2+Mpv<67NR{(mdtSDNJ3gSD@>gX_7S5 zCD)JP5Hnv!llc-9fwG=4@?=%qu~(4j>YXtgz%gZ#+A9i^H!_R!MxWlFsH(ClP3dU} za&`m(cM0xebj&S170&KLU%39I+XVWOJ_1XpF^ip}3|y()Fn5P@$pP5rvtiEK6w&+w z7uqIxZUj$#qN|<_LFhE@@SAdBy8)xTu>>`xC>VYU@d}E)^sb9k0}YKr=B8-5M?3}d z7&LqQWQ`a&=ihhANxe3^YT>yj&72x#X4NXRTc#+sk;K z=VUp#I(YIRO`g7#;5))p=y=MQ54JWeS(A^$qt>Y#unGRT$0BG=rI(tr>YqSxNm+-x z6n;-y8B>#FnhZX#mhVOT30baJ{47E^j-I6EOp;am;FvTlYRR2_?CjCWY+ypoUD-2S zqnFH6FS+q$H$^7>>(nd^WE+?Zn#@HU3#t|&=JnEDgIU+;CgS+krs+Y8vMo6U zHVkPoReZ-Di3z!xdBu#aW1f{8sC)etjN90`2|Y@{2=Os`(XLL9+ z1$_PE$GgTQrVx`^sx=Y(_y-SvquMF5<`9C=vM52+e+-r=g?D z+E|97MyoaK5M^n1(mnWeBpgtMs8fXOu4Q$89C5q4@YY0H{N47VANA1}M2e zspor6LdndC=kEvxs3YrPGbc;`q}|zeg`f;t3-8na)dGdZ9&d(n{|%mNaHaKJOA~@8 zgP?nkzV-=ULb)L3r`p)vj4<702a5h~Y%byo4)lh?rtu1YXYOY+qyTwzs!59I zL}XLe=q$e<+Wm7tvB$n88#a9LzBkgHhfT<&i#%e*y|}@I z!N~_)vodngB7%CI2pJT*{GX|cI5y>ZBN)}mezK~fFv@$*L`84rb0)V=PvQ2KN}3lTpT@$>a=CP?kcC0S_^PZ#Vd9#CF4 zP&`6{Y!hd^qmL!zr#F~FB0yag-V;qrmW9Jnq~-l>Sg$b%%TpO}{Q+*Pd-@n2suVh_ zSYP->P@# z&gQ^f{?}m(u5B9xqo63pUvDsJDQJi5B~ak+J{tX8$oL!_{Dh zL@=XFzWb+83H3wPbTic+osVp&~UoW3SqK0#P6+BKbOzK65tz)-@AW#g}Ew+pE3@ zVbdJkJ}EM@-Ghxp_4a)|asEk* z5)mMI&EK~BI^aaTMRl)oPJRH^Ld{;1FC&#pS`gh;l3Y;DF*`pR%OSz8U@B@zJxPNX zwyP_&8GsQ7^eYyUO3FEE|9~I~X8;{WTN=DJW0$2OH=3-!KZG=X6TH?>URr(A0l@+d zj^B9G-ACel;yYGZc}G`w9sR$Mo{tzE7&%XKuW$|u7DM<6_z}L>I{o`(=!*1 z{5?1p3F^aBONr6Ws!6@G?XRxJxXt_6b}2%Bp=0Iv5ngnpU^P+?(?O0hKwAK z*|wAisG&8&Td1XY+6qI~-5&+4DE2p|Dj8@do;!40o)F)QuoeUY;*I&QZ0*4?u)$s`VTkNl1WG`}g@J_i zjjmv4L%g&>@U9_|l>8^CN}`@4<D2aMN&?XXD-HNnsVM`irjv$ z^YVNUx3r1{-o6waQfDp=OG^P+vd;qEvd{UUYc;gF0UwaeacXkw32He^qyoYHjZeFS zo(#C9#&NEdFRcFrj7Q{CJgbmDejNS!H%aF6?;|KJQn_*Ps3pkq9yE~G{0wIS*mo0XIEYH zzIiJ>rbmD;sGXt#jlx7AXSGGcjty)5z5lTGp|M#5DCl0q0|~pNQ%1dP!-1>_7^BA~ zwu+uumJmTCcd)r|Hc)uWm7S!+Dw4;E|5+bwPb4i17Ued>NklnnsG+A{T-&}0=sLM- zY;sA9v@YH>b9#c$Vg{j@+>UULBX=jtu~N^%Y#BB5)pB|$?0Mf7msMD<7eACoP1(XY zPO^h5Brvhn$%(0JSo3KFwEPV&dz8(P41o=mo7G~A*P6wLJ@-#|_A z7>k~4&lbqyP1!la!qmhFBfIfT?nIHQ0j2WlohXk^sZ`?8-vwEwV0~uu{RDE^0yfl$ znua{^`VTZ)-h#ch_6^e2{VPaE@o&55|3dx$z_b6gbqduXJ(Lz(zq&ZbJ6qA4Ac4RT zhJO4KBLN!t;h(eW(?cZJw^swf8lP@tWMZ8GD)zg)siA3!2EJYI(j>WI$=pK!mo!Ry z?q&YkTIbTTr<>=}+N8C_EAR0XQL2&O{nNAXb?33iwo8{M``rUHJgnk z8KgZzZLFf|(O6oeugsm<;5m~4N$2Jm5#dph*@TgXC2_k&d%TG0LPY=Fw)=gf(hy9QmY*D6jCAiq44 zo-k2C+?3*+Wu7xm1w*LEAl`Vsq(sYPUMw|MiXrW)92>rVOAse5Pmx^OSi{y%EwPAE zx|csvE{U3c{vA>@;>xcjdCW15pE31F3aoIBsz@OQRvi%_MMfgar2j3Ob`9e@gLQk# zlzznEHgr|Ols%f*a+B-0klD`czi@RWGPPpR1tE@GB|nwe`td1OwG#OjGlTH zfT#^r?%3Ocp^U0F8Kekck6-Vg2gWs|sD_DTJ%2TR<5H3a$}B4ZYpP=p)oAoHxr8I! z1SYJ~v-iP&mNm{ra7!KP^KVpkER>-HFvq*>eG4J#kz1|eu;=~u2|>}TE_5nv2=d!0 z3P~?@blSo^uumuEt{lBsGcx{_IXPO8s01+7DP^yt&>k;<5(NRrF|To2h7hTWBFQ_A z+;?Q$o5L|LlIB>PH(4j)j3`JIb1xA_C@HRFnPnlg{zGO|-RO7Xn}!*2U=Z2V?{5Al z9+iL+n^_T~6Uu{law`R&fFadSVi}da8G>|>D<{(#vi{OU;}1ZnfXy8=etC7)Ae<2S zAlI`&=HkNiHhT0|tQztSLNsRR6v8bmf&$6CI|7b8V4kyJ{=pG#h{1sVeC28&Ho%Fh zwo_FIS}ST-2OF6jNQ$(pjrq)P)@sie#tigN1zSclxJLb-O9V|trp^G8<1rpsj8@+$ z2y27iiM>H8kfd%AMlK|9C>Lkvfs9iSk>k2}tCFlqF~Z_>-uWVQDd$5{3sM%2$du9; z*ukNSo}~@w@DPF)_vS^VaZ)7Mk&8ijX2hNhKom$#PM%bzSA-s$ z0O!broj`!Nuk)Qcp3(>dL|5om#XMx2RUSDMDY9#1|+~fxwP}1I4iYy4j$CGx3jD&eKhf%z`Jn z7mD!y6`nVq%&Q#5yqG`|+e~1$Zkgu!O(~~pWSDTw2^va3u!DOMVRQ8ycq)sk&H%vb z;$a`3gp74~I@swI!ILOkzVK3G&SdTcVe~RzN<+z`u(BY=yuwez{#T3a_83)8>2!X?`^02zVjqx-fN+tW`zCqH^XG>#Ies$qxa!n4*FF0m zxgJlPPYl*q4ylX;DVu3G*I6T&JyWvs`A(*u0+62=+ylt2!u)6LJ=Qe1rA$OWcNCmH zLu7PwMDY#rYQA1!!ONNcz~I^uMvi6N&Lo4dD&HF?1Su5}COTZ-jwR)-zLq=6@bN}X zSP(-MY`TOJ@1O`bLPphMMSWm+YL{Ger>cA$KT~)DuTl+H)!2Lf`c+lZ0ipxd>KfKn zIv;;eEmz(_(nwW24a+>v{K}$)A?=tp+?>zAmfL{}@0r|1>iFQfJ5C*6dKdijK=j16 zQpl4gl93ttF5@d<9e2LoZ~cqkH)aFMgt(el_)#OG4R4Hnqm(@D*Uj>2ZuUCy)o-yy z_J|&S-@o5#2IMcL(}qWF3EL<4n(`cygenA)G%Ssi7k4w)LafelpV5FvS9uJES+(Ml z?rzZ={vYrB#mB-Hd#ID{KS5dKl-|Wh_~v+Lvq3|<@w^MD-RA{q!$gkUUNIvAaex5y z)jIGW{#U=#UWyku7FIAB=TES8>L%Y9*h2N`#Gghie+a?>$CRNth?ORq)!Tde24f5K zKh>cz5oLC;ry*tHIEQEL>8L=zsjG7+(~LUN5K1pT`_Z-4Z}k^m%&H%g3*^e(FDCC{ zBh~eqx%bY?qqu_2qa+9A+oS&yFw^3nLRsN#?FcZvt?*dZhRC_a%Jd{qou(p5AG_Q6 ziOJMu8D~kJ7xEkG(69$Dl3t1J592=Olom%;13uZvYDda08YwzqFlND-;YodmA!SL) z!AOSI=(uCnG#Yo&BgrH(muUemmhQW7?}IHfxI~T`44wuLGFOMdKreQO!a=Z-LkH{T z@h;`A_l2Pp>Xg#`Vo@-?WJn-0((RR4uKM6P2*^-qprHgQhMzSd32@ho>%fFMbp9Y$ zx-#!r8gEu;VZN(fDbP7he+Nu7^o3<+pT!<<>m;m z=FC$N)wx)asxb_KLs}Z^;x*hQM}wQGr((&=%+=#jW^j|Gjn$(qqXwt-o-|>kL!?=T zh0*?m<^>S*F}kPiq@)Cp+^fnKi2)%<-Tw4K3oHwmI-}h}Kc^+%1P!D8aWp!hB@-ZT zybHrRdeYlYulEj>Bk zEIi|PU0eGg&~kWQ{q)gw%~bFT0`Q%k5S|tt!JIZXVXX=>er!7R^w>zeQ%M-(C|eOQG>5i|}i3}X#?aqAg~b1t{-fqwKd(&CyA zmyy)et*E}+q_lEqgbClewiJ=u@bFX}LKe)5o26K9fS;R`!er~a?lUCKf60`4Zq7{2q$L?k?IrAdcDu+ z4A0QJBUiGx&$TBASI2ASM_Wj{?fjv=CORO3GZz;1X*AYY`anM zI`M6C%8OUFSc$tKjiFJ|V74Yj-lK&Epi7F^Gp*rLeDTokfW#o6sl33W^~4V|edbS1 zhx%1PTdnI!C96iYqSA=qu6;p&Dd%)Skjjw0fyl>3k@O?I@x5|>2_7G#_Yc2*1>=^# z|H43bJDx$SS2!vkaMG!;VRGMbY{eJhT%FR{(a+RXDbd4OT?DRoE(`NhiVI6MsUCsT z1gc^~Nv>i;cIm2~_SYOfFpkUvV)(iINXEep;i4>&8@N#|h+_;DgzLqh3I#lzhn>cN zjm;m6U{+JXR2Mi)=~WxM&t9~WShlyA$Pnu+VIW2#;0)4J*C!{1W|y1TP{Q;!tldR< zI7aoH&cMm*apW}~BabBT;`fQ1-9q|!?6nTzmhiIo6fGQlcP{pu)kJh- zUK&Ei9lArSO6ep_SN$Lt_01|Y#@Ksznl@f<+%ku1F|k#Gcwa`(^M<2%M3FAZVb99?Ez4d9O)rqM< zCbYsdZlSo{X#nKqiRA$}XG}1Tw@)D|jGKo1ITqmvE4;ovYH{NAk{h8*Ysh@=nZFiF zmDF`@4do#UDKKM*@wDbwoO@tPx4aExhPF_dvlR&dB5>)W=wG6Pil zq{eBzw%Ov!?D+%8&(uK`m7JV7pqNp-krMd>ECQypq&?p#_3wy){eW{(2q}ij{6bfmyE+-ZO z)G4OtI;ga9;EVyKF6v3kO1RdQV+!*>tV-ditH-=;`n|2T zu(vYR*BJSBsjzFl1Oy#DpL=|pfEY4NM;y5Yly__T*Eg^3Mb_()pHwn)mAsh!7Yz-Z zY`hBLDXS4F^{>x=oOphq|LMo;G!C(b2hS9A6lJqb+e$2af}7C>zW2p{m18@Bdd>iL zoEE$nFUnaz_6p${cMO|;(c1f9nm5G5R;p)m4dcC1?1YD=2Mi&20=4{nu>AV#R^d%A zsmm_RlT#`;g~an9mo#O1dYV)2{mgUWEqb*a@^Ok;ckj;uqy{%*YB^({d{^V)P9VvP zC^qbK&lq~}TWm^RF8d4zbo~bJuw zFV!!}b^4BlJ0>5S3Q>;u*BLC&G6Fa5V|~w&bRZ*-YU>df6%qAvK?%Qf+#=M-+JqLw&w*l4{v7XTstY4j z26z69U#SVzSbY9HBXyD;%P$#vVU7G*Yb-*fy)Qpx?;ed;-P24>-L6U+OAC9Jj63kg zlY`G2+5tg1szc#*9ga3%f9H9~!(^QjECetX-PlacTR+^g8L<#VRovPGvsT)ln3lr= zm5WO@!NDuw+d4MY;K4WJg3B|Sp|WdumpFJO>I2tz$72s4^uXljWseYSAd+vGfjutO z-x~Qlct+BnlI+Iun)fOklxPH?30i&j9R$6g5^f&(x7bIom|FLKq9CUE);w2G>}vye zxWvEaXhx8|~2j)({Rq>0J9}lzdE`yhQ(l$z! z;x%d%_u?^4vlES_>JaIjJBN|N8z5}@l1#PG_@{mh`oWXQOI41_kPG}R_pV+jd^PU) zEor^SHo`VMul*80-K$0mSk|FiI+tHdWt-hzt~S>6!2-!R&rdL_^gGGUzkPe zEZkUKU=EY(5Ex)zeTA4-{Bkbn!Gm?nuaI4jLE%X;zMZ7bwn4FXz(?az;9(Uv;38U6 zi)}rA3xAcD2&6BY<~Pj9Q1~4Dyjs&!$)hyHiiTI@%qXd~+>> zW}$_puSSJ^uWv$jtWakn}}@eX6_LGz|7M#$!3yjY ztS{>HmQ%-8u0@|ig{kzD&CNK~-dIK5e{;@uWOs8$r>J7^c2P~Pwx%QVX0e8~oXK0J zM4HCNK?%t6?v~#;eP#t@tM$@SXRt;(b&kU7uDzlzUuu;+LQ5g%=FqpJPGrX8HJ8CS zITK|(fjhs3@CR}H4@)EjL@J zV_HPexOQ!@k&kvsQG)n;7lZaUh>{87l4NS_=Y-O9Ul3CaKG8iy+xD=QXZSr57a-hb z7jz3Ts-NVsMI783OPEdlE|e&a2;l^h@e>oYMh5@=Lte-9A+20|?!9>Djl~{XkAo>0p9`n&nfWGdGAfT-mSYW z1cvG>GT9dRJdcm7M_AG9JX5AqTCdJ6MRqR3p?+FvMxp(oB-6MZ`lRzSAj%N(1#8@_ zDnIIo9Rtv12(Eo}k_#FILhaZQ`yRD^Vn5tm+IK@hZO>s=t5`@p1#k?Umz2y*R64CF zGM-v&*k}zZ%Xm<_?1=g~<*&3KAy;_^QfccIp~CS7NW24Tn|mSDxb%pvvi}S}(~`2# z3I|kD@||l@lAW06K2%*gHd4x9YKeXWpwU%!ozYcJ+KJeX!s6b94j!Qyy7>S!wb?{qaMa`rpbU1phn0EpF}L zsBdZc|Im#iRiQmJjZwb5#n;`_O{$Zu$I zMXqbfu0yVmt!!Y`Fzl}QV7HUSOPib#da4i@vM$0u2FEYytsvrbR#ui9lrMkZ(AVVJ zMVl^Wi_fSRsEXLA_#rdaG%r(@UCw#o7*yBN)%22b)VSNyng6Lxk|2;XK3Qb=C_<`F zN##8MLHz-s%&O6JE~@P1=iHpj8go@4sC7*AWe99tuf$f7?2~wC&RA^UjB*2`K!%$y zSDzMd7}!vvN|#wDuP%%nuGk8&>N)7eRxtqdMXHD1W%hP7tYW{W>^DJp`3WS>3}i+$ z_li?4AlEj`r=!SPiIc+NNUZ9NCrMv&G0BdQHBO&S7d48aB)LfGi@D%5CC1%)1hVcJ zB~=yNC}LBn(K?cHkPmAX$5^M7JSnNkcc!X!0kD&^F$cJmRP(SJ`9b7}b)o$rj=BZ- zC;BX3IG94%Qz&(V$)7O~v|!=jd-yU1(6wd1u;*$z4DDe6+BFLhz>+8?59?d2Ngxck zm92yR!jk@MP@>>9FtAY2L+Z|MaSp{MnL-;fm}W3~fg!9TRr3;S@ysLf@#<)keHDRO zsJI1tP`g3PNL`2(8hK3!4;r|E-ZQbU0e-9u{(@du`4wjGj|A!QB&9w~?OI1r}M? zw)6tvsknfPfmNijZ;3VZX&HM6=|&W zy6GIe3a?_(pRxdUc==do9?C&v7+6cgIoL4)Ka^bOG9`l;S|QmVzjv%)3^PDi@=-cp z=!R0bU<@_;#*D}e1m@0!%k=VPtyRAkWYW(VFl|eu0LteWH7eDB%P|uF7BQ-|D4`n; z)UpuY1)*s32UwW756>!OoAq#5GAtfrjo*^7YUv^(eiySE?!TQzKxzqXE@jM_bq3Zq zg#1orE*Zd5ZWEpDXW9$=NzuadNSO*NW)ZJ@IDuU`w}j_FRE4-QS*rD4mPVQPH(jGg z+-Ye?3%G%=DT5U1b+TnNHHv(nz-S?3!M4hXtEB@J4WK%%p zkv=Bb`1DHmgUdYo>3kwB(T>Ba#DKv%cLp2h4r8v}p=Np}wL!&PB5J-w4V4REM{kMD z${oSuAw9?*yo3?tNp~X5WF@B^P<6L0HtIW0H7^`R8~9zAXgREH`6H{ntGu$aQ;oNq zig;pB^@KMHNoJcEb0f1fz+!M6sy?hQjof-QoxJgBM`!k^T~cykcmi^s_@1B9 z)t1)Y-ZsV9iA&FDrVoF=L7U#4&inXk{3+Xm9A|R<=ErgxPW~Fq zqu-~x0dIBlR+5_}`IK^*5l3f5$&K@l?J{)_d_*459pvsF*e*#+2guls(cid4!N%DG zl3(2`az#5!^@HNRe3O4(_5nc+){q?ENQG2|uKW0U0$aJ5SQ6hg>G4OyN6os76y%u8qNNHi;}XnRNwpsfn^!6Qt(-4tE`uxaDZ`hQp#aFX373|F?vjEiSEkV>K)cTBG+UL#wDj0_ zM9$H&-86zP=9=5_Q7d3onkqKNr4PAlF<>U^^yYAAEso|Ak~p$3NNZ$~4&kE9Nj^As zQPoo!m*uZ;z1~;#g(?zFECJ$O2@EBy<;F)fnQxOKvH`MojG5T?7thbe%F@JyN^k1K zn3H*%Ymoim)ePf)xhl2%$T)vq3P=4ty%NK)@}po&7Q^~o3l))Zm4<75Y!fFihsXJc z9?vecovF^nYfJVg#W~R3T1*PK{+^YFgb*7}Up2U#)oNyzkfJ#$)PkFxrq_{Ai?0zk zWnjq_ixF~Hs7YS9Y6H&8&k0#2cAj~!Vv4{wCM zi2f1FjQf+F@=BOB)pD|T41a4AEz+8hnH<#_PT#H|Vwm7iQ0-Tw()WMN za0eI-{B2G{sZ7+L+^k@BA)G;mOFWE$O+2nS|DzPSGZ)ede(9%+8kqu4W^wTn!yZPN z7u!Qu0u}K5(0euRZ$7=kn9DZ+llruq5A_l) zOK~wof7_^8Yeh@Qd*=P!gM)lh`Z@7^M?k8Z?t$$vMAuBG>4p56Dt!R$p{)y>QG}it zGG;Ei```7ewXrbGo6Z=!AJNQ!GP8l13m7|FIQTFZTpIg#kpZkl1wj)s1eySXjAAWy zfl;;@{QQ;Qnb$@LY8_Z&7 z6+d98F?z2Zo)sS)z$YoL(zzF>Ey8u#S_%n7)XUX1Pu(>e8gEUU1S;J=EH(#`cWi1+ zoL$5TN+?#NM8=4E7HOk)bf5MXvEo%he5QcB%_5YQ$cu_j)Pd^@5hi}d%nG}x9xXtD-JMQxr;KkC=r_dS-t`lf zF&CS?Lk~>U^!)Y0LZqNVJq+*_#F7W~!UkvZfQhzvW`q;^X&iv~ zEDDGIQ&(S;#Hb(Ej4j+#D#sDS_uHehlY0kZsQpktc?;O z22W1b%wNcdfNza<1M2{*mAkM<{}@(w`VuQ<^lG|iYSuWBD#lYK9+jsdA+&#;Y@=zXLVr840Nq_t5))#7}2s9pK* zg42zd{EY|#sIVMDhg9>t6_Y#O>JoG<{GO&OzTa;iA9&&^6=5MT21f6$7o@nS=w;R) znkgu*7Y{UNPu7B9&B&~q+N@@+%&cO0N`TZ-qQ|@f@e0g2BI+9xO$}NzMOzEbSSJ@v z1uNp(S z-dioXc$5YyA6-My@gW~1GH($Q?;GCHfk{ej-{Q^{iTFs1^Sa67RNd5y{cjX1tG+$& zbGrUte{U1{^Z_qpzW$-V!pJz$dQZrL5i(1MKU`%^= z^)i;xua4w)evDBrFVm)Id5SbXMx2u7M5Df<2L4B`wy4-Y+Wec#b^QJO|J9xF{x#M8 zuLUer`%ZL^m3gy?U&dI+`kgNZ+?bl3H%8)&k84*-=aMfADh&@$xr&IS|4{3$v&K3q zZTn&f{N(#L6<-BZYNs4 zB*Kl*@_IhGXI^_8zfXT^XNmjJ@5E~H*wFf<&er?p7suz85)$-Hqz@C zGMFg1NKs;otNViu)r-u{SOLcqwqc7$poPvm(-^ag1m71}HL#cj5t4Hw(W?*fi4GSH z9962NZ>p^ECPqVc$N}phy>N8rQsWWm%%rc5B4XLATFEtffX&TM2%|8S2Lh_q; zCytXua84HBnSybW-}(j z3Zwv4CaK)jC!{oUvdsFRXK&Sx@t)yGm(h65$!WZ!-jL52no}NX6=E<=H!aZ74h_&> zZ+~c@k!@}Cs84l{u+)%kg4fq~pOeTK3S4)gX~FKJw4t9ba!Ai{_gkKQYQvafZIyKq zX|r4xgC(l%JgmW!tvR&yNt$6uME({M`uNIi7HFiPEQo_UMRkl~12&4c& z^se;dbZWKu7>dLMg`IZq%@b@ME?|@{&xEIZEU(omKNUY? z`JszxNghuO-VA;MrZKEC0|Gi0tz3c#M?aO?WGLy64LkG4T%|PBIt_?bl{C=L@9e;A zia!35TZI7<`R8hr06xF62*rNH5T3N0v^acg+;ENvrLYo|B4!c^eILcn#+lxDZR!%l zjL6!6h9zo)<5GrSPth7+R(rLAW?HF4uu$glo?w1U-y}CR@%v+wSAlsgIXn>e%bc{FE;j@R0AoNIWf#*@BSngZ)HmNqkB z)cs3yN%_PT4f*K+Y1wFl)be=1iq+bb1G-}b|72|gJ|lMt`tf~0Jk}zMbS0+M-Mq}R z>Bv}-W6J%}j#dIz`Z0}zD(DGKn`R;E8A`)$a6qDfr(c@iHKZcCVY_nJEDpcUddGH* z*ct2$&)RelhmV}@jGXY>3Y~vp;b*l9M+hO}&x`e~q*heO8GVkvvJTwyxFetJC8VnhjR`5*+qHEDUNp16g`~$TbdliLLd}AFf}U+Oda1JXwwseRFbj?DN96;VSX~z?JxJSuA^BF}262%Z0)nv<6teKK`F zfm9^HsblS~?Xrb1_~^=5=PD!QH$Y1hD_&qe1HTQnese8N#&C(|Q)CvtAu6{{0Q%ut8ESVdn&& z4y%nsCs!$(#9d{iVjXDR##3UyoMNeY@_W^%qyuZ^K3Oa4(^!tDXOUS?b2P)yRtJ8j zSX}@qGBj+gKf;|6Kb&rq`!}S*cSu-3&S>=pM$eEB{K>PP~I}N|uGE|`3U#{Q6v^kO4nIsaq zfPld}c|4tVPI4!=!ETCNW+LjcbmEoxm0RZ%ieV0`(nVlWKClZW5^>f&h79-~CF(%+ zv|KL(^xQ7$#a}&BSGr9zf{xJ(cCfq>UR*>^-Ou_pmknCt6Y--~!duL{k2D{yLMl__ z!KeMRRg&EsD2s|cmy?xgK&XcGIKeos`&UEVhBTw;mqy|8DlP1M7PYS2z{YmTJ;n!h znPe(Qu?c7+xZz!Tm1AnE8|;&tf7fW$2dArX7ck1Jd(S1+91YB8bjISRZ`UL*?vb{b zMp*!Xq7VaLc0Ogqj5qmop8NREQ{9_iC$;tviZlubGLy1jLlIFBxAymMr@SDLAcx+) z5YRkl$bW**X)W0JzWNcLx9>fTqJj00ipY6Ua?mUlsgQrVVgpmaheE;RgA5U_+WsPh z9+X|PU4zFyNxZ2?Q+V`Mo{xH~(m}OMRZa<&$nCl7o4x`^^|V4?aPz8#KwFm=8T6_} z8=P_4$_rD2a%7}}HT6VQ>ZGKW=QF7zI-2=6oBNZR$HVn|gq`>l$HZ`48lkM7%R$>MS& zghR`WZ9Xrd_6FaDedH6_aKVJhYev*2)UQ>!CRH3PQ_d9nXlO;c z9PeqiKD@aGz^|mvD-tV<{BjfA;)B+76!*+`$CZOJ=#)}>{?!9fAg(Xngbh||n=q*C zU0mGP`NxHn$uY#@)gN<0xr)%Ue80U{-`^FX1~Q@^>WbLraiB|c#4v$5HX)0z!oA#jOXPyWg! z8EC}SBmG7j3T&zCenPLYA{kN(3l62pu}91KOWZl? zg~>T4gQ%1y3AYa^J|>ba$7F5KlVx}_&*~me*q-SYLBCXZFU=U8mHQD4K!?;B61NoX z?VS41SS&jHyhmB~+bC=w0a06V``ZXCkC~}oM9pM{$hU~-s_elYPmT1L!%B`?*<+?( zFQ@TP%y+QL`_&Y0A3679pe5~iL=z)$b)k!oSbJRyw+K};SGAvvE=|<~*aiwJc?uE@2?7a1i9|3=^N%*9smt3ZIhjY>gIsr{Q2rX(NovZ7I1n^V{ z#~(1ze-%`C>fM`^hCV**9BA-04lNuu&3=reevNOMwmX(A{yh`^c8%0mjAKMj{Th05 zXrM(zILwyL-Pcdw^(=gj(ZLVMA95zlzmLa^skb8tQq%8SV&4vp?S>L3+P4^tp`$xA zr38jBw0ItR`VbO5vB1`<3d})}aorkIU1z3*ifYN&Lpp)}|}QJS60th_v-EEkAM zyOREuj!Ou|pVeZEWg;$Hf!x;xAmFu7gB^UR$=L0BuZ~thLC@#moJ(@@wejR|`t_K@ zuQ{XmpAWz%o&~2dk!SIGR$EmpZY)@+r^gvX26%)y>1u2bt~JUPTQzQu&_tB)|{19)&n$m5Fhw0A-8S1^%XpAD%`#a z_ModVxsM|x!m3N1vRt_XEL`O-+J3cMsM1l*dbjT&S0c@}Xxl3I&AeMNT97G3c6%3C zbrZS?2EAKcEq@@Pw?r%eh0YM6z0>&Qe#n+e9hEHK?fzig3v5S#O2IxVLu;a>~c~ZfHVbgLox%_tg)bsC8Rl35P=Jhl+Y=w6zb$ z;*uO%i^U z^mp_QggBILLF$AyjPD41Z0SFdbDj&z&xjq~X|OoM7bCuBfma1CEd!4RKGqPR)K)e}+7^JfFUI_fy63cMyq#&)Z*#w18{S zhC@f9U5k#2S2`d$-)cEoH-eAz{2Qh>YF1Xa)E$rWd52N-@{#lrw3lRqr)z?BGThgO z-Mn>X=RPHQ)#9h{3ciF)<>s{uf_&XdKb&kC!a373l2OCu&y8&n#P%$7YwAVJ_lD-G zX7tgMEV8}dY^mz`R6_0tQ5Eu@CdSOyaI63Vb*mR+rCzxgsjCXLSHOmzt0tA zGoA0Cp&l>rtO@^uQayrkoe#d2@}|?SlQl9W{fmcxY(0*y zHTZ6>FL;$8FEzbb;M(o%mBe-X?o<0+1dH?ZVjcf8)Kyqb07*a zLfP1blbt)=W)TN}4M#dUnt8Gdr4p$QRA<0W)JhWLK3-g82Q~2Drmx4J z;6m4re%igus136VL}MDI-V;WmSfs4guF_(7ifNl#M~Yx5HB!UF)>*-KDQl0U?u4UXV2I*qMhEfsxb%87fi+W;mW5{h?o8!52}VUs*Fpo#aSuXk(Ug z>r>xC#&2<9Uwmao@iJQ|{Vr__?eRT2NB$OcoXQ-jZ{t|?Uy{7q$nU-i|&-R6fHPWJDgHZ69iVbK#Ab@2@y zPD*Gj=hib?PWr8NGf;g$o5I!*n>94Z!IfqRm zLvM>Gx$Y*rEL3Z-+lS42=cnEfXR)h1z`h8a+I%E_ss%qXsrgIV%qv9d|KT>fV5=3e zw>P#ju>2naGc{=6!)9TeHq$S9Pk|>$UCEl}H}lE@;0(jbNT9TXUXyss>al>S4DuGi zVCy;Qt=a2`iu2;TvrIkh2NTvNV}0)qun~9y1yEQMdOf#V#3(e(C?+--8bCsJu={Q1z5qNJIk&yW>ZnVm;A=fL~29lvXQ*4j(SLau?P zi8LC7&**O!6B6=vfY%M;!p2L2tQ+w3Y!am{b?14E`h4kN$1L0XqT5=y=DW8GI_yi% zlIWsjmf0{l#|ei>)>&IM4>jXH)?>!fK?pfWIQn9gT9N(z&w3SvjlD|u*6T@oNQRF6 zU5Uo~SA}ml5f8mvxzX>BGL}c2#AT^6Lo-TM5XluWoqBRin$tiyRQK0wJ!Ro+7S!-K z=S95p-(#IDKOZsRd{l65N(Xae`wOa4Dg9?g|Jx97N-7OfHG(rN#k=yNGW0K$Tia5J zMMX1+!ulc1%8e*FNRV8jL|OSL-_9Nv6O=CH>Ty(W@sm`j=NFa1F3tT$?wM1}GZekB z6F_VLMCSd7(b9T%IqUMo$w9sM5wOA7l8xW<(1w0T=S}MB+9X5UT|+nemtm_;!|bxX z_bnOKN+F30ehJ$459k@=69yTz^_)-hNE4XMv$~_%vlH_y^`P1pLxYF6#_IZyteO`9wpuS> z#%Vyg5mMDt?}j!0}MoBX|9PS0#B zSVo6xLVjujMN57}IVc#A{VB*_yx;#mgM4~yT6wO;Qtm8MV6DX?u(JS~JFA~PvEl%9 z2XI}c>OzPoPn_IoyXa2v}BA(M+sWq=_~L0rZ_yR17I5c^m4;?2&KdCc)3lCs!M|0OzH@(PbG8T6w%N zKzR>%SLxL_C6~r3=xm9VG8<9yLHV6rJOjFHPaNdQHHflp><44l>&;)&7s)4lX%-er znWCv8eJJe1KAi_t1p%c4`bgxD2(1v)jm(gvQLp2K-=04oaIJu{F7SIu8&)gyw7x>+ zbzYF7KXg;T71w!-=C0DjcnF^JP$^o_N>*BAjtH!^HD6t1o?(O7IrmcodeQVDD<*+j zN)JdgB6v^iiJ1q`bZ(^WvN{v@sDqG$M9L`-UV!3q&sWZUnQ{&tAkpX(nZ_L#rMs}>p7l0fU5I5IzArncQi6TWjP#1B=QZ|Uqm-3{)YPn=XFqHW-~Fb z^!0CvIdelQbgcac9;By79%T`uvNhg9tS><pLzXePP=JZzcO@?5GRAdF4)sY*)YGP* zyioMa3=HRQz(v}+cqXc0%2*Q%CQi%e2~$a9r+X*u3J8w^Shg#%4I&?!$})y@ zzg8tQ6_-`|TBa_2v$D;Q(pFutj7@yos0W$&__9$|Yn3DFe*)k{g^|JIV4bqI@2%-4kpb_p? zQ4}qQcA>R6ihbxnVa{c;f7Y)VPV&mRY-*^qm~u3HB>8lf3P&&#GhQk8uIYYgwrugY zei>mp`YdC*R^Cxuv@d0V?$~d*=m-X?1Fqd9@*IM^wQ_^-nQEuc0!OqMr#TeT=8W`JbjjXc-Dh3NhnTj8e82yP;V_B<7LIejij+B{W1ViaJ_)+q?$BaLJpxt_4@&(?rWC3NC-_Z9Sg4JJWc( zX!Y34j67vCMHKB=JcJ1|#UI^D^mn(i=A5rf-iV7y4bR5HhC=I`rFPZv4F>q+h?l34 z4(?KYwZYHwkPG%kK7$A&M#=lpIn3Qo<>s6UFy|J$Zca-s(oM7??dkuKh?f5b2`m57 zJhs4BTcVVmwsswlX?#70uQb*k1Fi3q4+9`V+ikSk{L3K=-5HgN0JekQ=J~549Nd*+H%5+fi6aJuR=K zyD3xW{X$PL7&iR)=wumlTq2gY{LdrngAaPC;Qw_xLfVE0c0Z>y918TQpL!q@?`8{L!el18Qxiki3WZONF=eK$N3)p>36EW)I@Y z7QxbWW_9_7a*`VS&5~4-9!~&g8M+*U9{I2Bz`@TJ@E(YL$l+%<=?FyR#&e&v?Y@@G zqFF`J*v;l$&(A=s`na2>4ExKnxr`|OD+Xd-b4?6xl4mQ94xuk!-$l8*%+1zQU{)!= zTooUhjC0SNBh!&Ne}Q=1%`_r=Vu1c8RuE!|(g4BQGcd5AbpLbvKv_Z~Y`l!mr!sCc zDBupoc{W@U(6KWqW@xV_`;J0~+WDx|t^WeMri#=q0U5ZN7@@FAv<1!hP6!IYX z>UjbhaEv2Fk<6C0M^@J`lH#LgKJ(`?6z5=uH+ImggSQaZtvh52WTK+EBN~-op#EQKYW`$yBmq z4wgLTJPn3;mtbs0m0RO&+EG>?rb*ZECE0#eeSOFL!2YQ$w}cae>sun`<=}m!=go!v zO2jn<0tNh4E-4)ZA(ixh5nIUuXF-qYl>0I_1)K%EAw`D7~la$=gc@6g{iWF=>i_76?Mc zh#l9h7))<|EY=sK!E|54;c!b;Zp}HLd5*-w^6^whxB98v`*P>cj!Nfu1R%@bcp{cb zUZ24(fUXn3d&oc{6H%u(@4&_O?#HO(qd^YH=V`WJ=u*u6Zie8mE^r_Oz zDw`DaXeq4G#m@EK5+p40Xe!Lr!-jTQLCV3?R1|3#`%45h8#WSA!XoLDMS7=t!SluZ4H56;G z6C9D(B6>k^ur_DGfJ@Y-=3$5HkrI zO+3P>R@$6QZ#ATUI3$)xRBEL#5IKs}yhf&fK;ANA#Qj~G zdE|k|`puh$%dyE4R0$7dZd)M*#e7s%*PKPyrS;d%&S(d{_Ktq^!Hpi&bxZx`?9pEw z%sPjo&adHm95F7Z1{RdY#*a!&LcBZVRe{qhn8d{pOUJ{fOu`_kFg7ZVeRYZ(!ezNktT5{Ab z4BZI$vS0$vm3t9q`ECjDK;pmS{8ZTKs`Js~PYv2|=VkDv{Dtt)cLU@9%K6_KqtqfM zaE*e$f$Xm=;IAURNUXw8g%=?jzG2}10ZA5qXzAaJ@eh)yv5B=ETyVwC-a*CD;GgRJ z4J1~zMUey?4iVlS0zW|F-~0nenLiN3S0)l!T2}D%;<}Z9DzeVgcB+MSj;f$KY;uP%UR#f`0u*@6U@tk@jO3N?Fjq< z{cUUhjrr$rmo>qE?52zKe+>6iP5P_tcUfxsLSy{9*)shB(w`UUveNH`a`kr$VEF@} zKh&|lTD;4;m_H6C&)9#D`kRh;S(NTa=Ve^~xe_0~x$6h8Q@B_qu#ee=(lkI9@F6$0m=z@H=4&h%Q{htM>uHs(Sr@2ry`fgLA zKj8lVXdGPyy)2J%A${}Rm_a{){wHnlM?yGPQ7#KO{8*(_l0QZHuV};nO?c%h?qwSL z3wem|w*2tdxW5&PxC(Wd0QG_w|GPbw|0UFK`u$~U%!`QKcME;=Q@?*erh4_>FP~1n zAldwG9h$$u_$RFK6Uxo20GHqJzc}Rl-EwVz3h4n z;3~%DwD84i>)-8#&#y3k)3BG5cNaP3?t4q}F%yfv?*yEiC>sSo}$f>nh0QNZXH1N)-Q7kbk=2uL9OrF)nXrE@F1y%_8Yn c82=K%QXLKFx%@O{wJjEi6Y56o#$)Bpeg literal 0 HcmV?d00001 diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 00000000..2a84e188 --- /dev/null +++ b/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,7 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-9.0.0-bin.zip +networkTimeout=10000 +validateDistributionUrl=true +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew new file mode 100644 index 00000000..ef07e016 --- /dev/null +++ b/gradlew @@ -0,0 +1,251 @@ +#!/bin/sh + +# +# Copyright © 2015 the original authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 +# + +############################################################################## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# +############################################################################## + +# Attempt to set APP_HOME + +# Resolve links: $0 may be a link +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac +done + +# This is normally unused +# shellcheck disable=SC2034 +APP_BASE_NAME=${0##*/} +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD=maximum + +warn () { + echo "$*" +} >&2 + +die () { + echo + echo "$*" + echo + exit 1 +} >&2 + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; +esac + +CLASSPATH="\\\"\\\"" + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD=$JAVA_HOME/jre/sh/java + else + JAVACMD=$JAVA_HOME/bin/java + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD=java + if ! command -v java >/dev/null 2>&1 + then + die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac +fi + +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + + # Now convert the arguments - kludge to limit ourselves to /bin/sh + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) + fi + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg + done +fi + + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + -jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \ + "$@" + +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" +fi + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat new file mode 100644 index 00000000..db3a6ac2 --- /dev/null +++ b/gradlew.bat @@ -0,0 +1,94 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem +@rem SPDX-License-Identifier: Apache-2.0 +@rem + +@if "%DEBUG%"=="" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if %ERRORLEVEL% equ 0 goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH= + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* + +:end +@rem End local scope for the variables with windows NT shell +if %ERRORLEVEL% equ 0 goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/pom.xml b/pom.xml index 7314100c..8a314d06 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ net.buildtheearth BuildTeamTools - 0.1.3-alpha + 0.2.0-alpha jar BuildTeamTools @@ -206,7 +206,7 @@ io.papermc.paper paper-api - 1.21.4-R0.1-SNAPSHOT + 1.21.10-R0.1-SNAPSHOT provided @@ -214,7 +214,7 @@ com.mojang authlib - 3.13.56 + 7.0.61 provided diff --git a/settings.gradle.kts b/settings.gradle.kts new file mode 100644 index 00000000..5a289eac --- /dev/null +++ b/settings.gradle.kts @@ -0,0 +1,5 @@ +/* + * This file was generated by the Gradle 'init' task. + */ + +rootProject.name = "BuildTeamTools" diff --git a/src/main/java/net/buildtheearth/BuildTeamTools.java b/src/main/java/net/buildtheearth/BuildTeamTools.java index 9f985e2a..accc350b 100644 --- a/src/main/java/net/buildtheearth/BuildTeamTools.java +++ b/src/main/java/net/buildtheearth/BuildTeamTools.java @@ -8,7 +8,6 @@ import net.buildtheearth.modules.miscellaneous.MiscModule; import net.buildtheearth.modules.navigation.NavigationModule; import net.buildtheearth.modules.network.NetworkModule; -import net.buildtheearth.modules.plotsystem.PlotSystemModule; import net.buildtheearth.modules.stats.StatsModule; import net.buildtheearth.utils.io.ConfigUtil; import org.bukkit.configuration.file.FileConfiguration; @@ -47,8 +46,6 @@ public void onEnable() { NetworkModule.getInstance(), GeneratorModule.getInstance(), NavigationModule.getInstance(), - PlotSystemModule.getInstance(), - StatsModule.getInstance(), MiscModule.getInstance() ); ModuleHandler.getInstance().enableAll(null); diff --git a/src/main/java/net/buildtheearth/modules/Module.java b/src/main/java/net/buildtheearth/modules/Module.java index 540ba76e..9bd01439 100644 --- a/src/main/java/net/buildtheearth/modules/Module.java +++ b/src/main/java/net/buildtheearth/modules/Module.java @@ -8,7 +8,6 @@ import org.bukkit.command.CommandExecutor; import org.bukkit.command.PluginCommand; import org.bukkit.command.TabCompleter; -import org.bukkit.entity.Player; import org.bukkit.event.HandlerList; import org.bukkit.event.Listener; @@ -182,17 +181,4 @@ protected void checkForModuleDependencies(){ return; } } - - - /** - * Sends more information about the generator to a player. - * The WIKI_PAGE varies depending on the generator. - * - * @param p The player who should receive the information. - */ - public void sendWikiLink(Player p) { - p.sendMessage(" "); - p.sendMessage("§cFor more information take a look here:"); - p.sendMessage("§c" + wikiPage); - } } diff --git a/src/main/java/net/buildtheearth/modules/ModuleHandler.java b/src/main/java/net/buildtheearth/modules/ModuleHandler.java index d2ad004f..fcaf3e4d 100644 --- a/src/main/java/net/buildtheearth/modules/ModuleHandler.java +++ b/src/main/java/net/buildtheearth/modules/ModuleHandler.java @@ -8,8 +8,8 @@ import org.bukkit.ChatColor; import org.bukkit.command.CommandSender; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; -import javax.annotation.Nullable; import java.util.ArrayList; import java.util.List; import java.util.Objects; diff --git a/src/main/java/net/buildtheearth/modules/generator/components/field/Field.java b/src/main/java/net/buildtheearth/modules/generator/components/field/Field.java index 2ef99d6a..49a20638 100644 --- a/src/main/java/net/buildtheearth/modules/generator/components/field/Field.java +++ b/src/main/java/net/buildtheearth/modules/generator/components/field/Field.java @@ -1,6 +1,5 @@ package net.buildtheearth.modules.generator.components.field; -import com.sk89q.worldedit.regions.Region; import net.buildtheearth.modules.generator.model.GeneratorComponent; import net.buildtheearth.modules.generator.model.GeneratorType; import net.buildtheearth.modules.generator.utils.GeneratorUtils; @@ -15,7 +14,7 @@ public Field() { @Override public boolean checkForPlayer(Player p) { - return GeneratorUtils.checkForNoWorldEditSelection(p); + return !GeneratorUtils.checkForNoWorldEditSelection(p); /* Only needed if block checks are made afterwards like in House Generator if (getPlayerSettings().get(p.getUniqueId()).getBlocks() == null) diff --git a/src/main/java/net/buildtheearth/modules/generator/components/field/FieldScripts.java b/src/main/java/net/buildtheearth/modules/generator/components/field/FieldScripts.java index 00ed550c..74385d89 100644 --- a/src/main/java/net/buildtheearth/modules/generator/components/field/FieldScripts.java +++ b/src/main/java/net/buildtheearth/modules/generator/components/field/FieldScripts.java @@ -42,8 +42,8 @@ public void fieldScript_v_1_0() { // Create a cuboid selection of the field area to scan enough blocks GeneratorUtils.createCuboidSelection(getPlayer(), - new Vector(getRegion().getMinimumPoint().getX(), getRegion().getMinimumPoint().getY(), getRegion().getMinimumPoint().getZ()), - new Vector(getRegion().getMaximumPoint().getX(), getRegion().getMaximumPoint().getY(), getRegion().getMaximumPoint().getZ()) + new Vector(getRegion().getMinimumPoint().x(), getRegion().getMinimumPoint().y(), getRegion().getMinimumPoint().z()), + new Vector(getRegion().getMaximumPoint().x(), getRegion().getMaximumPoint().y(), getRegion().getMaximumPoint().z()) ); // Expand the selection to make sure the field is big enough diff --git a/src/main/java/net/buildtheearth/modules/generator/model/GeneratorCollections.java b/src/main/java/net/buildtheearth/modules/generator/model/GeneratorCollections.java index 8628c8d2..84b11efa 100644 --- a/src/main/java/net/buildtheearth/modules/generator/model/GeneratorCollections.java +++ b/src/main/java/net/buildtheearth/modules/generator/model/GeneratorCollections.java @@ -14,10 +14,10 @@ import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.entity.Player; +import org.jetbrains.annotations.Nullable; import org.json.JSONArray; import org.json.JSONObject; -import javax.annotation.Nullable; import java.io.*; import java.lang.reflect.Method; import java.net.HttpURLConnection; diff --git a/src/main/java/net/buildtheearth/modules/network/api/NetworkAPI.java b/src/main/java/net/buildtheearth/modules/network/api/NetworkAPI.java index 69a8346b..f63fcfa4 100644 --- a/src/main/java/net/buildtheearth/modules/network/api/NetworkAPI.java +++ b/src/main/java/net/buildtheearth/modules/network/api/NetworkAPI.java @@ -48,7 +48,7 @@ public void onResponse(String response) { @Override public void onFailure(IOException e) { - ChatHelper.logError("Something went wrong while notifying the network API of the plugins presence: %s", e.getMessage()); + ChatHelper.logError("Something went wrong while notifying the network API of the plugins presence: " + e.getMessage()); } }); } @@ -242,7 +242,7 @@ private int getArea(JSONObject regionObject) { @Override public void onFailure(IOException e) { - ChatHelper.logError("Failed to get teams information from the network API: %s", e); + ChatHelper.logError("Failed to get teams information from the network API: " + e.getMessage()); // Handle failure scenario future.completeExceptionally(e); diff --git a/src/main/java/net/buildtheearth/utils/ChatHelper.java b/src/main/java/net/buildtheearth/utils/ChatHelper.java index db250e57..43020a0b 100644 --- a/src/main/java/net/buildtheearth/utils/ChatHelper.java +++ b/src/main/java/net/buildtheearth/utils/ChatHelper.java @@ -11,8 +11,8 @@ import org.bukkit.Location; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; +import org.jetbrains.annotations.Nullable; -import javax.annotation.Nullable; import java.util.Arrays; import java.util.logging.Level; diff --git a/src/main/java/net/buildtheearth/utils/Item.java b/src/main/java/net/buildtheearth/utils/Item.java index 69401a13..71ab40d4 100644 --- a/src/main/java/net/buildtheearth/utils/Item.java +++ b/src/main/java/net/buildtheearth/utils/Item.java @@ -1,6 +1,8 @@ package net.buildtheearth.utils; import com.cryptomorin.xseries.XMaterial; +import com.cryptomorin.xseries.profiles.builder.XSkull; +import com.cryptomorin.xseries.profiles.objects.Profileable; import com.mojang.authlib.GameProfile; import com.mojang.authlib.properties.Property; import com.sk89q.worldedit.world.block.BlockType; @@ -473,8 +475,7 @@ public static ItemStack createCustomHeadTextureURL(String url, String name, List if(head == null) return null; - SkullMeta meta = (SkullMeta) head.getItemMeta(); - mutateItemMeta(meta, base64); + ItemMeta meta = XSkull.of(head).profile(Profileable.detect(base64)).apply().getItemMeta(); meta.setDisplayName(name); meta.setLore(lore); head.setItemMeta(meta); @@ -487,15 +488,43 @@ public static ItemStack createCustomHeadTextureURL(String url, String name, List private static void mutateItemMeta(SkullMeta meta, String b64) { GameProfile profile = makeProfile(b64); - // Try Paper API (Minecraft Version 1.20+) + // Try Paper API (Minecraft Version 1.21+) try { Method setPlayerProfile = SkullMeta.class.getMethod("setPlayerProfile", com.destroystokyo.paper.profile.PlayerProfile.class); - com.destroystokyo.paper.profile.PlayerProfile paperProfile = Bukkit.createProfile(profile.getId(), profile.getName()); - paperProfile.getProperties().add(new com.destroystokyo.paper.profile.ProfileProperty("textures", b64)); + com.destroystokyo.paper.profile.PlayerProfile paperProfile = Bukkit.createProfile(profile.id(), profile.name()); + paperProfile.setProperty(new com.destroystokyo.paper.profile.ProfileProperty("textures", b64)); setPlayerProfile.invoke(meta, paperProfile); return; } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException ignored) {} + // Try Paper API (Minecraft Version 1.20+) + try { + Method setPlayerProfile = SkullMeta.class.getMethod( + "setPlayerProfile", + com.destroystokyo.paper.profile.PlayerProfile.class + ); + + // Reflective access to profile.getId() and profile.getName() + Method getIdMethod = profile.getClass().getMethod("getId"); + Method getNameMethod = profile.getClass().getMethod("getName"); + + UUID id = (UUID) getIdMethod.invoke(profile); + String name = (String) getNameMethod.invoke(profile); + + com.destroystokyo.paper.profile.PlayerProfile paperProfile = + Bukkit.createProfile(id, name); + + paperProfile.getProperties().add( + new com.destroystokyo.paper.profile.ProfileProperty("textures", b64) + ); + + setPlayerProfile.invoke(meta, paperProfile); + return; + + } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException ignored) { + } + + // Try setProfile(GameProfile) (Minecraft Version 1.15 – 1.19.4) try { Method metaSetProfileMethod = meta.getClass().getDeclaredMethod("setProfile", GameProfile.class); @@ -521,7 +550,28 @@ private static void mutateItemMeta(SkullMeta meta, String b64) { b64.substring(b64.length() - 10).hashCode() ); GameProfile profile = new GameProfile(id, "bte"); - profile.getProperties().put("textures", new Property("textures", b64)); + + // Try Paper API (Minecraft Version 1.21+) + boolean firstVersionWorked = false; + try { + profile.properties().put("textures", new Property("textures", b64)); + firstVersionWorked = true; + } catch (Exception ignored) { + } + + // Try api for older versions + if (!firstVersionWorked) { + try { + Method getPropertiesMethod = profile.getClass().getMethod("getProperties"); + Object properties = getPropertiesMethod.invoke(profile); + + ((com.mojang.authlib.properties.PropertyMap) properties) + .put("textures", new Property("textures", b64)); + } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) { + throw new RuntimeException(e); + } + } + return profile; } } diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index c813b428..c56d1836 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -6,11 +6,9 @@ # | [Contacts - Discord] BuildTheEarth Staff Discord, @minefact # ---------------------------------------------------------------------------------------------- -language: "EN" - # The Build Team API Key used to fetch build team info for display. # Find the key on the Minecraft Network at "buildtheearth.net". Navigate: Compass > Build Teams > My Teams > Your Team > API-Key. -# Without this key, some plugin components won`t function. For assistance, see #server-support on the staff discord. +# Without this key, some plugin components won't function. For assistance, see #server-support on the staff discord. api-key: 00000000-0000-0000-0000-000000000000 # The main world using the custom BTE Dynmaxion projection @@ -23,6 +21,5 @@ disabled-modules: # Enable or disable the debug mode debug: false - # NOTE: Do not change config-version: 1.4 \ No newline at end of file diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index dece42e8..ecf6ef75 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,7 +1,8 @@ name: BuildTeamTools main: net.buildtheearth.BuildTeamTools api-version: 1.13 -version: 0.1.3-alpha +version: ${version} +description: ${description} author: MineFact, frikandelworst, George112n, ELgamer, SirJodelstein, Zoriot softdepend: [WorldEdit, HeadDatabase, PlotSystem-Terra] @@ -21,26 +22,15 @@ commands: warp: description: Command for managing warps. usage: /warp - aliases: [warps] - warpsbt: + aliases: [ warps, wp ] + warpbt: description: Opens the warp menu for the specified BuildTeam usage: /warpsbt - aliases: [ wbt ] + aliases: [ wbt, wpt, warpsbuildteam, warpsbt ] kml: description: kml pasting and parsing usage: /kml aliases: [geopoints, geopath, georing, geosurface] - createplot: - description: Creates a new plot for the PlotSystem. - usage: /createplot - permission: plotsystem.createplot - pasteplot: - description: Pastes a plot manually with specific ID - usage: /pasteplot - permission: plotsystem.pasteplot - plotsystemterra: - description: Sends info about the plugin - usage: /plotsystemterra blockpalette: description: Opens the block palette menu. usage: /blockpalette [filter|menu|filter ...] From 51aa6c267791df71c60077f410f15f2ead9d972e Mon Sep 17 00:00:00 2001 From: Zoriot Date: Mon, 5 Jan 2026 22:21:16 +0100 Subject: [PATCH 02/23] =?UTF-8?q?feat(build):=20=E2=9C=A8=20update=20depen?= =?UTF-8?q?dencies=20and=20improve=20async=20task=20handling=20in=20script?= =?UTF-8?q?s?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.gradle.kts | 6 +- gradle/libs.versions.toml | 6 +- gradlew | 0 pom.xml | 360 ------------------ .../net/buildtheearth/modules/Module.java | 4 +- .../modules/ModuleComponent.java | 1 + .../buildtheearth/modules/WikiDocumented.java | 22 ++ .../components/field/FieldScripts.java | 4 +- .../generator/components/house/House.java | 5 +- .../components/house/HouseScripts.java | 5 +- .../components/rail/RailScripts.java | 4 +- .../generator/model/GeneratorComponent.java | 5 +- .../modules/generator/model/Script.java | 1 - .../generator/utils/GeneratorUtils.java | 24 +- .../modules/plotsystem/PlotSystemModule.java | 16 +- .../resources/modules/navigation/config.yml | 2 +- 16 files changed, 68 insertions(+), 397 deletions(-) mode change 100644 => 100755 gradlew delete mode 100644 pom.xml create mode 100644 src/main/java/net/buildtheearth/modules/WikiDocumented.java diff --git a/build.gradle.kts b/build.gradle.kts index 8fe34276..12ea19cd 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -62,7 +62,11 @@ repositories { } dependencies { - implementation(libs.com.alpsbte.alpslib.alpslib.libpsterra) + //implementation(libs.com.alpsbte.alpslib.alpslib.libpsterra) CURRENTLY BROKEN + implementation(libs.alpslib.io) + implementation(libs.alpslib.utils) { + exclude(group = "com.github.cryptomorin", module = "XSeries") + } implementation(libs.com.alpsbte.canvas) implementation(libs.net.daporkchop.lib.binary) implementation(libs.com.github.cryptomorin.xseries) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 419eb437..37fa9611 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -6,7 +6,7 @@ com-alpsbte-alpslib-alpslib-libpsterra = "1.1.3" com-alpsbte-canvas = "1.3" com-fastasyncworldedit-fastasyncworldedit-bukkit = "2.12.3" com-fastasyncworldedit-fastasyncworldedit-core = "2.12.3" -com-github-cryptomorin-xseries = "13.4.0" +com-github-cryptomorin-xseries = "13.6.0" com-google-code-gson-gson = "2.13.1" com-google-guava-guava = "33.4.8-jre" com-mojang-authlib = "7.0.61" @@ -21,6 +21,8 @@ io-freefair-lombok = "9.1.0" com-googlecode-json-simple = "1.1.1" # https://mvnrepository.com/artifact/com.googlecode.json-simple/json-simple com-palantir-git-version = "4.0.0" com-gradleup-shadow = "9.3.0" +alpslib-io = "1.2.0" +alpslib-utils = "1.3.8" [libraries] com-alpsbte-alpslib-alpslib-libpsterra = { module = "com.alpsbte.alpslib:alpslib-libpsterra", version.ref = "com-alpsbte-alpslib-alpslib-libpsterra" } @@ -39,6 +41,8 @@ net-daporkchop-lib-binary = { module = "net.daporkchop.lib:binary", version.ref net-wesjd-anvilgui = { module = "net.wesjd:anvilgui", version.ref = "net-wesjd-anvilgui" } org-json-json = { module = "org.json:json", version.ref = "org-json-json" } com-googlecode-json-simple = { module = "com.googlecode.json-simple:json-simple", version.ref = "com-googlecode-json-simple" } +alpslib-io = { module = "com.alpsbte.alpslib:alpslib-io", version.ref = "alpslib-io" } +alpslib-utils = { module = "com.alpsbte.alpslib:alpslib-utils", version.ref = "alpslib-utils" } [plugins] lombok = { id = "io.freefair.lombok", version.ref = "io-freefair-lombok" } diff --git a/gradlew b/gradlew old mode 100644 new mode 100755 diff --git a/pom.xml b/pom.xml deleted file mode 100644 index 8a314d06..00000000 --- a/pom.xml +++ /dev/null @@ -1,360 +0,0 @@ - - - 4.0.0 - - net.buildtheearth - BuildTeamTools - 0.2.0-alpha - jar - - BuildTeamTools - - BuildTeamTools Plugin - - 21 - UTF-8 - - buildtheearth.net - - - - - org.apache.maven.plugins - maven-compiler-plugin - 3.14.0 - - ${java.version} - ${java.version} - ${java.version} - - - - org.apache.maven.plugins - maven-shade-plugin - 3.6.0 - - - package - - shade - - - false - - - - - net.wesjd.anvilgui - net.buildtheearth.buildteamtools.shaded.anvilgui - - - com.cryptomorin.xseries - net.buildtheearth.buildteamtools.shaded.xseries - - - org.ipvp.canvas - net.buildtheearth.buildteamtools.shaded.canvas - - - - - - com.alpsbte.alpslib:alpslib-libpsterra - - org/ipvp/canvas/** - com/cryptomorin/xseries/** - net/wesjd/anvilgui/** - - - - *:* - false - - net/wesjd/anvilgui/** - - - - *:* - false - - com/cryptomorin/xseries/** - - - - - *:* - - com/sun/codemodel/** - - - - - - - - - - - src/main/resources - true - - - - - - - - papermc - https://repo.papermc.io/repository/maven-public/ - - - - - reposilite-repository-releases - BuildTheEarth - https://maven.buildtheearth.net/releases - - - - - spigot-repo - https://hub.spigotmc.org/nexus/content/repositories/snapshots/ - - - - - alpsbte-repo - https://mvn.alps-bte.com/repository/alps-bte/ - - - - - OnARandomBox - https://repo.onarandombox.com/content/groups/public/ - - - - - codemc-snapshots - https://repo.codemc.io/repository/maven-snapshots/ - - - - - codemc-repo - https://repo.codemc.io/repository/maven-public/ - - - - - jitpack.io - https://jitpack.io - - - - - dmulloy2-repo - https://repo.dmulloy2.net/repository/public/ - - - - - DaPorkchop_ - https://maven.daporkchop.net/ - - - - - maven2-repository.dev.java.net - Java.net Maven 2 Repository - https://download.java.net/maven/2 - default - - true - - - - - maven-enginehub - https://maven.enginehub.org/repo/ - - - - - - - - - com.intellectualsites.bom - bom-newest - 1.52 - import - pom - - - - - - - - - - - - - io.papermc.paper - paper-api - 1.21.10-R0.1-SNAPSHOT - provided - - - - - com.mojang - authlib - 7.0.61 - provided - - - - - - - - - - com.alpsbte.alpslib - alpslib-libpsterra - 1.1.3 - compile - - - - - - com.alpsbte - canvas - 1.3 - compile - - - - - net.daporkchop.lib - binary - 0.5.7-SNAPSHOT - compile - - - - - - - - - com.fastasyncworldedit - FastAsyncWorldEdit-Core - provided - - - - com.fastasyncworldedit - FastAsyncWorldEdit-Bukkit - provided - - - FastAsyncWorldEdit-Core - * - - - - - - - - - - - - com.github.cryptomorin - XSeries - 13.4.0 - compile - - - - - - net.wesjd - anvilgui - 1.10.8-SNAPSHOT - compile - - - - - - - - - micycle - clipper2 - 1.2.2 - compile - - - - - org.json - json - 20250517 - compile - - - - - com.google.code.gson - gson - 2.13.1 - compile - - - - - com.google.guava - guava - 33.4.8-jre - compile - - - - - com.squareup.okhttp3 - okhttp-jvm - 5.1.0 - compile - - - - - de.micromata.jak - JavaAPIforKml - 2.2.1 - compile - - - - - - - - - org.projectlombok - lombok - 1.18.38 - compile - - - diff --git a/src/main/java/net/buildtheearth/modules/Module.java b/src/main/java/net/buildtheearth/modules/Module.java index 9bd01439..c3b2f9c7 100644 --- a/src/main/java/net/buildtheearth/modules/Module.java +++ b/src/main/java/net/buildtheearth/modules/Module.java @@ -8,6 +8,7 @@ import org.bukkit.command.CommandExecutor; import org.bukkit.command.PluginCommand; import org.bukkit.command.TabCompleter; +import org.bukkit.entity.Player; import org.bukkit.event.HandlerList; import org.bukkit.event.Listener; @@ -21,7 +22,7 @@ * * @authors MineFact, Noah Husby */ -public abstract class Module { +public abstract class Module implements WikiDocumented { @Getter private boolean enabled = false; @@ -45,6 +46,7 @@ public abstract class Module { @Getter private final List dependsOnModules = new ArrayList<>(); + @Getter private final String wikiPage; diff --git a/src/main/java/net/buildtheearth/modules/ModuleComponent.java b/src/main/java/net/buildtheearth/modules/ModuleComponent.java index 8e18055f..09db3a6f 100644 --- a/src/main/java/net/buildtheearth/modules/ModuleComponent.java +++ b/src/main/java/net/buildtheearth/modules/ModuleComponent.java @@ -1,6 +1,7 @@ package net.buildtheearth.modules; import lombok.Getter; +import org.bukkit.entity.Player; /** * An interface for BuildTeamTools components. diff --git a/src/main/java/net/buildtheearth/modules/WikiDocumented.java b/src/main/java/net/buildtheearth/modules/WikiDocumented.java new file mode 100644 index 00000000..3f8e8d01 --- /dev/null +++ b/src/main/java/net/buildtheearth/modules/WikiDocumented.java @@ -0,0 +1,22 @@ +package net.buildtheearth.modules; + +import org.bukkit.entity.Player; +import org.jspecify.annotations.NonNull; + +public interface WikiDocumented { + + /** + * @return the wiki page URL for this object + */ + String getWikiPage(); + + /** + * Sends more information about this object to a player. + */ + default void sendWikiLink(@NonNull Player p) { + p.sendMessage(" "); + p.sendMessage("§cFor more information take a look here:"); + p.sendMessage("§c" + getWikiPage()); + } +} + diff --git a/src/main/java/net/buildtheearth/modules/generator/components/field/FieldScripts.java b/src/main/java/net/buildtheearth/modules/generator/components/field/FieldScripts.java index 74385d89..ac0592c3 100644 --- a/src/main/java/net/buildtheearth/modules/generator/components/field/FieldScripts.java +++ b/src/main/java/net/buildtheearth/modules/generator/components/field/FieldScripts.java @@ -1,9 +1,11 @@ package net.buildtheearth.modules.generator.components.field; +import net.buildtheearth.BuildTeamTools; import net.buildtheearth.modules.generator.model.Flag; import net.buildtheearth.modules.generator.model.GeneratorComponent; import net.buildtheearth.modules.generator.model.Script; import net.buildtheearth.modules.generator.utils.GeneratorUtils; +import org.bukkit.Bukkit; import org.bukkit.block.Block; import org.bukkit.entity.Player; import org.bukkit.util.Vector; @@ -17,7 +19,7 @@ public class FieldScripts extends Script { public FieldScripts(Player player, GeneratorComponent generatorComponent) { super(player, generatorComponent); - fieldScript_v_1_0(); + Bukkit.getScheduler().runTaskAsynchronously(BuildTeamTools.getInstance(), this::fieldScript_v_1_0); } public void fieldScript_v_1_0() { diff --git a/src/main/java/net/buildtheearth/modules/generator/components/house/House.java b/src/main/java/net/buildtheearth/modules/generator/components/house/House.java index 71065264..a0f1bf24 100644 --- a/src/main/java/net/buildtheearth/modules/generator/components/house/House.java +++ b/src/main/java/net/buildtheearth/modules/generator/components/house/House.java @@ -1,6 +1,5 @@ package net.buildtheearth.modules.generator.components.house; -import com.sk89q.worldedit.regions.Region; import net.buildtheearth.modules.generator.model.GeneratorComponent; import net.buildtheearth.modules.generator.model.GeneratorType; import net.buildtheearth.modules.generator.utils.GeneratorUtils; @@ -24,10 +23,10 @@ public boolean checkForPlayer(Player p) { Block[][][] blocks = getPlayerSettings().get(p.getUniqueId()).getBlocks(); - if (!GeneratorUtils.checkForBrickOutline(blocks, p)) + if (!GeneratorUtils.checkForBrickOutline(blocks, p, this)) return false; - return GeneratorUtils.checkForWoolBlock(blocks, p); + return GeneratorUtils.checkForWoolBlock(blocks, p, this); } @Override diff --git a/src/main/java/net/buildtheearth/modules/generator/components/house/HouseScripts.java b/src/main/java/net/buildtheearth/modules/generator/components/house/HouseScripts.java index fe19b864..8fd67493 100644 --- a/src/main/java/net/buildtheearth/modules/generator/components/house/HouseScripts.java +++ b/src/main/java/net/buildtheearth/modules/generator/components/house/HouseScripts.java @@ -5,12 +5,14 @@ import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockType; import com.sk89q.worldedit.world.block.BlockTypes; +import net.buildtheearth.BuildTeamTools; import net.buildtheearth.modules.generator.model.Flag; import net.buildtheearth.modules.generator.model.GeneratorComponent; import net.buildtheearth.modules.generator.model.Script; import net.buildtheearth.modules.generator.utils.GeneratorUtils; import net.buildtheearth.utils.Item; import net.buildtheearth.utils.MenuItems; +import org.bukkit.Bukkit; import org.bukkit.Material; import org.bukkit.block.Block; import org.bukkit.entity.Player; @@ -22,8 +24,7 @@ public class HouseScripts extends Script { public HouseScripts(Player player, GeneratorComponent generatorComponent) { super(player, generatorComponent); - - buildscript_v_1_2(); + Bukkit.getScheduler().runTaskAsynchronously(BuildTeamTools.getInstance(), this::buildscript_v_1_2); } public void buildscript_v_1_2(){ diff --git a/src/main/java/net/buildtheearth/modules/generator/components/rail/RailScripts.java b/src/main/java/net/buildtheearth/modules/generator/components/rail/RailScripts.java index 7cd126ef..3178a538 100644 --- a/src/main/java/net/buildtheearth/modules/generator/components/rail/RailScripts.java +++ b/src/main/java/net/buildtheearth/modules/generator/components/rail/RailScripts.java @@ -1,7 +1,9 @@ package net.buildtheearth.modules.generator.components.rail; +import net.buildtheearth.BuildTeamTools; import net.buildtheearth.modules.generator.model.*; import net.buildtheearth.modules.generator.utils.GeneratorUtils; +import org.bukkit.Bukkit; import org.bukkit.block.Block; import org.bukkit.entity.Player; import org.bukkit.util.Vector; @@ -14,7 +16,7 @@ public class RailScripts extends Script { public RailScripts(Player player, GeneratorComponent generatorComponent) { super(player, generatorComponent); - railScript_v_1_3(); + Bukkit.getScheduler().runTaskAsynchronously(BuildTeamTools.getInstance(), this::railScript_v_1_3); } public void railScript_v_1_3() { diff --git a/src/main/java/net/buildtheearth/modules/generator/model/GeneratorComponent.java b/src/main/java/net/buildtheearth/modules/generator/model/GeneratorComponent.java index d40ee6f4..9c84694b 100644 --- a/src/main/java/net/buildtheearth/modules/generator/model/GeneratorComponent.java +++ b/src/main/java/net/buildtheearth/modules/generator/model/GeneratorComponent.java @@ -3,6 +3,7 @@ import lombok.Getter; import net.buildtheearth.BuildTeamTools; import net.buildtheearth.modules.ModuleComponent; +import net.buildtheearth.modules.WikiDocumented; import net.buildtheearth.modules.generator.components.field.FieldSettings; import net.buildtheearth.modules.generator.components.house.HouseSettings; import net.buildtheearth.modules.generator.components.rail.RailSettings; @@ -22,9 +23,9 @@ import java.util.HashMap; import java.util.UUID; -public abstract class GeneratorComponent extends ModuleComponent { - +public abstract class GeneratorComponent extends ModuleComponent implements WikiDocumented { + @Getter public String wikiPage; @Getter diff --git a/src/main/java/net/buildtheearth/modules/generator/model/Script.java b/src/main/java/net/buildtheearth/modules/generator/model/Script.java index 3af5cf03..786b4998 100644 --- a/src/main/java/net/buildtheearth/modules/generator/model/Script.java +++ b/src/main/java/net/buildtheearth/modules/generator/model/Script.java @@ -54,7 +54,6 @@ public Script(Player player, GeneratorComponent generatorComponent) { GeneratorUtils.setGmask(localSession, null); } - protected void finish(Block[][][] blocks, List points){ createSelection(points); //setGmask(null); diff --git a/src/main/java/net/buildtheearth/modules/generator/utils/GeneratorUtils.java b/src/main/java/net/buildtheearth/modules/generator/utils/GeneratorUtils.java index 992ece36..6c32b9e5 100644 --- a/src/main/java/net/buildtheearth/modules/generator/utils/GeneratorUtils.java +++ b/src/main/java/net/buildtheearth/modules/generator/utils/GeneratorUtils.java @@ -37,8 +37,8 @@ import com.sk89q.worldedit.world.block.BlockType; import com.sk89q.worldedit.world.block.BlockTypes; import net.buildtheearth.BuildTeamTools; +import net.buildtheearth.modules.WikiDocumented; import net.buildtheearth.modules.common.CommonModule; -import net.buildtheearth.modules.generator.GeneratorModule; import net.buildtheearth.utils.ChatHelper; import net.buildtheearth.utils.MenuItems; import org.apache.commons.lang3.StringUtils; @@ -138,8 +138,8 @@ *

Preparation Check Functions: *
• {@link #checkIfSchematicBrushIsInstalled(Player)} *
• {@link #checkForNoWorldEditSelection(Player)} - *
• {@link #checkForBrickOutline(Block[][][], Player)} - *
• {@link #checkForWoolBlock(Block[][][], Player)} + *
• {@link #checkForBrickOutline(Block[][][], Player, WikiDocumented)} + *
• {@link #checkForWoolBlock(Block[][][], Player, WikiDocumented)} * * @version 1.5 * @author MineFact @@ -183,14 +183,6 @@ private static Material[] getIgnoredMaterials(){ return MenuItems.getIgnoredMaterials(); } - private static void sendWikiLink(Player p){ - sendWikiLink(p); - } - - - - - /*=============================================** SCRIPT HELPER FUNCTIONS @@ -1700,7 +1692,7 @@ public static boolean checkIfSchematicBrushIsInstalled(Player p){ // Check if WorldEdit is enabled if (!isSchematicBrushEnabled()) { p.sendMessage("§cPlease install Schematic Brush to use this tool. You can ask the server administrator to install it."); - sendWikiLink(p); + return false; } return true; @@ -1733,12 +1725,12 @@ public static boolean checkForNoWorldEditSelection(Player p){ * @param p The player to check for * @return Whether the player has a brick block in their selection */ - public static boolean checkForBrickOutline(Block[][][] blocks, Player p){ + public static boolean checkForBrickOutline(Block[][][] blocks, Player p, WikiDocumented w){ if(!containsBlock(blocks, XMaterial.BRICKS)){ p.sendMessage("§cPlease make a selection around an outline."); p.closeInventory(); p.playSound(p.getLocation(), Sound.ENTITY_ITEM_BREAK, 1.0F, 1.0F); - sendWikiLink(p); + w.sendWikiLink(p); return false; } @@ -1752,12 +1744,12 @@ public static boolean checkForBrickOutline(Block[][][] blocks, Player p){ * @param p The player to check for * @return Whether the player has a yellow wool block in their selection */ - public static boolean checkForWoolBlock(Block[][][] blocks, Player p){ + public static boolean checkForWoolBlock(Block[][][] blocks, Player p, WikiDocumented w){ if(!containsBlock(blocks, XMaterial.YELLOW_WOOL)){ p.sendMessage("§cPlease place a yellow wool block inside the outline."); p.closeInventory(); p.playSound(p.getLocation(), Sound.ENTITY_ITEM_BREAK, 1.0F, 1.0F); - sendWikiLink(p); + w.sendWikiLink(p); ItemStack yellowWool = XMaterial.YELLOW_WOOL.parseItem(); if(!p.getInventory().contains(yellowWool)) { diff --git a/src/main/java/net/buildtheearth/modules/plotsystem/PlotSystemModule.java b/src/main/java/net/buildtheearth/modules/plotsystem/PlotSystemModule.java index 5d4b6cb6..18f728c2 100644 --- a/src/main/java/net/buildtheearth/modules/plotsystem/PlotSystemModule.java +++ b/src/main/java/net/buildtheearth/modules/plotsystem/PlotSystemModule.java @@ -1,12 +1,12 @@ package net.buildtheearth.modules.plotsystem; -import com.alpsbte.alpslib.libpsterra.core.Connection; +/*import com.alpsbte.alpslib.libpsterra.core.Connection; import com.alpsbte.alpslib.libpsterra.core.PSTerraSetup; import com.alpsbte.alpslib.libpsterra.core.config.ConfigManager; import com.alpsbte.alpslib.libpsterra.core.config.PSInitializer; import com.alpsbte.alpslib.libpsterra.core.plotsystem.PlotCreator; -import com.alpsbte.alpslib.libpsterra.core.plotsystem.PlotPaster; +import com.alpsbte.alpslib.libpsterra.core.plotsystem.PlotPaster;*/ import net.buildtheearth.BuildTeamTools; import net.buildtheearth.modules.Module; import net.buildtheearth.modules.common.CommonModule; @@ -17,24 +17,25 @@ import net.buildtheearth.utils.io.ConfigUtil; import net.buildtheearth.utils.io.Constants; import net.buildtheearth.utils.io.Errors; +import org.apache.commons.lang3.NotImplementedException; import org.bukkit.Bukkit; public class PlotSystemModule extends Module { private static PlotSystemModule instance = null; - +/* private ConfigManager configManager; - private PlotPaster plotPaster; + private PlotPaster plotPaster;*/ private boolean pluginEnabled = false; public String version; public String newVersion; public boolean updateInstalled = false; - +/* private Connection connection; - private PlotCreator plotCreator; + private PlotCreator plotCreator;*/ public PlotSystemModule() { super("PlotSystem"); @@ -47,6 +48,7 @@ public static PlotSystemModule getInstance() { @Override public void enable() { + throw new NotImplementedException("Currently broken");/* // Check if WorldEdit is enabled if (!CommonModule.getInstance().getDependencyComponent().isWorldEditEnabled()) { shutdown(Errors.WORLD_EDIT_NOT_INSTALLED); @@ -124,7 +126,7 @@ public void enable() { return; } - super.enable(); + super.enable();*/ } diff --git a/src/main/resources/modules/navigation/config.yml b/src/main/resources/modules/navigation/config.yml index 0eed449b..dd644f89 100644 --- a/src/main/resources/modules/navigation/config.yml +++ b/src/main/resources/modules/navigation/config.yml @@ -48,4 +48,4 @@ warps: sorting-mode: default # NOTE: Do not change -config-version: 1.4 \ No newline at end of file +config-version: 1.6 \ No newline at end of file From 9260c2564f9545e0c53f84033a9f01ddc5f090d3 Mon Sep 17 00:00:00 2001 From: Zoriot Date: Mon, 5 Jan 2026 23:30:01 +0100 Subject: [PATCH 03/23] =?UTF-8?q?feat(build):=20=E2=9C=A8=20enhance=20asyn?= =?UTF-8?q?c=20operation=20handling=20and=20update=20module=20registration?= =?UTF-8?q?=20logic?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/net/buildtheearth/modules/ModuleHandler.java | 2 +- .../common/components/version/VersionComponent.java | 2 +- .../buildtheearth/modules/generator/model/Command.java | 8 +++++++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/main/java/net/buildtheearth/modules/ModuleHandler.java b/src/main/java/net/buildtheearth/modules/ModuleHandler.java index fcaf3e4d..6583f17c 100644 --- a/src/main/java/net/buildtheearth/modules/ModuleHandler.java +++ b/src/main/java/net/buildtheearth/modules/ModuleHandler.java @@ -46,7 +46,7 @@ public void registerModule(Module module) { */ public void registerModules(Module @NotNull ... modules) { for (Module m : modules) { - if (!Objects.requireNonNull(BuildTeamTools.getInstance().getConfig().getList(ConfigPaths.DISABLED_MODULES)).contains(m.getModuleName())) { + if (!BuildTeamTools.getInstance().getConfig().getList(ConfigPaths.DISABLED_MODULES, List.of()).contains(m.getModuleName())) { registerModule(m); } } diff --git a/src/main/java/net/buildtheearth/modules/common/components/version/VersionComponent.java b/src/main/java/net/buildtheearth/modules/common/components/version/VersionComponent.java index 90714a89..6f658ce7 100644 --- a/src/main/java/net/buildtheearth/modules/common/components/version/VersionComponent.java +++ b/src/main/java/net/buildtheearth/modules/common/components/version/VersionComponent.java @@ -50,7 +50,7 @@ public enum Version { v1_20_R1(20, "1.20", "1.20.1"), v1_20_R2(20, "1.20.2", "1.20.3"), v1_20_R3(20, "1.20.4"), - v1_21_R1(21, "1.21", "1.21.1", "1.21.2", "1.21.3", "1.21.4", "1.21.5", "1.21.6", "1.21.7", "1.21.8"); + v1_21_R1(21, "1.21", "1.21.1", "1.21.2", "1.21.3", "1.21.4", "1.21.5", "1.21.6", "1.21.7", "1.21.8", "1.21.10", "1.21.11"); private final int xseriesVersion; private final String[] bukkitVersions; diff --git a/src/main/java/net/buildtheearth/modules/generator/model/Command.java b/src/main/java/net/buildtheearth/modules/generator/model/Command.java index ef91b560..c543e3ad 100644 --- a/src/main/java/net/buildtheearth/modules/generator/model/Command.java +++ b/src/main/java/net/buildtheearth/modules/generator/model/Command.java @@ -235,8 +235,14 @@ public void processOperation(Operation operation){ if(future != null){ threadActive = true; - future.thenRun(() -> { + // Ensure we clear threadActive and remove the operation regardless of success or exception + future.whenComplete((v, ex) -> { threadActive = false; + if (ex != null) { + ChatHelper.logError("Async operation failed: " + operation.getOperationType() + " - " + operation.getValuesAsString()); + ex.printStackTrace(); + } + // Remove the processed operation from the queue operations.remove(0); }); From 0beb3a94efbcd10d17b22b90f9f239fa4a9a6887 Mon Sep 17 00:00:00 2001 From: Zoriot Date: Sat, 10 Jan 2026 19:21:40 +0100 Subject: [PATCH 04/23] =?UTF-8?q?fix(kml):=20=E2=9C=A8=20fix=20JAXB=20cont?= =?UTF-8?q?ext=20handling?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Improves #61. --- build.gradle.kts | 4 +- gradle/libs.versions.toml | 4 +- .../generator/components/kml/KmlParser.java | 76 ++++++++++--------- 3 files changed, 46 insertions(+), 38 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 12ea19cd..c6dd11b1 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -76,7 +76,9 @@ dependencies { implementation(libs.com.google.code.gson.gson) implementation(libs.com.google.guava.guava) implementation(libs.com.squareup.okhttp3.okhttp.jvm) - implementation(libs.de.micromata.jak.javaapiforkml) + implementation(libs.javaapiforkml) { + exclude(group = "com.sun.xml.bind", module = "jaxb-xjc") // Else Remapping will yell of duplicated classes + } implementation(libs.com.googlecode.json.simple) compileOnly(libs.io.papermc.paper.paper.api) compileOnly(libs.com.mojang.authlib) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 37fa9611..4c86f938 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -11,7 +11,7 @@ com-google-code-gson-gson = "2.13.1" com-google-guava-guava = "33.4.8-jre" com-mojang-authlib = "7.0.61" com-squareup-okhttp3-okhttp-jvm = "5.1.0" -de-micromata-jak-javaapiforkml = "2.2.1" +javaapiforkml = "3.0.10" # https://github.com/urbancamo/javaapiforkml io-papermc-paper-paper-api = "1.21.10-R0.1-SNAPSHOT" micycle-clipper2 = "1.2.2" net-daporkchop-lib-binary = "0.5.7-SNAPSHOT" @@ -34,7 +34,7 @@ com-google-code-gson-gson = { module = "com.google.code.gson:gson", version.ref com-google-guava-guava = { module = "com.google.guava:guava", version.ref = "com-google-guava-guava" } com-mojang-authlib = { module = "com.mojang:authlib", version.ref = "com-mojang-authlib" } com-squareup-okhttp3-okhttp-jvm = { module = "com.squareup.okhttp3:okhttp-jvm", version.ref = "com-squareup-okhttp3-okhttp-jvm" } -de-micromata-jak-javaapiforkml = { module = "de.micromata.jak:JavaAPIforKml", version.ref = "de-micromata-jak-javaapiforkml" } +javaapiforkml = { module = "uk.m0nom:javaapiforkml", version.ref = "javaapiforkml" } io-papermc-paper-paper-api = { module = "io.papermc.paper:paper-api", version.ref = "io-papermc-paper-paper-api" } micycle-clipper2 = { module = "micycle:clipper2", version.ref = "micycle-clipper2" } net-daporkchop-lib-binary = { module = "net.daporkchop.lib:binary", version.ref = "net-daporkchop-lib-binary" } diff --git a/src/main/java/net/buildtheearth/modules/generator/components/kml/KmlParser.java b/src/main/java/net/buildtheearth/modules/generator/components/kml/KmlParser.java index 69df0bd3..d48bdb06 100644 --- a/src/main/java/net/buildtheearth/modules/generator/components/kml/KmlParser.java +++ b/src/main/java/net/buildtheearth/modules/generator/components/kml/KmlParser.java @@ -1,21 +1,11 @@ package net.buildtheearth.modules.generator.components.kml; -import java.util.List; -import java.util.ArrayList; - +import de.micromata.opengis.kml.v_2_2_0.*; import org.bukkit.entity.Player; -import de.micromata.opengis.kml.v_2_2_0.Coordinate; -import de.micromata.opengis.kml.v_2_2_0.Document; -import de.micromata.opengis.kml.v_2_2_0.Feature; -import de.micromata.opengis.kml.v_2_2_0.Geometry; -import de.micromata.opengis.kml.v_2_2_0.Kml; -import de.micromata.opengis.kml.v_2_2_0.LineString; -import de.micromata.opengis.kml.v_2_2_0.LinearRing; -import de.micromata.opengis.kml.v_2_2_0.MultiGeometry; -import de.micromata.opengis.kml.v_2_2_0.Placemark; -import de.micromata.opengis.kml.v_2_2_0.Polygon; +import java.util.ArrayList; +import java.util.List; public class KmlParser { private Player player; @@ -32,18 +22,26 @@ public List> extractCoordinates(String kmlString) //https://github.com/micromata/javaapiforkml try { - Kml kml = Kml.unmarshal(kmlString); - - //Top-level element will be a document - Document doc = (Document) kml.getFeature(); - List placemarks = findPlacemarks(doc); - - - for (Placemark placemark : placemarks){ - // get all geometries from placemark (might be multiple lists) - //each list creates a separate entry list in the result - List> placemark_coords_lists = getCoordinates(placemark.getGeometry()); - result_lists.addAll(placemark_coords_lists); + // Set the context class loader to ensure JAXB service loader can find the implementation + // This is necessary when running in a PluginClassLoader environment + ClassLoader originalClassLoader = Thread.currentThread().getContextClassLoader(); + try { + Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader()); + Kml kml = Kml.unmarshal(kmlString); + + //Top-level element will be a document + Document doc = (Document) kml.getFeature(); + List placemarks = findPlacemarks(doc); + + + for (Placemark placemark : placemarks) { + // get all geometries from placemark (might be multiple lists) + //each list creates a separate entry list in the result + List> placemark_coords_lists = getCoordinates(placemark.getGeometry()); + result_lists.addAll(placemark_coords_lists); + } + } finally { + Thread.currentThread().setContextClassLoader(originalClassLoader); } } catch (Exception ex) { @@ -70,16 +68,24 @@ public List extractLinestrings(String kmlString) //https://github.com/micromata/javaapiforkml try { - Kml kml = Kml.unmarshal(kmlString); - //Top-level element will be a document - Document doc = (Document) kml.getFeature(); - List placemarks = findPlacemarks(doc); - - - for (Placemark placemark : placemarks){ - // #extract coordinates assuming geometry is linestring - List lines = findLineStrings(placemark); - linestrings.addAll(lines); + // Set the context class loader to ensure JAXB service loader can find the implementation + // This is necessary when running in a PluginClassLoader environment + ClassLoader originalClassLoader = Thread.currentThread().getContextClassLoader(); + try { + Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader()); + Kml kml = Kml.unmarshal(kmlString); + //Top-level element will be a document + Document doc = (Document) kml.getFeature(); + List placemarks = findPlacemarks(doc); + + + for (Placemark placemark : placemarks) { + // #extract coordinates assuming geometry is linestring + List lines = findLineStrings(placemark); + linestrings.addAll(lines); + } + } finally { + Thread.currentThread().setContextClassLoader(originalClassLoader); } } catch (Exception ex) { From fc4b7af9a6a0ca27280278214c38e003ced379d2 Mon Sep 17 00:00:00 2001 From: Zoriot Date: Sat, 10 Jan 2026 19:25:37 +0100 Subject: [PATCH 05/23] =?UTF-8?q?feat(gen):=20=E2=9C=A8=20refactor=20zip?= =?UTF-8?q?=20installation=20and=20extraction=20logic,=20improve=20error?= =?UTF-8?q?=20handling,=20and=20add=20version=20file=20management?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes #47. Fixes #60. --- .../generator/model/GeneratorCollections.java | 131 ++++++++++-------- 1 file changed, 72 insertions(+), 59 deletions(-) diff --git a/src/main/java/net/buildtheearth/modules/generator/model/GeneratorCollections.java b/src/main/java/net/buildtheearth/modules/generator/model/GeneratorCollections.java index 84b11efa..3a894dca 100644 --- a/src/main/java/net/buildtheearth/modules/generator/model/GeneratorCollections.java +++ b/src/main/java/net/buildtheearth/modules/generator/model/GeneratorCollections.java @@ -14,16 +14,20 @@ import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.entity.Player; +import org.codehaus.plexus.util.FileUtils; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.json.JSONArray; import org.json.JSONObject; +import org.jspecify.annotations.NonNull; import java.io.*; import java.lang.reflect.Method; import java.net.HttpURLConnection; +import java.net.URI; import java.net.URL; import java.nio.file.Files; -import java.nio.file.Paths; +import java.nio.file.Path; import java.util.logging.Level; import java.util.zip.ZipEntry; import java.util.zip.ZipInputStream; @@ -114,7 +118,7 @@ else if(CommonModule.getInstance().getDependencyComponent().isWorldEditEnabled() return checkIfGeneratorCollectionsIsUpToDate(p); } catch (Exception e) { - e.printStackTrace(); + BuildTeamTools.getInstance().getComponentLogger().warn("Failed to check if Generator Collections is installed:", e); return installGeneratorCollections(p, true); } } @@ -168,13 +172,17 @@ public static String getRepositoryReleaseVersionString(String owner, String repo * * @param filename The name of the zip folder to install. Example: "newtrees.zip" * @param path The path to extract the zip folder to. Parent Folder is the plugin folder. Example: "/../WorldEdit/schematics/" + * @param extractionFolder The path where the downloaded zip file is temporarily saved */ - private static boolean installZipFolder(String parentURL, String filename, String path) throws IOException { - path = BuildTeamTools.getInstance().getDataFolder().getAbsolutePath() + path; - String zipFilePath = path + "/" + filename; - URL url = new URL(parentURL + filename); + private static boolean installZipFolder(String parentURL, String filename, Path path, @NonNull Path extractionFolder) throws IOException { + if (!extractionFolder.toFile().exists() && !extractionFolder.toFile().mkdirs()) { + throw new IOException("Failed to create generator module folder: " + extractionFolder); + } + + var zipFilePath = extractionFolder.resolve(filename); + URL url = URI.create(parentURL + filename).toURL(); - File file = new File(path); + File file = path.toFile(); if(!file.exists()) { boolean created = file.mkdir(); @@ -192,7 +200,7 @@ private static boolean installZipFolder(String parentURL, String filename, Strin // Save the zip file to the path try (BufferedInputStream in = new BufferedInputStream(httpConn.getInputStream()); - FileOutputStream out = new FileOutputStream(path + "/" + filename)) { + FileOutputStream out = new FileOutputStream(zipFilePath.toFile())) { byte[] buffer = new byte[4096]; int bytesRead; @@ -215,33 +223,30 @@ private static boolean installZipFolder(String parentURL, String filename, Strin /** Extracts a zip folder on the system * - * @param zipFilePath The path to the zip folder. Example: "/../WorldEdit/schematics/newtrees.zip" + * @param zipFilePath The path to the zip folder. Example: "/../BuildTeamTols/modules/generator/GeneratorCollections.zip" * @param destDirectory The path to extract the zip folder to. Parent Folder is the plugin folder. Example: "/../WorldEdit/schematics/" */ - private static boolean unzip(String zipFilePath, String destDirectory) { - File destDir = new File(destDirectory); + private static boolean unzip(Path zipFilePath, @NonNull Path destDirectory) { + File destDir = destDirectory.toFile(); if (!destDir.exists()) { boolean success = destDir.mkdir(); if(!success) return false; } - try (ZipInputStream zipIn = new ZipInputStream(Files.newInputStream(Paths.get(zipFilePath)))) { + try (ZipInputStream zipIn = new ZipInputStream(Files.newInputStream(zipFilePath))) { ZipEntry entry = zipIn.getNextEntry(); while (entry != null) { - String filePath = destDirectory + File.separator + entry.getName(); + var filePath = destDirectory.resolve(entry.getName()); if (!entry.isDirectory()) { - File file = new File(filePath); - File parentDir = file.getParentFile(); - if (!parentDir.exists()) { - if (!parentDir.mkdirs()) { + File parentDir = filePath.getParent().toFile(); + if (!parentDir.exists() && !parentDir.mkdirs()) { throw new IOException("Failed to create parent directories for: " + filePath); } - } - try (BufferedOutputStream bos = new BufferedOutputStream(Files.newOutputStream(Paths.get(filePath)))) { + try (BufferedOutputStream bos = new BufferedOutputStream(Files.newOutputStream(filePath))) { byte[] bytesIn = new byte[4096]; int read; while ((read = zipIn.read(bytesIn)) != -1) { @@ -249,8 +254,7 @@ private static boolean unzip(String zipFilePath, String destDirectory) { } } } else { - File dir = new File(filePath); - boolean success = dir.mkdirs(); + boolean success = filePath.toFile().mkdirs(); if(!success) return false; @@ -259,8 +263,7 @@ private static boolean unzip(String zipFilePath, String destDirectory) { entry = zipIn.getNextEntry(); } - // Delete the old zip file - deleteFile(zipFilePath); + deleteFile(zipFilePath); // Delete the old zip file }catch (Exception e){ e.printStackTrace(); return false; @@ -272,23 +275,13 @@ private static boolean unzip(String zipFilePath, String destDirectory) { /** Deletes a directory from the system * * @param path The path to the directory to delete - * @return Whether the directory was deleted successfully */ - private static boolean deleteDirectory(String path) { - File dir = new File(path); - - if (dir.isDirectory()) { - String[] children = dir.list(); - - if (children != null) - for (String child : children) { - boolean success = deleteDirectory(new File(dir, child).getAbsolutePath()); - if (!success) { - return false; // Return false if deletion is unsuccessful - } - } + private static void deleteDirectory(@NonNull Path path) { + try { + FileUtils.deleteDirectory(path.toFile()); + } catch (IOException e) { + BuildTeamTools.getInstance().getComponentLogger().warn("Failed to delete directory: {}", path); } - return dir.delete(); // Return true if directory is deleted successfully } /** @@ -296,11 +289,11 @@ private static boolean deleteDirectory(String path) { * * @param path The path to the file to delete */ - private static void deleteFile(String path) { - File file = new File(path); + private static void deleteFile(@NonNull Path path) { + File file = path.toFile(); boolean success = file.delete(); if(!success) - System.out.println("Failed to delete file: " + path); + BuildTeamTools.getInstance().getComponentLogger().warn("Failed to delete file: {}", path); } /** @@ -312,16 +305,8 @@ private static void deleteFile(String path) { private static boolean checkIfGeneratorCollectionsIsUpToDate(Player p){ // Load the schematic file try { - String folder; - if(CommonModule.getInstance().getDependencyComponent().isFastAsyncWorldEditEnabled()) - folder = "/../FastAsyncWorldEdit/schematics/"; - else if(CommonModule.getInstance().getDependencyComponent().isWorldEditEnabled()) - folder = "/../WorldEdit/schematics/"; - else - return false; - - String filepath = "GeneratorCollections/"; - FileConfiguration cfg = YamlConfiguration.loadConfiguration(new File(BuildTeamTools.getInstance().getDataFolder().getAbsolutePath() + folder + filepath, "config.yml")); + var cfgFile = BuildTeamTools.getInstance().getDataFolder().toPath().resolve("modules").resolve("generator").resolve("generatorCollectionsVersion.yml"); + FileConfiguration cfg = YamlConfiguration.loadConfiguration(cfgFile.toFile()); if(!cfg.contains("version")) return installGeneratorCollections(p, true); @@ -365,25 +350,25 @@ private static boolean installGeneratorCollections(@Nullable Player p, boolean u String filename = "GeneratorCollections.zip"; String fileDirectory = "GeneratorCollections/"; - String path; + var path = Bukkit.getPluginsFolder().toPath(); if(CommonModule.getInstance().getDependencyComponent().isFastAsyncWorldEditEnabled()) - path = "/../FastAsyncWorldEdit/schematics/"; + path = path.resolve("FastAsyncWorldEdit").resolve("schematics"); else if(CommonModule.getInstance().getDependencyComponent().isWorldEditEnabled()) - path = "/../WorldEdit/schematics/"; + path = path.resolve("WorldEdit").resolve("schematics"); else return false; if(update) { ChatHelper.logPlayerAndConsole(p, "§cThe Generator Collections package is outdated. Updating...", Level.INFO); - - deleteDirectory(BuildTeamTools.getInstance().getDataFolder().getAbsolutePath() + path + fileDirectory); + deleteDirectory(path.resolve(fileDirectory)); } else ChatHelper.logPlayerAndConsole(p, "§cThe Generator Collections package wasn't found on your server. Installing...", Level.INFO); - - + var generatorModulePath = BuildTeamTools.getInstance().getDataFolder().toPath().resolve("modules").resolve("generator"); try { - boolean success = installZipFolder(parentURL, filename, path); + boolean success = installZipFolder(parentURL, filename, path, generatorModulePath); + if (success) + success = moveVersionFile(generatorModulePath, path.resolve("GeneratorCollections"), "config.yml", "generatorCollectionsVersion.yml"); if(success) { ChatHelper.logPlayerAndConsole(p, "§7Successfully installed §eGenerator Collections v" + GENERATOR_COLLECTIONS_VERSION + "§7!", Level.INFO); @@ -400,4 +385,32 @@ else if(CommonModule.getInstance().getDependencyComponent().isWorldEditEnabled() } } + /** + * Moves a file from the old directory to the new directory + * + * @param newDir The new directory to move the file to + * @param oldDir The old directory to move the file from + * @param oldFileName The name of the file to move + * @param newFileName The new name of the file + * @return Whether the move was successful + */ + private static boolean moveVersionFile(@NotNull Path newDir, @NotNull Path oldDir, String oldFileName, String newFileName) { + Path source = oldDir.resolve(oldFileName); + Path target = newDir.resolve(newFileName); + + try { + // Ensure target parent exists + Files.createDirectories(target.getParent()); + + // Move with replace to avoid failure if target exists + Files.move(source, target, java.nio.file.StandardCopyOption.REPLACE_EXISTING); + + return true; + } catch (IOException e) { + BuildTeamTools.getInstance().getComponentLogger() + .warn("Failed to move '{}' to '{}': {}", source, target, e.toString()); + return false; + } + } + } From 2ed6e29df56b819418b5a1216a9dc455cb27ec2f Mon Sep 17 00:00:00 2001 From: Zoriot Date: Sat, 10 Jan 2026 19:27:48 +0100 Subject: [PATCH 06/23] =?UTF-8?q?fix(stats):=20=E2=9C=A8=20add=20validatio?= =?UTF-8?q?n=20for=20Network=20Module=20Build=20Team=20connection=20on=20e?= =?UTF-8?q?nable?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes #34. --- .../modules/stats/StatsModule.java | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/main/java/net/buildtheearth/modules/stats/StatsModule.java b/src/main/java/net/buildtheearth/modules/stats/StatsModule.java index 35001cf9..9b505666 100644 --- a/src/main/java/net/buildtheearth/modules/stats/StatsModule.java +++ b/src/main/java/net/buildtheearth/modules/stats/StatsModule.java @@ -40,6 +40,16 @@ public static StatsModule getInstance() { @Override public void enable() { + if (NetworkModule.getInstance().getBuildTeam() == null) { + shutdown("The Network Module failed to load the Build Team."); + return; + } + + if (!NetworkModule.getInstance().getBuildTeam().isConnected() || !Bukkit.getServerConfig().isProxyEnabled()) { + shutdown("The Build Team have to be connected to the BtE Network (Proxy)."); + return; + } + statsServer = new StatsServer(); statsPlayerList = new HashMap<>(); @@ -93,18 +103,18 @@ public void addStatsPlayer(UUID uuid) { */ public boolean updateAndSave() { List communicators = NetworkModule.getInstance().getCommunicators(); - if (communicators.size() == 0) return false; + if (communicators.isEmpty()) return false; if (!BuildTeamTools.getInstance().isEnabled()) return false; - Player p = Bukkit.getPlayer(communicators.get(0)); + Player p = Bukkit.getPlayer(communicators.getFirst()); if (p == null) { - communicators.remove(0); + communicators.removeFirst(); return false; } if (!p.isOnline()) { - communicators.remove(0); + communicators.removeFirst(); return false; } From c0efe6b4c43fb6dece26d546e6b3dab1f39392fb Mon Sep 17 00:00:00 2001 From: Zoriot Date: Sat, 10 Jan 2026 19:30:49 +0100 Subject: [PATCH 07/23] =?UTF-8?q?feat(build):=20=E2=9C=A8=20update=20build?= =?UTF-8?q?=20configuration,=20enhance=20module=20registration,=20and=20im?= =?UTF-8?q?prove=20error=20handling?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 10 ++--- build.gradle.kts | 22 ++-------- .../net/buildtheearth/BuildTeamTools.java | 11 +++-- .../buildtheearth/modules/ModuleHandler.java | 44 ++++++++++--------- .../common/listeners/CommandListener.java | 3 +- .../components/rail/RailScripts.java | 10 ++--- .../modules/plotsystem/PlotSystemModule.java | 14 ++---- src/main/resources/config.yml | 2 +- 8 files changed, 46 insertions(+), 70 deletions(-) diff --git a/README.md b/README.md index 7ff45773..704f4b04 100644 --- a/README.md +++ b/README.md @@ -4,10 +4,9 @@ Logo

- Logo + Logo

-

BuildTeamTools

@@ -25,7 +24,6 @@

Downloads Count Latest Version - Total Lines Repo Size

@@ -41,11 +39,11 @@ Its primary goal is to significantly speed up the building process by eliminatin ## Features 🔨 **Easy-to-use** Tools for everything around BuildTheEarth
-⏱ **Multi-Version** support from `1.18` - `1.21.4`
+⏱ **Multi-Version** support from `1.18` - `1.21.x`
✔️ **User-friendly** GUIs and Commands
-💬 **Multi-Language** Support (PLANNED)
📆 **Automatic** Updates
🔌 **Easy setup** and configuration
+**Multi-Language** Support (PLANNED)
## Components @@ -64,7 +62,7 @@ The **\*** symbol shows that this feature is still being developed or under main ## Installation 💻 **Requirements:** -- A Server running Paper 1.18 - **1.21.4**. +- A Server running Paper 1.18 - **1.21.x**. 🚩 **How to install:** 1. Download BuildTeamTools [here](https://www.spigotmc.org/resources/buildteamtools.101854/). diff --git a/build.gradle.kts b/build.gradle.kts index c6dd11b1..7ac88f94 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -108,27 +108,10 @@ tasks.shadowJar { exclude("org/jetbrains/annotations/**") // Exclude slf4j classes exclude("org/slf4j/**") - exclude("META-INF/**") - // Exclude duplicate com.sun.* classes - exclude("com/sun/codemodel/**") - exclude("com/sun/tools/xjc/**") - exclude("com/sun/xml/xsom/**") archiveClassifier = "" - val relocationPrefix = "net.buildtheearth.buildteamtools.shaded" - relocate("com.alpsbte.alpslib", "$relocationPrefix.alpslib") - relocate("org.mariadb.jdbc", "$relocationPrefix.jdbc") - relocate("com.zaxxer.hikari", "$relocationPrefix.hikari") - relocate("net.wesjd.anvilgui", "$relocationPrefix.anvilgui") - relocate("com.cryptomorin.xseries", "$relocationPrefix.xseries") - relocate("org.ipvp.canvas", "$relocationPrefix.canvas") - relocate("net.daporkchop.lib.binary", "$relocationPrefix.binary") - relocate("clipper2", "$relocationPrefix.clipper2") - relocate("com.google.gson", "$relocationPrefix.gson") - relocate("de.micromata.jak", "$relocationPrefix.jak") - relocate("org.json", "$relocationPrefix.json") - relocate("com.google.guava", "$relocationPrefix.guava") - relocate("com.squareup.okhttp3", "$relocationPrefix.okhttp3") + relocationPrefix = "net.buildtheearth.buildteamtools.shaded" + enableAutoRelocation = true } tasks.assemble { @@ -136,6 +119,7 @@ tasks.assemble { } tasks.jar { + archiveClassifier = "UNSHADED" enabled = false // Disable the default jar task since we are using shadowJar } diff --git a/src/main/java/net/buildtheearth/BuildTeamTools.java b/src/main/java/net/buildtheearth/BuildTeamTools.java index accc350b..e051cd5a 100644 --- a/src/main/java/net/buildtheearth/BuildTeamTools.java +++ b/src/main/java/net/buildtheearth/BuildTeamTools.java @@ -8,6 +8,7 @@ import net.buildtheearth.modules.miscellaneous.MiscModule; import net.buildtheearth.modules.navigation.NavigationModule; import net.buildtheearth.modules.network.NetworkModule; +import net.buildtheearth.modules.plotsystem.PlotSystemModule; import net.buildtheearth.modules.stats.StatsModule; import net.buildtheearth.utils.io.ConfigUtil; import org.bukkit.configuration.file.FileConfiguration; @@ -37,16 +38,14 @@ public void onEnable() { instance = this; // Register Modules - - // We need to register the Common Module first to have the Config System Available for other modules/logic. - ModuleHandler.getInstance().registerModule(CommonModule.getInstance()); - ModuleHandler.getInstance().enable(CommonModule.getInstance(), null); - ModuleHandler.getInstance().registerModules( + CommonModule.getInstance(), NetworkModule.getInstance(), GeneratorModule.getInstance(), NavigationModule.getInstance(), - MiscModule.getInstance() + MiscModule.getInstance(), + StatsModule.getInstance(), + PlotSystemModule.getInstance() ); ModuleHandler.getInstance().enableAll(null); } diff --git a/src/main/java/net/buildtheearth/modules/ModuleHandler.java b/src/main/java/net/buildtheearth/modules/ModuleHandler.java index 6583f17c..3877ec9b 100644 --- a/src/main/java/net/buildtheearth/modules/ModuleHandler.java +++ b/src/main/java/net/buildtheearth/modules/ModuleHandler.java @@ -12,7 +12,6 @@ import java.util.ArrayList; import java.util.List; -import java.util.Objects; /** * @author Noah Husby @@ -45,11 +44,8 @@ public void registerModule(Module module) { * @param modules {@link Module} */ public void registerModules(Module @NotNull ... modules) { - for (Module m : modules) { - if (!BuildTeamTools.getInstance().getConfig().getList(ConfigPaths.DISABLED_MODULES, List.of()).contains(m.getModuleName())) { - registerModule(m); - } - } + for (Module m : modules) + registerModule(m); } /** @@ -64,24 +60,30 @@ public boolean enable(@NotNull Module module, @Nullable CommandSender executor) if (m.getModuleName().equals(module.getModuleName()) && m.isEnabled()) return false; - boolean containsDisabledDependencyModule = false; - for (Module m : module.getDependsOnModules()) - if (!m.isEnabled()) { - module.checkForModuleDependencies(); - containsDisabledDependencyModule = true; + if (!module.getModuleName().equals("Common") && BuildTeamTools.getInstance().getConfig().getList(ConfigPaths.DISABLED_MODULES, List.of()).contains(module.getModuleName())) { + module.shutdown("This module is disabled in the config."); + } else { + boolean containsDisabledDependencyModule = false; + for (Module m : module.getDependsOnModules()) + if (!m.isEnabled()) { + module.checkForModuleDependencies(); + containsDisabledDependencyModule = true; + } + + try { + if (!containsDisabledDependencyModule) + module.enable(); + } catch (Exception ex) { + if (BuildTeamTools.getInstance().isDebug()) { + ChatHelper.logError("An error occurred while enabling the %s Module: %s", ex, module.getModuleName(), + ex.getMessage()); + } + + module.shutdown(ex.getMessage()); } + } - try { - if (!containsDisabledDependencyModule) - module.enable(); - } catch (Exception ex) { - if (BuildTeamTools.getInstance().isDebug()) { - ChatHelper.logError("An error occurred while enabling the %s Module: %s", ex, module.getModuleName(), - ex.getMessage()); - } - module.shutdown(ex.getMessage()); - } if (executor != null) { if (module.isEnabled() && BuildTeamTools.getInstance().isDebug()) diff --git a/src/main/java/net/buildtheearth/modules/common/listeners/CommandListener.java b/src/main/java/net/buildtheearth/modules/common/listeners/CommandListener.java index 0c474c0a..3eee3f7f 100644 --- a/src/main/java/net/buildtheearth/modules/common/listeners/CommandListener.java +++ b/src/main/java/net/buildtheearth/modules/common/listeners/CommandListener.java @@ -20,11 +20,12 @@ public void onCommand(PlayerCommandPreprocessEvent e) { for(Module module : ModuleHandler.getInstance().getModules()) if(!module.isEnabled()) for(PluginCommand command : module.getCommands().keySet()) { + if (command == null) continue; List commands = command.getAliases(); commands.add(command.getLabel()); for (String alias : commands) { - if (message.toLowerCase().startsWith("/" + alias.toLowerCase())) { + if (message.toLowerCase().equalsIgnoreCase("/" + alias.toLowerCase())) { String reason = ""; if (module.getError() != null && !module.getError().isEmpty()) diff --git a/src/main/java/net/buildtheearth/modules/generator/components/rail/RailScripts.java b/src/main/java/net/buildtheearth/modules/generator/components/rail/RailScripts.java index 3178a538..8c6bdf5f 100644 --- a/src/main/java/net/buildtheearth/modules/generator/components/rail/RailScripts.java +++ b/src/main/java/net/buildtheearth/modules/generator/components/rail/RailScripts.java @@ -1,9 +1,8 @@ package net.buildtheearth.modules.generator.components.rail; -import net.buildtheearth.BuildTeamTools; -import net.buildtheearth.modules.generator.model.*; +import net.buildtheearth.modules.generator.model.GeneratorComponent; +import net.buildtheearth.modules.generator.model.Script; import net.buildtheearth.modules.generator.utils.GeneratorUtils; -import org.bukkit.Bukkit; import org.bukkit.block.Block; import org.bukkit.entity.Player; import org.bukkit.util.Vector; @@ -16,7 +15,9 @@ public class RailScripts extends Script { public RailScripts(Player player, GeneratorComponent generatorComponent) { super(player, generatorComponent); - Bukkit.getScheduler().runTaskAsynchronously(BuildTeamTools.getInstance(), this::railScript_v_1_3); + throw new UnsupportedOperationException("RailScripts is currently broken."); + //getPlayer().chat("/clearhistory"); + //Bukkit.getScheduler().runTaskAsynchronously(BuildTeamTools.getInstance(), this::railScript_v_1_3); } public void railScript_v_1_3() { @@ -27,7 +28,6 @@ public void railScript_v_1_3() { int zPos = getPlayer().getLocation().getBlockZ(); int operations = 0; - getPlayer().chat("/clearhistory"); int railWidth = 5; diff --git a/src/main/java/net/buildtheearth/modules/plotsystem/PlotSystemModule.java b/src/main/java/net/buildtheearth/modules/plotsystem/PlotSystemModule.java index 18f728c2..c84c2664 100644 --- a/src/main/java/net/buildtheearth/modules/plotsystem/PlotSystemModule.java +++ b/src/main/java/net/buildtheearth/modules/plotsystem/PlotSystemModule.java @@ -7,18 +7,9 @@ import com.alpsbte.alpslib.libpsterra.core.config.PSInitializer; import com.alpsbte.alpslib.libpsterra.core.plotsystem.PlotCreator; import com.alpsbte.alpslib.libpsterra.core.plotsystem.PlotPaster;*/ -import net.buildtheearth.BuildTeamTools; + import net.buildtheearth.modules.Module; -import net.buildtheearth.modules.common.CommonModule; -import net.buildtheearth.modules.network.NetworkModule; import net.buildtheearth.modules.plotsystem.commands.PlotSystemTerraCommand; -import net.buildtheearth.utils.ChatHelper; -import net.buildtheearth.utils.io.ConfigPaths; -import net.buildtheearth.utils.io.ConfigUtil; -import net.buildtheearth.utils.io.Constants; -import net.buildtheearth.utils.io.Errors; -import org.apache.commons.lang3.NotImplementedException; -import org.bukkit.Bukkit; public class PlotSystemModule extends Module { @@ -48,7 +39,8 @@ public static PlotSystemModule getInstance() { @Override public void enable() { - throw new NotImplementedException("Currently broken");/* + shutdown("This module is currently oudated & broken."); + /* // Check if WorldEdit is enabled if (!CommonModule.getInstance().getDependencyComponent().isWorldEditEnabled()) { shutdown(Errors.WORLD_EDIT_NOT_INSTALLED); diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index c56d1836..8d7e53a4 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -8,7 +8,7 @@ # The Build Team API Key used to fetch build team info for display. # Find the key on the Minecraft Network at "buildtheearth.net". Navigate: Compass > Build Teams > My Teams > Your Team > API-Key. -# Without this key, some plugin components won't function. For assistance, see #server-support on the staff discord. +# Without this key, some plugin components wont function. For assistance, see #server-support on the staff discord. api-key: 00000000-0000-0000-0000-000000000000 # The main world using the custom BTE Dynmaxion projection From 227b4270fc5c544320f500a1fcb41fbd2ee1db57 Mon Sep 17 00:00:00 2001 From: Zoriot Date: Sat, 10 Jan 2026 19:31:29 +0100 Subject: [PATCH 08/23] =?UTF-8?q?fix(housescripts):=20=E2=9C=A8=20correct?= =?UTF-8?q?=20block=20query=20logic=20for=20roof=20type=20handling?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes #59. --- .../modules/generator/components/house/HouseScripts.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/main/java/net/buildtheearth/modules/generator/components/house/HouseScripts.java b/src/main/java/net/buildtheearth/modules/generator/components/house/HouseScripts.java index 8fd67493..f2fb1eab 100644 --- a/src/main/java/net/buildtheearth/modules/generator/components/house/HouseScripts.java +++ b/src/main/java/net/buildtheearth/modules/generator/components/house/HouseScripts.java @@ -13,7 +13,6 @@ import net.buildtheearth.utils.Item; import net.buildtheearth.utils.MenuItems; import org.bukkit.Bukkit; -import org.bukkit.Material; import org.bukkit.block.Block; import org.bukkit.entity.Player; import org.bukkit.util.Vector; @@ -425,7 +424,7 @@ public void buildscript_v_1_2(){ for(int i = 0; i < maxRoofHeight; i++) { if(roofType == RoofType.FLATTER_SLABS || roofType == RoofType.MEDIUM_SLABS) //Only select air block that are surrounded by other stone slabs below or which are directly neighbors to lime wool or blue wool - replaceBlocksWithMask("=queryRel(0,-1,0,43)&&" + + replaceBlocksWithMask("=queryRel(0,-1,0,43,0)&&" + "(" + "(" + "queryRel(1,-1,0,43,-1)&&queryRel(-1,-1,0,43,-1)&&queryRel(0,-1,1,43,-1)&&queryRel(0,-1,-1,43,-1)" + From b48fc24cd2cf73d87dbbe975fdeae8da38af3c09 Mon Sep 17 00:00:00 2001 From: Zoriot Date: Sat, 10 Jan 2026 19:31:58 +0100 Subject: [PATCH 09/23] =?UTF-8?q?fix(generator):=20=E2=9C=A8=20disable=20r?= =?UTF-8?q?ailway=20generator=20temporarly?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../generator/commands/GeneratorCommand.java | 5 ++++- .../modules/generator/menu/GeneratorMenu.java | 16 ++++++++-------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/main/java/net/buildtheearth/modules/generator/commands/GeneratorCommand.java b/src/main/java/net/buildtheearth/modules/generator/commands/GeneratorCommand.java index c24ca9c8..33429ede 100644 --- a/src/main/java/net/buildtheearth/modules/generator/commands/GeneratorCommand.java +++ b/src/main/java/net/buildtheearth/modules/generator/commands/GeneratorCommand.java @@ -6,6 +6,8 @@ import net.buildtheearth.modules.network.model.Permissions; import net.buildtheearth.utils.ChatHelper; import net.buildtheearth.utils.Utils; +import net.kyori.adventure.text.Component; +import net.kyori.adventure.text.format.NamedTextColor; import org.bukkit.command.Command; import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandSender; @@ -48,7 +50,8 @@ public boolean onCommand(@NotNull CommandSender sender, @NotNull Command cmd, @N // Command Usage: /gen rail ... case "rail": - GeneratorModule.getInstance().getRail().analyzeCommand(p, args); + p.sendMessage(Component.text("This generator have some serious issues and is currently disabled.", NamedTextColor.DARK_RED)); + //GeneratorModule.getInstance().getRail().analyzeCommand(p, args); return true; // Command Usage: /gen tree ... diff --git a/src/main/java/net/buildtheearth/modules/generator/menu/GeneratorMenu.java b/src/main/java/net/buildtheearth/modules/generator/menu/GeneratorMenu.java index a41d33f8..b8c4dd21 100644 --- a/src/main/java/net/buildtheearth/modules/generator/menu/GeneratorMenu.java +++ b/src/main/java/net/buildtheearth/modules/generator/menu/GeneratorMenu.java @@ -3,7 +3,6 @@ import com.cryptomorin.xseries.XMaterial; import net.buildtheearth.modules.common.CommonModule; import net.buildtheearth.modules.generator.GeneratorModule; -import net.buildtheearth.modules.generator.model.GeneratorCollections; import net.buildtheearth.modules.generator.components.field.Field; import net.buildtheearth.modules.generator.components.field.FieldSettings; import net.buildtheearth.modules.generator.components.field.menu.CropTypeMenu; @@ -11,14 +10,13 @@ import net.buildtheearth.modules.generator.components.house.HouseSettings; import net.buildtheearth.modules.generator.components.house.RoofType; import net.buildtheearth.modules.generator.components.house.menu.WallColorMenu; -import net.buildtheearth.modules.generator.components.rail.Rail; -import net.buildtheearth.modules.generator.components.rail.RailSettings; import net.buildtheearth.modules.generator.components.road.Road; import net.buildtheearth.modules.generator.components.road.RoadSettings; import net.buildtheearth.modules.generator.components.road.menu.RoadColorMenu; import net.buildtheearth.modules.generator.components.tree.Tree; import net.buildtheearth.modules.generator.components.tree.TreeSettings; import net.buildtheearth.modules.generator.components.tree.menu.TreeTypeMenu; +import net.buildtheearth.modules.generator.model.GeneratorCollections; import net.buildtheearth.modules.generator.model.GeneratorType; import net.buildtheearth.utils.Item; import net.buildtheearth.utils.ListUtil; @@ -26,13 +24,12 @@ import net.buildtheearth.utils.menus.AbstractMenu; import org.bukkit.ChatColor; import org.bukkit.Sound; -import org.bukkit.SoundCategory; -import org.bukkit.SoundGroup; import org.bukkit.entity.Player; import org.bukkit.event.inventory.ClickType; import org.bukkit.inventory.ItemStack; import org.ipvp.canvas.mask.BinaryMask; import org.ipvp.canvas.mask.Mask; + import java.util.ArrayList; public class GeneratorMenu extends AbstractMenu { @@ -110,7 +107,9 @@ protected void setPreviewItems() { "§8Left-click to generate", "§8Right-click for Tutorial"); - ItemStack railwayItem = Item.create(XMaterial.RAIL.parseMaterial(), "§9Generate Railway", railwayLore); + railwayLore = ListUtil.createList("", "§cThis §eGenerator §cis currently broken", "§cRailway Generator is disabled", "", "§8If you want to help fixing ask on Dev Hub!"); + + ItemStack railwayItem = Item.create(XMaterial.RAIL.parseMaterial(), "§9Generate Railway §c(DISABLED)", railwayLore); // Set navigator item getMenu().getSlot(RAILWAY_ITEM_SLOT).setItem(railwayItem); @@ -221,8 +220,9 @@ protected void setItemClickEventsAsync() { sendMoreInformation(clickPlayer, GeneratorType.RAILWAY); return; } + sendMoreInformation(clickPlayer, GeneratorType.RAILWAY); - Rail rail = GeneratorModule.getInstance().getRail(); + /*Rail rail = GeneratorModule.getInstance().getRail(); rail.getPlayerSettings().put(clickPlayer.getUniqueId(), new RailSettings(clickPlayer)); if(!rail.checkForPlayer(clickPlayer)) @@ -231,7 +231,7 @@ protected void setItemClickEventsAsync() { clickPlayer.closeInventory(); clickPlayer.playSound(clickPlayer.getLocation(), Sound.UI_BUTTON_CLICK, 1.0F, 1.0F); - GeneratorModule.getInstance().getRail().generate(clickPlayer); + GeneratorModule.getInstance().getRail().generate(clickPlayer);*/ })); // Set click event for tree item From 64c6cdf742dad0181d726ee940825299d67caddb Mon Sep 17 00:00:00 2001 From: Zoriot Date: Sat, 10 Jan 2026 21:58:32 +0100 Subject: [PATCH 10/23] =?UTF-8?q?fix(generator):=20=E2=9C=A8=20disable=20f?= =?UTF-8?q?ield=20generator=20temporarily?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/generator/commands/GeneratorCommand.java | 3 ++- .../modules/generator/components/field/FieldScripts.java | 8 ++++---- .../modules/generator/menu/GeneratorMenu.java | 4 +++- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/main/java/net/buildtheearth/modules/generator/commands/GeneratorCommand.java b/src/main/java/net/buildtheearth/modules/generator/commands/GeneratorCommand.java index 33429ede..0a7663a9 100644 --- a/src/main/java/net/buildtheearth/modules/generator/commands/GeneratorCommand.java +++ b/src/main/java/net/buildtheearth/modules/generator/commands/GeneratorCommand.java @@ -61,7 +61,8 @@ public boolean onCommand(@NotNull CommandSender sender, @NotNull Command cmd, @N // Command Usage: /gen field ... case "field": - GeneratorModule.getInstance().getField().analyzeCommand(p, args); + p.sendMessage(Component.text("This generator have some serious issues and is currently disabled.", NamedTextColor.DARK_RED)); + //GeneratorModule.getInstance().getField().analyzeCommand(p, args); return true; // Command Usage: /gen history diff --git a/src/main/java/net/buildtheearth/modules/generator/components/field/FieldScripts.java b/src/main/java/net/buildtheearth/modules/generator/components/field/FieldScripts.java index ac0592c3..eb4696c4 100644 --- a/src/main/java/net/buildtheearth/modules/generator/components/field/FieldScripts.java +++ b/src/main/java/net/buildtheearth/modules/generator/components/field/FieldScripts.java @@ -1,11 +1,9 @@ package net.buildtheearth.modules.generator.components.field; -import net.buildtheearth.BuildTeamTools; import net.buildtheearth.modules.generator.model.Flag; import net.buildtheearth.modules.generator.model.GeneratorComponent; import net.buildtheearth.modules.generator.model.Script; import net.buildtheearth.modules.generator.utils.GeneratorUtils; -import org.bukkit.Bukkit; import org.bukkit.block.Block; import org.bukkit.entity.Player; import org.bukkit.util.Vector; @@ -18,8 +16,10 @@ public class FieldScripts extends Script { public FieldScripts(Player player, GeneratorComponent generatorComponent) { super(player, generatorComponent); - - Bukkit.getScheduler().runTaskAsynchronously(BuildTeamTools.getInstance(), this::fieldScript_v_1_0); + + throw new UnsupportedOperationException("FieldScripts are currently broken."); + + //Bukkit.getScheduler().runTaskAsynchronously(BuildTeamTools.getInstance(), this::fieldScript_v_1_0); } public void fieldScript_v_1_0() { diff --git a/src/main/java/net/buildtheearth/modules/generator/menu/GeneratorMenu.java b/src/main/java/net/buildtheearth/modules/generator/menu/GeneratorMenu.java index b8c4dd21..833b8dc2 100644 --- a/src/main/java/net/buildtheearth/modules/generator/menu/GeneratorMenu.java +++ b/src/main/java/net/buildtheearth/modules/generator/menu/GeneratorMenu.java @@ -164,7 +164,9 @@ protected void setPreviewItems() { "§8Left-click to generate", "§8Right-click for Tutorial"); - ItemStack fieldItem = Item.create(XMaterial.WHEAT.parseMaterial(), "§6Generate Field", fieldLore); + fieldLore = ListUtil.createList("", "§cThis §eGenerator §cis currently broken", "§cField Generator is disabled", "", "§8If you want to help fixing ask on Dev Hub!"); + + ItemStack fieldItem = Item.create(XMaterial.WHEAT.get(), "§6Generate Field §c(DISABLED)", fieldLore); // Set navigator item getMenu().getSlot(FIELD_ITEM_SLOT).setItem(fieldItem); From d8f3aa6aa04cddddeb8e88abfedb340172f818e2 Mon Sep 17 00:00:00 2001 From: Zoriot Date: Sat, 10 Jan 2026 21:59:12 +0100 Subject: [PATCH 11/23] =?UTF-8?q?refactor(generator):=20=E2=9C=A8=20update?= =?UTF-8?q?=20generator=20components=20to=20use=20centralized=20wiki=20lin?= =?UTF-8?q?ks=20and=20improve=20constructor=20parameters?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 30 ++-- .../net/buildtheearth/modules/Module.java | 26 ++-- .../modules/common/CommonModule.java | 50 ++----- .../modules/generator/GeneratorModule.java | 27 ++-- .../generator/commands/GeneratorCommand.java | 10 +- .../generator/components/field/Field.java | 1 - .../components/field/menu/CropStageMenu.java | 79 +++++----- .../components/field/menu/CropTypeMenu.java | 54 ++----- .../generator/components/house/House.java | 3 +- .../generator/components/rail/Rail.java | 9 -- .../generator/components/road/Road.java | 8 - .../generator/components/tree/Tree.java | 8 +- .../modules/generator/menu/GeneratorMenu.java | 140 +++++------------- .../generator/model/GeneratorCollections.java | 39 +++-- .../generator/model/GeneratorComponent.java | 78 ++++------ .../generator/model/GeneratorType.java | 17 ++- .../modules/miscellaneous/MiscModule.java | 17 ++- .../modules/navigation/NavigationModule.java | 3 +- .../modules/network/NetworkModule.java | 5 +- .../modules/plotsystem/PlotSystemModule.java | 19 +-- .../modules/stats/StatsModule.java | 18 +-- .../net/buildtheearth/utils/WikiLinks.java | 37 +++++ src/main/resources/config.yml | 4 +- .../resources/modules/navigation/config.yml | 4 +- 24 files changed, 272 insertions(+), 414 deletions(-) create mode 100644 src/main/java/net/buildtheearth/utils/WikiLinks.java diff --git a/README.md b/README.md index 704f4b04..e40c361b 100644 --- a/README.md +++ b/README.md @@ -78,29 +78,29 @@ The **\*** symbol shows that this feature is still being developed or under main **For more help, please see the [wiki](https://resources.buildtheearth.net/s/btt).** ## Contributors -Thank you to the following developers for contributing towards the plugin: -- **MineFact** -- **frikandelworst** -- **Brigart** -- **v4siv** -- **Adam** -- **Noah Husby** -- **Zoriot** +Thanks to all our contributors for contributing towards the plugin development and improvement! +You find them on the [contributors page](https://github.com/BuildTheEarth/BuildTeamTools/graphs/contributors). +Special thanks to the people currently working on the plugin: + +- **[Zoriot](https://github.com/Zoriot)** +- **[Jasupa](https://github.com/Jasupa)** +- **[frikandelworst](https://github.com/kyanvde)** +- **[MineFact](https://github.com/MineFact)** ## Index Click the links below for more information, or see the [wiki](https://resources.buildtheearth.net/s/btt). +- [Sledgehammer](https://resources.buildtheearth.net/s/btt/doc/sledgehammer-module-T7I0PWPsTD) - [Generators](https://resources.buildtheearth.net/s/btt/doc/generator-module-13zqgI4yFA) - [Houses](https://resources.buildtheearth.net/s/btt/doc/house-generator-YKQunon6Bp) - [Roads](https://resources.buildtheearth.net/s/btt/doc/road-generator-QqKBBP0nqO) - - [Railways](https://resources.buildtheearth.net/s/btt/doc/rail-generator-EfgKXdBvk1) + - [Railways [Currently Broken]](https://resources.buildtheearth.net/s/btt/doc/rail-generator-EfgKXdBvk1) - [Trees](https://resources.buildtheearth.net/s/btt/doc/tree-generator-pnDmYC9hzW) - [Fields](https://resources.buildtheearth.net/s/btt/doc/field-generator-OqIN2BrZT7) -- [Sledgehammer](https://resources.buildtheearth.net/s/btt/doc/sledgehammer-module-T7I0PWPsTD) -- [Statistics](https://resources.buildtheearth.net/s/btt/doc/statistics-module-iM7IfoKroF) (PLANNED) -- [Plot System](https://resources.buildtheearth.net/s/btt/doc/plot-system-module-kkcH00jpcQ) (PLANNED) -- [Tutorials](https://resources.buildtheearth.net/s/btt/doc/tutorials-module-lkc3LaOrql) (PLANNED) -- Miscellaneous (PLANNED) -- [Security](https://resources.buildtheearth.net/s/btt/doc/security-module-iOmxV0djrW) (PLANNED) +- [Statistics](https://resources.buildtheearth.net/s/btt/doc/statistics-module-iM7IfoKroF) +- [Miscellaneous](https://resources.buildtheearth.net/doc/miscellaneous-appUzeNc5I) + - [Block Palette GUI](https://resources.buildtheearth.net/doc/block-palette-gui-hW8InCtxcq) +- Tutorials (PLANNED) +- Plot System (PLANNED - use [PST](https://github.com/AlpsBTE/Plot-System-Terra) for now) diff --git a/src/main/java/net/buildtheearth/modules/Module.java b/src/main/java/net/buildtheearth/modules/Module.java index c3b2f9c7..a056a14c 100644 --- a/src/main/java/net/buildtheearth/modules/Module.java +++ b/src/main/java/net/buildtheearth/modules/Module.java @@ -8,7 +8,6 @@ import org.bukkit.command.CommandExecutor; import org.bukkit.command.PluginCommand; import org.bukkit.command.TabCompleter; -import org.bukkit.entity.Player; import org.bukkit.event.HandlerList; import org.bukkit.event.Listener; @@ -20,7 +19,7 @@ /** * An interface for BuildTeamTools modules * - * @authors MineFact, Noah Husby + * @author MineFact, Noah Husby */ public abstract class Module implements WikiDocumented { @@ -53,12 +52,13 @@ public abstract class Module implements WikiDocumented { /** Initializes a new module. * * @param moduleName The name of the module + * @param wikiPage The wiki page of the module * @param dependsOnModules The modules that this module depends on. If any of these modules are disabled, this module will be disabled as well. */ - protected Module(String moduleName, Module... dependsOnModules) { + protected Module(String moduleName, String wikiPage, Module... dependsOnModules) { this.moduleName = moduleName; this.dependsOnModules.addAll(Arrays.asList(dependsOnModules)); - this.wikiPage = "https://github.com/BuildTheEarth/BuildTeamTools/wiki/" + moduleName + "-Module"; + this.wikiPage = wikiPage; registerCommands(); registerListeners(); @@ -114,8 +114,8 @@ protected void registerCommands(){} protected void registerCommand(@NonNull String command, @NonNull CommandExecutor executor){ this.commands.put(BuildTeamTools.getInstance().getCommand(command), executor); - if(executor instanceof TabCompleter) - this.tabCompleter.put(BuildTeamTools.getInstance().getCommand(command), (TabCompleter) executor); + if (executor instanceof TabCompleter tc) + this.tabCompleter.put(BuildTeamTools.getInstance().getCommand(command), tc); } /** Registers a command for the module. @@ -133,11 +133,11 @@ protected void registerCommand(@NonNull String command, @NonNull CommandExecutor /** Loads the commands for the module into Bukkit */ private void loadCommands(){ - for(PluginCommand command : commands.keySet()) - command.setExecutor(commands.get(command)); + for (var command : commands.entrySet()) + command.getKey().setExecutor(command.getValue()); - for(PluginCommand command : tabCompleter.keySet()) - command.setTabCompleter(tabCompleter.get(command)); + for (var command : tabCompleter.entrySet()) + command.getKey().setTabCompleter(command.getValue()); } @@ -174,12 +174,12 @@ private void unregisterListeners(){ protected void checkForModuleDependencies(){ for(Module module : dependsOnModules) if(!module.isEnabled()) { - String error = "The " + module.getModuleName() + " Module is currently disabled."; + String moduleDepsError = "The " + module.getModuleName() + " Module is currently disabled."; if(module.getError() != null && !module.getError().isEmpty()) - error = module.getError(); + moduleDepsError = module.getError(); - shutdown(error); + shutdown(moduleDepsError); return; } } diff --git a/src/main/java/net/buildtheearth/modules/common/CommonModule.java b/src/main/java/net/buildtheearth/modules/common/CommonModule.java index b9e67f6c..ac31e512 100644 --- a/src/main/java/net/buildtheearth/modules/common/CommonModule.java +++ b/src/main/java/net/buildtheearth/modules/common/CommonModule.java @@ -17,6 +17,7 @@ import net.buildtheearth.modules.stats.StatsModule; import net.buildtheearth.modules.stats.model.StatsPlayerType; import net.buildtheearth.modules.stats.model.StatsServerType; +import net.buildtheearth.utils.WikiLinks; import net.buildtheearth.utils.io.ConfigPaths; import net.buildtheearth.utils.io.ConfigUtil; import org.bukkit.Bukkit; @@ -43,7 +44,7 @@ public class CommonModule extends Module { private static CommonModule instance = null; public CommonModule() { - super("Common"); + super("Common", WikiLinks.ENTRY); } public static CommonModule getInstance() { @@ -57,7 +58,7 @@ public void enable() { try { YamlFileFactory.registerPlugin(BuildTeamTools.getInstance()); ConfigUtil.init(); - } catch (ConfigNotImplementedException ex) { + } catch (ConfigNotImplementedException ex) { // Fine? } // Reload the configuration file @@ -86,21 +87,10 @@ public void registerCommands() { @Override public void registerListeners() { - super.registerListeners( - new MenuFunctionListener(), - new CommandListener() - ); - - // The ServerExceptionEvent only exists in Paper not in Spigot - try{ - getListeners().add(new ExceptionListener()); - }catch (Exception ignored){} + super.registerListeners(new MenuFunctionListener(), new CommandListener(), new ExceptionListener()); } - - - /** * The main Timer of the plugin that runs once a second. * It calls the tick() function. @@ -109,20 +99,14 @@ private void startTimer() { Bukkit.getScheduler().scheduleSyncRepeatingTask(BuildTeamTools.getInstance(), () -> { time++; - // Every hour - if (time % (20 * 60 * 60) == 0) { - // Do something - } - // Every 10 minutes (+1 second) - if (time % (NetworkModule.CACHE_UPLOAD_SPEED) == 0) { - if(StatsModule.getInstance().isEnabled()) - StatsModule.getInstance().updateAndSave(); - } + if (time % (NetworkModule.CACHE_UPLOAD_SPEED) == 0 && StatsModule.getInstance().isEnabled()) + StatsModule.getInstance().updateAndSave(); + // Every minute if (time % (20 * 60) == 0) { - if(StatsModule.getInstance().isEnabled()){ + if (StatsModule.getInstance().isEnabled()) { StatsModule.getInstance().getStatsServer().addValue(StatsServerType.UPTIME, 1); for (Player p : Bukkit.getOnlinePlayers()) { @@ -131,23 +115,7 @@ private void startTimer() { } } - if(CommonModule.getInstance().isEnabled()) - ExceptionListener.limiter = false; - } - - // Every 5 seconds - if (time % 100 == 0) { - // Do something - } - - // Every second - if (time % 20 == 0) { - // Do something - } - - // Every 0.25 seconds - if (time % 5 == 0) { - // Do something + if (CommonModule.getInstance().isEnabled()) ExceptionListener.limiter = false; } GeneratorModule.getInstance().tick(); diff --git a/src/main/java/net/buildtheearth/modules/generator/GeneratorModule.java b/src/main/java/net/buildtheearth/modules/generator/GeneratorModule.java index 6a702a7c..5a739166 100644 --- a/src/main/java/net/buildtheearth/modules/generator/GeneratorModule.java +++ b/src/main/java/net/buildtheearth/modules/generator/GeneratorModule.java @@ -1,7 +1,6 @@ package net.buildtheearth.modules.generator; import com.sk89q.worldedit.LocalSession; -import com.sk89q.worldedit.WorldEdit; import lombok.Getter; import net.buildtheearth.modules.Module; import net.buildtheearth.modules.common.CommonModule; @@ -16,21 +15,17 @@ import net.buildtheearth.modules.generator.listeners.GeneratorListener; import net.buildtheearth.modules.generator.model.Command; import net.buildtheearth.modules.generator.model.GeneratorCollections; -import net.buildtheearth.modules.generator.model.GeneratorComponent; import net.buildtheearth.modules.generator.model.History; -import net.buildtheearth.modules.navigation.components.navigator.listeners.NavigatorJoinListener; -import net.buildtheearth.modules.navigation.components.navigator.listeners.NavigatorOpenListener; -import net.buildtheearth.modules.navigation.components.tpll.listeners.TpllJoinListener; -import net.buildtheearth.modules.navigation.components.tpll.listeners.TpllListener; -import net.buildtheearth.modules.navigation.components.warps.listeners.WarpJoinListener; +import net.buildtheearth.utils.WikiLinks; import org.bukkit.entity.Player; -import java.util.*; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.UUID; public class GeneratorModule extends Module { - public static String INSTALL_WIKI = "https://github.com/BuildTheEarth/BuildTeamTools/wiki/Installation"; - private final HashMap playerHistory = new HashMap<>(); @Getter @@ -52,7 +47,7 @@ public class GeneratorModule extends Module { private static GeneratorModule instance = null; public GeneratorModule() { - super("Generator"); + super("Generator", WikiLinks.GEN); } public static GeneratorModule getInstance() { @@ -74,11 +69,11 @@ public void enable() { tree = new Tree(); field = new Field(); - GeneratorCollections.GENERATOR_COLLECTIONS_VERSION = GeneratorCollections.getRepositoryReleaseVersionString("BuildTheEarth", "GeneratorCollections"); + GeneratorCollections.generatorCollectionsVersion = GeneratorCollections.getRepositoryReleaseVersionString("BuildTheEarth", "GeneratorCollections"); // In case the version could not be retrieved, set it to 3.0 as a fallback - if(GeneratorCollections.GENERATOR_COLLECTIONS_VERSION == null) - GeneratorCollections.GENERATOR_COLLECTIONS_VERSION = "3.0"; + if (GeneratorCollections.generatorCollectionsVersion == null) + GeneratorCollections.generatorCollectionsVersion = "3.0"; // Check if the GeneratorCollections plugin is installed and up to date GeneratorCollections.checkIfGeneratorCollectionsIsInstalled(null); @@ -110,12 +105,12 @@ public void registerListeners() { * @see Command#tick() */ public void tick() { - if (generatorCommands.size() == 0) + if (generatorCommands.isEmpty()) return; // Tick all commands in the queue for(Command command : new ArrayList<>(generatorCommands)){ - if(command.getOperations().size() == 0){ + if (command.getOperations().isEmpty()) { if(!command.isFinished()) command.finish(); generatorCommands.remove(command); diff --git a/src/main/java/net/buildtheearth/modules/generator/commands/GeneratorCommand.java b/src/main/java/net/buildtheearth/modules/generator/commands/GeneratorCommand.java index 0a7663a9..98d966ac 100644 --- a/src/main/java/net/buildtheearth/modules/generator/commands/GeneratorCommand.java +++ b/src/main/java/net/buildtheearth/modules/generator/commands/GeneratorCommand.java @@ -18,13 +18,11 @@ public class GeneratorCommand implements CommandExecutor { public boolean onCommand(@NotNull CommandSender sender, @NotNull Command cmd, @NotNull String cmdLabel, String @NotNull [] args) { - if (!(sender instanceof Player)) { + if (!(sender instanceof Player p)) { sender.sendMessage("§cOnly players can execute this command."); return true; } - Player p = (Player) sender; - if(!p.hasPermission(Permissions.GENERATOR_USE)) { p.sendMessage(ChatHelper.getErrorString("You don't have permission to use this command!")); return true; @@ -87,10 +85,10 @@ public boolean onCommand(@NotNull CommandSender sender, @NotNull Command cmd, @N case "redo": GeneratorModule.getInstance().getPlayerHistory(p).redoCommand(p); return true; + default: + sendHelp(p); + return true; } - - sendHelp(p); - return true; } public static void sendHelp(CommandSender sender) { diff --git a/src/main/java/net/buildtheearth/modules/generator/components/field/Field.java b/src/main/java/net/buildtheearth/modules/generator/components/field/Field.java index 49a20638..66a47dc3 100644 --- a/src/main/java/net/buildtheearth/modules/generator/components/field/Field.java +++ b/src/main/java/net/buildtheearth/modules/generator/components/field/Field.java @@ -9,7 +9,6 @@ public class Field extends GeneratorComponent { public Field() { super(GeneratorType.FIELD); - wikiPage = "https://github.com/BuildTheEarth/BuildTeamTools/wiki/Field-Command"; } @Override diff --git a/src/main/java/net/buildtheearth/modules/generator/components/field/menu/CropStageMenu.java b/src/main/java/net/buildtheearth/modules/generator/components/field/menu/CropStageMenu.java index 2a51d919..a0e4a1db 100644 --- a/src/main/java/net/buildtheearth/modules/generator/components/field/menu/CropStageMenu.java +++ b/src/main/java/net/buildtheearth/modules/generator/components/field/menu/CropStageMenu.java @@ -7,25 +7,28 @@ import net.buildtheearth.utils.Item; import net.buildtheearth.utils.ListUtil; import net.buildtheearth.utils.MenuItems; +import net.buildtheearth.utils.WikiLinks; import net.buildtheearth.utils.menus.AbstractMenu; -import org.bukkit.ChatColor; +import net.kyori.adventure.text.Component; +import net.kyori.adventure.text.format.NamedTextColor; import org.bukkit.Sound; import org.bukkit.entity.Player; import org.bukkit.event.inventory.ClickType; import org.bukkit.inventory.ItemStack; import org.ipvp.canvas.mask.BinaryMask; import org.ipvp.canvas.mask.Mask; +import org.jspecify.annotations.NonNull; -public class CropStageMenu extends AbstractMenu { +import java.util.ArrayList; - public static String CROP_TYPE_INV_NAME = "Choose a Crop Stage"; +public class CropStageMenu extends AbstractMenu { + private static final String CROP_TYPE_INV_NAME = "Choose a Crop Stage"; private final CropType cropType; - private final byte STAGE_ONE_SLOT = 11; - private final byte STAGE_TWO_SLOT = 15; - - private final int BACK_ITEM_SLOT = 18; + private static final byte STAGE_ONE_SLOT = 11; + private static final byte STAGE_TWO_SLOT = 15; + private static final int BACK_ITEM_SLOT = 18; public CropStageMenu(Player player, CropType cropType) { super(3, CROP_TYPE_INV_NAME, player); @@ -41,23 +44,23 @@ protected void setPreviewItems() { ItemStack itemOne = Item.create(XMaterial.BARRIER.parseMaterial()); ItemStack itemTwo = Item.create(XMaterial.BARRIER.parseMaterial()); + ArrayList typeLore = ListUtil.createList("", "§8Left-click to select", "§8Right-click for more information"); switch (cropType) { case POTATO: - itemOne = new Item(XMaterial.SHORT_GRASS.parseItem()).setDisplayName("§bLow").setLore(ListUtil.createList("", "§8Left-click to select", "§8Right-click for more information")).build(); - itemTwo = new Item(XMaterial.TALL_GRASS.parseItem()).setDisplayName("§bTall").setLore(ListUtil.createList("", "§8Left-click to select", "§8Right-click for more information")).build(); + itemOne = new Item(XMaterial.SHORT_GRASS.parseItem()).setDisplayName("§bLow").setLore(typeLore).build(); + itemTwo = new Item(XMaterial.TALL_GRASS.parseItem()).setDisplayName("§bTall").setLore(typeLore).build(); break; case WHEAT: - itemOne = Item.create(XMaterial.BIRCH_FENCE.parseMaterial(), "§bLight", ListUtil.createList("", "§8Left-click to select", "§8Right-click for more information")); - itemTwo = Item.create(XMaterial.DARK_OAK_FENCE.parseMaterial(), "§bDark", ListUtil.createList("", "§8Left-click to select", "§8Right-click for more information")); + itemOne = Item.create(XMaterial.BIRCH_FENCE.parseMaterial(), "§bLight", typeLore); + itemTwo = Item.create(XMaterial.DARK_OAK_FENCE.parseMaterial(), "§bDark", typeLore); break; case CORN: - itemOne = new Item(XMaterial.SHORT_GRASS.parseItem()).setDisplayName("§bHarvested").setLore(ListUtil.createList("", "§8Left-click to select", "§8Right-click for more information")).build(); - itemTwo = new Item(XMaterial.TALL_GRASS.parseItem()).setDisplayName("§bTall").setLore(ListUtil.createList("", "§8Left-click to select", "§8Right-click for more information")).build(); + itemOne = new Item(XMaterial.SHORT_GRASS.parseItem()).setDisplayName("§bHarvested").setLore(typeLore).build(); + itemTwo = new Item(XMaterial.TALL_GRASS.parseItem()).setDisplayName("§bTall").setLore(typeLore).build(); break; - case HARVESTED: case OTHER: - itemOne = Item.create(XMaterial.DEAD_BUSH.parseMaterial(), "§bDry", ListUtil.createList("", "§8Left-click to select", "§8Right-click for more information")); - itemTwo = Item.create(XMaterial.WATER_BUCKET.parseMaterial(), "§bWet", ListUtil.createList("", "§8Left-click to select", "§8Right-click for more information")); + itemOne = Item.create(XMaterial.DEAD_BUSH.parseMaterial(), "§bDry", typeLore); + itemTwo = Item.create(XMaterial.WATER_BUCKET.parseMaterial(), "§bWet", typeLore); break; } @@ -96,7 +99,6 @@ protected void setItemClickEventsAsync() { case CORN: cropstage = CropStage.HARVESTED; break; - case HARVESTED: case OTHER: cropstage = CropStage.DRY; break; @@ -112,19 +114,12 @@ protected void setItemClickEventsAsync() { } CropStage cropstage = CropStage.FALLBACK; - switch (cropType) { - case POTATO: - case CORN: - cropstage = CropStage.TALL; - break; - case WHEAT: - cropstage = CropStage.DARK; - break; - case HARVESTED: - case OTHER: - cropstage = CropStage.WET; - break; - } + cropstage = switch (cropType) { + case POTATO, CORN -> CropStage.TALL; + case WHEAT -> CropStage.DARK; + case HARVESTED, OTHER -> CropStage.WET; + default -> cropstage; + }; performClickAction(clickPlayer, cropstage); })); @@ -144,22 +139,34 @@ private void performClickAction(Player p, CropStage cropStage) { GeneratorModule.getInstance().getField().generate(p); } - private void sendMoreInformation(Player p, CropType cropType) { + public static void sendMoreInformation(Player p, @NonNull CropType cropType) { switch (cropType) { case POTATO: - p.sendMessage(ChatColor.RED + "https://github.com/BuildTheEarth/BuildTeamTools/wiki/Crop-Types#potato-requires-lines"); + p.sendMessage(Component.text(WikiLinks.Gen.Field.CROP_POTATO, NamedTextColor.RED)); break; case CORN: - p.sendMessage(ChatColor.RED + "https://github.com/BuildTheEarth/BuildTeamTools/wiki/Crop-Types#corn"); + p.sendMessage(Component.text(WikiLinks.Gen.Field.CROP_CORN, NamedTextColor.RED)); break; case WHEAT: - p.sendMessage(ChatColor.RED + "https://github.com/BuildTheEarth/BuildTeamTools/wiki/Crop-Types#wheat"); + p.sendMessage(Component.text(WikiLinks.Gen.Field.CROP_WHEAT, NamedTextColor.RED)); break; case HARVESTED: - p.sendMessage(ChatColor.RED + "https://github.com/BuildTheEarth/BuildTeamTools/wiki/Crop-Types#harvested-requires-lines"); + p.sendMessage(Component.text(WikiLinks.Gen.Field.CROP_HARVESTED, NamedTextColor.RED)); break; case OTHER: - p.sendMessage(ChatColor.RED + "https://github.com/BuildTheEarth/BuildTeamTools/wiki/Crop-Types#other-requires-lines"); + p.sendMessage(Component.text(WikiLinks.Gen.Field.CROP_OTHER, NamedTextColor.RED)); + break; + case VINEYARD: + p.sendMessage(Component.text(WikiLinks.Gen.Field.CROP_VINEYARD, NamedTextColor.RED)); + break; + case PEAR: + p.sendMessage(Component.text(WikiLinks.Gen.Field.CROP_PEAR, NamedTextColor.RED)); + break; + case CATTLE: + p.sendMessage(Component.text(WikiLinks.Gen.Field.CROP_CATTLE, NamedTextColor.RED)); + break; + case MEADOW: + p.sendMessage(Component.text(WikiLinks.Gen.Field.CROP_MEADOW, NamedTextColor.RED)); break; } diff --git a/src/main/java/net/buildtheearth/modules/generator/components/field/menu/CropTypeMenu.java b/src/main/java/net/buildtheearth/modules/generator/components/field/menu/CropTypeMenu.java index 7d9be6d9..c9aabbcf 100644 --- a/src/main/java/net/buildtheearth/modules/generator/components/field/menu/CropTypeMenu.java +++ b/src/main/java/net/buildtheearth/modules/generator/components/field/menu/CropTypeMenu.java @@ -11,13 +11,13 @@ import net.buildtheearth.utils.ListUtil; import net.buildtheearth.utils.MenuItems; import net.buildtheearth.utils.menus.AbstractMenu; -import org.bukkit.ChatColor; import org.bukkit.Sound; import org.bukkit.entity.Player; import org.bukkit.event.inventory.ClickType; import org.bukkit.inventory.ItemStack; import org.ipvp.canvas.mask.BinaryMask; import org.ipvp.canvas.mask.Mask; +import org.jspecify.annotations.NonNull; public class CropTypeMenu extends AbstractMenu { @@ -78,7 +78,7 @@ protected void setItemClickEventsAsync() { // Set click events for the crop type items getMenu().getSlot(POTATO_CROP_SLOT).setClickHandler(((clickPlayer, clickInformation) -> { if (clickInformation.getClickType().equals(ClickType.RIGHT)) { - sendMoreInformation(clickPlayer, CropType.POTATO); + CropStageMenu.sendMoreInformation(clickPlayer, CropType.POTATO); return; } performClickAction(clickPlayer, CropType.POTATO); @@ -86,7 +86,7 @@ protected void setItemClickEventsAsync() { getMenu().getSlot(WHEAT_CROP_SLOT).setClickHandler(((clickPlayer, clickInformation) -> { if (clickInformation.getClickType().equals(ClickType.RIGHT)) { - sendMoreInformation(clickPlayer, CropType.WHEAT); + CropStageMenu.sendMoreInformation(clickPlayer, CropType.WHEAT); return; } performClickAction(clickPlayer, CropType.WHEAT); @@ -94,7 +94,7 @@ protected void setItemClickEventsAsync() { getMenu().getSlot(CORN_CROP_SLOT).setClickHandler(((clickPlayer, clickInformation) -> { if (clickInformation.getClickType().equals(ClickType.RIGHT)) { - sendMoreInformation(clickPlayer, CropType.CORN); + CropStageMenu.sendMoreInformation(clickPlayer, CropType.CORN); return; } performClickAction(clickPlayer, CropType.CORN); @@ -102,7 +102,7 @@ protected void setItemClickEventsAsync() { getMenu().getSlot(VINEYARD_CROP_SLOT).setClickHandler(((clickPlayer, clickInformation) -> { if (clickInformation.getClickType().equals(ClickType.RIGHT)) { - sendMoreInformation(clickPlayer, CropType.VINEYARD); + CropStageMenu.sendMoreInformation(clickPlayer, CropType.VINEYARD); return; } performClickAction(clickPlayer, CropType.VINEYARD); @@ -110,7 +110,7 @@ protected void setItemClickEventsAsync() { getMenu().getSlot(PEAR_CROP_SLOT).setClickHandler(((clickPlayer, clickInformation) -> { if (clickInformation.getClickType().equals(ClickType.RIGHT)) { - sendMoreInformation(clickPlayer, CropType.PEAR); + CropStageMenu.sendMoreInformation(clickPlayer, CropType.PEAR); return; } performClickAction(clickPlayer, CropType.PEAR); @@ -118,7 +118,7 @@ protected void setItemClickEventsAsync() { getMenu().getSlot(CATTLE_CROP_SLOT).setClickHandler(((clickPlayer, clickInformation) -> { if (clickInformation.getClickType().equals(ClickType.RIGHT)) { - sendMoreInformation(clickPlayer, CropType.CATTLE); + CropStageMenu.sendMoreInformation(clickPlayer, CropType.CATTLE); return; } performClickAction(clickPlayer, CropType.CATTLE); @@ -126,7 +126,7 @@ protected void setItemClickEventsAsync() { getMenu().getSlot(MEADOW_CROP_SLOT).setClickHandler(((clickPlayer, clickInformation) -> { if (clickInformation.getClickType().equals(ClickType.RIGHT)) { - sendMoreInformation(clickPlayer, CropType.MEADOW); + CropStageMenu.sendMoreInformation(clickPlayer, CropType.MEADOW); return; } performClickAction(clickPlayer, CropType.MEADOW); @@ -134,7 +134,7 @@ protected void setItemClickEventsAsync() { getMenu().getSlot(HARVESTED_CROP_SLOT).setClickHandler(((clickPlayer, clickInformation) -> { if (clickInformation.getClickType().equals(ClickType.RIGHT)) { - sendMoreInformation(clickPlayer, CropType.HARVESTED); + CropStageMenu.sendMoreInformation(clickPlayer, CropType.HARVESTED); return; } performClickAction(clickPlayer, CropType.HARVESTED); @@ -142,7 +142,7 @@ protected void setItemClickEventsAsync() { getMenu().getSlot(OTHER_CROP_SLOT).setClickHandler(((clickPlayer, clickInformation) -> { if (clickInformation.getClickType().equals(ClickType.RIGHT)) { - sendMoreInformation(clickPlayer, CropType.OTHER); + CropStageMenu.sendMoreInformation(clickPlayer, CropType.OTHER); return; } performClickAction(clickPlayer, CropType.OTHER); @@ -151,7 +151,7 @@ protected void setItemClickEventsAsync() { } - private void performClickAction(Player p, CropType cropType) { + private void performClickAction(@NonNull Player p, CropType cropType) { Settings settings = GeneratorModule.getInstance().getField().getPlayerSettings().get(p.getUniqueId()); if (!(settings instanceof FieldSettings)) @@ -174,38 +174,6 @@ private void performClickAction(Player p, CropType cropType) { GeneratorModule.getInstance().getField().generate(p); } - private void sendMoreInformation(Player p, CropType cropType) { - switch (cropType) { - case POTATO: - p.sendMessage(ChatColor.RED + "https://github.com/BuildTheEarth/BuildTeamTools/wiki/Crop-Types#potato-requires-lines"); - break; - case CORN: - p.sendMessage(ChatColor.RED + "https://github.com/BuildTheEarth/BuildTeamTools/wiki/Crop-Types#corn"); - break; - case WHEAT: - p.sendMessage(ChatColor.RED + "https://github.com/BuildTheEarth/BuildTeamTools/wiki/Crop-Types#wheat"); - break; - case HARVESTED: - p.sendMessage(ChatColor.RED + "https://github.com/BuildTheEarth/BuildTeamTools/wiki/Crop-Types#harvested-requires-lines"); - break; - case OTHER: - p.sendMessage(ChatColor.RED + "https://github.com/BuildTheEarth/BuildTeamTools/wiki/Crop-Types#other-requires-lines"); - break; - case VINEYARD: - p.sendMessage(ChatColor.RED + "https://github.com/BuildTheEarth/BuildTeamTools/wiki/Crop-Types#vineyard-requires-lines"); - break; - case PEAR: - p.sendMessage(ChatColor.RED + "https://github.com/BuildTheEarth/BuildTeamTools/wiki/Crop-Types#pear-requires-lines"); - break; - case CATTLE: - p.sendMessage(ChatColor.RED + "https://github.com/BuildTheEarth/BuildTeamTools/wiki/Crop-Types#cattle"); - break; - case MEADOW: - p.sendMessage(ChatColor.RED + "https://github.com/BuildTheEarth/BuildTeamTools/wiki/Crop-Types#meadow"); - break; - } - } - @Override protected Mask getMask() { return BinaryMask.builder(getMenu()) diff --git a/src/main/java/net/buildtheearth/modules/generator/components/house/House.java b/src/main/java/net/buildtheearth/modules/generator/components/house/House.java index a0f1bf24..ab9a84d2 100644 --- a/src/main/java/net/buildtheearth/modules/generator/components/house/House.java +++ b/src/main/java/net/buildtheearth/modules/generator/components/house/House.java @@ -10,7 +10,6 @@ public class House extends GeneratorComponent { public House() { super(GeneratorType.HOUSE); - wikiPage = "https://github.com/BuildTheEarth/BuildTeamTools/wiki/House-Command"; } @Override @@ -18,7 +17,7 @@ public boolean checkForPlayer(Player p) { if (GeneratorUtils.checkForNoWorldEditSelection(p)) return false; - if (getPlayerSettings().get(p.getUniqueId()).getBlocks() == null) + if (getPlayerSettings().get(p.getUniqueId()).getBlocks() == null) // Needed because block checks are made afterwards getPlayerSettings().get(p.getUniqueId()).setBlocks(GeneratorUtils.analyzeRegion(p, p.getWorld())); Block[][][] blocks = getPlayerSettings().get(p.getUniqueId()).getBlocks(); diff --git a/src/main/java/net/buildtheearth/modules/generator/components/rail/Rail.java b/src/main/java/net/buildtheearth/modules/generator/components/rail/Rail.java index c7056f34..a484ec5d 100644 --- a/src/main/java/net/buildtheearth/modules/generator/components/rail/Rail.java +++ b/src/main/java/net/buildtheearth/modules/generator/components/rail/Rail.java @@ -1,29 +1,20 @@ package net.buildtheearth.modules.generator.components.rail; -import com.sk89q.worldedit.regions.ConvexPolyhedralRegion; -import com.sk89q.worldedit.regions.Region; import net.buildtheearth.modules.generator.GeneratorModule; import net.buildtheearth.modules.generator.model.GeneratorComponent; import net.buildtheearth.modules.generator.model.GeneratorType; import net.buildtheearth.modules.generator.utils.GeneratorUtils; -import org.bukkit.Bukkit; import org.bukkit.entity.Player; public class Rail extends GeneratorComponent { public Rail() { super(GeneratorType.RAILWAY); - - wikiPage = "https://github.com/BuildTheEarth/BuildTeamTools/wiki/Road-Command"; } @Override public boolean checkForPlayer(Player p) { return !GeneratorUtils.checkForNoWorldEditSelection(p); - - /* Only needed if block checks are made afterwards like in House Generator - if (getPlayerSettings().get(p.getUniqueId()).getBlocks() == null) - getPlayerSettings().get(p.getUniqueId()).setBlocks(GeneratorUtils.analyzeRegion(p, p.getWorld()));*/ } @Override diff --git a/src/main/java/net/buildtheearth/modules/generator/components/road/Road.java b/src/main/java/net/buildtheearth/modules/generator/components/road/Road.java index 50ec00ca..7f73dd01 100644 --- a/src/main/java/net/buildtheearth/modules/generator/components/road/Road.java +++ b/src/main/java/net/buildtheearth/modules/generator/components/road/Road.java @@ -1,7 +1,5 @@ package net.buildtheearth.modules.generator.components.road; -import com.sk89q.worldedit.regions.ConvexPolyhedralRegion; -import com.sk89q.worldedit.regions.Region; import net.buildtheearth.modules.generator.GeneratorModule; import net.buildtheearth.modules.generator.model.GeneratorComponent; import net.buildtheearth.modules.generator.model.GeneratorType; @@ -12,17 +10,11 @@ public class Road extends GeneratorComponent { public Road() { super(GeneratorType.ROAD); - - wikiPage = "https://github.com/BuildTheEarth/BuildTeamTools/wiki/Road-Command"; } @Override public boolean checkForPlayer(Player p) { return !GeneratorUtils.checkForNoWorldEditSelection(p); - - /* Only needed if block checks are made afterwards like in House Generator - if (getPlayerSettings().get(p.getUniqueId()).getBlocks() == null) - getPlayerSettings().get(p.getUniqueId()).setBlocks(GeneratorUtils.analyzeRegion(p, p.getWorld()));*/ } @Override diff --git a/src/main/java/net/buildtheearth/modules/generator/components/tree/Tree.java b/src/main/java/net/buildtheearth/modules/generator/components/tree/Tree.java index d1474bbc..bd0eda8e 100644 --- a/src/main/java/net/buildtheearth/modules/generator/components/tree/Tree.java +++ b/src/main/java/net/buildtheearth/modules/generator/components/tree/Tree.java @@ -9,13 +9,11 @@ public class Tree extends GeneratorComponent { - public static String TREE_PACK_VERSION = "v2.0"; + public static final String TREE_PACK_VERSION = "v2.0"; public Tree() { super(GeneratorType.TREE); - - wikiPage = "https://github.com/BuildTheEarth/BuildTeamTools/wiki/Tree-Command"; } @Override @@ -23,10 +21,6 @@ public boolean checkForPlayer(Player p) { if (!GeneratorCollections.checkIfGeneratorCollectionsIsInstalled(p)) return false; - /* Only needed if block checks are made afterwards like in House Generator - if (getPlayerSettings().get(p.getUniqueId()).getBlocks() == null) - getPlayerSettings().get(p.getUniqueId()).setBlocks(GeneratorUtils.analyzeRegion(p, p.getWorld()));*/ - return GeneratorUtils.checkIfSchematicBrushIsInstalled(p); } diff --git a/src/main/java/net/buildtheearth/modules/generator/menu/GeneratorMenu.java b/src/main/java/net/buildtheearth/modules/generator/menu/GeneratorMenu.java index 833b8dc2..6c5981b6 100644 --- a/src/main/java/net/buildtheearth/modules/generator/menu/GeneratorMenu.java +++ b/src/main/java/net/buildtheearth/modules/generator/menu/GeneratorMenu.java @@ -3,9 +3,6 @@ import com.cryptomorin.xseries.XMaterial; import net.buildtheearth.modules.common.CommonModule; import net.buildtheearth.modules.generator.GeneratorModule; -import net.buildtheearth.modules.generator.components.field.Field; -import net.buildtheearth.modules.generator.components.field.FieldSettings; -import net.buildtheearth.modules.generator.components.field.menu.CropTypeMenu; import net.buildtheearth.modules.generator.components.house.House; import net.buildtheearth.modules.generator.components.house.HouseSettings; import net.buildtheearth.modules.generator.components.house.RoofType; @@ -22,13 +19,15 @@ import net.buildtheearth.utils.ListUtil; import net.buildtheearth.utils.MenuItems; import net.buildtheearth.utils.menus.AbstractMenu; -import org.bukkit.ChatColor; +import net.kyori.adventure.text.Component; +import net.kyori.adventure.text.format.NamedTextColor; import org.bukkit.Sound; import org.bukkit.entity.Player; import org.bukkit.event.inventory.ClickType; import org.bukkit.inventory.ItemStack; import org.ipvp.canvas.mask.BinaryMask; import org.ipvp.canvas.mask.Mask; +import org.jspecify.annotations.NonNull; import java.util.ArrayList; @@ -44,7 +43,7 @@ public class GeneratorMenu extends AbstractMenu { public static final int TREE_ITEM_SLOT = 15; - public static int FIELD_ITEM_SLOT = 17; + public static final int FIELD_ITEM_SLOT = 17; public GeneratorMenu(Player player, boolean autoLoad) { @@ -54,38 +53,16 @@ public GeneratorMenu(Player player, boolean autoLoad) { @Override protected void setPreviewItems() { // HOUSE ITEM - ArrayList houseLore = ListUtil.createList("", - "§eDescription:", - "Generate basic building shells", - "with multiple floors, windows and roofs", - "", - "§eFeatures:", - "- " + RoofType.values().length + " Roof Types", - "- Custom Wall, Base and Roof Color", - "- Custom Floor and Window Sizes", - "", - "§8Left-click to generate", - "§8Right-click for Tutorial"); - - ItemStack houseItem = Item.create(XMaterial.BIRCH_DOOR.parseMaterial(), "§cGenerate House", houseLore); + ArrayList houseLore = ListUtil.createList("", "§eDescription:", "Generate basic building shells", "with multiple floors, windows and roofs", "", "§eFeatures:", "- " + RoofType.values().length + " Roof Types", "- Custom Wall, Base and Roof Color", "- Custom Floor and Window Sizes", "", "§8Left-click to generate", "§8Right-click for Tutorial"); + + ItemStack houseItem = Item.create(XMaterial.BIRCH_DOOR.get(), "§cGenerate House", houseLore); // Set navigator item getMenu().getSlot(HOUSE_ITEM_SLOT).setItem(houseItem); // ROAD ITEM - ArrayList roadLore = ListUtil.createList("", - "§eDescription:", - "Generate roads and highways", - "with multiple lanes and sidewalks", - "", - "§eFeatures:", - "- Custom Road Width and Color", - "- Custom Sidewalk Width and Color", - "- Custom Lane Count", - "", - "§8Left-click to generate", - "§8Right-click for Tutorial"); + ArrayList roadLore = ListUtil.createList("", "§eDescription:", "Generate roads and highways", "with multiple lanes and sidewalks", "", "§eFeatures:", "- Custom Road Width and Color", "- Custom Sidewalk Width and Color", "- Custom Lane Count", "", "§8Left-click to generate", "§8Right-click for Tutorial"); ItemStack roadItem = new Item(XMaterial.SMOOTH_STONE_SLAB.parseItem()).setDisplayName("§bGenerate Road").setLore(roadLore).build(); @@ -95,21 +72,11 @@ protected void setPreviewItems() { // RAILWAY ITEM - ArrayList railwayLore = ListUtil.createList("", - "§eDescription:", - "Generate railways with multiple tracks", - "and many different designs", - "", - "§eFeatures:", - "- Custom Railway Width and Color (TODO)", - "- Custom Track Count (TODO)", - "", - "§8Left-click to generate", - "§8Right-click for Tutorial"); + ArrayList railwayLore = ListUtil.createList("", "§eDescription:", "Generate railways with multiple tracks", "and many different designs", "", "§eFeatures:", "- Custom Railway Width and Color (TODO)", "- Custom Track Count (TODO)", "", "§8Left-click to generate", "§8Right-click for Tutorial"); railwayLore = ListUtil.createList("", "§cThis §eGenerator §cis currently broken", "§cRailway Generator is disabled", "", "§8If you want to help fixing ask on Dev Hub!"); - ItemStack railwayItem = Item.create(XMaterial.RAIL.parseMaterial(), "§9Generate Railway §c(DISABLED)", railwayLore); + ItemStack railwayItem = Item.create(XMaterial.RAIL.get(), "§9Generate Railway §c(DISABLED)", railwayLore); // Set navigator item getMenu().getSlot(RAILWAY_ITEM_SLOT).setItem(railwayItem); @@ -119,32 +86,23 @@ protected void setPreviewItems() { // TREE ITEM ArrayList treeLore = ListUtil.createList("", "§cPlugin §eSchematicBrush §cis not installed", "§cTree Generator is disabled", "", "§8Leftclick for Installation Instructions"); - ItemStack treeItem = Item.create(XMaterial.OAK_SAPLING.parseMaterial(), "§aGenerate Tree & Forest §c(DISABLED)", treeLore); + ItemStack treeItem = Item.create(XMaterial.OAK_SAPLING.get(), "§aGenerate Tree & Forest §c(DISABLED)", treeLore); // Set navigator item getMenu().getSlot(TREE_ITEM_SLOT).setItem(treeItem); - }else if(GeneratorCollections.checkIfGeneratorCollectionsIsInstalled(getMenuPlayer())){ + } else if (GeneratorCollections.checkIfGeneratorCollectionsIsInstalled(getMenuPlayer())) { // TREE ITEM ArrayList treeLore = ListUtil.createList("", "§cThe §eTree Pack " + Tree.TREE_PACK_VERSION + " §cis not installed", "§cTree Generator is disabled", "", "§8Leftclick for Installation Instructions"); - ItemStack treeItem = Item.create(XMaterial.OAK_SAPLING.parseMaterial(), "§aGenerate Tree & Forest §c(DISABLED)", treeLore); + ItemStack treeItem = Item.create(XMaterial.OAK_SAPLING.get(), "§aGenerate Tree & Forest §c(DISABLED)", treeLore); // Set navigator item getMenu().getSlot(TREE_ITEM_SLOT).setItem(treeItem); - }else{ + } else { // TREE ITEM - ArrayList treeLore = ListUtil.createList("", - "§eDescription:", - "Generate trees from a set of", - "hundreds of different types", - "", - "§eFeatures:", - "- Custom Tree Type", - "", - "§8Left-click to generate", - "§8Right-click for Tutorial"); - - ItemStack treeItem = Item.create(XMaterial.OAK_SAPLING.parseMaterial(), "§aGenerate Tree & Forest", treeLore); + ArrayList treeLore = ListUtil.createList("", "§eDescription:", "Generate trees from a set of", "hundreds of different types", "", "§eFeatures:", "- Custom Tree Type", "", "§8Left-click to generate", "§8Right-click for Tutorial"); + + ItemStack treeItem = Item.create(XMaterial.OAK_SAPLING.get(), "§aGenerate Tree & Forest", treeLore); // Set navigator item getMenu().getSlot(TREE_ITEM_SLOT).setItem(treeItem); @@ -152,17 +110,7 @@ protected void setPreviewItems() { // FIELD ITEM - ArrayList fieldLore = ListUtil.createList("", - "§eDescription:", - "Generate fields with different", - "crops and plants", - "", - "§eFeatures:", - "- Custom Crop Type", - "- Custom Crop Size", - "", - "§8Left-click to generate", - "§8Right-click for Tutorial"); + ArrayList fieldLore = ListUtil.createList("", "§eDescription:", "Generate fields with different", "crops and plants", "", "§eFeatures:", "- Custom Crop Type", "- Custom Crop Size", "", "§8Left-click to generate", "§8Right-click for Tutorial"); fieldLore = ListUtil.createList("", "§cThis §eGenerator §cis currently broken", "§cField Generator is disabled", "", "§8If you want to help fixing ask on Dev Hub!"); @@ -176,13 +124,15 @@ protected void setPreviewItems() { } @Override - protected void setMenuItemsAsync() {} + protected void setMenuItemsAsync() { + // No Async / DB Items + } @Override protected void setItemClickEventsAsync() { // Set click event for house item getMenu().getSlot(HOUSE_ITEM_SLOT).setClickHandler(((clickPlayer, clickInformation) -> { - if(clickInformation.getClickType().equals(ClickType.RIGHT)) { + if (clickInformation.getClickType().equals(ClickType.RIGHT)) { sendMoreInformation(clickPlayer, GeneratorType.HOUSE); return; } @@ -190,8 +140,7 @@ protected void setItemClickEventsAsync() { House house = GeneratorModule.getInstance().getHouse(); house.getPlayerSettings().put(clickPlayer.getUniqueId(), new HouseSettings(clickPlayer)); - if(!house.checkForPlayer(clickPlayer)) - return; + if (!house.checkForPlayer(clickPlayer)) return; clickPlayer.closeInventory(); clickPlayer.playSound(clickPlayer.getLocation(), Sound.UI_BUTTON_CLICK, 1.0F, 1.0F); @@ -200,7 +149,7 @@ protected void setItemClickEventsAsync() { // Set click event for road item getMenu().getSlot(ROAD_ITEM_SLOT).setClickHandler(((clickPlayer, clickInformation) -> { - if(clickInformation.getClickType().equals(ClickType.RIGHT)) { + if (clickInformation.getClickType().equals(ClickType.RIGHT)) { sendMoreInformation(clickPlayer, GeneratorType.ROAD); return; } @@ -208,8 +157,7 @@ protected void setItemClickEventsAsync() { Road road = GeneratorModule.getInstance().getRoad(); road.getPlayerSettings().put(clickPlayer.getUniqueId(), new RoadSettings(clickPlayer)); - if(!road.checkForPlayer(clickPlayer)) - return; + if (!road.checkForPlayer(clickPlayer)) return; clickPlayer.closeInventory(); clickPlayer.playSound(clickPlayer.getLocation(), Sound.UI_BUTTON_CLICK, 1.0F, 1.0F); @@ -218,7 +166,7 @@ protected void setItemClickEventsAsync() { // Set click event for railway item getMenu().getSlot(RAILWAY_ITEM_SLOT).setClickHandler(((clickPlayer, clickInformation) -> { - if(clickInformation.getClickType().equals(ClickType.RIGHT)) { + if (clickInformation.getClickType().equals(ClickType.RIGHT)) { sendMoreInformation(clickPlayer, GeneratorType.RAILWAY); return; } @@ -238,7 +186,7 @@ protected void setItemClickEventsAsync() { // Set click event for tree item getMenu().getSlot(TREE_ITEM_SLOT).setClickHandler(((clickPlayer, clickInformation) -> { - if(clickInformation.getClickType().equals(ClickType.RIGHT)) { + if (clickInformation.getClickType().equals(ClickType.RIGHT)) { sendMoreInformation(clickPlayer, GeneratorType.TREE); return; } @@ -246,8 +194,7 @@ protected void setItemClickEventsAsync() { Tree tree = GeneratorModule.getInstance().getTree(); tree.getPlayerSettings().put(clickPlayer.getUniqueId(), new TreeSettings(clickPlayer)); - if(!tree.checkForPlayer(clickPlayer)) - return; + if (!tree.checkForPlayer(clickPlayer)) return; clickPlayer.closeInventory(); clickPlayer.playSound(clickPlayer.getLocation(), Sound.UI_BUTTON_CLICK, 1.0F, 1.0F); @@ -256,12 +203,13 @@ protected void setItemClickEventsAsync() { // Set click event for field item getMenu().getSlot(FIELD_ITEM_SLOT).setClickHandler(((clickPlayer, clickInformation) -> { - if(clickInformation.getClickType().equals(ClickType.RIGHT)) { + if (clickInformation.getClickType().equals(ClickType.RIGHT)) { sendMoreInformation(clickPlayer, GeneratorType.FIELD); return; } + sendMoreInformation(clickPlayer, GeneratorType.FIELD); - Field field = GeneratorModule.getInstance().getField(); + /*Field field = GeneratorModule.getInstance().getField(); field.getPlayerSettings().put(clickPlayer.getUniqueId(), new FieldSettings(clickPlayer)); if(!field.checkForPlayer(clickPlayer)) @@ -269,34 +217,16 @@ protected void setItemClickEventsAsync() { clickPlayer.closeInventory(); clickPlayer.playSound(clickPlayer.getLocation(), Sound.UI_BUTTON_CLICK, 1.0F, 1.0F); - new CropTypeMenu(clickPlayer, true); + new CropTypeMenu(clickPlayer, true);*/ })); } - private void sendMoreInformation(Player clickPlayer, GeneratorType generator) { - switch (generator) { - case FIELD: - clickPlayer.sendMessage(ChatColor.RED + "https://github.com/BuildTheEarth/BuildTeamTools/wiki/Field-Command"); - break; - case HOUSE: - clickPlayer.sendMessage(ChatColor.RED + "https://github.com/BuildTheEarth/BuildTeamTools/wiki/House-Command"); - break; - case RAILWAY: - clickPlayer.sendMessage(ChatColor.RED + "https://github.com/BuildTheEarth/BuildTeamTools/wiki/Rail-Command"); - break; - case ROAD: - clickPlayer.sendMessage(ChatColor.RED + "https://github.com/BuildTheEarth/BuildTeamTools/wiki/Road-Command"); - break; - } + private void sendMoreInformation(@NonNull Player clickPlayer, @NonNull GeneratorType generator) { + clickPlayer.sendMessage(Component.text(generator.getWikiPage(), NamedTextColor.RED)); } @Override protected Mask getMask() { - return BinaryMask.builder(getMenu()) - .item(MenuItems.ITEM_BACKGROUND) - .pattern("111111111") - .pattern("010101010") - .pattern("111111111") - .build(); + return BinaryMask.builder(getMenu()).item(MenuItems.ITEM_BACKGROUND).pattern("111111111").pattern("010101010").pattern("111111111").build(); } } \ No newline at end of file diff --git a/src/main/java/net/buildtheearth/modules/generator/model/GeneratorCollections.java b/src/main/java/net/buildtheearth/modules/generator/model/GeneratorCollections.java index 3a894dca..2a331680 100644 --- a/src/main/java/net/buildtheearth/modules/generator/model/GeneratorCollections.java +++ b/src/main/java/net/buildtheearth/modules/generator/model/GeneratorCollections.java @@ -6,9 +6,9 @@ import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormat; import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormats; import com.sk89q.worldedit.extent.clipboard.io.ClipboardReader; +import lombok.experimental.UtilityClass; import net.buildtheearth.BuildTeamTools; import net.buildtheearth.modules.common.CommonModule; -import net.buildtheearth.modules.generator.GeneratorModule; import net.buildtheearth.utils.ChatHelper; import org.bukkit.Bukkit; import org.bukkit.configuration.file.FileConfiguration; @@ -32,10 +32,10 @@ import java.util.zip.ZipEntry; import java.util.zip.ZipInputStream; +@UtilityClass public class GeneratorCollections { - public static String GENERATOR_COLLECTIONS_VERSION; - + public static String generatorCollectionsVersion; /** * Checks if the GeneratorCollections is installed and sends the player a message if it isn't. @@ -82,7 +82,7 @@ else if(CommonModule.getInstance().getDependencyComponent().isWorldEditEnabled() if(p != null) bukkitWorld = new BukkitWorld(p.getWorld()); else - bukkitWorld = new BukkitWorld(Bukkit.getWorlds().get(0)); + bukkitWorld = new BukkitWorld(Bukkit.getWorlds().getFirst()); if (reader != null){ Class readerClass = reader.getClass(); @@ -130,11 +130,11 @@ else if(CommonModule.getInstance().getDependencyComponent().isWorldEditEnabled() * @param repo The name of the repository * @return The latest release version of the repository */ - public static String getRepositoryReleaseVersionString(String owner, String repo){ + public static @Nullable String getRepositoryReleaseVersionString(String owner, String repo) { try { String url = "https://api.github.com/repos/" + owner + "/" + repo + "/releases"; - HttpURLConnection con = (HttpURLConnection) new URL(url).openConnection(); + HttpURLConnection con = (HttpURLConnection) URI.create(url).toURL().openConnection(); con.setRequestProperty("User-Agent", "Mozilla/5.0"); con.setRequestMethod("GET"); @@ -151,7 +151,7 @@ public static String getRepositoryReleaseVersionString(String owner, String repo in.close(); JSONArray releases = new JSONArray(response.toString()); - if (releases.length() > 0) { + if (!releases.isEmpty()) { JSONObject latestRelease = releases.getJSONObject(0); // The first object in the array is the latest release return latestRelease.getString("tag_name").replace("v", ""); @@ -160,7 +160,7 @@ public static String getRepositoryReleaseVersionString(String owner, String repo } else return null; } catch (Exception e) { - e.printStackTrace(); + BuildTeamTools.getInstance().getComponentLogger().warn("Failed to get latest release version of repository {}/{}:", owner, repo, e); return null; } } @@ -208,7 +208,7 @@ private static boolean installZipFolder(String parentURL, String filename, Path out.write(buffer, 0, bytesRead); } }catch (Exception e){ - e.printStackTrace(); + BuildTeamTools.getInstance().getComponentLogger().warn("Failed to download zip file from {}:", url, e); return false; } } else { @@ -265,7 +265,7 @@ private static boolean unzip(Path zipFilePath, @NonNull Path destDirectory) { deleteFile(zipFilePath); // Delete the old zip file }catch (Exception e){ - e.printStackTrace(); + BuildTeamTools.getInstance().getComponentLogger().warn("Failed to unzip zip file:", e); return false; } @@ -290,10 +290,11 @@ private static void deleteDirectory(@NonNull Path path) { * @param path The path to the file to delete */ private static void deleteFile(@NonNull Path path) { - File file = path.toFile(); - boolean success = file.delete(); - if(!success) - BuildTeamTools.getInstance().getComponentLogger().warn("Failed to delete file: {}", path); + try { + Files.delete(path); + } catch (IOException e) { + BuildTeamTools.getInstance().getComponentLogger().warn("Failed to delete file: {}", path, e); + } } /** @@ -313,7 +314,7 @@ private static boolean checkIfGeneratorCollectionsIsUpToDate(Player p){ String oldVersion = cfg.getString("version"); - if(!CommonModule.getInstance().getUpdaterComponent().shouldUpdate(GENERATOR_COLLECTIONS_VERSION, oldVersion)) + if (!CommonModule.getInstance().getUpdaterComponent().shouldUpdate(generatorCollectionsVersion, oldVersion)) return true; else return installGeneratorCollections(p, true); @@ -331,11 +332,7 @@ private static boolean checkIfGeneratorCollectionsIsUpToDate(Player p){ * @param p The player to send the message to */ private static void sendGeneratorCollectionsError(@Nullable Player p){ - ChatHelper.logPlayerAndConsole(p, "§cAn error occurred while installing the Generator Collections.", Level.INFO); - ChatHelper.logPlayerAndConsole(p, "§cPlease install the Generator Collections v" + GENERATOR_COLLECTIONS_VERSION + " to use this tool. You can ask the server administrator to install it.", Level.INFO); - ChatHelper.logPlayerAndConsole(p, " ", Level.INFO); - ChatHelper.logPlayerAndConsole(p, "§cFor more installation help, please see the wiki:", Level.INFO); - ChatHelper.logPlayerAndConsole(p, "§c" + GeneratorModule.INSTALL_WIKI, Level.INFO); + ChatHelper.logPlayerAndConsole(p, "§cAn error occurred while installing the Generator Collections. Please report that with the log!", Level.INFO); } @@ -371,7 +368,7 @@ else if(CommonModule.getInstance().getDependencyComponent().isWorldEditEnabled() success = moveVersionFile(generatorModulePath, path.resolve("GeneratorCollections"), "config.yml", "generatorCollectionsVersion.yml"); if(success) { - ChatHelper.logPlayerAndConsole(p, "§7Successfully installed §eGenerator Collections v" + GENERATOR_COLLECTIONS_VERSION + "§7!", Level.INFO); + ChatHelper.logPlayerAndConsole(p, "§7Successfully installed §eGenerator Collections v" + generatorCollectionsVersion + "§7!", Level.INFO); return true; }else { diff --git a/src/main/java/net/buildtheearth/modules/generator/model/GeneratorComponent.java b/src/main/java/net/buildtheearth/modules/generator/model/GeneratorComponent.java index 9c84694b..7c66078d 100644 --- a/src/main/java/net/buildtheearth/modules/generator/model/GeneratorComponent.java +++ b/src/main/java/net/buildtheearth/modules/generator/model/GeneratorComponent.java @@ -19,22 +19,19 @@ import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer; import org.bukkit.Sound; import org.bukkit.entity.Player; +import org.jspecify.annotations.NonNull; import java.util.HashMap; import java.util.UUID; public abstract class GeneratorComponent extends ModuleComponent implements WikiDocumented { - - @Getter - public String wikiPage; - @Getter private final GeneratorType generatorType; @Getter private final HashMap playerSettings = new HashMap<>(); - public GeneratorComponent(GeneratorType type) { + protected GeneratorComponent(@NonNull GeneratorType type) { super(type.getName()); generatorType = type; } @@ -75,50 +72,40 @@ public void addPlayerSetting(Player p){ } } - public void sendHelp(Player p, String[] args){ - if (args.length == 2) - if (args[1].equals("info") || args[1].equals("help") || args[1].equals("?")) + public void sendHelp(Player p, String @NonNull [] args) { + if (args.length == 2 && (args[1].equals("info") || args[1].equals("help") || args[1].equals("?"))) sendHelp(p); } - public void sendHelp(Player p){ - //TODO send houses help - p.sendMessage("TODO send Houses Help"); + public void sendHelp(@NonNull Player p) { + p.sendMessage(Component.text(getWikiPage(), NamedTextColor.YELLOW)); } public void sendMoreInfo(Player p) { p.sendMessage(" "); p.sendMessage("§cFor more information take a look at the wiki:"); - p.sendMessage("§c" + wikiPage); + p.sendMessage("§c" + getWikiPage()); } public void sendError(Player p) { p.sendMessage("§cThere was an error while generating the house. Please contact the admins"); } - public String getCommand(Player p) { + public String getCommand(@NonNull Player p) { HashMap flags = getPlayerSettings().get(p.getUniqueId()).getValuesAsString(); - String type = "house"; - - switch (generatorType) { - case HOUSE: - type = "house"; - break; - case ROAD: - type = "road"; - break; - case RAILWAY: - type = "railway"; - break; - case TREE: - type = "tree"; - break; - } + String type = switch (generatorType) { + case HOUSE -> "house"; + case ROAD -> "road"; + case RAILWAY -> "railway"; + case TREE -> "tree"; + case FIELD -> "field"; + }; StringBuilder command = new StringBuilder("/gen " + type); - for(Flag flag : flags.keySet()) - command.append(" -").append(flag.getFlag()).append(" ").append(flags.get(flag)); + + for (var flag : flags.entrySet()) + command.append(" -").append(flag.getKey().getFlag()).append(" ").append(flag.getValue()); return command.toString(); } @@ -138,23 +125,14 @@ public void sendSuccessMessage(Player p){ p.playSound(p.getLocation(), Sound.ENTITY_PLAYER_LEVELUP, 1.0F, 1.0F); } - private TextComponent getMessage() { - String type = "Building"; - - switch (generatorType){ - case HOUSE: - type = "House"; - break; - case ROAD: - type = "Road"; - break; - case RAILWAY: - type = "Railway"; - break; - case TREE: - type = "Tree"; - break; - } + private @NonNull TextComponent getMessage() { + String type = switch (generatorType) { + case HOUSE -> "House"; + case ROAD -> "Road"; + case RAILWAY -> "Railway"; + case TREE -> "Tree"; + case FIELD -> "Field"; + }; return LegacyComponentSerializer.legacyAmpersand().deserialize(BuildTeamTools.PREFIX + type + "§a successfully §7generated."); } @@ -195,4 +173,8 @@ protected void convertArgsToSettings(Player p, String[] args){ if(getPlayerSettings().get(p.getUniqueId()).getValues().isEmpty() && args.length > 1) sendHelp(p); } + + public String getWikiPage() { + return generatorType.getWikiPage(); + } } diff --git a/src/main/java/net/buildtheearth/modules/generator/model/GeneratorType.java b/src/main/java/net/buildtheearth/modules/generator/model/GeneratorType.java index 0321ca98..1e00d64b 100644 --- a/src/main/java/net/buildtheearth/modules/generator/model/GeneratorType.java +++ b/src/main/java/net/buildtheearth/modules/generator/model/GeneratorType.java @@ -1,20 +1,25 @@ package net.buildtheearth.modules.generator.model; import lombok.Getter; +import net.buildtheearth.utils.WikiLinks; public enum GeneratorType { - HOUSE("House"), - ROAD("Road"), - RAILWAY("Railway"), - TREE("Tree"), - FIELD("Field"); + HOUSE("House", WikiLinks.Gen.HOUSE), + ROAD("Road", WikiLinks.Gen.ROAD), + RAILWAY("Railway", WikiLinks.Gen.RAIL), + TREE("Tree", WikiLinks.Gen.TREE), + FIELD("Field", WikiLinks.Gen.FIELD); @Getter private final String name; - GeneratorType(String name) { + @Getter + private final String wikiPage; + + GeneratorType(String name, String wikiPage) { this.name = name; + this.wikiPage = wikiPage; } } diff --git a/src/main/java/net/buildtheearth/modules/miscellaneous/MiscModule.java b/src/main/java/net/buildtheearth/modules/miscellaneous/MiscModule.java index a2af3b9a..4c7b77b1 100644 --- a/src/main/java/net/buildtheearth/modules/miscellaneous/MiscModule.java +++ b/src/main/java/net/buildtheearth/modules/miscellaneous/MiscModule.java @@ -1,13 +1,15 @@ package net.buildtheearth.modules.miscellaneous; import net.buildtheearth.modules.Module; +import net.buildtheearth.modules.miscellaneous.blockpalettegui.BlockPaletteCommand; import net.buildtheearth.modules.miscellaneous.blockpalettegui.BlockPaletteGUI; import net.buildtheearth.modules.miscellaneous.blockpalettegui.BlockPaletteManager; -import net.buildtheearth.modules.miscellaneous.blockpalettegui.BlockPaletteCommand; +import net.buildtheearth.utils.WikiLinks; import org.bukkit.command.CommandExecutor; import org.bukkit.command.PluginCommand; import org.bukkit.command.TabCompleter; import org.bukkit.plugin.java.JavaPlugin; +import org.jspecify.annotations.NonNull; import java.lang.reflect.Constructor; @@ -17,7 +19,7 @@ public class MiscModule extends Module { private static MiscModule instance = null; public MiscModule() { - super("Misc"); + super("Misc", WikiLinks.MISC); } public static MiscModule getInstance() { @@ -50,17 +52,18 @@ public void disable() { @Override public void registerListeners() { + // No Listeners } - private JavaPlugin resolvePlugin() { + private @NonNull JavaPlugin resolvePlugin() { try { return JavaPlugin.getProvidingPlugin(MiscModule.class); - } catch (Throwable t) { + } catch (Exception t) { throw new IllegalStateException("Cannot resolve JavaPlugin for MiscModule", t); } } - private void registerCommandSafely(JavaPlugin plugin, String name, BlockPaletteManager manager) { + private void registerCommandSafely(@NonNull JavaPlugin plugin, String name, BlockPaletteManager manager) { PluginCommand cmd = plugin.getCommand(name); if (cmd == null) { return; @@ -71,7 +74,7 @@ private void registerCommandSafely(JavaPlugin plugin, String name, BlockPaletteM if (obj instanceof TabCompleter tab) cmd.setTabCompleter(tab); } - private Object createCommandInstance(BlockPaletteManager manager, JavaPlugin plugin) { + private @NonNull Object createCommandInstance(BlockPaletteManager manager, JavaPlugin plugin) { try { Class c = BlockPaletteCommand.class; Constructor k; @@ -92,7 +95,7 @@ private Object createCommandInstance(BlockPaletteManager manager, JavaPlugin plu } catch (NoSuchMethodException ignored) {} return c.getDeclaredConstructor().newInstance(); - } catch (Throwable t) { + } catch (Exception t) { throw new RuntimeException("Cannot construct BlockPaletteCommand", t); } } diff --git a/src/main/java/net/buildtheearth/modules/navigation/NavigationModule.java b/src/main/java/net/buildtheearth/modules/navigation/NavigationModule.java index e903e0da..79f8f36b 100644 --- a/src/main/java/net/buildtheearth/modules/navigation/NavigationModule.java +++ b/src/main/java/net/buildtheearth/modules/navigation/NavigationModule.java @@ -15,6 +15,7 @@ import net.buildtheearth.modules.navigation.components.warps.commands.WarpsBtCommand; import net.buildtheearth.modules.navigation.components.warps.listeners.WarpJoinListener; import net.buildtheearth.modules.network.NetworkModule; +import net.buildtheearth.utils.WikiLinks; /** * Manages all things related to universal tpll @@ -33,7 +34,7 @@ public class NavigationModule extends Module { private static NavigationModule instance = null; public NavigationModule() { - super("Navigation", NetworkModule.getInstance()); + super("Navigation", WikiLinks.NAV, NetworkModule.getInstance()); } public static NavigationModule getInstance() { diff --git a/src/main/java/net/buildtheearth/modules/network/NetworkModule.java b/src/main/java/net/buildtheearth/modules/network/NetworkModule.java index 355dc8a0..ac75a8a4 100644 --- a/src/main/java/net/buildtheearth/modules/network/NetworkModule.java +++ b/src/main/java/net/buildtheearth/modules/network/NetworkModule.java @@ -12,6 +12,7 @@ import net.buildtheearth.modules.network.model.BuildTeam; import net.buildtheearth.modules.network.model.Region; import net.buildtheearth.modules.network.model.RegionType; +import net.buildtheearth.utils.WikiLinks; import net.buildtheearth.utils.io.ConfigPaths; import net.buildtheearth.utils.io.Constants; import net.buildtheearth.utils.io.Errors; @@ -51,7 +52,7 @@ public class NetworkModule extends Module { private static NetworkModule instance = null; public NetworkModule() { - super("Network"); + super("Network", WikiLinks.ENTRY); } public static NetworkModule getInstance() { @@ -130,7 +131,7 @@ public void ping(Player p) { ByteArrayDataOutput out = ByteStreams.newDataOutput(); out.writeUTF("Ping"); out.writeUTF(p.getUniqueId().toString()); - out.writeUTF("Version: " + BuildTeamTools.getInstance().getDescription().getVersion()); + out.writeUTF("Version: " + BuildTeamTools.getInstance().getPluginMeta().getVersion()); p.sendPluginMessage(BuildTeamTools.getInstance(), "btt:buildteam", out.toByteArray()); } diff --git a/src/main/java/net/buildtheearth/modules/plotsystem/PlotSystemModule.java b/src/main/java/net/buildtheearth/modules/plotsystem/PlotSystemModule.java index c84c2664..ad38318b 100644 --- a/src/main/java/net/buildtheearth/modules/plotsystem/PlotSystemModule.java +++ b/src/main/java/net/buildtheearth/modules/plotsystem/PlotSystemModule.java @@ -1,15 +1,8 @@ package net.buildtheearth.modules.plotsystem; - -/*import com.alpsbte.alpslib.libpsterra.core.Connection; -import com.alpsbte.alpslib.libpsterra.core.PSTerraSetup; -import com.alpsbte.alpslib.libpsterra.core.config.ConfigManager; -import com.alpsbte.alpslib.libpsterra.core.config.PSInitializer; -import com.alpsbte.alpslib.libpsterra.core.plotsystem.PlotCreator; -import com.alpsbte.alpslib.libpsterra.core.plotsystem.PlotPaster;*/ - import net.buildtheearth.modules.Module; import net.buildtheearth.modules.plotsystem.commands.PlotSystemTerraCommand; +import net.buildtheearth.utils.WikiLinks; public class PlotSystemModule extends Module { @@ -17,19 +10,19 @@ public class PlotSystemModule extends Module { private static PlotSystemModule instance = null; /* private ConfigManager configManager; - private PlotPaster plotPaster;*/ + private PlotPaster plotPaster; private boolean pluginEnabled = false; public String version; public String newVersion; public boolean updateInstalled = false; -/* + private Connection connection; private PlotCreator plotCreator;*/ public PlotSystemModule() { - super("PlotSystem"); + super("PlotSystem", WikiLinks.PLOT); } public static PlotSystemModule getInstance() { @@ -128,7 +121,9 @@ public void registerCommands() { } @Override - public void registerListeners() {} + public void registerListeners() { + // No Listeners + } } diff --git a/src/main/java/net/buildtheearth/modules/stats/StatsModule.java b/src/main/java/net/buildtheearth/modules/stats/StatsModule.java index 9b505666..d8257ff4 100644 --- a/src/main/java/net/buildtheearth/modules/stats/StatsModule.java +++ b/src/main/java/net/buildtheearth/modules/stats/StatsModule.java @@ -2,12 +2,14 @@ import com.google.common.io.ByteArrayDataOutput; import com.google.common.io.ByteStreams; +import lombok.Getter; import net.buildtheearth.BuildTeamTools; import net.buildtheearth.modules.Module; import net.buildtheearth.modules.network.NetworkModule; import net.buildtheearth.modules.stats.listeners.StatsListener; import net.buildtheearth.modules.stats.model.StatsPlayer; import net.buildtheearth.modules.stats.model.StatsServer; +import net.buildtheearth.utils.WikiLinks; import org.bukkit.Bukkit; import org.bukkit.entity.Player; import org.json.JSONArray; @@ -19,8 +21,9 @@ public class StatsModule extends Module { - public static int RATE_LIMIT = NetworkModule.CACHE_UPLOAD_SPEED / 20; + public static final int RATE_LIMIT = NetworkModule.CACHE_UPLOAD_SPEED / 20; + @Getter private StatsServer statsServer; private HashMap statsPlayerList; @@ -29,7 +32,7 @@ public class StatsModule extends Module { private static StatsModule instance = null; public StatsModule() { - super("Stats"); + super("Stats", WikiLinks.STATS); } public static StatsModule getInstance() { @@ -71,13 +74,6 @@ public void registerListeners() { super.registerListeners(new StatsListener()); } - - - - public StatsServer getStatsServer() { - return statsServer; - } - public StatsPlayer getStatsPlayer(UUID uuid) { if (statsPlayerList.get(uuid) == null) addStatsPlayer(uuid); @@ -133,8 +129,8 @@ public JSONObject getCurrentCache() { //Player Stats JSONArray jsonArray = new JSONArray(); - for (UUID uuid : statsPlayerList.keySet()) - jsonArray.put(statsPlayerList.get(uuid).toJSON()); + for (StatsPlayer statsPlayer : statsPlayerList.values()) + jsonArray.put(statsPlayer.toJSON()); jsonObject.put("PLAYERS", jsonArray); return jsonObject; diff --git a/src/main/java/net/buildtheearth/utils/WikiLinks.java b/src/main/java/net/buildtheearth/utils/WikiLinks.java new file mode 100644 index 00000000..dc6a83a3 --- /dev/null +++ b/src/main/java/net/buildtheearth/utils/WikiLinks.java @@ -0,0 +1,37 @@ +package net.buildtheearth.utils; + +import lombok.experimental.UtilityClass; + +@UtilityClass +public class WikiLinks { + private static final String WIKI_BASE_URL = "https://resources.buildtheearth.net/doc/"; + public static final String ENTRY = WIKI_BASE_URL + "build-team-tools-gwhwx9xRsX"; + public static final String GEN = WIKI_BASE_URL + "generator-module-13zqgI4yFA"; + public static final String NAV = WIKI_BASE_URL + "sledgehammer-module-T7I0PWPsTD"; + public static final String MISC = WIKI_BASE_URL + "miscellaneous-appUzeNc5I"; + public static final String STATS = WIKI_BASE_URL + "statistics-module-iM7IfoKroF"; + public static final String PLOT = "https://github.com/AlpsBTE/Plot-System/wiki/Installation#setting-up-the-terra-servers"; + + @UtilityClass + public static class Gen { + public static final String RAIL = WIKI_BASE_URL + "rail-generator-EfgKXdBvk1"; + public static final String ROAD = WIKI_BASE_URL + "road-generator-QqKBBP0nqO"; + public static final String TREE = WIKI_BASE_URL + "tree-generator-pnDmYC9hzW"; + public static final String HOUSE = WIKI_BASE_URL + "house-generator-YKQunon6Bp"; + public static final String FIELD = WIKI_BASE_URL + "field-generator-OqIN2BrZT7"; + + @UtilityClass + public static class Field { + private static final String CROP_BASE = WIKI_BASE_URL + "crop-types-z7ww6RZK2J"; + public static final String CROP_POTATO = CROP_BASE + "#h-potato-field"; + public static final String CROP_CORN = CROP_BASE + "#h-corn-field"; + public static final String CROP_WHEAT = CROP_BASE + "#h-wheat-field"; + public static final String CROP_HARVESTED = CROP_BASE + "#h-harvested-field"; + public static final String CROP_OTHER = CROP_BASE + "#h-other"; + public static final String CROP_VINEYARD = CROP_BASE + "#h-vineyard-field"; + public static final String CROP_PEAR = CROP_BASE + "#h-pear-field"; + public static final String CROP_CATTLE = CROP_BASE + "#h-cattle"; + public static final String CROP_MEADOW = CROP_BASE + "#h-meadow"; + } + } +} diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index 8d7e53a4..3fc73a47 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -2,8 +2,8 @@ # | BuildTeamTools - by BuildTheEarth # ---------------------------------------------------------------------------------------------- # | [Github Repo] https://github.com/BuildTheEarth/BuildTeamTools -# | [Config Documentation] https://github.com/BuildTheEarth/BuildTeamTools/wiki/Configuration -# | [Contacts - Discord] BuildTheEarth Staff Discord, @minefact +# | [Config Documentation] https://resources.buildtheearth.net/doc/configuration-tpEHSZ6Zt2#h-general-configuration +# | [Contacts - Discord] BTE Development Hub, @zoriot # ---------------------------------------------------------------------------------------------- # The Build Team API Key used to fetch build team info for display. diff --git a/src/main/resources/modules/navigation/config.yml b/src/main/resources/modules/navigation/config.yml index dd644f89..6bbb5662 100644 --- a/src/main/resources/modules/navigation/config.yml +++ b/src/main/resources/modules/navigation/config.yml @@ -4,8 +4,8 @@ # | The navigator module allows the player to navigate through the project # ---------------------------------------------------------------------------------------------- # | [Github Repo] https://github.com/BuildTheEarth/BuildTeamTools -# | [Config Documentation] https://github.com/BuildTheEarth/BuildTeamTools/wiki/Configuration -# | [Contacts - Discord] BuildTheEarth Staff Discord, @minefact +# | [Config Documentation] https://resources.buildtheearth.net/doc/configuration-tpEHSZ6Zt2#h-navigation +# | [Contacts - Discord] BTE Development Hub, @zoriot # ---------------------------------------------------------------------------------------------- # Configures the navigator item in the players hotbar From 0c9eccb72c478b6cd8aa3c413b6e0141890b838f Mon Sep 17 00:00:00 2001 From: Zoriot Date: Sun, 11 Jan 2026 16:41:17 +0100 Subject: [PATCH 12/23] =?UTF-8?q?refactor(tree):=20=E2=9C=A8=20update=20tr?= =?UTF-8?q?ee=20component=20logic=20and=20improve=20menu=20interactions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.gradle.kts | 1 - gradle/libs.versions.toml | 4 +- .../dependency/DependencyComponent.java | 37 +---- .../modules/generator/GeneratorModule.java | 4 +- .../generator/components/tree/Tree.java | 31 +++- .../generator/components/tree/TreeFlag.java | 20 ++- .../components/tree/TreeScripts.java | 66 +++------ .../generator/components/tree/TreeType.java | 9 ++ .../generator/components/tree/TreeWidth.java | 9 ++ .../components/tree/menu/TreeHeightMenu.java | 62 ++++++++ .../components/tree/menu/TreeTypeMenu.java | 30 ++-- .../components/tree/menu/TreeWidthMenu.java | 31 ++-- .../modules/generator/menu/GeneratorMenu.java | 2 +- .../modules/generator/model/Flag.java | 24 ++-- .../modules/generator/model/FlagType.java | 4 +- .../generator/model/GeneratorCollections.java | 4 +- .../utils/menus/NameListMenu.java | 133 ++++++++++++++++++ 17 files changed, 320 insertions(+), 151 deletions(-) create mode 100644 src/main/java/net/buildtheearth/modules/generator/components/tree/menu/TreeHeightMenu.java create mode 100644 src/main/java/net/buildtheearth/utils/menus/NameListMenu.java diff --git a/build.gradle.kts b/build.gradle.kts index 7ac88f94..c9a1b3a3 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -74,7 +74,6 @@ dependencies { implementation(libs.micycle.clipper2) implementation(libs.org.json.json) implementation(libs.com.google.code.gson.gson) - implementation(libs.com.google.guava.guava) implementation(libs.com.squareup.okhttp3.okhttp.jvm) implementation(libs.javaapiforkml) { exclude(group = "com.sun.xml.bind", module = "jaxb-xjc") // Else Remapping will yell of duplicated classes diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 4c86f938..1004ecaa 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -6,9 +6,8 @@ com-alpsbte-alpslib-alpslib-libpsterra = "1.1.3" com-alpsbte-canvas = "1.3" com-fastasyncworldedit-fastasyncworldedit-bukkit = "2.12.3" com-fastasyncworldedit-fastasyncworldedit-core = "2.12.3" -com-github-cryptomorin-xseries = "13.6.0" +com-github-cryptomorin-xseries = "13.6.0" # https://github.com/CryptoMorin/XSeries/releases com-google-code-gson-gson = "2.13.1" -com-google-guava-guava = "33.4.8-jre" com-mojang-authlib = "7.0.61" com-squareup-okhttp3-okhttp-jvm = "5.1.0" javaapiforkml = "3.0.10" # https://github.com/urbancamo/javaapiforkml @@ -31,7 +30,6 @@ com-fastasyncworldedit-fastasyncworldedit-bukkit = { module = "com.fastasyncworl com-fastasyncworldedit-fastasyncworldedit-core = { module = "com.fastasyncworldedit:FastAsyncWorldEdit-Core", version.ref = "com-fastasyncworldedit-fastasyncworldedit-core" } com-github-cryptomorin-xseries = { module = "com.github.cryptomorin:XSeries", version.ref = "com-github-cryptomorin-xseries" } com-google-code-gson-gson = { module = "com.google.code.gson:gson", version.ref = "com-google-code-gson-gson" } -com-google-guava-guava = { module = "com.google.guava:guava", version.ref = "com-google-guava-guava" } com-mojang-authlib = { module = "com.mojang:authlib", version.ref = "com-mojang-authlib" } com-squareup-okhttp3-okhttp-jvm = { module = "com.squareup.okhttp3:okhttp-jvm", version.ref = "com-squareup-okhttp3-okhttp-jvm" } javaapiforkml = { module = "uk.m0nom:javaapiforkml", version.ref = "javaapiforkml" } diff --git a/src/main/java/net/buildtheearth/modules/common/components/dependency/DependencyComponent.java b/src/main/java/net/buildtheearth/modules/common/components/dependency/DependencyComponent.java index 1f216d9e..09a70b8e 100644 --- a/src/main/java/net/buildtheearth/modules/common/components/dependency/DependencyComponent.java +++ b/src/main/java/net/buildtheearth/modules/common/components/dependency/DependencyComponent.java @@ -4,6 +4,8 @@ import net.buildtheearth.BuildTeamTools; import net.buildtheearth.modules.ModuleComponent; +import java.util.Objects; + /** * This class handles checking if the required dependencies for certain features are present */ @@ -31,42 +33,13 @@ public boolean isLegacyWorldEdit(){ if(!isWorldEditEnabled()) return false; - String version = BuildTeamTools.getInstance().getServer().getPluginManager().getPlugin("WorldEdit").getDescription().getVersion(); + String version = Objects.requireNonNull(BuildTeamTools.getInstance().getServer().getPluginManager() + .getPlugin("WorldEdit"), "World Edit was not found!").getPluginMeta().getVersion(); int major = Integer.parseInt(version.split("\\.")[0]); return major < 7; } - /** - * Checks if the server is running on a Paper-based server. - * - * @return True if the server is running on a Paper-based server, false if it is not - */ - public boolean isPaper(){ - try { - // Try to load a Paper-specific class - Class.forName("com.destroystokyo.paper.PaperConfig"); - return true; - } catch (ClassNotFoundException e) { - return false; - } - } - - /** - * Checks if the server is running on a Spigot-based server. - * - * @return True if the server is running on a Spigot-based server, false if it is not - */ - public boolean isSpigot(){ - try { - // Try to load a Spigot-specific class - Class.forName("org.spigotmc.SpigotConfig"); - return true; - } catch (ClassNotFoundException e) { - return false; - } - } - /** * Checks if the plugin "FastAsyncWorldEdit" is enabled. * @@ -82,7 +55,7 @@ public boolean isFastAsyncWorldEditEnabled() { * @return True if SchematicBrush is enabled, false if it is not enabled */ public boolean isSchematicBrushEnabled() { - return BuildTeamTools.getInstance().getServer().getPluginManager().isPluginEnabled("SchematicBrush"); + return BuildTeamTools.getInstance().getServer().getPluginManager().isPluginEnabled("SchematicBrushReborn"); } /** diff --git a/src/main/java/net/buildtheearth/modules/generator/GeneratorModule.java b/src/main/java/net/buildtheearth/modules/generator/GeneratorModule.java index 5a739166..ec1887de 100644 --- a/src/main/java/net/buildtheearth/modules/generator/GeneratorModule.java +++ b/src/main/java/net/buildtheearth/modules/generator/GeneratorModule.java @@ -42,8 +42,6 @@ public class GeneratorModule extends Module { @Getter private Field field; - - private static GeneratorModule instance = null; public GeneratorModule() { @@ -76,7 +74,7 @@ public void enable() { GeneratorCollections.generatorCollectionsVersion = "3.0"; // Check if the GeneratorCollections plugin is installed and up to date - GeneratorCollections.checkIfGeneratorCollectionsIsInstalled(null); + GeneratorCollections.hasUpdatedGeneratorCollections(null); LocalSession.MAX_HISTORY_SIZE = 500; diff --git a/src/main/java/net/buildtheearth/modules/generator/components/tree/Tree.java b/src/main/java/net/buildtheearth/modules/generator/components/tree/Tree.java index bd0eda8e..d353739d 100644 --- a/src/main/java/net/buildtheearth/modules/generator/components/tree/Tree.java +++ b/src/main/java/net/buildtheearth/modules/generator/components/tree/Tree.java @@ -1,24 +1,47 @@ package net.buildtheearth.modules.generator.components.tree; -import net.buildtheearth.modules.generator.GeneratorModule; +import lombok.Getter; +import net.buildtheearth.BuildTeamTools; import net.buildtheearth.modules.generator.model.GeneratorCollections; import net.buildtheearth.modules.generator.model.GeneratorComponent; import net.buildtheearth.modules.generator.model.GeneratorType; import net.buildtheearth.modules.generator.utils.GeneratorUtils; +import org.bukkit.Bukkit; import org.bukkit.entity.Player; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.HashSet; +import java.util.Set; +import java.util.stream.Collectors; +import java.util.stream.Stream; + public class Tree extends GeneratorComponent { public static final String TREE_PACK_VERSION = "v2.0"; - + @Getter + private Set heights = new HashSet<>(); public Tree() { super(GeneratorType.TREE); + Bukkit.getScheduler().runTaskAsynchronously(BuildTeamTools.getInstance(), () -> { + Path basePath = Path.of(GeneratorUtils.getWorldEditSchematicsFolderPath(), "GeneratorCollections", "treepack"); + try (Stream paths = Files.walk(basePath, 2)) { + heights = paths + .filter(p -> basePath.relativize(p).getNameCount() == 2) + .filter(Files::isDirectory) + .map(p -> p.getFileName().toString()) + .collect(Collectors.toSet()); + } catch (IOException e) { + BuildTeamTools.getInstance().getComponentLogger().warn("Failed to load tree pack heights:", e); + } + }); } @Override public boolean checkForPlayer(Player p) { - if (!GeneratorCollections.checkIfGeneratorCollectionsIsInstalled(p)) + if (!GeneratorCollections.hasUpdatedGeneratorCollections(p)) return false; return GeneratorUtils.checkIfSchematicBrushIsInstalled(p); @@ -26,7 +49,7 @@ public boolean checkForPlayer(Player p) { @Override public void generate(Player p) { - if (!GeneratorModule.getInstance().getRoad().checkForPlayer(p)) + if (!checkForPlayer(p)) return; TreeScripts.treescript_v_1_0(p, this); diff --git a/src/main/java/net/buildtheearth/modules/generator/components/tree/TreeFlag.java b/src/main/java/net/buildtheearth/modules/generator/components/tree/TreeFlag.java index bece460a..85fd4de9 100644 --- a/src/main/java/net/buildtheearth/modules/generator/components/tree/TreeFlag.java +++ b/src/main/java/net/buildtheearth/modules/generator/components/tree/TreeFlag.java @@ -1,15 +1,20 @@ package net.buildtheearth.modules.generator.components.tree; -import net.buildtheearth.modules.generator.model.FlagType; +import lombok.Getter; import net.buildtheearth.modules.generator.model.Flag; +import net.buildtheearth.modules.generator.model.FlagType; +import org.jspecify.annotations.Nullable; public enum TreeFlag implements Flag { TYPE("t", FlagType.TREE_TYPE), WIDTH("w", FlagType.TREE_WIDTH), - HEIGHT("h", FlagType.INTEGER); + HEIGHT("h", FlagType.STRING); + @Getter private final String flag; + + @Getter private final FlagType flagType; TreeFlag(String flag, FlagType flagType){ @@ -17,16 +22,7 @@ public enum TreeFlag implements Flag { this.flagType = flagType; } - public String getFlag() { - return flag; - } - - @Override - public FlagType getFlagType() { - return null; - } - - public static TreeFlag byString(String flag){ + public static @Nullable TreeFlag byString(String flag) { for(TreeFlag treeFlag : TreeFlag.values()) if(treeFlag.getFlag().equalsIgnoreCase(flag)) return treeFlag; diff --git a/src/main/java/net/buildtheearth/modules/generator/components/tree/TreeScripts.java b/src/main/java/net/buildtheearth/modules/generator/components/tree/TreeScripts.java index e6c2dfe4..889d7b77 100644 --- a/src/main/java/net/buildtheearth/modules/generator/components/tree/TreeScripts.java +++ b/src/main/java/net/buildtheearth/modules/generator/components/tree/TreeScripts.java @@ -5,59 +5,31 @@ import net.buildtheearth.utils.Item; import org.bukkit.Material; import org.bukkit.entity.Player; +import org.jspecify.annotations.NonNull; public class TreeScripts { - public static void treescript_v_1_0(Player p, Tree tree) { - String[] args = new String[4]; - + public static void treescript_v_1_0(@NonNull Player p, @NonNull Tree tree) { Settings settings = tree.getPlayerSettings().get(p.getUniqueId()); - args[1] = (String) settings.getValues().get(TreeFlag.TYPE); - args[2] = (String) settings.getValues().get(TreeFlag.HEIGHT); - args[3] = (String) settings.getValues().get(TreeFlag.WIDTH); - + TreeType treeType = (TreeType) settings.getValues().get(TreeFlag.TYPE); + if (treeType == null) treeType = TreeType.ANY; + String height = String.valueOf(settings.getValues().get(TreeFlag.HEIGHT)); + TreeWidth treeWidth = (TreeWidth) settings.getValues().get(TreeFlag.WIDTH); + if (treeWidth == null) treeWidth = TreeWidth.ANY; // In case the player is holding no item, give him a diamond sword - if(p.getItemOnCursor() == null || p.getInventory().getItemInMainHand().getType() == Material.AIR) - p.getInventory().setItem(p.getInventory().getHeldItemSlot(), Item.create(XMaterial.DIAMOND_SWORD.parseMaterial())); - - - if(args.length == 1) { - p.chat("//schbr newtrees/*@** -place:bottom -yoff:2"); - - }else if(args.length >= 2) { - String type = args[1]; - - if(args.length == 2) { - if(type.equalsIgnoreCase("any")) - p.chat("//schbr newtrees/*@** -place:bottom -yoff:2"); - else - p.chat("//schbr newtrees/" + type + "*@** -place:bottom -yoff:2"); - - }else if(args.length == 3) { - String scale = args[2]; - - if(type.equalsIgnoreCase("any")) - p.chat("//schbr newtrees/*/" + scale + "/*@** -place:bottom -yoff:2"); - else - p.chat("//schbr newtrees/"+ type + "/" + scale + "/*@** -place:bottom -yoff:2"); - - }else if(args.length == 4) { - String scale = args[2]; - String option = args[3]; - - if(type.equalsIgnoreCase("any")) { - if(scale.equalsIgnoreCase("any")) - p.chat("//schbr newtrees/*/*/*"+ option +"/*@** -place:bottom -yoff:2"); - else - p.chat("//schbr newtrees/*/" + scale + "/*" + option + "/*@** -place:bottom -yoff:2"); - } else { - if(scale.equalsIgnoreCase("any")) - p.chat("//schbr newtrees/" + type + "/*/*" + option + "/*@** -place:bottom -yoff:2"); - else - p.chat("//schbr newtrees/" + type + "/" + scale + "/*" + option + "/*@** -place:bottom -yoff:2"); - } - } + if (p.getInventory().getItemInMainHand().getType() == Material.AIR) + p.getInventory().setItem(p.getInventory().getHeldItemSlot(), Item.create(XMaterial.DIAMOND_SWORD.get())); + + if (treeType.getName().equalsIgnoreCase("any")) { + p.chat("/schbr $GeneratorCollections/treepack/* -place:bottom -yoff:2"); + } else if (height.equalsIgnoreCase("null") || height.equalsIgnoreCase("any")) { + p.chat("/schbr $GeneratorCollections/treepack/" + treeType.getName() + "/* -place:bottom -yoff:2"); + } else if (treeWidth.getName().equalsIgnoreCase("any")) { + p.chat("/schbr $GeneratorCollections/treepack/" + treeType.getName() + "/" + height + "/* -place:bottom -yoff:2"); + } else { + p.chat("/schbr $GeneratorCollections/treepack/" + treeType.getName() + "/" + height + "/" + + treeWidth.getName() + "/* -place:bottom -yoff:2"); } } } diff --git a/src/main/java/net/buildtheearth/modules/generator/components/tree/TreeType.java b/src/main/java/net/buildtheearth/modules/generator/components/tree/TreeType.java index b4ed37ad..1e0379ad 100644 --- a/src/main/java/net/buildtheearth/modules/generator/components/tree/TreeType.java +++ b/src/main/java/net/buildtheearth/modules/generator/components/tree/TreeType.java @@ -1,6 +1,7 @@ package net.buildtheearth.modules.generator.components.tree; import lombok.Getter; +import org.jspecify.annotations.Nullable; public enum TreeType { @@ -50,4 +51,12 @@ public enum TreeType { TreeType(String name) { this.name = name; } + + public static @Nullable TreeType byString(String check) { + for (TreeType type : TreeType.values()) + if (type.getName().equalsIgnoreCase(check)) + return type; + + return null; + } } diff --git a/src/main/java/net/buildtheearth/modules/generator/components/tree/TreeWidth.java b/src/main/java/net/buildtheearth/modules/generator/components/tree/TreeWidth.java index dace5fa6..af1eb7e3 100644 --- a/src/main/java/net/buildtheearth/modules/generator/components/tree/TreeWidth.java +++ b/src/main/java/net/buildtheearth/modules/generator/components/tree/TreeWidth.java @@ -1,6 +1,7 @@ package net.buildtheearth.modules.generator.components.tree; import lombok.Getter; +import org.jspecify.annotations.Nullable; public enum TreeWidth { @@ -17,4 +18,12 @@ public enum TreeWidth { TreeWidth(String name) { this.name = name; } + + public static @Nullable TreeWidth byString(String width) { + for (TreeWidth treeWidth : TreeWidth.values()) + if (treeWidth.getName().equalsIgnoreCase(width)) + return treeWidth; + + return null; + } } diff --git a/src/main/java/net/buildtheearth/modules/generator/components/tree/menu/TreeHeightMenu.java b/src/main/java/net/buildtheearth/modules/generator/components/tree/menu/TreeHeightMenu.java new file mode 100644 index 00000000..5e5d79f9 --- /dev/null +++ b/src/main/java/net/buildtheearth/modules/generator/components/tree/menu/TreeHeightMenu.java @@ -0,0 +1,62 @@ +package net.buildtheearth.modules.generator.components.tree.menu; + +import com.cryptomorin.xseries.XMaterial; +import net.buildtheearth.modules.generator.GeneratorModule; +import net.buildtheearth.modules.generator.components.tree.TreeFlag; +import net.buildtheearth.modules.generator.components.tree.TreeSettings; +import net.buildtheearth.modules.generator.model.Settings; +import net.buildtheearth.utils.Item; +import net.buildtheearth.utils.menus.NameListMenu; +import net.daporkchop.lib.common.misc.Tuple; +import org.apache.commons.lang3.StringUtils; +import org.bukkit.Sound; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; +import org.jspecify.annotations.NonNull; + +import java.util.ArrayList; +import java.util.List; + +public class TreeHeightMenu extends NameListMenu { + + public static final String TREE_TYPE_INV_NAME = "Choose a Tree Width"; + + public TreeHeightMenu(Player player, boolean autoLoad) { + super(player, TREE_TYPE_INV_NAME, getTreeHeights(), new TreeTypeMenu(player, false), autoLoad); + } + + /** + * Get a list of all tree widths + */ + private static @NonNull List> getTreeHeights() { + List> treeHeights = new ArrayList<>(); + + treeHeights.add(new Tuple<>(new Item(XMaterial.LIME_CONCRETE.parseItem()).setDisplayName("Any").build(), "Any")); + + GeneratorModule.getInstance().getTree().getHeights().forEach(h -> + treeHeights.add(new Tuple<>(Item.create(XMaterial.PAPER.get(), StringUtils.capitalize(h)), h))); + + return treeHeights; + } + + @Override + protected void setItemClickEventsAsync() { + super.setItemClickEventsAsync(); + + // Set click event for next item + if (canProceed()) + getMenu().getSlot(NEXT_ITEM_SLOT).setClickHandler((clickPlayer, clickInformation) -> { + Settings settings = GeneratorModule.getInstance().getTree().getPlayerSettings().get(clickPlayer.getUniqueId()); + + if (!(settings instanceof TreeSettings treeSettings)) + return; + + treeSettings.setValue(TreeFlag.HEIGHT, selectedNames.getFirst()); + + clickPlayer.closeInventory(); + clickPlayer.playSound(clickPlayer.getLocation(), Sound.UI_BUTTON_CLICK, 1.0F, 1.0F); + + new TreeWidthMenu(clickPlayer, true); + }); + } +} diff --git a/src/main/java/net/buildtheearth/modules/generator/components/tree/menu/TreeTypeMenu.java b/src/main/java/net/buildtheearth/modules/generator/components/tree/menu/TreeTypeMenu.java index ac766927..2add790e 100644 --- a/src/main/java/net/buildtheearth/modules/generator/components/tree/menu/TreeTypeMenu.java +++ b/src/main/java/net/buildtheearth/modules/generator/components/tree/menu/TreeTypeMenu.java @@ -2,23 +2,24 @@ import com.cryptomorin.xseries.XMaterial; import net.buildtheearth.modules.generator.GeneratorModule; +import net.buildtheearth.modules.generator.components.tree.TreeFlag; +import net.buildtheearth.modules.generator.components.tree.TreeSettings; +import net.buildtheearth.modules.generator.components.tree.TreeType; import net.buildtheearth.modules.generator.menu.GeneratorMenu; import net.buildtheearth.modules.generator.model.Settings; -import net.buildtheearth.modules.generator.components.road.RoadFlag; -import net.buildtheearth.modules.generator.components.road.RoadSettings; -import net.buildtheearth.modules.generator.components.tree.TreeType; import net.buildtheearth.utils.Item; -import net.buildtheearth.utils.menus.BlockListMenu; +import net.buildtheearth.utils.menus.NameListMenu; +import net.daporkchop.lib.common.misc.Tuple; import org.apache.commons.lang3.StringUtils; -import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; +import org.jspecify.annotations.NonNull; import java.util.ArrayList; import java.util.List; -public class TreeTypeMenu extends BlockListMenu { +public class TreeTypeMenu extends NameListMenu { public static final String TREE_TYPE_INV_NAME = "Choose a Tree Type"; @@ -27,13 +28,13 @@ public TreeTypeMenu(Player player, boolean autoLoad) { } /** Get a list of all tree types */ - private static List getTreeTypes() { - List treeTypes = new ArrayList<>(); + private static @NonNull List> getTreeTypes() { + List> treeTypes = new ArrayList<>(); - treeTypes.add(new Item(XMaterial.LIME_CONCRETE.parseItem()).setDisplayName("Any").build()); + treeTypes.add(new Tuple<>(new Item(XMaterial.LIME_CONCRETE.parseItem()).setDisplayName("Any").build(), "Any")); for(TreeType treeType : TreeType.values()) - treeTypes.add(Item.create(XMaterial.OAK_SAPLING.parseMaterial(), StringUtils.capitalize(treeType.getName()))); + treeTypes.add(new Tuple<>(Item.create(XMaterial.OAK_SAPLING.get(), StringUtils.capitalize(treeType.getName())), treeType.getName())); return treeTypes; } @@ -45,16 +46,17 @@ protected void setItemClickEventsAsync() { // Set click event for next item if(canProceed()) getMenu().getSlot(NEXT_ITEM_SLOT).setClickHandler((clickPlayer, clickInformation) -> { - Settings settings = GeneratorModule.getInstance().getRoad().getPlayerSettings().get(clickPlayer.getUniqueId()); + Settings settings = GeneratorModule.getInstance().getTree().getPlayerSettings().get(clickPlayer.getUniqueId()); - if(!(settings instanceof RoadSettings)) + if (!(settings instanceof TreeSettings treeSettings)) return; - RoadSettings roadSettings = (RoadSettings) settings; - roadSettings.setValue(RoadFlag.ROAD_MATERIAL, Item.createStringFromItemList(selectedMaterials)); + treeSettings.setValue(TreeFlag.TYPE, selectedNames.getFirst()); clickPlayer.closeInventory(); clickPlayer.playSound(clickPlayer.getLocation(), Sound.UI_BUTTON_CLICK, 1.0F, 1.0F); + + new TreeHeightMenu(clickPlayer, true); }); } } diff --git a/src/main/java/net/buildtheearth/modules/generator/components/tree/menu/TreeWidthMenu.java b/src/main/java/net/buildtheearth/modules/generator/components/tree/menu/TreeWidthMenu.java index fe184127..a1d2f605 100644 --- a/src/main/java/net/buildtheearth/modules/generator/components/tree/menu/TreeWidthMenu.java +++ b/src/main/java/net/buildtheearth/modules/generator/components/tree/menu/TreeWidthMenu.java @@ -2,21 +2,23 @@ import com.cryptomorin.xseries.XMaterial; import net.buildtheearth.modules.generator.GeneratorModule; -import net.buildtheearth.modules.generator.model.Settings; -import net.buildtheearth.modules.generator.components.road.RoadFlag; -import net.buildtheearth.modules.generator.components.road.RoadSettings; +import net.buildtheearth.modules.generator.components.tree.TreeFlag; +import net.buildtheearth.modules.generator.components.tree.TreeSettings; import net.buildtheearth.modules.generator.components.tree.TreeWidth; +import net.buildtheearth.modules.generator.model.Settings; import net.buildtheearth.utils.Item; -import net.buildtheearth.utils.menus.BlockListMenu; +import net.buildtheearth.utils.menus.NameListMenu; +import net.daporkchop.lib.common.misc.Tuple; import org.apache.commons.lang3.StringUtils; import org.bukkit.Sound; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; +import org.jspecify.annotations.NonNull; import java.util.ArrayList; import java.util.List; -public class TreeWidthMenu extends BlockListMenu { +public class TreeWidthMenu extends NameListMenu { public static final String TREE_TYPE_INV_NAME = "Choose a Tree Width"; @@ -27,15 +29,15 @@ public TreeWidthMenu(Player player, boolean autoLoad) { /** * Get a list of all tree widths */ - private static List getTreeWidths() { - List treeTypes = new ArrayList<>(); + private static @NonNull List> getTreeWidths() { + List> treeWidths = new ArrayList<>(); - treeTypes.add(new Item(XMaterial.LIME_CONCRETE.parseItem()).setDisplayName("Any").build()); + treeWidths.add(new Tuple<>(new Item(XMaterial.LIME_CONCRETE.parseItem()).setDisplayName("Any").build(), "Any")); for (TreeWidth treeWidth : TreeWidth.values()) - treeTypes.add(Item.create(XMaterial.PAPER.parseMaterial(), StringUtils.capitalize(treeWidth.getName()))); + treeWidths.add(new Tuple<>(Item.create(XMaterial.JUNGLE_SAPLING.get(), StringUtils.capitalize(treeWidth.getName())), treeWidth.getName())); - return treeTypes; + return treeWidths; } @Override @@ -45,18 +47,17 @@ protected void setItemClickEventsAsync() { // Set click event for next item if (canProceed()) getMenu().getSlot(NEXT_ITEM_SLOT).setClickHandler((clickPlayer, clickInformation) -> { - Settings settings = GeneratorModule.getInstance().getRoad().getPlayerSettings().get(clickPlayer.getUniqueId()); + Settings settings = GeneratorModule.getInstance().getTree().getPlayerSettings().get(clickPlayer.getUniqueId()); - if (!(settings instanceof RoadSettings)) + if (!(settings instanceof TreeSettings treeSettings)) return; - RoadSettings roadSettings = (RoadSettings) settings; - roadSettings.setValue(RoadFlag.ROAD_MATERIAL, Item.createStringFromItemList(selectedMaterials)); + treeSettings.setValue(TreeFlag.WIDTH, selectedNames.getFirst()); clickPlayer.closeInventory(); clickPlayer.playSound(clickPlayer.getLocation(), Sound.UI_BUTTON_CLICK, 1.0F, 1.0F); - //new SidewalkColorMenu(clickPlayer); + GeneratorModule.getInstance().getTree().generate(clickPlayer); }); } } diff --git a/src/main/java/net/buildtheearth/modules/generator/menu/GeneratorMenu.java b/src/main/java/net/buildtheearth/modules/generator/menu/GeneratorMenu.java index 6c5981b6..c325d8fd 100644 --- a/src/main/java/net/buildtheearth/modules/generator/menu/GeneratorMenu.java +++ b/src/main/java/net/buildtheearth/modules/generator/menu/GeneratorMenu.java @@ -90,7 +90,7 @@ protected void setPreviewItems() { // Set navigator item getMenu().getSlot(TREE_ITEM_SLOT).setItem(treeItem); - } else if (GeneratorCollections.checkIfGeneratorCollectionsIsInstalled(getMenuPlayer())) { + } else if (!GeneratorCollections.hasUpdatedGeneratorCollections(getMenuPlayer())) { // TREE ITEM ArrayList treeLore = ListUtil.createList("", "§cThe §eTree Pack " + Tree.TREE_PACK_VERSION + " §cis not installed", "§cTree Generator is disabled", "", "§8Leftclick for Installation Instructions"); diff --git a/src/main/java/net/buildtheearth/modules/generator/model/Flag.java b/src/main/java/net/buildtheearth/modules/generator/model/Flag.java index 156873e1..d49d80d1 100644 --- a/src/main/java/net/buildtheearth/modules/generator/model/Flag.java +++ b/src/main/java/net/buildtheearth/modules/generator/model/Flag.java @@ -1,11 +1,11 @@ package net.buildtheearth.modules.generator.model; -import lombok.Getter; import net.buildtheearth.modules.generator.components.field.FieldFlag; import net.buildtheearth.modules.generator.components.house.HouseFlag; import net.buildtheearth.modules.generator.components.rail.RailFlag; import net.buildtheearth.modules.generator.components.road.RoadFlag; import net.buildtheearth.modules.generator.components.tree.TreeFlag; +import org.jspecify.annotations.NonNull; public interface Flag { @@ -14,19 +14,13 @@ public interface Flag { FlagType getFlagType(); /** @return the flag by the given string and generator type */ - static Flag byString(GeneratorType generatorType, String flag) { - switch (generatorType) { - case HOUSE: - return HouseFlag.byString(flag); - case ROAD: - return RoadFlag.byString(flag); - case TREE: - return TreeFlag.byString(flag); - case RAILWAY: - return RailFlag.byString(flag); - case FIELD: - return FieldFlag.byString(flag); - } - return null; + static Flag byString(@NonNull GeneratorType generatorType, String flag) { + return switch (generatorType) { + case HOUSE -> HouseFlag.byString(flag); + case ROAD -> RoadFlag.byString(flag); + case TREE -> TreeFlag.byString(flag); + case RAILWAY -> RailFlag.byString(flag); + case FIELD -> FieldFlag.byString(flag); + }; } } diff --git a/src/main/java/net/buildtheearth/modules/generator/model/FlagType.java b/src/main/java/net/buildtheearth/modules/generator/model/FlagType.java index b7b5d18e..681d2a0a 100644 --- a/src/main/java/net/buildtheearth/modules/generator/model/FlagType.java +++ b/src/main/java/net/buildtheearth/modules/generator/model/FlagType.java @@ -86,9 +86,9 @@ public static Object convertToFlagType(Flag flag, String value){ case CROP_STAGE: return CropStage.getByIdentifier(value); case TREE_TYPE: - return TreeType.valueOf(value); + return TreeType.byString(value); case TREE_WIDTH: - return TreeWidth.valueOf(value); + return TreeWidth.byString(value); } return null; } diff --git a/src/main/java/net/buildtheearth/modules/generator/model/GeneratorCollections.java b/src/main/java/net/buildtheearth/modules/generator/model/GeneratorCollections.java index 2a331680..f50b304a 100644 --- a/src/main/java/net/buildtheearth/modules/generator/model/GeneratorCollections.java +++ b/src/main/java/net/buildtheearth/modules/generator/model/GeneratorCollections.java @@ -43,7 +43,7 @@ public class GeneratorCollections { * @param p The player to check for. If null, the console will be used instead. * @return Whether the Generator Collections package is installed */ - public static boolean checkIfGeneratorCollectionsIsInstalled(@Nullable Player p){ + public static boolean hasUpdatedGeneratorCollections(@Nullable Player p) { // Load the schematic file try { String folder; @@ -327,7 +327,7 @@ private static boolean checkIfGeneratorCollectionsIsUpToDate(Player p){ /** * Sends the player and console a message with more information about the generator collections package in case it isn't installed. * - * @see #checkIfGeneratorCollectionsIsInstalled(Player) + * @see #hasUpdatedGeneratorCollections(Player) * * @param p The player to send the message to */ diff --git a/src/main/java/net/buildtheearth/utils/menus/NameListMenu.java b/src/main/java/net/buildtheearth/utils/menus/NameListMenu.java new file mode 100644 index 00000000..e63308df --- /dev/null +++ b/src/main/java/net/buildtheearth/utils/menus/NameListMenu.java @@ -0,0 +1,133 @@ +package net.buildtheearth.utils.menus; + +import net.buildtheearth.utils.CustomHeads; +import net.buildtheearth.utils.Item; +import net.buildtheearth.utils.MenuItems; +import net.daporkchop.lib.common.misc.Tuple; +import org.bukkit.enchantments.Enchantment; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; +import org.ipvp.canvas.mask.BinaryMask; +import org.ipvp.canvas.mask.Mask; +import org.jspecify.annotations.NonNull; + +import java.util.ArrayList; +import java.util.List; + +/** + * A menu that allows the player to select a block from a list of blocks. It is possible to switch pages and to proceed to the next menu once a block has been selected. It is also possible to select multiple blocks. + * To change the items that are displayed in the menu, override the {@link #getSource()} method. + * To perform an action when a block is selected, override the {@link #setItemClickEventsAsync()} method. + */ +public class NameListMenu extends AbstractPaginatedMenu { + + public static final int SWITCH_PAGE_ITEM_SLOT = 31; + public static final int NEXT_ITEM_SLOT = 35; + public static final int BACK_ITEM_SLOT = 27; + + protected final List selectedNames; + private final List> items; + + private final AbstractMenu backMenu; + + + public NameListMenu(Player player, String invName, List> items, AbstractMenu backMenu, boolean autoLoad) { + super(4, 3, invName, player, autoLoad); + + this.items = items; + this.backMenu = backMenu; + selectedNames = new ArrayList<>(); + } + + @Override + protected void setPreviewItems() { + if (backMenu != null) + setBackItem(BACK_ITEM_SLOT, backMenu); + + setSwitchPageItems(SWITCH_PAGE_ITEM_SLOT); + + if (canProceed()) + getMenu().getSlot(NEXT_ITEM_SLOT).setItem(CustomHeads.getCheckmarkItem("§eNext")); + else + getMenu().getSlot(NEXT_ITEM_SLOT).setItem(MenuItems.ITEM_BACKGROUND); + + super.setPreviewItems(); + } + + @Override + protected void setMenuItemsAsync() { + // + } + + @Override + protected void setItemClickEventsAsync() { + setSwitchPageItemClickEvents(SWITCH_PAGE_ITEM_SLOT); + } + + @Override + protected Mask getMask() { + String backSlot = backMenu == null ? "1" : "0"; + + return BinaryMask.builder(getMenu()) + .item(MenuItems.ITEM_BACKGROUND) + .pattern("000000000") + .pattern("000000000") + .pattern("000000000") + .pattern(backSlot + "11000110") + .build(); + } + + @Override + protected List getSource() { + return items; + } + + @Override + protected void setPaginatedPreviewItems(List source) { + // Set pagignated items + List> pagItems = source.stream().map(l -> (Tuple) l).toList(); + int slot = 0; + for (Tuple item : pagItems) { + if (selectedNames.contains(item.getB())) + item.setA(new Item(item.getA()).setAmount(1).addEnchantment(Enchantment.LUCK_OF_THE_SEA, 1).hideEnchantments(true).build()); + + getMenu().getSlot(slot).setItem(item.getA()); + slot++; + } + } + + @Override + protected void setPaginatedMenuItemsAsync(List source) { + // No Async / DB Items + } + + @Override + protected void setPaginatedItemClickEventsAsync(@NonNull List source) { + List> pagItems = source.stream().map(l -> (Tuple) l).toList(); + int slot = 0; + for (Tuple item : pagItems) { + final int _slot = slot; + getMenu().getSlot(_slot).setClickHandler((clickPlayer, clickInformation) -> { + String type = (item.getB().toLowerCase()); + + if (selectedNames.contains(type)) + selectedNames.remove(type); + else + selectedNames.add(type); + + reloadMenuAsync(); + }); + slot++; + } + } + + /** + * Checks if the player has selected at least one block. + * + * @return true if the player has selected at least one block, false otherwise. + */ + protected boolean canProceed() { + return !selectedNames.isEmpty(); + } +} + From b6befcf9415634da590f68ffd95642c3c21f1f3f Mon Sep 17 00:00:00 2001 From: MineFact Date: Fri, 18 Jul 2025 11:27:35 +0200 Subject: [PATCH 13/23] feat(util): Update GeneratorUtils to 1.7.3 --- .../generator/utils/GeneratorUtils.java | 375 ++++++++++++------ 1 file changed, 248 insertions(+), 127 deletions(-) diff --git a/src/main/java/net/buildtheearth/modules/generator/utils/GeneratorUtils.java b/src/main/java/net/buildtheearth/modules/generator/utils/GeneratorUtils.java index 6c32b9e5..ce83bcf3 100644 --- a/src/main/java/net/buildtheearth/modules/generator/utils/GeneratorUtils.java +++ b/src/main/java/net/buildtheearth/modules/generator/utils/GeneratorUtils.java @@ -14,6 +14,7 @@ import com.sk89q.worldedit.extension.input.InputParseException; import com.sk89q.worldedit.extension.input.ParserContext; import com.sk89q.worldedit.extension.platform.Actor; +import com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard; import com.sk89q.worldedit.extent.clipboard.Clipboard; import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormat; import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormats; @@ -21,6 +22,8 @@ import com.sk89q.worldedit.extent.inventory.BlockBag; import com.sk89q.worldedit.function.mask.BlockMask; import com.sk89q.worldedit.function.mask.Mask; +import com.sk89q.worldedit.function.operation.ForwardExtentCopy; +import com.sk89q.worldedit.function.operation.Operation; import com.sk89q.worldedit.function.operation.Operations; import com.sk89q.worldedit.function.pattern.ClipboardPattern; import com.sk89q.worldedit.function.pattern.Pattern; @@ -38,18 +41,15 @@ import com.sk89q.worldedit.world.block.BlockTypes; import net.buildtheearth.BuildTeamTools; import net.buildtheearth.modules.WikiDocumented; -import net.buildtheearth.modules.common.CommonModule; import net.buildtheearth.utils.ChatHelper; -import net.buildtheearth.utils.MenuItems; import org.apache.commons.lang3.StringUtils; -import org.bukkit.Sound; -import org.bukkit.World; -import org.bukkit.Location; -import org.bukkit.Material; +import org.bukkit.*; import org.bukkit.block.Block; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; import org.bukkit.plugin.Plugin; +import org.bukkit.plugin.PluginDescriptionFile; +import org.bukkit.plugin.PluginManager; import org.bukkit.util.Vector; import java.io.File; @@ -99,10 +99,12 @@ *
• {@link #createCuboidSelection(Player, Vector, Vector)} *
• {@link #createPolySelection(Player, List, Block[][][])} *
• {@link #createPolySelection(Player, List, int, int)} + *
• {@link #changeRegionWorld(Region, com.sk89q.worldedit.world.World)} * *

WorldEdit Operation Functions: *
• {@link #prepareScriptSession(LocalSession, Actor, Player, com.sk89q.worldedit.world.World, int, boolean, boolean, boolean)} *
• {@link #analyzeRegion(Player, World)} + *
• {@link #copyRegion(LocalSession, Actor, Region, World, World)} *
• {@link #replaceBlocksWithMasks(LocalSession, Actor, com.sk89q.worldedit.world.World, List, BlockState, BlockState[], int)} *
• {@link #replaceBlocksWithSchematic(LocalSession, Actor, com.sk89q.worldedit.world.World, BlockState[], String)} *
• {@link #replaceBlocks(LocalSession, Actor, com.sk89q.worldedit.world.World, BlockState[], BlockState[])} @@ -141,9 +143,10 @@ *
• {@link #checkForBrickOutline(Block[][][], Player, WikiDocumented)} *
• {@link #checkForWoolBlock(Block[][][], Player, WikiDocumented)} * - * @version 1.5 + * @version 1.7.3 * @author MineFact */ +@SuppressWarnings("unused") public class GeneratorUtils { @@ -160,28 +163,60 @@ private static Plugin getPlugin(){ /** Checks if the plugin "FastAsyncWorldEdit" is enabled. */ private static boolean isFastAsyncWorldEditEnabled(){ - return CommonModule.getInstance().getDependencyComponent().isFastAsyncWorldEditEnabled(); + return getPlugin().getServer().getPluginManager().isPluginEnabled("FastAsyncWorldEdit"); } - /** Checks if only the plugin "WorldEdit" is enabled and not "FastAsyncWorldEdit". */ - private static boolean isLegacyWorldEditEnabled(){ - return CommonModule.getInstance().getDependencyComponent().isLegacyWorldEdit(); + private static boolean isLegacyWorldEditEnabled() { + if (isFastAsyncWorldEditEnabled()) + return false; + + PluginManager pluginManager = getPlugin().getServer().getPluginManager(); + if (!pluginManager.isPluginEnabled("WorldEdit")) + return false; + + Plugin plugin = pluginManager.getPlugin("WorldEdit"); + if (plugin == null) + return false; + + @SuppressWarnings("deprecation") + PluginDescriptionFile description = plugin.getDescription(); + String version = description.getVersion(); + int major; + try { + major = Integer.parseInt(version.split("\\.")[0]); + } catch (NumberFormatException e) { + // Fallback or assume not legacy if version can't be parsed + return false; + } + + return major < 7; } + /** Checks if the plugin "SchematicBrush" is enabled. */ private static boolean isSchematicBrushEnabled(){ - return CommonModule.getInstance().getDependencyComponent().isSchematicBrushEnabled(); - } + return getPlugin().getServer().getPluginManager().isPluginEnabled("SchematicBrush"); + } // e.g., "1.21.4" + /** Checks if the server version is 1.12. */ private static boolean isServerVersion1_12(){ - return CommonModule.getInstance().getVersionComponent().is_1_12(); + String rawVersion = Bukkit.getBukkitVersion().split("-")[0]; + return rawVersion.equals("1.12.2") || rawVersion.equals("1.12.1") || rawVersion.equals("1.12"); } /** Get the ignored materials. */ private static Material[] getIgnoredMaterials(){ - return MenuItems.getIgnoredMaterials(); + return new Material[]{}; } + + private static void sendWikiLink(Player p) { + p.sendMessage("§cFor more information, see the Wiki."); + } + + + + /*=============================================** @@ -234,12 +269,14 @@ public static BlockState getBlockState(XMaterial xMaterial){ return null; BlockType blockType = BlockTypes.get(xMaterial.getId() + ""); + ItemStack item = xMaterial.parseItem(); + if (blockType == null && item != null) + blockType = BlockTypes.get(item.getType().getKey().asString()); - if(blockType == null && xMaterial.parseMaterial() != null) - blockType = BlockTypes.get(xMaterial.parseMaterial().getKey().asString()); - - if(blockType == null) - throw new IllegalArgumentException("Invalid block type: " + xMaterial.parseMaterial().name()); + if (blockType == null && item != null) + throw new IllegalArgumentException("Invalid block type: " + item.getType().name()); + else if (blockType == null) + throw new IllegalArgumentException("Invalid block type: " + xMaterial.name()); return blockType.getDefaultState(); } @@ -299,83 +336,82 @@ public static String getWorldEditSchematicsFolderPath(){ public static List getSelectionPointsFromRegion(Region region) { List points = new ArrayList<>(); - if (region instanceof Polygonal2DRegion) { - Polygonal2DRegion polyRegion = (Polygonal2DRegion) region; - ChatHelper.logDebug("Polygonal2DRegion found"); - // In latest FAWE, the points are stored as BlockVector2 - // In 1.12 WorldEdit, the points are stored as BlockVector2D - // Both classes have the same methods, so we can use reflection to get the methods - for (Object blockVectorObj : polyRegion.getPoints()) { - ChatHelper.logDebug("BlockVector2:" + blockVectorObj); - try { - Class blockVectorClass = blockVectorObj.getClass(); - Method getXMethod = blockVectorClass.getMethod("getBlockX"); - Method getZMethod = blockVectorClass.getMethod("getBlockZ"); - - int x = (Integer) getXMethod.invoke(blockVectorObj); - int z = (Integer) getZMethod.invoke(blockVectorObj); - - points.add(new Vector(x, 0, z)); - } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) { - e.printStackTrace(); + switch (region) { + case Polygonal2DRegion polyRegion -> { + ChatHelper.logDebug("Polygonal2DRegion found"); + // In latest FAWE, the points are stored as BlockVector2 + // In 1.12 WorldEdit, the points are stored as BlockVector2D + // Both classes have the same methods, so we can use reflection to get the methods + for (Object blockVectorObj : polyRegion.getPoints()) { + ChatHelper.logDebug("BlockVector2:" + blockVectorObj); + try { + Class blockVectorClass = blockVectorObj.getClass(); + Method getXMethod = blockVectorClass.getMethod("getBlockX"); + Method getZMethod = blockVectorClass.getMethod("getBlockZ"); + + int x = (Integer) getXMethod.invoke(blockVectorObj); + int z = (Integer) getZMethod.invoke(blockVectorObj); + + points.add(new Vector(x, 0, z)); + } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) { + ChatHelper.logDebug("Exception while processing region: " + e.getMessage()); + } } } - - } else if (region instanceof ConvexPolyhedralRegion) { - ConvexPolyhedralRegion convexRegion = (ConvexPolyhedralRegion) region; - - // In latest FAWE, the points are stored as BlockVector2 - // In 1.12 WorldEdit, the points are stored as BlockVector2D - // Both classes have the same methods, so we can use reflection to get the methods - for (Object blockVectorObj : convexRegion.getVertices()) { - try { - Class blockVectorClass = blockVectorObj.getClass(); - Method getXMethod = blockVectorClass.getMethod("getBlockX"); - Method getYMethod = blockVectorClass.getMethod("getBlockY"); - Method getZMethod = blockVectorClass.getMethod("getBlockZ"); - - int x = (Integer) getXMethod.invoke(blockVectorObj); - int y = (Integer) getYMethod.invoke(blockVectorObj); - int z = (Integer) getZMethod.invoke(blockVectorObj); - - points.add(new Vector(x, y, z)); - } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) { - e.printStackTrace(); + case ConvexPolyhedralRegion convexRegion -> { + // In latest FAWE, the points are stored as BlockVector2 + // In 1.12 WorldEdit, the points are stored as BlockVector2D + // Both classes have the same methods, so we can use reflection to get the methods + for (Object blockVectorObj : convexRegion.getVertices()) { + try { + Class blockVectorClass = blockVectorObj.getClass(); + Method getXMethod = blockVectorClass.getMethod("getBlockX"); + Method getYMethod = blockVectorClass.getMethod("getBlockY"); + Method getZMethod = blockVectorClass.getMethod("getBlockZ"); + + int x = (Integer) getXMethod.invoke(blockVectorObj); + int y = (Integer) getYMethod.invoke(blockVectorObj); + int z = (Integer) getZMethod.invoke(blockVectorObj); + + points.add(new Vector(x, y, z)); + } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) { + ChatHelper.logDebug("Exception while processing region: " + e.getMessage()); + } } } + case CuboidRegion cuboidRegion -> { + try { + Class regionClass = cuboidRegion.getClass(); + Method getPos1Method = regionClass.getMethod("getPos1"); + Method getPos2Method = regionClass.getMethod("getPos2"); - }else if (region instanceof CuboidRegion) { - CuboidRegion cuboidRegion = (CuboidRegion) region; - - try { - Class regionClass = cuboidRegion.getClass(); - Method getPos1Method = regionClass.getMethod("getPos1"); - Method getPos2Method = regionClass.getMethod("getPos2"); - - Class vectorClass = getPos1Method.getReturnType(); + Class vectorClass = getPos1Method.getReturnType(); - Method getXMethod = vectorClass.getMethod("getBlockX"); - Method getYMethod = vectorClass.getMethod("getBlockY"); - Method getZMethod = vectorClass.getMethod("getBlockZ"); + Method getXMethod = vectorClass.getMethod("getBlockX"); + Method getYMethod = vectorClass.getMethod("getBlockY"); + Method getZMethod = vectorClass.getMethod("getBlockZ"); - Object pos1 = getPos1Method.invoke(region); - Object pos2 = getPos2Method.invoke(region); + Object pos1 = getPos1Method.invoke(region); + Object pos2 = getPos2Method.invoke(region); - int x1 = (Integer) getXMethod.invoke(pos1); - int y1 = (Integer) getYMethod.invoke(pos1); - int z1 = (Integer) getZMethod.invoke(pos1); + int x1 = (Integer) getXMethod.invoke(pos1); + int y1 = (Integer) getYMethod.invoke(pos1); + int z1 = (Integer) getZMethod.invoke(pos1); - int x2 = (Integer) getXMethod.invoke(pos2); - int y2 = (Integer) getYMethod.invoke(pos2); - int z2 = (Integer) getZMethod.invoke(pos2); + int x2 = (Integer) getXMethod.invoke(pos2); + int y2 = (Integer) getYMethod.invoke(pos2); + int z2 = (Integer) getZMethod.invoke(pos2); - points.add(new Vector(x1, y1, z1)); - points.add(new Vector(x2, y2, z2)); - } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) { - e.printStackTrace(); + points.add(new Vector(x1, y1, z1)); + points.add(new Vector(x2, y2, z2)); + } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) { + ChatHelper.logDebug("Exception while processing region: " + e.getMessage()); + } } - } else - return null; + case null, default -> { + return null; + } + } return points; } @@ -415,7 +451,7 @@ public static Vector[] getMinMaxPoints(Region region){ minMax[1] = new Vector(maxX, maxY, maxZ); } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) { - e.printStackTrace(); + ChatHelper.logDebug("Exception while processing MinMax Points: " + e.getMessage()); } return minMax; @@ -481,14 +517,11 @@ public static boolean containsBlock(Block[][][] blocks, XMaterial xMaterial, int int amountFound = 0; for (Block[][] block2D : blocks) for (Block[] block1D : block2D) - for (Block block : block1D) - if (isServerVersion1_12()) { - if (block != null && block.getType() == xMaterial.parseMaterial() && block.getData() == xMaterial.getData()) + for (Block block : block1D) { + ItemStack item = xMaterial.parseItem(); + if (block != null && item != null && block.getType() == item.getType()) amountFound++; - }else { - if (block != null && block.getType() == xMaterial.parseMaterial()) - amountFound++; - } + } return amountFound >= requiredAmount; } @@ -597,13 +630,46 @@ public static void createPolySelection(Player p, List points, int minY, ChatHelper.logDebug("Created polygonal selection with " + points.size() + " points. minY: " + minY + " maxY: " + maxY); } + + /** + * Rebuilds a region with a different world while keeping its coordinates. + * Currently, supports {@link Polygonal2DRegion} and {@link CuboidRegion}. + * + * @param region The region to rebuild + * @param world The world that should be used for the new region + * @return A new region with the supplied world or {@code null} if the type is unsupported + */ + public static Region changeRegionWorld(Region region, com.sk89q.worldedit.world.World world) { + if (region instanceof Polygonal2DRegion) { + List points = getSelectionPointsFromRegion(region); + if (points == null) + return null; + + List blockPoints = new ArrayList<>(); + for (Vector v : points) + blockPoints.add(BlockVector2.at(v.getBlockX(), v.getBlockZ())); + + Vector[] minMax = getMinMaxPoints(region); + int minY = minMax[0].getBlockY(); + int maxY = minMax[1].getBlockY(); + + return new Polygonal2DRegion(world, blockPoints, minY, maxY); + } else if (region instanceof CuboidRegion) { + Vector[] minMax = getMinMaxPoints(region); + BlockVector3 min = BlockVector3.at(minMax[0].getBlockX(), minMax[0].getBlockY(), minMax[0].getBlockZ()); + BlockVector3 max = BlockVector3.at(minMax[1].getBlockX(), minMax[1].getBlockY(), minMax[1].getBlockZ()); + return new CuboidRegion(world, min, max); + } + + return null; + } + - - - - - - + + + + + /*=============================================** WORLDEDIT OPERATION FUNCTIONS @@ -694,7 +760,7 @@ public static Block[][][] analyzeRegion(Player p, World world) { if(isLegacyWorldEditEnabled()) contains = regionClass.getMethod("contains", Class.forName("com.sk89q.worldedit.Vector")); else - contains = regionClass.getMethod("contains", com.sk89q.worldedit.math.BlockVector3.class); + contains = regionClass.getMethod("contains", BlockVector3.class); Object minPoint = getMinimumPoint.invoke(region); Object maxPoint = getMaximumPoint.invoke(region); @@ -743,11 +809,71 @@ public static Block[][][] analyzeRegion(Player p, World world) { return blocks; } catch (Exception e) { - e.printStackTrace(); + ChatHelper.logDebug("Exception while analyzing region: " + e.getMessage()); return null; } } + /** + * Copies all blocks inside a region from one world to another to the same coordinates. + * + * @param region The region to copy. + * @param fromWorld The source world. + * @param toWorld The destination world. + */ + public static CompletableFuture copyRegion(LocalSession localSession, Actor actor, + Region region, World fromWorld, + World toWorld) { + CompletableFuture future = new CompletableFuture<>(); + Bukkit.getScheduler().runTaskAsynchronously(getPlugin(), () -> { + com.sk89q.worldedit.world.World weFrom = BukkitAdapter.adapt(fromWorld); + com.sk89q.worldedit.world.World weTo = BukkitAdapter.adapt(toWorld); + Region copyRegion = region; + + try (EditSession sourceEditSession = WorldEdit.getInstance().newEditSession(weFrom); + EditSession targetEditSession = WorldEdit.getInstance().newEditSession(weTo)) { + + if (copyRegion.getWorld() != null && !copyRegion.getWorld().getName().equals(fromWorld.getName())) + copyRegion = changeRegionWorld(region, weFrom); + + if (copyRegion == null) { + ChatHelper.logError("Failed to copy region from " + fromWorld.getName() + " to " + toWorld.getName() + " because region is null."); + return; + } + + BlockArrayClipboard clipboard = new BlockArrayClipboard(copyRegion); + ForwardExtentCopy forwardCopy = new ForwardExtentCopy(sourceEditSession, copyRegion, + clipboard, region.getMinimumPoint()); + forwardCopy.setCopyingEntities(true); + forwardCopy.setCopyingBiomes(true); + Operations.complete(forwardCopy); + + ChatHelper.log("Pasting at: " + region.getMinimumPoint() + " in world " + toWorld.getName()); + ChatHelper.log("Clipboard size: " + clipboard.getRegion().getVolume()); + + Operation paste = new ClipboardHolder(clipboard) + .createPaste(targetEditSession) + .to(region.getMinimumPoint()) + .copyEntities(true) + .copyBiomes(true) + .ignoreAirBlocks(false) + .build(); + Operations.complete(paste); + targetEditSession.flushQueue(); + + saveEditSession(targetEditSession, localSession, actor); + } catch (WorldEditException e) { + ChatHelper.logError("Failed to copy region: " + e.getMessage()); + future.completeExceptionally(e); + return; + } + + future.complete(null); + }); + + return future; + } + /** * Replaces all blocks in a region with the given masks and a pattern. * @@ -766,7 +892,7 @@ public static CompletableFuture replaceBlocksWithMasks(LocalSession localS throw new IllegalArgumentException("BlockState[] to is empty"); CompletableFuture future = new CompletableFuture<>(); - Thread thread = new Thread(() -> { + Bukkit.getScheduler().runTaskAsynchronously(getPlugin(), () -> { for (int i = 0; i < iterations; i++) { try (EditSession editSession = WorldEdit.getInstance().newEditSession(weWorld)) { @@ -815,7 +941,6 @@ public static CompletableFuture replaceBlocksWithMasks(LocalSession localS future.complete(null); }); - thread.start(); return future; } @@ -832,7 +957,7 @@ public static CompletableFuture replaceBlocksWithMasks(LocalSession localS */ public static CompletableFuture replaceBlocksWithSchematic(LocalSession localSession, Actor actor, com.sk89q.worldedit.world.World weWorld, BlockState[] from, String schematicPath) { CompletableFuture future = new CompletableFuture<>(); - Thread thread = new Thread(() -> { + Bukkit.getScheduler().runTaskAsynchronously(getPlugin(), () -> { ChatHelper.logDebug("Replacing blocks from " + Arrays.toString(from) + " to " + schematicPath); try (EditSession editSession = WorldEdit.getInstance().newEditSession(weWorld)) { @@ -858,7 +983,7 @@ public static CompletableFuture replaceBlocksWithSchematic(LocalSession lo }else editSession.setBlocks(region, pattern); } catch (IOException e) { - e.printStackTrace(); + ChatHelper.logDebug("Exception while replacing blocks with schematic: " + e.getMessage()); return; } @@ -869,7 +994,7 @@ public static CompletableFuture replaceBlocksWithSchematic(LocalSession lo future.complete(null); }); - thread.start(); + return future; } @@ -889,7 +1014,7 @@ public static CompletableFuture replaceBlocks(LocalSession localSession, A throw new IllegalArgumentException("BlockState[] to is empty"); CompletableFuture future = new CompletableFuture<>(); - Thread thread = new Thread(() -> { + Bukkit.getScheduler().runTaskAsynchronously(getPlugin(), () -> { ChatHelper.logDebug("Replacing blocks from " + Arrays.toString(from) + " to " + Arrays.toString(to)); try (EditSession editSession = WorldEdit.getInstance().newEditSession(weWorld)) { @@ -922,7 +1047,6 @@ public static CompletableFuture replaceBlocks(LocalSession localSession, A future.complete(null); }); - thread.start(); return future; } @@ -951,14 +1075,14 @@ public static CompletableFuture drawSplineWithMasks(LocalSession localSess throw new IllegalArgumentException("BlockState[] to is empty"); // If no mask is provided, add an empty mask - if(masks.size() == 0) { + if (masks.isEmpty()) { masks = new ArrayList<>(); masks.add(""); } List finalMasks = masks; CompletableFuture future = new CompletableFuture<>(); - Thread thread = new Thread(() -> { + Bukkit.getScheduler().runTaskAsynchronously(getPlugin(), () -> { try (EditSession editSession = WorldEdit.getInstance().newEditSession(weWorld)) { @@ -1004,7 +1128,7 @@ public static CompletableFuture drawSplineWithMasks(LocalSession localSess editSession.drawSpline(pattern, blockVector3s, tension, bias, continuity, quality, radius, filled); if (connectLineEnds && blockVector3s.size() > 1) - editSession.drawLine(pattern, blockVector3s.get(0), blockVector3s.get(blockVector3s.size() - 1), radius, true); + editSession.drawLine(pattern, blockVector3s.getFirst(), blockVector3s.getLast(), radius, true); saveEditSession(editSession, localSession, actor); } @@ -1015,7 +1139,6 @@ public static CompletableFuture drawSplineWithMasks(LocalSession localSess future.complete(null); }); - thread.start(); return future; } @@ -1048,14 +1171,14 @@ public static CompletableFuture drawLineWithMasks(LocalSession localSessio throw new IllegalArgumentException("BlockState[] to is empty"); // If no mask is provided, add an empty mask - if(masks.size() == 0) { + if (masks.isEmpty()) { masks = new ArrayList<>(); masks.add(""); } CompletableFuture future = new CompletableFuture<>(); List finalMasks = masks; - Thread thread = new Thread(() -> { + Bukkit.getScheduler().runTaskAsynchronously(getPlugin(), () -> { try (EditSession editSession = WorldEdit.getInstance().newEditSession(weWorld)) { ParserContext parserContext = new ParserContext(); @@ -1112,7 +1235,6 @@ public static CompletableFuture drawLineWithMasks(LocalSession localSessio future.complete(null); }); - thread.start(); return future; } @@ -1132,7 +1254,7 @@ public static CompletableFuture pasteSchematicWithMasks(LocalSession local int offsetY = 1; // If no mask is provided, add an empty mask - if (masks.size() == 0) { + if (masks.isEmpty()) { masks = new ArrayList<>(); masks.add(""); } @@ -1147,7 +1269,7 @@ public static CompletableFuture pasteSchematicWithMasks(LocalSession local CompletableFuture future = new CompletableFuture<>(); int finalMaxHeight = maxHeight; final List finalMasks = masks; - Thread thread = new Thread(() -> { + Bukkit.getScheduler().runTaskAsynchronously(getPlugin(), () -> { try (EditSession editSession = WorldEdit.getInstance().newEditSession(weWorld)) { File schematicFile = new File(getWorldEditSchematicsFolderPath() + schematicPath); @@ -1179,7 +1301,7 @@ public static CompletableFuture pasteSchematicWithMasks(LocalSession local if(!maskString.isEmpty()) mask = new MaskFactory(WorldEdit.getInstance()).parseFromInput(maskString, parserContext); - com.sk89q.worldedit.function.operation.Operation op = holder + Operation op = holder .createPaste(editSession) .to(BlockVector3.at(loc.getBlockX(), finalMaxHeight + offsetY, loc.getBlockZ())) .ignoreAirBlocks(true) @@ -1199,7 +1321,6 @@ public static CompletableFuture pasteSchematicWithMasks(LocalSession local future.complete(null); }); - thread.start(); return future; } @@ -1387,7 +1508,7 @@ public static List populatePoints(List points, int distance){ } } - result.add(points.get(points.size()-1)); + result.add(points.getLast()); points = result; result = new ArrayList<>(); } @@ -1442,7 +1563,7 @@ public static List extendPolyLine(List vectors){ // Get the last two points Vector p3 = vectors.get(vectors.size()-2); - Vector p4 = vectors.get(vectors.size()-1); + Vector p4 = vectors.getLast(); // Get the vectors between the points Vector v1 = p1.clone().subtract(p2); @@ -1472,7 +1593,7 @@ public static List shortenPolyLine(List vectors, int distance){ // Get the last two points Vector p3 = vectors.get(vectors.size()-2); - Vector p4 = vectors.get(vectors.size()-1); + Vector p4 = vectors.getLast(); // Get the vectors between the points Vector v1 = p2.clone().subtract(p1); @@ -1483,8 +1604,8 @@ public static List shortenPolyLine(List vectors, int distance){ v2 = v2.clone().normalize().multiply(distance); // Remove the first and last points - vectors.remove(0); - vectors.remove(vectors.size() - 1); + vectors.removeFirst(); + vectors.removeLast(); // Add the shortened vectors result.add(p1.clone().add(v1)); @@ -1571,7 +1692,7 @@ private static List> convertPathsToVectorList(Paths64 pathsD, Vecto for(Point64 point : new ArrayList<>(path)) vectorList.add(new Vector(point.x + reference.getX(), minHeight, point.y + reference.getZ())); - Vector vector = vectorList.get(vectorList.size() - 1).setY(maxHeight); + Vector vector = vectorList.getLast().setY(maxHeight); vectorList.set(vectorList.size() - 1, vector); vectors.add(vectorList); @@ -1632,7 +1753,7 @@ public static List shiftPoints(List vectors, double shift, boole * @return The shifted polyline */ public static List> shiftPointsAll(List vectors, double shift) { - Vector reference = vectors.get(0); + Vector reference = vectors.getFirst(); int minHeight = getMinHeight(vectors); int maxHeight = getMaxHeight(vectors); Paths64 paths = new Paths64(); From 73f3c65e03165455f0c5a39fb5fd179c51463556 Mon Sep 17 00:00:00 2001 From: Zoriot Date: Sun, 11 Jan 2026 17:40:06 +0100 Subject: [PATCH 14/23] =?UTF-8?q?refactor(item):=20=E2=9C=A8=20simplify=20?= =?UTF-8?q?and=20clean=20up=20item=20metadata=20handling=20logic?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/net/buildtheearth/utils/Item.java | 103 +----------------- 1 file changed, 1 insertion(+), 102 deletions(-) diff --git a/src/main/java/net/buildtheearth/utils/Item.java b/src/main/java/net/buildtheearth/utils/Item.java index 71ab40d4..fe234123 100644 --- a/src/main/java/net/buildtheearth/utils/Item.java +++ b/src/main/java/net/buildtheearth/utils/Item.java @@ -3,12 +3,9 @@ import com.cryptomorin.xseries.XMaterial; import com.cryptomorin.xseries.profiles.builder.XSkull; import com.cryptomorin.xseries.profiles.objects.Profileable; -import com.mojang.authlib.GameProfile; -import com.mojang.authlib.properties.Property; import com.sk89q.worldedit.world.block.BlockType; import com.sk89q.worldedit.world.block.BlockTypes; import net.buildtheearth.modules.common.CommonModule; -import org.bukkit.Bukkit; import org.bukkit.Color; import org.bukkit.Material; import org.bukkit.enchantments.Enchantment; @@ -21,15 +18,7 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import java.lang.reflect.Field; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.Base64; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.UUID; +import java.util.*; public class Item { public static final Map nonPlayerSkulls = new HashMap<>(); @@ -484,94 +473,4 @@ public static ItemStack createCustomHeadTextureURL(String url, String name, List return head; } - - private static void mutateItemMeta(SkullMeta meta, String b64) { - GameProfile profile = makeProfile(b64); - - // Try Paper API (Minecraft Version 1.21+) - try { - Method setPlayerProfile = SkullMeta.class.getMethod("setPlayerProfile", com.destroystokyo.paper.profile.PlayerProfile.class); - com.destroystokyo.paper.profile.PlayerProfile paperProfile = Bukkit.createProfile(profile.id(), profile.name()); - paperProfile.setProperty(new com.destroystokyo.paper.profile.ProfileProperty("textures", b64)); - setPlayerProfile.invoke(meta, paperProfile); - return; - } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException ignored) {} - - // Try Paper API (Minecraft Version 1.20+) - try { - Method setPlayerProfile = SkullMeta.class.getMethod( - "setPlayerProfile", - com.destroystokyo.paper.profile.PlayerProfile.class - ); - - // Reflective access to profile.getId() and profile.getName() - Method getIdMethod = profile.getClass().getMethod("getId"); - Method getNameMethod = profile.getClass().getMethod("getName"); - - UUID id = (UUID) getIdMethod.invoke(profile); - String name = (String) getNameMethod.invoke(profile); - - com.destroystokyo.paper.profile.PlayerProfile paperProfile = - Bukkit.createProfile(id, name); - - paperProfile.getProperties().add( - new com.destroystokyo.paper.profile.ProfileProperty("textures", b64) - ); - - setPlayerProfile.invoke(meta, paperProfile); - return; - - } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException ignored) { - } - - - // Try setProfile(GameProfile) (Minecraft Version 1.15 – 1.19.4) - try { - Method metaSetProfileMethod = meta.getClass().getDeclaredMethod("setProfile", GameProfile.class); - metaSetProfileMethod.setAccessible(true); - metaSetProfileMethod.invoke(meta, profile); - return; - } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException ignored) {} - - // Try direct profile field (Minecraft Version 1.12 – 1.14) - try { - Field metaProfileField = meta.getClass().getDeclaredField("profile"); - metaProfileField.setAccessible(true); - metaProfileField.set(meta, profile); - } catch (NoSuchFieldException | IllegalAccessException ignored) { - System.err.println("Failed to set custom skull texture: unsupported server version or method change."); - } - } - - - private static @NotNull GameProfile makeProfile(@NotNull String b64) { - UUID id = new UUID( - b64.substring(b64.length() - 20).hashCode(), - b64.substring(b64.length() - 10).hashCode() - ); - GameProfile profile = new GameProfile(id, "bte"); - - // Try Paper API (Minecraft Version 1.21+) - boolean firstVersionWorked = false; - try { - profile.properties().put("textures", new Property("textures", b64)); - firstVersionWorked = true; - } catch (Exception ignored) { - } - - // Try api for older versions - if (!firstVersionWorked) { - try { - Method getPropertiesMethod = profile.getClass().getMethod("getProperties"); - Object properties = getPropertiesMethod.invoke(profile); - - ((com.mojang.authlib.properties.PropertyMap) properties) - .put("textures", new Property("textures", b64)); - } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) { - throw new RuntimeException(e); - } - } - - return profile; - } } From 61b8f3d91221213a8c4ab0c593f2a672087ca14f Mon Sep 17 00:00:00 2001 From: MineFact Date: Fri, 18 Jul 2025 13:06:01 +0200 Subject: [PATCH 15/23] feat(util): Update Item Utils to 1.3.2 --- .../java/net/buildtheearth/utils/Item.java | 414 +++++++++--------- 1 file changed, 200 insertions(+), 214 deletions(-) diff --git a/src/main/java/net/buildtheearth/utils/Item.java b/src/main/java/net/buildtheearth/utils/Item.java index fe234123..71fda7fc 100644 --- a/src/main/java/net/buildtheearth/utils/Item.java +++ b/src/main/java/net/buildtheearth/utils/Item.java @@ -6,6 +6,7 @@ import com.sk89q.worldedit.world.block.BlockType; import com.sk89q.worldedit.world.block.BlockTypes; import net.buildtheearth.modules.common.CommonModule; +import org.bukkit.Bukkit; import org.bukkit.Color; import org.bukkit.Material; import org.bukkit.enchantments.Enchantment; @@ -17,37 +18,96 @@ import org.jetbrains.annotations.Contract; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; - -import java.util.*; - +import org.jspecify.annotations.NonNull; + +import java.util.Base64; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; + +/** + * This class provides static utility methods and a fluent builder API for creating and modifying {@link ItemStack} objects in Bukkit.
+ * It supports the customization of items with names, lore, enchantments, attributes, and skull textures. + *

+ * The following dependencies are required: + *
    + *
  1. Bukkit API
  2. + *
  3. HeadDatabaseAPI
  4. (removed for BuildTeamTools) + *
+ * + *
+ * The functions are categorized into the following sections: + * + *

Builder Pattern Methods: + *
These methods allow chaining item properties using a fluent API: + *
• {@link #setDisplayName(String)} + *
• {@link #setAmount(int)} + *
• {@link #setLore(List)} + *
• {@link #addEnchantment(Enchantment, int)} + *
• {@link #hideAttributes(boolean)} + *
• {@link #hideEnchantments(boolean)} + *
• {@link #build()} + * + *

Item Creation Methods: + *
Static methods to quickly create customized {@link ItemStack} instances: + *
• {@link #create(Material)} + *
• {@link #create(Material, int)} + *
• {@link #create(Material, String)} + *
• {@link #create(Material, String, int)} + *
• {@link #create(Material, String, List)} + *
• {@link #create(Material, String, short, List)} + *
• {@link #create(Material, String, int, List)} + *
• {@link #create(Material, String, List, Enchantment, Integer)} + *
• {@link #create(Material, String, List, Enchantment, Integer, Enchantment, Integer)} + *
• {@link #create(Material, String, List, Enchantment, Integer, Enchantment, Integer, Enchantment, Integer)} + * + *

Leather Armor Creation Methods: + *
Special methods for creating and coloring leather armor: + *
• {@link #createLeatherArmor(Material, Color)} + *
• {@link #createLeatherArmor(Material, String, Color, List)} + *
• {@link #createLeatherArmor(Material, String, Color, List, Enchantment, Integer)} + *
• {@link #createLeatherArmor(Material, String, Color, List, Enchantment, Integer, Enchantment, Integer)} + *
• {@link #createLeatherArmor(Material, String, Color, List, Enchantment, Integer, Enchantment, Integer, Enchantment, Integer)} + * + *

Skull Creation Methods: + *
Utility methods to create player and custom skulls: + *
• {@link #createPlayerHead(String, String)} + *
• {@link #createPlayerHead(String, String, List)} + *
• {@link #createPlayerHead(String, String, int, List)} + * + *

Item Editing Methods: + *
Modify existing {@link ItemStack} objects: + *
• {@link #edit(ItemStack, Material)} + *
• {@link #edit(ItemStack, int)} + *
• {@link #edit(ItemStack, String)} + *
• {@link #edit(ItemStack, int, String)} + *
• {@link #edit(ItemStack, List)} + *
• {@link #edit(ItemStack, int, String, List)} + * + * @author MineFact + * @version 1.3.2 + */ +@SuppressWarnings({"deprecation", "unused"}) public class Item { - public static final Map nonPlayerSkulls = new HashMap<>(); + public static final Map nonPlayerSkulls = new ConcurrentHashMap<>(); + + private final Material material; - private ItemStack item; - private Material material; private String displayName; - private int amount = -1; - private List lore; - private boolean hideAttributes; - private boolean hideEnchantments; - private final List canDestroyItems = new ArrayList<>(); - private final List canPlaceItems = new ArrayList<>(); - private final HashMap enchantments = new HashMap<>(); + private int amount = 1; - public Item() {} + private List lore; - public Item(Material material) { - this.material = material; - } + private boolean hideAttributes; - public Item(ItemStack item) { - this.item = item; - } + private boolean hideEnchantments; + + private final Map enchantments = new HashMap<>(); - public Item setType(Material material) { + public Item(Material material) { this.material = material; - return this; } public Item setDisplayName(String name) { @@ -80,247 +140,173 @@ public Item hideEnchantments(boolean enchants) { return this; } - public Item addCanDestroyItem(String itemName){ - this.canDestroyItems.add(itemName); - return this; - } - - public Item addCanPlaceItem(String itemName){ - this.canPlaceItems.add(itemName); - return this; - } - public ItemStack build() { - ItemStack item = XMaterial.BARRIER.parseItem(); - - if(this.material != null) - item.setType(material); - - if(this.item != null) - item = this.item.clone(); - - if(this.amount != -1) - item.setAmount(this.amount); - else - item.setAmount(1); - - if (item.getEnchantments().isEmpty()) - for (Map.Entry en : this.enchantments.entrySet()) - item.addUnsafeEnchantment(en.getKey(), en.getValue()); - + ItemStack item = new ItemStack(this.material); + item.setAmount(this.amount); + for (Enchantment en : this.enchantments.keySet()) + item.addUnsafeEnchantment(en, this.enchantments.get(en)); ItemMeta itemmeta = item.getItemMeta(); + itemmeta.setDisplayName(this.displayName); + itemmeta.setLore(this.lore); + if (this.hideAttributes) itemmeta.addItemFlags(ItemFlag.HIDE_ATTRIBUTES); + if (this.hideEnchantments) itemmeta.addItemFlags(ItemFlag.HIDE_ENCHANTS); + item.setItemMeta(itemmeta); + return item; + } - if(this.displayName != null) - itemmeta.setDisplayName(this.displayName); - - if(this.lore != null) - itemmeta.setLore(this.lore); - - if (this.hideAttributes) - itemmeta.addItemFlags(ItemFlag.HIDE_ATTRIBUTES); - if (this.hideEnchantments) - itemmeta.addItemFlags(ItemFlag.HIDE_ENCHANTS); - - /*if(!canDestroyItems.isEmpty()){ - // TODO Marked for removal in 1.20.6, not fixed yet. - //Set nameSpacedKeySet = new HashSet<>(); - //for(String itemName : canDestroyItems) - // nameSpacedKeySet.add(NamespacedKey.minecraft(itemName)); - //itemmeta.setDestroyableKeys(nameSpacedKeySet); - } - - if(!canPlaceItems.isEmpty()){ - // TODO Marked for removal in 1.20.6, not fixed yet. - //Set nameSpacedKeySet = new HashSet<>(); - //for(String itemName : canPlaceItems) - // nameSpacedKeySet.add(NamespacedKey.minecraft(itemName)); - //itemmeta.setPlaceableKeys(nameSpacedKeySet); - }*/ + private static ItemStack createItem(Material material, String name, int amount, List lore, + Map enchantments) { + ItemStack item = new ItemStack(material, amount); + if (enchantments != null) + for (Map.Entry e : enchantments.entrySet()) + item.addUnsafeEnchantment(e.getKey(), e.getValue()); + + ItemMeta meta = item.getItemMeta(); + if (name != null) + meta.setDisplayName(name); + if (lore != null) + meta.setLore(lore); + meta.addItemFlags(ItemFlag.HIDE_ATTRIBUTES); + item.setItemMeta(meta); + return item; + } - item.setItemMeta(itemmeta); + private static ItemStack createLeatherArmorItem(Material material, String name, Color color, + List lore, Map enchantments) { + ItemStack item = new ItemStack(material); + if (enchantments != null) + for (Map.Entry e : enchantments.entrySet()) + item.addUnsafeEnchantment(e.getKey(), e.getValue()); + + + LeatherArmorMeta meta = (LeatherArmorMeta) item.getItemMeta(); + if (name != null) + meta.setDisplayName(name); + if (lore != null) + meta.setLore(lore); + meta.setColor(color); + meta.addItemFlags(ItemFlag.HIDE_ATTRIBUTES); + item.setItemMeta(meta); return item; } - public static ItemStack create(Material material) { + @Contract("_ -> new") + public static @NonNull ItemStack create(Material material) { return new ItemStack(material); } - public static ItemStack create(Material material, int amount) { + @Contract("_, _ -> new") + public static @NonNull ItemStack create(Material material, int amount) { return new ItemStack(material, amount); } - public static ItemStack create(Material material, String name) { - ItemStack item = new ItemStack(material, 1); - return edit(item, name); + public static @NonNull ItemStack create(Material material, String name) { + return createItem(material, name, 1, null, null); } - public static ItemStack create(Material material, String name, int amount) { - ItemStack item = new ItemStack(material, amount); - ItemMeta itemmeta = item.getItemMeta(); - itemmeta.setDisplayName(name); - itemmeta.addItemFlags(ItemFlag.HIDE_ATTRIBUTES); - item.setItemMeta(itemmeta); - return item; + public static @NonNull ItemStack create(Material material, String name, int amount) { + return createItem(material, name, amount, null, null); } - public static @NotNull ItemStack create(Material material, String name, List lore) { - ItemStack item = new ItemStack(material, 1, (short)0); - ItemMeta itemmeta = item.getItemMeta(); - itemmeta.setDisplayName(name); - itemmeta.setLore(lore); - itemmeta.addItemFlags(ItemFlag.HIDE_ATTRIBUTES); - item.setItemMeta(itemmeta); - return item; + public static @NonNull ItemStack create(Material material, String name, List lore) { + return createItem(material, name, 1, lore, null); } - public static @NotNull ItemStack create(Material material, String name, short durability, List lore) { - ItemStack item = new ItemStack(material, 1, durability); - ItemMeta itemmeta = item.getItemMeta(); - itemmeta.setDisplayName(name); - itemmeta.setLore(lore); - itemmeta.addItemFlags(ItemFlag.HIDE_ATTRIBUTES); - item.setItemMeta(itemmeta); + public static @NonNull ItemStack create(Material material, String name, short durability, List lore) { + ItemStack item = createItem(material, name, 1, lore, null); + item.setDurability(durability); return item; } - public static @NotNull ItemStack create(Material material, String name, int amount, List lore) { - ItemStack item = new ItemStack(material, amount); - ItemMeta itemmeta = item.getItemMeta(); - itemmeta.setDisplayName(name); - itemmeta.setLore(lore); - itemmeta.addItemFlags(ItemFlag.HIDE_ATTRIBUTES); - item.setItemMeta(itemmeta); - return item; + public static @NonNull ItemStack create(Material material, String name, int amount, List lore) { + return createItem(material, name, amount, lore, null); } - public static @NotNull ItemStack createLeatherArmor(Material material, String name, Color color, List lore) { - ItemStack item = new ItemStack(material); - LeatherArmorMeta itemmeta = (LeatherArmorMeta)item.getItemMeta(); - itemmeta.setDisplayName(name); - itemmeta.setLore(lore); - itemmeta.setColor(color); - itemmeta.addItemFlags(ItemFlag.HIDE_ATTRIBUTES); - item.setItemMeta(itemmeta); - return item; + public static @NonNull ItemStack createLeatherArmor(Material material, String name, Color color, List lore) { + return createLeatherArmorItem(material, name, color, lore, null); } - public static @NotNull ItemStack create(Material material, String name, List lore, Enchantment enchnt1, Integer level1) { - ItemStack item = new ItemStack(material); - item.addUnsafeEnchantment(enchnt1, level1); - ItemMeta itemmeta = item.getItemMeta(); - itemmeta.setDisplayName(name); - itemmeta.setLore(lore); - itemmeta.addItemFlags(ItemFlag.HIDE_ATTRIBUTES); - item.setItemMeta(itemmeta); - return item; + public static @NonNull ItemStack create(Material material, String name, List lore, Enchantment enchantment1, Integer level1) { + Map enchantments = new HashMap<>(); + enchantments.put(enchantment1, level1); + return createItem(material, name, 1, lore, enchantments); } - public static @NotNull ItemStack create(Material material, String name, List lore, Enchantment enchnt1, Integer level1, Enchantment enchnt2, Integer level2) { - ItemStack item = new ItemStack(material); - item.addUnsafeEnchantment(enchnt1, level1); - item.addUnsafeEnchantment(enchnt2, level2); - ItemMeta itemmeta = item.getItemMeta(); - itemmeta.setDisplayName(name); - itemmeta.setLore(lore); - itemmeta.addItemFlags(ItemFlag.HIDE_ATTRIBUTES); - item.setItemMeta(itemmeta); - return item; + public static @NonNull ItemStack create(Material material, String name, List lore, Enchantment enchantment, Integer level1, Enchantment enchantment2, Integer level2) { + Map enchantments = new HashMap<>(); + enchantments.put(enchantment, level1); + enchantments.put(enchantment2, level2); + return createItem(material, name, 1, lore, enchantments); } - public static @NotNull ItemStack create(Material material, String name, List lore, Enchantment enchnt1, Integer level1, Enchantment enchnt2, Integer level2, Enchantment enchnt3, Integer level3) { - ItemStack item = new ItemStack(material); - item.addUnsafeEnchantment(enchnt1, level1); - item.addUnsafeEnchantment(enchnt2, level2); - item.addUnsafeEnchantment(enchnt3, level3); - ItemMeta itemmeta = item.getItemMeta(); - itemmeta.setDisplayName(name); - itemmeta.setLore(lore); - itemmeta.addItemFlags(ItemFlag.HIDE_ATTRIBUTES); - item.setItemMeta(itemmeta); - return item; + public static @NonNull ItemStack create(Material material, String name, List lore, Enchantment enchantment, Integer level1, Enchantment enchantment2, Integer level2, Enchantment enchantment3, Integer level3) { + Map enchantments = new HashMap<>(); + enchantments.put(enchantment, level1); + enchantments.put(enchantment2, level2); + enchantments.put(enchantment3, level3); + return createItem(material, name, 1, lore, enchantments); } - public static @NotNull ItemStack createLeatherArmor(Material material, Color color) { + public static @NonNull ItemStack createLeatherArmor(Material material, Color color) { + LeatherArmorMeta itemMeta = (LeatherArmorMeta) new ItemStack(material).getItemMeta(); + itemMeta.setColor(color); + itemMeta.addItemFlags(ItemFlag.HIDE_ATTRIBUTES); ItemStack item = new ItemStack(material); - LeatherArmorMeta itemmeta = (LeatherArmorMeta)item.getItemMeta(); - itemmeta.setColor(color); - item.setItemMeta(itemmeta); - itemmeta.addItemFlags(ItemFlag.HIDE_ATTRIBUTES); + item.setItemMeta(itemMeta); return item; } - public static @NotNull ItemStack createLeatherArmor(Material material, String name, Color color, List lore, Enchantment enchnt1, Integer level1) { - ItemStack item = new ItemStack(material); - item.addUnsafeEnchantment(enchnt1, level1); - LeatherArmorMeta itemmeta = (LeatherArmorMeta)item.getItemMeta(); - itemmeta.setDisplayName(name); - itemmeta.setLore(lore); - itemmeta.setColor(color); - itemmeta.addItemFlags(ItemFlag.HIDE_ATTRIBUTES); - item.setItemMeta(itemmeta); - return item; + public static @NonNull ItemStack createLeatherArmor(Material material, String name, Color color, List lore, Enchantment enchantment, Integer level1) { + Map enchantments = new HashMap<>(); + enchantments.put(enchantment, level1); + return createLeatherArmorItem(material, name, color, lore, enchantments); } - public static @NotNull ItemStack createLeatherArmor(Material material, String name, Color color, List lore, Enchantment enchnt1, Integer level1, Enchantment enchnt2, Integer level2) { - ItemStack item = new ItemStack(material); - item.addUnsafeEnchantment(enchnt1, level1); - item.addUnsafeEnchantment(enchnt2, level2); - LeatherArmorMeta itemmeta = (LeatherArmorMeta)item.getItemMeta(); - itemmeta.setDisplayName(name); - itemmeta.setLore(lore); - itemmeta.setColor(color); - itemmeta.addItemFlags(ItemFlag.HIDE_ATTRIBUTES); - item.setItemMeta(itemmeta); - return item; + public static @NonNull ItemStack createLeatherArmor(Material material, String name, Color color, List lore, Enchantment enchantment, Integer level1, Enchantment enchantment2, Integer level2) { + Map enchantments = new HashMap<>(); + enchantments.put(enchantment, level1); + enchantments.put(enchantment2, level2); + return createLeatherArmorItem(material, name, color, lore, enchantments); } - public static @NotNull ItemStack createLeatherArmor(Material material, String name, Color color, List lore, Enchantment enchnt1, Integer level1, Enchantment enchnt2, Integer level2, Enchantment enchnt3, Integer level3) { - ItemStack item = new ItemStack(material); - item.addUnsafeEnchantment(enchnt1, level1); - item.addUnsafeEnchantment(enchnt2, level2); - item.addUnsafeEnchantment(enchnt3, level3); - LeatherArmorMeta itemmeta = (LeatherArmorMeta)item.getItemMeta(); - itemmeta.setDisplayName(name); - itemmeta.setLore(lore); - itemmeta.setColor(color); - itemmeta.addItemFlags(ItemFlag.HIDE_ATTRIBUTES); - item.setItemMeta(itemmeta); - return item; + public static @NonNull ItemStack createLeatherArmor(Material material, String name, Color color, List lore, Enchantment enchantment, Integer level1, Enchantment enchantment2, Integer level2, Enchantment enchantment3, Integer level3) { + Map enchantments = new HashMap<>(); + enchantments.put(enchantment, level1); + enchantments.put(enchantment2, level2); + enchantments.put(enchantment3, level3); + return createLeatherArmorItem(material, name, color, lore, enchantments); } - public static @Nullable ItemStack createPlayerHead(String name, String owner) { - ItemStack item = XMaterial.PLAYER_HEAD.parseItem(); - - if(item == null) - return null; - - SkullMeta itemmeta = (SkullMeta)item.getItemMeta(); - itemmeta.setDisplayName(name); - itemmeta.setOwner(owner); - itemmeta.addItemFlags(ItemFlag.HIDE_ATTRIBUTES); - item.setItemMeta(itemmeta); + public static @NonNull ItemStack createPlayerHead(String name, String owner) { + ItemStack item = new ItemStack(Material.PLAYER_HEAD); + SkullMeta itemMeta = (SkullMeta) item.getItemMeta(); + itemMeta.setDisplayName(name); + itemMeta.setOwningPlayer(Bukkit.getOfflinePlayer(owner)); + itemMeta.addItemFlags(ItemFlag.HIDE_ATTRIBUTES); + item.setItemMeta(itemMeta); return item; } - public static @Nullable ItemStack createPlayerHead(String name, String owner, List lore) { - ItemStack item = XMaterial.PLAYER_HEAD.parseItem(); - - if(item == null) - return null; - - SkullMeta itemmeta = (SkullMeta)item.getItemMeta(); - itemmeta.setDisplayName(name); - itemmeta.setOwner(owner); - itemmeta.setLore(lore); - itemmeta.addItemFlags(ItemFlag.HIDE_ATTRIBUTES); - item.setItemMeta(itemmeta); + public static @NonNull ItemStack createPlayerHead(String name, String owner, List lore) { + ItemStack item = new ItemStack(Material.PLAYER_HEAD); + SkullMeta itemMeta = (SkullMeta) item.getItemMeta(); + itemMeta.setDisplayName(name); + itemMeta.setOwningPlayer(Bukkit.getOfflinePlayer(owner)); + itemMeta.setLore(lore); + itemMeta.addItemFlags(ItemFlag.HIDE_ATTRIBUTES); + item.setItemMeta(itemMeta); return item; } + public static @NonNull ItemStack createPlayerHead(String name, String owner, int amount, List lore) { + var item = createPlayerHead(name, owner, lore); + return edit(item, amount); + } + @Contract("_, _ -> param1") - public static @NotNull ItemStack edit(@NotNull ItemStack item, Material material) { + public static @NotNull ItemStack edit(@NotNull ItemStack item, Material material) { item.setType(material); return item; } @@ -409,12 +395,12 @@ public static String getUniqueMaterialString(XMaterial[] materials) { public static @Nullable XMaterial convertStringToXMaterial(String materialString) { XMaterial material; - if(XMaterial.matchXMaterial(materialString).isPresent()) + if (XMaterial.matchXMaterial(materialString).isPresent()) material = XMaterial.matchXMaterial(materialString).get(); else { Material mat = Material.matchMaterial(materialString); - if(mat != null) + if (mat != null) material = XMaterial.matchXMaterial(mat); else return null; From fb0c3ff6424ce841f1c886ca932218bfc13270a9 Mon Sep 17 00:00:00 2001 From: MineFact Date: Fri, 18 Jul 2025 13:25:37 +0200 Subject: [PATCH 16/23] feat(util): Update Item Utils to 1.3.3 --- .../java/net/buildtheearth/utils/Item.java | 57 ++++++++++++++----- 1 file changed, 44 insertions(+), 13 deletions(-) diff --git a/src/main/java/net/buildtheearth/utils/Item.java b/src/main/java/net/buildtheearth/utils/Item.java index 71fda7fc..ce7d2976 100644 --- a/src/main/java/net/buildtheearth/utils/Item.java +++ b/src/main/java/net/buildtheearth/utils/Item.java @@ -5,7 +5,6 @@ import com.cryptomorin.xseries.profiles.objects.Profileable; import com.sk89q.worldedit.world.block.BlockType; import com.sk89q.worldedit.world.block.BlockTypes; -import net.buildtheearth.modules.common.CommonModule; import org.bukkit.Bukkit; import org.bukkit.Color; import org.bukkit.Material; @@ -34,6 +33,7 @@ *
    *
  1. Bukkit API
  2. *
  3. HeadDatabaseAPI
  4. (removed for BuildTeamTools) + *
  5. XMaterial from XSeries
  6. *
* *
@@ -85,8 +85,16 @@ *
• {@link #edit(ItemStack, List)} *
• {@link #edit(ItemStack, int, String, List)} * - * @author MineFact - * @version 1.3.2 + *

Material Conversion Utilities: + *
Utility methods to convert between {@link Material}, {@link XMaterial}, and {@link ItemStack} representations: + *
• {@link #fromUniqueMaterialString(String)} – Converts a namespaced string to an {@link ItemStack}. + *
• {@link #getUniqueMaterialString(ItemStack)} – Gets the namespaced key of an {@link ItemStack}'s material. + *
• {@link #getUniqueMaterialString(XMaterial)} – Gets the namespaced key of an {@link XMaterial}. + *
• {@link #getUniqueMaterialString(XMaterial[])} – Gets a comma-separated list of namespaced keys from multiple {@link XMaterial}s. + *
• {@link #convertStringToXMaterial(String)} – Converts a string to an {@link XMaterial}, fallback to Bukkit {@link Material} if needed. + * + * @version 1.3.3 + * @author MineFact, Zoriot */ @SuppressWarnings({"deprecation", "unused"}) public class Item { @@ -156,6 +164,13 @@ public ItemStack build() { return item; } + + // ============================== + // SECTION: Item Creation Methods + // ============================== + + + private static ItemStack createItem(Material material, String name, int amount, List lore, Map enchantments) { ItemStack item = new ItemStack(material, amount); @@ -279,6 +294,10 @@ private static ItemStack createLeatherArmorItem(Material material, String name, return createLeatherArmorItem(material, name, color, lore, enchantments); } + // ============================== + // SECTION: Skull Creation Methods + // ============================== + public static @NonNull ItemStack createPlayerHead(String name, String owner) { ItemStack item = new ItemStack(Material.PLAYER_HEAD); SkullMeta itemMeta = (SkullMeta) item.getItemMeta(); @@ -305,6 +324,10 @@ private static ItemStack createLeatherArmorItem(Material material, String name, return edit(item, amount); } + // ============================== + // SECTION: Item Editing Methods + // ============================== + @Contract("_, _ -> param1") public static @NotNull ItemStack edit(@NotNull ItemStack item, Material material) { item.setType(material); @@ -356,6 +379,10 @@ private static ItemStack createLeatherArmorItem(Material material, String name, return item; } + // ====================================== + // SECTION: Material Conversion Utilities + // ====================================== + public static @Nullable ItemStack fromUniqueMaterialString(String materialString) { Material material = Material.matchMaterial(materialString); if(material != null) @@ -368,20 +395,24 @@ private static ItemStack createLeatherArmorItem(Material material, String name, return null; } - public static @NotNull String getUniqueMaterialString(ItemStack item) { - if(CommonModule.getInstance().getVersionComponent().is_1_12()) - return XMaterial.matchXMaterial(item).getId() + ":" + XMaterial.matchXMaterial(item).getData(); - else - return item.getType().getKey().asString(); - + public static String getUniqueMaterialString(ItemStack item) { + return item.getType().getKey().asString(); } - public static @NotNull String getUniqueMaterialString(@NotNull XMaterial material) { - return getUniqueMaterialString(material.parseItem()); + + public static String getUniqueMaterialString(XMaterial material) { + if (material == null) + return null; + + ItemStack item = material.parseItem(); + if (item == null) + return null; + + return getUniqueMaterialString(item); } public static String getUniqueMaterialString(XMaterial[] materials) { - if(materials == null || materials.length == 0) + if (materials == null || materials.length == 0) return null; StringBuilder s = new StringBuilder(getUniqueMaterialString(materials[0])); @@ -392,7 +423,7 @@ public static String getUniqueMaterialString(XMaterial[] materials) { return s.toString(); } - public static @Nullable XMaterial convertStringToXMaterial(String materialString) { + public static XMaterial convertStringToXMaterial(String materialString) { XMaterial material; if (XMaterial.matchXMaterial(materialString).isPresent()) From 49ef421d431a23aacd88c375eb0a664f17028cb8 Mon Sep 17 00:00:00 2001 From: MineFact Date: Fri, 18 Jul 2025 13:45:50 +0200 Subject: [PATCH 17/23] feat(util): Update Item Utils to 1.3.4 --- .../components/field/menu/FenceTypeMenu.java | 2 +- .../components/house/HouseScripts.java | 8 +- .../components/house/menu/BaseColorMenu.java | 4 +- .../components/house/menu/RoofColorMenu.java | 6 +- .../components/house/menu/WallColorMenu.java | 6 +- .../road/menu/AdvancedColorMenu.java | 4 +- .../components/road/menu/RoadColorMenu.java | 6 +- .../road/menu/SidewalkColorMenu.java | 4 +- .../java/net/buildtheearth/utils/Item.java | 80 ++++++++++++------- 9 files changed, 69 insertions(+), 51 deletions(-) diff --git a/src/main/java/net/buildtheearth/modules/generator/components/field/menu/FenceTypeMenu.java b/src/main/java/net/buildtheearth/modules/generator/components/field/menu/FenceTypeMenu.java index 07350dff..d467b02e 100644 --- a/src/main/java/net/buildtheearth/modules/generator/components/field/menu/FenceTypeMenu.java +++ b/src/main/java/net/buildtheearth/modules/generator/components/field/menu/FenceTypeMenu.java @@ -33,7 +33,7 @@ protected void setItemClickEventsAsync() { return; FieldSettings fieldSettings = (FieldSettings) settings; - fieldSettings.setValue(FieldFlag.FENCE, Item.createStringFromItemList(selectedMaterials)); + fieldSettings.setValue(FieldFlag.FENCE, Item.createStringFromItemStringList(selectedMaterials)); clickPlayer.closeInventory(); clickPlayer.playSound(clickPlayer.getLocation(), Sound.UI_BUTTON_CLICK, 1.0F, 1.0F); diff --git a/src/main/java/net/buildtheearth/modules/generator/components/house/HouseScripts.java b/src/main/java/net/buildtheearth/modules/generator/components/house/HouseScripts.java index f2fb1eab..22589392 100644 --- a/src/main/java/net/buildtheearth/modules/generator/components/house/HouseScripts.java +++ b/src/main/java/net/buildtheearth/modules/generator/components/house/HouseScripts.java @@ -506,7 +506,7 @@ public void buildscript_v_1_2(){ BlockState[] doubleSlabs = new BlockState[roofColor.length]; for(int i = 0; i < roofColor.length; i++){ - BlockType bt = Item.convertXMaterialToBlockType(roofColor[i]); + BlockType bt = Item.convertXMaterialToWEBlockType(roofColor[i]); if(bt == null) continue; @@ -729,7 +729,7 @@ else if(property.getName().equalsIgnoreCase("shape")) // Convert all stair blocks to the correct orientation BlockState[] stairsWithOrientation = new BlockState[roofColor.length]; for(int i = 0; i < roofColor.length; i++){ - BlockType bt = Item.convertXMaterialToBlockType(roofColor[i]); + BlockType bt = Item.convertXMaterialToWEBlockType(roofColor[i]); if(bt == null) continue; @@ -760,7 +760,7 @@ else if(property.getName().equalsIgnoreCase("shape")) BlockState[] doubleSlabs = new BlockState[roofColor.length]; for(int i = 0; i < roofColor.length; i++){ - BlockType bt = Item.convertXMaterialToBlockType(roofColor[i]); + BlockType bt = Item.convertXMaterialToWEBlockType(roofColor[i]); if(bt == null) continue; @@ -768,7 +768,7 @@ else if(property.getName().equalsIgnoreCase("shape")) doubleSlabs[i] = getSlab(bt, "double"); } - replaceBlocks(Item.convertXMaterialToBlockType(XMaterial.DISPENSER).getDefaultState(), doubleSlabs); + replaceBlocks(Item.convertXMaterialToWEBlockType(XMaterial.DISPENSER).getDefaultState(), doubleSlabs); // Finish the script finish(blocks, selectionPoints); diff --git a/src/main/java/net/buildtheearth/modules/generator/components/house/menu/BaseColorMenu.java b/src/main/java/net/buildtheearth/modules/generator/components/house/menu/BaseColorMenu.java index b8e8468a..b5397c67 100644 --- a/src/main/java/net/buildtheearth/modules/generator/components/house/menu/BaseColorMenu.java +++ b/src/main/java/net/buildtheearth/modules/generator/components/house/menu/BaseColorMenu.java @@ -1,9 +1,9 @@ package net.buildtheearth.modules.generator.components.house.menu; import net.buildtheearth.modules.generator.GeneratorModule; -import net.buildtheearth.modules.generator.model.Settings; import net.buildtheearth.modules.generator.components.house.HouseFlag; import net.buildtheearth.modules.generator.components.house.HouseSettings; +import net.buildtheearth.modules.generator.model.Settings; import net.buildtheearth.utils.Item; import net.buildtheearth.utils.MenuItems; import net.buildtheearth.utils.menus.BlockListMenu; @@ -31,7 +31,7 @@ protected void setItemClickEventsAsync() { return; HouseSettings houseSettings = (HouseSettings) settings; - houseSettings.setValue(HouseFlag.BASE_COLOR, Item.createStringFromItemList(selectedMaterials)); + houseSettings.setValue(HouseFlag.BASE_COLOR, Item.createStringFromItemStringList(selectedMaterials)); clickPlayer.closeInventory(); clickPlayer.playSound(clickPlayer.getLocation(), Sound.UI_BUTTON_CLICK, 1.0F, 1.0F); diff --git a/src/main/java/net/buildtheearth/modules/generator/components/house/menu/RoofColorMenu.java b/src/main/java/net/buildtheearth/modules/generator/components/house/menu/RoofColorMenu.java index 390c16d6..a4062e35 100644 --- a/src/main/java/net/buildtheearth/modules/generator/components/house/menu/RoofColorMenu.java +++ b/src/main/java/net/buildtheearth/modules/generator/components/house/menu/RoofColorMenu.java @@ -1,20 +1,18 @@ package net.buildtheearth.modules.generator.components.house.menu; import net.buildtheearth.modules.generator.GeneratorModule; -import net.buildtheearth.modules.generator.model.Settings; import net.buildtheearth.modules.generator.components.house.HouseFlag; import net.buildtheearth.modules.generator.components.house.HouseSettings; import net.buildtheearth.modules.generator.components.house.RoofType; +import net.buildtheearth.modules.generator.model.Settings; import net.buildtheearth.utils.Item; import net.buildtheearth.utils.MenuItems; import net.buildtheearth.utils.menus.BlockListMenu; -import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; import java.util.ArrayList; -import java.util.Arrays; import java.util.List; public class RoofColorMenu extends BlockListMenu { @@ -38,7 +36,7 @@ protected void setItemClickEventsAsync() { return; HouseSettings houseSettings = (HouseSettings) settings; - houseSettings.setValue(HouseFlag.ROOF_COLOR, Item.createStringFromItemList(selectedMaterials)); + houseSettings.setValue(HouseFlag.ROOF_COLOR, Item.createStringFromItemStringList(selectedMaterials)); clickPlayer.closeInventory(); clickPlayer.playSound(clickPlayer.getLocation(), Sound.UI_BUTTON_CLICK, 1.0F, 1.0F); diff --git a/src/main/java/net/buildtheearth/modules/generator/components/house/menu/WallColorMenu.java b/src/main/java/net/buildtheearth/modules/generator/components/house/menu/WallColorMenu.java index 408ef2a5..04f47b08 100644 --- a/src/main/java/net/buildtheearth/modules/generator/components/house/menu/WallColorMenu.java +++ b/src/main/java/net/buildtheearth/modules/generator/components/house/menu/WallColorMenu.java @@ -1,10 +1,10 @@ package net.buildtheearth.modules.generator.components.house.menu; import net.buildtheearth.modules.generator.GeneratorModule; -import net.buildtheearth.modules.generator.menu.GeneratorMenu; -import net.buildtheearth.modules.generator.model.Settings; import net.buildtheearth.modules.generator.components.house.HouseFlag; import net.buildtheearth.modules.generator.components.house.HouseSettings; +import net.buildtheearth.modules.generator.menu.GeneratorMenu; +import net.buildtheearth.modules.generator.model.Settings; import net.buildtheearth.utils.Item; import net.buildtheearth.utils.MenuItems; import net.buildtheearth.utils.menus.BlockListMenu; @@ -32,7 +32,7 @@ protected void setItemClickEventsAsync() { return; HouseSettings houseSettings = (HouseSettings) settings; - houseSettings.setValue(HouseFlag.WALL_COLOR, Item.createStringFromItemList(selectedMaterials)); + houseSettings.setValue(HouseFlag.WALL_COLOR, Item.createStringFromItemStringList(selectedMaterials)); clickPlayer.closeInventory(); clickPlayer.playSound(clickPlayer.getLocation(), Sound.UI_BUTTON_CLICK, 1.0F, 1.0F); diff --git a/src/main/java/net/buildtheearth/modules/generator/components/road/menu/AdvancedColorMenu.java b/src/main/java/net/buildtheearth/modules/generator/components/road/menu/AdvancedColorMenu.java index 4cda5a9d..17cbf25e 100644 --- a/src/main/java/net/buildtheearth/modules/generator/components/road/menu/AdvancedColorMenu.java +++ b/src/main/java/net/buildtheearth/modules/generator/components/road/menu/AdvancedColorMenu.java @@ -1,9 +1,9 @@ package net.buildtheearth.modules.generator.components.road.menu; import net.buildtheearth.modules.generator.GeneratorModule; -import net.buildtheearth.modules.generator.model.Settings; import net.buildtheearth.modules.generator.components.road.RoadFlag; import net.buildtheearth.modules.generator.components.road.RoadSettings; +import net.buildtheearth.modules.generator.model.Settings; import net.buildtheearth.utils.Item; import net.buildtheearth.utils.menus.BlockListMenu; import org.bukkit.Sound; @@ -35,7 +35,7 @@ protected void setItemClickEventsAsync() { return; RoadSettings roadSettings = (RoadSettings) settings; - roadSettings.setValue(roadFlag, Item.createStringFromItemList(selectedMaterials)); + roadSettings.setValue(roadFlag, Item.createStringFromItemStringList(selectedMaterials)); clickPlayer.closeInventory(); clickPlayer.playSound(clickPlayer.getLocation(), Sound.UI_BUTTON_CLICK, 1.0F, 1.0F); diff --git a/src/main/java/net/buildtheearth/modules/generator/components/road/menu/RoadColorMenu.java b/src/main/java/net/buildtheearth/modules/generator/components/road/menu/RoadColorMenu.java index 6de0d1a6..c29ad8d3 100644 --- a/src/main/java/net/buildtheearth/modules/generator/components/road/menu/RoadColorMenu.java +++ b/src/main/java/net/buildtheearth/modules/generator/components/road/menu/RoadColorMenu.java @@ -1,10 +1,10 @@ package net.buildtheearth.modules.generator.components.road.menu; import net.buildtheearth.modules.generator.GeneratorModule; -import net.buildtheearth.modules.generator.menu.GeneratorMenu; -import net.buildtheearth.modules.generator.model.Settings; import net.buildtheearth.modules.generator.components.road.RoadFlag; import net.buildtheearth.modules.generator.components.road.RoadSettings; +import net.buildtheearth.modules.generator.menu.GeneratorMenu; +import net.buildtheearth.modules.generator.model.Settings; import net.buildtheearth.utils.Item; import net.buildtheearth.utils.MenuItems; import net.buildtheearth.utils.menus.BlockListMenu; @@ -32,7 +32,7 @@ protected void setItemClickEventsAsync() { return; RoadSettings roadSettings = (RoadSettings) settings; - roadSettings.setValue(RoadFlag.ROAD_MATERIAL, Item.createStringFromItemList(selectedMaterials)); + roadSettings.setValue(RoadFlag.ROAD_MATERIAL, Item.createStringFromItemStringList(selectedMaterials)); clickPlayer.closeInventory(); clickPlayer.playSound(clickPlayer.getLocation(), Sound.UI_BUTTON_CLICK, 1.0F, 1.0F); diff --git a/src/main/java/net/buildtheearth/modules/generator/components/road/menu/SidewalkColorMenu.java b/src/main/java/net/buildtheearth/modules/generator/components/road/menu/SidewalkColorMenu.java index 058797e2..7dbdde83 100644 --- a/src/main/java/net/buildtheearth/modules/generator/components/road/menu/SidewalkColorMenu.java +++ b/src/main/java/net/buildtheearth/modules/generator/components/road/menu/SidewalkColorMenu.java @@ -1,9 +1,9 @@ package net.buildtheearth.modules.generator.components.road.menu; import net.buildtheearth.modules.generator.GeneratorModule; -import net.buildtheearth.modules.generator.model.Settings; import net.buildtheearth.modules.generator.components.road.RoadFlag; import net.buildtheearth.modules.generator.components.road.RoadSettings; +import net.buildtheearth.modules.generator.model.Settings; import net.buildtheearth.utils.Item; import net.buildtheearth.utils.MenuItems; import net.buildtheearth.utils.menus.BlockListMenu; @@ -32,7 +32,7 @@ protected void setItemClickEventsAsync() { return; RoadSettings roadSettings = (RoadSettings) settings; - roadSettings.setValue(RoadFlag.SIDEWALK_MATERIAL, Item.createStringFromItemList(selectedMaterials)); + roadSettings.setValue(RoadFlag.SIDEWALK_MATERIAL, Item.createStringFromItemStringList(selectedMaterials)); clickPlayer.closeInventory(); clickPlayer.playSound(clickPlayer.getLocation(), Sound.UI_BUTTON_CLICK, 1.0F, 1.0F); diff --git a/src/main/java/net/buildtheearth/utils/Item.java b/src/main/java/net/buildtheearth/utils/Item.java index ce7d2976..0b37f465 100644 --- a/src/main/java/net/buildtheearth/utils/Item.java +++ b/src/main/java/net/buildtheearth/utils/Item.java @@ -19,10 +19,7 @@ import org.jetbrains.annotations.Nullable; import org.jspecify.annotations.NonNull; -import java.util.Base64; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.util.*; import java.util.concurrent.ConcurrentHashMap; /** @@ -70,12 +67,6 @@ *
• {@link #createLeatherArmor(Material, String, Color, List, Enchantment, Integer, Enchantment, Integer)} *
• {@link #createLeatherArmor(Material, String, Color, List, Enchantment, Integer, Enchantment, Integer, Enchantment, Integer)} * - *

Skull Creation Methods: - *
Utility methods to create player and custom skulls: - *
• {@link #createPlayerHead(String, String)} - *
• {@link #createPlayerHead(String, String, List)} - *
• {@link #createPlayerHead(String, String, int, List)} - * *

Item Editing Methods: *
Modify existing {@link ItemStack} objects: *
• {@link #edit(ItemStack, Material)} @@ -92,15 +83,26 @@ *
• {@link #getUniqueMaterialString(XMaterial)} – Gets the namespaced key of an {@link XMaterial}. *
• {@link #getUniqueMaterialString(XMaterial[])} – Gets a comma-separated list of namespaced keys from multiple {@link XMaterial}s. *
• {@link #convertStringToXMaterial(String)} – Converts a string to an {@link XMaterial}, fallback to Bukkit {@link Material} if needed. + *
• {@link #convertXMaterialToWEBlockType(XMaterial)} – Converts an {@link XMaterial} to a WorldEdit {@link BlockType}. + *
• {@link #createStringFromItemStringList(ArrayList)} – Converts a list of material strings to a comma-separated namespaced material string. + *
• {@link #createStringFromItemStringList(String...)} – Converts an array of material strings to a comma-separated namespaced material string. + * + *

Skull Creation Methods: + *
Utility methods to create player and custom skulls: + *
• {@link #createPlayerHead(String, String)} + *
• {@link #createPlayerHead(String, String, List)} + *
• {@link #createPlayerHead(String, String, int, List)} * - * @version 1.3.3 + * @version 1.3.4 * @author MineFact, Zoriot */ @SuppressWarnings({"deprecation", "unused"}) public class Item { public static final Map nonPlayerSkulls = new ConcurrentHashMap<>(); - private final Material material; + private ItemStack item; + + private Material material; private String displayName; @@ -118,6 +120,10 @@ public Item(Material material) { this.material = material; } + public Item(ItemStack item) { + this.item = item; + } + public Item setDisplayName(String name) { this.displayName = name; return this; @@ -149,7 +155,12 @@ public Item hideEnchantments(boolean enchants) { } public ItemStack build() { - ItemStack item = new ItemStack(this.material); + ItemStack item; + if (this.item != null) + item = this.item.clone(); + else + item = new ItemStack(this.material); + item.setAmount(this.amount); for (Enchantment en : this.enchantments.keySet()) @@ -170,9 +181,8 @@ public ItemStack build() { // ============================== - - private static ItemStack createItem(Material material, String name, int amount, List lore, - Map enchantments) { + private static @NonNull ItemStack createItem(Material material, String name, int amount, List lore, + Map enchantments) { ItemStack item = new ItemStack(material, amount); if (enchantments != null) for (Map.Entry e : enchantments.entrySet()) @@ -188,8 +198,8 @@ private static ItemStack createItem(Material material, String name, int amount, return item; } - private static ItemStack createLeatherArmorItem(Material material, String name, Color color, - List lore, Map enchantments) { + private static @NonNull ItemStack createLeatherArmorItem(Material material, String name, Color color, + List lore, Map enchantments) { ItemStack item = new ItemStack(material); if (enchantments != null) for (Map.Entry e : enchantments.entrySet()) @@ -395,8 +405,8 @@ private static ItemStack createLeatherArmorItem(Material material, String name, return null; } - public static String getUniqueMaterialString(ItemStack item) { - return item.getType().getKey().asString(); + public static @NonNull String getUniqueMaterialString(@NonNull ItemStack item) { + return item.getType().name(); } @@ -423,7 +433,7 @@ public static String getUniqueMaterialString(XMaterial[] materials) { return s.toString(); } - public static XMaterial convertStringToXMaterial(String materialString) { + public static @org.jspecify.annotations.Nullable XMaterial convertStringToXMaterial(String materialString) { XMaterial material; if (XMaterial.matchXMaterial(materialString).isPresent()) @@ -440,11 +450,11 @@ public static XMaterial convertStringToXMaterial(String materialString) { return material; } - public static BlockType convertXMaterialToBlockType(XMaterial material) { + public static BlockType convertXMaterialToWEBlockType(XMaterial material) { String mat = getUniqueMaterialString(material); BlockType bt; - if(mat.contains("minecraft:")) + if (mat.contains("minecraft:")) bt = BlockTypes.parse(mat); else bt = BlockTypes.get(mat); @@ -452,19 +462,29 @@ public static BlockType convertXMaterialToBlockType(XMaterial material) { return bt; } - public static @NotNull String createStringFromItemList(@NotNull List items) throws IllegalArgumentException { - StringBuilder s = new StringBuilder(items.getFirst()); + public static @NonNull String createStringFromItemStringList(@NonNull List items) throws IllegalArgumentException { + StringBuilder s = new StringBuilder(); - for (int i = 1; i < items.size(); i++) - if(XMaterial.matchXMaterial(items.get(i)).isPresent()) { - XMaterial xMaterial = XMaterial.matchXMaterial(items.get(i)).get(); + for (int i = 0; i < items.size(); i++) + if (XMaterial.matchXMaterial(items.get(i)).isPresent()) { + var curItem = items.get(i); + var material = XMaterial.matchXMaterial(curItem); + XMaterial xMaterial = material.get(); + ItemStack item = xMaterial.parseItem(); - s.append(",").append(getUniqueMaterialString(xMaterial.parseItem())); - } + if (item == null) + continue; + if (i > 0) s.append(","); + s.append(getUniqueMaterialString(item)); + } return s.toString(); } + public static @NonNull String createStringFromItemStringList(String... items) throws IllegalArgumentException { + return createStringFromItemStringList(new ArrayList<>(Arrays.asList(items))); + } + public static ItemStack createCustomHeadTextureURL(String url, String name, List lore) { byte[] encodedByteData = Base64.getEncoder().encode(String.format("{textures:{SKIN:{url:\"%s\"}}}", url).getBytes()); String encodedData = new String(encodedByteData); From 93011c897d583c1b2ac7da448b12216c0cea60dc Mon Sep 17 00:00:00 2001 From: Zoriot Date: Sun, 11 Jan 2026 20:34:01 +0100 Subject: [PATCH 18/23] =?UTF-8?q?refactor(build):=20=E2=9C=A8=20remove=20u?= =?UTF-8?q?nused=20authlib=20dependency=20from=20build=20configuration?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.gradle.kts | 1 - 1 file changed, 1 deletion(-) diff --git a/build.gradle.kts b/build.gradle.kts index c9a1b3a3..b5fb1595 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -80,7 +80,6 @@ dependencies { } implementation(libs.com.googlecode.json.simple) compileOnly(libs.io.papermc.paper.paper.api) - compileOnly(libs.com.mojang.authlib) compileOnly(libs.com.fastasyncworldedit.fastasyncworldedit.core) compileOnly(libs.com.fastasyncworldedit.fastasyncworldedit.bukkit) } From 557cf6132cb9016bb6ad4d58bbeb3b3321dd34d8 Mon Sep 17 00:00:00 2001 From: Zoriot Date: Sun, 11 Jan 2026 22:07:57 +0100 Subject: [PATCH 19/23] =?UTF-8?q?refactor(all):=20=E2=9C=A8=20extract=20ut?= =?UTF-8?q?ilities=20into=20alps-lib?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gradle/libs.versions.toml | 2 +- .../net/buildtheearth/modules/Module.java | 3 +- .../buildtheearth/modules/ModuleHandler.java | 2 +- .../buildtheearth/modules/WikiDocumented.java | 22 - .../modules/common/CommonModule.java | 2 + .../commands/BuildTeamToolsCommand.java | 8 +- .../PluginMessagingComponent.java | 2 +- .../common/listeners/CommandListener.java | 2 +- .../modules/generator/GeneratorModule.java | 4 + .../generator/commands/GeneratorCommand.java | 2 +- .../generator/components/field/Field.java | 2 +- .../components/field/FieldScripts.java | 2 +- .../components/field/FieldSettings.java | 1 - .../components/field/menu/CropStageMenu.java | 2 +- .../components/field/menu/CropTypeMenu.java | 2 +- .../components/field/menu/FenceTypeMenu.java | 2 +- .../generator/components/house/House.java | 2 +- .../components/house/HouseScripts.java | 4 +- .../components/house/menu/BaseColorMenu.java | 2 +- .../components/house/menu/RoofColorMenu.java | 2 +- .../components/house/menu/RoofTypeMenu.java | 5 +- .../components/house/menu/WallColorMenu.java | 2 +- .../generator/components/kml/KmlCommand.java | 38 +- .../generator/components/rail/Rail.java | 2 +- .../components/rail/RailScripts.java | 2 +- .../generator/components/road/Road.java | 2 +- .../components/road/RoadScripts.java | 4 +- .../components/road/RoadSettings.java | 5 +- .../road/menu/AdvancedColorMenu.java | 2 +- .../road/menu/AdvancedSettingsMenu.java | 4 +- .../components/road/menu/RoadColorMenu.java | 2 +- .../road/menu/SidewalkColorMenu.java | 2 +- .../generator/components/tree/Tree.java | 2 +- .../components/tree/TreeScripts.java | 2 +- .../components/tree/menu/TreeHeightMenu.java | 2 +- .../components/tree/menu/TreeTypeMenu.java | 2 +- .../components/tree/menu/TreeWidthMenu.java | 2 +- .../listeners/GeneratorListener.java | 2 +- .../modules/generator/menu/GeneratorMenu.java | 2 +- .../modules/generator/model/Command.java | 4 +- .../modules/generator/model/FlagType.java | 4 +- .../generator/model/GeneratorCollections.java | 2 +- .../generator/model/GeneratorComponent.java | 4 +- .../modules/generator/model/History.java | 5 +- .../modules/generator/model/Script.java | 2 +- .../modules/generator/model/Settings.java | 3 +- .../generator/utils/GeneratorUtils.java | 1885 ----------------- .../ChoosePaletteBlocksMenu.java | 4 +- .../blockpalettegui/ChoosePaletteMenu.java | 2 +- .../blockpalettegui/CreatePaletteMenu.java | 2 +- .../blockpalettegui/EditPaletteMenu.java | 2 +- .../blockpalettegui/PaletteBlockListMenu.java | 2 +- .../modules/navigation/NavUtils.java | 2 +- .../navigator/NavigatorComponent.java | 4 +- .../navigator/commands/BuildteamCommand.java | 2 +- .../navigator/commands/NavigatorCommand.java | 4 +- .../components/tpll/TpllComponent.java | 2 +- .../tpll/listeners/TpllJoinListener.java | 2 +- .../tpll/listeners/TpllListener.java | 2 +- .../components/warps/WarpsComponent.java | 2 +- .../warps/commands/WarpCommand.java | 2 +- .../warps/listeners/WarpJoinListener.java | 2 +- .../warps/menu/AddressTypeSelectionMenu.java | 2 +- .../warps/menu/MaterialSelectionMenu.java | 10 +- .../components/warps/menu/WarpEditMenu.java | 8 +- .../warps/menu/WarpGroupEditMenu.java | 8 +- .../components/warps/menu/WarpGroupMenu.java | 4 +- .../components/warps/menu/WarpMenu.java | 2 +- .../components/warps/model/Warp.java | 5 +- .../components/warps/model/WarpGroup.java | 2 +- .../navigation/menu/CountrySelectorMenu.java | 4 +- .../modules/navigation/menu/ExploreMenu.java | 4 +- .../modules/navigation/menu/MainMenu.java | 11 +- .../navigation/menu/StateSelectorMenu.java | 4 +- .../modules/network/api/NetworkAPI.java | 2 +- .../modules/network/api/OpenStreetMapAPI.java | 2 +- .../modules/network/model/BuildTeam.java | 2 +- .../modules/stats/menu/StatsMenu.java | 2 +- .../net/buildtheearth/utils/ChatHelper.java | 165 -- .../net/buildtheearth/utils/CustomHeads.java | 1 + .../java/net/buildtheearth/utils/Item.java | 513 ----- .../net/buildtheearth/utils/MenuItems.java | 1 + .../utils/menus/AbstractMenu.java | 3 +- .../utils/menus/BlockListMenu.java | 2 +- .../buildtheearth/utils/menus/BookMenu.java | 3 +- .../utils/menus/NameListMenu.java | 2 +- 86 files changed, 135 insertions(+), 2726 deletions(-) delete mode 100644 src/main/java/net/buildtheearth/modules/WikiDocumented.java delete mode 100644 src/main/java/net/buildtheearth/modules/generator/utils/GeneratorUtils.java delete mode 100644 src/main/java/net/buildtheearth/utils/ChatHelper.java delete mode 100644 src/main/java/net/buildtheearth/utils/Item.java diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 1004ecaa..3a764c30 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -21,7 +21,7 @@ com-googlecode-json-simple = "1.1.1" # https://mvnrepository.com/artifact/com.go com-palantir-git-version = "4.0.0" com-gradleup-shadow = "9.3.0" alpslib-io = "1.2.0" -alpslib-utils = "1.3.8" +alpslib-utils = "1.4.0" [libraries] com-alpsbte-alpslib-alpslib-libpsterra = { module = "com.alpsbte.alpslib:alpslib-libpsterra", version.ref = "com-alpsbte-alpslib-alpslib-libpsterra" } diff --git a/src/main/java/net/buildtheearth/modules/Module.java b/src/main/java/net/buildtheearth/modules/Module.java index a056a14c..f6ab58aa 100644 --- a/src/main/java/net/buildtheearth/modules/Module.java +++ b/src/main/java/net/buildtheearth/modules/Module.java @@ -1,9 +1,10 @@ package net.buildtheearth.modules; +import com.alpsbte.alpslib.utils.ChatHelper; +import com.alpsbte.alpslib.utils.WikiDocumented; import lombok.Getter; import lombok.NonNull; import net.buildtheearth.BuildTeamTools; -import net.buildtheearth.utils.ChatHelper; import org.bukkit.Bukkit; import org.bukkit.command.CommandExecutor; import org.bukkit.command.PluginCommand; diff --git a/src/main/java/net/buildtheearth/modules/ModuleHandler.java b/src/main/java/net/buildtheearth/modules/ModuleHandler.java index 3877ec9b..dc07f7e0 100644 --- a/src/main/java/net/buildtheearth/modules/ModuleHandler.java +++ b/src/main/java/net/buildtheearth/modules/ModuleHandler.java @@ -1,8 +1,8 @@ package net.buildtheearth.modules; +import com.alpsbte.alpslib.utils.ChatHelper; import lombok.Getter; import net.buildtheearth.BuildTeamTools; -import net.buildtheearth.utils.ChatHelper; import net.buildtheearth.utils.io.ConfigPaths; import org.bukkit.Bukkit; import org.bukkit.ChatColor; diff --git a/src/main/java/net/buildtheearth/modules/WikiDocumented.java b/src/main/java/net/buildtheearth/modules/WikiDocumented.java deleted file mode 100644 index 3f8e8d01..00000000 --- a/src/main/java/net/buildtheearth/modules/WikiDocumented.java +++ /dev/null @@ -1,22 +0,0 @@ -package net.buildtheearth.modules; - -import org.bukkit.entity.Player; -import org.jspecify.annotations.NonNull; - -public interface WikiDocumented { - - /** - * @return the wiki page URL for this object - */ - String getWikiPage(); - - /** - * Sends more information about this object to a player. - */ - default void sendWikiLink(@NonNull Player p) { - p.sendMessage(" "); - p.sendMessage("§cFor more information take a look here:"); - p.sendMessage("§c" + getWikiPage()); - } -} - diff --git a/src/main/java/net/buildtheearth/modules/common/CommonModule.java b/src/main/java/net/buildtheearth/modules/common/CommonModule.java index ac31e512..8204d35d 100644 --- a/src/main/java/net/buildtheearth/modules/common/CommonModule.java +++ b/src/main/java/net/buildtheearth/modules/common/CommonModule.java @@ -2,6 +2,7 @@ import com.alpsbte.alpslib.io.YamlFileFactory; import com.alpsbte.alpslib.io.config.ConfigNotImplementedException; +import com.alpsbte.alpslib.utils.ChatHelper; import lombok.Getter; import net.buildtheearth.BuildTeamTools; import net.buildtheearth.modules.Module; @@ -58,6 +59,7 @@ public void enable() { try { YamlFileFactory.registerPlugin(BuildTeamTools.getInstance()); ConfigUtil.init(); + ChatHelper.init(BuildTeamTools.getInstance(), BuildTeamTools.getInstance().isDebug(), BuildTeamTools.PREFIX, BuildTeamTools.CONSOLE_PREFIX); } catch (ConfigNotImplementedException ex) { // Fine? } diff --git a/src/main/java/net/buildtheearth/modules/common/commands/BuildTeamToolsCommand.java b/src/main/java/net/buildtheearth/modules/common/commands/BuildTeamToolsCommand.java index a4cbd3bf..d0581547 100644 --- a/src/main/java/net/buildtheearth/modules/common/commands/BuildTeamToolsCommand.java +++ b/src/main/java/net/buildtheearth/modules/common/commands/BuildTeamToolsCommand.java @@ -1,5 +1,6 @@ package net.buildtheearth.modules.common.commands; +import com.alpsbte.alpslib.utils.ChatHelper; import com.google.gson.Gson; import net.buildtheearth.BuildTeamTools; import net.buildtheearth.modules.Module; @@ -9,7 +10,6 @@ import net.buildtheearth.modules.network.model.Permissions; import net.buildtheearth.modules.network.model.Region; import net.buildtheearth.modules.stats.StatsModule; -import net.buildtheearth.utils.ChatHelper; import net.buildtheearth.utils.Utils; import net.md_5.bungee.api.chat.ComponentBuilder; import net.md_5.bungee.api.chat.HoverEvent; @@ -20,11 +20,7 @@ import org.bukkit.command.TabCompleter; import org.jetbrains.annotations.NotNull; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; -import java.util.UUID; +import java.util.*; public class BuildTeamToolsCommand implements CommandExecutor, TabCompleter { diff --git a/src/main/java/net/buildtheearth/modules/common/components/pluginmessaging/PluginMessagingComponent.java b/src/main/java/net/buildtheearth/modules/common/components/pluginmessaging/PluginMessagingComponent.java index 2f0beeaf..fa93b403 100644 --- a/src/main/java/net/buildtheearth/modules/common/components/pluginmessaging/PluginMessagingComponent.java +++ b/src/main/java/net/buildtheearth/modules/common/components/pluginmessaging/PluginMessagingComponent.java @@ -1,5 +1,6 @@ package net.buildtheearth.modules.common.components.pluginmessaging; +import com.alpsbte.alpslib.utils.ChatHelper; import com.google.common.io.ByteArrayDataInput; import com.google.common.io.ByteStreams; import net.buildtheearth.BuildTeamTools; @@ -7,7 +8,6 @@ import net.buildtheearth.modules.navigation.NavigationModule; import net.buildtheearth.modules.network.NetworkModule; import net.buildtheearth.modules.stats.StatsModule; -import net.buildtheearth.utils.ChatHelper; import org.bukkit.entity.Player; import org.bukkit.plugin.messaging.PluginMessageListener; diff --git a/src/main/java/net/buildtheearth/modules/common/listeners/CommandListener.java b/src/main/java/net/buildtheearth/modules/common/listeners/CommandListener.java index 3eee3f7f..4ce65cf8 100644 --- a/src/main/java/net/buildtheearth/modules/common/listeners/CommandListener.java +++ b/src/main/java/net/buildtheearth/modules/common/listeners/CommandListener.java @@ -1,8 +1,8 @@ package net.buildtheearth.modules.common.listeners; +import com.alpsbte.alpslib.utils.ChatHelper; import net.buildtheearth.modules.Module; import net.buildtheearth.modules.ModuleHandler; -import net.buildtheearth.utils.ChatHelper; import org.bukkit.command.PluginCommand; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; diff --git a/src/main/java/net/buildtheearth/modules/generator/GeneratorModule.java b/src/main/java/net/buildtheearth/modules/generator/GeneratorModule.java index ec1887de..ff001828 100644 --- a/src/main/java/net/buildtheearth/modules/generator/GeneratorModule.java +++ b/src/main/java/net/buildtheearth/modules/generator/GeneratorModule.java @@ -1,7 +1,9 @@ package net.buildtheearth.modules.generator; +import com.alpsbte.alpslib.utils.GeneratorUtils; import com.sk89q.worldedit.LocalSession; import lombok.Getter; +import net.buildtheearth.BuildTeamTools; import net.buildtheearth.modules.Module; import net.buildtheearth.modules.common.CommonModule; import net.buildtheearth.modules.generator.commands.GeneratorCommand; @@ -54,6 +56,8 @@ public static GeneratorModule getInstance() { @Override public void enable() { + GeneratorUtils.plugin = BuildTeamTools.getInstance(); + // Check if WorldEdit is enabled if (!CommonModule.getInstance().getDependencyComponent().isWorldEditEnabled() && !CommonModule.getInstance().getDependencyComponent().isFastAsyncWorldEditEnabled()) { diff --git a/src/main/java/net/buildtheearth/modules/generator/commands/GeneratorCommand.java b/src/main/java/net/buildtheearth/modules/generator/commands/GeneratorCommand.java index 98d966ac..e13ddd85 100644 --- a/src/main/java/net/buildtheearth/modules/generator/commands/GeneratorCommand.java +++ b/src/main/java/net/buildtheearth/modules/generator/commands/GeneratorCommand.java @@ -1,10 +1,10 @@ package net.buildtheearth.modules.generator.commands; +import com.alpsbte.alpslib.utils.ChatHelper; import net.buildtheearth.modules.generator.GeneratorModule; import net.buildtheearth.modules.generator.menu.GeneratorMenu; import net.buildtheearth.modules.generator.model.History; import net.buildtheearth.modules.network.model.Permissions; -import net.buildtheearth.utils.ChatHelper; import net.buildtheearth.utils.Utils; import net.kyori.adventure.text.Component; import net.kyori.adventure.text.format.NamedTextColor; diff --git a/src/main/java/net/buildtheearth/modules/generator/components/field/Field.java b/src/main/java/net/buildtheearth/modules/generator/components/field/Field.java index 66a47dc3..f11d8e2a 100644 --- a/src/main/java/net/buildtheearth/modules/generator/components/field/Field.java +++ b/src/main/java/net/buildtheearth/modules/generator/components/field/Field.java @@ -1,8 +1,8 @@ package net.buildtheearth.modules.generator.components.field; +import com.alpsbte.alpslib.utils.GeneratorUtils; import net.buildtheearth.modules.generator.model.GeneratorComponent; import net.buildtheearth.modules.generator.model.GeneratorType; -import net.buildtheearth.modules.generator.utils.GeneratorUtils; import org.bukkit.entity.Player; public class Field extends GeneratorComponent { diff --git a/src/main/java/net/buildtheearth/modules/generator/components/field/FieldScripts.java b/src/main/java/net/buildtheearth/modules/generator/components/field/FieldScripts.java index eb4696c4..aebe8665 100644 --- a/src/main/java/net/buildtheearth/modules/generator/components/field/FieldScripts.java +++ b/src/main/java/net/buildtheearth/modules/generator/components/field/FieldScripts.java @@ -1,9 +1,9 @@ package net.buildtheearth.modules.generator.components.field; +import com.alpsbte.alpslib.utils.GeneratorUtils; import net.buildtheearth.modules.generator.model.Flag; import net.buildtheearth.modules.generator.model.GeneratorComponent; import net.buildtheearth.modules.generator.model.Script; -import net.buildtheearth.modules.generator.utils.GeneratorUtils; import org.bukkit.block.Block; import org.bukkit.entity.Player; import org.bukkit.util.Vector; diff --git a/src/main/java/net/buildtheearth/modules/generator/components/field/FieldSettings.java b/src/main/java/net/buildtheearth/modules/generator/components/field/FieldSettings.java index 05e343f9..35dede83 100644 --- a/src/main/java/net/buildtheearth/modules/generator/components/field/FieldSettings.java +++ b/src/main/java/net/buildtheearth/modules/generator/components/field/FieldSettings.java @@ -2,7 +2,6 @@ import com.cryptomorin.xseries.XMaterial; import net.buildtheearth.modules.generator.model.Settings; -import net.buildtheearth.utils.Item; import net.buildtheearth.utils.MenuItems; import net.buildtheearth.utils.Utils; import org.bukkit.entity.Player; diff --git a/src/main/java/net/buildtheearth/modules/generator/components/field/menu/CropStageMenu.java b/src/main/java/net/buildtheearth/modules/generator/components/field/menu/CropStageMenu.java index a0e4a1db..32444cd4 100644 --- a/src/main/java/net/buildtheearth/modules/generator/components/field/menu/CropStageMenu.java +++ b/src/main/java/net/buildtheearth/modules/generator/components/field/menu/CropStageMenu.java @@ -1,10 +1,10 @@ package net.buildtheearth.modules.generator.components.field.menu; +import com.alpsbte.alpslib.utils.item.Item; import com.cryptomorin.xseries.XMaterial; import net.buildtheearth.modules.generator.GeneratorModule; import net.buildtheearth.modules.generator.components.field.*; import net.buildtheearth.modules.generator.model.Settings; -import net.buildtheearth.utils.Item; import net.buildtheearth.utils.ListUtil; import net.buildtheearth.utils.MenuItems; import net.buildtheearth.utils.WikiLinks; diff --git a/src/main/java/net/buildtheearth/modules/generator/components/field/menu/CropTypeMenu.java b/src/main/java/net/buildtheearth/modules/generator/components/field/menu/CropTypeMenu.java index c9aabbcf..b66528de 100644 --- a/src/main/java/net/buildtheearth/modules/generator/components/field/menu/CropTypeMenu.java +++ b/src/main/java/net/buildtheearth/modules/generator/components/field/menu/CropTypeMenu.java @@ -1,5 +1,6 @@ package net.buildtheearth.modules.generator.components.field.menu; +import com.alpsbte.alpslib.utils.item.Item; import com.cryptomorin.xseries.XMaterial; import net.buildtheearth.modules.generator.GeneratorModule; import net.buildtheearth.modules.generator.components.field.CropType; @@ -7,7 +8,6 @@ import net.buildtheearth.modules.generator.components.field.FieldSettings; import net.buildtheearth.modules.generator.menu.GeneratorMenu; import net.buildtheearth.modules.generator.model.Settings; -import net.buildtheearth.utils.Item; import net.buildtheearth.utils.ListUtil; import net.buildtheearth.utils.MenuItems; import net.buildtheearth.utils.menus.AbstractMenu; diff --git a/src/main/java/net/buildtheearth/modules/generator/components/field/menu/FenceTypeMenu.java b/src/main/java/net/buildtheearth/modules/generator/components/field/menu/FenceTypeMenu.java index d467b02e..dd9e3ce3 100644 --- a/src/main/java/net/buildtheearth/modules/generator/components/field/menu/FenceTypeMenu.java +++ b/src/main/java/net/buildtheearth/modules/generator/components/field/menu/FenceTypeMenu.java @@ -1,11 +1,11 @@ package net.buildtheearth.modules.generator.components.field.menu; +import com.alpsbte.alpslib.utils.item.Item; import net.buildtheearth.modules.generator.GeneratorModule; import net.buildtheearth.modules.generator.components.field.FieldFlag; import net.buildtheearth.modules.generator.components.field.FieldSettings; import net.buildtheearth.modules.generator.model.Settings; -import net.buildtheearth.utils.Item; import net.buildtheearth.utils.MenuItems; import net.buildtheearth.utils.menus.BlockListMenu; import org.bukkit.Sound; diff --git a/src/main/java/net/buildtheearth/modules/generator/components/house/House.java b/src/main/java/net/buildtheearth/modules/generator/components/house/House.java index ab9a84d2..5d618fe7 100644 --- a/src/main/java/net/buildtheearth/modules/generator/components/house/House.java +++ b/src/main/java/net/buildtheearth/modules/generator/components/house/House.java @@ -1,8 +1,8 @@ package net.buildtheearth.modules.generator.components.house; +import com.alpsbte.alpslib.utils.GeneratorUtils; import net.buildtheearth.modules.generator.model.GeneratorComponent; import net.buildtheearth.modules.generator.model.GeneratorType; -import net.buildtheearth.modules.generator.utils.GeneratorUtils; import org.bukkit.block.Block; import org.bukkit.entity.Player; diff --git a/src/main/java/net/buildtheearth/modules/generator/components/house/HouseScripts.java b/src/main/java/net/buildtheearth/modules/generator/components/house/HouseScripts.java index 22589392..0e1af58b 100644 --- a/src/main/java/net/buildtheearth/modules/generator/components/house/HouseScripts.java +++ b/src/main/java/net/buildtheearth/modules/generator/components/house/HouseScripts.java @@ -1,5 +1,7 @@ package net.buildtheearth.modules.generator.components.house; +import com.alpsbte.alpslib.utils.GeneratorUtils; +import com.alpsbte.alpslib.utils.item.Item; import com.cryptomorin.xseries.XMaterial; import com.sk89q.worldedit.registry.state.Property; import com.sk89q.worldedit.world.block.BlockState; @@ -9,8 +11,6 @@ import net.buildtheearth.modules.generator.model.Flag; import net.buildtheearth.modules.generator.model.GeneratorComponent; import net.buildtheearth.modules.generator.model.Script; -import net.buildtheearth.modules.generator.utils.GeneratorUtils; -import net.buildtheearth.utils.Item; import net.buildtheearth.utils.MenuItems; import org.bukkit.Bukkit; import org.bukkit.block.Block; diff --git a/src/main/java/net/buildtheearth/modules/generator/components/house/menu/BaseColorMenu.java b/src/main/java/net/buildtheearth/modules/generator/components/house/menu/BaseColorMenu.java index b5397c67..455e412c 100644 --- a/src/main/java/net/buildtheearth/modules/generator/components/house/menu/BaseColorMenu.java +++ b/src/main/java/net/buildtheearth/modules/generator/components/house/menu/BaseColorMenu.java @@ -1,10 +1,10 @@ package net.buildtheearth.modules.generator.components.house.menu; +import com.alpsbte.alpslib.utils.item.Item; import net.buildtheearth.modules.generator.GeneratorModule; import net.buildtheearth.modules.generator.components.house.HouseFlag; import net.buildtheearth.modules.generator.components.house.HouseSettings; import net.buildtheearth.modules.generator.model.Settings; -import net.buildtheearth.utils.Item; import net.buildtheearth.utils.MenuItems; import net.buildtheearth.utils.menus.BlockListMenu; import org.bukkit.Sound; diff --git a/src/main/java/net/buildtheearth/modules/generator/components/house/menu/RoofColorMenu.java b/src/main/java/net/buildtheearth/modules/generator/components/house/menu/RoofColorMenu.java index a4062e35..4acab2f3 100644 --- a/src/main/java/net/buildtheearth/modules/generator/components/house/menu/RoofColorMenu.java +++ b/src/main/java/net/buildtheearth/modules/generator/components/house/menu/RoofColorMenu.java @@ -1,11 +1,11 @@ package net.buildtheearth.modules.generator.components.house.menu; +import com.alpsbte.alpslib.utils.item.Item; import net.buildtheearth.modules.generator.GeneratorModule; import net.buildtheearth.modules.generator.components.house.HouseFlag; import net.buildtheearth.modules.generator.components.house.HouseSettings; import net.buildtheearth.modules.generator.components.house.RoofType; import net.buildtheearth.modules.generator.model.Settings; -import net.buildtheearth.utils.Item; import net.buildtheearth.utils.MenuItems; import net.buildtheearth.utils.menus.BlockListMenu; import org.bukkit.Sound; diff --git a/src/main/java/net/buildtheearth/modules/generator/components/house/menu/RoofTypeMenu.java b/src/main/java/net/buildtheearth/modules/generator/components/house/menu/RoofTypeMenu.java index dcc858d2..5cc30dbc 100644 --- a/src/main/java/net/buildtheearth/modules/generator/components/house/menu/RoofTypeMenu.java +++ b/src/main/java/net/buildtheearth/modules/generator/components/house/menu/RoofTypeMenu.java @@ -1,16 +1,15 @@ package net.buildtheearth.modules.generator.components.house.menu; +import com.alpsbte.alpslib.utils.item.Item; import com.cryptomorin.xseries.XMaterial; import net.buildtheearth.modules.generator.GeneratorModule; -import net.buildtheearth.modules.generator.model.Settings; import net.buildtheearth.modules.generator.components.house.HouseFlag; import net.buildtheearth.modules.generator.components.house.HouseSettings; import net.buildtheearth.modules.generator.components.house.RoofType; -import net.buildtheearth.utils.Item; +import net.buildtheearth.modules.generator.model.Settings; import net.buildtheearth.utils.ListUtil; import net.buildtheearth.utils.MenuItems; import net.buildtheearth.utils.menus.AbstractMenu; -import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; diff --git a/src/main/java/net/buildtheearth/modules/generator/components/house/menu/WallColorMenu.java b/src/main/java/net/buildtheearth/modules/generator/components/house/menu/WallColorMenu.java index 04f47b08..41d1ac45 100644 --- a/src/main/java/net/buildtheearth/modules/generator/components/house/menu/WallColorMenu.java +++ b/src/main/java/net/buildtheearth/modules/generator/components/house/menu/WallColorMenu.java @@ -1,11 +1,11 @@ package net.buildtheearth.modules.generator.components.house.menu; +import com.alpsbte.alpslib.utils.item.Item; import net.buildtheearth.modules.generator.GeneratorModule; import net.buildtheearth.modules.generator.components.house.HouseFlag; import net.buildtheearth.modules.generator.components.house.HouseSettings; import net.buildtheearth.modules.generator.menu.GeneratorMenu; import net.buildtheearth.modules.generator.model.Settings; -import net.buildtheearth.utils.Item; import net.buildtheearth.utils.MenuItems; import net.buildtheearth.utils.menus.BlockListMenu; import org.bukkit.Sound; diff --git a/src/main/java/net/buildtheearth/modules/generator/components/kml/KmlCommand.java b/src/main/java/net/buildtheearth/modules/generator/components/kml/KmlCommand.java index f0e4dd42..b452c9dd 100644 --- a/src/main/java/net/buildtheearth/modules/generator/components/kml/KmlCommand.java +++ b/src/main/java/net/buildtheearth/modules/generator/components/kml/KmlCommand.java @@ -1,45 +1,33 @@ package net.buildtheearth.modules.generator.components.kml; +import com.alpsbte.alpslib.utils.ChatHelper; import com.cryptomorin.xseries.XMaterial; +import de.micromata.opengis.kml.v_2_2_0.Coordinate; import net.buildtheearth.BuildTeamTools; import net.buildtheearth.utils.BlockLocation; -import net.buildtheearth.utils.ChatHelper; import net.buildtheearth.utils.GeometricUtils; import net.buildtheearth.utils.LineRasterization; import net.buildtheearth.utils.PolygonTools; - -import java.util.List; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Set; -import java.util.Stack; -import java.util.concurrent.CompletableFuture; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; -import java.util.stream.Collectors; -import java.util.HashSet; - import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.Material; - -import org.bukkit.command.Command; -import org.bukkit.command.CommandExecutor; -import org.bukkit.command.CommandSender; -import org.bukkit.command.BlockCommandSender; - -import org.bukkit.entity.Player; - -import de.micromata.opengis.kml.v_2_2_0.Coordinate; - import org.bukkit.World; - import org.bukkit.block.Block; import org.bukkit.block.BlockState; import org.bukkit.block.CommandBlock; - +import org.bukkit.command.BlockCommandSender; +import org.bukkit.command.Command; +import org.bukkit.command.CommandExecutor; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; import org.bukkit.metadata.FixedMetadataValue; +import java.util.*; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.stream.Collectors; + /** Class to handle kml command and its aliases * diff --git a/src/main/java/net/buildtheearth/modules/generator/components/rail/Rail.java b/src/main/java/net/buildtheearth/modules/generator/components/rail/Rail.java index a484ec5d..4d06e3cc 100644 --- a/src/main/java/net/buildtheearth/modules/generator/components/rail/Rail.java +++ b/src/main/java/net/buildtheearth/modules/generator/components/rail/Rail.java @@ -1,9 +1,9 @@ package net.buildtheearth.modules.generator.components.rail; +import com.alpsbte.alpslib.utils.GeneratorUtils; import net.buildtheearth.modules.generator.GeneratorModule; import net.buildtheearth.modules.generator.model.GeneratorComponent; import net.buildtheearth.modules.generator.model.GeneratorType; -import net.buildtheearth.modules.generator.utils.GeneratorUtils; import org.bukkit.entity.Player; public class Rail extends GeneratorComponent { diff --git a/src/main/java/net/buildtheearth/modules/generator/components/rail/RailScripts.java b/src/main/java/net/buildtheearth/modules/generator/components/rail/RailScripts.java index 8c6bdf5f..1593df6b 100644 --- a/src/main/java/net/buildtheearth/modules/generator/components/rail/RailScripts.java +++ b/src/main/java/net/buildtheearth/modules/generator/components/rail/RailScripts.java @@ -1,8 +1,8 @@ package net.buildtheearth.modules.generator.components.rail; +import com.alpsbte.alpslib.utils.GeneratorUtils; import net.buildtheearth.modules.generator.model.GeneratorComponent; import net.buildtheearth.modules.generator.model.Script; -import net.buildtheearth.modules.generator.utils.GeneratorUtils; import org.bukkit.block.Block; import org.bukkit.entity.Player; import org.bukkit.util.Vector; diff --git a/src/main/java/net/buildtheearth/modules/generator/components/road/Road.java b/src/main/java/net/buildtheearth/modules/generator/components/road/Road.java index 7f73dd01..c22f1831 100644 --- a/src/main/java/net/buildtheearth/modules/generator/components/road/Road.java +++ b/src/main/java/net/buildtheearth/modules/generator/components/road/Road.java @@ -1,9 +1,9 @@ package net.buildtheearth.modules.generator.components.road; +import com.alpsbte.alpslib.utils.GeneratorUtils; import net.buildtheearth.modules.generator.GeneratorModule; import net.buildtheearth.modules.generator.model.GeneratorComponent; import net.buildtheearth.modules.generator.model.GeneratorType; -import net.buildtheearth.modules.generator.utils.GeneratorUtils; import org.bukkit.entity.Player; public class Road extends GeneratorComponent { diff --git a/src/main/java/net/buildtheearth/modules/generator/components/road/RoadScripts.java b/src/main/java/net/buildtheearth/modules/generator/components/road/RoadScripts.java index 0b722385..d3090857 100644 --- a/src/main/java/net/buildtheearth/modules/generator/components/road/RoadScripts.java +++ b/src/main/java/net/buildtheearth/modules/generator/components/road/RoadScripts.java @@ -1,13 +1,13 @@ package net.buildtheearth.modules.generator.components.road; +import com.alpsbte.alpslib.utils.GeneratorUtils; +import com.alpsbte.alpslib.utils.item.Item; import com.cryptomorin.xseries.XMaterial; import net.buildtheearth.modules.common.CommonModule; import net.buildtheearth.modules.generator.model.Flag; import net.buildtheearth.modules.generator.model.GeneratorComponent; import net.buildtheearth.modules.generator.model.Script; -import net.buildtheearth.modules.generator.utils.GeneratorUtils; -import net.buildtheearth.utils.Item; import org.bukkit.Location; import org.bukkit.block.Block; import org.bukkit.entity.Player; diff --git a/src/main/java/net/buildtheearth/modules/generator/components/road/RoadSettings.java b/src/main/java/net/buildtheearth/modules/generator/components/road/RoadSettings.java index 430a5c36..8312b288 100644 --- a/src/main/java/net/buildtheearth/modules/generator/components/road/RoadSettings.java +++ b/src/main/java/net/buildtheearth/modules/generator/components/road/RoadSettings.java @@ -1,11 +1,8 @@ package net.buildtheearth.modules.generator.components.road; +import com.alpsbte.alpslib.utils.GeneratorUtils; import com.cryptomorin.xseries.XMaterial; -import net.buildtheearth.BuildTeamTools; -import net.buildtheearth.modules.generator.model.Flag; import net.buildtheearth.modules.generator.model.Settings; -import net.buildtheearth.modules.generator.utils.GeneratorUtils; -import net.buildtheearth.utils.Item; import org.bukkit.entity.Player; import java.io.File; diff --git a/src/main/java/net/buildtheearth/modules/generator/components/road/menu/AdvancedColorMenu.java b/src/main/java/net/buildtheearth/modules/generator/components/road/menu/AdvancedColorMenu.java index 17cbf25e..bd647800 100644 --- a/src/main/java/net/buildtheearth/modules/generator/components/road/menu/AdvancedColorMenu.java +++ b/src/main/java/net/buildtheearth/modules/generator/components/road/menu/AdvancedColorMenu.java @@ -1,10 +1,10 @@ package net.buildtheearth.modules.generator.components.road.menu; +import com.alpsbte.alpslib.utils.item.Item; import net.buildtheearth.modules.generator.GeneratorModule; import net.buildtheearth.modules.generator.components.road.RoadFlag; import net.buildtheearth.modules.generator.components.road.RoadSettings; import net.buildtheearth.modules.generator.model.Settings; -import net.buildtheearth.utils.Item; import net.buildtheearth.utils.menus.BlockListMenu; import org.bukkit.Sound; import org.bukkit.entity.Player; diff --git a/src/main/java/net/buildtheearth/modules/generator/components/road/menu/AdvancedSettingsMenu.java b/src/main/java/net/buildtheearth/modules/generator/components/road/menu/AdvancedSettingsMenu.java index a5a9f222..9aa71755 100644 --- a/src/main/java/net/buildtheearth/modules/generator/components/road/menu/AdvancedSettingsMenu.java +++ b/src/main/java/net/buildtheearth/modules/generator/components/road/menu/AdvancedSettingsMenu.java @@ -1,13 +1,13 @@ package net.buildtheearth.modules.generator.components.road.menu; +import com.alpsbte.alpslib.utils.item.Item; import com.cryptomorin.xseries.XMaterial; import net.buildtheearth.modules.generator.GeneratorModule; -import net.buildtheearth.modules.generator.model.Settings; import net.buildtheearth.modules.generator.components.road.Road; import net.buildtheearth.modules.generator.components.road.RoadFlag; import net.buildtheearth.modules.generator.components.road.RoadSettings; +import net.buildtheearth.modules.generator.model.Settings; import net.buildtheearth.utils.CustomHeads; -import net.buildtheearth.utils.Item; import net.buildtheearth.utils.ListUtil; import net.buildtheearth.utils.MenuItems; import net.buildtheearth.utils.menus.AbstractMenu; diff --git a/src/main/java/net/buildtheearth/modules/generator/components/road/menu/RoadColorMenu.java b/src/main/java/net/buildtheearth/modules/generator/components/road/menu/RoadColorMenu.java index c29ad8d3..c46e2e30 100644 --- a/src/main/java/net/buildtheearth/modules/generator/components/road/menu/RoadColorMenu.java +++ b/src/main/java/net/buildtheearth/modules/generator/components/road/menu/RoadColorMenu.java @@ -1,11 +1,11 @@ package net.buildtheearth.modules.generator.components.road.menu; +import com.alpsbte.alpslib.utils.item.Item; import net.buildtheearth.modules.generator.GeneratorModule; import net.buildtheearth.modules.generator.components.road.RoadFlag; import net.buildtheearth.modules.generator.components.road.RoadSettings; import net.buildtheearth.modules.generator.menu.GeneratorMenu; import net.buildtheearth.modules.generator.model.Settings; -import net.buildtheearth.utils.Item; import net.buildtheearth.utils.MenuItems; import net.buildtheearth.utils.menus.BlockListMenu; import org.bukkit.Sound; diff --git a/src/main/java/net/buildtheearth/modules/generator/components/road/menu/SidewalkColorMenu.java b/src/main/java/net/buildtheearth/modules/generator/components/road/menu/SidewalkColorMenu.java index 7dbdde83..2e6a7f84 100644 --- a/src/main/java/net/buildtheearth/modules/generator/components/road/menu/SidewalkColorMenu.java +++ b/src/main/java/net/buildtheearth/modules/generator/components/road/menu/SidewalkColorMenu.java @@ -1,10 +1,10 @@ package net.buildtheearth.modules.generator.components.road.menu; +import com.alpsbte.alpslib.utils.item.Item; import net.buildtheearth.modules.generator.GeneratorModule; import net.buildtheearth.modules.generator.components.road.RoadFlag; import net.buildtheearth.modules.generator.components.road.RoadSettings; import net.buildtheearth.modules.generator.model.Settings; -import net.buildtheearth.utils.Item; import net.buildtheearth.utils.MenuItems; import net.buildtheearth.utils.menus.BlockListMenu; import org.bukkit.Sound; diff --git a/src/main/java/net/buildtheearth/modules/generator/components/tree/Tree.java b/src/main/java/net/buildtheearth/modules/generator/components/tree/Tree.java index d353739d..a8189235 100644 --- a/src/main/java/net/buildtheearth/modules/generator/components/tree/Tree.java +++ b/src/main/java/net/buildtheearth/modules/generator/components/tree/Tree.java @@ -1,11 +1,11 @@ package net.buildtheearth.modules.generator.components.tree; +import com.alpsbte.alpslib.utils.GeneratorUtils; import lombok.Getter; import net.buildtheearth.BuildTeamTools; import net.buildtheearth.modules.generator.model.GeneratorCollections; import net.buildtheearth.modules.generator.model.GeneratorComponent; import net.buildtheearth.modules.generator.model.GeneratorType; -import net.buildtheearth.modules.generator.utils.GeneratorUtils; import org.bukkit.Bukkit; import org.bukkit.entity.Player; diff --git a/src/main/java/net/buildtheearth/modules/generator/components/tree/TreeScripts.java b/src/main/java/net/buildtheearth/modules/generator/components/tree/TreeScripts.java index 889d7b77..02307a5d 100644 --- a/src/main/java/net/buildtheearth/modules/generator/components/tree/TreeScripts.java +++ b/src/main/java/net/buildtheearth/modules/generator/components/tree/TreeScripts.java @@ -1,8 +1,8 @@ package net.buildtheearth.modules.generator.components.tree; +import com.alpsbte.alpslib.utils.item.Item; import com.cryptomorin.xseries.XMaterial; import net.buildtheearth.modules.generator.model.Settings; -import net.buildtheearth.utils.Item; import org.bukkit.Material; import org.bukkit.entity.Player; import org.jspecify.annotations.NonNull; diff --git a/src/main/java/net/buildtheearth/modules/generator/components/tree/menu/TreeHeightMenu.java b/src/main/java/net/buildtheearth/modules/generator/components/tree/menu/TreeHeightMenu.java index 5e5d79f9..993a7b4a 100644 --- a/src/main/java/net/buildtheearth/modules/generator/components/tree/menu/TreeHeightMenu.java +++ b/src/main/java/net/buildtheearth/modules/generator/components/tree/menu/TreeHeightMenu.java @@ -1,11 +1,11 @@ package net.buildtheearth.modules.generator.components.tree.menu; +import com.alpsbte.alpslib.utils.item.Item; import com.cryptomorin.xseries.XMaterial; import net.buildtheearth.modules.generator.GeneratorModule; import net.buildtheearth.modules.generator.components.tree.TreeFlag; import net.buildtheearth.modules.generator.components.tree.TreeSettings; import net.buildtheearth.modules.generator.model.Settings; -import net.buildtheearth.utils.Item; import net.buildtheearth.utils.menus.NameListMenu; import net.daporkchop.lib.common.misc.Tuple; import org.apache.commons.lang3.StringUtils; diff --git a/src/main/java/net/buildtheearth/modules/generator/components/tree/menu/TreeTypeMenu.java b/src/main/java/net/buildtheearth/modules/generator/components/tree/menu/TreeTypeMenu.java index 2add790e..bab6c688 100644 --- a/src/main/java/net/buildtheearth/modules/generator/components/tree/menu/TreeTypeMenu.java +++ b/src/main/java/net/buildtheearth/modules/generator/components/tree/menu/TreeTypeMenu.java @@ -1,5 +1,6 @@ package net.buildtheearth.modules.generator.components.tree.menu; +import com.alpsbte.alpslib.utils.item.Item; import com.cryptomorin.xseries.XMaterial; import net.buildtheearth.modules.generator.GeneratorModule; import net.buildtheearth.modules.generator.components.tree.TreeFlag; @@ -7,7 +8,6 @@ import net.buildtheearth.modules.generator.components.tree.TreeType; import net.buildtheearth.modules.generator.menu.GeneratorMenu; import net.buildtheearth.modules.generator.model.Settings; -import net.buildtheearth.utils.Item; import net.buildtheearth.utils.menus.NameListMenu; import net.daporkchop.lib.common.misc.Tuple; import org.apache.commons.lang3.StringUtils; diff --git a/src/main/java/net/buildtheearth/modules/generator/components/tree/menu/TreeWidthMenu.java b/src/main/java/net/buildtheearth/modules/generator/components/tree/menu/TreeWidthMenu.java index a1d2f605..84a4f7bd 100644 --- a/src/main/java/net/buildtheearth/modules/generator/components/tree/menu/TreeWidthMenu.java +++ b/src/main/java/net/buildtheearth/modules/generator/components/tree/menu/TreeWidthMenu.java @@ -1,12 +1,12 @@ package net.buildtheearth.modules.generator.components.tree.menu; +import com.alpsbte.alpslib.utils.item.Item; import com.cryptomorin.xseries.XMaterial; import net.buildtheearth.modules.generator.GeneratorModule; import net.buildtheearth.modules.generator.components.tree.TreeFlag; import net.buildtheearth.modules.generator.components.tree.TreeSettings; import net.buildtheearth.modules.generator.components.tree.TreeWidth; import net.buildtheearth.modules.generator.model.Settings; -import net.buildtheearth.utils.Item; import net.buildtheearth.utils.menus.NameListMenu; import net.daporkchop.lib.common.misc.Tuple; import org.apache.commons.lang3.StringUtils; diff --git a/src/main/java/net/buildtheearth/modules/generator/listeners/GeneratorListener.java b/src/main/java/net/buildtheearth/modules/generator/listeners/GeneratorListener.java index 02068ab3..8ac94cf4 100644 --- a/src/main/java/net/buildtheearth/modules/generator/listeners/GeneratorListener.java +++ b/src/main/java/net/buildtheearth/modules/generator/listeners/GeneratorListener.java @@ -1,7 +1,7 @@ package net.buildtheearth.modules.generator.listeners; +import com.alpsbte.alpslib.utils.ChatHelper; import net.buildtheearth.modules.generator.GeneratorModule; -import net.buildtheearth.utils.ChatHelper; import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.entity.Player; diff --git a/src/main/java/net/buildtheearth/modules/generator/menu/GeneratorMenu.java b/src/main/java/net/buildtheearth/modules/generator/menu/GeneratorMenu.java index c325d8fd..b3fc563d 100644 --- a/src/main/java/net/buildtheearth/modules/generator/menu/GeneratorMenu.java +++ b/src/main/java/net/buildtheearth/modules/generator/menu/GeneratorMenu.java @@ -1,5 +1,6 @@ package net.buildtheearth.modules.generator.menu; +import com.alpsbte.alpslib.utils.item.Item; import com.cryptomorin.xseries.XMaterial; import net.buildtheearth.modules.common.CommonModule; import net.buildtheearth.modules.generator.GeneratorModule; @@ -15,7 +16,6 @@ import net.buildtheearth.modules.generator.components.tree.menu.TreeTypeMenu; import net.buildtheearth.modules.generator.model.GeneratorCollections; import net.buildtheearth.modules.generator.model.GeneratorType; -import net.buildtheearth.utils.Item; import net.buildtheearth.utils.ListUtil; import net.buildtheearth.utils.MenuItems; import net.buildtheearth.utils.menus.AbstractMenu; diff --git a/src/main/java/net/buildtheearth/modules/generator/model/Command.java b/src/main/java/net/buildtheearth/modules/generator/model/Command.java index c543e3ad..24136664 100644 --- a/src/main/java/net/buildtheearth/modules/generator/model/Command.java +++ b/src/main/java/net/buildtheearth/modules/generator/model/Command.java @@ -1,5 +1,7 @@ package net.buildtheearth.modules.generator.model; +import com.alpsbte.alpslib.utils.ChatHelper; +import com.alpsbte.alpslib.utils.GeneratorUtils; import com.sk89q.worldedit.LocalSession; import com.sk89q.worldedit.extension.platform.Actor; import com.sk89q.worldedit.regions.Region; @@ -10,8 +12,6 @@ import com.sk89q.worldedit.world.block.BlockTypes; import lombok.Getter; import net.buildtheearth.modules.common.CommonModule; -import net.buildtheearth.modules.generator.utils.GeneratorUtils; -import net.buildtheearth.utils.ChatHelper; import net.buildtheearth.utils.MenuItems; import org.bukkit.Location; import org.bukkit.Material; diff --git a/src/main/java/net/buildtheearth/modules/generator/model/FlagType.java b/src/main/java/net/buildtheearth/modules/generator/model/FlagType.java index 681d2a0a..500aaeb2 100644 --- a/src/main/java/net/buildtheearth/modules/generator/model/FlagType.java +++ b/src/main/java/net/buildtheearth/modules/generator/model/FlagType.java @@ -1,5 +1,7 @@ package net.buildtheearth.modules.generator.model; +import com.alpsbte.alpslib.utils.ChatHelper; +import com.alpsbte.alpslib.utils.item.Item; import com.cryptomorin.xseries.XMaterial; import lombok.Getter; import net.buildtheearth.modules.generator.components.field.CropStage; @@ -7,8 +9,6 @@ import net.buildtheearth.modules.generator.components.house.RoofType; import net.buildtheearth.modules.generator.components.tree.TreeType; import net.buildtheearth.modules.generator.components.tree.TreeWidth; -import net.buildtheearth.utils.ChatHelper; -import net.buildtheearth.utils.Item; public enum FlagType { diff --git a/src/main/java/net/buildtheearth/modules/generator/model/GeneratorCollections.java b/src/main/java/net/buildtheearth/modules/generator/model/GeneratorCollections.java index f50b304a..4b183d15 100644 --- a/src/main/java/net/buildtheearth/modules/generator/model/GeneratorCollections.java +++ b/src/main/java/net/buildtheearth/modules/generator/model/GeneratorCollections.java @@ -1,5 +1,6 @@ package net.buildtheearth.modules.generator.model; +import com.alpsbte.alpslib.utils.ChatHelper; import com.fastasyncworldedit.core.FaweAPI; import com.sk89q.worldedit.bukkit.BukkitWorld; import com.sk89q.worldedit.extent.clipboard.Clipboard; @@ -9,7 +10,6 @@ import lombok.experimental.UtilityClass; import net.buildtheearth.BuildTeamTools; import net.buildtheearth.modules.common.CommonModule; -import net.buildtheearth.utils.ChatHelper; import org.bukkit.Bukkit; import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.configuration.file.YamlConfiguration; diff --git a/src/main/java/net/buildtheearth/modules/generator/model/GeneratorComponent.java b/src/main/java/net/buildtheearth/modules/generator/model/GeneratorComponent.java index 7c66078d..00e8a622 100644 --- a/src/main/java/net/buildtheearth/modules/generator/model/GeneratorComponent.java +++ b/src/main/java/net/buildtheearth/modules/generator/model/GeneratorComponent.java @@ -1,15 +1,15 @@ package net.buildtheearth.modules.generator.model; +import com.alpsbte.alpslib.utils.GeneratorUtils; +import com.alpsbte.alpslib.utils.WikiDocumented; import lombok.Getter; import net.buildtheearth.BuildTeamTools; import net.buildtheearth.modules.ModuleComponent; -import net.buildtheearth.modules.WikiDocumented; import net.buildtheearth.modules.generator.components.field.FieldSettings; import net.buildtheearth.modules.generator.components.house.HouseSettings; import net.buildtheearth.modules.generator.components.rail.RailSettings; import net.buildtheearth.modules.generator.components.road.RoadSettings; import net.buildtheearth.modules.generator.components.tree.TreeSettings; -import net.buildtheearth.modules.generator.utils.GeneratorUtils; import net.kyori.adventure.text.Component; import net.kyori.adventure.text.TextComponent; import net.kyori.adventure.text.event.ClickEvent; diff --git a/src/main/java/net/buildtheearth/modules/generator/model/History.java b/src/main/java/net/buildtheearth/modules/generator/model/History.java index c88f9101..94d66932 100644 --- a/src/main/java/net/buildtheearth/modules/generator/model/History.java +++ b/src/main/java/net/buildtheearth/modules/generator/model/History.java @@ -1,17 +1,16 @@ package net.buildtheearth.modules.generator.model; +import com.alpsbte.alpslib.utils.ChatHelper; +import com.alpsbte.alpslib.utils.GeneratorUtils; import com.sk89q.worldedit.LocalSession; import com.sk89q.worldedit.extension.platform.Actor; import lombok.Getter; import net.buildtheearth.BuildTeamTools; -import net.buildtheearth.modules.generator.utils.GeneratorUtils; -import net.buildtheearth.utils.ChatHelper; import net.kyori.adventure.text.Component; import net.kyori.adventure.text.event.ClickEvent; import net.kyori.adventure.text.event.HoverEvent; import net.kyori.adventure.text.format.NamedTextColor; import org.bukkit.Bukkit; -import org.bukkit.NamespacedKey; import org.bukkit.Sound; import org.bukkit.entity.Player; diff --git a/src/main/java/net/buildtheearth/modules/generator/model/Script.java b/src/main/java/net/buildtheearth/modules/generator/model/Script.java index 786b4998..8639c5d9 100644 --- a/src/main/java/net/buildtheearth/modules/generator/model/Script.java +++ b/src/main/java/net/buildtheearth/modules/generator/model/Script.java @@ -1,5 +1,6 @@ package net.buildtheearth.modules.generator.model; +import com.alpsbte.alpslib.utils.GeneratorUtils; import com.cryptomorin.xseries.XMaterial; import com.fastasyncworldedit.core.registry.state.PropertyKey; import com.sk89q.worldedit.LocalSession; @@ -13,7 +14,6 @@ import com.sk89q.worldedit.world.block.BlockType; import lombok.Getter; import net.buildtheearth.modules.generator.GeneratorModule; -import net.buildtheearth.modules.generator.utils.GeneratorUtils; import org.bukkit.Location; import org.bukkit.block.Block; import org.bukkit.entity.Player; diff --git a/src/main/java/net/buildtheearth/modules/generator/model/Settings.java b/src/main/java/net/buildtheearth/modules/generator/model/Settings.java index 1fb58aaa..4c0c8ff4 100644 --- a/src/main/java/net/buildtheearth/modules/generator/model/Settings.java +++ b/src/main/java/net/buildtheearth/modules/generator/model/Settings.java @@ -1,5 +1,6 @@ package net.buildtheearth.modules.generator.model; +import com.alpsbte.alpslib.utils.item.Item; import com.cryptomorin.xseries.XMaterial; import lombok.Getter; import lombok.Setter; @@ -7,8 +8,6 @@ import net.buildtheearth.modules.generator.components.field.CropType; import net.buildtheearth.modules.generator.components.house.RoofType; import net.buildtheearth.modules.generator.components.tree.TreeWidth; -import net.buildtheearth.utils.Item; -import org.bukkit.TreeType; import org.bukkit.block.Block; import org.bukkit.entity.Player; diff --git a/src/main/java/net/buildtheearth/modules/generator/utils/GeneratorUtils.java b/src/main/java/net/buildtheearth/modules/generator/utils/GeneratorUtils.java deleted file mode 100644 index ce83bcf3..00000000 --- a/src/main/java/net/buildtheearth/modules/generator/utils/GeneratorUtils.java +++ /dev/null @@ -1,1885 +0,0 @@ -package net.buildtheearth.modules.generator.utils; - -import clipper2.Clipper; -import clipper2.core.Path64; -import clipper2.core.Paths64; -import clipper2.core.Point64; -import clipper2.offset.EndType; -import clipper2.offset.JoinType; -import com.cryptomorin.xseries.XMaterial; -import com.fastasyncworldedit.core.limit.FaweLimit; -import com.sk89q.worldedit.*; -import com.sk89q.worldedit.bukkit.BukkitAdapter; -import com.sk89q.worldedit.extension.factory.MaskFactory; -import com.sk89q.worldedit.extension.input.InputParseException; -import com.sk89q.worldedit.extension.input.ParserContext; -import com.sk89q.worldedit.extension.platform.Actor; -import com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard; -import com.sk89q.worldedit.extent.clipboard.Clipboard; -import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormat; -import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormats; -import com.sk89q.worldedit.extent.clipboard.io.ClipboardReader; -import com.sk89q.worldedit.extent.inventory.BlockBag; -import com.sk89q.worldedit.function.mask.BlockMask; -import com.sk89q.worldedit.function.mask.Mask; -import com.sk89q.worldedit.function.operation.ForwardExtentCopy; -import com.sk89q.worldedit.function.operation.Operation; -import com.sk89q.worldedit.function.operation.Operations; -import com.sk89q.worldedit.function.pattern.ClipboardPattern; -import com.sk89q.worldedit.function.pattern.Pattern; -import com.sk89q.worldedit.function.pattern.RandomPattern; -import com.sk89q.worldedit.math.BlockVector2; -import com.sk89q.worldedit.math.BlockVector3; -import com.sk89q.worldedit.math.transform.AffineTransform; -import com.sk89q.worldedit.regions.*; -import com.sk89q.worldedit.regions.selector.CuboidRegionSelector; -import com.sk89q.worldedit.regions.selector.Polygonal2DRegionSelector; -import com.sk89q.worldedit.session.ClipboardHolder; -import com.sk89q.worldedit.session.SessionManager; -import com.sk89q.worldedit.world.block.BlockState; -import com.sk89q.worldedit.world.block.BlockType; -import com.sk89q.worldedit.world.block.BlockTypes; -import net.buildtheearth.BuildTeamTools; -import net.buildtheearth.modules.WikiDocumented; -import net.buildtheearth.utils.ChatHelper; -import org.apache.commons.lang3.StringUtils; -import org.bukkit.*; -import org.bukkit.block.Block; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; -import org.bukkit.plugin.Plugin; -import org.bukkit.plugin.PluginDescriptionFile; -import org.bukkit.plugin.PluginManager; -import org.bukkit.util.Vector; - -import java.io.File; -import java.io.IOException; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.nio.file.Files; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; -import java.util.concurrent.CompletableFuture; - - -/** This class contains static utility methods for the generator module.
- * The following dependencies are needed for this class to work: - *
    - *
  1. WorldEdit
  2. - *
  3. FastAsyncWorldEdit
  4. - *
  5. XSeries
  6. - *
  7. Clipper
  8. - *
  9. ChatHelper (internal)
  10. - *
- *
- * The functions are categorized into the following sections: - * - *

Setup Functions: - * These functions are plugin specific functions that need to be changed when copying the class to another plugin. - * - *

Script Helper Functions: - *
• {@link #convertArgsToFlags(String[])} - *
• {@link #convertToFlagAndValue(String, Player)} - *
• {@link #getBlockState(XMaterial)} - * - *

WorldEdit Helper Functions: - *
• {@link #getWorldEditSchematicsFolderPath()} - * - *

WorldEdit Region Functions: - *
• {@link #getSelectionPointsFromRegion(Region)} - *
• {@link #getMinMaxPoints(Region)} - *
• {@link #getMaxHeight(Block[][][], Material...)} - *
• {@link #getMaxHeight(Block[][][], int, int, Material...)} - *
• {@link #containsBlock(Block[][][], XMaterial)} - *
• {@link #containsBlock(Block[][][], XMaterial, int)} - *
• {@link #getWorldEditSelection(Player)} - *
• {@link #restoreSelection(Player, RegionSelector)} - *
• {@link #createCuboidSelection(Player, Vector, Vector)} - *
• {@link #createPolySelection(Player, List, Block[][][])} - *
• {@link #createPolySelection(Player, List, int, int)} - *
• {@link #changeRegionWorld(Region, com.sk89q.worldedit.world.World)} - * - *

WorldEdit Operation Functions: - *
• {@link #prepareScriptSession(LocalSession, Actor, Player, com.sk89q.worldedit.world.World, int, boolean, boolean, boolean)} - *
• {@link #analyzeRegion(Player, World)} - *
• {@link #copyRegion(LocalSession, Actor, Region, World, World)} - *
• {@link #replaceBlocksWithMasks(LocalSession, Actor, com.sk89q.worldedit.world.World, List, BlockState, BlockState[], int)} - *
• {@link #replaceBlocksWithSchematic(LocalSession, Actor, com.sk89q.worldedit.world.World, BlockState[], String)} - *
• {@link #replaceBlocks(LocalSession, Actor, com.sk89q.worldedit.world.World, BlockState[], BlockState[])} - *
• {@link #drawSplineWithMasks(LocalSession, Actor, com.sk89q.worldedit.world.World, Block[][][], List, List, BlockState[], boolean, double, double, double, double, double, boolean, boolean)} - *
• {@link #drawCurveWithMasks(LocalSession, Actor, com.sk89q.worldedit.world.World, Block[][][], List, List, BlockState[], boolean)} - *
• {@link #drawPolyLineWithMasks(LocalSession, Actor, com.sk89q.worldedit.world.World, Block[][][], List, List, BlockState[], boolean, boolean)} - *
• {@link #drawLineWithMasks(LocalSession, Actor, com.sk89q.worldedit.world.World, Block[][][], List, Vector, Vector, BlockState[], boolean)} - *
• {@link #pasteSchematicWithMasks(LocalSession, Actor, com.sk89q.worldedit.world.World, Block[][][], List, String, Location, double)} - *
• {@link #pasteSchematic(LocalSession, Actor, com.sk89q.worldedit.world.World, Block[][][], String, Location, double)} - *
• {@link #expandSelection(LocalSession, Vector)} - *
• {@link #clearHistory(LocalSession)} - *
• {@link #undo(LocalSession, Player, Actor, int)} - *
• {@link #redo(LocalSession, Player, Actor, int)} - *
• {@link #setGmask(LocalSession, String)} - *
• {@link #saveEditSession(EditSession, LocalSession, Actor)} - * - *

Vector Helper Functions: - *
• {@link #adjustHeight(List, Block[][][])} - *
• {@link #populatePoints(List, int)} - *
• {@link #reducePoints(List, int, int)} - *
• {@link #extendPolyLine(List)} - *
• {@link #shortenPolyLine(List, int)} - *
• {@link #getClosestVector(List, Vector)} - *
• {@link #getXYZ(Vector, Block[][][])} - *
• {@link #getXYZWithVerticalOffset(Vector, Block[][][], int)} - *
• {@link #convertVectorListToPath64(List, Vector)} - *
• {@link #convertPathsToVectorList(Paths64, Vector, int, int)} - *
• {@link #shiftPoints(List, double, boolean)} - *
• {@link #shiftPointsAll(List, double)} - *
• {@link #getMinHeight(List)} - *
• {@link #getMaxHeight(List)} - * - *

Preparation Check Functions: - *
• {@link #checkIfSchematicBrushIsInstalled(Player)} - *
• {@link #checkForNoWorldEditSelection(Player)} - *
• {@link #checkForBrickOutline(Block[][][], Player, WikiDocumented)} - *
• {@link #checkForWoolBlock(Block[][][], Player, WikiDocumented)} - * - * @version 1.7.3 - * @author MineFact - */ -@SuppressWarnings("unused") -public class GeneratorUtils { - - - /*=============================================** - - SETUP FUNCTIONS - - **=============================================*/ - - /** Get the plugin instance. */ - private static Plugin getPlugin(){ - return BuildTeamTools.getInstance(); - } - - /** Checks if the plugin "FastAsyncWorldEdit" is enabled. */ - private static boolean isFastAsyncWorldEditEnabled(){ - return getPlugin().getServer().getPluginManager().isPluginEnabled("FastAsyncWorldEdit"); - } - - private static boolean isLegacyWorldEditEnabled() { - if (isFastAsyncWorldEditEnabled()) - return false; - - PluginManager pluginManager = getPlugin().getServer().getPluginManager(); - if (!pluginManager.isPluginEnabled("WorldEdit")) - return false; - - Plugin plugin = pluginManager.getPlugin("WorldEdit"); - if (plugin == null) - return false; - - @SuppressWarnings("deprecation") - PluginDescriptionFile description = plugin.getDescription(); - String version = description.getVersion(); - int major; - try { - major = Integer.parseInt(version.split("\\.")[0]); - } catch (NumberFormatException e) { - // Fallback or assume not legacy if version can't be parsed - return false; - } - - return major < 7; - } - - - /** Checks if the plugin "SchematicBrush" is enabled. */ - private static boolean isSchematicBrushEnabled(){ - return getPlugin().getServer().getPluginManager().isPluginEnabled("SchematicBrush"); - } // e.g., "1.21.4" - - - /** Checks if the server version is 1.12. */ - private static boolean isServerVersion1_12(){ - String rawVersion = Bukkit.getBukkitVersion().split("-")[0]; - return rawVersion.equals("1.12.2") || rawVersion.equals("1.12.1") || rawVersion.equals("1.12"); - } - - /** Get the ignored materials. */ - private static Material[] getIgnoredMaterials(){ - return new Material[]{}; - } - - private static void sendWikiLink(Player p) { - p.sendMessage("§cFor more information, see the Wiki."); - } - - - - - - /*=============================================** - - SCRIPT HELPER FUNCTIONS - - **=============================================*/ - - /** - * Converts a String[] of arguments to a String[] of flags. - * - * @param args The arguments to be converted. - * @return The converted flags. - */ - public static String[] convertArgsToFlags(String[] args) { - String argsString = " " + StringUtils.join(Arrays.copyOfRange(args, 1, args.length), " "); - String[] argsArray = argsString.split(" -"); - - return Arrays.copyOfRange(argsArray, 1, argsArray.length); - } - - /** Converts a string with all flags and values to a string array with the flag name and the flag value. - * - * @param flagAndValue The string with all flags and values. Example is a command like /gen house -w 10 -h 10 - * @param p The player who should receive an error message if the flag value is invalid. - * @return The string array with the flag name and the flag value. - */ - public static String[] convertToFlagAndValue(String flagAndValue, Player p){ - String[] values = flagAndValue.split(" "); - String flagName = values[0]; - String flagValue; - - try { - flagValue = StringUtils.join(Arrays.copyOfRange(values, 1, values.length), " "); - } catch (ArrayIndexOutOfBoundsException e) { - p.sendMessage("§cInvalid flag value: -" + flagName + "§n§c ???"); - return null; - } - - return new String[]{flagName, flagValue}; - } - - /** - * Returns the blockState of a given XMaterial. - * - * @param xMaterial The XMaterial to get the blockState from - * @return The blockState of the XMaterial - */ - public static BlockState getBlockState(XMaterial xMaterial){ - if(xMaterial == null) - return null; - - BlockType blockType = BlockTypes.get(xMaterial.getId() + ""); - ItemStack item = xMaterial.parseItem(); - if (blockType == null && item != null) - blockType = BlockTypes.get(item.getType().getKey().asString()); - - if (blockType == null && item != null) - throw new IllegalArgumentException("Invalid block type: " + item.getType().name()); - else if (blockType == null) - throw new IllegalArgumentException("Invalid block type: " + xMaterial.name()); - - return blockType.getDefaultState(); - } - public static BlockState[] getBlockState(XMaterial[] xMaterial){ - if(xMaterial == null) - return null; - - BlockState[] blockStates = new BlockState[xMaterial.length]; - - for(int i = 0; i < xMaterial.length; i++) - blockStates[i] = getBlockState(xMaterial[i]); - - return blockStates; - } - - - - /*=============================================** - - WORLDEDIT HELPER FUNCTIONS - - **=============================================*/ - - - /** - * Returns the path to the WorldEdit schematics folder. - * - * @return The path to the WorldEdit schematics folder - */ - public static String getWorldEditSchematicsFolderPath(){ - String worldEditFolder = "WorldEdit"; - - if(isFastAsyncWorldEditEnabled()) - worldEditFolder = "FastAsyncWorldEdit"; - - return getPlugin().getDataFolder().getAbsolutePath() + "/../" + worldEditFolder + "/schematics"; - } - - - - - - /*=============================================** - - WORLDEDIT REGION FUNCTIONS - - **=============================================*/ - - - - /** - * Returns the WorldEdit selection Vector from a player no matter which type of selection the player made. - * - * @param region The WorldEdit region to get the selection from - * @return A list of vectors representing the selection - */ - public static List getSelectionPointsFromRegion(Region region) { - List points = new ArrayList<>(); - - switch (region) { - case Polygonal2DRegion polyRegion -> { - ChatHelper.logDebug("Polygonal2DRegion found"); - // In latest FAWE, the points are stored as BlockVector2 - // In 1.12 WorldEdit, the points are stored as BlockVector2D - // Both classes have the same methods, so we can use reflection to get the methods - for (Object blockVectorObj : polyRegion.getPoints()) { - ChatHelper.logDebug("BlockVector2:" + blockVectorObj); - try { - Class blockVectorClass = blockVectorObj.getClass(); - Method getXMethod = blockVectorClass.getMethod("getBlockX"); - Method getZMethod = blockVectorClass.getMethod("getBlockZ"); - - int x = (Integer) getXMethod.invoke(blockVectorObj); - int z = (Integer) getZMethod.invoke(blockVectorObj); - - points.add(new Vector(x, 0, z)); - } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) { - ChatHelper.logDebug("Exception while processing region: " + e.getMessage()); - } - } - } - case ConvexPolyhedralRegion convexRegion -> { - // In latest FAWE, the points are stored as BlockVector2 - // In 1.12 WorldEdit, the points are stored as BlockVector2D - // Both classes have the same methods, so we can use reflection to get the methods - for (Object blockVectorObj : convexRegion.getVertices()) { - try { - Class blockVectorClass = blockVectorObj.getClass(); - Method getXMethod = blockVectorClass.getMethod("getBlockX"); - Method getYMethod = blockVectorClass.getMethod("getBlockY"); - Method getZMethod = blockVectorClass.getMethod("getBlockZ"); - - int x = (Integer) getXMethod.invoke(blockVectorObj); - int y = (Integer) getYMethod.invoke(blockVectorObj); - int z = (Integer) getZMethod.invoke(blockVectorObj); - - points.add(new Vector(x, y, z)); - } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) { - ChatHelper.logDebug("Exception while processing region: " + e.getMessage()); - } - } - } - case CuboidRegion cuboidRegion -> { - try { - Class regionClass = cuboidRegion.getClass(); - Method getPos1Method = regionClass.getMethod("getPos1"); - Method getPos2Method = regionClass.getMethod("getPos2"); - - Class vectorClass = getPos1Method.getReturnType(); - - Method getXMethod = vectorClass.getMethod("getBlockX"); - Method getYMethod = vectorClass.getMethod("getBlockY"); - Method getZMethod = vectorClass.getMethod("getBlockZ"); - - Object pos1 = getPos1Method.invoke(region); - Object pos2 = getPos2Method.invoke(region); - - int x1 = (Integer) getXMethod.invoke(pos1); - int y1 = (Integer) getYMethod.invoke(pos1); - int z1 = (Integer) getZMethod.invoke(pos1); - - int x2 = (Integer) getXMethod.invoke(pos2); - int y2 = (Integer) getYMethod.invoke(pos2); - int z2 = (Integer) getZMethod.invoke(pos2); - - points.add(new Vector(x1, y1, z1)); - points.add(new Vector(x2, y2, z2)); - } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) { - ChatHelper.logDebug("Exception while processing region: " + e.getMessage()); - } - } - case null, default -> { - return null; - } - } - - return points; - } - - /** - * Returns the minimum and maximum points of a region as a Vector array. - * - * @param region The region to get the minimum and maximum points from - * @return A Vector array with the minimum vector at index 0 and the maximum vector at index 1 - */ - public static Vector[] getMinMaxPoints(Region region){ - Vector[] minMax = new Vector[2]; - - try{ - Class regionClass = region.getClass(); - Method getMinimumPointMethod = regionClass.getMethod("getMinimumPoint"); - Method getMaximumPointMethod = regionClass.getMethod("getMaximumPoint"); - - Class vectorClass = getMinimumPointMethod.getReturnType(); - - Method getXMethod = vectorClass.getMethod("getBlockX"); - Method getYMethod = vectorClass.getMethod("getBlockY"); - Method getZMethod = vectorClass.getMethod("getBlockZ"); - - Object minPoint = getMinimumPointMethod.invoke(region); - Object maxPoint = getMaximumPointMethod.invoke(region); - - int minX = (Integer) getXMethod.invoke(minPoint); - int minY = (Integer) getYMethod.invoke(minPoint); - int minZ = (Integer) getZMethod.invoke(minPoint); - - int maxX = (Integer) getXMethod.invoke(maxPoint); - int maxY = (Integer) getYMethod.invoke(maxPoint); - int maxZ = (Integer) getZMethod.invoke(maxPoint); - - minMax[0] = new Vector(minX, minY, minZ); - minMax[1] = new Vector(maxX, maxY, maxZ); - - } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) { - ChatHelper.logDebug("Exception while processing MinMax Points: " + e.getMessage()); - } - - return minMax; - } - - /** - * Checks the maximum height of a polygon region - * - * @param blocks List of blocks in polygon region - * @return Maximum height of polygon region - */ - public static int getMaxHeight(Block[][][] blocks, Material... ignoreMaterials){ - int maxHeight = 0; - List ignoreMaterialsList = Arrays.asList(ignoreMaterials); - - for (Block[][] block2D : blocks) - for (Block[] block1D : block2D) - for (Block block : block1D) - if (block != null && !ignoreMaterialsList.contains(block.getType()) && block.getType().isSolid() && !block.isLiquid() && block.getY() > maxHeight) - maxHeight = block.getY(); - - return maxHeight; - } - - /** - * Checks the max height of a polygon region given a certain x and z coordinate - * - * @param blocks List of blocks in polygon region - * @return Maximum height of polygon region - */ - public static int getMaxHeight(Block[][][] blocks, int x, int z, Material... ignoreMaterials){ - int maxHeight = 0; - List ignoreMaterialsList = Arrays.asList(ignoreMaterials); - - for (Block[][] block2D : blocks) - for (Block[] block1D : block2D) - for (Block block : block1D) - if (block != null && block.getX() == x && block.getZ() == z && block.getY() > maxHeight && !ignoreMaterialsList.contains(block.getType()) && block.getType().isSolid() && !block.isLiquid()) - maxHeight = block.getY(); - - return maxHeight; - } - - /** - * Checks if polygon region contains a block of a certain type - * - * @param blocks List of blocks in polygon region - * @param xMaterial Material to check for (e.g. XMaterial.WALL_SIGN) - * @return true if polygon region contains the block, false otherwise - */ - public static boolean containsBlock(Block[][][] blocks, XMaterial xMaterial){ - return containsBlock(blocks, xMaterial, 1); - } - - /** - * Checks if polygon region contains a minimum amount of blocks of a certain type - * @param blocks List of blocks in polygon region - * @param xMaterial Material to check for (e.g. XMaterial.WALL_SIGN) - * @param requiredAmount The minimum amount required to return true - * @return true if polygon region contains the required amount of the block, false otherwise - */ - public static boolean containsBlock(Block[][][] blocks, XMaterial xMaterial, int requiredAmount){ - int amountFound = 0; - for (Block[][] block2D : blocks) - for (Block[] block1D : block2D) - for (Block block : block1D) { - ItemStack item = xMaterial.parseItem(); - if (block != null && item != null && block.getType() == item.getType()) - amountFound++; - } - - return amountFound >= requiredAmount; - } - - /** - * Returns the current WorldEdit selection of a player. - * - * @param p The player whose selection should be returned. - * @return The current WorldEdit selection of the player. - */ - public static Region getWorldEditSelection(Player p){ - try { - Actor actor = BukkitAdapter.adapt(p); - SessionManager sessionManager = WorldEdit.getInstance().getSessionManager(); - com.sk89q.worldedit.world.World world = sessionManager.get(actor).getSelectionWorld(); - - return sessionManager.get(actor).getSelection(world); - } catch (NullPointerException | IncompleteRegionException ex) { - return null; - } - } - - /** - * Returns the WorldEdit selection of a player. - * - * @param p The player to get the selection from - * @param regionSelector The region selector to get the selection from - */ - public static void restoreSelection(Player p, RegionSelector regionSelector){ - Actor actor = BukkitAdapter.adapt(p); - SessionManager sessionManager = WorldEdit.getInstance().getSessionManager(); - com.sk89q.worldedit.world.World world = sessionManager.get(actor).getSelectionWorld(); - - sessionManager.get(actor).setRegionSelector(world, regionSelector); - - ChatHelper.logDebug("Restored selection"); - } - - /** - * Creates a Cuboid WorldEdit selection from a list of points and execute it right away. - * - * @param p The player to create the selection for - * @param vector1 Position 1 - * @param vector2 Position 2 - */ - public static void createCuboidSelection(Player p, Vector vector1, Vector vector2){ - Actor actor = BukkitAdapter.adapt(p); - SessionManager sessionManager = WorldEdit.getInstance().getSessionManager(); - com.sk89q.worldedit.world.World world = sessionManager.get(actor).getSelectionWorld(); - - sessionManager.get(actor).setRegionSelector(world, - new CuboidRegionSelector(world, - BlockVector3.at(vector1.getBlockX(), vector1.getBlockY(), vector1.getBlockZ()), - BlockVector3.at(vector2.getBlockX(), vector2.getBlockY(), vector2.getBlockZ()) - ) - ); - - ChatHelper.logDebug("Created cuboid selection"); - } - - - /** - * Creates a Polygon WorldEdit selection from a list of points and execute it right away. - * This functions determines the current surface height of each vector directly. - * - * @param p The player to create the selection for - * @param points The list of points to create the selection from - */ - public static void createPolySelection(Player p, List points, Block[][][] blocks){ - int minY = Integer.MAX_VALUE; - int maxY = Integer.MIN_VALUE; - - for(Vector vector : points) { - int y = getMaxHeight(blocks, vector.getBlockX(), vector.getBlockZ(), getIgnoredMaterials()); - - minY = Math.min(minY, y); - maxY = Math.max(maxY, y); - } - - createPolySelection(p, points, minY, maxY); - } - - /** - * Creates a Polygon WorldEdit selection from a list of points and execute it right away. - * This functions determines the current surface height of each vector directly. - * - * @param p The player to create the selection for - * @param points The list of points to create the selection from - * @param minY The minimum Y value of the selection - * @param maxY The maximum Y value of the selection - */ - public static void createPolySelection(Player p, List points, int minY, int maxY) { - Actor actor = BukkitAdapter.adapt(p); - SessionManager sessionManager = WorldEdit.getInstance().getSessionManager(); - com.sk89q.worldedit.world.World world = sessionManager.get(actor).getSelectionWorld(); - - List blockVector2List = new ArrayList<>(); - for (Vector vector : points){ - blockVector2List.add(BlockVector2.at(vector.getBlockX(), vector.getBlockZ())); - ChatHelper.logDebug("Added point: " + vector); - } - - sessionManager.get(actor).setRegionSelector(world, - new Polygonal2DRegionSelector(world, blockVector2List, minY, maxY) - ); - - ChatHelper.logDebug("Created polygonal selection with " + points.size() + " points. minY: " + minY + " maxY: " + maxY); - } - - /** - * Rebuilds a region with a different world while keeping its coordinates. - * Currently, supports {@link Polygonal2DRegion} and {@link CuboidRegion}. - * - * @param region The region to rebuild - * @param world The world that should be used for the new region - * @return A new region with the supplied world or {@code null} if the type is unsupported - */ - public static Region changeRegionWorld(Region region, com.sk89q.worldedit.world.World world) { - if (region instanceof Polygonal2DRegion) { - List points = getSelectionPointsFromRegion(region); - if (points == null) - return null; - - List blockPoints = new ArrayList<>(); - for (Vector v : points) - blockPoints.add(BlockVector2.at(v.getBlockX(), v.getBlockZ())); - - Vector[] minMax = getMinMaxPoints(region); - int minY = minMax[0].getBlockY(); - int maxY = minMax[1].getBlockY(); - - return new Polygonal2DRegion(world, blockPoints, minY, maxY); - } else if (region instanceof CuboidRegion) { - Vector[] minMax = getMinMaxPoints(region); - BlockVector3 min = BlockVector3.at(minMax[0].getBlockX(), minMax[0].getBlockY(), minMax[0].getBlockZ()); - BlockVector3 max = BlockVector3.at(minMax[1].getBlockX(), minMax[1].getBlockY(), minMax[1].getBlockZ()); - return new CuboidRegion(world, min, max); - } - - return null; - } - - - - - - - - /*=============================================** - - WORLDEDIT OPERATION FUNCTIONS - - **=============================================*/ - - - - /** - * Prepares a script session by expanding the selection, removing non-solid blocks and ignored materials. - * The blocks of the region are also analyzed and returned. - * - * @param localSession The local session of the actor - * @param actor The actor who should perform the operation - * @param player The player who should receive an error message if the flag value is invalid - * @param world The world in which the region is located - * @param expandSelection The amount of blocks to expand the selection - * @param readBlocks Whether the blocks of the region should be read and returned - * @param removeNonSolidBlocks Whether non-solid blocks should be removed - * @param removeIgnoredMaterials Whether ignored materials should be removed - * @return A three-dimensional array of all blocks in the region - */ - public static Block[][][] prepareScriptSession(LocalSession localSession, Actor actor, Player player, com.sk89q.worldedit.world.World world, int expandSelection, boolean readBlocks, boolean removeNonSolidBlocks, boolean removeIgnoredMaterials){ - if(expandSelection > 0) { - expandSelection(localSession, new Vector(0, expandSelection, 0)); - expandSelection(localSession, new Vector(0, -expandSelection, 0)); - } - - BlockType air = BlockTypes.AIR; - - if(air == null) - return null; - - if(removeNonSolidBlocks) - replaceBlocksWithMasks(localSession, actor, world, Collections.singletonList("!#solid"), null, new BlockState[]{air.getDefaultState()}, 1) - .join(); - - if(removeIgnoredMaterials) { - Material[] materials = getIgnoredMaterials(); - for (Material material : materials) { - BlockType blockType = BlockTypes.get(material.getKey().asString()); - - if (blockType == null) - continue; - - List blockStates = blockType.getAllStates(); - BlockState[] blockStatesArray = blockStates.toArray(new BlockState[0]); - replaceBlocks(localSession, actor, world, blockStatesArray, new BlockState[]{air.getDefaultState()}) - .join(); - } - } - - Block[][][] regionBlocks = null; - - if(readBlocks) - regionBlocks = analyzeRegion(player, player.getWorld()); - - return regionBlocks; - } - - - - /** Analyzes a region and returns a three-dimensional array of all blocks in the region. - * The size of the array is defined by the width, height and length of the region from WorldEdit of the player. - * By saving the blocks in an array, the generation can be done much faster later once the region blocks need to be inspected. - * - * @param p The player whose selection should be analyzed. - * @param world The world in which the region is located. - * @return A three-dimensional array of all blocks in the region. - */ - public static Block[][][] analyzeRegion(Player p, World world) { - // Get WorldEdit selection of player - Region region = getWorldEditSelection(p); - - if(region == null) - return null; - - Block[][][] blocks = new Block[region.getWidth()][region.getHeight()][region.getLength()]; - - try { - Class regionClass = region.getClass(); - - // Reflectively access the minimum and maximum points - Method getMinimumPoint = regionClass.getMethod("getMinimumPoint"); - Method getMaximumPoint = regionClass.getMethod("getMaximumPoint"); - Method contains; - - if(isLegacyWorldEditEnabled()) - contains = regionClass.getMethod("contains", Class.forName("com.sk89q.worldedit.Vector")); - else - contains = regionClass.getMethod("contains", BlockVector3.class); - - Object minPoint = getMinimumPoint.invoke(region); - Object maxPoint = getMaximumPoint.invoke(region); - - Class vectorClass = minPoint.getClass(); - - // Assume getBlockX/Y/Z methods exist in both Vector and BlockVector3 - Method getBlockX = vectorClass.getMethod("getBlockX"); - Method getBlockY = vectorClass.getMethod("getBlockY"); - Method getBlockZ = vectorClass.getMethod("getBlockZ"); - - int minX = (Integer) getBlockX.invoke(minPoint); - int minY = (Integer) getBlockY.invoke(minPoint); - int minZ = (Integer) getBlockZ.invoke(minPoint); - int maxX = (Integer) getBlockX.invoke(maxPoint); - int maxY = (Integer) getBlockY.invoke(maxPoint); - int maxZ = (Integer) getBlockZ.invoke(maxPoint); - - for (int i = minX; i <= maxX; i++) - for (int j = minY; j <= maxY; j++) - for (int k = minZ; k <= maxZ; k++) { - // Dynamically create vector instance to use in contains method - Object vectorInstance; - - // First, try using BlockVector3.at(int, int, int) - common in FAWE and newer WorldEdit - try { - Class blockVector3Class = Class.forName("com.sk89q.worldedit.math.BlockVector3"); - Method atMethod = blockVector3Class.getMethod("at", int.class, int.class, int.class); - vectorInstance = atMethod.invoke(null, i, j, k); - } catch (ClassNotFoundException | NoSuchMethodException e) { - - // If BlockVector3 or at method is not found, fallback to WorldEdit's Vector - vectorInstance = vectorClass.getConstructor(int.class, int.class, int.class).newInstance(i, j, k); - } - - if(vectorInstance != null) { - boolean regionContains = (Boolean) contains.invoke(region, vectorInstance); - - if (regionContains) { - Block block = world.getBlockAt(i, j, k); - blocks[i - minX][j - minY][k - minZ] = block; - } - } - } - - - return blocks; - } catch (Exception e) { - ChatHelper.logDebug("Exception while analyzing region: " + e.getMessage()); - return null; - } - } - - /** - * Copies all blocks inside a region from one world to another to the same coordinates. - * - * @param region The region to copy. - * @param fromWorld The source world. - * @param toWorld The destination world. - */ - public static CompletableFuture copyRegion(LocalSession localSession, Actor actor, - Region region, World fromWorld, - World toWorld) { - CompletableFuture future = new CompletableFuture<>(); - Bukkit.getScheduler().runTaskAsynchronously(getPlugin(), () -> { - com.sk89q.worldedit.world.World weFrom = BukkitAdapter.adapt(fromWorld); - com.sk89q.worldedit.world.World weTo = BukkitAdapter.adapt(toWorld); - Region copyRegion = region; - - try (EditSession sourceEditSession = WorldEdit.getInstance().newEditSession(weFrom); - EditSession targetEditSession = WorldEdit.getInstance().newEditSession(weTo)) { - - if (copyRegion.getWorld() != null && !copyRegion.getWorld().getName().equals(fromWorld.getName())) - copyRegion = changeRegionWorld(region, weFrom); - - if (copyRegion == null) { - ChatHelper.logError("Failed to copy region from " + fromWorld.getName() + " to " + toWorld.getName() + " because region is null."); - return; - } - - BlockArrayClipboard clipboard = new BlockArrayClipboard(copyRegion); - ForwardExtentCopy forwardCopy = new ForwardExtentCopy(sourceEditSession, copyRegion, - clipboard, region.getMinimumPoint()); - forwardCopy.setCopyingEntities(true); - forwardCopy.setCopyingBiomes(true); - Operations.complete(forwardCopy); - - ChatHelper.log("Pasting at: " + region.getMinimumPoint() + " in world " + toWorld.getName()); - ChatHelper.log("Clipboard size: " + clipboard.getRegion().getVolume()); - - Operation paste = new ClipboardHolder(clipboard) - .createPaste(targetEditSession) - .to(region.getMinimumPoint()) - .copyEntities(true) - .copyBiomes(true) - .ignoreAirBlocks(false) - .build(); - Operations.complete(paste); - targetEditSession.flushQueue(); - - saveEditSession(targetEditSession, localSession, actor); - } catch (WorldEditException e) { - ChatHelper.logError("Failed to copy region: " + e.getMessage()); - future.completeExceptionally(e); - return; - } - - future.complete(null); - }); - - return future; - } - - /** - * Replaces all blocks in a region with the given masks and a pattern. - * - * @param localSession The local session of the actor - * @param actor The actor who should perform the operation - * @param weWorld The WorldEdit world in which the region is located - * @param masks The masks to use - * @param from The block to replace - * @param to The blocks to replace with - * @param iterations The number of iterations to perform - * - * @return A CompletableFuture that completes when the operation is finished - */ - public static CompletableFuture replaceBlocksWithMasks(LocalSession localSession, Actor actor, com.sk89q.worldedit.world.World weWorld, List masks, BlockState from, BlockState[] to, int iterations) { - if(to == null || to.length == 0) - throw new IllegalArgumentException("BlockState[] to is empty"); - - CompletableFuture future = new CompletableFuture<>(); - Bukkit.getScheduler().runTaskAsynchronously(getPlugin(), () -> { - for (int i = 0; i < iterations; i++) { - try (EditSession editSession = WorldEdit.getInstance().newEditSession(weWorld)) { - - Region region = localSession.getSelection(); - - ParserContext parserContext = new ParserContext(); - parserContext.setActor(actor); - parserContext.setWorld(weWorld); - parserContext.setSession(localSession); - parserContext.setExtent(editSession); - - for (String maskString : masks) { - ChatHelper.logDebug("Replacing blocks with expression mask: " + maskString.replace("%", "'PCT'") + " from " + from + " to " + Arrays.toString(to) + " for " + iterations + " iterations"); - - Mask mask = new MaskFactory(WorldEdit.getInstance()).parseFromInput(maskString, parserContext); - - if (from != null) { - BlockMask blockMask = new BlockMask(weWorld, from.toBaseBlock()); - editSession.setMask(blockMask); - } - - Pattern pattern; - - if (to.length == 1) - pattern = to[0]; - else { - RandomPattern randomPattern = new RandomPattern(); - double chance = 100.0 / to.length; - - for (BlockState blockState : to) - randomPattern.add(blockState, chance); - - pattern = randomPattern; - } - - - editSession.replaceBlocks(region, mask, pattern); - - saveEditSession(editSession, localSession, actor); - } - } catch (IncompleteRegionException | MaxChangedBlocksException | InputParseException e) { - future.completeExceptionally(new RuntimeException(e)); - } - } - - future.complete(null); - }); - - return future; - } - - - /** - * Replaces all blocks in a region with a schematic pattern. - * - * @param weWorld The WorldEdit world in which the region is located - * @param localSession The local session of the actor - * @param from The block to replace - * @param schematicPath The path of the schematic to replace with - * - * @return A CompletableFuture that completes when the operation is finished - */ - public static CompletableFuture replaceBlocksWithSchematic(LocalSession localSession, Actor actor, com.sk89q.worldedit.world.World weWorld, BlockState[] from, String schematicPath) { - CompletableFuture future = new CompletableFuture<>(); - Bukkit.getScheduler().runTaskAsynchronously(getPlugin(), () -> { - ChatHelper.logDebug("Replacing blocks from " + Arrays.toString(from) + " to " + schematicPath); - - try (EditSession editSession = WorldEdit.getInstance().newEditSession(weWorld)) { - Region region = localSession.getSelection(); - - File schematicFile = new File(GeneratorUtils.getWorldEditSchematicsFolderPath() + schematicPath); - - ClipboardFormat format = ClipboardFormats.findByFile(schematicFile); - ClipboardReader reader; - - if (format == null) - return; - - try { - reader = format.getReader(Files.newInputStream(schematicFile.toPath())); - Clipboard clipboard = reader.read(); - - Pattern pattern = new ClipboardPattern(clipboard); - - if(from != null) { - BlockMask blockMask = new BlockMask(weWorld).add(from); - editSession.replaceBlocks(region, blockMask, pattern); - }else - editSession.setBlocks(region, pattern); - } catch (IOException e) { - ChatHelper.logDebug("Exception while replacing blocks with schematic: " + e.getMessage()); - return; - } - - saveEditSession(editSession, localSession, actor); - } catch (IncompleteRegionException | MaxChangedBlocksException e) { - future.completeExceptionally(new RuntimeException(e)); - } - - future.complete(null); - }); - - return future; - } - - - /** - * Replaces all blocks in a region with a given block. - * - * @param weWorld The WorldEdit world in which the region is located - * @param localSession The local session of the actor - * @param from The block to replace - * @param to The block to replace with - * - * @return A CompletableFuture that completes when the operation is finished - */ - public static CompletableFuture replaceBlocks(LocalSession localSession, Actor actor, com.sk89q.worldedit.world.World weWorld, BlockState[] from, BlockState[] to) { - if(to.length == 0) - throw new IllegalArgumentException("BlockState[] to is empty"); - - CompletableFuture future = new CompletableFuture<>(); - Bukkit.getScheduler().runTaskAsynchronously(getPlugin(), () -> { - ChatHelper.logDebug("Replacing blocks from " + Arrays.toString(from) + " to " + Arrays.toString(to)); - - try (EditSession editSession = WorldEdit.getInstance().newEditSession(weWorld)) { - Region region = localSession.getSelection(); - Pattern pattern; - - if(to.length == 1) - pattern = to[0]; - else{ - RandomPattern randomPattern = new RandomPattern(); - double chance = 100.0 / to.length; - - for(BlockState blockState : to) - randomPattern.add(blockState, chance); - - pattern = randomPattern; - } - - if(from != null) { - BlockMask blockMask = new BlockMask(weWorld).add(from); - editSession.replaceBlocks(region, blockMask, pattern); - }else - editSession.setBlocks(region, pattern); - - - saveEditSession(editSession, localSession, actor); - } catch (IncompleteRegionException | MaxChangedBlocksException e) { - future.completeExceptionally(new RuntimeException(e)); - } - - future.complete(null); - }); - return future; - } - - - /** - * Draws a spline in a region with the given masks and a pattern. - * - * @param localSession The local session of the actor - * @param actor The actor who should perform the operation - * @param weWorld The WorldEdit world in which the region is located - * @param regionBlocks The blocks of the region - * @param masks The masks to use. If no mask should be used, pass an empty list. - * @param points The points of the curve - * @param blocks The blocks to use for the curve - * @param tension The tension of the curve - Kochanek–Bartels Spline - * @param bias The bias of the curve - Kochanek–Bartels Spline - * @param continuity The continuity of the curve - Kochanek–Bartels Spline - * @param quality The quality of the curve. The higher the quality, the more points the curve will have. - * @param radius The radius of the curve. The higher the radius the thicker the curve will be. - * @param filled Whether the curve should be filled or not. - * @param matchElevation Whether the elevation of the points should be matched to the region - */ - public static CompletableFuture drawSplineWithMasks(LocalSession localSession, Actor actor, com.sk89q.worldedit.world.World weWorld, Block[][][] regionBlocks, List masks, List points, BlockState[] blocks, - boolean matchElevation, double tension, double bias, double continuity, double quality, double radius, boolean filled, boolean connectLineEnds) { - if(blocks == null || blocks.length == 0) - throw new IllegalArgumentException("BlockState[] to is empty"); - - // If no mask is provided, add an empty mask - if (masks.isEmpty()) { - masks = new ArrayList<>(); - masks.add(""); - } - - List finalMasks = masks; - CompletableFuture future = new CompletableFuture<>(); - Bukkit.getScheduler().runTaskAsynchronously(getPlugin(), () -> { - - try (EditSession editSession = WorldEdit.getInstance().newEditSession(weWorld)) { - - ParserContext parserContext = new ParserContext(); - parserContext.setActor(actor); - parserContext.setWorld(weWorld); - parserContext.setSession(localSession); - parserContext.setExtent(editSession); - - for (String maskString : finalMasks) { - ChatHelper.logDebug("Drawing spline with expression mask: " + maskString.replace("%", "'PCT'") + " with " + Arrays.toString(blocks)); - - // Set the mask - if (!maskString.isEmpty()) { - Mask mask = new MaskFactory(WorldEdit.getInstance()).parseFromInput(maskString, parserContext); - editSession.setMask(mask); - } - - // Set the pattern - Pattern pattern; - - if (blocks.length == 1) - pattern = blocks[0]; - else { - RandomPattern randomPattern = new RandomPattern(); - double chance = 100.0 / blocks.length; - - for (BlockState blockState : blocks) - randomPattern.add(blockState, chance); - - pattern = randomPattern; - } - - // Set the block vectors - List blockVector3s = new ArrayList<>(); - for (Vector point : points) { - if (matchElevation) - point = getXYZ(point, regionBlocks); - - blockVector3s.add(BlockVector3.at(point.getBlockX(), point.getBlockY(), point.getBlockZ())); - } - - editSession.drawSpline(pattern, blockVector3s, tension, bias, continuity, quality, radius, filled); - - if (connectLineEnds && blockVector3s.size() > 1) - editSession.drawLine(pattern, blockVector3s.getFirst(), blockVector3s.getLast(), radius, true); - - saveEditSession(editSession, localSession, actor); - } - } catch (IncompleteRegionException | MaxChangedBlocksException | InputParseException e) { - throw new RuntimeException(e); - } - - future.complete(null); - }); - - return future; - } - - public static CompletableFuture drawCurveWithMasks(LocalSession localSession, Actor actor, com.sk89q.worldedit.world.World weWorld, Block[][][] regionBlocks, List masks, List points, BlockState[] blocks, boolean matchElevation){ - return drawSplineWithMasks(localSession, actor, weWorld, regionBlocks, masks, points, blocks, matchElevation, 0, 0, 0, 10, 0, true, false); - } - - public static CompletableFuture drawPolyLineWithMasks(LocalSession localSession, Actor actor, com.sk89q.worldedit.world.World weWorld, Block[][][] regionBlocks, List masks, List points, BlockState[] blocks, boolean matchElevation, boolean connectLineEnds){ - return drawSplineWithMasks(localSession, actor, weWorld, regionBlocks, masks, points, blocks, matchElevation, 1, 0, -1, 10, 0, true, connectLineEnds); - } - - - - - /** - * Draws a Line in a region with the given masks and a pattern. - * - * @param localSession The local session of the actor - * @param actor The actor who should perform the operation - * @param weWorld The WorldEdit world in which the region is located - * @param regionBlocks The blocks of the region - * @param masks The masks to use. If no mask should be used, pass an empty list. - * @param point1 The first point of the curve - * @param point2 The second point of the curve - * @param blocks The blocks to use for the curve - * @param matchElevation Whether the elevation of the points should be matched to the region - */ - public static CompletableFuture drawLineWithMasks(LocalSession localSession, Actor actor, com.sk89q.worldedit.world.World weWorld, Block[][][] regionBlocks, List masks, Vector point1, Vector point2, BlockState[] blocks, boolean matchElevation) { - if(blocks == null || blocks.length == 0) - throw new IllegalArgumentException("BlockState[] to is empty"); - - // If no mask is provided, add an empty mask - if (masks.isEmpty()) { - masks = new ArrayList<>(); - masks.add(""); - } - - CompletableFuture future = new CompletableFuture<>(); - List finalMasks = masks; - Bukkit.getScheduler().runTaskAsynchronously(getPlugin(), () -> { - try (EditSession editSession = WorldEdit.getInstance().newEditSession(weWorld)) { - - ParserContext parserContext = new ParserContext(); - parserContext.setActor(actor); - parserContext.setWorld(weWorld); - parserContext.setSession(localSession); - parserContext.setExtent(editSession); - - for (String maskString : finalMasks) { - ChatHelper.logDebug("Drawing line with expression mask: " + maskString.replace("%", "'PCT'") + " with " + Arrays.toString(blocks) + " from " + point1 + " to " + point2); - - // Set the mask - if(!maskString.isEmpty()) { - Mask mask = new MaskFactory(WorldEdit.getInstance()).parseFromInput(maskString, parserContext); - editSession.setMask(mask); - } - - // Set the pattern - Pattern pattern; - - if(blocks.length == 1) - pattern = blocks[0]; - else{ - RandomPattern randomPattern = new RandomPattern(); - double chance = 100.0 / blocks.length; - - for(BlockState blockState : blocks) - randomPattern.add(blockState, chance); - - pattern = randomPattern; - } - - Vector newPoint1 = point1; - Vector newPoint2 = point2; - - // Adjust the points to the elevation of the region if matchElevation is true - if(matchElevation){ - newPoint1 = getXYZ(point1, regionBlocks); - newPoint2 = getXYZ(point2, regionBlocks); - } - - // Set the block vectors - BlockVector3 point1BlockVector3 = BlockVector3.at(newPoint1.getBlockX(), newPoint1.getBlockY(), newPoint1.getBlockZ()); - BlockVector3 point2BlockVector3 = BlockVector3.at(newPoint2.getBlockX(), newPoint2.getBlockY(), newPoint2.getBlockZ()); - - editSession.drawLine(pattern, point1BlockVector3, point2BlockVector3, 0, true); - - saveEditSession(editSession, localSession, actor); - } - } catch(IncompleteRegionException | MaxChangedBlocksException | InputParseException e){ - throw new RuntimeException(e); - } - - future.complete(null); - }); - - return future; - } - - - /** - * Pastes a schematic at a given location. - * - * @param localSession The local session of the actor - * @param weWorld The WorldEdit world in which the region is located - * @param blocks The blocks to paste - * @param masks The masks to use - * @param schematicPath The path to the schematic - * @param loc The location to paste the schematic - * @param rotation The rotation of the schematic - */ - public static CompletableFuture pasteSchematicWithMasks(LocalSession localSession, Actor actor, com.sk89q.worldedit.world.World weWorld, Block[][][] blocks, List masks, String schematicPath, Location loc, double rotation) { - int offsetY = 1; - - // If no mask is provided, add an empty mask - if (masks.isEmpty()) { - masks = new ArrayList<>(); - masks.add(""); - } - - int maxHeight = loc.getBlockY(); - - if(blocks != null) - maxHeight = GeneratorUtils.getMaxHeight(blocks, loc.getBlockX(), loc.getBlockZ(), getIgnoredMaterials()); - if(maxHeight == 0) - maxHeight = loc.getBlockY(); - - CompletableFuture future = new CompletableFuture<>(); - int finalMaxHeight = maxHeight; - final List finalMasks = masks; - Bukkit.getScheduler().runTaskAsynchronously(getPlugin(), () -> { - try (EditSession editSession = WorldEdit.getInstance().newEditSession(weWorld)) { - File schematicFile = new File(getWorldEditSchematicsFolderPath() + schematicPath); - - ClipboardFormat format = ClipboardFormats.findByFile(schematicFile); - ClipboardReader reader; - - if (format == null) - return; - - try { - reader = format.getReader(Files.newInputStream(schematicFile.toPath())); - Clipboard clipboard = reader.read(); - - AffineTransform transform = new AffineTransform(); - transform = transform.rotateY(rotation); - - ClipboardHolder holder = new ClipboardHolder(clipboard); - holder.setTransform(transform); - - ParserContext parserContext = new ParserContext(); - parserContext.setActor(actor); - parserContext.setWorld(weWorld); - parserContext.setSession(localSession); - parserContext.setExtent(editSession); - - for (String maskString : finalMasks) { - // Set the mask - Mask mask = null; - if(!maskString.isEmpty()) - mask = new MaskFactory(WorldEdit.getInstance()).parseFromInput(maskString, parserContext); - - Operation op = holder - .createPaste(editSession) - .to(BlockVector3.at(loc.getBlockX(), finalMaxHeight + offsetY, loc.getBlockZ())) - .ignoreAirBlocks(true) - .maskSource(mask) - .build(); - Operations.complete(op); - } - } catch (IOException | WorldEditException e) { - throw new RuntimeException(e); - } - - saveEditSession(editSession, localSession, actor); - - ChatHelper.logDebug("Pasted schematic: " + schematicPath + " at " + loc + " with rotation " + rotation); - } - - future.complete(null); - }); - - return future; - } - - public static CompletableFuture pasteSchematic(LocalSession localSession, Actor actor, com.sk89q.worldedit.world.World weWorld, Block[][][] blocks, String schematicPath, Location loc, double rotation){ - return pasteSchematicWithMasks(localSession, actor, weWorld, blocks, new ArrayList<>(), schematicPath, loc, rotation); - } - - - /** - * Expands the WorldEdit selection by a given vector. - * - * @param localSession The local session of the actor - * @param vector The vector to expand the selection by - */ - public static void expandSelection(LocalSession localSession, Vector vector){ - BlockVector3 blockVector3 = BlockVector3.at(vector.getBlockX(), vector.getBlockY(), vector.getBlockZ()); - - try { - localSession.getSelection().expand(blockVector3); - } catch (IncompleteRegionException | RegionOperationException e) { - throw new RuntimeException(e); - } - - ChatHelper.logDebug("Expanded selection by: " + vector); - } - - - /** - * Clears the history of a LocalSession. - * @param session The local session to clear the history of - */ - public static void clearHistory(LocalSession session){ - session.clearHistory(); - ChatHelper.logDebug("Cleared history"); - } - - /** - * Undoes the last action of a LocalSession. - * @param session The local session to undo the last action of - * @param player The player who created the structure - * @param amount The amount of actions to undo - */ - public static void undo(LocalSession session, Player player, Actor actor, int amount){ - com.sk89q.worldedit.entity.Player wePlayer = BukkitAdapter.adapt(player); - - for(int i = 0; i < amount; i++) { - BlockBag blockBag = session.getBlockBag(wePlayer); - EditSession undoSession = session.undo(blockBag, wePlayer); - - if (undoSession != null) - WorldEdit.getInstance().flushBlockBag(actor, undoSession); - else - break; - } - } - - /** - * Redoes the last action of a LocalSession. - * @param session The local session to redo the last action of - * @param player The player who created the structure - * @param amount The amount of actions to redo - */ - public static void redo(LocalSession session, Player player, Actor actor, int amount){ - com.sk89q.worldedit.entity.Player wePlayer = BukkitAdapter.adapt(player); - - for(int i = 0; i < amount; i++) { - BlockBag blockBag = session.getBlockBag(wePlayer); - EditSession redoSession = session.redo(blockBag, wePlayer); - - if (redoSession != null) - WorldEdit.getInstance().flushBlockBag(actor, redoSession); - else - break; - } - } - - - - /** - * Sets the gmask of a LocalSession. - * - * @param session The local session to set the gmask of - * @param mask The mask to set. If the mask is null or empty, the gmask will be disabled. - */ - public static void setGmask(LocalSession session, String mask){ - if(mask == null || mask.isEmpty()) { - session.setMask(null); - ChatHelper.logDebug("Disabled gmask"); - return; - } - - try { - ParserContext parserContext = new ParserContext(); - parserContext.setExtent(session.getSelectionWorld()); - - Mask newMask = WorldEdit.getInstance().getMaskFactory().parseFromInput(mask,parserContext); - session.setMask(newMask); - } catch (InputParseException e) { - throw new RuntimeException(e); - } - - ChatHelper.logDebug("Set gmask to: " + mask); - } - - - - - /** - * Commits and saves an edit session. - * - * @param editSession The edit session to commit - * @param localSession The local session to save the edit session to - */ - public static void saveEditSession(EditSession editSession, LocalSession localSession, Actor actor){ - editSession.commit(); - editSession.flushQueue(); - - if(isFastAsyncWorldEditEnabled()) - localSession.remember(actor, localSession.getSelectionWorld(), editSession.getChangeSet(), FaweLimit.MAX); - - editSession.close(); - } - - - - - - - - /*=============================================** - - VECTOR HELPER FUNCTIONS - - **=============================================*/ - - - - /** - * Adjusts the height of a list of vectors so that they are on the surface of the terrain. - * - * @param points List of vectors to adjust - * @param blocks List of blocks in polygon region - */ - public static void adjustHeight(List points, Block[][][] blocks){ - for (Vector point : points) - point.setY(getMaxHeight(blocks, point.getBlockX(), point.getBlockZ(), getIgnoredMaterials())); - } - - /** As long as two neighboring vectors are further than a given distance of blocks apart, add a new vector in between them - * - * @param points The points to populate - * @param distance The distance between the points - * @return The populated points - */ - public static List populatePoints(List points, int distance){ - List result = new ArrayList<>(); - - // Go through all points - boolean found = true; - while(found){ - found = false; - - // Go through all vectors - for (int i = 0; i < points.size() - 1; i++) { - - // Get the two neighboring vectors - Vector p1 = points.get(i).clone(); - Vector p2 = points.get(i+1).clone(); - - //ChatHelper.logDebug("p1: " + p1 + " p2: " + p2 + " distance: " + distance); - - // Add the first point - result.add(p1); - - // If the distance between the two points is greater than the given distance, add a new point in between them - if(p1.distance(p2) > distance){ - Vector v1 = p2.clone().subtract(p1); - Vector v2 = v1.clone().multiply(0.5); - Vector v3 = p1.clone().add(v2); - - // Add the new point - result.add(v3); - found = true; - //ChatHelper.logDebug("Adding new point in between: " + v3); - } - } - - result.add(points.getLast()); - points = result; - result = new ArrayList<>(); - } - - return points; - } - - /** As long as two neighboring vectors are closer than a given distance of blocks apart, remove the second point. The distances switch between distance1 and distance2 - * - * @param points The points to reduce - * @return The reduced points - */ - public static List reducePoints(List points, int distance1, int distance2){ - points = new ArrayList<>(points); - - // Go through all points - boolean found = true; - while(found){ - found = false; - for(int i = 0; i < points.size()-1; i++){ - Vector p1 = points.get(i); - Vector p2 = points.get(i+1); - - int distance = distance1; - // Switch between distance1 and distance2 - if(i%2 == 0) - distance = distance2; - - // If the distance between the two points is less than the given distance, remove the second point - if(p1.distance(p2) < distance){ - points.remove(p2); - found = true; - break; - } - } - } - - return points; - } - - /** Extends a polyline by taking the first two points and the last two points of the polyline and extending them - * - * @param vectors The polyline to extend - * @return The extended polyline - */ - public static List extendPolyLine(List vectors){ - List result = new ArrayList<>(); - - // Get the first two points - Vector p1 = vectors.get(0); - Vector p2 = vectors.get(1); - - // Get the last two points - Vector p3 = vectors.get(vectors.size()-2); - Vector p4 = vectors.getLast(); - - // Get the vectors between the points - Vector v1 = p1.clone().subtract(p2); - Vector v2 = p4.clone().subtract(p3); - - result.add(p1.clone().add(v1)); - result.addAll(vectors); - result.add(p4.clone().add(v2)); - - return result; - } - - /** Shortens a polyline by taking the first two points and the last two points of the polyline and shortening them - * - * @param vectors The polyline to shorten - * @return The shortened polyline - */ - public static List shortenPolyLine(List vectors, int distance){ - List result = new ArrayList<>(); - - if(vectors.size() < 4) - return vectors; - - // Get the first two points - Vector p1 = vectors.get(0); - Vector p2 = vectors.get(1); - - // Get the last two points - Vector p3 = vectors.get(vectors.size()-2); - Vector p4 = vectors.getLast(); - - // Get the vectors between the points - Vector v1 = p2.clone().subtract(p1); - Vector v2 = p3.clone().subtract(p4); - - // Shorten the vectors - v1 = v1.clone().normalize().multiply(distance); - v2 = v2.clone().normalize().multiply(distance); - - // Remove the first and last points - vectors.removeFirst(); - vectors.removeLast(); - - // Add the shortened vectors - result.add(p1.clone().add(v1)); - result.addAll(vectors); - result.add(p4.clone().add(v2)); - - return result; - } - - /** Returns the closest vector from a list of vectors to a reference vector - * - * @param vectors List of vectors to search through - * @param reference Reference vector to compare to - * @return Closest vector to the reference vector - */ - public static Vector getClosestVector(List vectors, Vector reference){ - Vector closestVector = null; - double closestDistance = Double.MAX_VALUE; - - for(Vector vector : vectors){ - double distance = vector.distance(reference); - if(distance < closestDistance){ - closestVector = vector; - closestDistance = distance; - } - } - - if(closestVector == null) - return null; - - return closestVector.clone(); - } - - /** - * Returns the given vector with the height of the point matching the surface of the terrain. - * - * @param vector The vector to get the height from - * @param blocks The dataset to get the height from - * @return The vector with the height matching the surface of the terrain - */ - private static Vector getXYZ(Vector vector, Block[][][] blocks){ - int maxHeight = vector.getBlockY(); - - if(blocks != null) - maxHeight = getMaxHeight(blocks, vector.getBlockX(), vector.getBlockZ(), getIgnoredMaterials()); - if(maxHeight == 0) - maxHeight = vector.getBlockY(); - - return vector.setY(maxHeight); - } - - /** - * Returns a XYZ String with the height of the point matching the surface of the terrain. - * - * @param vector The vector to get the XYZ String from - * @param blocks The dataset to get the height from - * @return The XYZ String - */ - public static String getXYZWithVerticalOffset(Vector vector, Block[][][] blocks, int offset){ - int maxHeight = vector.getBlockY(); - - if(blocks != null) - maxHeight = getMaxHeight(blocks, vector.getBlockX(), vector.getBlockZ(), getIgnoredMaterials()) + offset; - if(maxHeight == 0) - maxHeight = vector.getBlockY(); - - return vector.getBlockX() + "," + maxHeight + "," + vector.getBlockZ(); - } - - private static Path64 convertVectorListToPath64(List vectors, Vector reference){ - List points = new ArrayList<>(); - for(Vector vector : vectors) - points.add(new Point64(vector.getBlockX() - reference.getBlockX(), vector.getBlockZ() - reference.getBlockZ())); - - return new Path64(points); - } - - private static List> convertPathsToVectorList(Paths64 pathsD, Vector reference, int minHeight, int maxHeight){ - List> vectors = new ArrayList<>(); - - for(Path64 path : new ArrayList<>(pathsD)) { - List vectorList = new ArrayList<>(); - - for(Point64 point : new ArrayList<>(path)) - vectorList.add(new Vector(point.x + reference.getX(), minHeight, point.y + reference.getZ())); - - Vector vector = vectorList.getLast().setY(maxHeight); - vectorList.set(vectorList.size() - 1, vector); - - vectors.add(vectorList); - } - - return vectors; - } - - /** - * Shifts the points in a polyline by a given amount. - * Sometimes during shifting there are multiple paths created. - * For example, if you have a polyline that intersects itself, there is an inner and outer path. - * This method can either return all the paths or just the longest one. - * - * @see #shiftPointsAll(List, double) - * - * @param vectors The polyline to shift - * @param shift The amount to shift the points by - * @param useLongestPathOnly Whether to only return the longest path - * @return The shifted polyline - */ - public static List shiftPoints(List vectors, double shift, boolean useLongestPathOnly) { - List> resultVectors = shiftPointsAll(vectors, shift); - - // If we only want the longest path, find it and return it - if(useLongestPathOnly){ - int longestPathIndex = 0; - int longestPathLength = 0; - for(int i = 0; i < resultVectors.size(); i++){ - if(resultVectors.get(i).size() > longestPathLength){ - longestPathIndex = i; - longestPathLength = resultVectors.get(i).size(); - } - } - - return resultVectors.get(longestPathIndex); - - // Otherwise, return all paths combined into one - }else{ - List result = new ArrayList<>(); - for(List vectorList : resultVectors) - result.addAll(vectorList); - - return result; - } - } - - /** - * Shifts the points in a polyline by a given amount. - * Sometimes during shifting there are multiple paths created. - * For example, if you have a polyline that intersects itself, there is an inner and outer path. - * This method returns a list of all the paths. - * - * @see #shiftPoints(List, double, boolean) - * - * @param vectors The polyline to shift - * @param shift The amount to shift the points by - * @return The shifted polyline - */ - public static List> shiftPointsAll(List vectors, double shift) { - Vector reference = vectors.getFirst(); - int minHeight = getMinHeight(vectors); - int maxHeight = getMaxHeight(vectors); - Paths64 paths = new Paths64(); - paths.add(convertVectorListToPath64(vectors, reference)); - Paths64 inflatedPath = Clipper.InflatePaths(paths, shift, JoinType.Round, EndType.Butt, 2); - - return convertPathsToVectorList(inflatedPath, reference, minHeight, maxHeight); - } - - /** - * Gets the minimum height of a list of vectors - * - * @param vectors The list of vectors to get the minimum height of - * @return The minimum height - */ - public static int getMinHeight(List vectors){ - int minHeight = Integer.MAX_VALUE; - for(Vector vector : vectors) - minHeight = Math.min(minHeight, vector.getBlockY()); - - return minHeight; - } - - /** - * Gets the maximum height of a list of vectors - * - * @param vectors The list of vectors to get the maximum height of - * @return The maximum height - */ - private static int getMaxHeight(List vectors){ - int maxHeight = Integer.MIN_VALUE; - for(Vector vector : vectors) - maxHeight = Math.max(maxHeight, vector.getBlockY()); - - return maxHeight; - } - - - - - - /*=============================================** - - PREPARATION CHECK FUNCTIONS - - **=============================================*/ - - - - /** - * Checks if Schematic Brush is installed and sends the player a message if it isn't. - * - * @param p The player to check for - * @return Whether Schematic Brush is installed - */ - public static boolean checkIfSchematicBrushIsInstalled(Player p){ - // Check if WorldEdit is enabled - if (!isSchematicBrushEnabled()) { - p.sendMessage("§cPlease install Schematic Brush to use this tool. You can ask the server administrator to install it."); - - return false; - } - return true; - } - - - /** - * Checks if the player has a WorldEdit selection and sends them a message if they don't. - * - * @param p The player to check for - * @return Whether the player has a WorldEdit selection - */ - public static boolean checkForNoWorldEditSelection(Player p){ - // Get WorldEdit selection of player - Region polyRegion = getWorldEditSelection(p); - - if(polyRegion != null) - return false; - - p.sendMessage("§cPlease make a WorldEdit Selection first."); - p.closeInventory(); - p.playSound(p.getLocation(), Sound.ENTITY_ITEM_BREAK, 1.0F, 1.0F); - return true; - } - - - /** - * Checks if the player has a brick block in their selection and sends them a message if they don't. - * - * @param p The player to check for - * @return Whether the player has a brick block in their selection - */ - public static boolean checkForBrickOutline(Block[][][] blocks, Player p, WikiDocumented w){ - if(!containsBlock(blocks, XMaterial.BRICKS)){ - p.sendMessage("§cPlease make a selection around an outline."); - p.closeInventory(); - p.playSound(p.getLocation(), Sound.ENTITY_ITEM_BREAK, 1.0F, 1.0F); - w.sendWikiLink(p); - - return false; - } - - return true; - } - - /** - * Checks if the player has a yellow wool block in their selection and sends them a message if they don't. - * - * @param p The player to check for - * @return Whether the player has a yellow wool block in their selection - */ - public static boolean checkForWoolBlock(Block[][][] blocks, Player p, WikiDocumented w){ - if(!containsBlock(blocks, XMaterial.YELLOW_WOOL)){ - p.sendMessage("§cPlease place a yellow wool block inside the outline."); - p.closeInventory(); - p.playSound(p.getLocation(), Sound.ENTITY_ITEM_BREAK, 1.0F, 1.0F); - w.sendWikiLink(p); - - ItemStack yellowWool = XMaterial.YELLOW_WOOL.parseItem(); - if(!p.getInventory().contains(yellowWool)) { - p.getInventory().setItem(4, yellowWool); - p.playSound(p.getLocation(), Sound.ENTITY_ITEM_PICKUP, 1.0F, 1.0F); - } - - return false; - } - return true; - } -} \ No newline at end of file diff --git a/src/main/java/net/buildtheearth/modules/miscellaneous/blockpalettegui/ChoosePaletteBlocksMenu.java b/src/main/java/net/buildtheearth/modules/miscellaneous/blockpalettegui/ChoosePaletteBlocksMenu.java index 4d5e92ec..f5751b53 100644 --- a/src/main/java/net/buildtheearth/modules/miscellaneous/blockpalettegui/ChoosePaletteBlocksMenu.java +++ b/src/main/java/net/buildtheearth/modules/miscellaneous/blockpalettegui/ChoosePaletteBlocksMenu.java @@ -1,7 +1,7 @@ package net.buildtheearth.modules.miscellaneous.blockpalettegui; +import com.alpsbte.alpslib.utils.item.Item; import com.cryptomorin.xseries.XMaterial; -import net.buildtheearth.utils.Item; import net.buildtheearth.utils.menus.AbstractPaginatedMenu; import org.bukkit.Material; import org.bukkit.NamespacedKey; @@ -11,10 +11,10 @@ import org.bukkit.inventory.ItemFlag; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.ItemMeta; +import org.bukkit.plugin.java.JavaPlugin; import org.ipvp.canvas.Menu; import org.ipvp.canvas.mask.BinaryMask; import org.ipvp.canvas.mask.Mask; -import org.bukkit.plugin.java.JavaPlugin; import java.util.*; import java.util.function.Consumer; diff --git a/src/main/java/net/buildtheearth/modules/miscellaneous/blockpalettegui/ChoosePaletteMenu.java b/src/main/java/net/buildtheearth/modules/miscellaneous/blockpalettegui/ChoosePaletteMenu.java index b1448091..8176f581 100644 --- a/src/main/java/net/buildtheearth/modules/miscellaneous/blockpalettegui/ChoosePaletteMenu.java +++ b/src/main/java/net/buildtheearth/modules/miscellaneous/blockpalettegui/ChoosePaletteMenu.java @@ -1,7 +1,7 @@ package net.buildtheearth.modules.miscellaneous.blockpalettegui; +import com.alpsbte.alpslib.utils.item.Item; import com.cryptomorin.xseries.XMaterial; -import net.buildtheearth.utils.Item; import net.buildtheearth.utils.menus.AbstractMenu; import org.bukkit.Material; import org.bukkit.entity.Player; diff --git a/src/main/java/net/buildtheearth/modules/miscellaneous/blockpalettegui/CreatePaletteMenu.java b/src/main/java/net/buildtheearth/modules/miscellaneous/blockpalettegui/CreatePaletteMenu.java index f27ef7d7..a26c6369 100644 --- a/src/main/java/net/buildtheearth/modules/miscellaneous/blockpalettegui/CreatePaletteMenu.java +++ b/src/main/java/net/buildtheearth/modules/miscellaneous/blockpalettegui/CreatePaletteMenu.java @@ -1,7 +1,7 @@ package net.buildtheearth.modules.miscellaneous.blockpalettegui; +import com.alpsbte.alpslib.utils.item.Item; import com.cryptomorin.xseries.XMaterial; -import net.buildtheearth.utils.Item; import net.buildtheearth.utils.menus.AbstractMenu; import org.bukkit.Bukkit; import org.bukkit.entity.Player; diff --git a/src/main/java/net/buildtheearth/modules/miscellaneous/blockpalettegui/EditPaletteMenu.java b/src/main/java/net/buildtheearth/modules/miscellaneous/blockpalettegui/EditPaletteMenu.java index d43dfc80..eb7f8404 100644 --- a/src/main/java/net/buildtheearth/modules/miscellaneous/blockpalettegui/EditPaletteMenu.java +++ b/src/main/java/net/buildtheearth/modules/miscellaneous/blockpalettegui/EditPaletteMenu.java @@ -1,7 +1,7 @@ package net.buildtheearth.modules.miscellaneous.blockpalettegui; +import com.alpsbte.alpslib.utils.item.Item; import com.cryptomorin.xseries.XMaterial; -import net.buildtheearth.utils.Item; import net.buildtheearth.utils.menus.AbstractMenu; import org.bukkit.Bukkit; import org.bukkit.entity.Player; diff --git a/src/main/java/net/buildtheearth/modules/miscellaneous/blockpalettegui/PaletteBlockListMenu.java b/src/main/java/net/buildtheearth/modules/miscellaneous/blockpalettegui/PaletteBlockListMenu.java index c03e3067..da0475ac 100644 --- a/src/main/java/net/buildtheearth/modules/miscellaneous/blockpalettegui/PaletteBlockListMenu.java +++ b/src/main/java/net/buildtheearth/modules/miscellaneous/blockpalettegui/PaletteBlockListMenu.java @@ -1,7 +1,7 @@ package net.buildtheearth.modules.miscellaneous.blockpalettegui; +import com.alpsbte.alpslib.utils.item.Item; import com.cryptomorin.xseries.XMaterial; -import net.buildtheearth.utils.Item; import net.buildtheearth.utils.MenuItems; import net.buildtheearth.utils.menus.AbstractPaginatedMenu; import org.bukkit.entity.Player; diff --git a/src/main/java/net/buildtheearth/modules/navigation/NavUtils.java b/src/main/java/net/buildtheearth/modules/navigation/NavUtils.java index 03864890..a22be73b 100644 --- a/src/main/java/net/buildtheearth/modules/navigation/NavUtils.java +++ b/src/main/java/net/buildtheearth/modules/navigation/NavUtils.java @@ -1,5 +1,6 @@ package net.buildtheearth.modules.navigation; +import com.alpsbte.alpslib.utils.ChatHelper; import com.google.common.io.ByteArrayDataOutput; import com.google.common.io.ByteStreams; import lombok.experimental.UtilityClass; @@ -7,7 +8,6 @@ import net.buildtheearth.modules.navigation.components.warps.model.WarpGroup; import net.buildtheearth.modules.network.NetworkModule; import net.buildtheearth.modules.network.model.BuildTeam; -import net.buildtheearth.utils.ChatHelper; import net.md_5.bungee.api.chat.ClickEvent; import net.md_5.bungee.api.chat.ComponentBuilder; import net.md_5.bungee.api.chat.HoverEvent; diff --git a/src/main/java/net/buildtheearth/modules/navigation/components/navigator/NavigatorComponent.java b/src/main/java/net/buildtheearth/modules/navigation/components/navigator/NavigatorComponent.java index bc21d043..272f65ab 100644 --- a/src/main/java/net/buildtheearth/modules/navigation/components/navigator/NavigatorComponent.java +++ b/src/main/java/net/buildtheearth/modules/navigation/components/navigator/NavigatorComponent.java @@ -1,12 +1,12 @@ package net.buildtheearth.modules.navigation.components.navigator; +import com.alpsbte.alpslib.utils.ChatHelper; +import com.alpsbte.alpslib.utils.item.Item; import com.cryptomorin.xseries.XMaterial; import com.sk89q.worldedit.WorldEdit; import net.buildtheearth.BuildTeamTools; import net.buildtheearth.modules.ModuleComponent; import net.buildtheearth.modules.common.CommonModule; -import net.buildtheearth.utils.ChatHelper; -import net.buildtheearth.utils.Item; import net.buildtheearth.utils.io.ConfigPaths; import net.buildtheearth.utils.io.ConfigUtil; import org.bukkit.entity.Player; diff --git a/src/main/java/net/buildtheearth/modules/navigation/components/navigator/commands/BuildteamCommand.java b/src/main/java/net/buildtheearth/modules/navigation/components/navigator/commands/BuildteamCommand.java index 3a4c1c46..7716901f 100644 --- a/src/main/java/net/buildtheearth/modules/navigation/components/navigator/commands/BuildteamCommand.java +++ b/src/main/java/net/buildtheearth/modules/navigation/components/navigator/commands/BuildteamCommand.java @@ -1,10 +1,10 @@ package net.buildtheearth.modules.navigation.components.navigator.commands; +import com.alpsbte.alpslib.utils.ChatHelper; import net.buildtheearth.modules.navigation.NavUtils; import net.buildtheearth.modules.network.NetworkModule; import net.buildtheearth.modules.network.model.BuildTeam; import net.buildtheearth.modules.network.model.Permissions; -import net.buildtheearth.utils.ChatHelper; import org.bukkit.command.Command; import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandSender; diff --git a/src/main/java/net/buildtheearth/modules/navigation/components/navigator/commands/NavigatorCommand.java b/src/main/java/net/buildtheearth/modules/navigation/components/navigator/commands/NavigatorCommand.java index b368777c..03063c43 100644 --- a/src/main/java/net/buildtheearth/modules/navigation/components/navigator/commands/NavigatorCommand.java +++ b/src/main/java/net/buildtheearth/modules/navigation/components/navigator/commands/NavigatorCommand.java @@ -1,9 +1,9 @@ package net.buildtheearth.modules.navigation.components.navigator.commands; -import net.buildtheearth.modules.navigation.menu.MainMenu; +import com.alpsbte.alpslib.utils.ChatHelper; import net.buildtheearth.modules.navigation.NavigationModule; +import net.buildtheearth.modules.navigation.menu.MainMenu; import net.buildtheearth.modules.network.model.Permissions; -import net.buildtheearth.utils.ChatHelper; import org.bukkit.command.Command; import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandSender; diff --git a/src/main/java/net/buildtheearth/modules/navigation/components/tpll/TpllComponent.java b/src/main/java/net/buildtheearth/modules/navigation/components/tpll/TpllComponent.java index c49435c5..2ddbc302 100644 --- a/src/main/java/net/buildtheearth/modules/navigation/components/tpll/TpllComponent.java +++ b/src/main/java/net/buildtheearth/modules/navigation/components/tpll/TpllComponent.java @@ -1,5 +1,6 @@ package net.buildtheearth.modules.navigation.components.tpll; +import com.alpsbte.alpslib.utils.ChatHelper; import com.google.common.io.ByteArrayDataInput; import com.google.common.io.ByteArrayDataOutput; import com.google.common.io.ByteStreams; @@ -7,7 +8,6 @@ import net.buildtheearth.modules.ModuleComponent; import net.buildtheearth.modules.navigation.NavUtils; import net.buildtheearth.modules.network.NetworkModule; -import net.buildtheearth.utils.ChatHelper; import net.buildtheearth.utils.GeometricUtils; import org.bukkit.Bukkit; import org.bukkit.Location; diff --git a/src/main/java/net/buildtheearth/modules/navigation/components/tpll/listeners/TpllJoinListener.java b/src/main/java/net/buildtheearth/modules/navigation/components/tpll/listeners/TpllJoinListener.java index af8b28d5..9483e89f 100644 --- a/src/main/java/net/buildtheearth/modules/navigation/components/tpll/listeners/TpllJoinListener.java +++ b/src/main/java/net/buildtheearth/modules/navigation/components/tpll/listeners/TpllJoinListener.java @@ -1,8 +1,8 @@ package net.buildtheearth.modules.navigation.components.tpll.listeners; +import com.alpsbte.alpslib.utils.ChatHelper; import net.buildtheearth.modules.navigation.NavigationModule; import net.buildtheearth.modules.navigation.components.tpll.TpllComponent; -import net.buildtheearth.utils.ChatHelper; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.player.PlayerJoinEvent; diff --git a/src/main/java/net/buildtheearth/modules/navigation/components/tpll/listeners/TpllListener.java b/src/main/java/net/buildtheearth/modules/navigation/components/tpll/listeners/TpllListener.java index 0f4d0934..837ada94 100644 --- a/src/main/java/net/buildtheearth/modules/navigation/components/tpll/listeners/TpllListener.java +++ b/src/main/java/net/buildtheearth/modules/navigation/components/tpll/listeners/TpllListener.java @@ -1,13 +1,13 @@ package net.buildtheearth.modules.navigation.components.tpll.listeners; import com.alpsbte.alpslib.utils.AlpsUtils; +import com.alpsbte.alpslib.utils.ChatHelper; import net.buildtheearth.modules.navigation.NavUtils; import net.buildtheearth.modules.navigation.NavigationModule; import net.buildtheearth.modules.network.NetworkModule; import net.buildtheearth.modules.network.api.OpenStreetMapAPI; import net.buildtheearth.modules.network.model.BuildTeam; import net.buildtheearth.modules.network.model.Region; -import net.buildtheearth.utils.ChatHelper; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.player.PlayerCommandPreprocessEvent; diff --git a/src/main/java/net/buildtheearth/modules/navigation/components/warps/WarpsComponent.java b/src/main/java/net/buildtheearth/modules/navigation/components/warps/WarpsComponent.java index 0064ace7..6e4e1482 100644 --- a/src/main/java/net/buildtheearth/modules/navigation/components/warps/WarpsComponent.java +++ b/src/main/java/net/buildtheearth/modules/navigation/components/warps/WarpsComponent.java @@ -1,5 +1,6 @@ package net.buildtheearth.modules.navigation.components.warps; +import com.alpsbte.alpslib.utils.ChatHelper; import com.google.common.io.ByteArrayDataInput; import com.google.common.io.ByteArrayDataOutput; import com.google.common.io.ByteStreams; @@ -15,7 +16,6 @@ import net.buildtheearth.modules.network.NetworkModule; import net.buildtheearth.modules.network.api.OpenStreetMapAPI; import net.buildtheearth.modules.network.model.BuildTeam; -import net.buildtheearth.utils.ChatHelper; import net.buildtheearth.utils.GeometricUtils; import net.buildtheearth.utils.geo.CoordinateConversion; import net.buildtheearth.utils.menus.AbstractMenu; diff --git a/src/main/java/net/buildtheearth/modules/navigation/components/warps/commands/WarpCommand.java b/src/main/java/net/buildtheearth/modules/navigation/components/warps/commands/WarpCommand.java index c7363d17..1da940c4 100644 --- a/src/main/java/net/buildtheearth/modules/navigation/components/warps/commands/WarpCommand.java +++ b/src/main/java/net/buildtheearth/modules/navigation/components/warps/commands/WarpCommand.java @@ -1,11 +1,11 @@ package net.buildtheearth.modules.navigation.components.warps.commands; +import com.alpsbte.alpslib.utils.ChatHelper; import net.buildtheearth.modules.navigation.NavigationModule; import net.buildtheearth.modules.navigation.components.warps.WarpsComponent; import net.buildtheearth.modules.navigation.components.warps.model.Warp; import net.buildtheearth.modules.network.NetworkModule; import net.buildtheearth.modules.network.model.Permissions; -import net.buildtheearth.utils.ChatHelper; import org.bukkit.command.Command; import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandSender; diff --git a/src/main/java/net/buildtheearth/modules/navigation/components/warps/listeners/WarpJoinListener.java b/src/main/java/net/buildtheearth/modules/navigation/components/warps/listeners/WarpJoinListener.java index 6771a91c..b140de92 100644 --- a/src/main/java/net/buildtheearth/modules/navigation/components/warps/listeners/WarpJoinListener.java +++ b/src/main/java/net/buildtheearth/modules/navigation/components/warps/listeners/WarpJoinListener.java @@ -1,8 +1,8 @@ package net.buildtheearth.modules.navigation.components.warps.listeners; +import com.alpsbte.alpslib.utils.ChatHelper; import net.buildtheearth.modules.navigation.NavigationModule; import net.buildtheearth.modules.navigation.components.warps.WarpsComponent; -import net.buildtheearth.utils.ChatHelper; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.player.PlayerJoinEvent; diff --git a/src/main/java/net/buildtheearth/modules/navigation/components/warps/menu/AddressTypeSelectionMenu.java b/src/main/java/net/buildtheearth/modules/navigation/components/warps/menu/AddressTypeSelectionMenu.java index 10321e68..d17b9a5e 100644 --- a/src/main/java/net/buildtheearth/modules/navigation/components/warps/menu/AddressTypeSelectionMenu.java +++ b/src/main/java/net/buildtheearth/modules/navigation/components/warps/menu/AddressTypeSelectionMenu.java @@ -1,9 +1,9 @@ package net.buildtheearth.modules.navigation.components.warps.menu; +import com.alpsbte.alpslib.utils.item.Item; import com.cryptomorin.xseries.XMaterial; import net.buildtheearth.BuildTeamTools; import net.buildtheearth.modules.navigation.components.warps.model.Warp; -import net.buildtheearth.utils.Item; import net.buildtheearth.utils.ListUtil; import net.buildtheearth.utils.MenuItems; import net.buildtheearth.utils.Utils; diff --git a/src/main/java/net/buildtheearth/modules/navigation/components/warps/menu/MaterialSelectionMenu.java b/src/main/java/net/buildtheearth/modules/navigation/components/warps/menu/MaterialSelectionMenu.java index 91352685..bfed7047 100644 --- a/src/main/java/net/buildtheearth/modules/navigation/components/warps/menu/MaterialSelectionMenu.java +++ b/src/main/java/net/buildtheearth/modules/navigation/components/warps/menu/MaterialSelectionMenu.java @@ -1,11 +1,15 @@ package net.buildtheearth.modules.navigation.components.warps.menu; +import com.alpsbte.alpslib.utils.ChatHelper; +import com.alpsbte.alpslib.utils.item.Item; import com.cryptomorin.xseries.XMaterial; import net.buildtheearth.BuildTeamTools; +import net.buildtheearth.modules.navigation.components.warps.model.Warp; import net.buildtheearth.modules.navigation.components.warps.model.WarpGroup; -import net.buildtheearth.utils.*; +import net.buildtheearth.utils.CustomHeads; +import net.buildtheearth.utils.ListUtil; +import net.buildtheearth.utils.MenuItems; import net.buildtheearth.utils.menus.AbstractMenu; -import net.buildtheearth.modules.navigation.components.warps.model.Warp; import net.buildtheearth.utils.menus.BookMenu; import net.wesjd.anvilgui.AnvilGUI; import org.bukkit.Sound; @@ -43,7 +47,7 @@ public MaterialSelectionMenu(Player menuPlayer, Object object, boolean alreadyEx @Override protected void setMenuItemsAsync() { - getMenu().getSlot(MATERIAL_SLOT).setItem(Item.create(XMaterial.STONE.parseMaterial(), "§6§lItem", ListUtil.createList("", "Change the material of the warp", "to a minecraft item.", "", "§eExample:", "Stone"))); + getMenu().getSlot(MATERIAL_SLOT).setItem(Item.create(XMaterial.STONE.get(), "§6§lItem", ListUtil.createList("", "Change the material of the warp", "to a minecraft item.", "", "§eExample:", "Stone"))); getMenu().getSlot(CUSTOM_HEAD_SLOT).setItem(CustomHeads.getLetterHead("?", CustomHeads.LetterType.WOODEN, "§6§lCustom Head", ListUtil.createList("", "Change the material of the warp", "to a custom head texture URL.", "", "§eExample:", "https://textures.minecraft.net/texture/..."))); if(object instanceof Warp) diff --git a/src/main/java/net/buildtheearth/modules/navigation/components/warps/menu/WarpEditMenu.java b/src/main/java/net/buildtheearth/modules/navigation/components/warps/menu/WarpEditMenu.java index 1a65bb87..4e52875f 100644 --- a/src/main/java/net/buildtheearth/modules/navigation/components/warps/menu/WarpEditMenu.java +++ b/src/main/java/net/buildtheearth/modules/navigation/components/warps/menu/WarpEditMenu.java @@ -1,14 +1,18 @@ package net.buildtheearth.modules.navigation.components.warps.menu; +import com.alpsbte.alpslib.utils.ChatHelper; +import com.alpsbte.alpslib.utils.item.Item; import com.cryptomorin.xseries.XMaterial; import net.buildtheearth.BuildTeamTools; +import net.buildtheearth.modules.navigation.components.warps.model.Warp; import net.buildtheearth.modules.network.NetworkModule; import net.buildtheearth.modules.network.api.OpenStreetMapAPI; import net.buildtheearth.modules.network.model.Permissions; -import net.buildtheearth.utils.*; +import net.buildtheearth.utils.CustomHeads; +import net.buildtheearth.utils.ListUtil; +import net.buildtheearth.utils.MenuItems; import net.buildtheearth.utils.geo.CoordinateConversion; import net.buildtheearth.utils.menus.AbstractMenu; -import net.buildtheearth.modules.navigation.components.warps.model.Warp; import net.wesjd.anvilgui.AnvilGUI; import org.bukkit.Location; import org.bukkit.Sound; diff --git a/src/main/java/net/buildtheearth/modules/navigation/components/warps/menu/WarpGroupEditMenu.java b/src/main/java/net/buildtheearth/modules/navigation/components/warps/menu/WarpGroupEditMenu.java index 2abc56e2..fc2707f5 100644 --- a/src/main/java/net/buildtheearth/modules/navigation/components/warps/menu/WarpGroupEditMenu.java +++ b/src/main/java/net/buildtheearth/modules/navigation/components/warps/menu/WarpGroupEditMenu.java @@ -1,14 +1,18 @@ package net.buildtheearth.modules.navigation.components.warps.menu; import com.alpsbte.alpslib.utils.AlpsUtils; +import com.alpsbte.alpslib.utils.ChatHelper; +import com.alpsbte.alpslib.utils.item.Item; import com.cryptomorin.xseries.XMaterial; import net.buildtheearth.BuildTeamTools; +import net.buildtheearth.modules.navigation.components.warps.model.WarpGroup; import net.buildtheearth.modules.network.NetworkModule; import net.buildtheearth.modules.network.model.Permissions; -import net.buildtheearth.utils.*; +import net.buildtheearth.utils.CustomHeads; +import net.buildtheearth.utils.ListUtil; +import net.buildtheearth.utils.MenuItems; import net.buildtheearth.utils.menus.AbstractMenu; import net.buildtheearth.utils.menus.BookMenu; -import net.buildtheearth.modules.navigation.components.warps.model.WarpGroup; import net.wesjd.anvilgui.AnvilGUI; import org.bukkit.Sound; import org.bukkit.entity.Player; diff --git a/src/main/java/net/buildtheearth/modules/navigation/components/warps/menu/WarpGroupMenu.java b/src/main/java/net/buildtheearth/modules/navigation/components/warps/menu/WarpGroupMenu.java index 235e32c4..b4f44a8b 100644 --- a/src/main/java/net/buildtheearth/modules/navigation/components/warps/menu/WarpGroupMenu.java +++ b/src/main/java/net/buildtheearth/modules/navigation/components/warps/menu/WarpGroupMenu.java @@ -1,5 +1,7 @@ package net.buildtheearth.modules.navigation.components.warps.menu; +import com.alpsbte.alpslib.utils.ChatHelper; +import com.alpsbte.alpslib.utils.item.Item; import com.google.gson.Gson; import net.buildtheearth.BuildTeamTools; import net.buildtheearth.modules.navigation.NavigationModule; @@ -7,9 +9,7 @@ import net.buildtheearth.modules.network.NetworkModule; import net.buildtheearth.modules.network.model.BuildTeam; import net.buildtheearth.modules.network.model.Permissions; -import net.buildtheearth.utils.ChatHelper; import net.buildtheearth.utils.CustomHeads; -import net.buildtheearth.utils.Item; import net.buildtheearth.utils.ListUtil; import net.buildtheearth.utils.MenuItems; import net.buildtheearth.utils.io.ConfigPaths; diff --git a/src/main/java/net/buildtheearth/modules/navigation/components/warps/menu/WarpMenu.java b/src/main/java/net/buildtheearth/modules/navigation/components/warps/menu/WarpMenu.java index d80c4438..b35247ef 100644 --- a/src/main/java/net/buildtheearth/modules/navigation/components/warps/menu/WarpMenu.java +++ b/src/main/java/net/buildtheearth/modules/navigation/components/warps/menu/WarpMenu.java @@ -1,12 +1,12 @@ package net.buildtheearth.modules.navigation.components.warps.menu; +import com.alpsbte.alpslib.utils.item.Item; import net.buildtheearth.modules.navigation.NavigationModule; import net.buildtheearth.modules.navigation.components.warps.model.Warp; import net.buildtheearth.modules.navigation.components.warps.model.WarpGroup; import net.buildtheearth.modules.network.NetworkModule; import net.buildtheearth.modules.network.model.Permissions; import net.buildtheearth.utils.CustomHeads; -import net.buildtheearth.utils.Item; import net.buildtheearth.utils.ListUtil; import net.buildtheearth.utils.MenuItems; import net.buildtheearth.utils.menus.AbstractPaginatedMenu; diff --git a/src/main/java/net/buildtheearth/modules/navigation/components/warps/model/Warp.java b/src/main/java/net/buildtheearth/modules/navigation/components/warps/model/Warp.java index ac5d7039..3eb5bd0b 100644 --- a/src/main/java/net/buildtheearth/modules/navigation/components/warps/model/Warp.java +++ b/src/main/java/net/buildtheearth/modules/navigation/components/warps/model/Warp.java @@ -1,9 +1,12 @@ package net.buildtheearth.modules.navigation.components.warps.model; +import com.alpsbte.alpslib.utils.item.Item; import lombok.AllArgsConstructor; import lombok.Getter; import lombok.Setter; -import net.buildtheearth.utils.*; +import net.buildtheearth.utils.CustomHeads; +import net.buildtheearth.utils.ListUtil; +import net.buildtheearth.utils.Utils; import org.bukkit.Material; import org.bukkit.inventory.ItemStack; import org.json.JSONObject; diff --git a/src/main/java/net/buildtheearth/modules/navigation/components/warps/model/WarpGroup.java b/src/main/java/net/buildtheearth/modules/navigation/components/warps/model/WarpGroup.java index e51282e8..6499973e 100644 --- a/src/main/java/net/buildtheearth/modules/navigation/components/warps/model/WarpGroup.java +++ b/src/main/java/net/buildtheearth/modules/navigation/components/warps/model/WarpGroup.java @@ -1,10 +1,10 @@ package net.buildtheearth.modules.navigation.components.warps.model; +import com.alpsbte.alpslib.utils.item.Item; import lombok.Getter; import lombok.Setter; import net.buildtheearth.modules.network.model.BuildTeam; import net.buildtheearth.utils.CustomHeads; -import net.buildtheearth.utils.Item; import net.buildtheearth.utils.ListUtil; import org.bukkit.Material; import org.bukkit.inventory.ItemStack; diff --git a/src/main/java/net/buildtheearth/modules/navigation/menu/CountrySelectorMenu.java b/src/main/java/net/buildtheearth/modules/navigation/menu/CountrySelectorMenu.java index aafb89d1..868abbaa 100644 --- a/src/main/java/net/buildtheearth/modules/navigation/menu/CountrySelectorMenu.java +++ b/src/main/java/net/buildtheearth/modules/navigation/menu/CountrySelectorMenu.java @@ -1,5 +1,7 @@ package net.buildtheearth.modules.navigation.menu; +import com.alpsbte.alpslib.utils.ChatHelper; +import com.alpsbte.alpslib.utils.item.Item; import lombok.NonNull; import net.buildtheearth.modules.navigation.NavUtils; import net.buildtheearth.modules.navigation.components.warps.WarpsComponent; @@ -8,8 +10,6 @@ import net.buildtheearth.modules.network.model.Continent; import net.buildtheearth.modules.network.model.Permissions; import net.buildtheearth.modules.network.model.Region; -import net.buildtheearth.utils.ChatHelper; -import net.buildtheearth.utils.Item; import net.buildtheearth.utils.ListUtil; import net.buildtheearth.utils.MenuItems; import net.buildtheearth.utils.menus.AbstractPaginatedMenu; diff --git a/src/main/java/net/buildtheearth/modules/navigation/menu/ExploreMenu.java b/src/main/java/net/buildtheearth/modules/navigation/menu/ExploreMenu.java index ba3a6a97..c29be7fc 100644 --- a/src/main/java/net/buildtheearth/modules/navigation/menu/ExploreMenu.java +++ b/src/main/java/net/buildtheearth/modules/navigation/menu/ExploreMenu.java @@ -1,10 +1,10 @@ package net.buildtheearth.modules.navigation.menu; +import com.alpsbte.alpslib.utils.ChatHelper; +import com.alpsbte.alpslib.utils.item.Item; import com.cryptomorin.xseries.XMaterial; import net.buildtheearth.modules.network.model.Continent; -import net.buildtheearth.utils.ChatHelper; -import net.buildtheearth.utils.Item; import net.buildtheearth.utils.MenuItems; import net.buildtheearth.utils.menus.AbstractMenu; import org.bukkit.entity.Player; diff --git a/src/main/java/net/buildtheearth/modules/navigation/menu/MainMenu.java b/src/main/java/net/buildtheearth/modules/navigation/menu/MainMenu.java index 1d9b7dbc..db12d2eb 100644 --- a/src/main/java/net/buildtheearth/modules/navigation/menu/MainMenu.java +++ b/src/main/java/net/buildtheearth/modules/navigation/menu/MainMenu.java @@ -1,12 +1,12 @@ package net.buildtheearth.modules.navigation.menu; +import com.alpsbte.alpslib.utils.ChatHelper; +import com.alpsbte.alpslib.utils.item.Item; import com.cryptomorin.xseries.XMaterial; import net.buildtheearth.BuildTeamTools; import net.buildtheearth.modules.navigation.NavUtils; import net.buildtheearth.modules.navigation.components.warps.WarpsComponent; import net.buildtheearth.modules.network.NetworkModule; -import net.buildtheearth.utils.ChatHelper; -import net.buildtheearth.utils.Item; import net.buildtheearth.utils.MenuItems; import net.buildtheearth.utils.io.ConfigPaths; import net.buildtheearth.utils.io.ConfigUtil; @@ -19,12 +19,7 @@ import org.ipvp.canvas.mask.Mask; import org.jetbrains.annotations.NotNull; -import java.util.ArrayDeque; -import java.util.ArrayList; -import java.util.Collections; -import java.util.Deque; -import java.util.List; -import java.util.Objects; +import java.util.*; /** * The main menu for the BTE universal navigator.
diff --git a/src/main/java/net/buildtheearth/modules/navigation/menu/StateSelectorMenu.java b/src/main/java/net/buildtheearth/modules/navigation/menu/StateSelectorMenu.java index a239bc8f..6f4bf270 100644 --- a/src/main/java/net/buildtheearth/modules/navigation/menu/StateSelectorMenu.java +++ b/src/main/java/net/buildtheearth/modules/navigation/menu/StateSelectorMenu.java @@ -1,12 +1,12 @@ package net.buildtheearth.modules.navigation.menu; +import com.alpsbte.alpslib.utils.ChatHelper; +import com.alpsbte.alpslib.utils.item.Item; import lombok.NonNull; import net.buildtheearth.modules.navigation.NavUtils; import net.buildtheearth.modules.network.NetworkModule; import net.buildtheearth.modules.network.model.Region; import net.buildtheearth.modules.network.model.RegionType; -import net.buildtheearth.utils.ChatHelper; -import net.buildtheearth.utils.Item; import net.buildtheearth.utils.ListUtil; import net.buildtheearth.utils.MenuItems; import net.buildtheearth.utils.menus.AbstractPaginatedMenu; diff --git a/src/main/java/net/buildtheearth/modules/network/api/NetworkAPI.java b/src/main/java/net/buildtheearth/modules/network/api/NetworkAPI.java index f63fcfa4..d15061d8 100644 --- a/src/main/java/net/buildtheearth/modules/network/api/NetworkAPI.java +++ b/src/main/java/net/buildtheearth/modules/network/api/NetworkAPI.java @@ -1,5 +1,6 @@ package net.buildtheearth.modules.network.api; +import com.alpsbte.alpslib.utils.ChatHelper; import lombok.experimental.UtilityClass; import net.buildtheearth.BuildTeamTools; import net.buildtheearth.modules.navigation.NavUtils; @@ -10,7 +11,6 @@ import net.buildtheearth.modules.network.model.Continent; import net.buildtheearth.modules.network.model.Region; import net.buildtheearth.modules.network.model.RegionType; -import net.buildtheearth.utils.ChatHelper; import net.buildtheearth.utils.io.ConfigPaths; import okhttp3.MediaType; import okhttp3.RequestBody; diff --git a/src/main/java/net/buildtheearth/modules/network/api/OpenStreetMapAPI.java b/src/main/java/net/buildtheearth/modules/network/api/OpenStreetMapAPI.java index 41cd903e..b9406963 100644 --- a/src/main/java/net/buildtheearth/modules/network/api/OpenStreetMapAPI.java +++ b/src/main/java/net/buildtheearth/modules/network/api/OpenStreetMapAPI.java @@ -1,6 +1,6 @@ package net.buildtheearth.modules.network.api; -import net.buildtheearth.utils.ChatHelper; +import com.alpsbte.alpslib.utils.ChatHelper; import org.jetbrains.annotations.NotNull; import org.json.simple.JSONArray; import org.json.simple.JSONObject; diff --git a/src/main/java/net/buildtheearth/modules/network/model/BuildTeam.java b/src/main/java/net/buildtheearth/modules/network/model/BuildTeam.java index 3472a30c..825b6f8e 100644 --- a/src/main/java/net/buildtheearth/modules/network/model/BuildTeam.java +++ b/src/main/java/net/buildtheearth/modules/network/model/BuildTeam.java @@ -1,12 +1,12 @@ package net.buildtheearth.modules.network.model; +import com.alpsbte.alpslib.utils.ChatHelper; import lombok.Getter; import net.buildtheearth.modules.navigation.components.warps.model.Warp; import net.buildtheearth.modules.navigation.components.warps.model.WarpGroup; import net.buildtheearth.modules.network.NetworkModule; import net.buildtheearth.modules.network.api.API; import net.buildtheearth.modules.network.api.NetworkAPI; -import net.buildtheearth.utils.ChatHelper; import org.bukkit.entity.Player; import java.io.IOException; diff --git a/src/main/java/net/buildtheearth/modules/stats/menu/StatsMenu.java b/src/main/java/net/buildtheearth/modules/stats/menu/StatsMenu.java index 0745c4d1..7e18e47f 100644 --- a/src/main/java/net/buildtheearth/modules/stats/menu/StatsMenu.java +++ b/src/main/java/net/buildtheearth/modules/stats/menu/StatsMenu.java @@ -1,11 +1,11 @@ package net.buildtheearth.modules.stats.menu; +import com.alpsbte.alpslib.utils.item.Item; import com.cryptomorin.xseries.XMaterial; import net.buildtheearth.modules.stats.StatsModule; import net.buildtheearth.modules.stats.model.StatsPlayer; import net.buildtheearth.modules.stats.model.StatsServer; import net.buildtheearth.utils.CustomHeads; -import net.buildtheearth.utils.Item; import net.buildtheearth.utils.ListUtil; import net.buildtheearth.utils.MenuItems; import net.buildtheearth.utils.menus.AbstractMenu; diff --git a/src/main/java/net/buildtheearth/utils/ChatHelper.java b/src/main/java/net/buildtheearth/utils/ChatHelper.java deleted file mode 100644 index 43020a0b..00000000 --- a/src/main/java/net/buildtheearth/utils/ChatHelper.java +++ /dev/null @@ -1,165 +0,0 @@ -package net.buildtheearth.utils; - -import net.buildtheearth.BuildTeamTools; -import net.buildtheearth.utils.io.ConfigPaths; -import net.kyori.adventure.text.Component; -import net.kyori.adventure.text.TextComponent; -import net.kyori.adventure.text.format.NamedTextColor; -import net.kyori.adventure.text.format.TextDecoration; -import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer; -import org.bukkit.Bukkit; -import org.bukkit.Location; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; -import org.jetbrains.annotations.Nullable; - -import java.util.Arrays; -import java.util.logging.Level; - -public class ChatHelper { - - public static TextComponent PREFIX_COMPONENT = LegacyComponentSerializer.legacyAmpersand().deserialize(BuildTeamTools.PREFIX); - - public static boolean DEBUG; - - static { - BuildTeamTools.getInstance().getConfig(); - DEBUG = BuildTeamTools.getInstance().getConfig().getBoolean(ConfigPaths.DEBUG, false); - } - - - // ------------------ LOGGING ------------------ - - public static void logError(String errorMessage, Object... objects) { - Bukkit.getLogger().log(Level.INFO, ChatHelper.getErrorString(errorMessage, objects)); - } - - public static void logError(String errorMessage, Exception e, Object... objects) { - BuildTeamTools.getInstance().getComponentLogger().error(ChatHelper.getErrorComponent(errorMessage, objects), e); - } - - public static void log(String string, Object... objects) { - Bukkit.getConsoleSender().sendMessage( getConsoleString(string, objects)); - } - - public static void logDebug(String string, Object... objects) { - if(DEBUG || BuildTeamTools.getInstance().isDebug()) - Bukkit.getLogger().log(Level.INFO, getConsoleString(string, objects)); - } - - public static String getConsoleString(String string, Object... objects) { - return BuildTeamTools.CONSOLE_PREFIX + String.format(string, objects); - } - - - - // ------------------ STANDARD TEXT (Gray & Yellow) ------------------ - - public static Component getStandardComponent(boolean containsPrefix, String string, Object... objects) { - Component component = LegacyComponentSerializer.legacyAmpersand().deserialize( - String.format(string.replaceAll("%s", "&e%s&7"), objects) - ).color(NamedTextColor.GRAY); - - return containsPrefix ? PREFIX_COMPONENT.append(component) : component; - } - - public static String getStandardString(boolean containsPrefix, String string, Object... objects) { - return convertComponentToLegacyString(getStandardComponent(containsPrefix, string, objects)); - } - - public static String getStandardString(String string, Object... objects) { - return getStandardString(true, string, objects); - } - - public static void sendStandardMessage(Player player, String string, Object... objects) { - player.sendMessage(getStandardComponent(true, string, objects)); - } - - public static void sendStandardMessage(Player player, boolean containsPrefix, String string, Object... objects) { - player.sendMessage(getStandardComponent(containsPrefix, string, objects)); - } - - - // ------------------ SUCCESS TEXT (Gray & Green Text) ------------------ - - public static Component getSuccessComponent(String string, Object... objects) { - return PREFIX_COMPONENT.append( - LegacyComponentSerializer.legacyAmpersand().deserialize( - String.format(string.replaceAll("%s", "&a%s&7"), objects) - ).color(NamedTextColor.GRAY) - ); - } - - public static void sendSuccessfulMessage(Player player, String string, Object... objects) { - player.sendMessage(getSuccessComponent(string, objects)); - } - - - - // ------------------ ERROR TEXT (Red & Yellow Text) ------------------ - - public static Component getErrorComponent(String string, Object... objects) { - return LegacyComponentSerializer.legacyAmpersand().deserialize( - String.format(string.replaceAll("%s", "&e%s&c"), objects) - ).color(NamedTextColor.RED); - } - - public static String getErrorString(String string, Object... objects) { - return convertComponentToLegacyString(getErrorComponent(string, objects)); - } - - public static void sendErrorMessage(Player player, String string, Object... objects) { - player.sendMessage(getErrorString(string, objects)); - } - - - // ------------------ COLORIZED TEXT ------------------ - - public static Component getColorizedComponent(NamedTextColor color, String string, boolean bold) { - return Component.text(string).color(color).decoration(TextDecoration.BOLD, bold); - } - - public static String getColorizedString(NamedTextColor color, String string, boolean bold) { - return convertComponentToLegacyString(getColorizedComponent(color, string, bold)); - } - - - - /** Sends the given message to the given player and the console - * - * @param p player to send the message to. If null, the message will only be sent to the console - * @param message message to send - * @param logLevel log level to use for the console - */ - public static void logPlayerAndConsole(@Nullable Player p, String message, Level logLevel){ - if(p != null) - p.sendMessage(message); - - BuildTeamTools.getInstance().getLogger().log(logLevel, message); - } - - public static void sendMessageBox(CommandSender sender, String title, Runnable runnable) { - sender.sendMessage(""); - sender.sendMessage("§7§m==============§e§l " + title + " §7§m=============="); - sender.sendMessage(""); - - runnable.run(); - - int length = org.bukkit.ChatColor.stripColor(title).length(); - char[] array = new char[length]; - Arrays.fill(array, '='); - String bottom = "==============================" + new String(array); - sender.sendMessage(""); - sender.sendMessage("§7§m" + bottom); - } - - public static void sendMessageToPlayersNearLocation(Location location, String message, double maxDistance) { - for (Player player : location.getWorld().getNearbyEntitiesByType(Player.class, location, maxDistance)) { - player.sendMessage(message); - } - } - - private static String convertComponentToLegacyString(Component component) { - return LegacyComponentSerializer.legacyAmpersand().serialize(component).replace("&", "§"); - } -} diff --git a/src/main/java/net/buildtheearth/utils/CustomHeads.java b/src/main/java/net/buildtheearth/utils/CustomHeads.java index a9866201..f29317d1 100644 --- a/src/main/java/net/buildtheearth/utils/CustomHeads.java +++ b/src/main/java/net/buildtheearth/utils/CustomHeads.java @@ -1,5 +1,6 @@ package net.buildtheearth.utils; +import com.alpsbte.alpslib.utils.item.Item; import org.bukkit.inventory.ItemStack; import java.util.ArrayList; diff --git a/src/main/java/net/buildtheearth/utils/Item.java b/src/main/java/net/buildtheearth/utils/Item.java deleted file mode 100644 index 0b37f465..00000000 --- a/src/main/java/net/buildtheearth/utils/Item.java +++ /dev/null @@ -1,513 +0,0 @@ -package net.buildtheearth.utils; - -import com.cryptomorin.xseries.XMaterial; -import com.cryptomorin.xseries.profiles.builder.XSkull; -import com.cryptomorin.xseries.profiles.objects.Profileable; -import com.sk89q.worldedit.world.block.BlockType; -import com.sk89q.worldedit.world.block.BlockTypes; -import org.bukkit.Bukkit; -import org.bukkit.Color; -import org.bukkit.Material; -import org.bukkit.enchantments.Enchantment; -import org.bukkit.inventory.ItemFlag; -import org.bukkit.inventory.ItemStack; -import org.bukkit.inventory.meta.ItemMeta; -import org.bukkit.inventory.meta.LeatherArmorMeta; -import org.bukkit.inventory.meta.SkullMeta; -import org.jetbrains.annotations.Contract; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; -import org.jspecify.annotations.NonNull; - -import java.util.*; -import java.util.concurrent.ConcurrentHashMap; - -/** - * This class provides static utility methods and a fluent builder API for creating and modifying {@link ItemStack} objects in Bukkit.
- * It supports the customization of items with names, lore, enchantments, attributes, and skull textures. - *

- * The following dependencies are required: - *
    - *
  1. Bukkit API
  2. - *
  3. HeadDatabaseAPI
  4. (removed for BuildTeamTools) - *
  5. XMaterial from XSeries
  6. - *
- * - *
- * The functions are categorized into the following sections: - * - *

Builder Pattern Methods: - *
These methods allow chaining item properties using a fluent API: - *
• {@link #setDisplayName(String)} - *
• {@link #setAmount(int)} - *
• {@link #setLore(List)} - *
• {@link #addEnchantment(Enchantment, int)} - *
• {@link #hideAttributes(boolean)} - *
• {@link #hideEnchantments(boolean)} - *
• {@link #build()} - * - *

Item Creation Methods: - *
Static methods to quickly create customized {@link ItemStack} instances: - *
• {@link #create(Material)} - *
• {@link #create(Material, int)} - *
• {@link #create(Material, String)} - *
• {@link #create(Material, String, int)} - *
• {@link #create(Material, String, List)} - *
• {@link #create(Material, String, short, List)} - *
• {@link #create(Material, String, int, List)} - *
• {@link #create(Material, String, List, Enchantment, Integer)} - *
• {@link #create(Material, String, List, Enchantment, Integer, Enchantment, Integer)} - *
• {@link #create(Material, String, List, Enchantment, Integer, Enchantment, Integer, Enchantment, Integer)} - * - *

Leather Armor Creation Methods: - *
Special methods for creating and coloring leather armor: - *
• {@link #createLeatherArmor(Material, Color)} - *
• {@link #createLeatherArmor(Material, String, Color, List)} - *
• {@link #createLeatherArmor(Material, String, Color, List, Enchantment, Integer)} - *
• {@link #createLeatherArmor(Material, String, Color, List, Enchantment, Integer, Enchantment, Integer)} - *
• {@link #createLeatherArmor(Material, String, Color, List, Enchantment, Integer, Enchantment, Integer, Enchantment, Integer)} - * - *

Item Editing Methods: - *
Modify existing {@link ItemStack} objects: - *
• {@link #edit(ItemStack, Material)} - *
• {@link #edit(ItemStack, int)} - *
• {@link #edit(ItemStack, String)} - *
• {@link #edit(ItemStack, int, String)} - *
• {@link #edit(ItemStack, List)} - *
• {@link #edit(ItemStack, int, String, List)} - * - *

Material Conversion Utilities: - *
Utility methods to convert between {@link Material}, {@link XMaterial}, and {@link ItemStack} representations: - *
• {@link #fromUniqueMaterialString(String)} – Converts a namespaced string to an {@link ItemStack}. - *
• {@link #getUniqueMaterialString(ItemStack)} – Gets the namespaced key of an {@link ItemStack}'s material. - *
• {@link #getUniqueMaterialString(XMaterial)} – Gets the namespaced key of an {@link XMaterial}. - *
• {@link #getUniqueMaterialString(XMaterial[])} – Gets a comma-separated list of namespaced keys from multiple {@link XMaterial}s. - *
• {@link #convertStringToXMaterial(String)} – Converts a string to an {@link XMaterial}, fallback to Bukkit {@link Material} if needed. - *
• {@link #convertXMaterialToWEBlockType(XMaterial)} – Converts an {@link XMaterial} to a WorldEdit {@link BlockType}. - *
• {@link #createStringFromItemStringList(ArrayList)} – Converts a list of material strings to a comma-separated namespaced material string. - *
• {@link #createStringFromItemStringList(String...)} – Converts an array of material strings to a comma-separated namespaced material string. - * - *

Skull Creation Methods: - *
Utility methods to create player and custom skulls: - *
• {@link #createPlayerHead(String, String)} - *
• {@link #createPlayerHead(String, String, List)} - *
• {@link #createPlayerHead(String, String, int, List)} - * - * @version 1.3.4 - * @author MineFact, Zoriot - */ -@SuppressWarnings({"deprecation", "unused"}) -public class Item { - public static final Map nonPlayerSkulls = new ConcurrentHashMap<>(); - - private ItemStack item; - - private Material material; - - private String displayName; - - private int amount = 1; - - private List lore; - - private boolean hideAttributes; - - private boolean hideEnchantments; - - private final Map enchantments = new HashMap<>(); - - public Item(Material material) { - this.material = material; - } - - public Item(ItemStack item) { - this.item = item; - } - - public Item setDisplayName(String name) { - this.displayName = name; - return this; - } - - public Item setAmount(int amount) { - this.amount = amount; - return this; - } - - public Item setLore(List lore) { - this.lore = lore; - return this; - } - - public Item addEnchantment(Enchantment enchantment, int level) { - this.enchantments.put(enchantment, level); - return this; - } - - public Item hideAttributes(boolean hide) { - this.hideAttributes = hide; - return this; - } - - public Item hideEnchantments(boolean enchants) { - this.hideEnchantments = enchants; - return this; - } - - public ItemStack build() { - ItemStack item; - if (this.item != null) - item = this.item.clone(); - else - item = new ItemStack(this.material); - - item.setAmount(this.amount); - - for (Enchantment en : this.enchantments.keySet()) - item.addUnsafeEnchantment(en, this.enchantments.get(en)); - - ItemMeta itemmeta = item.getItemMeta(); - itemmeta.setDisplayName(this.displayName); - itemmeta.setLore(this.lore); - if (this.hideAttributes) itemmeta.addItemFlags(ItemFlag.HIDE_ATTRIBUTES); - if (this.hideEnchantments) itemmeta.addItemFlags(ItemFlag.HIDE_ENCHANTS); - item.setItemMeta(itemmeta); - return item; - } - - - // ============================== - // SECTION: Item Creation Methods - // ============================== - - - private static @NonNull ItemStack createItem(Material material, String name, int amount, List lore, - Map enchantments) { - ItemStack item = new ItemStack(material, amount); - if (enchantments != null) - for (Map.Entry e : enchantments.entrySet()) - item.addUnsafeEnchantment(e.getKey(), e.getValue()); - - ItemMeta meta = item.getItemMeta(); - if (name != null) - meta.setDisplayName(name); - if (lore != null) - meta.setLore(lore); - meta.addItemFlags(ItemFlag.HIDE_ATTRIBUTES); - item.setItemMeta(meta); - return item; - } - - private static @NonNull ItemStack createLeatherArmorItem(Material material, String name, Color color, - List lore, Map enchantments) { - ItemStack item = new ItemStack(material); - if (enchantments != null) - for (Map.Entry e : enchantments.entrySet()) - item.addUnsafeEnchantment(e.getKey(), e.getValue()); - - - LeatherArmorMeta meta = (LeatherArmorMeta) item.getItemMeta(); - if (name != null) - meta.setDisplayName(name); - if (lore != null) - meta.setLore(lore); - meta.setColor(color); - meta.addItemFlags(ItemFlag.HIDE_ATTRIBUTES); - item.setItemMeta(meta); - return item; - } - - @Contract("_ -> new") - public static @NonNull ItemStack create(Material material) { - return new ItemStack(material); - } - - @Contract("_, _ -> new") - public static @NonNull ItemStack create(Material material, int amount) { - return new ItemStack(material, amount); - } - - public static @NonNull ItemStack create(Material material, String name) { - return createItem(material, name, 1, null, null); - } - - public static @NonNull ItemStack create(Material material, String name, int amount) { - return createItem(material, name, amount, null, null); - } - - public static @NonNull ItemStack create(Material material, String name, List lore) { - return createItem(material, name, 1, lore, null); - } - - public static @NonNull ItemStack create(Material material, String name, short durability, List lore) { - ItemStack item = createItem(material, name, 1, lore, null); - item.setDurability(durability); - return item; - } - - public static @NonNull ItemStack create(Material material, String name, int amount, List lore) { - return createItem(material, name, amount, lore, null); - } - - public static @NonNull ItemStack createLeatherArmor(Material material, String name, Color color, List lore) { - return createLeatherArmorItem(material, name, color, lore, null); - } - - public static @NonNull ItemStack create(Material material, String name, List lore, Enchantment enchantment1, Integer level1) { - Map enchantments = new HashMap<>(); - enchantments.put(enchantment1, level1); - return createItem(material, name, 1, lore, enchantments); - } - - public static @NonNull ItemStack create(Material material, String name, List lore, Enchantment enchantment, Integer level1, Enchantment enchantment2, Integer level2) { - Map enchantments = new HashMap<>(); - enchantments.put(enchantment, level1); - enchantments.put(enchantment2, level2); - return createItem(material, name, 1, lore, enchantments); - } - - public static @NonNull ItemStack create(Material material, String name, List lore, Enchantment enchantment, Integer level1, Enchantment enchantment2, Integer level2, Enchantment enchantment3, Integer level3) { - Map enchantments = new HashMap<>(); - enchantments.put(enchantment, level1); - enchantments.put(enchantment2, level2); - enchantments.put(enchantment3, level3); - return createItem(material, name, 1, lore, enchantments); - } - - public static @NonNull ItemStack createLeatherArmor(Material material, Color color) { - LeatherArmorMeta itemMeta = (LeatherArmorMeta) new ItemStack(material).getItemMeta(); - itemMeta.setColor(color); - itemMeta.addItemFlags(ItemFlag.HIDE_ATTRIBUTES); - ItemStack item = new ItemStack(material); - item.setItemMeta(itemMeta); - return item; - } - - public static @NonNull ItemStack createLeatherArmor(Material material, String name, Color color, List lore, Enchantment enchantment, Integer level1) { - Map enchantments = new HashMap<>(); - enchantments.put(enchantment, level1); - return createLeatherArmorItem(material, name, color, lore, enchantments); - } - - public static @NonNull ItemStack createLeatherArmor(Material material, String name, Color color, List lore, Enchantment enchantment, Integer level1, Enchantment enchantment2, Integer level2) { - Map enchantments = new HashMap<>(); - enchantments.put(enchantment, level1); - enchantments.put(enchantment2, level2); - return createLeatherArmorItem(material, name, color, lore, enchantments); - } - - public static @NonNull ItemStack createLeatherArmor(Material material, String name, Color color, List lore, Enchantment enchantment, Integer level1, Enchantment enchantment2, Integer level2, Enchantment enchantment3, Integer level3) { - Map enchantments = new HashMap<>(); - enchantments.put(enchantment, level1); - enchantments.put(enchantment2, level2); - enchantments.put(enchantment3, level3); - return createLeatherArmorItem(material, name, color, lore, enchantments); - } - - // ============================== - // SECTION: Skull Creation Methods - // ============================== - - public static @NonNull ItemStack createPlayerHead(String name, String owner) { - ItemStack item = new ItemStack(Material.PLAYER_HEAD); - SkullMeta itemMeta = (SkullMeta) item.getItemMeta(); - itemMeta.setDisplayName(name); - itemMeta.setOwningPlayer(Bukkit.getOfflinePlayer(owner)); - itemMeta.addItemFlags(ItemFlag.HIDE_ATTRIBUTES); - item.setItemMeta(itemMeta); - return item; - } - - public static @NonNull ItemStack createPlayerHead(String name, String owner, List lore) { - ItemStack item = new ItemStack(Material.PLAYER_HEAD); - SkullMeta itemMeta = (SkullMeta) item.getItemMeta(); - itemMeta.setDisplayName(name); - itemMeta.setOwningPlayer(Bukkit.getOfflinePlayer(owner)); - itemMeta.setLore(lore); - itemMeta.addItemFlags(ItemFlag.HIDE_ATTRIBUTES); - item.setItemMeta(itemMeta); - return item; - } - - public static @NonNull ItemStack createPlayerHead(String name, String owner, int amount, List lore) { - var item = createPlayerHead(name, owner, lore); - return edit(item, amount); - } - - // ============================== - // SECTION: Item Editing Methods - // ============================== - - @Contract("_, _ -> param1") - public static @NotNull ItemStack edit(@NotNull ItemStack item, Material material) { - item.setType(material); - return item; - } - - @Contract("_, _ -> param1") - public static @NotNull ItemStack edit(@NotNull ItemStack item, int amount) { - item.setAmount(amount); - return item; - } - - @Contract("_, _ -> param1") - public static @NotNull ItemStack edit(@NotNull ItemStack item, String name) { - ItemMeta itemmeta = item.getItemMeta(); - itemmeta.setDisplayName(name); - itemmeta.addItemFlags(ItemFlag.HIDE_ATTRIBUTES); - item.setItemMeta(itemmeta); - return item; - } - - @Contract("_, _, _ -> param1") - public static @NotNull ItemStack edit(@NotNull ItemStack item, int amount, String name) { - item.setAmount(amount); - ItemMeta itemmeta = item.getItemMeta(); - itemmeta.setDisplayName(name); - itemmeta.addItemFlags(ItemFlag.HIDE_ATTRIBUTES); - item.setItemMeta(itemmeta); - return item; - } - - @Contract("_, _ -> param1") - public static @NotNull ItemStack edit(@NotNull ItemStack item, List lore) { - ItemMeta itemmeta = item.getItemMeta(); - itemmeta.setLore(lore); - itemmeta.addItemFlags(ItemFlag.HIDE_ATTRIBUTES); - item.setItemMeta(itemmeta); - return item; - } - - @Contract("_, _, _, _ -> param1") - public static @NotNull ItemStack edit(@NotNull ItemStack item, int amount, String name, List lore) { - item.setAmount(amount); - ItemMeta itemmeta = item.getItemMeta(); - itemmeta.setDisplayName(name); - itemmeta.addItemFlags(ItemFlag.HIDE_ATTRIBUTES); - itemmeta.setLore(lore); - item.setItemMeta(itemmeta); - return item; - } - - // ====================================== - // SECTION: Material Conversion Utilities - // ====================================== - - public static @Nullable ItemStack fromUniqueMaterialString(String materialString) { - Material material = Material.matchMaterial(materialString); - if(material != null) - return XMaterial.matchXMaterial(material).parseItem(); - - - if(XMaterial.matchXMaterial(materialString).isPresent()) - return XMaterial.matchXMaterial(materialString).get().parseItem(); - - return null; - } - - public static @NonNull String getUniqueMaterialString(@NonNull ItemStack item) { - return item.getType().name(); - } - - - public static String getUniqueMaterialString(XMaterial material) { - if (material == null) - return null; - - ItemStack item = material.parseItem(); - if (item == null) - return null; - - return getUniqueMaterialString(item); - } - - public static String getUniqueMaterialString(XMaterial[] materials) { - if (materials == null || materials.length == 0) - return null; - - StringBuilder s = new StringBuilder(getUniqueMaterialString(materials[0])); - - for (int i = 1; i < materials.length; i++) - s.append(",").append(getUniqueMaterialString(materials[i])); - - return s.toString(); - } - - public static @org.jspecify.annotations.Nullable XMaterial convertStringToXMaterial(String materialString) { - XMaterial material; - - if (XMaterial.matchXMaterial(materialString).isPresent()) - material = XMaterial.matchXMaterial(materialString).get(); - else { - Material mat = Material.matchMaterial(materialString); - - if (mat != null) - material = XMaterial.matchXMaterial(mat); - else - return null; - } - - return material; - } - - public static BlockType convertXMaterialToWEBlockType(XMaterial material) { - String mat = getUniqueMaterialString(material); - BlockType bt; - - if (mat.contains("minecraft:")) - bt = BlockTypes.parse(mat); - else - bt = BlockTypes.get(mat); - - return bt; - } - - public static @NonNull String createStringFromItemStringList(@NonNull List items) throws IllegalArgumentException { - StringBuilder s = new StringBuilder(); - - for (int i = 0; i < items.size(); i++) - if (XMaterial.matchXMaterial(items.get(i)).isPresent()) { - var curItem = items.get(i); - var material = XMaterial.matchXMaterial(curItem); - XMaterial xMaterial = material.get(); - ItemStack item = xMaterial.parseItem(); - - if (item == null) - continue; - - if (i > 0) s.append(","); - s.append(getUniqueMaterialString(item)); - } - return s.toString(); - } - - public static @NonNull String createStringFromItemStringList(String... items) throws IllegalArgumentException { - return createStringFromItemStringList(new ArrayList<>(Arrays.asList(items))); - } - - public static ItemStack createCustomHeadTextureURL(String url, String name, List lore) { - byte[] encodedByteData = Base64.getEncoder().encode(String.format("{textures:{SKIN:{url:\"%s\"}}}", url).getBytes()); - String encodedData = new String(encodedByteData); - - return createCustomHeadBase64(encodedData, name, lore); - } - - public static @Nullable ItemStack createCustomHeadBase64(String base64, String name, List lore) { - if (nonPlayerSkulls.containsKey(base64 + name + lore)) - return nonPlayerSkulls.get(base64 + name + lore); - - ItemStack head = XMaterial.PLAYER_HEAD.parseItem(); - - if(head == null) - return null; - - ItemMeta meta = XSkull.of(head).profile(Profileable.detect(base64)).apply().getItemMeta(); - meta.setDisplayName(name); - meta.setLore(lore); - head.setItemMeta(meta); - - nonPlayerSkulls.put(base64 + name + lore, head); - - return head; - } -} diff --git a/src/main/java/net/buildtheearth/utils/MenuItems.java b/src/main/java/net/buildtheearth/utils/MenuItems.java index f4e1cc29..8ab36efd 100644 --- a/src/main/java/net/buildtheearth/utils/MenuItems.java +++ b/src/main/java/net/buildtheearth/utils/MenuItems.java @@ -1,5 +1,6 @@ package net.buildtheearth.utils; +import com.alpsbte.alpslib.utils.item.Item; import com.cryptomorin.xseries.XMaterial; import org.bukkit.Material; import org.bukkit.inventory.ItemStack; diff --git a/src/main/java/net/buildtheearth/utils/menus/AbstractMenu.java b/src/main/java/net/buildtheearth/utils/menus/AbstractMenu.java index 1b588b8f..8b26a7bf 100644 --- a/src/main/java/net/buildtheearth/utils/menus/AbstractMenu.java +++ b/src/main/java/net/buildtheearth/utils/menus/AbstractMenu.java @@ -1,10 +1,9 @@ package net.buildtheearth.utils.menus; +import com.alpsbte.alpslib.utils.item.Item; import com.cryptomorin.xseries.XMaterial; import net.buildtheearth.BuildTeamTools; -import net.buildtheearth.utils.ChatHelper; import net.buildtheearth.utils.CustomHeads; -import net.buildtheearth.utils.Item; import net.kyori.adventure.text.Component; import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer; import org.bukkit.Bukkit; diff --git a/src/main/java/net/buildtheearth/utils/menus/BlockListMenu.java b/src/main/java/net/buildtheearth/utils/menus/BlockListMenu.java index a59b0a20..1f07498c 100644 --- a/src/main/java/net/buildtheearth/utils/menus/BlockListMenu.java +++ b/src/main/java/net/buildtheearth/utils/menus/BlockListMenu.java @@ -1,7 +1,7 @@ package net.buildtheearth.utils.menus; +import com.alpsbte.alpslib.utils.item.Item; import net.buildtheearth.utils.CustomHeads; -import net.buildtheearth.utils.Item; import net.buildtheearth.utils.MenuItems; import org.bukkit.enchantments.Enchantment; import org.bukkit.entity.Player; diff --git a/src/main/java/net/buildtheearth/utils/menus/BookMenu.java b/src/main/java/net/buildtheearth/utils/menus/BookMenu.java index f04828a3..4595c2eb 100644 --- a/src/main/java/net/buildtheearth/utils/menus/BookMenu.java +++ b/src/main/java/net/buildtheearth/utils/menus/BookMenu.java @@ -1,11 +1,10 @@ package net.buildtheearth.utils.menus; +import com.alpsbte.alpslib.utils.item.Item; import com.cryptomorin.xseries.XMaterial; import net.buildtheearth.BuildTeamTools; -import net.buildtheearth.utils.Item; import net.buildtheearth.utils.MenuItems; import org.bukkit.Bukkit; -import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; diff --git a/src/main/java/net/buildtheearth/utils/menus/NameListMenu.java b/src/main/java/net/buildtheearth/utils/menus/NameListMenu.java index e63308df..3a1f61c6 100644 --- a/src/main/java/net/buildtheearth/utils/menus/NameListMenu.java +++ b/src/main/java/net/buildtheearth/utils/menus/NameListMenu.java @@ -1,7 +1,7 @@ package net.buildtheearth.utils.menus; +import com.alpsbte.alpslib.utils.item.Item; import net.buildtheearth.utils.CustomHeads; -import net.buildtheearth.utils.Item; import net.buildtheearth.utils.MenuItems; import net.daporkchop.lib.common.misc.Tuple; import org.bukkit.enchantments.Enchantment; From fbdd680e26b58201f627da30dc0050cb2fab5b46 Mon Sep 17 00:00:00 2001 From: Zoriot Date: Mon, 12 Jan 2026 17:33:45 +0100 Subject: [PATCH 20/23] =?UTF-8?q?fix(nav):=20=E2=9C=A8=20fix=20others/defa?= =?UTF-8?q?ult=20warp=20group?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/navigation/NavUtils.java | 4 +- .../components/warps/WarpsComponent.java | 2 +- .../modules/network/api/NetworkAPI.java | 58 +++++++++---------- 3 files changed, 30 insertions(+), 34 deletions(-) diff --git a/src/main/java/net/buildtheearth/modules/navigation/NavUtils.java b/src/main/java/net/buildtheearth/modules/navigation/NavUtils.java index a22be73b..fd1b2f25 100644 --- a/src/main/java/net/buildtheearth/modules/navigation/NavUtils.java +++ b/src/main/java/net/buildtheearth/modules/navigation/NavUtils.java @@ -113,8 +113,8 @@ public static void switchToTeam(BuildTeam team, Player clickPlayer) { } } - public static @NotNull WarpGroup createOtherWarpGroup() { + public static @NotNull WarpGroup createOtherWarpGroup(BuildTeam team) { // Create an "other" Warp Group for warps that don't belong to a warp group - return new WarpGroup(NetworkModule.getInstance().getBuildTeam(), "Other", "Other warps", -1, null); + return new WarpGroup(team, "Other", "Other warps", -1, null); } } diff --git a/src/main/java/net/buildtheearth/modules/navigation/components/warps/WarpsComponent.java b/src/main/java/net/buildtheearth/modules/navigation/components/warps/WarpsComponent.java index 6e4e1482..b7224a9f 100644 --- a/src/main/java/net/buildtheearth/modules/navigation/components/warps/WarpsComponent.java +++ b/src/main/java/net/buildtheearth/modules/navigation/components/warps/WarpsComponent.java @@ -142,7 +142,7 @@ public WarpGroup getOtherWarpGroup() { public void createWarp(Player creator) { WarpGroup group = getOtherWarpGroup(); if (group == null) { - group = NavUtils.createOtherWarpGroup(); + group = NavUtils.createOtherWarpGroup(NetworkModule.getInstance().getBuildTeam()); } createWarp(creator, group); } diff --git a/src/main/java/net/buildtheearth/modules/network/api/NetworkAPI.java b/src/main/java/net/buildtheearth/modules/network/api/NetworkAPI.java index d15061d8..14e37dcf 100644 --- a/src/main/java/net/buildtheearth/modules/network/api/NetworkAPI.java +++ b/src/main/java/net/buildtheearth/modules/network/api/NetworkAPI.java @@ -29,6 +29,7 @@ public class NetworkAPI { /** * Notifies the network API about the presence of the plugin + * * @param installed if the plugin is installed */ public static void setBuildTeamToolsInstalled(boolean installed) { @@ -105,7 +106,7 @@ public void onResponse(String response) { isConnected, hasBuildTeamToolsInstalled, allowsTransfers, tag); NetworkModule.getInstance().getBuildTeams().add(buildTeam); - WarpGroup otherWarpGroup = NavUtils.createOtherWarpGroup(); + WarpGroup otherWarpGroup = NavUtils.createOtherWarpGroup(buildTeam); // Add all the warp groups of the team to their respective build teams for (Object warpGroupJSON : warpGroups.toArray()) { @@ -122,8 +123,6 @@ public void onResponse(String response) { buildTeam.getWarpGroups().add(warpGroup); } - if (!otherWarpGroup.getWarps().isEmpty()) buildTeam.getWarpGroups().add(otherWarpGroup); - // Add all the warps of the team to their respective warp groups for (Object warpJSON : warps.toArray()) { if (!(warpJSON instanceof JSONObject warpObject)) continue; @@ -162,23 +161,21 @@ public void onResponse(String response) { Warp warp = new Warp(warpID, warpGroup, warpName, countryCode, "cca3", address, addressType, material, warpWorldName, warpLat, warpLon, warpHeight, warpYaw, warpPitch, isHighlight); // If the warp belongs to a warp group, add it to that, otherwise add it to the "other" warp group. - if (warpGroupID == null) { + boolean added = false; + + for (WarpGroup wg : buildTeam.getWarpGroups()) + if (wg.getId().equals(warpGroup.getId())) { + wg.getWarps().add(warp); + added = true; + break; + } + + if (!added) otherWarpGroup.getWarps().add(warp); - } else { - boolean added = false; - - for (WarpGroup wg : buildTeam.getWarpGroups()) - if (wg.getId().equals(warpGroupID)) { - wg.getWarps().add(warp); - added = true; - break; - } - - if (!added) - otherWarpGroup.getWarps().add(warp); - } } + if (!otherWarpGroup.getWarps().isEmpty()) buildTeam.getWarpGroups().add(otherWarpGroup); + // Add all the regions of the team to their respective continents for (Object regionJSON : regions.toArray()) { if (!(regionJSON instanceof JSONObject regionObject)) continue; @@ -205,7 +202,7 @@ public void onResponse(String response) { NetworkModule.getInstance().getRegions().add(region); } } - }catch (Exception e) { + } catch (Exception e) { future.completeExceptionally(e); return; } @@ -214,25 +211,24 @@ public void onResponse(String response) { } - private String getMainServerName(JSONObject teamObject) { String mainServerIP = (String) teamObject.get("MainServerIP"); Object serversObject = teamObject.get("Servers"); if (!(serversObject instanceof JSONArray serversArray)) return null; - for(Object object : serversArray.toArray()) { + for (Object object : serversArray.toArray()) { if (!(object instanceof JSONObject serverObject)) return null; String serverIP = (String) serverObject.get("IP"); - if(serverIP.equals(mainServerIP)) return (String) serverObject.get("Name"); + if (serverIP.equals(mainServerIP)) return (String) serverObject.get("Name"); } return null; } private int getArea(JSONObject regionObject) { - if(regionObject == null) return 0; - if(regionObject.get("area") == null) return 0; + if (regionObject == null) return 0; + if (regionObject.get("area") == null) return 0; if (regionObject.get("area") instanceof Long area) return Math.toIntExact(area); @@ -289,28 +285,28 @@ public static void createWarp(Warp warp, API.ApiResponseCallback callback) { String apiKey = BuildTeamTools.getInstance().getConfig().getString(ConfigPaths.API_KEY); RequestBody requestBody = RequestBody.create(warp.toJSON().toString(), MediaType.parse("application/json")); - API.postAsync("https://nwapi.buildtheearth.net/api/teams/"+apiKey+"/warps", requestBody, callback); + API.postAsync("https://nwapi.buildtheearth.net/api/teams/" + apiKey + "/warps", requestBody, callback); } public static void createWarpGroup(WarpGroup warpGroup, API.ApiResponseCallback callback) { String apiKey = BuildTeamTools.getInstance().getConfig().getString(ConfigPaths.API_KEY); RequestBody requestBody = RequestBody.create(warpGroup.toJSON().toString(), MediaType.parse("application/json")); - API.postAsync("https://nwapi.buildtheearth.net/api/teams/"+apiKey+"/warpgroups", requestBody, callback); + API.postAsync("https://nwapi.buildtheearth.net/api/teams/" + apiKey + "/warpgroups", requestBody, callback); } public static void updateWarp(Warp warp, API.ApiResponseCallback callback) { String apiKey = BuildTeamTools.getInstance().getConfig().getString(ConfigPaths.API_KEY); RequestBody requestBody = RequestBody.create(warp.toJSON().toString(), MediaType.parse("application/json")); - API.putAsync("https://nwapi.buildtheearth.net/api/teams/"+apiKey+"/warps", requestBody, callback); + API.putAsync("https://nwapi.buildtheearth.net/api/teams/" + apiKey + "/warps", requestBody, callback); } public static void updateWarpGroup(WarpGroup warpGroup, API.ApiResponseCallback callback) { String apiKey = BuildTeamTools.getInstance().getConfig().getString(ConfigPaths.API_KEY); RequestBody requestBody = RequestBody.create(warpGroup.toJSON().toString(), MediaType.parse("application/json")); - API.putAsync("https://nwapi.buildtheearth.net/api/teams/"+apiKey+"/warpgroups", requestBody, callback); + API.putAsync("https://nwapi.buildtheearth.net/api/teams/" + apiKey + "/warpgroups", requestBody, callback); } public static void deleteWarp(Warp warp, API.ApiResponseCallback callback) { @@ -322,7 +318,7 @@ public static void deleteWarp(Warp warp, API.ApiResponseCallback callback) { RequestBody requestBody = RequestBody.create(requestBodyString, MediaType.parse("application/json")); - API.deleteAsync("https://nwapi.buildtheearth.net/api/teams/"+apiKey+"/warps", requestBody, callback); + API.deleteAsync("https://nwapi.buildtheearth.net/api/teams/" + apiKey + "/warps", requestBody, callback); } public static void deleteWarpGroup(WarpGroup warpGroup, API.ApiResponseCallback callback) { @@ -333,11 +329,11 @@ public static void deleteWarpGroup(WarpGroup warpGroup, API.ApiResponseCallback String requestBodyString = requestBodyJson.toString(); RequestBody requestBody = RequestBody.create(requestBodyString, MediaType.parse("application/json")); - API.deleteAsync("https://nwapi.buildtheearth.net/api/teams/"+apiKey+"/warpgroups", requestBody, callback); + API.deleteAsync("https://nwapi.buildtheearth.net/api/teams/" + apiKey + "/warpgroups", requestBody, callback); } public static void syncPlayerList() { - if(NetworkModule.getInstance().getBuildTeam().isConnected()) + if (NetworkModule.getInstance().getBuildTeam().isConnected()) return; String apiKey = BuildTeamTools.getInstance().getConfig().getString(ConfigPaths.API_KEY); @@ -348,7 +344,7 @@ public static void syncPlayerList() { RequestBody requestBody = RequestBody.create(requestBodyArray.toString(), MediaType.parse("application/json")); - API.postAsync("https://nwapi.buildtheearth.net/api/teams/"+apiKey+"/playerlist", requestBody, new API.ApiResponseCallback() { + API.postAsync("https://nwapi.buildtheearth.net/api/teams/" + apiKey + "/playerlist", requestBody, new API.ApiResponseCallback() { @Override public void onResponse(String response) { ChatHelper.logDebug("Synced the player list with the network API: %s", response); From a5819e5875298f61ba434cdee7f60a24eae62fe8 Mon Sep 17 00:00:00 2001 From: Zoriot Date: Mon, 12 Jan 2026 18:43:26 +0100 Subject: [PATCH 21/23] =?UTF-8?q?fix(gen/kml):=20=E2=9C=A8=20fix=20coordin?= =?UTF-8?q?ate=20parsing=20and=20improve=20error=20handling?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes #61! --- .../generator/components/kml/KmlCommand.java | 683 +++++++++++------- .../components/tpll/TpllComponent.java | 3 +- .../buildtheearth/utils/GeometricUtils.java | 4 +- 3 files changed, 420 insertions(+), 270 deletions(-) diff --git a/src/main/java/net/buildtheearth/modules/generator/components/kml/KmlCommand.java b/src/main/java/net/buildtheearth/modules/generator/components/kml/KmlCommand.java index b452c9dd..9bb511c4 100644 --- a/src/main/java/net/buildtheearth/modules/generator/components/kml/KmlCommand.java +++ b/src/main/java/net/buildtheearth/modules/generator/components/kml/KmlCommand.java @@ -21,64 +21,64 @@ import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; import org.bukkit.metadata.FixedMetadataValue; +import org.jspecify.annotations.NonNull; import java.util.*; import java.util.concurrent.CompletableFuture; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; -import java.util.stream.Collectors; - - - /** Class to handle kml command and its aliases - * - * Since kml content easily exceeds the normal chat/character limit, - * we use the following workflow: - * - * if sent from a player, generates a CommandBlock and adds some metadata to it - * the player then pastes the kml contents and confirms the command - * - * the CommandBlock then sends a kml command with the contents, which is parsed by the server - * - * note: this command differentiates between aliases to determine wether to - * generate intermediate points between the geo-coordinates from the kml linestrings. - * Players should only use /geopoints or /geopath aliases, - * direct use of the /kml command is restricted to CommandBlockSender - * - */ + + +/** + * Class to handle kml command and its aliases

+ *

+ * Since kml content easily exceeds the normal chat/character limit, + * we use the following workflow:
+ * 1) If sent from a player, generates a CommandBlock and adds some metadata to it + * the player then pastes the kml contents and confirms the command
+ * 2) The CommandBlock then sends a kml command with the contents, which is parsed by the server

+ *

+ * note: this command differentiates between aliases to determine wether to + * generate intermediate points between the geo-coordinates from the kml linestrings. + * Players should only use /geopoints or /geopath aliases, + * direct use of the /kml command is restricted to CommandBlockSender + * + */ public class KmlCommand implements CommandExecutor { - - /** Command handling - * + /** + * Handles the execution of KML-related commands (/geopoints, /geopath, /georing, /kml). + *

+ * This method has two main execution paths: + *

    + *
  • If sender is a CommandBlock: directly processes the KML content
  • + *
  • If sender is a Player: creates a CommandBlock UI for pasting KML content or handles undo
  • + *
+ * + * @param sender The command sender (Player or CommandBlock) + * @param cmd The command object + * @param alias The alias used to invoke this command (geopoints/geopath/georing/kml) + * @param args Command arguments (KML content if from CommandBlock, block type if from Player) + * @return true if the command was handled successfully, false otherwise */ - public boolean onCommand(CommandSender sender, Command cmd, String alias, String[] args) { - if (sender instanceof BlockCommandSender){ - Block senderBlock = ((BlockCommandSender)sender).getBlock(); + public boolean onCommand(@NonNull CommandSender sender, @NonNull Command cmd, @NonNull String alias, String @NonNull [] args) { + if (sender instanceof BlockCommandSender cmdbSender) { + Block senderBlock = cmdbSender.getBlock(); return processKml(senderBlock, args); } - if(!(sender instanceof Player)){ + if (!(sender instanceof Player p)) { sender.sendMessage("§cOnly players can execute this command."); return false; } - - Player p = (Player) sender; - if (args.length > 0 && args[0].equals("undo")){ + if (args.length > 0 && args[0].equals("undo")) { return undoCommand(p); - } - - // //TESTING location/elevation code - // Block targetedBlock = p.getTargetBlock(null, 10); - // Location targetedLocation = targetedBlock.getLocation(); - // int highY = p.getWorld().getHighestBlockYAt(targetedLocation); - // p.sendMessage(String.format("elevation test: targeted block (%s) location Y %d (%f), highestY %d", - // targetedBlock.getType().toString(), targetedLocation.getBlockY(), targetedLocation.getY(),highY)); - - + } + //check if alias is geopoints or geopath (direct /kml is only allowed for undo) - if (alias.equals("kml")){ + if (alias.equals("kml")) { sender.sendMessage("§cPlease use /geopoints or /geopath to execute this command."); return false; } @@ -86,236 +86,301 @@ public boolean onCommand(CommandSender sender, Command cmd, String alias, String return createPasteUI(p, cmd, alias, args); } - void addSingleLocation(BlockLocation loc, boolean extendToGround, World world, Set container, Set fillPositions) - { + /** + * Adds a single block location to the transaction, optionally extending down to terrain. + *

+ * If extendToGround is enabled, this will also fill all blocks vertically from the terrain + * elevation up to the specified location height. + * + * @param loc The block location to add + * @param extendToGround Whether to fill blocks down to terrain level + * @param world The world containing the blocks + * @param container The set to add the block location to + * @param fillPositions The set to add vertical fill positions to + */ + void addSingleLocation(BlockLocation loc, boolean extendToGround, World world, @NonNull Set container, Set fillPositions) { container.add(loc); - if (extendToGround) - fillVerticalToTerrain(loc, world, fillPositions); + if (extendToGround) fillVerticalToTerrain(loc, world, fillPositions); } - void addLocations(List locs, boolean extendToGround, World world, Set container, Set fillPositions) - { + /** + * Adds multiple block locations to the transaction, optionally extending each down to terrain. + *

+ * This is a convenience method that calls {@link #addSingleLocation(BlockLocation, boolean, World, Set, Set)} + * for each location in the list. + * + * @param locs List of block locations to add + * @param extendToGround Whether to fill blocks down to terrain level for each location + * @param world The world containing the blocks + * @param container The set to add the block locations to + * @param fillPositions The set to add vertical fill positions to + */ + void addLocations(@NonNull List locs, boolean extendToGround, World world, Set container, Set fillPositions) { for (BlockLocation loc : locs) addSingleLocation(loc, extendToGround, world, container, fillPositions); } - void fillVerticalToTerrain(BlockLocation locationOverGround, World world, Set container) - { + /** + * Fills all block positions vertically from terrain level up to the specified location. + *

+ * This is used when the "extend to ground" feature is enabled, creating a vertical + * column of blocks from the highest block at the XZ coordinates up to the target height. + * + * @param locationOverGround The target block location (height to extend to) + * @param world The world to query for terrain height + * @param container The set to add the vertical fill positions to + */ + void fillVerticalToTerrain(BlockLocation locationOverGround, @NonNull World world, Set container) { int terrainElevation = world.getHighestBlockYAt(locationOverGround.x, locationOverGround.z); - for (int y = terrainElevation; y < locationOverGround.y; y++){ + for (int y = terrainElevation; y < locationOverGround.y; y++) { container.add(new BlockLocation(locationOverGround.x, y, locationOverGround.z)); } } - /** - * @param senderBlock - * @param args - * @return boolean - */ - public boolean processKml(Block senderBlock, String[] args){ - long time_start = System.currentTimeMillis(); + /** + * Processes KML content from a CommandBlock and places blocks in the world. + *

+ * This method performs the following steps: + *

    + *
  1. Reads metadata from the command block (player, block type, operation mode)
  2. + *
  3. Parses the KML content to extract geographic coordinates
  4. + *
  5. Converts geographic coordinates to Minecraft coordinates (async)
  6. + *
  7. Rasterizes lines/points based on the operation mode
  8. + *
  9. Filters blocks by distance and chunk loading
  10. + *
  11. Commits block changes to the world (sync)
  12. + *
  13. Cleans up the command block
  14. + *
+ *

+ * The coordinate conversion and processing is done asynchronously to avoid blocking + * the server thread, then syncs back to the main thread for actual block changes. + *

+ * Blocks are only placed if: + *

    + *
  • The chunk is loaded
  • + *
  • The block is within 1000 blocks of the player
  • + *
+ * + * @param senderBlock The CommandBlock that sent this command (contains metadata) + * @param args The KML content as a string array + * @return true if processing started successfully, false if validation failed + */ + public boolean processKml(@NonNull Block senderBlock, String[] args) { //read metadata to get player name/ID BlockState blockState = senderBlock.getState(); - String playerName = blockState.getMetadata("kmlPlayerName").get(0).asString(); - String blocktypeString = blockState.getMetadata("kmlBlocktype").get(0).asString(); - String previousCommandBlockType = blockState.getMetadata("kmlPreviousBlocktype").get(0).asString(); - String blockCreationCommand = blockState.getMetadata("kmlBlockCreationCommand").get(0).asString(); + String playerName = blockState.getMetadata("kmlPlayerName").getFirst().asString(); + String blocktypeString = blockState.getMetadata("kmlBlocktype").getFirst().asString(); + String previousCommandBlockType = blockState.getMetadata("kmlPreviousBlocktype").getFirst().asString(); + String blockCreationCommand = blockState.getMetadata("kmlBlockCreationCommand").getFirst().asString(); BlockCreationMode operationMode = commandToCreationMode(blockCreationCommand); - boolean extendToGround = blockState.getMetadata("kmlExtendToGround").get(0).asBoolean(); - String extendToGroundBlockType = blockState.getMetadata("kmlExtendToGroundBlocktype").get(0).asString(); - + boolean extendToGround = blockState.getMetadata("kmlExtendToGround").getFirst().asBoolean(); + String extendToGroundBlockType = blockState.getMetadata("kmlExtendToGroundBlocktype").getFirst().asString(); + - if (playerName == "" || blocktypeString == ""){ + if (playerName.isEmpty() || blocktypeString.isEmpty()) { //invalid metadata, cancel //send error message to all players within 50m of the command block - ChatHelper.sendMessageToPlayersNearLocation( - senderBlock.getLocation(), - "§cReceived /kml command from CommandBlock without sufficient metadata.\nThis command can only be executed from a CommandBlock created with the /kml command!", - 50); + ChatHelper.sendMessageToPlayersNearLocation(senderBlock.getLocation(), "§cReceived /kml command from CommandBlock without sufficient metadata.\nThis command can only be executed from a CommandBlock created with the /kml command!", 50); return false; } Player player = Bukkit.getServer().getPlayer(playerName); - - if (player == null){ + + if (player == null) { return false; } String kml_content = String.join(" ", args); - // player.sendMessage(String.format("§creceived /kml command with blocktypestring %s and and kml length %d: %s", - // blocktypeString, kml_content.length(), kml_content)); - Material blockMaterial = Material.matchMaterial(blocktypeString); - if (blockMaterial == null){ + Material matchedBlockMaterial = Material.matchMaterial(blocktypeString); + final Material blockMaterial = (matchedBlockMaterial != null && matchedBlockMaterial.isBlock()) ? matchedBlockMaterial : Material.BRICKS; + if (matchedBlockMaterial == null || !matchedBlockMaterial.isBlock()) { player.sendMessage("§cServer received /kml command with invalid blocktype string metadata. Using bricks as fallback."); - blockMaterial = Material.BRICK; } - Material extendMaterial = Material.matchMaterial(extendToGroundBlockType); - if (extendMaterial == null){ + + Material matchedExtendMaterial = Material.matchMaterial(extendToGroundBlockType); + final Material extendMaterial = (matchedExtendMaterial != null && matchedExtendMaterial.isBlock()) ? matchedExtendMaterial : Material.BRICKS; + if (matchedExtendMaterial == null || !matchedExtendMaterial.isBlock()) { player.sendMessage("§cServer received /kml command with invalid blocktype string metadata. Using bricks as fallback."); - extendMaterial = Material.BRICK; } - //parse kml long time_beforeKMLParse = System.currentTimeMillis(); - - KmlParser parser = new KmlParser(player); // we pass the player here to be able to report parsing errors List> geoCoords = parser.extractCoordinates(kml_content); long time_afterKMLParse = System.currentTimeMillis(); - World world = senderBlock.getWorld(); - List> mcLocations = convertToMC(geoCoords, world); - long time_afterProjection = System.currentTimeMillis(); - - - //set up a transaction (collection of block changes) - ChangeTransaction transaction = new ChangeTransaction(player); - - //collect all blocklocations in a set - //if just iterate and create blocks one by one, we create multiple blocks at the same XZ coordinates, - // this also stacks them vertically because we check terrain altitude. - Set blockPositions = new HashSet<>(); - Set fillPositions = new HashSet<>(); - - - - for (List polyline : mcLocations) - { - if (operationMode == BlockCreationMode.FILLED) - blockPositions = triangulateAndFill(polyline); - else{ - //rasterize line and create intermediate blocks - //note: iteration starts at second block, so we always have a previous block to draw the line - //for single point mode, we explicitly add the first block - if (operationMode == BlockCreationMode.POINTS) - { - BlockLocation loc = new BlockLocation(polyline.get(0)); - addSingleLocation(loc, extendToGround, world, blockPositions, fillPositions); - } + // Run the coordinate conversion asynchronously to avoid blocking the server thread + Bukkit.getScheduler().runTaskAsynchronously(BuildTeamTools.getInstance(), () -> { + List> mcLocations = convertToMC(geoCoords, world); + long time_afterProjection = System.currentTimeMillis(); - for (int i = 1; i < polyline.size(); ++i) - { - if (operationMode == BlockCreationMode.POINTS) - { - BlockLocation loc = new BlockLocation(polyline.get(i)); + + //set up a transaction (collection of block changes) + ChangeTransaction transaction = new ChangeTransaction(player); + + //collect all blocklocations in a set + //if just iterate and create blocks one by one, we create multiple blocks at the same XZ coordinates, + // this also stacks them vertically because we check terrain altitude. + Set blockPositions = new HashSet<>(); + Set fillPositions = new HashSet<>(); + + + for (List polyline : mcLocations) { + if (operationMode == BlockCreationMode.FILLED) blockPositions = triangulateAndFill(polyline); + else { + //rasterize line and create intermediate blocks + //note: iteration starts at second block, so we always have a previous block to draw the line + //for single point mode, we explicitly add the first block + if (operationMode == BlockCreationMode.POINTS) { + BlockLocation loc = new BlockLocation(polyline.getFirst()); addSingleLocation(loc, extendToGround, world, blockPositions, fillPositions); } - else //interpolate - { - addLocations(LineRasterization.rasterizeLine(polyline.get(i-1), polyline.get(i)), - extendToGround, world, blockPositions, fillPositions); + + // For PATH/CLOSED_PATH modes, start from the first point + int startIndex = (operationMode == BlockCreationMode.POINTS) ? 1 : 0; + + for (int i = startIndex + 1; i < polyline.size(); ++i) { + if (operationMode == BlockCreationMode.POINTS) { + BlockLocation loc = new BlockLocation(polyline.get(i)); + addSingleLocation(loc, extendToGround, world, blockPositions, fillPositions); + } else //interpolate + { + addLocations(LineRasterization.rasterizeLine(polyline.get(i - 1), polyline.get(i)), extendToGround, world, blockPositions, fillPositions); + } + } + + //for closed-path-mode, add extra line between start and end + if (operationMode == BlockCreationMode.CLOSED_PATH) { + addLocations(LineRasterization.rasterizeLine(polyline.getFirst(), polyline.getLast()), extendToGround, world, blockPositions, fillPositions); } } + } + + //now create the blocks + // restrictions: only if block is loaded, and only within 1000 blocks of the current player location + final boolean[] preventedUnloadedChunkChanges = {false}; + final boolean[] preventedFarChanges = {false}; + + float maxDistanceToPlayer = 1000; //TODO server config - //for closed-path-mode, add extra line between start and end - if (operationMode == BlockCreationMode.CLOSED_PATH) - { - addLocations(LineRasterization.rasterizeLine(polyline.get(0), polyline.get(polyline.size()-1)) - , extendToGround, world, blockPositions, fillPositions); + for (BlockLocation pt : blockPositions) { + Location loc = pt.getLocation(world); + if (!loc.getChunk().isLoaded()) preventedUnloadedChunkChanges[0] = true; + else if (loc.distance(player.getLocation()) > maxDistanceToPlayer) preventedFarChanges[0] = true; + else { + transaction.addBlockChange(pt, world, blockMaterial); } } - - } - //now create the blocks - // restrictions: only if block is loaded, and only within 1000 blocks of the current player location - boolean preventedUnloadedChunkChanges = false; - boolean preventedFarChanges = false; - - float maxDistanceToPlayer = 1000; //TODO server config - - for (BlockLocation pt : blockPositions) - { - Location loc = pt.getLocation(world); - if (!loc.getChunk().isLoaded()) - preventedUnloadedChunkChanges = true; - else if (loc.distance(player.getLocation()) > maxDistanceToPlayer) - preventedFarChanges = true; - else - { - transaction.addBlockChange(pt, world, blockMaterial); + for (BlockLocation pt : fillPositions) { + Location loc = pt.getLocation(world); + if (!loc.getChunk().isLoaded()) preventedUnloadedChunkChanges[0] = true; + else if (loc.distance(player.getLocation()) > maxDistanceToPlayer) preventedFarChanges[0] = true; + else { + transaction.addBlockChange(pt, world, extendMaterial); + } } - } - for (BlockLocation pt : fillPositions) - { - Location loc = pt.getLocation(world); - if (!loc.getChunk().isLoaded()) - preventedUnloadedChunkChanges = true; - else if (loc.distance(player.getLocation()) > maxDistanceToPlayer) - preventedFarChanges = true; - else - { - transaction.addBlockChange(pt, world, extendMaterial); + + if (transaction.size() == 0) { + StringBuilder debugMessage = new StringBuilder("§ckml command did not contain any allowed block changes. "); + debugMessage.append("Total positions calculated: ").append(blockPositions.size() + fillPositions.size()).append(". "); + debugMessage.append("Player at: X=").append(player.getLocation().getBlockX()); + debugMessage.append(" Y=").append(player.getLocation().getBlockY()); + debugMessage.append(" Z=").append(player.getLocation().getBlockZ()).append(". "); + + // Show first calculated block location for debugging + if (!blockPositions.isEmpty()) { + BlockLocation firstBlock = blockPositions.iterator().next(); + debugMessage.append("First block would be at: X=").append(firstBlock.x); + debugMessage.append(" Y=").append(firstBlock.y); + debugMessage.append(" Z=").append(firstBlock.z).append(". "); + } + + if (preventedUnloadedChunkChanges[0]) { + debugMessage.append("Some blocks are in unloaded chunks. "); + } + if (preventedFarChanges[0]) { + debugMessage.append("Some blocks are >1000 blocks from your location (max distance 1000). "); + } + if (!preventedUnloadedChunkChanges[0] && !preventedFarChanges[0]) { + debugMessage.append("No positions were calculated from the KML. Check your coordinates and alias (/geopoints, /geopath, /georing)."); + } + player.sendMessage(debugMessage.toString()); + return; } - } + // Sync back to main thread for block changes and player history management + Bukkit.getScheduler().runTask(BuildTeamTools.getInstance(), () -> { + //create commandHistory if not exits + if (KmlCommand.this.playerHistories == null) KmlCommand.this.playerHistories = new HashMap<>(); - if (transaction.size() == 0){ - player.sendMessage("§ckml command did not contain any allowed block changes.\nThis command can only change blocks near your current location, and cannot load new chunks."); - return false; - } + if (!KmlCommand.this.playerHistories.containsKey(player)) + KmlCommand.this.playerHistories.put(player, new Stack<>()); - //create commandHistory if not exits - if (this.playerHistories == null) - this.playerHistories = new HashMap<>(); + Stack playerHistory = KmlCommand.this.playerHistories.get(player); - if (! playerHistories.containsKey(player)) - playerHistories.put(player, new Stack<>()); + playerHistory.push(transaction); - Stack playerHistory = playerHistories.get(player); - playerHistory.push(transaction); + long time_beforeBlockChange = System.currentTimeMillis(); - long time_beforeBlockChange = System.currentTimeMillis(); + player.sendMessage(String.format("KML parsing: %d ms. BTE Projection: %d ms, Transaction preparation: %d ms. Changing %d blocks, please stand by.", (time_afterKMLParse - time_beforeKMLParse), (time_afterProjection - time_afterKMLParse), (time_beforeBlockChange - time_afterProjection), transaction.size())); + int blocksChanged = transaction.commit(); - player.sendMessage(String.format("KML parsing: %d ms. BTE Projection: %d ms, Transaction preparation: %d ms. Changing %d blocks, please stand by." - , (time_afterKMLParse-time_beforeKMLParse) - , (time_afterProjection - time_afterKMLParse ) - , (time_beforeBlockChange - time_afterProjection), transaction.size())); - - int blocksChanged = transaction.commit(); + long time_afterBlockChanged = System.currentTimeMillis(); + player.sendMessage(String.format("KML command changed %d blocks (%d ms).", blocksChanged, (time_afterBlockChanged - time_beforeBlockChange))); - long time_afterBlockChanged = System.currentTimeMillis(); - player.sendMessage(String.format("KML command changed %d blocks (%d ms).", blocksChanged, (time_afterBlockChanged - time_beforeBlockChange))); - - if (preventedUnloadedChunkChanges){ - player.sendMessage("§cSome block changes target unloaded chunks and were not applied."); - } - if (preventedFarChanges){ - player.sendMessage("§cSome block changes target blocks too far away from the player and were not applied."); - } + if (preventedUnloadedChunkChanges[0]) { + player.sendMessage("§cSome block changes target unloaded chunks and were not applied."); + } + if (preventedFarChanges[0]) { + player.sendMessage("§cSome block changes target blocks too far away from the player and were not applied."); + } - Material material = Material.matchMaterial(previousCommandBlockType); + Material material = Material.matchMaterial(previousCommandBlockType); - if (material == null){ - player.sendMessage("§cServer received /kml command with invalid blocktype string metadata. Using bricks as fallback."); - material = Material.BRICK; - } + if (material == null) { + player.sendMessage("§cServer received /kml command with invalid blocktype string metadata. Using bricks as fallback."); + material = Material.BRICKS; + } - //Delete command block, restore previous type - senderBlock.setType(material); + //Delete command block, restore previous type + senderBlock.setType(material); + }); + }); return true; } - private Set triangulateAndFill(List polyline) { - Setresult = new HashSet<>(); + /** + * Triangulates a polygon defined by a polyline and fills it with blocks. + *

+ * This method: + *

    + *
  1. Triangulates the polygon into triangles using {@link PolygonTools#triangulatePolygon(List)}
  2. + *
  3. Rasterizes each triangle to fill it with blocks
  4. + *
  5. Also adds triangle borders for debugging purposes
  6. + *
+ * + * @param polyline The list of locations defining the polygon boundary + * @return A set of all block locations that should be filled + */ + private @NonNull Set triangulateAndFill(List polyline) { + Set result = new HashSet<>(); //triangulate the polygon List triangles = PolygonTools.triangulatePolygon(polyline); //fill with bresenham. for now, just all border-lines - for (PolygonTools.Triangle tri : triangles){ + for (PolygonTools.Triangle tri : triangles) { result.addAll(PolygonTools.rasterizeTriangle(tri)); - + //dEBUG: ALL triangle borders result.addAll(LineRasterization.rasterizeLine(tri.getVertex1(), tri.getVertex2())); result.addAll(LineRasterization.rasterizeLine(tri.getVertex1(), tri.getVertex3())); @@ -325,39 +390,65 @@ private Set triangulateAndFill(List polyline) { } - - public boolean createPasteUI(Player player, Command cmd, String alias, String[] args){ + /** + * Creates a CommandBlock UI for pasting KML content. + *

+ * This method: + *

    + *
  1. Parses command arguments for block type and extend options
  2. + *
  3. Spawns a CommandBlock 2 blocks in front of the player
  4. + *
  5. Stores metadata on the CommandBlock (player, block types, operation mode)
  6. + *
  7. Configures the CommandBlock to execute /kml when triggered
  8. + *
+ *

+ * Arguments: + *

    + *
  • Optional block type (e.g., "STONE", "GLASS") - defaults to "BRICKS"
  • + *
  • Optional -extend:BLOCKTYPE to fill vertically down to terrain
  • + *
+ *

+ * After creation, the player should: + *

    + *
  1. Right-click the CommandBlock
  2. + *
  3. Paste the KML content after "/kml "
  4. + *
  5. Set the CommandBlock to "Always Active"
  6. + *
  7. Confirm to execute
  8. + *
+ * + * @param player The player creating the CommandBlock UI + * @param cmd The command object (unused) + * @param alias The command alias used (determines operation mode) + * @param args Command arguments (block type and extend options) + * @return true if the CommandBlock was created successfully + */ + public boolean createPasteUI(Player player, Command cmd, String alias, String @NonNull [] args) { //The command either creates a command-block at the player location //arguments are an // optional blocktype // optional -toGround:blockType - String blocktype = "BRICK"; + String blocktype = "BRICKS"; boolean extendToGround = false; String extendToGroundBlockType = "GREEN_WOOL"; String prefix_extendParam = "-extend:"; - for (String arg : args) - { - if (arg.startsWith(prefix_extendParam)){ + for (String arg : args) { + if (arg.startsWith(prefix_extendParam)) { extendToGround = true; extendToGroundBlockType = arg.substring(prefix_extendParam.length()).toUpperCase(); if (Material.matchMaterial(extendToGroundBlockType) == null) { player.sendMessage(String.format("§cInvalid block type for extend parameter '%s'. Using bricks as fallback.", extendToGroundBlockType)); - extendToGroundBlockType = "BRICK"; + extendToGroundBlockType = "BRICKS"; } - }else{ + } else { blocktype = arg.toUpperCase(); if (Material.matchMaterial(blocktype) == null) { player.sendMessage(String.format("§cInvalid block type '%s'. Using bricks as fallback.", blocktype)); - blocktype = "BRICK"; + blocktype = "BRICKS"; } } - - } - //spawn a command block in front of the player Location commandBlockLocation = player.getLocation().add(player.getLocation().getDirection().multiply(2)); commandBlockLocation = commandBlockLocation.add(0, 2, 0); @@ -367,38 +458,49 @@ public boolean createPasteUI(Player player, Command cmd, String alias, String[] Material previousMaterial = block.getType(); //remember old blocktype to replace after command processing - if(XMaterial.COMMAND_BLOCK.parseMaterial() != null) - block.setType(XMaterial.COMMAND_BLOCK.parseMaterial()); - + if (XMaterial.COMMAND_BLOCK.get() != null) block.setType(XMaterial.COMMAND_BLOCK.get()); + //for now, user has to manually set the command to "auto" to get it immediately triggered on confirm CommandBlock cmdBlock = (CommandBlock) block.getState(); - + cmdBlock.setCommand("/kml "); //ready to paste kml content cmdBlock.setMetadata("kmlPlayerName", new FixedMetadataValue(BuildTeamTools.getInstance(), player.getName())); //cmdBlock.setMetadata("kmlPlayerID", new FixedMetadataValue(BuildTeamTools.getInstance(), p.getUniqueId())); cmdBlock.setMetadata("kmlBlocktype", new FixedMetadataValue(BuildTeamTools.getInstance(), blocktype)); cmdBlock.setMetadata("kmlExtendToGround", new FixedMetadataValue(BuildTeamTools.getInstance(), extendToGround)); cmdBlock.setMetadata("kmlExtendToGroundBlocktype", new FixedMetadataValue(BuildTeamTools.getInstance(), extendToGroundBlockType)); - + cmdBlock.setMetadata("kmlPreviousBlocktype", new FixedMetadataValue(BuildTeamTools.getInstance(), previousMaterial.toString())); - + cmdBlock.setMetadata("kmlBlockCreationCommand", new FixedMetadataValue(BuildTeamTools.getInstance(), alias)); - + cmdBlock.update(); player.sendMessage("§6Command block created. Right click the block, paste the KML content, set it to 'always on' and confirm"); return true; - + } - public boolean undoCommand(Player player){ - if (playerHistories==null){ + /** + * Undoes the last KML command executed by the player. + *

+ * This method retrieves the most recent {@link ChangeTransaction} from the player's + * history and reverses all block changes made by that transaction. + *

+ * The undo history is maintained per-player in a stack, so multiple undos can be + * performed in sequence to revert multiple KML commands. + * + * @param player The player requesting the undo + * @return true if undo was successful, false if no history exists + */ + public boolean undoCommand(Player player) { + if (playerHistories == null) { player.sendMessage("kml undo failed - no command history available."); return false; } Stack playerHistory = playerHistories.get(player); - - if (playerHistory == null || playerHistory.empty()){ + + if (playerHistory == null || playerHistory.empty()) { player.sendMessage("kml undo failed - there is no previously executed kml command."); return false; } @@ -409,82 +511,129 @@ public boolean undoCommand(Player player){ return true; } - public static void sendHelp(CommandSender sender){ - //ChatUtil.sendMessageBox(sender, "GML Command", () -> { - // sender.sendMessage("§eHouse Generator:§7 /gml help"); - //}); - } - - private Location getLocationFromCoordinates(double[] coordinates, double altitudeFromKML) - { + /** + * Converts geographic coordinates (latitude/longitude) to a Minecraft Location. + *

+ * This method: + *

    + *
  1. Converts lat/lon to Minecraft X/Z using {@link GeometricUtils#getLocationFromCoordinates(double[])}
  2. + *
  3. Applies the KML altitude offset (Google Earth altitudes are relative to ground)
  4. + *
+ *

+ * Note: GeometricUtils already adds +2 to terrain elevation, so we don't subtract it here anymore. + * + * @param coordinates Array of [latitude, longitude] in degrees + * @param altitudeFromKML Altitude from the KML file (relative to ground level) + * @return A Bukkit Location with X/Z from projection and Y adjusted for altitude + */ + private @NonNull Location getLocationFromCoordinates(double[] coordinates, double altitudeFromKML) { Location mcLocation = GeometricUtils.getLocationFromCoordinates(coordinates); //add altitude from kml (altitude from Google Earth is always relative to ground) //note: the "-2" is only neccesary because // getLocationFromCoordinates returns terrain altitude + 2 // (one from Bukkits getHighestBlockY and one from our geoutils) - mcLocation.add(0, altitudeFromKML - 2, 0); + mcLocation.add(0, altitudeFromKML, 0); return mcLocation; } - private List > convertToMC(List> geocoords_lists, World world){ - - List > mcLines = new ArrayList<>(); + /** + * Converts multiple lists of geographic coordinates to Minecraft Locations. + *

+ * This method parallelizes the coordinate conversion using a thread pool to improve + * performance when processing large KML files with many coordinates. Each coordinate + * conversion is executed asynchronously, and the method waits for all conversions + * to complete before returning. + *

+ * For each list of coordinates (representing a polyline), it: + *

    + *
  1. Creates a thread pool sized to the number of coordinates
  2. + *
  3. Submits each coordinate conversion as a CompletableFuture
  4. + *
  5. Waits for all futures to complete using {@link CompletableFuture#join()}
  6. + *
  7. Collects the results into a list of Locations
  8. + *
+ *

+ * Note: This method is called from an async task, so the .join() call won't block + * the main server thread. + * + * @param geocoords_lists List of polylines, where each polyline is a list of KML Coordinates + * @param world The world context (currently unused but available for future use) + * @return List of polylines converted to Minecraft Locations + */ + private @NonNull List> convertToMC(@NonNull List> geocoords_lists, World world) { + + List> mcLines = new ArrayList<>(); //This lat/long to xyz conversion takes most of the runtime for this command // since the conversions do not influence each other, we can parallelize them. - for (List geocoords : geocoords_lists){ + for (List geocoords : geocoords_lists) { // ExecutorService to manage the threads - ExecutorService executorService = Executors.newFixedThreadPool(geocoords.size()); + try (ExecutorService executorService = Executors.newFixedThreadPool(geocoords.size())) { - // List to store CompletableFuture results - List> completableFutureList = new ArrayList<>(); + // List to store CompletableFuture results + List> completableFutureList = new ArrayList<>(); - // Create a CompletableFuture for each set of coordinates - for (Coordinate geocoord : geocoords) { - double[] coordinates = new double[]{geocoord.getLatitude(), geocoord.getLongitude()}; + // Create a CompletableFuture for each set of coordinates + for (Coordinate geocoord : geocoords) { + double[] coordinates = new double[]{geocoord.getLatitude(), geocoord.getLongitude()}; - CompletableFuture completableFuture = CompletableFuture.supplyAsync(() -> - getLocationFromCoordinates(coordinates, geocoord.getAltitude()), executorService); - completableFutureList.add(completableFuture); - } + CompletableFuture completableFuture = CompletableFuture.supplyAsync(() -> getLocationFromCoordinates(coordinates, geocoord.getAltitude()), executorService); + completableFutureList.add(completableFuture); + } - // Combine all CompletableFutures into a single CompletableFuture representing all of them - CompletableFuture allOf = CompletableFuture.allOf( - completableFutureList.toArray(new CompletableFuture[0]) - ); + // Combine all CompletableFutures into a single CompletableFuture representing all of them + CompletableFuture allOf = CompletableFuture.allOf(completableFutureList.toArray(new CompletableFuture[0])); - // Wait for all CompletableFutures to complete - allOf.join(); + // Wait for all CompletableFutures to complete + allOf.join(); - // Collect the results from the CompletableFutures - List mcLine = completableFutureList.stream() - .map(CompletableFuture::join) - .collect(Collectors.toList()); + // Collect the results from the CompletableFutures + List mcLine = completableFutureList.stream().map(CompletableFuture::join).toList(); - mcLines.add(mcLine); + mcLines.add(mcLine); - // Shutdown the ExecutorService - executorService.shutdown(); + // Shutdown the ExecutorService + executorService.shutdown(); + } } return mcLines; } - private BlockCreationMode commandToCreationMode(String command){ - if (command.equals("geopoints")) - return BlockCreationMode.POINTS; - else if (command.equals("geopath")) - return BlockCreationMode.PATH; - else if (command.equals("georing")) - return BlockCreationMode.CLOSED_PATH; - else if (command.equals("geosurface")) - { - throw new UnsupportedOperationException("Operation mode 'filled surface' is not yet implemented"); + /** + * Maps command aliases to their corresponding block creation modes. + *

+ * This method determines how KML coordinates should be processed: + *

    + *
  • geopoints → {@link BlockCreationMode#POINTS}: Places blocks only at coordinate points
  • + *
  • geopath → {@link BlockCreationMode#PATH}: Draws lines between consecutive points
  • + *
  • georing → {@link BlockCreationMode#CLOSED_PATH}: Draws lines and closes the path (connects last to first)
  • + *
  • geosurface → {@link BlockCreationMode#FILLED}: Triangulates and fills the polygon (not yet implemented)
  • + *
+ * + * @param command The command alias used to invoke the KML command + * @return The BlockCreationMode corresponding to the command + * @throws UnsupportedOperationException if command is "geosurface" (not implemented) + * @throws IllegalArgumentException if command is not recognized + */ + private BlockCreationMode commandToCreationMode(@NonNull String command) { + return switch (command) { + case "geopoints" -> BlockCreationMode.POINTS; + case "geopath" -> BlockCreationMode.PATH; + case "georing" -> BlockCreationMode.CLOSED_PATH; + case "geosurface" -> + throw new UnsupportedOperationException("Operation mode 'filled surface' is not yet implemented"); //return BlockCreationMode.FILLED; - } - else - throw new IllegalArgumentException(command); - + default -> throw new IllegalArgumentException(command); + }; + } + /** + * Per-player history of KML command transactions for undo functionality. + *

+ * Each player has a stack of {@link ChangeTransaction} objects representing their + * executed KML commands. This allows players to undo their changes using /kml undo. + *

+ * The most recent transaction is at the top of the stack and will be undone first. + */ private HashMap> playerHistories; } diff --git a/src/main/java/net/buildtheearth/modules/navigation/components/tpll/TpllComponent.java b/src/main/java/net/buildtheearth/modules/navigation/components/tpll/TpllComponent.java index 2ddbc302..24a6b51b 100644 --- a/src/main/java/net/buildtheearth/modules/navigation/components/tpll/TpllComponent.java +++ b/src/main/java/net/buildtheearth/modules/navigation/components/tpll/TpllComponent.java @@ -95,7 +95,8 @@ public void tpllPlayer(@NotNull Player player, double @NotNull [] coordinates, S out.writeUTF("TPLL"); out.writeUTF(targetServerName); out.writeUTF(player.getUniqueId().toString()); - out.writeUTF(String.valueOf(coordinates[0] + coordinates[1])); + out.writeUTF(String.valueOf(coordinates[0])); + out.writeUTF(String.valueOf(coordinates[1])); player.sendPluginMessage(BuildTeamTools.getInstance(), "btt:buildteam", out.toByteArray()); // Switch the player to the target server diff --git a/src/main/java/net/buildtheearth/utils/GeometricUtils.java b/src/main/java/net/buildtheearth/utils/GeometricUtils.java index fd492a50..ae19fd20 100644 --- a/src/main/java/net/buildtheearth/utils/GeometricUtils.java +++ b/src/main/java/net/buildtheearth/utils/GeometricUtils.java @@ -56,10 +56,10 @@ public static Location getLocationFromCoordinatesYawPitch(double[] coordinates, * @return A bukkit location matching the coordinates. Height is terrain elevation +2. */ public static Location getLocationFromCoordinates(double[] coordinates) { - double[] xz = CoordinateConversion.convertToGeo(coordinates[0], coordinates[1]); + double[] xz = CoordinateConversion.convertFromGeo(coordinates[0], coordinates[1]); double x = xz[0]; - double z = -xz[1]; + double z = xz[1]; //Creates the location Location location; From 73b3597910e496fc6bd357ac9d1acff5c35d342f Mon Sep 17 00:00:00 2001 From: Zoriot Date: Mon, 12 Jan 2026 18:58:09 +0100 Subject: [PATCH 22/23] =?UTF-8?q?refactor(build):=20=E2=9C=A8=20rename=20p?= =?UTF-8?q?ackages=20to=20align=20with=20buildteamtools=20structure?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../{ => buildteamtools}/BuildTeamTools.java | 20 +++++------ .../{ => buildteamtools}/modules/Module.java | 4 +-- .../modules/ModuleComponent.java | 3 +- .../modules/ModuleHandler.java | 6 ++-- .../modules/common/CommonModule.java | 36 +++++++++---------- .../commands/BuildTeamToolsCommand.java | 20 +++++------ .../dependency/DependencyComponent.java | 6 ++-- .../PluginMessagingComponent.java | 12 +++---- .../components/updater/UpdaterComponent.java | 13 +++---- .../components/version/VersionComponent.java | 4 +-- .../common/listeners/CommandListener.java | 6 ++-- .../common/listeners/ExceptionListener.java | 2 +- .../modules/generator/GeneratorModule.java | 34 +++++++++--------- .../generator/commands/GeneratorCommand.java | 12 +++---- .../generator/components/field/CropStage.java | 2 +- .../generator/components/field/CropType.java | 2 +- .../generator/components/field/Field.java | 6 ++-- .../generator/components/field/FieldFlag.java | 6 ++-- .../components/field/FieldScripts.java | 8 ++--- .../components/field/FieldSettings.java | 8 ++--- .../components/field/menu/CropStageMenu.java | 16 ++++----- .../components/field/menu/CropTypeMenu.java | 20 +++++------ .../components/field/menu/FenceTypeMenu.java | 14 ++++---- .../generator/components/house/House.java | 6 ++-- .../generator/components/house/HouseFlag.java | 6 ++-- .../components/house/HouseScripts.java | 12 +++---- .../components/house/HouseSettings.java | 8 ++--- .../generator/components/house/RoofType.java | 2 +- .../house/menu/AdvancedSettingsMenu.java | 20 +++++------ .../components/house/menu/BaseColorMenu.java | 14 ++++---- .../components/house/menu/RoofColorMenu.java | 16 ++++----- .../components/house/menu/RoofTypeMenu.java | 18 +++++----- .../components/house/menu/WallColorMenu.java | 16 ++++----- .../components/kml/BlockCreationMode.java | 2 +- .../components/kml/ChangeTransaction.java | 14 ++++---- .../generator/components/kml/KmlCommand.java | 12 +++---- .../generator/components/kml/KmlParser.java | 2 +- .../components/kml/KmlTabCompleter.java | 10 +++--- .../generator/components/rail/Rail.java | 8 ++--- .../generator/components/rail/RailFlag.java | 6 ++-- .../components/rail/RailScripts.java | 6 ++-- .../components/rail/RailSettings.java | 4 +-- .../generator/components/road/Road.java | 8 ++--- .../generator/components/road/RoadFlag.java | 6 ++-- .../components/road/RoadScripts.java | 10 +++--- .../components/road/RoadSettings.java | 4 +-- .../road/menu/AdvancedColorMenu.java | 12 +++---- .../road/menu/AdvancedSettingsMenu.java | 20 +++++------ .../components/road/menu/RoadColorMenu.java | 16 ++++----- .../road/menu/SidewalkColorMenu.java | 14 ++++---- .../generator/components/tree/Tree.java | 10 +++--- .../generator/components/tree/TreeFlag.java | 6 ++-- .../components/tree/TreeScripts.java | 4 +-- .../components/tree/TreeSettings.java | 6 ++-- .../generator/components/tree/TreeType.java | 2 +- .../generator/components/tree/TreeWidth.java | 2 +- .../components/tree/menu/TreeHeightMenu.java | 12 +++---- .../components/tree/menu/TreeTypeMenu.java | 16 ++++----- .../components/tree/menu/TreeWidthMenu.java | 14 ++++---- .../listeners/GeneratorListener.java | 4 +-- .../modules/generator/menu/GeneratorMenu.java | 36 +++++++++---------- .../modules/generator/model/Command.java | 6 ++-- .../modules/generator/model/Flag.java | 12 +++---- .../modules/generator/model/FlagType.java | 12 +++---- .../generator/model/GeneratorCollections.java | 6 ++-- .../generator/model/GeneratorComponent.java | 16 ++++----- .../generator/model/GeneratorType.java | 4 +-- .../modules/generator/model/History.java | 4 +-- .../modules/generator/model/Operation.java | 2 +- .../modules/generator/model/Script.java | 4 +-- .../modules/generator/model/Settings.java | 10 +++--- .../modules/miscellaneous/MiscModule.java | 12 +++---- .../blockpalettegui/BlockPaletteCommand.java | 2 +- .../blockpalettegui/BlockPaletteGUI.java | 4 +-- .../blockpalettegui/BlockPaletteManager.java | 10 +++--- .../blockpalettegui/BlockPaletteMenuType.java | 10 ++---- .../ChoosePaletteBlocksMenu.java | 4 +-- .../blockpalettegui/ChoosePaletteMenu.java | 4 +-- .../blockpalettegui/CreatePaletteMenu.java | 4 +-- .../blockpalettegui/EditPaletteMenu.java | 4 +-- .../blockpalettegui/PaletteBlockListMenu.java | 6 ++-- .../signtextgenerator/SignTextGenerator.java | 4 +-- .../modules/navigation/NavUtils.java | 10 +++--- .../modules/navigation/NavigationModule.java | 32 ++++++++--------- .../navigator/NavigatorComponent.java | 12 +++---- .../navigator/commands/BuildteamCommand.java | 10 +++--- .../navigator/commands/NavigatorCommand.java | 8 ++--- .../listeners/NavigatorJoinListener.java | 10 +++--- .../listeners/NavigatorOpenListener.java | 6 ++-- .../components/tpll/TpllComponent.java | 12 +++---- .../tpll/listeners/TpllJoinListener.java | 6 ++-- .../tpll/listeners/TpllListener.java | 14 ++++---- .../components/warps/WarpsComponent.java | 32 ++++++++--------- .../warps/commands/WarpCommand.java | 12 +++---- .../warps/commands/WarpsBtCommand.java | 10 +++--- .../warps/listeners/WarpJoinListener.java | 6 ++-- .../warps/menu/AddressTypeSelectionMenu.java | 14 ++++---- .../warps/menu/MaterialSelectionMenu.java | 18 +++++----- .../components/warps/menu/WarpEditMenu.java | 22 ++++++------ .../warps/menu/WarpGroupEditMenu.java | 22 ++++++------ .../components/warps/menu/WarpGroupMenu.java | 28 +++++++-------- .../warps/menu/WarpGroupSelectionMenu.java | 8 ++--- .../components/warps/menu/WarpMenu.java | 20 +++++------ .../components/warps/model/Warp.java | 8 ++--- .../components/warps/model/WarpGroup.java | 8 ++--- .../navigation/menu/CountrySelectorMenu.java | 22 ++++++------ .../modules/navigation/menu/ExploreMenu.java | 8 ++--- .../modules/navigation/menu/MainMenu.java | 18 +++++----- .../navigation/menu/StateSelectorMenu.java | 16 ++++----- .../navigation/menu/TutorialsMenu.java | 4 +-- .../modules/network/NetworkModule.java | 26 +++++++------- .../modules/network/api/API.java | 13 +++---- .../modules/network/api/NetworkAPI.java | 22 ++++++------ .../modules/network/api/OpenStreetMapAPI.java | 2 +- .../listeners/NetworkJoinListener.java | 8 ++--- .../listeners/NetworkQuitListener.java | 6 ++-- .../modules/network/model/BuildTeam.java | 12 +++---- .../modules/network/model/Continent.java | 2 +- .../modules/network/model/Permissions.java | 2 +- .../modules/network/model/Region.java | 2 +- .../modules/network/model/RegionType.java | 2 +- .../modules/plotsystem/PlotSystemModule.java | 8 ++--- .../commands/PlotSystemTerraCommand.java | 2 +- .../modules/stats/StatsModule.java | 16 ++++----- .../stats/listeners/StatsListener.java | 8 ++--- .../modules/stats/menu/StatsMenu.java | 16 ++++----- .../modules/stats/model/StatsPlayer.java | 4 +-- .../modules/stats/model/StatsPlayerType.java | 2 +- .../modules/stats/model/StatsServer.java | 4 +-- .../modules/stats/model/StatsServerType.java | 2 +- .../utils/BlockLocation.java | 2 +- .../{ => buildteamtools}/utils/Config.java | 4 +-- .../utils/CustomHeads.java | 2 +- .../utils/GeometricUtils.java | 8 ++--- .../{ => buildteamtools}/utils/JsonUtils.java | 8 ++--- .../utils/LineRasterization.java | 4 +-- .../{ => buildteamtools}/utils/ListUtil.java | 2 +- .../{ => buildteamtools}/utils/MathUtils.java | 2 +- .../{ => buildteamtools}/utils/MenuItems.java | 2 +- .../utils/PolygonTools.java | 3 +- .../{ => buildteamtools}/utils/Utils.java | 2 +- .../{ => buildteamtools}/utils/WikiLinks.java | 2 +- .../utils/geo/CoordinateConversion.java | 10 +++--- .../geo/projection/GeographicProjection.java | 8 ++--- .../geo/projection/InvertableVectorField.java | 4 +-- .../projection/OffsetProjectionTransform.java | 2 +- .../OutOfProjectionBoundsException.java | 2 +- .../geo/projection/ProjectionTransform.java | 2 +- .../projection/ScaleProjectionTransform.java | 2 +- ...UprightOrientationProjectionTransform.java | 2 +- .../geo/projection/airocean/Airocean.java | 8 ++--- .../airocean/ConformalEstimate.java | 6 ++-- .../projection/airocean/ModifiedAirocean.java | 6 ++-- .../utils/io/ConfigPaths.java | 2 +- .../utils/io/ConfigUtil.java | 2 +- .../utils/io/Constants.java | 2 +- .../{ => buildteamtools}/utils/io/Errors.java | 2 +- .../utils/io/LangPaths.java | 2 +- .../utils/io/LangUtil.java | 2 +- .../utils/menus/AbstractMenu.java | 6 ++-- .../utils/menus/AbstractPaginatedMenu.java | 6 ++-- .../utils/menus/BlockListMenu.java | 6 ++-- .../utils/menus/BookMenu.java | 6 ++-- .../utils/menus/NameListMenu.java | 6 ++-- .../utils/raycast/Raycast.java | 2 +- .../utils/raycast/RaycastAPIMath.java | 2 +- src/main/resources/plugin.yml | 2 +- 167 files changed, 729 insertions(+), 751 deletions(-) rename src/main/java/net/buildtheearth/{ => buildteamtools}/BuildTeamTools.java (73%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/modules/Module.java (98%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/modules/ModuleComponent.java (88%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/modules/ModuleHandler.java (97%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/modules/common/CommonModule.java (72%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/modules/common/commands/BuildTeamToolsCommand.java (93%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/modules/common/components/dependency/DependencyComponent.java (92%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/modules/common/components/pluginmessaging/PluginMessagingComponent.java (86%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/modules/common/components/updater/UpdaterComponent.java (97%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/modules/common/components/version/VersionComponent.java (94%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/modules/common/listeners/CommandListener.java (88%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/modules/common/listeners/ExceptionListener.java (88%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/modules/generator/GeneratorModule.java (75%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/modules/generator/commands/GeneratorCommand.java (91%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/modules/generator/components/field/CropStage.java (89%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/modules/generator/components/field/CropType.java (93%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/modules/generator/components/field/Field.java (75%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/modules/generator/components/field/FieldFlag.java (76%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/modules/generator/components/field/FieldScripts.java (97%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/modules/generator/components/field/FieldSettings.java (86%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/modules/generator/components/field/menu/CropStageMenu.java (92%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/modules/generator/components/field/menu/CropTypeMenu.java (91%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/modules/generator/components/field/menu/FenceTypeMenu.java (71%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/modules/generator/components/house/House.java (80%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/modules/generator/components/house/HouseFlag.java (84%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/modules/generator/components/house/HouseScripts.java (99%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/modules/generator/components/house/HouseSettings.java (91%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/modules/generator/components/house/RoofType.java (87%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/modules/generator/components/house/menu/AdvancedSettingsMenu.java (89%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/modules/generator/components/house/menu/BaseColorMenu.java (71%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/modules/generator/components/house/menu/RoofColorMenu.java (80%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/modules/generator/components/house/menu/RoofTypeMenu.java (87%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/modules/generator/components/house/menu/WallColorMenu.java (68%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/modules/generator/components/kml/BlockCreationMode.java (63%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/modules/generator/components/kml/ChangeTransaction.java (96%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/modules/generator/components/kml/KmlCommand.java (98%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/modules/generator/components/kml/KmlParser.java (99%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/modules/generator/components/kml/KmlTabCompleter.java (97%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/modules/generator/components/rail/Rail.java (62%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/modules/generator/components/rail/RailFlag.java (74%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/modules/generator/components/rail/RailScripts.java (95%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/modules/generator/components/rail/RailSettings.java (65%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/modules/generator/components/road/Road.java (61%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/modules/generator/components/road/RoadFlag.java (85%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/modules/generator/components/road/RoadScripts.java (98%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/modules/generator/components/road/RoadSettings.java (94%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/modules/generator/components/road/menu/AdvancedColorMenu.java (74%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/modules/generator/components/road/menu/AdvancedSettingsMenu.java (92%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/modules/generator/components/road/menu/RoadColorMenu.java (68%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/modules/generator/components/road/menu/SidewalkColorMenu.java (71%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/modules/generator/components/tree/Tree.java (81%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/modules/generator/components/tree/TreeFlag.java (74%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/modules/generator/components/tree/TreeScripts.java (92%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/modules/generator/components/tree/TreeSettings.java (66%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/modules/generator/components/tree/TreeType.java (94%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/modules/generator/components/tree/TreeWidth.java (87%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/modules/generator/components/tree/menu/TreeHeightMenu.java (81%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/modules/generator/components/tree/menu/TreeTypeMenu.java (76%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/modules/generator/components/tree/menu/TreeWidthMenu.java (78%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/modules/generator/listeners/GeneratorListener.java (90%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/modules/generator/menu/GeneratorMenu.java (87%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/modules/generator/model/Command.java (98%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/modules/generator/model/Flag.java (54%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/modules/generator/model/FlagType.java (85%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/modules/generator/model/GeneratorCollections.java (98%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/modules/generator/model/GeneratorComponent.java (90%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/modules/generator/model/GeneratorType.java (79%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/modules/generator/model/History.java (97%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/modules/generator/model/Operation.java (98%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/modules/generator/model/Script.java (99%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/modules/generator/model/Settings.java (88%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/modules/miscellaneous/MiscModule.java (85%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/modules/miscellaneous/blockpalettegui/BlockPaletteCommand.java (97%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/modules/miscellaneous/blockpalettegui/BlockPaletteGUI.java (83%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/modules/miscellaneous/blockpalettegui/BlockPaletteManager.java (99%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/modules/miscellaneous/blockpalettegui/BlockPaletteMenuType.java (92%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/modules/miscellaneous/blockpalettegui/ChoosePaletteBlocksMenu.java (98%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/modules/miscellaneous/blockpalettegui/ChoosePaletteMenu.java (98%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/modules/miscellaneous/blockpalettegui/CreatePaletteMenu.java (98%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/modules/miscellaneous/blockpalettegui/EditPaletteMenu.java (98%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/modules/miscellaneous/blockpalettegui/PaletteBlockListMenu.java (96%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/modules/miscellaneous/signtextgenerator/SignTextGenerator.java (72%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/modules/navigation/NavUtils.java (93%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/modules/navigation/NavigationModule.java (52%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/modules/navigation/components/navigator/NavigatorComponent.java (87%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/modules/navigation/components/navigator/commands/BuildteamCommand.java (87%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/modules/navigation/components/navigator/commands/NavigatorCommand.java (78%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/modules/navigation/components/navigator/listeners/NavigatorJoinListener.java (67%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/modules/navigation/components/navigator/listeners/NavigatorOpenListener.java (93%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/modules/navigation/components/tpll/TpllComponent.java (93%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/modules/navigation/components/tpll/listeners/TpllJoinListener.java (80%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/modules/navigation/components/tpll/listeners/TpllListener.java (90%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/modules/navigation/components/warps/WarpsComponent.java (88%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/modules/navigation/components/warps/commands/WarpCommand.java (88%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/modules/navigation/components/warps/commands/WarpsBtCommand.java (61%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/modules/navigation/components/warps/listeners/WarpJoinListener.java (81%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/modules/navigation/components/warps/menu/AddressTypeSelectionMenu.java (93%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/modules/navigation/components/warps/menu/MaterialSelectionMenu.java (92%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/modules/navigation/components/warps/menu/WarpEditMenu.java (93%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/modules/navigation/components/warps/menu/WarpGroupEditMenu.java (93%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/modules/navigation/components/warps/menu/WarpGroupMenu.java (90%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/modules/navigation/components/warps/menu/WarpGroupSelectionMenu.java (82%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/modules/navigation/components/warps/menu/WarpMenu.java (85%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/modules/navigation/components/warps/model/Warp.java (94%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/modules/navigation/components/warps/model/WarpGroup.java (91%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/modules/navigation/menu/CountrySelectorMenu.java (88%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/modules/navigation/menu/ExploreMenu.java (90%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/modules/navigation/menu/MainMenu.java (93%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/modules/navigation/menu/StateSelectorMenu.java (90%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/modules/navigation/menu/TutorialsMenu.java (87%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/modules/network/NetworkModule.java (87%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/modules/network/api/API.java (97%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/modules/network/api/NetworkAPI.java (96%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/modules/network/api/OpenStreetMapAPI.java (96%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/modules/network/listeners/NetworkJoinListener.java (71%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/modules/network/listeners/NetworkQuitListener.java (69%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/modules/network/model/BuildTeam.java (94%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/modules/network/model/Continent.java (94%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/modules/network/model/Permissions.java (95%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/modules/network/model/Region.java (97%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/modules/network/model/RegionType.java (89%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/modules/plotsystem/PlotSystemModule.java (94%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/modules/plotsystem/commands/PlotSystemTerraCommand.java (81%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/modules/stats/StatsModule.java (86%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/modules/stats/listeners/StatsListener.java (89%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/modules/stats/menu/StatsMenu.java (88%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/modules/stats/model/StatsPlayer.java (93%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/modules/stats/model/StatsPlayerType.java (70%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/modules/stats/model/StatsServer.java (92%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/modules/stats/model/StatsServerType.java (72%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/utils/BlockLocation.java (93%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/utils/Config.java (97%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/utils/CustomHeads.java (99%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/utils/GeometricUtils.java (92%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/utils/JsonUtils.java (95%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/utils/LineRasterization.java (97%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/utils/ListUtil.java (87%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/utils/MathUtils.java (98%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/utils/MenuItems.java (99%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/utils/PolygonTools.java (95%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/utils/Utils.java (98%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/utils/WikiLinks.java (97%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/utils/geo/CoordinateConversion.java (92%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/utils/geo/projection/GeographicProjection.java (93%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/utils/geo/projection/InvertableVectorField.java (96%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/utils/geo/projection/OffsetProjectionTransform.java (95%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/utils/geo/projection/OutOfProjectionBoundsException.java (90%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/utils/geo/projection/ProjectionTransform.java (89%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/utils/geo/projection/ScaleProjectionTransform.java (96%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/utils/geo/projection/UprightOrientationProjectionTransform.java (93%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/utils/geo/projection/airocean/Airocean.java (97%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/utils/geo/projection/airocean/ConformalEstimate.java (93%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/utils/geo/projection/airocean/ModifiedAirocean.java (94%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/utils/io/ConfigPaths.java (98%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/utils/io/ConfigUtil.java (97%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/utils/io/Constants.java (89%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/utils/io/Errors.java (92%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/utils/io/LangPaths.java (96%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/utils/io/LangUtil.java (97%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/utils/menus/AbstractMenu.java (97%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/utils/menus/AbstractPaginatedMenu.java (96%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/utils/menus/BlockListMenu.java (96%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/utils/menus/BookMenu.java (97%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/utils/menus/NameListMenu.java (96%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/utils/raycast/Raycast.java (99%) rename src/main/java/net/buildtheearth/{ => buildteamtools}/utils/raycast/RaycastAPIMath.java (97%) diff --git a/src/main/java/net/buildtheearth/BuildTeamTools.java b/src/main/java/net/buildtheearth/buildteamtools/BuildTeamTools.java similarity index 73% rename from src/main/java/net/buildtheearth/BuildTeamTools.java rename to src/main/java/net/buildtheearth/buildteamtools/BuildTeamTools.java index e051cd5a..22d1715a 100644 --- a/src/main/java/net/buildtheearth/BuildTeamTools.java +++ b/src/main/java/net/buildtheearth/buildteamtools/BuildTeamTools.java @@ -1,16 +1,16 @@ -package net.buildtheearth; +package net.buildtheearth.buildteamtools; import lombok.Getter; import lombok.Setter; -import net.buildtheearth.modules.ModuleHandler; -import net.buildtheearth.modules.common.CommonModule; -import net.buildtheearth.modules.generator.GeneratorModule; -import net.buildtheearth.modules.miscellaneous.MiscModule; -import net.buildtheearth.modules.navigation.NavigationModule; -import net.buildtheearth.modules.network.NetworkModule; -import net.buildtheearth.modules.plotsystem.PlotSystemModule; -import net.buildtheearth.modules.stats.StatsModule; -import net.buildtheearth.utils.io.ConfigUtil; +import net.buildtheearth.buildteamtools.modules.ModuleHandler; +import net.buildtheearth.buildteamtools.modules.common.CommonModule; +import net.buildtheearth.buildteamtools.modules.generator.GeneratorModule; +import net.buildtheearth.buildteamtools.modules.miscellaneous.MiscModule; +import net.buildtheearth.buildteamtools.modules.navigation.NavigationModule; +import net.buildtheearth.buildteamtools.modules.network.NetworkModule; +import net.buildtheearth.buildteamtools.modules.plotsystem.PlotSystemModule; +import net.buildtheearth.buildteamtools.modules.stats.StatsModule; +import net.buildtheearth.buildteamtools.utils.io.ConfigUtil; import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.plugin.java.JavaPlugin; import org.jetbrains.annotations.NotNull; diff --git a/src/main/java/net/buildtheearth/modules/Module.java b/src/main/java/net/buildtheearth/buildteamtools/modules/Module.java similarity index 98% rename from src/main/java/net/buildtheearth/modules/Module.java rename to src/main/java/net/buildtheearth/buildteamtools/modules/Module.java index f6ab58aa..14db9133 100644 --- a/src/main/java/net/buildtheearth/modules/Module.java +++ b/src/main/java/net/buildtheearth/buildteamtools/modules/Module.java @@ -1,10 +1,10 @@ -package net.buildtheearth.modules; +package net.buildtheearth.buildteamtools.modules; import com.alpsbte.alpslib.utils.ChatHelper; import com.alpsbte.alpslib.utils.WikiDocumented; import lombok.Getter; import lombok.NonNull; -import net.buildtheearth.BuildTeamTools; +import net.buildtheearth.buildteamtools.BuildTeamTools; import org.bukkit.Bukkit; import org.bukkit.command.CommandExecutor; import org.bukkit.command.PluginCommand; diff --git a/src/main/java/net/buildtheearth/modules/ModuleComponent.java b/src/main/java/net/buildtheearth/buildteamtools/modules/ModuleComponent.java similarity index 88% rename from src/main/java/net/buildtheearth/modules/ModuleComponent.java rename to src/main/java/net/buildtheearth/buildteamtools/modules/ModuleComponent.java index 09db3a6f..80473eee 100644 --- a/src/main/java/net/buildtheearth/modules/ModuleComponent.java +++ b/src/main/java/net/buildtheearth/buildteamtools/modules/ModuleComponent.java @@ -1,7 +1,6 @@ -package net.buildtheearth.modules; +package net.buildtheearth.buildteamtools.modules; import lombok.Getter; -import org.bukkit.entity.Player; /** * An interface for BuildTeamTools components. diff --git a/src/main/java/net/buildtheearth/modules/ModuleHandler.java b/src/main/java/net/buildtheearth/buildteamtools/modules/ModuleHandler.java similarity index 97% rename from src/main/java/net/buildtheearth/modules/ModuleHandler.java rename to src/main/java/net/buildtheearth/buildteamtools/modules/ModuleHandler.java index dc07f7e0..3bcffe1f 100644 --- a/src/main/java/net/buildtheearth/modules/ModuleHandler.java +++ b/src/main/java/net/buildtheearth/buildteamtools/modules/ModuleHandler.java @@ -1,9 +1,9 @@ -package net.buildtheearth.modules; +package net.buildtheearth.buildteamtools.modules; import com.alpsbte.alpslib.utils.ChatHelper; import lombok.Getter; -import net.buildtheearth.BuildTeamTools; -import net.buildtheearth.utils.io.ConfigPaths; +import net.buildtheearth.buildteamtools.BuildTeamTools; +import net.buildtheearth.buildteamtools.utils.io.ConfigPaths; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.command.CommandSender; diff --git a/src/main/java/net/buildtheearth/modules/common/CommonModule.java b/src/main/java/net/buildtheearth/buildteamtools/modules/common/CommonModule.java similarity index 72% rename from src/main/java/net/buildtheearth/modules/common/CommonModule.java rename to src/main/java/net/buildtheearth/buildteamtools/modules/common/CommonModule.java index 8204d35d..0f4811f3 100644 --- a/src/main/java/net/buildtheearth/modules/common/CommonModule.java +++ b/src/main/java/net/buildtheearth/buildteamtools/modules/common/CommonModule.java @@ -1,26 +1,26 @@ -package net.buildtheearth.modules.common; +package net.buildtheearth.buildteamtools.modules.common; import com.alpsbte.alpslib.io.YamlFileFactory; import com.alpsbte.alpslib.io.config.ConfigNotImplementedException; import com.alpsbte.alpslib.utils.ChatHelper; import lombok.Getter; -import net.buildtheearth.BuildTeamTools; -import net.buildtheearth.modules.Module; -import net.buildtheearth.modules.common.commands.BuildTeamToolsCommand; -import net.buildtheearth.modules.common.components.dependency.DependencyComponent; -import net.buildtheearth.modules.common.components.pluginmessaging.PluginMessagingComponent; -import net.buildtheearth.modules.common.components.updater.UpdaterComponent; -import net.buildtheearth.modules.common.components.version.VersionComponent; -import net.buildtheearth.modules.common.listeners.CommandListener; -import net.buildtheearth.modules.common.listeners.ExceptionListener; -import net.buildtheearth.modules.generator.GeneratorModule; -import net.buildtheearth.modules.network.NetworkModule; -import net.buildtheearth.modules.stats.StatsModule; -import net.buildtheearth.modules.stats.model.StatsPlayerType; -import net.buildtheearth.modules.stats.model.StatsServerType; -import net.buildtheearth.utils.WikiLinks; -import net.buildtheearth.utils.io.ConfigPaths; -import net.buildtheearth.utils.io.ConfigUtil; +import net.buildtheearth.buildteamtools.BuildTeamTools; +import net.buildtheearth.buildteamtools.modules.Module; +import net.buildtheearth.buildteamtools.modules.common.commands.BuildTeamToolsCommand; +import net.buildtheearth.buildteamtools.modules.common.components.dependency.DependencyComponent; +import net.buildtheearth.buildteamtools.modules.common.components.pluginmessaging.PluginMessagingComponent; +import net.buildtheearth.buildteamtools.modules.common.components.updater.UpdaterComponent; +import net.buildtheearth.buildteamtools.modules.common.components.version.VersionComponent; +import net.buildtheearth.buildteamtools.modules.common.listeners.CommandListener; +import net.buildtheearth.buildteamtools.modules.common.listeners.ExceptionListener; +import net.buildtheearth.buildteamtools.modules.generator.GeneratorModule; +import net.buildtheearth.buildteamtools.modules.network.NetworkModule; +import net.buildtheearth.buildteamtools.modules.stats.StatsModule; +import net.buildtheearth.buildteamtools.modules.stats.model.StatsPlayerType; +import net.buildtheearth.buildteamtools.modules.stats.model.StatsServerType; +import net.buildtheearth.buildteamtools.utils.WikiLinks; +import net.buildtheearth.buildteamtools.utils.io.ConfigPaths; +import net.buildtheearth.buildteamtools.utils.io.ConfigUtil; import org.bukkit.Bukkit; import org.bukkit.entity.Player; import org.ipvp.canvas.MenuFunctionListener; diff --git a/src/main/java/net/buildtheearth/modules/common/commands/BuildTeamToolsCommand.java b/src/main/java/net/buildtheearth/buildteamtools/modules/common/commands/BuildTeamToolsCommand.java similarity index 93% rename from src/main/java/net/buildtheearth/modules/common/commands/BuildTeamToolsCommand.java rename to src/main/java/net/buildtheearth/buildteamtools/modules/common/commands/BuildTeamToolsCommand.java index d0581547..8da8037a 100644 --- a/src/main/java/net/buildtheearth/modules/common/commands/BuildTeamToolsCommand.java +++ b/src/main/java/net/buildtheearth/buildteamtools/modules/common/commands/BuildTeamToolsCommand.java @@ -1,16 +1,16 @@ -package net.buildtheearth.modules.common.commands; +package net.buildtheearth.buildteamtools.modules.common.commands; import com.alpsbte.alpslib.utils.ChatHelper; import com.google.gson.Gson; -import net.buildtheearth.BuildTeamTools; -import net.buildtheearth.modules.Module; -import net.buildtheearth.modules.ModuleHandler; -import net.buildtheearth.modules.common.CommonModule; -import net.buildtheearth.modules.network.NetworkModule; -import net.buildtheearth.modules.network.model.Permissions; -import net.buildtheearth.modules.network.model.Region; -import net.buildtheearth.modules.stats.StatsModule; -import net.buildtheearth.utils.Utils; +import net.buildtheearth.buildteamtools.BuildTeamTools; +import net.buildtheearth.buildteamtools.modules.Module; +import net.buildtheearth.buildteamtools.modules.ModuleHandler; +import net.buildtheearth.buildteamtools.modules.common.CommonModule; +import net.buildtheearth.buildteamtools.modules.network.NetworkModule; +import net.buildtheearth.buildteamtools.modules.network.model.Permissions; +import net.buildtheearth.buildteamtools.modules.network.model.Region; +import net.buildtheearth.buildteamtools.modules.stats.StatsModule; +import net.buildtheearth.buildteamtools.utils.Utils; import net.md_5.bungee.api.chat.ComponentBuilder; import net.md_5.bungee.api.chat.HoverEvent; import net.md_5.bungee.api.chat.TextComponent; diff --git a/src/main/java/net/buildtheearth/modules/common/components/dependency/DependencyComponent.java b/src/main/java/net/buildtheearth/buildteamtools/modules/common/components/dependency/DependencyComponent.java similarity index 92% rename from src/main/java/net/buildtheearth/modules/common/components/dependency/DependencyComponent.java rename to src/main/java/net/buildtheearth/buildteamtools/modules/common/components/dependency/DependencyComponent.java index 09a70b8e..595eb00b 100644 --- a/src/main/java/net/buildtheearth/modules/common/components/dependency/DependencyComponent.java +++ b/src/main/java/net/buildtheearth/buildteamtools/modules/common/components/dependency/DependencyComponent.java @@ -1,8 +1,8 @@ -package net.buildtheearth.modules.common.components.dependency; +package net.buildtheearth.buildteamtools.modules.common.components.dependency; import com.sk89q.worldedit.WorldEdit; -import net.buildtheearth.BuildTeamTools; -import net.buildtheearth.modules.ModuleComponent; +import net.buildtheearth.buildteamtools.BuildTeamTools; +import net.buildtheearth.buildteamtools.modules.ModuleComponent; import java.util.Objects; diff --git a/src/main/java/net/buildtheearth/modules/common/components/pluginmessaging/PluginMessagingComponent.java b/src/main/java/net/buildtheearth/buildteamtools/modules/common/components/pluginmessaging/PluginMessagingComponent.java similarity index 86% rename from src/main/java/net/buildtheearth/modules/common/components/pluginmessaging/PluginMessagingComponent.java rename to src/main/java/net/buildtheearth/buildteamtools/modules/common/components/pluginmessaging/PluginMessagingComponent.java index fa93b403..9760a42f 100644 --- a/src/main/java/net/buildtheearth/modules/common/components/pluginmessaging/PluginMessagingComponent.java +++ b/src/main/java/net/buildtheearth/buildteamtools/modules/common/components/pluginmessaging/PluginMessagingComponent.java @@ -1,13 +1,13 @@ -package net.buildtheearth.modules.common.components.pluginmessaging; +package net.buildtheearth.buildteamtools.modules.common.components.pluginmessaging; import com.alpsbte.alpslib.utils.ChatHelper; import com.google.common.io.ByteArrayDataInput; import com.google.common.io.ByteStreams; -import net.buildtheearth.BuildTeamTools; -import net.buildtheearth.modules.ModuleComponent; -import net.buildtheearth.modules.navigation.NavigationModule; -import net.buildtheearth.modules.network.NetworkModule; -import net.buildtheearth.modules.stats.StatsModule; +import net.buildtheearth.buildteamtools.BuildTeamTools; +import net.buildtheearth.buildteamtools.modules.ModuleComponent; +import net.buildtheearth.buildteamtools.modules.navigation.NavigationModule; +import net.buildtheearth.buildteamtools.modules.network.NetworkModule; +import net.buildtheearth.buildteamtools.modules.stats.StatsModule; import org.bukkit.entity.Player; import org.bukkit.plugin.messaging.PluginMessageListener; diff --git a/src/main/java/net/buildtheearth/modules/common/components/updater/UpdaterComponent.java b/src/main/java/net/buildtheearth/buildteamtools/modules/common/components/updater/UpdaterComponent.java similarity index 97% rename from src/main/java/net/buildtheearth/modules/common/components/updater/UpdaterComponent.java rename to src/main/java/net/buildtheearth/buildteamtools/modules/common/components/updater/UpdaterComponent.java index 8d0a058b..0eea39a3 100644 --- a/src/main/java/net/buildtheearth/modules/common/components/updater/UpdaterComponent.java +++ b/src/main/java/net/buildtheearth/buildteamtools/modules/common/components/updater/UpdaterComponent.java @@ -1,22 +1,17 @@ -package net.buildtheearth.modules.common.components.updater; +package net.buildtheearth.buildteamtools.modules.common.components.updater; import com.google.gson.JsonArray; import com.google.gson.JsonElement; import com.google.gson.JsonObject; import com.google.gson.JsonParser; -import net.buildtheearth.modules.ModuleComponent; -import net.buildtheearth.modules.network.model.Permissions; +import net.buildtheearth.buildteamtools.modules.ModuleComponent; +import net.buildtheearth.buildteamtools.modules.network.model.Permissions; import org.bukkit.Bukkit; import org.bukkit.Sound; import org.bukkit.entity.Player; import org.bukkit.plugin.Plugin; -import java.io.BufferedInputStream; -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; +import java.io.*; import java.net.HttpURLConnection; import java.net.URL; import java.util.logging.Level; diff --git a/src/main/java/net/buildtheearth/modules/common/components/version/VersionComponent.java b/src/main/java/net/buildtheearth/buildteamtools/modules/common/components/version/VersionComponent.java similarity index 94% rename from src/main/java/net/buildtheearth/modules/common/components/version/VersionComponent.java rename to src/main/java/net/buildtheearth/buildteamtools/modules/common/components/version/VersionComponent.java index 6f658ce7..311ae89a 100644 --- a/src/main/java/net/buildtheearth/modules/common/components/version/VersionComponent.java +++ b/src/main/java/net/buildtheearth/buildteamtools/modules/common/components/version/VersionComponent.java @@ -1,7 +1,7 @@ -package net.buildtheearth.modules.common.components.version; +package net.buildtheearth.buildteamtools.modules.common.components.version; import lombok.Getter; -import net.buildtheearth.modules.ModuleComponent; +import net.buildtheearth.buildteamtools.modules.ModuleComponent; import org.bukkit.Bukkit; import java.util.Arrays; diff --git a/src/main/java/net/buildtheearth/modules/common/listeners/CommandListener.java b/src/main/java/net/buildtheearth/buildteamtools/modules/common/listeners/CommandListener.java similarity index 88% rename from src/main/java/net/buildtheearth/modules/common/listeners/CommandListener.java rename to src/main/java/net/buildtheearth/buildteamtools/modules/common/listeners/CommandListener.java index 4ce65cf8..02b15748 100644 --- a/src/main/java/net/buildtheearth/modules/common/listeners/CommandListener.java +++ b/src/main/java/net/buildtheearth/buildteamtools/modules/common/listeners/CommandListener.java @@ -1,8 +1,8 @@ -package net.buildtheearth.modules.common.listeners; +package net.buildtheearth.buildteamtools.modules.common.listeners; import com.alpsbte.alpslib.utils.ChatHelper; -import net.buildtheearth.modules.Module; -import net.buildtheearth.modules.ModuleHandler; +import net.buildtheearth.buildteamtools.modules.Module; +import net.buildtheearth.buildteamtools.modules.ModuleHandler; import org.bukkit.command.PluginCommand; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; diff --git a/src/main/java/net/buildtheearth/modules/common/listeners/ExceptionListener.java b/src/main/java/net/buildtheearth/buildteamtools/modules/common/listeners/ExceptionListener.java similarity index 88% rename from src/main/java/net/buildtheearth/modules/common/listeners/ExceptionListener.java rename to src/main/java/net/buildtheearth/buildteamtools/modules/common/listeners/ExceptionListener.java index 810c018f..07523e49 100644 --- a/src/main/java/net/buildtheearth/modules/common/listeners/ExceptionListener.java +++ b/src/main/java/net/buildtheearth/buildteamtools/modules/common/listeners/ExceptionListener.java @@ -1,4 +1,4 @@ -package net.buildtheearth.modules.common.listeners; +package net.buildtheearth.buildteamtools.modules.common.listeners; import com.destroystokyo.paper.event.server.ServerExceptionEvent; import org.bukkit.event.EventHandler; diff --git a/src/main/java/net/buildtheearth/modules/generator/GeneratorModule.java b/src/main/java/net/buildtheearth/buildteamtools/modules/generator/GeneratorModule.java similarity index 75% rename from src/main/java/net/buildtheearth/modules/generator/GeneratorModule.java rename to src/main/java/net/buildtheearth/buildteamtools/modules/generator/GeneratorModule.java index ff001828..681ede42 100644 --- a/src/main/java/net/buildtheearth/modules/generator/GeneratorModule.java +++ b/src/main/java/net/buildtheearth/buildteamtools/modules/generator/GeneratorModule.java @@ -1,24 +1,24 @@ -package net.buildtheearth.modules.generator; +package net.buildtheearth.buildteamtools.modules.generator; import com.alpsbte.alpslib.utils.GeneratorUtils; import com.sk89q.worldedit.LocalSession; import lombok.Getter; -import net.buildtheearth.BuildTeamTools; -import net.buildtheearth.modules.Module; -import net.buildtheearth.modules.common.CommonModule; -import net.buildtheearth.modules.generator.commands.GeneratorCommand; -import net.buildtheearth.modules.generator.components.field.Field; -import net.buildtheearth.modules.generator.components.house.House; -import net.buildtheearth.modules.generator.components.kml.KmlCommand; -import net.buildtheearth.modules.generator.components.kml.KmlTabCompleter; -import net.buildtheearth.modules.generator.components.rail.Rail; -import net.buildtheearth.modules.generator.components.road.Road; -import net.buildtheearth.modules.generator.components.tree.Tree; -import net.buildtheearth.modules.generator.listeners.GeneratorListener; -import net.buildtheearth.modules.generator.model.Command; -import net.buildtheearth.modules.generator.model.GeneratorCollections; -import net.buildtheearth.modules.generator.model.History; -import net.buildtheearth.utils.WikiLinks; +import net.buildtheearth.buildteamtools.BuildTeamTools; +import net.buildtheearth.buildteamtools.modules.Module; +import net.buildtheearth.buildteamtools.modules.common.CommonModule; +import net.buildtheearth.buildteamtools.modules.generator.commands.GeneratorCommand; +import net.buildtheearth.buildteamtools.modules.generator.components.field.Field; +import net.buildtheearth.buildteamtools.modules.generator.components.house.House; +import net.buildtheearth.buildteamtools.modules.generator.components.kml.KmlCommand; +import net.buildtheearth.buildteamtools.modules.generator.components.kml.KmlTabCompleter; +import net.buildtheearth.buildteamtools.modules.generator.components.rail.Rail; +import net.buildtheearth.buildteamtools.modules.generator.components.road.Road; +import net.buildtheearth.buildteamtools.modules.generator.components.tree.Tree; +import net.buildtheearth.buildteamtools.modules.generator.listeners.GeneratorListener; +import net.buildtheearth.buildteamtools.modules.generator.model.Command; +import net.buildtheearth.buildteamtools.modules.generator.model.GeneratorCollections; +import net.buildtheearth.buildteamtools.modules.generator.model.History; +import net.buildtheearth.buildteamtools.utils.WikiLinks; import org.bukkit.entity.Player; import java.util.ArrayList; diff --git a/src/main/java/net/buildtheearth/modules/generator/commands/GeneratorCommand.java b/src/main/java/net/buildtheearth/buildteamtools/modules/generator/commands/GeneratorCommand.java similarity index 91% rename from src/main/java/net/buildtheearth/modules/generator/commands/GeneratorCommand.java rename to src/main/java/net/buildtheearth/buildteamtools/modules/generator/commands/GeneratorCommand.java index e13ddd85..b3fe253c 100644 --- a/src/main/java/net/buildtheearth/modules/generator/commands/GeneratorCommand.java +++ b/src/main/java/net/buildtheearth/buildteamtools/modules/generator/commands/GeneratorCommand.java @@ -1,11 +1,11 @@ -package net.buildtheearth.modules.generator.commands; +package net.buildtheearth.buildteamtools.modules.generator.commands; import com.alpsbte.alpslib.utils.ChatHelper; -import net.buildtheearth.modules.generator.GeneratorModule; -import net.buildtheearth.modules.generator.menu.GeneratorMenu; -import net.buildtheearth.modules.generator.model.History; -import net.buildtheearth.modules.network.model.Permissions; -import net.buildtheearth.utils.Utils; +import net.buildtheearth.buildteamtools.modules.generator.GeneratorModule; +import net.buildtheearth.buildteamtools.modules.generator.menu.GeneratorMenu; +import net.buildtheearth.buildteamtools.modules.generator.model.History; +import net.buildtheearth.buildteamtools.modules.network.model.Permissions; +import net.buildtheearth.buildteamtools.utils.Utils; import net.kyori.adventure.text.Component; import net.kyori.adventure.text.format.NamedTextColor; import org.bukkit.command.Command; diff --git a/src/main/java/net/buildtheearth/modules/generator/components/field/CropStage.java b/src/main/java/net/buildtheearth/buildteamtools/modules/generator/components/field/CropStage.java similarity index 89% rename from src/main/java/net/buildtheearth/modules/generator/components/field/CropStage.java rename to src/main/java/net/buildtheearth/buildteamtools/modules/generator/components/field/CropStage.java index 87d0ec5a..c32d16db 100644 --- a/src/main/java/net/buildtheearth/modules/generator/components/field/CropStage.java +++ b/src/main/java/net/buildtheearth/buildteamtools/modules/generator/components/field/CropStage.java @@ -1,4 +1,4 @@ -package net.buildtheearth.modules.generator.components.field; +package net.buildtheearth.buildteamtools.modules.generator.components.field; public enum CropStage { diff --git a/src/main/java/net/buildtheearth/modules/generator/components/field/CropType.java b/src/main/java/net/buildtheearth/buildteamtools/modules/generator/components/field/CropType.java similarity index 93% rename from src/main/java/net/buildtheearth/modules/generator/components/field/CropType.java rename to src/main/java/net/buildtheearth/buildteamtools/modules/generator/components/field/CropType.java index 4e08678c..6e87a19a 100644 --- a/src/main/java/net/buildtheearth/modules/generator/components/field/CropType.java +++ b/src/main/java/net/buildtheearth/buildteamtools/modules/generator/components/field/CropType.java @@ -1,4 +1,4 @@ -package net.buildtheearth.modules.generator.components.field; +package net.buildtheearth.buildteamtools.modules.generator.components.field; public enum CropType { diff --git a/src/main/java/net/buildtheearth/modules/generator/components/field/Field.java b/src/main/java/net/buildtheearth/buildteamtools/modules/generator/components/field/Field.java similarity index 75% rename from src/main/java/net/buildtheearth/modules/generator/components/field/Field.java rename to src/main/java/net/buildtheearth/buildteamtools/modules/generator/components/field/Field.java index f11d8e2a..69df9d05 100644 --- a/src/main/java/net/buildtheearth/modules/generator/components/field/Field.java +++ b/src/main/java/net/buildtheearth/buildteamtools/modules/generator/components/field/Field.java @@ -1,8 +1,8 @@ -package net.buildtheearth.modules.generator.components.field; +package net.buildtheearth.buildteamtools.modules.generator.components.field; import com.alpsbte.alpslib.utils.GeneratorUtils; -import net.buildtheearth.modules.generator.model.GeneratorComponent; -import net.buildtheearth.modules.generator.model.GeneratorType; +import net.buildtheearth.buildteamtools.modules.generator.model.GeneratorComponent; +import net.buildtheearth.buildteamtools.modules.generator.model.GeneratorType; import org.bukkit.entity.Player; public class Field extends GeneratorComponent { diff --git a/src/main/java/net/buildtheearth/modules/generator/components/field/FieldFlag.java b/src/main/java/net/buildtheearth/buildteamtools/modules/generator/components/field/FieldFlag.java similarity index 76% rename from src/main/java/net/buildtheearth/modules/generator/components/field/FieldFlag.java rename to src/main/java/net/buildtheearth/buildteamtools/modules/generator/components/field/FieldFlag.java index 10025e72..754e5cde 100644 --- a/src/main/java/net/buildtheearth/modules/generator/components/field/FieldFlag.java +++ b/src/main/java/net/buildtheearth/buildteamtools/modules/generator/components/field/FieldFlag.java @@ -1,7 +1,7 @@ -package net.buildtheearth.modules.generator.components.field; +package net.buildtheearth.buildteamtools.modules.generator.components.field; -import net.buildtheearth.modules.generator.model.FlagType; -import net.buildtheearth.modules.generator.model.Flag; +import net.buildtheearth.buildteamtools.modules.generator.model.Flag; +import net.buildtheearth.buildteamtools.modules.generator.model.FlagType; public enum FieldFlag implements Flag { diff --git a/src/main/java/net/buildtheearth/modules/generator/components/field/FieldScripts.java b/src/main/java/net/buildtheearth/buildteamtools/modules/generator/components/field/FieldScripts.java similarity index 97% rename from src/main/java/net/buildtheearth/modules/generator/components/field/FieldScripts.java rename to src/main/java/net/buildtheearth/buildteamtools/modules/generator/components/field/FieldScripts.java index aebe8665..88ab3e91 100644 --- a/src/main/java/net/buildtheearth/modules/generator/components/field/FieldScripts.java +++ b/src/main/java/net/buildtheearth/buildteamtools/modules/generator/components/field/FieldScripts.java @@ -1,9 +1,9 @@ -package net.buildtheearth.modules.generator.components.field; +package net.buildtheearth.buildteamtools.modules.generator.components.field; import com.alpsbte.alpslib.utils.GeneratorUtils; -import net.buildtheearth.modules.generator.model.Flag; -import net.buildtheearth.modules.generator.model.GeneratorComponent; -import net.buildtheearth.modules.generator.model.Script; +import net.buildtheearth.buildteamtools.modules.generator.model.Flag; +import net.buildtheearth.buildteamtools.modules.generator.model.GeneratorComponent; +import net.buildtheearth.buildteamtools.modules.generator.model.Script; import org.bukkit.block.Block; import org.bukkit.entity.Player; import org.bukkit.util.Vector; diff --git a/src/main/java/net/buildtheearth/modules/generator/components/field/FieldSettings.java b/src/main/java/net/buildtheearth/buildteamtools/modules/generator/components/field/FieldSettings.java similarity index 86% rename from src/main/java/net/buildtheearth/modules/generator/components/field/FieldSettings.java rename to src/main/java/net/buildtheearth/buildteamtools/modules/generator/components/field/FieldSettings.java index 35dede83..8f4395a7 100644 --- a/src/main/java/net/buildtheearth/modules/generator/components/field/FieldSettings.java +++ b/src/main/java/net/buildtheearth/buildteamtools/modules/generator/components/field/FieldSettings.java @@ -1,9 +1,9 @@ -package net.buildtheearth.modules.generator.components.field; +package net.buildtheearth.buildteamtools.modules.generator.components.field; import com.cryptomorin.xseries.XMaterial; -import net.buildtheearth.modules.generator.model.Settings; -import net.buildtheearth.utils.MenuItems; -import net.buildtheearth.utils.Utils; +import net.buildtheearth.buildteamtools.modules.generator.model.Settings; +import net.buildtheearth.buildteamtools.utils.MenuItems; +import net.buildtheearth.buildteamtools.utils.Utils; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; diff --git a/src/main/java/net/buildtheearth/modules/generator/components/field/menu/CropStageMenu.java b/src/main/java/net/buildtheearth/buildteamtools/modules/generator/components/field/menu/CropStageMenu.java similarity index 92% rename from src/main/java/net/buildtheearth/modules/generator/components/field/menu/CropStageMenu.java rename to src/main/java/net/buildtheearth/buildteamtools/modules/generator/components/field/menu/CropStageMenu.java index 32444cd4..329ac04e 100644 --- a/src/main/java/net/buildtheearth/modules/generator/components/field/menu/CropStageMenu.java +++ b/src/main/java/net/buildtheearth/buildteamtools/modules/generator/components/field/menu/CropStageMenu.java @@ -1,14 +1,14 @@ -package net.buildtheearth.modules.generator.components.field.menu; +package net.buildtheearth.buildteamtools.modules.generator.components.field.menu; import com.alpsbte.alpslib.utils.item.Item; import com.cryptomorin.xseries.XMaterial; -import net.buildtheearth.modules.generator.GeneratorModule; -import net.buildtheearth.modules.generator.components.field.*; -import net.buildtheearth.modules.generator.model.Settings; -import net.buildtheearth.utils.ListUtil; -import net.buildtheearth.utils.MenuItems; -import net.buildtheearth.utils.WikiLinks; -import net.buildtheearth.utils.menus.AbstractMenu; +import net.buildtheearth.buildteamtools.modules.generator.GeneratorModule; +import net.buildtheearth.buildteamtools.modules.generator.components.field.*; +import net.buildtheearth.buildteamtools.modules.generator.model.Settings; +import net.buildtheearth.buildteamtools.utils.ListUtil; +import net.buildtheearth.buildteamtools.utils.MenuItems; +import net.buildtheearth.buildteamtools.utils.WikiLinks; +import net.buildtheearth.buildteamtools.utils.menus.AbstractMenu; import net.kyori.adventure.text.Component; import net.kyori.adventure.text.format.NamedTextColor; import org.bukkit.Sound; diff --git a/src/main/java/net/buildtheearth/modules/generator/components/field/menu/CropTypeMenu.java b/src/main/java/net/buildtheearth/buildteamtools/modules/generator/components/field/menu/CropTypeMenu.java similarity index 91% rename from src/main/java/net/buildtheearth/modules/generator/components/field/menu/CropTypeMenu.java rename to src/main/java/net/buildtheearth/buildteamtools/modules/generator/components/field/menu/CropTypeMenu.java index b66528de..0180412d 100644 --- a/src/main/java/net/buildtheearth/modules/generator/components/field/menu/CropTypeMenu.java +++ b/src/main/java/net/buildtheearth/buildteamtools/modules/generator/components/field/menu/CropTypeMenu.java @@ -1,16 +1,16 @@ -package net.buildtheearth.modules.generator.components.field.menu; +package net.buildtheearth.buildteamtools.modules.generator.components.field.menu; import com.alpsbte.alpslib.utils.item.Item; import com.cryptomorin.xseries.XMaterial; -import net.buildtheearth.modules.generator.GeneratorModule; -import net.buildtheearth.modules.generator.components.field.CropType; -import net.buildtheearth.modules.generator.components.field.FieldFlag; -import net.buildtheearth.modules.generator.components.field.FieldSettings; -import net.buildtheearth.modules.generator.menu.GeneratorMenu; -import net.buildtheearth.modules.generator.model.Settings; -import net.buildtheearth.utils.ListUtil; -import net.buildtheearth.utils.MenuItems; -import net.buildtheearth.utils.menus.AbstractMenu; +import net.buildtheearth.buildteamtools.modules.generator.GeneratorModule; +import net.buildtheearth.buildteamtools.modules.generator.components.field.CropType; +import net.buildtheearth.buildteamtools.modules.generator.components.field.FieldFlag; +import net.buildtheearth.buildteamtools.modules.generator.components.field.FieldSettings; +import net.buildtheearth.buildteamtools.modules.generator.menu.GeneratorMenu; +import net.buildtheearth.buildteamtools.modules.generator.model.Settings; +import net.buildtheearth.buildteamtools.utils.ListUtil; +import net.buildtheearth.buildteamtools.utils.MenuItems; +import net.buildtheearth.buildteamtools.utils.menus.AbstractMenu; import org.bukkit.Sound; import org.bukkit.entity.Player; import org.bukkit.event.inventory.ClickType; diff --git a/src/main/java/net/buildtheearth/modules/generator/components/field/menu/FenceTypeMenu.java b/src/main/java/net/buildtheearth/buildteamtools/modules/generator/components/field/menu/FenceTypeMenu.java similarity index 71% rename from src/main/java/net/buildtheearth/modules/generator/components/field/menu/FenceTypeMenu.java rename to src/main/java/net/buildtheearth/buildteamtools/modules/generator/components/field/menu/FenceTypeMenu.java index dd9e3ce3..85d0c503 100644 --- a/src/main/java/net/buildtheearth/modules/generator/components/field/menu/FenceTypeMenu.java +++ b/src/main/java/net/buildtheearth/buildteamtools/modules/generator/components/field/menu/FenceTypeMenu.java @@ -1,13 +1,13 @@ -package net.buildtheearth.modules.generator.components.field.menu; +package net.buildtheearth.buildteamtools.modules.generator.components.field.menu; import com.alpsbte.alpslib.utils.item.Item; -import net.buildtheearth.modules.generator.GeneratorModule; -import net.buildtheearth.modules.generator.components.field.FieldFlag; -import net.buildtheearth.modules.generator.components.field.FieldSettings; -import net.buildtheearth.modules.generator.model.Settings; -import net.buildtheearth.utils.MenuItems; -import net.buildtheearth.utils.menus.BlockListMenu; +import net.buildtheearth.buildteamtools.modules.generator.GeneratorModule; +import net.buildtheearth.buildteamtools.modules.generator.components.field.FieldFlag; +import net.buildtheearth.buildteamtools.modules.generator.components.field.FieldSettings; +import net.buildtheearth.buildteamtools.modules.generator.model.Settings; +import net.buildtheearth.buildteamtools.utils.MenuItems; +import net.buildtheearth.buildteamtools.utils.menus.BlockListMenu; import org.bukkit.Sound; import org.bukkit.entity.Player; diff --git a/src/main/java/net/buildtheearth/modules/generator/components/house/House.java b/src/main/java/net/buildtheearth/buildteamtools/modules/generator/components/house/House.java similarity index 80% rename from src/main/java/net/buildtheearth/modules/generator/components/house/House.java rename to src/main/java/net/buildtheearth/buildteamtools/modules/generator/components/house/House.java index 5d618fe7..e0da3777 100644 --- a/src/main/java/net/buildtheearth/modules/generator/components/house/House.java +++ b/src/main/java/net/buildtheearth/buildteamtools/modules/generator/components/house/House.java @@ -1,8 +1,8 @@ -package net.buildtheearth.modules.generator.components.house; +package net.buildtheearth.buildteamtools.modules.generator.components.house; import com.alpsbte.alpslib.utils.GeneratorUtils; -import net.buildtheearth.modules.generator.model.GeneratorComponent; -import net.buildtheearth.modules.generator.model.GeneratorType; +import net.buildtheearth.buildteamtools.modules.generator.model.GeneratorComponent; +import net.buildtheearth.buildteamtools.modules.generator.model.GeneratorType; import org.bukkit.block.Block; import org.bukkit.entity.Player; diff --git a/src/main/java/net/buildtheearth/modules/generator/components/house/HouseFlag.java b/src/main/java/net/buildtheearth/buildteamtools/modules/generator/components/house/HouseFlag.java similarity index 84% rename from src/main/java/net/buildtheearth/modules/generator/components/house/HouseFlag.java rename to src/main/java/net/buildtheearth/buildteamtools/modules/generator/components/house/HouseFlag.java index b1685bfe..117d011b 100644 --- a/src/main/java/net/buildtheearth/modules/generator/components/house/HouseFlag.java +++ b/src/main/java/net/buildtheearth/buildteamtools/modules/generator/components/house/HouseFlag.java @@ -1,7 +1,7 @@ -package net.buildtheearth.modules.generator.components.house; +package net.buildtheearth.buildteamtools.modules.generator.components.house; -import net.buildtheearth.modules.generator.model.FlagType; -import net.buildtheearth.modules.generator.model.Flag; +import net.buildtheearth.buildteamtools.modules.generator.model.Flag; +import net.buildtheearth.buildteamtools.modules.generator.model.FlagType; public enum HouseFlag implements Flag { WALL_COLOR("w", FlagType.XMATERIAL_LIST), diff --git a/src/main/java/net/buildtheearth/modules/generator/components/house/HouseScripts.java b/src/main/java/net/buildtheearth/buildteamtools/modules/generator/components/house/HouseScripts.java similarity index 99% rename from src/main/java/net/buildtheearth/modules/generator/components/house/HouseScripts.java rename to src/main/java/net/buildtheearth/buildteamtools/modules/generator/components/house/HouseScripts.java index 0e1af58b..c972420b 100644 --- a/src/main/java/net/buildtheearth/modules/generator/components/house/HouseScripts.java +++ b/src/main/java/net/buildtheearth/buildteamtools/modules/generator/components/house/HouseScripts.java @@ -1,4 +1,4 @@ -package net.buildtheearth.modules.generator.components.house; +package net.buildtheearth.buildteamtools.modules.generator.components.house; import com.alpsbte.alpslib.utils.GeneratorUtils; import com.alpsbte.alpslib.utils.item.Item; @@ -7,11 +7,11 @@ import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockType; import com.sk89q.worldedit.world.block.BlockTypes; -import net.buildtheearth.BuildTeamTools; -import net.buildtheearth.modules.generator.model.Flag; -import net.buildtheearth.modules.generator.model.GeneratorComponent; -import net.buildtheearth.modules.generator.model.Script; -import net.buildtheearth.utils.MenuItems; +import net.buildtheearth.buildteamtools.BuildTeamTools; +import net.buildtheearth.buildteamtools.modules.generator.model.Flag; +import net.buildtheearth.buildteamtools.modules.generator.model.GeneratorComponent; +import net.buildtheearth.buildteamtools.modules.generator.model.Script; +import net.buildtheearth.buildteamtools.utils.MenuItems; import org.bukkit.Bukkit; import org.bukkit.block.Block; import org.bukkit.entity.Player; diff --git a/src/main/java/net/buildtheearth/modules/generator/components/house/HouseSettings.java b/src/main/java/net/buildtheearth/buildteamtools/modules/generator/components/house/HouseSettings.java similarity index 91% rename from src/main/java/net/buildtheearth/modules/generator/components/house/HouseSettings.java rename to src/main/java/net/buildtheearth/buildteamtools/modules/generator/components/house/HouseSettings.java index ae0caa54..95c0ef45 100644 --- a/src/main/java/net/buildtheearth/modules/generator/components/house/HouseSettings.java +++ b/src/main/java/net/buildtheearth/buildteamtools/modules/generator/components/house/HouseSettings.java @@ -1,9 +1,9 @@ -package net.buildtheearth.modules.generator.components.house; +package net.buildtheearth.buildteamtools.modules.generator.components.house; import com.cryptomorin.xseries.XMaterial; -import net.buildtheearth.modules.generator.model.Settings; -import net.buildtheearth.utils.MenuItems; -import net.buildtheearth.utils.Utils; +import net.buildtheearth.buildteamtools.modules.generator.model.Settings; +import net.buildtheearth.buildteamtools.utils.MenuItems; +import net.buildtheearth.buildteamtools.utils.Utils; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; diff --git a/src/main/java/net/buildtheearth/modules/generator/components/house/RoofType.java b/src/main/java/net/buildtheearth/buildteamtools/modules/generator/components/house/RoofType.java similarity index 87% rename from src/main/java/net/buildtheearth/modules/generator/components/house/RoofType.java rename to src/main/java/net/buildtheearth/buildteamtools/modules/generator/components/house/RoofType.java index 41e51280..9312da19 100644 --- a/src/main/java/net/buildtheearth/modules/generator/components/house/RoofType.java +++ b/src/main/java/net/buildtheearth/buildteamtools/modules/generator/components/house/RoofType.java @@ -1,4 +1,4 @@ -package net.buildtheearth.modules.generator.components.house; +package net.buildtheearth.buildteamtools.modules.generator.components.house; public enum RoofType { diff --git a/src/main/java/net/buildtheearth/modules/generator/components/house/menu/AdvancedSettingsMenu.java b/src/main/java/net/buildtheearth/buildteamtools/modules/generator/components/house/menu/AdvancedSettingsMenu.java similarity index 89% rename from src/main/java/net/buildtheearth/modules/generator/components/house/menu/AdvancedSettingsMenu.java rename to src/main/java/net/buildtheearth/buildteamtools/modules/generator/components/house/menu/AdvancedSettingsMenu.java index cfe85206..69dd70a7 100644 --- a/src/main/java/net/buildtheearth/modules/generator/components/house/menu/AdvancedSettingsMenu.java +++ b/src/main/java/net/buildtheearth/buildteamtools/modules/generator/components/house/menu/AdvancedSettingsMenu.java @@ -1,13 +1,13 @@ -package net.buildtheearth.modules.generator.components.house.menu; - -import net.buildtheearth.modules.generator.GeneratorModule; -import net.buildtheearth.modules.generator.model.Settings; -import net.buildtheearth.modules.generator.components.house.House; -import net.buildtheearth.modules.generator.components.house.HouseFlag; -import net.buildtheearth.modules.generator.components.house.HouseSettings; -import net.buildtheearth.utils.CustomHeads; -import net.buildtheearth.utils.MenuItems; -import net.buildtheearth.utils.menus.AbstractMenu; +package net.buildtheearth.buildteamtools.modules.generator.components.house.menu; + +import net.buildtheearth.buildteamtools.modules.generator.GeneratorModule; +import net.buildtheearth.buildteamtools.modules.generator.components.house.House; +import net.buildtheearth.buildteamtools.modules.generator.components.house.HouseFlag; +import net.buildtheearth.buildteamtools.modules.generator.components.house.HouseSettings; +import net.buildtheearth.buildteamtools.modules.generator.model.Settings; +import net.buildtheearth.buildteamtools.utils.CustomHeads; +import net.buildtheearth.buildteamtools.utils.MenuItems; +import net.buildtheearth.buildteamtools.utils.menus.AbstractMenu; import org.bukkit.Sound; import org.bukkit.entity.Player; import org.ipvp.canvas.mask.BinaryMask; diff --git a/src/main/java/net/buildtheearth/modules/generator/components/house/menu/BaseColorMenu.java b/src/main/java/net/buildtheearth/buildteamtools/modules/generator/components/house/menu/BaseColorMenu.java similarity index 71% rename from src/main/java/net/buildtheearth/modules/generator/components/house/menu/BaseColorMenu.java rename to src/main/java/net/buildtheearth/buildteamtools/modules/generator/components/house/menu/BaseColorMenu.java index 455e412c..cecb09af 100644 --- a/src/main/java/net/buildtheearth/modules/generator/components/house/menu/BaseColorMenu.java +++ b/src/main/java/net/buildtheearth/buildteamtools/modules/generator/components/house/menu/BaseColorMenu.java @@ -1,12 +1,12 @@ -package net.buildtheearth.modules.generator.components.house.menu; +package net.buildtheearth.buildteamtools.modules.generator.components.house.menu; import com.alpsbte.alpslib.utils.item.Item; -import net.buildtheearth.modules.generator.GeneratorModule; -import net.buildtheearth.modules.generator.components.house.HouseFlag; -import net.buildtheearth.modules.generator.components.house.HouseSettings; -import net.buildtheearth.modules.generator.model.Settings; -import net.buildtheearth.utils.MenuItems; -import net.buildtheearth.utils.menus.BlockListMenu; +import net.buildtheearth.buildteamtools.modules.generator.GeneratorModule; +import net.buildtheearth.buildteamtools.modules.generator.components.house.HouseFlag; +import net.buildtheearth.buildteamtools.modules.generator.components.house.HouseSettings; +import net.buildtheearth.buildteamtools.modules.generator.model.Settings; +import net.buildtheearth.buildteamtools.utils.MenuItems; +import net.buildtheearth.buildteamtools.utils.menus.BlockListMenu; import org.bukkit.Sound; import org.bukkit.entity.Player; diff --git a/src/main/java/net/buildtheearth/modules/generator/components/house/menu/RoofColorMenu.java b/src/main/java/net/buildtheearth/buildteamtools/modules/generator/components/house/menu/RoofColorMenu.java similarity index 80% rename from src/main/java/net/buildtheearth/modules/generator/components/house/menu/RoofColorMenu.java rename to src/main/java/net/buildtheearth/buildteamtools/modules/generator/components/house/menu/RoofColorMenu.java index 4acab2f3..698a53a5 100644 --- a/src/main/java/net/buildtheearth/modules/generator/components/house/menu/RoofColorMenu.java +++ b/src/main/java/net/buildtheearth/buildteamtools/modules/generator/components/house/menu/RoofColorMenu.java @@ -1,13 +1,13 @@ -package net.buildtheearth.modules.generator.components.house.menu; +package net.buildtheearth.buildteamtools.modules.generator.components.house.menu; import com.alpsbte.alpslib.utils.item.Item; -import net.buildtheearth.modules.generator.GeneratorModule; -import net.buildtheearth.modules.generator.components.house.HouseFlag; -import net.buildtheearth.modules.generator.components.house.HouseSettings; -import net.buildtheearth.modules.generator.components.house.RoofType; -import net.buildtheearth.modules.generator.model.Settings; -import net.buildtheearth.utils.MenuItems; -import net.buildtheearth.utils.menus.BlockListMenu; +import net.buildtheearth.buildteamtools.modules.generator.GeneratorModule; +import net.buildtheearth.buildteamtools.modules.generator.components.house.HouseFlag; +import net.buildtheearth.buildteamtools.modules.generator.components.house.HouseSettings; +import net.buildtheearth.buildteamtools.modules.generator.components.house.RoofType; +import net.buildtheearth.buildteamtools.modules.generator.model.Settings; +import net.buildtheearth.buildteamtools.utils.MenuItems; +import net.buildtheearth.buildteamtools.utils.menus.BlockListMenu; import org.bukkit.Sound; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; diff --git a/src/main/java/net/buildtheearth/modules/generator/components/house/menu/RoofTypeMenu.java b/src/main/java/net/buildtheearth/buildteamtools/modules/generator/components/house/menu/RoofTypeMenu.java similarity index 87% rename from src/main/java/net/buildtheearth/modules/generator/components/house/menu/RoofTypeMenu.java rename to src/main/java/net/buildtheearth/buildteamtools/modules/generator/components/house/menu/RoofTypeMenu.java index 5cc30dbc..204384c0 100644 --- a/src/main/java/net/buildtheearth/modules/generator/components/house/menu/RoofTypeMenu.java +++ b/src/main/java/net/buildtheearth/buildteamtools/modules/generator/components/house/menu/RoofTypeMenu.java @@ -1,15 +1,15 @@ -package net.buildtheearth.modules.generator.components.house.menu; +package net.buildtheearth.buildteamtools.modules.generator.components.house.menu; import com.alpsbte.alpslib.utils.item.Item; import com.cryptomorin.xseries.XMaterial; -import net.buildtheearth.modules.generator.GeneratorModule; -import net.buildtheearth.modules.generator.components.house.HouseFlag; -import net.buildtheearth.modules.generator.components.house.HouseSettings; -import net.buildtheearth.modules.generator.components.house.RoofType; -import net.buildtheearth.modules.generator.model.Settings; -import net.buildtheearth.utils.ListUtil; -import net.buildtheearth.utils.MenuItems; -import net.buildtheearth.utils.menus.AbstractMenu; +import net.buildtheearth.buildteamtools.modules.generator.GeneratorModule; +import net.buildtheearth.buildteamtools.modules.generator.components.house.HouseFlag; +import net.buildtheearth.buildteamtools.modules.generator.components.house.HouseSettings; +import net.buildtheearth.buildteamtools.modules.generator.components.house.RoofType; +import net.buildtheearth.buildteamtools.modules.generator.model.Settings; +import net.buildtheearth.buildteamtools.utils.ListUtil; +import net.buildtheearth.buildteamtools.utils.MenuItems; +import net.buildtheearth.buildteamtools.utils.menus.AbstractMenu; import org.bukkit.Sound; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; diff --git a/src/main/java/net/buildtheearth/modules/generator/components/house/menu/WallColorMenu.java b/src/main/java/net/buildtheearth/buildteamtools/modules/generator/components/house/menu/WallColorMenu.java similarity index 68% rename from src/main/java/net/buildtheearth/modules/generator/components/house/menu/WallColorMenu.java rename to src/main/java/net/buildtheearth/buildteamtools/modules/generator/components/house/menu/WallColorMenu.java index 41d1ac45..bb68936e 100644 --- a/src/main/java/net/buildtheearth/modules/generator/components/house/menu/WallColorMenu.java +++ b/src/main/java/net/buildtheearth/buildteamtools/modules/generator/components/house/menu/WallColorMenu.java @@ -1,13 +1,13 @@ -package net.buildtheearth.modules.generator.components.house.menu; +package net.buildtheearth.buildteamtools.modules.generator.components.house.menu; import com.alpsbte.alpslib.utils.item.Item; -import net.buildtheearth.modules.generator.GeneratorModule; -import net.buildtheearth.modules.generator.components.house.HouseFlag; -import net.buildtheearth.modules.generator.components.house.HouseSettings; -import net.buildtheearth.modules.generator.menu.GeneratorMenu; -import net.buildtheearth.modules.generator.model.Settings; -import net.buildtheearth.utils.MenuItems; -import net.buildtheearth.utils.menus.BlockListMenu; +import net.buildtheearth.buildteamtools.modules.generator.GeneratorModule; +import net.buildtheearth.buildteamtools.modules.generator.components.house.HouseFlag; +import net.buildtheearth.buildteamtools.modules.generator.components.house.HouseSettings; +import net.buildtheearth.buildteamtools.modules.generator.menu.GeneratorMenu; +import net.buildtheearth.buildteamtools.modules.generator.model.Settings; +import net.buildtheearth.buildteamtools.utils.MenuItems; +import net.buildtheearth.buildteamtools.utils.menus.BlockListMenu; import org.bukkit.Sound; import org.bukkit.entity.Player; diff --git a/src/main/java/net/buildtheearth/modules/generator/components/kml/BlockCreationMode.java b/src/main/java/net/buildtheearth/buildteamtools/modules/generator/components/kml/BlockCreationMode.java similarity index 63% rename from src/main/java/net/buildtheearth/modules/generator/components/kml/BlockCreationMode.java rename to src/main/java/net/buildtheearth/buildteamtools/modules/generator/components/kml/BlockCreationMode.java index a9a40065..00a47a48 100644 --- a/src/main/java/net/buildtheearth/modules/generator/components/kml/BlockCreationMode.java +++ b/src/main/java/net/buildtheearth/buildteamtools/modules/generator/components/kml/BlockCreationMode.java @@ -1,4 +1,4 @@ -package net.buildtheearth.modules.generator.components.kml; +package net.buildtheearth.buildteamtools.modules.generator.components.kml; public enum BlockCreationMode { POINTS, //geopoints diff --git a/src/main/java/net/buildtheearth/modules/generator/components/kml/ChangeTransaction.java b/src/main/java/net/buildtheearth/buildteamtools/modules/generator/components/kml/ChangeTransaction.java similarity index 96% rename from src/main/java/net/buildtheearth/modules/generator/components/kml/ChangeTransaction.java rename to src/main/java/net/buildtheearth/buildteamtools/modules/generator/components/kml/ChangeTransaction.java index 3125360d..d545b900 100644 --- a/src/main/java/net/buildtheearth/modules/generator/components/kml/ChangeTransaction.java +++ b/src/main/java/net/buildtheearth/buildteamtools/modules/generator/components/kml/ChangeTransaction.java @@ -1,18 +1,16 @@ -package net.buildtheearth.modules.generator.components.kml; - -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Set; +package net.buildtheearth.buildteamtools.modules.generator.components.kml; +import net.buildtheearth.buildteamtools.utils.BlockLocation; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.World; import org.bukkit.block.Block; import org.bukkit.entity.Player; - -import net.buildtheearth.utils.BlockLocation; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; /** * A set of block changes that should be bundled together. diff --git a/src/main/java/net/buildtheearth/modules/generator/components/kml/KmlCommand.java b/src/main/java/net/buildtheearth/buildteamtools/modules/generator/components/kml/KmlCommand.java similarity index 98% rename from src/main/java/net/buildtheearth/modules/generator/components/kml/KmlCommand.java rename to src/main/java/net/buildtheearth/buildteamtools/modules/generator/components/kml/KmlCommand.java index 9bb511c4..78520890 100644 --- a/src/main/java/net/buildtheearth/modules/generator/components/kml/KmlCommand.java +++ b/src/main/java/net/buildtheearth/buildteamtools/modules/generator/components/kml/KmlCommand.java @@ -1,13 +1,13 @@ -package net.buildtheearth.modules.generator.components.kml; +package net.buildtheearth.buildteamtools.modules.generator.components.kml; import com.alpsbte.alpslib.utils.ChatHelper; import com.cryptomorin.xseries.XMaterial; import de.micromata.opengis.kml.v_2_2_0.Coordinate; -import net.buildtheearth.BuildTeamTools; -import net.buildtheearth.utils.BlockLocation; -import net.buildtheearth.utils.GeometricUtils; -import net.buildtheearth.utils.LineRasterization; -import net.buildtheearth.utils.PolygonTools; +import net.buildtheearth.buildteamtools.BuildTeamTools; +import net.buildtheearth.buildteamtools.utils.BlockLocation; +import net.buildtheearth.buildteamtools.utils.GeometricUtils; +import net.buildtheearth.buildteamtools.utils.LineRasterization; +import net.buildtheearth.buildteamtools.utils.PolygonTools; import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.Material; diff --git a/src/main/java/net/buildtheearth/modules/generator/components/kml/KmlParser.java b/src/main/java/net/buildtheearth/buildteamtools/modules/generator/components/kml/KmlParser.java similarity index 99% rename from src/main/java/net/buildtheearth/modules/generator/components/kml/KmlParser.java rename to src/main/java/net/buildtheearth/buildteamtools/modules/generator/components/kml/KmlParser.java index d48bdb06..8b9f92dc 100644 --- a/src/main/java/net/buildtheearth/modules/generator/components/kml/KmlParser.java +++ b/src/main/java/net/buildtheearth/buildteamtools/modules/generator/components/kml/KmlParser.java @@ -1,4 +1,4 @@ -package net.buildtheearth.modules.generator.components.kml; +package net.buildtheearth.buildteamtools.modules.generator.components.kml; import de.micromata.opengis.kml.v_2_2_0.*; diff --git a/src/main/java/net/buildtheearth/modules/generator/components/kml/KmlTabCompleter.java b/src/main/java/net/buildtheearth/buildteamtools/modules/generator/components/kml/KmlTabCompleter.java similarity index 97% rename from src/main/java/net/buildtheearth/modules/generator/components/kml/KmlTabCompleter.java rename to src/main/java/net/buildtheearth/buildteamtools/modules/generator/components/kml/KmlTabCompleter.java index 2d2a3ecc..3695e2f8 100644 --- a/src/main/java/net/buildtheearth/modules/generator/components/kml/KmlTabCompleter.java +++ b/src/main/java/net/buildtheearth/buildteamtools/modules/generator/components/kml/KmlTabCompleter.java @@ -1,8 +1,4 @@ -package net.buildtheearth.modules.generator.components.kml; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; +package net.buildtheearth.buildteamtools.modules.generator.components.kml; import org.bukkit.Material; import org.bukkit.command.Command; @@ -10,6 +6,10 @@ import org.bukkit.command.TabCompleter; import org.bukkit.entity.Player; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + public class KmlTabCompleter implements TabCompleter{ public KmlTabCompleter(){ //compile list of block material types for completion diff --git a/src/main/java/net/buildtheearth/modules/generator/components/rail/Rail.java b/src/main/java/net/buildtheearth/buildteamtools/modules/generator/components/rail/Rail.java similarity index 62% rename from src/main/java/net/buildtheearth/modules/generator/components/rail/Rail.java rename to src/main/java/net/buildtheearth/buildteamtools/modules/generator/components/rail/Rail.java index 4d06e3cc..b0a7b913 100644 --- a/src/main/java/net/buildtheearth/modules/generator/components/rail/Rail.java +++ b/src/main/java/net/buildtheearth/buildteamtools/modules/generator/components/rail/Rail.java @@ -1,9 +1,9 @@ -package net.buildtheearth.modules.generator.components.rail; +package net.buildtheearth.buildteamtools.modules.generator.components.rail; import com.alpsbte.alpslib.utils.GeneratorUtils; -import net.buildtheearth.modules.generator.GeneratorModule; -import net.buildtheearth.modules.generator.model.GeneratorComponent; -import net.buildtheearth.modules.generator.model.GeneratorType; +import net.buildtheearth.buildteamtools.modules.generator.GeneratorModule; +import net.buildtheearth.buildteamtools.modules.generator.model.GeneratorComponent; +import net.buildtheearth.buildteamtools.modules.generator.model.GeneratorType; import org.bukkit.entity.Player; public class Rail extends GeneratorComponent { diff --git a/src/main/java/net/buildtheearth/modules/generator/components/rail/RailFlag.java b/src/main/java/net/buildtheearth/buildteamtools/modules/generator/components/rail/RailFlag.java similarity index 74% rename from src/main/java/net/buildtheearth/modules/generator/components/rail/RailFlag.java rename to src/main/java/net/buildtheearth/buildteamtools/modules/generator/components/rail/RailFlag.java index e0d17484..a78994b0 100644 --- a/src/main/java/net/buildtheearth/modules/generator/components/rail/RailFlag.java +++ b/src/main/java/net/buildtheearth/buildteamtools/modules/generator/components/rail/RailFlag.java @@ -1,7 +1,7 @@ -package net.buildtheearth.modules.generator.components.rail; +package net.buildtheearth.buildteamtools.modules.generator.components.rail; -import net.buildtheearth.modules.generator.model.FlagType; -import net.buildtheearth.modules.generator.model.Flag; +import net.buildtheearth.buildteamtools.modules.generator.model.Flag; +import net.buildtheearth.buildteamtools.modules.generator.model.FlagType; public enum RailFlag implements Flag { LANE_COUNT("c", FlagType.INTEGER); diff --git a/src/main/java/net/buildtheearth/modules/generator/components/rail/RailScripts.java b/src/main/java/net/buildtheearth/buildteamtools/modules/generator/components/rail/RailScripts.java similarity index 95% rename from src/main/java/net/buildtheearth/modules/generator/components/rail/RailScripts.java rename to src/main/java/net/buildtheearth/buildteamtools/modules/generator/components/rail/RailScripts.java index 1593df6b..ab1156d2 100644 --- a/src/main/java/net/buildtheearth/modules/generator/components/rail/RailScripts.java +++ b/src/main/java/net/buildtheearth/buildteamtools/modules/generator/components/rail/RailScripts.java @@ -1,8 +1,8 @@ -package net.buildtheearth.modules.generator.components.rail; +package net.buildtheearth.buildteamtools.modules.generator.components.rail; import com.alpsbte.alpslib.utils.GeneratorUtils; -import net.buildtheearth.modules.generator.model.GeneratorComponent; -import net.buildtheearth.modules.generator.model.Script; +import net.buildtheearth.buildteamtools.modules.generator.model.GeneratorComponent; +import net.buildtheearth.buildteamtools.modules.generator.model.Script; import org.bukkit.block.Block; import org.bukkit.entity.Player; import org.bukkit.util.Vector; diff --git a/src/main/java/net/buildtheearth/modules/generator/components/rail/RailSettings.java b/src/main/java/net/buildtheearth/buildteamtools/modules/generator/components/rail/RailSettings.java similarity index 65% rename from src/main/java/net/buildtheearth/modules/generator/components/rail/RailSettings.java rename to src/main/java/net/buildtheearth/buildteamtools/modules/generator/components/rail/RailSettings.java index 9b62c40e..0d7ef243 100644 --- a/src/main/java/net/buildtheearth/modules/generator/components/rail/RailSettings.java +++ b/src/main/java/net/buildtheearth/buildteamtools/modules/generator/components/rail/RailSettings.java @@ -1,6 +1,6 @@ -package net.buildtheearth.modules.generator.components.rail; +package net.buildtheearth.buildteamtools.modules.generator.components.rail; -import net.buildtheearth.modules.generator.model.Settings; +import net.buildtheearth.buildteamtools.modules.generator.model.Settings; import org.bukkit.entity.Player; public class RailSettings extends Settings { diff --git a/src/main/java/net/buildtheearth/modules/generator/components/road/Road.java b/src/main/java/net/buildtheearth/buildteamtools/modules/generator/components/road/Road.java similarity index 61% rename from src/main/java/net/buildtheearth/modules/generator/components/road/Road.java rename to src/main/java/net/buildtheearth/buildteamtools/modules/generator/components/road/Road.java index c22f1831..dc133d3f 100644 --- a/src/main/java/net/buildtheearth/modules/generator/components/road/Road.java +++ b/src/main/java/net/buildtheearth/buildteamtools/modules/generator/components/road/Road.java @@ -1,9 +1,9 @@ -package net.buildtheearth.modules.generator.components.road; +package net.buildtheearth.buildteamtools.modules.generator.components.road; import com.alpsbte.alpslib.utils.GeneratorUtils; -import net.buildtheearth.modules.generator.GeneratorModule; -import net.buildtheearth.modules.generator.model.GeneratorComponent; -import net.buildtheearth.modules.generator.model.GeneratorType; +import net.buildtheearth.buildteamtools.modules.generator.GeneratorModule; +import net.buildtheearth.buildteamtools.modules.generator.model.GeneratorComponent; +import net.buildtheearth.buildteamtools.modules.generator.model.GeneratorType; import org.bukkit.entity.Player; public class Road extends GeneratorComponent { diff --git a/src/main/java/net/buildtheearth/modules/generator/components/road/RoadFlag.java b/src/main/java/net/buildtheearth/buildteamtools/modules/generator/components/road/RoadFlag.java similarity index 85% rename from src/main/java/net/buildtheearth/modules/generator/components/road/RoadFlag.java rename to src/main/java/net/buildtheearth/buildteamtools/modules/generator/components/road/RoadFlag.java index 9205134b..79760261 100644 --- a/src/main/java/net/buildtheearth/modules/generator/components/road/RoadFlag.java +++ b/src/main/java/net/buildtheearth/buildteamtools/modules/generator/components/road/RoadFlag.java @@ -1,8 +1,8 @@ -package net.buildtheearth.modules.generator.components.road; +package net.buildtheearth.buildteamtools.modules.generator.components.road; -import net.buildtheearth.modules.generator.model.FlagType; -import net.buildtheearth.modules.generator.model.Flag; +import net.buildtheearth.buildteamtools.modules.generator.model.Flag; +import net.buildtheearth.buildteamtools.modules.generator.model.FlagType; public enum RoadFlag implements Flag { LANE_COUNT("c", FlagType.INTEGER), diff --git a/src/main/java/net/buildtheearth/modules/generator/components/road/RoadScripts.java b/src/main/java/net/buildtheearth/buildteamtools/modules/generator/components/road/RoadScripts.java similarity index 98% rename from src/main/java/net/buildtheearth/modules/generator/components/road/RoadScripts.java rename to src/main/java/net/buildtheearth/buildteamtools/modules/generator/components/road/RoadScripts.java index d3090857..7fbaa368 100644 --- a/src/main/java/net/buildtheearth/modules/generator/components/road/RoadScripts.java +++ b/src/main/java/net/buildtheearth/buildteamtools/modules/generator/components/road/RoadScripts.java @@ -1,13 +1,13 @@ -package net.buildtheearth.modules.generator.components.road; +package net.buildtheearth.buildteamtools.modules.generator.components.road; import com.alpsbte.alpslib.utils.GeneratorUtils; import com.alpsbte.alpslib.utils.item.Item; import com.cryptomorin.xseries.XMaterial; -import net.buildtheearth.modules.common.CommonModule; -import net.buildtheearth.modules.generator.model.Flag; -import net.buildtheearth.modules.generator.model.GeneratorComponent; -import net.buildtheearth.modules.generator.model.Script; +import net.buildtheearth.buildteamtools.modules.common.CommonModule; +import net.buildtheearth.buildteamtools.modules.generator.model.Flag; +import net.buildtheearth.buildteamtools.modules.generator.model.GeneratorComponent; +import net.buildtheearth.buildteamtools.modules.generator.model.Script; import org.bukkit.Location; import org.bukkit.block.Block; import org.bukkit.entity.Player; diff --git a/src/main/java/net/buildtheearth/modules/generator/components/road/RoadSettings.java b/src/main/java/net/buildtheearth/buildteamtools/modules/generator/components/road/RoadSettings.java similarity index 94% rename from src/main/java/net/buildtheearth/modules/generator/components/road/RoadSettings.java rename to src/main/java/net/buildtheearth/buildteamtools/modules/generator/components/road/RoadSettings.java index 8312b288..1cda8457 100644 --- a/src/main/java/net/buildtheearth/modules/generator/components/road/RoadSettings.java +++ b/src/main/java/net/buildtheearth/buildteamtools/modules/generator/components/road/RoadSettings.java @@ -1,8 +1,8 @@ -package net.buildtheearth.modules.generator.components.road; +package net.buildtheearth.buildteamtools.modules.generator.components.road; import com.alpsbte.alpslib.utils.GeneratorUtils; import com.cryptomorin.xseries.XMaterial; -import net.buildtheearth.modules.generator.model.Settings; +import net.buildtheearth.buildteamtools.modules.generator.model.Settings; import org.bukkit.entity.Player; import java.io.File; diff --git a/src/main/java/net/buildtheearth/modules/generator/components/road/menu/AdvancedColorMenu.java b/src/main/java/net/buildtheearth/buildteamtools/modules/generator/components/road/menu/AdvancedColorMenu.java similarity index 74% rename from src/main/java/net/buildtheearth/modules/generator/components/road/menu/AdvancedColorMenu.java rename to src/main/java/net/buildtheearth/buildteamtools/modules/generator/components/road/menu/AdvancedColorMenu.java index bd647800..0a4e79c6 100644 --- a/src/main/java/net/buildtheearth/modules/generator/components/road/menu/AdvancedColorMenu.java +++ b/src/main/java/net/buildtheearth/buildteamtools/modules/generator/components/road/menu/AdvancedColorMenu.java @@ -1,11 +1,11 @@ -package net.buildtheearth.modules.generator.components.road.menu; +package net.buildtheearth.buildteamtools.modules.generator.components.road.menu; import com.alpsbte.alpslib.utils.item.Item; -import net.buildtheearth.modules.generator.GeneratorModule; -import net.buildtheearth.modules.generator.components.road.RoadFlag; -import net.buildtheearth.modules.generator.components.road.RoadSettings; -import net.buildtheearth.modules.generator.model.Settings; -import net.buildtheearth.utils.menus.BlockListMenu; +import net.buildtheearth.buildteamtools.modules.generator.GeneratorModule; +import net.buildtheearth.buildteamtools.modules.generator.components.road.RoadFlag; +import net.buildtheearth.buildteamtools.modules.generator.components.road.RoadSettings; +import net.buildtheearth.buildteamtools.modules.generator.model.Settings; +import net.buildtheearth.buildteamtools.utils.menus.BlockListMenu; import org.bukkit.Sound; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; diff --git a/src/main/java/net/buildtheearth/modules/generator/components/road/menu/AdvancedSettingsMenu.java b/src/main/java/net/buildtheearth/buildteamtools/modules/generator/components/road/menu/AdvancedSettingsMenu.java similarity index 92% rename from src/main/java/net/buildtheearth/modules/generator/components/road/menu/AdvancedSettingsMenu.java rename to src/main/java/net/buildtheearth/buildteamtools/modules/generator/components/road/menu/AdvancedSettingsMenu.java index 9aa71755..40334242 100644 --- a/src/main/java/net/buildtheearth/modules/generator/components/road/menu/AdvancedSettingsMenu.java +++ b/src/main/java/net/buildtheearth/buildteamtools/modules/generator/components/road/menu/AdvancedSettingsMenu.java @@ -1,16 +1,16 @@ -package net.buildtheearth.modules.generator.components.road.menu; +package net.buildtheearth.buildteamtools.modules.generator.components.road.menu; import com.alpsbte.alpslib.utils.item.Item; import com.cryptomorin.xseries.XMaterial; -import net.buildtheearth.modules.generator.GeneratorModule; -import net.buildtheearth.modules.generator.components.road.Road; -import net.buildtheearth.modules.generator.components.road.RoadFlag; -import net.buildtheearth.modules.generator.components.road.RoadSettings; -import net.buildtheearth.modules.generator.model.Settings; -import net.buildtheearth.utils.CustomHeads; -import net.buildtheearth.utils.ListUtil; -import net.buildtheearth.utils.MenuItems; -import net.buildtheearth.utils.menus.AbstractMenu; +import net.buildtheearth.buildteamtools.modules.generator.GeneratorModule; +import net.buildtheearth.buildteamtools.modules.generator.components.road.Road; +import net.buildtheearth.buildteamtools.modules.generator.components.road.RoadFlag; +import net.buildtheearth.buildteamtools.modules.generator.components.road.RoadSettings; +import net.buildtheearth.buildteamtools.modules.generator.model.Settings; +import net.buildtheearth.buildteamtools.utils.CustomHeads; +import net.buildtheearth.buildteamtools.utils.ListUtil; +import net.buildtheearth.buildteamtools.utils.MenuItems; +import net.buildtheearth.buildteamtools.utils.menus.AbstractMenu; import org.bukkit.Sound; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; diff --git a/src/main/java/net/buildtheearth/modules/generator/components/road/menu/RoadColorMenu.java b/src/main/java/net/buildtheearth/buildteamtools/modules/generator/components/road/menu/RoadColorMenu.java similarity index 68% rename from src/main/java/net/buildtheearth/modules/generator/components/road/menu/RoadColorMenu.java rename to src/main/java/net/buildtheearth/buildteamtools/modules/generator/components/road/menu/RoadColorMenu.java index c46e2e30..d76379f6 100644 --- a/src/main/java/net/buildtheearth/modules/generator/components/road/menu/RoadColorMenu.java +++ b/src/main/java/net/buildtheearth/buildteamtools/modules/generator/components/road/menu/RoadColorMenu.java @@ -1,13 +1,13 @@ -package net.buildtheearth.modules.generator.components.road.menu; +package net.buildtheearth.buildteamtools.modules.generator.components.road.menu; import com.alpsbte.alpslib.utils.item.Item; -import net.buildtheearth.modules.generator.GeneratorModule; -import net.buildtheearth.modules.generator.components.road.RoadFlag; -import net.buildtheearth.modules.generator.components.road.RoadSettings; -import net.buildtheearth.modules.generator.menu.GeneratorMenu; -import net.buildtheearth.modules.generator.model.Settings; -import net.buildtheearth.utils.MenuItems; -import net.buildtheearth.utils.menus.BlockListMenu; +import net.buildtheearth.buildteamtools.modules.generator.GeneratorModule; +import net.buildtheearth.buildteamtools.modules.generator.components.road.RoadFlag; +import net.buildtheearth.buildteamtools.modules.generator.components.road.RoadSettings; +import net.buildtheearth.buildteamtools.modules.generator.menu.GeneratorMenu; +import net.buildtheearth.buildteamtools.modules.generator.model.Settings; +import net.buildtheearth.buildteamtools.utils.MenuItems; +import net.buildtheearth.buildteamtools.utils.menus.BlockListMenu; import org.bukkit.Sound; import org.bukkit.entity.Player; diff --git a/src/main/java/net/buildtheearth/modules/generator/components/road/menu/SidewalkColorMenu.java b/src/main/java/net/buildtheearth/buildteamtools/modules/generator/components/road/menu/SidewalkColorMenu.java similarity index 71% rename from src/main/java/net/buildtheearth/modules/generator/components/road/menu/SidewalkColorMenu.java rename to src/main/java/net/buildtheearth/buildteamtools/modules/generator/components/road/menu/SidewalkColorMenu.java index 2e6a7f84..8f79bf8d 100644 --- a/src/main/java/net/buildtheearth/modules/generator/components/road/menu/SidewalkColorMenu.java +++ b/src/main/java/net/buildtheearth/buildteamtools/modules/generator/components/road/menu/SidewalkColorMenu.java @@ -1,12 +1,12 @@ -package net.buildtheearth.modules.generator.components.road.menu; +package net.buildtheearth.buildteamtools.modules.generator.components.road.menu; import com.alpsbte.alpslib.utils.item.Item; -import net.buildtheearth.modules.generator.GeneratorModule; -import net.buildtheearth.modules.generator.components.road.RoadFlag; -import net.buildtheearth.modules.generator.components.road.RoadSettings; -import net.buildtheearth.modules.generator.model.Settings; -import net.buildtheearth.utils.MenuItems; -import net.buildtheearth.utils.menus.BlockListMenu; +import net.buildtheearth.buildteamtools.modules.generator.GeneratorModule; +import net.buildtheearth.buildteamtools.modules.generator.components.road.RoadFlag; +import net.buildtheearth.buildteamtools.modules.generator.components.road.RoadSettings; +import net.buildtheearth.buildteamtools.modules.generator.model.Settings; +import net.buildtheearth.buildteamtools.utils.MenuItems; +import net.buildtheearth.buildteamtools.utils.menus.BlockListMenu; import org.bukkit.Sound; import org.bukkit.entity.Player; diff --git a/src/main/java/net/buildtheearth/modules/generator/components/tree/Tree.java b/src/main/java/net/buildtheearth/buildteamtools/modules/generator/components/tree/Tree.java similarity index 81% rename from src/main/java/net/buildtheearth/modules/generator/components/tree/Tree.java rename to src/main/java/net/buildtheearth/buildteamtools/modules/generator/components/tree/Tree.java index a8189235..6c5e747f 100644 --- a/src/main/java/net/buildtheearth/modules/generator/components/tree/Tree.java +++ b/src/main/java/net/buildtheearth/buildteamtools/modules/generator/components/tree/Tree.java @@ -1,11 +1,11 @@ -package net.buildtheearth.modules.generator.components.tree; +package net.buildtheearth.buildteamtools.modules.generator.components.tree; import com.alpsbte.alpslib.utils.GeneratorUtils; import lombok.Getter; -import net.buildtheearth.BuildTeamTools; -import net.buildtheearth.modules.generator.model.GeneratorCollections; -import net.buildtheearth.modules.generator.model.GeneratorComponent; -import net.buildtheearth.modules.generator.model.GeneratorType; +import net.buildtheearth.buildteamtools.BuildTeamTools; +import net.buildtheearth.buildteamtools.modules.generator.model.GeneratorCollections; +import net.buildtheearth.buildteamtools.modules.generator.model.GeneratorComponent; +import net.buildtheearth.buildteamtools.modules.generator.model.GeneratorType; import org.bukkit.Bukkit; import org.bukkit.entity.Player; diff --git a/src/main/java/net/buildtheearth/modules/generator/components/tree/TreeFlag.java b/src/main/java/net/buildtheearth/buildteamtools/modules/generator/components/tree/TreeFlag.java similarity index 74% rename from src/main/java/net/buildtheearth/modules/generator/components/tree/TreeFlag.java rename to src/main/java/net/buildtheearth/buildteamtools/modules/generator/components/tree/TreeFlag.java index 85fd4de9..e23308bc 100644 --- a/src/main/java/net/buildtheearth/modules/generator/components/tree/TreeFlag.java +++ b/src/main/java/net/buildtheearth/buildteamtools/modules/generator/components/tree/TreeFlag.java @@ -1,8 +1,8 @@ -package net.buildtheearth.modules.generator.components.tree; +package net.buildtheearth.buildteamtools.modules.generator.components.tree; import lombok.Getter; -import net.buildtheearth.modules.generator.model.Flag; -import net.buildtheearth.modules.generator.model.FlagType; +import net.buildtheearth.buildteamtools.modules.generator.model.Flag; +import net.buildtheearth.buildteamtools.modules.generator.model.FlagType; import org.jspecify.annotations.Nullable; public enum TreeFlag implements Flag { diff --git a/src/main/java/net/buildtheearth/modules/generator/components/tree/TreeScripts.java b/src/main/java/net/buildtheearth/buildteamtools/modules/generator/components/tree/TreeScripts.java similarity index 92% rename from src/main/java/net/buildtheearth/modules/generator/components/tree/TreeScripts.java rename to src/main/java/net/buildtheearth/buildteamtools/modules/generator/components/tree/TreeScripts.java index 02307a5d..143a1c8c 100644 --- a/src/main/java/net/buildtheearth/modules/generator/components/tree/TreeScripts.java +++ b/src/main/java/net/buildtheearth/buildteamtools/modules/generator/components/tree/TreeScripts.java @@ -1,8 +1,8 @@ -package net.buildtheearth.modules.generator.components.tree; +package net.buildtheearth.buildteamtools.modules.generator.components.tree; import com.alpsbte.alpslib.utils.item.Item; import com.cryptomorin.xseries.XMaterial; -import net.buildtheearth.modules.generator.model.Settings; +import net.buildtheearth.buildteamtools.modules.generator.model.Settings; import org.bukkit.Material; import org.bukkit.entity.Player; import org.jspecify.annotations.NonNull; diff --git a/src/main/java/net/buildtheearth/modules/generator/components/tree/TreeSettings.java b/src/main/java/net/buildtheearth/buildteamtools/modules/generator/components/tree/TreeSettings.java similarity index 66% rename from src/main/java/net/buildtheearth/modules/generator/components/tree/TreeSettings.java rename to src/main/java/net/buildtheearth/buildteamtools/modules/generator/components/tree/TreeSettings.java index d751d0b5..dcf183e9 100644 --- a/src/main/java/net/buildtheearth/modules/generator/components/tree/TreeSettings.java +++ b/src/main/java/net/buildtheearth/buildteamtools/modules/generator/components/tree/TreeSettings.java @@ -1,7 +1,7 @@ -package net.buildtheearth.modules.generator.components.tree; +package net.buildtheearth.buildteamtools.modules.generator.components.tree; -import net.buildtheearth.modules.generator.model.Settings; -import net.buildtheearth.modules.generator.components.road.RoadFlag; +import net.buildtheearth.buildteamtools.modules.generator.components.road.RoadFlag; +import net.buildtheearth.buildteamtools.modules.generator.model.Settings; import org.bukkit.entity.Player; public class TreeSettings extends Settings { diff --git a/src/main/java/net/buildtheearth/modules/generator/components/tree/TreeType.java b/src/main/java/net/buildtheearth/buildteamtools/modules/generator/components/tree/TreeType.java similarity index 94% rename from src/main/java/net/buildtheearth/modules/generator/components/tree/TreeType.java rename to src/main/java/net/buildtheearth/buildteamtools/modules/generator/components/tree/TreeType.java index 1e0379ad..31d88fc3 100644 --- a/src/main/java/net/buildtheearth/modules/generator/components/tree/TreeType.java +++ b/src/main/java/net/buildtheearth/buildteamtools/modules/generator/components/tree/TreeType.java @@ -1,4 +1,4 @@ -package net.buildtheearth.modules.generator.components.tree; +package net.buildtheearth.buildteamtools.modules.generator.components.tree; import lombok.Getter; import org.jspecify.annotations.Nullable; diff --git a/src/main/java/net/buildtheearth/modules/generator/components/tree/TreeWidth.java b/src/main/java/net/buildtheearth/buildteamtools/modules/generator/components/tree/TreeWidth.java similarity index 87% rename from src/main/java/net/buildtheearth/modules/generator/components/tree/TreeWidth.java rename to src/main/java/net/buildtheearth/buildteamtools/modules/generator/components/tree/TreeWidth.java index af1eb7e3..3b958fe8 100644 --- a/src/main/java/net/buildtheearth/modules/generator/components/tree/TreeWidth.java +++ b/src/main/java/net/buildtheearth/buildteamtools/modules/generator/components/tree/TreeWidth.java @@ -1,4 +1,4 @@ -package net.buildtheearth.modules.generator.components.tree; +package net.buildtheearth.buildteamtools.modules.generator.components.tree; import lombok.Getter; import org.jspecify.annotations.Nullable; diff --git a/src/main/java/net/buildtheearth/modules/generator/components/tree/menu/TreeHeightMenu.java b/src/main/java/net/buildtheearth/buildteamtools/modules/generator/components/tree/menu/TreeHeightMenu.java similarity index 81% rename from src/main/java/net/buildtheearth/modules/generator/components/tree/menu/TreeHeightMenu.java rename to src/main/java/net/buildtheearth/buildteamtools/modules/generator/components/tree/menu/TreeHeightMenu.java index 993a7b4a..1683d870 100644 --- a/src/main/java/net/buildtheearth/modules/generator/components/tree/menu/TreeHeightMenu.java +++ b/src/main/java/net/buildtheearth/buildteamtools/modules/generator/components/tree/menu/TreeHeightMenu.java @@ -1,12 +1,12 @@ -package net.buildtheearth.modules.generator.components.tree.menu; +package net.buildtheearth.buildteamtools.modules.generator.components.tree.menu; import com.alpsbte.alpslib.utils.item.Item; import com.cryptomorin.xseries.XMaterial; -import net.buildtheearth.modules.generator.GeneratorModule; -import net.buildtheearth.modules.generator.components.tree.TreeFlag; -import net.buildtheearth.modules.generator.components.tree.TreeSettings; -import net.buildtheearth.modules.generator.model.Settings; -import net.buildtheearth.utils.menus.NameListMenu; +import net.buildtheearth.buildteamtools.modules.generator.GeneratorModule; +import net.buildtheearth.buildteamtools.modules.generator.components.tree.TreeFlag; +import net.buildtheearth.buildteamtools.modules.generator.components.tree.TreeSettings; +import net.buildtheearth.buildteamtools.modules.generator.model.Settings; +import net.buildtheearth.buildteamtools.utils.menus.NameListMenu; import net.daporkchop.lib.common.misc.Tuple; import org.apache.commons.lang3.StringUtils; import org.bukkit.Sound; diff --git a/src/main/java/net/buildtheearth/modules/generator/components/tree/menu/TreeTypeMenu.java b/src/main/java/net/buildtheearth/buildteamtools/modules/generator/components/tree/menu/TreeTypeMenu.java similarity index 76% rename from src/main/java/net/buildtheearth/modules/generator/components/tree/menu/TreeTypeMenu.java rename to src/main/java/net/buildtheearth/buildteamtools/modules/generator/components/tree/menu/TreeTypeMenu.java index bab6c688..d2de1d4a 100644 --- a/src/main/java/net/buildtheearth/modules/generator/components/tree/menu/TreeTypeMenu.java +++ b/src/main/java/net/buildtheearth/buildteamtools/modules/generator/components/tree/menu/TreeTypeMenu.java @@ -1,14 +1,14 @@ -package net.buildtheearth.modules.generator.components.tree.menu; +package net.buildtheearth.buildteamtools.modules.generator.components.tree.menu; import com.alpsbte.alpslib.utils.item.Item; import com.cryptomorin.xseries.XMaterial; -import net.buildtheearth.modules.generator.GeneratorModule; -import net.buildtheearth.modules.generator.components.tree.TreeFlag; -import net.buildtheearth.modules.generator.components.tree.TreeSettings; -import net.buildtheearth.modules.generator.components.tree.TreeType; -import net.buildtheearth.modules.generator.menu.GeneratorMenu; -import net.buildtheearth.modules.generator.model.Settings; -import net.buildtheearth.utils.menus.NameListMenu; +import net.buildtheearth.buildteamtools.modules.generator.GeneratorModule; +import net.buildtheearth.buildteamtools.modules.generator.components.tree.TreeFlag; +import net.buildtheearth.buildteamtools.modules.generator.components.tree.TreeSettings; +import net.buildtheearth.buildteamtools.modules.generator.components.tree.TreeType; +import net.buildtheearth.buildteamtools.modules.generator.menu.GeneratorMenu; +import net.buildtheearth.buildteamtools.modules.generator.model.Settings; +import net.buildtheearth.buildteamtools.utils.menus.NameListMenu; import net.daporkchop.lib.common.misc.Tuple; import org.apache.commons.lang3.StringUtils; import org.bukkit.Sound; diff --git a/src/main/java/net/buildtheearth/modules/generator/components/tree/menu/TreeWidthMenu.java b/src/main/java/net/buildtheearth/buildteamtools/modules/generator/components/tree/menu/TreeWidthMenu.java similarity index 78% rename from src/main/java/net/buildtheearth/modules/generator/components/tree/menu/TreeWidthMenu.java rename to src/main/java/net/buildtheearth/buildteamtools/modules/generator/components/tree/menu/TreeWidthMenu.java index 84a4f7bd..a8fb57a4 100644 --- a/src/main/java/net/buildtheearth/modules/generator/components/tree/menu/TreeWidthMenu.java +++ b/src/main/java/net/buildtheearth/buildteamtools/modules/generator/components/tree/menu/TreeWidthMenu.java @@ -1,13 +1,13 @@ -package net.buildtheearth.modules.generator.components.tree.menu; +package net.buildtheearth.buildteamtools.modules.generator.components.tree.menu; import com.alpsbte.alpslib.utils.item.Item; import com.cryptomorin.xseries.XMaterial; -import net.buildtheearth.modules.generator.GeneratorModule; -import net.buildtheearth.modules.generator.components.tree.TreeFlag; -import net.buildtheearth.modules.generator.components.tree.TreeSettings; -import net.buildtheearth.modules.generator.components.tree.TreeWidth; -import net.buildtheearth.modules.generator.model.Settings; -import net.buildtheearth.utils.menus.NameListMenu; +import net.buildtheearth.buildteamtools.modules.generator.GeneratorModule; +import net.buildtheearth.buildteamtools.modules.generator.components.tree.TreeFlag; +import net.buildtheearth.buildteamtools.modules.generator.components.tree.TreeSettings; +import net.buildtheearth.buildteamtools.modules.generator.components.tree.TreeWidth; +import net.buildtheearth.buildteamtools.modules.generator.model.Settings; +import net.buildtheearth.buildteamtools.utils.menus.NameListMenu; import net.daporkchop.lib.common.misc.Tuple; import org.apache.commons.lang3.StringUtils; import org.bukkit.Sound; diff --git a/src/main/java/net/buildtheearth/modules/generator/listeners/GeneratorListener.java b/src/main/java/net/buildtheearth/buildteamtools/modules/generator/listeners/GeneratorListener.java similarity index 90% rename from src/main/java/net/buildtheearth/modules/generator/listeners/GeneratorListener.java rename to src/main/java/net/buildtheearth/buildteamtools/modules/generator/listeners/GeneratorListener.java index 8ac94cf4..1d4523ae 100644 --- a/src/main/java/net/buildtheearth/modules/generator/listeners/GeneratorListener.java +++ b/src/main/java/net/buildtheearth/buildteamtools/modules/generator/listeners/GeneratorListener.java @@ -1,7 +1,7 @@ -package net.buildtheearth.modules.generator.listeners; +package net.buildtheearth.buildteamtools.modules.generator.listeners; import com.alpsbte.alpslib.utils.ChatHelper; -import net.buildtheearth.modules.generator.GeneratorModule; +import net.buildtheearth.buildteamtools.modules.generator.GeneratorModule; import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.entity.Player; diff --git a/src/main/java/net/buildtheearth/modules/generator/menu/GeneratorMenu.java b/src/main/java/net/buildtheearth/buildteamtools/modules/generator/menu/GeneratorMenu.java similarity index 87% rename from src/main/java/net/buildtheearth/modules/generator/menu/GeneratorMenu.java rename to src/main/java/net/buildtheearth/buildteamtools/modules/generator/menu/GeneratorMenu.java index b3fc563d..ef738425 100644 --- a/src/main/java/net/buildtheearth/modules/generator/menu/GeneratorMenu.java +++ b/src/main/java/net/buildtheearth/buildteamtools/modules/generator/menu/GeneratorMenu.java @@ -1,24 +1,24 @@ -package net.buildtheearth.modules.generator.menu; +package net.buildtheearth.buildteamtools.modules.generator.menu; import com.alpsbte.alpslib.utils.item.Item; import com.cryptomorin.xseries.XMaterial; -import net.buildtheearth.modules.common.CommonModule; -import net.buildtheearth.modules.generator.GeneratorModule; -import net.buildtheearth.modules.generator.components.house.House; -import net.buildtheearth.modules.generator.components.house.HouseSettings; -import net.buildtheearth.modules.generator.components.house.RoofType; -import net.buildtheearth.modules.generator.components.house.menu.WallColorMenu; -import net.buildtheearth.modules.generator.components.road.Road; -import net.buildtheearth.modules.generator.components.road.RoadSettings; -import net.buildtheearth.modules.generator.components.road.menu.RoadColorMenu; -import net.buildtheearth.modules.generator.components.tree.Tree; -import net.buildtheearth.modules.generator.components.tree.TreeSettings; -import net.buildtheearth.modules.generator.components.tree.menu.TreeTypeMenu; -import net.buildtheearth.modules.generator.model.GeneratorCollections; -import net.buildtheearth.modules.generator.model.GeneratorType; -import net.buildtheearth.utils.ListUtil; -import net.buildtheearth.utils.MenuItems; -import net.buildtheearth.utils.menus.AbstractMenu; +import net.buildtheearth.buildteamtools.modules.common.CommonModule; +import net.buildtheearth.buildteamtools.modules.generator.GeneratorModule; +import net.buildtheearth.buildteamtools.modules.generator.components.house.House; +import net.buildtheearth.buildteamtools.modules.generator.components.house.HouseSettings; +import net.buildtheearth.buildteamtools.modules.generator.components.house.RoofType; +import net.buildtheearth.buildteamtools.modules.generator.components.house.menu.WallColorMenu; +import net.buildtheearth.buildteamtools.modules.generator.components.road.Road; +import net.buildtheearth.buildteamtools.modules.generator.components.road.RoadSettings; +import net.buildtheearth.buildteamtools.modules.generator.components.road.menu.RoadColorMenu; +import net.buildtheearth.buildteamtools.modules.generator.components.tree.Tree; +import net.buildtheearth.buildteamtools.modules.generator.components.tree.TreeSettings; +import net.buildtheearth.buildteamtools.modules.generator.components.tree.menu.TreeTypeMenu; +import net.buildtheearth.buildteamtools.modules.generator.model.GeneratorCollections; +import net.buildtheearth.buildteamtools.modules.generator.model.GeneratorType; +import net.buildtheearth.buildteamtools.utils.ListUtil; +import net.buildtheearth.buildteamtools.utils.MenuItems; +import net.buildtheearth.buildteamtools.utils.menus.AbstractMenu; import net.kyori.adventure.text.Component; import net.kyori.adventure.text.format.NamedTextColor; import org.bukkit.Sound; diff --git a/src/main/java/net/buildtheearth/modules/generator/model/Command.java b/src/main/java/net/buildtheearth/buildteamtools/modules/generator/model/Command.java similarity index 98% rename from src/main/java/net/buildtheearth/modules/generator/model/Command.java rename to src/main/java/net/buildtheearth/buildteamtools/modules/generator/model/Command.java index 24136664..4ac228fd 100644 --- a/src/main/java/net/buildtheearth/modules/generator/model/Command.java +++ b/src/main/java/net/buildtheearth/buildteamtools/modules/generator/model/Command.java @@ -1,4 +1,4 @@ -package net.buildtheearth.modules.generator.model; +package net.buildtheearth.buildteamtools.modules.generator.model; import com.alpsbte.alpslib.utils.ChatHelper; import com.alpsbte.alpslib.utils.GeneratorUtils; @@ -11,8 +11,8 @@ import com.sk89q.worldedit.world.block.BlockType; import com.sk89q.worldedit.world.block.BlockTypes; import lombok.Getter; -import net.buildtheearth.modules.common.CommonModule; -import net.buildtheearth.utils.MenuItems; +import net.buildtheearth.buildteamtools.modules.common.CommonModule; +import net.buildtheearth.buildteamtools.utils.MenuItems; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.block.Block; diff --git a/src/main/java/net/buildtheearth/modules/generator/model/Flag.java b/src/main/java/net/buildtheearth/buildteamtools/modules/generator/model/Flag.java similarity index 54% rename from src/main/java/net/buildtheearth/modules/generator/model/Flag.java rename to src/main/java/net/buildtheearth/buildteamtools/modules/generator/model/Flag.java index d49d80d1..c95f7177 100644 --- a/src/main/java/net/buildtheearth/modules/generator/model/Flag.java +++ b/src/main/java/net/buildtheearth/buildteamtools/modules/generator/model/Flag.java @@ -1,10 +1,10 @@ -package net.buildtheearth.modules.generator.model; +package net.buildtheearth.buildteamtools.modules.generator.model; -import net.buildtheearth.modules.generator.components.field.FieldFlag; -import net.buildtheearth.modules.generator.components.house.HouseFlag; -import net.buildtheearth.modules.generator.components.rail.RailFlag; -import net.buildtheearth.modules.generator.components.road.RoadFlag; -import net.buildtheearth.modules.generator.components.tree.TreeFlag; +import net.buildtheearth.buildteamtools.modules.generator.components.field.FieldFlag; +import net.buildtheearth.buildteamtools.modules.generator.components.house.HouseFlag; +import net.buildtheearth.buildteamtools.modules.generator.components.rail.RailFlag; +import net.buildtheearth.buildteamtools.modules.generator.components.road.RoadFlag; +import net.buildtheearth.buildteamtools.modules.generator.components.tree.TreeFlag; import org.jspecify.annotations.NonNull; public interface Flag { diff --git a/src/main/java/net/buildtheearth/modules/generator/model/FlagType.java b/src/main/java/net/buildtheearth/buildteamtools/modules/generator/model/FlagType.java similarity index 85% rename from src/main/java/net/buildtheearth/modules/generator/model/FlagType.java rename to src/main/java/net/buildtheearth/buildteamtools/modules/generator/model/FlagType.java index 500aaeb2..ed9dc8dd 100644 --- a/src/main/java/net/buildtheearth/modules/generator/model/FlagType.java +++ b/src/main/java/net/buildtheearth/buildteamtools/modules/generator/model/FlagType.java @@ -1,14 +1,14 @@ -package net.buildtheearth.modules.generator.model; +package net.buildtheearth.buildteamtools.modules.generator.model; import com.alpsbte.alpslib.utils.ChatHelper; import com.alpsbte.alpslib.utils.item.Item; import com.cryptomorin.xseries.XMaterial; import lombok.Getter; -import net.buildtheearth.modules.generator.components.field.CropStage; -import net.buildtheearth.modules.generator.components.field.CropType; -import net.buildtheearth.modules.generator.components.house.RoofType; -import net.buildtheearth.modules.generator.components.tree.TreeType; -import net.buildtheearth.modules.generator.components.tree.TreeWidth; +import net.buildtheearth.buildteamtools.modules.generator.components.field.CropStage; +import net.buildtheearth.buildteamtools.modules.generator.components.field.CropType; +import net.buildtheearth.buildteamtools.modules.generator.components.house.RoofType; +import net.buildtheearth.buildteamtools.modules.generator.components.tree.TreeType; +import net.buildtheearth.buildteamtools.modules.generator.components.tree.TreeWidth; public enum FlagType { diff --git a/src/main/java/net/buildtheearth/modules/generator/model/GeneratorCollections.java b/src/main/java/net/buildtheearth/buildteamtools/modules/generator/model/GeneratorCollections.java similarity index 98% rename from src/main/java/net/buildtheearth/modules/generator/model/GeneratorCollections.java rename to src/main/java/net/buildtheearth/buildteamtools/modules/generator/model/GeneratorCollections.java index 4b183d15..fb9c3924 100644 --- a/src/main/java/net/buildtheearth/modules/generator/model/GeneratorCollections.java +++ b/src/main/java/net/buildtheearth/buildteamtools/modules/generator/model/GeneratorCollections.java @@ -1,4 +1,4 @@ -package net.buildtheearth.modules.generator.model; +package net.buildtheearth.buildteamtools.modules.generator.model; import com.alpsbte.alpslib.utils.ChatHelper; import com.fastasyncworldedit.core.FaweAPI; @@ -8,8 +8,8 @@ import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormats; import com.sk89q.worldedit.extent.clipboard.io.ClipboardReader; import lombok.experimental.UtilityClass; -import net.buildtheearth.BuildTeamTools; -import net.buildtheearth.modules.common.CommonModule; +import net.buildtheearth.buildteamtools.BuildTeamTools; +import net.buildtheearth.buildteamtools.modules.common.CommonModule; import org.bukkit.Bukkit; import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.configuration.file.YamlConfiguration; diff --git a/src/main/java/net/buildtheearth/modules/generator/model/GeneratorComponent.java b/src/main/java/net/buildtheearth/buildteamtools/modules/generator/model/GeneratorComponent.java similarity index 90% rename from src/main/java/net/buildtheearth/modules/generator/model/GeneratorComponent.java rename to src/main/java/net/buildtheearth/buildteamtools/modules/generator/model/GeneratorComponent.java index 00e8a622..67f41622 100644 --- a/src/main/java/net/buildtheearth/modules/generator/model/GeneratorComponent.java +++ b/src/main/java/net/buildtheearth/buildteamtools/modules/generator/model/GeneratorComponent.java @@ -1,15 +1,15 @@ -package net.buildtheearth.modules.generator.model; +package net.buildtheearth.buildteamtools.modules.generator.model; import com.alpsbte.alpslib.utils.GeneratorUtils; import com.alpsbte.alpslib.utils.WikiDocumented; import lombok.Getter; -import net.buildtheearth.BuildTeamTools; -import net.buildtheearth.modules.ModuleComponent; -import net.buildtheearth.modules.generator.components.field.FieldSettings; -import net.buildtheearth.modules.generator.components.house.HouseSettings; -import net.buildtheearth.modules.generator.components.rail.RailSettings; -import net.buildtheearth.modules.generator.components.road.RoadSettings; -import net.buildtheearth.modules.generator.components.tree.TreeSettings; +import net.buildtheearth.buildteamtools.BuildTeamTools; +import net.buildtheearth.buildteamtools.modules.ModuleComponent; +import net.buildtheearth.buildteamtools.modules.generator.components.field.FieldSettings; +import net.buildtheearth.buildteamtools.modules.generator.components.house.HouseSettings; +import net.buildtheearth.buildteamtools.modules.generator.components.rail.RailSettings; +import net.buildtheearth.buildteamtools.modules.generator.components.road.RoadSettings; +import net.buildtheearth.buildteamtools.modules.generator.components.tree.TreeSettings; import net.kyori.adventure.text.Component; import net.kyori.adventure.text.TextComponent; import net.kyori.adventure.text.event.ClickEvent; diff --git a/src/main/java/net/buildtheearth/modules/generator/model/GeneratorType.java b/src/main/java/net/buildtheearth/buildteamtools/modules/generator/model/GeneratorType.java similarity index 79% rename from src/main/java/net/buildtheearth/modules/generator/model/GeneratorType.java rename to src/main/java/net/buildtheearth/buildteamtools/modules/generator/model/GeneratorType.java index 1e00d64b..53b53551 100644 --- a/src/main/java/net/buildtheearth/modules/generator/model/GeneratorType.java +++ b/src/main/java/net/buildtheearth/buildteamtools/modules/generator/model/GeneratorType.java @@ -1,7 +1,7 @@ -package net.buildtheearth.modules.generator.model; +package net.buildtheearth.buildteamtools.modules.generator.model; import lombok.Getter; -import net.buildtheearth.utils.WikiLinks; +import net.buildtheearth.buildteamtools.utils.WikiLinks; public enum GeneratorType { diff --git a/src/main/java/net/buildtheearth/modules/generator/model/History.java b/src/main/java/net/buildtheearth/buildteamtools/modules/generator/model/History.java similarity index 97% rename from src/main/java/net/buildtheearth/modules/generator/model/History.java rename to src/main/java/net/buildtheearth/buildteamtools/modules/generator/model/History.java index 94d66932..02e8473f 100644 --- a/src/main/java/net/buildtheearth/modules/generator/model/History.java +++ b/src/main/java/net/buildtheearth/buildteamtools/modules/generator/model/History.java @@ -1,11 +1,11 @@ -package net.buildtheearth.modules.generator.model; +package net.buildtheearth.buildteamtools.modules.generator.model; import com.alpsbte.alpslib.utils.ChatHelper; import com.alpsbte.alpslib.utils.GeneratorUtils; import com.sk89q.worldedit.LocalSession; import com.sk89q.worldedit.extension.platform.Actor; import lombok.Getter; -import net.buildtheearth.BuildTeamTools; +import net.buildtheearth.buildteamtools.BuildTeamTools; import net.kyori.adventure.text.Component; import net.kyori.adventure.text.event.ClickEvent; import net.kyori.adventure.text.event.HoverEvent; diff --git a/src/main/java/net/buildtheearth/modules/generator/model/Operation.java b/src/main/java/net/buildtheearth/buildteamtools/modules/generator/model/Operation.java similarity index 98% rename from src/main/java/net/buildtheearth/modules/generator/model/Operation.java rename to src/main/java/net/buildtheearth/buildteamtools/modules/generator/model/Operation.java index 6fdddc1d..0d230139 100644 --- a/src/main/java/net/buildtheearth/modules/generator/model/Operation.java +++ b/src/main/java/net/buildtheearth/buildteamtools/modules/generator/model/Operation.java @@ -1,4 +1,4 @@ -package net.buildtheearth.modules.generator.model; +package net.buildtheearth.buildteamtools.modules.generator.model; import com.sk89q.worldedit.world.block.BlockState; import lombok.Getter; diff --git a/src/main/java/net/buildtheearth/modules/generator/model/Script.java b/src/main/java/net/buildtheearth/buildteamtools/modules/generator/model/Script.java similarity index 99% rename from src/main/java/net/buildtheearth/modules/generator/model/Script.java rename to src/main/java/net/buildtheearth/buildteamtools/modules/generator/model/Script.java index 8639c5d9..0a5dc7a0 100644 --- a/src/main/java/net/buildtheearth/modules/generator/model/Script.java +++ b/src/main/java/net/buildtheearth/buildteamtools/modules/generator/model/Script.java @@ -1,4 +1,4 @@ -package net.buildtheearth.modules.generator.model; +package net.buildtheearth.buildteamtools.modules.generator.model; import com.alpsbte.alpslib.utils.GeneratorUtils; import com.cryptomorin.xseries.XMaterial; @@ -13,7 +13,7 @@ import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockType; import lombok.Getter; -import net.buildtheearth.modules.generator.GeneratorModule; +import net.buildtheearth.buildteamtools.modules.generator.GeneratorModule; import org.bukkit.Location; import org.bukkit.block.Block; import org.bukkit.entity.Player; diff --git a/src/main/java/net/buildtheearth/modules/generator/model/Settings.java b/src/main/java/net/buildtheearth/buildteamtools/modules/generator/model/Settings.java similarity index 88% rename from src/main/java/net/buildtheearth/modules/generator/model/Settings.java rename to src/main/java/net/buildtheearth/buildteamtools/modules/generator/model/Settings.java index 4c0c8ff4..7bed4c57 100644 --- a/src/main/java/net/buildtheearth/modules/generator/model/Settings.java +++ b/src/main/java/net/buildtheearth/buildteamtools/modules/generator/model/Settings.java @@ -1,13 +1,13 @@ -package net.buildtheearth.modules.generator.model; +package net.buildtheearth.buildteamtools.modules.generator.model; import com.alpsbte.alpslib.utils.item.Item; import com.cryptomorin.xseries.XMaterial; import lombok.Getter; import lombok.Setter; -import net.buildtheearth.modules.generator.components.field.CropStage; -import net.buildtheearth.modules.generator.components.field.CropType; -import net.buildtheearth.modules.generator.components.house.RoofType; -import net.buildtheearth.modules.generator.components.tree.TreeWidth; +import net.buildtheearth.buildteamtools.modules.generator.components.field.CropStage; +import net.buildtheearth.buildteamtools.modules.generator.components.field.CropType; +import net.buildtheearth.buildteamtools.modules.generator.components.house.RoofType; +import net.buildtheearth.buildteamtools.modules.generator.components.tree.TreeWidth; import org.bukkit.block.Block; import org.bukkit.entity.Player; diff --git a/src/main/java/net/buildtheearth/modules/miscellaneous/MiscModule.java b/src/main/java/net/buildtheearth/buildteamtools/modules/miscellaneous/MiscModule.java similarity index 85% rename from src/main/java/net/buildtheearth/modules/miscellaneous/MiscModule.java rename to src/main/java/net/buildtheearth/buildteamtools/modules/miscellaneous/MiscModule.java index 4c7b77b1..c24b9136 100644 --- a/src/main/java/net/buildtheearth/modules/miscellaneous/MiscModule.java +++ b/src/main/java/net/buildtheearth/buildteamtools/modules/miscellaneous/MiscModule.java @@ -1,10 +1,10 @@ -package net.buildtheearth.modules.miscellaneous; +package net.buildtheearth.buildteamtools.modules.miscellaneous; -import net.buildtheearth.modules.Module; -import net.buildtheearth.modules.miscellaneous.blockpalettegui.BlockPaletteCommand; -import net.buildtheearth.modules.miscellaneous.blockpalettegui.BlockPaletteGUI; -import net.buildtheearth.modules.miscellaneous.blockpalettegui.BlockPaletteManager; -import net.buildtheearth.utils.WikiLinks; +import net.buildtheearth.buildteamtools.modules.Module; +import net.buildtheearth.buildteamtools.modules.miscellaneous.blockpalettegui.BlockPaletteCommand; +import net.buildtheearth.buildteamtools.modules.miscellaneous.blockpalettegui.BlockPaletteGUI; +import net.buildtheearth.buildteamtools.modules.miscellaneous.blockpalettegui.BlockPaletteManager; +import net.buildtheearth.buildteamtools.utils.WikiLinks; import org.bukkit.command.CommandExecutor; import org.bukkit.command.PluginCommand; import org.bukkit.command.TabCompleter; diff --git a/src/main/java/net/buildtheearth/modules/miscellaneous/blockpalettegui/BlockPaletteCommand.java b/src/main/java/net/buildtheearth/buildteamtools/modules/miscellaneous/blockpalettegui/BlockPaletteCommand.java similarity index 97% rename from src/main/java/net/buildtheearth/modules/miscellaneous/blockpalettegui/BlockPaletteCommand.java rename to src/main/java/net/buildtheearth/buildteamtools/modules/miscellaneous/blockpalettegui/BlockPaletteCommand.java index b8b9632a..b94edbc6 100644 --- a/src/main/java/net/buildtheearth/modules/miscellaneous/blockpalettegui/BlockPaletteCommand.java +++ b/src/main/java/net/buildtheearth/buildteamtools/modules/miscellaneous/blockpalettegui/BlockPaletteCommand.java @@ -1,4 +1,4 @@ -package net.buildtheearth.modules.miscellaneous.blockpalettegui; +package net.buildtheearth.buildteamtools.modules.miscellaneous.blockpalettegui; import org.bukkit.command.Command; import org.bukkit.command.CommandExecutor; diff --git a/src/main/java/net/buildtheearth/modules/miscellaneous/blockpalettegui/BlockPaletteGUI.java b/src/main/java/net/buildtheearth/buildteamtools/modules/miscellaneous/blockpalettegui/BlockPaletteGUI.java similarity index 83% rename from src/main/java/net/buildtheearth/modules/miscellaneous/blockpalettegui/BlockPaletteGUI.java rename to src/main/java/net/buildtheearth/buildteamtools/modules/miscellaneous/blockpalettegui/BlockPaletteGUI.java index 5236b432..305eae06 100644 --- a/src/main/java/net/buildtheearth/modules/miscellaneous/blockpalettegui/BlockPaletteGUI.java +++ b/src/main/java/net/buildtheearth/buildteamtools/modules/miscellaneous/blockpalettegui/BlockPaletteGUI.java @@ -1,6 +1,6 @@ -package net.buildtheearth.modules.miscellaneous.blockpalettegui; +package net.buildtheearth.buildteamtools.modules.miscellaneous.blockpalettegui; -import net.buildtheearth.modules.ModuleComponent; +import net.buildtheearth.buildteamtools.modules.ModuleComponent; import org.bukkit.plugin.java.JavaPlugin; public class BlockPaletteGUI extends ModuleComponent { diff --git a/src/main/java/net/buildtheearth/modules/miscellaneous/blockpalettegui/BlockPaletteManager.java b/src/main/java/net/buildtheearth/buildteamtools/modules/miscellaneous/blockpalettegui/BlockPaletteManager.java similarity index 99% rename from src/main/java/net/buildtheearth/modules/miscellaneous/blockpalettegui/BlockPaletteManager.java rename to src/main/java/net/buildtheearth/buildteamtools/modules/miscellaneous/blockpalettegui/BlockPaletteManager.java index 0ce4e00c..8633a183 100644 --- a/src/main/java/net/buildtheearth/modules/miscellaneous/blockpalettegui/BlockPaletteManager.java +++ b/src/main/java/net/buildtheearth/buildteamtools/modules/miscellaneous/blockpalettegui/BlockPaletteManager.java @@ -1,15 +1,15 @@ -package net.buildtheearth.modules.miscellaneous.blockpalettegui; +package net.buildtheearth.buildteamtools.modules.miscellaneous.blockpalettegui; import com.cryptomorin.xseries.XMaterial; +import lombok.Getter; +import lombok.Setter; import org.bukkit.Material; +import org.bukkit.configuration.file.FileConfiguration; +import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.ItemMeta; import org.bukkit.plugin.java.JavaPlugin; -import org.bukkit.configuration.file.FileConfiguration; -import org.bukkit.configuration.file.YamlConfiguration; -import lombok.Getter; -import lombok.Setter; import java.io.File; import java.io.IOException; diff --git a/src/main/java/net/buildtheearth/modules/miscellaneous/blockpalettegui/BlockPaletteMenuType.java b/src/main/java/net/buildtheearth/buildteamtools/modules/miscellaneous/blockpalettegui/BlockPaletteMenuType.java similarity index 92% rename from src/main/java/net/buildtheearth/modules/miscellaneous/blockpalettegui/BlockPaletteMenuType.java rename to src/main/java/net/buildtheearth/buildteamtools/modules/miscellaneous/blockpalettegui/BlockPaletteMenuType.java index d799338d..a84281b6 100644 --- a/src/main/java/net/buildtheearth/modules/miscellaneous/blockpalettegui/BlockPaletteMenuType.java +++ b/src/main/java/net/buildtheearth/buildteamtools/modules/miscellaneous/blockpalettegui/BlockPaletteMenuType.java @@ -1,14 +1,10 @@ -package net.buildtheearth.modules.miscellaneous.blockpalettegui; +package net.buildtheearth.buildteamtools.modules.miscellaneous.blockpalettegui; -import net.buildtheearth.utils.MenuItems; +import net.buildtheearth.buildteamtools.utils.MenuItems; import org.bukkit.inventory.ItemStack; -import java.util.HashMap; -import java.util.Map; +import java.util.*; import java.util.function.Supplier; -import java.util.List; -import java.util.Arrays; -import java.util.Collections; import java.util.stream.Collectors; public enum BlockPaletteMenuType { diff --git a/src/main/java/net/buildtheearth/modules/miscellaneous/blockpalettegui/ChoosePaletteBlocksMenu.java b/src/main/java/net/buildtheearth/buildteamtools/modules/miscellaneous/blockpalettegui/ChoosePaletteBlocksMenu.java similarity index 98% rename from src/main/java/net/buildtheearth/modules/miscellaneous/blockpalettegui/ChoosePaletteBlocksMenu.java rename to src/main/java/net/buildtheearth/buildteamtools/modules/miscellaneous/blockpalettegui/ChoosePaletteBlocksMenu.java index f5751b53..0ebc9542 100644 --- a/src/main/java/net/buildtheearth/modules/miscellaneous/blockpalettegui/ChoosePaletteBlocksMenu.java +++ b/src/main/java/net/buildtheearth/buildteamtools/modules/miscellaneous/blockpalettegui/ChoosePaletteBlocksMenu.java @@ -1,8 +1,8 @@ -package net.buildtheearth.modules.miscellaneous.blockpalettegui; +package net.buildtheearth.buildteamtools.modules.miscellaneous.blockpalettegui; import com.alpsbte.alpslib.utils.item.Item; import com.cryptomorin.xseries.XMaterial; -import net.buildtheearth.utils.menus.AbstractPaginatedMenu; +import net.buildtheearth.buildteamtools.utils.menus.AbstractPaginatedMenu; import org.bukkit.Material; import org.bukkit.NamespacedKey; import org.bukkit.enchantments.Enchantment; diff --git a/src/main/java/net/buildtheearth/modules/miscellaneous/blockpalettegui/ChoosePaletteMenu.java b/src/main/java/net/buildtheearth/buildteamtools/modules/miscellaneous/blockpalettegui/ChoosePaletteMenu.java similarity index 98% rename from src/main/java/net/buildtheearth/modules/miscellaneous/blockpalettegui/ChoosePaletteMenu.java rename to src/main/java/net/buildtheearth/buildteamtools/modules/miscellaneous/blockpalettegui/ChoosePaletteMenu.java index 8176f581..9026673d 100644 --- a/src/main/java/net/buildtheearth/modules/miscellaneous/blockpalettegui/ChoosePaletteMenu.java +++ b/src/main/java/net/buildtheearth/buildteamtools/modules/miscellaneous/blockpalettegui/ChoosePaletteMenu.java @@ -1,8 +1,8 @@ -package net.buildtheearth.modules.miscellaneous.blockpalettegui; +package net.buildtheearth.buildteamtools.modules.miscellaneous.blockpalettegui; import com.alpsbte.alpslib.utils.item.Item; import com.cryptomorin.xseries.XMaterial; -import net.buildtheearth.utils.menus.AbstractMenu; +import net.buildtheearth.buildteamtools.utils.menus.AbstractMenu; import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.event.inventory.ClickType; diff --git a/src/main/java/net/buildtheearth/modules/miscellaneous/blockpalettegui/CreatePaletteMenu.java b/src/main/java/net/buildtheearth/buildteamtools/modules/miscellaneous/blockpalettegui/CreatePaletteMenu.java similarity index 98% rename from src/main/java/net/buildtheearth/modules/miscellaneous/blockpalettegui/CreatePaletteMenu.java rename to src/main/java/net/buildtheearth/buildteamtools/modules/miscellaneous/blockpalettegui/CreatePaletteMenu.java index a26c6369..64a2ccbe 100644 --- a/src/main/java/net/buildtheearth/modules/miscellaneous/blockpalettegui/CreatePaletteMenu.java +++ b/src/main/java/net/buildtheearth/buildteamtools/modules/miscellaneous/blockpalettegui/CreatePaletteMenu.java @@ -1,8 +1,8 @@ -package net.buildtheearth.modules.miscellaneous.blockpalettegui; +package net.buildtheearth.buildteamtools.modules.miscellaneous.blockpalettegui; import com.alpsbte.alpslib.utils.item.Item; import com.cryptomorin.xseries.XMaterial; -import net.buildtheearth.utils.menus.AbstractMenu; +import net.buildtheearth.buildteamtools.utils.menus.AbstractMenu; import org.bukkit.Bukkit; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; diff --git a/src/main/java/net/buildtheearth/modules/miscellaneous/blockpalettegui/EditPaletteMenu.java b/src/main/java/net/buildtheearth/buildteamtools/modules/miscellaneous/blockpalettegui/EditPaletteMenu.java similarity index 98% rename from src/main/java/net/buildtheearth/modules/miscellaneous/blockpalettegui/EditPaletteMenu.java rename to src/main/java/net/buildtheearth/buildteamtools/modules/miscellaneous/blockpalettegui/EditPaletteMenu.java index eb7f8404..5fd56f0e 100644 --- a/src/main/java/net/buildtheearth/modules/miscellaneous/blockpalettegui/EditPaletteMenu.java +++ b/src/main/java/net/buildtheearth/buildteamtools/modules/miscellaneous/blockpalettegui/EditPaletteMenu.java @@ -1,8 +1,8 @@ -package net.buildtheearth.modules.miscellaneous.blockpalettegui; +package net.buildtheearth.buildteamtools.modules.miscellaneous.blockpalettegui; import com.alpsbte.alpslib.utils.item.Item; import com.cryptomorin.xseries.XMaterial; -import net.buildtheearth.utils.menus.AbstractMenu; +import net.buildtheearth.buildteamtools.utils.menus.AbstractMenu; import org.bukkit.Bukkit; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; diff --git a/src/main/java/net/buildtheearth/modules/miscellaneous/blockpalettegui/PaletteBlockListMenu.java b/src/main/java/net/buildtheearth/buildteamtools/modules/miscellaneous/blockpalettegui/PaletteBlockListMenu.java similarity index 96% rename from src/main/java/net/buildtheearth/modules/miscellaneous/blockpalettegui/PaletteBlockListMenu.java rename to src/main/java/net/buildtheearth/buildteamtools/modules/miscellaneous/blockpalettegui/PaletteBlockListMenu.java index da0475ac..d66c4b75 100644 --- a/src/main/java/net/buildtheearth/modules/miscellaneous/blockpalettegui/PaletteBlockListMenu.java +++ b/src/main/java/net/buildtheearth/buildteamtools/modules/miscellaneous/blockpalettegui/PaletteBlockListMenu.java @@ -1,9 +1,9 @@ -package net.buildtheearth.modules.miscellaneous.blockpalettegui; +package net.buildtheearth.buildteamtools.modules.miscellaneous.blockpalettegui; import com.alpsbte.alpslib.utils.item.Item; import com.cryptomorin.xseries.XMaterial; -import net.buildtheearth.utils.MenuItems; -import net.buildtheearth.utils.menus.AbstractPaginatedMenu; +import net.buildtheearth.buildteamtools.utils.MenuItems; +import net.buildtheearth.buildteamtools.utils.menus.AbstractPaginatedMenu; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; import org.bukkit.plugin.java.JavaPlugin; diff --git a/src/main/java/net/buildtheearth/modules/miscellaneous/signtextgenerator/SignTextGenerator.java b/src/main/java/net/buildtheearth/buildteamtools/modules/miscellaneous/signtextgenerator/SignTextGenerator.java similarity index 72% rename from src/main/java/net/buildtheearth/modules/miscellaneous/signtextgenerator/SignTextGenerator.java rename to src/main/java/net/buildtheearth/buildteamtools/modules/miscellaneous/signtextgenerator/SignTextGenerator.java index e10cd54c..ee93e0b3 100644 --- a/src/main/java/net/buildtheearth/modules/miscellaneous/signtextgenerator/SignTextGenerator.java +++ b/src/main/java/net/buildtheearth/buildteamtools/modules/miscellaneous/signtextgenerator/SignTextGenerator.java @@ -1,6 +1,6 @@ -package net.buildtheearth.modules.miscellaneous.signtextgenerator; +package net.buildtheearth.buildteamtools.modules.miscellaneous.signtextgenerator; -import net.buildtheearth.modules.ModuleComponent; +import net.buildtheearth.buildteamtools.modules.ModuleComponent; public class SignTextGenerator extends ModuleComponent { diff --git a/src/main/java/net/buildtheearth/modules/navigation/NavUtils.java b/src/main/java/net/buildtheearth/buildteamtools/modules/navigation/NavUtils.java similarity index 93% rename from src/main/java/net/buildtheearth/modules/navigation/NavUtils.java rename to src/main/java/net/buildtheearth/buildteamtools/modules/navigation/NavUtils.java index fd1b2f25..83c575c8 100644 --- a/src/main/java/net/buildtheearth/modules/navigation/NavUtils.java +++ b/src/main/java/net/buildtheearth/buildteamtools/modules/navigation/NavUtils.java @@ -1,13 +1,13 @@ -package net.buildtheearth.modules.navigation; +package net.buildtheearth.buildteamtools.modules.navigation; import com.alpsbte.alpslib.utils.ChatHelper; import com.google.common.io.ByteArrayDataOutput; import com.google.common.io.ByteStreams; import lombok.experimental.UtilityClass; -import net.buildtheearth.BuildTeamTools; -import net.buildtheearth.modules.navigation.components.warps.model.WarpGroup; -import net.buildtheearth.modules.network.NetworkModule; -import net.buildtheearth.modules.network.model.BuildTeam; +import net.buildtheearth.buildteamtools.BuildTeamTools; +import net.buildtheearth.buildteamtools.modules.navigation.components.warps.model.WarpGroup; +import net.buildtheearth.buildteamtools.modules.network.NetworkModule; +import net.buildtheearth.buildteamtools.modules.network.model.BuildTeam; import net.md_5.bungee.api.chat.ClickEvent; import net.md_5.bungee.api.chat.ComponentBuilder; import net.md_5.bungee.api.chat.HoverEvent; diff --git a/src/main/java/net/buildtheearth/modules/navigation/NavigationModule.java b/src/main/java/net/buildtheearth/buildteamtools/modules/navigation/NavigationModule.java similarity index 52% rename from src/main/java/net/buildtheearth/modules/navigation/NavigationModule.java rename to src/main/java/net/buildtheearth/buildteamtools/modules/navigation/NavigationModule.java index 79f8f36b..d63c5e21 100644 --- a/src/main/java/net/buildtheearth/modules/navigation/NavigationModule.java +++ b/src/main/java/net/buildtheearth/buildteamtools/modules/navigation/NavigationModule.java @@ -1,21 +1,21 @@ -package net.buildtheearth.modules.navigation; +package net.buildtheearth.buildteamtools.modules.navigation; import lombok.Getter; -import net.buildtheearth.modules.Module; -import net.buildtheearth.modules.navigation.components.navigator.NavigatorComponent; -import net.buildtheearth.modules.navigation.components.navigator.commands.BuildteamCommand; -import net.buildtheearth.modules.navigation.components.navigator.commands.NavigatorCommand; -import net.buildtheearth.modules.navigation.components.navigator.listeners.NavigatorJoinListener; -import net.buildtheearth.modules.navigation.components.navigator.listeners.NavigatorOpenListener; -import net.buildtheearth.modules.navigation.components.tpll.TpllComponent; -import net.buildtheearth.modules.navigation.components.tpll.listeners.TpllJoinListener; -import net.buildtheearth.modules.navigation.components.tpll.listeners.TpllListener; -import net.buildtheearth.modules.navigation.components.warps.WarpsComponent; -import net.buildtheearth.modules.navigation.components.warps.commands.WarpCommand; -import net.buildtheearth.modules.navigation.components.warps.commands.WarpsBtCommand; -import net.buildtheearth.modules.navigation.components.warps.listeners.WarpJoinListener; -import net.buildtheearth.modules.network.NetworkModule; -import net.buildtheearth.utils.WikiLinks; +import net.buildtheearth.buildteamtools.modules.Module; +import net.buildtheearth.buildteamtools.modules.navigation.components.navigator.NavigatorComponent; +import net.buildtheearth.buildteamtools.modules.navigation.components.navigator.commands.BuildteamCommand; +import net.buildtheearth.buildteamtools.modules.navigation.components.navigator.commands.NavigatorCommand; +import net.buildtheearth.buildteamtools.modules.navigation.components.navigator.listeners.NavigatorJoinListener; +import net.buildtheearth.buildteamtools.modules.navigation.components.navigator.listeners.NavigatorOpenListener; +import net.buildtheearth.buildteamtools.modules.navigation.components.tpll.TpllComponent; +import net.buildtheearth.buildteamtools.modules.navigation.components.tpll.listeners.TpllJoinListener; +import net.buildtheearth.buildteamtools.modules.navigation.components.tpll.listeners.TpllListener; +import net.buildtheearth.buildteamtools.modules.navigation.components.warps.WarpsComponent; +import net.buildtheearth.buildteamtools.modules.navigation.components.warps.commands.WarpCommand; +import net.buildtheearth.buildteamtools.modules.navigation.components.warps.commands.WarpsBtCommand; +import net.buildtheearth.buildteamtools.modules.navigation.components.warps.listeners.WarpJoinListener; +import net.buildtheearth.buildteamtools.modules.network.NetworkModule; +import net.buildtheearth.buildteamtools.utils.WikiLinks; /** * Manages all things related to universal tpll diff --git a/src/main/java/net/buildtheearth/modules/navigation/components/navigator/NavigatorComponent.java b/src/main/java/net/buildtheearth/buildteamtools/modules/navigation/components/navigator/NavigatorComponent.java similarity index 87% rename from src/main/java/net/buildtheearth/modules/navigation/components/navigator/NavigatorComponent.java rename to src/main/java/net/buildtheearth/buildteamtools/modules/navigation/components/navigator/NavigatorComponent.java index 272f65ab..f65d0179 100644 --- a/src/main/java/net/buildtheearth/modules/navigation/components/navigator/NavigatorComponent.java +++ b/src/main/java/net/buildtheearth/buildteamtools/modules/navigation/components/navigator/NavigatorComponent.java @@ -1,14 +1,14 @@ -package net.buildtheearth.modules.navigation.components.navigator; +package net.buildtheearth.buildteamtools.modules.navigation.components.navigator; import com.alpsbte.alpslib.utils.ChatHelper; import com.alpsbte.alpslib.utils.item.Item; import com.cryptomorin.xseries.XMaterial; import com.sk89q.worldedit.WorldEdit; -import net.buildtheearth.BuildTeamTools; -import net.buildtheearth.modules.ModuleComponent; -import net.buildtheearth.modules.common.CommonModule; -import net.buildtheearth.utils.io.ConfigPaths; -import net.buildtheearth.utils.io.ConfigUtil; +import net.buildtheearth.buildteamtools.BuildTeamTools; +import net.buildtheearth.buildteamtools.modules.ModuleComponent; +import net.buildtheearth.buildteamtools.modules.common.CommonModule; +import net.buildtheearth.buildteamtools.utils.io.ConfigPaths; +import net.buildtheearth.buildteamtools.utils.io.ConfigUtil; import org.bukkit.entity.Player; import org.bukkit.inventory.Inventory; import org.bukkit.inventory.ItemStack; diff --git a/src/main/java/net/buildtheearth/modules/navigation/components/navigator/commands/BuildteamCommand.java b/src/main/java/net/buildtheearth/buildteamtools/modules/navigation/components/navigator/commands/BuildteamCommand.java similarity index 87% rename from src/main/java/net/buildtheearth/modules/navigation/components/navigator/commands/BuildteamCommand.java rename to src/main/java/net/buildtheearth/buildteamtools/modules/navigation/components/navigator/commands/BuildteamCommand.java index 7716901f..6ec563e6 100644 --- a/src/main/java/net/buildtheearth/modules/navigation/components/navigator/commands/BuildteamCommand.java +++ b/src/main/java/net/buildtheearth/buildteamtools/modules/navigation/components/navigator/commands/BuildteamCommand.java @@ -1,10 +1,10 @@ -package net.buildtheearth.modules.navigation.components.navigator.commands; +package net.buildtheearth.buildteamtools.modules.navigation.components.navigator.commands; import com.alpsbte.alpslib.utils.ChatHelper; -import net.buildtheearth.modules.navigation.NavUtils; -import net.buildtheearth.modules.network.NetworkModule; -import net.buildtheearth.modules.network.model.BuildTeam; -import net.buildtheearth.modules.network.model.Permissions; +import net.buildtheearth.buildteamtools.modules.navigation.NavUtils; +import net.buildtheearth.buildteamtools.modules.network.NetworkModule; +import net.buildtheearth.buildteamtools.modules.network.model.BuildTeam; +import net.buildtheearth.buildteamtools.modules.network.model.Permissions; import org.bukkit.command.Command; import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandSender; diff --git a/src/main/java/net/buildtheearth/modules/navigation/components/navigator/commands/NavigatorCommand.java b/src/main/java/net/buildtheearth/buildteamtools/modules/navigation/components/navigator/commands/NavigatorCommand.java similarity index 78% rename from src/main/java/net/buildtheearth/modules/navigation/components/navigator/commands/NavigatorCommand.java rename to src/main/java/net/buildtheearth/buildteamtools/modules/navigation/components/navigator/commands/NavigatorCommand.java index 03063c43..f1dbe38c 100644 --- a/src/main/java/net/buildtheearth/modules/navigation/components/navigator/commands/NavigatorCommand.java +++ b/src/main/java/net/buildtheearth/buildteamtools/modules/navigation/components/navigator/commands/NavigatorCommand.java @@ -1,9 +1,9 @@ -package net.buildtheearth.modules.navigation.components.navigator.commands; +package net.buildtheearth.buildteamtools.modules.navigation.components.navigator.commands; import com.alpsbte.alpslib.utils.ChatHelper; -import net.buildtheearth.modules.navigation.NavigationModule; -import net.buildtheearth.modules.navigation.menu.MainMenu; -import net.buildtheearth.modules.network.model.Permissions; +import net.buildtheearth.buildteamtools.modules.navigation.NavigationModule; +import net.buildtheearth.buildteamtools.modules.navigation.menu.MainMenu; +import net.buildtheearth.buildteamtools.modules.network.model.Permissions; import org.bukkit.command.Command; import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandSender; diff --git a/src/main/java/net/buildtheearth/modules/navigation/components/navigator/listeners/NavigatorJoinListener.java b/src/main/java/net/buildtheearth/buildteamtools/modules/navigation/components/navigator/listeners/NavigatorJoinListener.java similarity index 67% rename from src/main/java/net/buildtheearth/modules/navigation/components/navigator/listeners/NavigatorJoinListener.java rename to src/main/java/net/buildtheearth/buildteamtools/modules/navigation/components/navigator/listeners/NavigatorJoinListener.java index 6638b371..5afda224 100644 --- a/src/main/java/net/buildtheearth/modules/navigation/components/navigator/listeners/NavigatorJoinListener.java +++ b/src/main/java/net/buildtheearth/buildteamtools/modules/navigation/components/navigator/listeners/NavigatorJoinListener.java @@ -1,9 +1,9 @@ -package net.buildtheearth.modules.navigation.components.navigator.listeners; +package net.buildtheearth.buildteamtools.modules.navigation.components.navigator.listeners; -import net.buildtheearth.BuildTeamTools; -import net.buildtheearth.modules.navigation.NavigationModule; -import net.buildtheearth.utils.io.ConfigPaths; -import net.buildtheearth.utils.io.ConfigUtil; +import net.buildtheearth.buildteamtools.BuildTeamTools; +import net.buildtheearth.buildteamtools.modules.navigation.NavigationModule; +import net.buildtheearth.buildteamtools.utils.io.ConfigPaths; +import net.buildtheearth.buildteamtools.utils.io.ConfigUtil; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; diff --git a/src/main/java/net/buildtheearth/modules/navigation/components/navigator/listeners/NavigatorOpenListener.java b/src/main/java/net/buildtheearth/buildteamtools/modules/navigation/components/navigator/listeners/NavigatorOpenListener.java similarity index 93% rename from src/main/java/net/buildtheearth/modules/navigation/components/navigator/listeners/NavigatorOpenListener.java rename to src/main/java/net/buildtheearth/buildteamtools/modules/navigation/components/navigator/listeners/NavigatorOpenListener.java index 70880293..c564a8e6 100644 --- a/src/main/java/net/buildtheearth/modules/navigation/components/navigator/listeners/NavigatorOpenListener.java +++ b/src/main/java/net/buildtheearth/buildteamtools/modules/navigation/components/navigator/listeners/NavigatorOpenListener.java @@ -1,7 +1,7 @@ -package net.buildtheearth.modules.navigation.components.navigator.listeners; +package net.buildtheearth.buildteamtools.modules.navigation.components.navigator.listeners; -import net.buildtheearth.modules.navigation.menu.MainMenu; -import net.buildtheearth.modules.navigation.NavigationModule; +import net.buildtheearth.buildteamtools.modules.navigation.NavigationModule; +import net.buildtheearth.buildteamtools.modules.navigation.menu.MainMenu; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; diff --git a/src/main/java/net/buildtheearth/modules/navigation/components/tpll/TpllComponent.java b/src/main/java/net/buildtheearth/buildteamtools/modules/navigation/components/tpll/TpllComponent.java similarity index 93% rename from src/main/java/net/buildtheearth/modules/navigation/components/tpll/TpllComponent.java rename to src/main/java/net/buildtheearth/buildteamtools/modules/navigation/components/tpll/TpllComponent.java index 24a6b51b..ddd1bac9 100644 --- a/src/main/java/net/buildtheearth/modules/navigation/components/tpll/TpllComponent.java +++ b/src/main/java/net/buildtheearth/buildteamtools/modules/navigation/components/tpll/TpllComponent.java @@ -1,14 +1,14 @@ -package net.buildtheearth.modules.navigation.components.tpll; +package net.buildtheearth.buildteamtools.modules.navigation.components.tpll; import com.alpsbte.alpslib.utils.ChatHelper; import com.google.common.io.ByteArrayDataInput; import com.google.common.io.ByteArrayDataOutput; import com.google.common.io.ByteStreams; -import net.buildtheearth.BuildTeamTools; -import net.buildtheearth.modules.ModuleComponent; -import net.buildtheearth.modules.navigation.NavUtils; -import net.buildtheearth.modules.network.NetworkModule; -import net.buildtheearth.utils.GeometricUtils; +import net.buildtheearth.buildteamtools.BuildTeamTools; +import net.buildtheearth.buildteamtools.modules.ModuleComponent; +import net.buildtheearth.buildteamtools.modules.navigation.NavUtils; +import net.buildtheearth.buildteamtools.modules.network.NetworkModule; +import net.buildtheearth.buildteamtools.utils.GeometricUtils; import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.NamespacedKey; diff --git a/src/main/java/net/buildtheearth/modules/navigation/components/tpll/listeners/TpllJoinListener.java b/src/main/java/net/buildtheearth/buildteamtools/modules/navigation/components/tpll/listeners/TpllJoinListener.java similarity index 80% rename from src/main/java/net/buildtheearth/modules/navigation/components/tpll/listeners/TpllJoinListener.java rename to src/main/java/net/buildtheearth/buildteamtools/modules/navigation/components/tpll/listeners/TpllJoinListener.java index 9483e89f..8750abb3 100644 --- a/src/main/java/net/buildtheearth/modules/navigation/components/tpll/listeners/TpllJoinListener.java +++ b/src/main/java/net/buildtheearth/buildteamtools/modules/navigation/components/tpll/listeners/TpllJoinListener.java @@ -1,8 +1,8 @@ -package net.buildtheearth.modules.navigation.components.tpll.listeners; +package net.buildtheearth.buildteamtools.modules.navigation.components.tpll.listeners; import com.alpsbte.alpslib.utils.ChatHelper; -import net.buildtheearth.modules.navigation.NavigationModule; -import net.buildtheearth.modules.navigation.components.tpll.TpllComponent; +import net.buildtheearth.buildteamtools.modules.navigation.NavigationModule; +import net.buildtheearth.buildteamtools.modules.navigation.components.tpll.TpllComponent; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.player.PlayerJoinEvent; diff --git a/src/main/java/net/buildtheearth/modules/navigation/components/tpll/listeners/TpllListener.java b/src/main/java/net/buildtheearth/buildteamtools/modules/navigation/components/tpll/listeners/TpllListener.java similarity index 90% rename from src/main/java/net/buildtheearth/modules/navigation/components/tpll/listeners/TpllListener.java rename to src/main/java/net/buildtheearth/buildteamtools/modules/navigation/components/tpll/listeners/TpllListener.java index 837ada94..b3f967c5 100644 --- a/src/main/java/net/buildtheearth/modules/navigation/components/tpll/listeners/TpllListener.java +++ b/src/main/java/net/buildtheearth/buildteamtools/modules/navigation/components/tpll/listeners/TpllListener.java @@ -1,13 +1,13 @@ -package net.buildtheearth.modules.navigation.components.tpll.listeners; +package net.buildtheearth.buildteamtools.modules.navigation.components.tpll.listeners; import com.alpsbte.alpslib.utils.AlpsUtils; import com.alpsbte.alpslib.utils.ChatHelper; -import net.buildtheearth.modules.navigation.NavUtils; -import net.buildtheearth.modules.navigation.NavigationModule; -import net.buildtheearth.modules.network.NetworkModule; -import net.buildtheearth.modules.network.api.OpenStreetMapAPI; -import net.buildtheearth.modules.network.model.BuildTeam; -import net.buildtheearth.modules.network.model.Region; +import net.buildtheearth.buildteamtools.modules.navigation.NavUtils; +import net.buildtheearth.buildteamtools.modules.navigation.NavigationModule; +import net.buildtheearth.buildteamtools.modules.network.NetworkModule; +import net.buildtheearth.buildteamtools.modules.network.api.OpenStreetMapAPI; +import net.buildtheearth.buildteamtools.modules.network.model.BuildTeam; +import net.buildtheearth.buildteamtools.modules.network.model.Region; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.player.PlayerCommandPreprocessEvent; diff --git a/src/main/java/net/buildtheearth/modules/navigation/components/warps/WarpsComponent.java b/src/main/java/net/buildtheearth/buildteamtools/modules/navigation/components/warps/WarpsComponent.java similarity index 88% rename from src/main/java/net/buildtheearth/modules/navigation/components/warps/WarpsComponent.java rename to src/main/java/net/buildtheearth/buildteamtools/modules/navigation/components/warps/WarpsComponent.java index b7224a9f..43cc4da5 100644 --- a/src/main/java/net/buildtheearth/modules/navigation/components/warps/WarpsComponent.java +++ b/src/main/java/net/buildtheearth/buildteamtools/modules/navigation/components/warps/WarpsComponent.java @@ -1,24 +1,24 @@ -package net.buildtheearth.modules.navigation.components.warps; +package net.buildtheearth.buildteamtools.modules.navigation.components.warps; import com.alpsbte.alpslib.utils.ChatHelper; import com.google.common.io.ByteArrayDataInput; import com.google.common.io.ByteArrayDataOutput; import com.google.common.io.ByteStreams; -import net.buildtheearth.BuildTeamTools; -import net.buildtheearth.modules.ModuleComponent; -import net.buildtheearth.modules.navigation.NavUtils; -import net.buildtheearth.modules.navigation.components.warps.menu.WarpEditMenu; -import net.buildtheearth.modules.navigation.components.warps.menu.WarpGroupEditMenu; -import net.buildtheearth.modules.navigation.components.warps.menu.WarpGroupMenu; -import net.buildtheearth.modules.navigation.components.warps.menu.WarpMenu; -import net.buildtheearth.modules.navigation.components.warps.model.Warp; -import net.buildtheearth.modules.navigation.components.warps.model.WarpGroup; -import net.buildtheearth.modules.network.NetworkModule; -import net.buildtheearth.modules.network.api.OpenStreetMapAPI; -import net.buildtheearth.modules.network.model.BuildTeam; -import net.buildtheearth.utils.GeometricUtils; -import net.buildtheearth.utils.geo.CoordinateConversion; -import net.buildtheearth.utils.menus.AbstractMenu; +import net.buildtheearth.buildteamtools.BuildTeamTools; +import net.buildtheearth.buildteamtools.modules.ModuleComponent; +import net.buildtheearth.buildteamtools.modules.navigation.NavUtils; +import net.buildtheearth.buildteamtools.modules.navigation.components.warps.menu.WarpEditMenu; +import net.buildtheearth.buildteamtools.modules.navigation.components.warps.menu.WarpGroupEditMenu; +import net.buildtheearth.buildteamtools.modules.navigation.components.warps.menu.WarpGroupMenu; +import net.buildtheearth.buildteamtools.modules.navigation.components.warps.menu.WarpMenu; +import net.buildtheearth.buildteamtools.modules.navigation.components.warps.model.Warp; +import net.buildtheearth.buildteamtools.modules.navigation.components.warps.model.WarpGroup; +import net.buildtheearth.buildteamtools.modules.network.NetworkModule; +import net.buildtheearth.buildteamtools.modules.network.api.OpenStreetMapAPI; +import net.buildtheearth.buildteamtools.modules.network.model.BuildTeam; +import net.buildtheearth.buildteamtools.utils.GeometricUtils; +import net.buildtheearth.buildteamtools.utils.geo.CoordinateConversion; +import net.buildtheearth.buildteamtools.utils.menus.AbstractMenu; import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.NamespacedKey; diff --git a/src/main/java/net/buildtheearth/modules/navigation/components/warps/commands/WarpCommand.java b/src/main/java/net/buildtheearth/buildteamtools/modules/navigation/components/warps/commands/WarpCommand.java similarity index 88% rename from src/main/java/net/buildtheearth/modules/navigation/components/warps/commands/WarpCommand.java rename to src/main/java/net/buildtheearth/buildteamtools/modules/navigation/components/warps/commands/WarpCommand.java index 1da940c4..37938a69 100644 --- a/src/main/java/net/buildtheearth/modules/navigation/components/warps/commands/WarpCommand.java +++ b/src/main/java/net/buildtheearth/buildteamtools/modules/navigation/components/warps/commands/WarpCommand.java @@ -1,11 +1,11 @@ -package net.buildtheearth.modules.navigation.components.warps.commands; +package net.buildtheearth.buildteamtools.modules.navigation.components.warps.commands; import com.alpsbte.alpslib.utils.ChatHelper; -import net.buildtheearth.modules.navigation.NavigationModule; -import net.buildtheearth.modules.navigation.components.warps.WarpsComponent; -import net.buildtheearth.modules.navigation.components.warps.model.Warp; -import net.buildtheearth.modules.network.NetworkModule; -import net.buildtheearth.modules.network.model.Permissions; +import net.buildtheearth.buildteamtools.modules.navigation.NavigationModule; +import net.buildtheearth.buildteamtools.modules.navigation.components.warps.WarpsComponent; +import net.buildtheearth.buildteamtools.modules.navigation.components.warps.model.Warp; +import net.buildtheearth.buildteamtools.modules.network.NetworkModule; +import net.buildtheearth.buildteamtools.modules.network.model.Permissions; import org.bukkit.command.Command; import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandSender; diff --git a/src/main/java/net/buildtheearth/modules/navigation/components/warps/commands/WarpsBtCommand.java b/src/main/java/net/buildtheearth/buildteamtools/modules/navigation/components/warps/commands/WarpsBtCommand.java similarity index 61% rename from src/main/java/net/buildtheearth/modules/navigation/components/warps/commands/WarpsBtCommand.java rename to src/main/java/net/buildtheearth/buildteamtools/modules/navigation/components/warps/commands/WarpsBtCommand.java index e7336706..fb5648bb 100644 --- a/src/main/java/net/buildtheearth/modules/navigation/components/warps/commands/WarpsBtCommand.java +++ b/src/main/java/net/buildtheearth/buildteamtools/modules/navigation/components/warps/commands/WarpsBtCommand.java @@ -1,9 +1,9 @@ -package net.buildtheearth.modules.navigation.components.warps.commands; +package net.buildtheearth.buildteamtools.modules.navigation.components.warps.commands; -import net.buildtheearth.modules.navigation.components.navigator.commands.BuildteamCommand; -import net.buildtheearth.modules.navigation.components.warps.WarpsComponent; -import net.buildtheearth.modules.network.model.BuildTeam; -import net.buildtheearth.modules.network.model.Permissions; +import net.buildtheearth.buildteamtools.modules.navigation.components.navigator.commands.BuildteamCommand; +import net.buildtheearth.buildteamtools.modules.navigation.components.warps.WarpsComponent; +import net.buildtheearth.buildteamtools.modules.network.model.BuildTeam; +import net.buildtheearth.buildteamtools.modules.network.model.Permissions; import org.bukkit.command.Command; import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandSender; diff --git a/src/main/java/net/buildtheearth/modules/navigation/components/warps/listeners/WarpJoinListener.java b/src/main/java/net/buildtheearth/buildteamtools/modules/navigation/components/warps/listeners/WarpJoinListener.java similarity index 81% rename from src/main/java/net/buildtheearth/modules/navigation/components/warps/listeners/WarpJoinListener.java rename to src/main/java/net/buildtheearth/buildteamtools/modules/navigation/components/warps/listeners/WarpJoinListener.java index b140de92..a054afcf 100644 --- a/src/main/java/net/buildtheearth/modules/navigation/components/warps/listeners/WarpJoinListener.java +++ b/src/main/java/net/buildtheearth/buildteamtools/modules/navigation/components/warps/listeners/WarpJoinListener.java @@ -1,8 +1,8 @@ -package net.buildtheearth.modules.navigation.components.warps.listeners; +package net.buildtheearth.buildteamtools.modules.navigation.components.warps.listeners; import com.alpsbte.alpslib.utils.ChatHelper; -import net.buildtheearth.modules.navigation.NavigationModule; -import net.buildtheearth.modules.navigation.components.warps.WarpsComponent; +import net.buildtheearth.buildteamtools.modules.navigation.NavigationModule; +import net.buildtheearth.buildteamtools.modules.navigation.components.warps.WarpsComponent; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.player.PlayerJoinEvent; diff --git a/src/main/java/net/buildtheearth/modules/navigation/components/warps/menu/AddressTypeSelectionMenu.java b/src/main/java/net/buildtheearth/buildteamtools/modules/navigation/components/warps/menu/AddressTypeSelectionMenu.java similarity index 93% rename from src/main/java/net/buildtheearth/modules/navigation/components/warps/menu/AddressTypeSelectionMenu.java rename to src/main/java/net/buildtheearth/buildteamtools/modules/navigation/components/warps/menu/AddressTypeSelectionMenu.java index d17b9a5e..9cb831ba 100644 --- a/src/main/java/net/buildtheearth/modules/navigation/components/warps/menu/AddressTypeSelectionMenu.java +++ b/src/main/java/net/buildtheearth/buildteamtools/modules/navigation/components/warps/menu/AddressTypeSelectionMenu.java @@ -1,13 +1,13 @@ -package net.buildtheearth.modules.navigation.components.warps.menu; +package net.buildtheearth.buildteamtools.modules.navigation.components.warps.menu; import com.alpsbte.alpslib.utils.item.Item; import com.cryptomorin.xseries.XMaterial; -import net.buildtheearth.BuildTeamTools; -import net.buildtheearth.modules.navigation.components.warps.model.Warp; -import net.buildtheearth.utils.ListUtil; -import net.buildtheearth.utils.MenuItems; -import net.buildtheearth.utils.Utils; -import net.buildtheearth.utils.menus.AbstractMenu; +import net.buildtheearth.buildteamtools.BuildTeamTools; +import net.buildtheearth.buildteamtools.modules.navigation.components.warps.model.Warp; +import net.buildtheearth.buildteamtools.utils.ListUtil; +import net.buildtheearth.buildteamtools.utils.MenuItems; +import net.buildtheearth.buildteamtools.utils.Utils; +import net.buildtheearth.buildteamtools.utils.menus.AbstractMenu; import net.wesjd.anvilgui.AnvilGUI; import org.bukkit.Sound; import org.bukkit.entity.Player; diff --git a/src/main/java/net/buildtheearth/modules/navigation/components/warps/menu/MaterialSelectionMenu.java b/src/main/java/net/buildtheearth/buildteamtools/modules/navigation/components/warps/menu/MaterialSelectionMenu.java similarity index 92% rename from src/main/java/net/buildtheearth/modules/navigation/components/warps/menu/MaterialSelectionMenu.java rename to src/main/java/net/buildtheearth/buildteamtools/modules/navigation/components/warps/menu/MaterialSelectionMenu.java index bfed7047..9e45e8f2 100644 --- a/src/main/java/net/buildtheearth/modules/navigation/components/warps/menu/MaterialSelectionMenu.java +++ b/src/main/java/net/buildtheearth/buildteamtools/modules/navigation/components/warps/menu/MaterialSelectionMenu.java @@ -1,16 +1,16 @@ -package net.buildtheearth.modules.navigation.components.warps.menu; +package net.buildtheearth.buildteamtools.modules.navigation.components.warps.menu; import com.alpsbte.alpslib.utils.ChatHelper; import com.alpsbte.alpslib.utils.item.Item; import com.cryptomorin.xseries.XMaterial; -import net.buildtheearth.BuildTeamTools; -import net.buildtheearth.modules.navigation.components.warps.model.Warp; -import net.buildtheearth.modules.navigation.components.warps.model.WarpGroup; -import net.buildtheearth.utils.CustomHeads; -import net.buildtheearth.utils.ListUtil; -import net.buildtheearth.utils.MenuItems; -import net.buildtheearth.utils.menus.AbstractMenu; -import net.buildtheearth.utils.menus.BookMenu; +import net.buildtheearth.buildteamtools.BuildTeamTools; +import net.buildtheearth.buildteamtools.modules.navigation.components.warps.model.Warp; +import net.buildtheearth.buildteamtools.modules.navigation.components.warps.model.WarpGroup; +import net.buildtheearth.buildteamtools.utils.CustomHeads; +import net.buildtheearth.buildteamtools.utils.ListUtil; +import net.buildtheearth.buildteamtools.utils.MenuItems; +import net.buildtheearth.buildteamtools.utils.menus.AbstractMenu; +import net.buildtheearth.buildteamtools.utils.menus.BookMenu; import net.wesjd.anvilgui.AnvilGUI; import org.bukkit.Sound; import org.bukkit.entity.Player; diff --git a/src/main/java/net/buildtheearth/modules/navigation/components/warps/menu/WarpEditMenu.java b/src/main/java/net/buildtheearth/buildteamtools/modules/navigation/components/warps/menu/WarpEditMenu.java similarity index 93% rename from src/main/java/net/buildtheearth/modules/navigation/components/warps/menu/WarpEditMenu.java rename to src/main/java/net/buildtheearth/buildteamtools/modules/navigation/components/warps/menu/WarpEditMenu.java index 4e52875f..7f5de25c 100644 --- a/src/main/java/net/buildtheearth/modules/navigation/components/warps/menu/WarpEditMenu.java +++ b/src/main/java/net/buildtheearth/buildteamtools/modules/navigation/components/warps/menu/WarpEditMenu.java @@ -1,18 +1,18 @@ -package net.buildtheearth.modules.navigation.components.warps.menu; +package net.buildtheearth.buildteamtools.modules.navigation.components.warps.menu; import com.alpsbte.alpslib.utils.ChatHelper; import com.alpsbte.alpslib.utils.item.Item; import com.cryptomorin.xseries.XMaterial; -import net.buildtheearth.BuildTeamTools; -import net.buildtheearth.modules.navigation.components.warps.model.Warp; -import net.buildtheearth.modules.network.NetworkModule; -import net.buildtheearth.modules.network.api.OpenStreetMapAPI; -import net.buildtheearth.modules.network.model.Permissions; -import net.buildtheearth.utils.CustomHeads; -import net.buildtheearth.utils.ListUtil; -import net.buildtheearth.utils.MenuItems; -import net.buildtheearth.utils.geo.CoordinateConversion; -import net.buildtheearth.utils.menus.AbstractMenu; +import net.buildtheearth.buildteamtools.BuildTeamTools; +import net.buildtheearth.buildteamtools.modules.navigation.components.warps.model.Warp; +import net.buildtheearth.buildteamtools.modules.network.NetworkModule; +import net.buildtheearth.buildteamtools.modules.network.api.OpenStreetMapAPI; +import net.buildtheearth.buildteamtools.modules.network.model.Permissions; +import net.buildtheearth.buildteamtools.utils.CustomHeads; +import net.buildtheearth.buildteamtools.utils.ListUtil; +import net.buildtheearth.buildteamtools.utils.MenuItems; +import net.buildtheearth.buildteamtools.utils.geo.CoordinateConversion; +import net.buildtheearth.buildteamtools.utils.menus.AbstractMenu; import net.wesjd.anvilgui.AnvilGUI; import org.bukkit.Location; import org.bukkit.Sound; diff --git a/src/main/java/net/buildtheearth/modules/navigation/components/warps/menu/WarpGroupEditMenu.java b/src/main/java/net/buildtheearth/buildteamtools/modules/navigation/components/warps/menu/WarpGroupEditMenu.java similarity index 93% rename from src/main/java/net/buildtheearth/modules/navigation/components/warps/menu/WarpGroupEditMenu.java rename to src/main/java/net/buildtheearth/buildteamtools/modules/navigation/components/warps/menu/WarpGroupEditMenu.java index fc2707f5..b2ba0a6a 100644 --- a/src/main/java/net/buildtheearth/modules/navigation/components/warps/menu/WarpGroupEditMenu.java +++ b/src/main/java/net/buildtheearth/buildteamtools/modules/navigation/components/warps/menu/WarpGroupEditMenu.java @@ -1,18 +1,18 @@ -package net.buildtheearth.modules.navigation.components.warps.menu; +package net.buildtheearth.buildteamtools.modules.navigation.components.warps.menu; import com.alpsbte.alpslib.utils.AlpsUtils; import com.alpsbte.alpslib.utils.ChatHelper; import com.alpsbte.alpslib.utils.item.Item; import com.cryptomorin.xseries.XMaterial; -import net.buildtheearth.BuildTeamTools; -import net.buildtheearth.modules.navigation.components.warps.model.WarpGroup; -import net.buildtheearth.modules.network.NetworkModule; -import net.buildtheearth.modules.network.model.Permissions; -import net.buildtheearth.utils.CustomHeads; -import net.buildtheearth.utils.ListUtil; -import net.buildtheearth.utils.MenuItems; -import net.buildtheearth.utils.menus.AbstractMenu; -import net.buildtheearth.utils.menus.BookMenu; +import net.buildtheearth.buildteamtools.BuildTeamTools; +import net.buildtheearth.buildteamtools.modules.navigation.components.warps.model.WarpGroup; +import net.buildtheearth.buildteamtools.modules.network.NetworkModule; +import net.buildtheearth.buildteamtools.modules.network.model.Permissions; +import net.buildtheearth.buildteamtools.utils.CustomHeads; +import net.buildtheearth.buildteamtools.utils.ListUtil; +import net.buildtheearth.buildteamtools.utils.MenuItems; +import net.buildtheearth.buildteamtools.utils.menus.AbstractMenu; +import net.buildtheearth.buildteamtools.utils.menus.BookMenu; import net.wesjd.anvilgui.AnvilGUI; import org.bukkit.Sound; import org.bukkit.entity.Player; @@ -24,7 +24,7 @@ import java.util.Collections; import java.util.List; -import static net.buildtheearth.modules.navigation.components.warps.menu.WarpEditMenu.CONFIRM_SLOT; +import static net.buildtheearth.buildteamtools.modules.navigation.components.warps.menu.WarpEditMenu.CONFIRM_SLOT; public class WarpGroupEditMenu extends AbstractMenu { diff --git a/src/main/java/net/buildtheearth/modules/navigation/components/warps/menu/WarpGroupMenu.java b/src/main/java/net/buildtheearth/buildteamtools/modules/navigation/components/warps/menu/WarpGroupMenu.java similarity index 90% rename from src/main/java/net/buildtheearth/modules/navigation/components/warps/menu/WarpGroupMenu.java rename to src/main/java/net/buildtheearth/buildteamtools/modules/navigation/components/warps/menu/WarpGroupMenu.java index b4f44a8b..a40f7b79 100644 --- a/src/main/java/net/buildtheearth/modules/navigation/components/warps/menu/WarpGroupMenu.java +++ b/src/main/java/net/buildtheearth/buildteamtools/modules/navigation/components/warps/menu/WarpGroupMenu.java @@ -1,21 +1,21 @@ -package net.buildtheearth.modules.navigation.components.warps.menu; +package net.buildtheearth.buildteamtools.modules.navigation.components.warps.menu; import com.alpsbte.alpslib.utils.ChatHelper; import com.alpsbte.alpslib.utils.item.Item; import com.google.gson.Gson; -import net.buildtheearth.BuildTeamTools; -import net.buildtheearth.modules.navigation.NavigationModule; -import net.buildtheearth.modules.navigation.components.warps.model.WarpGroup; -import net.buildtheearth.modules.network.NetworkModule; -import net.buildtheearth.modules.network.model.BuildTeam; -import net.buildtheearth.modules.network.model.Permissions; -import net.buildtheearth.utils.CustomHeads; -import net.buildtheearth.utils.ListUtil; -import net.buildtheearth.utils.MenuItems; -import net.buildtheearth.utils.io.ConfigPaths; -import net.buildtheearth.utils.io.ConfigUtil; -import net.buildtheearth.utils.menus.AbstractMenu; -import net.buildtheearth.utils.menus.AbstractPaginatedMenu; +import net.buildtheearth.buildteamtools.BuildTeamTools; +import net.buildtheearth.buildteamtools.modules.navigation.NavigationModule; +import net.buildtheearth.buildteamtools.modules.navigation.components.warps.model.WarpGroup; +import net.buildtheearth.buildteamtools.modules.network.NetworkModule; +import net.buildtheearth.buildteamtools.modules.network.model.BuildTeam; +import net.buildtheearth.buildteamtools.modules.network.model.Permissions; +import net.buildtheearth.buildteamtools.utils.CustomHeads; +import net.buildtheearth.buildteamtools.utils.ListUtil; +import net.buildtheearth.buildteamtools.utils.MenuItems; +import net.buildtheearth.buildteamtools.utils.io.ConfigPaths; +import net.buildtheearth.buildteamtools.utils.io.ConfigUtil; +import net.buildtheearth.buildteamtools.utils.menus.AbstractMenu; +import net.buildtheearth.buildteamtools.utils.menus.AbstractPaginatedMenu; import org.bukkit.entity.Player; import org.ipvp.canvas.mask.BinaryMask; import org.ipvp.canvas.mask.Mask; diff --git a/src/main/java/net/buildtheearth/modules/navigation/components/warps/menu/WarpGroupSelectionMenu.java b/src/main/java/net/buildtheearth/buildteamtools/modules/navigation/components/warps/menu/WarpGroupSelectionMenu.java similarity index 82% rename from src/main/java/net/buildtheearth/modules/navigation/components/warps/menu/WarpGroupSelectionMenu.java rename to src/main/java/net/buildtheearth/buildteamtools/modules/navigation/components/warps/menu/WarpGroupSelectionMenu.java index 70df51eb..25ca84a1 100644 --- a/src/main/java/net/buildtheearth/modules/navigation/components/warps/menu/WarpGroupSelectionMenu.java +++ b/src/main/java/net/buildtheearth/buildteamtools/modules/navigation/components/warps/menu/WarpGroupSelectionMenu.java @@ -1,8 +1,8 @@ -package net.buildtheearth.modules.navigation.components.warps.menu; +package net.buildtheearth.buildteamtools.modules.navigation.components.warps.menu; -import net.buildtheearth.modules.network.model.BuildTeam; -import net.buildtheearth.modules.navigation.components.warps.model.Warp; -import net.buildtheearth.modules.navigation.components.warps.model.WarpGroup; +import net.buildtheearth.buildteamtools.modules.navigation.components.warps.model.Warp; +import net.buildtheearth.buildteamtools.modules.navigation.components.warps.model.WarpGroup; +import net.buildtheearth.buildteamtools.modules.network.model.BuildTeam; import org.bukkit.Sound; import org.bukkit.entity.Player; import org.jetbrains.annotations.NotNull; diff --git a/src/main/java/net/buildtheearth/modules/navigation/components/warps/menu/WarpMenu.java b/src/main/java/net/buildtheearth/buildteamtools/modules/navigation/components/warps/menu/WarpMenu.java similarity index 85% rename from src/main/java/net/buildtheearth/modules/navigation/components/warps/menu/WarpMenu.java rename to src/main/java/net/buildtheearth/buildteamtools/modules/navigation/components/warps/menu/WarpMenu.java index b35247ef..8b5d85bd 100644 --- a/src/main/java/net/buildtheearth/modules/navigation/components/warps/menu/WarpMenu.java +++ b/src/main/java/net/buildtheearth/buildteamtools/modules/navigation/components/warps/menu/WarpMenu.java @@ -1,15 +1,15 @@ -package net.buildtheearth.modules.navigation.components.warps.menu; +package net.buildtheearth.buildteamtools.modules.navigation.components.warps.menu; import com.alpsbte.alpslib.utils.item.Item; -import net.buildtheearth.modules.navigation.NavigationModule; -import net.buildtheearth.modules.navigation.components.warps.model.Warp; -import net.buildtheearth.modules.navigation.components.warps.model.WarpGroup; -import net.buildtheearth.modules.network.NetworkModule; -import net.buildtheearth.modules.network.model.Permissions; -import net.buildtheearth.utils.CustomHeads; -import net.buildtheearth.utils.ListUtil; -import net.buildtheearth.utils.MenuItems; -import net.buildtheearth.utils.menus.AbstractPaginatedMenu; +import net.buildtheearth.buildteamtools.modules.navigation.NavigationModule; +import net.buildtheearth.buildteamtools.modules.navigation.components.warps.model.Warp; +import net.buildtheearth.buildteamtools.modules.navigation.components.warps.model.WarpGroup; +import net.buildtheearth.buildteamtools.modules.network.NetworkModule; +import net.buildtheearth.buildteamtools.modules.network.model.Permissions; +import net.buildtheearth.buildteamtools.utils.CustomHeads; +import net.buildtheearth.buildteamtools.utils.ListUtil; +import net.buildtheearth.buildteamtools.utils.MenuItems; +import net.buildtheearth.buildteamtools.utils.menus.AbstractPaginatedMenu; import org.bukkit.entity.Player; import org.ipvp.canvas.mask.BinaryMask; import org.ipvp.canvas.mask.Mask; diff --git a/src/main/java/net/buildtheearth/modules/navigation/components/warps/model/Warp.java b/src/main/java/net/buildtheearth/buildteamtools/modules/navigation/components/warps/model/Warp.java similarity index 94% rename from src/main/java/net/buildtheearth/modules/navigation/components/warps/model/Warp.java rename to src/main/java/net/buildtheearth/buildteamtools/modules/navigation/components/warps/model/Warp.java index 3eb5bd0b..456753c6 100644 --- a/src/main/java/net/buildtheearth/modules/navigation/components/warps/model/Warp.java +++ b/src/main/java/net/buildtheearth/buildteamtools/modules/navigation/components/warps/model/Warp.java @@ -1,12 +1,12 @@ -package net.buildtheearth.modules.navigation.components.warps.model; +package net.buildtheearth.buildteamtools.modules.navigation.components.warps.model; import com.alpsbte.alpslib.utils.item.Item; import lombok.AllArgsConstructor; import lombok.Getter; import lombok.Setter; -import net.buildtheearth.utils.CustomHeads; -import net.buildtheearth.utils.ListUtil; -import net.buildtheearth.utils.Utils; +import net.buildtheearth.buildteamtools.utils.CustomHeads; +import net.buildtheearth.buildteamtools.utils.ListUtil; +import net.buildtheearth.buildteamtools.utils.Utils; import org.bukkit.Material; import org.bukkit.inventory.ItemStack; import org.json.JSONObject; diff --git a/src/main/java/net/buildtheearth/modules/navigation/components/warps/model/WarpGroup.java b/src/main/java/net/buildtheearth/buildteamtools/modules/navigation/components/warps/model/WarpGroup.java similarity index 91% rename from src/main/java/net/buildtheearth/modules/navigation/components/warps/model/WarpGroup.java rename to src/main/java/net/buildtheearth/buildteamtools/modules/navigation/components/warps/model/WarpGroup.java index 6499973e..833a9f48 100644 --- a/src/main/java/net/buildtheearth/modules/navigation/components/warps/model/WarpGroup.java +++ b/src/main/java/net/buildtheearth/buildteamtools/modules/navigation/components/warps/model/WarpGroup.java @@ -1,11 +1,11 @@ -package net.buildtheearth.modules.navigation.components.warps.model; +package net.buildtheearth.buildteamtools.modules.navigation.components.warps.model; import com.alpsbte.alpslib.utils.item.Item; import lombok.Getter; import lombok.Setter; -import net.buildtheearth.modules.network.model.BuildTeam; -import net.buildtheearth.utils.CustomHeads; -import net.buildtheearth.utils.ListUtil; +import net.buildtheearth.buildteamtools.modules.network.model.BuildTeam; +import net.buildtheearth.buildteamtools.utils.CustomHeads; +import net.buildtheearth.buildteamtools.utils.ListUtil; import org.bukkit.Material; import org.bukkit.inventory.ItemStack; import org.json.JSONObject; diff --git a/src/main/java/net/buildtheearth/modules/navigation/menu/CountrySelectorMenu.java b/src/main/java/net/buildtheearth/buildteamtools/modules/navigation/menu/CountrySelectorMenu.java similarity index 88% rename from src/main/java/net/buildtheearth/modules/navigation/menu/CountrySelectorMenu.java rename to src/main/java/net/buildtheearth/buildteamtools/modules/navigation/menu/CountrySelectorMenu.java index 868abbaa..cbde5bfe 100644 --- a/src/main/java/net/buildtheearth/modules/navigation/menu/CountrySelectorMenu.java +++ b/src/main/java/net/buildtheearth/buildteamtools/modules/navigation/menu/CountrySelectorMenu.java @@ -1,18 +1,18 @@ -package net.buildtheearth.modules.navigation.menu; +package net.buildtheearth.buildteamtools.modules.navigation.menu; import com.alpsbte.alpslib.utils.ChatHelper; import com.alpsbte.alpslib.utils.item.Item; import lombok.NonNull; -import net.buildtheearth.modules.navigation.NavUtils; -import net.buildtheearth.modules.navigation.components.warps.WarpsComponent; -import net.buildtheearth.modules.network.NetworkModule; -import net.buildtheearth.modules.network.model.BuildTeam; -import net.buildtheearth.modules.network.model.Continent; -import net.buildtheearth.modules.network.model.Permissions; -import net.buildtheearth.modules.network.model.Region; -import net.buildtheearth.utils.ListUtil; -import net.buildtheearth.utils.MenuItems; -import net.buildtheearth.utils.menus.AbstractPaginatedMenu; +import net.buildtheearth.buildteamtools.modules.navigation.NavUtils; +import net.buildtheearth.buildteamtools.modules.navigation.components.warps.WarpsComponent; +import net.buildtheearth.buildteamtools.modules.network.NetworkModule; +import net.buildtheearth.buildteamtools.modules.network.model.BuildTeam; +import net.buildtheearth.buildteamtools.modules.network.model.Continent; +import net.buildtheearth.buildteamtools.modules.network.model.Permissions; +import net.buildtheearth.buildteamtools.modules.network.model.Region; +import net.buildtheearth.buildteamtools.utils.ListUtil; +import net.buildtheearth.buildteamtools.utils.MenuItems; +import net.buildtheearth.buildteamtools.utils.menus.AbstractPaginatedMenu; import org.bukkit.entity.Player; import org.ipvp.canvas.mask.BinaryMask; import org.ipvp.canvas.mask.Mask; diff --git a/src/main/java/net/buildtheearth/modules/navigation/menu/ExploreMenu.java b/src/main/java/net/buildtheearth/buildteamtools/modules/navigation/menu/ExploreMenu.java similarity index 90% rename from src/main/java/net/buildtheearth/modules/navigation/menu/ExploreMenu.java rename to src/main/java/net/buildtheearth/buildteamtools/modules/navigation/menu/ExploreMenu.java index c29be7fc..3b3690f7 100644 --- a/src/main/java/net/buildtheearth/modules/navigation/menu/ExploreMenu.java +++ b/src/main/java/net/buildtheearth/buildteamtools/modules/navigation/menu/ExploreMenu.java @@ -1,12 +1,12 @@ -package net.buildtheearth.modules.navigation.menu; +package net.buildtheearth.buildteamtools.modules.navigation.menu; import com.alpsbte.alpslib.utils.ChatHelper; import com.alpsbte.alpslib.utils.item.Item; import com.cryptomorin.xseries.XMaterial; -import net.buildtheearth.modules.network.model.Continent; -import net.buildtheearth.utils.MenuItems; -import net.buildtheearth.utils.menus.AbstractMenu; +import net.buildtheearth.buildteamtools.modules.network.model.Continent; +import net.buildtheearth.buildteamtools.utils.MenuItems; +import net.buildtheearth.buildteamtools.utils.menus.AbstractMenu; import org.bukkit.entity.Player; import org.ipvp.canvas.mask.BinaryMask; import org.ipvp.canvas.mask.Mask; diff --git a/src/main/java/net/buildtheearth/modules/navigation/menu/MainMenu.java b/src/main/java/net/buildtheearth/buildteamtools/modules/navigation/menu/MainMenu.java similarity index 93% rename from src/main/java/net/buildtheearth/modules/navigation/menu/MainMenu.java rename to src/main/java/net/buildtheearth/buildteamtools/modules/navigation/menu/MainMenu.java index db12d2eb..cf433250 100644 --- a/src/main/java/net/buildtheearth/modules/navigation/menu/MainMenu.java +++ b/src/main/java/net/buildtheearth/buildteamtools/modules/navigation/menu/MainMenu.java @@ -1,16 +1,16 @@ -package net.buildtheearth.modules.navigation.menu; +package net.buildtheearth.buildteamtools.modules.navigation.menu; import com.alpsbte.alpslib.utils.ChatHelper; import com.alpsbte.alpslib.utils.item.Item; import com.cryptomorin.xseries.XMaterial; -import net.buildtheearth.BuildTeamTools; -import net.buildtheearth.modules.navigation.NavUtils; -import net.buildtheearth.modules.navigation.components.warps.WarpsComponent; -import net.buildtheearth.modules.network.NetworkModule; -import net.buildtheearth.utils.MenuItems; -import net.buildtheearth.utils.io.ConfigPaths; -import net.buildtheearth.utils.io.ConfigUtil; -import net.buildtheearth.utils.menus.AbstractMenu; +import net.buildtheearth.buildteamtools.BuildTeamTools; +import net.buildtheearth.buildteamtools.modules.navigation.NavUtils; +import net.buildtheearth.buildteamtools.modules.navigation.components.warps.WarpsComponent; +import net.buildtheearth.buildteamtools.modules.network.NetworkModule; +import net.buildtheearth.buildteamtools.utils.MenuItems; +import net.buildtheearth.buildteamtools.utils.io.ConfigPaths; +import net.buildtheearth.buildteamtools.utils.io.ConfigUtil; +import net.buildtheearth.buildteamtools.utils.menus.AbstractMenu; import net.kyori.adventure.text.format.NamedTextColor; import org.apache.commons.lang3.BooleanUtils; import org.bukkit.configuration.file.FileConfiguration; diff --git a/src/main/java/net/buildtheearth/modules/navigation/menu/StateSelectorMenu.java b/src/main/java/net/buildtheearth/buildteamtools/modules/navigation/menu/StateSelectorMenu.java similarity index 90% rename from src/main/java/net/buildtheearth/modules/navigation/menu/StateSelectorMenu.java rename to src/main/java/net/buildtheearth/buildteamtools/modules/navigation/menu/StateSelectorMenu.java index 6f4bf270..c9a59567 100644 --- a/src/main/java/net/buildtheearth/modules/navigation/menu/StateSelectorMenu.java +++ b/src/main/java/net/buildtheearth/buildteamtools/modules/navigation/menu/StateSelectorMenu.java @@ -1,15 +1,15 @@ -package net.buildtheearth.modules.navigation.menu; +package net.buildtheearth.buildteamtools.modules.navigation.menu; import com.alpsbte.alpslib.utils.ChatHelper; import com.alpsbte.alpslib.utils.item.Item; import lombok.NonNull; -import net.buildtheearth.modules.navigation.NavUtils; -import net.buildtheearth.modules.network.NetworkModule; -import net.buildtheearth.modules.network.model.Region; -import net.buildtheearth.modules.network.model.RegionType; -import net.buildtheearth.utils.ListUtil; -import net.buildtheearth.utils.MenuItems; -import net.buildtheearth.utils.menus.AbstractPaginatedMenu; +import net.buildtheearth.buildteamtools.modules.navigation.NavUtils; +import net.buildtheearth.buildteamtools.modules.network.NetworkModule; +import net.buildtheearth.buildteamtools.modules.network.model.Region; +import net.buildtheearth.buildteamtools.modules.network.model.RegionType; +import net.buildtheearth.buildteamtools.utils.ListUtil; +import net.buildtheearth.buildteamtools.utils.MenuItems; +import net.buildtheearth.buildteamtools.utils.menus.AbstractPaginatedMenu; import org.bukkit.entity.Player; import org.ipvp.canvas.mask.BinaryMask; import org.ipvp.canvas.mask.Mask; diff --git a/src/main/java/net/buildtheearth/modules/navigation/menu/TutorialsMenu.java b/src/main/java/net/buildtheearth/buildteamtools/modules/navigation/menu/TutorialsMenu.java similarity index 87% rename from src/main/java/net/buildtheearth/modules/navigation/menu/TutorialsMenu.java rename to src/main/java/net/buildtheearth/buildteamtools/modules/navigation/menu/TutorialsMenu.java index 4c4a3c15..e58ed572 100644 --- a/src/main/java/net/buildtheearth/modules/navigation/menu/TutorialsMenu.java +++ b/src/main/java/net/buildtheearth/buildteamtools/modules/navigation/menu/TutorialsMenu.java @@ -1,6 +1,6 @@ -package net.buildtheearth.modules.navigation.menu; +package net.buildtheearth.buildteamtools.modules.navigation.menu; -import net.buildtheearth.utils.menus.AbstractMenu; +import net.buildtheearth.buildteamtools.utils.menus.AbstractMenu; import org.bukkit.entity.Player; import org.ipvp.canvas.mask.Mask; diff --git a/src/main/java/net/buildtheearth/modules/network/NetworkModule.java b/src/main/java/net/buildtheearth/buildteamtools/modules/network/NetworkModule.java similarity index 87% rename from src/main/java/net/buildtheearth/modules/network/NetworkModule.java rename to src/main/java/net/buildtheearth/buildteamtools/modules/network/NetworkModule.java index ac75a8a4..7f5f78a4 100644 --- a/src/main/java/net/buildtheearth/modules/network/NetworkModule.java +++ b/src/main/java/net/buildtheearth/buildteamtools/modules/network/NetworkModule.java @@ -1,21 +1,21 @@ -package net.buildtheearth.modules.network; +package net.buildtheearth.buildteamtools.modules.network; import com.google.common.io.ByteArrayDataOutput; import com.google.common.io.ByteStreams; import lombok.Getter; import lombok.Setter; -import net.buildtheearth.BuildTeamTools; -import net.buildtheearth.modules.Module; -import net.buildtheearth.modules.network.api.NetworkAPI; -import net.buildtheearth.modules.network.listeners.NetworkJoinListener; -import net.buildtheearth.modules.network.listeners.NetworkQuitListener; -import net.buildtheearth.modules.network.model.BuildTeam; -import net.buildtheearth.modules.network.model.Region; -import net.buildtheearth.modules.network.model.RegionType; -import net.buildtheearth.utils.WikiLinks; -import net.buildtheearth.utils.io.ConfigPaths; -import net.buildtheearth.utils.io.Constants; -import net.buildtheearth.utils.io.Errors; +import net.buildtheearth.buildteamtools.BuildTeamTools; +import net.buildtheearth.buildteamtools.modules.Module; +import net.buildtheearth.buildteamtools.modules.network.api.NetworkAPI; +import net.buildtheearth.buildteamtools.modules.network.listeners.NetworkJoinListener; +import net.buildtheearth.buildteamtools.modules.network.listeners.NetworkQuitListener; +import net.buildtheearth.buildteamtools.modules.network.model.BuildTeam; +import net.buildtheearth.buildteamtools.modules.network.model.Region; +import net.buildtheearth.buildteamtools.modules.network.model.RegionType; +import net.buildtheearth.buildteamtools.utils.WikiLinks; +import net.buildtheearth.buildteamtools.utils.io.ConfigPaths; +import net.buildtheearth.buildteamtools.utils.io.Constants; +import net.buildtheearth.buildteamtools.utils.io.Errors; import org.bukkit.Bukkit; import org.bukkit.entity.Player; import org.jetbrains.annotations.NotNull; diff --git a/src/main/java/net/buildtheearth/modules/network/api/API.java b/src/main/java/net/buildtheearth/buildteamtools/modules/network/api/API.java similarity index 97% rename from src/main/java/net/buildtheearth/modules/network/api/API.java rename to src/main/java/net/buildtheearth/buildteamtools/modules/network/api/API.java index 00b688e7..326cf005 100644 --- a/src/main/java/net/buildtheearth/modules/network/api/API.java +++ b/src/main/java/net/buildtheearth/buildteamtools/modules/network/api/API.java @@ -1,12 +1,7 @@ -package net.buildtheearth.modules.network.api; - -import net.buildtheearth.BuildTeamTools; -import okhttp3.Call; -import okhttp3.Callback; -import okhttp3.OkHttpClient; -import okhttp3.Request; -import okhttp3.RequestBody; -import okhttp3.Response; +package net.buildtheearth.buildteamtools.modules.network.api; + +import net.buildtheearth.buildteamtools.BuildTeamTools; +import okhttp3.*; import okio.Buffer; import org.jetbrains.annotations.NotNull; import org.json.simple.JSONArray; diff --git a/src/main/java/net/buildtheearth/modules/network/api/NetworkAPI.java b/src/main/java/net/buildtheearth/buildteamtools/modules/network/api/NetworkAPI.java similarity index 96% rename from src/main/java/net/buildtheearth/modules/network/api/NetworkAPI.java rename to src/main/java/net/buildtheearth/buildteamtools/modules/network/api/NetworkAPI.java index 14e37dcf..35c6e7b8 100644 --- a/src/main/java/net/buildtheearth/modules/network/api/NetworkAPI.java +++ b/src/main/java/net/buildtheearth/buildteamtools/modules/network/api/NetworkAPI.java @@ -1,17 +1,17 @@ -package net.buildtheearth.modules.network.api; +package net.buildtheearth.buildteamtools.modules.network.api; import com.alpsbte.alpslib.utils.ChatHelper; import lombok.experimental.UtilityClass; -import net.buildtheearth.BuildTeamTools; -import net.buildtheearth.modules.navigation.NavUtils; -import net.buildtheearth.modules.navigation.components.warps.model.Warp; -import net.buildtheearth.modules.navigation.components.warps.model.WarpGroup; -import net.buildtheearth.modules.network.NetworkModule; -import net.buildtheearth.modules.network.model.BuildTeam; -import net.buildtheearth.modules.network.model.Continent; -import net.buildtheearth.modules.network.model.Region; -import net.buildtheearth.modules.network.model.RegionType; -import net.buildtheearth.utils.io.ConfigPaths; +import net.buildtheearth.buildteamtools.BuildTeamTools; +import net.buildtheearth.buildteamtools.modules.navigation.NavUtils; +import net.buildtheearth.buildteamtools.modules.navigation.components.warps.model.Warp; +import net.buildtheearth.buildteamtools.modules.navigation.components.warps.model.WarpGroup; +import net.buildtheearth.buildteamtools.modules.network.NetworkModule; +import net.buildtheearth.buildteamtools.modules.network.model.BuildTeam; +import net.buildtheearth.buildteamtools.modules.network.model.Continent; +import net.buildtheearth.buildteamtools.modules.network.model.Region; +import net.buildtheearth.buildteamtools.modules.network.model.RegionType; +import net.buildtheearth.buildteamtools.utils.io.ConfigPaths; import okhttp3.MediaType; import okhttp3.RequestBody; import org.bukkit.Bukkit; diff --git a/src/main/java/net/buildtheearth/modules/network/api/OpenStreetMapAPI.java b/src/main/java/net/buildtheearth/buildteamtools/modules/network/api/OpenStreetMapAPI.java similarity index 96% rename from src/main/java/net/buildtheearth/modules/network/api/OpenStreetMapAPI.java rename to src/main/java/net/buildtheearth/buildteamtools/modules/network/api/OpenStreetMapAPI.java index b9406963..92d7993e 100644 --- a/src/main/java/net/buildtheearth/modules/network/api/OpenStreetMapAPI.java +++ b/src/main/java/net/buildtheearth/buildteamtools/modules/network/api/OpenStreetMapAPI.java @@ -1,4 +1,4 @@ -package net.buildtheearth.modules.network.api; +package net.buildtheearth.buildteamtools.modules.network.api; import com.alpsbte.alpslib.utils.ChatHelper; import org.jetbrains.annotations.NotNull; diff --git a/src/main/java/net/buildtheearth/modules/network/listeners/NetworkJoinListener.java b/src/main/java/net/buildtheearth/buildteamtools/modules/network/listeners/NetworkJoinListener.java similarity index 71% rename from src/main/java/net/buildtheearth/modules/network/listeners/NetworkJoinListener.java rename to src/main/java/net/buildtheearth/buildteamtools/modules/network/listeners/NetworkJoinListener.java index b60a6c47..2a1b7d82 100644 --- a/src/main/java/net/buildtheearth/modules/network/listeners/NetworkJoinListener.java +++ b/src/main/java/net/buildtheearth/buildteamtools/modules/network/listeners/NetworkJoinListener.java @@ -1,8 +1,8 @@ -package net.buildtheearth.modules.network.listeners; +package net.buildtheearth.buildteamtools.modules.network.listeners; -import net.buildtheearth.modules.common.CommonModule; -import net.buildtheearth.modules.network.NetworkModule; -import net.buildtheearth.modules.network.api.NetworkAPI; +import net.buildtheearth.buildteamtools.modules.common.CommonModule; +import net.buildtheearth.buildteamtools.modules.network.NetworkModule; +import net.buildtheearth.buildteamtools.modules.network.api.NetworkAPI; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; diff --git a/src/main/java/net/buildtheearth/modules/network/listeners/NetworkQuitListener.java b/src/main/java/net/buildtheearth/buildteamtools/modules/network/listeners/NetworkQuitListener.java similarity index 69% rename from src/main/java/net/buildtheearth/modules/network/listeners/NetworkQuitListener.java rename to src/main/java/net/buildtheearth/buildteamtools/modules/network/listeners/NetworkQuitListener.java index 00735bd7..9a48777f 100644 --- a/src/main/java/net/buildtheearth/modules/network/listeners/NetworkQuitListener.java +++ b/src/main/java/net/buildtheearth/buildteamtools/modules/network/listeners/NetworkQuitListener.java @@ -1,7 +1,7 @@ -package net.buildtheearth.modules.network.listeners; +package net.buildtheearth.buildteamtools.modules.network.listeners; -import net.buildtheearth.modules.network.NetworkModule; -import net.buildtheearth.modules.network.api.NetworkAPI; +import net.buildtheearth.buildteamtools.modules.network.NetworkModule; +import net.buildtheearth.buildteamtools.modules.network.api.NetworkAPI; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; diff --git a/src/main/java/net/buildtheearth/modules/network/model/BuildTeam.java b/src/main/java/net/buildtheearth/buildteamtools/modules/network/model/BuildTeam.java similarity index 94% rename from src/main/java/net/buildtheearth/modules/network/model/BuildTeam.java rename to src/main/java/net/buildtheearth/buildteamtools/modules/network/model/BuildTeam.java index 825b6f8e..7f5dddf4 100644 --- a/src/main/java/net/buildtheearth/modules/network/model/BuildTeam.java +++ b/src/main/java/net/buildtheearth/buildteamtools/modules/network/model/BuildTeam.java @@ -1,12 +1,12 @@ -package net.buildtheearth.modules.network.model; +package net.buildtheearth.buildteamtools.modules.network.model; import com.alpsbte.alpslib.utils.ChatHelper; import lombok.Getter; -import net.buildtheearth.modules.navigation.components.warps.model.Warp; -import net.buildtheearth.modules.navigation.components.warps.model.WarpGroup; -import net.buildtheearth.modules.network.NetworkModule; -import net.buildtheearth.modules.network.api.API; -import net.buildtheearth.modules.network.api.NetworkAPI; +import net.buildtheearth.buildteamtools.modules.navigation.components.warps.model.Warp; +import net.buildtheearth.buildteamtools.modules.navigation.components.warps.model.WarpGroup; +import net.buildtheearth.buildteamtools.modules.network.NetworkModule; +import net.buildtheearth.buildteamtools.modules.network.api.API; +import net.buildtheearth.buildteamtools.modules.network.api.NetworkAPI; import org.bukkit.entity.Player; import java.io.IOException; diff --git a/src/main/java/net/buildtheearth/modules/network/model/Continent.java b/src/main/java/net/buildtheearth/buildteamtools/modules/network/model/Continent.java similarity index 94% rename from src/main/java/net/buildtheearth/modules/network/model/Continent.java rename to src/main/java/net/buildtheearth/buildteamtools/modules/network/model/Continent.java index 5c704384..c5ad9bf0 100644 --- a/src/main/java/net/buildtheearth/modules/network/model/Continent.java +++ b/src/main/java/net/buildtheearth/buildteamtools/modules/network/model/Continent.java @@ -1,4 +1,4 @@ -package net.buildtheearth.modules.network.model; +package net.buildtheearth.buildteamtools.modules.network.model; import lombok.Getter; import lombok.NonNull; diff --git a/src/main/java/net/buildtheearth/modules/network/model/Permissions.java b/src/main/java/net/buildtheearth/buildteamtools/modules/network/model/Permissions.java similarity index 95% rename from src/main/java/net/buildtheearth/modules/network/model/Permissions.java rename to src/main/java/net/buildtheearth/buildteamtools/modules/network/model/Permissions.java index f2cf1dff..d29ee740 100644 --- a/src/main/java/net/buildtheearth/modules/network/model/Permissions.java +++ b/src/main/java/net/buildtheearth/buildteamtools/modules/network/model/Permissions.java @@ -1,4 +1,4 @@ -package net.buildtheearth.modules.network.model; +package net.buildtheearth.buildteamtools.modules.network.model; public abstract class Permissions { diff --git a/src/main/java/net/buildtheearth/modules/network/model/Region.java b/src/main/java/net/buildtheearth/buildteamtools/modules/network/model/Region.java similarity index 97% rename from src/main/java/net/buildtheearth/modules/network/model/Region.java rename to src/main/java/net/buildtheearth/buildteamtools/modules/network/model/Region.java index 41f5a3a4..ff60aa64 100644 --- a/src/main/java/net/buildtheearth/modules/network/model/Region.java +++ b/src/main/java/net/buildtheearth/buildteamtools/modules/network/model/Region.java @@ -1,4 +1,4 @@ -package net.buildtheearth.modules.network.model; +package net.buildtheearth.buildteamtools.modules.network.model; import lombok.Getter; diff --git a/src/main/java/net/buildtheearth/modules/network/model/RegionType.java b/src/main/java/net/buildtheearth/buildteamtools/modules/network/model/RegionType.java similarity index 89% rename from src/main/java/net/buildtheearth/modules/network/model/RegionType.java rename to src/main/java/net/buildtheearth/buildteamtools/modules/network/model/RegionType.java index 6279a005..a58d40e7 100644 --- a/src/main/java/net/buildtheearth/modules/network/model/RegionType.java +++ b/src/main/java/net/buildtheearth/buildteamtools/modules/network/model/RegionType.java @@ -1,4 +1,4 @@ -package net.buildtheearth.modules.network.model; +package net.buildtheearth.buildteamtools.modules.network.model; import lombok.Getter; import lombok.NonNull; diff --git a/src/main/java/net/buildtheearth/modules/plotsystem/PlotSystemModule.java b/src/main/java/net/buildtheearth/buildteamtools/modules/plotsystem/PlotSystemModule.java similarity index 94% rename from src/main/java/net/buildtheearth/modules/plotsystem/PlotSystemModule.java rename to src/main/java/net/buildtheearth/buildteamtools/modules/plotsystem/PlotSystemModule.java index ad38318b..edbf1950 100644 --- a/src/main/java/net/buildtheearth/modules/plotsystem/PlotSystemModule.java +++ b/src/main/java/net/buildtheearth/buildteamtools/modules/plotsystem/PlotSystemModule.java @@ -1,8 +1,8 @@ -package net.buildtheearth.modules.plotsystem; +package net.buildtheearth.buildteamtools.modules.plotsystem; -import net.buildtheearth.modules.Module; -import net.buildtheearth.modules.plotsystem.commands.PlotSystemTerraCommand; -import net.buildtheearth.utils.WikiLinks; +import net.buildtheearth.buildteamtools.modules.Module; +import net.buildtheearth.buildteamtools.modules.plotsystem.commands.PlotSystemTerraCommand; +import net.buildtheearth.buildteamtools.utils.WikiLinks; public class PlotSystemModule extends Module { diff --git a/src/main/java/net/buildtheearth/modules/plotsystem/commands/PlotSystemTerraCommand.java b/src/main/java/net/buildtheearth/buildteamtools/modules/plotsystem/commands/PlotSystemTerraCommand.java similarity index 81% rename from src/main/java/net/buildtheearth/modules/plotsystem/commands/PlotSystemTerraCommand.java rename to src/main/java/net/buildtheearth/buildteamtools/modules/plotsystem/commands/PlotSystemTerraCommand.java index 3b84735e..d318c2c8 100644 --- a/src/main/java/net/buildtheearth/modules/plotsystem/commands/PlotSystemTerraCommand.java +++ b/src/main/java/net/buildtheearth/buildteamtools/modules/plotsystem/commands/PlotSystemTerraCommand.java @@ -1,4 +1,4 @@ -package net.buildtheearth.modules.plotsystem.commands; +package net.buildtheearth.buildteamtools.modules.plotsystem.commands; import org.bukkit.command.Command; import org.bukkit.command.CommandExecutor; diff --git a/src/main/java/net/buildtheearth/modules/stats/StatsModule.java b/src/main/java/net/buildtheearth/buildteamtools/modules/stats/StatsModule.java similarity index 86% rename from src/main/java/net/buildtheearth/modules/stats/StatsModule.java rename to src/main/java/net/buildtheearth/buildteamtools/modules/stats/StatsModule.java index d8257ff4..90df7693 100644 --- a/src/main/java/net/buildtheearth/modules/stats/StatsModule.java +++ b/src/main/java/net/buildtheearth/buildteamtools/modules/stats/StatsModule.java @@ -1,15 +1,15 @@ -package net.buildtheearth.modules.stats; +package net.buildtheearth.buildteamtools.modules.stats; import com.google.common.io.ByteArrayDataOutput; import com.google.common.io.ByteStreams; import lombok.Getter; -import net.buildtheearth.BuildTeamTools; -import net.buildtheearth.modules.Module; -import net.buildtheearth.modules.network.NetworkModule; -import net.buildtheearth.modules.stats.listeners.StatsListener; -import net.buildtheearth.modules.stats.model.StatsPlayer; -import net.buildtheearth.modules.stats.model.StatsServer; -import net.buildtheearth.utils.WikiLinks; +import net.buildtheearth.buildteamtools.BuildTeamTools; +import net.buildtheearth.buildteamtools.modules.Module; +import net.buildtheearth.buildteamtools.modules.network.NetworkModule; +import net.buildtheearth.buildteamtools.modules.stats.listeners.StatsListener; +import net.buildtheearth.buildteamtools.modules.stats.model.StatsPlayer; +import net.buildtheearth.buildteamtools.modules.stats.model.StatsServer; +import net.buildtheearth.buildteamtools.utils.WikiLinks; import org.bukkit.Bukkit; import org.bukkit.entity.Player; import org.json.JSONArray; diff --git a/src/main/java/net/buildtheearth/modules/stats/listeners/StatsListener.java b/src/main/java/net/buildtheearth/buildteamtools/modules/stats/listeners/StatsListener.java similarity index 89% rename from src/main/java/net/buildtheearth/modules/stats/listeners/StatsListener.java rename to src/main/java/net/buildtheearth/buildteamtools/modules/stats/listeners/StatsListener.java index dce7ad88..4f6ad9f1 100644 --- a/src/main/java/net/buildtheearth/modules/stats/listeners/StatsListener.java +++ b/src/main/java/net/buildtheearth/buildteamtools/modules/stats/listeners/StatsListener.java @@ -1,8 +1,8 @@ -package net.buildtheearth.modules.stats.listeners; +package net.buildtheearth.buildteamtools.modules.stats.listeners; -import net.buildtheearth.modules.stats.StatsModule; -import net.buildtheearth.modules.stats.model.StatsPlayerType; -import net.buildtheearth.modules.stats.model.StatsServerType; +import net.buildtheearth.buildteamtools.modules.stats.StatsModule; +import net.buildtheearth.buildteamtools.modules.stats.model.StatsPlayerType; +import net.buildtheearth.buildteamtools.modules.stats.model.StatsServerType; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; diff --git a/src/main/java/net/buildtheearth/modules/stats/menu/StatsMenu.java b/src/main/java/net/buildtheearth/buildteamtools/modules/stats/menu/StatsMenu.java similarity index 88% rename from src/main/java/net/buildtheearth/modules/stats/menu/StatsMenu.java rename to src/main/java/net/buildtheearth/buildteamtools/modules/stats/menu/StatsMenu.java index 7e18e47f..60a778fa 100644 --- a/src/main/java/net/buildtheearth/modules/stats/menu/StatsMenu.java +++ b/src/main/java/net/buildtheearth/buildteamtools/modules/stats/menu/StatsMenu.java @@ -1,14 +1,14 @@ -package net.buildtheearth.modules.stats.menu; +package net.buildtheearth.buildteamtools.modules.stats.menu; import com.alpsbte.alpslib.utils.item.Item; import com.cryptomorin.xseries.XMaterial; -import net.buildtheearth.modules.stats.StatsModule; -import net.buildtheearth.modules.stats.model.StatsPlayer; -import net.buildtheearth.modules.stats.model.StatsServer; -import net.buildtheearth.utils.CustomHeads; -import net.buildtheearth.utils.ListUtil; -import net.buildtheearth.utils.MenuItems; -import net.buildtheearth.utils.menus.AbstractMenu; +import net.buildtheearth.buildteamtools.modules.stats.StatsModule; +import net.buildtheearth.buildteamtools.modules.stats.model.StatsPlayer; +import net.buildtheearth.buildteamtools.modules.stats.model.StatsServer; +import net.buildtheearth.buildteamtools.utils.CustomHeads; +import net.buildtheearth.buildteamtools.utils.ListUtil; +import net.buildtheearth.buildteamtools.utils.MenuItems; +import net.buildtheearth.buildteamtools.utils.menus.AbstractMenu; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; import org.ipvp.canvas.mask.BinaryMask; diff --git a/src/main/java/net/buildtheearth/modules/stats/model/StatsPlayer.java b/src/main/java/net/buildtheearth/buildteamtools/modules/stats/model/StatsPlayer.java similarity index 93% rename from src/main/java/net/buildtheearth/modules/stats/model/StatsPlayer.java rename to src/main/java/net/buildtheearth/buildteamtools/modules/stats/model/StatsPlayer.java index f2a79004..99bd57f5 100644 --- a/src/main/java/net/buildtheearth/modules/stats/model/StatsPlayer.java +++ b/src/main/java/net/buildtheearth/buildteamtools/modules/stats/model/StatsPlayer.java @@ -1,6 +1,6 @@ -package net.buildtheearth.modules.stats.model; +package net.buildtheearth.buildteamtools.modules.stats.model; -import net.buildtheearth.modules.stats.StatsModule; +import net.buildtheearth.buildteamtools.modules.stats.StatsModule; import org.json.simple.JSONObject; import java.util.HashMap; diff --git a/src/main/java/net/buildtheearth/modules/stats/model/StatsPlayerType.java b/src/main/java/net/buildtheearth/buildteamtools/modules/stats/model/StatsPlayerType.java similarity index 70% rename from src/main/java/net/buildtheearth/modules/stats/model/StatsPlayerType.java rename to src/main/java/net/buildtheearth/buildteamtools/modules/stats/model/StatsPlayerType.java index 23dc6313..61f63a77 100644 --- a/src/main/java/net/buildtheearth/modules/stats/model/StatsPlayerType.java +++ b/src/main/java/net/buildtheearth/buildteamtools/modules/stats/model/StatsPlayerType.java @@ -1,4 +1,4 @@ -package net.buildtheearth.modules.stats.model; +package net.buildtheearth.buildteamtools.modules.stats.model; public enum StatsPlayerType { PLAYTIME, diff --git a/src/main/java/net/buildtheearth/modules/stats/model/StatsServer.java b/src/main/java/net/buildtheearth/buildteamtools/modules/stats/model/StatsServer.java similarity index 92% rename from src/main/java/net/buildtheearth/modules/stats/model/StatsServer.java rename to src/main/java/net/buildtheearth/buildteamtools/modules/stats/model/StatsServer.java index ba53c4c0..d8b9052c 100644 --- a/src/main/java/net/buildtheearth/modules/stats/model/StatsServer.java +++ b/src/main/java/net/buildtheearth/buildteamtools/modules/stats/model/StatsServer.java @@ -1,6 +1,6 @@ -package net.buildtheearth.modules.stats.model; +package net.buildtheearth.buildteamtools.modules.stats.model; -import net.buildtheearth.modules.stats.StatsModule; +import net.buildtheearth.buildteamtools.modules.stats.StatsModule; import org.json.simple.JSONObject; import java.util.HashMap; diff --git a/src/main/java/net/buildtheearth/modules/stats/model/StatsServerType.java b/src/main/java/net/buildtheearth/buildteamtools/modules/stats/model/StatsServerType.java similarity index 72% rename from src/main/java/net/buildtheearth/modules/stats/model/StatsServerType.java rename to src/main/java/net/buildtheearth/buildteamtools/modules/stats/model/StatsServerType.java index cbcfcf5f..460c9a16 100644 --- a/src/main/java/net/buildtheearth/modules/stats/model/StatsServerType.java +++ b/src/main/java/net/buildtheearth/buildteamtools/modules/stats/model/StatsServerType.java @@ -1,4 +1,4 @@ -package net.buildtheearth.modules.stats.model; +package net.buildtheearth.buildteamtools.modules.stats.model; public enum StatsServerType { UPTIME, diff --git a/src/main/java/net/buildtheearth/utils/BlockLocation.java b/src/main/java/net/buildtheearth/buildteamtools/utils/BlockLocation.java similarity index 93% rename from src/main/java/net/buildtheearth/utils/BlockLocation.java rename to src/main/java/net/buildtheearth/buildteamtools/utils/BlockLocation.java index 46a42657..909b2305 100644 --- a/src/main/java/net/buildtheearth/utils/BlockLocation.java +++ b/src/main/java/net/buildtheearth/buildteamtools/utils/BlockLocation.java @@ -1,4 +1,4 @@ -package net.buildtheearth.utils; +package net.buildtheearth.buildteamtools.utils; import org.bukkit.Location; import org.bukkit.World; diff --git a/src/main/java/net/buildtheearth/utils/Config.java b/src/main/java/net/buildtheearth/buildteamtools/utils/Config.java similarity index 97% rename from src/main/java/net/buildtheearth/utils/Config.java rename to src/main/java/net/buildtheearth/buildteamtools/utils/Config.java index 26d200c0..68963917 100644 --- a/src/main/java/net/buildtheearth/utils/Config.java +++ b/src/main/java/net/buildtheearth/buildteamtools/utils/Config.java @@ -1,6 +1,6 @@ -package net.buildtheearth.utils; +package net.buildtheearth.buildteamtools.utils; -import net.buildtheearth.BuildTeamTools; +import net.buildtheearth.buildteamtools.BuildTeamTools; import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.World; diff --git a/src/main/java/net/buildtheearth/utils/CustomHeads.java b/src/main/java/net/buildtheearth/buildteamtools/utils/CustomHeads.java similarity index 99% rename from src/main/java/net/buildtheearth/utils/CustomHeads.java rename to src/main/java/net/buildtheearth/buildteamtools/utils/CustomHeads.java index f29317d1..c56c9076 100644 --- a/src/main/java/net/buildtheearth/utils/CustomHeads.java +++ b/src/main/java/net/buildtheearth/buildteamtools/utils/CustomHeads.java @@ -1,4 +1,4 @@ -package net.buildtheearth.utils; +package net.buildtheearth.buildteamtools.utils; import com.alpsbte.alpslib.utils.item.Item; import org.bukkit.inventory.ItemStack; diff --git a/src/main/java/net/buildtheearth/utils/GeometricUtils.java b/src/main/java/net/buildtheearth/buildteamtools/utils/GeometricUtils.java similarity index 92% rename from src/main/java/net/buildtheearth/utils/GeometricUtils.java rename to src/main/java/net/buildtheearth/buildteamtools/utils/GeometricUtils.java index ae19fd20..ee2e3c48 100644 --- a/src/main/java/net/buildtheearth/utils/GeometricUtils.java +++ b/src/main/java/net/buildtheearth/buildteamtools/utils/GeometricUtils.java @@ -1,8 +1,8 @@ -package net.buildtheearth.utils; +package net.buildtheearth.buildteamtools.utils; -import net.buildtheearth.BuildTeamTools; -import net.buildtheearth.utils.geo.CoordinateConversion; -import net.buildtheearth.utils.io.ConfigPaths; +import net.buildtheearth.buildteamtools.BuildTeamTools; +import net.buildtheearth.buildteamtools.utils.geo.CoordinateConversion; +import net.buildtheearth.buildteamtools.utils.io.ConfigPaths; import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.World; diff --git a/src/main/java/net/buildtheearth/utils/JsonUtils.java b/src/main/java/net/buildtheearth/buildteamtools/utils/JsonUtils.java similarity index 95% rename from src/main/java/net/buildtheearth/utils/JsonUtils.java rename to src/main/java/net/buildtheearth/buildteamtools/utils/JsonUtils.java index fc800e99..b9dff456 100644 --- a/src/main/java/net/buildtheearth/utils/JsonUtils.java +++ b/src/main/java/net/buildtheearth/buildteamtools/utils/JsonUtils.java @@ -18,13 +18,9 @@ * */ -package net.buildtheearth.utils; +package net.buildtheearth.buildteamtools.utils; -import com.google.gson.JsonElement; -import com.google.gson.JsonIOException; -import com.google.gson.JsonObject; -import com.google.gson.JsonParseException; -import com.google.gson.JsonSyntaxException; +import com.google.gson.*; import com.google.gson.internal.Streams; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonToken; diff --git a/src/main/java/net/buildtheearth/utils/LineRasterization.java b/src/main/java/net/buildtheearth/buildteamtools/utils/LineRasterization.java similarity index 97% rename from src/main/java/net/buildtheearth/utils/LineRasterization.java rename to src/main/java/net/buildtheearth/buildteamtools/utils/LineRasterization.java index 40fa6f80..d8d0432e 100644 --- a/src/main/java/net/buildtheearth/utils/LineRasterization.java +++ b/src/main/java/net/buildtheearth/buildteamtools/utils/LineRasterization.java @@ -1,9 +1,9 @@ -package net.buildtheearth.utils; +package net.buildtheearth.buildteamtools.utils; import org.bukkit.Location; -import java.util.List; import java.util.ArrayList; +import java.util.List; public class LineRasterization { diff --git a/src/main/java/net/buildtheearth/utils/ListUtil.java b/src/main/java/net/buildtheearth/buildteamtools/utils/ListUtil.java similarity index 87% rename from src/main/java/net/buildtheearth/utils/ListUtil.java rename to src/main/java/net/buildtheearth/buildteamtools/utils/ListUtil.java index cb832636..fff5eac6 100644 --- a/src/main/java/net/buildtheearth/utils/ListUtil.java +++ b/src/main/java/net/buildtheearth/buildteamtools/utils/ListUtil.java @@ -1,4 +1,4 @@ -package net.buildtheearth.utils; +package net.buildtheearth.buildteamtools.utils; import java.util.ArrayList; diff --git a/src/main/java/net/buildtheearth/utils/MathUtils.java b/src/main/java/net/buildtheearth/buildteamtools/utils/MathUtils.java similarity index 98% rename from src/main/java/net/buildtheearth/utils/MathUtils.java rename to src/main/java/net/buildtheearth/buildteamtools/utils/MathUtils.java index 4d112945..85ab6bd1 100644 --- a/src/main/java/net/buildtheearth/utils/MathUtils.java +++ b/src/main/java/net/buildtheearth/buildteamtools/utils/MathUtils.java @@ -1,4 +1,4 @@ -package net.buildtheearth.utils; +package net.buildtheearth.buildteamtools.utils; public class MathUtils { /** diff --git a/src/main/java/net/buildtheearth/utils/MenuItems.java b/src/main/java/net/buildtheearth/buildteamtools/utils/MenuItems.java similarity index 99% rename from src/main/java/net/buildtheearth/utils/MenuItems.java rename to src/main/java/net/buildtheearth/buildteamtools/utils/MenuItems.java index 8ab36efd..4f9ddba3 100644 --- a/src/main/java/net/buildtheearth/utils/MenuItems.java +++ b/src/main/java/net/buildtheearth/buildteamtools/utils/MenuItems.java @@ -1,4 +1,4 @@ -package net.buildtheearth.utils; +package net.buildtheearth.buildteamtools.utils; import com.alpsbte.alpslib.utils.item.Item; import com.cryptomorin.xseries.XMaterial; diff --git a/src/main/java/net/buildtheearth/utils/PolygonTools.java b/src/main/java/net/buildtheearth/buildteamtools/utils/PolygonTools.java similarity index 95% rename from src/main/java/net/buildtheearth/utils/PolygonTools.java rename to src/main/java/net/buildtheearth/buildteamtools/utils/PolygonTools.java index d768faf0..24bbd70b 100644 --- a/src/main/java/net/buildtheearth/utils/PolygonTools.java +++ b/src/main/java/net/buildtheearth/buildteamtools/utils/PolygonTools.java @@ -1,8 +1,7 @@ -package net.buildtheearth.utils; +package net.buildtheearth.buildteamtools.utils; import org.bukkit.Location; - import java.util.ArrayList; import java.util.List; diff --git a/src/main/java/net/buildtheearth/utils/Utils.java b/src/main/java/net/buildtheearth/buildteamtools/utils/Utils.java similarity index 98% rename from src/main/java/net/buildtheearth/utils/Utils.java rename to src/main/java/net/buildtheearth/buildteamtools/utils/Utils.java index d1446a9d..6780d572 100644 --- a/src/main/java/net/buildtheearth/utils/Utils.java +++ b/src/main/java/net/buildtheearth/buildteamtools/utils/Utils.java @@ -1,4 +1,4 @@ -package net.buildtheearth.utils; +package net.buildtheearth.buildteamtools.utils; import java.util.ArrayList; import java.util.List; diff --git a/src/main/java/net/buildtheearth/utils/WikiLinks.java b/src/main/java/net/buildtheearth/buildteamtools/utils/WikiLinks.java similarity index 97% rename from src/main/java/net/buildtheearth/utils/WikiLinks.java rename to src/main/java/net/buildtheearth/buildteamtools/utils/WikiLinks.java index dc6a83a3..efa27b07 100644 --- a/src/main/java/net/buildtheearth/utils/WikiLinks.java +++ b/src/main/java/net/buildtheearth/buildteamtools/utils/WikiLinks.java @@ -1,4 +1,4 @@ -package net.buildtheearth.utils; +package net.buildtheearth.buildteamtools.utils; import lombok.experimental.UtilityClass; diff --git a/src/main/java/net/buildtheearth/utils/geo/CoordinateConversion.java b/src/main/java/net/buildtheearth/buildteamtools/utils/geo/CoordinateConversion.java similarity index 92% rename from src/main/java/net/buildtheearth/utils/geo/CoordinateConversion.java rename to src/main/java/net/buildtheearth/buildteamtools/utils/geo/CoordinateConversion.java index 52b35bdd..c725b53e 100644 --- a/src/main/java/net/buildtheearth/utils/geo/CoordinateConversion.java +++ b/src/main/java/net/buildtheearth/buildteamtools/utils/geo/CoordinateConversion.java @@ -22,12 +22,12 @@ * SOFTWARE. */ -package net.buildtheearth.utils.geo; +package net.buildtheearth.buildteamtools.utils.geo; -import net.buildtheearth.utils.geo.projection.GeographicProjection; -import net.buildtheearth.utils.geo.projection.OffsetProjectionTransform; -import net.buildtheearth.utils.geo.projection.OutOfProjectionBoundsException; -import net.buildtheearth.utils.geo.projection.ScaleProjectionTransform; +import net.buildtheearth.buildteamtools.utils.geo.projection.GeographicProjection; +import net.buildtheearth.buildteamtools.utils.geo.projection.OffsetProjectionTransform; +import net.buildtheearth.buildteamtools.utils.geo.projection.OutOfProjectionBoundsException; +import net.buildtheearth.buildteamtools.utils.geo.projection.ScaleProjectionTransform; import java.text.DecimalFormat; import java.text.DecimalFormatSymbols; diff --git a/src/main/java/net/buildtheearth/utils/geo/projection/GeographicProjection.java b/src/main/java/net/buildtheearth/buildteamtools/utils/geo/projection/GeographicProjection.java similarity index 93% rename from src/main/java/net/buildtheearth/utils/geo/projection/GeographicProjection.java rename to src/main/java/net/buildtheearth/buildteamtools/utils/geo/projection/GeographicProjection.java index 04b8b61d..06ec5ce6 100644 --- a/src/main/java/net/buildtheearth/utils/geo/projection/GeographicProjection.java +++ b/src/main/java/net/buildtheearth/buildteamtools/utils/geo/projection/GeographicProjection.java @@ -1,9 +1,9 @@ -package net.buildtheearth.utils.geo.projection; +package net.buildtheearth.buildteamtools.utils.geo.projection; -import net.buildtheearth.utils.geo.projection.airocean.Airocean; -import net.buildtheearth.utils.geo.projection.airocean.ConformalEstimate; -import net.buildtheearth.utils.geo.projection.airocean.ModifiedAirocean; +import net.buildtheearth.buildteamtools.utils.geo.projection.airocean.Airocean; +import net.buildtheearth.buildteamtools.utils.geo.projection.airocean.ConformalEstimate; +import net.buildtheearth.buildteamtools.utils.geo.projection.airocean.ModifiedAirocean; import java.util.HashMap; import java.util.Map; diff --git a/src/main/java/net/buildtheearth/utils/geo/projection/InvertableVectorField.java b/src/main/java/net/buildtheearth/buildteamtools/utils/geo/projection/InvertableVectorField.java similarity index 96% rename from src/main/java/net/buildtheearth/utils/geo/projection/InvertableVectorField.java rename to src/main/java/net/buildtheearth/buildteamtools/utils/geo/projection/InvertableVectorField.java index 19923822..caf88399 100644 --- a/src/main/java/net/buildtheearth/utils/geo/projection/InvertableVectorField.java +++ b/src/main/java/net/buildtheearth/buildteamtools/utils/geo/projection/InvertableVectorField.java @@ -1,7 +1,7 @@ -package net.buildtheearth.utils.geo.projection; +package net.buildtheearth.buildteamtools.utils.geo.projection; -import net.buildtheearth.utils.MathUtils; +import net.buildtheearth.buildteamtools.utils.MathUtils; public class InvertableVectorField { diff --git a/src/main/java/net/buildtheearth/utils/geo/projection/OffsetProjectionTransform.java b/src/main/java/net/buildtheearth/buildteamtools/utils/geo/projection/OffsetProjectionTransform.java similarity index 95% rename from src/main/java/net/buildtheearth/utils/geo/projection/OffsetProjectionTransform.java rename to src/main/java/net/buildtheearth/buildteamtools/utils/geo/projection/OffsetProjectionTransform.java index 92d09bd4..28ac4d19 100644 --- a/src/main/java/net/buildtheearth/utils/geo/projection/OffsetProjectionTransform.java +++ b/src/main/java/net/buildtheearth/buildteamtools/utils/geo/projection/OffsetProjectionTransform.java @@ -1,4 +1,4 @@ -package net.buildtheearth.utils.geo.projection; +package net.buildtheearth.buildteamtools.utils.geo.projection; import com.google.common.base.Preconditions; diff --git a/src/main/java/net/buildtheearth/utils/geo/projection/OutOfProjectionBoundsException.java b/src/main/java/net/buildtheearth/buildteamtools/utils/geo/projection/OutOfProjectionBoundsException.java similarity index 90% rename from src/main/java/net/buildtheearth/utils/geo/projection/OutOfProjectionBoundsException.java rename to src/main/java/net/buildtheearth/buildteamtools/utils/geo/projection/OutOfProjectionBoundsException.java index 93c45e2e..fc5e8ef9 100644 --- a/src/main/java/net/buildtheearth/utils/geo/projection/OutOfProjectionBoundsException.java +++ b/src/main/java/net/buildtheearth/buildteamtools/utils/geo/projection/OutOfProjectionBoundsException.java @@ -1,4 +1,4 @@ -package net.buildtheearth.utils.geo.projection; +package net.buildtheearth.buildteamtools.utils.geo.projection; public final class OutOfProjectionBoundsException extends Exception { private static final OutOfProjectionBoundsException INSTANCE = new OutOfProjectionBoundsException(false); diff --git a/src/main/java/net/buildtheearth/utils/geo/projection/ProjectionTransform.java b/src/main/java/net/buildtheearth/buildteamtools/utils/geo/projection/ProjectionTransform.java similarity index 89% rename from src/main/java/net/buildtheearth/utils/geo/projection/ProjectionTransform.java rename to src/main/java/net/buildtheearth/buildteamtools/utils/geo/projection/ProjectionTransform.java index 95e07a9b..9a1dd0aa 100644 --- a/src/main/java/net/buildtheearth/utils/geo/projection/ProjectionTransform.java +++ b/src/main/java/net/buildtheearth/buildteamtools/utils/geo/projection/ProjectionTransform.java @@ -1,4 +1,4 @@ -package net.buildtheearth.utils.geo.projection; +package net.buildtheearth.buildteamtools.utils.geo.projection; public abstract class ProjectionTransform extends GeographicProjection { protected final GeographicProjection input; diff --git a/src/main/java/net/buildtheearth/utils/geo/projection/ScaleProjectionTransform.java b/src/main/java/net/buildtheearth/buildteamtools/utils/geo/projection/ScaleProjectionTransform.java similarity index 96% rename from src/main/java/net/buildtheearth/utils/geo/projection/ScaleProjectionTransform.java rename to src/main/java/net/buildtheearth/buildteamtools/utils/geo/projection/ScaleProjectionTransform.java index ab108a2d..50ca09b6 100644 --- a/src/main/java/net/buildtheearth/utils/geo/projection/ScaleProjectionTransform.java +++ b/src/main/java/net/buildtheearth/buildteamtools/utils/geo/projection/ScaleProjectionTransform.java @@ -1,4 +1,4 @@ -package net.buildtheearth.utils.geo.projection; +package net.buildtheearth.buildteamtools.utils.geo.projection; import com.google.common.base.Preconditions; diff --git a/src/main/java/net/buildtheearth/utils/geo/projection/UprightOrientationProjectionTransform.java b/src/main/java/net/buildtheearth/buildteamtools/utils/geo/projection/UprightOrientationProjectionTransform.java similarity index 93% rename from src/main/java/net/buildtheearth/utils/geo/projection/UprightOrientationProjectionTransform.java rename to src/main/java/net/buildtheearth/buildteamtools/utils/geo/projection/UprightOrientationProjectionTransform.java index 856500f1..05701260 100644 --- a/src/main/java/net/buildtheearth/utils/geo/projection/UprightOrientationProjectionTransform.java +++ b/src/main/java/net/buildtheearth/buildteamtools/utils/geo/projection/UprightOrientationProjectionTransform.java @@ -1,4 +1,4 @@ -package net.buildtheearth.utils.geo.projection; +package net.buildtheearth.buildteamtools.utils.geo.projection; /** * Mirrors the warped projection vertically. diff --git a/src/main/java/net/buildtheearth/utils/geo/projection/airocean/Airocean.java b/src/main/java/net/buildtheearth/buildteamtools/utils/geo/projection/airocean/Airocean.java similarity index 97% rename from src/main/java/net/buildtheearth/utils/geo/projection/airocean/Airocean.java rename to src/main/java/net/buildtheearth/buildteamtools/utils/geo/projection/airocean/Airocean.java index 19defd96..a8e636da 100644 --- a/src/main/java/net/buildtheearth/utils/geo/projection/airocean/Airocean.java +++ b/src/main/java/net/buildtheearth/buildteamtools/utils/geo/projection/airocean/Airocean.java @@ -1,8 +1,8 @@ -package net.buildtheearth.utils.geo.projection.airocean; +package net.buildtheearth.buildteamtools.utils.geo.projection.airocean; -import net.buildtheearth.utils.MathUtils; -import net.buildtheearth.utils.geo.projection.GeographicProjection; -import net.buildtheearth.utils.geo.projection.OutOfProjectionBoundsException; +import net.buildtheearth.buildteamtools.utils.MathUtils; +import net.buildtheearth.buildteamtools.utils.geo.projection.GeographicProjection; +import net.buildtheearth.buildteamtools.utils.geo.projection.OutOfProjectionBoundsException; /** * Implementation of the Dynmaxion projection. diff --git a/src/main/java/net/buildtheearth/utils/geo/projection/airocean/ConformalEstimate.java b/src/main/java/net/buildtheearth/buildteamtools/utils/geo/projection/airocean/ConformalEstimate.java similarity index 93% rename from src/main/java/net/buildtheearth/utils/geo/projection/airocean/ConformalEstimate.java rename to src/main/java/net/buildtheearth/buildteamtools/utils/geo/projection/airocean/ConformalEstimate.java index 57715f45..b868ad55 100644 --- a/src/main/java/net/buildtheearth/utils/geo/projection/airocean/ConformalEstimate.java +++ b/src/main/java/net/buildtheearth/buildteamtools/utils/geo/projection/airocean/ConformalEstimate.java @@ -1,7 +1,7 @@ -package net.buildtheearth.utils.geo.projection.airocean; +package net.buildtheearth.buildteamtools.utils.geo.projection.airocean; -import net.buildtheearth.utils.MathUtils; -import net.buildtheearth.utils.geo.projection.InvertableVectorField; +import net.buildtheearth.buildteamtools.utils.MathUtils; +import net.buildtheearth.buildteamtools.utils.geo.projection.InvertableVectorField; import java.io.IOException; import java.io.InputStream; diff --git a/src/main/java/net/buildtheearth/utils/geo/projection/airocean/ModifiedAirocean.java b/src/main/java/net/buildtheearth/buildteamtools/utils/geo/projection/airocean/ModifiedAirocean.java similarity index 94% rename from src/main/java/net/buildtheearth/utils/geo/projection/airocean/ModifiedAirocean.java rename to src/main/java/net/buildtheearth/buildteamtools/utils/geo/projection/airocean/ModifiedAirocean.java index 3e84fb75..0f224892 100644 --- a/src/main/java/net/buildtheearth/utils/geo/projection/airocean/ModifiedAirocean.java +++ b/src/main/java/net/buildtheearth/buildteamtools/utils/geo/projection/airocean/ModifiedAirocean.java @@ -1,8 +1,8 @@ -package net.buildtheearth.utils.geo.projection.airocean; +package net.buildtheearth.buildteamtools.utils.geo.projection.airocean; -import net.buildtheearth.utils.MathUtils; -import net.buildtheearth.utils.geo.projection.OutOfProjectionBoundsException; +import net.buildtheearth.buildteamtools.utils.MathUtils; +import net.buildtheearth.buildteamtools.utils.geo.projection.OutOfProjectionBoundsException; /** * Implementation of the BTE modified Dynmaxion projection. diff --git a/src/main/java/net/buildtheearth/utils/io/ConfigPaths.java b/src/main/java/net/buildtheearth/buildteamtools/utils/io/ConfigPaths.java similarity index 98% rename from src/main/java/net/buildtheearth/utils/io/ConfigPaths.java rename to src/main/java/net/buildtheearth/buildteamtools/utils/io/ConfigPaths.java index e8831afa..9258c538 100644 --- a/src/main/java/net/buildtheearth/utils/io/ConfigPaths.java +++ b/src/main/java/net/buildtheearth/buildteamtools/utils/io/ConfigPaths.java @@ -1,4 +1,4 @@ -package net.buildtheearth.utils.io; +package net.buildtheearth.buildteamtools.utils.io; public abstract class ConfigPaths { diff --git a/src/main/java/net/buildtheearth/utils/io/ConfigUtil.java b/src/main/java/net/buildtheearth/buildteamtools/utils/io/ConfigUtil.java similarity index 97% rename from src/main/java/net/buildtheearth/utils/io/ConfigUtil.java rename to src/main/java/net/buildtheearth/buildteamtools/utils/io/ConfigUtil.java index b043f629..e7b20228 100644 --- a/src/main/java/net/buildtheearth/utils/io/ConfigUtil.java +++ b/src/main/java/net/buildtheearth/buildteamtools/utils/io/ConfigUtil.java @@ -22,7 +22,7 @@ * SOFTWARE. */ -package net.buildtheearth.utils.io; +package net.buildtheearth.buildteamtools.utils.io; import com.alpsbte.alpslib.io.config.ConfigNotImplementedException; import com.alpsbte.alpslib.io.config.ConfigurationUtil; diff --git a/src/main/java/net/buildtheearth/utils/io/Constants.java b/src/main/java/net/buildtheearth/buildteamtools/utils/io/Constants.java similarity index 89% rename from src/main/java/net/buildtheearth/utils/io/Constants.java rename to src/main/java/net/buildtheearth/buildteamtools/utils/io/Constants.java index 463e3b33..a1e85fa2 100644 --- a/src/main/java/net/buildtheearth/utils/io/Constants.java +++ b/src/main/java/net/buildtheearth/buildteamtools/utils/io/Constants.java @@ -1,4 +1,4 @@ -package net.buildtheearth.utils.io; +package net.buildtheearth.buildteamtools.utils.io; public class Constants { diff --git a/src/main/java/net/buildtheearth/utils/io/Errors.java b/src/main/java/net/buildtheearth/buildteamtools/utils/io/Errors.java similarity index 92% rename from src/main/java/net/buildtheearth/utils/io/Errors.java rename to src/main/java/net/buildtheearth/buildteamtools/utils/io/Errors.java index ba5fcb12..823f0e9d 100644 --- a/src/main/java/net/buildtheearth/utils/io/Errors.java +++ b/src/main/java/net/buildtheearth/buildteamtools/utils/io/Errors.java @@ -1,4 +1,4 @@ -package net.buildtheearth.utils.io; +package net.buildtheearth.buildteamtools.utils.io; public class Errors { diff --git a/src/main/java/net/buildtheearth/utils/io/LangPaths.java b/src/main/java/net/buildtheearth/buildteamtools/utils/io/LangPaths.java similarity index 96% rename from src/main/java/net/buildtheearth/utils/io/LangPaths.java rename to src/main/java/net/buildtheearth/buildteamtools/utils/io/LangPaths.java index d10ac862..91ba9860 100644 --- a/src/main/java/net/buildtheearth/utils/io/LangPaths.java +++ b/src/main/java/net/buildtheearth/buildteamtools/utils/io/LangPaths.java @@ -22,7 +22,7 @@ * SOFTWARE. */ -package net.buildtheearth.utils.io; +package net.buildtheearth.buildteamtools.utils.io; public abstract class LangPaths { private static final String LANG = "lang."; diff --git a/src/main/java/net/buildtheearth/utils/io/LangUtil.java b/src/main/java/net/buildtheearth/buildteamtools/utils/io/LangUtil.java similarity index 97% rename from src/main/java/net/buildtheearth/utils/io/LangUtil.java rename to src/main/java/net/buildtheearth/buildteamtools/utils/io/LangUtil.java index c94657d0..a7a66d50 100644 --- a/src/main/java/net/buildtheearth/utils/io/LangUtil.java +++ b/src/main/java/net/buildtheearth/buildteamtools/utils/io/LangUtil.java @@ -22,7 +22,7 @@ * SOFTWARE. */ -package net.buildtheearth.utils.io; +package net.buildtheearth.buildteamtools.utils.io; import com.alpsbte.alpslib.io.lang.LanguageUtil; diff --git a/src/main/java/net/buildtheearth/utils/menus/AbstractMenu.java b/src/main/java/net/buildtheearth/buildteamtools/utils/menus/AbstractMenu.java similarity index 97% rename from src/main/java/net/buildtheearth/utils/menus/AbstractMenu.java rename to src/main/java/net/buildtheearth/buildteamtools/utils/menus/AbstractMenu.java index 8b26a7bf..94d30121 100644 --- a/src/main/java/net/buildtheearth/utils/menus/AbstractMenu.java +++ b/src/main/java/net/buildtheearth/buildteamtools/utils/menus/AbstractMenu.java @@ -1,9 +1,9 @@ -package net.buildtheearth.utils.menus; +package net.buildtheearth.buildteamtools.utils.menus; import com.alpsbte.alpslib.utils.item.Item; import com.cryptomorin.xseries.XMaterial; -import net.buildtheearth.BuildTeamTools; -import net.buildtheearth.utils.CustomHeads; +import net.buildtheearth.buildteamtools.BuildTeamTools; +import net.buildtheearth.buildteamtools.utils.CustomHeads; import net.kyori.adventure.text.Component; import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer; import org.bukkit.Bukkit; diff --git a/src/main/java/net/buildtheearth/utils/menus/AbstractPaginatedMenu.java b/src/main/java/net/buildtheearth/buildteamtools/utils/menus/AbstractPaginatedMenu.java similarity index 96% rename from src/main/java/net/buildtheearth/utils/menus/AbstractPaginatedMenu.java rename to src/main/java/net/buildtheearth/buildteamtools/utils/menus/AbstractPaginatedMenu.java index fe022cf9..b6eb6ae1 100644 --- a/src/main/java/net/buildtheearth/utils/menus/AbstractPaginatedMenu.java +++ b/src/main/java/net/buildtheearth/buildteamtools/utils/menus/AbstractPaginatedMenu.java @@ -1,7 +1,7 @@ -package net.buildtheearth.utils.menus; +package net.buildtheearth.buildteamtools.utils.menus; -import net.buildtheearth.BuildTeamTools; -import net.buildtheearth.utils.CustomHeads; +import net.buildtheearth.buildteamtools.BuildTeamTools; +import net.buildtheearth.buildteamtools.utils.CustomHeads; import org.bukkit.Bukkit; import org.bukkit.Sound; import org.bukkit.entity.Player; diff --git a/src/main/java/net/buildtheearth/utils/menus/BlockListMenu.java b/src/main/java/net/buildtheearth/buildteamtools/utils/menus/BlockListMenu.java similarity index 96% rename from src/main/java/net/buildtheearth/utils/menus/BlockListMenu.java rename to src/main/java/net/buildtheearth/buildteamtools/utils/menus/BlockListMenu.java index 1f07498c..5aee3e70 100644 --- a/src/main/java/net/buildtheearth/utils/menus/BlockListMenu.java +++ b/src/main/java/net/buildtheearth/buildteamtools/utils/menus/BlockListMenu.java @@ -1,8 +1,8 @@ -package net.buildtheearth.utils.menus; +package net.buildtheearth.buildteamtools.utils.menus; import com.alpsbte.alpslib.utils.item.Item; -import net.buildtheearth.utils.CustomHeads; -import net.buildtheearth.utils.MenuItems; +import net.buildtheearth.buildteamtools.utils.CustomHeads; +import net.buildtheearth.buildteamtools.utils.MenuItems; import org.bukkit.enchantments.Enchantment; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; diff --git a/src/main/java/net/buildtheearth/utils/menus/BookMenu.java b/src/main/java/net/buildtheearth/buildteamtools/utils/menus/BookMenu.java similarity index 97% rename from src/main/java/net/buildtheearth/utils/menus/BookMenu.java rename to src/main/java/net/buildtheearth/buildteamtools/utils/menus/BookMenu.java index 4595c2eb..20962aa4 100644 --- a/src/main/java/net/buildtheearth/utils/menus/BookMenu.java +++ b/src/main/java/net/buildtheearth/buildteamtools/utils/menus/BookMenu.java @@ -1,9 +1,9 @@ -package net.buildtheearth.utils.menus; +package net.buildtheearth.buildteamtools.utils.menus; import com.alpsbte.alpslib.utils.item.Item; import com.cryptomorin.xseries.XMaterial; -import net.buildtheearth.BuildTeamTools; -import net.buildtheearth.utils.MenuItems; +import net.buildtheearth.buildteamtools.BuildTeamTools; +import net.buildtheearth.buildteamtools.utils.MenuItems; import org.bukkit.Bukkit; import org.bukkit.Sound; import org.bukkit.entity.Player; diff --git a/src/main/java/net/buildtheearth/utils/menus/NameListMenu.java b/src/main/java/net/buildtheearth/buildteamtools/utils/menus/NameListMenu.java similarity index 96% rename from src/main/java/net/buildtheearth/utils/menus/NameListMenu.java rename to src/main/java/net/buildtheearth/buildteamtools/utils/menus/NameListMenu.java index 3a1f61c6..f22ee90f 100644 --- a/src/main/java/net/buildtheearth/utils/menus/NameListMenu.java +++ b/src/main/java/net/buildtheearth/buildteamtools/utils/menus/NameListMenu.java @@ -1,8 +1,8 @@ -package net.buildtheearth.utils.menus; +package net.buildtheearth.buildteamtools.utils.menus; import com.alpsbte.alpslib.utils.item.Item; -import net.buildtheearth.utils.CustomHeads; -import net.buildtheearth.utils.MenuItems; +import net.buildtheearth.buildteamtools.utils.CustomHeads; +import net.buildtheearth.buildteamtools.utils.MenuItems; import net.daporkchop.lib.common.misc.Tuple; import org.bukkit.enchantments.Enchantment; import org.bukkit.entity.Player; diff --git a/src/main/java/net/buildtheearth/utils/raycast/Raycast.java b/src/main/java/net/buildtheearth/buildteamtools/utils/raycast/Raycast.java similarity index 99% rename from src/main/java/net/buildtheearth/utils/raycast/Raycast.java rename to src/main/java/net/buildtheearth/buildteamtools/utils/raycast/Raycast.java index b400cef6..bd68a22c 100644 --- a/src/main/java/net/buildtheearth/utils/raycast/Raycast.java +++ b/src/main/java/net/buildtheearth/buildteamtools/utils/raycast/Raycast.java @@ -1,4 +1,4 @@ -package net.buildtheearth.utils.raycast; +package net.buildtheearth.buildteamtools.utils.raycast; import com.cryptomorin.xseries.XMaterial; import org.bukkit.Location; diff --git a/src/main/java/net/buildtheearth/utils/raycast/RaycastAPIMath.java b/src/main/java/net/buildtheearth/buildteamtools/utils/raycast/RaycastAPIMath.java similarity index 97% rename from src/main/java/net/buildtheearth/utils/raycast/RaycastAPIMath.java rename to src/main/java/net/buildtheearth/buildteamtools/utils/raycast/RaycastAPIMath.java index b60510b7..17f2c3a9 100644 --- a/src/main/java/net/buildtheearth/utils/raycast/RaycastAPIMath.java +++ b/src/main/java/net/buildtheearth/buildteamtools/utils/raycast/RaycastAPIMath.java @@ -1,4 +1,4 @@ -package net.buildtheearth.utils.raycast; +package net.buildtheearth.buildteamtools.utils.raycast; import org.bukkit.util.Vector; diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index ecf6ef75..b7984b01 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,5 +1,5 @@ name: BuildTeamTools -main: net.buildtheearth.BuildTeamTools +main: net.buildtheearth.buildteamtools.BuildTeamTools api-version: 1.13 version: ${version} description: ${description} From ed341fc90b0d071208425b69f2b79294611ce8e0 Mon Sep 17 00:00:00 2001 From: Zoriot Date: Tue, 13 Jan 2026 15:25:45 +0100 Subject: [PATCH 23/23] =?UTF-8?q?feat(build):=20=E2=9C=A8=20add=20GitHub?= =?UTF-8?q?=20Actions=20workflow=20for=20Java=20CI=20with=20Gradle?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build.yml | 45 +++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 00000000..7e87526e --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,45 @@ +# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-gradle + +name: Java CI with Gradle + +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + +jobs: + build: + + runs-on: ubuntu-latest + permissions: + contents: read + + steps: + - uses: actions/checkout@v5 + with: + fetch-depth: 0 # full history + fetch-tags: true # grab your tags + # Make sure we check out by branch name, not just SHA: + ref: ${{ github.event_name == 'pull_request' && github.head_ref || github.ref_name }} + + - name: Set up JDK 21 + uses: actions/setup-java@v5 + with: + java-version: '21' + distribution: 'temurin' + + # Configure Gradle for optimal use in GitHub Actions, including caching of downloaded dependencies. + # See: https://github.com/gradle/actions/blob/main/setup-gradle/README.md + - name: Setup Gradle + uses: gradle/actions/setup-gradle@v4 + + - name: Build with Gradle Wrapper + run: ./gradlew clean build + + - uses: actions/upload-artifact@v4 + with: + name: Staging-Build + path: build/libs + compression-level: '9'