Revert "Update ExampleEvent for changes needed to work latest version"
This reverts commit 314ff77855.
This commit is contained in:
@@ -1,39 +1,14 @@
|
||||
package dev.hytalemodding.events;
|
||||
|
||||
import com.hypixel.hytale.component.Ref;
|
||||
import com.hypixel.hytale.component.Store;
|
||||
import com.hypixel.hytale.server.core.Message;
|
||||
import com.hypixel.hytale.server.core.entity.entities.Player;
|
||||
import com.hypixel.hytale.server.core.event.events.player.PlayerReadyEvent;
|
||||
import com.hypixel.hytale.server.core.universe.PlayerRef;
|
||||
import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
|
||||
|
||||
public final class ExampleEvent {
|
||||
|
||||
private ExampleEvent() {}
|
||||
public class ExampleEvent {
|
||||
|
||||
public static void onPlayerReady(PlayerReadyEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
|
||||
Ref<EntityStore> playerRef = player.getReference();
|
||||
if (playerRef == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
Store<EntityStore> store = playerRef.getStore();
|
||||
|
||||
PlayerRef playerRefComponent = store.getComponent(
|
||||
playerRef,
|
||||
PlayerRef.getComponentType()
|
||||
);
|
||||
|
||||
if (playerRefComponent == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
playerRefComponent.sendMessage(
|
||||
Message.raw("Welcome " + playerRefComponent.getUsername())
|
||||
);
|
||||
player.sendMessage(Message.raw("Welcome " + player.getDisplayName()));
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user