mirror of
https://github.com/zDevelopers/ImageOnMap.git
synced 2024-09-28 06:27:38 +02:00
bug fix and typo
This commit is contained in:
parent
1becb9faf4
commit
c769f50835
@ -62,19 +62,19 @@ public class DeleteOtherCommand extends IoMCommand
|
|||||||
@Override
|
@Override
|
||||||
protected void run() throws CommandException
|
protected void run() throws CommandException
|
||||||
{
|
{
|
||||||
if(args.length < 2) {
|
if(args.length < 2) {
|
||||||
warning(I.t("Not enough parameters! Usage: /maptool deleteother <playername> <mapname>"));
|
warning(I.t("Not enough parameters! Usage: /maptool deleteother <playername> <mapname>"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Player player = null;
|
Player player = null;
|
||||||
UUID uuid = null;
|
UUID uuid = null;
|
||||||
OfflinePlayer op = null;
|
OfflinePlayer op = null;
|
||||||
player = Bukkit.getPlayer(args[0]);
|
player = Bukkit.getPlayer(args[0]);
|
||||||
if(player == null){
|
if(player == null){
|
||||||
op = Bukkit.getOfflinePlayer(args[0]);
|
op = Bukkit.getOfflinePlayer(args[0]);
|
||||||
if(op.hasPlayedBefore()) uuid = op.getUniqueId();
|
if(op.hasPlayedBefore()) uuid = op.getUniqueId();
|
||||||
else warning(I.t("We've never seen that player before!"));
|
else warning(I.t("We've never seen that player before!"));
|
||||||
}
|
}
|
||||||
else uuid = player.getUniqueId();
|
else uuid = player.getUniqueId();
|
||||||
if(player==null){
|
if(player==null){
|
||||||
@ -85,17 +85,17 @@ public class DeleteOtherCommand extends IoMCommand
|
|||||||
|
|
||||||
if(player != null) MapManager.clear(player.getInventory(), map);
|
if(player != null) MapManager.clear(player.getInventory(), map);
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
MapManager.deleteMap(map);
|
MapManager.deleteMap(map);
|
||||||
info(I.t("{gray}Map successfully deleted."));
|
info(I.t("{gray}Map successfully deleted."));
|
||||||
}
|
|
||||||
catch (MapManagerException ex)
|
|
||||||
{
|
|
||||||
PluginLogger.warning(I.t("A non-existent map was requested to be deleted", ex));
|
|
||||||
warning(ChatColor.RED+(I.t("This map does not exist.")));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
catch (MapManagerException ex)
|
||||||
|
{
|
||||||
|
PluginLogger.warning(I.t("A non-existent map was requested to be deleted", ex));
|
||||||
|
warning(ChatColor.RED+(I.t("This map does not exist.")));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected List<String> complete() throws CommandException
|
protected List<String> complete() throws CommandException
|
||||||
|
@ -43,10 +43,11 @@ import fr.zcraft.zlib.components.commands.CommandException;
|
|||||||
import fr.zcraft.zlib.components.commands.CommandInfo;
|
import fr.zcraft.zlib.components.commands.CommandInfo;
|
||||||
import fr.zcraft.zlib.components.gui.Gui;
|
import fr.zcraft.zlib.components.gui.Gui;
|
||||||
import fr.zcraft.zlib.components.i18n.I;
|
import fr.zcraft.zlib.components.i18n.I;
|
||||||
|
import fr.zcraft.zlib.tools.PluginLogger;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.OfflinePlayer;
|
import org.bukkit.OfflinePlayer;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
import java.util.concurrent.ExecutionException;
|
|
||||||
|
|
||||||
|
|
||||||
@CommandInfo (name = "exploreother")
|
@CommandInfo (name = "exploreother")
|
||||||
@ -59,21 +60,31 @@ public class ExploreOtherCommand extends IoMCommand
|
|||||||
warning(I.t("Not enough parameters! Usage: /maptool exploreother <playername>"));
|
warning(I.t("Not enough parameters! Usage: /maptool exploreother <playername>"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
try{
|
String name=args[0];
|
||||||
OfflinePlayer player=getOfflinePlayerParameter(0);
|
Player sender=playerSender();
|
||||||
String name=args[0];
|
offlinePlayerParameter(0, uuid -> {
|
||||||
if(player!=null)
|
if(uuid==null){
|
||||||
Gui.open(playerSender(), new MapListGui(player,name));
|
try {
|
||||||
}
|
throwInvalidArgument(I.t("Player not found."));
|
||||||
catch (InterruptedException | ExecutionException e){
|
} catch (CommandException e) {
|
||||||
warning(I.t("Can't find player"));
|
PluginLogger.error("CommandException "+e);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
OfflinePlayer offlinePlayer = Bukkit.getOfflinePlayer(uuid);
|
||||||
|
if (offlinePlayer != null) {
|
||||||
|
Gui.open(sender, new MapListGui(offlinePlayer, name));
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
PluginLogger.warning(I.t("Can't find player"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canExecute(CommandSender sender)
|
public boolean canExecute(CommandSender sender)
|
||||||
{
|
{
|
||||||
return Permissions.LISTOTHER.grantedTo(sender);
|
return Permissions.LISTOTHER.grantedTo(sender);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -59,24 +59,24 @@ public class GetOtherCommand extends IoMCommand
|
|||||||
@Override
|
@Override
|
||||||
protected void run() throws CommandException
|
protected void run() throws CommandException
|
||||||
{
|
{
|
||||||
if(args.length < 2) {
|
if(args.length < 2) {
|
||||||
warning(I.t("Not enough parameters! Usage: /maptool getother <playername> <mapname>"));
|
warning(I.t("Not enough parameters! Usage: /maptool getother <playername> <mapname>"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Player player = null;
|
Player player = null;
|
||||||
UUID uuid = null;
|
UUID uuid = null;
|
||||||
player = Bukkit.getPlayer(args[0]);
|
player = Bukkit.getPlayer(args[0]);
|
||||||
|
|
||||||
if(player == null){
|
if(player == null){
|
||||||
OfflinePlayer op = Bukkit.getOfflinePlayer(args[0]);
|
OfflinePlayer op = Bukkit.getOfflinePlayer(args[0]);
|
||||||
if(op.hasPlayedBefore()) uuid = op.getUniqueId();
|
if(op.hasPlayedBefore()) uuid = op.getUniqueId();
|
||||||
else warning(I.t("We've never seen that player before!"));
|
else warning(I.t("We've never seen that player before!"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
uuid = player.getUniqueId();
|
uuid = player.getUniqueId();
|
||||||
}
|
}
|
||||||
ImageMap map = null;
|
ImageMap map = null;
|
||||||
String mapName = "";
|
String mapName = "";
|
||||||
mapName = args[1];
|
mapName = args[1];
|
||||||
@ -93,9 +93,9 @@ public class GetOtherCommand extends IoMCommand
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public boolean canExecute(CommandSender sender)
|
public boolean canExecute(CommandSender sender)
|
||||||
{
|
{
|
||||||
return Permissions.GETOTHER.grantedTo(sender);
|
return Permissions.GETOTHER.grantedTo(sender);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -61,37 +61,37 @@ import java.util.UUID;
|
|||||||
@CommandInfo (name = "listother", usageParameters = "<PlayerName>")
|
@CommandInfo (name = "listother", usageParameters = "<PlayerName>")
|
||||||
public class ListOtherCommand extends IoMCommand
|
public class ListOtherCommand extends IoMCommand
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
protected void run() throws CommandException
|
protected void run() throws CommandException
|
||||||
{
|
{
|
||||||
if(args.length < 1){
|
if(args.length < 1){
|
||||||
warning(I.t("Not enough parameters! Usage: /maptool listother <playername>"));
|
warning(I.t("Not enough parameters! Usage: /maptool listother <playername>"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Player player = null;
|
Player player = null;
|
||||||
UUID uuid = null;
|
UUID uuid = null;
|
||||||
player = Bukkit.getPlayer(args[0]);
|
player = Bukkit.getPlayer(args[0]);
|
||||||
if(player == null){
|
if(player == null){
|
||||||
OfflinePlayer op = Bukkit.getOfflinePlayer(args[0]);
|
OfflinePlayer op = Bukkit.getOfflinePlayer(args[0]);
|
||||||
if(op.hasPlayedBefore()) {
|
if(op.hasPlayedBefore()) {
|
||||||
uuid = op.getUniqueId();
|
uuid = op.getUniqueId();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
warning(I.t("We've never seen that player before!"));
|
warning(I.t("We've never seen that player before!"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
uuid = player.getUniqueId();
|
uuid = player.getUniqueId();
|
||||||
}
|
}
|
||||||
|
|
||||||
List<ImageMap> mapList = null;
|
List<ImageMap> mapList = null;
|
||||||
try{
|
try{
|
||||||
mapList = MapManager.getMapList(uuid);
|
mapList = MapManager.getMapList(uuid);
|
||||||
}
|
}
|
||||||
catch(Exception e){
|
catch(Exception e){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(mapList.isEmpty())
|
if(mapList.isEmpty())
|
||||||
@ -122,7 +122,7 @@ public class ListOtherCommand extends IoMCommand
|
|||||||
.then(map.getId())
|
.then(map.getId())
|
||||||
.color(ChatColor.WHITE)
|
.color(ChatColor.WHITE)
|
||||||
.command(GetCommand.class, map.getId())
|
.command(GetCommand.class, map.getId())
|
||||||
.hover(new RawText()
|
.hover(new RawText()
|
||||||
.then(map.getName()).style(ChatColor.BOLD, ChatColor.GREEN).then("\n")
|
.then(map.getName()).style(ChatColor.BOLD, ChatColor.GREEN).then("\n")
|
||||||
.then(map.getId() + ", " + size).color(ChatColor.GRAY).then("\n\n")
|
.then(map.getId() + ", " + size).color(ChatColor.GRAY).then("\n\n")
|
||||||
.then(I.t("{white}Click{gray} to get this map"))
|
.then(I.t("{white}Click{gray} to get this map"))
|
||||||
|
@ -18,10 +18,13 @@
|
|||||||
|
|
||||||
package fr.moribus.imageonmap.commands.maptool;
|
package fr.moribus.imageonmap.commands.maptool;
|
||||||
|
|
||||||
|
import fr.moribus.imageonmap.Permissions;
|
||||||
import fr.moribus.imageonmap.commands.IoMCommand;
|
import fr.moribus.imageonmap.commands.IoMCommand;
|
||||||
import fr.moribus.imageonmap.map.ImageMap;
|
import fr.moribus.imageonmap.map.ImageMap;
|
||||||
import fr.zcraft.zlib.components.commands.CommandException;
|
import fr.zcraft.zlib.components.commands.CommandException;
|
||||||
import fr.zcraft.zlib.components.commands.CommandInfo;
|
import fr.zcraft.zlib.components.commands.CommandInfo;
|
||||||
|
import fr.zcraft.zlib.components.i18n.I;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ -30,13 +33,17 @@ public class RenameCommand extends IoMCommand {
|
|||||||
@Override
|
@Override
|
||||||
protected void run() throws CommandException
|
protected void run() throws CommandException
|
||||||
{
|
{
|
||||||
if(args.length == 2)
|
if(args.length != 4) {
|
||||||
{
|
warning(I.t("Not enough or too many arguments! Usage: /maptool rename <map name> <new map name>"));
|
||||||
ImageMap map = getMapFromArgs();
|
return;
|
||||||
map.rename(args[1]);
|
|
||||||
} else {
|
|
||||||
info(I.t("Not enough or too many arguments"));
|
|
||||||
}
|
}
|
||||||
|
//if(args.length == 2)
|
||||||
|
//{
|
||||||
|
ImageMap map = getMapFromArgs();
|
||||||
|
map.rename(args[2]);
|
||||||
|
// } else {
|
||||||
|
// info(I.t("Not enough or too many arguments"));
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
protected List<String> complete() throws CommandException
|
protected List<String> complete() throws CommandException
|
||||||
|
@ -165,7 +165,7 @@ public class ImageRendererExecutor extends Worker
|
|||||||
public ImageMap run() throws Throwable
|
public ImageMap run() throws Throwable
|
||||||
{
|
{
|
||||||
|
|
||||||
final URLConnection connection = HTTPconnection(url);
|
final URLConnection connection = connecting(url);
|
||||||
|
|
||||||
final InputStream stream = connection.getInputStream();
|
final InputStream stream = connection.getInputStream();
|
||||||
final BufferedImage image = ImageIO.read(stream);
|
final BufferedImage image = ImageIO.read(stream);
|
||||||
|
Loading…
Reference in New Issue
Block a user