1
0
mirror of https://github.com/essentials/Essentials.git synced 2025-08-25 15:41:21 +02:00

Refactoring: New Charge class

user.canAfford(String), user.canAfford(EssentialsCommand), user.charge(String), user.charge(EssentialsCommand) have been removed.
Teleport class has been changed to use the Charge class.
This also fixes some bugs, like the one with warp signs.

git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1512 e251c2fe-e539-e718-e476-b85c1f46cddb
This commit is contained in:
snowleo
2011-05-22 18:53:23 +00:00
parent 011fc09b4f
commit 5ae48481bd
28 changed files with 208 additions and 117 deletions

View File

@@ -17,7 +17,7 @@ public class Commandsetspawn extends EssentialsCommand
@Override
public void run(Server server, User user, String commandLabel, String[] args) throws Exception
{
user.charge(this);
charge(user);
String group = args.length > 0 ? getFinalArg(args, 0) : "default";
Essentials.getSpawn().setSpawn(user.getLocation(), group);
user.sendMessage(Util.format("spawnSet", group));

View File

@@ -1,5 +1,6 @@
package com.earth2me.essentials.spawn;
import com.earth2me.essentials.Charge;
import org.bukkit.Server;
import com.earth2me.essentials.Essentials;
import com.earth2me.essentials.User;
@@ -16,7 +17,8 @@ public class Commandspawn extends EssentialsCommand
@Override
public void run(Server server, User user, String commandLabel, String[] args) throws Exception
{
user.canAfford(this);
user.getTeleport().respawn(Essentials.getSpawn(), this.getName());
Charge charge = new Charge(this);
charge.isAffordableFor(user);
user.getTeleport().respawn(Essentials.getSpawn(), charge);
}
}