Renamed the Charge class to Trade

This commit is contained in:
snowleo 2011-06-13 15:05:11 +02:00
parent adc7502115
commit fd2d2456b9
15 changed files with 34 additions and 34 deletions

View file

@ -181,7 +181,7 @@ public class EssentialsPlayerListener extends PlayerListener
event.setTo(loc); event.setTo(loc);
try try
{ {
user.getTeleport().now(loc, new Charge("portal", ess)); user.getTeleport().now(loc, new Trade("portal", ess));
} }
catch (Exception ex) catch (Exception ex)
{ {
@ -474,13 +474,13 @@ public class EssentialsPlayerListener extends PlayerListener
{ {
if (sign.getLine(2).equals("§2Everyone")) if (sign.getLine(2).equals("§2Everyone"))
{ {
Charge charge = chargeUserForWarp(sign, user); Trade charge = chargeUserForWarp(sign, user);
user.getTeleport().warp(sign.getLine(1), charge); user.getTeleport().warp(sign.getLine(1), charge);
return; return;
} }
if (user.inGroup(sign.getLine(2))) if (user.inGroup(sign.getLine(2)))
{ {
Charge charge = chargeUserForWarp(sign, user); Trade charge = chargeUserForWarp(sign, user);
user.getTeleport().warp(sign.getLine(1), charge); user.getTeleport().warp(sign.getLine(1), charge);
return; return;
} }
@ -488,7 +488,7 @@ public class EssentialsPlayerListener extends PlayerListener
if (user.isAuthorized("essentials.signs.warp.use") if (user.isAuthorized("essentials.signs.warp.use")
&& (!ess.getSettings().getPerWarpPermission() || user.isAuthorized("essentials.warp." + sign.getLine(1)))) && (!ess.getSettings().getPerWarpPermission() || user.isAuthorized("essentials.warp." + sign.getLine(1))))
{ {
Charge charge = chargeUserForWarp(sign, user); Trade charge = chargeUserForWarp(sign, user);
user.getTeleport().warp(sign.getLine(1), charge); user.getTeleport().warp(sign.getLine(1), charge);
} }
return; return;
@ -520,7 +520,7 @@ public class EssentialsPlayerListener extends PlayerListener
} }
} }
private Charge chargeUserForWarp(Sign sign, User user) throws Exception private Trade chargeUserForWarp(Sign sign, User user) throws Exception
{ {
if (!sign.getLine(3).isEmpty()) if (!sign.getLine(3).isEmpty())
{ {
@ -533,15 +533,15 @@ public class EssentialsPlayerListener extends PlayerListener
} }
if (m1) if (m1)
{ {
return new Charge(q1, ess); return new Trade(q1, ess);
} }
else else
{ {
ItemStack i = ItemDb.get(l1[1], (int)q1); ItemStack i = ItemDb.get(l1[1], (int)q1);
return new Charge(i, ess); return new Trade(i, ess);
} }
} }
return new Charge("warpsign", ess); return new Trade("warpsign", ess);
} }
@Override @Override

View file

@ -1,6 +1,6 @@
package com.earth2me.essentials.commands; package com.earth2me.essentials.commands;
import com.earth2me.essentials.Charge; import com.earth2me.essentials.Trade;
import com.earth2me.essentials.User; import com.earth2me.essentials.User;
import com.earth2me.essentials.Util; import com.earth2me.essentials.Util;
import org.bukkit.Server; import org.bukkit.Server;
@ -16,7 +16,7 @@ public class Commandback extends EssentialsCommand
@Override @Override
protected void run(Server server, User user, String commandLabel, String[] args) throws Exception protected void run(Server server, User user, String commandLabel, String[] args) throws Exception
{ {
Charge charge = new Charge(this.getName(), ess); Trade charge = new Trade(this.getName(), ess);
charge.isAffordableFor(user); charge.isAffordableFor(user);
user.sendMessage(Util.i18n("backUsageMsg")); user.sendMessage(Util.i18n("backUsageMsg"));
user.getTeleport().back(charge); user.getTeleport().back(charge);

View file

@ -1,6 +1,6 @@
package com.earth2me.essentials.commands; package com.earth2me.essentials.commands;
import com.earth2me.essentials.Charge; import com.earth2me.essentials.Trade;
import org.bukkit.Server; import org.bukkit.Server;
import com.earth2me.essentials.User; import com.earth2me.essentials.User;
import com.earth2me.essentials.Util; import com.earth2me.essentials.Util;
@ -16,7 +16,7 @@ public class Commandhome extends EssentialsCommand
@Override @Override
public void run(Server server, User user, String commandLabel, String[] args) throws Exception public void run(Server server, User user, String commandLabel, String[] args) throws Exception
{ {
Charge charge = new Charge(this.getName(), ess); Trade charge = new Trade(this.getName(), ess);
charge.isAffordableFor(user); charge.isAffordableFor(user);
if(args.length > 0 && user.isAuthorized("essentials.home.others")) if(args.length > 0 && user.isAuthorized("essentials.home.others"))
{ {

View file

@ -1,6 +1,6 @@
package com.earth2me.essentials.commands; package com.earth2me.essentials.commands;
import com.earth2me.essentials.Charge; import com.earth2me.essentials.Trade;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Server; import org.bukkit.Server;
import com.earth2me.essentials.TargetBlock; import com.earth2me.essentials.TargetBlock;
@ -36,7 +36,7 @@ public class Commandjump extends EssentialsCommand
throw new Exception(Util.i18n("jumpError"), ex); throw new Exception(Util.i18n("jumpError"), ex);
} }
Charge charge = new Charge(this.getName(), ess); Trade charge = new Trade(this.getName(), ess);
charge.isAffordableFor(user); charge.isAffordableFor(user);
user.getTeleport().teleport(loc, charge); user.getTeleport().teleport(loc, charge);
} }

View file

@ -1,6 +1,6 @@
package com.earth2me.essentials.commands; package com.earth2me.essentials.commands;
import com.earth2me.essentials.Charge; import com.earth2me.essentials.Trade;
import java.util.Calendar; import java.util.Calendar;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
@ -109,7 +109,7 @@ public class Commandkit extends EssentialsCommand
items = (List<String>)kit; items = (List<String>)kit;
} }
Charge charge = new Charge("kit-" + kitName, ess); Trade charge = new Trade("kit-" + kitName, ess);
try try
{ {
charge.isAffordableFor(user); charge.isAffordableFor(user);

View file

@ -1,6 +1,6 @@
package com.earth2me.essentials.commands; package com.earth2me.essentials.commands;
import com.earth2me.essentials.Charge; import com.earth2me.essentials.Trade;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Server; import org.bukkit.Server;
import com.earth2me.essentials.User; import com.earth2me.essentials.User;
@ -21,7 +21,7 @@ public class Commandtop extends EssentialsCommand
int topZ = user.getLocation().getBlockZ(); int topZ = user.getLocation().getBlockZ();
int topY = user.getWorld().getHighestBlockYAt(topX, topZ); int topY = user.getWorld().getHighestBlockYAt(topX, topZ);
charge(user); charge(user);
user.getTeleport().teleport(new Location(user.getWorld(), user.getLocation().getX(), topY + 1, user.getLocation().getZ()), new Charge(this.getName(), ess)); user.getTeleport().teleport(new Location(user.getWorld(), user.getLocation().getX(), topY + 1, user.getLocation().getZ()), new Trade(this.getName(), ess));
user.sendMessage(Util.i18n("teleportTop")); user.sendMessage(Util.i18n("teleportTop"));
} }
} }

View file

@ -1,6 +1,6 @@
package com.earth2me.essentials.commands; package com.earth2me.essentials.commands;
import com.earth2me.essentials.Charge; import com.earth2me.essentials.Trade;
import com.earth2me.essentials.Console; import com.earth2me.essentials.Console;
import org.bukkit.Server; import org.bukkit.Server;
import com.earth2me.essentials.User; import com.earth2me.essentials.User;
@ -30,7 +30,7 @@ public class Commandtp extends EssentialsCommand
throw new Exception(Util.format("teleportDisabled", p.getDisplayName())); throw new Exception(Util.format("teleportDisabled", p.getDisplayName()));
} }
user.sendMessage(Util.i18n("teleporting")); user.sendMessage(Util.i18n("teleporting"));
Charge charge = new Charge(this.getName(), ess); Trade charge = new Trade(this.getName(), ess);
charge.isAffordableFor(user); charge.isAffordableFor(user);
user.getTeleport().teleport(p, charge); user.getTeleport().teleport(p, charge);
break; break;

View file

@ -1,6 +1,6 @@
package com.earth2me.essentials.commands; package com.earth2me.essentials.commands;
import com.earth2me.essentials.Charge; import com.earth2me.essentials.Trade;
import org.bukkit.Server; import org.bukkit.Server;
import com.earth2me.essentials.User; import com.earth2me.essentials.User;
import com.earth2me.essentials.Util; import com.earth2me.essentials.Util;
@ -23,7 +23,7 @@ public class Commandtpaccept extends EssentialsCommand
throw new Exception(Util.i18n("noPendingRequest")); throw new Exception(Util.i18n("noPendingRequest"));
} }
Charge charge = new Charge(this.getName(), ess); Trade charge = new Trade(this.getName(), ess);
if (user.isTeleportRequestHere()) if (user.isTeleportRequestHere())
{ {
charge.isAffordableFor(user); charge.isAffordableFor(user);

View file

@ -1,6 +1,6 @@
package com.earth2me.essentials.commands; package com.earth2me.essentials.commands;
import com.earth2me.essentials.Charge; import com.earth2me.essentials.Trade;
import org.bukkit.Server; import org.bukkit.Server;
import com.earth2me.essentials.User; import com.earth2me.essentials.User;
import com.earth2me.essentials.Util; import com.earth2me.essentials.Util;
@ -21,7 +21,7 @@ public class Commandtphere extends EssentialsCommand
{ {
throw new Exception(Util.format("teleportDisabled", p.getDisplayName())); throw new Exception(Util.format("teleportDisabled", p.getDisplayName()));
} }
p.getTeleport().teleport(user, new Charge(this.getName(), ess)); p.getTeleport().teleport(user, new Trade(this.getName(), ess));
user.sendMessage(Util.i18n("teleporting")); user.sendMessage(Util.i18n("teleporting"));
p.sendMessage(Util.i18n("teleporting")); p.sendMessage(Util.i18n("teleporting"));
} }

View file

@ -1,6 +1,6 @@
package com.earth2me.essentials.commands; package com.earth2me.essentials.commands;
import com.earth2me.essentials.Charge; import com.earth2me.essentials.Trade;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Server; import org.bukkit.Server;
import com.earth2me.essentials.User; import com.earth2me.essentials.User;
@ -26,7 +26,7 @@ public class Commandtppos extends EssentialsCommand
int y = Integer.parseInt(args[1]); int y = Integer.parseInt(args[1]);
int z = Integer.parseInt(args[2]); int z = Integer.parseInt(args[2]);
Location l = new Location(user.getWorld(), x, y, z); Location l = new Location(user.getWorld(), x, y, z);
Charge charge = new Charge(this.getName(), ess); Trade charge = new Trade(this.getName(), ess);
charge.isAffordableFor(user); charge.isAffordableFor(user);
user.sendMessage(Util.i18n("teleporting")); user.sendMessage(Util.i18n("teleporting"));
user.getTeleport().teleport(l, charge); user.getTeleport().teleport(l, charge);

View file

@ -1,6 +1,6 @@
package com.earth2me.essentials.commands; package com.earth2me.essentials.commands;
import com.earth2me.essentials.Charge; import com.earth2me.essentials.Trade;
import org.bukkit.Server; import org.bukkit.Server;
import com.earth2me.essentials.User; import com.earth2me.essentials.User;
import com.earth2me.essentials.Util; import com.earth2me.essentials.Util;
@ -73,7 +73,7 @@ public class Commandwarp extends EssentialsCommand
private void warpUser(User user, String name) throws Exception private void warpUser(User user, String name) throws Exception
{ {
Charge charge = new Charge(this.getName(), ess); Trade charge = new Trade(this.getName(), ess);
charge.isAffordableFor(user); charge.isAffordableFor(user);
if (ess.getSettings().getPerWarpPermission()) if (ess.getSettings().getPerWarpPermission())
{ {

View file

@ -1,6 +1,6 @@
package com.earth2me.essentials.commands; package com.earth2me.essentials.commands;
import com.earth2me.essentials.Charge; import com.earth2me.essentials.Trade;
import java.util.List; import java.util.List;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Server; import org.bukkit.Server;
@ -68,7 +68,7 @@ public class Commandworld extends EssentialsCommand
Location loc = user.getLocation(); Location loc = user.getLocation();
loc = new Location(world, loc.getBlockX() * factor + .5, loc.getBlockY(), loc.getBlockZ() * factor + .5); loc = new Location(world, loc.getBlockX() * factor + .5, loc.getBlockY(), loc.getBlockZ() * factor + .5);
Charge charge = new Charge(this.getName(), ess); Trade charge = new Trade(this.getName(), ess);
charge.isAffordableFor(user); charge.isAffordableFor(user);
user.getTeleport().teleport(loc, charge); user.getTeleport().teleport(loc, charge);
} }

View file

@ -1,6 +1,6 @@
package com.earth2me.essentials.commands; package com.earth2me.essentials.commands;
import com.earth2me.essentials.Charge; import com.earth2me.essentials.Trade;
import java.util.List; import java.util.List;
import org.bukkit.Server; import org.bukkit.Server;
import org.bukkit.command.Command; import org.bukkit.command.Command;
@ -89,7 +89,7 @@ public abstract class EssentialsCommand implements IEssentialsCommand
{ {
if (sender instanceof Player) if (sender instanceof Player)
{ {
Charge charge = new Charge(this.getName(), ess); Trade charge = new Trade(this.getName(), ess);
charge.charge(ess.getUser((Player)sender)); charge.charge(ess.getUser((Player)sender));
} }
} }

View file

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