Skip to content

Commit

Permalink
smol changez 🈯
Browse files Browse the repository at this point in the history
  • Loading branch information
not-coded committed Aug 3, 2024
1 parent d2f75e0 commit 0748d8f
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 7 deletions.
1 change: 1 addition & 0 deletions src/main/java/com/nexia/core/gui/PrefixGUI.java
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ public boolean click(int index, ClickType clickType, net.minecraft.world.invento
}

if(name.equalsIgnoreCase("player")) name = "default";
if(name.equalsIgnoreCase("nexia")) name = "supporter";

player.addTag(name.toLowerCase());
this.setMainLayout(this.player);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public void registerListener() {

boolean isPlaying = ((SkywarsPlayerData)PlayerDataManager.getDataManager(NexiaCore.SKYWARS_DATA_MANAGER).get(player)).gameMode == SkywarsGameMode.PLAYING;
ServerPlayer serverPlayer = PlayerUtil.getPlayerAttacker(player.unwrap());
if(serverPlayer != null && serverPlayer != player.unwrap() && isPlaying) {
if(serverPlayer != null && !serverPlayer.equals(player.unwrap()) && isPlaying) {
respawn.setX(serverPlayer.getX());
respawn.setY(serverPlayer.getY());
respawn.setZ(serverPlayer.getZ());
Expand Down
11 changes: 10 additions & 1 deletion src/main/java/com/nexia/core/mixin/player/PlayerListMixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,16 @@ private void checkIfBanned(SocketAddress socketAddress, GameProfile gameProfile,
String textBanTime = banTimeToText(banTime);

if(LocalDateTime.now().isBefore(banTime)){
cir.setReturnValue(new TextComponent("§c§lYou have been banned.\n§7Duration: §d" + textBanTime + "\n§7Reason: §d" + reason + "\n§7You can appeal your ban at §d" + NexiaDiscord.config.discordLink));
cir.setReturnValue(ObjectMappings.convertComponent(
net.kyori.adventure.text.Component.text("You have been banned.", ChatFormat.failColor)
.append(net.kyori.adventure.text.Component.text("\nDuration: ", ChatFormat.systemColor))
.append(net.kyori.adventure.text.Component.text(textBanTime, ChatFormat.brandColor2))
.append(net.kyori.adventure.text.Component.text("\nReason: ", ChatFormat.systemColor))
.append(net.kyori.adventure.text.Component.text(reason, ChatFormat.brandColor2))
.append(net.kyori.adventure.text.Component.text("\nYou can appeal your ban at ", ChatFormat.systemColor))
.append(net.kyori.adventure.text.Component.text(NexiaDiscord.config.discordLink, ChatFormat.brandColor2))
));

} else {
BanHandler.removeBanFromList(gameProfile);
}
Expand Down
17 changes: 12 additions & 5 deletions src/main/java/com/nexia/core/utilities/player/BanHandler.java
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
package com.nexia.core.utilities.player;

import com.nexia.nexus.api.command.CommandSourceInfo;
import com.mojang.authlib.GameProfile;
import com.mojang.brigadier.StringReader;
import com.nexia.core.utilities.chat.ChatFormat;
import com.nexia.core.utilities.time.ServerTime;
import com.nexia.discord.NexiaDiscord;
import com.nexia.nexus.api.command.CommandSourceInfo;
import com.nexia.nexus.api.world.entity.player.Player;
import net.fabricmc.loader.api.FabricLoader;
import net.kyori.adventure.text.Component;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.server.level.ServerPlayer;
import org.apache.commons.lang3.time.DurationFormatUtils;
import org.json.simple.JSONObject;
import org.json.simple.parser.JSONParser;
Expand Down Expand Up @@ -121,10 +120,18 @@ public static void tryBan(CommandSourceInfo sender, Collection<GameProfile> coll
.append(Component.text(reason, ChatFormat.brandColor2))
);

ServerPlayer banned = ServerTime.minecraftServer.getPlayerList().getPlayer(profile.getId());
Player banned = ServerTime.nexusServer.getPlayer(profile.getId());

if (banned != null) {
banned.connection.disconnect(new TextComponent("§c§lYou have been banned.\n§7Duration: §d" + banTimeToText(banTime) + "\n§7Reason: §d" + reason + "\n§7You can appeal your ban at §d" + NexiaDiscord.config.discordLink));
banned.disconnect(
net.kyori.adventure.text.Component.text("You have been banned.", ChatFormat.failColor)
.append(net.kyori.adventure.text.Component.text("\nDuration: ", ChatFormat.systemColor))
.append(net.kyori.adventure.text.Component.text(banTimeToText(banTime), ChatFormat.brandColor2))
.append(net.kyori.adventure.text.Component.text("\nReason: ", ChatFormat.systemColor))
.append(net.kyori.adventure.text.Component.text(reason, ChatFormat.brandColor2))
.append(net.kyori.adventure.text.Component.text("\nYou can appeal your ban at ", ChatFormat.systemColor))
.append(net.kyori.adventure.text.Component.text(NexiaDiscord.config.discordLink, ChatFormat.brandColor2))
);
}
}

Expand Down

0 comments on commit 0748d8f

Please sign in to comment.