Updated to latest SongodaCore.

This commit is contained in:
Fernando Pettinelli 2021-12-22 19:11:16 -03:00
parent ff82b1d8f8
commit e9e052871e
5 changed files with 34 additions and 4 deletions

View File

@ -125,7 +125,7 @@
<dependency>
<groupId>com.songoda</groupId>
<artifactId>SongodaCore</artifactId>
<version>LATEST</version>
<version>2.6.10</version>
<scope>compile</scope>
</dependency>
<dependency>

View File

@ -367,12 +367,17 @@ public class UltimateStacker extends SongodaPlugin {
spawnerStackManager.removeSpawner(stack.getLocation());
// are holograms enabled?
if (!stack.areHologramsEnabled() && !HologramManager.getManager().isEnabled()) return;
// create the hologram
HologramManager.updateHologram(stack.getLocation(), stack.getHologramName());
// update the hologram
if (!HologramManager.isHologramLoaded(stack.getHologramId())) {
HologramManager.createHologram(stack.getHologramId(), stack.getLocation(), stack.getHologramName());
return;
}
HologramManager.updateHologram(stack.getHologramId(), stack.getHologramName());
}
public void removeHologram(Hologramable stack) {
HologramManager.removeHologram(stack.getLocation());
HologramManager.removeHologram(stack.getHologramId());
}
//////// Convenient API //////////

View File

@ -11,4 +11,6 @@ public interface Hologramable {
boolean areHologramsEnabled();
boolean isValid();
String getHologramId();
}

View File

@ -10,8 +10,15 @@ import com.songoda.ultimatestacker.utils.Stackable;
import org.bukkit.Location;
import org.bukkit.World;
import java.util.UUID;
public class BlockStack implements Stackable, Hologramable {
// This is the unique identifier for this stack.
// It is reset on every plugin load.
// Used for holograms.
private final UUID uniqueId = UUID.randomUUID();
// The id that identifies this stack in the database.
private int id;
@ -105,6 +112,11 @@ public class BlockStack implements Stackable, Hologramable {
this.id = id;
}
@Override
public String getHologramId() {
return "UltimateStacker-" + uniqueId;
}
@Override
public String toString() {
return "BlockStack{" +

View File

@ -12,9 +12,15 @@ import org.bukkit.World;
import org.bukkit.block.CreatureSpawner;
import java.util.Random;
import java.util.UUID;
public class SpawnerStack extends SSpawner implements Stackable, Hologramable {
// This is the unique identifier for this spawner.
// It is reset on every plugin load.
// Used for holograms.
private final UUID uniqueId = UUID.randomUUID();
private int id;
private int amount;
@ -93,6 +99,11 @@ public class SpawnerStack extends SSpawner implements Stackable, Hologramable {
return location.getWorld();
}
@Override
public String getHologramId() {
return "UltimateStacker-" + uniqueId;
}
@Override
public String toString() {
return "SpawnerStack:{"