Typo, number formats, better interact cancelling on island

This commit is contained in:
Esophose 2019-06-04 04:58:38 -06:00
parent 481099b65a
commit b3001dc18d
3 changed files with 21 additions and 15 deletions

View File

@ -8,6 +8,7 @@ import org.bukkit.GameMode;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Beacon;
import org.bukkit.block.CreatureSpawner;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.entity.ArmorStand;
import org.bukkit.entity.EntityType;
@ -24,6 +25,7 @@ import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.vehicle.VehicleDamageEvent;
import org.bukkit.event.vehicle.VehicleDestroyEvent;
import org.bukkit.inventory.EquipmentSlot;
import org.bukkit.inventory.InventoryHolder;
import org.bukkit.inventory.ItemStack;
import me.goodandevil.skyblock.SkyBlock;
@ -76,7 +78,7 @@ public class Interact implements Listener {
return;
}
} else if (block.getState() instanceof Beacon) {
} else if (block.getState() instanceof Beacon) { // ChunkCollectors support
if (!islandManager.hasPermission(player, block.getLocation(), "Beacon")) {
event.setCancelled(true);
@ -85,6 +87,17 @@ public class Interact implements Listener {
.getFileConfiguration().getString("Island.Settings.Permission.Message"));
soundManager.playSound(player, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F);
return;
}
} else if (block.getState() instanceof InventoryHolder || block.getState() instanceof CreatureSpawner) { // EpicHoppers/EpicSpawners support
if (!islandManager.hasPermission(player, block.getLocation(), "Storage")) {
event.setCancelled(true);
messageManager.sendMessage(player,
skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml"))
.getFileConfiguration().getString("Island.Settings.Permission.Message"));
soundManager.playSound(player, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F);
return;
}
}

View File

@ -11,28 +11,21 @@ public final class NumberUtil {
}
public static String formatNumberByDecimal(double number) {
DecimalFormat decimalFormat = new DecimalFormat("0.#");
String withoutDecimal = decimalFormat.format(number), withDecimal = "";
String withoutDecimal = new DecimalFormat("0.#").format(number).replace(",", "."), withDecimal = "";
if (decimalFormat.getDecimalFormatSymbols().getDigit() == '.') {
if (withoutDecimal.contains(".")) {
withDecimal = "." + withoutDecimal.split("\\.")[1];
withoutDecimal = withoutDecimal.replace(withDecimal, "");
}
} else if (decimalFormat.getDecimalFormatSymbols().getDigit() == ',') {
if (withoutDecimal.contains(",")) {
withDecimal = "," + withoutDecimal.split(",")[1];
withoutDecimal = withoutDecimal.replace(withDecimal, "");
}
if (withoutDecimal.contains(".")) {
withDecimal = "." + withoutDecimal.split("\\.")[1];
withoutDecimal = withoutDecimal.replace(withDecimal, "");
}
if (withDecimal.equals(".0") || withDecimal.equals(",0")) {
if (withDecimal.equals(".0")) {
withDecimal = "";
}
long itemCostWithoutDecimalValue = Long.valueOf(withoutDecimal);
return formatNumber(itemCostWithoutDecimalValue) + withDecimal;
}
public static String formatNumberBySuffix(long number) {

View File

@ -2360,7 +2360,7 @@ Menu:
- '&7Safety&8: %safety'
Enabled:
Lore:
- '&7Owner&8: &f%mwner'
- '&7Owner&8: &f%owner'
- ''
- '&7Signature&8:'
- '%signature'