Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>com.modnmetl</groupId>
<artifactId>virtualrealty</artifactId>
<version>2.2.3</version>
<version>2.2.4</version>
<packaging>jar</packaging>

<description>A plot creation and management plugin for Minecraft</description>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;

import java.util.*;

Expand Down Expand Up @@ -105,12 +106,44 @@ public void exec(CommandSender sender, Command command, String label, String[] a
(byte) 0);
}
}
int additionalDays = Integer.parseInt(args[7-backwardArgs]);
int itemsAmount = Integer.parseInt(args[8-backwardArgs]);
int additionalDays;
try {
additionalDays = Integer.parseInt(args[7-backwardArgs]);
} catch (NumberFormatException e) {
sender.sendMessage(VirtualRealty.PREFIX + VirtualRealty.getMessages().incorrectValue);
return;
}
if (additionalDays < 0) {
sender.sendMessage(VirtualRealty.PREFIX + VirtualRealty.getMessages().incorrectValue);
return;
}
int itemsAmount;
try {
itemsAmount = Integer.parseInt(args[8-backwardArgs]);
} catch (NumberFormatException e) {
sender.sendMessage(VirtualRealty.PREFIX + VirtualRealty.getMessages().incorrectValue);
return;
}
if (itemsAmount < 1) {
sender.sendMessage(VirtualRealty.PREFIX + VirtualRealty.getMessages().incorrectValue);
return;
}
Player onlinePlayer = Bukkit.getPlayer(args[9-backwardArgs]);
if (onlinePlayer == null) {
sender.sendMessage(VirtualRealty.PREFIX + VirtualRealty.getMessages().playerNotFoundWithUsername);
return;
}
for (int i = 0; i < itemsAmount; i++) {
PlotItem plotItem = new PlotItem(VItem.CLAIM, plotSize, length, height, width, floorData, borderData, isNatural, additionalDays, UUID.randomUUID());
onlinePlayer.getInventory().addItem(plotItem.getItemStack());
ItemStack itemStack = plotItem.getItemStack();
onlinePlayer.getInventory().addItem(itemStack);
if (onlinePlayer.getInventory().contains(itemStack)) {
sender.sendMessage(VirtualRealty.PREFIX + "§aPlot item has been assigned to " + onlinePlayer.getName() + " by " + (sender.getName()) + "!");
onlinePlayer.sendMessage(VirtualRealty.PREFIX + "§aYou received a plot item from " + (sender.getName()) + "!");
} else {
sender.sendMessage(VirtualRealty.PREFIX + "§c" + onlinePlayer.getName() + " has no inventory space to receive plot item!");
onlinePlayer.sendMessage(VirtualRealty.PREFIX + "§cNo inventory space to receive plot item from " + (sender.getName()) + "!");
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public class MessagesConfiguration extends OkaeriConfig {
public String insufficientPermissions = "§cInsufficient permissions! §8(§7%permission%§8)";
public String useNaturalNumbersOnly = "§cUse only natural numbers!";
public String incorrectGamemode = "§cIncorrect gamemode value!";
public String incorrectValue = "§cIncorrect value!";
public String sizeNotRecognised = "§cSize not recognized!";
public String hardLimit = "§cL, W and H hard-limit is 500!";
public String graterThenZero = "§cL, W and H values must be greater than 0!";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -729,6 +729,7 @@ public void onEntityDamage(EntityDamageByEntityEvent e) {
public void onStaticEntityDamage(EntityDamageByEntityEvent e) {
if (e.isCancelled()) return;
if (e.getEntity() instanceof Creature || e.getEntity() instanceof Player) return;
if (!(e.getDamager() instanceof Player)) return;
Player player = (Player) e.getDamager();
Plot plot = PlotManager.getPlot(e.getEntity().getLocation());
if (plot == null) return;
Expand Down