Add permission to remove splattermap off wall

This commit is contained in:
Pugabyte 2020-07-03 16:20:58 -04:00
parent 3753a03ef3
commit 13881f751e
3 changed files with 20 additions and 10 deletions

View File

@ -44,6 +44,7 @@ public enum Permissions
LIST("imageonmap.list"),
GET("imageonmap.get"),
RENAME("imageonmap.rename"),
REMOVE_SPLATTER_MAP("imageonmap.removesplattermap"),
DELETE("imageonmap.delete"),
ADMINISTRATIVE("imageonmap.administrative"),
BYPASS_SIZE("imageonmap.bypasssize")

View File

@ -36,6 +36,7 @@
package fr.moribus.imageonmap.ui;
import fr.moribus.imageonmap.Permissions;
import fr.moribus.imageonmap.map.ImageMap;
import fr.moribus.imageonmap.map.MapManager;
import fr.moribus.imageonmap.map.PosterMap;
@ -285,17 +286,20 @@ public class MapItemManager implements Listener
ItemStack item = frame.getItem();
if (frame.getItem().getType() != Material.FILLED_MAP) return;
if (player.isSneaking())
if (Permissions.REMOVE_SPLATTER_MAP.grantedTo(player))
{
PosterMap poster = SplatterMapManager.removeSplatterMap(frame,player);
if (poster != null)
if (player.isSneaking())
{
event.setCancelled(true);
PosterMap poster = SplatterMapManager.removeSplatterMap(frame,player);
if (poster != null)
{
event.setCancelled(true);
if (player.getGameMode() != GameMode.CREATIVE || !SplatterMapManager.hasSplatterMap(player, poster))
poster.give(player);
if (player.getGameMode() != GameMode.CREATIVE || !SplatterMapManager.hasSplatterMap(player, poster))
poster.give(player);
return;
return;
}
}
}

View File

@ -23,15 +23,16 @@ permissions:
imageonmap.get: true
imageonmap.explore: true
imageonmap.rename: true
imageonmap.removesplattermap: true
imageonmap.delete: true
imageonmap.bypasssize: false
imageonmap.userender:
description: "Allows you to use /tomap and related commands (/maptool getremaing). Alias of imageonmap.new."
description: "Allows you to use /tomap and related commands (/maptool getremaining). Alias of imageonmap.new."
default: true
imageonmap.new:
description: "Allows you to use /tomap and related commands (/maptool getremaing)."
description: "Allows you to use /tomap and related commands (/maptool getremaining)."
default: true
imageonmap.list:
@ -39,7 +40,7 @@ permissions:
default: true
imageonmap.get:
description: "Allows you to get a new map among the ones you already rendered, and related commands (/maptool getremaing)."
description: "Allows you to get a new map among the ones you already rendered, and related commands (/maptool getremaining)."
default: true
imageonmap.explore:
@ -54,6 +55,10 @@ permissions:
description: "Allows you to delete a map you rendered in the past."
default: true
imageonmap.removesplattermap:
description: "Allows you to remove a splatter map from a wall by sneaking and breaking a map."
default: true
imageonmap.administrative:
description: "Allows you to perform administrative tasks (like /maptool migrate)."
default: op