Add factions Hooks (2 and UUID)

This commit is contained in:
Phoenix616 2019-10-06 18:08:11 +01:00
parent a41bf653fb
commit 864cd68e79
5 changed files with 183 additions and 0 deletions

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">
<parent>
<artifactId>randomteleport-plugin-hooks</artifactId>
<groupId>de.themoep.randomteleport.pluginhook</groupId>
<version>2.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>factions-uuid</artifactId>
<repositories>
<repository>
<id>factions-repo</id>
<url>http://ci.ender.zone/plugin/repository/everything/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>com.massivecraft</groupId>
<artifactId>Factions</artifactId>
<version>1.6.9.5-U0.2.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,57 @@
package de.themoep.randomteleport.hook.plugin;
/*
* RandomTeleport - Factions UUID Hook
* 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.massivecraft.factions.Board;
import com.massivecraft.factions.FLocation;
import de.themoep.randomteleport.hook.ProtectionHook;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;
public class Factions1_6_9_5_U0Hook implements ProtectionHook {
private final Plugin inst;
public Factions1_6_9_5_U0Hook() {
inst = Bukkit.getPluginManager().getPlugin("Factions");
}
@Override
public Plugin getPlugin() {
return inst;
}
@Override
public String getPluginName() {
return inst.getName();
}
@Override
public boolean canBuild(Player player, Location location) {
return Board.getInstance().getFactionAt(new FLocation(location)) == null;
}
@Override
public boolean canBuild(Player player, World world, int chunkX, int chunkZ) {
return Board.getInstance().getFactionAt(new FLocation(world.getName(), chunkX, chunkZ)) == null;
}
}

View File

@ -0,0 +1,37 @@
<?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">
<parent>
<artifactId>randomteleport-plugin-hooks</artifactId>
<groupId>de.themoep.randomteleport.pluginhook</groupId>
<version>2.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>factions</artifactId>
<repositories>
<repository>
<id>minebench-repo</id>
<url>https://repo.minebench.de/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>com.massivecraft.factions</groupId>
<artifactId>Factions</artifactId>
<version>2.12.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.massivecraft.massivecore</groupId>
<artifactId>massivecore</artifactId>
<version>2.12.0</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,56 @@
package de.themoep.randomteleport.hook.plugin;
/*
* RandomTeleport - Factions Hook
* 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.massivecraft.factions.entity.BoardColl;
import com.massivecraft.massivecore.ps.PS;
import de.themoep.randomteleport.hook.ProtectionHook;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;
public class Factions2Hook implements ProtectionHook {
private final Plugin inst;
public Factions2Hook() {
inst = Bukkit.getPluginManager().getPlugin("Factions");
}
@Override
public Plugin getPlugin() {
return inst;
}
@Override
public String getPluginName() {
return inst.getName();
}
@Override
public boolean canBuild(Player player, Location location) {
return BoardColl.get().getFactionAt(PS.valueOf(location)) == null;
}
@Override
public boolean canBuild(Player player, World world, int chunkX, int chunkZ) {
return BoardColl.get().getFactionAt(PS.valueOf(world.getName(), chunkX, chunkZ)) == null;
}
}

View File

@ -19,6 +19,8 @@
<module>worldguard-7</module>
<module>griefprevention</module>
<module>redprotect</module>
<module>factions</module>
<module>factions-uuid</module>
<module>worldborder</module>
</modules>