From aef047f061918148dc720f3167a2591e3299b92c Mon Sep 17 00:00:00 2001 From: Brokkonaut Date: Tue, 24 Apr 2018 03:59:33 +0200 Subject: [PATCH 01/10] Remove reverted permission from imageonmap.* It currently causes the player to have the permission imageonmap.administrative when you give him ^imageonmap.* (to remove the default permissions), because it is inverted.. This is surely not intended. --- src/main/resources/plugin.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index 17bd4fe..93f815f 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -23,7 +23,6 @@ permissions: imageonmap.explore: true imageonmap.rename: true imageonmap.delete: true - imageonmap.administrative: false imageonmap.userender: description: "Allows you to use /tomap and related commands (/maptool getremaing). Alias of imageonmap.new." From dd4f90cca68f9a6377cf2599f1652670d8903dae Mon Sep 17 00:00:00 2001 From: Vlammar <36545324+Vlammar@users.noreply.github.com> Date: Wed, 11 Mar 2020 14:28:24 +0100 Subject: [PATCH 02/10] Update README.md --- README.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/README.md b/README.md index 314b19a..fbf17d5 100644 --- a/README.md +++ b/README.md @@ -113,6 +113,15 @@ You will find amongst the new features: - Fixed permissions support by adding a full set of permissions for every action of the plugin. +### 4.0 (Upcoming) +Compatibility with 1.15, backcompatibility dropped for a moment, (use 4.0 pre1 for now). + +You can now place a map on the ground or on a ceilling. +Fixed various bugs +Added a GUI for easy map editing (old command still working) +Added permissions: +- SizeLimit +- Admin/moderator command ## Data collection From fa8f27989bfe8a3dc556ffdc7f872866da76bff1 Mon Sep 17 00:00:00 2001 From: Vlammar <36545324+Vlammar@users.noreply.github.com> Date: Wed, 11 Mar 2020 14:41:52 +0100 Subject: [PATCH 03/10] Update README.md --- README.md | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index fbf17d5..6e537dc 100644 --- a/README.md +++ b/README.md @@ -114,15 +114,22 @@ You will find amongst the new features: - Fixed permissions support by adding a full set of permissions for every action of the plugin. ### 4.0 (Upcoming) -Compatibility with 1.15, backcompatibility dropped for a moment, (use 4.0 pre1 for now). +The 4.0 is a bit light in content but we have unified part of the plugin (splatter map) and we have make various change to zLib, next update should be bigger and will add more stuff (thumbnail, optimization, possibility to deploy and place item frame in creative, creating interactive map that can run a command if you click on a specific frame...). -You can now place a map on the ground or on a ceilling. -Fixed various bugs -Added a GUI for easy map editing (old command still working) -Added permissions: -- SizeLimit -- Admin/moderator command +Despite the changes to zLib we have a lot of things to refactor in order to keep version older than 1.15 working. + +Backcompatibility is dropped for now but in the future we will try to bring it back, (use 4.0 pre1 for now :( ). + + +The new features added to ImageOnMap for the 4.0 are: +- You can now place a map on the ground or on a ceilling. +- Fixed bug with splattermap that throw an exception +- Fixed another bug that allow to get from a vanilla map a splatter map that will have issues in rendering +- Added a GUI for easy map editing (old command still working) +- Added permissions: + - SizeLimit + - Admin/moderator command ## Data collection From f0446343490c2e3debe058ae1de02b476362e22c Mon Sep 17 00:00:00 2001 From: Vlammar <36545324+Vlammar@users.noreply.github.com> Date: Wed, 11 Mar 2020 14:43:12 +0100 Subject: [PATCH 04/10] Update README.md --- README.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/README.md b/README.md index 6e537dc..110dfbf 100644 --- a/README.md +++ b/README.md @@ -115,13 +115,9 @@ You will find amongst the new features: ### 4.0 (Upcoming) The 4.0 is a bit light in content but we have unified part of the plugin (splatter map) and we have make various change to zLib, next update should be bigger and will add more stuff (thumbnail, optimization, possibility to deploy and place item frame in creative, creating interactive map that can run a command if you click on a specific frame...). - - Despite the changes to zLib we have a lot of things to refactor in order to keep version older than 1.15 working. - Backcompatibility is dropped for now but in the future we will try to bring it back, (use 4.0 pre1 for now :( ). - The new features added to ImageOnMap for the 4.0 are: - You can now place a map on the ground or on a ceilling. - Fixed bug with splattermap that throw an exception From 8543df7086df75a12b086b57f42d88f34c0ed76e Mon Sep 17 00:00:00 2001 From: Vlammar <36545324+Vlammar@users.noreply.github.com> Date: Sun, 7 Jun 2020 19:28:01 +0200 Subject: [PATCH 05/10] Update README.md --- README.md | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/README.md b/README.md index 110dfbf..0627a79 100644 --- a/README.md +++ b/README.md @@ -122,10 +122,7 @@ The new features added to ImageOnMap for the 4.0 are: - You can now place a map on the ground or on a ceilling. - Fixed bug with splattermap that throw an exception - Fixed another bug that allow to get from a vanilla map a splatter map that will have issues in rendering -- Added a GUI for easy map editing (old command still working) -- Added permissions: - - SizeLimit - - Admin/moderator command +- Fixed renderer issues when putting a map other player don't see the bottom left corner ## Data collection From 207514dcaf3cc6c815d2af173d32386df1c7b862 Mon Sep 17 00:00:00 2001 From: Vlammar <36545324+Vlammar@users.noreply.github.com> Date: Sun, 7 Jun 2020 19:29:32 +0200 Subject: [PATCH 06/10] Update README.md --- README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index 0627a79..51f0612 100644 --- a/README.md +++ b/README.md @@ -121,9 +121,8 @@ Backcompatibility is dropped for now but in the future we will try to bring it b The new features added to ImageOnMap for the 4.0 are: - You can now place a map on the ground or on a ceilling. - Fixed bug with splattermap that throw an exception -- Fixed another bug that allow to get from a vanilla map a splatter map that will have issues in rendering - Fixed renderer issues when putting a map other player don't see the bottom left corner - +- Added Russian and German (thx to Danechek and to ...) ## Data collection We use metrics to collect basic information about the usage of this plugin. This can be disabled by setting `collect-data` to false in `config.yml`. From 69fcb0c24114a3212060c611af8d4f5f94b1d79a Mon Sep 17 00:00:00 2001 From: kirbykirby56 Date: Sat, 24 Mar 2018 21:44:06 -0400 Subject: [PATCH 07/10] Add save-full-image and limit-x/y --- .../imageonmap/PluginConfiguration.java | 3 +++ .../image/ImageRendererExecutor.java | 24 +++++++++++++++++-- .../fr/moribus/imageonmap/map/ImageMap.java | 8 ++++++- 3 files changed, 32 insertions(+), 3 deletions(-) diff --git a/src/main/java/fr/moribus/imageonmap/PluginConfiguration.java b/src/main/java/fr/moribus/imageonmap/PluginConfiguration.java index 3dff18e..146afd1 100644 --- a/src/main/java/fr/moribus/imageonmap/PluginConfiguration.java +++ b/src/main/java/fr/moribus/imageonmap/PluginConfiguration.java @@ -31,7 +31,10 @@ public final class PluginConfiguration extends Configuration static public ConfigurationItem LANG = item("lang", Locale.class); static public ConfigurationItem COLLECT_DATA = item("collect-data", true); + static public ConfigurationItem SAVE_FULL_IMAGE = item("save-full-image", true); static public ConfigurationItem MAP_GLOBAL_LIMIT = item("map-global-limit", 0, "Limit-map-by-server"); static public ConfigurationItem MAP_PLAYER_LIMIT = item("map-player-limit", 0, "Limit-map-by-player"); + static public ConfigurationItem LIMIT_SIZE_X = item("limit-map-size-x", 0); + static public ConfigurationItem LIMIT_SIZE_Y = item("limit-map-size-y", 0); } diff --git a/src/main/java/fr/moribus/imageonmap/image/ImageRendererExecutor.java b/src/main/java/fr/moribus/imageonmap/image/ImageRendererExecutor.java index acd6749..e153d78 100644 --- a/src/main/java/fr/moribus/imageonmap/image/ImageRendererExecutor.java +++ b/src/main/java/fr/moribus/imageonmap/image/ImageRendererExecutor.java @@ -18,6 +18,8 @@ package fr.moribus.imageonmap.image; +import fr.moribus.imageonmap.ImageOnMap; +import fr.moribus.imageonmap.PluginConfiguration; import fr.moribus.imageonmap.map.ImageMap; import fr.moribus.imageonmap.map.MapManager; import fr.zcraft.zlib.components.i18n.I; @@ -27,6 +29,7 @@ import fr.zcraft.zlib.components.worker.WorkerCallback; import fr.zcraft.zlib.components.worker.WorkerRunnable; import javax.imageio.ImageIO; +import org.bukkit.Bukkit; import java.awt.image.BufferedImage; import java.io.IOException; import java.io.InputStream; @@ -63,13 +66,25 @@ public class ImageRendererExecutor extends Worker final BufferedImage image = ImageIO.read(stream); if (image == null) throw new IOException(I.t("The given URL is not a valid image")); - + + + //Limits are in place and the player does NOT have rights to avoid them. + if((PluginConfiguration.LIMIT_SIZE_X.get() > 0 || PluginConfiguration.LIMIT_SIZE_Y.get() > 0) && !Bukkit.getPlayer(playerUUID).hasPermission("imageonmap.bypasssize")) { + if(PluginConfiguration.LIMIT_SIZE_X.get() > 0) { + if(image.getWidth() > PluginConfiguration.LIMIT_SIZE_X.get()) throw new IOException(I.t("The image is too wide!")); + } + if(PluginConfiguration.LIMIT_SIZE_Y.get() > 0) { + if(image.getHeight() > PluginConfiguration.LIMIT_SIZE_Y.get()) throw new IOException(I.t("The image is too tall!")); + } + } + if(scaling != ImageUtils.ScalingType.NONE && height <= 1 && width <= 1) { return renderSingle(scaling.resize(image, ImageMap.WIDTH, ImageMap.HEIGHT), playerUUID); } final BufferedImage resizedImage = scaling.resize(image, ImageMap.WIDTH * width, ImageMap.HEIGHT * height); return renderPoster(resizedImage, playerUUID); + //return RenderPoster(image, playerUUID); } }, callback); } @@ -123,6 +138,11 @@ public class ImageRendererExecutor extends Worker ImageIOExecutor.saveImage(mapsIDs, poster); + if(PluginConfiguration.SAVE_FULL_IMAGE.get()) { + ImageIOExecutor.saveImage(ImageMap.getFullImageFile(mapsIDs[0], mapsIDs[mapsIDs.length - 1]), image); + + } + submitToMainThread(new Callable() { @Override @@ -136,4 +156,4 @@ public class ImageRendererExecutor extends Worker return MapManager.createMap(poster, playerUUID, mapsIDs); } -} +} \ No newline at end of file diff --git a/src/main/java/fr/moribus/imageonmap/map/ImageMap.java b/src/main/java/fr/moribus/imageonmap/map/ImageMap.java index b74e587..7ca7d03 100644 --- a/src/main/java/fr/moribus/imageonmap/map/ImageMap.java +++ b/src/main/java/fr/moribus/imageonmap/map/ImageMap.java @@ -18,6 +18,7 @@ package fr.moribus.imageonmap.map; +import fr.moribus.imageonmap.ImageOnMap; import fr.moribus.imageonmap.ui.MapItemManager; import fr.zcraft.zlib.components.i18n.I; import org.bukkit.Material; @@ -26,6 +27,7 @@ import org.bukkit.configuration.serialization.ConfigurationSerializable; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; +import java.io.File; import java.util.HashMap; import java.util.Map; import java.util.UUID; @@ -47,7 +49,6 @@ public abstract class ImageMap implements ConfigurationSerializable private final UUID userUUID; private final Type mapType; private String name; - protected ImageMap(UUID userUUID, Type mapType) { this(userUUID, mapType, null, null); @@ -84,6 +85,11 @@ public abstract class ImageMap implements ConfigurationSerializable return MapItemManager.give(player, this); } + public static File getFullImageFile(short mapIDstart, short mapIDend) + { + return new File(ImageOnMap.getPlugin().getImagesDirectory(), "_"+mapIDstart+"-"+mapIDend+".png"); + } + /* ====== Serialization methods ====== */ static public ImageMap fromConfig(Map map, UUID userUUID) throws InvalidConfigurationException From c68221b0956e343be12ae2c0947861304afb2393 Mon Sep 17 00:00:00 2001 From: kirbykirby56 Date: Sat, 24 Mar 2018 21:45:22 -0400 Subject: [PATCH 08/10] Change config.yml --- src/main/resources/config.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index 5ffe7d4..ab0ed6f 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -16,3 +16,12 @@ collect-data: true # 0 means unlimited. map-global-limit: 0 map-player-limit: 0 + + +#Maximum size in pixels for an image to be. 0 is unlimited. +limit-map-size-x: 0 +limit-map-size-y: 0 + + +#Should the full image be saved when a map is rendered? +save-full-image: false \ No newline at end of file From e6a48faa8986dc02a3199642cb99452b3d612796 Mon Sep 17 00:00:00 2001 From: Vlammar <36545324+Vlammar@users.noreply.github.com> Date: Fri, 12 Jun 2020 18:24:24 +0200 Subject: [PATCH 09/10] Update config.yml --- src/main/resources/config.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index ab0ed6f..bad11b2 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -2,7 +2,7 @@ # Plugin language. Empty: system language. -# Available: en_US (default, fallback) and fr_FR. +# Available: en-US (default, fallback) and fr-FR. lang: @@ -24,4 +24,4 @@ limit-map-size-y: 0 #Should the full image be saved when a map is rendered? -save-full-image: false \ No newline at end of file +save-full-image: false From 7732f6c04663334f4160d484f1fd748723ea7359 Mon Sep 17 00:00:00 2001 From: Vlammar <36545324+Vlammar@users.noreply.github.com> Date: Fri, 12 Jun 2020 18:28:01 +0200 Subject: [PATCH 10/10] Update config.yml --- src/main/resources/config.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index bad11b2..0708f1e 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -25,3 +25,4 @@ limit-map-size-y: 0 #Should the full image be saved when a map is rendered? save-full-image: false +