i'm not like 95% sure what id id in these commits, but it works

This commit is contained in:
Soph :3 2026-02-15 23:14:53 +02:00
parent a2935ad53d
commit 12170991be
6 changed files with 51 additions and 4 deletions

6
.idea/vcs.xml generated Normal file
View 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>

View file

@ -139,9 +139,11 @@ public final class Snowcore extends JavaPlugin {
for (int z = minZ; z <= maxZ; z++) { for (int z = minZ; z <= maxZ; z++) {
for (int y = maxY; y >= minY; y--) { for (int y = maxY; y >= minY; y--) {
Block block = world.getBlockAt(x, y, z); Block block = world.getBlockAt(x, y, z);
Material type = block.getType();
// Only care about full snow blocks as the base if (type != Material.STONE
if (block.getType() != Material.SNOW_BLOCK) continue; && type != Material.TUFF
&& type != Material.ANDESITE) continue;
Block above = world.getBlockAt(x, y + 1, z); Block above = world.getBlockAt(x, y + 1, z);
Material aboveType = above.getType(); Material aboveType = above.getType();
@ -251,7 +253,7 @@ public final class Snowcore extends JavaPlugin {
Snowcore.snowify( Snowcore.snowify(
world, world,
new Location(world, 39, 127, 157), new Location(world, 39, 127, 157),
new Location(world, 8, 139, 215) new Location(world, 8, 148, 215)
); );
Bukkit.broadcast(snowing); Bukkit.broadcast(snowing);

View file

@ -26,6 +26,33 @@ public class SellCommand implements BasicCommand {
@Override @Override
public void execute(CommandSourceStack source, String[] args) { 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); AtomicBoolean sold = new AtomicBoolean(false);
Gui gui = Gui.gui() Gui gui = Gui.gui()
.title(Component.text("Sell Items")) .title(Component.text("Sell Items"))

View file

@ -19,7 +19,7 @@ public class SnowifyCommand implements BasicCommand {
Snowcore.snowify( Snowcore.snowify(
world, world,
new Location(world, 39, 127, 157), new Location(world, 39, 127, 157),
new Location(world, 8, 139, 215) new Location(world, 8, 148, 215)
); );
} }

View file

@ -3,6 +3,7 @@ package ovh.sad.snowcore.items;
import net.kyori.adventure.text.Component; import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.minimessage.MiniMessage; import net.kyori.adventure.text.minimessage.MiniMessage;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.inventory.ItemFlag; import org.bukkit.inventory.ItemFlag;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta; 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()); definedAbilities.stream().filter(a -> a.byDefault).toList());
meta.setEnchantmentGlintOverride(true); 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); item.setItemMeta(meta);
return item; return item;
@ -133,6 +138,10 @@ public abstract class Tool<T extends Tool<T>> {
meta.lore(lore); meta.lore(lore);
meta.setEnchantmentGlintOverride(true); 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); item.setItemMeta(meta);
return item; return item;

View file

@ -204,6 +204,9 @@ public class InteractListener implements Listener {
} else { } else {
name = Component.text(def.type.name, NamedTextColor.YELLOW); name = Component.text(def.type.name, NamedTextColor.YELLOW);
lore.add(Component.text("Cost: " + (int) def.baseCost + "$", NamedTextColor.GOLD)); 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)); lore.add(Component.text("Click to unlock", NamedTextColor.GRAY));
} }