Skip to content

Commit

Permalink
GH-492 Fix FabricServerSender#getIdentifier (#492)
Browse files Browse the repository at this point in the history
* fix FabricServerSender#getIdentifier

* update FabricServerSender
  • Loading branch information
huanmeng-qwq authored Dec 9, 2024
1 parent e1d3df8 commit 2d25f16
Showing 1 changed file with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@

import dev.rollczi.litecommands.identifier.Identifier;
import dev.rollczi.litecommands.platform.AbstractPlatformSender;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.entity.Entity;
import net.minecraft.server.command.ServerCommandSource;

import java.util.ArrayList;
import java.util.List;

public class FabricServerSender extends AbstractPlatformSender {
private final ServerCommandSource source;

Expand All @@ -20,7 +22,14 @@ public String getName() {

@Override
public Identifier getIdentifier() {
return Identifier.of(source.getEntity().getUuid());
List<Object> list = new ArrayList<>();
list.add(source.getName());
Entity entity = source.getEntity();
if (entity != null) {
list.add(entity.getUuid());
}
Object[] objects = list.toArray();
return Identifier.of(objects);
}

@Override
Expand Down

0 comments on commit 2d25f16

Please sign in to comment.