1
mirror of https://github.com/StarWishsama/Slimefun4.git synced 2024-09-20 19:55:48 +00:00

Add check for ProtectionManagers

This commit is contained in:
svr333 2020-10-08 22:34:18 +02:00
parent 9dcf895258
commit b042fbd3a4
2 changed files with 10 additions and 4 deletions

View File

@ -3,6 +3,8 @@ package io.github.thebusybiscuit.slimefun4.implementation.items.magical.talisman
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import io.github.thebusybiscuit.cscorelib2.data.PersistentJsonDataType;
import io.github.thebusybiscuit.cscorelib2.protection.ProtectableAction;
import org.bukkit.potion.PotionEffectType;
import io.github.thebusybiscuit.slimefun4.core.handlers.ItemUseHandler;
import org.bukkit.persistence.PersistentDataContainer;
@ -46,11 +48,14 @@ public class ResurrectedTalisman extends Talisman {
JsonObject json = createJsonFromLocation(currentLoc);
ItemMeta itemMeta = e.getItem().getItemMeta();
itemMeta.getPersistentDataContainer().set(locationKey, PersistentJsonDataType.JSON_OBJECT, json);
if (SlimefunPlugin.getProtectionManager().hasPermission(e.getPlayer(), currentLoc, ProtectableAction.PLACE_BLOCK)) {
itemMeta.getPersistentDataContainer().set(locationKey, PersistentJsonDataType.JSON_OBJECT, json);
e.getItem().setItemMeta(itemMeta);
SlimefunPlugin.getLocalization().sendMessage(e.getPlayer(), "messages.talisman.resurrected-location", true);
}
e.getItem().setItemMeta(itemMeta);
SlimefunPlugin.getLocalization().sendMessage(e.getPlayer(), "messages.talisman.resurrected-location", true);
SlimefunPlugin.getLocalization().sendMessage(e.getPlayer(), "messages.talisman.resurrected-location-failed", true);
};
}

View File

@ -155,6 +155,7 @@ messages:
wise: '&a&oYour Talisman doubled your experience drops'
resurrected: '&a&oYour Talisman a-voided your death, but sacrificed itself in the process'
resurrected-location: 'Successfully saved your current location. You will teleport here when you fall into the void.'
resurrected-location-failed: 'Failed to set location here, you dont have enough permissions.'
soulbound-rune:
fail: '&cYou can only bind one item to your soul at a time.'