mirror of
https://github.com/essentials/Essentials.git
synced 2025-08-15 02:59:06 +02:00
Fixing the Testcases
This commit is contained in:
@@ -269,7 +269,7 @@ public class Teleport implements Runnable, ITeleport
|
||||
user.acquireReadLock();
|
||||
try
|
||||
{
|
||||
teleport(new Target(user.getData().getLastLocation()), chargeFor, TeleportCause.COMMAND);
|
||||
teleport(new Target(user.getData().getLastLocation().getBukkitLocation()), chargeFor, TeleportCause.COMMAND);
|
||||
}
|
||||
finally
|
||||
{
|
||||
@@ -282,7 +282,7 @@ public class Teleport implements Runnable, ITeleport
|
||||
user.acquireReadLock();
|
||||
try
|
||||
{
|
||||
now(new Target(user.getData().getLastLocation()), TeleportCause.COMMAND);
|
||||
now(new Target(user.getData().getLastLocation().getBukkitLocation()), TeleportCause.COMMAND);
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
@@ -36,9 +36,9 @@ public class Commandsethome extends EssentialsCommand
|
||||
user.acquireWriteLock();
|
||||
if (user.getData().getHomes() == null)
|
||||
{
|
||||
user.getData().setHomes(new HashMap<String, Location>());
|
||||
user.getData().setHomes(new HashMap<String, com.earth2me.essentials.storage.Location>());
|
||||
}
|
||||
user.getData().getHomes().put(args[0].toLowerCase(Locale.ENGLISH), user.getLocation());
|
||||
user.getData().getHomes().put(args[0].toLowerCase(Locale.ENGLISH), new com.earth2me.essentials.storage.Location(user.getLocation()));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -73,9 +73,9 @@ public class Commandsethome extends EssentialsCommand
|
||||
usersHome.acquireWriteLock();
|
||||
if (usersHome.getData().getHomes() == null)
|
||||
{
|
||||
usersHome.getData().setHomes(new HashMap<String, Location>());
|
||||
usersHome.getData().setHomes(new HashMap<String, com.earth2me.essentials.storage.Location>());
|
||||
}
|
||||
usersHome.getData().getHomes().put(name, user.getLocation());
|
||||
usersHome.getData().getHomes().put(name, new com.earth2me.essentials.storage.Location(user.getLocation()));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -84,9 +84,9 @@ public class Commandsethome extends EssentialsCommand
|
||||
user.acquireWriteLock();
|
||||
if (user.getData().getHomes() == null)
|
||||
{
|
||||
user.getData().setHomes(new HashMap<String, Location>());
|
||||
user.getData().setHomes(new HashMap<String, com.earth2me.essentials.storage.Location>());
|
||||
}
|
||||
user.getData().getHomes().put("home", user.getLocation());
|
||||
user.getData().getHomes().put("home", new com.earth2me.essentials.storage.Location(user.getLocation()));
|
||||
}
|
||||
user.sendMessage(_("homeSet"));
|
||||
|
||||
|
@@ -190,7 +190,7 @@ public class User extends UserBase implements IUser
|
||||
acquireWriteLock();
|
||||
try
|
||||
{
|
||||
getData().setLastLocation(getLocation());
|
||||
getData().setLastLocation(new com.earth2me.essentials.storage.Location(getLocation()));
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
@@ -243,13 +243,13 @@ public abstract class UserBase extends AsyncStorageObjectHolder<UserData> implem
|
||||
acquireWriteLock();
|
||||
try
|
||||
{
|
||||
Map<String, Location> homes = getData().getHomes();
|
||||
Map<String, com.earth2me.essentials.storage.Location> homes = getData().getHomes();
|
||||
if (homes == null)
|
||||
{
|
||||
homes = new HashMap<String, Location>();
|
||||
homes = new HashMap<String, com.earth2me.essentials.storage.Location>();
|
||||
getData().setHomes(homes);
|
||||
}
|
||||
homes.put(Util.sanitizeKey(name), loc);
|
||||
homes.put(Util.sanitizeKey(name), new com.earth2me.essentials.storage.Location(loc));
|
||||
}
|
||||
finally
|
||||
{
|
||||
@@ -417,10 +417,17 @@ public abstract class UserBase extends AsyncStorageObjectHolder<UserData> implem
|
||||
return null;
|
||||
}
|
||||
ArrayList<Location> worldHomes = new ArrayList<Location>();
|
||||
for (Location location : getData().getHomes().values())
|
||||
for (com.earth2me.essentials.storage.Location location : getData().getHomes().values())
|
||||
{
|
||||
if (location.getWorld().equals(loc.getWorld())) {
|
||||
worldHomes.add(location);
|
||||
if (location.getWorldName().equals(loc.getWorld().getName())) {
|
||||
try
|
||||
{
|
||||
worldHomes.add(location.getBukkitLocation());
|
||||
}
|
||||
catch (WorldNotLoadedException ex)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (worldHomes.isEmpty()) {
|
||||
|
@@ -1,13 +1,9 @@
|
||||
package com.earth2me.essentials.user;
|
||||
|
||||
import com.earth2me.essentials.storage.ListType;
|
||||
import com.earth2me.essentials.storage.MapKeyType;
|
||||
import com.earth2me.essentials.storage.MapValueType;
|
||||
import com.earth2me.essentials.storage.StorageObject;
|
||||
import com.earth2me.essentials.storage.*;
|
||||
import java.util.*;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
|
||||
|
||||
|
@@ -98,7 +98,7 @@ public class StorageTest extends TestCase
|
||||
|
||||
for (int j = 0; j < 10000; j++)
|
||||
{
|
||||
userdata.getHomes().put("home", new Location(world, j, j, j));
|
||||
userdata.getHomes().put("home", new com.earth2me.essentials.storage.Location(new Location(world, j, j, j)));
|
||||
}
|
||||
ext.mark("change home 10000 times");
|
||||
final ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
|
Reference in New Issue
Block a user