MCPcopy Create free account
hub / github.com/e2wugui/zeze / onTimer

Method onTimer

ZezeJava/ZezexJava/server/ModuleEquip.hot.java:121–156  ·  view source on GitHub ↗
(@NotNull TimerContext context)

Source from the content-addressed store, hash-verified

119
120 public static class HotTimer implements TimerHandle {
121 @Override
122 public void onTimer(@NotNull TimerContext context) throws Exception {
123 var mc = context.timer.zeze.getHotManager().getModuleContext("Game.Equip", IModuleEquip.class);
124 var equip = mc.getService();
125 var count = 1; // default is 1
126 var custom = (BEquipExtra)context.customData;
127 switch (custom.getDefence()) {
128 case 1:
129 count = equip.getHotTimerCount();
130 break;
131 case 2:
132 count = equip.getNamedTimerCount();
133 break;
134 case 3:
135 count = equip.getOnlineTimerCount();
136 break;
137 }
138 if (count != custom.getAttack())
139 throw new RuntimeException("HotTimer verify fail. type=" + custom.getDefence()
140 + " count=" + count + ":" + custom.getAttack());
141 custom.setAttack(count + 1);
142 var finalCount = count;
143 Transaction.whileCommit(() -> {
144 switch (custom.getDefence()) {
145 case 1:
146 equip.setHotTimerCount(finalCount + 1);
147 break;
148 case 2:
149 equip.setNamedTimerCount(finalCount + 1);
150 break;
151 case 3:
152 equip.setOnlineTimerCount(finalCount + 1);
153 break;
154 }
155 });
156 }
157 }
158
159 private void accessWillAddTable() {

Callers

nothing calls this directly

Calls 13

whileCommitMethod · 0.95
getModuleContextMethod · 0.80
getDefenceMethod · 0.65
getHotTimerCountMethod · 0.65
getNamedTimerCountMethod · 0.65
getOnlineTimerCountMethod · 0.65
getAttackMethod · 0.65
setAttackMethod · 0.65
setHotTimerCountMethod · 0.65
setNamedTimerCountMethod · 0.65
setOnlineTimerCountMethod · 0.65
getHotManagerMethod · 0.45

Tested by

no test coverage detected