mirror of
https://github.com/songoda/UltimateStacker.git
synced 2024-11-27 04:25:21 +01:00
Updated to latest SongodaCore.
This commit is contained in:
parent
ff82b1d8f8
commit
e9e052871e
2
pom.xml
2
pom.xml
@ -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>
|
||||
|
@ -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 //////////
|
||||
|
@ -11,4 +11,6 @@ public interface Hologramable {
|
||||
boolean areHologramsEnabled();
|
||||
|
||||
boolean isValid();
|
||||
|
||||
String getHologramId();
|
||||
}
|
||||
|
@ -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{" +
|
||||
|
@ -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:{"
|
||||
|
Loading…
Reference in New Issue
Block a user