Start implementing inv update task

This commit is contained in:
mmxw11 2017-09-25 16:13:56 +03:00
parent b2669129f2
commit 976c418c9e
3 changed files with 50 additions and 2 deletions

View File

@ -0,0 +1,22 @@
package us.myles.ViaVersion.bukkit.protocol1_12to1_11_1;
import java.util.UUID;
import us.myles.ViaVersion.bukkit.providers.BukkitInvContainerItemProvider;
public class BukkitInvContainerUpdateTask implements Runnable {
private BukkitInvContainerItemProvider provider;
private UUID uuid;
public BukkitInvContainerUpdateTask(BukkitInvContainerItemProvider provider, UUID uuid) {
this.provider = provider;
this.uuid = uuid;
}
@Override
public void run() {
// TODO Auto-generated method stub
provider.onTaskExecuted(uuid);
}
}

View File

@ -1,15 +1,28 @@
package us.myles.ViaVersion.bukkit.providers;
import java.util.Map;
import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;
import us.myles.ViaVersion.api.data.UserConnection;
import us.myles.ViaVersion.bukkit.protocol1_12to1_11_1.BukkitInvContainerUpdateTask;
import us.myles.ViaVersion.protocols.base.ProtocolInfo;
import us.myles.ViaVersion.protocols.protocol1_12to1_11_1.providers.InvContainerItemProvider;
public class BukkitInvContainerItemProvider extends InvContainerItemProvider {
private static Map<UUID, BukkitInvContainerUpdateTask> updateTasks = new ConcurrentHashMap<>();
@Override
public boolean registerInvClickPacket(short windowId, short slotId, short anumber, UserConnection uconnection) {
ProtocolInfo info = uconnection.get(ProtocolInfo.class);
// TODO: lets add some stuff here :)
//http://wiki.vg/index.php?title=Protocol&oldid=13223#Click_Window
System.out.println("QUICK ACTION windowId: " + windowId + " slotId: " + slotId + " button: " + 0 + " anumber: " + anumber + " mode: " + 1);
// http://wiki.vg/index.php?title=Protocol&oldid=13223#Click_Window
System.out.println("info: " + info + " QUICK ACTION windowId: " + windowId + " slotId: " + slotId + " button: " + 0 + " anumber: " + anumber + " mode: " + 1);
return false; // change to true once supported
}
public void onTaskExecuted(UUID uuid) {
updateTasks.remove(uuid);
}
}

View File

@ -0,0 +1,13 @@
package us.myles.ViaVersion.protocols.protocol1_12to1_11_1.storage;
import lombok.AllArgsConstructor;
import lombok.Getter;
@AllArgsConstructor
@Getter
public class InvItemStorage {
private short windowId;
private short slotId;
private short actionNumber;
}