Skip to content

Commit

Permalink
fix: AuthMe Authentication
Browse files Browse the repository at this point in the history
If a user hasn't logged in but hovered over a slot that previously had an ItemJoin item, the Item Commands could be triggered.

AuthMe does not remove items from the player inventory, they simply are made invisible (ghosts).
  • Loading branch information
RockinChaos committed Jul 30, 2024
1 parent 56c5bfa commit 1aa8e6e
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 18 deletions.
13 changes: 0 additions & 13 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
<chaoscore.version>1.0.8-SNAPSHOT</chaoscore.version>
<spigot.version>1.21-R0.1-SNAPSHOT</spigot.version>

<authme.version>5.6.0-SNAPSHOT</authme.version>
<authlib.version>1.5.21</authlib.version>
<worldguard.version>7.0.4-SNAPSHOT</worldguard.version>

Expand Down Expand Up @@ -117,11 +116,6 @@
<id>mojang</id>
<url>https://libraries.minecraft.net/</url>
</repository>
<!--AuthMe Repository-->
<repository>
<id>CodeMC</id>
<url>https://repo.codemc.org/repository/maven-public</url>
</repository>
<!--TokenEnchant Repository-->
<repository>
<id>teamvk-repo</id>
Expand Down Expand Up @@ -164,13 +158,6 @@
<version>${spigot.version}</version>
<scope>provided</scope>
</dependency>
<!--AuthMe API-->
<dependency>
<groupId>fr.xephi</groupId>
<artifactId>authme</artifactId>
<version>${authme.version}</version>
<scope>provided</scope>
</dependency>
<!--Vault API-->
<dependency>
<groupId>net.milkbowl.vault</groupId>
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/me/RockinChaos/itemjoin/item/ItemMap.java
Original file line number Diff line number Diff line change
Expand Up @@ -5044,7 +5044,7 @@ public void setAnimations(final Player player) {
* @param slot - The Slot of the ItemStack.
*/
public void executeCommands(final Player player, final Player altPlayer, final ItemStack itemCopy, final String action, final String clickType, final String slot) {
if (this.commands != null && this.commands.length > 0 && !Menu.isOpen(player) && !this.getWarmPending(player) && this.isExecutable(player, action, clickType) && !this.onCooldown(player) && this.isPlayerChargeable(player, this.itemCost != null && !this.itemCost.isEmpty())) {
if (this.commands != null && this.commands.length > 0 && ItemJoin.getCore().getDependencies().isAuthenticated(player) && !Menu.isOpen(player) && !this.getWarmPending(player) && this.isExecutable(player, action, clickType) && !this.onCooldown(player) && this.isPlayerChargeable(player, this.itemCost != null && !this.itemCost.isEmpty())) {
this.warmCycle(player, altPlayer, this, this.getWarmDelay(), player.getLocation(), itemCopy, action, clickType, slot);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,10 +209,7 @@ public void setAuthenticating(final Player player, final World world, TriggerTyp
@Override
public void run() {
try {
final fr.xephi.authme.api.v3.AuthMeApi authMe = fr.xephi.authme.api.v3.AuthMeApi.getInstance();
if (fr.xephi.authme.api.v3.AuthMeApi.getInstance().isAuthenticated(player)
|| (authMe.getPlugin().getConfig().getString("settings.registration.force") != null
&& !authMe.getPlugin().getConfig().getBoolean("settings.registration.force"))) {
if (ItemJoin.getCore().getDependencies().isAuthenticated(player)) {
setItems(player, world, type, newMode, targetRegion, regions);
this.cancel();
} else if (!player.isOnline()) {
Expand Down

0 comments on commit 1aa8e6e

Please sign in to comment.