Merge branch 'development'

This commit is contained in:
Christian Koop 2022-01-17 13:54:29 +01:00
commit ecf2ee3f48
No known key found for this signature in database
GPG Key ID: 89A8181384E010A3
6 changed files with 46 additions and 14 deletions

BIN
.DS_Store vendored

Binary file not shown.

24
pom.xml
View File

@ -2,7 +2,7 @@
<groupId>com.songoda</groupId>
<artifactId>UltimateStacker</artifactId>
<modelVersion>4.0.0</modelVersion>
<version>2.1.8</version>
<version>2.2.0</version>
<build>
<defaultGoal>clean install</defaultGoal>
<finalName>UltimateStacker-${project.version}</finalName>
@ -101,29 +101,31 @@
</pluginRepositories>
<repositories>
<repository>
<id>public</id>
<url>http://repo.songoda.com/repository/public/</url>
<id>songoda-public</id>
<url>https://repo.songoda.com/repository/public/</url>
</repository>
<repository>
<id>spigotmc-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
<repository>
<id>CodeMC</id>
<url>https://repo.codemc.org/repository/maven-public</url>
</repository>
<repository>
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
<url>https://repo.codemc.org/repository/maven-public/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>1.17</version>
<artifactId>spigot-api</artifactId>
<version>1.18-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<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:{"