Mirror von
https://github.com/GeyserMC/Geyser.git
synchronisiert 2024-09-08 20:43:04 +02:00
Remove debug lines
Dieser Commit ist enthalten in:
Ursprung
e87ae8f0dd
Commit
196c9f5c17
@ -93,7 +93,6 @@ public class GeyserSpigot1_11CraftingListener implements Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
System.out.println("Sending recipes!");
|
||||
sendServerRecipes(session);
|
||||
}
|
||||
|
||||
|
@ -887,7 +887,6 @@ public class GeyserSession implements CommandSender {
|
||||
*/
|
||||
public void addInventoryTask(Runnable task) {
|
||||
synchronized (inventoryLock) {
|
||||
System.out.println("new task " + task.toString());
|
||||
inventoryFuture = inventoryFuture.thenRun(task).exceptionally(throwable -> {
|
||||
GeyserConnector.getInstance().getLogger().error("Error processing inventory task", throwable.getCause());
|
||||
return null;
|
||||
@ -905,7 +904,6 @@ public class GeyserSession implements CommandSender {
|
||||
*/
|
||||
public void addInventoryTask(Runnable task, long delayMillis) {
|
||||
synchronized (inventoryLock) {
|
||||
System.out.println("new delayed task " + task.toString());
|
||||
Executor delayedExecutor = command -> GeyserConnector.getInstance().getGeneralThreadPool().schedule(command, delayMillis, TimeUnit.MILLISECONDS);
|
||||
inventoryFuture = inventoryFuture.thenRunAsync(task, delayedExecutor).exceptionally(throwable -> {
|
||||
GeyserConnector.getInstance().getLogger().error("Error processing inventory task", throwable.getCause());
|
||||
|
@ -48,7 +48,6 @@ public class BedrockContainerCloseTranslator extends PacketTranslator<ContainerC
|
||||
|
||||
Inventory openInventory = session.getOpenInventory();
|
||||
if (openInventory != null && windowId == openInventory.getId()) {
|
||||
System.out.println(packet);
|
||||
ClientCloseWindowPacket closeWindowPacket = new ClientCloseWindowPacket(windowId);
|
||||
session.sendDownstreamPacket(closeWindowPacket);
|
||||
InventoryUtils.closeInventory(session, windowId);
|
||||
|
@ -52,7 +52,6 @@ public class BedrockFilterTextTranslator extends PacketTranslator<FilterTextPack
|
||||
if (session.getOpenInventory() instanceof AnvilContainer) {
|
||||
// Java Edition sends a packet every time an item is renamed even slightly in GUI. Fortunately, this works out for us now
|
||||
ClientRenameItemPacket renameItemPacket = new ClientRenameItemPacket(packet.getText());
|
||||
System.out.println(renameItemPacket);
|
||||
session.sendDownstreamPacket(renameItemPacket);
|
||||
}
|
||||
}
|
||||
|
@ -81,7 +81,6 @@ public class BedrockInventoryTransactionTranslator extends PacketTranslator<Inve
|
||||
|
||||
switch (packet.getTransactionType()) {
|
||||
case NORMAL:
|
||||
System.out.println(packet);
|
||||
if (packet.getActions().size() == 2) {
|
||||
InventoryActionData worldAction = packet.getActions().get(0);
|
||||
InventoryActionData containerAction = packet.getActions().get(1);
|
||||
|
@ -37,7 +37,6 @@ public class BedrockItemStackRequestTranslator extends PacketTranslator<ItemStac
|
||||
|
||||
@Override
|
||||
public void translate(ItemStackRequestPacket packet, GeyserSession session) {
|
||||
session.getConnector().getLogger().info(packet.toString());
|
||||
Inventory inventory = session.getOpenInventory();
|
||||
if (inventory == null)
|
||||
return;
|
||||
|
@ -50,8 +50,6 @@ public class BedrockLecternUpdateTranslator extends PacketTranslator<LecternUpda
|
||||
// So, we enter the GUI and then drop it! :)
|
||||
session.setDroppingLecternBook(true);
|
||||
|
||||
Vector3f diff = session.getPlayerEntity().getPosition().sub(packet.getBlockPosition().toFloat());
|
||||
System.out.println(diff);
|
||||
// Emulate an interact packet
|
||||
ClientPlayerPlaceBlockPacket blockPacket = new ClientPlayerPlaceBlockPacket(
|
||||
new Position(packet.getBlockPosition().getX(), packet.getBlockPosition().getY(), packet.getBlockPosition().getZ()),
|
||||
@ -79,13 +77,11 @@ public class BedrockLecternUpdateTranslator extends PacketTranslator<LecternUpda
|
||||
if (newJavaPage > currentJavaPage) {
|
||||
for (int i = currentJavaPage; i < newJavaPage; i++) {
|
||||
ClientClickWindowButtonPacket clickButtonPacket = new ClientClickWindowButtonPacket(session.getOpenInventory().getId(), 2);
|
||||
System.out.println(clickButtonPacket);
|
||||
session.sendDownstreamPacket(clickButtonPacket);
|
||||
}
|
||||
} else {
|
||||
for (int i = currentJavaPage; i > newJavaPage; i--) {
|
||||
ClientClickWindowButtonPacket clickButtonPacket = new ClientClickWindowButtonPacket(session.getOpenInventory().getId(), 1);
|
||||
System.out.println(clickButtonPacket);
|
||||
session.sendDownstreamPacket(clickButtonPacket);
|
||||
}
|
||||
}
|
||||
|
@ -173,11 +173,9 @@ public abstract class InventoryTranslator {
|
||||
}
|
||||
}
|
||||
session.sendUpstreamPacket(responsePacket);
|
||||
System.out.println(responsePacket);
|
||||
}
|
||||
|
||||
public ItemStackResponsePacket.Response translateRequest(GeyserSession session, Inventory inventory, ItemStackRequestPacket.Request request) {
|
||||
System.out.println(request);
|
||||
ClickPlan plan = new ClickPlan(session, this, inventory);
|
||||
IntSet affectedSlots = new IntOpenHashSet();
|
||||
for (StackRequestActionData action : request.getActions()) {
|
||||
@ -273,7 +271,6 @@ public abstract class InventoryTranslator {
|
||||
itemToUpdate.isEmpty() ? new ItemStack(0) : itemToUpdate.getItemStack()
|
||||
);
|
||||
session.sendDownstreamPacket(creativeActionPacket);
|
||||
System.out.println(creativeActionPacket);
|
||||
|
||||
if (!sourceIsCursor) { // Cursor is always added for us as an affected slot
|
||||
affectedSlots.add(sourceSlot);
|
||||
@ -365,7 +362,6 @@ public abstract class InventoryTranslator {
|
||||
sourceSlot,
|
||||
oldDestinationItem.isEmpty() ? new ItemStack(0) : oldDestinationItem.getItemStack() // isEmpty check... just in case
|
||||
);
|
||||
System.out.println(creativeActionPacket);
|
||||
session.sendDownstreamPacket(creativeActionPacket);
|
||||
inventory.setItem(sourceSlot, oldDestinationItem, session);
|
||||
}
|
||||
@ -376,7 +372,6 @@ public abstract class InventoryTranslator {
|
||||
destSlot,
|
||||
oldSourceItem.isEmpty() ? new ItemStack(0) : oldSourceItem.getItemStack()
|
||||
);
|
||||
System.out.println(creativeActionPacket);
|
||||
session.sendDownstreamPacket(creativeActionPacket);
|
||||
inventory.setItem(destSlot, oldSourceItem, session);
|
||||
}
|
||||
@ -433,7 +428,6 @@ public abstract class InventoryTranslator {
|
||||
Click.OUTSIDE_SLOT,
|
||||
droppingItem.getItemStack()
|
||||
);
|
||||
System.out.println(packet.toString());
|
||||
session.sendDownstreamPacket(packet);
|
||||
} else {
|
||||
int sourceAmount = plan.getCursor().getAmount();
|
||||
@ -458,11 +452,6 @@ public abstract class InventoryTranslator {
|
||||
}
|
||||
break;
|
||||
}
|
||||
case CRAFT_CREATIVE: {
|
||||
CraftCreativeStackRequestActionData creativeAction = (CraftCreativeStackRequestActionData) action;
|
||||
System.out.println(creativeAction.getCreativeItemNetworkId());
|
||||
break;
|
||||
}
|
||||
case DESTROY: {
|
||||
// Only called when a creative client wants to destroy an item... I think - Camotoy
|
||||
DestroyStackRequestActionData destroyAction = (DestroyStackRequestActionData) action;
|
||||
@ -489,7 +478,6 @@ public abstract class InventoryTranslator {
|
||||
);
|
||||
}
|
||||
session.sendDownstreamPacket(destroyItemPacket);
|
||||
System.out.println(destroyItemPacket);
|
||||
affectedSlots.add(javaSlot);
|
||||
} else {
|
||||
// Just sync up the item on our end, since the server doesn't care what's in our cursor
|
||||
@ -538,8 +526,6 @@ public abstract class InventoryTranslator {
|
||||
}
|
||||
|
||||
public ItemStackResponsePacket.Response translateCraftingRequest(GeyserSession session, Inventory inventory, ItemStackRequestPacket.Request request) {
|
||||
System.out.println(request);
|
||||
|
||||
int recipeId = 0;
|
||||
int resultSize = 0;
|
||||
int timesCrafted = 0;
|
||||
@ -809,8 +795,6 @@ public abstract class InventoryTranslator {
|
||||
boolean done = true;
|
||||
for (Int2ObjectMap.Entry<Int2IntMap> entry : ingredientMap.int2ObjectEntrySet()) {
|
||||
Int2IntMap sources = entry.getValue();
|
||||
System.out.println("Grid slot: " + entry.getIntKey());
|
||||
System.out.println(sources);
|
||||
if (sources.isEmpty())
|
||||
continue;
|
||||
|
||||
@ -829,16 +813,10 @@ public abstract class InventoryTranslator {
|
||||
transferSlot(plan, sourceSlot, gridSlot, transferAmount);
|
||||
}
|
||||
|
||||
for (int x = 0; x < 3; x++) {
|
||||
int offset = x * 3;
|
||||
System.out.println(plan.getItem(1 + offset).getAmount() + " " + plan.getItem(2 + offset).getAmount() + " " + plan.getItem(3 + offset).getAmount());
|
||||
}
|
||||
|
||||
if (!done) {
|
||||
//TODO: sometimes the server does not agree on this slot?
|
||||
plan.add(Click.LEFT_SHIFT, 0, true);
|
||||
} else {
|
||||
System.out.println("Times looped: " + loops);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -908,7 +886,6 @@ public abstract class InventoryTranslator {
|
||||
javaCreativeItem
|
||||
);
|
||||
session.sendDownstreamPacket(creativeActionPacket);
|
||||
System.out.println(creativeActionPacket);
|
||||
Set<Integer> affectedSlots = Collections.singleton(javaSlot);
|
||||
return acceptRequest(request, makeContainerEntries(session, inventory, affectedSlots));
|
||||
}
|
||||
@ -1017,8 +994,6 @@ public abstract class InventoryTranslator {
|
||||
if (!viable) {
|
||||
continue;
|
||||
}
|
||||
|
||||
System.out.println("TEMP SLOT CHOSEN: " + i + " => " + inventory.getItem(i));
|
||||
return i;
|
||||
}
|
||||
//could not find a viable temp slot
|
||||
|
@ -132,7 +132,6 @@ public class ClickPlan {
|
||||
if (clickedItemStack == InventoryUtils.REFRESH_ITEM || action.force) {
|
||||
session.sendDownstreamPacket(new ClientConfirmTransactionPacket(inventory.getId(), actionId, true));
|
||||
}
|
||||
System.out.println(clickPacket);
|
||||
}
|
||||
|
||||
session.getPlayerInventory().setCursor(simulatedCursor, session);
|
||||
@ -268,7 +267,6 @@ public class ClickPlan {
|
||||
if (!item.isEmpty())
|
||||
item.sub(crafted);
|
||||
}
|
||||
System.out.println("REDUCED GRID BY " + crafted);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -84,7 +84,6 @@ public class BeaconInventoryTranslator extends AbstractBlockInventoryTranslator
|
||||
BlockEntityDataPacket packet = new BlockEntityDataPacket();
|
||||
packet.setBlockPosition(position);
|
||||
packet.setData(builder.build());
|
||||
System.out.println(packet.toString());
|
||||
session.sendUpstreamPacket(packet);
|
||||
}
|
||||
|
||||
@ -98,7 +97,6 @@ public class BeaconInventoryTranslator extends AbstractBlockInventoryTranslator
|
||||
// Input a beacon payment
|
||||
BeaconPaymentStackRequestActionData beaconPayment = (BeaconPaymentStackRequestActionData) request.getActions()[0];
|
||||
ClientSetBeaconEffectPacket packet = new ClientSetBeaconEffectPacket(beaconPayment.getPrimaryEffect(), beaconPayment.getSecondaryEffect());
|
||||
System.out.println(packet.toString());
|
||||
session.sendDownstreamPacket(packet);
|
||||
return acceptRequest(request, makeContainerEntries(session, inventory, Collections.emptySet()));
|
||||
}
|
||||
|
@ -69,7 +69,6 @@ public class BrewingInventoryTranslator extends AbstractBlockInventoryTranslator
|
||||
|
||||
@Override
|
||||
public int bedrockSlotToJava(StackRequestSlotInfoData slotInfoData) {
|
||||
System.out.println("Brewing stand: " + slotInfoData);
|
||||
if (slotInfoData.getContainer() == ContainerSlotType.BREWING_INPUT) {
|
||||
// Ingredient
|
||||
// TODO: This hasn't worked and then suddenly, it did.
|
||||
|
@ -99,7 +99,6 @@ public class EnchantingInventoryTranslator extends AbstractBlockInventoryTransla
|
||||
enchantingInventory.getEnchantOptions()[slotToUpdate] = enchantingInventory.getGeyserEnchantOptions()[slotToUpdate].build(session);
|
||||
PlayerEnchantOptionsPacket packet = new PlayerEnchantOptionsPacket();
|
||||
packet.getOptions().addAll(Arrays.asList(enchantingInventory.getEnchantOptions()));
|
||||
System.out.println(packet);
|
||||
session.sendUpstreamPacket(packet);
|
||||
}
|
||||
}
|
||||
@ -130,7 +129,6 @@ public class EnchantingInventoryTranslator extends AbstractBlockInventoryTransla
|
||||
return rejectRequest(request);
|
||||
}
|
||||
ClientClickWindowButtonPacket packet = new ClientClickWindowButtonPacket(inventory.getId(), javaSlot);
|
||||
System.out.println(packet);
|
||||
session.sendDownstreamPacket(packet);
|
||||
return acceptRequest(request, makeContainerEntries(session, inventory, Collections.emptySet()));
|
||||
}
|
||||
|
@ -140,7 +140,6 @@ public class LoomInventoryTranslator extends AbstractBlockInventoryTranslator {
|
||||
// And the Java loom window has a fixed row/width of four
|
||||
// So... Number / 4 = row (so we don't have to bother there), and number % 4 is our column, which leads us back to our index. :)
|
||||
ClientClickWindowButtonPacket packet = new ClientClickWindowButtonPacket(inventory.getId(), index);
|
||||
System.out.println(packet);
|
||||
session.sendDownstreamPacket(packet);
|
||||
|
||||
GeyserItemStack inputCopy = inventory.getItem(0).copy();
|
||||
|
@ -73,15 +73,12 @@ public class StonecutterInventoryTranslator extends AbstractBlockInventoryTransl
|
||||
if (results == null) {
|
||||
return rejectRequest(request);
|
||||
}
|
||||
System.out.println(id + " " + results);
|
||||
ItemStack javaOutput = ItemTranslator.translateToJava(craftData.getResultItems()[0]);
|
||||
System.out.println(javaOutput);
|
||||
int button = results.indexOf(javaOutput.getId());
|
||||
// If we've already pressed the button with this item, no need to press it again!
|
||||
if (container.getStonecutterButton() != button) {
|
||||
// Getting the index of the item in the Java stonecutter list
|
||||
ClientClickWindowButtonPacket packet = new ClientClickWindowButtonPacket(inventory.getId(), button);
|
||||
System.out.println(packet.toString());
|
||||
session.sendDownstreamPacket(packet);
|
||||
container.setStonecutterButton(button);
|
||||
if (inventory.getItem(1).getJavaId() != javaOutput.getId()) {
|
||||
|
@ -107,7 +107,6 @@ public abstract class ChestedHorseInventoryTranslator extends AbstractHorseInven
|
||||
InventoryContentPacket horseContentsPacket = new InventoryContentPacket();
|
||||
horseContentsPacket.setContainerId(inventory.getId());
|
||||
horseContentsPacket.setContents(Arrays.asList(horseItems));
|
||||
System.out.println(horseContentsPacket);
|
||||
session.sendUpstreamPacket(horseContentsPacket);
|
||||
}
|
||||
}
|
||||
|
@ -62,7 +62,6 @@ public class HorseInventoryUpdater extends InventoryUpdater {
|
||||
slotPacket.setSlot(translator.javaSlotToBedrock(javaSlot));
|
||||
slotPacket.setItem(inventory.getItem(javaSlot).getItemData(session));
|
||||
session.sendUpstreamPacket(slotPacket);
|
||||
System.out.println(slotPacket);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -41,7 +41,6 @@ public class JavaConfirmTransactionTranslator extends PacketTranslator<ServerCon
|
||||
if (!packet.isAccepted()) {
|
||||
ClientConfirmTransactionPacket confirmPacket = new ClientConfirmTransactionPacket(packet.getWindowId(), packet.getActionId(), true);
|
||||
session.sendDownstreamPacket(confirmPacket);
|
||||
System.out.println(packet);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -99,7 +99,6 @@ public class JavaOpenHorseWindowTranslator extends PacketTranslator<ServerOpenHo
|
||||
|
||||
@Override
|
||||
public void translate(ServerOpenHorseWindowPacket packet, GeyserSession session) {
|
||||
System.out.println(packet.toString());
|
||||
Entity entity = session.getEntityCache().getEntityByJavaId(packet.getEntityId());
|
||||
if (entity == null) {
|
||||
return;
|
||||
@ -130,7 +129,6 @@ public class JavaOpenHorseWindowTranslator extends PacketTranslator<ServerOpenHo
|
||||
builder.putList("slots", NbtType.COMPOUND, slots);
|
||||
|
||||
updateEquipPacket.setTag(builder.build());
|
||||
System.out.println(updateEquipPacket);
|
||||
session.sendUpstreamPacket(updateEquipPacket);
|
||||
|
||||
session.setInventoryTranslator(inventoryTranslator);
|
||||
|
@ -58,7 +58,6 @@ public class JavaSetSlotTranslator extends PacketTranslator<ServerSetSlotPacket>
|
||||
|
||||
@Override
|
||||
public void translate(ServerSetSlotPacket packet, GeyserSession session) {
|
||||
System.out.println(packet.toString());
|
||||
session.addInventoryTask(() -> {
|
||||
if (packet.getWindowId() == 255) { //cursor
|
||||
GeyserItemStack newItem = GeyserItemStack.from(packet.getItem());
|
||||
@ -125,11 +124,6 @@ public class JavaSetSlotTranslator extends PacketTranslator<ServerSetSlotPacket>
|
||||
height += -firstRow + 1;
|
||||
width += -firstCol + 1;
|
||||
|
||||
System.out.println("Start Row: " + firstRow);
|
||||
System.out.println("Start Column: " + firstCol);
|
||||
System.out.println("Rows: " + height);
|
||||
System.out.println("Columns: " + width);
|
||||
|
||||
//TODO
|
||||
recipes:
|
||||
for (Recipe recipe : session.getCraftingRecipes().values()) {
|
||||
@ -157,8 +151,6 @@ public class JavaSetSlotTranslator extends PacketTranslator<ServerSetSlotPacket>
|
||||
continue;
|
||||
}
|
||||
}
|
||||
System.out.println("FOUND SHAPED RECIPE :)");
|
||||
System.out.println(recipe);
|
||||
// Recipe is had, don't sent packet
|
||||
return;
|
||||
} else if (recipe.getType() == RecipeType.CRAFTING_SHAPELESS) {
|
||||
@ -191,7 +183,6 @@ public class JavaSetSlotTranslator extends PacketTranslator<ServerSetSlotPacket>
|
||||
return;
|
||||
}
|
||||
}
|
||||
System.out.println("Sending packet!");
|
||||
|
||||
UUID uuid = UUID.randomUUID();
|
||||
int newRecipeId = session.getLastRecipeNetId().incrementAndGet();
|
||||
@ -234,7 +225,6 @@ public class JavaSetSlotTranslator extends PacketTranslator<ServerSetSlotPacket>
|
||||
newRecipeId
|
||||
));
|
||||
craftPacket.setCleanRecipes(false);
|
||||
System.out.println(craftPacket);
|
||||
session.sendUpstreamPacket(craftPacket);
|
||||
|
||||
index = 0;
|
||||
|
@ -38,7 +38,6 @@ public class JavaWindowPropertyTranslator extends PacketTranslator<ServerWindowP
|
||||
|
||||
@Override
|
||||
public void translate(ServerWindowPropertyPacket packet, GeyserSession session) {
|
||||
System.out.println(packet.toString());
|
||||
session.addInventoryTask(() -> {
|
||||
Inventory inventory = InventoryUtils.getInventory(session, packet.getWindowId());
|
||||
if (inventory == null)
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren