2011-03-19 22:39:51 +00:00
|
|
|
package com.earth2me.essentials.commands;
|
|
|
|
|
|
|
|
import net.minecraft.server.WorldServer;
|
|
|
|
import org.bukkit.Location;
|
|
|
|
import org.bukkit.Server;
|
|
|
|
import com.earth2me.essentials.User;
|
|
|
|
import com.earth2me.essentials.Mob;
|
|
|
|
import com.earth2me.essentials.Mob.MobException;
|
|
|
|
import com.earth2me.essentials.TargetBlock;
|
2011-05-11 22:42:48 +00:00
|
|
|
import com.earth2me.essentials.Util;
|
2011-04-03 17:10:19 +00:00
|
|
|
import net.minecraft.server.EntityWolf;
|
|
|
|
import net.minecraft.server.PathEntity;
|
2011-04-03 16:32:33 +00:00
|
|
|
import org.bukkit.DyeColor;
|
2011-04-04 02:58:41 +00:00
|
|
|
import org.bukkit.Material;
|
|
|
|
import org.bukkit.block.Block;
|
|
|
|
import org.bukkit.craftbukkit.CraftWorld;
|
2011-04-21 17:03:44 +00:00
|
|
|
import org.bukkit.craftbukkit.entity.CraftCreeper;
|
2011-04-03 16:32:33 +00:00
|
|
|
import org.bukkit.craftbukkit.entity.CraftSheep;
|
|
|
|
import org.bukkit.craftbukkit.entity.CraftSlime;
|
2011-04-03 17:10:19 +00:00
|
|
|
import org.bukkit.craftbukkit.entity.CraftWolf;
|
2011-06-23 12:10:27 +00:00
|
|
|
import org.bukkit.entity.Entity;
|
2011-03-19 22:39:51 +00:00
|
|
|
|
|
|
|
|
|
|
|
public class Commandspawnmob extends EssentialsCommand
|
|
|
|
{
|
|
|
|
public Commandspawnmob()
|
|
|
|
{
|
|
|
|
super("spawnmob");
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
This is a big refactoring of the user class and more.
Many commands have been cleaned.
File changes:
- all user data has been moved from users.yml to userdata folder
- all files in userdata folder are lower case
Both changes should be done automatically.
Class changes:
- Moved all user data functions to UserData class
- Moved all user teleport functions to Teleport class
- Moved the user list to Essentials class
- Less static functions for better testing
- EssentialsCommand now has ess Property (Essentials class)
- New NotEnoughArgumentsException, that will show command description and syntax
New commands:
- /seen, shows the last login or logout
- /tempban, temporarily ban someone
- /tjail and mute, temporarily option added
Other changes:
- ban reason is saved
- don't show "You have xxx mail" on login, if user doesn't have essentials.mail permission
- time will be parsed: years, months (mo), weeks, days, hours, minutes (m), seconds, these can be shortened and combined, example: 2 days 5h 30m
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1300 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-01 21:07:30 +00:00
|
|
|
public void run(Server server, User user, String commandLabel, String[] args) throws Exception
|
2011-03-19 22:39:51 +00:00
|
|
|
{
|
|
|
|
if (args.length < 1)
|
|
|
|
{
|
This is a big refactoring of the user class and more.
Many commands have been cleaned.
File changes:
- all user data has been moved from users.yml to userdata folder
- all files in userdata folder are lower case
Both changes should be done automatically.
Class changes:
- Moved all user data functions to UserData class
- Moved all user teleport functions to Teleport class
- Moved the user list to Essentials class
- Less static functions for better testing
- EssentialsCommand now has ess Property (Essentials class)
- New NotEnoughArgumentsException, that will show command description and syntax
New commands:
- /seen, shows the last login or logout
- /tempban, temporarily ban someone
- /tjail and mute, temporarily option added
Other changes:
- ban reason is saved
- don't show "You have xxx mail" on login, if user doesn't have essentials.mail permission
- time will be parsed: years, months (mo), weeks, days, hours, minutes (m), seconds, these can be shortened and combined, example: 2 days 5h 30m
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1300 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-01 21:07:30 +00:00
|
|
|
throw new NotEnoughArgumentsException();
|
|
|
|
//TODO: user.sendMessage("§7Mobs: Zombie PigZombie Skeleton Slime Chicken Pig Monster Spider Creeper Ghast Squid Giant Cow Sheep Wolf");
|
2011-03-19 22:39:51 +00:00
|
|
|
}
|
|
|
|
|
This is a big refactoring of the user class and more.
Many commands have been cleaned.
File changes:
- all user data has been moved from users.yml to userdata folder
- all files in userdata folder are lower case
Both changes should be done automatically.
Class changes:
- Moved all user data functions to UserData class
- Moved all user teleport functions to Teleport class
- Moved the user list to Essentials class
- Less static functions for better testing
- EssentialsCommand now has ess Property (Essentials class)
- New NotEnoughArgumentsException, that will show command description and syntax
New commands:
- /seen, shows the last login or logout
- /tempban, temporarily ban someone
- /tjail and mute, temporarily option added
Other changes:
- ban reason is saved
- don't show "You have xxx mail" on login, if user doesn't have essentials.mail permission
- time will be parsed: years, months (mo), weeks, days, hours, minutes (m), seconds, these can be shortened and combined, example: 2 days 5h 30m
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1300 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-01 21:07:30 +00:00
|
|
|
|
2011-04-04 02:58:41 +00:00
|
|
|
String[] mountparts = args[0].split(",");
|
|
|
|
String[] parts = mountparts[0].split(":");
|
|
|
|
String mobType = parts[0];
|
|
|
|
mobType = mobType.equalsIgnoreCase("PigZombie") ? "PigZombie" : capitalCase(mobType);
|
|
|
|
String mobData = null;
|
This is a big refactoring of the user class and more.
Many commands have been cleaned.
File changes:
- all user data has been moved from users.yml to userdata folder
- all files in userdata folder are lower case
Both changes should be done automatically.
Class changes:
- Moved all user data functions to UserData class
- Moved all user teleport functions to Teleport class
- Moved the user list to Essentials class
- Less static functions for better testing
- EssentialsCommand now has ess Property (Essentials class)
- New NotEnoughArgumentsException, that will show command description and syntax
New commands:
- /seen, shows the last login or logout
- /tempban, temporarily ban someone
- /tjail and mute, temporarily option added
Other changes:
- ban reason is saved
- don't show "You have xxx mail" on login, if user doesn't have essentials.mail permission
- time will be parsed: years, months (mo), weeks, days, hours, minutes (m), seconds, these can be shortened and combined, example: 2 days 5h 30m
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1300 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-01 21:07:30 +00:00
|
|
|
if (parts.length == 2)
|
|
|
|
{
|
2011-04-04 02:58:41 +00:00
|
|
|
mobData = parts[1];
|
2011-03-19 22:39:51 +00:00
|
|
|
}
|
2011-04-04 02:58:41 +00:00
|
|
|
String mountType = null;
|
|
|
|
String mountData = null;
|
This is a big refactoring of the user class and more.
Many commands have been cleaned.
File changes:
- all user data has been moved from users.yml to userdata folder
- all files in userdata folder are lower case
Both changes should be done automatically.
Class changes:
- Moved all user data functions to UserData class
- Moved all user teleport functions to Teleport class
- Moved the user list to Essentials class
- Less static functions for better testing
- EssentialsCommand now has ess Property (Essentials class)
- New NotEnoughArgumentsException, that will show command description and syntax
New commands:
- /seen, shows the last login or logout
- /tempban, temporarily ban someone
- /tjail and mute, temporarily option added
Other changes:
- ban reason is saved
- don't show "You have xxx mail" on login, if user doesn't have essentials.mail permission
- time will be parsed: years, months (mo), weeks, days, hours, minutes (m), seconds, these can be shortened and combined, example: 2 days 5h 30m
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1300 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-01 21:07:30 +00:00
|
|
|
if (mountparts.length > 1)
|
|
|
|
{
|
2011-04-04 02:58:41 +00:00
|
|
|
parts = mountparts[1].split(":");
|
|
|
|
mountType = parts[0];
|
|
|
|
mountType = mountType.equalsIgnoreCase("PigZombie") ? "PigZombie" : capitalCase(mountType);
|
This is a big refactoring of the user class and more.
Many commands have been cleaned.
File changes:
- all user data has been moved from users.yml to userdata folder
- all files in userdata folder are lower case
Both changes should be done automatically.
Class changes:
- Moved all user data functions to UserData class
- Moved all user teleport functions to Teleport class
- Moved the user list to Essentials class
- Less static functions for better testing
- EssentialsCommand now has ess Property (Essentials class)
- New NotEnoughArgumentsException, that will show command description and syntax
New commands:
- /seen, shows the last login or logout
- /tempban, temporarily ban someone
- /tjail and mute, temporarily option added
Other changes:
- ban reason is saved
- don't show "You have xxx mail" on login, if user doesn't have essentials.mail permission
- time will be parsed: years, months (mo), weeks, days, hours, minutes (m), seconds, these can be shortened and combined, example: 2 days 5h 30m
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1300 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-01 21:07:30 +00:00
|
|
|
if (parts.length == 2)
|
|
|
|
{
|
2011-04-04 02:58:41 +00:00
|
|
|
mountData = parts[1];
|
|
|
|
}
|
2011-03-19 22:39:51 +00:00
|
|
|
}
|
This is a big refactoring of the user class and more.
Many commands have been cleaned.
File changes:
- all user data has been moved from users.yml to userdata folder
- all files in userdata folder are lower case
Both changes should be done automatically.
Class changes:
- Moved all user data functions to UserData class
- Moved all user teleport functions to Teleport class
- Moved the user list to Essentials class
- Less static functions for better testing
- EssentialsCommand now has ess Property (Essentials class)
- New NotEnoughArgumentsException, that will show command description and syntax
New commands:
- /seen, shows the last login or logout
- /tempban, temporarily ban someone
- /tjail and mute, temporarily option added
Other changes:
- ban reason is saved
- don't show "You have xxx mail" on login, if user doesn't have essentials.mail permission
- time will be parsed: years, months (mo), weeks, days, hours, minutes (m), seconds, these can be shortened and combined, example: 2 days 5h 30m
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1300 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-01 21:07:30 +00:00
|
|
|
|
|
|
|
|
2011-06-23 12:10:27 +00:00
|
|
|
Entity spawnedMob = null;
|
2011-04-04 02:58:41 +00:00
|
|
|
Mob mob = null;
|
2011-06-23 12:10:27 +00:00
|
|
|
Entity spawnedMount = null;
|
2011-04-04 02:58:41 +00:00
|
|
|
Mob mobMount = null;
|
|
|
|
|
|
|
|
mob = Mob.fromName(mobType);
|
2011-03-19 22:39:51 +00:00
|
|
|
if (mob == null)
|
|
|
|
{
|
2011-05-11 22:42:48 +00:00
|
|
|
user.sendMessage(Util.i18n("invalidMob"));
|
2011-03-19 22:39:51 +00:00
|
|
|
return;
|
|
|
|
}
|
This is a big refactoring of the user class and more.
Many commands have been cleaned.
File changes:
- all user data has been moved from users.yml to userdata folder
- all files in userdata folder are lower case
Both changes should be done automatically.
Class changes:
- Moved all user data functions to UserData class
- Moved all user teleport functions to Teleport class
- Moved the user list to Essentials class
- Less static functions for better testing
- EssentialsCommand now has ess Property (Essentials class)
- New NotEnoughArgumentsException, that will show command description and syntax
New commands:
- /seen, shows the last login or logout
- /tempban, temporarily ban someone
- /tjail and mute, temporarily option added
Other changes:
- ban reason is saved
- don't show "You have xxx mail" on login, if user doesn't have essentials.mail permission
- time will be parsed: years, months (mo), weeks, days, hours, minutes (m), seconds, these can be shortened and combined, example: 2 days 5h 30m
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1300 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-01 21:07:30 +00:00
|
|
|
charge(user);
|
|
|
|
int[] ignore =
|
|
|
|
{
|
|
|
|
8, 9
|
|
|
|
};
|
2011-03-19 22:39:51 +00:00
|
|
|
Location loc = (new TargetBlock(user, 300, 0.2, ignore)).getTargetBlock().getLocation();
|
This is a big refactoring of the user class and more.
Many commands have been cleaned.
File changes:
- all user data has been moved from users.yml to userdata folder
- all files in userdata folder are lower case
Both changes should be done automatically.
Class changes:
- Moved all user data functions to UserData class
- Moved all user teleport functions to Teleport class
- Moved the user list to Essentials class
- Less static functions for better testing
- EssentialsCommand now has ess Property (Essentials class)
- New NotEnoughArgumentsException, that will show command description and syntax
New commands:
- /seen, shows the last login or logout
- /tempban, temporarily ban someone
- /tjail and mute, temporarily option added
Other changes:
- ban reason is saved
- don't show "You have xxx mail" on login, if user doesn't have essentials.mail permission
- time will be parsed: years, months (mo), weeks, days, hours, minutes (m), seconds, these can be shortened and combined, example: 2 days 5h 30m
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1300 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-01 21:07:30 +00:00
|
|
|
|
2011-04-04 02:58:41 +00:00
|
|
|
Block block = user.getWorld().getBlockAt(loc);
|
This is a big refactoring of the user class and more.
Many commands have been cleaned.
File changes:
- all user data has been moved from users.yml to userdata folder
- all files in userdata folder are lower case
Both changes should be done automatically.
Class changes:
- Moved all user data functions to UserData class
- Moved all user teleport functions to Teleport class
- Moved the user list to Essentials class
- Less static functions for better testing
- EssentialsCommand now has ess Property (Essentials class)
- New NotEnoughArgumentsException, that will show command description and syntax
New commands:
- /seen, shows the last login or logout
- /tempban, temporarily ban someone
- /tjail and mute, temporarily option added
Other changes:
- ban reason is saved
- don't show "You have xxx mail" on login, if user doesn't have essentials.mail permission
- time will be parsed: years, months (mo), weeks, days, hours, minutes (m), seconds, these can be shortened and combined, example: 2 days 5h 30m
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1300 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-01 21:07:30 +00:00
|
|
|
while (!(block.getType() == Material.AIR || block.getType() == Material.WATER || block.getType() == Material.STATIONARY_WATER))
|
2011-03-19 22:39:51 +00:00
|
|
|
{
|
|
|
|
loc.setY(loc.getY() + 1);
|
2011-04-04 02:58:41 +00:00
|
|
|
block = user.getWorld().getBlockAt(loc);
|
2011-03-19 22:39:51 +00:00
|
|
|
}
|
2011-06-27 09:46:57 +00:00
|
|
|
|
|
|
|
try
|
|
|
|
{
|
|
|
|
spawnedMob = mob.spawn(user, server, loc);
|
|
|
|
}
|
|
|
|
catch (MobException e)
|
|
|
|
{
|
|
|
|
user.sendMessage(Util.i18n("unableToSpawnMob"));
|
|
|
|
return;
|
|
|
|
}
|
This is a big refactoring of the user class and more.
Many commands have been cleaned.
File changes:
- all user data has been moved from users.yml to userdata folder
- all files in userdata folder are lower case
Both changes should be done automatically.
Class changes:
- Moved all user data functions to UserData class
- Moved all user teleport functions to Teleport class
- Moved the user list to Essentials class
- Less static functions for better testing
- EssentialsCommand now has ess Property (Essentials class)
- New NotEnoughArgumentsException, that will show command description and syntax
New commands:
- /seen, shows the last login or logout
- /tempban, temporarily ban someone
- /tjail and mute, temporarily option added
Other changes:
- ban reason is saved
- don't show "You have xxx mail" on login, if user doesn't have essentials.mail permission
- time will be parsed: years, months (mo), weeks, days, hours, minutes (m), seconds, these can be shortened and combined, example: 2 days 5h 30m
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1300 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-01 21:07:30 +00:00
|
|
|
|
2011-04-04 02:58:41 +00:00
|
|
|
if (mountType != null)
|
2011-03-19 22:39:51 +00:00
|
|
|
{
|
2011-04-04 02:58:41 +00:00
|
|
|
mobMount = Mob.fromName(mountType);
|
|
|
|
if (mobMount == null)
|
2011-03-19 22:39:51 +00:00
|
|
|
{
|
2011-05-11 22:42:48 +00:00
|
|
|
user.sendMessage(Util.i18n("invalidMob"));
|
2011-03-19 22:39:51 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
try
|
|
|
|
{
|
2011-06-27 09:46:57 +00:00
|
|
|
spawnedMount = mobMount.spawn(user, server, loc);
|
2011-03-19 22:39:51 +00:00
|
|
|
}
|
|
|
|
catch (MobException e)
|
|
|
|
{
|
2011-05-11 22:42:48 +00:00
|
|
|
user.sendMessage(Util.i18n("unableToSpawnMob"));
|
2011-03-19 22:39:51 +00:00
|
|
|
return;
|
|
|
|
}
|
2011-06-23 12:10:27 +00:00
|
|
|
spawnedMob.setPassenger(spawnedMount);
|
2011-04-03 16:32:33 +00:00
|
|
|
}
|
This is a big refactoring of the user class and more.
Many commands have been cleaned.
File changes:
- all user data has been moved from users.yml to userdata folder
- all files in userdata folder are lower case
Both changes should be done automatically.
Class changes:
- Moved all user data functions to UserData class
- Moved all user teleport functions to Teleport class
- Moved the user list to Essentials class
- Less static functions for better testing
- EssentialsCommand now has ess Property (Essentials class)
- New NotEnoughArgumentsException, that will show command description and syntax
New commands:
- /seen, shows the last login or logout
- /tempban, temporarily ban someone
- /tjail and mute, temporarily option added
Other changes:
- ban reason is saved
- don't show "You have xxx mail" on login, if user doesn't have essentials.mail permission
- time will be parsed: years, months (mo), weeks, days, hours, minutes (m), seconds, these can be shortened and combined, example: 2 days 5h 30m
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1300 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-01 21:07:30 +00:00
|
|
|
if (mobData != null)
|
|
|
|
{
|
2011-04-04 02:58:41 +00:00
|
|
|
changeMobData(mob.name, spawnedMob, mobData, user);
|
2011-04-03 17:10:19 +00:00
|
|
|
}
|
This is a big refactoring of the user class and more.
Many commands have been cleaned.
File changes:
- all user data has been moved from users.yml to userdata folder
- all files in userdata folder are lower case
Both changes should be done automatically.
Class changes:
- Moved all user data functions to UserData class
- Moved all user teleport functions to Teleport class
- Moved the user list to Essentials class
- Less static functions for better testing
- EssentialsCommand now has ess Property (Essentials class)
- New NotEnoughArgumentsException, that will show command description and syntax
New commands:
- /seen, shows the last login or logout
- /tempban, temporarily ban someone
- /tjail and mute, temporarily option added
Other changes:
- ban reason is saved
- don't show "You have xxx mail" on login, if user doesn't have essentials.mail permission
- time will be parsed: years, months (mo), weeks, days, hours, minutes (m), seconds, these can be shortened and combined, example: 2 days 5h 30m
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1300 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-01 21:07:30 +00:00
|
|
|
if (spawnedMount != null && mountData != null)
|
|
|
|
{
|
2011-04-04 02:58:41 +00:00
|
|
|
changeMobData(mobMount.name, spawnedMount, mountData, user);
|
2011-04-03 17:10:19 +00:00
|
|
|
}
|
2011-03-19 22:39:51 +00:00
|
|
|
if (args.length == 2)
|
|
|
|
{
|
|
|
|
int mobCount = Integer.parseInt(args[1]);
|
This is a big refactoring of the user class and more.
Many commands have been cleaned.
File changes:
- all user data has been moved from users.yml to userdata folder
- all files in userdata folder are lower case
Both changes should be done automatically.
Class changes:
- Moved all user data functions to UserData class
- Moved all user teleport functions to Teleport class
- Moved the user list to Essentials class
- Less static functions for better testing
- EssentialsCommand now has ess Property (Essentials class)
- New NotEnoughArgumentsException, that will show command description and syntax
New commands:
- /seen, shows the last login or logout
- /tempban, temporarily ban someone
- /tjail and mute, temporarily option added
Other changes:
- ban reason is saved
- don't show "You have xxx mail" on login, if user doesn't have essentials.mail permission
- time will be parsed: years, months (mo), weeks, days, hours, minutes (m), seconds, these can be shortened and combined, example: 2 days 5h 30m
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1300 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-01 21:07:30 +00:00
|
|
|
int serverLimit = ess.getSettings().getSpawnMobLimit();
|
|
|
|
if (mobCount > serverLimit)
|
2011-03-19 22:39:51 +00:00
|
|
|
{
|
|
|
|
mobCount = serverLimit;
|
2011-05-11 22:42:48 +00:00
|
|
|
user.sendMessage(Util.i18n("mobSpawnLimit"));
|
2011-03-19 22:39:51 +00:00
|
|
|
}
|
This is a big refactoring of the user class and more.
Many commands have been cleaned.
File changes:
- all user data has been moved from users.yml to userdata folder
- all files in userdata folder are lower case
Both changes should be done automatically.
Class changes:
- Moved all user data functions to UserData class
- Moved all user teleport functions to Teleport class
- Moved the user list to Essentials class
- Less static functions for better testing
- EssentialsCommand now has ess Property (Essentials class)
- New NotEnoughArgumentsException, that will show command description and syntax
New commands:
- /seen, shows the last login or logout
- /tempban, temporarily ban someone
- /tjail and mute, temporarily option added
Other changes:
- ban reason is saved
- don't show "You have xxx mail" on login, if user doesn't have essentials.mail permission
- time will be parsed: years, months (mo), weeks, days, hours, minutes (m), seconds, these can be shortened and combined, example: 2 days 5h 30m
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1300 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-01 21:07:30 +00:00
|
|
|
|
2011-03-19 22:39:51 +00:00
|
|
|
try
|
|
|
|
{
|
|
|
|
for (int i = 1; i < mobCount; i++)
|
|
|
|
{
|
2011-06-27 09:46:57 +00:00
|
|
|
spawnedMob = mob.spawn(user, server, loc);
|
2011-04-04 02:58:41 +00:00
|
|
|
if (mobMount != null)
|
2011-03-19 22:39:51 +00:00
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
2011-06-27 09:46:57 +00:00
|
|
|
spawnedMount = mobMount.spawn(user, server, loc);
|
2011-03-19 22:39:51 +00:00
|
|
|
}
|
|
|
|
catch (MobException e)
|
|
|
|
{
|
2011-05-11 22:42:48 +00:00
|
|
|
user.sendMessage(Util.i18n("unableToSpawnMob"));
|
2011-03-19 22:39:51 +00:00
|
|
|
return;
|
|
|
|
}
|
2011-06-23 12:10:27 +00:00
|
|
|
spawnedMob.setPassenger(spawnedMount);
|
2011-04-04 02:58:41 +00:00
|
|
|
}
|
This is a big refactoring of the user class and more.
Many commands have been cleaned.
File changes:
- all user data has been moved from users.yml to userdata folder
- all files in userdata folder are lower case
Both changes should be done automatically.
Class changes:
- Moved all user data functions to UserData class
- Moved all user teleport functions to Teleport class
- Moved the user list to Essentials class
- Less static functions for better testing
- EssentialsCommand now has ess Property (Essentials class)
- New NotEnoughArgumentsException, that will show command description and syntax
New commands:
- /seen, shows the last login or logout
- /tempban, temporarily ban someone
- /tjail and mute, temporarily option added
Other changes:
- ban reason is saved
- don't show "You have xxx mail" on login, if user doesn't have essentials.mail permission
- time will be parsed: years, months (mo), weeks, days, hours, minutes (m), seconds, these can be shortened and combined, example: 2 days 5h 30m
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1300 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-01 21:07:30 +00:00
|
|
|
if (mobData != null)
|
|
|
|
{
|
2011-04-04 02:58:41 +00:00
|
|
|
changeMobData(mob.name, spawnedMob, mobData, user);
|
|
|
|
}
|
This is a big refactoring of the user class and more.
Many commands have been cleaned.
File changes:
- all user data has been moved from users.yml to userdata folder
- all files in userdata folder are lower case
Both changes should be done automatically.
Class changes:
- Moved all user data functions to UserData class
- Moved all user teleport functions to Teleport class
- Moved the user list to Essentials class
- Less static functions for better testing
- EssentialsCommand now has ess Property (Essentials class)
- New NotEnoughArgumentsException, that will show command description and syntax
New commands:
- /seen, shows the last login or logout
- /tempban, temporarily ban someone
- /tjail and mute, temporarily option added
Other changes:
- ban reason is saved
- don't show "You have xxx mail" on login, if user doesn't have essentials.mail permission
- time will be parsed: years, months (mo), weeks, days, hours, minutes (m), seconds, these can be shortened and combined, example: 2 days 5h 30m
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1300 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-01 21:07:30 +00:00
|
|
|
if (spawnedMount != null && mountData != null)
|
|
|
|
{
|
2011-04-04 02:58:41 +00:00
|
|
|
changeMobData(mobMount.name, spawnedMount, mountData, user);
|
2011-03-19 22:39:51 +00:00
|
|
|
}
|
|
|
|
}
|
2011-06-27 09:46:57 +00:00
|
|
|
user.sendMessage(args[1] + " " + mob.name.toLowerCase() + mob.suffix + Util.i18n("spawned"));
|
2011-03-19 22:39:51 +00:00
|
|
|
}
|
|
|
|
catch (MobException e1)
|
|
|
|
{
|
2011-06-01 10:40:12 +00:00
|
|
|
throw new Exception(Util.i18n("unableToSpawnMob"), e1);
|
2011-03-19 22:39:51 +00:00
|
|
|
}
|
|
|
|
catch (NumberFormatException e2)
|
|
|
|
{
|
2011-06-01 10:40:12 +00:00
|
|
|
throw new Exception(Util.i18n("numberRequired"), e2);
|
2011-03-19 22:39:51 +00:00
|
|
|
}
|
|
|
|
catch (NullPointerException np)
|
|
|
|
{
|
2011-06-01 10:40:12 +00:00
|
|
|
throw new Exception(Util.i18n("soloMob"), np);
|
2011-03-19 22:39:51 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2011-05-11 22:42:48 +00:00
|
|
|
user.sendMessage(mob.name + " " + Util.i18n("spawned"));
|
2011-03-19 22:39:51 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private String capitalCase(String s)
|
|
|
|
{
|
|
|
|
return s.toUpperCase().charAt(0) + s.toLowerCase().substring(1);
|
|
|
|
}
|
2011-04-04 02:58:41 +00:00
|
|
|
|
2011-06-23 12:10:27 +00:00
|
|
|
private void changeMobData(String type, Entity spawned, String data, User user) throws Exception
|
This is a big refactoring of the user class and more.
Many commands have been cleaned.
File changes:
- all user data has been moved from users.yml to userdata folder
- all files in userdata folder are lower case
Both changes should be done automatically.
Class changes:
- Moved all user data functions to UserData class
- Moved all user teleport functions to Teleport class
- Moved the user list to Essentials class
- Less static functions for better testing
- EssentialsCommand now has ess Property (Essentials class)
- New NotEnoughArgumentsException, that will show command description and syntax
New commands:
- /seen, shows the last login or logout
- /tempban, temporarily ban someone
- /tjail and mute, temporarily option added
Other changes:
- ban reason is saved
- don't show "You have xxx mail" on login, if user doesn't have essentials.mail permission
- time will be parsed: years, months (mo), weeks, days, hours, minutes (m), seconds, these can be shortened and combined, example: 2 days 5h 30m
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1300 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-01 21:07:30 +00:00
|
|
|
{
|
|
|
|
if ("Slime".equalsIgnoreCase(type))
|
|
|
|
{
|
2011-04-04 02:58:41 +00:00
|
|
|
try
|
|
|
|
{
|
|
|
|
((CraftSlime)spawned).setSize(Integer.parseInt(data));
|
|
|
|
}
|
|
|
|
catch (Exception e)
|
|
|
|
{
|
2011-06-01 10:40:12 +00:00
|
|
|
throw new Exception(Util.i18n("slimeMalformedSize"), e);
|
2011-04-04 02:58:41 +00:00
|
|
|
}
|
|
|
|
}
|
This is a big refactoring of the user class and more.
Many commands have been cleaned.
File changes:
- all user data has been moved from users.yml to userdata folder
- all files in userdata folder are lower case
Both changes should be done automatically.
Class changes:
- Moved all user data functions to UserData class
- Moved all user teleport functions to Teleport class
- Moved the user list to Essentials class
- Less static functions for better testing
- EssentialsCommand now has ess Property (Essentials class)
- New NotEnoughArgumentsException, that will show command description and syntax
New commands:
- /seen, shows the last login or logout
- /tempban, temporarily ban someone
- /tjail and mute, temporarily option added
Other changes:
- ban reason is saved
- don't show "You have xxx mail" on login, if user doesn't have essentials.mail permission
- time will be parsed: years, months (mo), weeks, days, hours, minutes (m), seconds, these can be shortened and combined, example: 2 days 5h 30m
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1300 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-01 21:07:30 +00:00
|
|
|
if ("Sheep".equalsIgnoreCase(type))
|
|
|
|
{
|
2011-04-04 02:58:41 +00:00
|
|
|
try
|
|
|
|
{
|
|
|
|
((CraftSheep)spawned).setColor(DyeColor.valueOf(data.toUpperCase()));
|
|
|
|
}
|
|
|
|
catch (Exception e)
|
|
|
|
{
|
2011-06-01 10:40:12 +00:00
|
|
|
throw new Exception(Util.i18n("sheepMalformedColor"), e);
|
2011-04-04 02:58:41 +00:00
|
|
|
}
|
|
|
|
}
|
This is a big refactoring of the user class and more.
Many commands have been cleaned.
File changes:
- all user data has been moved from users.yml to userdata folder
- all files in userdata folder are lower case
Both changes should be done automatically.
Class changes:
- Moved all user data functions to UserData class
- Moved all user teleport functions to Teleport class
- Moved the user list to Essentials class
- Less static functions for better testing
- EssentialsCommand now has ess Property (Essentials class)
- New NotEnoughArgumentsException, that will show command description and syntax
New commands:
- /seen, shows the last login or logout
- /tempban, temporarily ban someone
- /tjail and mute, temporarily option added
Other changes:
- ban reason is saved
- don't show "You have xxx mail" on login, if user doesn't have essentials.mail permission
- time will be parsed: years, months (mo), weeks, days, hours, minutes (m), seconds, these can be shortened and combined, example: 2 days 5h 30m
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1300 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-01 21:07:30 +00:00
|
|
|
if ("Wolf".equalsIgnoreCase(type) && data.equalsIgnoreCase("tamed"))
|
|
|
|
{
|
|
|
|
EntityWolf wolf = ((CraftWolf)spawned).getHandle();
|
2011-04-04 02:58:41 +00:00
|
|
|
wolf.d(true);
|
This is a big refactoring of the user class and more.
Many commands have been cleaned.
File changes:
- all user data has been moved from users.yml to userdata folder
- all files in userdata folder are lower case
Both changes should be done automatically.
Class changes:
- Moved all user data functions to UserData class
- Moved all user teleport functions to Teleport class
- Moved the user list to Essentials class
- Less static functions for better testing
- EssentialsCommand now has ess Property (Essentials class)
- New NotEnoughArgumentsException, that will show command description and syntax
New commands:
- /seen, shows the last login or logout
- /tempban, temporarily ban someone
- /tjail and mute, temporarily option added
Other changes:
- ban reason is saved
- don't show "You have xxx mail" on login, if user doesn't have essentials.mail permission
- time will be parsed: years, months (mo), weeks, days, hours, minutes (m), seconds, these can be shortened and combined, example: 2 days 5h 30m
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1300 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-01 21:07:30 +00:00
|
|
|
wolf.a((PathEntity)null);
|
2011-04-21 09:45:59 +00:00
|
|
|
wolf.setSitting(true);
|
2011-04-04 02:58:41 +00:00
|
|
|
wolf.health = 20;
|
|
|
|
wolf.a(user.getName());
|
This is a big refactoring of the user class and more.
Many commands have been cleaned.
File changes:
- all user data has been moved from users.yml to userdata folder
- all files in userdata folder are lower case
Both changes should be done automatically.
Class changes:
- Moved all user data functions to UserData class
- Moved all user teleport functions to Teleport class
- Moved the user list to Essentials class
- Less static functions for better testing
- EssentialsCommand now has ess Property (Essentials class)
- New NotEnoughArgumentsException, that will show command description and syntax
New commands:
- /seen, shows the last login or logout
- /tempban, temporarily ban someone
- /tjail and mute, temporarily option added
Other changes:
- ban reason is saved
- don't show "You have xxx mail" on login, if user doesn't have essentials.mail permission
- time will be parsed: years, months (mo), weeks, days, hours, minutes (m), seconds, these can be shortened and combined, example: 2 days 5h 30m
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1300 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-01 21:07:30 +00:00
|
|
|
wolf.world.a(wolf, (byte)7);
|
2011-04-04 02:58:41 +00:00
|
|
|
}
|
This is a big refactoring of the user class and more.
Many commands have been cleaned.
File changes:
- all user data has been moved from users.yml to userdata folder
- all files in userdata folder are lower case
Both changes should be done automatically.
Class changes:
- Moved all user data functions to UserData class
- Moved all user teleport functions to Teleport class
- Moved the user list to Essentials class
- Less static functions for better testing
- EssentialsCommand now has ess Property (Essentials class)
- New NotEnoughArgumentsException, that will show command description and syntax
New commands:
- /seen, shows the last login or logout
- /tempban, temporarily ban someone
- /tjail and mute, temporarily option added
Other changes:
- ban reason is saved
- don't show "You have xxx mail" on login, if user doesn't have essentials.mail permission
- time will be parsed: years, months (mo), weeks, days, hours, minutes (m), seconds, these can be shortened and combined, example: 2 days 5h 30m
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1300 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-01 21:07:30 +00:00
|
|
|
if ("Wolf".equalsIgnoreCase(type) && data.equalsIgnoreCase("angry"))
|
|
|
|
{
|
2011-04-04 02:58:41 +00:00
|
|
|
((CraftWolf)spawned).setAngry(true);
|
|
|
|
}
|
2011-04-21 17:03:44 +00:00
|
|
|
if ("Creeper".equalsIgnoreCase(type) && data.equalsIgnoreCase("powered")) {
|
|
|
|
((CraftCreeper)spawned).setPowered(true);
|
|
|
|
}
|
2011-04-04 02:58:41 +00:00
|
|
|
}
|
2011-03-19 22:39:51 +00:00
|
|
|
}
|