make buffrates functional

This commit is contained in:
Sekalol15 committed 2023-07-15 09:10:17 +02:00
1 parent ced424fd55
commit 324cb5925a
94 files changed
+121 -10

No files matched your search

Binary file not shown.
Binary file not shown.
Binary file not shown.
Whitespace-only changes.
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
Whitespace-only changes.
Binary file not shown.
@@ -0,0 +1,2 @@
#Thu Jul 13 07:29:49 CEST 2023
gradle.version=8.1.1
Binary file not shown.
Binary file not shown.
View File
Whitespace-only changes.
+3
View File
@@ -0,0 +1,3 @@
# Default ignored files
/shelf/
/workspace.xml
+6
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
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>
+16
View File
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GradleMigrationSettings" migrationVersion="1" />
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />
</set>
</option>
</GradleProjectSettings>
</option>
</component>
</project>
+25
View File
@@ -0,0 +1,25 @@
<?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="maven" />
<option name="name" value="maven" />
<option name="url" value="https://repo.purpurmc.org/snapshots" />
</remote-repository>
</component>
</project>
+6
View File
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="KotlinJpsPluginSettings">
<option name="version" value="1.9.0" />
</component>
</project>
+5
View File
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" project-jdk-name="19" project-jdk-type="JavaSDK" />
</project>
+8
View File
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/modules/BuffRates-OG.main.iml" filepath="$PROJECT_DIR$/.idea/modules/BuffRates-OG.main.iml" />
</modules>
</component>
</project>
+12
View File
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<module version="4">
<component name="FacetManager">
<facet type="minecraft" name="Minecraft">
<configuration>
<autoDetectTypes>
<platformType>ADVENTURE</platformType>
</autoDetectTypes>
</configuration>
</facet>
</component>
</module>
Generated
+6
View File
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>
BIN
View File
Binary file not shown.
Binary file not shown.
@@ -1,2 +1,2 @@
2
9
0
Binary file not shown.
BIN
View File
Binary file not shown.
+4 -7
View File
@@ -7,13 +7,7 @@ import org.bukkit.plugin.java.JavaPlugin
import java.io.File
import org.bukkit.Bukkit
import org.bukkit.attribute.Attribute
object Config {
private lateinit var config: FileConfiguration
private lateinit var file: File
fun getslimeChance(): Float {
return config.get("slimeChance") as Float
}
// Extending this class is standard bukkit boilerplate for any plugin, or else the server software won't load the classes.
class BuffRatesOG : JavaPlugin() {
@@ -23,13 +17,16 @@ class BuffRatesOG : JavaPlugin() {
plugin = this
server.pluginManager.registerEvents(Listeners(), this)
CreateConfig()
}
private fun CreateConfig() {
ConfigFile = File(dataFolder, "config.yml")
if (!ConfigFile!!.exists()) {
plugin!!.saveDefaultConfig()
}
}
}}
}
+17
View File
@@ -0,0 +1,17 @@
// This is free and unencumbered software released into the public domain.
// Author: Sekalol15
package plugin
import org.bukkit.configuration.file.FileConfiguration
import java.io.File
object Config {
private lateinit var config: FileConfiguration
private lateinit var file: File
fun getSlimeChance(): Float {
return config.get("slimeChance") as Float
}
}
+3 -2
View File
@@ -9,11 +9,12 @@ import org.bukkit.event.entity.CreatureSpawnEvent
import kotlin.random.Random
class Listeners : Listener {
//val getChance = Config.getSlimeChance()
@EventHandler
fun CreatureSpawnEvent(event: CreatureSpawnEvent) {
val slimePos = event.entity.location
var getChance = Config.getslimeChance()
if (event.entity.entitySpawnReason != CreatureSpawnEvent.SpawnReason.CUSTOM && Random.nextDouble() <= getChance) {
//var getChance = Config.getSlimeChance()
if (event.entity.entitySpawnReason != CreatureSpawnEvent.SpawnReason.CUSTOM && Random.nextDouble() <= 0.2) {
event.entity.world.spawnEntity(slimePos, EntityType.SLIME, CreatureSpawnEvent.SpawnReason.CUSTOM)