Skip to content

Commit

Permalink
Update to 1.21.3 (#365)
Browse files Browse the repository at this point in the history
  • Loading branch information
tastybento authored Nov 9, 2024
1 parent 52864d6 commit dc8942a
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 16 deletions.
28 changes: 14 additions & 14 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,23 +28,30 @@
<system>GitHub</system>
<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>
Expand Down Expand Up @@ -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>
Expand All @@ -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>
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/addon.yml
Original file line number Diff line number Diff line change
@@ -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

Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
@@ -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"]
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -30,6 +32,7 @@
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;
Expand All @@ -41,6 +44,7 @@
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;
Expand All @@ -49,6 +53,7 @@
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;
Expand Down Expand Up @@ -119,6 +124,8 @@ public class TryToCompleteTest {
@Mock
private BoundingBox bb;
private Set<Player> onlinePlayers;
@Mock
private Spigot spigot;

/**
*/
Expand Down Expand Up @@ -207,6 +214,7 @@ public void setUp() {
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));
Expand Down Expand Up @@ -702,4 +710,32 @@ public void testRemoveItemsNothing() {

}

/**
* 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);
}

}

0 comments on commit dc8942a

Please sign in to comment.