GithubHelp home page GithubHelp logo

shynixn / astraledit Goto Github PK

View Code? Open in Web Editor NEW
12.0 4.0 14.0 406 KB

AstralEdit is a spigot plugin to pre render WorldEdit selections in Minecraft.

License: Apache License 2.0

Java 89.22% Kotlin 10.78%
hacktoberfest hacktoberfest2018 bukkit minecraft spigot

astraledit's Introduction

AstralEdit Build Status GitHub license

branch status coverage version download
master Build Status Coverage GitHub license Download latest release
experimental Build Status Coverage GitHub license Download snapshots

JavaDocs: https://shynixn.github.io/AstralEdit/apidocs/

Description

AstralEdit is a spigot plugin to render WorldEdit selections in Minecraft.

Features

  • View your WorldEdit selection in advance
  • Move, rotate, flip, mirror selections
  • Place your selection anywhere
  • Version support 1.8.R1 - 1.12.R1

Installation

Screenshots

alt tag alt tag

How to use the API

Maven

<dependency>
     <groupId>com.github.shynixn</groupId>
     <artifactId>astraledit</artifactId>
     <version>1.1.0</version>
     <scope>provided</scope>
</dependency>

Gradle

dependencies {
    compileOnly 'com.github.shynixn:astraledit:1.1.0'
}

Rendering the WorldEdit selection of the player and moving it to the player's location

//Get a player and a plugin instance
Player player;
Plugin plugin;

 //It is highly recommend to work with selections asynchronly to increase server performance
Bukkit.getServer().getScheduler().runTaskAsynchronously(plugin, new Runnable() {
   @Override
   public void run() {
       Selection selection = AstralEditApi.render(player);
       selection.move(player.getLocation());
   }
});

Rendering the blocks between two given corners, moving it to a targetLocation and placing the blocks.

//Select the locations
Location corner1 = new Location(Bukkit.getWorld("world"), 20, 5, 20);
Location corner2 = new Location(Bukkit.getWorld("world"), 40, 10, 40);
Location targetLocation  = new Location(Bukkit.getWorld("world"), 70, 8, 40);

//Get a player and a plugin instance
Player player;
Plugin plugin;

Bukkit.getServer().getScheduler().runTaskAsynchronously(plugin, new Runnable() {
        @Override
        public void run() {
            Selection selection = AstralEditApi.renderAndDestroy(player,corner1, corner2);
            selection.move(targetLocation);
            selection.placeBlocks();
            AstralEditApi.clearRenderedObject(player); //Do not forget to clean up the selection
        }
});

Contributing

  • Fork the AstralEdit project on github and clone it to your local environment.
  • Use BuildTools.jar from spigotmc.org to build the following dependencies.
java -jar BuildTools.jar --rev 1.8
java -jar BuildTools.jar --rev 1.8.3
java -jar BuildTools.jar --rev 1.8.8
java -jar BuildTools.jar --rev 1.9
java -jar BuildTools.jar --rev 1.9.4
java -jar BuildTools.jar --rev 1.10
java -jar BuildTools.jar --rev 1.11
java -jar BuildTools.jar --rev 1.12
java -jar BuildTools.jar --rev 1.13
java -jar BuildTools.jar --rev 1.13.1
  • Install the created libraries to your local maven repository.
mvn install:install-file -Dfile=spigot-1.8.jar -DgroupId=org.spigotmc -DartifactId=spigot18R1 -Dversion=1.8.0-R1.0 -Dpackaging=jar
mvn install:install-file -Dfile=spigot-1.8.3.jar -DgroupId=org.spigotmc -DartifactId=spigot18R2 -Dversion=1.8.3-R2.0 -Dpackaging=jar
mvn install:install-file -Dfile=spigot-1.8.8.jar -DgroupId=org.spigotmc -DartifactId=spigot18R3 -Dversion=1.8.8-R3.0 -Dpackaging=jar
mvn install:install-file -Dfile=spigot-1.9.jar -DgroupId=org.spigotmc -DartifactId=spigot19R1 -Dversion=1.9.0-R1.0 -Dpackaging=jar
mvn install:install-file -Dfile=spigot-1.9.4.jar -DgroupId=org.spigotmc -DartifactId=spigot19R2 -Dversion=1.9.4-R2.0 -Dpackaging=jar
mvn install:install-file -Dfile=spigot-1.10.2.jar -DgroupId=org.spigotmc -DartifactId=spigot110R1 -Dversion=1.10.2-R1.0 -Dpackaging=jar
mvn install:install-file -Dfile=spigot-1.11.jar -DgroupId=org.spigotmc -DartifactId=spigot111R1 -Dversion=1.11.0-R1.0 -Dpackaging=jar
mvn install:install-file -Dfile=spigot-1.12.jar -DgroupId=org.spigotmc -DartifactId=spigot112R1 -Dversion=1.12.0-R1.0 -Dpackaging=jar
mvn install:install-file -Dfile=spigot-1.13.jar -DgroupId=org.spigotmc -DartifactId=spigot113R1 -Dversion=1.13.0-R1.0 -Dpackaging=jar
mvn install:install-file -Dfile=spigot-1.13.1.jar -DgroupId=org.spigotmc -DartifactId=spigot113R2 -Dversion=1.13.1-R2.0 -Dpackaging=jar
  • Reimport the AstralEdit maven project and execute 'mvn package' afterwards.
  • The generated astraledit-bukkit-plugin/target/astraledit-bukkit-plugin-version.jar can be used for testing on a server.

Licence

Copyright 2015-2018 Shynixn

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

astraledit's People

Contributors

abhyudayasharma avatar beatbrot avatar chrisom79 avatar meik99 avatar mibac138 avatar monst12 avatar nikgil avatar shynixn avatar vankka avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

astraledit's Issues

Hacktoberfest Discussion Thread

Hacktoberfest 2018

+Thanks for already over 21 completed tasks!

This project has not been active for about a year and would need some love from fellow developers. If you are a OpenSource contributor, you have found a project which provides explained and easy tasks for you :)

Guidlines

Required Knowledge

  • Java or Kotlin developer
  • Common knowledge about the Bukkit API

Code/Style/Architecture

  • Please use the existing layout of the project and avoid creating packages.
  • Keep consistency over the whole project.

Getting started

  • Look for a task below which you would like to do
  • Create a new issue with the task name and label Hacktoberfest
  • Fork and clone the repository to your local pc
  • Use the contributing description on the README to setup required dependencies in order to build the project.
  • Work on it :)
  • Submit a pull request when you are done to initiate a reviewing process

Tasks

Open Tasks

It is highly recommend to create a new issue on this project with the task name for example "refactor the 'render' command" to avoid duplicate task pull requests.

  • There are some code smells in AstralEdit which should be removed in order to achieve clean code.
  • Remove the SimpleCommandExecutor class as only 1 statement is actually used of the inherited classes. Move this registration statement to the related constructor.
  • There should not be Utils classes in a good project. AstralEdit does not require the RefelectionUtils class as using the required reflection for each use case is a way better.
  • Replace calls to the ReflectionUtils with actual reflection. Remove the ReflectionUtils class in the end.
  • The SelectionController should have one single function called cleanResources(Player player) to clear all allocated resources of the given player.

  • The implementation should call clearSelection and clearOperation.

  • Refactor the SelectionListener by removing the inheritance SimpleListener and adding the interface Listener. The parameter of the class should only be a SelectionController which is used in the onPlayerQuitEvent to call clearResources

  • Register the listener in the AstralEditPlugin class and delete the SimpleListener class

  • There are commands implemented in the commands package using the AstralEdit.INSTANCE api or even worse the SelectionManager class directly like passing them as parameter. This is not a good coding style as an interface, in this case the SelectionController, should be used instead.
    How to complete this task:

  • Replace all references to the AstralEdit.INSTANCE and SelectionManager with references to the SelectionController.
  • If the SelectionController does not offer the same functions from the SelectionManager add them to the interface.

Completed Tasks

The commandexecutor SelectionCommandExecutor.java is very messy concerning readability of the onPlayerExecuteCommand function. Using the https://en.wikipedia.org/wiki/Command_pattern helps resolving this.

There is already one command called AutoRotateCommand correctly refactored.

Steps:

  1. Creating a command class.
  2. Moving the validation checks
  3. Moving the implementation.

There are many commands which need to get refactored. Each one is a single task.

  • Create a package called service in the bukkit-api project below the entity package and create a new class called UpdateService
  • The only method should be called checkForUpdates() which returns a CompletableFuture$Boolean$.
  • Put a new class UpdateServiceImpl in the service package of the bukkit-plugin project and refactor the implementation from the UpdateUtils class to the new UpdateServiceImpl. The UpdateServiceImpl should have a constructor taking a plugin instance for doing a asynchrone webrequest inside.
  • Remove the UpdateUtils.class once it is no longer used.

Help

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.