mirror of
https://github.com/BG-Software-LLC/WildLoaders.git
synced 2024-11-21 11:46:46 +01:00
Added infinite chunk loaders
This commit is contained in:
parent
e0f523d47a
commit
2946a98884
@ -14,6 +14,11 @@ public interface LoaderData {
|
||||
*/
|
||||
long getTimeLeft();
|
||||
|
||||
/**
|
||||
* Whether or not the chunk loader is infinite.
|
||||
*/
|
||||
boolean isInfinite();
|
||||
|
||||
/**
|
||||
* Get the drop item of the chunk loader, with default time.
|
||||
*/
|
||||
|
@ -17,6 +17,7 @@ import java.util.stream.Collectors;
|
||||
public final class SettingsHandler {
|
||||
|
||||
public List<String> hologramLines;
|
||||
public List<String> infiniteHologramLines;
|
||||
|
||||
public SettingsHandler(WildLoadersPlugin plugin){
|
||||
WildLoadersPlugin.log("Loading configuration started...");
|
||||
@ -31,13 +32,15 @@ public final class SettingsHandler {
|
||||
|
||||
hologramLines = cfg.getStringList("hologram-lines").stream()
|
||||
.map(line -> ChatColor.translateAlternateColorCodes('&', line)).collect(Collectors.toList());
|
||||
infiniteHologramLines = cfg.getStringList("infinite-hologram-lines").stream()
|
||||
.map(line -> ChatColor.translateAlternateColorCodes('&', line)).collect(Collectors.toList());
|
||||
|
||||
plugin.getLoaders().removeLoadersData();
|
||||
|
||||
for (String name : cfg.getConfigurationSection("chunkloaders").getKeys(false)) {
|
||||
ConfigurationSection loaderSection = cfg.getConfigurationSection("chunkloaders." + name);
|
||||
|
||||
long timeLeft = loaderSection.getLong("time", 0);
|
||||
long timeLeft = loaderSection.getLong("time", Integer.MIN_VALUE);
|
||||
|
||||
ItemBuilder itemBuilder = null;
|
||||
|
||||
@ -72,7 +75,7 @@ public final class SettingsHandler {
|
||||
}
|
||||
} catch(Exception ignored){}
|
||||
|
||||
if (timeLeft <= 0 || itemBuilder == null) {
|
||||
if (itemBuilder == null) {
|
||||
WildLoadersPlugin.log("Something went wrong while loading chunk-loader '" + name + "'.");
|
||||
continue;
|
||||
}
|
||||
|
@ -61,18 +61,27 @@ public final class WChunkLoader implements ChunkLoader {
|
||||
}
|
||||
|
||||
public void tick(){
|
||||
timeLeft--;
|
||||
if(timeLeft < 0) {
|
||||
remove();
|
||||
}
|
||||
else if(timeLeft > 0 && timeLeft % 10 == 0){
|
||||
Query.UPDATE_CHUNK_LOADER_TIME_LEFT.insertParameters()
|
||||
.setObject(timeLeft)
|
||||
.setLocation(location)
|
||||
.queue(location);
|
||||
if(!isInfinite()) {
|
||||
timeLeft--;
|
||||
if (timeLeft < 0) {
|
||||
remove();
|
||||
} else if (timeLeft > 0 && timeLeft % 10 == 0) {
|
||||
Query.UPDATE_CHUNK_LOADER_TIME_LEFT.insertParameters()
|
||||
.setObject(timeLeft)
|
||||
.setLocation(location)
|
||||
.queue(location);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isInfinite(){
|
||||
return timeLeft == Integer.MIN_VALUE;
|
||||
}
|
||||
|
||||
public List<String> getHologramLines(){
|
||||
return isInfinite() ? plugin.getSettings().infiniteHologramLines : plugin.getSettings().hologramLines;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Location getLocation() {
|
||||
return location.clone();
|
||||
|
@ -33,6 +33,11 @@ public final class WLoaderData implements LoaderData {
|
||||
return timeLeft;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInfinite() {
|
||||
return timeLeft == Integer.MIN_VALUE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getLoaderItem() {
|
||||
return loaderItem.clone();
|
||||
|
@ -5,10 +5,29 @@
|
||||
## ##
|
||||
#######################################################
|
||||
|
||||
# Hologram lines for regular chunk loaders.
|
||||
hologram-lines:
|
||||
- '&b{0}''s Loader'
|
||||
- '&bTime Left: &f{1} days, {2} hours, {3} minutes, {4} seconds'
|
||||
|
||||
# Hologram lines for chunk loaders with no time limits.
|
||||
infinite-hologram-lines:
|
||||
- '&b{0}''s Loader'
|
||||
|
||||
# You can use the following settings when setting up chunk loaders:
|
||||
#
|
||||
# time (Integer) - The default amount of time the chunk loader will be alive.
|
||||
# This field is in seconds. You can remove this field to have no time limit for the loader.
|
||||
# chunks-radius (Integer) - The radius of chunks that will be loaded by the chunk loader for each direction.
|
||||
# By default, the radius is 0 (1 chunk will be loaded).
|
||||
# chunks-spread (Boolean) - Whether or not the chunk loader should load all the connected chunks inside a claim.
|
||||
# This will give the ability to load all the claims in a faction, for example.
|
||||
#
|
||||
# type (String) - The material-type of the item (and the block) of the chunk-loader.
|
||||
# name (String) - The name of the item of the chunk loader.
|
||||
# lore: (List) - The lore of the item of the chunk loader.
|
||||
#
|
||||
#
|
||||
# List of all the chunk-loaders
|
||||
# Do not name 2 chunk-loaders the same
|
||||
chunkloaders:
|
||||
|
@ -177,37 +177,41 @@ public final class NMSAdapter_v1_10_R1 implements NMSAdapter {
|
||||
private static final Map<Long, TileEntityChunkLoader> tileEntityChunkLoaderMap = new HashMap<>();
|
||||
|
||||
private final List<EntityHolograms_v1_10_R1> holograms = new ArrayList<>();
|
||||
private final ChunkLoader chunkLoader;
|
||||
private final WChunkLoader chunkLoader;
|
||||
|
||||
private short currentTick = 20;
|
||||
private short daysAmount, hoursAmount, minutesAmount, secondsAmount;
|
||||
private short daysAmount, hoursAmount = 0, minutesAmount = 0, secondsAmount = 0;
|
||||
private boolean removed = false;
|
||||
|
||||
TileEntityChunkLoader(ChunkLoader chunkLoader, World world, BlockPosition blockPosition){
|
||||
this.chunkLoader = chunkLoader;
|
||||
this.chunkLoader = (WChunkLoader) chunkLoader;
|
||||
|
||||
setPosition(blockPosition);
|
||||
a(world);
|
||||
|
||||
long timeLeft = chunkLoader.getTimeLeft();
|
||||
if(!this.chunkLoader.isInfinite()) {
|
||||
long timeLeft = chunkLoader.getTimeLeft();
|
||||
|
||||
daysAmount = (short) (timeLeft / 86400);
|
||||
timeLeft = timeLeft % 86400;
|
||||
daysAmount = (short) (timeLeft / 86400);
|
||||
timeLeft = timeLeft % 86400;
|
||||
|
||||
hoursAmount = (short) (timeLeft / 3600);
|
||||
timeLeft = timeLeft % 3600;
|
||||
hoursAmount = (short) (timeLeft / 3600);
|
||||
timeLeft = timeLeft % 3600;
|
||||
|
||||
minutesAmount = (short) (timeLeft / 60);
|
||||
timeLeft = timeLeft % 60;
|
||||
minutesAmount = (short) (timeLeft / 60);
|
||||
timeLeft = timeLeft % 60;
|
||||
|
||||
secondsAmount = (short) timeLeft;
|
||||
secondsAmount = (short) timeLeft;
|
||||
}
|
||||
|
||||
tileEntityChunkLoaderMap.put(LongHash.toLong(blockPosition.getX() >> 4, blockPosition.getZ() >> 4), this);
|
||||
|
||||
List<String> hologramLines = this.chunkLoader.getHologramLines();
|
||||
|
||||
double currentY = position.getY() + 1;
|
||||
for(int i = plugin.getSettings().hologramLines.size(); i > 0; i--){
|
||||
for(int i = hologramLines.size(); i > 0; i--){
|
||||
EntityHolograms_v1_10_R1 hologram = new EntityHolograms_v1_10_R1(world, position.getX() + 0.5, currentY, position.getZ() + 0.5);
|
||||
updateName(hologram, plugin.getSettings().hologramLines.get(i - 1));
|
||||
updateName(hologram, hologramLines.get(i - 1));
|
||||
world.addEntity(hologram);
|
||||
currentY += 0.23;
|
||||
holograms.add(hologram);
|
||||
@ -221,20 +225,25 @@ public final class NMSAdapter_v1_10_R1 implements NMSAdapter {
|
||||
|
||||
currentTick = 0;
|
||||
|
||||
if(((WChunkLoader) chunkLoader).isNotActive()){
|
||||
if(chunkLoader.isNotActive()){
|
||||
chunkLoader.remove();
|
||||
return;
|
||||
}
|
||||
|
||||
if(chunkLoader.isInfinite())
|
||||
return;
|
||||
|
||||
List<String> hologramLines = chunkLoader.getHologramLines();
|
||||
|
||||
int hologramsAmount = holograms.size();
|
||||
for (int i = hologramsAmount; i > 0; i--) {
|
||||
EntityHolograms_v1_10_R1 hologram = holograms.get(hologramsAmount - i);
|
||||
updateName(hologram, plugin.getSettings().hologramLines.get(i - 1));
|
||||
updateName(hologram, hologramLines.get(i - 1));
|
||||
}
|
||||
|
||||
((WChunkLoader) chunkLoader).tick();
|
||||
chunkLoader.tick();
|
||||
|
||||
if(!removed) {
|
||||
if(!removed && daysAmount != -1) {
|
||||
secondsAmount--;
|
||||
if (secondsAmount < 0) {
|
||||
secondsAmount = 59;
|
||||
|
@ -177,37 +177,41 @@ public final class NMSAdapter_v1_11_R1 implements NMSAdapter {
|
||||
private static final Map<Long, TileEntityChunkLoader> tileEntityChunkLoaderMap = new HashMap<>();
|
||||
|
||||
private final List<EntityHolograms_v1_11_R1> holograms = new ArrayList<>();
|
||||
private final ChunkLoader chunkLoader;
|
||||
private final WChunkLoader chunkLoader;
|
||||
|
||||
private short currentTick = 20;
|
||||
private short daysAmount, hoursAmount, minutesAmount, secondsAmount;
|
||||
private boolean removed = false;
|
||||
|
||||
TileEntityChunkLoader(ChunkLoader chunkLoader, World world, BlockPosition blockPosition){
|
||||
this.chunkLoader = chunkLoader;
|
||||
this.chunkLoader = (WChunkLoader) chunkLoader;
|
||||
|
||||
setPosition(blockPosition);
|
||||
a(world);
|
||||
|
||||
long timeLeft = chunkLoader.getTimeLeft();
|
||||
if(!this.chunkLoader.isInfinite()) {
|
||||
long timeLeft = chunkLoader.getTimeLeft();
|
||||
|
||||
daysAmount = (short) (timeLeft / 86400);
|
||||
timeLeft = timeLeft % 86400;
|
||||
daysAmount = (short) (timeLeft / 86400);
|
||||
timeLeft = timeLeft % 86400;
|
||||
|
||||
hoursAmount = (short) (timeLeft / 3600);
|
||||
timeLeft = timeLeft % 3600;
|
||||
hoursAmount = (short) (timeLeft / 3600);
|
||||
timeLeft = timeLeft % 3600;
|
||||
|
||||
minutesAmount = (short) (timeLeft / 60);
|
||||
timeLeft = timeLeft % 60;
|
||||
minutesAmount = (short) (timeLeft / 60);
|
||||
timeLeft = timeLeft % 60;
|
||||
|
||||
secondsAmount = (short) timeLeft;
|
||||
secondsAmount = (short) timeLeft;
|
||||
}
|
||||
|
||||
tileEntityChunkLoaderMap.put(LongHash.toLong(blockPosition.getX() >> 4, blockPosition.getZ() >> 4), this);
|
||||
|
||||
List<String> hologramLines = this.chunkLoader.getHologramLines();
|
||||
|
||||
double currentY = position.getY() + 1;
|
||||
for(int i = plugin.getSettings().hologramLines.size(); i > 0; i--){
|
||||
for(int i = hologramLines.size(); i > 0; i--){
|
||||
EntityHolograms_v1_11_R1 hologram = new EntityHolograms_v1_11_R1(world, position.getX() + 0.5, currentY, position.getZ() + 0.5);
|
||||
updateName(hologram, plugin.getSettings().hologramLines.get(i - 1));
|
||||
updateName(hologram, hologramLines.get(i - 1));
|
||||
world.addEntity(hologram);
|
||||
currentY += 0.23;
|
||||
holograms.add(hologram);
|
||||
@ -221,18 +225,23 @@ public final class NMSAdapter_v1_11_R1 implements NMSAdapter {
|
||||
|
||||
currentTick = 0;
|
||||
|
||||
if(((WChunkLoader) chunkLoader).isNotActive()){
|
||||
if(chunkLoader.isNotActive()){
|
||||
chunkLoader.remove();
|
||||
return;
|
||||
}
|
||||
|
||||
if(chunkLoader.isInfinite())
|
||||
return;
|
||||
|
||||
List<String> hologramLines = chunkLoader.getHologramLines();
|
||||
|
||||
int hologramsAmount = holograms.size();
|
||||
for (int i = hologramsAmount; i > 0; i--) {
|
||||
EntityHolograms_v1_11_R1 hologram = holograms.get(hologramsAmount - i);
|
||||
updateName(hologram, plugin.getSettings().hologramLines.get(i - 1));
|
||||
updateName(hologram, hologramLines.get(i - 1));
|
||||
}
|
||||
|
||||
((WChunkLoader) chunkLoader).tick();
|
||||
chunkLoader.tick();
|
||||
|
||||
if(!removed) {
|
||||
secondsAmount--;
|
||||
|
@ -200,37 +200,41 @@ public final class NMSAdapter_v1_12_R1 implements NMSAdapter {
|
||||
private static final Map<Long, TileEntityChunkLoader> tileEntityChunkLoaderMap = new HashMap<>();
|
||||
|
||||
private final List<EntityHolograms_v1_12_R1> holograms = new ArrayList<>();
|
||||
private final ChunkLoader chunkLoader;
|
||||
private final WChunkLoader chunkLoader;
|
||||
|
||||
private short currentTick = 20;
|
||||
private short daysAmount, hoursAmount, minutesAmount, secondsAmount;
|
||||
private boolean removed = false;
|
||||
|
||||
TileEntityChunkLoader(ChunkLoader chunkLoader, World world, BlockPosition blockPosition){
|
||||
this.chunkLoader = chunkLoader;
|
||||
this.chunkLoader = (WChunkLoader) chunkLoader;
|
||||
|
||||
setPosition(blockPosition);
|
||||
a(world);
|
||||
|
||||
long timeLeft = chunkLoader.getTimeLeft();
|
||||
if(!this.chunkLoader.isInfinite()) {
|
||||
long timeLeft = chunkLoader.getTimeLeft();
|
||||
|
||||
daysAmount = (short) (timeLeft / 86400);
|
||||
timeLeft = timeLeft % 86400;
|
||||
daysAmount = (short) (timeLeft / 86400);
|
||||
timeLeft = timeLeft % 86400;
|
||||
|
||||
hoursAmount = (short) (timeLeft / 3600);
|
||||
timeLeft = timeLeft % 3600;
|
||||
hoursAmount = (short) (timeLeft / 3600);
|
||||
timeLeft = timeLeft % 3600;
|
||||
|
||||
minutesAmount = (short) (timeLeft / 60);
|
||||
timeLeft = timeLeft % 60;
|
||||
minutesAmount = (short) (timeLeft / 60);
|
||||
timeLeft = timeLeft % 60;
|
||||
|
||||
secondsAmount = (short) timeLeft;
|
||||
secondsAmount = (short) timeLeft;
|
||||
}
|
||||
|
||||
tileEntityChunkLoaderMap.put(LongHash.toLong(blockPosition.getX() >> 4, blockPosition.getZ() >> 4), this);
|
||||
|
||||
List<String> hologramLines = this.chunkLoader.getHologramLines();
|
||||
|
||||
double currentY = position.getY() + 1;
|
||||
for(int i = plugin.getSettings().hologramLines.size(); i > 0; i--){
|
||||
for(int i = hologramLines.size(); i > 0; i--){
|
||||
EntityHolograms_v1_12_R1 hologram = new EntityHolograms_v1_12_R1(world, position.getX() + 0.5, currentY, position.getZ() + 0.5);
|
||||
updateName(hologram, plugin.getSettings().hologramLines.get(i - 1));
|
||||
updateName(hologram, hologramLines.get(i - 1));
|
||||
world.addEntity(hologram);
|
||||
currentY += 0.23;
|
||||
holograms.add(hologram);
|
||||
@ -244,18 +248,23 @@ public final class NMSAdapter_v1_12_R1 implements NMSAdapter {
|
||||
|
||||
currentTick = 0;
|
||||
|
||||
if(((WChunkLoader) chunkLoader).isNotActive()){
|
||||
if(chunkLoader.isNotActive()){
|
||||
chunkLoader.remove();
|
||||
return;
|
||||
}
|
||||
|
||||
if(chunkLoader.isInfinite())
|
||||
return;
|
||||
|
||||
List<String> hologramLines = chunkLoader.getHologramLines();
|
||||
|
||||
int hologramsAmount = holograms.size();
|
||||
for (int i = hologramsAmount; i > 0; i--) {
|
||||
EntityHolograms_v1_12_R1 hologram = holograms.get(hologramsAmount - i);
|
||||
updateName(hologram, plugin.getSettings().hologramLines.get(i - 1));
|
||||
updateName(hologram, hologramLines.get(i - 1));
|
||||
}
|
||||
|
||||
((WChunkLoader) chunkLoader).tick();
|
||||
chunkLoader.tick();
|
||||
|
||||
if(!removed) {
|
||||
secondsAmount--;
|
||||
|
@ -170,7 +170,7 @@ public final class NMSAdapter_v1_13_R1 implements NMSAdapter {
|
||||
private static final Map<Long, TileEntityChunkLoader> tileEntityChunkLoaderMap = new HashMap<>();
|
||||
|
||||
private final List<EntityHolograms_v1_13_R1> holograms = new ArrayList<>();
|
||||
private final ChunkLoader chunkLoader;
|
||||
private final WChunkLoader chunkLoader;
|
||||
|
||||
private short currentTick = 20;
|
||||
private short daysAmount, hoursAmount, minutesAmount, secondsAmount;
|
||||
@ -179,30 +179,34 @@ public final class NMSAdapter_v1_13_R1 implements NMSAdapter {
|
||||
TileEntityChunkLoader(ChunkLoader chunkLoader, World world, BlockPosition blockPosition){
|
||||
super(TileEntityTypes.w);
|
||||
|
||||
this.chunkLoader = chunkLoader;
|
||||
this.chunkLoader = (WChunkLoader) chunkLoader;
|
||||
|
||||
setPosition(blockPosition);
|
||||
setWorld(world);
|
||||
|
||||
long timeLeft = chunkLoader.getTimeLeft();
|
||||
if(!this.chunkLoader.isInfinite()) {
|
||||
long timeLeft = chunkLoader.getTimeLeft();
|
||||
|
||||
daysAmount = (short) (timeLeft / 86400);
|
||||
timeLeft = timeLeft % 86400;
|
||||
daysAmount = (short) (timeLeft / 86400);
|
||||
timeLeft = timeLeft % 86400;
|
||||
|
||||
hoursAmount = (short) (timeLeft / 3600);
|
||||
timeLeft = timeLeft % 3600;
|
||||
hoursAmount = (short) (timeLeft / 3600);
|
||||
timeLeft = timeLeft % 3600;
|
||||
|
||||
minutesAmount = (short) (timeLeft / 60);
|
||||
timeLeft = timeLeft % 60;
|
||||
minutesAmount = (short) (timeLeft / 60);
|
||||
timeLeft = timeLeft % 60;
|
||||
|
||||
secondsAmount = (short) timeLeft;
|
||||
secondsAmount = (short) timeLeft;
|
||||
}
|
||||
|
||||
tileEntityChunkLoaderMap.put(LongHash.toLong(blockPosition.getX() >> 4, blockPosition.getZ() >> 4), this);
|
||||
|
||||
List<String> hologramLines = this.chunkLoader.getHologramLines();
|
||||
|
||||
double currentY = position.getY() + 1;
|
||||
for(int i = plugin.getSettings().hologramLines.size(); i > 0; i--){
|
||||
for(int i = hologramLines.size(); i > 0; i--){
|
||||
EntityHolograms_v1_13_R1 hologram = new EntityHolograms_v1_13_R1(world, position.getX() + 0.5, currentY, position.getZ() + 0.5);
|
||||
updateName(hologram, plugin.getSettings().hologramLines.get(i - 1));
|
||||
updateName(hologram, hologramLines.get(i - 1));
|
||||
world.addEntity(hologram);
|
||||
currentY += 0.23;
|
||||
holograms.add(hologram);
|
||||
@ -216,18 +220,23 @@ public final class NMSAdapter_v1_13_R1 implements NMSAdapter {
|
||||
|
||||
currentTick = 0;
|
||||
|
||||
if(((WChunkLoader) chunkLoader).isNotActive()){
|
||||
if(chunkLoader.isNotActive()){
|
||||
chunkLoader.remove();
|
||||
return;
|
||||
}
|
||||
|
||||
if(chunkLoader.isInfinite())
|
||||
return;
|
||||
|
||||
List<String> hologramLines = chunkLoader.getHologramLines();
|
||||
|
||||
int hologramsAmount = holograms.size();
|
||||
for (int i = hologramsAmount; i > 0; i--) {
|
||||
EntityHolograms_v1_13_R1 hologram = holograms.get(hologramsAmount - i);
|
||||
updateName(hologram, plugin.getSettings().hologramLines.get(i - 1));
|
||||
updateName(hologram, hologramLines.get(i - 1));
|
||||
}
|
||||
|
||||
((WChunkLoader) chunkLoader).tick();
|
||||
chunkLoader.tick();
|
||||
|
||||
if(!removed) {
|
||||
secondsAmount--;
|
||||
|
@ -170,7 +170,7 @@ public final class NMSAdapter_v1_13_R2 implements NMSAdapter {
|
||||
private static final Map<Long, TileEntityChunkLoader> tileEntityChunkLoaderMap = new HashMap<>();
|
||||
|
||||
private final List<EntityHolograms_v1_13_R2> holograms = new ArrayList<>();
|
||||
private final ChunkLoader chunkLoader;
|
||||
private final WChunkLoader chunkLoader;
|
||||
|
||||
private short currentTick = 20;
|
||||
private short daysAmount, hoursAmount, minutesAmount, secondsAmount;
|
||||
@ -179,30 +179,34 @@ public final class NMSAdapter_v1_13_R2 implements NMSAdapter {
|
||||
TileEntityChunkLoader(ChunkLoader chunkLoader, World world, BlockPosition blockPosition){
|
||||
super(TileEntityTypes.COMMAND_BLOCK);
|
||||
|
||||
this.chunkLoader = chunkLoader;
|
||||
this.chunkLoader = (WChunkLoader) chunkLoader;
|
||||
|
||||
setPosition(blockPosition);
|
||||
setWorld(world);
|
||||
|
||||
long timeLeft = chunkLoader.getTimeLeft();
|
||||
if(!this.chunkLoader.isInfinite()) {
|
||||
long timeLeft = chunkLoader.getTimeLeft();
|
||||
|
||||
daysAmount = (short) (timeLeft / 86400);
|
||||
timeLeft = timeLeft % 86400;
|
||||
daysAmount = (short) (timeLeft / 86400);
|
||||
timeLeft = timeLeft % 86400;
|
||||
|
||||
hoursAmount = (short) (timeLeft / 3600);
|
||||
timeLeft = timeLeft % 3600;
|
||||
hoursAmount = (short) (timeLeft / 3600);
|
||||
timeLeft = timeLeft % 3600;
|
||||
|
||||
minutesAmount = (short) (timeLeft / 60);
|
||||
timeLeft = timeLeft % 60;
|
||||
minutesAmount = (short) (timeLeft / 60);
|
||||
timeLeft = timeLeft % 60;
|
||||
|
||||
secondsAmount = (short) timeLeft;
|
||||
secondsAmount = (short) timeLeft;
|
||||
}
|
||||
|
||||
tileEntityChunkLoaderMap.put(LongHash.toLong(blockPosition.getX() >> 4, blockPosition.getZ() >> 4), this);
|
||||
|
||||
List<String> hologramLines = this.chunkLoader.getHologramLines();
|
||||
|
||||
double currentY = position.getY() + 1;
|
||||
for(int i = plugin.getSettings().hologramLines.size(); i > 0; i--){
|
||||
for(int i = hologramLines.size(); i > 0; i--){
|
||||
EntityHolograms_v1_13_R2 hologram = new EntityHolograms_v1_13_R2(world, position.getX() + 0.5, currentY, position.getZ() + 0.5);
|
||||
updateName(hologram, plugin.getSettings().hologramLines.get(i - 1));
|
||||
updateName(hologram, hologramLines.get(i - 1));
|
||||
world.addEntity(hologram);
|
||||
currentY += 0.23;
|
||||
holograms.add(hologram);
|
||||
@ -216,18 +220,23 @@ public final class NMSAdapter_v1_13_R2 implements NMSAdapter {
|
||||
|
||||
currentTick = 0;
|
||||
|
||||
if(((WChunkLoader) chunkLoader).isNotActive()){
|
||||
if(chunkLoader.isNotActive()){
|
||||
chunkLoader.remove();
|
||||
return;
|
||||
}
|
||||
|
||||
if(chunkLoader.isInfinite())
|
||||
return;
|
||||
|
||||
List<String> hologramLines = chunkLoader.getHologramLines();
|
||||
|
||||
int hologramsAmount = holograms.size();
|
||||
for (int i = hologramsAmount; i > 0; i--) {
|
||||
EntityHolograms_v1_13_R2 hologram = holograms.get(hologramsAmount - i);
|
||||
updateName(hologram, plugin.getSettings().hologramLines.get(i - 1));
|
||||
updateName(hologram, hologramLines.get(i - 1));
|
||||
}
|
||||
|
||||
((WChunkLoader) chunkLoader).tick();
|
||||
chunkLoader.tick();
|
||||
|
||||
if(!removed) {
|
||||
secondsAmount--;
|
||||
|
@ -178,7 +178,7 @@ public final class NMSAdapter_v1_14_R1 implements NMSAdapter {
|
||||
private static final Map<Long, TileEntityChunkLoader> tileEntityChunkLoaderMap = new HashMap<>();
|
||||
|
||||
private final List<EntityHolograms_v1_14_R1> holograms = new ArrayList<>();
|
||||
private final ChunkLoader chunkLoader;
|
||||
private final WChunkLoader chunkLoader;
|
||||
|
||||
private short currentTick = 20;
|
||||
private short daysAmount, hoursAmount, minutesAmount, secondsAmount;
|
||||
@ -187,30 +187,34 @@ public final class NMSAdapter_v1_14_R1 implements NMSAdapter {
|
||||
TileEntityChunkLoader(ChunkLoader chunkLoader, World world, BlockPosition blockPosition){
|
||||
super(TileEntityTypes.COMMAND_BLOCK);
|
||||
|
||||
this.chunkLoader = chunkLoader;
|
||||
this.chunkLoader = (WChunkLoader) chunkLoader;
|
||||
|
||||
setPosition(blockPosition);
|
||||
setWorld(world);
|
||||
|
||||
long timeLeft = chunkLoader.getTimeLeft();
|
||||
if(!this.chunkLoader.isInfinite()) {
|
||||
long timeLeft = chunkLoader.getTimeLeft();
|
||||
|
||||
daysAmount = (short) (timeLeft / 86400);
|
||||
timeLeft = timeLeft % 86400;
|
||||
daysAmount = (short) (timeLeft / 86400);
|
||||
timeLeft = timeLeft % 86400;
|
||||
|
||||
hoursAmount = (short) (timeLeft / 3600);
|
||||
timeLeft = timeLeft % 3600;
|
||||
hoursAmount = (short) (timeLeft / 3600);
|
||||
timeLeft = timeLeft % 3600;
|
||||
|
||||
minutesAmount = (short) (timeLeft / 60);
|
||||
timeLeft = timeLeft % 60;
|
||||
minutesAmount = (short) (timeLeft / 60);
|
||||
timeLeft = timeLeft % 60;
|
||||
|
||||
secondsAmount = (short) timeLeft;
|
||||
secondsAmount = (short) timeLeft;
|
||||
}
|
||||
|
||||
tileEntityChunkLoaderMap.put(ChunkCoordIntPair.pair(blockPosition.getX() >> 4, blockPosition.getZ() >> 4), this);
|
||||
|
||||
List<String> hologramLines = this.chunkLoader.getHologramLines();
|
||||
|
||||
double currentY = position.getY() + 1;
|
||||
for(int i = plugin.getSettings().hologramLines.size(); i > 0; i--){
|
||||
for(int i = hologramLines.size(); i > 0; i--){
|
||||
EntityHolograms_v1_14_R1 hologram = new EntityHolograms_v1_14_R1(world, position.getX() + 0.5, currentY, position.getZ() + 0.5);
|
||||
updateName(hologram, plugin.getSettings().hologramLines.get(i - 1));
|
||||
updateName(hologram, hologramLines.get(i - 1));
|
||||
world.addEntity(hologram);
|
||||
currentY += 0.23;
|
||||
holograms.add(hologram);
|
||||
@ -229,18 +233,23 @@ public final class NMSAdapter_v1_14_R1 implements NMSAdapter {
|
||||
|
||||
currentTick = 0;
|
||||
|
||||
if(((WChunkLoader) chunkLoader).isNotActive()){
|
||||
if(chunkLoader.isNotActive()){
|
||||
chunkLoader.remove();
|
||||
return;
|
||||
}
|
||||
|
||||
if(chunkLoader.isInfinite())
|
||||
return;
|
||||
|
||||
List<String> hologramLines = chunkLoader.getHologramLines();
|
||||
|
||||
int hologramsAmount = holograms.size();
|
||||
for (int i = hologramsAmount; i > 0; i--) {
|
||||
EntityHolograms_v1_14_R1 hologram = holograms.get(hologramsAmount - i);
|
||||
updateName(hologram, plugin.getSettings().hologramLines.get(i - 1));
|
||||
updateName(hologram, hologramLines.get(i - 1));
|
||||
}
|
||||
|
||||
((WChunkLoader) chunkLoader).tick();
|
||||
chunkLoader.tick();
|
||||
|
||||
if(!removed) {
|
||||
secondsAmount--;
|
||||
|
@ -178,7 +178,7 @@ public final class NMSAdapter_v1_15_R1 implements NMSAdapter {
|
||||
private static final Map<Long, TileEntityChunkLoader> tileEntityChunkLoaderMap = new HashMap<>();
|
||||
|
||||
private final List<EntityHolograms_v1_15_R1> holograms = new ArrayList<>();
|
||||
private final ChunkLoader chunkLoader;
|
||||
private final WChunkLoader chunkLoader;
|
||||
|
||||
private short currentTick = 20;
|
||||
private short daysAmount, hoursAmount, minutesAmount, secondsAmount;
|
||||
@ -187,29 +187,33 @@ public final class NMSAdapter_v1_15_R1 implements NMSAdapter {
|
||||
TileEntityChunkLoader(ChunkLoader chunkLoader, World world, BlockPosition blockPosition){
|
||||
super(TileEntityTypes.COMMAND_BLOCK);
|
||||
|
||||
this.chunkLoader = chunkLoader;
|
||||
this.chunkLoader = (WChunkLoader) chunkLoader;
|
||||
|
||||
setLocation(world, blockPosition);
|
||||
|
||||
long timeLeft = chunkLoader.getTimeLeft();
|
||||
if(!this.chunkLoader.isInfinite()) {
|
||||
long timeLeft = chunkLoader.getTimeLeft();
|
||||
|
||||
daysAmount = (short) (timeLeft / 86400);
|
||||
timeLeft = timeLeft % 86400;
|
||||
daysAmount = (short) (timeLeft / 86400);
|
||||
timeLeft = timeLeft % 86400;
|
||||
|
||||
hoursAmount = (short) (timeLeft / 3600);
|
||||
timeLeft = timeLeft % 3600;
|
||||
hoursAmount = (short) (timeLeft / 3600);
|
||||
timeLeft = timeLeft % 3600;
|
||||
|
||||
minutesAmount = (short) (timeLeft / 60);
|
||||
timeLeft = timeLeft % 60;
|
||||
minutesAmount = (short) (timeLeft / 60);
|
||||
timeLeft = timeLeft % 60;
|
||||
|
||||
secondsAmount = (short) timeLeft;
|
||||
secondsAmount = (short) timeLeft;
|
||||
}
|
||||
|
||||
tileEntityChunkLoaderMap.put(ChunkCoordIntPair.pair(blockPosition.getX() >> 4, blockPosition.getZ() >> 4), this);
|
||||
|
||||
List<String> hologramLines = this.chunkLoader.getHologramLines();
|
||||
|
||||
double currentY = position.getY() + 1;
|
||||
for(int i = plugin.getSettings().hologramLines.size(); i > 0; i--){
|
||||
for(int i = hologramLines.size(); i > 0; i--){
|
||||
EntityHolograms_v1_15_R1 hologram = new EntityHolograms_v1_15_R1(world, position.getX() + 0.5, currentY, position.getZ() + 0.5);
|
||||
updateName(hologram, plugin.getSettings().hologramLines.get(i - 1));
|
||||
updateName(hologram, hologramLines.get(i - 1));
|
||||
world.addEntity(hologram);
|
||||
currentY += 0.23;
|
||||
holograms.add(hologram);
|
||||
@ -228,18 +232,23 @@ public final class NMSAdapter_v1_15_R1 implements NMSAdapter {
|
||||
|
||||
currentTick = 0;
|
||||
|
||||
if(((WChunkLoader) chunkLoader).isNotActive()){
|
||||
if(chunkLoader.isNotActive()){
|
||||
chunkLoader.remove();
|
||||
return;
|
||||
}
|
||||
|
||||
if(chunkLoader.isInfinite())
|
||||
return;
|
||||
|
||||
List<String> hologramLines = chunkLoader.getHologramLines();
|
||||
|
||||
int hologramsAmount = holograms.size();
|
||||
for (int i = hologramsAmount; i > 0; i--) {
|
||||
EntityHolograms_v1_15_R1 hologram = holograms.get(hologramsAmount - i);
|
||||
updateName(hologram, plugin.getSettings().hologramLines.get(i - 1));
|
||||
updateName(hologram, hologramLines.get(i - 1));
|
||||
}
|
||||
|
||||
((WChunkLoader) chunkLoader).tick();
|
||||
chunkLoader.tick();
|
||||
|
||||
if(!removed) {
|
||||
secondsAmount--;
|
||||
|
@ -180,7 +180,7 @@ public final class NMSAdapter_v1_16_R1 implements NMSAdapter {
|
||||
private static final Map<Long, TileEntityChunkLoader> tileEntityChunkLoaderMap = new HashMap<>();
|
||||
|
||||
private final List<EntityHolograms_v1_16_R1> holograms = new ArrayList<>();
|
||||
private final ChunkLoader chunkLoader;
|
||||
private final WChunkLoader chunkLoader;
|
||||
|
||||
private short currentTick = 20;
|
||||
private short daysAmount, hoursAmount, minutesAmount, secondsAmount;
|
||||
@ -189,29 +189,33 @@ public final class NMSAdapter_v1_16_R1 implements NMSAdapter {
|
||||
TileEntityChunkLoader(ChunkLoader chunkLoader, World world, BlockPosition blockPosition){
|
||||
super(TileEntityTypes.COMMAND_BLOCK);
|
||||
|
||||
this.chunkLoader = chunkLoader;
|
||||
this.chunkLoader = (WChunkLoader) chunkLoader;
|
||||
|
||||
setLocation(world, blockPosition);
|
||||
|
||||
long timeLeft = chunkLoader.getTimeLeft();
|
||||
if(!this.chunkLoader.isInfinite()) {
|
||||
long timeLeft = chunkLoader.getTimeLeft();
|
||||
|
||||
daysAmount = (short) (timeLeft / 86400);
|
||||
timeLeft = timeLeft % 86400;
|
||||
daysAmount = (short) (timeLeft / 86400);
|
||||
timeLeft = timeLeft % 86400;
|
||||
|
||||
hoursAmount = (short) (timeLeft / 3600);
|
||||
timeLeft = timeLeft % 3600;
|
||||
hoursAmount = (short) (timeLeft / 3600);
|
||||
timeLeft = timeLeft % 3600;
|
||||
|
||||
minutesAmount = (short) (timeLeft / 60);
|
||||
timeLeft = timeLeft % 60;
|
||||
minutesAmount = (short) (timeLeft / 60);
|
||||
timeLeft = timeLeft % 60;
|
||||
|
||||
secondsAmount = (short) timeLeft;
|
||||
secondsAmount = (short) timeLeft;
|
||||
}
|
||||
|
||||
tileEntityChunkLoaderMap.put(ChunkCoordIntPair.pair(blockPosition.getX() >> 4, blockPosition.getZ() >> 4), this);
|
||||
|
||||
List<String> hologramLines = this.chunkLoader.getHologramLines();
|
||||
|
||||
double currentY = position.getY() + 1;
|
||||
for(int i = plugin.getSettings().hologramLines.size(); i > 0; i--){
|
||||
for(int i = hologramLines.size(); i > 0; i--){
|
||||
EntityHolograms_v1_16_R1 hologram = new EntityHolograms_v1_16_R1(world, position.getX() + 0.5, currentY, position.getZ() + 0.5);
|
||||
updateName(hologram, plugin.getSettings().hologramLines.get(i - 1));
|
||||
updateName(hologram, hologramLines.get(i - 1));
|
||||
world.addEntity(hologram);
|
||||
currentY += 0.23;
|
||||
holograms.add(hologram);
|
||||
@ -230,18 +234,23 @@ public final class NMSAdapter_v1_16_R1 implements NMSAdapter {
|
||||
|
||||
currentTick = 0;
|
||||
|
||||
if(((WChunkLoader) chunkLoader).isNotActive()){
|
||||
if(chunkLoader.isNotActive()){
|
||||
chunkLoader.remove();
|
||||
return;
|
||||
}
|
||||
|
||||
if(chunkLoader.isInfinite())
|
||||
return;
|
||||
|
||||
List<String> hologramLines = chunkLoader.getHologramLines();
|
||||
|
||||
int hologramsAmount = holograms.size();
|
||||
for (int i = hologramsAmount; i > 0; i--) {
|
||||
EntityHolograms_v1_16_R1 hologram = holograms.get(hologramsAmount - i);
|
||||
updateName(hologram, plugin.getSettings().hologramLines.get(i - 1));
|
||||
updateName(hologram, hologramLines.get(i - 1));
|
||||
}
|
||||
|
||||
((WChunkLoader) chunkLoader).tick();
|
||||
chunkLoader.tick();
|
||||
|
||||
if(!removed) {
|
||||
secondsAmount--;
|
||||
|
@ -180,7 +180,7 @@ public final class NMSAdapter_v1_16_R2 implements NMSAdapter {
|
||||
private static final Map<Long, TileEntityChunkLoader> tileEntityChunkLoaderMap = new HashMap<>();
|
||||
|
||||
private final List<EntityHolograms_v1_16_R2> holograms = new ArrayList<>();
|
||||
private final ChunkLoader chunkLoader;
|
||||
private final WChunkLoader chunkLoader;
|
||||
|
||||
private short currentTick = 20;
|
||||
private short daysAmount, hoursAmount, minutesAmount, secondsAmount;
|
||||
@ -189,29 +189,33 @@ public final class NMSAdapter_v1_16_R2 implements NMSAdapter {
|
||||
TileEntityChunkLoader(ChunkLoader chunkLoader, World world, BlockPosition blockPosition){
|
||||
super(TileEntityTypes.COMMAND_BLOCK);
|
||||
|
||||
this.chunkLoader = chunkLoader;
|
||||
this.chunkLoader = (WChunkLoader) chunkLoader;
|
||||
|
||||
setLocation(world, blockPosition);
|
||||
|
||||
long timeLeft = chunkLoader.getTimeLeft();
|
||||
if(!this.chunkLoader.isInfinite()) {
|
||||
long timeLeft = chunkLoader.getTimeLeft();
|
||||
|
||||
daysAmount = (short) (timeLeft / 86400);
|
||||
timeLeft = timeLeft % 86400;
|
||||
daysAmount = (short) (timeLeft / 86400);
|
||||
timeLeft = timeLeft % 86400;
|
||||
|
||||
hoursAmount = (short) (timeLeft / 3600);
|
||||
timeLeft = timeLeft % 3600;
|
||||
hoursAmount = (short) (timeLeft / 3600);
|
||||
timeLeft = timeLeft % 3600;
|
||||
|
||||
minutesAmount = (short) (timeLeft / 60);
|
||||
timeLeft = timeLeft % 60;
|
||||
minutesAmount = (short) (timeLeft / 60);
|
||||
timeLeft = timeLeft % 60;
|
||||
|
||||
secondsAmount = (short) timeLeft;
|
||||
secondsAmount = (short) timeLeft;
|
||||
}
|
||||
|
||||
tileEntityChunkLoaderMap.put(ChunkCoordIntPair.pair(blockPosition.getX() >> 4, blockPosition.getZ() >> 4), this);
|
||||
|
||||
List<String> hologramLines = this.chunkLoader.getHologramLines();
|
||||
|
||||
double currentY = position.getY() + 1;
|
||||
for(int i = plugin.getSettings().hologramLines.size(); i > 0; i--){
|
||||
for(int i = hologramLines.size(); i > 0; i--){
|
||||
EntityHolograms_v1_16_R2 hologram = new EntityHolograms_v1_16_R2(world, position.getX() + 0.5, currentY, position.getZ() + 0.5);
|
||||
updateName(hologram, plugin.getSettings().hologramLines.get(i - 1));
|
||||
updateName(hologram, hologramLines.get(i - 1));
|
||||
world.addEntity(hologram);
|
||||
currentY += 0.23;
|
||||
holograms.add(hologram);
|
||||
@ -230,18 +234,23 @@ public final class NMSAdapter_v1_16_R2 implements NMSAdapter {
|
||||
|
||||
currentTick = 0;
|
||||
|
||||
if(((WChunkLoader) chunkLoader).isNotActive()){
|
||||
if(chunkLoader.isNotActive()){
|
||||
chunkLoader.remove();
|
||||
return;
|
||||
}
|
||||
|
||||
if(chunkLoader.isInfinite())
|
||||
return;
|
||||
|
||||
List<String> hologramLines = chunkLoader.getHologramLines();
|
||||
|
||||
int hologramsAmount = holograms.size();
|
||||
for (int i = hologramsAmount; i > 0; i--) {
|
||||
EntityHolograms_v1_16_R2 hologram = holograms.get(hologramsAmount - i);
|
||||
updateName(hologram, plugin.getSettings().hologramLines.get(i - 1));
|
||||
updateName(hologram, hologramLines.get(i - 1));
|
||||
}
|
||||
|
||||
((WChunkLoader) chunkLoader).tick();
|
||||
chunkLoader.tick();
|
||||
|
||||
if(!removed) {
|
||||
secondsAmount--;
|
||||
|
@ -7,7 +7,6 @@ import com.bgsoftware.wildloaders.loaders.WChunkLoader;
|
||||
import net.minecraft.server.v1_8_R1.Block;
|
||||
import net.minecraft.server.v1_8_R1.BlockPosition;
|
||||
import net.minecraft.server.v1_8_R1.Chunk;
|
||||
import net.minecraft.server.v1_8_R1.Entity;
|
||||
import net.minecraft.server.v1_8_R1.IUpdatePlayerListBox;
|
||||
import net.minecraft.server.v1_8_R1.ItemStack;
|
||||
import net.minecraft.server.v1_8_R1.NBTTagCompound;
|
||||
@ -181,37 +180,41 @@ public final class NMSAdapter_v1_8_R1 implements NMSAdapter {
|
||||
private static final Map<Long, TileEntityChunkLoader> tileEntityChunkLoaderMap = new HashMap<>();
|
||||
|
||||
private final List<EntityHolograms_v1_8_R1> holograms = new ArrayList<>();
|
||||
private final ChunkLoader chunkLoader;
|
||||
private final WChunkLoader chunkLoader;
|
||||
|
||||
private short currentTick = 20;
|
||||
private short daysAmount, hoursAmount, minutesAmount, secondsAmount;
|
||||
private boolean removed = false;
|
||||
|
||||
TileEntityChunkLoader(ChunkLoader chunkLoader, World world, BlockPosition blockPosition){
|
||||
this.chunkLoader = chunkLoader;
|
||||
this.chunkLoader = (WChunkLoader) chunkLoader;
|
||||
|
||||
a(blockPosition);
|
||||
a(world);
|
||||
|
||||
long timeLeft = chunkLoader.getTimeLeft();
|
||||
if(!this.chunkLoader.isInfinite()) {
|
||||
long timeLeft = chunkLoader.getTimeLeft();
|
||||
|
||||
daysAmount = (short) (timeLeft / 86400);
|
||||
timeLeft = timeLeft % 86400;
|
||||
daysAmount = (short) (timeLeft / 86400);
|
||||
timeLeft = timeLeft % 86400;
|
||||
|
||||
hoursAmount = (short) (timeLeft / 3600);
|
||||
timeLeft = timeLeft % 3600;
|
||||
hoursAmount = (short) (timeLeft / 3600);
|
||||
timeLeft = timeLeft % 3600;
|
||||
|
||||
minutesAmount = (short) (timeLeft / 60);
|
||||
timeLeft = timeLeft % 60;
|
||||
minutesAmount = (short) (timeLeft / 60);
|
||||
timeLeft = timeLeft % 60;
|
||||
|
||||
secondsAmount = (short) timeLeft;
|
||||
secondsAmount = (short) timeLeft;
|
||||
}
|
||||
|
||||
tileEntityChunkLoaderMap.put(LongHash.toLong(blockPosition.getX() >> 4, blockPosition.getZ() >> 4), this);
|
||||
|
||||
List<String> hologramLines = this.chunkLoader.getHologramLines();
|
||||
|
||||
double currentY = position.getY() + 1;
|
||||
for(int i = plugin.getSettings().hologramLines.size(); i > 0; i--){
|
||||
for (int i = hologramLines.size(); i > 0; i--) {
|
||||
EntityHolograms_v1_8_R1 hologram = new EntityHolograms_v1_8_R1(world, position.getX() + 0.5, currentY, position.getZ() + 0.5);
|
||||
updateName(hologram, plugin.getSettings().hologramLines.get(i - 1));
|
||||
updateName(hologram, hologramLines.get(i - 1));
|
||||
world.addEntity(hologram);
|
||||
currentY += 0.23;
|
||||
holograms.add(hologram);
|
||||
@ -225,18 +228,23 @@ public final class NMSAdapter_v1_8_R1 implements NMSAdapter {
|
||||
|
||||
currentTick = 0;
|
||||
|
||||
if(((WChunkLoader) chunkLoader).isNotActive()){
|
||||
if(chunkLoader.isNotActive()){
|
||||
chunkLoader.remove();
|
||||
return;
|
||||
}
|
||||
|
||||
if(chunkLoader.isInfinite())
|
||||
return;
|
||||
|
||||
List<String> hologramLines = chunkLoader.getHologramLines();
|
||||
|
||||
int hologramsAmount = holograms.size();
|
||||
for (int i = hologramsAmount; i > 0; i--) {
|
||||
EntityHolograms_v1_8_R1 hologram = holograms.get(hologramsAmount - i);
|
||||
updateName(hologram, plugin.getSettings().hologramLines.get(i - 1));
|
||||
updateName(hologram, hologramLines.get(i - 1));
|
||||
}
|
||||
|
||||
((WChunkLoader) chunkLoader).tick();
|
||||
chunkLoader.tick();
|
||||
|
||||
if(!removed) {
|
||||
secondsAmount--;
|
||||
|
@ -177,37 +177,41 @@ public final class NMSAdapter_v1_8_R2 implements NMSAdapter {
|
||||
private static final Map<Long, TileEntityChunkLoader> tileEntityChunkLoaderMap = new HashMap<>();
|
||||
|
||||
private final List<EntityHolograms_v1_8_R2> holograms = new ArrayList<>();
|
||||
private final ChunkLoader chunkLoader;
|
||||
private final WChunkLoader chunkLoader;
|
||||
|
||||
private short currentTick = 20;
|
||||
private short daysAmount, hoursAmount, minutesAmount, secondsAmount;
|
||||
private boolean removed = false;
|
||||
|
||||
TileEntityChunkLoader(ChunkLoader chunkLoader, World world, BlockPosition blockPosition){
|
||||
this.chunkLoader = chunkLoader;
|
||||
this.chunkLoader = (WChunkLoader) chunkLoader;
|
||||
|
||||
a(blockPosition);
|
||||
a(world);
|
||||
|
||||
long timeLeft = chunkLoader.getTimeLeft();
|
||||
if(!this.chunkLoader.isInfinite()) {
|
||||
long timeLeft = chunkLoader.getTimeLeft();
|
||||
|
||||
daysAmount = (short) (timeLeft / 86400);
|
||||
timeLeft = timeLeft % 86400;
|
||||
daysAmount = (short) (timeLeft / 86400);
|
||||
timeLeft = timeLeft % 86400;
|
||||
|
||||
hoursAmount = (short) (timeLeft / 3600);
|
||||
timeLeft = timeLeft % 3600;
|
||||
hoursAmount = (short) (timeLeft / 3600);
|
||||
timeLeft = timeLeft % 3600;
|
||||
|
||||
minutesAmount = (short) (timeLeft / 60);
|
||||
timeLeft = timeLeft % 60;
|
||||
minutesAmount = (short) (timeLeft / 60);
|
||||
timeLeft = timeLeft % 60;
|
||||
|
||||
secondsAmount = (short) timeLeft;
|
||||
secondsAmount = (short) timeLeft;
|
||||
}
|
||||
|
||||
tileEntityChunkLoaderMap.put(LongHash.toLong(blockPosition.getX() >> 4, blockPosition.getZ() >> 4), this);
|
||||
|
||||
List<String> hologramLines = this.chunkLoader.getHologramLines();
|
||||
|
||||
double currentY = position.getY() + 1;
|
||||
for(int i = plugin.getSettings().hologramLines.size(); i > 0; i--){
|
||||
for(int i = hologramLines.size(); i > 0; i--){
|
||||
EntityHolograms_v1_8_R2 hologram = new EntityHolograms_v1_8_R2(world, position.getX() + 0.5, currentY, position.getZ() + 0.5);
|
||||
updateName(hologram, plugin.getSettings().hologramLines.get(i - 1));
|
||||
updateName(hologram, hologramLines.get(i - 1));
|
||||
world.addEntity(hologram);
|
||||
currentY += 0.23;
|
||||
holograms.add(hologram);
|
||||
@ -221,18 +225,23 @@ public final class NMSAdapter_v1_8_R2 implements NMSAdapter {
|
||||
|
||||
currentTick = 0;
|
||||
|
||||
if(((WChunkLoader) chunkLoader).isNotActive()){
|
||||
if(chunkLoader.isNotActive()){
|
||||
chunkLoader.remove();
|
||||
return;
|
||||
}
|
||||
|
||||
if(chunkLoader.isInfinite())
|
||||
return;
|
||||
|
||||
List<String> hologramLines = chunkLoader.getHologramLines();
|
||||
|
||||
int hologramsAmount = holograms.size();
|
||||
for (int i = hologramsAmount; i > 0; i--) {
|
||||
EntityHolograms_v1_8_R2 hologram = holograms.get(hologramsAmount - i);
|
||||
updateName(hologram, plugin.getSettings().hologramLines.get(i - 1));
|
||||
updateName(hologram, hologramLines.get(i - 1));
|
||||
}
|
||||
|
||||
((WChunkLoader) chunkLoader).tick();
|
||||
chunkLoader.tick();
|
||||
|
||||
if(!removed) {
|
||||
secondsAmount--;
|
||||
|
@ -177,37 +177,41 @@ public final class NMSAdapter_v1_8_R3 implements NMSAdapter {
|
||||
private static final Map<Long, TileEntityChunkLoader> tileEntityChunkLoaderMap = new HashMap<>();
|
||||
|
||||
private final List<EntityHolograms_v1_8_R3> holograms = new ArrayList<>();
|
||||
private final ChunkLoader chunkLoader;
|
||||
private final WChunkLoader chunkLoader;
|
||||
|
||||
private short currentTick = 20;
|
||||
private short daysAmount, hoursAmount, minutesAmount, secondsAmount;
|
||||
private boolean removed = false;
|
||||
|
||||
TileEntityChunkLoader(ChunkLoader chunkLoader, World world, BlockPosition blockPosition){
|
||||
this.chunkLoader = chunkLoader;
|
||||
this.chunkLoader = (WChunkLoader) chunkLoader;
|
||||
|
||||
a(blockPosition);
|
||||
a(world);
|
||||
|
||||
long timeLeft = chunkLoader.getTimeLeft();
|
||||
if(!this.chunkLoader.isInfinite()) {
|
||||
long timeLeft = chunkLoader.getTimeLeft();
|
||||
|
||||
daysAmount = (short) (timeLeft / 86400);
|
||||
timeLeft = timeLeft % 86400;
|
||||
daysAmount = (short) (timeLeft / 86400);
|
||||
timeLeft = timeLeft % 86400;
|
||||
|
||||
hoursAmount = (short) (timeLeft / 3600);
|
||||
timeLeft = timeLeft % 3600;
|
||||
hoursAmount = (short) (timeLeft / 3600);
|
||||
timeLeft = timeLeft % 3600;
|
||||
|
||||
minutesAmount = (short) (timeLeft / 60);
|
||||
timeLeft = timeLeft % 60;
|
||||
minutesAmount = (short) (timeLeft / 60);
|
||||
timeLeft = timeLeft % 60;
|
||||
|
||||
secondsAmount = (short) timeLeft;
|
||||
secondsAmount = (short) timeLeft;
|
||||
}
|
||||
|
||||
tileEntityChunkLoaderMap.put(LongHash.toLong(blockPosition.getX() >> 4, blockPosition.getZ() >> 4), this);
|
||||
|
||||
List<String> hologramLines = this.chunkLoader.getHologramLines();
|
||||
|
||||
double currentY = position.getY() + 1;
|
||||
for(int i = plugin.getSettings().hologramLines.size(); i > 0; i--){
|
||||
for(int i = hologramLines.size(); i > 0; i--){
|
||||
EntityHolograms_v1_8_R3 hologram = new EntityHolograms_v1_8_R3(world, position.getX() + 0.5, currentY, position.getZ() + 0.5);
|
||||
updateName(hologram, plugin.getSettings().hologramLines.get(i - 1));
|
||||
updateName(hologram, hologramLines.get(i - 1));
|
||||
world.addEntity(hologram);
|
||||
currentY += 0.23;
|
||||
holograms.add(hologram);
|
||||
@ -221,18 +225,23 @@ public final class NMSAdapter_v1_8_R3 implements NMSAdapter {
|
||||
|
||||
currentTick = 0;
|
||||
|
||||
if(((WChunkLoader) chunkLoader).isNotActive()){
|
||||
if(chunkLoader.isNotActive()){
|
||||
chunkLoader.remove();
|
||||
return;
|
||||
}
|
||||
|
||||
if(chunkLoader.isInfinite())
|
||||
return;
|
||||
|
||||
List<String> hologramLines = chunkLoader.getHologramLines();
|
||||
|
||||
int hologramsAmount = holograms.size();
|
||||
for (int i = hologramsAmount; i > 0; i--) {
|
||||
EntityHolograms_v1_8_R3 hologram = holograms.get(hologramsAmount - i);
|
||||
updateName(hologram, plugin.getSettings().hologramLines.get(i - 1));
|
||||
updateName(hologram, hologramLines.get(i - 1));
|
||||
}
|
||||
|
||||
((WChunkLoader) chunkLoader).tick();
|
||||
chunkLoader.tick();
|
||||
|
||||
if(!removed) {
|
||||
secondsAmount--;
|
||||
|
@ -177,37 +177,41 @@ public final class NMSAdapter_v1_9_R1 implements NMSAdapter {
|
||||
private static final Map<Long, TileEntityChunkLoader> tileEntityChunkLoaderMap = new HashMap<>();
|
||||
|
||||
private final List<EntityHolograms_v1_9_R1> holograms = new ArrayList<>();
|
||||
private final ChunkLoader chunkLoader;
|
||||
private final WChunkLoader chunkLoader;
|
||||
|
||||
private short currentTick = 20;
|
||||
private short daysAmount, hoursAmount, minutesAmount, secondsAmount;
|
||||
private boolean removed = false;
|
||||
|
||||
TileEntityChunkLoader(ChunkLoader chunkLoader, World world, BlockPosition blockPosition){
|
||||
this.chunkLoader = chunkLoader;
|
||||
this.chunkLoader = (WChunkLoader) chunkLoader;
|
||||
|
||||
a(blockPosition);
|
||||
a(world);
|
||||
|
||||
long timeLeft = chunkLoader.getTimeLeft();
|
||||
if(!this.chunkLoader.isInfinite()) {
|
||||
long timeLeft = chunkLoader.getTimeLeft();
|
||||
|
||||
daysAmount = (short) (timeLeft / 86400);
|
||||
timeLeft = timeLeft % 86400;
|
||||
daysAmount = (short) (timeLeft / 86400);
|
||||
timeLeft = timeLeft % 86400;
|
||||
|
||||
hoursAmount = (short) (timeLeft / 3600);
|
||||
timeLeft = timeLeft % 3600;
|
||||
hoursAmount = (short) (timeLeft / 3600);
|
||||
timeLeft = timeLeft % 3600;
|
||||
|
||||
minutesAmount = (short) (timeLeft / 60);
|
||||
timeLeft = timeLeft % 60;
|
||||
minutesAmount = (short) (timeLeft / 60);
|
||||
timeLeft = timeLeft % 60;
|
||||
|
||||
secondsAmount = (short) timeLeft;
|
||||
secondsAmount = (short) timeLeft;
|
||||
}
|
||||
|
||||
tileEntityChunkLoaderMap.put(LongHash.toLong(blockPosition.getX() >> 4, blockPosition.getZ() >> 4), this);
|
||||
|
||||
List<String> hologramLines = this.chunkLoader.getHologramLines();
|
||||
|
||||
double currentY = position.getY() + 1;
|
||||
for(int i = plugin.getSettings().hologramLines.size(); i > 0; i--){
|
||||
for(int i = hologramLines.size(); i > 0; i--){
|
||||
EntityHolograms_v1_9_R1 hologram = new EntityHolograms_v1_9_R1(world, position.getX() + 0.5, currentY, position.getZ() + 0.5);
|
||||
updateName(hologram, plugin.getSettings().hologramLines.get(i - 1));
|
||||
updateName(hologram, hologramLines.get(i - 1));
|
||||
world.addEntity(hologram);
|
||||
currentY += 0.23;
|
||||
holograms.add(hologram);
|
||||
@ -221,18 +225,23 @@ public final class NMSAdapter_v1_9_R1 implements NMSAdapter {
|
||||
|
||||
currentTick = 0;
|
||||
|
||||
if(((WChunkLoader) chunkLoader).isNotActive()){
|
||||
if(chunkLoader.isNotActive()){
|
||||
chunkLoader.remove();
|
||||
return;
|
||||
}
|
||||
|
||||
if(chunkLoader.isInfinite())
|
||||
return;
|
||||
|
||||
List<String> hologramLines = chunkLoader.getHologramLines();
|
||||
|
||||
int hologramsAmount = holograms.size();
|
||||
for (int i = hologramsAmount; i > 0; i--) {
|
||||
EntityHolograms_v1_9_R1 hologram = holograms.get(hologramsAmount - i);
|
||||
updateName(hologram, plugin.getSettings().hologramLines.get(i - 1));
|
||||
updateName(hologram, hologramLines.get(i - 1));
|
||||
}
|
||||
|
||||
((WChunkLoader) chunkLoader).tick();
|
||||
chunkLoader.tick();
|
||||
|
||||
if(!removed) {
|
||||
secondsAmount--;
|
||||
|
@ -177,37 +177,41 @@ public final class NMSAdapter_v1_9_R2 implements NMSAdapter {
|
||||
private static final Map<Long, TileEntityChunkLoader> tileEntityChunkLoaderMap = new HashMap<>();
|
||||
|
||||
private final List<EntityHolograms_v1_9_R2> holograms = new ArrayList<>();
|
||||
private final ChunkLoader chunkLoader;
|
||||
private final WChunkLoader chunkLoader;
|
||||
|
||||
private short currentTick = 20;
|
||||
private short daysAmount, hoursAmount, minutesAmount, secondsAmount;
|
||||
private boolean removed = false;
|
||||
|
||||
TileEntityChunkLoader(ChunkLoader chunkLoader, World world, BlockPosition blockPosition){
|
||||
this.chunkLoader = chunkLoader;
|
||||
this.chunkLoader = (WChunkLoader) chunkLoader;
|
||||
|
||||
a(blockPosition);
|
||||
a(world);
|
||||
|
||||
long timeLeft = chunkLoader.getTimeLeft();
|
||||
if(!this.chunkLoader.isInfinite()) {
|
||||
long timeLeft = chunkLoader.getTimeLeft();
|
||||
|
||||
daysAmount = (short) (timeLeft / 86400);
|
||||
timeLeft = timeLeft % 86400;
|
||||
daysAmount = (short) (timeLeft / 86400);
|
||||
timeLeft = timeLeft % 86400;
|
||||
|
||||
hoursAmount = (short) (timeLeft / 3600);
|
||||
timeLeft = timeLeft % 3600;
|
||||
hoursAmount = (short) (timeLeft / 3600);
|
||||
timeLeft = timeLeft % 3600;
|
||||
|
||||
minutesAmount = (short) (timeLeft / 60);
|
||||
timeLeft = timeLeft % 60;
|
||||
minutesAmount = (short) (timeLeft / 60);
|
||||
timeLeft = timeLeft % 60;
|
||||
|
||||
secondsAmount = (short) timeLeft;
|
||||
secondsAmount = (short) timeLeft;
|
||||
}
|
||||
|
||||
tileEntityChunkLoaderMap.put(LongHash.toLong(blockPosition.getX() >> 4, blockPosition.getZ() >> 4), this);
|
||||
|
||||
List<String> hologramLines = this.chunkLoader.getHologramLines();
|
||||
|
||||
double currentY = position.getY() + 1;
|
||||
for(int i = plugin.getSettings().hologramLines.size(); i > 0; i--){
|
||||
for(int i = hologramLines.size(); i > 0; i--){
|
||||
EntityHolograms_v1_9_R2 hologram = new EntityHolograms_v1_9_R2(world, position.getX() + 0.5, currentY, position.getZ() + 0.5);
|
||||
updateName(hologram, plugin.getSettings().hologramLines.get(i - 1));
|
||||
updateName(hologram, hologramLines.get(i - 1));
|
||||
world.addEntity(hologram);
|
||||
currentY += 0.23;
|
||||
holograms.add(hologram);
|
||||
@ -221,18 +225,23 @@ public final class NMSAdapter_v1_9_R2 implements NMSAdapter {
|
||||
|
||||
currentTick = 0;
|
||||
|
||||
if(((WChunkLoader) chunkLoader).isNotActive()){
|
||||
if(chunkLoader.isNotActive()){
|
||||
chunkLoader.remove();
|
||||
return;
|
||||
}
|
||||
|
||||
if(chunkLoader.isInfinite())
|
||||
return;
|
||||
|
||||
List<String> hologramLines = chunkLoader.getHologramLines();
|
||||
|
||||
int hologramsAmount = holograms.size();
|
||||
for (int i = hologramsAmount; i > 0; i--) {
|
||||
EntityHolograms_v1_9_R2 hologram = holograms.get(hologramsAmount - i);
|
||||
updateName(hologram, plugin.getSettings().hologramLines.get(i - 1));
|
||||
updateName(hologram, hologramLines.get(i - 1));
|
||||
}
|
||||
|
||||
((WChunkLoader) chunkLoader).tick();
|
||||
chunkLoader.tick();
|
||||
|
||||
if(!removed) {
|
||||
secondsAmount--;
|
||||
|
Loading…
Reference in New Issue
Block a user