reduce chance

This commit is contained in:
okx-code
2024-07-15 20:17:30 +01:00
parent da0e3eedbb
commit 2b16c0448d
3 changed files with 57 additions and 9 deletions

View File

@@ -136,7 +136,7 @@ hacks:
- '["",{"text":"[CivMC] ","color":"gold"},{"text":"Make sure to reinforce your buildings/chests to protect them from others. Click for more info","color":"green","clickEvent":{"action":"open_url","value":"https://wiki.civmc.net/pages/plugins/essential/citadel"}}]'
- '["",{"text":"[CivMC] ","color":"gold"},{"text":"Jukeboxes and Noteblocks act as CCTV, when reinforced they record player actions. Click for more info","color":"green","clickEvent":{"action":"open_url","value":"https://wiki.civmc.net/pages/plugins/unique/jukealert"}}]'
- '["",{"text":"[CivMC] ","color":"gold"},{"text":"Killing someone with an ender pearl in your hotbar will lock them in the nether! Player essence is used to keep the players trapped. Click for more info","color":"green","clickEvent":{"action":"open_url","value":"https://wiki.civmc.net/pages/plugins/essential/exilepearl"}}]'
ElytraFeatures:
enabled: false
# Whether Elytra flight should be outright disabled
@@ -465,12 +465,12 @@ hacks:
- org.bukkit.event.weather
- org.bukkit.event.world
Introbook:
enabled: true
enabled: true
follow: true
contents:
title: Welcome ${player}!
author: RedDevel
pages:
pages:
- "&5 Welcome &2${player}!\n &5to CivMC!&r\n\nThis book will guide your first steps!\nIf you die or lose it you can open it via the /introbook command\n\nLet's begin your journey!"
- "You've just spawned near another player or town, say something in chat!\n\nIf nobody responds try out global chat instead by using the /global command!\n\nMany nations will want a potential new productive member.\nTake your pick!"
- "Maybe you've joined at a time of lower activity, and nobody is responding.\n\nThen you can join the official discord and take your pick of the nation ads there!\n\n &9discord.gg/\n HkD79GfmQQ&r"
@@ -492,14 +492,14 @@ hacks:
announce: '&f%Player% is brand new!'
giveIntroKitToRandomSpawners: false
broadcast: [CONSOLE, ALL]
helptips: on
helptips: on
helptips_end: 20m
introkit:
introkit:
enabled: true
contents:
contents:
- ==: org.bukkit.inventory.ItemStack
type: COOKIE
amount: 32
amount: 32
meta:
==: ItemMeta
meta-type: UNSPECIFIC
@@ -508,7 +508,7 @@ hacks:
- "begin your journey on CivMC"
- ==: org.bukkit.inventory.ItemStack
type: BED
amount: 1
amount: 1
meta:
==: ItemMeta
meta-type: UNSPECIFIC
@@ -534,7 +534,7 @@ hacks:
- "This will help you"
- "get on track."
ReinforcedChestBreak:
enabled: true
enabled: true
# in seconds
delay: 180
message: "&4%player% is raiding a chest at %x% %y% %z%."
@@ -597,3 +597,6 @@ hacks:
maxSpeed: 0.438827582278 # 18.5m/s
AntiDerailment:
enabled: true
CreeperDiscHack:
enabled: true
discChance: 0.003

View File

@@ -0,0 +1,42 @@
package com.programmerdan.minecraft.simpleadminhacks.hacks;
import com.destroystokyo.paper.MaterialTags;
import com.programmerdan.minecraft.simpleadminhacks.SimpleAdminHacks;
import com.programmerdan.minecraft.simpleadminhacks.framework.BasicHack;
import com.programmerdan.minecraft.simpleadminhacks.framework.BasicHackConfig;
import com.programmerdan.minecraft.simpleadminhacks.framework.autoload.AutoLoad;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Ageable;
import org.bukkit.entity.Creeper;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.EntityDeathEvent;
import org.bukkit.inventory.ItemStack;
import vg.civcraft.mc.civmodcore.inventory.items.SpawnEggUtils;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ThreadLocalRandom;
public class CreeperDiscHack extends BasicHack {
@AutoLoad
private double discChance;
public CreeperDiscHack(SimpleAdminHacks plugin, BasicHackConfig config) {
super(plugin, config);
}
@EventHandler
public void onEntityDeath(EntityDeathEvent event) {
if (!(event.getEntity() instanceof Creeper entity)) {
return;
}
List<ItemStack> drops = event.getDrops();
drops.removeIf(drop -> MaterialTags.MUSIC_DISCS.isTagged(drop)
&& ThreadLocalRandom.current().nextDouble() >= discChance);
}
}

View File

@@ -546,3 +546,6 @@ hacks:
maxSpeed: 0.438827582278 # 18.5m/s
AntiDerailment:
enabled: true
CreeperDiscHack:
enabled: true
discChance: 0.003