chore: pre-commit changes [skip ci]

This commit is contained in:
github-actions[bot] 2024-10-17 02:11:37 +00:00 committed by Sekwah
parent a70e83b4d1
commit 5bc1dc3218

View File

@ -1,70 +1,70 @@
package com.sekwah.advancedportals.core.tags; package com.sekwah.advancedportals.core.tags;
import com.google.common.io.ByteArrayDataOutput; import com.google.common.io.ByteArrayDataOutput;
import com.google.common.io.ByteStreams; import com.google.common.io.ByteStreams;
import com.google.inject.Inject; import com.google.inject.Inject;
import com.sekwah.advancedportals.core.connector.containers.PlayerContainer; import com.sekwah.advancedportals.core.connector.containers.PlayerContainer;
import com.sekwah.advancedportals.core.registry.TagTarget; import com.sekwah.advancedportals.core.registry.TagTarget;
import com.sekwah.advancedportals.core.repository.ConfigRepository; import com.sekwah.advancedportals.core.repository.ConfigRepository;
import com.sekwah.advancedportals.core.util.FriendlyDataOutput; import com.sekwah.advancedportals.core.util.FriendlyDataOutput;
import com.sekwah.advancedportals.core.util.Lang; import com.sekwah.advancedportals.core.util.Lang;
import com.sekwah.advancedportals.core.warphandler.ActivationData; import com.sekwah.advancedportals.core.warphandler.ActivationData;
import com.sekwah.advancedportals.core.warphandler.Tag; import com.sekwah.advancedportals.core.warphandler.Tag;
import java.util.Random; import java.util.Random;
public class BungeeTag implements Tag.Activation { public class BungeeTag implements Tag.Activation {
public static final String PACKET_CHANNEL = "BungeeCord"; public static final String PACKET_CHANNEL = "BungeeCord";
@Inject @Inject
ConfigRepository configRepository; ConfigRepository configRepository;
public static String TAG_NAME = "bungee"; public static String TAG_NAME = "bungee";
private final TagType[] tagTypes = private final TagType[] tagTypes =
new TagType[] {TagType.PORTAL}; new TagType[] {TagType.PORTAL};
private final Random random = new Random(); private final Random random = new Random();
@Override @Override
public TagType[] getTagTypes() { public TagType[] getTagTypes() {
return tagTypes; return tagTypes;
} }
@Override @Override
public String getName() { public String getName() {
return TAG_NAME; return TAG_NAME;
} }
@Override @Override
public String[] getAliases() { public String[] getAliases() {
return null; return null;
} }
@Override @Override
public String description() { public String description() {
return Lang.translate("tag.bungee.description"); return Lang.translate("tag.bungee.description");
} }
@Override @Override
public boolean preActivated(TagTarget target, PlayerContainer player, ActivationData activeData, String[] argData) { public boolean preActivated(TagTarget target, PlayerContainer player, ActivationData activeData, String[] argData) {
return true; return true;
} }
@Override @Override
public void postActivated(TagTarget target, PlayerContainer player, ActivationData activationData, String[] argData) { public void postActivated(TagTarget target, PlayerContainer player, ActivationData activationData, String[] argData) {
} }
@Override @Override
public boolean activated(TagTarget target, PlayerContainer player, ActivationData activeData, String[] argData) { public boolean activated(TagTarget target, PlayerContainer player, ActivationData activeData, String[] argData) {
String selectedArg = argData[random.nextInt(argData.length)]; String selectedArg = argData[random.nextInt(argData.length)];
ByteArrayDataOutput outForSend = ByteStreams.newDataOutput(); ByteArrayDataOutput outForSend = ByteStreams.newDataOutput();
outForSend.writeUTF("Connect"); outForSend.writeUTF("Connect");
outForSend.writeUTF(selectedArg); outForSend.writeUTF(selectedArg);
player.sendPacket(BungeeTag.PACKET_CHANNEL, outForSend.toByteArray()); player.sendPacket(BungeeTag.PACKET_CHANNEL, outForSend.toByteArray());
activeData.setWarpStatus(ActivationData.WarpedStatus.WARPED); activeData.setWarpStatus(ActivationData.WarpedStatus.WARPED);
return true; return true;
} }
} }