mirror of
https://github.com/zDevelopers/ImageOnMap.git
synced 2024-11-13 05:44:04 +01:00
Merge branch 'indev' into 4.0_dev
This commit is contained in:
commit
326e90d33f
10
README.md
10
README.md
@ -113,8 +113,16 @@ 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)
|
||||
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
|
||||
- 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`.
|
||||
|
@ -31,10 +31,18 @@ public final class PluginConfiguration extends Configuration
|
||||
static public ConfigurationItem<Locale> LANG = item("lang", Locale.class);
|
||||
|
||||
static public ConfigurationItem<Boolean> COLLECT_DATA = item("collect-data", true);
|
||||
|
||||
static public ConfigurationItem<Boolean> CHECK_FOR_UPDATES = item("check-for-updates", true);
|
||||
|
||||
static public ConfigurationItem<Integer> MAP_GLOBAL_LIMIT = item("map-global-limit", 0, "Limit-map-by-server");
|
||||
static public ConfigurationItem<Integer> MAP_PLAYER_LIMIT = item("map-player-limit", 0, "Limit-map-by-player");
|
||||
|
||||
static public ConfigurationItem<Integer> MAP_SIZE_NOTOP_LIMIT = item("map-size-notop-limit", 0, "Size-limit-map-notop");
|
||||
|
||||
static public ConfigurationItem<Boolean> SAVE_FULL_IMAGE = item("save-full-image", true);
|
||||
|
||||
|
||||
static public ConfigurationItem<Integer> LIMIT_SIZE_X = item("limit-map-size-x", 0);
|
||||
static public ConfigurationItem<Integer> LIMIT_SIZE_Y = item("limit-map-size-y", 0);
|
||||
|
||||
}
|
||||
|
@ -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;
|
||||
@ -62,13 +65,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);
|
||||
}
|
||||
@ -122,6 +137,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<Void>()
|
||||
{
|
||||
@Override
|
||||
@ -135,4 +155,4 @@ public class ImageRendererExecutor extends Worker
|
||||
|
||||
return MapManager.createMap(poster, playerUUID, mapsIDs);
|
||||
}
|
||||
}
|
||||
}
|
@ -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<String, Object> map, UUID userUUID) throws InvalidConfigurationException
|
||||
|
@ -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:
|
||||
|
||||
|
||||
@ -17,6 +17,17 @@ collect-data: true
|
||||
map-global-limit: 0
|
||||
map-player-limit: 0
|
||||
|
||||
|
||||
#Limit to the size of map non operator can render
|
||||
#The value is the number of map used for the image for instance if you make a map 10 X 12 you will get 120 maps
|
||||
map-size-notop-limit: 256
|
||||
map-size-notop-limit: 256
|
||||
|
||||
|
||||
#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
|
||||
|
||||
|
@ -24,7 +24,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."
|
||||
|
Loading…
Reference in New Issue
Block a user