Skip to content

Commit

Permalink
fix: #108 (item payments not parsing)
Browse files Browse the repository at this point in the history
  • Loading branch information
Thatsmusic99 committed Jul 15, 2023
1 parent 8fb232f commit e95d867
Showing 1 changed file with 8 additions and 0 deletions.
Expand Up @@ -6,6 +6,7 @@
import io.github.niestrat99.advancedteleport.payments.types.LevelsPayment;
import io.github.niestrat99.advancedteleport.payments.types.PointsPayment;
import io.github.niestrat99.advancedteleport.payments.types.VaultPayment;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.entity.Player;

Expand Down Expand Up @@ -78,6 +79,13 @@ private Payment parsePayment(String rawPayment) {
if (matcher.matches()) {
String plugin = matcher.group(1);
double payment = Double.parseDouble(matcher.group(2));

// If it's not a plugin and actually an item, lmao
if (plugin != null && Material.getMaterial(plugin) != null) {
return ItemsPayment.getFromString(rawPayment);
}

// Otherwise, resort to that
return new VaultPayment(
payment,
plugin == null ? null : plugin.substring(0, plugin.length() - 1)
Expand Down

0 comments on commit e95d867

Please sign in to comment.