mirror of
https://github.com/BentoBoxWorld/Challenges.git
synced 2024-11-15 07:05:48 +01:00
Merge remote-tracking branch 'origin/develop' into develop
This commit is contained in:
commit
d74cfbfe96
9
.github/workflows/build.yml
vendored
9
.github/workflows/build.yml
vendored
@ -11,21 +11,22 @@ jobs:
|
||||
name: Build
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
|
||||
- name: Set up JDK 17
|
||||
uses: actions/setup-java@v1
|
||||
uses: actions/setup-java@v3
|
||||
with:
|
||||
distribution: 'adopt'
|
||||
java-version: 17
|
||||
- name: Cache SonarCloud packages
|
||||
uses: actions/cache@v1
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: ~/.sonar/cache
|
||||
key: ${{ runner.os }}-sonar
|
||||
restore-keys: ${{ runner.os }}-sonar
|
||||
- name: Cache Maven packages
|
||||
uses: actions/cache@v1
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: ~/.m2
|
||||
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
|
||||
|
@ -82,7 +82,7 @@ public class ChallengesManagerTest {
|
||||
// Mocks
|
||||
@Mock
|
||||
private ChallengesAddon addon;
|
||||
@Mock
|
||||
|
||||
private Settings settings;
|
||||
@Mock
|
||||
private IslandWorldManager iwm;
|
||||
@ -134,9 +134,11 @@ public class ChallengesManagerTest {
|
||||
when(s.getDatabaseType()).thenReturn(DatabaseType.JSON);
|
||||
|
||||
// Addon Settings
|
||||
settings = new Settings();
|
||||
when(addon.getChallengesSettings()).thenReturn(settings);
|
||||
when(settings.isStoreHistory()).thenReturn(true);
|
||||
when(settings.getLifeSpan()).thenReturn(10);
|
||||
settings.setStoreAsIslandData(false);
|
||||
settings.setStoreHistory(true);
|
||||
settings.setLifeSpan(10);
|
||||
|
||||
// Database
|
||||
database = new File("database");
|
||||
@ -264,7 +266,7 @@ public class ChallengesManagerTest {
|
||||
assertTrue(cm.loadChallenge(challenge, world, false, user, true));
|
||||
// load twice - no overwrite, not silent
|
||||
assertFalse(cm.loadChallenge(challenge, world, false, user, false));
|
||||
verify(user).getTranslation("challenges.messages.load-skipping", "[value]", "name");
|
||||
verify(user).getTranslation(world, "challenges.messages.load-skipping", "[value]", "name");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -276,7 +278,7 @@ public class ChallengesManagerTest {
|
||||
assertTrue(cm.loadChallenge(challenge, world, false, user, true));
|
||||
// overwrite
|
||||
assertTrue(cm.loadChallenge(challenge, world, true, user, true));
|
||||
verify(user, never()).getTranslation(anyString(), anyString(), anyString());
|
||||
verify(user, never()).getTranslation(any(World.class), anyString(), anyString(), anyString());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -288,7 +290,7 @@ public class ChallengesManagerTest {
|
||||
assertTrue(cm.loadChallenge(challenge, world, false, user, true));
|
||||
// overwrite not silent
|
||||
assertTrue(cm.loadChallenge(challenge, world, true, user, false));
|
||||
verify(user).getTranslation("challenges.messages.load-overwriting", "[value]", "name");
|
||||
verify(user).getTranslation(world, "challenges.messages.load-overwriting", "[value]", "name");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -311,7 +313,7 @@ public class ChallengesManagerTest {
|
||||
assertTrue(cm.loadLevel(level, world, false, user, true));
|
||||
// load twice - no overwrite, not silent
|
||||
assertFalse(cm.loadLevel(level, world, false, user, false));
|
||||
verify(user).getTranslation("challenges.messages.load-skipping", "[value]", "Novice");
|
||||
verify(user).getTranslation(world, "challenges.messages.load-skipping", "[value]", "Novice");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -323,7 +325,7 @@ public class ChallengesManagerTest {
|
||||
assertTrue(cm.loadLevel(level, world, false, user, true));
|
||||
// overwrite
|
||||
assertTrue(cm.loadLevel(level, world, true, user, true));
|
||||
verify(user, never()).getTranslation(anyString(), anyString(), anyString());
|
||||
verify(user, never()).getTranslation(any(World.class), anyString(), anyString(), anyString());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -335,7 +337,7 @@ public class ChallengesManagerTest {
|
||||
assertTrue(cm.loadLevel(level, world, false, user, true));
|
||||
// overwrite not silent
|
||||
assertTrue(cm.loadLevel(level, world, true, user, false));
|
||||
verify(user).getTranslation("challenges.messages.load-overwriting", "[value]", "Novice");
|
||||
verify(user).getTranslation(world, "challenges.messages.load-overwriting", "[value]", "Novice");
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -104,7 +104,7 @@ public class ChallengesCommandTest {
|
||||
Optional<GameModeAddon> optionalAddon = Optional.of(gameModeAddon);
|
||||
when(iwm.getAddon(any())).thenReturn(optionalAddon);
|
||||
when(plugin.getIWM()).thenReturn(iwm);
|
||||
|
||||
|
||||
@NonNull
|
||||
WorldSettings ws = new TestWorldSetting();
|
||||
when(iwm.getWorldSettings(any())).thenReturn(ws);
|
||||
@ -172,7 +172,7 @@ public class ChallengesCommandTest {
|
||||
public void testCanExecuteWrongWorld() {
|
||||
when(iwm.inWorld(any(World.class))).thenReturn(false);
|
||||
assertFalse(cc.canExecute(user, "challenges", Collections.emptyList()));
|
||||
verify(user).getTranslation("general.errors.wrong-world");
|
||||
verify(user).getTranslation(world, "general.errors.wrong-world");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -184,7 +184,7 @@ public class ChallengesCommandTest {
|
||||
when(chm.hasAnyChallengeData(any(World.class))).thenReturn(false);
|
||||
assertFalse(cc.canExecute(user, "challenges", Collections.emptyList()));
|
||||
verify(addon).logError("There are no challenges set up in world!");
|
||||
verify(user).getTranslation("challenges.errors.no-challenges");
|
||||
verify(user).getTranslation(world, "challenges.errors.no-challenges");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -196,8 +196,8 @@ public class ChallengesCommandTest {
|
||||
when(chm.hasAnyChallengeData(any(World.class))).thenReturn(false);
|
||||
assertFalse(cc.canExecute(user, "challenges", Collections.emptyList()));
|
||||
verify(addon).logError("There are no challenges set up in world!");
|
||||
verify(user).getTranslation("challenges.errors.no-challenges-admin", "[command]", "bsb challenges");
|
||||
verify(user, never()).getTranslation("challenges.errors.no-challenges");
|
||||
verify(user).getTranslation(world, "challenges.errors.no-challenges-admin", "[command]", "bsb challenges");
|
||||
verify(user, never()).getTranslation(world, "challenges.errors.no-challenges");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -209,8 +209,8 @@ public class ChallengesCommandTest {
|
||||
when(chm.hasAnyChallengeData(any(World.class))).thenReturn(false);
|
||||
assertFalse(cc.canExecute(user, "challenges", Collections.emptyList()));
|
||||
verify(addon).logError("There are no challenges set up in world!");
|
||||
verify(user).getTranslation("challenges.errors.no-challenges-admin", "[command]", "bsb challenges");
|
||||
verify(user, never()).getTranslation("challenges.errors.no-challenges");
|
||||
verify(user).getTranslation(world, "challenges.errors.no-challenges-admin", "[command]", "bsb challenges");
|
||||
verify(user, never()).getTranslation(world, "challenges.errors.no-challenges");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -223,8 +223,8 @@ public class ChallengesCommandTest {
|
||||
when(chm.hasAnyChallengeData(any(World.class))).thenReturn(false);
|
||||
assertFalse(cc.canExecute(user, "challenges", Collections.emptyList()));
|
||||
verify(addon).logError("There are no challenges set up in world!");
|
||||
verify(user).getTranslation("challenges.errors.no-challenges-admin", "[command]", "bsb challenges");
|
||||
verify(user, never()).getTranslation("challenges.errors.no-challenges");
|
||||
verify(user).getTranslation(world, "challenges.errors.no-challenges-admin", "[command]", "bsb challenges");
|
||||
verify(user, never()).getTranslation(world, "challenges.errors.no-challenges");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -234,7 +234,7 @@ public class ChallengesCommandTest {
|
||||
public void testCanExecuteNoIsland() {
|
||||
when(im.getIsland(any(), any(User.class))).thenReturn(null);
|
||||
assertFalse(cc.canExecute(user, "challenges", Collections.emptyList()));
|
||||
verify(user).getTranslation("general.errors.no-island");
|
||||
verify(user).getTranslation(world, "general.errors.no-island");
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -51,6 +51,7 @@ import world.bentobox.challenges.config.Settings;
|
||||
import world.bentobox.challenges.config.SettingsUtils.VisibilityMode;
|
||||
import world.bentobox.challenges.database.object.Challenge;
|
||||
import world.bentobox.challenges.tasks.TryToComplete;
|
||||
import world.bentobox.challenges.utils.Constants;
|
||||
import world.bentobox.challenges.utils.Utils;
|
||||
|
||||
/**
|
||||
@ -207,7 +208,8 @@ public class CompleteChallengeCommandTest {
|
||||
@Test
|
||||
public void testExecuteUserStringListOfStringNoArgs() {
|
||||
assertFalse(cc.execute(user, "complete", Collections.emptyList()));
|
||||
verify(user).getTranslation(eq("challenges.errors.no-name"));
|
||||
PowerMockito.verifyStatic(Utils.class);
|
||||
Utils.sendMessage(user, world, Constants.ERRORS + "no-name");
|
||||
verify(user).sendMessage(eq("commands.help.header"), eq(TextVariables.LABEL), eq("BSkyBlock"));
|
||||
}
|
||||
|
||||
@ -218,7 +220,8 @@ public class CompleteChallengeCommandTest {
|
||||
public void testExecuteUserStringListOfStringUnknownChallenge() {
|
||||
when(chm.getChallenge(anyString())).thenReturn(null);
|
||||
assertFalse(cc.execute(user, "complete", Collections.singletonList("mychal")));
|
||||
verify(user).getTranslation(eq("challenges.errors.unknown-challenge"));
|
||||
PowerMockito.verifyStatic(Utils.class);
|
||||
Utils.sendMessage(user, world, Constants.ERRORS + "unknown-challenge");
|
||||
verify(user).sendMessage(eq("commands.help.header"), eq(TextVariables.LABEL), eq("BSkyBlock"));
|
||||
}
|
||||
|
||||
@ -247,7 +250,8 @@ public class CompleteChallengeCommandTest {
|
||||
@Test
|
||||
public void testExecuteUserStringListOfStringKnownChallengeSuccessMultipleTimesNoPerm() {
|
||||
assertTrue(cc.execute(user, "complete", Arrays.asList("mychal", "5")));
|
||||
verify(user).getTranslation(eq("challenges.error.no-multiple-permission"));
|
||||
PowerMockito.verifyStatic(Utils.class);
|
||||
Utils.sendMessage(user, world, Constants.ERRORS + "no-multiple-permission");
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -254,7 +254,7 @@ public class TryToCompleteTest {
|
||||
// ItemFactory
|
||||
ItemFactory itemFactory = mock(ItemFactory.class);
|
||||
when(Bukkit.getItemFactory()).thenReturn(itemFactory);
|
||||
|
||||
|
||||
// ChatColor
|
||||
PowerMockito.mockStatic(ChatColor.class, Mockito.RETURNS_MOCKS);
|
||||
when(ChatColor.stripColor(anyString())).thenAnswer((Answer<String>) invocation -> invocation.getArgument(0, String.class));
|
||||
@ -282,7 +282,7 @@ public class TryToCompleteTest {
|
||||
public void testCompleteChallengesAddonUserChallengeWorldStringStringNotDeployed() {
|
||||
challenge.setDeployed(false);
|
||||
assertFalse(TryToComplete.complete(addon, user, challenge, world, topLabel, permissionPrefix));
|
||||
verify(user).getTranslation("challenges.errors.not-deployed");
|
||||
verify(user).getTranslation(any(World.class), eq("challenges.errors.not-deployed"));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -292,7 +292,7 @@ public class TryToCompleteTest {
|
||||
public void testCompleteChallengesAddonUserChallengeWorldStringStringWrongWorld() {
|
||||
challenge.setUniqueId("test");
|
||||
assertFalse(TryToComplete.complete(addon, user, challenge, world, topLabel, permissionPrefix));
|
||||
verify(user).getTranslation("general.errors.wrong-world");
|
||||
verify(user).getTranslation(any(World.class), eq("general.errors.wrong-world"));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -303,7 +303,7 @@ public class TryToCompleteTest {
|
||||
ChallengesAddon.CHALLENGES_WORLD_PROTECTION.setSetting(world, true);
|
||||
when(im.locationIsOnIsland(any(Player.class), any(Location.class))).thenReturn(false);
|
||||
assertFalse(TryToComplete.complete(addon, user, challenge, world, topLabel, permissionPrefix));
|
||||
verify(user).getTranslation("challenges.errors.not-on-island");
|
||||
verify(user).getTranslation(any(World.class), eq("challenges.messages.not-on-island"));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -314,7 +314,7 @@ public class TryToCompleteTest {
|
||||
ChallengesAddon.CHALLENGES_WORLD_PROTECTION.setSetting(world, false);
|
||||
when(im.locationIsOnIsland(any(Player.class), any(Location.class))).thenReturn(false);
|
||||
assertTrue(TryToComplete.complete(addon, user, challenge, world, topLabel, permissionPrefix));
|
||||
verify(user).getTranslation("challenges.messages.you-completed-challenge", "[value]", "name");
|
||||
verify(user).getTranslation(any(World.class), eq("challenges.messages.you-completed-challenge"), eq("[value]"), eq("name"));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -324,7 +324,7 @@ public class TryToCompleteTest {
|
||||
public void testCompleteChallengesAddonUserChallengeWorldStringStringLevelNotUnlocked() {
|
||||
when(cm.isLevelUnlocked(any(), any(), any())).thenReturn(false);
|
||||
assertFalse(TryToComplete.complete(addon, user, challenge, world, topLabel, permissionPrefix));
|
||||
verify(user).getTranslation("challenges.errors.challenge-level-not-available");
|
||||
verify(user).getTranslation(any(World.class), eq("challenges.errors.challenge-level-not-available"));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -335,7 +335,7 @@ public class TryToCompleteTest {
|
||||
challenge.setRepeatable(false);
|
||||
when(cm.isChallengeComplete(any(User.class), any(), any())).thenReturn(true);
|
||||
assertFalse(TryToComplete.complete(addon, user, challenge, world, topLabel, permissionPrefix));
|
||||
verify(user).getTranslation("challenges.errors.not-repeatable");
|
||||
verify(user).getTranslation(any(World.class), eq("challenges.errors.not-repeatable"));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -347,7 +347,7 @@ public class TryToCompleteTest {
|
||||
challenge.setMaxTimes(0);
|
||||
when(cm.getChallengeTimes(any(), any(), any(Challenge.class))).thenReturn(0L);
|
||||
assertTrue(TryToComplete.complete(addon, user, challenge, world, topLabel, permissionPrefix));
|
||||
verify(user).getTranslation("challenges.messages.you-completed-challenge", "[value]", "name");
|
||||
verify(user).getTranslation(any(World.class), eq("challenges.messages.you-completed-challenge"), eq("[value]"), eq("name"));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -357,7 +357,7 @@ public class TryToCompleteTest {
|
||||
public void testCompleteChallengesAddonUserChallengeWorldStringStringNoRank() {
|
||||
when(island.isAllowed(any(), any())).thenReturn(false);
|
||||
assertFalse(TryToComplete.complete(addon, user, challenge, world, topLabel, permissionPrefix));
|
||||
verify(user).getTranslation("challenges.errors.no-rank");
|
||||
verify(user).getTranslation(any(World.class), eq("challenges.messages.no-rank"));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -366,7 +366,7 @@ public class TryToCompleteTest {
|
||||
@Test
|
||||
public void testCompleteChallengesAddonUserChallengeWorldStringStringIntZero() {
|
||||
assertFalse(TryToComplete.complete(addon, user, challenge, world, topLabel, permissionPrefix, 0));
|
||||
verify(user).getTranslation("challenges.errors.not-valid-integer");
|
||||
verify(user).getTranslation(any(World.class), eq("challenges.errors.not-valid-integer"));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -375,7 +375,7 @@ public class TryToCompleteTest {
|
||||
@Test
|
||||
public void testCompleteChallengesAddonUserChallengeWorldStringStringIntNegative() {
|
||||
assertFalse(TryToComplete.complete(addon, user, challenge, world, topLabel, permissionPrefix, -10));
|
||||
verify(user).getTranslation("challenges.errors.not-valid-integer");
|
||||
verify(user).getTranslation(any(World.class), eq("challenges.errors.not-valid-integer"));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -385,7 +385,7 @@ public class TryToCompleteTest {
|
||||
public void testCompleteChallengesAddonUserChallengeWorldStringStringIntPositiveWrongEnvinonment() {
|
||||
challenge.setEnvironment(Collections.singleton(Environment.NETHER));
|
||||
assertFalse(TryToComplete.complete(addon, user, challenge, world, topLabel, permissionPrefix, 100));
|
||||
verify(user).getTranslation("challenges.errors.wrong-environment");
|
||||
verify(user).getTranslation(any(World.class), eq("challenges.errors.wrong-environment"));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -398,7 +398,7 @@ public class TryToCompleteTest {
|
||||
when(user.hasPermission(anyString())).thenReturn(false);
|
||||
challenge.setRequirements(req);
|
||||
assertFalse(TryToComplete.complete(addon, user, challenge, world, topLabel, permissionPrefix, 100));
|
||||
verify(user).getTranslation("general.errors.no-permission");
|
||||
verify(user).getTranslation(any(World.class), eq("challenges.errors.no-permission"));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -407,7 +407,7 @@ public class TryToCompleteTest {
|
||||
@Test
|
||||
public void testCompleteChallengesAddonUserChallengeWorldStringStringSuccess() {
|
||||
assertTrue(TryToComplete.complete(addon, user, challenge, world, topLabel, permissionPrefix));
|
||||
verify(user).getTranslation("challenges.messages.you-completed-challenge", "[value]", "name");
|
||||
verify(user).getTranslation(any(World.class), eq("challenges.messages.you-completed-challenge"), eq("[value]"), eq("name"));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -419,7 +419,7 @@ public class TryToCompleteTest {
|
||||
req.setRequiredItems(Collections.singletonList(new ItemStack(Material.EMERALD_BLOCK)));
|
||||
challenge.setRequirements(req);
|
||||
assertFalse(TryToComplete.complete(addon, user, challenge, world, topLabel, permissionPrefix));
|
||||
verify(user).getTranslation("challenges.errors.not-enough-items", "[items]", "challenges.materials.emerald_block");
|
||||
verify(user).getTranslation(any(World.class), eq("challenges.errors.not-enough-items"), eq("[items]"), eq("challenges.materials.emerald_block"));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -454,9 +454,9 @@ public class TryToCompleteTest {
|
||||
|
||||
assertFalse(TryToComplete.complete(addon, user, challenge, world, topLabel, permissionPrefix));
|
||||
// Sufficient emerald blocks
|
||||
verify(user, never()).getTranslation("challenges.errors.not-enough-items", "[items]", "challenges.materials.emerald_block");
|
||||
verify(user, never()).getTranslation(any(World.class), eq("challenges.errors.not-enough-items"), eq("[items]"), eq("challenges.materials.emerald_block"));
|
||||
// Not enough books
|
||||
verify(user).getTranslation("challenges.errors.not-enough-items", "[items]", "challenges.materials.enchanted_book");
|
||||
verify(user).getTranslation(any(World.class), eq("challenges.errors.not-enough-items"), eq("[items]"),eq("challenges.materials.enchanted_book"));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -466,7 +466,7 @@ public class TryToCompleteTest {
|
||||
public void testCompleteChallengesAddonUserChallengeWorldStringStringSuccessCreative() {
|
||||
when(player.getGameMode()).thenReturn(GameMode.CREATIVE);
|
||||
assertTrue(TryToComplete.complete(addon, user, challenge, world, topLabel, permissionPrefix));
|
||||
verify(user).getTranslation("challenges.messages.you-completed-challenge", "[value]", "name");
|
||||
verify(user).getTranslation(any(World.class), eq("challenges.messages.you-completed-challenge"), eq("[value]"),eq("name"));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -496,7 +496,7 @@ public class TryToCompleteTest {
|
||||
req.setSearchRadius(1);
|
||||
challenge.setRequirements(req);
|
||||
assertTrue(TryToComplete.complete(addon, user, challenge, world, topLabel, permissionPrefix));
|
||||
verify(user).getTranslation("challenges.messages.you-completed-challenge", "[value]", "name");
|
||||
verify(user).getTranslation(any(World.class), eq("challenges.messages.you-completed-challenge"), eq("[value]"), eq("name"));
|
||||
|
||||
}
|
||||
|
||||
@ -512,7 +512,7 @@ public class TryToCompleteTest {
|
||||
req.setSearchRadius(1);
|
||||
challenge.setRequirements(req);
|
||||
assertFalse(TryToComplete.complete(addon, user, challenge, world, topLabel, permissionPrefix));
|
||||
verify(user).getTranslation("challenges.errors.you-still-need", "[amount]", "3", "[item]", "challenges.entities.ghast.name");
|
||||
verify(user).getTranslation(any(World.class), eq("challenges.errors.you-still-need"), eq("[amount]"), eq("3"), eq("[item]"), eq("challenges.entities.ghast.name"));
|
||||
|
||||
}
|
||||
|
||||
@ -531,9 +531,9 @@ public class TryToCompleteTest {
|
||||
req.setSearchRadius(1);
|
||||
challenge.setRequirements(req);
|
||||
assertFalse(TryToComplete.complete(addon, user, challenge, world, topLabel, permissionPrefix));
|
||||
verify(user).getTranslation("challenges.errors.you-still-need", "[amount]", "3", "[item]", "challenges.entities.ghast.name");
|
||||
verify(user).getTranslation("challenges.errors.you-still-need", "[amount]", "1", "[item]", "challenges.entities.pufferfish.name");
|
||||
verify(user).getTranslation("challenges.errors.you-still-need", "[amount]", "5", "[item]", "challenges.entities.chicken.name");
|
||||
verify(user).getTranslation(any(World.class), eq("challenges.errors.you-still-need"), eq("[amount]"), eq("3"), eq("[item]"), eq("challenges.entities.ghast.name"));
|
||||
verify(user).getTranslation(any(World.class), eq("challenges.errors.you-still-need"), eq("[amount]"), eq("1"), eq("[item]"), eq("challenges.entities.pufferfish.name"));
|
||||
verify(user).getTranslation(any(World.class), eq("challenges.errors.you-still-need"), eq("[amount]"), eq("5"), eq("[item]"), eq("challenges.entities.chicken.name"));
|
||||
|
||||
}
|
||||
|
||||
@ -558,9 +558,9 @@ public class TryToCompleteTest {
|
||||
List<Entity> list = Collections.singletonList(ent);
|
||||
when(world.getNearbyEntities(any(BoundingBox.class))).thenReturn(list);
|
||||
assertFalse(TryToComplete.complete(addon, user, challenge, world, topLabel, permissionPrefix));
|
||||
verify(user).getTranslation("challenges.errors.you-still-need", "[amount]", "3", "[item]", "challenges.entities.ghast.name");
|
||||
verify(user, never()).getTranslation("challenges.errors.you-still-need", "[amount]", "1", "[item]", "challenges.entities.pufferfish.name");
|
||||
verify(user).getTranslation("challenges.errors.you-still-need", "[amount]", "5", "[item]", "challenges.entities.chicken.name");
|
||||
verify(user).getTranslation(any(World.class), eq("challenges.errors.you-still-need"), eq("[amount]"), eq("3"), eq("[item]"), eq("challenges.entities.ghast.name"));
|
||||
verify(user, never()).getTranslation(any(World.class), eq("challenges.errors.you-still-need"), eq("[amount]"), eq("1"), eq("[item]"), eq("challenges.entities.pufferfish.name"));
|
||||
verify(user).getTranslation(any(World.class), eq("challenges.errors.you-still-need"), eq("[amount]"), eq("5"), eq("[item]"), eq("challenges.entities.chicken.name"));
|
||||
|
||||
}
|
||||
|
||||
@ -583,7 +583,7 @@ public class TryToCompleteTest {
|
||||
List<Entity> list = Collections.singletonList(ent);
|
||||
when(world.getNearbyEntities(any(BoundingBox.class))).thenReturn(list);
|
||||
assertTrue(TryToComplete.complete(addon, user, challenge, world, topLabel, permissionPrefix));
|
||||
verify(user).getTranslation("challenges.messages.you-completed-challenge", "[value]", "name");
|
||||
verify(user).getTranslation(any(World.class), eq("challenges.messages.you-completed-challenge"), eq("[value]"), eq("name"));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -611,7 +611,7 @@ public class TryToCompleteTest {
|
||||
when(world.getNearbyEntities(any(BoundingBox.class))).thenReturn(list);
|
||||
when(netherWorld.getNearbyEntities(any(BoundingBox.class))).thenReturn(Collections.emptyList());
|
||||
assertFalse(TryToComplete.complete(addon, user, challenge, world, topLabel, permissionPrefix));
|
||||
verify(user).getTranslation("challenges.errors.you-still-need", "[amount]", "1", "[item]", "challenges.entities.pufferfish.name");
|
||||
verify(user).getTranslation(any(World.class), eq("challenges.errors.you-still-need"), eq("[amount]"), eq("1"), eq("[item]"), eq("challenges.entities.pufferfish.name"));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -621,7 +621,7 @@ public class TryToCompleteTest {
|
||||
public void testCompleteChallengesAddonUserChallengeWorldStringStringIntMultipleTimesPositiveSuccess() {
|
||||
// Try to complete 10 times. Already done 3 times, and max is 10, so it should be only done 7 times
|
||||
assertTrue(TryToComplete.complete(addon, user, challenge, world, topLabel, permissionPrefix, 10));
|
||||
verify(user).getTranslation("challenges.messages.you-repeated-challenge-multiple", "[value]", "name", "[count]", "7");
|
||||
verify(user).getTranslation(any(World.class), eq("challenges.messages.you-repeated-challenge-multiple"), eq("[value]"), eq("name"), eq("[count]"), eq("7"));
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user