mirror of
https://github.com/songoda/FabledSkyBlock.git
synced 2024-11-25 11:46:54 +01:00
Updates to Core v2.6.12 (MC1.18.2) + new hologram api implementation
This commit is contained in:
parent
d53e0939d5
commit
e5e136b7d3
4
pom.xml
4
pom.xml
@ -6,7 +6,7 @@
|
||||
|
||||
<groupId>com.songoda</groupId>
|
||||
<artifactId>skyblock</artifactId>
|
||||
<version>2.4.0</version>
|
||||
<version>2.4.1-DEV</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<properties>
|
||||
@ -207,7 +207,7 @@
|
||||
<dependency>
|
||||
<groupId>com.songoda</groupId>
|
||||
<artifactId>SongodaCore</artifactId>
|
||||
<version>2.6.5</version>
|
||||
<version>2.6.12</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
|
@ -6,18 +6,22 @@ import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
public class Hologram {
|
||||
private final String hologramId;
|
||||
|
||||
private final HologramType type;
|
||||
private final Location location;
|
||||
|
||||
public Hologram(HologramType type, Location location, List<String> lines) {
|
||||
this.hologramId = location.toString() + UUID.randomUUID();
|
||||
|
||||
this.type = type;
|
||||
this.location = location;
|
||||
|
||||
Bukkit.getScheduler().runTask(SkyBlock.getInstance(),
|
||||
() -> HologramManager.createHologram(location, lines));
|
||||
() -> HologramManager.createHologram(hologramId, location, lines));
|
||||
}
|
||||
|
||||
public HologramType getType() {
|
||||
@ -30,14 +34,19 @@ public class Hologram {
|
||||
}
|
||||
|
||||
public void remove() {
|
||||
HologramManager.removeHologram(location);
|
||||
Bukkit.getScheduler().runTask(SkyBlock.getInstance(),
|
||||
() -> HologramManager.removeHologram(location));
|
||||
HologramManager.removeHologram(hologramId);
|
||||
Bukkit.getScheduler().runTask(SkyBlock.getInstance(), () -> HologramManager.removeHologram(hologramId));
|
||||
}
|
||||
|
||||
public void update(List<String> lines) {
|
||||
Bukkit.getScheduler().runTask(SkyBlock.getInstance(),
|
||||
() -> HologramManager.updateHologram(location, lines));
|
||||
Bukkit.getScheduler().runTask(SkyBlock.getInstance(), () -> {
|
||||
if (HologramManager.isHologramLoaded(hologramId)) {
|
||||
HologramManager.updateHologram(hologramId, lines);
|
||||
return;
|
||||
}
|
||||
|
||||
HologramManager.createHologram(hologramId, location, lines);
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -7,7 +7,12 @@ import com.songoda.core.utils.NMSUtils;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.io.*;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.DataInput;
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutput;
|
||||
import java.io.DataOutputStream;
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.math.BigInteger;
|
||||
|
||||
|
@ -6,8 +6,32 @@ import com.songoda.core.compatibility.ServerVersion;
|
||||
import com.songoda.core.utils.BlockUtils;
|
||||
import com.songoda.core.utils.NMSUtils;
|
||||
import com.songoda.skyblock.utils.item.ItemStackUtil;
|
||||
import org.bukkit.*;
|
||||
import org.bukkit.block.*;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.DyeColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.SkullType;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Banner;
|
||||
import org.bukkit.block.Barrel;
|
||||
import org.bukkit.block.Beacon;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.block.BrewingStand;
|
||||
import org.bukkit.block.Chest;
|
||||
import org.bukkit.block.CommandBlock;
|
||||
import org.bukkit.block.CreatureSpawner;
|
||||
import org.bukkit.block.Dispenser;
|
||||
import org.bukkit.block.Dropper;
|
||||
import org.bukkit.block.EndGateway;
|
||||
import org.bukkit.block.Furnace;
|
||||
import org.bukkit.block.Hopper;
|
||||
import org.bukkit.block.Jukebox;
|
||||
import org.bukkit.block.ShulkerBox;
|
||||
import org.bukkit.block.Sign;
|
||||
import org.bukkit.block.Skull;
|
||||
import org.bukkit.block.banner.Pattern;
|
||||
import org.bukkit.block.banner.PatternType;
|
||||
import org.bukkit.block.data.type.RespawnAnchor;
|
||||
@ -227,7 +251,7 @@ public final class BlockUtil extends BlockUtils {
|
||||
try {
|
||||
World world = block.getWorld();
|
||||
|
||||
Class<?> blockPositionClass = ClassMapping.BLOCK_POSITION.getClazz();;
|
||||
Class<?> blockPositionClass = ClassMapping.BLOCK_POSITION.getClazz();
|
||||
|
||||
Object worldHandle = world.getClass().getMethod("getHandle").invoke(world);
|
||||
Object blockPosition = blockPositionClass.getConstructor(int.class, int.class, int.class).newInstance(block.getX(), block.getY(), block.getZ());
|
||||
|
Loading…
Reference in New Issue
Block a user