Initial commit
This commit is contained in:
33
.gitignore
vendored
Normal file
33
.gitignore
vendored
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
# Created by https://www.toptal.com/developers/gitignore/api/java
|
||||||
|
# Edit at https://www.toptal.com/developers/gitignore?templates=java
|
||||||
|
|
||||||
|
### Java ###
|
||||||
|
# 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*
|
||||||
|
|
||||||
|
# End of https://www.toptal.com/developers/gitignore/api/java
|
||||||
|
|
||||||
|
|
||||||
|
run
|
||||||
BIN
.gradle/8.8/checksums/checksums.lock
Normal file
BIN
.gradle/8.8/checksums/checksums.lock
Normal file
Binary file not shown.
BIN
.gradle/8.8/checksums/md5-checksums.bin
Normal file
BIN
.gradle/8.8/checksums/md5-checksums.bin
Normal file
Binary file not shown.
BIN
.gradle/8.8/checksums/sha1-checksums.bin
Normal file
BIN
.gradle/8.8/checksums/sha1-checksums.bin
Normal file
Binary file not shown.
0
.gradle/8.8/dependencies-accessors/gc.properties
Normal file
0
.gradle/8.8/dependencies-accessors/gc.properties
Normal file
BIN
.gradle/8.8/executionHistory/executionHistory.bin
Normal file
BIN
.gradle/8.8/executionHistory/executionHistory.bin
Normal file
Binary file not shown.
BIN
.gradle/8.8/executionHistory/executionHistory.lock
Normal file
BIN
.gradle/8.8/executionHistory/executionHistory.lock
Normal file
Binary file not shown.
BIN
.gradle/8.8/fileChanges/last-build.bin
Normal file
BIN
.gradle/8.8/fileChanges/last-build.bin
Normal file
Binary file not shown.
BIN
.gradle/8.8/fileHashes/fileHashes.bin
Normal file
BIN
.gradle/8.8/fileHashes/fileHashes.bin
Normal file
Binary file not shown.
BIN
.gradle/8.8/fileHashes/fileHashes.lock
Normal file
BIN
.gradle/8.8/fileHashes/fileHashes.lock
Normal file
Binary file not shown.
BIN
.gradle/8.8/fileHashes/resourceHashesCache.bin
Normal file
BIN
.gradle/8.8/fileHashes/resourceHashesCache.bin
Normal file
Binary file not shown.
0
.gradle/8.8/gc.properties
Normal file
0
.gradle/8.8/gc.properties
Normal file
BIN
.gradle/buildOutputCleanup/buildOutputCleanup.lock
Normal file
BIN
.gradle/buildOutputCleanup/buildOutputCleanup.lock
Normal file
Binary file not shown.
2
.gradle/buildOutputCleanup/cache.properties
Normal file
2
.gradle/buildOutputCleanup/cache.properties
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
#Fri Jan 09 21:21:17 CET 2026
|
||||||
|
gradle.version=8.8
|
||||||
BIN
.gradle/buildOutputCleanup/outputFiles.bin
Normal file
BIN
.gradle/buildOutputCleanup/outputFiles.bin
Normal file
Binary file not shown.
BIN
.gradle/file-system.probe
Normal file
BIN
.gradle/file-system.probe
Normal file
Binary file not shown.
0
.gradle/vcs-1/gc.properties
Normal file
0
.gradle/vcs-1/gc.properties
Normal file
3
.idea/.gitignore
generated
vendored
Normal file
3
.idea/.gitignore
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
# Default ignored files
|
||||||
|
/shelf/
|
||||||
|
/workspace.xml
|
||||||
6
.idea/compiler.xml
generated
Normal file
6
.idea/compiler.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="CompilerConfiguration">
|
||||||
|
<bytecodeTargetLevel target="21" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
15
.idea/gradle.xml
generated
Normal file
15
.idea/gradle.xml
generated
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<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>
|
||||||
7
.idea/misc.xml
generated
Normal file
7
.idea/misc.xml
generated
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||||
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_21" default="true" project-jdk-name="corretto-21" project-jdk-type="JavaSDK">
|
||||||
|
<output url="file://$PROJECT_DIR$/out" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
8
.idea/modules.xml
generated
Normal file
8
.idea/modules.xml
generated
Normal 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/BabyCreeper.main.iml" filepath="$PROJECT_DIR$/.idea/modules/BabyCreeper.main.iml" />
|
||||||
|
</modules>
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
13
.idea/modules/BabyCreeper.main.iml
generated
Normal file
13
.idea/modules/BabyCreeper.main.iml
generated
Normal 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>ADVENTURE</platformType>
|
||||||
|
</autoDetectTypes>
|
||||||
|
<projectReimportVersion>1</projectReimportVersion>
|
||||||
|
</configuration>
|
||||||
|
</facet>
|
||||||
|
</component>
|
||||||
|
</module>
|
||||||
6
.idea/vcs.xml
generated
Normal file
6
.idea/vcs.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="VcsDirectoryMappings">
|
||||||
|
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
55
build.gradle
Normal file
55
build.gradle
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
plugins {
|
||||||
|
id 'java'
|
||||||
|
id("xyz.jpenilla.run-paper") version "2.3.1"
|
||||||
|
}
|
||||||
|
|
||||||
|
group = 'eu.mhsl.minecraft.BabyCreeper'
|
||||||
|
version = '1.0-SNAPSHOT'
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
mavenCentral()
|
||||||
|
maven {
|
||||||
|
name = "papermc-repo"
|
||||||
|
url = "https://repo.papermc.io/repository/maven-public/"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
compileOnly("io.papermc.paper:paper-api:1.21.11-R0.1-SNAPSHOT")
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks {
|
||||||
|
runServer {
|
||||||
|
// Configure the Minecraft version for our task.
|
||||||
|
// This is the only required configuration besides applying the plugin.
|
||||||
|
// Your plugin's jar (or shadowJar if present) will be used automatically.
|
||||||
|
minecraftVersion("1.21.10")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def targetJavaVersion = 21
|
||||||
|
java {
|
||||||
|
def javaVersion = JavaVersion.toVersion(targetJavaVersion)
|
||||||
|
sourceCompatibility = javaVersion
|
||||||
|
targetCompatibility = javaVersion
|
||||||
|
if (JavaVersion.current() < javaVersion) {
|
||||||
|
toolchain.languageVersion = JavaLanguageVersion.of(targetJavaVersion)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.withType(JavaCompile).configureEach {
|
||||||
|
options.encoding = 'UTF-8'
|
||||||
|
|
||||||
|
if (targetJavaVersion >= 10 || JavaVersion.current().isJava10Compatible()) {
|
||||||
|
options.release.set(targetJavaVersion)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
processResources {
|
||||||
|
def props = [version: version]
|
||||||
|
inputs.properties props
|
||||||
|
filteringCharset 'UTF-8'
|
||||||
|
filesMatching('plugin.yml') {
|
||||||
|
expand props
|
||||||
|
}
|
||||||
|
}
|
||||||
5
build/resources/main/config.yml
Normal file
5
build/resources/main/config.yml
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
babyCreepers:
|
||||||
|
enabled: true
|
||||||
|
spawnProbability: 0.1
|
||||||
|
size: 0.5
|
||||||
|
speed: 0.3
|
||||||
7
build/resources/main/plugin.yml
Normal file
7
build/resources/main/plugin.yml
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
name: BabyCreeper
|
||||||
|
version: '1.0-SNAPSHOT'
|
||||||
|
main: eu.mhsl.minecraft.BabyCreeper
|
||||||
|
api-version: '1.21'
|
||||||
|
authors: [ MineTec ]
|
||||||
|
description: Hides Serverlist-Ping information
|
||||||
|
website: mhsl.eu
|
||||||
Binary file not shown.
Binary file not shown.
BIN
build/tmp/compileJava/previous-compilation-data.bin
Normal file
BIN
build/tmp/compileJava/previous-compilation-data.bin
Normal file
Binary file not shown.
2
build/tmp/jar/MANIFEST.MF
Normal file
2
build/tmp/jar/MANIFEST.MF
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
Manifest-Version: 1.0
|
||||||
|
|
||||||
0
gradle.properties
Normal file
0
gradle.properties
Normal file
1
gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
1
gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
|
||||||
1
settings.gradle
Normal file
1
settings.gradle
Normal file
@@ -0,0 +1 @@
|
|||||||
|
rootProject.name = 'BabyCreeper'
|
||||||
30
src/main/java/eu/mhsl/minecraft/BabyCreeper.java
Normal file
30
src/main/java/eu/mhsl/minecraft/BabyCreeper.java
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
package eu.mhsl.minecraft;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.NamespacedKey;
|
||||||
|
import org.bukkit.configuration.ConfigurationSection;
|
||||||
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
public final class BabyCreeper extends JavaPlugin {
|
||||||
|
@NotNull
|
||||||
|
public static final NamespacedKey babyCreeper = NamespacedKey.fromString("babycreeper");
|
||||||
|
|
||||||
|
public static ConfigurationSection config;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onEnable() {
|
||||||
|
saveResource("config.yml", false);
|
||||||
|
reloadConfig();
|
||||||
|
config = getConfig().getConfigurationSection("babyCreepers");
|
||||||
|
if(config == null) throw new IllegalStateException("Could not load config. Root element 'babyCreepers' is missing!");
|
||||||
|
|
||||||
|
if(!config.getBoolean("enabled", true)) return;
|
||||||
|
Bukkit.getPluginManager().registerEvents(new BabyCreeperListener(), this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDisable() {
|
||||||
|
Bukkit.getScheduler().cancelTasks(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
57
src/main/java/eu/mhsl/minecraft/BabyCreeperListener.java
Normal file
57
src/main/java/eu/mhsl/minecraft/BabyCreeperListener.java
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
package eu.mhsl.minecraft;
|
||||||
|
|
||||||
|
import org.bukkit.attribute.Attribute;
|
||||||
|
import org.bukkit.attribute.AttributeInstance;
|
||||||
|
import org.bukkit.entity.Creeper;
|
||||||
|
import org.bukkit.entity.EntityType;
|
||||||
|
import org.bukkit.entity.WindCharge;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.Listener;
|
||||||
|
import org.bukkit.event.entity.CreatureSpawnEvent;
|
||||||
|
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||||
|
import org.bukkit.event.entity.EntityExplodeEvent;
|
||||||
|
import org.bukkit.persistence.PersistentDataType;
|
||||||
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.concurrent.ThreadLocalRandom;
|
||||||
|
|
||||||
|
public class BabyCreeperListener implements Listener {
|
||||||
|
@EventHandler
|
||||||
|
public void onCreeperSpawn(CreatureSpawnEvent event) {
|
||||||
|
if(!event.getEntity().getType().equals(EntityType.CREEPER)) return;
|
||||||
|
// if(ThreadLocalRandom.current().nextDouble() > BabyCreeper.config.getDouble("spawnProbability", 0.1)) return;
|
||||||
|
|
||||||
|
Creeper creeper = (Creeper) event.getEntity();
|
||||||
|
creeper.getPersistentDataContainer().set(BabyCreeper.babyCreeper, PersistentDataType.BOOLEAN, true);
|
||||||
|
AttributeInstance scaleAttribute = Objects.requireNonNull(creeper.getAttribute(Attribute.SCALE), "Could not find scale attribute for Entity");
|
||||||
|
AttributeInstance speedAttribute = Objects.requireNonNull(creeper.getAttribute(Attribute.MOVEMENT_SPEED), "Could not find speed attribute for Entity");
|
||||||
|
scaleAttribute.setBaseValue(BabyCreeper.config.getDouble("size", 0.5));
|
||||||
|
speedAttribute.setBaseValue(BabyCreeper.config.getDouble("speed", 0.5));
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onCreeperExplode(EntityExplodeEvent event) {
|
||||||
|
if(!event.getEntity().getType().equals(EntityType.CREEPER)) return;
|
||||||
|
Creeper creeper = (Creeper) event.getEntity();
|
||||||
|
if(!creeper.getPersistentDataContainer().has(BabyCreeper.babyCreeper, PersistentDataType.BOOLEAN)) return;
|
||||||
|
|
||||||
|
event.setCancelled(true);
|
||||||
|
creeper.getLocation().createExplosion(creeper, 2, false, false);
|
||||||
|
|
||||||
|
// // WindCharge windCharge = creeper.getLocation().getWorld().spawn(creeper.getLocation(), WindCharge.class);
|
||||||
|
// windCharge.setVelocity(new Vector(0, -100, 0));
|
||||||
|
// windCharge.setInvulnerable(true);
|
||||||
|
// windCharge.setGravity(false);
|
||||||
|
// windCharge.setInvisible(true);
|
||||||
|
// windCharge.setVisibleByDefault(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onCreeperDamage(EntityDamageByEntityEvent event) {
|
||||||
|
if(!event.getDamager().getType().equals(EntityType.CREEPER)) return;
|
||||||
|
Creeper creeper = (Creeper) event.getDamager();
|
||||||
|
if(!creeper.getPersistentDataContainer().has(BabyCreeper.babyCreeper, PersistentDataType.BOOLEAN)) return;
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
5
src/main/resources/config.yml
Normal file
5
src/main/resources/config.yml
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
babyCreepers:
|
||||||
|
enabled: true
|
||||||
|
spawnProbability: 0.1
|
||||||
|
size: 0.5
|
||||||
|
speed: 0.3
|
||||||
7
src/main/resources/plugin.yml
Normal file
7
src/main/resources/plugin.yml
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
name: BabyCreeper
|
||||||
|
version: '1.0-SNAPSHOT'
|
||||||
|
main: eu.mhsl.minecraft.BabyCreeper
|
||||||
|
api-version: '1.21'
|
||||||
|
authors: [ MineTec ]
|
||||||
|
description: Hides Serverlist-Ping information
|
||||||
|
website: mhsl.eu
|
||||||
Reference in New Issue
Block a user