Skip to content

Commit

Permalink
Fix my dumbassery
Browse files Browse the repository at this point in the history
  • Loading branch information
Stunf committed Jul 26, 2024
1 parent 9aa99e3 commit 38eecf7
Show file tree
Hide file tree
Showing 11 changed files with 34 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ public void registerListener(){
if (!EventUtil.dropItem(player, playerDropItemEvent.getItemStack())) {
playerDropItemEvent.setCancelled(true);
player.refreshInventory();
return;
}
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
import com.nexia.base.player.PlayerDataManager;
import com.nexia.core.NexiaCore;
import com.nexia.core.utilities.player.CorePlayerData;
import com.nexia.minigames.games.bedwars.BwGame;
import com.nexia.minigames.games.oitc.OitcGame;
import com.nexia.minigames.games.oitc.OitcGameMode;
import com.nexia.minigames.games.oitc.util.player.OITCPlayerData;
import com.nexia.minigames.games.skywars.util.player.SkywarsPlayerData;
import com.nexia.nexus.api.event.player.PlayerRespawnEvent;
import com.nexia.nexus.api.world.types.Minecraft;
Expand Down Expand Up @@ -56,16 +60,36 @@ public void registerListener(){
return;
}

if(data.gameMode == PlayerGameMode.BEDWARS && hasRespawned(respawnEvent)) {
player.setGameMode(Minecraft.GameMode.SURVIVAL);
}
if(data.gameMode == PlayerGameMode.BEDWARS) {
Location respawn = new Location(0,100, 0, WorldUtil.getWorld(BwGame.world));

if(data.gameMode == PlayerGameMode.SKYWARS && hasRespawned(respawnEvent)) {
player.setGameMode(Minecraft.GameMode.SPECTATOR);
ServerPlayer serverPlayer = PlayerUtil.getPlayerAttacker(player.unwrap());
if(serverPlayer != null && serverPlayer != player.unwrap()) {
respawn.setX(serverPlayer.getX());
respawn.setY(serverPlayer.getY());
respawn.setZ(serverPlayer.getZ());
respawnEvent.setRespawnMode(Minecraft.GameMode.ADVENTURE);
respawnEvent.setSpawnpoint(respawn);
}

return;
}

if(data.gameMode == PlayerGameMode.OITC && hasRespawned(respawnEvent)) {
player.setGameMode(Minecraft.GameMode.ADVENTURE);

if(data.gameMode == PlayerGameMode.OITC) {
Location respawn = new Location(0,100, 0, WorldUtil.getWorld(OitcGame.world));

boolean isPlaying = ((OITCPlayerData)PlayerDataManager.getDataManager(NexiaCore.OITC_DATA_MANAGER).get(player)).gameMode == OitcGameMode.PLAYING;
ServerPlayer serverPlayer = PlayerUtil.getPlayerAttacker(player.unwrap());
if(serverPlayer != null && serverPlayer != player.unwrap() && isPlaying) {
respawn.setX(serverPlayer.getX());
respawn.setY(serverPlayer.getY());
respawn.setZ(serverPlayer.getZ());
respawnEvent.setRespawnMode(Minecraft.GameMode.ADVENTURE);
respawnEvent.setSpawnpoint(respawn);
}

return;
}

if(duelsGame != null && duelsGame.isEnding && duelsGame.winner != null) {
Expand Down Expand Up @@ -132,8 +156,4 @@ public void registerListener(){

});
}

private boolean hasRespawned(PlayerRespawnEvent respawnEvent) {
return respawnEvent != null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ public void registerListener(){

if(LobbyUtil.isLobbyWorld(player.getWorld())) {
playerDropItemEvent.setCancelled(true);
return;
}
});
}
Expand Down
3 changes: 0 additions & 3 deletions src/main/java/com/nexia/core/mixin/player/PlayerMixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@
import com.nexia.core.utilities.pos.EntityPos;
import com.nexia.ffa.base.BaseFfaUtil;
import com.nexia.ffa.sky.utilities.FfaSkyUtil;
import com.nexia.ffa.sky.utilities.SkyFfaAreas;
import com.nexia.ffa.uhc.utilities.FfaUhcUtil;
import com.nexia.ffa.uhc.utilities.UhcFfaAreas;
import com.nexia.minigames.games.bedwars.players.BwPlayerEvents;
import com.nexia.minigames.games.bedwars.util.BwUtil;
import com.nexia.minigames.games.duels.DuelGameMode;
Expand Down Expand Up @@ -117,7 +115,6 @@ private void beforeHurt(DamageSource damageSource, float damage, CallbackInfoRet
if(attacker != null) {
if(attacker.getTags().contains(LobbyUtil.NO_DAMAGE_TAG)) {
cir.setReturnValue(false);
return;
}

/*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
import com.nexia.core.utilities.item.BlockUtil;
import com.nexia.base.player.NexiaPlayer;
import com.nexia.ffa.sky.utilities.FfaSkyUtil;
import com.nexia.ffa.sky.utilities.SkyFfaAreas;
import com.nexia.ffa.uhc.utilities.UhcFfaAreas;
import com.nexia.ffa.uhc.utilities.FfaUhcUtil;
import com.nexia.minigames.games.bedwars.areas.BwAreas;
import com.nexia.minigames.games.bedwars.players.BwPlayerEvents;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import net.fabricmc.fabric.api.networking.v1.ServerPlayConnectionEvents;
import net.fabricmc.fabric.api.networking.v1.ServerPlayNetworking;
import net.kyori.adventure.text.Component;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.resources.ResourceLocation;

public class NetworkingHandler {
Expand Down
3 changes: 1 addition & 2 deletions src/main/java/com/nexia/discord/NexiaDiscord.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import net.dv8tion.jda.api.interactions.commands.build.OptionData;
import net.dv8tion.jda.api.requests.GatewayIntent;
import net.fabricmc.api.ModInitializer;
import net.minecraft.resources.ResourceLocation;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.Logger;

Expand Down Expand Up @@ -51,7 +50,7 @@ public static void registerCommands() {
.addChoice("EU", "eu")
.addChoice("NA", "na")
.addChoice("DEV", "dev"),
new OptionData(OptionType.INTEGER, "code", "The code when you do /link in minecraft.")
new OptionData(OptionType.INTEGER, "code", "The code when you do /link in Minecraft.")
.setRequired(true)
.setRequiredRange(1000, 9999)
)
Expand Down
1 change: 0 additions & 1 deletion src/main/java/com/nexia/ffa/FfaAreas.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import com.nexia.core.utilities.pos.PositionUtil;
import com.nexia.nexus.api.world.World;
import com.nexia.nexus.api.world.util.Location;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.level.Level;
import net.minecraft.world.phys.AABB;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package com.nexia.ffa.classic.utilities;

import com.nexia.base.player.NexiaPlayer;
import com.nexia.core.utilities.pos.EntityPos;
import com.nexia.core.utilities.pos.PositionUtil;
import com.nexia.core.utilities.world.WorldUtil;
import com.nexia.ffa.FfaAreas;
import com.nexia.nexus.api.world.World;
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/com/nexia/minigames/games/bedwars/BwGame.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import com.nexia.minigames.games.bedwars.util.BwUtil;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.title.Title;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.sounds.SoundEvents;
import net.minecraft.sounds.SoundSource;
import net.minecraft.world.entity.Entity;
Expand All @@ -41,6 +41,7 @@ public class BwGame {

public static final String bedWarsDirectory = NxFileUtil.addConfigDir("bedwars");

public static ServerLevel world = null;
public static boolean isGameActive = false;
public static int gameTicks = 0;
public static final int gameLength = 30 * 60 + 1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import com.nexia.nexus.api.util.Identifier;
import com.nexia.nexus.builder.implementation.world.structure.StructureMap;
import net.minecraft.core.BlockPos;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.level.block.Blocks;

Expand Down

0 comments on commit 38eecf7

Please sign in to comment.