mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-07-22 21:43:41 +00: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:
parent
011fc09b4f
commit
5ae48481bd
28 changed files with 208 additions and 117 deletions
|
@ -1,5 +1,6 @@
|
|||
package com.earth2me.essentials.commands;
|
||||
|
||||
import com.earth2me.essentials.Charge;
|
||||
import org.bukkit.Server;
|
||||
import com.earth2me.essentials.User;
|
||||
import com.earth2me.essentials.Util;
|
||||
|
@ -22,17 +23,25 @@ public class Commandtpaccept extends EssentialsCommand
|
|||
throw new Exception(Util.i18n("noPendingRequest"));
|
||||
}
|
||||
|
||||
user.canAfford(this);
|
||||
Charge charge = new Charge(this);
|
||||
if (user.isTeleportRequestHere())
|
||||
{
|
||||
charge.isAffordableFor(user);
|
||||
}
|
||||
else
|
||||
{
|
||||
charge.isAffordableFor(p);
|
||||
}
|
||||
user.sendMessage(Util.i18n("requestAccepted"));
|
||||
p.sendMessage(Util.i18n("requestAccepted"));
|
||||
|
||||
if (user.isTeleportRequestHere())
|
||||
{
|
||||
user.getTeleport().teleport(p, this.getName());
|
||||
user.getTeleport().teleport(p, charge);
|
||||
}
|
||||
else
|
||||
{
|
||||
p.getTeleport().teleport(user, this.getName());
|
||||
p.getTeleport().teleport(user, charge);
|
||||
}
|
||||
user.requestTeleport(null, false);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue