Code Monkey home page Code Monkey logo

blwarps's Introduction

BLWarps Build Status

BLWarps is a Sponge plugin for easily setting locations for players to warp to.

Commands

Note: In the following commands, square brackets ([]) indicate optional arguments, and angle brackets (<>) indicate required arguments.

Warp Commands

  • /warp set [-g] <warp name> [x] [y] [z]
  • Create a new warp with name warp name and optional coordinates (x, y, z). Add the -g flag to make it a global warp.
  • /warp <warp id>
  • Warp to the warp with ID warp id.
  • /warp delete <warp id>
  • Delete the warp with ID warp id.
  • /warp list
  • List all of the warps for which one has permission to use
  • /warp info <warp id>
  • Displays information about the specified warp

Warp Region Commands

  • /warp region set [-g] <region name> <warp id> <corner1> <corner1>
  • Create a new warp region with name region name, linked warp with ID warp id and corners corner1 and corner2
  • /warp region delete <region id>
  • Delete the warp region with ID region id.
  • /warp region list
  • List all of the regions for which the player has permission to use their linked warps
  • /warp region info <region id>
  • Displays information about the warp region with ID region id

Warp Regions

A warp region is an area in a world in which a player will be warped to any arbitrary warp if they enter the region. Currently, there is no support for WorldGuard regions, but it is a planned feature. See the Warp Region Commands section above for instructions.

Warp Signs

Warp signs can be created for any previously established warp. To do this, simply place a sign anywhere in the world, and write the following text on each line:

  1. [Warp]
  2. <warp name>
  3. Doesn't matter
  4. Doesn't matter

If you have correctly placed the sign, the text on the sign will be colored and reformatted. To use the sign to warp, simply right click on the sign.

Permissions

Permission to use a warp is given on a per-warp basis, as shown below:

  • blwarps.warp.<warp name> Permissions for various commands are as follows:
  • blwarps.warp.create: Permission to create a private warp
  • blwarps.warp.create-global: Permission to create a global warp
  • blwarps.warp.delete-global: Permission to delete a global warp
  • blwarps.region.create: Permission to create a private warp region
  • blwarps.region.create-global: Permission to create a global warp region
  • blwarps.region.delete-global: Permission to delete a global warp region You can also configure the number of private warps a player can have with the warpCreationLimit option. For example, see the following PermissionsEx configuration:
"group": {
    "test": [
        {
            "options": {
                "warpCreationLimit": "2"
            }
        }
    ]
}

Storage

Regardless of the storage solution, each warp has 5 properties:

  • id - the unique ID of the warp. Follows the format: username/warpname
  • name - the name of the warp
  • owner - the owner of the warp's UUID, or "global"
  • world - the name of the world that contains the warp
  • x - the x coordinate of the warp (stored as a double)
  • y - the y coordinate of the warp (stored as a double)
  • z - the z coordinate of the warp (stored as a double)

Flat File Storage

For flat file storage, warps are stored as JSON (serialized using Jackson) in the config/BLWarps/warps.json file. A sample warps.json file would be similar to the following:

[ {
    "id" : "global/warp1",
    "name" : "warp1",
    "owner" : "global",
    "world" : "world",
    "x" : 40.3,
    "y" : 41.0,
    "z" : 72.07
}, {
    "id" : "Zirconium/warp2",
    "name" : "warp2",
    "owner" : "5d30e92c-5ae2-4284-a3ee-74bc15077439",
    "world" : "DIM-1",
    "x" : 7.63,
    "y" : 64.0,
    "z" : 11.79
} ]

SQL Storage

Any JDBC-compatible database is a valid option for storing warps. The JDBC connection URL must be specified in the sql.connection-url. By default, the Warps will be stored in the warps table. Currently, the name of the table cannot be changed. BLWarps uses JDBI for executing queries and mapping results to a Warp object.

REST API Storage

For REST-based storage, HTTP requests are sent using the Jersey Client to the URI specified by the rest-uri field in the configuration. Currently, only basic authentication is available, which uses the rest.username and rest.password credentials (by default, they are root and pass, respectively). The plugin will send the following requests, and will expect the application/json media type as part of the response:

  • GET when loading warps - must receive a List of Warps
  • POST when saving a new warp
  • DELETE when deleting a warp. The warp's name will be a path parameter.
  • Ex: http://localhost:8080/warps/deletethiswarp

Building BLWarps

BLWarps uses Maven as a dependency manager and build tool. To build the plugin from source, make sure Maven is installed, and run mvn clean install. The newly built plugin will be in target/bl-warps-{version}.jar. For developing, run the Maven build once, then add the target/generated-sources/java-templates directory as a source folder (see graphic below for how to do this in Eclipse).

Add generated sources as a source folder

blwarps's People

Contributors

r15ch13 avatar robertherhold avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

blwarps's Issues

Exceptions on player log in or out event

[14:39:16] [Server thread/ERROR] [Sponge]: Could not pass PlayerLoggedInEvent to SpongePlugin:BLWarps{1.1.0}
java.lang.NullPointerException
at org.spongepowered.common.text.SpongeTextFactory.toPlain(SpongeTextFactory.java:64) ~[SpongeTextFactory.class:1.8-1371-2.1DEV-472+unknown-b472.git-unknown]
at org.spongepowered.common.text.SpongeTextFactory.toPlain(SpongeTextFactory.java:59) ~[SpongeTextFactory.class:1.8-1371-2.1DEV-472+unknown-b472.git-unknown]
at org.spongepowered.api.text.Texts.toPlain(Texts.java:405) ~[Texts.class:1.8-1371-2.1DEV-472+unknown-b472.git-unknown]
at com.blocklaunch.blwarps.eventhandlers.MessageEventHandler.handle(MessageEventHandler.java:33) ~[MessageEventHandler.class:?]
at com.blocklaunch.blwarps.eventhandlers.MessageEventHandler.handle(MessageEventHandler.java:20) ~[MessageEventHandler.class:?]
at org.spongepowered.common.event.RegisteredHandler.handle(RegisteredHandler.java:86) ~[RegisteredHandler.class:1.8-1371-2.1DEV-472+unknown-b472.git-unknown]
at org.spongepowered.common.event.SpongeEventManager.post(SpongeEventManager.java:248) [SpongeEventManager.class:1.8-1371-2.1DEV-472+unknown-b472.git-unknown]
at org.spongepowered.mod.event.SpongeModEventManager.post(SpongeModEventManager.java:69) [SpongeModEventManager.class:1.8-1371-2.1DEV-472+unknown-b472.git-unknown]
at net.minecraftforge.fml.common.eventhandler.EventBus.post(EventBus.java:56) [EventBus.class:?]
at net.minecraftforge.fml.common.FMLCommonHandler.firePlayerLoggedIn(FMLCommonHandler.java:591) [FMLCommonHandler.class:?]
at net.minecraft.server.management.ServerConfigurationManager.initializeConnectionToPlayer(ServerConfigurationManager.java:218) [sn.class:?]
at net.minecraftforge.fml.common.network.handshake.NetworkDispatcher.completeServerSideConnection(NetworkDispatcher.java:229) [NetworkDispatcher.class:?]
at net.minecraftforge.fml.common.network.handshake.NetworkDispatcher.serverToClientHandshake(NetworkDispatcher.java:138) [NetworkDispatcher.class:?]
at net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.fmlServerHandshake(FMLNetworkHandler.java:64) [FMLNetworkHandler.class:?]
at net.minecraft.server.network.NetHandlerLoginServer.func_147326_c(NetHandlerLoginServer.java:116) [rq.class:?]
at net.minecraft.server.network.NetHandlerLoginServer.func_73660_a(NetHandlerLoginServer.java:62) [rq.class:?]
at net.minecraft.network.NetworkManager.func_74428_b(NetworkManager.java:248) [gr.class:?]
at net.minecraft.network.NetworkSystem.func_151269_c(NetworkSystem.java:191) [rc.class:?]
at net.minecraft.server.MinecraftServer.func_71190_q(MinecraftServer.java:726) [MinecraftServer.class:?]
at net.minecraft.server.dedicated.DedicatedServer.func_71190_q(DedicatedServer.java:364) [po.class:?]
at net.minecraft.server.MinecraftServer.func_71217_p(MinecraftServer.java:598) [MinecraftServer.class:?]
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:478) [MinecraftServer.class:?]
at java.lang.Thread.run(Thread.java:745) [?:1.8.0_45]

Permissions

Add per-warp permissions. Possibly add groups of warps which can be allowed/forbidden with a single permission

Inventory Item Warps

Add support for custom items that can be selected in an inventory that warp the player when clicked on.

Multiple Warp points not working

Expected Results: Multiple warps should permit the user to warp to any in the list.

Actual Results: Only the first warp appears to be loading and working.

Steps

  1. Installed fresh Forge server 1397
  2. Installed sponge-1.8-1371-2.1DEV-433.jar
  3. Installed sponge-warps-0.1.0.jar
  4. Loaded a fresh world.
  5. Logged into game and created a home warp point.
  6. Moved out some distance and created a second warp point.
  7. Typed /warp home and it telleported me back to home.
  8. Typed /warp test and it did not warp me off Home and gave a message that it was successful.

warps.json file created

[ {
  "name" : "home",
  "world" : "world",
  "x" : -185.37,
  "y" : 69.0,
  "z" : -190.26
}, {
  "name" : "test",
  "world" : "world",
  "x" : -195.89,
  "y" : 73.0,
  "z" : -118.61
} ]

Using flatfile format for storage.

Sign Warps

Add support for creating signs for players to click on and be warped

Update README.md with exact command usage

I've been having trouble figuring out the syntax to create region warps. Could you update the README.md with some exact examples of how to use each warp command?

If I understand the warp region correctly, I should be able to create a new region named Foo that, when entered by a player, will take me to the warp identified by Player/WarpName. I want that region to be where my player currently is, which via F3 I see is at -212,6,-358. I am trying the following:

/warp region set Foo Player/WarpName -212,6,-358 -212,6,-358

but it comes back saying:

Too many arguments!
region set Foo Player/WarpName -212,6,-358 -212,6,-358
      ^

Am I using the correct syntax?

Info text

In the output of /warp ls, put a ? at the end that executes /warp info <warp name>

Fix SQL connection URLs

Make sure that JDBC connection URL's can be properly constructed for MySQL and H2 (only supporting those two right now). Also add Travis tests for each.

Error while executing command

[18:09:06] [Server thread/ERROR] [Sponge/]: Error occurred while executing command 'warp chateau' for source EntityPlayerMP['DeathChain01'/0, l='world', x=-891.30, y=74.00, z=-479.59]: org.spongepowered.api.Game.getSyncScheduler()Lorg/spongepowered/api/service/scheduler/SynchronousScheduler;
java.lang.NoSuchMethodError: org.spongepowered.api.Game.getSyncScheduler()Lorg/spongepowered/api/service/scheduler/SynchronousScheduler;
at com.blocklaunch.blwarps.managers.WarpManager.scheduleWarp(WarpManager.java:150) ~[WarpManager.class:?]
at com.blocklaunch.blwarps.commands.executors.WarpExecutor.execute(WarpExecutor.java:53) ~[WarpExecutor.class:?]
at org.spongepowered.api.util.command.args.ChildCommandElementExecutor.execute(ChildCommandElementExecutor.java:173) ~[ChildCommandElementExecutor.class:1.8-1446-2.1DEV-500+unknown-b500.git-unknown]
at org.spongepowered.api.util.command.spec.CommandSpec.process(CommandSpec.java:333) ~[CommandSpec.class:1.8-1446-2.1DEV-500+unknown-b500.git-unknown]
at org.spongepowered.api.util.command.dispatcher.SimpleDispatcher.process(SimpleDispatcher.java:342) ~[SimpleDispatcher.class:1.8-1446-2.1DEV-500+unknown-b500.git-unknown]
at org.spongepowered.api.service.command.SimpleCommandService.process(SimpleCommandService.java:243) [SimpleCommandService.class:1.8-1446-2.1DEV-500+unknown-b500.git-unknown]
at net.minecraft.command.ServerCommandManager.func_71556_a(SourceFile:85) [cl.class:?]
at net.minecraft.network.NetHandlerPlayServer.func_147361_d(NetHandlerPlayServer.java:812) [rj.class:?]
at net.minecraft.network.NetHandlerPlayServer.func_147354_a(NetHandlerPlayServer.java:791) [rj.class:?]
at net.minecraft.network.play.client.C01PacketChatMessage.func_180757_a(SourceFile:37) [lu.class:?]
at net.minecraft.network.play.client.C01PacketChatMessage.func_148833_a(SourceFile:9) [lu.class:?]
at net.minecraft.network.PacketThreadUtil$1.run(SourceFile:13) [ih.class:?]
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) [?:1.7.0_67]
at java.util.concurrent.FutureTask.run(Unknown Source) [?:1.7.0_67]
at net.minecraftforge.fml.common.FMLCommonHandler.callFuture(FMLCommonHandler.java:714) [FMLCommonHandler.class:?]
at net.minecraft.server.MinecraftServer.func_71190_q(MinecraftServer.java:656) [MinecraftServer.class:?]
at net.minecraft.server.dedicated.DedicatedServer.func_71190_q(DedicatedServer.java:364) [po.class:?]
at net.minecraft.server.MinecraftServer.func_71217_p(MinecraftServer.java:598) [MinecraftServer.class:?]
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:478) [MinecraftServer.class:?]
at java.lang.Thread.run(Unknown Source) [?:1.7.0_67]

Use configurate-json

It will make the plugin smaller, as configurate-json is included with sponge.

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.