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);
|
||||
}
|
||||
|
||||
|
||||
@@ -60,12 +60,12 @@ public class ArenaconfigCommand extends SWCommand {
|
||||
YamlConfiguration config = YamlConfiguration.loadConfiguration(file);
|
||||
|
||||
config.set("UnderBorder", lowerPlayerBorder);
|
||||
config.set("BlueCorner.x", pos1.getX());
|
||||
config.set("BlueCorner.y", pos1.getY());
|
||||
config.set("BlueCorner.z", pos1.getZ());
|
||||
config.set("BlueToRed.x", pos2.getX() - pos1.getX());
|
||||
config.set("BlueToRed.y", pos2.getY() - pos1.getY());
|
||||
config.set("BlueToRed.z", pos2.getZ() - pos1.getZ());
|
||||
config.set("BlueCorner.x", pos1.x());
|
||||
config.set("BlueCorner.y", pos1.y());
|
||||
config.set("BlueCorner.z", pos1.z());
|
||||
config.set("BlueToRed.x", pos2.x() - pos1.x());
|
||||
config.set("BlueToRed.y", pos2.y() - pos1.y());
|
||||
config.set("BlueToRed.z", pos2.z() - pos1.z());
|
||||
|
||||
config.save(file);
|
||||
}
|
||||
|
||||
@@ -27,9 +27,9 @@ import de.steamwar.towerrun.config.WorldConfig;
|
||||
import de.steamwar.towerrun.state.GameState;
|
||||
import de.steamwar.towerrun.state.GameStates;
|
||||
import lombok.experimental.UtilityClass;
|
||||
import net.minecraft.world.level.chunk.Chunk;
|
||||
import net.minecraft.world.level.chunk.LevelChunk;
|
||||
import org.bukkit.*;
|
||||
import org.bukkit.craftbukkit.v1_19_R2.CraftWorld;
|
||||
import org.bukkit.craftbukkit.CraftWorld;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Player;
|
||||
@@ -187,10 +187,10 @@ public class TowerRunGame {
|
||||
}
|
||||
|
||||
private static void resetChunk(World backup, int x, int z) {
|
||||
Chunk chunk = ((CraftWorld) world).getHandle().d(x, z);
|
||||
Chunk backupChunk = ((CraftWorld) backup).getHandle().d(x, z);
|
||||
LevelChunk chunk = ((CraftWorld) world).getHandle().getChunk(x, z);
|
||||
LevelChunk backupChunk = ((CraftWorld) backup).getHandle().getChunk(x, z);
|
||||
|
||||
System.arraycopy(backupChunk.d(), 0, chunk.d(), 0, chunk.d().length);
|
||||
System.arraycopy(backupChunk.getSections(), 0, chunk.getSections(), 0, chunk.getSections().length);
|
||||
|
||||
for (Player p : Bukkit.getOnlinePlayers())
|
||||
CraftbukkitWrapper.impl.sendChunk(p, x, z);
|
||||
|
||||
@@ -118,12 +118,12 @@ public class TowerGenerator {
|
||||
ClipboardHolder ch = new ClipboardHolder(clipboard);
|
||||
Operations.completeBlindly(ch.createPaste(e).to(BlockVector3.at(config.x, y, config.z)).build());
|
||||
}
|
||||
width = clipboard.getDimensions().getX();
|
||||
depth = clipboard.getDimensions().getZ();
|
||||
width = clipboard.getDimensions().x();
|
||||
depth = clipboard.getDimensions().z();
|
||||
currentY = y;
|
||||
y += clipboard.getDimensions().getY();
|
||||
height -= clipboard.getDimensions().getY();
|
||||
TowerGenerator.this.height += clipboard.getDimensions().getY();
|
||||
y += clipboard.getDimensions().y();
|
||||
height -= clipboard.getDimensions().y();
|
||||
TowerGenerator.this.height += clipboard.getDimensions().y();
|
||||
} catch (IOException e) {
|
||||
allSchematics.remove(schematicNode);
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user