Add roaming Arrakis smuggler missions and Imperial spice sale bonus

This commit is contained in:
unimatrixgit 2026-10-13 09:31:34 +02:00
commit f5bbe09227
13 changed files with 391 additions and 7 deletions

View file

@ -1,6 +1,6 @@
plugins { java }
group = "com.example"
version = "1.0.6"
version = "1.0.7"
repositories { mavenCentral(); maven("https://repo.papermc.io/repository/maven-public/"); maven("https://jitpack.io") }
dependencies {
compileOnly("io.papermc.paper:paper-api:1.21.4-R0.1-SNAPSHOT")

View file

@ -59,6 +59,7 @@ public final class DuneCore extends JavaPlugin implements Listener, CommandExecu
private final Map<UUID, Integer> sunExposureSeconds = new HashMap<>();
private ConfigurableGui gui;
private AdminGui adminGui;
private Smugglers smugglers;
private Politics politics;
private SharedDatabase sharedDatabase;
public SharedDatabase sharedDatabase(){return sharedDatabase;}
@ -107,6 +108,7 @@ public final class DuneCore extends JavaPlugin implements Listener, CommandExecu
duneCommand.setTabCompleter(this);
Bukkit.getPluginManager().registerEvents(this, this);
adminGui = new AdminGui(this);
smugglers = new Smugglers(this, economy, politics);
announcements = new ArrakisAnnouncements(this);
sandwormMobs = new SandwormMobs(this, wormKey);
World loadedArrakis = Bukkit.getWorld("arrakis");
@ -415,7 +417,16 @@ public final class DuneCore extends JavaPlugin implements Listener, CommandExecu
}
public int spiceSellPrice() { org.bukkit.plugin.Plugin p=Bukkit.getPluginManager().getPlugin("DuneEss"); return p instanceof JavaPlugin j ? Math.max(1,j.getConfig().getInt("currency.spice-price",15)) : 15; }
public int travelPrice() { org.bukkit.plugin.Plugin p=Bukkit.getPluginManager().getPlugin("DuneEss"); return p instanceof JavaPlugin j ? Math.max(0,j.getConfig().getInt("currency.travel-price",100)) : 100; }
public int processSpiceSale(Player p,int gross) { if(!politics.isAuthorizedSpice(selected.getOrDefault(p.getUniqueId(),"")))reportSmuggling(p,"SPICE",gross); return Math.max(0,gross-politics.levy(p.getUniqueId(),gross)); }
public int processSpiceSale(Player p,int gross) {
String house = factionOf(p);
boolean sanctioned = politics.isAuthorizedSpice(house) || politics.isAuthorizedWater(house);
int adjusted = sanctionedSpiceGross(gross, sanctioned);
if (!sanctioned) reportSmuggling(p, "SPICE", adjusted);
return Math.max(0, adjusted - politics.levy(p.getUniqueId(), adjusted));
}
static int sanctionedSpiceGross(int gross, boolean sanctioned) {
return (int) Math.min(Integer.MAX_VALUE, Math.round(Math.max(0, gross) * (sanctioned ? 1.33 : 1.0)));
}
public boolean hasFreeArrakisTravel(Player p) { return emperorSanctioned(p,"arrakis"); }
public boolean authorizeArrakisTravel(Player p) { if(!emperorSanctioned(p,"arrakis"))return true; if(sharedDatabase==null)return false; try{sharedDatabase.issueArrakisPermit(p.getUniqueId(),System.currentTimeMillis()+120000L);return true;}catch(java.sql.SQLException ex){getLogger().warning("Could not issue Arrakis permit: "+ex.getMessage());return false;} }
public void enforceArrakisArrival(Player player) { checkArrakisArrival(player); }
@ -479,6 +490,7 @@ public final class DuneCore extends JavaPlugin implements Listener, CommandExecu
selected.put(p.getUniqueId(), match); economy.createPlayerAccount(p); savePlayers(); kit(p); factionArrival(p, planets[Arrays.asList(factions).indexOf(match)]);
p.sendMessage(ChatColor.GREEN + "You joined " + match + "!");
}
case "smuggle" -> smugglers.command(p, args);
case "elytra" -> mergeElytra(p);
case "kit" -> { if (!selected.containsKey(p.getUniqueId())) { p.sendMessage("Choose a faction first."); break; } kit(p); }
case "politics", "trust" -> politics.command(p, args);
@ -517,7 +529,8 @@ public final class DuneCore extends JavaPlugin implements Listener, CommandExecu
helpSection(sender, "Solaris and spice");
helpLine(sender, "/duneess balance", "Check your Solaris balance.");
helpLine(sender, "/duneess sell", "Sell tagged spice from your inventory for Solaris.");
helpLine(sender, "/duneess sell", "Sell tagged spice; Imperial-sanctioned houses receive +33% before levy.");
helpLine(sender, "/dune smuggle status | cancel", "Check or abandon your roaming smuggler delivery contract.");
helpLine(sender, "/dune exchange", "Open the player-posted spice job exchange.");
helpSection(sender, "Politics");
@ -573,7 +586,7 @@ public final class DuneCore extends JavaPlugin implements Listener, CommandExecu
String root = args[0].toLowerCase(Locale.ROOT);
if (args.length == 1) {
List<String> commands = new ArrayList<>(List.of("help", "choose", "elytra", "kit", "politics", "trust", "water",
"menu", "gui", "menuitem", "exchange", "serverjobs", "job"));
"menu", "gui", "menuitem", "exchange", "serverjobs", "job", "smuggle"));
if (sender.hasPermission("dune.admin")) commands.addAll(List.of("guireload", "guildnpc", "givespice", "summon", "admin", "adminitem"));
return matching(commands, args[0]);
}

View file

@ -54,10 +54,14 @@ public final class Politics {
public synchronized int levy(UUID player,int gross) {
refresh();
if (gross<=0) return 0;
int fee=(int)Math.ceil(gross*plugin.getConfig().getDouble("politics.trust-levy",0.0121));
int fee=levyAmount(gross);
state.set("trust",state.getLong("trust")+fee); save();
return fee;
}
public int levyAmount(int gross) {
double rate = Math.max(0, Math.min(1, plugin.getConfig().getDouble("politics.trust-levy", 0.0121)));
return (int) Math.ceil(Math.max(0, gross) * rate);
}
/** The appointments expire automatically when a new election week or Emperor changes. */
private boolean appointed(String key,String house) {
refresh();

View file

@ -0,0 +1,271 @@
package com.example.dunerealms;
import net.milkbowl.vault.economy.Economy;
import org.bukkit.*;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.entity.*;
import org.bukkit.event.*;
import org.bukkit.event.entity.CreatureSpawnEvent;
import org.bukkit.event.inventory.*;
import org.bukkit.event.player.PlayerInteractEntityEvent;
import org.bukkit.inventory.*;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.persistence.PersistentDataType;
import java.io.File;
import java.io.IOException;
import java.util.*;
/** Local Arrakis delivery contracts; cargo is the existing tagged trade items. */
final class Smugglers implements Listener {
private final DuneCore plugin;
private final Economy economy;
private final Politics politics;
private final NamespacedKey traderKey, spiceKey, waterKey;
private final File file;
private final YamlConfiguration data;
private final Map<UUID, Contract> contracts = new HashMap<>();
private final Random random = new Random();
record Contract(String commodity, int amount, int reward, UUID source, double x, double z) {}
private static final class Menu implements InventoryHolder {
private Inventory inventory;
private final UUID trader;
Menu(UUID trader) { this.trader = trader; }
@Override public Inventory getInventory() { return inventory; }
}
Smugglers(DuneCore plugin, Economy economy, Politics politics) {
this.plugin = plugin; this.economy = economy; this.politics = politics;
traderKey = new NamespacedKey(plugin, "smuggler");
spiceKey = new NamespacedKey("dunerealms", "item");
waterKey = new NamespacedKey("dunerealms", "finite_arrakis_water");
file = new File(plugin.getDataFolder(), "smuggling.yml");
data = YamlConfiguration.loadConfiguration(file);
for (String key : data.getKeys(false)) try {
String commodity = data.getString(key + ".commodity", "");
int amount = data.getInt(key + ".amount"), reward = data.getInt(key + ".reward");
if (!Set.of("spice", "water").contains(commodity) || amount < 1 || reward < 1) continue;
contracts.put(UUID.fromString(key), new Contract(commodity, amount, reward,
UUID.fromString(data.getString(key + ".source", "")), data.getDouble(key + ".x"), data.getDouble(key + ".z")));
} catch (IllegalArgumentException ignored) { }
Bukkit.getPluginManager().registerEvents(this, plugin);
Bukkit.getScheduler().runTaskTimer(plugin, this::populate, 100L, 1200L);
}
private boolean sanctioned(Player player) {
String house = plugin.factionOf(player);
return politics.isAuthorizedSpice(house) || politics.isAuthorizedWater(house);
}
private boolean tagged(Entity entity) {
return entity instanceof WanderingTrader && entity.getPersistentDataContainer().has(traderKey, PersistentDataType.BYTE);
}
private void mark(WanderingTrader trader) {
trader.getPersistentDataContainer().set(traderKey, PersistentDataType.BYTE, (byte) 1);
trader.setCustomName(ChatColor.GOLD + "Arrakis Smuggler");
trader.setCustomNameVisible(true);
trader.setRecipes(List.of());
trader.setAI(true);
trader.setCanDrinkPotion(false);
trader.setDespawnDelay(48000);
}
@EventHandler(ignoreCancelled = true) public void spawn(CreatureSpawnEvent event) {
if (plugin.getConfig().getBoolean("smugglers.enabled", true)
&& event.getLocation().getWorld().getName().equalsIgnoreCase("arrakis")
&& event.getEntity() instanceof WanderingTrader trader) mark(trader);
}
private void populate() {
if (!plugin.getConfig().getBoolean("smugglers.enabled", true)) return;
World world = Bukkit.getWorld("arrakis");
if (world == null || world.getPlayers().isEmpty()) return;
int count = 0;
for (WanderingTrader trader : world.getEntitiesByClass(WanderingTrader.class)) {
if (!tagged(trader)) mark(trader);
roam(trader);
count++;
}
int maximum = Math.max(2, Math.min(20, plugin.getConfig().getInt("smugglers.max-traders", 6)));
// At most two new traders per minute, only in already-loaded chunks near players.
for (int attempt = 0, added = 0; attempt < 20 && count < maximum && added < 2; attempt++) {
Player player = world.getPlayers().get(random.nextInt(world.getPlayers().size()));
double angle = random.nextDouble() * Math.PI * 2;
int radius = 24 + random.nextInt(25);
int x = player.getLocation().getBlockX() + (int) (Math.cos(angle) * radius);
int z = player.getLocation().getBlockZ() + (int) (Math.sin(angle) * radius);
if (!world.isChunkLoaded(x >> 4, z >> 4)) continue;
int y = world.getHighestBlockYAt(x, z);
Location location = new Location(world, x + .5, y + 1, z + .5);
if (y + 2 >= world.getMaxHeight() || !world.getBlockAt(x, y, z).getType().isSolid()
|| !world.getBlockAt(x, y + 1, z).isPassable() || !world.getBlockAt(x, y + 2, z).isPassable()
|| !world.getWorldBorder().isInside(location)) continue;
WanderingTrader trader = world.spawn(location, WanderingTrader.class, this::mark);
roam(trader);
if (trader.isValid()) { count++; added++; }
}
}
private void roam(WanderingTrader trader) {
Location here = trader.getLocation();
int x = here.getBlockX() + random.nextInt(49) - 24;
int z = here.getBlockZ() + random.nextInt(49) - 24;
World world = trader.getWorld();
if (!world.isChunkLoaded(x >> 4, z >> 4)) return;
int y = world.getHighestBlockYAt(x, z);
Location destination = new Location(world, x + .5, y + 1, z + .5);
if (y + 2 < world.getMaxHeight() && world.getBlockAt(x, y, z).getType().isSolid()
&& world.getBlockAt(x, y + 1, z).isPassable() && world.getWorldBorder().isInside(destination))
trader.setWanderingTowards(destination);
}
@EventHandler(ignoreCancelled = true) public void interact(PlayerInteractEntityEvent event) {
if (!tagged(event.getRightClicked())) return;
event.setCancelled(true);
if (!plugin.getConfig().getBoolean("smugglers.enabled", true)) return;
if (event.getHand() != EquipmentSlot.HAND) return;
Player player = event.getPlayer();
if (sanctioned(player)) {
player.sendMessage(ChatColor.GOLD + "Smuggler: 'The Emperor's seal is on your house. I won't risk my routes for an Imperial agent. Sell through your charter: /duneess sell pays +33% before the Trust levy.'");
return;
}
open(player, event.getRightClicked());
}
private ItemStack icon(Material type, String title, String... lines) {
ItemStack item = new ItemStack(type);
ItemMeta meta = item.getItemMeta();
meta.setDisplayName(ChatColor.GOLD + title);
meta.setLore(Arrays.stream(lines).map(line -> ChatColor.GRAY + line).toList());
item.setItemMeta(meta); return item;
}
private void open(Player player, Entity trader) {
Menu holder = new Menu(trader.getUniqueId());
holder.inventory = Bukkit.createInventory(holder, 27, ChatColor.GOLD + "Arrakis | Smuggler Contracts");
for (int i = 0; i < 27; i++) holder.inventory.setItem(i, icon(Material.BROWN_STAINED_GLASS_PANE, " "));
Contract active = contracts.get(player.getUniqueId());
if (active == null) {
Contract spice = offer("spice", trader), water = offer("water", trader);
holder.inventory.setItem(11, icon(Material.ORANGE_DYE, "The Unmarked Spice Run",
"'Imperial patrols count every grain of melange.'",
"'Our hidden buyers need a shipment without a seal.'",
"Deliver " + spice.amount() + " tagged spice to another smuggler.", "Reward: " + spice.reward() + " Solaris before levy."));
holder.inventory.setItem(15, icon(Material.WATER_BUCKET, "Water for the Hidden Sietch",
"'A sietch beyond the patrol routes is running dry.'",
"'Carry its water quietly. On Arrakis, water is life.'",
"Deliver " + water.amount() + " finite-source water buckets.", "Reward: " + water.reward() + " Solaris before levy."));
} else {
holder.inventory.setItem(13, icon(Material.CHEST, "Deliver " + active.commodity(),
"Required cargo: " + active.amount(), "Reward: " + active.reward() + " Solaris before levy.",
"Use a different smuggler, 64+ blocks from the starting point.",
"Departure: X " + (int) active.x() + " / Z " + (int) active.z(),
active.commodity().equals("spice") ? "'Keep the melange beyond the Emperor's ledgers.'" : "'The hidden sietch is counting on you.'",
"Illegal delivery triggers the existing bounty system."));
holder.inventory.setItem(22, icon(Material.BARRIER, "Cancel Contract", "No cargo or Solaris is taken."));
}
player.openInventory(holder.inventory);
}
private Contract offer(String commodity, Entity trader) {
int amount = Math.max(1, Math.min(commodity.equals("spice") ? 4096 : 36,
plugin.getConfig().getInt("smugglers." + commodity + "-amount", commodity.equals("spice") ? 64 : 4)));
int base = commodity.equals("spice") ? plugin.spiceSellPrice() : Math.max(1, plugin.spiceSellPrice() / 2);
int reward = (int) Math.min(Integer.MAX_VALUE, Math.round((double) amount * base * 1.45));
return new Contract(commodity, amount, reward, trader.getUniqueId(), trader.getLocation().getX(), trader.getLocation().getZ());
}
@EventHandler public void click(InventoryClickEvent event) {
if (!(event.getView().getTopInventory().getHolder() instanceof Menu menu)) return;
event.setCancelled(true);
if (!(event.getWhoClicked() instanceof Player player) || event.getClickedInventory() != event.getView().getTopInventory()) return;
int slot = event.getRawSlot();
Bukkit.getScheduler().runTask(plugin, () -> {
if (!player.isOnline()) return;
player.closeInventory();
if (!plugin.getConfig().getBoolean("smugglers.enabled", true)) return;
if (sanctioned(player)) { player.sendMessage(ChatColor.RED + "Imperial sanction: smuggling contracts are unavailable."); return; }
Entity trader = Bukkit.getEntity(menu.trader);
if (trader == null || !trader.isValid() || !tagged(trader)
|| !trader.getWorld().getName().equalsIgnoreCase("arrakis") || player.getWorld() != trader.getWorld()
|| player.getLocation().distanceSquared(trader.getLocation()) > 64) {
player.sendMessage(ChatColor.RED + "Return to the smuggler to trade."); return;
}
Contract active = contracts.get(player.getUniqueId());
if (active == null && (slot == 11 || slot == 15)) {
contracts.put(player.getUniqueId(), offer(slot == 11 ? "spice" : "water", trader));
if (!save()) { contracts.remove(player.getUniqueId()); player.sendMessage("Contract could not be saved. Try again."); return; }
player.sendMessage(ChatColor.GOLD + (slot == 11
? "Smuggler: 'The melange must vanish from the Imperial ledger. My distant contact will pay for your silence.'"
: "Smuggler: 'The hidden sietch has no water to spare. Reach my distant contact, and its people will remember.'"));
player.sendMessage("Carry the cargo to another smuggler 64+ blocks from here. /dune smuggle status shows your contract.");
} else if (active != null && slot == 22) {
contracts.remove(player.getUniqueId());
if (!save()) contracts.put(player.getUniqueId(), active);
else player.sendMessage("Smuggling contract cancelled.");
} else if (active != null && slot == 13) deliver(player, trader, active);
});
}
@EventHandler public void drag(InventoryDragEvent event) {
if (event.getView().getTopInventory().getHolder() instanceof Menu) event.setCancelled(true);
}
static boolean validDestination(Contract contract, UUID trader, double x, double z) {
return !contract.source().equals(trader) && Math.pow(x - contract.x(), 2) + Math.pow(z - contract.z(), 2) >= 4096;
}
private boolean cargo(ItemStack item, String commodity) {
if (item == null || !item.hasItemMeta()) return false;
if (commodity.equals("spice")) return "spice".equals(item.getItemMeta().getPersistentDataContainer().get(spiceKey, PersistentDataType.STRING));
return item.getType() == Material.WATER_BUCKET && item.getItemMeta().getPersistentDataContainer().has(waterKey, PersistentDataType.BYTE);
}
private void deliver(Player player, Entity trader, Contract contract) {
if (!validDestination(contract, trader.getUniqueId(), trader.getLocation().getX(), trader.getLocation().getZ())) {
player.sendMessage("Find a different smuggler at least 64 blocks from the starting point."); return;
}
ItemStack[] original = player.getInventory().getStorageContents();
ItemStack[] remaining = Arrays.stream(original).map(item -> item == null ? null : item.clone()).toArray(ItemStack[]::new);
int needed = contract.amount();
for (int i = 0; i < remaining.length && needed > 0; i++) if (cargo(remaining[i], contract.commodity())) {
int taken = Math.min(needed, remaining[i].getAmount());
needed -= taken;
if (remaining[i].getAmount() == taken) remaining[i] = null;
else remaining[i].setAmount(remaining[i].getAmount() - taken);
}
if (needed > 0) { player.sendMessage("You still need " + needed + " tagged " + contract.commodity() + "."); return; }
// Persist completion before paying, preventing replay of a completed contract after restart.
contracts.remove(player.getUniqueId());
if (!save()) { contracts.put(player.getUniqueId(), contract); player.sendMessage("Delivery could not be saved. Try again."); return; }
int net = Math.max(0, contract.reward() - politics.levyAmount(contract.reward()));
if (!economy.depositPlayer(player, net).transactionSuccess()) {
contracts.put(player.getUniqueId(), contract); save();
player.sendMessage("Payment failed. Cargo kept; try delivery again."); return;
}
politics.levy(player.getUniqueId(), contract.reward());
player.getInventory().setStorageContents(remaining);
if (contract.commodity().equals("water")) {
for (ItemStack bucket : player.getInventory().addItem(new ItemStack(Material.BUCKET, contract.amount())).values())
player.getWorld().dropItemNaturally(player.getLocation(), bucket);
}
plugin.reportSmuggling(player, contract.commodity().toUpperCase(Locale.ROOT), contract.reward());
player.sendMessage(ChatColor.GOLD + (contract.commodity().equals("spice")
? "Smuggler: 'No seal, no names. The melange is already on its way. The Emperor's men may have noticed you.'"
: "Smuggler: 'Tonight the sietch drinks. Keep your route secret; the water monopoly has long eyes.'"));
player.sendMessage(ChatColor.GOLD + "Smuggling delivery complete: " + net + " Solaris after the Trust levy.");
}
void command(Player player, String[] args) {
Contract contract = contracts.get(player.getUniqueId());
if (contract == null) { player.sendMessage("No smuggling contract. Seek a roaming Arrakis Smuggler."); return; }
if (args.length > 1 && args[1].equalsIgnoreCase("cancel")) {
contracts.remove(player.getUniqueId());
if (!save()) contracts.put(player.getUniqueId(), contract);
else player.sendMessage("Contract cancelled. Cargo kept.");
return;
}
player.sendMessage(ChatColor.GOLD + (contract.commodity().equals("spice") ? "The Unmarked Spice Run" : "Water for the Hidden Sietch"));
player.sendMessage("Deliver " + contract.amount() + " tagged " + contract.commodity() + " to another Arrakis Smuggler, 64+ blocks from X "
+ (int) contract.x() + " / Z " + (int) contract.z() + ". Reward: " + contract.reward() + " Solaris before levy. /dune smuggle cancel abandons it.");
if (sanctioned(player)) player.sendMessage("Your Imperial sanction blocks delivery. Cancel the contract or wait for the appointment to expire.");
}
private boolean save() {
for (String key : new HashSet<>(data.getKeys(false))) data.set(key, null);
contracts.forEach((id, contract) -> {
String key = id.toString();
data.set(key + ".commodity", contract.commodity()); data.set(key + ".amount", contract.amount());
data.set(key + ".reward", contract.reward()); data.set(key + ".source", contract.source().toString());
data.set(key + ".x", contract.x()); data.set(key + ".z", contract.z());
});
try { data.save(file); return true; }
catch (IOException exception) { plugin.getLogger().severe("Cannot save smuggling contracts: " + exception.getMessage()); return false; }
}
}

View file

@ -60,3 +60,10 @@ database:
jdbc-url: "jdbc:postgresql://127.0.0.1:5432/dunerealms"
username: "dune"
password: "CHANGE_ME"
# Roaming Arrakis traders: native wandering-trader AI and local persistent delivery contracts.
smugglers:
enabled: true
max-traders: 6
spice-amount: 64
water-amount: 4

View file

@ -1,5 +1,5 @@
name: DuneCore
version: 1.0.6
version: 1.0.7
main: com.example.dunerealms.DuneCore
api-version: '1.21'
depend: [Vault, DuneEss]

View file

@ -0,0 +1,44 @@
package com.example.dunerealms;
import org.bukkit.entity.Player;
import org.junit.jupiter.api.Test;
import java.lang.reflect.Field;
import java.util.UUID;
import static org.junit.jupiter.api.Assertions.*;
import static org.mockito.Mockito.*;
import static org.mockito.ArgumentMatchers.*;
class SmugglersTest {
@Test void deliveryNeedsDifferentTraderAndSixtyFourBlockRoute() {
UUID source = UUID.randomUUID(), other = UUID.randomUUID();
Smugglers.Contract contract = new Smugglers.Contract("spice", 64, 1392, source, 10, -20);
assertFalse(Smugglers.validDestination(contract, source, 1000, 1000));
assertFalse(Smugglers.validDestination(contract, other, 73, -20));
assertTrue(Smugglers.validDestination(contract, other, 74, -20));
assertTrue(Smugglers.validDestination(contract, other, 10, -84));
}
@Test void ordinarySaleOnlyBonusesSanctionedPlayersAndHandlesRoundingAndOverflow() {
assertEquals(1995, DuneCore.sanctionedSpiceGross(1500, true));
assertEquals(1500, DuneCore.sanctionedSpiceGross(1500, false));
assertEquals(20, DuneCore.sanctionedSpiceGross(15, true));
assertEquals(0, DuneCore.sanctionedSpiceGross(-100, true));
assertEquals(Integer.MAX_VALUE, DuneCore.sanctionedSpiceGross(Integer.MAX_VALUE, true));
}
@Test void sanctionedNormalSaleAppliesBonusBeforeLevyAndDoesNotReportSmuggling() throws Exception {
for (boolean spiceAppointment : new boolean[]{true, false}) {
DuneCore plugin = mock(DuneCore.class);
Player player = mock(Player.class);
Politics politics = mock(Politics.class);
when(plugin.factionOf(player)).thenReturn("Atreides");
when(politics.isAuthorizedSpice("Atreides")).thenReturn(spiceAppointment);
when(politics.isAuthorizedWater("Atreides")).thenReturn(!spiceAppointment);
when(politics.levy(player.getUniqueId(), 1995)).thenReturn(25);
Field field = DuneCore.class.getDeclaredField("politics");
field.setAccessible(true); field.set(plugin, politics);
when(plugin.processSpiceSale(player, 1500)).thenCallRealMethod();
assertEquals(1970, plugin.processSpiceSale(player, 1500));
verify(plugin, never()).reportSmuggling(any(), anyString(), anyInt());
verify(politics).levy(player.getUniqueId(), 1995);
}
}
}

Binary file not shown.

View file

@ -7,3 +7,7 @@ Client-side resource pack for Minecraft Java 1.21.4 servers. Works with vanilla
- Recolors suspicious sand to a bright spice-gold so deposits are easier to spot.
On a Fabric client, copy `DuneResourcePack.zip` into `.minecraft/resourcepacks`, launch the Fabric profile for Minecraft 1.21.4, then enable **Dune Resource Pack** in Options → Resource Packs. Do not put the ZIP in the `mods` folder. For automatic server delivery, host the ZIP at a direct-download URL and set `resource-pack` in `server.properties` for each backend. Players must accept it. Reaccept or reload the updated pack after upgrading. DuneCore 1.0.5 spawns a real Sniffer body with an invisible Husk providing native zombie AI. The Sniffer texture keeps the vanilla model's UV layout; the pack does not create a custom worm mesh. The legacy Husk texture remains for compatibility.
DuneCore 1.0.7 adds an Arrakis smuggler texture for the vanilla wandering trader model.
Enable the updated pack to see sand-tan robes, a face covering, amber trim and leather gear.
This texture applies to all wandering traders client-side; smuggling missions only apply to Arrakis traders.

View file

@ -0,0 +1,13 @@
# Arrakis smuggler texture
Built-in imagegen edit of the Minecraft 1.21.4 wandering trader UV atlas.
Converted to the native 64 x 64 PNG size using nearest-neighbor resampling.
Reference: https://raw.githubusercontent.com/InventivetalentDev/minecraft-assets/1.21.4/assets/minecraft/textures/entity/wandering_trader.png
Asset: assets/minecraft/textures/entity/wandering_trader.png
Prompt:
Edit target: Minecraft Java wandering trader entity UV texture atlas. Create a Dune Arrakis desert smuggler skin. Preserve EXACT source 64x64 UV atlas geometry, all occupied pixel islands and transparent gaps, face and nose positions, clothing areas. Replace blue robes with weathered sand-tan and dark brown desert wraps, charcoal face covering, tiny amber trim, subtle blue eyes, leather belt and concealed spice pouches suggested by pixels. Minecraft pixel art, no gradients, no text, no background, no assembled character or illustration. Output texture atlas only, intended for assets/minecraft/textures/entity/wandering_trader.png. Keep geometry and alpha untouched.
The vanilla wandering trader model is retained. A standard resource pack globally replaces
this entity texture; vanilla clients cannot restrict it to named Arrakis traders.
The atlas is generated artwork and still needs in-game visual inspection on the model.

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.7 KiB

View file

@ -5,6 +5,6 @@
"min_inclusive": 46,
"max_inclusive": 46
},
"description": "Dune — Shai-Hulud, Haunted Fremen, and spice-rich sand (Java 1.21.4)"
"description": "Dune — Shai-Hulud, Arrakis Smugglers, Haunted Fremen, and spice-rich sand (Java 1.21.4)"
}
}

View file

@ -102,3 +102,31 @@ give one test spice item, reload `gui.yml`, issue your selected faction kit, and
Actions use the existing command checks. Both opening the menu and clicking a control require operator status;
granting only `dune.admin` does not enable this menu. A deopped player cannot use a retained rod.
The blaze rod has custom model data 1006, a gold name and enchantment glint; its current appearance uses the vanilla blaze rod texture.
### Roaming smugglers and Imperial spice charter (DuneCore 1.0.7)
Arrakis wandering traders become **Arrakis Smugglers**. Their vanilla AI roams toward new
nearby destinations each minute; up to six are maintained in loaded chunks near players by default.
Right-click a smuggler to select one active delivery contract:
- **The Unmarked Spice Run**: carry 64 tagged spice to another smuggler, past the Imperial ledgers.
- **Water for the Hidden Sietch**: carry four tagged finite-source Arrakis water buckets to supply a hidden sietch.
The receiving trader must be a different entity and at least 64 horizontal blocks from the departure location.
Deliver by clicking the active contract in its menu. Default rewards are 1,392 Solaris for spice and
41 Solaris for water, before the existing Trust levy (45% above the commodity's normal base value, rounded).
Only the required cargo is consumed; water deliveries return empty buckets. The existing smuggling bounty
system is called after delivery and requires PostgreSQL to track bounties across servers.
The lore is in-game mission dialogue; these contracts do not generate additional sietch structures.
`/dune smuggle status` shows cargo, departure and reward; `/dune smuggle cancel` abandons a contract without taking cargo.
Contracts save to `smuggling.yml` and survive restarts on the Arrakis backend; they do not transfer between backends.
Appointments are checked when opening, accepting and delivering. Members of the Emperor-appointed Spice Steward
or House of Water receive no smuggling offers. Their normal `/duneess sell` spice sales instead receive **+33% gross
value before the Trust levy**, rounded to the nearest Solaris. An appointment gained mid-contract blocks delivery;
the contract can still be cancelled. Expired appointments remove the bonus automatically.
`smugglers.enabled`, `smugglers.max-traders`, `smugglers.spice-amount`, and `smugglers.water-amount` control this system.
Existing config files use the defaults when these keys are missing. Restart after editing.
Enable the updated resource pack for the sand-tan smuggler robes, face covering and leather equipment.
Vanilla packs replace the texture of **all wandering traders**, including those on other planets; mission behavior is Arrakis-only.
Without the pack the same missions work with the vanilla trader appearance.