forked from SteamWar/SteamWar
Refactor to simplify API usage and improve compatibility by replacing legacy methods and adapting to updated libraries.
Signed-off-by: Chaoscaot <max@maxsp.de>
This commit is contained in:
@@ -39,10 +39,10 @@ public class MWTeam {
|
||||
|
||||
static {
|
||||
ItemMeta bowMeta = Objects.requireNonNull(bow.getItemMeta());
|
||||
bowMeta.addEnchant(Enchantment.ARROW_FIRE, 1, true);
|
||||
bowMeta.addEnchant(Enchantment.ARROW_KNOCKBACK, 1, true);
|
||||
bowMeta.addEnchant(Enchantment.FLAME, 1, true);
|
||||
bowMeta.addEnchant(Enchantment.PUNCH, 1, true);
|
||||
bowMeta.addEnchant(Enchantment.KNOCKBACK, 1, true);
|
||||
bowMeta.addEnchant(Enchantment.DAMAGE_ALL, 2, true);
|
||||
bowMeta.addEnchant(Enchantment.POWER, 2, true);
|
||||
bowMeta.setUnbreakable(true);
|
||||
bow.setItemMeta(bowMeta);
|
||||
}
|
||||
|
||||
@@ -107,7 +107,7 @@ public class Missile extends SpecialItem {
|
||||
else if (yaw > 135 && yaw <= 225) aT = aT.rotateY(180);
|
||||
else if (yaw > 225 && yaw <= 315) aT = aT.rotateY(90);
|
||||
|
||||
v = v.subtract(dimensions.getX()/2, dimensions.getY() + 2, -2).subtract(offset);
|
||||
v = v.subtract(dimensions.x()/2, dimensions.y() + 2, -2).subtract(offset);
|
||||
v = aT.apply(v.toVector3()).toBlockPoint();
|
||||
v = v.add(location.getBlockX(), location.getBlockY(), location.getBlockZ());
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ public class SpaceListener extends BasicListener {
|
||||
if (!Config.Space) return;
|
||||
Bukkit.getScheduler().runTaskLater(MissileWars.getPlugin(), () -> {
|
||||
Player player = event.getPlayer();
|
||||
player.addPotionEffect(new PotionEffect(PotionEffectType.JUMP, Integer.MAX_VALUE, 3));
|
||||
player.addPotionEffect(new PotionEffect(PotionEffectType.JUMP_BOOST, Integer.MAX_VALUE, 3));
|
||||
player.addPotionEffect(new PotionEffect(PotionEffectType.SLOW_FALLING, Integer.MAX_VALUE, 3));
|
||||
player.setHealth(0.5);
|
||||
player.setHealthScale(0.5);
|
||||
@@ -61,7 +61,7 @@ public class SpaceListener extends BasicListener {
|
||||
if (!Config.Space) return;
|
||||
Bukkit.getScheduler().runTaskLater(MissileWars.getPlugin(), () -> {
|
||||
Player player = event.getPlayer();
|
||||
player.addPotionEffect(new PotionEffect(PotionEffectType.JUMP, Integer.MAX_VALUE, 3));
|
||||
player.addPotionEffect(new PotionEffect(PotionEffectType.JUMP_BOOST, Integer.MAX_VALUE, 3));
|
||||
player.addPotionEffect(new PotionEffect(PotionEffectType.SLOW_FALLING, Integer.MAX_VALUE, 3));
|
||||
player.setHealth(0.5);
|
||||
player.setHealthScale(0.5);
|
||||
|
||||
@@ -23,6 +23,8 @@ import com.google.gson.JsonObject;
|
||||
import de.steamwar.misslewars.scripts.RunnableScript;
|
||||
import de.steamwar.misslewars.scripts.RunnableScriptEvent;
|
||||
import de.steamwar.misslewars.scripts.ScriptedItem;
|
||||
import net.kyori.adventure.key.Key;
|
||||
import org.bukkit.Registry;
|
||||
import org.bukkit.Sound;
|
||||
|
||||
import static de.steamwar.misslewars.scripts.utils.JsonUtils.getFloat;
|
||||
@@ -35,7 +37,7 @@ public class SoundScript implements RunnableScript {
|
||||
private float pitch;
|
||||
|
||||
public SoundScript(JsonObject sound) {
|
||||
getString(sound, "sound", value -> this.sound = Sound.valueOf(value));
|
||||
getString(sound, "sound", value -> this.sound = Registry.SOUNDS.get(Key.key("minecraft", value)));
|
||||
volume = getFloat(sound, "volume", 100);
|
||||
pitch = getFloat(sound, "pitch", 1);
|
||||
}
|
||||
|
||||
@@ -38,7 +38,6 @@ public class EntityUtils {
|
||||
}
|
||||
|
||||
public static void setProjectileOptions(Projectile projectile, JsonObject jsonObject) {
|
||||
getBoolean(jsonObject, "bounce", projectile::setBounce);
|
||||
setEntityOptions(projectile, jsonObject);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user