Reformat and clean up "client" package
This commit is contained in:
@@ -41,7 +41,7 @@ public class ItemDropCommand extends Command {
|
||||
@Override
|
||||
public void execute(Client c, String[] params) {
|
||||
Character player = c.getPlayer();
|
||||
|
||||
|
||||
if (params.length < 1) {
|
||||
player.yellowMessage("Syntax: !drop <itemid> <quantity>");
|
||||
return;
|
||||
@@ -50,13 +50,15 @@ public class ItemDropCommand extends Command {
|
||||
int itemId = Integer.parseInt(params[0]);
|
||||
ItemInformationProvider ii = ItemInformationProvider.getInstance();
|
||||
|
||||
if(ii.getName(itemId) == null) {
|
||||
if (ii.getName(itemId) == null) {
|
||||
player.yellowMessage("Item id '" + params[0] + "' does not exist.");
|
||||
return;
|
||||
}
|
||||
|
||||
short quantity = 1;
|
||||
if(params.length >= 2) quantity = Short.parseShort(params[1]);
|
||||
if (params.length >= 2) {
|
||||
quantity = Short.parseShort(params[1]);
|
||||
}
|
||||
|
||||
if (YamlConfig.config.server.BLOCK_GENERATE_CASH_ITEM && ii.isCash(itemId)) {
|
||||
player.yellowMessage("You cannot create a cash item with this command.");
|
||||
@@ -64,7 +66,7 @@ public class ItemDropCommand extends Command {
|
||||
}
|
||||
|
||||
if (ItemConstants.isPet(itemId)) {
|
||||
if (params.length >= 2){ // thanks to istreety & TacoBell
|
||||
if (params.length >= 2) { // thanks to istreety & TacoBell
|
||||
quantity = 1;
|
||||
long days = Math.max(1, Integer.parseInt(params[1]));
|
||||
long expiration = System.currentTimeMillis() + (days * 24 * 60 * 60 * 1000);
|
||||
@@ -74,12 +76,12 @@ public class ItemDropCommand extends Command {
|
||||
toDrop.setExpiration(expiration);
|
||||
|
||||
toDrop.setOwner("");
|
||||
if(player.gmLevel() < 3) {
|
||||
if (player.gmLevel() < 3) {
|
||||
short f = toDrop.getFlag();
|
||||
f |= ItemConstants.ACCOUNT_SHARING;
|
||||
f |= ItemConstants.UNTRADEABLE;
|
||||
f |= ItemConstants.SANDBOX;
|
||||
|
||||
|
||||
toDrop.setFlag(f);
|
||||
toDrop.setOwner("TRIAL-MODE");
|
||||
}
|
||||
@@ -89,10 +91,10 @@ public class ItemDropCommand extends Command {
|
||||
return;
|
||||
} else {
|
||||
player.yellowMessage("Pet Syntax: !drop <itemid> <expiration>");
|
||||
return;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Item toDrop;
|
||||
if (ItemConstants.getInventoryType(itemId) == InventoryType.EQUIP) {
|
||||
toDrop = ii.getEquipById(itemId);
|
||||
@@ -101,7 +103,7 @@ public class ItemDropCommand extends Command {
|
||||
}
|
||||
|
||||
toDrop.setOwner(player.getName());
|
||||
if(player.gmLevel() < 3) {
|
||||
if (player.gmLevel() < 3) {
|
||||
short f = toDrop.getFlag();
|
||||
f |= ItemConstants.ACCOUNT_SHARING;
|
||||
f |= ItemConstants.UNTRADEABLE;
|
||||
|
||||
Reference in New Issue
Block a user