First commit!
This commit is contained in:
commit
6c2c58c60f
6 changed files with 344 additions and 0 deletions
19
src/main/java/tech/sbdevelopment/vp3apitest/VP3APItest.java
Normal file
19
src/main/java/tech/sbdevelopment/vp3apitest/VP3APItest.java
Normal 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() {
|
||||
}
|
||||
}
|
|
@ -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();
|
||||
}
|
||||
}
|
55
src/main/java/tech/sbdevelopment/vp3apitest/parts/Vent.java
Normal file
55
src/main/java/tech/sbdevelopment/vp3apitest/parts/Vent.java
Normal 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));
|
||||
}
|
||||
}
|
||||
}
|
5
src/main/resources/plugin.yml
Normal file
5
src/main/resources/plugin.yml
Normal file
|
@ -0,0 +1,5 @@
|
|||
name: VP3-APItest
|
||||
version: '1.0'
|
||||
main: tech.sbdevelopment.vp3apitest.VP3APItest
|
||||
api-version: '1.21'
|
||||
depend: [VehiclesPlus]
|
Loading…
Add table
Add a link
Reference in a new issue