mirror of
https://github.com/zDevelopers/ImageOnMap.git
synced 2025-01-05 23:37:43 +01:00
* OPT: Remove the unfinished AnimatedMap implementation for now.
This commit is contained in:
parent
e31c20191f
commit
3e19bb0b74
@ -1,73 +0,0 @@
|
||||
package fr.moribus.imageonmap.map;
|
||||
|
||||
import java.awt.Image;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.awt.image.ImageObserver;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
|
||||
import javax.swing.ImageIcon;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class AnimatedMap implements ImageObserver
|
||||
{
|
||||
private ImageMap map;
|
||||
private ImageIcon icon;
|
||||
private BufferedImage img;
|
||||
private Player joueur;
|
||||
|
||||
public AnimatedMap(ImageMap map, Player j) throws MalformedURLException
|
||||
{
|
||||
this.map = map;
|
||||
icon = new ImageIcon(new URL("http://upload.wikimedia.org/wikipedia/commons/5/55/Tesseract.gif"));
|
||||
img = new BufferedImage(256, 256, BufferedImage.TYPE_4BYTE_ABGR);
|
||||
joueur = j;
|
||||
icon.setImageObserver(this);
|
||||
}
|
||||
|
||||
public void animer()
|
||||
{
|
||||
icon.paintIcon(null, img.getGraphics(), 0, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean imageUpdate(Image gif, int infoflags, int x, int y,
|
||||
int width, int height)
|
||||
{
|
||||
if ((infoflags & ImageObserver.FRAMEBITS) != 0)
|
||||
{
|
||||
Bukkit.getScheduler().runTask(Bukkit.getPluginManager().getPlugin("ImageOnMap"), new DessinerAnimation(gif));
|
||||
|
||||
try
|
||||
{
|
||||
Thread.sleep(300);
|
||||
}
|
||||
catch (InterruptedException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
class DessinerAnimation implements Runnable
|
||||
{
|
||||
private Image image;
|
||||
public DessinerAnimation(Image image)
|
||||
{
|
||||
this.image = image;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
img.getGraphics().clearRect(0, 0, 128, 128);
|
||||
img.getGraphics().drawImage(image, 0, 0, null);
|
||||
map.setImage(img);
|
||||
map.send(joueur);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -14,7 +14,7 @@ public abstract class ImageMap
|
||||
{
|
||||
static public enum Type
|
||||
{
|
||||
SINGLE, POSTER, ANIMATED;
|
||||
SINGLE, POSTER;
|
||||
|
||||
static public ImageMap createNewMap(Type type, BufferedImage image, Player player)
|
||||
{
|
||||
@ -31,8 +31,6 @@ public abstract class ImageMap
|
||||
{
|
||||
switch(string.toLowerCase())
|
||||
{
|
||||
case "animated":
|
||||
return ANIMATED;
|
||||
case "poster":
|
||||
case "multi":
|
||||
return POSTER;
|
||||
|
Loading…
Reference in New Issue
Block a user