Skip to content

Commit

Permalink
Balancing Explosive
Browse files Browse the repository at this point in the history
  • Loading branch information
Flo56958 committed Oct 8, 2023
1 parent 503491e commit f687f82
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ public class ModManager {
incompatibilityList.add(Sharpness.instance().getKey() + ":" + Explosive.instance().getKey());
incompatibilityList.add(Magical.instance().getKey() + ":" + Explosive.instance().getKey());
incompatibilityList.add(Piercing.instance().getKey() + ":" + Explosive.instance().getKey());
incompatibilityList.add(Channeling.instance().getKey() + ":" + Explosive.instance().getKey());

Plugin plugin = Bukkit.getPluginManager().getPlugin("ProtocolLib");
if (plugin != null && plugin.isEnabled()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,11 @@
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.metadata.FixedMetadataValue;
import org.jetbrains.annotations.NotNull;

import java.io.File;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;

public class Explosive extends Modifier implements Listener {

Expand Down Expand Up @@ -57,7 +55,7 @@ public List<ToolType> getAllowedTools() {

@Override
public @NotNull List<Enchantment> getAppliedEnchantments() {
return Arrays.asList(Enchantment.DAMAGE_ALL, Enchantment.ARROW_DAMAGE, Enchantment.IMPALING);
return new ArrayList<>();
}

@Override
Expand All @@ -69,7 +67,7 @@ public void reload() {
config.addDefault("Color", "%RED%");
config.addDefault("MaxLevel", 5);
config.addDefault("SlotCost", 1);
config.addDefault("PowerPerLevel", 1.0);
config.addDefault("PowerPerLevel", 0.33);
config.addDefault("SetFire", false);
config.addDefault("BlockBreak", false);

Expand Down Expand Up @@ -103,6 +101,7 @@ public void reload() {
public void onProjectileHit(final MTProjectileHitEvent event) {
Player p = event.getPlayer();
ItemStack tool = event.getTool();
if (event.getEvent().getEntity().hasMetadata(this.getKey())) return;
if (!modManager.hasMod(tool, this)) return;

final int level = modManager.getModLevel(tool, this);
Expand All @@ -112,6 +111,7 @@ public void onProjectileHit(final MTProjectileHitEvent event) {
final Location loc = event.getEvent().getEntity().getLocation();

loc.getWorld().createExplosion(loc, this.powerPerLevel * level, false, false, p);
event.getEvent().getEntity().setMetadata(this.getKey(), new FixedMetadataValue(MineTinker.getPlugin(), 0));
}

@EventHandler(ignoreCancelled = true)
Expand All @@ -126,7 +126,7 @@ public void onEntityHit(final MTEntityDamageByEntityEvent event) {

if (!p.hasPermission("minetinker.modifiers.explosive.use")) return;

final Location loc = event.getEntity().getLocation();
final Location loc = event.getEntity().getLocation().add(0, 0.2, 0);

loc.getWorld().createExplosion(loc, this.powerPerLevel * level, this.setFire, this.blockBreak, p);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,10 @@ public void reload() {
config.addDefault("Allowed", true);
config.addDefault("Color", "%GOLD%");
config.addDefault("MaxLevel", 5);
config.addDefault("SlotCost", 1);
config.addDefault("SlotCost", 2);
config.addDefault("PercentagePerLevel", 10);

config.addDefault("EnchantCost", 15);
config.addDefault("EnchantCost", 25);
config.addDefault("Enchantable", true);
config.addDefault("MinimumToolLevelRequirement", 1);

Expand All @@ -81,7 +81,8 @@ public void reload() {
conversions.put(EntityType.ZOMBIE, List.of(new Tupel(Material.LEATHER, Material.ROTTEN_FLESH)));
conversions.put(EntityType.ZOMBIE_HORSE, List.of(new Tupel(Material.LEATHER, Material.ROTTEN_FLESH)));
conversions.put(EntityType.ZOMBIE_VILLAGER, List.of(new Tupel(Material.LEATHER, Material.ROTTEN_FLESH)));
conversions.put(EntityType.DROWNED, List.of(new Tupel(Material.LEATHER, Material.ROTTEN_FLESH)));
conversions.put(EntityType.DROWNED, List.of(new Tupel(Material.LEATHER, Material.ROTTEN_FLESH),
new Tupel(Material.NAUTILUS_SHELL, Material.COPPER_INGOT)));
conversions.put(EntityType.HUSK, List.of(new Tupel(Material.LEATHER, Material.ROTTEN_FLESH)));
conversions.put(EntityType.ZOGLIN, List.of(new Tupel(Material.LEATHER, Material.ROTTEN_FLESH)));
conversions.put(EntityType.ZOMBIFIED_PIGLIN, List.of(new Tupel(Material.LEATHER, Material.ROTTEN_FLESH),
Expand All @@ -92,6 +93,10 @@ public void reload() {
conversions.put(EntityType.WITHER_SKELETON, List.of(new Tupel(Material.WITHER_ROSE, Material.COAL)));
conversions.put(EntityType.SHULKER, List.of(new Tupel(Material.SHULKER_BOX, Material.SHULKER_SHELL)));
conversions.put(EntityType.SLIME, List.of(new Tupel(Material.EMERALD, Material.SLIME_BALL)));
conversions.put(EntityType.WITCH, List.of(new Tupel(Material.BLAZE_ROD, Material.STICK),
new Tupel(Material.FERMENTED_SPIDER_EYE, Material.SPIDER_EYE),
new Tupel(Material.BREWING_STAND, Material.GLASS_BOTTLE)));
conversions.put(EntityType.WITHER, List.of(new Tupel(Material.BEACON, Material.NETHER_STAR)));

conversions.forEach((k, v) -> config.addDefault("Conversions." + k.toString(), v.stream().map(Tupel::toString).toList()));
conversions.clear();
Expand Down

0 comments on commit f687f82

Please sign in to comment.