3
0
Fork 0

Compare commits

..

2 commits

Author SHA1 Message Date
9730ae42d4
Merge remote-tracking branch 'origin/main' 2024-08-05 20:31:24 +02:00
6c2c58c60f
First commit! 2024-08-05 20:29:21 +02:00
6 changed files with 344 additions and 0 deletions

114
.gitignore vendored Normal file
View file

@ -0,0 +1,114 @@
# User-specific stuff
.idea/
.fleet/
*.iml
*.ipr
*.iws
# IntelliJ
out/
# Compiled class file
*.class
# Log file
*.log
# BlueJ files
*.ctxt
# Package Files #
*.jar
*.war
*.nar
*.ear
*.zip
*.tar.gz
*.rar
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
*~
# temporary files which can be created if a process still has a handle open of a deleted file
.fuse_hidden*
# KDE directory preferences
.directory
# Linux trash folder which might appear on any partition or disk
.Trash-*
# .nfs files are created when an open file is removed but is still being accessed
.nfs*
# General
.DS_Store
.AppleDouble
.LSOverride
# Icon must end with two \r
Icon
# Thumbnails
._*
# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent
# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk
# Windows thumbnail cache files
Thumbs.db
Thumbs.db:encryptable
ehthumbs.db
ehthumbs_vista.db
# Dump file
*.stackdump
# Folder config file
[Dd]esktop.ini
# Recycle Bin used on file shares
$RECYCLE.BIN/
# Windows Installer files
*.cab
*.msi
*.msix
*.msm
*.msp
# Windows shortcuts
*.lnk
target/
pom.xml.tag
pom.xml.releaseBackup
pom.xml.versionsBackup
pom.xml.next
release.properties
dependency-reduced-pom.xml
buildNumber.properties
.mvn/timing.properties
.mvn/wrapper/maven-wrapper.jar
.flattened-pom.xml
# Common working directory
run/

78
pom.xml Normal file
View file

@ -0,0 +1,78 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>tech.sbdevelopment</groupId>
<artifactId>vp3apitest</artifactId>
<version>1.0</version>
<packaging>jar</packaging>
<name>vp3apitest</name>
<properties>
<java.version>21</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<build>
<defaultGoal>clean package</defaultGoal>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.13.0</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.5.3</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
</build>
<repositories>
<repository>
<id>papermc-repo</id>
<url>https://repo.papermc.io/repository/maven-public/</url>
</repository>
<repository>
<id>sonatype</id>
<url>https://oss.sonatype.org/content/groups/public/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>io.papermc.paper</groupId>
<artifactId>paper-api</artifactId>
<version>1.21-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>nl.sbdeveloper</groupId>
<artifactId>VehiclesPlus-API</artifactId>
<version>3.0.0-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>

View file

@ -0,0 +1,19 @@
package tech.sbdevelopment.vp3apitest;
import nl.sbdeveloper.vehiclesplus.api.VehiclesPlusAPI;
import org.bukkit.plugin.java.JavaPlugin;
import tech.sbdevelopment.vp3apitest.parts.Vent;
public final class VP3APItest extends JavaPlugin {
@Override
public void onEnable() {
VehiclesPlusAPI.registerHook(() -> {
VehiclesPlusAPI.registerPart(Vent.class);
getLogger().info("Hooked into VehiclesPlus!");
});
}
@Override
public void onDisable() {
}
}

View file

@ -0,0 +1,73 @@
package tech.sbdevelopment.vp3apitest.models;
import nl.sbdeveloper.vehiclesplus.api.vehicles.HolderItemPosition;
import nl.sbdeveloper.vehiclesplus.api.vehicles.VehicleModel;
import nl.sbdeveloper.vehiclesplus.api.vehicles.defaults.DefaultVehicleModel;
import nl.sbdeveloper.vehiclesplus.api.vehicles.parts.impl.seat.Seat;
import nl.sbdeveloper.vehiclesplus.api.vehicles.parts.impl.skin.Skin;
import nl.sbdeveloper.vehiclesplus.api.vehicles.settings.UpgradableSetting;
import nl.sbdeveloper.vehiclesplus.api.vehicles.settings.impl.*;
import nl.sbdeveloper.vehiclesplus.utils.ItemBuilder;
import nl.sbdeveloper.vehiclesplus.utils.jackson.ColorList;
import org.bukkit.Color;
import org.bukkit.Material;
import org.bukkit.Sound;
import tech.sbdevelopment.vp3apitest.parts.Vent;
public class DefaultSubmarine extends DefaultVehicleModel {
@Override
public VehicleModel build() {
return VehicleModel.builder()
.id("ExampleSubmarine")
.displayName("&cExample &aSubmarine")
.typeId("submarines")
.part(new Skin(
0, 0.3, 0,
new ItemBuilder(Material.LEATHER_BOOTS)
.customModelData(4, (ib) -> ib
.durability((short) 4)
.unbreakable())
.armorColor(Color.WHITE)
.getItemStack(),
HolderItemPosition.HEAD
))
.part(new Seat(
-0.5, -0.5, 0.5, true
))
.part(new Vent())
.permissions(new Permissions("ExampleSubmarine"))
.sounds(defaultSounds)
.availableColors(ColorList.of(
Color.GRAY,
Color.BLACK
))
.maxSpeed(new UpgradableSetting(
10, 200, 5, 1000, "km/h"
))
.fuelTank(new UpgradableSetting(
100, 200, 5, 1000, "L"
))
.turningRadius(new UpgradableSetting(
5, 10, 1, 1000, ""
))
.acceleration(new UpgradableSetting(
50, 100, 1, 1000, ""
))
.horn(new Horn(
true, new Sounds.Sound(Sound.WEATHER_RAIN_ABOVE.getKey().toString(), 3)
))
.drift(false)
.exitWhileMoving(false)
.price(100000)
.fuel(new Fuel(
"gasoline", 6
))
.health(100)
.trunkSize(0)
.hitbox(new Hitbox(
4, 2, 1.2
))
.gearbox(new Gearbox(false))
.build();
}
}

View file

@ -0,0 +1,55 @@
package tech.sbdevelopment.vp3apitest.parts;
import nl.sbdeveloper.vehiclesplus.api.vehicles.HolderItemPosition;
import nl.sbdeveloper.vehiclesplus.api.vehicles.movement.MovementInput;
import nl.sbdeveloper.vehiclesplus.api.vehicles.parts.EquipablePart;
import nl.sbdeveloper.vehiclesplus.api.vehicles.parts.PartTypeName;
import nl.sbdeveloper.vehiclesplus.api.vehicles.parts.impl.seat.Controllable;
import nl.sbdeveloper.vehiclesplus.utils.ItemBuilder;
import org.bukkit.ChatColor;
import org.bukkit.Color;
import org.bukkit.Material;
import org.bukkit.inventory.ItemStack;
@PartTypeName("vent")
public class Vent extends EquipablePart implements Controllable {
public Vent() {
super(-0.3, 0.95, 0,
new ItemBuilder(Material.LEATHER_CHESTPLATE)
.customModelData(4, (ib) -> ib
.durability((short) 4)
.unbreakable())
.armorColor(Color.GRAY)
.getItemStack(),
HolderItemPosition.HEAD);
}
public Vent(double xOffset, double yOffset, double zOffset, ItemStack skin, HolderItemPosition position) {
super(xOffset, yOffset, zOffset, skin, position);
}
@Override
public ItemStack getPartGUIItem() {
return new ItemBuilder(Material.LEATHER_BOOTS)
.displayname(ChatColor.GOLD + "Vent")
.lore(
ChatColor.GRAY + "This is the vent of the vehicle.",
ChatColor.GRAY + "It will provide a boost when the spacebar is pressed."
)
.unbreakable()
.durability(7)
.getItemStack();
}
@Override
public String asString() {
return "";
}
@Override
public void handleInput(MovementInput movementInput) {
if (movementInput.isSpace()) {
holder.getVehicle().getVelocity().add(holder.getVehicle().getLocation().getDirection().multiply(0.5));
}
}
}

View file

@ -0,0 +1,5 @@
name: VP3-APItest
version: '1.0'
main: tech.sbdevelopment.vp3apitest.VP3APItest
api-version: '1.21'
depend: [VehiclesPlus]