mirror of
https://github.com/zDevelopers/ImageOnMap.git
synced 2024-11-15 06:35:11 +01:00
diverses corrections
This commit is contained in:
parent
b1a7734f86
commit
675bf898aa
@ -16,13 +16,6 @@ import org.bukkit.entity.Player;
|
|||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
import com.comphenix.protocol.PacketType;
|
|
||||||
import com.comphenix.protocol.ProtocolLibrary;
|
|
||||||
import com.comphenix.protocol.events.ListenerPriority;
|
|
||||||
import com.comphenix.protocol.events.PacketAdapter;
|
|
||||||
import com.comphenix.protocol.events.PacketEvent;
|
|
||||||
import com.comphenix.protocol.wrappers.WrappedGameProfile;
|
|
||||||
|
|
||||||
import fr.moribus.ImageOnMap.Map.ImageMap;
|
import fr.moribus.ImageOnMap.Map.ImageMap;
|
||||||
import fr.moribus.ImageOnMap.Map.SingleMap;
|
import fr.moribus.ImageOnMap.Map.SingleMap;
|
||||||
|
|
||||||
@ -82,18 +75,6 @@ public final class ImageOnMap extends JavaPlugin
|
|||||||
this.setEnabled(false);
|
this.setEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Disable all sound effects
|
|
||||||
ProtocolLibrary.getProtocolManager().addPacketListener(
|
|
||||||
new PacketAdapter(this, ListenerPriority.NORMAL,
|
|
||||||
PacketType.Play.Server.SPAWN_ENTITY_LIVING)
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public void onPacketSending(PacketEvent event)
|
|
||||||
{
|
|
||||||
event.getPacket().getIntegers().write(1, (int) EntityType.BLAZE.getTypeId());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -42,12 +42,6 @@ public class ImageRendererThread extends Thread
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public HashMap<Integer, String> getNumeroMap()
|
|
||||||
{
|
|
||||||
return poster.NumeroMap;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public Boolean getStatut()
|
public Boolean getStatut()
|
||||||
{
|
{
|
||||||
|
@ -6,6 +6,8 @@ import org.bukkit.command.CommandExecutor;
|
|||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import fr.moribus.ImageOnMap.Map.MapType;
|
||||||
|
|
||||||
|
|
||||||
public class ImageRenduCommande implements CommandExecutor
|
public class ImageRenduCommande implements CommandExecutor
|
||||||
{
|
{
|
||||||
@ -13,6 +15,7 @@ public class ImageRenduCommande implements CommandExecutor
|
|||||||
boolean renderName, imgSvg;
|
boolean renderName, imgSvg;
|
||||||
ImageOnMap plugin;
|
ImageOnMap plugin;
|
||||||
boolean resize, rename;
|
boolean resize, rename;
|
||||||
|
MapType type;
|
||||||
|
|
||||||
public ImageRenduCommande(ImageOnMap p)
|
public ImageRenduCommande(ImageOnMap p)
|
||||||
{
|
{
|
||||||
@ -60,17 +63,19 @@ public class ImageRenduCommande implements CommandExecutor
|
|||||||
|
|
||||||
if(arg3.length >= 2)
|
if(arg3.length >= 2)
|
||||||
{
|
{
|
||||||
for(int i = 1; i < arg3.length; i++)
|
try
|
||||||
{
|
{
|
||||||
if(arg3[i].equalsIgnoreCase("resize:true"))
|
type = Enum.valueOf(MapType.class, arg3[1]);
|
||||||
resize = true;
|
|
||||||
if(arg3[i].equalsIgnoreCase("rename:false"))
|
|
||||||
rename = false;
|
|
||||||
}
|
}
|
||||||
|
catch(IllegalArgumentException ex)
|
||||||
|
{
|
||||||
|
joueur.sendMessage("Specified map type doesn't exist");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
TacheTraitementMap tache = new TacheTraitementNouvelleMap(joueur, arg3[0], resize, rename);
|
TacheTraitementMap tache = new TacheTraitementNouvelleMap(joueur, arg3[0], type, resize, rename);
|
||||||
tache.runTaskTimer(plugin, 0, 5);
|
tache.runTaskTimer(plugin, 0, 5);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
File diff suppressed because it is too large
Load Diff
6
src/fr/moribus/ImageOnMap/Map/MapType.java
Normal file
6
src/fr/moribus/ImageOnMap/Map/MapType.java
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
package fr.moribus.ImageOnMap.Map;
|
||||||
|
|
||||||
|
public enum MapType
|
||||||
|
{
|
||||||
|
Single, Multi, Animated
|
||||||
|
}
|
@ -18,13 +18,16 @@ public class SingleMap implements ImageMap
|
|||||||
private MapView map;
|
private MapView map;
|
||||||
private boolean named;
|
private boolean named;
|
||||||
|
|
||||||
|
public final int LARGEUR = 128;
|
||||||
|
public final int HAUTEUR = 128;
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
public SingleMap(Image img, Player joueur)
|
public SingleMap(Image img, Player joueur)
|
||||||
{
|
{
|
||||||
map = Bukkit.createMap(joueur.getWorld());
|
map = Bukkit.createMap(joueur.getWorld());
|
||||||
this.named = false;
|
this.named = false;
|
||||||
|
|
||||||
data = new MapData(map.getId(), joueur.getName(), img, joueur.getWorld().getName());
|
data = new MapData(map.getId(), joueur.getName(), img.getScaledInstance(LARGEUR, HAUTEUR, Image.SCALE_FAST), joueur.getWorld().getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
@ -32,7 +35,7 @@ public class SingleMap implements ImageMap
|
|||||||
{
|
{
|
||||||
map = Bukkit.createMap(joueur.getWorld());
|
map = Bukkit.createMap(joueur.getWorld());
|
||||||
|
|
||||||
data = new MapData(map.getId(), joueur.getName(), img, joueur.getWorld().getName(), name);
|
data = new MapData(map.getId(), joueur.getName(), img.getScaledInstance(LARGEUR, HAUTEUR, Image.SCALE_FAST), joueur.getWorld().getName(), name);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
|
@ -285,7 +285,7 @@ public class MetricsLite {
|
|||||||
boolean onlineMode = Bukkit.getServer().getOnlineMode(); // TRUE if online mode is enabled
|
boolean onlineMode = Bukkit.getServer().getOnlineMode(); // TRUE if online mode is enabled
|
||||||
String pluginVersion = description.getVersion();
|
String pluginVersion = description.getVersion();
|
||||||
String serverVersion = Bukkit.getVersion();
|
String serverVersion = Bukkit.getVersion();
|
||||||
int playersOnline = Bukkit.getServer().getOnlinePlayers().length;
|
int playersOnline = Bukkit.getServer().getOnlinePlayers().size();
|
||||||
|
|
||||||
// END server software specific section -- all code below does not use any code outside of this class / Java
|
// END server software specific section -- all code below does not use any code outside of this class / Java
|
||||||
|
|
||||||
|
@ -4,20 +4,31 @@ import java.awt.image.BufferedImage;
|
|||||||
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import fr.moribus.ImageOnMap.Map.ImageMap;
|
||||||
|
import fr.moribus.ImageOnMap.Map.MapType;
|
||||||
import fr.moribus.ImageOnMap.Map.PosterMap;
|
import fr.moribus.ImageOnMap.Map.PosterMap;
|
||||||
|
import fr.moribus.ImageOnMap.Map.SingleMap;
|
||||||
|
|
||||||
public class TacheTraitementNouvelleMap extends TacheTraitementMap
|
public class TacheTraitementNouvelleMap extends TacheTraitementMap
|
||||||
{
|
{
|
||||||
|
private MapType type;
|
||||||
|
|
||||||
public TacheTraitementNouvelleMap(Player j, String u, boolean rs, boolean rn)
|
public TacheTraitementNouvelleMap(Player j, String u, MapType type, boolean rs, boolean rn)
|
||||||
{
|
{
|
||||||
super(j, u, rs, rn);
|
super(j, u, rs, rn);
|
||||||
|
this.type = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void traiterMap(BufferedImage img)
|
public void traiterMap(BufferedImage img)
|
||||||
{
|
{
|
||||||
PosterMap m = new PosterMap(img, getJoueur());
|
ImageMap m;
|
||||||
|
|
||||||
|
if(type == MapType.Single)
|
||||||
|
m = new SingleMap(img, getJoueur());
|
||||||
|
else
|
||||||
|
m = new PosterMap(img, getJoueur());
|
||||||
|
|
||||||
m.load();
|
m.load();
|
||||||
m.give(getJoueur().getInventory());
|
m.give(getJoueur().getInventory());
|
||||||
m.save();
|
m.save();
|
||||||
|
Loading…
Reference in New Issue
Block a user