Code Monkey home page Code Monkey logo

lead-wires's Introduction

lead-wires

A Spigot plugin that allows you to place "wires".

Preview

SpigotMC plugin page

Build

To build, you need:

  • Maven
  • JDK 8
  • buildSettings.properties file with outputDir property set to path where you want the JAR to appear

git clone the repository, cd into its dir and run mvn clean install.

Using as an API

The plugin allows you to create and remove wires programmatically, so you or your developers can implement some awesome ideas like electricity, power poles, etc.

Adding as a dependency

First, you need to build this plugin using instructions above.

Then, you need to add the plugin as a Maven dependency:

<dependency>
    <groupId>me.saharnooby.plugins</groupId>
    <artifactId>lead-wires</artifactId>
    <version>1.1.10</version>
</dependency>

Alternatively, you can just download plugin from SpigotMC and link it yourself.

Add to your plugin.yml: depend: ['LeadWires'] so Spigot will know to load your plugin after LeadWires.

To get an API instance, call me.saharnooby.plugins.leadwires.LeadWires.getApi().

API documentation

/**
 * An API for the {@link me.saharnooby.plugins.leadwires.LeadWires} plugin.
 * <p>This API is not thread-safe and must be called only from the tick thread.
 * @author saharNooby
 * @since 10:04 26.03.2020
 */
public interface LeadWiresAPI {

	/**
	 * @return List of all existing wires in all worlds.
	 */
	Map<UUID, Wire> getWires();

	/**
	 * Finds a wire by an UUID.
	 * @param uuid UUID of the wire.
	 * @return Optional containing the found wire, or empty optional, if the wire does not exist.
	 */
	Optional<Wire> getWire(@NonNull UUID uuid);

	/**
	 * Creates a new wire from an UUID and two points in the same world.
	 * If wire with such UUID already exists, an {@link IllegalArgumentException} will be thrown.
	 * If worlds of the locations are different, an {@link IllegalArgumentException} will be thrown.
	 * @param uuid UUID of the wire.
	 * @param a First point.
	 * @param b Second point.
	 */
	void addWire(@NonNull UUID uuid, @NonNull Location a, @NonNull Location b);

	/**
	 * Creates a new wire from two points in the same world.
	 * If worlds of the locations are different, an {@link IllegalArgumentException} will be thrown.
	 * @param a First point.
	 * @param b Second point.
	 * @return Generated UUID of the new wire.
	 */
	UUID addWire(@NonNull Location a, @NonNull Location b);

	/**
	 * Creates a new thick wire from two points in the same world.
	 * Thick wires consist of 3 regular wires and appear as two times bigger.
	 * If any wire with such UUID already exists, an {@link IllegalArgumentException} will be thrown.
	 * If worlds of the locations are different, an {@link IllegalArgumentException} will be thrown.
	 * @param uuids List of UUIDs of the new wires, must contain exactly three non-null elements.
	 * @param a First point.
	 * @param b Second point.
	 */
	void addThickWire(@NonNull List<UUID> uuids, @NonNull Location a, @NonNull Location b);

	/**
	 * Creates a new wire from an UUID and two points in the same world.
	 * Thick wires consist of 3 regular wires and appear as two times bigger.
	 * If worlds of the locations are different, an {@link IllegalArgumentException} will be thrown.
	 * @param a First point.
	 * @param b Second point.
	 * @return List of three generated UUIDs of each new wire.
	 */
	List<UUID> addThickWire(@NonNull Location a, @NonNull Location b);

	/**
	 * Removes a wire by its UUID.
	 * If the wire does not exist, this method does nothing.
	 * @param uuid UUID of the wire.
	 */
	void removeWire(@NonNull UUID uuid);

}

lead-wires's People

Contributors

colorswind avatar ledariatim1 avatar saharnooby avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

lead-wires's Issues

Wires don't appear even with enableWireResend enabled

The issue

I encounter the issue, where wires set aren't appearing (silverfish don't spawn and no lead is visible).
Even having enableWireResend set to true doesn't fix this issue.

Context and steps

The wires, in particular, are saved in a separate world that I have to teleport to first (will change in the future).
The world is called spawn and here's the content of the wires.txt

c4b58297-e39a-4157-9436-fa60d492e32a,spawn,68.5,29.5,174.5,71.5,31.5,174.5
74d56ed0-b880-4a98-a891-a300d23aa877,spawn,62.5,36.5,160.5,65.5,38.5,160.5
4ad2a47c-5620-4ce1-bb2e-09ff62e6113d,hub,-13.5,69.5,-26.5,-17.5,70.5,-26.5
b819bc1b-51a7-44a5-9dd8-12cacfe51212,hub,-21.5,69.5,-26.5,-17.5,70.5,-26.5
6d702981-e8a5-4ed2-94e2-a04ad6537cf8,spawn,115.5,30.5,183.5,117.5,31.5,185.5
732c67bb-efe4-4616-a277-84e41a6226be,spawn,59.5,36.5,160.5,62.5,36.5,160.5
2edd246d-accd-43f8-a3a1-30a1563066fe,spawn,68.5,29.5,174.5,65.5,31.5,174.5
fd35ada5-74d0-4a94-ae2f-76b6938f5eec,spawn,62.5,36.5,156.5,59.5,36.5,156.5
f8535f45-5c1a-4a64-bbc4-6a9fb21e4503,spawn,59.5,36.5,156.5,56.5,38.5,156.5
57e783f4-4b8a-4a5f-b818-069f88c51bf1,spawn,115.5,30.5,183.5,117.5,31.5,180.5
62871461-94a5-4108-83d8-17169543a4f1,spawn,68.5,29.5,178.5,65.5,31.5,178.5
5d5979ec-3b4b-4b86-b61f-d09cf4c8740b,spawn,62.5,36.5,156.5,65.5,38.5,156.5
074c5ce7-042c-4738-b229-2e291b920013,spawn,68.5,29.5,178.5,71.5,31.5,178.5
be94323a-fe6e-4cf7-96a2-e1aacd08f4a8,spawn,59.5,36.5,160.5,56.5,38.5,160.5

All wires in hub are perfectly fine.

Steps to reproduce (I guess):

  • Have a separate world where you aren't by default.
  • Teleport to it.
  • Create wires
  • Teleport to another world or restart the server.
  • Go back to the world.

Info

  • Server: PaperMC git-Paper-334 (MC: 1.15.2)
  • Plugin: 1.1.1
  • Other Plugins:
    • AdvancedTabOverlay
    • Animatronics
    • ArmorStandTools
    • BKCommonLib
    • CinematicUI
    • Citizens
    • DeluxeChat
    • DeluxePlugins
    • DiscordSRV
    • Essentials
    • EssentialsSpawn
    • HeadDatabase
    • HelpPagePlus
    • HolographicDisplays
    • InfoHeads
    • InteractiveBoard
    • LeaderBalloons
    • LeadWires
    • LightAPI
    • LuckPerms
    • MailMe
    • Maplands
    • MessageAnnouncer
    • Multiverse-Core
    • OpenAudioMc
    • PlaceholderAPI
    • PowerPlugins
    • ProtocolLib
    • QuickShop
    • ServerListPlus
    • StatusNPC
    • SurveyPlus
    • Train_Carts
    • Vault
    • VoidGenerator
    • WarpSystem
    • WorldEdit
    • WorldGuard

Suggestion: add a method to move wire

If wires are used to make dynamic effects, you need to remove wires and then add them back when you need to update their position. If there is a method to move the position of wires, it world be better.

1.16.2: Wires are not displayed on placement

When placing wires using the place-tool are the leads not visible.

The plugin will also complain, that you have already clicked on the block, even if you click it for the first time.

image

Suggestion: Redstone over wires

Allow optional Sensing of Redstone over the wires :D

If redstone is powered on one site, the redstone schould be able to send over the wrie to the otehr end.
It additinal would be nice if the signal could be repeated too from lead-wire to lead-wire.

image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.