mirror of
https://github.com/BlueMap-Minecraft/BlueMap.git
synced 2025-03-12 06:42:26 +01:00
Add option to hide players if they are in the shadows *mystic sound here*
This commit is contained in:
parent
37c125c698
commit
d9df6989ff
@ -18,6 +18,8 @@ public class PluginConfig {
|
||||
private boolean hideInvisible = true;
|
||||
private boolean hideSneaking = false;
|
||||
private boolean hideDifferentWorld = false;
|
||||
private int hideBelowSkyLight = 0;
|
||||
private int hideBelowBlockLight = 0;
|
||||
|
||||
private int writeMarkersInterval = 0;
|
||||
private int writePlayersInterval = 0;
|
||||
@ -52,6 +54,14 @@ public boolean isHideDifferentWorld() {
|
||||
return hideDifferentWorld;
|
||||
}
|
||||
|
||||
public int getHideBelowSkyLight() {
|
||||
return hideBelowSkyLight;
|
||||
}
|
||||
|
||||
public int getHideBelowBlockLight() {
|
||||
return hideBelowBlockLight;
|
||||
}
|
||||
|
||||
public int getWriteMarkersInterval() {
|
||||
return writeMarkersInterval;
|
||||
}
|
||||
|
@ -46,6 +46,8 @@ public String get() {
|
||||
if (config.isHideSneaking() && player.isSneaking()) continue;
|
||||
if (config.getHiddenGameModes().contains(player.getGamemode().getId())) continue;
|
||||
if (config.isHideDifferentWorld() && !isCorrectWorld) continue;
|
||||
if (player.getSkyLight() < config.getHideBelowSkyLight()) continue;
|
||||
if (player.getBlockLight() < config.getHideBelowBlockLight()) continue;
|
||||
if (!this.playerFilter.test(player.getUuid())) continue;
|
||||
|
||||
json.beginObject();
|
||||
|
@ -44,6 +44,10 @@ public interface Player {
|
||||
*/
|
||||
Vector3d getRotation();
|
||||
|
||||
int getSkyLight();
|
||||
|
||||
int getBlockLight();
|
||||
|
||||
boolean isOnline();
|
||||
|
||||
/**
|
||||
|
@ -27,6 +27,12 @@ hide-invisible: true
|
||||
# Default is false
|
||||
hide-sneaking: false
|
||||
|
||||
# Hides the player if they are in a sky or block-light level below the given number.
|
||||
# E.g. if you set this to 1, then the player will be hidden on the map if they are in absolute darkness
|
||||
# Default is 0 (don't hide the player)
|
||||
hide-below-sky-light: 0
|
||||
hide-below-block-light: 0
|
||||
|
||||
# If this is true, players that are on a different world than the viewed map will not appear on the player-list.
|
||||
# Default is false
|
||||
hide-different-world: false
|
||||
|
@ -35,6 +35,7 @@
|
||||
import net.minecraft.server.network.ServerPlayerEntity;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.world.GameMode;
|
||||
import net.minecraft.world.LightType;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.EnumMap;
|
||||
@ -57,6 +58,8 @@ public class FabricPlayer implements Player {
|
||||
private String world;
|
||||
private Vector3d position;
|
||||
private Vector3d rotation;
|
||||
private int skyLight;
|
||||
private int blockLight;
|
||||
private boolean online;
|
||||
private boolean sneaking;
|
||||
private boolean invisible;
|
||||
@ -98,6 +101,16 @@ public Vector3d getRotation() {
|
||||
return rotation;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSkyLight() {
|
||||
return skyLight;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBlockLight() {
|
||||
return blockLight;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOnline() {
|
||||
return this.online;
|
||||
@ -148,6 +161,9 @@ public void update() {
|
||||
this.rotation = new Vector3d(player.pitch, player.headYaw, 0);
|
||||
this.sneaking = player.isSneaking();
|
||||
|
||||
this.skyLight = player.getServerWorld().getLightingProvider().get(LightType.SKY).getLightLevel(player.getBlockPos());
|
||||
this.blockLight = player.getServerWorld().getLightingProvider().get(LightType.BLOCK).getLightLevel(player.getBlockPos());
|
||||
|
||||
try {
|
||||
var world = mod.getWorld(player.getServerWorld());
|
||||
this.world = blueMap.getWorldId(world.getSaveFolder());
|
||||
|
@ -35,6 +35,7 @@
|
||||
import net.minecraft.server.network.ServerPlayerEntity;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.world.GameMode;
|
||||
import net.minecraft.world.LightType;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.EnumMap;
|
||||
@ -57,6 +58,8 @@ public class FabricPlayer implements Player {
|
||||
private String world;
|
||||
private Vector3d position;
|
||||
private Vector3d rotation;
|
||||
private int skyLight;
|
||||
private int blockLight;
|
||||
private boolean online;
|
||||
private boolean sneaking;
|
||||
private boolean invisible;
|
||||
@ -98,6 +101,16 @@ public Vector3d getRotation() {
|
||||
return rotation;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSkyLight() {
|
||||
return skyLight;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBlockLight() {
|
||||
return blockLight;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOnline() {
|
||||
return this.online;
|
||||
@ -148,6 +161,9 @@ public void update() {
|
||||
this.rotation = new Vector3d(player.pitch, player.headYaw, 0);
|
||||
this.sneaking = player.isSneaking();
|
||||
|
||||
this.skyLight = player.getServerWorld().getLightingProvider().get(LightType.SKY).getLightLevel(player.getBlockPos());
|
||||
this.blockLight = player.getServerWorld().getLightingProvider().get(LightType.BLOCK).getLightLevel(player.getBlockPos());
|
||||
|
||||
try {
|
||||
var world = mod.getWorld(player.getServerWorld());
|
||||
this.world = blueMap.getWorldId(world.getSaveFolder());
|
||||
|
@ -35,6 +35,7 @@
|
||||
import net.minecraft.server.network.ServerPlayerEntity;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.world.GameMode;
|
||||
import net.minecraft.world.LightType;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.EnumMap;
|
||||
@ -57,6 +58,8 @@ public class FabricPlayer implements Player {
|
||||
private String world;
|
||||
private Vector3d position;
|
||||
private Vector3d rotation;
|
||||
private int skyLight;
|
||||
private int blockLight;
|
||||
private boolean online;
|
||||
private boolean sneaking;
|
||||
private boolean invisible;
|
||||
@ -98,6 +101,16 @@ public Vector3d getRotation() {
|
||||
return rotation;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSkyLight() {
|
||||
return skyLight;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBlockLight() {
|
||||
return blockLight;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOnline() {
|
||||
return this.online;
|
||||
@ -148,6 +161,9 @@ public void update() {
|
||||
this.rotation = new Vector3d(player.pitch, player.headYaw, 0);
|
||||
this.sneaking = player.isSneaking();
|
||||
|
||||
this.skyLight = player.getServerWorld().getLightingProvider().get(LightType.SKY).getLightLevel(player.getBlockPos());
|
||||
this.blockLight = player.getServerWorld().getLightingProvider().get(LightType.BLOCK).getLightLevel(player.getBlockPos());
|
||||
|
||||
try {
|
||||
var world = mod.getWorld(player.getServerWorld());
|
||||
this.world = blueMap.getWorldId(world.getSaveFolder());
|
||||
|
@ -35,6 +35,7 @@
|
||||
import net.minecraft.server.network.ServerPlayerEntity;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.world.GameMode;
|
||||
import net.minecraft.world.LightType;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.EnumMap;
|
||||
@ -56,6 +57,8 @@ public class FabricPlayer implements Player {
|
||||
private String world;
|
||||
private Vector3d position;
|
||||
private Vector3d rotation;
|
||||
private int skyLight;
|
||||
private int blockLight;
|
||||
private boolean online;
|
||||
private boolean sneaking;
|
||||
private boolean invisible;
|
||||
@ -97,6 +100,16 @@ public Vector3d getRotation() {
|
||||
return rotation;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSkyLight() {
|
||||
return skyLight;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBlockLight() {
|
||||
return blockLight;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOnline() {
|
||||
return this.online;
|
||||
@ -147,6 +160,9 @@ public void update() {
|
||||
this.rotation = new Vector3d(player.getPitch(), player.getHeadYaw(), 0);
|
||||
this.sneaking = player.isSneaking();
|
||||
|
||||
this.skyLight = player.getServerWorld().getLightingProvider().get(LightType.SKY).getLightLevel(player.getBlockPos());
|
||||
this.blockLight = player.getServerWorld().getLightingProvider().get(LightType.BLOCK).getLightLevel(player.getBlockPos());
|
||||
|
||||
try {
|
||||
var world = mod.getWorld(player.getServerWorld());
|
||||
this.world = blueMap.getWorldId(world.getSaveFolder());
|
||||
|
@ -35,6 +35,7 @@
|
||||
import net.minecraft.server.network.ServerPlayerEntity;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.world.GameMode;
|
||||
import net.minecraft.world.LightType;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.EnumMap;
|
||||
@ -56,6 +57,8 @@ public class FabricPlayer implements Player {
|
||||
private String world;
|
||||
private Vector3d position;
|
||||
private Vector3d rotation;
|
||||
private int skyLight;
|
||||
private int blockLight;
|
||||
private boolean online;
|
||||
private boolean sneaking;
|
||||
private boolean invisible;
|
||||
@ -97,6 +100,16 @@ public Vector3d getRotation() {
|
||||
return this.rotation;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSkyLight() {
|
||||
return skyLight;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBlockLight() {
|
||||
return blockLight;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOnline() {
|
||||
return this.online;
|
||||
@ -147,6 +160,9 @@ public void update() {
|
||||
this.rotation = new Vector3d(player.getPitch(), player.getHeadYaw(), 0);
|
||||
this.sneaking = player.isSneaking();
|
||||
|
||||
this.skyLight = player.getWorld().getLightingProvider().get(LightType.SKY).getLightLevel(player.getBlockPos());
|
||||
this.blockLight = player.getWorld().getLightingProvider().get(LightType.BLOCK).getLightLevel(player.getBlockPos());
|
||||
|
||||
try {
|
||||
var world = mod.getWorld(player.getWorld());
|
||||
this.world = blueMap.getWorldId(world.getSaveFolder());
|
||||
|
@ -35,6 +35,7 @@
|
||||
import net.minecraft.server.network.ServerPlayerEntity;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.world.GameMode;
|
||||
import net.minecraft.world.LightType;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.EnumMap;
|
||||
@ -56,6 +57,8 @@ public class FabricPlayer implements Player {
|
||||
private String world;
|
||||
private Vector3d position;
|
||||
private Vector3d rotation;
|
||||
private int skyLight;
|
||||
private int blockLight;
|
||||
private boolean online;
|
||||
private boolean sneaking;
|
||||
private boolean invisible;
|
||||
@ -97,6 +100,16 @@ public Vector3d getRotation() {
|
||||
return rotation;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSkyLight() {
|
||||
return skyLight;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBlockLight() {
|
||||
return blockLight;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOnline() {
|
||||
return this.online;
|
||||
@ -147,6 +160,9 @@ public void update() {
|
||||
this.rotation = new Vector3d(player.getPitch(), player.getHeadYaw(), 0);
|
||||
this.sneaking = player.isSneaking();
|
||||
|
||||
this.skyLight = player.getWorld().getLightingProvider().get(LightType.SKY).getLightLevel(player.getBlockPos());
|
||||
this.blockLight = player.getWorld().getLightingProvider().get(LightType.BLOCK).getLightLevel(player.getBlockPos());
|
||||
|
||||
try {
|
||||
var world = mod.getWorld(player.getWorld());
|
||||
this.world = blueMap.getWorldId(world.getSaveFolder());
|
||||
|
@ -35,6 +35,7 @@
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.world.GameType;
|
||||
import net.minecraft.world.LightType;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.EnumMap;
|
||||
@ -57,6 +58,8 @@ public class ForgePlayer implements Player {
|
||||
private String world;
|
||||
private Vector3d position;
|
||||
private Vector3d rotation;
|
||||
private int skyLight;
|
||||
private int blockLight;
|
||||
private boolean online;
|
||||
private boolean sneaking;
|
||||
private boolean invisible;
|
||||
@ -98,6 +101,16 @@ public Vector3d getRotation() {
|
||||
return rotation;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSkyLight() {
|
||||
return skyLight;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBlockLight() {
|
||||
return blockLight;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOnline() {
|
||||
return this.online;
|
||||
@ -148,6 +161,9 @@ public void update() {
|
||||
this.rotation = new Vector3d(player.rotationPitch, player.rotationYawHead, 0);
|
||||
this.sneaking = player.isSneaking();
|
||||
|
||||
this.skyLight = player.getServerWorld().getChunkProvider().getLightManager().getLightEngine(LightType.SKY).getLightFor(player.getPosition());
|
||||
this.blockLight = player.getServerWorld().getChunkProvider().getLightManager().getLightEngine(LightType.BLOCK).getLightFor(player.getPosition());
|
||||
|
||||
try {
|
||||
var world = mod.getWorld(player.getServerWorld());
|
||||
this.world = blueMap.getWorldId(world.getSaveFolder());
|
||||
|
@ -35,6 +35,7 @@
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.world.GameType;
|
||||
import net.minecraft.world.LightType;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.EnumMap;
|
||||
@ -57,6 +58,8 @@ public class ForgePlayer implements Player {
|
||||
private String world;
|
||||
private Vector3d position;
|
||||
private Vector3d rotation;
|
||||
private int skyLight;
|
||||
private int blockLight;
|
||||
private boolean online;
|
||||
private boolean sneaking;
|
||||
private boolean invisible;
|
||||
@ -98,6 +101,16 @@ public Vector3d getRotation() {
|
||||
return rotation;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSkyLight() {
|
||||
return skyLight;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBlockLight() {
|
||||
return blockLight;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOnline() {
|
||||
return this.online;
|
||||
@ -148,6 +161,9 @@ public void update() {
|
||||
this.rotation = new Vector3d(player.rotationPitch, player.rotationYawHead, 0);
|
||||
this.sneaking = player.isCrouching();
|
||||
|
||||
this.skyLight = player.getServerWorld().getChunkProvider().getLightManager().getLightEngine(LightType.SKY).getLightFor(player.getPosition());
|
||||
this.blockLight = player.getServerWorld().getChunkProvider().getLightManager().getLightEngine(LightType.BLOCK).getLightFor(player.getPosition());
|
||||
|
||||
try {
|
||||
var world = mod.getWorld(player.getServerWorld());
|
||||
this.world = blueMap.getWorldId(world.getSaveFolder());
|
||||
|
@ -33,7 +33,9 @@
|
||||
import net.minecraft.potion.EffectInstance;
|
||||
import net.minecraft.potion.Effects;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.GameType;
|
||||
import net.minecraft.world.LightType;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.EnumMap;
|
||||
@ -56,6 +58,8 @@ public class ForgePlayer implements Player {
|
||||
private String world;
|
||||
private Vector3d position;
|
||||
private Vector3d rotation;
|
||||
private int skyLight;
|
||||
private int blockLight;
|
||||
private boolean online;
|
||||
private boolean sneaking;
|
||||
private boolean invisible;
|
||||
@ -97,6 +101,16 @@ public Vector3d getRotation() {
|
||||
return rotation;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSkyLight() {
|
||||
return skyLight;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBlockLight() {
|
||||
return blockLight;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOnline() {
|
||||
return this.online;
|
||||
@ -147,6 +161,9 @@ public void update() {
|
||||
this.rotation = new Vector3d(player.rotationPitch, player.rotationYawHead, 0);
|
||||
this.sneaking = player.isCrouching();
|
||||
|
||||
this.skyLight = player.getServerWorld().getChunkProvider().getLightManager().getLightEngine(LightType.SKY).getLightFor(new BlockPos(player.getPositionVec()));
|
||||
this.blockLight = player.getServerWorld().getChunkProvider().getLightManager().getLightEngine(LightType.BLOCK).getLightFor(new BlockPos(player.getPositionVec()));
|
||||
|
||||
try {
|
||||
var world = mod.getWorld(player.getServerWorld());
|
||||
this.world = blueMap.getWorldId(world.getSaveFolder());
|
||||
|
@ -29,11 +29,13 @@
|
||||
import de.bluecolored.bluemap.common.serverinterface.Gamemode;
|
||||
import de.bluecolored.bluemap.common.serverinterface.Player;
|
||||
import de.bluecolored.bluemap.common.plugin.text.Text;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.world.effect.MobEffectInstance;
|
||||
import net.minecraft.world.effect.MobEffects;
|
||||
import net.minecraft.world.level.GameType;
|
||||
import net.minecraft.world.level.LightLayer;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
|
||||
import java.io.IOException;
|
||||
@ -56,6 +58,8 @@ public class ForgePlayer implements Player {
|
||||
private String world;
|
||||
private Vector3d position;
|
||||
private Vector3d rotation;
|
||||
private int skyLight;
|
||||
private int blockLight;
|
||||
private boolean online;
|
||||
private boolean sneaking;
|
||||
private boolean invisible;
|
||||
@ -97,6 +101,16 @@ public Vector3d getRotation() {
|
||||
return rotation;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSkyLight() {
|
||||
return skyLight;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBlockLight() {
|
||||
return blockLight;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOnline() {
|
||||
return this.online;
|
||||
@ -147,6 +161,9 @@ public void update() {
|
||||
this.rotation = new Vector3d(player.getXRot(), player.getYHeadRot(), 0);
|
||||
this.sneaking = player.isCrouching();
|
||||
|
||||
this.skyLight = player.getLevel().getChunkSource().getLightEngine().getLayerListener(LightLayer.SKY).getLightValue(new BlockPos(player.getX(), player.getY(), player.getZ()));
|
||||
this.blockLight = player.getLevel().getChunkSource().getLightEngine().getLayerListener(LightLayer.BLOCK).getLightValue(new BlockPos(player.getX(), player.getY(), player.getZ()));
|
||||
|
||||
try {
|
||||
var world = mod.getWorld(player.getLevel());
|
||||
this.world = blueMap.getWorldId(world.getSaveFolder());
|
||||
|
@ -29,11 +29,13 @@
|
||||
import de.bluecolored.bluemap.common.serverinterface.Gamemode;
|
||||
import de.bluecolored.bluemap.common.serverinterface.Player;
|
||||
import de.bluecolored.bluemap.common.plugin.text.Text;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.world.effect.MobEffectInstance;
|
||||
import net.minecraft.world.effect.MobEffects;
|
||||
import net.minecraft.world.level.GameType;
|
||||
import net.minecraft.world.level.LightLayer;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
|
||||
import java.io.IOException;
|
||||
@ -56,6 +58,8 @@ public class ForgePlayer implements Player {
|
||||
private String world;
|
||||
private Vector3d position;
|
||||
private Vector3d rotation;
|
||||
private int skyLight;
|
||||
private int blockLight;
|
||||
private boolean online;
|
||||
private boolean sneaking;
|
||||
private boolean invisible;
|
||||
@ -97,6 +101,16 @@ public Vector3d getRotation() {
|
||||
return rotation;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSkyLight() {
|
||||
return skyLight;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBlockLight() {
|
||||
return blockLight;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOnline() {
|
||||
return this.online;
|
||||
@ -147,6 +161,9 @@ public void update() {
|
||||
this.rotation = new Vector3d(player.getXRot(), player.getYHeadRot(), 0);
|
||||
this.sneaking = player.isCrouching();
|
||||
|
||||
this.skyLight = player.getLevel().getChunkSource().getLightEngine().getLayerListener(LightLayer.SKY).getLightValue(new BlockPos(player.getX(), player.getY(), player.getZ()));
|
||||
this.blockLight = player.getLevel().getChunkSource().getLightEngine().getLayerListener(LightLayer.BLOCK).getLightValue(new BlockPos(player.getX(), player.getY(), player.getZ()));
|
||||
|
||||
try {
|
||||
var world = mod.getWorld(player.getLevel());
|
||||
this.world = blueMap.getWorldId(world.getSaveFolder());
|
||||
|
@ -29,11 +29,13 @@
|
||||
import de.bluecolored.bluemap.common.serverinterface.Gamemode;
|
||||
import de.bluecolored.bluemap.common.serverinterface.Player;
|
||||
import de.bluecolored.bluemap.common.plugin.text.Text;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.world.effect.MobEffectInstance;
|
||||
import net.minecraft.world.effect.MobEffects;
|
||||
import net.minecraft.world.level.GameType;
|
||||
import net.minecraft.world.level.LightLayer;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
|
||||
import java.io.IOException;
|
||||
@ -56,6 +58,8 @@ public class ForgePlayer implements Player {
|
||||
private String world;
|
||||
private Vector3d position;
|
||||
private Vector3d rotation;
|
||||
private int skyLight;
|
||||
private int blockLight;
|
||||
private boolean online;
|
||||
private boolean sneaking;
|
||||
private boolean invisible;
|
||||
@ -97,6 +101,16 @@ public Vector3d getRotation() {
|
||||
return rotation;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSkyLight() {
|
||||
return skyLight;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBlockLight() {
|
||||
return blockLight;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOnline() {
|
||||
return this.online;
|
||||
@ -147,6 +161,9 @@ public void update() {
|
||||
this.rotation = new Vector3d(player.getXRot(), player.getYHeadRot(), 0);
|
||||
this.sneaking = player.isCrouching();
|
||||
|
||||
this.skyLight = player.getLevel().getChunkSource().getLightEngine().getLayerListener(LightLayer.SKY).getLightValue(new BlockPos(player.getX(), player.getY(), player.getZ()));
|
||||
this.blockLight = player.getLevel().getChunkSource().getLightEngine().getLayerListener(LightLayer.BLOCK).getLightValue(new BlockPos(player.getX(), player.getY(), player.getZ()));
|
||||
|
||||
try {
|
||||
var world = mod.getWorld(player.getLevel());
|
||||
this.world = blueMap.getWorldId(world.getSaveFolder());
|
||||
|
@ -29,11 +29,13 @@
|
||||
import de.bluecolored.bluemap.common.serverinterface.Gamemode;
|
||||
import de.bluecolored.bluemap.common.serverinterface.Player;
|
||||
import de.bluecolored.bluemap.common.plugin.text.Text;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.world.effect.MobEffectInstance;
|
||||
import net.minecraft.world.effect.MobEffects;
|
||||
import net.minecraft.world.level.GameType;
|
||||
import net.minecraft.world.level.LightLayer;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
|
||||
import java.io.IOException;
|
||||
@ -56,6 +58,8 @@ public class ForgePlayer implements Player {
|
||||
private String world;
|
||||
private Vector3d position;
|
||||
private Vector3d rotation;
|
||||
private int skyLight;
|
||||
private int blockLight;
|
||||
private boolean online;
|
||||
private boolean sneaking;
|
||||
private boolean invisible;
|
||||
@ -97,6 +101,16 @@ public Vector3d getRotation() {
|
||||
return rotation;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSkyLight() {
|
||||
return skyLight;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBlockLight() {
|
||||
return blockLight;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOnline() {
|
||||
return this.online;
|
||||
@ -147,6 +161,9 @@ public void update() {
|
||||
this.rotation = new Vector3d(player.getXRot(), player.getYHeadRot(), 0);
|
||||
this.sneaking = player.isCrouching();
|
||||
|
||||
this.skyLight = player.getLevel().getChunkSource().getLightEngine().getLayerListener(LightLayer.SKY).getLightValue(new BlockPos(player.getX(), player.getY(), player.getZ()));
|
||||
this.blockLight = player.getLevel().getChunkSource().getLightEngine().getLayerListener(LightLayer.BLOCK).getLightValue(new BlockPos(player.getX(), player.getY(), player.getZ()));
|
||||
|
||||
try {
|
||||
var world = mod.getWorld(player.getLevel());
|
||||
this.world = blueMap.getWorldId(world.getSaveFolder());
|
||||
|
@ -54,6 +54,8 @@ public class BukkitPlayer implements Player {
|
||||
private String world;
|
||||
private Vector3d position;
|
||||
private Vector3d rotation;
|
||||
private int skyLight;
|
||||
private int blockLight;
|
||||
private boolean online;
|
||||
private boolean sneaking;
|
||||
private boolean invisible;
|
||||
@ -90,6 +92,16 @@ public Vector3d getRotation() {
|
||||
return rotation;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSkyLight() {
|
||||
return skyLight;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBlockLight() {
|
||||
return blockLight;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOnline() {
|
||||
return this.online;
|
||||
@ -145,6 +157,9 @@ public void update() {
|
||||
this.rotation = new Vector3d(location.getPitch(), location.getYaw(), 0);
|
||||
this.sneaking = player.isSneaking();
|
||||
|
||||
this.skyLight = player.getLocation().getBlock().getLightFromSky();
|
||||
this.blockLight = player.getLocation().getBlock().getLightFromBlocks();
|
||||
|
||||
try {
|
||||
var world = BukkitPlugin.getInstance().getWorld(player.getWorld());
|
||||
this.world = BukkitPlugin.getInstance().getPlugin().getBlueMap().getWorldId(world.getSaveFolder());
|
||||
|
@ -25,9 +25,9 @@
|
||||
package de.bluecolored.bluemap.sponge;
|
||||
|
||||
import com.flowpowered.math.vector.Vector3d;
|
||||
import de.bluecolored.bluemap.common.plugin.text.Text;
|
||||
import de.bluecolored.bluemap.common.serverinterface.Gamemode;
|
||||
import de.bluecolored.bluemap.common.serverinterface.Player;
|
||||
import de.bluecolored.bluemap.common.plugin.text.Text;
|
||||
import org.spongepowered.api.Sponge;
|
||||
import org.spongepowered.api.data.Keys;
|
||||
import org.spongepowered.api.effect.VanishState;
|
||||
@ -36,6 +36,7 @@
|
||||
import org.spongepowered.api.entity.living.player.gamemode.GameMode;
|
||||
import org.spongepowered.api.entity.living.player.gamemode.GameModes;
|
||||
import org.spongepowered.api.entity.living.player.server.ServerPlayer;
|
||||
import org.spongepowered.api.world.LightTypes;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
@ -56,6 +57,8 @@ public class SpongePlayer implements Player {
|
||||
private String world;
|
||||
private Vector3d position;
|
||||
private Vector3d rotation;
|
||||
private int skyLight;
|
||||
private int blockLight;
|
||||
private boolean online;
|
||||
private boolean sneaking;
|
||||
private boolean invisible;
|
||||
@ -92,6 +95,16 @@ public Vector3d getRotation() {
|
||||
return rotation;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSkyLight() {
|
||||
return skyLight;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBlockLight() {
|
||||
return blockLight;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOnline() {
|
||||
return this.online;
|
||||
@ -147,6 +160,9 @@ public void update() {
|
||||
this.rotation = SpongePlugin.fromSpongePoweredVector(player.rotation());
|
||||
this.sneaking = player.get(Keys.IS_SNEAKING).orElse(false);
|
||||
|
||||
this.skyLight = player.world().light(LightTypes.SKY, player.blockPosition());
|
||||
this.blockLight = player.world().light(LightTypes.BLOCK, player.blockPosition());
|
||||
|
||||
try {
|
||||
var world = SpongePlugin.getInstance().getWorld(player.world());
|
||||
this.world = SpongePlugin.getInstance().getPlugin().getBlueMap().getWorldId(world.getSaveFolder());
|
||||
|
@ -36,6 +36,7 @@
|
||||
import org.spongepowered.api.entity.living.player.gamemode.GameMode;
|
||||
import org.spongepowered.api.entity.living.player.gamemode.GameModes;
|
||||
import org.spongepowered.api.entity.living.player.server.ServerPlayer;
|
||||
import org.spongepowered.api.world.LightTypes;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
@ -55,6 +56,8 @@ public class SpongePlayer implements Player {
|
||||
private String world;
|
||||
private Vector3d position;
|
||||
private Vector3d rotation;
|
||||
private int skyLight;
|
||||
private int blockLight;
|
||||
private boolean online;
|
||||
private boolean sneaking;
|
||||
private boolean invisible;
|
||||
@ -91,6 +94,16 @@ public Vector3d getRotation() {
|
||||
return rotation;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSkyLight() {
|
||||
return skyLight;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBlockLight() {
|
||||
return blockLight;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOnline() {
|
||||
return this.online;
|
||||
@ -146,6 +159,9 @@ public void update() {
|
||||
this.rotation = SpongePlugin.fromSpongePoweredVector(player.rotation());
|
||||
this.sneaking = player.get(Keys.IS_SNEAKING).orElse(false);
|
||||
|
||||
this.skyLight = player.world().light(LightTypes.SKY, player.blockPosition());
|
||||
this.blockLight = player.world().light(LightTypes.BLOCK, player.blockPosition());
|
||||
|
||||
try {
|
||||
var world = SpongePlugin.getInstance().getWorld(player.world());
|
||||
this.world = SpongePlugin.getInstance().getPlugin().getBlueMap().getWorldId(world.getSaveFolder());
|
||||
|
Loading…
Reference in New Issue
Block a user