Add hook for WorldBorder plugin

This commit is contained in:
Phoenix616 2019-01-23 00:19:08 +01:00
parent 69686dd43f
commit f0ed0105d1
3 changed files with 88 additions and 0 deletions

View File

@ -17,6 +17,7 @@
<modules>
<module>worldguard-6</module>
<module>worldguard-7</module>
<module>worldborder</module>
</modules>
<dependencies>

View File

@ -0,0 +1,31 @@
<?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>
<parent>
<artifactId>randomteleport-plugin-hooks</artifactId>
<groupId>de.themoep.randomteleport.pluginhook</groupId>
<version>2.0-SNAPSHOT</version>
</parent>
<artifactId>worldborder</artifactId>
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>com.github.Brettflan</groupId>
<artifactId>WorldBorder</artifactId>
<version>master-c5df3417c8-1</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,56 @@
package de.themoep.randomteleport.hook.plugin;
/*
* RandomTeleport - worldborder - $project.description
* Copyright (c) 2019 Max Lee aka Phoenix616 (mail@moep.tv)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import com.wimbli.WorldBorder.BorderData;
import com.wimbli.WorldBorder.WorldBorder;
import de.themoep.randomteleport.hook.WorldborderHook;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.plugin.Plugin;
public class WorldBorderHook implements WorldborderHook {
private final WorldBorder plugin;
public WorldBorderHook() {
plugin = WorldBorder.plugin;
}
@Override
public Location getCenter(World world) {
BorderData data = plugin.getWorldBorder(world.getName());
return data == null ? null : new Location(world, data.getX(), 0, data.getZ());
}
@Override
public double getBorderRadius(World world) {
BorderData data = plugin.getWorldBorder(world.getName());
return data == null ? -1 : Math.min(data.getRadiusX(), data.getRadiusZ());
}
@Override
public Plugin getPlugin() {
return plugin;
}
@Override
public String getPluginName() {
return plugin.getName();
}
}