added armadilloExpFarm tweaks
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
package eu.mhsl.craftattack.spawn.craftattack.appliances.tweaks.armadilloInfectionReducer;
|
||||
|
||||
import eu.mhsl.craftattack.spawn.core.appliance.Appliance;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ArmadilloInfectionReducer extends Appliance {
|
||||
@Override
|
||||
protected @NotNull List<Listener> listeners() {
|
||||
return List.of(
|
||||
new InfectionSpawnListener()
|
||||
);
|
||||
}
|
||||
}
|
@@ -0,0 +1,17 @@
|
||||
package eu.mhsl.craftattack.spawn.craftattack.appliances.tweaks.armadilloInfectionReducer;
|
||||
|
||||
import eu.mhsl.craftattack.spawn.core.appliance.ApplianceListener;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.entity.CreatureSpawnEvent;
|
||||
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
|
||||
class InfectionSpawnListener extends ApplianceListener<ArmadilloInfectionReducer> {
|
||||
@EventHandler
|
||||
public void onSpawn(CreatureSpawnEvent event) {
|
||||
if(!event.getSpawnReason().equals(CreatureSpawnEvent.SpawnReason.POTION_EFFECT)) return;
|
||||
if(!event.getEntity().getType().equals(EntityType.SILVERFISH)) return;
|
||||
if(ThreadLocalRandom.current().nextDouble() > 0.7) event.setCancelled(true);
|
||||
}
|
||||
}
|
@@ -0,0 +1,14 @@
|
||||
package eu.mhsl.craftattack.spawn.craftattack.appliances.tweaks.silverfishExpReducer;
|
||||
|
||||
import eu.mhsl.craftattack.spawn.core.appliance.ApplianceListener;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.entity.EntityDeathEvent;
|
||||
|
||||
class SilverfishDeathListener extends ApplianceListener<SilverfishExpReducer> {
|
||||
@EventHandler
|
||||
public void onDeath(EntityDeathEvent event) {
|
||||
if(!event.getEntity().getType().equals(EntityType.SILVERFISH)) return;
|
||||
event.setDroppedExp(event.getDroppedExp() / 3);
|
||||
}
|
||||
}
|
@@ -0,0 +1,16 @@
|
||||
package eu.mhsl.craftattack.spawn.craftattack.appliances.tweaks.silverfishExpReducer;
|
||||
|
||||
import eu.mhsl.craftattack.spawn.core.appliance.Appliance;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class SilverfishExpReducer extends Appliance {
|
||||
@Override
|
||||
public @NotNull List<Listener> listeners() {
|
||||
return List.of(
|
||||
new SilverfishDeathListener()
|
||||
);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user