Skip to content

Commit 4eafc97

Browse files
committed
reduce duplicate code
1 parent 2f2717c commit 4eafc97

File tree

9 files changed

+0
-42
lines changed

9 files changed

+0
-42
lines changed

src/main/java/org/maxgamer/quickshop/command/subcommand/SubCommand_Buy.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,6 @@ public class SubCommand_Buy implements CommandHandler<Player> {
3939
public void onCommand(@NotNull Player sender, @NotNull String commandLabel, @NotNull String[] cmdArg) {
4040
BlockIterator bIt = new BlockIterator(sender, 10);
4141

42-
if (!bIt.hasNext()) {
43-
plugin.text().of(sender, "not-looking-at-shop").send();
44-
return;
45-
}
46-
4742
while (bIt.hasNext()) {
4843
final Block b = bIt.next();
4944
final Shop shop = plugin.getShopManager().getShop(b.getLocation());

src/main/java/org/maxgamer/quickshop/command/subcommand/SubCommand_Empty.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,6 @@ public class SubCommand_Empty implements CommandHandler<Player> {
3939
public void onCommand(@NotNull Player sender, @NotNull String commandLabel, @NotNull String[] cmdArg) {
4040
BlockIterator bIt = new BlockIterator(sender, 10);
4141

42-
if (!bIt.hasNext()) {
43-
plugin.text().of(sender, "not-looking-at-shop").send();
44-
return;
45-
}
46-
4742
while (bIt.hasNext()) {
4843
final Block b = bIt.next();
4944
final Shop shop = plugin.getShopManager().getShop(b.getLocation());

src/main/java/org/maxgamer/quickshop/command/subcommand/SubCommand_Item.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,6 @@ public class SubCommand_Item implements CommandHandler<Player> {
4242
public void onCommand(@NotNull Player sender, @NotNull String commandLabel, @NotNull String[] cmdArg) {
4343
BlockIterator bIt = new BlockIterator(sender, 10);
4444
// Loop through every block they're looking at upto 10 blocks away
45-
if (!bIt.hasNext()) {
46-
plugin.text().of(sender, "not-looking-at-shop").send();
47-
return;
48-
}
4945
while (bIt.hasNext()) {
5046
final Block b = bIt.next();
5147
final Shop shop = plugin.getShopManager().getShop(b.getLocation());

src/main/java/org/maxgamer/quickshop/command/subcommand/SubCommand_Remove.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,6 @@ public class SubCommand_Remove implements CommandHandler<Player> {
3838
public void onCommand(@NotNull Player sender, @NotNull String commandLabel, @NotNull String[] cmdArg) {
3939
BlockIterator bIt = new BlockIterator(sender, 10);
4040

41-
if (!bIt.hasNext()) {
42-
plugin.text().of(sender, "not-looking-at-shop").send();
43-
return;
44-
}
45-
4641
while (bIt.hasNext()) {
4742
final Block b = bIt.next();
4843
final Shop shop = plugin.getShopManager().getShop(b.getLocation());

src/main/java/org/maxgamer/quickshop/command/subcommand/SubCommand_Sell.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,6 @@ public class SubCommand_Sell implements CommandHandler<Player> {
3939
public void onCommand(@NotNull Player sender, @NotNull String commandLabel, @NotNull String[] cmdArg) {
4040
BlockIterator bIt = new BlockIterator(sender, 10);
4141

42-
if (!bIt.hasNext()) {
43-
plugin.text().of(sender, "not-looking-at-shop").send();
44-
return;
45-
}
46-
4742
while (bIt.hasNext()) {
4843
final Block b = bIt.next();
4944
final Shop shop = plugin.getShopManager().getShop(b.getLocation());

src/main/java/org/maxgamer/quickshop/command/subcommand/SubCommand_SetOwner.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,6 @@ public void onCommand(@NotNull Player sender, @NotNull String commandLabel, @Not
4949

5050
final BlockIterator bIt = new BlockIterator(sender, 10);
5151

52-
if (!bIt.hasNext()) {
53-
plugin.text().of(sender, "not-looking-at-shop").send();
54-
return;
55-
}
56-
5752
while (bIt.hasNext()) {
5853
final Block b = bIt.next();
5954
final Shop shop = plugin.getShopManager().getShop(b.getLocation());

src/main/java/org/maxgamer/quickshop/command/subcommand/SubCommand_Size.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,6 @@ public void onCommand(@NotNull Player sender, @NotNull String commandLabel, @Not
5656
}
5757
final BlockIterator bIt = new BlockIterator(sender, 10);
5858
// Loop through every block they're looking at upto 10 blocks away
59-
if (!bIt.hasNext()) {
60-
plugin.text().of(sender, "not-looking-at-shop").send();
61-
return;
62-
}
6359
while (bIt.hasNext()) {
6460
final Block b = bIt.next();
6561
final Shop shop = plugin.getShopManager().getShop(b.getLocation());

src/main/java/org/maxgamer/quickshop/command/subcommand/SubCommand_Staff.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,6 @@ public class SubCommand_Staff implements CommandHandler<Player> {
4949
@Override
5050
public void onCommand(@NotNull Player sender, @NotNull String commandLabel, @NotNull String[] cmdArg) {
5151
BlockIterator bIt = new BlockIterator(sender, 10);
52-
if (!bIt.hasNext()) {
53-
plugin.text().of(sender, "not-looking-at-shop").send();
54-
return;
55-
}
5652
while (bIt.hasNext()) {
5753
final Block b = bIt.next();
5854
final Shop shop = plugin.getShopManager().getShop(b.getLocation());

src/main/java/org/maxgamer/quickshop/command/subcommand/SubCommand_Unlimited.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,6 @@ public class SubCommand_Unlimited implements CommandHandler<Player> {
3838
public void onCommand(@NotNull Player sender, @NotNull String commandLabel, @NotNull String[] cmdArg) {
3939
BlockIterator bIt = new BlockIterator(sender, 10);
4040

41-
if (!bIt.hasNext()) {
42-
plugin.text().of(sender, "not-looking-at-shop").send();
43-
return;
44-
}
45-
4641
while (bIt.hasNext()) {
4742
final Block b = bIt.next();
4843
final Shop shop = plugin.getShopManager().getShop(b.getLocation());

0 commit comments

Comments
 (0)