Makes sure signs are no longer tracked if they no longer exist
This commit is contained in:
parent
797020aa7f
commit
483ffaec2b
@ -5,6 +5,7 @@ import net.knarcraft.paidsigns.container.TrackedSign;
|
|||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.OfflinePlayer;
|
import org.bukkit.OfflinePlayer;
|
||||||
|
import org.bukkit.block.Sign;
|
||||||
import org.bukkit.configuration.ConfigurationSection;
|
import org.bukkit.configuration.ConfigurationSection;
|
||||||
import org.bukkit.configuration.InvalidConfigurationException;
|
import org.bukkit.configuration.InvalidConfigurationException;
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
@ -107,6 +108,13 @@ public final class TrackedSignManager {
|
|||||||
throw new InvalidConfigurationException("Invalid sign coordinates");
|
throw new InvalidConfigurationException("Invalid sign coordinates");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Prevent destroyed signs from being tracked indefinitely
|
||||||
|
if (!(signLocation.getBlock().getState() instanceof Sign)) {
|
||||||
|
PaidSigns.getInstance().getLogger().log(Level.WARNING, "The sign at " + signLocation + " no longer " +
|
||||||
|
"exists. Removing from sign tracker.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
double cost = signSection.getDouble(key + ".cost");
|
double cost = signSection.getDouble(key + ".cost");
|
||||||
UUID playerId = UUID.fromString(Objects.requireNonNull(signSection.getString(key + ".playerId")));
|
UUID playerId = UUID.fromString(Objects.requireNonNull(signSection.getString(key + ".playerId")));
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user