mirror of
https://github.com/BentoBoxWorld/Challenges.git
synced 2024-11-14 14:45:44 +01:00
Update to 1.21.3 (#365)
This commit is contained in:
parent
52864d6329
commit
dc8942aaa4
28
pom.xml
28
pom.xml
@ -29,22 +29,29 @@
|
||||
<url>https://github.com/BentoBoxWorld/Challenges/issues</url>
|
||||
</issueManagement>
|
||||
|
||||
<distributionManagement>
|
||||
<repository>
|
||||
<id>bentoboxworld</id>
|
||||
<url>https://repo.codemc.org/repository/bentoboxworld/</url>
|
||||
</repository>
|
||||
</distributionManagement>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||
<java.version>21</java.version>
|
||||
<powermock.version>2.0.9</powermock.version>
|
||||
<!-- More visible way how to change dependency versions -->
|
||||
<spigot.version>1.21-R0.1-SNAPSHOT</spigot.version>
|
||||
<spigot.version>1.21.3-R0.1-SNAPSHOT</spigot.version>
|
||||
<spigot-annotations.version>1.2.3-SNAPSHOT</spigot-annotations.version>
|
||||
<bentobox.version>2.4.2</bentobox.version>
|
||||
<bentobox.version>2.7.1-SNAPSHOT</bentobox.version>
|
||||
<level.version>2.6.3</level.version>
|
||||
<vault.version>1.7</vault.version>
|
||||
<panelutils.version>1.2.0</panelutils.version>
|
||||
<!-- Revision variable removes warning about dynamic version -->
|
||||
<revision>${build.version}-SNAPSHOT</revision>
|
||||
<!-- This allows to change between versions and snapshots. -->
|
||||
<build.version>1.3.2</build.version>
|
||||
<build.version>1.4.0</build.version>
|
||||
<build.number>-LOCAL</build.number>
|
||||
<!-- Sonar Cloud -->
|
||||
<sonar.projectKey>BentoBoxWorld_Challenges</sonar.projectKey>
|
||||
@ -83,17 +90,6 @@
|
||||
</profile>
|
||||
</profiles>
|
||||
|
||||
<distributionManagement>
|
||||
<snapshotRepository>
|
||||
<id>codemc-snapshots</id>
|
||||
<url>https://repo.codemc.org/repository/maven-snapshots</url>
|
||||
</snapshotRepository>
|
||||
<repository>
|
||||
<id>codemc-releases</id>
|
||||
<url>https://repo.codemc.org/repository/maven-releases</url>
|
||||
</repository>
|
||||
</distributionManagement>
|
||||
|
||||
<pluginRepositories>
|
||||
<pluginRepository>
|
||||
<id>apache.snapshots</id>
|
||||
@ -108,6 +104,10 @@
|
||||
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots</url>
|
||||
</repository>
|
||||
<!-- CodeMC Repo for BentoBox -->
|
||||
<repository>
|
||||
<id>bentoboxworld</id>
|
||||
<url>https://repo.codemc.io/repository/bentoboxworld/c</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>codemc-repo</id>
|
||||
<url>https://repo.codemc.io/repository/maven-public</url>
|
||||
|
@ -1,7 +1,7 @@
|
||||
name: Challenges
|
||||
main: world.bentobox.challenges.ChallengesAddon
|
||||
version: ${version}${build.number}
|
||||
api-version: 1.17
|
||||
api-version: 2.7.1
|
||||
repository: 'BentoBoxWorld/Challenges'
|
||||
metrics: true
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
name: BentoBox-Challenges
|
||||
main: world.bentobox.challenges.ChallengesPladdon
|
||||
version: ${project.version}${build.number}
|
||||
api-version: "1.17"
|
||||
api-version: "1.21"
|
||||
|
||||
authors: [tastybento, BONNe]
|
||||
contributors: ["The BentoBoxWorld Community"]
|
||||
|
@ -1,10 +1,12 @@
|
||||
package world.bentobox.challenges.tasks;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.ArgumentMatchers.anyString;
|
||||
import static org.mockito.ArgumentMatchers.eq;
|
||||
import static org.mockito.Mockito.atLeast;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.never;
|
||||
import static org.mockito.Mockito.verify;
|
||||
@ -30,6 +32,7 @@ import org.bukkit.World.Environment;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Player.Spigot;
|
||||
import org.bukkit.inventory.ItemFactory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.PlayerInventory;
|
||||
@ -41,6 +44,7 @@ import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.ArgumentCaptor;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.Mockito;
|
||||
import org.mockito.stubbing.Answer;
|
||||
@ -49,6 +53,7 @@ import org.powermock.core.classloader.annotations.PrepareForTest;
|
||||
import org.powermock.modules.junit4.PowerMockRunner;
|
||||
import org.powermock.reflect.Whitebox;
|
||||
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
import world.bentobox.bentobox.BentoBox;
|
||||
import world.bentobox.bentobox.api.addons.AddonDescription;
|
||||
import world.bentobox.bentobox.api.addons.GameModeAddon;
|
||||
@ -119,6 +124,8 @@ public class TryToCompleteTest {
|
||||
@Mock
|
||||
private BoundingBox bb;
|
||||
private Set<Player> onlinePlayers;
|
||||
@Mock
|
||||
private Spigot spigot;
|
||||
|
||||
/**
|
||||
*/
|
||||
@ -207,6 +214,7 @@ public class TryToCompleteTest {
|
||||
when(user.getPlayer()).thenReturn(player);
|
||||
UUID uniqueId = UUID.randomUUID();
|
||||
when(player.getUniqueId()).thenReturn(uniqueId);
|
||||
when(player.spigot()).thenReturn(spigot);
|
||||
when(user.getUniqueId()).thenReturn(uniqueId);
|
||||
when(user.getTranslation(anyString()))
|
||||
.thenAnswer((Answer<String>) invocation -> invocation.getArgument(0, String.class));
|
||||
@ -702,4 +710,32 @@ public class TryToCompleteTest {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Check that spigot sent the message
|
||||
* @param message - message to check
|
||||
*/
|
||||
public void checkSpigotMessage(String expectedMessage) {
|
||||
checkSpigotMessage(expectedMessage, 1);
|
||||
}
|
||||
|
||||
public void checkSpigotMessage(String expectedMessage, int expectedOccurrences) {
|
||||
// Capture the argument passed to spigot().sendMessage(...) if messages are sent
|
||||
ArgumentCaptor<TextComponent> captor = ArgumentCaptor.forClass(TextComponent.class);
|
||||
|
||||
// Verify that sendMessage() was called at least 0 times (capture any sent messages)
|
||||
verify(spigot, atLeast(0)).sendMessage(captor.capture());
|
||||
|
||||
// Get all captured TextComponents
|
||||
List<TextComponent> capturedMessages = captor.getAllValues();
|
||||
|
||||
// Count the number of occurrences of the expectedMessage in the captured messages
|
||||
long actualOccurrences = capturedMessages.stream().map(component -> component.toLegacyText()) // Convert each TextComponent to plain text
|
||||
.filter(messageText -> messageText.contains(expectedMessage)) // Check if the message contains the expected text
|
||||
.count(); // Count how many times the expected message appears
|
||||
|
||||
// Assert that the number of occurrences matches the expectedOccurrences
|
||||
assertEquals("Expected message occurrence mismatch: " + expectedMessage, expectedOccurrences,
|
||||
actualOccurrences);
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user