Add /spawn and /setspawn commands to MapParser
This commit is contained in:
parent
d9184ad423
commit
9802c00ec5
@ -15,11 +15,9 @@ import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Sheep;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
@ -28,21 +26,16 @@ import org.bukkit.event.block.BlockBurnEvent;
|
||||
import org.bukkit.event.block.BlockFadeEvent;
|
||||
import org.bukkit.event.block.BlockSpreadEvent;
|
||||
import org.bukkit.event.block.LeavesDecayEvent;
|
||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
import org.bukkit.event.entity.EntitySpawnEvent;
|
||||
import org.bukkit.event.player.AsyncPlayerChatEvent;
|
||||
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.event.player.PlayerMoveEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.event.server.ServerListPingEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.Callback;
|
||||
import mineplex.core.common.util.F;
|
||||
@ -51,27 +44,9 @@ import mineplex.core.common.util.UtilBlock;
|
||||
import mineplex.core.common.util.UtilEvent;
|
||||
import mineplex.core.common.util.UtilEvent.ActionType;
|
||||
import mineplex.core.common.util.UtilGear;
|
||||
import mineplex.core.common.util.UtilInv;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.mapparser.command.AdminCommand;
|
||||
import mineplex.mapparser.command.AuthorCommand;
|
||||
import mineplex.mapparser.command.BaseCommand;
|
||||
import mineplex.mapparser.command.CopyCommand;
|
||||
import mineplex.mapparser.command.CopySchematicsCommand;
|
||||
import mineplex.mapparser.command.CreateCommand;
|
||||
import mineplex.mapparser.command.DeleteCommand;
|
||||
import mineplex.mapparser.command.GameTypeCommand;
|
||||
import mineplex.mapparser.command.HubCommand;
|
||||
import mineplex.mapparser.command.ListCommand;
|
||||
import mineplex.mapparser.command.MapCommand;
|
||||
import mineplex.mapparser.command.NameCommand;
|
||||
import mineplex.mapparser.command.ParseCommand200;
|
||||
import mineplex.mapparser.command.ParseCommand400;
|
||||
import mineplex.mapparser.command.ParseCommand600;
|
||||
import mineplex.mapparser.command.RenameCommand;
|
||||
import mineplex.mapparser.command.SaveCommand;
|
||||
import mineplex.mapparser.command.WorldsCommand;
|
||||
import mineplex.mapparser.command.*;
|
||||
|
||||
public class MapParser extends JavaPlugin implements Listener
|
||||
{
|
||||
@ -115,6 +90,8 @@ public class MapParser extends JavaPlugin implements Listener
|
||||
_commands.add(new SaveCommand(this));
|
||||
_commands.add(new WorldsCommand(this));
|
||||
_commands.add(new CopyCommand(this));
|
||||
_commands.add(new SpawnCommand(this));
|
||||
_commands.add(new SetSpawnCommand(this));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -215,13 +192,14 @@ public class MapParser extends JavaPlugin implements Listener
|
||||
{
|
||||
if (alias.equalsIgnoreCase(commandLabel))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
|
||||
if (!command.execute(player, commandLabel, args))
|
||||
{
|
||||
UtilPlayer.message(player, F.main("Parser", "Invalid Input."));
|
||||
UtilPlayer.message(player, F.elem(command.getUsage()));
|
||||
}
|
||||
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -415,7 +393,6 @@ public class MapParser extends JavaPlugin implements Listener
|
||||
|
||||
for (GameType type : GameType.values())
|
||||
{
|
||||
ChatColor color = ChatColor.YELLOW;
|
||||
|
||||
File mapsFolder = new File("map" + File.separator + type.GetName());
|
||||
if (!mapsFolder.exists())
|
||||
|
@ -0,0 +1,31 @@
|
||||
package mineplex.mapparser.command;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.mapparser.MapParser;
|
||||
|
||||
public class SetSpawnCommand extends BaseCommand
|
||||
{
|
||||
|
||||
public SetSpawnCommand(MapParser plugin)
|
||||
{
|
||||
super(plugin, "setspawn");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean execute(Player player, String alias, String[] args)
|
||||
{
|
||||
Location loc = player.getLocation();
|
||||
|
||||
player.getWorld().setSpawnLocation(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ());
|
||||
|
||||
player.sendMessage(ChatColor.YELLOW + "Spawn saved for world '" + ChatColor.GOLD + loc.getWorld().getName()
|
||||
+ ChatColor.YELLOW + "' to X: " + ChatColor.GOLD + loc.getBlockX() + ChatColor.YELLOW + ", Y: "
|
||||
+ ChatColor.GOLD + loc.getBlockY() + ChatColor.YELLOW + ", Z: " + ChatColor.GOLD + loc.getBlockZ());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package mineplex.mapparser.command;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.mapparser.MapParser;
|
||||
|
||||
public class SpawnCommand extends BaseCommand
|
||||
{
|
||||
|
||||
public SpawnCommand(MapParser plugin)
|
||||
{
|
||||
super(plugin, "spawn");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean execute(Player player, String alias, String[] args)
|
||||
{
|
||||
player.teleport(player.getWorld().getSpawnLocation());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user