johnnyjayjay / spigot-maps Goto Github PK
View Code? Open in Web Editor NEWA library to simplify the use of customised maps in Spigot.
License: GNU Lesser General Public License v3.0
A library to simplify the use of customised maps in Spigot.
License: GNU Lesser General Public License v3.0
How i can give me image maps with 7 witdh an 4 high?
RegEx in the static block of Compatibility.class
raises an error because of third number in the version.
1.19.1 works, but 1.19 doesn't because it doesn't match with the regex
To reproduce the error just try to launch 1.19 server with Compatibility class loaded and static block ran
Simple solution would be just to run 1.19.1 server but thats awkward :)
Hello, I'm currently using your API to generate an image on a map, This image needs to be persistent and can update whenever a command is sent;
I managed to get the map creation working, but I do struggle with trying to figure out how to save the map to storage and update it on demand
Are there any more examples or documentation that I can get on this topic?
Thank you and kind regards,
Merlyn
Is your feature request related to a problem? Please describe.
It's currently not possible to represent animated gifs conveniently as this library does not provide methods for that matter.
Describe the solution you'd like
A possibility to turn a RenderedMap
into a gif by periodically reloading the map with the next frame. Though this could be hard to accomplish because spigot does not expose an API to manipulate maps in that way.
Describe alternatives you've considered
A simpler, doable, yet probably much more inefficient way would be to provide a way to get a RenderedMap for each frame of a gif.
I considered combining this with reactor-core.
There could be a method, which, based on previously set attributes like the gif source, the fps and so on, returns a Flux that emits a RenderedMap for each frame of the gif in a period matching the FPS.
This could be consumed in a way that it continously replaces a map in an item frame ingame, for example.
This would not make it possible to render a gif on a single map and it would perhaps be too much overhead for its purpose.
Additional context
The most important task to find a proper solution to this is to look for a way to re-initialize existing maps.
Describe the bug
An exception was thrown when running createItemStack()
To Reproduce
Steps to reproduce the behavior:
Expected behavior
It should return an item stack
Screenshots, Code & Stack Traces
Caused by: java.lang.ClassCastException: org.bukkit.craftbukkit.v1_14_R1.inventory.CraftMetaItem cannot be cast to org.bukkit.inventory.meta.MapMeta
at com.github.johnnyjayjay.spigotmaps.RenderedMap.createItemStack(RenderedMap.java:208) ~[?:?]
at com.github.johnnyjayjay.spigotmaps.RenderedMap.createItemStack(RenderedMap.java:196) ~[?:?]
Spigot Version: Paper 1.14.4
1.16.1 server item meta can't cast into map meta
To Reproduce
Steps to reproduce the behavior:
Expected behavior
create an map itemstack
Screenshots, Code & Stack Traces
"java.lang.ClassCastException: org.bukkit.craftbukkit.v1_16_R1.inventory.CraftMetaItem cannot be cast to org.bukkit.inventory.meta.MapMeta"
Spigot Version:
Purpur-1.16.1
Is your feature request related to a problem? Please describe.
There are currently no utilities to divide an image that has a different resolution ratio than 1:1, although such images are quite common.
Describe the solution you'd like
ImageTools
could take the width and height of the given image into account and calculate a fitting number and distribution of maps. This would also introduce new issues: arbitrary ratios could lead to situations where hundreds (or even more) maps are required to match the input. There would need to be some safety net and some sort of sensible mechanism that makes slight adjustments to the original automatically.
Describe alternatives you've considered
This isn't necessarily something that needs to be baked into this library. If there are any existing libraries that provide such functionality, it need not be implemented here.
Additional context
/
Is your feature request related to a problem? Please describe.
Currently, if you want to store map renderers, you have to implement the logic for this from scratch, essentially. There are little to no facilities for this and no proper guidance in terms of best practice.
Describe the solution you'd like
There should be more obvious and simple ways to implement MapStorage
. There should also be standard implementations for common uses for spigot such as storing maps in a yaml config.
Describe alternatives you've considered
/
Additional context
This does not mean that the raw, low level MapStorage
interface should be changed or even replaced. It should still be possible to tailor storage exactly to your needs.
Describe the bug
Creating RenderedMap
s on legacy versions yields a NoSuchMethodError
. This is because prior to 1.13.2, MapView#getId()
returned a short
instead of an int
. Since the library is currently compiled against newer versions, it always looks for a getId()
method that returns an int
.
The obvious fix would be to compile the library against different spigot versions. But that is something I want to avoid from 2.0 on. As an alternative, reflection/MethodHandles that are initialised differently based on the Minecraft version could be used.
To Reproduce
Steps to reproduce the behavior:
RenderedMap
Expected behavior
It should work without any issues.
Screenshots, Code & Stack Traces
java.lang.NoSuchMethodError: org.bukkit.map.MapView.getId()I
at com.github.johnnyjayjay.spigotmaps.RenderedMap.lambda$new$0(RenderedMap.java:32) ~[?:?]
at java.util.ArrayList.forEach(Unknown Source) ~[?:1.8.0_261]
at com.github.johnnyjayjay.spigotmaps.RenderedMap.<init>(RenderedMap.java:32) ~[?:?]
at com.github.johnnyjayjay.spigotmaps.RenderedMap.create(RenderedMap.java:54) ~[?:?]
at com.github.johnnyjayjay.spigotmaps.MapBuilder.build(MapBuilder.java:55) ~[?:?]
at me.d3lt3x.maps.main.Main.createImage(Main.java:61) ~[?:?]
at me.d3lt3x.maps.main.Main.onCommand(Main.java:36) ~[?:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_261]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_261]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_261]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_261]
at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:306) ~[spigot.jar:git-Spigot-db6de12-18fbb24]
... 16 more
Spigot Version:
1.8.8, but same for anything below 1.13.2.
Additional context
/
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.