mirror of
https://github.com/songoda/FabledSkyBlock.git
synced 2024-09-16 00:47:34 +02:00
Merge branch 'development'
This commit is contained in:
commit
e2da0d09f0
2
pom.xml
2
pom.xml
@ -5,7 +5,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.songoda</groupId>
|
||||
<artifactId>skyblock</artifactId>
|
||||
<version>2.2.7</version>
|
||||
<version>2.2.8</version>
|
||||
<build>
|
||||
<defaultGoal>clean install</defaultGoal>
|
||||
<finalName>FabledSkyblock-${project.version}</finalName>
|
||||
|
@ -77,7 +77,7 @@ public class RemoveHologramCommand extends SubCommand {
|
||||
Hologram hologram = hologramManager.getHologram(hologramType1);
|
||||
|
||||
if (hologram != null)
|
||||
hologram.remove();
|
||||
hologramManager.removeHologram(hologram);
|
||||
});
|
||||
|
||||
messageManager.sendMessage(sender, configLoad.getString("Command.Island.Admin.RemoveHologram.Removed.Message").replace("%type", hologramType.name()));
|
||||
|
@ -49,15 +49,16 @@ public class SetHologramCommand extends SubCommand {
|
||||
fileManager.getConfig(new File(skyblock.getDataFolder(), "locations.yml")),
|
||||
"Location.Hologram.Leaderboard." + hologramType.name(), player.getLocation(), true);
|
||||
|
||||
HologramType hologramType1 = HologramType
|
||||
.valueOf(WordUtils.capitalize(args[0].toLowerCase()));
|
||||
Hologram hologram = hologramManager.getHologram(hologramType1);
|
||||
|
||||
if (hologram != null)
|
||||
hologram.remove();
|
||||
Bukkit.getServer().getScheduler().runTask(skyblock, () -> {
|
||||
HologramType hologramType1 = HologramType.valueOf(WordUtils.capitalize(args[0].toLowerCase()));
|
||||
Hologram hologram = hologramManager.getHologram(hologramType1);
|
||||
|
||||
Bukkit.getServer().getScheduler().runTaskAsynchronously(skyblock, () ->
|
||||
hologramManager.spawnHologram(hologramType1));
|
||||
if (hologram != null)
|
||||
hologramManager.removeHologram(hologram);
|
||||
|
||||
hologramManager.spawnHologram(hologramType1);
|
||||
});
|
||||
|
||||
messageManager.sendMessage(player,
|
||||
configLoad.getString("Command.Island.Admin.SetHologram.Set.Message").replace("%type",
|
||||
|
@ -9,9 +9,9 @@ import com.songoda.skyblock.hologram.HologramType;
|
||||
import com.songoda.skyblock.island.IslandLevel;
|
||||
import com.songoda.skyblock.leaderboard.Leaderboard;
|
||||
import com.songoda.skyblock.leaderboard.LeaderboardManager;
|
||||
import com.songoda.skyblock.message.MessageManager;
|
||||
import com.songoda.skyblock.utils.NumberUtil;
|
||||
import com.songoda.skyblock.utils.player.OfflinePlayer;
|
||||
import com.songoda.skyblock.utils.world.LocationUtil;
|
||||
import com.songoda.skyblock.visit.Visit;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
@ -63,7 +63,12 @@ public class HologramTask extends BukkitRunnable {
|
||||
}
|
||||
|
||||
public void spawnHologram(HologramType type, Location location, List<String> lines) {
|
||||
hologramStorage.add(new Hologram(type, location, lines));
|
||||
Hologram hologram = hologramStorage.stream()
|
||||
.filter(h -> LocationUtil.isLocationLocation(h.getLocation(), location)).findFirst().orElse(null);
|
||||
if (hologram == null)
|
||||
hologramStorage.add(new Hologram(type, location, lines));
|
||||
else
|
||||
hologram.update(lines);
|
||||
}
|
||||
|
||||
public void spawnHologram(HologramType type) {
|
||||
@ -163,8 +168,13 @@ public class HologramTask extends BukkitRunnable {
|
||||
}
|
||||
|
||||
public void updateHologram() {
|
||||
for (Hologram hologramList : hologramStorage) {
|
||||
for (Hologram hologramList : new ArrayList<>(hologramStorage)) {
|
||||
hologramList.update(getHologramLines(hologramList.getType()));
|
||||
}
|
||||
}
|
||||
|
||||
public void removeHologram(Hologram hologram) {
|
||||
hologramStorage.remove(hologram);
|
||||
hologram.remove();
|
||||
}
|
||||
}
|
||||
|
@ -17,6 +17,7 @@ import java.util.Map;
|
||||
public class BlockData {
|
||||
|
||||
private String material;
|
||||
private String blockData = "";
|
||||
private String biome;
|
||||
private String stateType = BlockStateType.NORMAL.toString();
|
||||
private String dataType = BlockDataType.NORMAL.toString();
|
||||
@ -72,6 +73,15 @@ public class BlockData {
|
||||
this.material = material.name();
|
||||
}
|
||||
|
||||
public String getBlockData() {
|
||||
return blockData;
|
||||
}
|
||||
|
||||
public void setBlockData(String blockData) {
|
||||
this.blockData = blockData;
|
||||
}
|
||||
|
||||
|
||||
public String getBiome() {
|
||||
return this.biome;
|
||||
}
|
||||
|
@ -28,6 +28,10 @@ public final class BlockUtil extends BlockUtils {
|
||||
int NMSVersion = NMSUtil.getVersionNumber();
|
||||
blockData.setVersion(NMSVersion);
|
||||
|
||||
if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_13)) {
|
||||
blockData.setBlockData(block.getBlockData().getAsString());
|
||||
}
|
||||
|
||||
BlockState blockState = block.getState();
|
||||
MaterialData materialData = blockState.getData();
|
||||
|
||||
@ -252,7 +256,10 @@ public final class BlockUtil extends BlockUtils {
|
||||
Material material = Material.valueOf(materialStr);
|
||||
if (material == Material.AIR) return;
|
||||
|
||||
setBlockFast(block.getWorld(), block.getX(), block.getY(), block.getZ(), material, blockData.getData());
|
||||
if (ServerVersion.isServerVersionBelow(ServerVersion.V1_13))
|
||||
setBlockFast(block.getWorld(), block.getX(), block.getY(), block.getZ(), material, blockData.getData());
|
||||
else
|
||||
block.setBlockData(Bukkit.getServer().createBlockData(blockData.getBlockData()));
|
||||
|
||||
// TODO Create a class to support biome changes
|
||||
// block.setBiome(Biome.valueOf(blockData.getBiome().toUpperCase()));
|
||||
@ -417,7 +424,7 @@ public final class BlockUtil extends BlockUtils {
|
||||
state.setData(stairs);
|
||||
} else if (blockDataType == BlockDataType.FLOWERPOT) {
|
||||
setBlockFast(block.getWorld(), block.getX(), block.getY() - 1, block.getZ(), CompatibleMaterial.STONE, (byte) 0);
|
||||
if (NMSVersion >= 8 && NMSVersion <= 12) {
|
||||
if (NMSVersion >= 8 && NMSVersion <= 12) {
|
||||
if (block.getLocation().clone().subtract(0.0D, 1.0D, 0.0D).getBlock().getType() == Material.AIR) {
|
||||
setBlockFast(block.getWorld(), block.getX(), block.getY() - 1, block.getZ(), CompatibleMaterial.STONE, (byte) 0);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user