3
0
Mirror von https://github.com/GeyserMC/Geyser.git synchronisiert 2024-12-27 16:40:14 +01:00

Make my life tolerable

Dieser Commit ist enthalten in:
DoctorMacc 2020-12-19 19:19:44 -05:00
Ursprung 1705f1034c
Commit f47cf32d90
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 6D6E7E059F186DB4

Datei anzeigen

@ -136,6 +136,10 @@ public abstract class InventoryTranslator {
case PLACE: { case PLACE: {
TransferStackRequestActionData transferAction = (TransferStackRequestActionData) action; TransferStackRequestActionData transferAction = (TransferStackRequestActionData) action;
if (!(checkNetId(session, inventory, transferAction.getSource()) && checkNetId(session, inventory, transferAction.getDestination()))) { if (!(checkNetId(session, inventory, transferAction.getSource()) && checkNetId(session, inventory, transferAction.getDestination()))) {
if (session.getGameMode().equals(GameMode.CREATIVE) && transferAction.getSource().getContainer() == ContainerSlotType.CRAFTING_INPUT &&
transferAction.getSource().getSlot() >= 28 && transferAction.getSource().getSlot() <= 31) {
return rejectRequest(request, false);
}
session.getConnector().getLogger().error("DEBUG: About to reject request."); session.getConnector().getLogger().error("DEBUG: About to reject request.");
session.getConnector().getLogger().error("Source: " + transferAction.getSource().toString() + " Result: " + checkNetId(session, inventory, transferAction.getSource())); session.getConnector().getLogger().error("Source: " + transferAction.getSource().toString() + " Result: " + checkNetId(session, inventory, transferAction.getSource()));
session.getConnector().getLogger().error("Destination: " + transferAction.getDestination().toString() + " Result: " + checkNetId(session, inventory, transferAction.getDestination())); session.getConnector().getLogger().error("Destination: " + transferAction.getDestination().toString() + " Result: " + checkNetId(session, inventory, transferAction.getDestination()));
@ -504,7 +508,14 @@ public abstract class InventoryTranslator {
} }
public static ItemStackResponsePacket.Response rejectRequest(ItemStackRequestPacket.Request request) { public static ItemStackResponsePacket.Response rejectRequest(ItemStackRequestPacket.Request request) {
new Throwable("DEBUGGING: ItemStackRequest rejected").printStackTrace(); //TODO: temporary debugging return rejectRequest(request, true);
}
public static ItemStackResponsePacket.Response rejectRequest(ItemStackRequestPacket.Request request, boolean throwError) {
if (throwError) {
// Currently for debugging, but might be worth it to keep in the future if something goes terribly wrong.
new Throwable("DEBUGGING: ItemStackRequest rejected").printStackTrace();
}
return new ItemStackResponsePacket.Response(ItemStackResponsePacket.ResponseStatus.ERROR, request.getRequestId(), Collections.emptyList()); return new ItemStackResponsePacket.Response(ItemStackResponsePacket.ResponseStatus.ERROR, request.getRequestId(), Collections.emptyList());
} }