Merge pull request #109 from Pugabyte/indev

Add permission to remove splattermap off wall, closes #53
This commit is contained in:
Vlammar 2020-07-03 23:44:59 +02:00 committed by GitHub
commit 7cae09ec6f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 20 additions and 10 deletions

View File

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

View File

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

View File

@ -23,15 +23,16 @@ permissions:
imageonmap.get: true imageonmap.get: true
imageonmap.explore: true imageonmap.explore: true
imageonmap.rename: true imageonmap.rename: true
imageonmap.removesplattermap: true
imageonmap.delete: true imageonmap.delete: true
imageonmap.bypasssize: false imageonmap.bypasssize: false
imageonmap.userender: 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 default: true
imageonmap.new: 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 default: true
imageonmap.list: imageonmap.list:
@ -39,7 +40,7 @@ permissions:
default: true default: true
imageonmap.get: 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 default: true
imageonmap.explore: imageonmap.explore:
@ -54,6 +55,10 @@ permissions:
description: "Allows you to delete a map you rendered in the past." description: "Allows you to delete a map you rendered in the past."
default: true 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: imageonmap.administrative:
description: "Allows you to perform administrative tasks (like /maptool migrate)." description: "Allows you to perform administrative tasks (like /maptool migrate)."
default: op default: op