Added inventory rollback support for online players
This commit is contained in:
parent
29d55e6ba9
commit
a2353afd0a
13 changed files with 230 additions and 60 deletions
|
|
@ -216,18 +216,6 @@ public class Queue {
|
|||
queueStandardData(consumerId, currentConsumer, new String[] { user, null }, location);
|
||||
}
|
||||
|
||||
protected static void queueContainerRollbackUpdate(String user, Location location, List<Object[]> list, int action) {
|
||||
if (location == null) {
|
||||
location = new Location(Bukkit.getServer().getWorlds().get(0), 0, 0, 0);
|
||||
}
|
||||
|
||||
int currentConsumer = Consumer.currentConsumer;
|
||||
int consumerId = Consumer.newConsumerId(currentConsumer);
|
||||
addConsumer(currentConsumer, new Object[] { consumerId, Process.CONTAINER_ROLLBACK_UPDATE, null, 0, null, 0, action, null });
|
||||
Consumer.consumerObjectArrayList.get(currentConsumer).put(consumerId, list);
|
||||
queueStandardData(consumerId, currentConsumer, new String[] { user, null }, location);
|
||||
}
|
||||
|
||||
protected static synchronized void queueContainerTransaction(String user, Location location, Material type, Object inventory, int chestId) {
|
||||
int currentConsumer = Consumer.currentConsumer;
|
||||
int consumerId = Consumer.newConsumerId(currentConsumer);
|
||||
|
|
@ -352,13 +340,14 @@ public class Queue {
|
|||
queueStandardData(consumerId, currentConsumer, new String[] { player.getName(), null }, player.getLocation().clone());
|
||||
}
|
||||
|
||||
protected static void queueRollbackUpdate(String user, Location location, List<Object[]> list, int action) {
|
||||
protected static void queueRollbackUpdate(String user, Location location, List<Object[]> list, int table, int action) {
|
||||
if (location == null) {
|
||||
location = new Location(Bukkit.getServer().getWorlds().get(0), 0, 0, 0);
|
||||
}
|
||||
|
||||
int currentConsumer = Consumer.currentConsumer;
|
||||
int consumerId = Consumer.newConsumerId(currentConsumer);
|
||||
addConsumer(currentConsumer, new Object[] { consumerId, Process.ROLLBACK_UPDATE, null, 0, null, 0, action, null });
|
||||
addConsumer(currentConsumer, new Object[] { consumerId, table, null, 0, null, 0, action, null });
|
||||
Consumer.consumerObjectArrayList.get(currentConsumer).put(consumerId, list);
|
||||
queueStandardData(consumerId, currentConsumer, new String[] { user, null }, location);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,6 +44,8 @@ public class Process {
|
|||
public static final int PLAYER_KILL = 24;
|
||||
public static final int BLOCKDATA_INSERT = 25;
|
||||
public static final int ITEM_TRANSACTION = 26;
|
||||
public static final int INVENTORY_ROLLBACK_UPDATE = 27;
|
||||
public static final int INVENTORY_CONTAINER_ROLLBACK_UPDATE = 28;
|
||||
|
||||
public static int lastLockUpdate = 0;
|
||||
private static volatile int currentConsumerSize = 0;
|
||||
|
|
@ -160,6 +162,12 @@ public class Process {
|
|||
case Process.CONTAINER_ROLLBACK_UPDATE:
|
||||
RollbackUpdateProcess.process(statement, processId, id, forceData, 1);
|
||||
break;
|
||||
case Process.INVENTORY_ROLLBACK_UPDATE:
|
||||
RollbackUpdateProcess.process(statement, processId, id, forceData, 2);
|
||||
break;
|
||||
case Process.INVENTORY_CONTAINER_ROLLBACK_UPDATE:
|
||||
RollbackUpdateProcess.process(statement, processId, id, forceData, 3);
|
||||
break;
|
||||
case Process.WORLD_INSERT:
|
||||
WorldInsertProcess.process(preparedStmtWorlds, i, statement, object, forceData);
|
||||
break;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue