Merge pull request #14 from Altitude-Devs/ClaimExpirationEvent
Add back shop expiration when claims expire
This commit is contained in:
commit
455b5ebb8d
|
|
@ -104,7 +104,7 @@ bukkit {
|
||||||
version = "${rootProject.version}-${gitCommit()}"
|
version = "${rootProject.version}-${gitCommit()}"
|
||||||
apiVersion = "1.19"
|
apiVersion = "1.19"
|
||||||
authors = listOf("destro174")
|
authors = listOf("destro174")
|
||||||
depend = listOf("Vault")
|
depend = listOf("Vault", "GriefPrevention")
|
||||||
|
|
||||||
permissions {
|
permissions {
|
||||||
register("playershops.admin") {
|
register("playershops.admin") {
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ import com.alttd.playershops.handler.ShopHandler;
|
||||||
import com.alttd.playershops.shop.PlayerShop;
|
import com.alttd.playershops.shop.PlayerShop;
|
||||||
import com.alttd.playershops.utils.EconomyUtils;
|
import com.alttd.playershops.utils.EconomyUtils;
|
||||||
import com.destroystokyo.paper.MaterialSetTag;
|
import com.destroystokyo.paper.MaterialSetTag;
|
||||||
|
import me.ryanhamshire.GriefPrevention.events.ClaimExpirationEvent;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.Tag;
|
import org.bukkit.Tag;
|
||||||
|
|
@ -34,6 +35,8 @@ import org.bukkit.inventory.InventoryHolder;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Dedicated class to listen to events related to shops.
|
* Dedicated class to listen to events related to shops.
|
||||||
|
|
@ -239,4 +242,21 @@ public class ShopListener extends EventListener {
|
||||||
if (material == Material.INK_SAC || material == Material.GLOW_INK_SAC || material.name().endsWith("_DYE")) // TODO create a cache for these?
|
if (material == Material.INK_SAC || material == Material.GLOW_INK_SAC || material.name().endsWith("_DYE")) // TODO create a cache for these?
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler(priority = EventPriority.HIGHEST)
|
||||||
|
public void onClaimExpiration(ClaimExpirationEvent event) {
|
||||||
|
if(!this.isRegistered)
|
||||||
|
return;
|
||||||
|
|
||||||
|
UUID uuid = event.getClaim().ownerID;
|
||||||
|
if(uuid == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
List<PlayerShop> playerShops = shopHandler.getShops(uuid);
|
||||||
|
for(PlayerShop shop : playerShops) {
|
||||||
|
shop.expireSign();
|
||||||
|
shopHandler.removeShop(shop);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -160,6 +160,10 @@ public class PlayerShop {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void expireSign() {
|
||||||
|
setSignLines(type.getShopTypeConfig().expiredSignLines);
|
||||||
|
}
|
||||||
|
|
||||||
public void removeSignLines() {
|
public void removeSignLines() {
|
||||||
setSignLines(type.getShopTypeConfig().activeSignLines);
|
setSignLines(type.getShopTypeConfig().activeSignLines);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user