i'm not like 95% sure what id id in these commits, but it works
This commit is contained in:
parent
a2935ad53d
commit
12170991be
6 changed files with 51 additions and 4 deletions
6
.idea/vcs.xml
generated
Normal file
6
.idea/vcs.xml
generated
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
|
|
@ -139,9 +139,11 @@ public final class Snowcore extends JavaPlugin {
|
|||
for (int z = minZ; z <= maxZ; z++) {
|
||||
for (int y = maxY; y >= minY; y--) {
|
||||
Block block = world.getBlockAt(x, y, z);
|
||||
Material type = block.getType();
|
||||
|
||||
// Only care about full snow blocks as the base
|
||||
if (block.getType() != Material.SNOW_BLOCK) continue;
|
||||
if (type != Material.STONE
|
||||
&& type != Material.TUFF
|
||||
&& type != Material.ANDESITE) continue;
|
||||
|
||||
Block above = world.getBlockAt(x, y + 1, z);
|
||||
Material aboveType = above.getType();
|
||||
|
|
@ -251,7 +253,7 @@ public final class Snowcore extends JavaPlugin {
|
|||
Snowcore.snowify(
|
||||
world,
|
||||
new Location(world, 39, 127, 157),
|
||||
new Location(world, 8, 139, 215)
|
||||
new Location(world, 8, 148, 215)
|
||||
);
|
||||
|
||||
Bukkit.broadcast(snowing);
|
||||
|
|
|
|||
|
|
@ -26,6 +26,33 @@ public class SellCommand implements BasicCommand {
|
|||
|
||||
@Override
|
||||
public void execute(CommandSourceStack source, String[] args) {
|
||||
if(args.length == 1 && args[0].equals("inv")) {
|
||||
Player player = (Player) Objects.requireNonNull(source.getExecutor());
|
||||
|
||||
var inv = player.getInventory();
|
||||
|
||||
double finalPrice = 0d;
|
||||
|
||||
for (int slot = 0; slot < 35; slot++) {
|
||||
ItemStack item = inv.getItem(slot);
|
||||
|
||||
if (item == null || item.getType().isAir()) continue;
|
||||
|
||||
boolean prices = Prices.hasSellPrice(item.getType());
|
||||
|
||||
if(prices) {
|
||||
double price = (Prices.getSellPrice(item.getType())/2) * item.getAmount();
|
||||
|
||||
finalPrice += price;
|
||||
|
||||
inv.setItem(slot, null);
|
||||
}
|
||||
}
|
||||
|
||||
Snowcore.econ.depositPlayer(player, finalPrice);
|
||||
player.sendMessage(Component.text("Sold items for §a" + finalPrice + "§r! §o§c-50% due to /sell inv being used.."));
|
||||
return;
|
||||
}
|
||||
AtomicBoolean sold = new AtomicBoolean(false);
|
||||
Gui gui = Gui.gui()
|
||||
.title(Component.text("Sell Items"))
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ public class SnowifyCommand implements BasicCommand {
|
|||
Snowcore.snowify(
|
||||
world,
|
||||
new Location(world, 39, 127, 157),
|
||||
new Location(world, 8, 139, 215)
|
||||
new Location(world, 8, 148, 215)
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package ovh.sad.snowcore.items;
|
|||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.minimessage.MiniMessage;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.inventory.ItemFlag;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
|
|
@ -87,6 +88,10 @@ public abstract class Tool<T extends Tool<T>> {
|
|||
definedAbilities.stream().filter(a -> a.byDefault).toList());
|
||||
|
||||
meta.setEnchantmentGlintOverride(true);
|
||||
meta.setUnbreakable(true);
|
||||
meta.addEnchant(Enchantment.EFFICIENCY, 3, false);
|
||||
meta.addItemFlags(ItemFlag.HIDE_UNBREAKABLE);
|
||||
meta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
|
||||
|
||||
item.setItemMeta(meta);
|
||||
return item;
|
||||
|
|
@ -133,6 +138,10 @@ public abstract class Tool<T extends Tool<T>> {
|
|||
meta.lore(lore);
|
||||
|
||||
meta.setEnchantmentGlintOverride(true);
|
||||
meta.setUnbreakable(true);
|
||||
meta.addEnchant(Enchantment.EFFICIENCY, 3, false);
|
||||
meta.addItemFlags(ItemFlag.HIDE_UNBREAKABLE);
|
||||
meta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
|
||||
|
||||
item.setItemMeta(meta);
|
||||
return item;
|
||||
|
|
|
|||
|
|
@ -204,6 +204,9 @@ public class InteractListener implements Listener {
|
|||
} else {
|
||||
name = Component.text(def.type.name, NamedTextColor.YELLOW);
|
||||
lore.add(Component.text("Cost: " + (int) def.baseCost + "$", NamedTextColor.GOLD));
|
||||
|
||||
lore.add(Component.text(def.type.description.replaceAll("%maxValue%", String.valueOf(def.maxValue)), NamedTextColor.GOLD));
|
||||
|
||||
lore.add(Component.text("Click to unlock", NamedTextColor.GRAY));
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue