Initial commit

This commit is contained in:
Paul Reilly 2023-03-08 00:42:58 -06:00
commit d4b46996c1
81 changed files with 1801 additions and 0 deletions

2
.gitattributes vendored Normal file
View File

@ -0,0 +1,2 @@
# Auto detect text files and perform LF normalization
* text=auto

24
.gitignore vendored Normal file
View File

@ -0,0 +1,24 @@
# Compiled class file
*.class
# Log file
*.log
# BlueJ files
*.ctxt
# Mobile Tools for Java (J2ME)
.mtj.tmp/
# Package Files #
*.jar
*.war
*.nar
*.ear
*.zip
*.tar.gz
*.rar
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
replay_pid*

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

Binary file not shown.

View File

@ -0,0 +1,2 @@
#Tue Mar 07 20:50:28 CST 2023
gradle.version=7.3.3

Binary file not shown.

BIN
.gradle/file-system.probe Normal file

Binary file not shown.

View File

3
.idea/.gitignore generated vendored Normal file
View File

@ -0,0 +1,3 @@
# Default ignored files
/shelf/
/workspace.xml

1
.idea/.name generated Normal file
View File

@ -0,0 +1 @@
TypeSelector

6
.idea/compiler.xml generated Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<bytecodeTargetLevel target="17" />
</component>
</project>

7
.idea/discord.xml generated Normal file
View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="DiscordProjectSettings">
<option name="show" value="PROJECT_FILES" />
<option name="description" value="" />
</component>
</project>

18
.idea/gradle.xml generated Normal file
View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GradleMigrationSettings" migrationVersion="1" />
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="distributionType" value="DEFAULT_WRAPPED" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="gradleHome" value="C:/Gradle/gradle-7.5.1" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />
</set>
</option>
</GradleProjectSettings>
</option>
</component>
</project>

View File

@ -0,0 +1,54 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="fcd36335-ac86-4bef-8d30-062d8aae0364_CryptoCipherInsecureAsymmetricCryptographicAlgorithm" enabled="true" level="SENSEI ERROR" enabled_by_default="true" />
<inspection_tool class="fcd36335-ac86-4bef-8d30-062d8aae0364_CryptoKeyAgreementGuideonApprovedCryptographicAlgorithm" enabled="true" level="SENSEI MARKED INFO" enabled_by_default="true" />
<inspection_tool class="fcd36335-ac86-4bef-8d30-062d8aae0364_CryptoKeyAgreementInsecureCryptographicAlgorithm" enabled="true" level="SENSEI ERROR" enabled_by_default="true" />
<inspection_tool class="fcd36335-ac86-4bef-8d30-062d8aae0364_CryptoKeyPairGenerationApprovedStandardCryptographicAlgorithm" enabled="true" level="SENSEI ERROR" enabled_by_default="true" />
<inspection_tool class="fcd36335-ac86-4bef-8d30-062d8aae0364_CryptoKeyPairGenerationInsecureCryptographicAlgorithm" enabled="true" level="SENSEI ERROR" enabled_by_default="true" />
<inspection_tool class="fcd36335-ac86-4bef-8d30-062d8aae0364_CryptoKeyPairGenerationNonStandardCryptographicAlgorithm" enabled="true" level="SENSEI ERROR" enabled_by_default="true" />
<inspection_tool class="fcd36335-ac86-4bef-8d30-062d8aae0364_CryptoSignatureApprovedHashingAlgorithm" enabled="true" level="SENSEI MARKED INFO" enabled_by_default="true" />
<inspection_tool class="fcd36335-ac86-4bef-8d30-062d8aae0364_CryptoSignatureInsecureHashingAlgorithm" enabled="true" level="SENSEI ERROR" enabled_by_default="true" />
<inspection_tool class="fcd36335-ac86-4bef-8d30-062d8aae0364_CryptoSignatureNonStandardHashingAlgorithm" enabled="true" level="SENSEI WARNING" enabled_by_default="true" />
<inspection_tool class="fcd36335-ac86-4bef-8d30-062d8aae0364_DataInjectionParameterizeLDAPFiltersDirContextsearch" enabled="true" level="SENSEI ERROR" enabled_by_default="true" />
<inspection_tool class="fcd36335-ac86-4bef-8d30-062d8aae0364_DataProtection-CryptographyAvoidbruteforcingUsesufficientlylongkeysizeskeyGenerator" enabled="true" level="SENSEI ERROR" enabled_by_default="true" />
<inspection_tool class="fcd36335-ac86-4bef-8d30-062d8aae0364_DataProtection-CryptographyAvoidcryptographicweaknessUseappropriatekeypairgenerationalgorithminsecure" enabled="true" level="SENSEI ERROR" enabled_by_default="true" />
<inspection_tool class="fcd36335-ac86-4bef-8d30-062d8aae0364_DataProtection-CryptographyAvoidcryptographicweaknessUseappropriatekeypairgenerationalgorithmnotrecommended" enabled="true" level="SENSEI ERROR" enabled_by_default="true" />
<inspection_tool class="fcd36335-ac86-4bef-8d30-062d8aae0364_DataProtection-CryptographyAvoidcryptographicweaknessUseappropriatesecretkeygenerationalgorithmDESfamily" enabled="true" level="SENSEI ERROR" enabled_by_default="true" />
<inspection_tool class="fcd36335-ac86-4bef-8d30-062d8aae0364_DataProtection-CryptographyAvoidcryptographicweaknessUseappropriatesecretkeygenerationalgorithmHmacfamily" enabled="true" level="SENSEI WARNING" enabled_by_default="true" />
<inspection_tool class="fcd36335-ac86-4bef-8d30-062d8aae0364_DataProtection-CryptographyAvoidcryptographicweaknessUseappropriatesecretkeygenerationalgorithmHmacfamily1" enabled="true" level="SENSEI WARNING" enabled_by_default="true" />
<inspection_tool class="fcd36335-ac86-4bef-8d30-062d8aae0364_DataProtection-CryptographyAvoidcryptographicweaknessUseappropriatesecretkeygenerationalgorithmOtheralgorithms" enabled="true" level="SENSEI MARKED INFO" enabled_by_default="true" />
<inspection_tool class="fcd36335-ac86-4bef-8d30-062d8aae0364_DataProtection-CryptographyAvoidcryptographicweaknessUseappropriatesecretkeygenerationalgorithminsecureSecretKeyFactory" enabled="true" level="SENSEI ERROR" enabled_by_default="true" />
<inspection_tool class="fcd36335-ac86-4bef-8d30-062d8aae0364_DataProtection-CryptographyAvoidcryptographicweaknessUseappropriatesecretkeygenerationalgorithmnotrecommendedSecretKeyFactory" enabled="true" level="SENSEI ERROR" enabled_by_default="true" />
<inspection_tool class="fcd36335-ac86-4bef-8d30-062d8aae0364_DataProtection-CryptographyAvoidcryptographicweaknessUseappropriatesecretkeygenerationalgorithmotherSecretKeyFactory" enabled="true" level="SENSEI ERROR" enabled_by_default="true" />
<inspection_tool class="fcd36335-ac86-4bef-8d30-062d8aae0364_DataProtection-CryptographyAvoidcryptographicweaknessUsestrongsymmetriccryptographicalgorithm" enabled="true" level="SENSEI ERROR" enabled_by_default="true" />
<inspection_tool class="fcd36335-ac86-4bef-8d30-062d8aae0364_DataProtection-CryptographyAvoidcryptographicweaknessUsesufficientlylongkeysizeskeyGeneratorbadvalue" enabled="true" level="SENSEI ERROR" enabled_by_default="true" />
<inspection_tool class="fcd36335-ac86-4bef-8d30-062d8aae0364_DataProtection-CryptographyAvoidcryptographicweaknessUsesufficientlylongkeysizeskeyPairGenerator" enabled="true" level="SENSEI ERROR" enabled_by_default="true" />
<inspection_tool class="fcd36335-ac86-4bef-8d30-062d8aae0364_DataProtection-CryptographyAvoidcryptographicweaknessUsesufficientlylongkeysizeskeyPairGeneratorbadvalue" enabled="true" level="SENSEI ERROR" enabled_by_default="true" />
<inspection_tool class="fcd36335-ac86-4bef-8d30-062d8aae0364_DataProtection-SecureDataStorageAvoiddataexposureUseCipherinsteadofNullCipher" enabled="true" level="SENSEI ERROR" enabled_by_default="true" />
<inspection_tool class="fcd36335-ac86-4bef-8d30-062d8aae0364_InjectionAvoidCodeInjectionUseSafeConstructor1stargumentoftypeConstructor" enabled="true" level="SENSEI ERROR" enabled_by_default="true" />
<inspection_tool class="fcd36335-ac86-4bef-8d30-062d8aae0364_InjectionAvoidCodeInjectionUseSafeConstructorargumentsbutnoConstructorargument" enabled="true" level="SENSEI ERROR" enabled_by_default="true" />
<inspection_tool class="fcd36335-ac86-4bef-8d30-062d8aae0364_InjectionAvoidCodeInjectionUseSafeConstructornoarguments" enabled="true" level="SENSEI ERROR" enabled_by_default="true" />
<inspection_tool class="fcd36335-ac86-4bef-8d30-062d8aae0364_InjectionAvoidSQLInjectionUseParameterizedQueriesPreparedStatement" enabled="true" level="SENSEI ERROR" enabled_by_default="true" />
<inspection_tool class="fcd36335-ac86-4bef-8d30-062d8aae0364_InjectionAvoidSQLInjectionUseParameterizedQueriesStatement" enabled="true" level="SENSEI ERROR" enabled_by_default="true" />
<inspection_tool class="fcd36335-ac86-4bef-8d30-062d8aae0364_InjectionAvoidXMLInjectionUsesetFeature" enabled="true" level="SENSEI ERROR" enabled_by_default="true" />
<inspection_tool class="fcd36335-ac86-4bef-8d30-062d8aae0364_InjectionAvoidXMLInjectionUsesetSchema" enabled="true" level="SENSEI ERROR" enabled_by_default="true" />
<inspection_tool class="fcd36335-ac86-4bef-8d30-062d8aae0364_InjectionAvoidXMLInjectionsetFeaturewithbadvalue" enabled="true" level="SENSEI ERROR" enabled_by_default="true" />
<inspection_tool class="fcd36335-ac86-4bef-8d30-062d8aae0364_InputValidationAvoidXXEDonotsetDocumentBuilderFactoryexternal-parameter-entitiestotrue" enabled="true" level="SENSEI ERROR" enabled_by_default="true" />
<inspection_tool class="fcd36335-ac86-4bef-8d30-062d8aae0364_InputValidationAvoidXXEDonotsetDocumentBuilderFactoryload-external-dtdtotrue" enabled="true" level="SENSEI ERROR" enabled_by_default="true" />
<inspection_tool class="fcd36335-ac86-4bef-8d30-062d8aae0364_InputValidationAvoidXXEDonotsetDocumentBuilderFactorysetExpandEntityReferencestotrue" enabled="true" level="SENSEI ERROR" enabled_by_default="true" />
<inspection_tool class="fcd36335-ac86-4bef-8d30-062d8aae0364_InputValidationAvoidXXEDonotsetDocumentBuilderFactorysetXIncludeAwaretotrue" enabled="true" level="SENSEI ERROR" enabled_by_default="true" />
<inspection_tool class="fcd36335-ac86-4bef-8d30-062d8aae0364_InputValidationAvoidXXEDonotsetXMLInputFactoryPropertytotrue" enabled="true" level="SENSEI ERROR" enabled_by_default="true" />
<inspection_tool class="fcd36335-ac86-4bef-8d30-062d8aae0364_PortabilityFlawAvoidlocaledependentcomparisonsequalsaftercaseconversion" enabled="true" level="SENSEI ERROR" enabled_by_default="true" />
<inspection_tool class="fcd36335-ac86-4bef-8d30-062d8aae0364_TLSWeakEncryptionInsecureVersion" enabled="true" level="SENSEI ERROR" enabled_by_default="true" />
<inspection_tool class="fcd36335-ac86-4bef-8d30-062d8aae0364_TLSWeakEncryptionOutdatedVersion" enabled="true" level="SENSEI WARNING" enabled_by_default="true" />
<inspection_tool class="fcd36335-ac86-4bef-8d30-062d8aae0364_XMLExternalEntitiesDocumentBuilderFactorysetExpandEntityReferencestofalse" enabled="true" level="SENSEI ERROR" enabled_by_default="true" />
<inspection_tool class="fcd36335-ac86-4bef-8d30-062d8aae0364_XMLExternalEntitiesDocumentBuilderFactorysetFeaturedissallow-doctype-decl" enabled="true" level="SENSEI ERROR" enabled_by_default="true" />
<inspection_tool class="fcd36335-ac86-4bef-8d30-062d8aae0364_XMLExternalEntitiesDocumentBuilderFactorysetFeaturedissallow-doctype-declwrongboolean" enabled="true" level="SENSEI ERROR" enabled_by_default="true" />
<inspection_tool class="fcd36335-ac86-4bef-8d30-062d8aae0364_XMLExternalEntitiesDocumentBuilderFactorysetFeatureexternal-parameter-entitiesshouldbesetfirst" enabled="true" level="SENSEI ERROR" enabled_by_default="true" />
<inspection_tool class="fcd36335-ac86-4bef-8d30-062d8aae0364_XMLExternalEntitiesDocumentBuilderFactorysetFeatureload-external-dtd" enabled="true" level="SENSEI ERROR" enabled_by_default="true" />
<inspection_tool class="fcd36335-ac86-4bef-8d30-062d8aae0364_XMLExternalEntitiesDocumentBuilderFactorysetXIncludeAware" enabled="true" level="SENSEI ERROR" enabled_by_default="true" />
<inspection_tool class="fcd36335-ac86-4bef-8d30-062d8aae0364_XMLExternalEntitiesXMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES" enabled="true" level="SENSEI ERROR" enabled_by_default="true" />
<inspection_tool class="fcd36335-ac86-4bef-8d30-062d8aae0364_XMLExternalEntitiesXMLInputFactory.SUPPORT_DTD" enabled="true" level="SENSEI ERROR" enabled_by_default="true" />
</profile>
</component>

30
.idea/jarRepositories.xml generated Normal file
View File

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RemoteRepositoriesConfiguration">
<remote-repository>
<option name="id" value="central" />
<option name="name" value="Maven Central repository" />
<option name="url" value="https://repo1.maven.org/maven2" />
</remote-repository>
<remote-repository>
<option name="id" value="jboss.community" />
<option name="name" value="JBoss Community repository" />
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
</remote-repository>
<remote-repository>
<option name="id" value="MavenRepo" />
<option name="name" value="MavenRepo" />
<option name="url" value="https://repo.maven.apache.org/maven2/" />
</remote-repository>
<remote-repository>
<option name="id" value="papermc-repo" />
<option name="name" value="papermc-repo" />
<option name="url" value="https://repo.papermc.io/repository/maven-public/" />
</remote-repository>
<remote-repository>
<option name="id" value="sonatype" />
<option name="name" value="sonatype" />
<option name="url" value="https://oss.sonatype.org/content/groups/public/" />
</remote-repository>
</component>
</project>

12
.idea/misc.xml generated Normal file
View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="EntryPointsManager">
<list size="1">
<item index="0" class="java.lang.String" itemvalue="org.bukkit.event.EventHandler" />
</list>
</component>
<component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" project-jdk-name="temurin-18" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>

13
.idea/modules/TypeSelector.main.iml generated Normal file
View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<module version="4">
<component name="FacetManager">
<facet type="minecraft" name="Minecraft">
<configuration>
<autoDetectTypes>
<platformType>PAPER</platformType>
<platformType>ADVENTURE</platformType>
</autoDetectTypes>
</configuration>
</facet>
</component>
</module>

View File

@ -0,0 +1,17 @@
Q
java:S1066!"/Merge this if statement with the enclosing one.(À<>·Ïþÿÿÿÿ8Õçþë0
U
java:S1118":Add a private constructor to hide the implicit public one.(¹‹ó¿ýÿÿÿÿ
t
java:S3776"RRefactor this method to reduce its Cognitive Complexity from 20 to the 15 allowed.(¼³”Íùÿÿÿÿ8Ûëþë0
C
java:S1659"!Declare "col" on a separate line.(žÏ¤šýÿÿÿÿ8Þëþë0
?
java:S1659""Declare "dCol" on a separate line.(õÀ©…8Þëþë0
f
java:S3358*"DExtract this nested ternary operation into an independent statement.(±·‹Šúÿÿÿÿ8ãëþë0
f
java:S3358*"DExtract this nested ternary operation into an independent statement.(±·‹Šúÿÿÿÿ8ãëþë0
O
java:S1128"-Remove this unused import 'java.util.Arrays'.(î–˜Éüÿÿÿÿ¸åýë0

View File

@ -0,0 +1,5 @@
c java:S116"NRename this field "INV" to match the regular expression '^[a-z][a-zA-Z0-9]*$'.(ÖóŸÕ
g java:S116"RRename this field "ACTIONS" to match the regular expression '^[a-z][a-zA-Z0-9]*$'.(»¬Þõ
I
java:S1611K"3Remove the parentheses around the "tuple" parameter(œÓ–ô

View File

@ -0,0 +1,7 @@
J
java:S2386"4Move "invByUUID" to a class and lower its visibility(ì‚ÖÀ
P
java:S2386":Move "openInventories" to a class and lower its visibility( <C2A0>¬
E
java:S1611-"/Remove the parentheses around the "p" parameter(‹±Ó‘

View File

@ -0,0 +1,9 @@
]
java:S2094"BRemove this empty class, write its code or make it an "interface".(̈–ƒþÿÿÿÿ
6
java:S2326"A is not used in the class.(̈–ƒþÿÿÿÿ
6
java:S2326"B is not used in the class.(̈–ƒþÿÿÿÿ
6
java:S2326"C is not used in the class.(̈–ƒþÿÿÿÿ

45
.idea/sonarlint/issuestore/index.pb generated Normal file
View File

@ -0,0 +1,45 @@
j
:src/main/java/io/github/simplexdevelopment/util/Tuple.java,a\c\ac5a95c559f2fc71d19c20cce19c09d1c5a8e233
i
9src/main/java/io/github/simplexdevelopment/util/Pair.java,5\1\5180bcd0407aa16dddc06876d760e9b3062791b1
m
=src/main/java/io/github/simplexdevelopment/api/GUIAction.java,3\0\30ddeaabb5082f9cf52c55066a39e20a1f7e4cde
l
<src/main/java/io/github/simplexdevelopment/util/Context.java,0\a\0a12643b5926514dc78595dd0de298f57c214da6
l
<src/main/java/io/github/simplexdevelopment/util/Utility.java,0\a\0a6146f64cde5935027cec3f5011843917c695cc
o
?src/main/java/io/github/simplexdevelopment/mob/AxolotlType.java,e\9\e9f15dd068513a64c53a24b0daa25119adfcc9ec
k
;src/main/java/io/github/simplexdevelopment/mob/CatType.java,4\8\4853b7b764faca92eb34eb45c9c8ae8753e8c104
k
;src/main/java/io/github/simplexdevelopment/mob/FoxType.java,1\2\12461258daee2839e766d082ea2e514d5578731c
m
=src/main/java/io/github/simplexdevelopment/mob/LlamaType.java,c\0\c073e6b63a4ab557c6e151977d8a00190061ea34
l
<src/main/java/io/github/simplexdevelopment/mob/FrogType.java,1\1\114d1a559c312d068b50b6a948d509cbdc315e2b
m
=src/main/java/io/github/simplexdevelopment/mob/HorseType.java,1\7\172cbc3e89142dd502a2aa74ee25933e1e1dca0e
n
>src/main/java/io/github/simplexdevelopment/mob/ParrotType.java,c\1\c17017a8e659f282bdd6ebfdaf9293f034645a9c
m
=src/main/java/io/github/simplexdevelopment/mob/SheepType.java,f\7\f7a91356545d95e994ebce6af582f1824b8ba782
n
>src/main/java/io/github/simplexdevelopment/mob/RabbitType.java,b\6\b6a6baf26fa767cc0299e356d0466810eb110166
m
=src/main/java/io/github/simplexdevelopment/mob/PandaType.java,6\d\6d697c45549525f848d3b9bc2eb4094069cf0043
t
Dsrc/main/java/io/github/simplexdevelopment/mob/TropicalFishType.java,f\b\fb9f8bc5d1d91117468f0312d09333f5af318753
p
@src/main/java/io/github/simplexdevelopment/mob/VillagerType.java,0\f\0f39357e2b7952a9117fcd9387b5a91735f600f5
x
Hsrc/main/java/io/github/simplexdevelopment/util/DisplayableSlotEnum.java,b\3\b3eafc205cf9dae5d1a7b77b5dbb74e37277308b
o
?src/main/java/io/github/simplexdevelopment/inv/AbstractGUI.java,3\f\3f45a40dab9ff1ac3dfeb0b1447c92d3fcca7e1d
m
=src/main/java/io/github/simplexdevelopment/api/GUIWindow.java,a\5\a5bbb1ae03235febbc6078171e3310884077d032
l
<src/main/java/io/github/simplexdevelopment/TypeListener.java,9\9\999d23e2cf89fb28de6ae4c8b025a7d0a7c4820d
l
<src/main/java/io/github/simplexdevelopment/TypeSelector.java,6\7\675f1b97b89a93527cff306e60abfb39c17a0c8d

124
.idea/uiDesigner.xml generated Normal file
View File

@ -0,0 +1,124 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Palette2">
<group name="Swing">
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
</item>
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
</item>
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
</item>
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.svg" removable="false" auto-create-binding="false" can-attach-label="true">
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
</item>
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
<initial-values>
<property name="text" value="Button" />
</initial-values>
</item>
<item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
<initial-values>
<property name="text" value="RadioButton" />
</initial-values>
</item>
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
<initial-values>
<property name="text" value="CheckBox" />
</initial-values>
</item>
<item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
<initial-values>
<property name="text" value="Label" />
</initial-values>
</item>
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
</item>
<item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
<preferred-size width="200" height="200" />
</default-constraints>
</item>
<item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
<preferred-size width="200" height="200" />
</default-constraints>
</item>
<item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
</item>
<item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
</item>
<item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
</item>
<item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
</item>
<item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
<preferred-size width="-1" height="20" />
</default-constraints>
</item>
<item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
</item>
<item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
</item>
</group>
</component>
</project>

23
LICENSE Normal file
View File

@ -0,0 +1,23 @@
Boost Software License - Version 1.0 - August 17th, 2003
Permission is hereby granted, free of charge, to any person or organization
obtaining a copy of the software and accompanying documentation covered by
this license (the "Software") to use, reproduce, display, distribute,
execute, and transmit the Software, and to prepare derivative works of the
Software, and to permit third-parties to whom the Software is furnished to
do so, all subject to the following:
The copyright notices in the Software and this entire statement, including
the above license grant, this restriction and the following disclaimer,
must be included in all copies of the Software, in whole or in part, and
all derivative works of the Software, unless such copies or derivative
works are solely in the form of machine-executable object code generated by
a source language processor.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.

47
build.gradle Normal file
View File

@ -0,0 +1,47 @@
plugins {
id 'java'
}
group = 'io.github.simplexdevelopment'
version = '1.0'
repositories {
mavenCentral()
maven {
name = 'papermc-repo'
url = 'https://repo.papermc.io/repository/maven-public/'
}
maven {
name = 'sonatype'
url = 'https://oss.sonatype.org/content/groups/public/'
}
}
dependencies {
compileOnly 'io.papermc.paper:paper-api:1.19.3-R0.1-SNAPSHOT'
}
def targetJavaVersion = 17
java {
def javaVersion = JavaVersion.toVersion(targetJavaVersion)
sourceCompatibility = javaVersion
targetCompatibility = javaVersion
if (JavaVersion.current() < javaVersion) {
toolchain.languageVersion = JavaLanguageVersion.of(targetJavaVersion)
}
}
tasks.withType(JavaCompile).configureEach {
if (targetJavaVersion >= 10 || JavaVersion.current().isJava10Compatible()) {
options.release = targetJavaVersion
}
}
processResources {
def props = [version: version]
inputs.properties props
filteringCharset 'UTF-8'
filesMatching('plugin.yml') {
expand props
}
}

0
gradle.properties Normal file
View File

View File

@ -0,0 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

234
gradlew vendored Normal file
View File

@ -0,0 +1,234 @@
#!/bin/sh
#
# Copyright © 2015-2021 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.
#
##############################################################################
#
# 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/master/subprojects/plugins/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
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
APP_NAME="Gradle"
APP_BASE_NAME=${0##*/}
# 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"'
# 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=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# 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
which java >/dev/null 2>&1 || 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
# Increase the maximum file descriptors if we can.
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
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
# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
# double quotes to make sure that they get re-expanded; and
# * put everything else in single quotes, so that it's not re-expanded.
set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
-classpath "$CLASSPATH" \
org.gradle.wrapper.GradleWrapperMain \
"$@"
# 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" "$@"

89
gradlew.bat vendored Normal file
View File

@ -0,0 +1,89 @@
@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
@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=.
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%" == "0" goto execute
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="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!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega

1
settings.gradle Normal file
View File

@ -0,0 +1 @@
rootProject.name = 'TypeSelector'

View File

@ -0,0 +1,118 @@
package io.github.simplexdevelopment;
import io.github.simplexdevelopment.api.GUIAction;
import io.github.simplexdevelopment.api.GUIWindow;
import io.github.simplexdevelopment.mob.*;
import org.bukkit.entity.*;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.inventory.InventoryCloseEvent;
import org.bukkit.event.player.PlayerInteractEntityEvent;
import org.jetbrains.annotations.NotNull;
import java.util.UUID;
public class TypeListener implements Listener {
@EventHandler
public void interact(@NotNull PlayerInteractEntityEvent e) {
if (!e.getPlayer().hasPermission("selector.menu")) {
return;
}
//
final Entity ent = e.getRightClicked();
final EntityType type = ent.getType();
final Player p = e.getPlayer();
//
if (p.isSneaking()) {
switch (type) {
case AXOLOTL -> {
Axolotl axolotl = (Axolotl) ent;
//
new AxolotlType(axolotl, p).openMenu();
}
case CAT -> {
Cat cat = (Cat) ent;
//
new CatType(cat, p).openMenu();
}
case FOX -> {
Fox fox = (Fox) ent;
//
new FoxType(fox, p);
}
case FROG -> {
Frog frog = (Frog) ent;
//
new FrogType(frog, p).openMenu();
}
case HORSE -> {
Horse horse = (Horse) ent;
//
new HorseType(horse, p).openMenu();
}
case LLAMA -> {
Llama llama = (Llama) ent;
//
new LlamaType(llama, p).openMenu();
}
case PANDA -> {
Panda panda = (Panda) ent;
//
new PandaType(panda, p).openMenu();
}
case PARROT -> {
Parrot parrot = (Parrot) ent;
//
new ParrotType(parrot, p).openMenu();
}
case RABBIT -> {
Rabbit rabbit = (Rabbit) ent;
//
new RabbitType(rabbit, p).openMenu();
}
case SHEEP -> {
Sheep sheep = (Sheep) ent;
//
new SheepType(sheep, p).openMenu();
}
case TROPICAL_FISH -> {
TropicalFish fish = (TropicalFish) ent;
//
new TropicalFishType(fish, p).openMenu();
}
case VILLAGER -> {
Villager villager = (Villager) ent;
//
new VillagerType(villager, p).openMenu();
}
default -> {
// We don't need anything here, because we don't want to do anything if it doesn't have a variant.
}
}
}
}
@EventHandler
public void onClick(@NotNull InventoryClickEvent e) {
if (!(e.getWhoClicked() instanceof Player player)) { return; }
//
UUID pUUID = player.getUniqueId();
UUID invUUID = GUIWindow.getOpenInvs().get(pUUID);
if (invUUID != null) {
e.setCancelled(true);
GUIWindow menu = GUIWindow.getInvByUUID().get(invUUID);
GUIAction action = menu.getActions().get(e.getSlot());
if (action != null) {
action.onClick(player);
}
}
}
@EventHandler
public void onClose(@NotNull InventoryCloseEvent e) {
Player player = (Player) e.getPlayer();
UUID pUUID = player.getUniqueId();
GUIWindow.getOpenInvs().remove(pUUID);
}
}

View File

@ -0,0 +1,17 @@
package io.github.simplexdevelopment;
import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;
public final class TypeSelector extends JavaPlugin {
@Override
public void onEnable() {
this.getServer().getPluginManager().registerEvents(new TypeListener(), this);
Bukkit.getLogger().info("TypeSelector has been enabled!");
}
@Override
public void onDisable() {
Bukkit.getLogger().info("TypeSelector has been disabled!");
}
}

View File

@ -0,0 +1,8 @@
package io.github.simplexdevelopment.api;
import org.bukkit.entity.Player;
@FunctionalInterface
public interface GUIAction {
void onClick(Player player);
}

View File

@ -0,0 +1,76 @@
package io.github.simplexdevelopment.api;
import net.kyori.adventure.text.Component;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.Listener;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.InventoryHolder;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
public interface GUIWindow extends InventoryHolder, Listener {
Map<UUID, GUIWindow> invByUUID = new HashMap<>();
Map<UUID, UUID> openInventories = new HashMap<>();
static Map<UUID, GUIWindow> getInvByUUID() {
return invByUUID;
}
static Map<UUID, UUID> getOpenInvs() {
return openInventories;
}
void openMenu();
UUID getUUID();
Map<Integer, GUIAction> getActions();
void setItem(int slot, @NotNull ItemStack itemStack, @Nullable GUIAction action);
void clear();
void open(@NotNull Player p);
default void delete() {
Bukkit.getOnlinePlayers().forEach((p) -> {
UUID u = openInventories.get(p.getUniqueId());
if (u.equals(getUUID())) {
p.closeInventory();
}
});
invByUUID.remove(getUUID());
}
default void setItem(int slot, @NotNull ItemStack itemStack) {
setItem(slot, itemStack, null);
}
default ItemStack newItem(@NotNull Material mat, String name) {
return newItem(mat, name, "");
}
default ItemStack newItem(@NotNull Material mat, String name, String... lore) {
ItemStack item = new ItemStack(mat);
ItemMeta meta = item.getItemMeta();
if (meta != null) {
meta.displayName(Component.text(name));
ArrayList<Component> lores = new ArrayList<>();
for (String s : lore) {
lores.add(Component.text(s));
}
meta.lore(lores);
item.setItemMeta(meta);
}
return item;
}
}

View File

@ -0,0 +1,89 @@
package io.github.simplexdevelopment.inv;
import io.github.simplexdevelopment.api.GUIAction;
import io.github.simplexdevelopment.api.GUIWindow;
import io.github.simplexdevelopment.util.DisplayableSlotEnum;
import io.github.simplexdevelopment.util.Tuple;
import io.github.simplexdevelopment.util.Utility;
import net.kyori.adventure.text.Component;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
import org.jetbrains.annotations.NotNull;
import java.util.*;
import java.util.stream.Collectors;
public abstract class AbstractGUI implements GUIWindow {
private final Inventory INV;
private final Map<Integer, GUIAction> ACTIONS;
private final UUID uuid;
private final int[] slots = Utility.range(0, 44);
private final Map<Integer, Material> slotMap = DisplayableSlotEnum.getSlotMaterialMap();
private final Set<Tuple<Integer, String, GUIAction>> tupleList = new HashSet<>();
protected AbstractGUI(String name) {
this.uuid = UUID.randomUUID();
this.INV = Bukkit.createInventory(null, 45, Component.text(name));
this.ACTIONS = new HashMap<>();
GUIWindow.getInvByUUID().put(getUUID(), this);
}
@Override
public Map<Integer, GUIAction> getActions() {
return ACTIONS;
}
@Override
public UUID getUUID() {
return uuid;
}
@Override
public Inventory getInventory() {
return INV;
}
@Override
public void setItem(int slot, @NotNull ItemStack itemStack, GUIAction action) {
INV.setItem(slot, itemStack);
if (action != null) {
ACTIONS.put(slot, action);
}
}
@Override
public void clear() {
INV.clear();
}
@Override
public void open(@NotNull Player p) {
p.openInventory(INV);
openInventories.put(p.getUniqueId(), getUUID());
}
public void createInjection(int slot, String name, GUIAction action) {
tupleList.add(new Tuple<>(slot, name, action));
}
public void dynamicSlotAssignment(Set<Tuple<Integer, String, GUIAction>> integerGUIActionTupleList) {
Set<Integer> availableSlots = Arrays.stream(slots).boxed().collect(Collectors.toSet());
int[] slotMapSelector = {0};
integerGUIActionTupleList.forEach((tuple) -> {
int slot = tuple.getA();
GUIAction action = tuple.getC();
if (availableSlots.contains(slot)) {
setItem(slot, newItem(slotMap.get(slotMapSelector[0]), tuple.getB()), action);
availableSlots.remove(slot);
slotMapSelector[0]++;
}
});
}
public Set<Tuple<Integer, String, GUIAction>> getTupleList() {
return tupleList;
}
}

View File

@ -0,0 +1,31 @@
package io.github.simplexdevelopment.mob;
import io.github.simplexdevelopment.inv.AbstractGUI;
import io.github.simplexdevelopment.util.Utility;
import org.bukkit.entity.Axolotl;
import org.bukkit.entity.Player;
public class AxolotlType extends AbstractGUI {
private final Axolotl axolotl;
private final Player player;
public AxolotlType(Axolotl axolotl, Player player) {
super("Axolotl Type");
this.axolotl = axolotl;
this.player = player;
}
@Override
public void openMenu() {
int[] x = {Utility.getNextEmptySlot(22)};
Utility.forEach(Axolotl.Variant.values(), variant -> {
this.createInjection(x[0], variant.name(), action -> {
axolotl.setVariant(variant);
action.closeInventory();
});
x[0] = Utility.getNextEmptySlot(x[0]);
});
this.dynamicSlotAssignment(this.getTupleList());
this.open(player);
}
}

View File

@ -0,0 +1,31 @@
package io.github.simplexdevelopment.mob;
import io.github.simplexdevelopment.inv.AbstractGUI;
import io.github.simplexdevelopment.util.Utility;
import org.bukkit.entity.Cat;
import org.bukkit.entity.Player;
public class CatType extends AbstractGUI {
private final Cat cat;
private final Player player;
public CatType(Cat cat, Player player) {
super("Cat Type");
this.cat = cat;
this.player = player;
}
@Override
public void openMenu() {
int[] x = {Utility.getNextEmptySlot(22)};
Utility.forEach(Cat.Type.values(), type -> {
this.createInjection(x[0], type.name(), p -> {
cat.setCatType(type);
p.closeInventory();
});
x[0] = Utility.getNextEmptySlot(x[0]);
});
this.dynamicSlotAssignment(this.getTupleList());
this.open(player);
}
}

View File

@ -0,0 +1,31 @@
package io.github.simplexdevelopment.mob;
import io.github.simplexdevelopment.inv.AbstractGUI;
import io.github.simplexdevelopment.util.Utility;
import org.bukkit.entity.Fox;
import org.bukkit.entity.Player;
public class FoxType extends AbstractGUI {
private final Fox fox;
private final Player player;
public FoxType(Fox fox, Player player) {
super("Fox Variant");
this.fox = fox;
this.player = player;
}
@Override
public void openMenu() {
int[] x = {Utility.getNextEmptySlot(22)};
Utility.forEach(Fox.Type.values(), type -> {
this.createInjection(x[0], type.name(), s -> {
fox.setFoxType(type);
s.closeInventory();
});
x[0] = Utility.getNextEmptySlot(x[0]);
});
this.dynamicSlotAssignment(this.getTupleList());
this.open(player);
}
}

View File

@ -0,0 +1,31 @@
package io.github.simplexdevelopment.mob;
import io.github.simplexdevelopment.inv.AbstractGUI;
import io.github.simplexdevelopment.util.Utility;
import org.bukkit.entity.Frog;
import org.bukkit.entity.Player;
public class FrogType extends AbstractGUI {
private final Frog frog;
private final Player player;
public FrogType(Frog frog, Player player) {
super("Frog Type");
this.frog = frog;
this.player = player;
}
@Override
public void openMenu() {
int[] x = {Utility.getNextEmptySlot(22)};
Utility.forEach(Frog.Variant.values(), type -> {
this.createInjection(x[0], type.name(), p -> {
frog.setVariant(type);
p.closeInventory();
});
x[0] = Utility.getNextEmptySlot(x[0]);
});
this.dynamicSlotAssignment(this.getTupleList());
this.open(player);
}
}

View File

@ -0,0 +1,59 @@
package io.github.simplexdevelopment.mob;
import io.github.simplexdevelopment.inv.AbstractGUI;
import io.github.simplexdevelopment.util.Utility;
import org.bukkit.entity.Horse;
import org.bukkit.entity.Player;
public class HorseType extends AbstractGUI {
private final Horse horse;
private final Player player;
private final HorseStyle horseStyle;
public HorseType(Horse horse, Player player) {
super("Horse Type");
this.horse = horse;
this.player = player;
this.horseStyle = new HorseStyle(horse, player);
}
@Override
public void openMenu() {
int[] x = {0};
Utility.forEach(Horse.Color.values(), color -> {
this.createInjection(x[0], color.name(), p -> {
horse.setColor(color);
horseStyle.openMenu();
});
x[0] = Utility.getNextEmptySlot(x[0]);
});
this.dynamicSlotAssignment(this.getTupleList());
this.open(player);
}
private final class HorseStyle extends AbstractGUI {
private final Horse horse;
private final Player player;
public HorseStyle(Horse horse, Player player) {
super("Horse Style");
this.horse = horse;
this.player = player;
}
@Override
public void openMenu() {
int[] x = {Utility.getNextEmptySlot(22)};
Utility.forEach(Horse.Style.values(), style -> {
this.createInjection(x[0], style.name(), p -> {
horse.setStyle(style);
p.closeInventory();
});
x[0] = Utility.getNextEmptySlot(x[0]);
});
this.dynamicSlotAssignment(this.getTupleList());
this.open(player);
}
}
}

View File

@ -0,0 +1,31 @@
package io.github.simplexdevelopment.mob;
import io.github.simplexdevelopment.inv.AbstractGUI;
import io.github.simplexdevelopment.util.Utility;
import org.bukkit.entity.Llama;
import org.bukkit.entity.Player;
public class LlamaType extends AbstractGUI {
private final Llama llama;
private final Player player;
public LlamaType(Llama llama, Player player) {
super("Llama Type");
this.llama = llama;
this.player = player;
}
@Override
public void openMenu() {
int[] x = {Utility.getNextEmptySlot(22)};
Utility.forEach(Llama.Color.values(), color -> {
this.createInjection(x[0], color.name(), p-> {
llama.setColor(color);
p.closeInventory();
});
x[0] = Utility.getNextEmptySlot(x[0]);
});
this.dynamicSlotAssignment(this.getTupleList());
this.open(player);
}
}

View File

@ -0,0 +1,57 @@
package io.github.simplexdevelopment.mob;
import io.github.simplexdevelopment.inv.AbstractGUI;
import io.github.simplexdevelopment.util.Utility;
import org.bukkit.entity.Panda;
import org.bukkit.entity.Player;
public class PandaType extends AbstractGUI {
private final Panda panda;
private final Player player;
private final PandaDiminutive diminutive;
public PandaType(Panda panda, Player player) {
super("Panda");
this.panda = panda;
this.player = player;
this.diminutive = new PandaDiminutive(panda, player);
}
@Override
public void openMenu() {
int[] x = {Utility.getNextEmptySlot(22)};
Utility.forEach(Panda.Gene.values(), gene -> {
this.createInjection(x[0], gene.name(), p -> {
panda.setMainGene(gene);
diminutive.openMenu();
});
x[0] = Utility.getNextEmptySlot(x[0]);
});
this.dynamicSlotAssignment(this.getTupleList());
this.open(player);
}
private static final class PandaDiminutive extends AbstractGUI {
private final Panda panda;
private final Player player;
public PandaDiminutive(Panda panda, Player player) {
super("Panda Diminutive");
this.panda = panda;
this.player = player;
}
@Override
public void openMenu() {
int[] x = {Utility.getNextEmptySlot(22)};
Utility.forEach(Panda.Gene.values(), gene -> {
this.createInjection(x[0], gene.name(), p -> {
panda.setHiddenGene(gene);
p.closeInventory();
});
x[0] = Utility.getNextEmptySlot(x[0]);
});
this.dynamicSlotAssignment(this.getTupleList());
this.open(player);
}
}
}

View File

@ -0,0 +1,31 @@
package io.github.simplexdevelopment.mob;
import io.github.simplexdevelopment.inv.AbstractGUI;
import io.github.simplexdevelopment.util.Utility;
import org.bukkit.entity.Parrot;
import org.bukkit.entity.Player;
public class ParrotType extends AbstractGUI {
private final Parrot parrot;
private final Player player;
public ParrotType(Parrot parrot, Player player) {
super("Parrot Type");
this.parrot = parrot;
this.player = player;
}
@Override
public void openMenu() {
int[] x = {Utility.getNextEmptySlot(22)};
Utility.forEach(Parrot.Variant.values(), variant -> {
this.createInjection(x[0], variant.name(), action -> {
parrot.setVariant(variant);
action.closeInventory();
});
x[0] = Utility.getNextEmptySlot(x[0]);
});
this.dynamicSlotAssignment(this.getTupleList());
this.open(player);
}
}

View File

@ -0,0 +1,31 @@
package io.github.simplexdevelopment.mob;
import io.github.simplexdevelopment.inv.AbstractGUI;
import io.github.simplexdevelopment.util.Utility;
import org.bukkit.entity.Player;
import org.bukkit.entity.Rabbit;
public class RabbitType extends AbstractGUI {
private final Rabbit rabbit;
private final Player player;
public RabbitType(Rabbit rabbit, Player player) {
super("Rabbit Type");
this.rabbit = rabbit;
this.player = player;
}
@Override
public void openMenu() {
int[] x = {Utility.getNextEmptySlot(22)};
Utility.forEach(Rabbit.Type.values(), type -> {
this.createInjection(x[0], type.name(), p -> {
rabbit.setRabbitType(type);
p.closeInventory();
});
x[0] = Utility.getNextEmptySlot(x[0]);
});
this.dynamicSlotAssignment(this.getTupleList());
this.open(player);
}
}

View File

@ -0,0 +1,32 @@
package io.github.simplexdevelopment.mob;
import io.github.simplexdevelopment.inv.AbstractGUI;
import io.github.simplexdevelopment.util.Utility;
import org.bukkit.DyeColor;
import org.bukkit.entity.Player;
import org.bukkit.entity.Sheep;
public class SheepType extends AbstractGUI {
private final Sheep sheep;
private final Player player;
public SheepType(Sheep sheep, Player player) {
super("Rabbit Type");
this.sheep = sheep;
this.player = player;
}
@Override
public void openMenu() {
int[] x = {Utility.getNextEmptySlot(22)};
Utility.forEach(DyeColor.values(), color -> {
this.createInjection(x[0], color.name(), p -> {
sheep.setColor(color);
p.closeInventory();
});
x[0] = Utility.getNextEmptySlot(x[0]);
});
this.dynamicSlotAssignment(this.getTupleList());
this.open(player);
}
}

View File

@ -0,0 +1,84 @@
package io.github.simplexdevelopment.mob;
import io.github.simplexdevelopment.inv.AbstractGUI;
import io.github.simplexdevelopment.util.Utility;
import org.bukkit.DyeColor;
import org.bukkit.entity.Player;
import org.bukkit.entity.TropicalFish;
public class TropicalFishType extends AbstractGUI {
private final TropicalFish fish;
private final Player player;
private final FishBodyColor bodyColor;
private final FishPatternColor patternColor;
public TropicalFishType(TropicalFish fish, Player player) {
super("Tropical Fish");
this.fish = fish;
this.player = player;
this.bodyColor = new FishBodyColor(fish, player);
this.patternColor = new FishPatternColor(fish, player);
}
@Override
public void openMenu() {
int[] x = {Utility.getNextEmptySlot(22)};
Utility.forEach(TropicalFish.Pattern.values(), pattern -> {
this.createInjection(x[0], pattern.name(), p -> {
fish.setPattern(pattern);
bodyColor.openMenu();
});
x[0] = Utility.getNextEmptySlot(x[0]);
});
this.dynamicSlotAssignment(this.getTupleList());
this.open(player);
}
private final class FishBodyColor extends AbstractGUI {
private final TropicalFish fish;
private final Player player;
public FishBodyColor(TropicalFish fish, Player player) {
super("Body Color");
this.fish = fish;
this.player = player;
}
public void openMenu() {
int[] x = {Utility.getNextEmptySlot(22)};
Utility.forEach(DyeColor.values(), dyeColor -> {
this.createInjection(x[0], dyeColor.name(), p -> {
fish.setBodyColor(dyeColor);
patternColor.openMenu();
});
x[0] = Utility.getNextEmptySlot(x[0]);
});
this.dynamicSlotAssignment(this.getTupleList());
this.open(player);
}
}
private final class FishPatternColor extends AbstractGUI {
private final TropicalFish fish;
private final Player player;
public FishPatternColor(TropicalFish fish, Player player) {
super("Body Color");
this.fish = fish;
this.player = player;
}
public void openMenu() {
int[] x = {Utility.getNextEmptySlot(22)};
Utility.forEach(DyeColor.values(), dyeColor -> {
this.createInjection(x[0], dyeColor.name(), p -> {
fish.setPatternColor(dyeColor);
p.closeInventory();
});
x[0] = Utility.getNextEmptySlot(x[0]);
});
this.dynamicSlotAssignment(this.getTupleList());
this.open(player);
}
}
}

View File

@ -0,0 +1,59 @@
package io.github.simplexdevelopment.mob;
import io.github.simplexdevelopment.inv.AbstractGUI;
import io.github.simplexdevelopment.util.Utility;
import org.bukkit.DyeColor;
import org.bukkit.entity.Player;
import org.bukkit.entity.Villager;
public class VillagerType extends AbstractGUI {
private final Villager villager;
private final Player player;
private final VillagerProfession villagerProfession;
public VillagerType(Villager villager, Player player) {
super("Rabbit Type");
this.villager = villager;
this.player = player;
this.villagerProfession = new VillagerProfession(villager, player);
}
@Override
public void openMenu() {
int[] x = {Utility.getNextEmptySlot(22)};
Utility.forEach(Villager.Type.values(), type -> {
this.createInjection(x[0], type.name(), p -> {
villager.setVillagerType(type);
villagerProfession.openMenu();
});
x[0] = Utility.getNextEmptySlot(x[0]);
});
this.dynamicSlotAssignment(this.getTupleList());
this.open(player);
}
private final class VillagerProfession extends AbstractGUI {
private final Villager villager;
private final Player player;
public VillagerProfession(Villager villager, Player player) {
super("Body Color");
this.villager = villager;
this.player = player;
}
public void openMenu() {
int[] x = {Utility.getNextEmptySlot(22)};
Utility.forEach(Villager.Profession.values(), profession -> {
this.createInjection(x[0], profession.name(), p -> {
villager.setProfession(profession);
villager.setVillagerExperience(1); // This prevents loss of profession.
p.closeInventory();
});
x[0] = Utility.getNextEmptySlot(x[0]);
});
this.dynamicSlotAssignment(this.getTupleList());
this.open(player);
}
}
}

View File

@ -0,0 +1,21 @@
package io.github.simplexdevelopment.util;
import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull;
public class Context<S> {
private final S state;
protected Context(S state) {
this.state = state;
}
public S getState() {
return state;
}
@Contract(value = "_ -> new", pure = true)
public static <S> @NotNull Context<S> of(S state) {
return new Context<>(state);
}
}

View File

@ -0,0 +1,84 @@
package io.github.simplexdevelopment.util;
import org.bukkit.Material;
import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull;
import java.util.HashMap;
import java.util.Map;
public enum DisplayableSlotEnum {
ZERO(0, Material.WHITE_DYE),
ONE(1, Material.LIGHT_GRAY_DYE),
TWO(2, Material.GRAY_DYE),
THREE(3, Material.BLACK_DYE),
FOUR(4, Material.RED_DYE),
FIVE(5, Material.ORANGE_DYE),
SIX(6, Material.YELLOW_DYE),
SEVEN(7, Material.GREEN_DYE),
EIGHT(8, Material.LIME_DYE),
NINE(9, Material.CYAN_DYE),
TEN(10, Material.LIGHT_BLUE_DYE),
ELEVEN(11, Material.BLUE_DYE),
TWELVE(12, Material.PURPLE_DYE),
THIRTEEN(13, Material.MAGENTA_DYE),
FOURTEEN(14, Material.PINK_DYE),
FIFTEEN(15, Material.BROWN_DYE),
SIXTEEN(16, Material.WHITE_WOOL),
SEVENTEEN(17, Material.LIGHT_GRAY_WOOL),
EIGHTEEN(18, Material.GRAY_WOOL),
NINETEEN(19, Material.BLACK_WOOL),
TWENTY(20, Material.RED_WOOL),
TWENTY_ONE(21, Material.ORANGE_WOOL),
TWENTY_TWO(22, Material.YELLOW_WOOL),
TWENTY_THREE(23, Material.GREEN_WOOL),
TWENTY_FOUR(24, Material.LIME_WOOL),
TWENTY_FIVE(25, Material.CYAN_WOOL),
TWENTY_SIX(26, Material.LIGHT_BLUE_WOOL),
TWENTY_SEVEN(27, Material.BLUE_WOOL),
TWENTY_EIGHT(28, Material.PURPLE_WOOL),
TWENTY_NINE(29, Material.MAGENTA_WOOL),
THIRTY(30, Material.PINK_WOOL),
THIRTY_ONE(31, Material.BROWN_WOOL),
THIRTY_TWO(32, Material.WHITE_STAINED_GLASS),
THIRTY_THREE(33, Material.LIGHT_GRAY_STAINED_GLASS),
THIRTY_FOUR(34, Material.GRAY_STAINED_GLASS),
THIRTY_FIVE(35, Material.BLACK_STAINED_GLASS),
THIRTY_SIX(36, Material.RED_STAINED_GLASS),
THIRTY_SEVEN(37, Material.ORANGE_STAINED_GLASS),
THIRTY_EIGHT(38, Material.YELLOW_STAINED_GLASS),
THIRTY_NINE(39, Material.GREEN_STAINED_GLASS),
FORTY(40, Material.LIME_STAINED_GLASS),
FORTY_ONE(41, Material.CYAN_STAINED_GLASS),
FORTY_TWO(42, Material.LIGHT_BLUE_STAINED_GLASS),
FORTY_THREE(43, Material.BLUE_STAINED_GLASS),
FORTY_FOUR(44, Material.PURPLE_STAINED_GLASS);
private final int slot;
private final Material material;
@Contract(pure = true)
DisplayableSlotEnum(int slot, Material material) {
this.slot = slot;
this.material = material;
}
@Contract(pure = true)
public int getSlot() {
return slot;
}
@Contract(pure = true)
public Material getMaterial() {
return material;
}
public static @NotNull Map<Integer, Material> getSlotMaterialMap() {
Map<Integer, Material> slotMaterialMap = new HashMap<>();
for (DisplayableSlotEnum displayableSlotEnum : values()) {
slotMaterialMap.put(displayableSlotEnum.getSlot(), displayableSlotEnum.getMaterial());
}
return slotMaterialMap;
}
}

View File

@ -0,0 +1,19 @@
package io.github.simplexdevelopment.util;
public class Pair<X, Y> {
private final X x;
private final Y y;
public Pair(X x, Y y) {
this.x = x;
this.y = y;
}
public X getX() {
return x;
}
public Y getY() {
return y;
}
}

View File

@ -0,0 +1,25 @@
package io.github.simplexdevelopment.util;
public class Tuple<A, B, C> {
private final A a;
private final B b;
private final C c;
public Tuple(A a, B b, C c) {
this.a = a;
this.b = b;
this.c = c;
}
public A getA() {
return a;
}
public B getB() {
return b;
}
public C getC() {
return c;
}
}

View File

@ -0,0 +1,52 @@
package io.github.simplexdevelopment.util;
import org.jetbrains.annotations.NotNull;
import java.util.Arrays;
import java.util.function.Consumer;
public class Utility {
public static int[] range(int start, int end) {
int[] range = new int[end - start];
for (int i = 0; i < range.length; i++) {
range[i] = start + i;
}
return range;
}
public static <T> void forEach(T @NotNull [] array, Consumer<T> consumer) {
for (T t : array) {
consumer.accept(t);
}
}
public static int getNextEmptySlot(int x) {
int[][] grid = new int[5][9]; // initialize the grid
int row = 0, col = 0;
int dRow = 0, dCol = 1;
int[] dr = {0, 1, 0, -1};
int[] dc = {1, 0, -1, 0};
for (int i = 0; i < 5 * 9; i++) {
if (grid[row][col] == 0) {
if (i == x) {
return row * 9 + col;
}
}
row += dRow;
col += dCol;
if (row < 0 || row >= 5 || col < 0 || col >= 9 || grid[row][col] != 0) {
row -= dRow;
col -= dCol;
int dir = (dRow == 0) ? (dCol == 1 ? 1 : 3) : (dRow == 1 ? 2 : 0);
dRow = dr[dir];
dCol = dc[dir];
row += dRow;
col += dCol;
}
}
return -1; // no empty slot found
}
}

View File

@ -0,0 +1,6 @@
name: TypeSelector
version: '${version}'
main: io.github.simplexdevelopment.typeselector.TypeSelector
api-version: 1.19
authors: [ SimplexDevelopment ]
description: A mob type selector for Paper servers.