mirror of
https://github.com/Oth3r/Sit.git
synced 2025-09-20 00:13:21 +02:00
Data -> FileData
This commit is contained in:
parent
e105f36dc8
commit
7d06735b3c
9 changed files with 26 additions and 26 deletions
|
@ -4,7 +4,7 @@ import net.minecraft.entity.Entity;
|
|||
import net.minecraft.entity.decoration.DisplayEntity;
|
||||
import net.minecraft.server.network.ServerPlayerEntity;
|
||||
import one.oth3r.sit.Sit;
|
||||
import one.oth3r.sit.file.Data;
|
||||
import one.oth3r.sit.file.FileData;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
|
@ -18,7 +18,7 @@ public class LoopManager {
|
|||
time = 0;
|
||||
|
||||
// check all sit entities to make sure their still valid
|
||||
HashMap<ServerPlayerEntity, DisplayEntity.TextDisplayEntity> entities = Data.getSitEntities();
|
||||
HashMap<ServerPlayerEntity, DisplayEntity.TextDisplayEntity> entities = FileData.getSitEntities();
|
||||
for (ServerPlayerEntity player : entities.keySet()) {
|
||||
DisplayEntity.TextDisplayEntity entity = entities.get(player);
|
||||
|
||||
|
@ -31,23 +31,23 @@ public class LoopManager {
|
|||
|
||||
// get the player's sit entity when they join
|
||||
// todo make it so it updates the sitting height and pos based on the block so if it changed while offline it still works (or if stair changes shape)
|
||||
HashMap<ServerPlayerEntity, Integer> checkPlayers = Data.getCheckPlayers();
|
||||
HashMap<ServerPlayerEntity, Integer> checkPlayers = FileData.getCheckPlayers();
|
||||
for (ServerPlayerEntity player : checkPlayers.keySet()) {
|
||||
Integer time = checkPlayers.get(player);
|
||||
// tick down or remove the player if at the end
|
||||
time -= 1;
|
||||
if (time <= 0) Data.removeCheckPlayer(player);
|
||||
else Data.setCheckPlayer(player, time);
|
||||
if (time <= 0) FileData.removeCheckPlayer(player);
|
||||
else FileData.setCheckPlayer(player, time);
|
||||
|
||||
if (player.getVehicle() != null) {
|
||||
Entity entity = player.getVehicle();
|
||||
if (entity instanceof DisplayEntity.TextDisplayEntity tde && entity.getName().getString().equals(Sit.ENTITY_NAME)) {
|
||||
// bind the entity to the player
|
||||
Data.addSitEntity(player, tde);
|
||||
FileData.addSitEntity(player, tde);
|
||||
// check if the player is still allowed to sit
|
||||
Logic.checkSittingValidity(player);
|
||||
// remove the player from the check
|
||||
Data.removeCheckPlayer(player);
|
||||
FileData.removeCheckPlayer(player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue