Skip to content

Commit

Permalink
Revert "me when waiting to test update"
Browse files Browse the repository at this point in the history
This reverts commit e5c38e9.
  • Loading branch information
not-coded committed Jan 6, 2024
1 parent e5c38e9 commit d7cc410
Show file tree
Hide file tree
Showing 103 changed files with 506 additions and 3,153 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):

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

*(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.10.1")
implementation("com.google.code.gson:gson:2.9.0")

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

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

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: 0 additions & 24 deletions src/main/java/com/nexia/core/commands/player/PlayCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@ 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 @@ -29,9 +26,6 @@ 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 @@ -49,24 +43,6 @@ 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 != ServerTime.minecraftServer.getPlayerCount(); i++){
staffPlayer = PlayerUtil.getMinecraftPlayerFromName(ServerTime.minecraftServer.getPlayerNames()[i]);
for (int i = 0; i != Main.server.getPlayerCount(); i++){
staffPlayer = PlayerUtil.getMinecraftPlayerFromName(Main.server.getPlayerNames()[i]);
if(Permissions.check(staffPlayer, "nexia.staff.report", 1)) {
PlayerUtil.getFactoryPlayer(staffPlayer).sendMessage(
ChatFormat.nexiaMessage
Expand Down
21 changes: 9 additions & 12 deletions src/main/java/com/nexia/core/commands/player/SpectateCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
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 @@ -74,7 +76,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!").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false))
Component.text("You must be fully healed to go into spectator!").decoration(ChatFormat.bold, false))
);
return 0;
}
Expand All @@ -95,7 +97,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 @@ -105,32 +107,27 @@ public static int spectate(CommandContext<CommandSourceStack> context, ServerPla
.append(Component.text("!").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false))
)
)

);
return 0;
}

if(PlayerDataManager.get(executor).gameMode != PlayerGameMode.FFA) {
if(!FfaUtil.isFfaPlayer(player)) {
factoryExecutor.sendMessage(ChatFormat.nexiaMessage.append(
Component.text("This can only be used in FFA!").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false)
Component.text("That player is not 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!").color(ChatFormat.normalColor).decoration(ChatFormat.bold, false))
Component.text("You must be fully healed to go into spectator!").decoration(ChatFormat.bold, false))
);
return 0;
}

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

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

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


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

Component message;

if (executorData.gameMode == PlayerGameMode.FFA) {
message = ChatFormat.separatorLine("FFA Classic Stats");
if (executerData.gameMode == PlayerGameMode.FFA) {
message = ChatFormat.separatorLine("FFA 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(kills).color(ChatFormat.greenColor))
.append(Component.text(data.kills).color(ChatFormat.greenColor))
);
player.sendMessage(start
.append(Component.text(" Deaths: ").color(ChatFormat.brandColor2))
.append(Component.text(deaths).color(ChatFormat.failColor))
.append(Component.text(data.deaths).color(ChatFormat.failColor))
);

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

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

if (executorData.gameMode == PlayerGameMode.LOBBY) {
if (executerData.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 @@ -125,7 +92,7 @@ public static int run(CommandContext<CommandSourceStack> context) throws Command
);
}

if (executorData.gameMode == PlayerGameMode.BEDWARS) {
if (executerData.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 @@ -144,7 +111,7 @@ public static int run(CommandContext<CommandSourceStack> context) throws Command
);
}

if(executorData.gameMode == PlayerGameMode.SKYWARS){
if(executerData.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 @@ -190,64 +157,31 @@ public static int other(CommandContext<CommandSourceStack> context, ServerPlayer

Component message;


if(gamemode.equalsIgnoreCase("ffa classic") || gamemode.equalsIgnoreCase("kit ffa")){
message = ChatFormat.separatorLine("FFA Classic Stats");
if(gamemode.equalsIgnoreCase("ffa")){
message = ChatFormat.separatorLine("FFA 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(kills).color(ChatFormat.greenColor))
.append(Component.text(data.kills).color(ChatFormat.greenColor))
);
player.sendMessage(start
.append(Component.text(" Deaths: ").color(ChatFormat.brandColor2))
.append(Component.text(deaths).color(ChatFormat.failColor))
.append(Component.text(data.deaths).color(ChatFormat.failColor))
);

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

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

Expand Down
Loading

0 comments on commit d7cc410

Please sign in to comment.