docs: Added simple docs and dockerized backend

This commit is contained in:
2025-01-02 16:12:31 +01:00
parent d8969df0d3
commit fdce5f2a62
19 changed files with 858 additions and 35 deletions

View File

@ -11,7 +11,7 @@ import cz.jzitnik.chronos.payload.responses.UnifiedResponse;
import cz.jzitnik.chronos.repository.CharacterRepository;
import cz.jzitnik.chronos.repository.PlayerRepository;
import cz.jzitnik.chronos.services.ItemService;
import cz.jzitnik.chronos.utils.anotations.CheckUser;
import cz.jzitnik.chronos.utils.annotations.CheckUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;

View File

@ -5,7 +5,7 @@ import cz.jzitnik.chronos.payload.requests.MessageRequest;
import cz.jzitnik.chronos.payload.responses.UnifiedResponse;
import cz.jzitnik.chronos.repository.MessageRepository;
import cz.jzitnik.chronos.repository.PlayerRepository;
import cz.jzitnik.chronos.utils.anotations.CheckUser;
import cz.jzitnik.chronos.utils.annotations.CheckUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;

View File

@ -9,7 +9,7 @@ import cz.jzitnik.chronos.repository.GameRepository;
import cz.jzitnik.chronos.repository.ItemRepository;
import cz.jzitnik.chronos.repository.PlayerRepository;
import cz.jzitnik.chronos.services.GameService;
import cz.jzitnik.chronos.utils.anotations.CheckUser;
import cz.jzitnik.chronos.utils.annotations.CheckUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;

View File

@ -17,7 +17,7 @@ import cz.jzitnik.chronos.repository.GameRepository;
import cz.jzitnik.chronos.repository.ItemRepository;
import cz.jzitnik.chronos.repository.PlayerRepository;
import cz.jzitnik.chronos.services.GameService;
import cz.jzitnik.chronos.utils.anotations.CheckUser;
import cz.jzitnik.chronos.utils.annotations.CheckUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
@ -154,7 +154,7 @@ public class PlayerController {
if (item.getOwner() == null || !item.getOwner().getId().equals(player.getId())) {
return ResponseEntity.status(HttpStatus.FORBIDDEN).body(UnifiedResponse.failure(new Error("You don't own this item!")));
}
if (player.getInventorySize() - player.getInventory().size() == 0) {
if (player2.getInventorySize() - player2.getInventory().size() == 0) {
// Inventory is full
return ResponseEntity.status(HttpStatus.CONFLICT).body(UnifiedResponse.failure(new FullInventoryError("Player has full inventory!")));
}

View File

@ -10,7 +10,7 @@ import cz.jzitnik.chronos.repository.PlayerRepository;
import cz.jzitnik.chronos.repository.RoomRepository;
import cz.jzitnik.chronos.services.GameService;
import cz.jzitnik.chronos.services.ItemService;
import cz.jzitnik.chronos.utils.anotations.CheckUser;
import cz.jzitnik.chronos.utils.annotations.CheckUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;

View File

@ -12,9 +12,7 @@ public enum ItemType {
public void useItem(Player player) throws ItemNotUsableException {
switch (this) {
case LUCK_POTION -> {
player.setLuck(true);
}
case LUCK_POTION -> player.setLuck(true);
default -> throw new ItemNotUsableException("Item " + this + " is not usable");
}
}

View File

@ -33,12 +33,12 @@ public class Baker implements InteractionPlayer {
return new InteractionResponse(false, "Nemáš pro mě buď mouku nebo vodu. Dej mi obojí najednou!", new ArrayList<>());
}
var flour = flours.getFirst();
var flour = flours.get(0);
flour.setOwner(null);
itemRepository.save(flour);
playerItems.remove(flour);
var onewater = water.getFirst();
var onewater = water.get(0);
onewater.setOwner(null);
itemRepository.save(onewater);
playerItems.remove(onewater);

View File

@ -32,7 +32,7 @@ public class Mayor implements InteractionPlayer {
return new InteractionResponse(false, "Nemáš zlaté hodinky v inventáři!", new ArrayList<>());
}
var goldenWatch = goldenWatches.getFirst();
var goldenWatch = goldenWatches.get(0);
goldenWatch.setOwner(null);
itemRepository.save(goldenWatch);
playerItems.remove(goldenWatch);

View File

@ -108,7 +108,7 @@ public class NumberGuessingGame implements InteractionPlayer {
if (coals.isEmpty()) {
return new InteractionResponse(false, "Nemáš uhlí pro mě!", new ArrayList<>());
}
var coal = coals.getFirst();
var coal = coals.get(0);
coal.setOwner(null);
itemRepository.save(coal);
player.getInventory().remove(coal);

View File

@ -1,4 +1,4 @@
package cz.jzitnik.chronos.utils.anotations;
package cz.jzitnik.chronos.utils.annotations;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;

View File

@ -1,4 +1,4 @@
package cz.jzitnik.chronos.utils.anotations;
package cz.jzitnik.chronos.utils.annotations;
import cz.jzitnik.chronos.payload.errors.PlayerNotFoundError;
import cz.jzitnik.chronos.payload.responses.UnifiedResponse;