Skip to content
Open
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
20 changes: 15 additions & 5 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ dependencies {
implementation(libs.clipper2)
implementation(libs.json)
implementation(libs.googlecode.gson)
implementation("org.apache.commons:commons-lang3:3.20.0")
implementation(libs.okhttp.jvm)
implementation(libs.javaapiforkml) {
exclude(group = "com.sun.xml.bind", module = "jaxb-xjc") // Else Remapping will yell of duplicated classes
Expand Down Expand Up @@ -99,12 +100,21 @@ tasks.withType<Javadoc> {
tasks.shadowJar {
archiveClassifier = ""

relocationPrefix = "net.buildtheearth.buildteamtools.shaded"
enableAutoRelocation = true
// Relocate only known Java libraries. Broad/automatic relocation also opens
// Kotlin classes with ASM and can overflow their large metadata annotations.
enableAutoRelocation = false
enableKotlinModuleRemapping = false

// Prevents the plugin itself from being relocated by autorelocate
// This is needed because net.buildtheearth.projection shares the same package namespace
relocate("net.buildtheearth.buildteamtools", "net.buildtheearth.buildteamtools")
val shadePrefix = "net.buildtheearth.buildteamtools.shaded"
relocate("clipper2", "$shadePrefix.clipper2")
relocate("com.alpsbte.alpslib", "$shadePrefix.alpslib")
relocate("com.cryptomorin.xseries", "$shadePrefix.xseries")
relocate("com.google.gson", "$shadePrefix.gson")
relocate("de.micromata.opengis.kml", "$shadePrefix.kml")
relocate("org.apache.commons.lang3", "$shadePrefix.commonslang3")
relocate("org.bstats", "$shadePrefix.bstats")
relocate("org.ipvp.canvas", "$shadePrefix.canvas")
relocate("org.json", "$shadePrefix.json")
}

tasks.assemble {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,14 @@
import com.sk89q.worldedit.regions.CuboidRegion;
import com.sk89q.worldedit.regions.Polygonal2DRegion;
import com.sk89q.worldedit.regions.Region;
import lombok.Getter;
import net.buildtheearth.buildteamtools.BuildTeamTools;
import net.buildtheearth.buildteamtools.modules.generator.GeneratorModule;
import net.buildtheearth.buildteamtools.modules.generator.components.rail.configuration.RailTypeManager;
import net.buildtheearth.buildteamtools.modules.generator.components.rail.generation.RailScripts;
import net.buildtheearth.buildteamtools.modules.generator.model.GeneratorComponent;
import net.buildtheearth.buildteamtools.modules.generator.model.GeneratorType;
import net.buildtheearth.buildteamtools.modules.network.model.Permissions;
import org.bukkit.Sound;
import org.bukkit.entity.Player;

Expand All @@ -20,8 +25,12 @@ public class Rail extends GeneratorComponent {

private final Set<UUID> preparingPlayers = ConcurrentHashMap.newKeySet();

@Getter
private final RailTypeManager railTypeManager;

public Rail() {
super(GeneratorType.RAIL);
railTypeManager = new RailTypeManager(BuildTeamTools.getInstance().getDataFolder());
}

@Override
Expand All @@ -38,7 +47,7 @@ public boolean checkForPlayer(Player player) {
"Rail Generator supports cuboid, polygonal and convex WorldEdit selections."
)));
player.closeInventory();
player.playSound(player.getLocation(), Sound.ENTITY_ITEM_BREAK, 1.0F, 1.0F);
playSound(player, Sound.ENTITY_ITEM_BREAK);
return false;
}

Expand All @@ -50,6 +59,9 @@ private boolean isSupportedRailSelection(Region region) {

@Override
public void generate(Player player) {
if (!RailPermissionGuard.check(player, Permissions.RAIL_GENERATOR_USE))
return;

if (GeneratorModule.getInstance().isGenerating(player) || !preparingPlayers.add(player.getUniqueId())) {
sendAlreadyGeneratingMessage(player);
return;
Expand All @@ -67,6 +79,10 @@ private void sendAlreadyGeneratingMessage(Player player) {
player.sendMessage(ChatHelper.PREFIX_COMPONENT.append(ChatHelper.getErrorComponent(
"Rail Generator is already running. Please wait until the current generation is finished."
)));
player.playSound(player.getLocation(), Sound.ENTITY_ITEM_BREAK, 1.0F, 1.0F);
playSound(player, Sound.ENTITY_ITEM_BREAK);
}

private void playSound(Player player, Sound sound) {
player.playSound(player, sound, 1.0F, 1.0F);
}
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@

public enum RailFlag implements Flag {

RAIL_TYPE("t", FlagType.RAIL_TYPE);
RAIL_TYPE("t", FlagType.RAIL_TYPE),
TRACK_COUNT("c", FlagType.INTEGER),
TRACK_SPACING("s", FlagType.INTEGER);

@Getter
private final String flag;
Expand Down
Loading