Skip to content

Commit

Permalink
me when waiting to test update
Browse files Browse the repository at this point in the history
!! NEED TO TEST !!

IM LOOKING AT YOU SURGEFLAME

- not sure if copied from dev correctly (might've forgotten to add some code)
  • Loading branch information
not-coded committed Dec 21, 2023
1 parent 92e00ca commit e5c38e9
Show file tree
Hide file tree
Showing 103 changed files with 3,153 additions and 506 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Last Sync with [Dev](https://github.com/nexia-cts/Nexia-Mod/tree/dev):

[003694ce3a026fd71e36337412a964f187582269](https://github.com/nexia-cts/Nexia-Mod/commit/003694ce3a026fd71e36337412a964f187582269)
[7b23c91a0b711df5e1c7da5edc09c2078a9ea4ad](https://github.com/nexia-cts/Nexia-Mod/commit/7b23c91a0b711df5e1c7da5edc09c2078a9ea4ad)

*(may be 1 commit forward)*

Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ dependencies {
exclude(group: "org.apache.logging.log4j")
}
implementation("org.apache.logging.log4j:log4j-core:2.20.0")
implementation("com.google.code.gson:gson:2.9.0")
implementation("com.google.code.gson:gson:2.10.1")

modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"

Expand Down
2 changes: 0 additions & 2 deletions src/main/java/com/nexia/core/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@

public class Main implements ModInitializer, FactoryPlugin {

public static MinecraftServer server;

public static ModConfig config;

public static final String MOD_NAME = "Nexia";
Expand Down
24 changes: 24 additions & 0 deletions src/main/java/com/nexia/core/commands/player/PlayCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ public static void register(CommandDispatcher<CommandSourceStack> dispatcher, bo
.then(Commands.literal("bedwars").executes(PlayCommand::playBedwars))
.then(Commands.literal("bw").executes(PlayCommand::playBedwars))
.then(Commands.literal("ffa").executes(PlayCommand::openGUI)
.then(Commands.literal("kits").executes(PlayCommand::playKitFFA))
.then(Commands.literal("pot").executes(PlayCommand::playPotFFA))
.then(Commands.literal("uhc").executes(PlayCommand::playUhcFFA))
.then(Commands.literal("classic").executes(PlayCommand::playNormalFFA)))
.then(Commands.literal("duels").executes(PlayCommand::playDuels)));
dispatcher.register(Commands.literal("join").executes(PlayCommand::openGUI)
Expand All @@ -26,6 +29,9 @@ public static void register(CommandDispatcher<CommandSourceStack> dispatcher, bo
.then(Commands.literal("bedwars").executes(PlayCommand::playBedwars))
.then(Commands.literal("bw").executes(PlayCommand::playBedwars))
.then(Commands.literal("ffa").executes(PlayCommand::openGUI)
.then(Commands.literal("pot").executes(PlayCommand::playPotFFA))
.then(Commands.literal("uhc").executes(PlayCommand::playUhcFFA))
.then(Commands.literal("kits").executes(PlayCommand::playKitFFA))
.then(Commands.literal("classic").executes(PlayCommand::playNormalFFA)))
.then(Commands.literal("duels").executes(PlayCommand::playDuels))
);
Expand All @@ -43,6 +49,24 @@ private static int playNormalFFA(CommandContext<CommandSourceStack> context) thr
return 1;
}

private static int playUhcFFA(CommandContext<CommandSourceStack> context) throws CommandSyntaxException {
ServerPlayer player = context.getSource().getPlayerOrException();
LobbyUtil.sendGame(player, "uhc ffa", true, true);
return 1;
}

private static int playPotFFA(CommandContext<CommandSourceStack> context) throws CommandSyntaxException {
ServerPlayer player = context.getSource().getPlayerOrException();
LobbyUtil.sendGame(player, "pot ffa", true, true);
return 1;
}

private static int playKitFFA(CommandContext<CommandSourceStack> context) throws CommandSyntaxException {
ServerPlayer player = context.getSource().getPlayerOrException();
LobbyUtil.sendGame(player, "kits ffa", true, true);
return 1;
}

private static int playBedwars(CommandContext<CommandSourceStack> context) throws CommandSyntaxException {
ServerPlayer player = context.getSource().getPlayerOrException();
LobbyUtil.sendGame(player, "bedwars", true, true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ public static int report(CommandContext<CommandSourceStack> context, ServerPlaye

ServerPlayer staffPlayer;
sendWebhook(executor.getRawName(), player.getScoreboardName(), reason);
for (int i = 0; i != Main.server.getPlayerCount(); i++){
staffPlayer = PlayerUtil.getMinecraftPlayerFromName(Main.server.getPlayerNames()[i]);
for (int i = 0; i != ServerTime.minecraftServer.getPlayerCount(); i++){
staffPlayer = PlayerUtil.getMinecraftPlayerFromName(ServerTime.minecraftServer.getPlayerNames()[i]);
if(Permissions.check(staffPlayer, "nexia.staff.report", 1)) {
PlayerUtil.getFactoryPlayer(staffPlayer).sendMessage(
ChatFormat.nexiaMessage
Expand Down
21 changes: 12 additions & 9 deletions src/main/java/com/nexia/core/commands/player/SpectateCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
import com.nexia.core.utilities.player.PlayerData;
import com.nexia.core.utilities.player.PlayerDataManager;
import com.nexia.core.utilities.player.PlayerUtil;
import com.nexia.ffa.utilities.FfaAreas;
import com.nexia.ffa.utilities.FfaUtil;
import com.nexia.minigames.games.duels.DuelGameMode;
import com.nexia.minigames.games.duels.gamemodes.GamemodeHandler;
import me.lucko.fabric.api.permissions.v0.Permissions;
Expand Down Expand Up @@ -76,7 +74,7 @@ public static int gameModeSpectate(CommandContext<CommandSourceStack> context) t

if(factoryExecutor.getHealth() < 20) {
factoryExecutor.sendMessage(ChatFormat.nexiaMessage.append(
Component.text("You must be fully healed to go into spectator!").decoration(ChatFormat.bold, false))
Component.text("You must be fully healed to go into spectator!").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false))
);
return 0;
}
Expand All @@ -97,7 +95,7 @@ public static int spectate(CommandContext<CommandSourceStack> context, ServerPla

if(!Permissions.check(executor, "nexia.prefix.supporter")) {
factoryExecutor.sendMessage(ChatFormat.nexiaMessage.append(
Component.text("This feature is only available for").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false)
Component.text("This feature is only available for ").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false)
.append(Component.text("Supporters")
.color(ChatFormat.brandColor1)
.decoration(ChatFormat.bold, true)
Expand All @@ -107,27 +105,32 @@ public static int spectate(CommandContext<CommandSourceStack> context, ServerPla
.append(Component.text("!").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false))
)
)

);
return 0;
}

if(!FfaUtil.isFfaPlayer(player)) {
if(PlayerDataManager.get(executor).gameMode != PlayerGameMode.FFA) {
factoryExecutor.sendMessage(ChatFormat.nexiaMessage.append(
Component.text("That player is not in FFA!").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false)
Component.text("This can only be used in FFA!").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false)
));
factoryExecutor.sendMessage(ChatFormat.nexiaMessage.append(
Component.text("If you are in duels then you do /spectate <player>.").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false)
));
return 0;
}

// Check if player is in combat (or full health), then put them in spectator.

if(factoryExecutor.getHealth() < 20) {
factoryExecutor.sendMessage(ChatFormat.nexiaMessage.append(
Component.text("You must be fully healed to go into spectator!").decoration(ChatFormat.bold, false))
Component.text("You must be fully healed to go into spectator!").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false))
);
return 0;
}

factoryExecutor.setGameMode(Minecraft.GameMode.SPECTATOR);
executor.teleportTo(FfaAreas.ffaWorld, player.getX(), player.getY(), player.getZ(), 0, 0);
executor.teleportTo(player.getLevel(), player.getX(), player.getY(), player.getZ(), 0, 0);
// potential bug caused here if manipulated correctly? [player.getLevel()]

return 1;
}
Expand Down
106 changes: 86 additions & 20 deletions src/main/java/com/nexia/core/commands/player/StatsCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@
import com.nexia.core.utilities.chat.ChatFormat;
import com.nexia.core.utilities.player.PlayerData;
import com.nexia.core.utilities.player.PlayerUtil;
import com.nexia.ffa.utilities.player.PlayerDataManager;
import com.nexia.ffa.utilities.player.SavedPlayerData;
import com.nexia.ffa.FfaGameMode;
import com.nexia.ffa.classic.utilities.player.PlayerDataManager;
import com.nexia.ffa.classic.utilities.player.SavedPlayerData;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.format.NamedTextColor;
import net.kyori.adventure.text.format.TextColor;
Expand All @@ -36,7 +37,7 @@ public static void register(CommandDispatcher<CommandSourceStack> dispatcher, bo
public static int run(CommandContext<CommandSourceStack> context) throws CommandSyntaxException {

ServerPlayer mcPlayer = context.getSource().getPlayerOrException();
PlayerData executerData = com.nexia.core.utilities.player.PlayerDataManager.get(mcPlayer);
PlayerData executorData = com.nexia.core.utilities.player.PlayerDataManager.get(mcPlayer);
Player player = PlayerUtil.getFactoryPlayer(mcPlayer);


Expand All @@ -49,35 +50,67 @@ public static int run(CommandContext<CommandSourceStack> context) throws Command

Component message;

if (executerData.gameMode == PlayerGameMode.FFA) {
message = ChatFormat.separatorLine("FFA Stats");
if (executorData.gameMode == PlayerGameMode.FFA) {
message = ChatFormat.separatorLine("FFA Classic Stats");
SavedPlayerData data = PlayerDataManager.get(mcPlayer).savedData;

int kills = data.kills;
int deaths = data.deaths;
int killstreak = data.killstreak;
int bestKillstreak = data.bestKillstreak;

if(executorData.ffaGameMode == FfaGameMode.KITS) {
message = ChatFormat.separatorLine("Kit FFA Stats");
com.nexia.ffa.kits.utilities.player.SavedPlayerData kData = com.nexia.ffa.kits.utilities.player.PlayerDataManager.get(mcPlayer).savedData;
kills = kData.kills;
deaths = kData.deaths;
killstreak = kData.killstreak;
bestKillstreak = kData.bestKillstreak;
}

if(executorData.ffaGameMode == FfaGameMode.UHC) {
message = ChatFormat.separatorLine("UHC FFA Stats");
com.nexia.ffa.uhc.utilities.player.SavedPlayerData kData = com.nexia.ffa.uhc.utilities.player.PlayerDataManager.get(mcPlayer).savedData;
kills = kData.kills;
deaths = kData.deaths;
killstreak = kData.killstreak;
bestKillstreak = kData.bestKillstreak;
}

if(executorData.ffaGameMode == FfaGameMode.POT) {
message = ChatFormat.separatorLine("Pot FFA Stats");
com.nexia.ffa.pot.utilities.player.SavedPlayerData kData = com.nexia.ffa.pot.utilities.player.PlayerDataManager.get(mcPlayer).savedData;
kills = kData.kills;
deaths = kData.deaths;
killstreak = kData.killstreak;
bestKillstreak = kData.bestKillstreak;
}

player.sendMessage(message);
player.sendMessage(user);
player.sendMessage(start
.append(Component.text(" Kills: ").color(ChatFormat.brandColor2))
.append(Component.text(data.kills).color(ChatFormat.greenColor))
.append(Component.text(kills).color(ChatFormat.greenColor))
);
player.sendMessage(start
.append(Component.text(" Deaths: ").color(ChatFormat.brandColor2))
.append(Component.text(data.deaths).color(ChatFormat.failColor))
.append(Component.text(deaths).color(ChatFormat.failColor))
);

player.sendMessage(start
.append(Component.text(" KDR: ").color(ChatFormat.brandColor2))
.append(Component.text(calculateKDR(data.kills, data.deaths)).color(ChatFormat.greenColor))
.append(Component.text(calculateKDR(kills, deaths)).color(ChatFormat.greenColor))
);

player.sendMessage(start
.append(Component.text(" Killstreak: ").color(ChatFormat.brandColor2))
.append(Component.text(data.killstreak).color(TextColor.fromHexString("#f5bc42")))
.append(Component.text(killstreak).color(TextColor.fromHexString("#f5bc42")))
.append(Component.text("/").color(ChatFormat.arrowColor))
.append(Component.text(data.bestKillstreak).color(TextColor.fromHexString("#f5bc42")))
.append(Component.text(bestKillstreak).color(TextColor.fromHexString("#f5bc42")))
);
}

if (executerData.gameMode == PlayerGameMode.LOBBY) {
if (executorData.gameMode == PlayerGameMode.LOBBY) {
message = ChatFormat.separatorLine("Duels Stats");
com.nexia.minigames.games.duels.util.player.SavedPlayerData data = com.nexia.minigames.games.duels.util.player.PlayerDataManager.get(mcPlayer).savedData;
player.sendMessage(message);
Expand All @@ -92,7 +125,7 @@ public static int run(CommandContext<CommandSourceStack> context) throws Command
);
}

if (executerData.gameMode == PlayerGameMode.BEDWARS) {
if (executorData.gameMode == PlayerGameMode.BEDWARS) {
message = ChatFormat.separatorLine("BedWars Stats");
com.nexia.minigames.games.bedwars.util.player.SavedPlayerData data = com.nexia.minigames.games.bedwars.util.player.PlayerDataManager.get(mcPlayer).savedData;
player.sendMessage(message);
Expand All @@ -111,7 +144,7 @@ public static int run(CommandContext<CommandSourceStack> context) throws Command
);
}

if(executerData.gameMode == PlayerGameMode.SKYWARS){
if(executorData.gameMode == PlayerGameMode.SKYWARS){
message = ChatFormat.separatorLine("SkyWars Stats");
com.nexia.minigames.games.skywars.util.player.SavedPlayerData data = com.nexia.minigames.games.skywars.util.player.PlayerDataManager.get(mcPlayer).savedData;

Expand Down Expand Up @@ -157,31 +190,64 @@ public static int other(CommandContext<CommandSourceStack> context, ServerPlayer

Component message;

if(gamemode.equalsIgnoreCase("ffa")){
message = ChatFormat.separatorLine("FFA Stats");

if(gamemode.equalsIgnoreCase("ffa classic") || gamemode.equalsIgnoreCase("kit ffa")){
message = ChatFormat.separatorLine("FFA Classic Stats");
SavedPlayerData data = PlayerDataManager.get(otherPlayer).savedData;

int kills = data.kills;
int deaths = data.deaths;
int killstreak = data.killstreak;
int bestKillstreak = data.bestKillstreak;

if(gamemode.equalsIgnoreCase("kit ffa")) {
message = ChatFormat.separatorLine("Kit FFA Stats");
com.nexia.ffa.kits.utilities.player.SavedPlayerData kData = com.nexia.ffa.kits.utilities.player.PlayerDataManager.get(otherPlayer).savedData;
kills = kData.kills;
deaths = kData.deaths;
killstreak = kData.killstreak;
bestKillstreak = kData.bestKillstreak;
}

if(gamemode.equalsIgnoreCase("pot ffa")) {
message = ChatFormat.separatorLine("Pot FFA Stats");
com.nexia.ffa.pot.utilities.player.SavedPlayerData kData = com.nexia.ffa.pot.utilities.player.PlayerDataManager.get(otherPlayer).savedData;
kills = kData.kills;
deaths = kData.deaths;
killstreak = kData.killstreak;
bestKillstreak = kData.bestKillstreak;
}

if(gamemode.equalsIgnoreCase("uhc ffa")) {
message = ChatFormat.separatorLine("UHC FFA Stats");
com.nexia.ffa.uhc.utilities.player.SavedPlayerData kData = com.nexia.ffa.uhc.utilities.player.PlayerDataManager.get(otherPlayer).savedData;
kills = kData.kills;
deaths = kData.deaths;
killstreak = kData.killstreak;
bestKillstreak = kData.bestKillstreak;
}

player.sendMessage(message);
player.sendMessage(user);
player.sendMessage(start
.append(Component.text(" Kills: ").color(ChatFormat.brandColor2))
.append(Component.text(data.kills).color(ChatFormat.greenColor))
.append(Component.text(kills).color(ChatFormat.greenColor))
);
player.sendMessage(start
.append(Component.text(" Deaths: ").color(ChatFormat.brandColor2))
.append(Component.text(data.deaths).color(ChatFormat.failColor))
.append(Component.text(deaths).color(ChatFormat.failColor))
);

player.sendMessage(start
.append(Component.text(" KDR: ").color(ChatFormat.brandColor2))
.append(Component.text(calculateKDR(data.kills, data.deaths)).color(ChatFormat.greenColor))
.append(Component.text(calculateKDR(kills, deaths)).color(ChatFormat.greenColor))
);

player.sendMessage(start
.append(Component.text(" Killstreak: ").color(ChatFormat.brandColor2))
.append(Component.text(data.killstreak).color(TextColor.fromHexString("#f5bc42")))
.append(Component.text(killstreak).color(TextColor.fromHexString("#f5bc42")))
.append(Component.text("/").color(ChatFormat.arrowColor))
.append(Component.text(data.bestKillstreak).color(TextColor.fromHexString("#f5bc42")))
.append(Component.text(bestKillstreak).color(TextColor.fromHexString("#f5bc42")))
);
}

Expand Down
Loading

0 comments on commit e5c38e9

Please sign in to comment.