Skip to content

Commit

Permalink
fix skyffa death messages & effect particles
Browse files Browse the repository at this point in the history
  • Loading branch information
not-coded committed Aug 4, 2024
1 parent 96a07f7 commit 5576441
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/main/java/com/nexia/base/player/NexiaPlayer.java
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public PlayerGameMode getCurrentGameMode() {
}

public NexiaPlayer refreshPlayer() {
return new NexiaPlayer(ServerTime.nexusServer.getPlayer(this.getUUID()));
return new NexiaPlayer(PlayerUtil.getMinecraftPlayer(this.getUUID()));
}

public boolean isInGameMode(PlayerGameMode gameMode) {
Expand Down
11 changes: 5 additions & 6 deletions src/main/java/com/nexia/ffa/base/BaseFfaUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import com.nexia.nexus.api.world.types.Minecraft;
import com.nexia.nexus.api.world.util.BoundingBox;
import com.nexia.nexus.api.world.util.Location;
import com.nexia.nexus.api.world.util.Vector3D;
import com.nexia.nexus.builder.implementation.world.entity.projectile.WrappedProjectile;
import io.github.blumbo.inventorymerger.InventoryMerger;
import io.github.blumbo.inventorymerger.saving.SavableInventory;
Expand Down Expand Up @@ -173,7 +172,7 @@ public void killHeal(NexiaPlayer attacker) {
public void doPreKill(NexiaPlayer attacker, NexiaPlayer player) {
}

public void calculateDeath(NexiaPlayer player){
public void calculateDeath(NexiaPlayer player, boolean sendMessage){
if (player.hasTag("bot")) return;

SavedPlayerData data = getDataManager().get(player).savedData;
Expand All @@ -182,9 +181,9 @@ public void calculateDeath(NexiaPlayer player){
if (killstreak > data.get(Integer.class, "bestKillstreak"))
data.set(Integer.class, "bestKillstreak", killstreak);

if (killstreak >= 5) {
for (ServerPlayer serverPlayer : getFfaWorld().players()) {
new NexiaPlayer(serverPlayer).sendMessage(
if (killstreak >= 5 && sendMessage) {
for (Player nexusPlayer : getNexusFfaWorld().getPlayers()) {
nexusPlayer.sendMessage(
Component.text("[").color(ChatFormat.lineColor)
.append(Component.text("☠", ChatFormat.failColor))
.append(Component.text("] ").color(ChatFormat.lineColor))
Expand Down Expand Up @@ -214,7 +213,7 @@ public AABB getFfaCorners() {


public void setDeathMessage(@NotNull NexiaPlayer player, @Nullable ServerPlayer attacker, @Nullable DamageSource source) {
calculateDeath(player);
calculateDeath(player, true);

Component msg = FfaUtil.returnDeathMessage(player, source);

Expand Down
10 changes: 8 additions & 2 deletions src/main/java/com/nexia/ffa/sky/utilities/FfaSkyUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import net.kyori.adventure.text.Component;
import net.minecraft.core.BlockPos;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.sounds.SoundEvents;
import net.minecraft.sounds.SoundSource;
import net.minecraft.world.InteractionHand;
Expand Down Expand Up @@ -111,12 +112,12 @@ public void alterInventory(NexiaPlayer player) {

public void respawn(NexiaPlayer player) {
super.respawn(player);
player.addEffectInstance(StatusEffectInstance.create(Minecraft.Effect.RESISTANCE, 1000000));
player.addEffectInstance(StatusEffectInstance.create(Minecraft.Effect.RESISTANCE, 1000000, 0, false));
}

public void join(NexiaPlayer player, boolean tp) {
super.join(player, tp);
player.addEffectInstance(StatusEffectInstance.create(Minecraft.Effect.RESISTANCE, 1000000));
player.addEffectInstance(StatusEffectInstance.create(Minecraft.Effect.RESISTANCE, 1000000, 0, false));
}

private static ItemStack setWoolColor(ItemStack itemStack) {
Expand Down Expand Up @@ -213,6 +214,11 @@ public boolean beforeBuild(NexiaPlayer player, BlockPos blockPos) {
return canBuild(player, blockPos);
}

@Override
public void setDeathMessage(@NotNull NexiaPlayer player, @Nullable ServerPlayer attacker, @Nullable DamageSource source) {
calculateDeath(player, false);
}

@Override
public Minecraft.GameMode getMinecraftGameMode() {
return Minecraft.GameMode.SURVIVAL;
Expand Down

0 comments on commit 5576441

Please sign in to comment.