mirror of
https://github.com/StarWishsama/Slimefun4.git
synced 2024-09-19 19:25:48 +00:00
Fixes #2418
This commit is contained in:
parent
8de60dbe1d
commit
503dbc8367
@ -59,6 +59,7 @@
|
||||
* Fixed Magician Talisman sometimes drawing invalid enchantments
|
||||
* Fixed id conflicts for external Enchantment sources (e.g. plugins) for the Magician Talisman settings
|
||||
* Fixed network visualizers spawning particles for other player heads
|
||||
* Fixed #2418
|
||||
|
||||
## Release Candidate 17 (17 Oct 2020)
|
||||
|
||||
|
@ -117,7 +117,7 @@ public abstract class MultiBlockMachine extends SlimefunItem implements NotPlace
|
||||
protected MultiBlockInteractionHandler getInteractionHandler() {
|
||||
return (p, mb, b) -> {
|
||||
if (mb.equals(getMultiBlock())) {
|
||||
if (!isDisabled() && SlimefunPlugin.getProtectionManager().hasPermission(p, b.getLocation(), ProtectableAction.ACCESS_INVENTORIES) && Slimefun.hasUnlocked(p, this, true)) {
|
||||
if (!isDisabled() && SlimefunPlugin.getProtectionManager().hasPermission(p, b.getLocation(), ProtectableAction.INTERACT_BLOCK) && Slimefun.hasUnlocked(p, this, true)) {
|
||||
onInteract(p, b);
|
||||
}
|
||||
|
||||
|
@ -11,7 +11,14 @@ import io.github.thebusybiscuit.slimefun4.api.player.PlayerProfile;
|
||||
import io.github.thebusybiscuit.slimefun4.core.categories.FlexCategory;
|
||||
import io.github.thebusybiscuit.slimefun4.core.guide.SlimefunGuideLayout;
|
||||
import me.mrCookieSlime.EmeraldEnchants.EnchantmentGuide;
|
||||
import me.mrCookieSlime.Slimefun.Objects.Category;
|
||||
|
||||
/**
|
||||
* This is the EmeraldEnchants {@link Category}
|
||||
*
|
||||
* @deprecated Support for EmeraldEnchants is being faded out
|
||||
*
|
||||
*/
|
||||
@Deprecated
|
||||
class EmeraldEnchantsCategory extends FlexCategory {
|
||||
|
||||
|
@ -52,7 +52,7 @@ public class StomperBoots extends SlimefunItem {
|
||||
n.setVelocity(velocity);
|
||||
|
||||
// Check if it's not a Player or if PvP is enabled
|
||||
if (!(n instanceof Player) || (p.getWorld().getPVP() && SlimefunPlugin.getProtectionManager().hasPermission(p, n.getLocation(), ProtectableAction.PVP))) {
|
||||
if (!(n instanceof Player) || (p.getWorld().getPVP() && SlimefunPlugin.getProtectionManager().hasPermission(p, n.getLocation(), ProtectableAction.ATTACK_PLAYER))) {
|
||||
EntityDamageByEntityEvent event = new EntityDamageByEntityEvent(p, n, DamageCause.ENTITY_ATTACK, fallDamageEvent.getDamage() / 2);
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
|
||||
|
@ -83,7 +83,7 @@ public class Composter extends SimpleSlimefunItem<BlockUseHandler> implements Re
|
||||
Player p = e.getPlayer();
|
||||
Block b = block.get();
|
||||
|
||||
if (p.hasPermission("slimefun.inventory.bypass") || SlimefunPlugin.getProtectionManager().hasPermission(p, b.getLocation(), ProtectableAction.ACCESS_INVENTORIES)) {
|
||||
if (p.hasPermission("slimefun.inventory.bypass") || SlimefunPlugin.getProtectionManager().hasPermission(p, b.getLocation(), ProtectableAction.INTERACT_BLOCK)) {
|
||||
ItemStack input = e.getItem();
|
||||
ItemStack output = getOutput(p, input);
|
||||
|
||||
|
@ -95,7 +95,7 @@ public class Crucible extends SimpleSlimefunItem<BlockUseHandler> implements Rec
|
||||
Player p = e.getPlayer();
|
||||
Block b = optional.get();
|
||||
|
||||
if (p.hasPermission("slimefun.inventory.bypass") || SlimefunPlugin.getProtectionManager().hasPermission(p, b.getLocation(), ProtectableAction.ACCESS_INVENTORIES)) {
|
||||
if (p.hasPermission("slimefun.inventory.bypass") || SlimefunPlugin.getProtectionManager().hasPermission(p, b.getLocation(), ProtectableAction.INTERACT_BLOCK)) {
|
||||
ItemStack input = e.getItem();
|
||||
Block block = b.getRelative(BlockFace.UP);
|
||||
|
||||
|
@ -65,7 +65,7 @@ abstract class AbstractCargoNode extends SlimefunItem {
|
||||
|
||||
@Override
|
||||
public boolean canOpen(Block b, Player p) {
|
||||
return p.hasPermission("slimefun.cargo.bypass") || SlimefunPlugin.getProtectionManager().hasPermission(p, b.getLocation(), ProtectableAction.ACCESS_INVENTORIES);
|
||||
return p.hasPermission("slimefun.cargo.bypass") || SlimefunPlugin.getProtectionManager().hasPermission(p, b.getLocation(), ProtectableAction.INTERACT_BLOCK);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -46,7 +46,7 @@ public class ReactorAccessPort extends SlimefunItem {
|
||||
|
||||
@Override
|
||||
public boolean canOpen(Block b, Player p) {
|
||||
return p.hasPermission("slimefun.inventory.bypass") || SlimefunPlugin.getProtectionManager().hasPermission(p, b.getLocation(), ProtectableAction.ACCESS_INVENTORIES);
|
||||
return p.hasPermission("slimefun.inventory.bypass") || SlimefunPlugin.getProtectionManager().hasPermission(p, b.getLocation(), ProtectableAction.INTERACT_BLOCK);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -80,7 +80,7 @@ public abstract class AbstractEntityAssembler<T extends Entity> extends SimpleSl
|
||||
|
||||
@Override
|
||||
public boolean canOpen(Block b, Player p) {
|
||||
return p.hasPermission("slimefun.inventory.bypass") || SlimefunPlugin.getProtectionManager().hasPermission(p, b.getLocation(), ProtectableAction.ACCESS_INVENTORIES);
|
||||
return p.hasPermission("slimefun.inventory.bypass") || SlimefunPlugin.getProtectionManager().hasPermission(p, b.getLocation(), ProtectableAction.INTERACT_BLOCK);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -86,7 +86,7 @@ public abstract class AutomatedCraftingChamber extends SlimefunItem implements I
|
||||
|
||||
@Override
|
||||
public boolean canOpen(Block b, Player p) {
|
||||
return p.hasPermission("slimefun.inventory.bypass") || SlimefunPlugin.getProtectionManager().hasPermission(p, b.getLocation(), ProtectableAction.ACCESS_INVENTORIES);
|
||||
return p.hasPermission("slimefun.inventory.bypass") || SlimefunPlugin.getProtectionManager().hasPermission(p, b.getLocation(), ProtectableAction.INTERACT_BLOCK);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -53,7 +53,7 @@ public class ElectricSmeltery extends AContainer {
|
||||
|
||||
@Override
|
||||
public boolean canOpen(Block b, Player p) {
|
||||
return p.hasPermission("slimefun.inventory.bypass") || SlimefunPlugin.getProtectionManager().hasPermission(p, b.getLocation(), ProtectableAction.ACCESS_INVENTORIES);
|
||||
return p.hasPermission("slimefun.inventory.bypass") || SlimefunPlugin.getProtectionManager().hasPermission(p, b.getLocation(), ProtectableAction.INTERACT_BLOCK);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -37,7 +37,7 @@ public class HeatedPressureChamber extends AContainer {
|
||||
|
||||
@Override
|
||||
public boolean canOpen(Block b, Player p) {
|
||||
return p.hasPermission("slimefun.inventory.bypass") || SlimefunPlugin.getProtectionManager().hasPermission(p, b.getLocation(), ProtectableAction.ACCESS_INVENTORIES);
|
||||
return p.hasPermission("slimefun.inventory.bypass") || SlimefunPlugin.getProtectionManager().hasPermission(p, b.getLocation(), ProtectableAction.INTERACT_BLOCK);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -98,7 +98,7 @@ public abstract class Reactor extends AbstractEnergyProvider {
|
||||
|
||||
@Override
|
||||
public boolean canOpen(Block b, Player p) {
|
||||
return p.hasPermission("slimefun.inventory.bypass") || SlimefunPlugin.getProtectionManager().hasPermission(p, b.getLocation(), ProtectableAction.ACCESS_INVENTORIES);
|
||||
return p.hasPermission("slimefun.inventory.bypass") || SlimefunPlugin.getProtectionManager().hasPermission(p, b.getLocation(), ProtectableAction.INTERACT_BLOCK);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -45,6 +45,6 @@ public class GEOScanner extends SimpleSlimefunItem<BlockUseHandler> {
|
||||
|
||||
@ParametersAreNonnullByDefault
|
||||
private boolean hasAccess(Player p, Location l) {
|
||||
return p.hasPermission("slimefun.gps.bypass") || (SlimefunPlugin.getProtectionManager().hasPermission(p, l, ProtectableAction.ACCESS_INVENTORIES));
|
||||
return p.hasPermission("slimefun.gps.bypass") || (SlimefunPlugin.getProtectionManager().hasPermission(p, l, ProtectableAction.INTERACT_BLOCK));
|
||||
}
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ public class OilPump extends AContainer implements RecipeDisplayItem {
|
||||
|
||||
@Override
|
||||
public boolean canOpen(Block b, Player p) {
|
||||
if (!(p.hasPermission("slimefun.inventory.bypass") || SlimefunPlugin.getProtectionManager().hasPermission(p, b.getLocation(), ProtectableAction.ACCESS_INVENTORIES))) {
|
||||
if (!(p.hasPermission("slimefun.inventory.bypass") || SlimefunPlugin.getProtectionManager().hasPermission(p, b.getLocation(), ProtectableAction.INTERACT_BLOCK))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -43,6 +43,6 @@ public class GPSControlPanel extends SimpleSlimefunItem<BlockUseHandler> {
|
||||
|
||||
@ParametersAreNonnullByDefault
|
||||
private boolean hasAccess(Player p, Location l) {
|
||||
return p.hasPermission("slimefun.gps.bypass") || (SlimefunPlugin.getProtectionManager().hasPermission(p, l, ProtectableAction.ACCESS_INVENTORIES));
|
||||
return p.hasPermission("slimefun.gps.bypass") || (SlimefunPlugin.getProtectionManager().hasPermission(p, l, ProtectableAction.INTERACT_BLOCK));
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package io.github.thebusybiscuit.slimefun4.implementation.items.magical;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
@ -14,6 +15,7 @@ import org.bukkit.entity.ZombieVillager;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import io.github.thebusybiscuit.cscorelib2.inventory.ItemUtils;
|
||||
import io.github.thebusybiscuit.cscorelib2.protection.ProtectableAction;
|
||||
import io.github.thebusybiscuit.slimefun4.api.MinecraftVersion;
|
||||
import io.github.thebusybiscuit.slimefun4.api.events.PlayerRightClickEvent;
|
||||
import io.github.thebusybiscuit.slimefun4.core.attributes.NotPlaceable;
|
||||
@ -40,6 +42,7 @@ import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
|
||||
*/
|
||||
public class MagicalZombiePills extends SimpleSlimefunItem<EntityInteractHandler> implements NotPlaceable {
|
||||
|
||||
@ParametersAreNonnullByDefault
|
||||
public MagicalZombiePills(Category category, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe, ItemStack recipeOutput) {
|
||||
super(category, item, recipeType, recipe, recipeOutput);
|
||||
|
||||
@ -50,6 +53,12 @@ public class MagicalZombiePills extends SimpleSlimefunItem<EntityInteractHandler
|
||||
public EntityInteractHandler getItemHandler() {
|
||||
return (e, item, offhand) -> {
|
||||
Entity entity = e.getRightClicked();
|
||||
|
||||
if (e.isCancelled() || !SlimefunPlugin.getProtectionManager().hasPermission(e.getPlayer(), entity.getLocation(), ProtectableAction.INTERACT_ENTITY)) {
|
||||
// They don't have permission to use it in this area
|
||||
return;
|
||||
}
|
||||
|
||||
Player p = e.getPlayer();
|
||||
|
||||
if (entity instanceof ZombieVillager) {
|
||||
|
@ -72,7 +72,7 @@ public class StormStaff extends SimpleSlimefunItem<ItemUseHandler> {
|
||||
Location loc = p.getTargetBlock(null, 30).getLocation();
|
||||
|
||||
if (loc.getWorld() != null && loc.getChunk().isLoaded()) {
|
||||
if (loc.getWorld().getPVP() && SlimefunPlugin.getProtectionManager().hasPermission(p, loc, ProtectableAction.PVP)) {
|
||||
if (loc.getWorld().getPVP() && SlimefunPlugin.getProtectionManager().hasPermission(p, loc, ProtectableAction.ATTACK_PLAYER)) {
|
||||
e.cancel();
|
||||
useItem(p, item, loc);
|
||||
} else {
|
||||
|
@ -10,7 +10,9 @@ import org.bukkit.entity.Villager.Profession;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import io.github.thebusybiscuit.cscorelib2.inventory.ItemUtils;
|
||||
import io.github.thebusybiscuit.cscorelib2.protection.ProtectableAction;
|
||||
import io.github.thebusybiscuit.slimefun4.core.handlers.EntityInteractHandler;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.items.SimpleSlimefunItem;
|
||||
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
|
||||
import me.mrCookieSlime.Slimefun.Objects.Category;
|
||||
@ -33,6 +35,11 @@ public class VillagerRune extends SimpleSlimefunItem<EntityInteractHandler> {
|
||||
@Override
|
||||
public EntityInteractHandler getItemHandler() {
|
||||
return (e, item, offhand) -> {
|
||||
if (e.isCancelled() || !SlimefunPlugin.getProtectionManager().hasPermission(e.getPlayer(), e.getRightClicked().getLocation(), ProtectableAction.INTERACT_ENTITY)) {
|
||||
// They don't have permission to use it in this area
|
||||
return;
|
||||
}
|
||||
|
||||
if (e.getRightClicked() instanceof Villager) {
|
||||
Villager v = (Villager) e.getRightClicked();
|
||||
|
||||
|
@ -128,7 +128,7 @@ public class AncientAltarListener implements Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!SlimefunPlugin.getProtectionManager().hasPermission(p, pedestal, ProtectableAction.ACCESS_INVENTORIES)) {
|
||||
if (!SlimefunPlugin.getProtectionManager().hasPermission(p, pedestal, ProtectableAction.INTERACT_BLOCK)) {
|
||||
SlimefunPlugin.getLocalization().sendMessage(p, "inventory.no-access", true);
|
||||
return;
|
||||
}
|
||||
@ -162,7 +162,7 @@ public class AncientAltarListener implements Listener {
|
||||
}
|
||||
|
||||
private void useAltar(@Nonnull Block altar, @Nonnull Player p) {
|
||||
if (!SlimefunPlugin.getProtectionManager().hasPermission(p, altar, ProtectableAction.ACCESS_INVENTORIES)) {
|
||||
if (!SlimefunPlugin.getProtectionManager().hasPermission(p, altar, ProtectableAction.INTERACT_BLOCK)) {
|
||||
SlimefunPlugin.getLocalization().sendMessage(p, "inventory.no-access", true);
|
||||
return;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user