@@ -45,15 +45,50 @@ Yamipa is ready-to-go right out of the box. By default, it creates the following
45
45
- ` images.dat ` : A file holding the list and properties (e.g. coordinates) of all placed images in your server. You
46
46
shouldn't modify its contents.
47
47
48
- You can change the default path of these files by creating a ` config.yml ` file in the plugin configuration directory:
48
+ You can change the path of these files by creating a ` config.yml ` file in the plugin configuration directory.
49
+ Here are the default configuration values if you don't specify them:
49
50
``` yaml
50
- verbose : false # Set to "true" to enable more verbose logging
51
- animate-images : true # Set to "false" to disable GIF support
52
- images-path : images # Path to images directory
53
- cache-path : cache # Path to cache directory
54
- data-path : images.dat # Path to placed images database file
51
+ verbose : false # Set to "true" to enable more verbose logging
52
+ animate-images : true # Set to "false" to disable GIF support
53
+ images-path : images # Path to images directory
54
+ cache-path : cache # Path to cache directory
55
+ data-path : images.dat # Path to placed images database file
56
+ allowed-paths : null # Set to a RegExp to limit accessible images to players
57
+ max-image-dimension : 30 # Maximum width or height in blocks allowed in images
55
58
` ` `
56
59
60
+ For more information on how to set a different ` allowed-paths` or `max-image-dimension` value per player, see the
61
+ [Player variables](#player-variables) section.
62
+
63
+ # ## Allowed paths
64
+ The variable `allowed-paths` is a regular expression that determines whether a player is allowed to see or download
65
+ an image file. If the desired path relative to the images directory matches this expression, then the player is allowed
66
+ to continue.
67
+
68
+ If `allowed-paths` is an empty string ("") or null, then the player can read any image file or download to any path
69
+ inside the images directory.
70
+
71
+ This regular expression must follow
72
+ [the syntax used by Java](https://docs.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html). You can test your
73
+ expression beforehand using an online tool like [regex101](https://regex101.com/).
74
+ In addition, you can make use of the following special tokens :
75
+
76
+ - ` #player#` : Player name
77
+ - ` #uuid#` : Player UUID (with hyphens)
78
+
79
+ For example, if you want every player in your server to have their own subdirectory for storing files that only they
80
+ can access, plus a shared public directory, you can use the following `allowed-paths` value :
81
+ ` ` ` regexp
82
+ ^(private/#player#|public)/
83
+ ` ` `
84
+
85
+ That way, the player "john" can see the image file at "private/john/something.jpg", but "jane" cannot.
86
+
87
+ > **IMPORTANT!**\
88
+ > Note that these restrictions **also apply to other entities** like NPCs, command blocks or the server console.
89
+ > However, special tokens will always match in non-player contexts (e.g., "#player#" will be interpreted as ".+").
90
+
91
+ # ## bStats
57
92
This library uses bStats to anonymously report the number of installs. If you don't like this, feel free to
58
93
disable it at any time by adding `enabled : false` to the
59
94
[bStats configuration file](https://bstats.org/getting-started#:~:text=Disabling%20bStats) (it's ok, no hard feelings).
@@ -75,17 +110,17 @@ This plugin adds the following commands:
75
110
- Show help\
76
111
` /image`
77
112
- Download an image from a URL and save it with another name\
78
- ` /image download "https://www.example.com/a/b/c/1234.jpg" imagename.jpg`
113
+ ` /image download "https://www.example.com/a/b/c/1234.jpg" " imagename.jpg" `
79
114
- Give 10 image items to "TestPlayer" for the "test.jpg" image (3x5 blocks)\
80
- ` /image give TestPlayer test.jpg 10 3 5`
115
+ ` /image give TestPlayer " test.jpg" 10 3 5`
81
116
- Give 10 image items to "TestPlayer" that will not drop an image item when removed\
82
- ` /image give TestPlayer test.jpg 10 3 5 -DROP`
117
+ ` /image give TestPlayer " test.jpg" 10 3 5 -DROP`
83
118
- Start the dialog to place an image with a width of 3 blocks and auto height\
84
- ` /image place imagename.jpg 3`
119
+ ` /image place " imagename.jpg" 3`
85
120
- Start the dialog to place a 3-blocks wide and 2-blocks high image\
86
- ` /image place imagename.jpg 3 2`
121
+ ` /image place " imagename.jpg" 3 2`
87
122
- Start the dialog to place an image that glows in the dark\
88
- ` /image place imagename.jpg 3 2 +GLOW`
123
+ ` /image place " imagename.jpg" 3 2 +GLOW`
89
124
- Start the dialog to remove a placed image while keeping the original file\
90
125
` /image remove`
91
126
- Remove all placed images in a radius of 5 blocks around the spawn\
@@ -123,6 +158,28 @@ You can change which roles or players are granted these commands by using a perm
123
158
such as [LuckPerms](https://luckperms.net/) or [GroupManager](https://elgarl.github.io/GroupManager/).
124
159
Both these plugins have been tested to work with Yamipa, although any similar one should work just fine.
125
160
161
+ # # Player variables
162
+ Some permission plugins like LuckPerms allow server operators to assign
163
+ [key-value pairs](https://luckperms.net/wiki/Meta-Commands) to entities as if they were permissions.
164
+ This is useful for granting different capabilities to different players or groups.
165
+
166
+ Yamipa looks for the following variables which, if found, override the default configuration value that applies to all
167
+ players :
168
+
169
+ | Variable (key) | Overrides | Description |
170
+ |:-----------------------------|:----------------------|:----------------------------------------------------------------------------------|
171
+ | `yamipa-allowed-paths` | `allowed-paths` | Regular expression that limits which paths in the images directory are accessible |
172
+ | `yamipa-max-image-dimension` | `max-image-dimension` | Maximum width or height of images and image items issued by this player or group |
173
+
174
+ For example, if you want to limit the image size to 5x5 blocks just for the "test" player, you can run this command :
175
+ ` ` ` sh
176
+ # Using LuckPerms
177
+ /lp user test meta set yamipa-max-image-dimension 5
178
+
179
+ # Using GroupManager
180
+ /manuaddv test yamipa-max-image-dimension 5
181
+ ` ` `
182
+
126
183
# # Protecting areas
127
184
In large servers, letting your players place and remove images wherever they want might not be the most sensible idea.
128
185
For those cases, Yamipa is compatible with other Bukkit plugins that allow creating and managing world areas.
0 commit comments