Added alchemy talisman/ring/relic
This commit is contained in:
@@ -5,6 +5,7 @@ import com.google.common.collect.BiMap;
|
||||
import com.google.common.collect.HashBiMap;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.willfp.eco.util.config.updating.annotations.ConfigUpdater;
|
||||
import com.willfp.talismans.talismans.talismans.relic.AlchemyRelic;
|
||||
import com.willfp.talismans.talismans.talismans.relic.ArcheryRelic;
|
||||
import com.willfp.talismans.talismans.talismans.relic.EndRelic;
|
||||
import com.willfp.talismans.talismans.talismans.relic.ExperienceRelic;
|
||||
@@ -17,6 +18,7 @@ import com.willfp.talismans.talismans.talismans.relic.RaidRelic;
|
||||
import com.willfp.talismans.talismans.talismans.relic.ResistanceRelic;
|
||||
import com.willfp.talismans.talismans.talismans.relic.SharpnessRelic;
|
||||
import com.willfp.talismans.talismans.talismans.relic.StrengthRelic;
|
||||
import com.willfp.talismans.talismans.talismans.ring.AlchemyRing;
|
||||
import com.willfp.talismans.talismans.talismans.ring.ArcheryRing;
|
||||
import com.willfp.talismans.talismans.talismans.ring.EndRing;
|
||||
import com.willfp.talismans.talismans.talismans.ring.ExperienceRing;
|
||||
@@ -29,6 +31,7 @@ import com.willfp.talismans.talismans.talismans.ring.RaidRing;
|
||||
import com.willfp.talismans.talismans.talismans.ring.ResistanceRing;
|
||||
import com.willfp.talismans.talismans.talismans.ring.SharpnessRing;
|
||||
import com.willfp.talismans.talismans.talismans.ring.StrengthRing;
|
||||
import com.willfp.talismans.talismans.talismans.talisman.AlchemyTalisman;
|
||||
import com.willfp.talismans.talismans.talismans.talisman.ArcheryTalisman;
|
||||
import com.willfp.talismans.talismans.talismans.talisman.CreeperTalisman;
|
||||
import com.willfp.talismans.talismans.talismans.talisman.EndTalisman;
|
||||
@@ -107,6 +110,9 @@ public class Talismans {
|
||||
public static final Talisman STRENGTH_RELIC = new StrengthRelic();
|
||||
public static final Talisman RAID_RING = new RaidRing();
|
||||
public static final Talisman RAID_RELIC = new RaidRelic();
|
||||
public static final Talisman ALCHEMY_TALISMAN = new AlchemyTalisman();
|
||||
public static final Talisman ALCHEMY_RING = new AlchemyRing();
|
||||
public static final Talisman ALCHEMY_RELIC = new AlchemyRelic();
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
package com.willfp.talismans.talismans.talismans.relic;
|
||||
|
||||
import com.willfp.talismans.talismans.Talisman;
|
||||
import com.willfp.talismans.talismans.meta.TalismanStrength;
|
||||
import com.willfp.talismans.talismans.util.TalismanChecks;
|
||||
import com.willfp.talismans.talismans.util.TalismanUtils;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.entity.EntityPotionEffectEvent;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class AlchemyRelic extends Talisman {
|
||||
public AlchemyRelic() {
|
||||
super("alchemy_relic", TalismanStrength.TALISMAN);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPotionEffect(@NotNull final EntityPotionEffectEvent event) {
|
||||
if (event.getNewEffect() == null) {
|
||||
return;
|
||||
}
|
||||
if (!(event.getEntity() instanceof Player)) {
|
||||
return;
|
||||
}
|
||||
|
||||
Player player = (Player) event.getEntity();
|
||||
|
||||
if (player.hasMetadata(event.getNewEffect().toString())) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!TalismanChecks.hasTalisman(player, this)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!TalismanUtils.passedChance(this)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.getDisabledWorlds().contains(player.getWorld())) {
|
||||
return;
|
||||
}
|
||||
|
||||
PotionEffect effect = event.getNewEffect();
|
||||
|
||||
PotionEffect newEffect = new PotionEffect(
|
||||
effect.getType(),
|
||||
effect.getDuration(),
|
||||
((effect.getAmplifier() + 1) * 2) - 1,
|
||||
effect.isAmbient(),
|
||||
effect.hasParticles(),
|
||||
effect.hasIcon()
|
||||
);
|
||||
|
||||
player.setMetadata(newEffect.toString(), this.getPlugin().getMetadataValueFactory().create(true));
|
||||
|
||||
player.removePotionEffect(effect.getType());
|
||||
|
||||
this.getPlugin().getScheduler().run(() -> newEffect.apply(player));
|
||||
|
||||
this.getPlugin().getScheduler().runLater(() -> player.removeMetadata(newEffect.toString(), this.getPlugin()), 1);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
package com.willfp.talismans.talismans.talismans.ring;
|
||||
|
||||
import com.willfp.talismans.talismans.Talisman;
|
||||
import com.willfp.talismans.talismans.meta.TalismanStrength;
|
||||
import com.willfp.talismans.talismans.util.TalismanChecks;
|
||||
import com.willfp.talismans.talismans.util.TalismanUtils;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.entity.EntityPotionEffectEvent;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class AlchemyRing extends Talisman {
|
||||
public AlchemyRing() {
|
||||
super("alchemy_ring", TalismanStrength.TALISMAN);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPotionEffect(@NotNull final EntityPotionEffectEvent event) {
|
||||
if (event.getNewEffect() == null) {
|
||||
return;
|
||||
}
|
||||
if (!(event.getEntity() instanceof Player)) {
|
||||
return;
|
||||
}
|
||||
|
||||
Player player = (Player) event.getEntity();
|
||||
|
||||
if (player.hasMetadata(event.getNewEffect().toString())) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!TalismanChecks.hasTalisman(player, this)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!TalismanUtils.passedChance(this)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.getDisabledWorlds().contains(player.getWorld())) {
|
||||
return;
|
||||
}
|
||||
|
||||
PotionEffect effect = event.getNewEffect();
|
||||
|
||||
PotionEffect newEffect = new PotionEffect(
|
||||
effect.getType(),
|
||||
effect.getDuration(),
|
||||
((effect.getAmplifier() + 1) * 2) - 1,
|
||||
effect.isAmbient(),
|
||||
effect.hasParticles(),
|
||||
effect.hasIcon()
|
||||
);
|
||||
|
||||
player.setMetadata(newEffect.toString(), this.getPlugin().getMetadataValueFactory().create(true));
|
||||
|
||||
player.removePotionEffect(effect.getType());
|
||||
|
||||
this.getPlugin().getScheduler().run(() -> newEffect.apply(player));
|
||||
|
||||
this.getPlugin().getScheduler().runLater(() -> player.removeMetadata(newEffect.toString(), this.getPlugin()), 1);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
package com.willfp.talismans.talismans.talismans.talisman;
|
||||
|
||||
import com.willfp.talismans.talismans.Talisman;
|
||||
import com.willfp.talismans.talismans.meta.TalismanStrength;
|
||||
import com.willfp.talismans.talismans.util.TalismanChecks;
|
||||
import com.willfp.talismans.talismans.util.TalismanUtils;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.entity.EntityPotionEffectEvent;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class AlchemyTalisman extends Talisman {
|
||||
public AlchemyTalisman() {
|
||||
super("alchemy_talisman", TalismanStrength.TALISMAN);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPotionEffect(@NotNull final EntityPotionEffectEvent event) {
|
||||
if (event.getNewEffect() == null) {
|
||||
return;
|
||||
}
|
||||
if (!(event.getEntity() instanceof Player)) {
|
||||
return;
|
||||
}
|
||||
|
||||
Player player = (Player) event.getEntity();
|
||||
|
||||
if (player.hasMetadata(event.getNewEffect().toString())) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!TalismanChecks.hasTalisman(player, this)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!TalismanUtils.passedChance(this)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.getDisabledWorlds().contains(player.getWorld())) {
|
||||
return;
|
||||
}
|
||||
|
||||
PotionEffect effect = event.getNewEffect();
|
||||
|
||||
PotionEffect newEffect = new PotionEffect(
|
||||
effect.getType(),
|
||||
effect.getDuration(),
|
||||
((effect.getAmplifier() + 1) * 2) - 1,
|
||||
effect.isAmbient(),
|
||||
effect.hasParticles(),
|
||||
effect.hasIcon()
|
||||
);
|
||||
|
||||
player.setMetadata(newEffect.toString(), this.getPlugin().getMetadataValueFactory().create(true));
|
||||
|
||||
player.removePotionEffect(effect.getType());
|
||||
|
||||
this.getPlugin().getScheduler().run(() -> newEffect.apply(player));
|
||||
|
||||
this.getPlugin().getScheduler().runLater(() -> player.removeMetadata(newEffect.toString(), this.getPlugin()), 1);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
name: "Alchemy Relic"
|
||||
description: 10% chance double the strength of applied potion effects.
|
||||
enabled: true
|
||||
|
||||
obtaining:
|
||||
# Recipes are left-right, top-bottom
|
||||
# The first item is the top left, the second is top middle, and so on. The last is bottom right.
|
||||
recipe:
|
||||
- talisman:alchemy_ring
|
||||
- talisman:alchemy_ring
|
||||
- talisman:alchemy_ring
|
||||
|
||||
- talisman:alchemy_ring
|
||||
- nether_star
|
||||
- talisman:alchemy_ring
|
||||
|
||||
- talisman:alchemy_ring
|
||||
- talisman:alchemy_ring
|
||||
- talisman:alchemy_ring
|
||||
|
||||
general-config:
|
||||
disabled-in-worlds: []
|
||||
# Texture is base64, https://minecraft-heads.com has a list of skulls.
|
||||
texture: eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvNDMwOTNhNWI3NzY0MmQ0MDkyMTEyZjQ2ZWE2ODE0MGZiNWFlMDRiYmQyMzFjZGExMDY2YTA0YzE4Yjg5Yzk0ZSJ9fX0=
|
||||
|
||||
config:
|
||||
chance: 10
|
||||
@@ -0,0 +1,27 @@
|
||||
name: "Alchemy Ring"
|
||||
description: 5% chance double the strength of applied potion effects.
|
||||
enabled: true
|
||||
|
||||
obtaining:
|
||||
# Recipes are left-right, top-bottom
|
||||
# The first item is the top left, the second is top middle, and so on. The last is bottom right.
|
||||
recipe:
|
||||
- talisman:alchemy_talisman
|
||||
- talisman:alchemy_talisman
|
||||
- talisman:alchemy_talisman
|
||||
|
||||
- talisman:alchemy_talisman
|
||||
- heart_of_the_sea
|
||||
- talisman:alchemy_talisman
|
||||
|
||||
- talisman:alchemy_talisman
|
||||
- talisman:alchemy_talisman
|
||||
- talisman:alchemy_talisman
|
||||
|
||||
general-config:
|
||||
disabled-in-worlds: []
|
||||
# Texture is base64, https://minecraft-heads.com has a list of skulls.
|
||||
texture: eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvYjZkNzljMDI2ODc0Nzk0MWRmOWEyYTQ1MTAzY2JkNzMxZmRlZGNiYTU4OGY2NDNiNjcwZmQ3N2FhMmJkOTE4YyJ9fX0=
|
||||
|
||||
config:
|
||||
chance: 5
|
||||
@@ -0,0 +1,27 @@
|
||||
name: "Alchemy Talisman"
|
||||
description: 2.5% chance double the strength of applied potion effects.
|
||||
enabled: true
|
||||
|
||||
obtaining:
|
||||
# Recipes are left-right, top-bottom
|
||||
# The first item is the top left, the second is top middle, and so on. The last is bottom right.
|
||||
recipe:
|
||||
- nether_wart
|
||||
- nether_wart
|
||||
- nether_wart
|
||||
|
||||
- nether_wart
|
||||
- ender_eye
|
||||
- nether_wart
|
||||
|
||||
- nether_wart
|
||||
- nether_wart
|
||||
- nether_wart
|
||||
|
||||
general-config:
|
||||
disabled-in-worlds: []
|
||||
# Texture is base64, https://minecraft-heads.com has a list of skulls.
|
||||
texture: eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvMTExYTNjZWM3YWFmOTA0MjEyY2NmOTNiYjY3YTNjYWYzZDY0OTc4M2JhOTBiOGI2MGJiNjNjNzY4N2ViMzlmIn19fQ==
|
||||
|
||||
config:
|
||||
chance: 2.5
|
||||
Reference in New Issue
Block a user