api: replace varbits enum with ints

This adds a Varbit magic constant annotation which is used now on
varbit parameters and fields.

This is roughly the same type-safety wise, with IDE support, but the ids
can be inlined by the compiler and it avoids having to have a large enum
class with many fields.
This commit is contained in:
Adam
2022-04-09 23:28:01 -04:00
parent b010e0481e
commit d129c49923
25 changed files with 476 additions and 403 deletions

View File

@@ -454,7 +454,6 @@ public class TimersPluginTest
public void testCorruptionCooldown()
{
when(timersConfig.showArceuusCooldown()).thenReturn(true);
when(client.getVar(any(Varbits.class))).thenReturn(0);
when(client.getVar(Varbits.CORRUPTION_COOLDOWN)).thenReturn(1);
timersPlugin.onVarbitChanged(new VarbitChanged());

View File

@@ -28,7 +28,7 @@ import com.google.inject.Guice;
import com.google.inject.testing.fieldbinder.Bind;
import com.google.inject.testing.fieldbinder.BoundFieldModule;
import java.time.Instant;
import java.util.EnumMap;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ScheduledExecutorService;
import javax.inject.Inject;
@@ -53,7 +53,7 @@ import org.mockito.junit.MockitoJUnitRunner;
@RunWith(MockitoJUnitRunner.class)
public class FarmingContractManagerTest
{
private Map<Varbits, FarmingPatch> farmingGuildPatches = new EnumMap<>(Varbits.class);
private Map<Integer, FarmingPatch> farmingGuildPatches = new HashMap<>();
@Inject
private FarmingContractManager farmingContractManager;