From 864cd68e796a8baa21854a15c4336e0e087306e9 Mon Sep 17 00:00:00 2001 From: Phoenix616 Date: Sun, 6 Oct 2019 18:08:11 +0100 Subject: [PATCH] Add factions Hooks (2 and UUID) --- .../factions-uuid/pom.xml | 31 ++++++++++ .../hook/plugin/Factions1_6_9_5_U0Hook.java | 57 +++++++++++++++++++ randomteleport-plugin-hooks/factions/pom.xml | 37 ++++++++++++ .../hook/plugin/Factions2Hook.java | 56 ++++++++++++++++++ randomteleport-plugin-hooks/pom.xml | 2 + 5 files changed, 183 insertions(+) create mode 100644 randomteleport-plugin-hooks/factions-uuid/pom.xml create mode 100644 randomteleport-plugin-hooks/factions-uuid/src/main/java/de/themoep/randomteleport/hook/plugin/Factions1_6_9_5_U0Hook.java create mode 100644 randomteleport-plugin-hooks/factions/pom.xml create mode 100644 randomteleport-plugin-hooks/factions/src/main/java/de/themoep/randomteleport/hook/plugin/Factions2Hook.java diff --git a/randomteleport-plugin-hooks/factions-uuid/pom.xml b/randomteleport-plugin-hooks/factions-uuid/pom.xml new file mode 100644 index 0000000..be596e9 --- /dev/null +++ b/randomteleport-plugin-hooks/factions-uuid/pom.xml @@ -0,0 +1,31 @@ + + + + + randomteleport-plugin-hooks + de.themoep.randomteleport.pluginhook + 2.0-SNAPSHOT + + 4.0.0 + + factions-uuid + + + + factions-repo + http://ci.ender.zone/plugin/repository/everything/ + + + + + + com.massivecraft + Factions + 1.6.9.5-U0.2.1-SNAPSHOT + provided + + + + \ No newline at end of file diff --git a/randomteleport-plugin-hooks/factions-uuid/src/main/java/de/themoep/randomteleport/hook/plugin/Factions1_6_9_5_U0Hook.java b/randomteleport-plugin-hooks/factions-uuid/src/main/java/de/themoep/randomteleport/hook/plugin/Factions1_6_9_5_U0Hook.java new file mode 100644 index 0000000..21f07d6 --- /dev/null +++ b/randomteleport-plugin-hooks/factions-uuid/src/main/java/de/themoep/randomteleport/hook/plugin/Factions1_6_9_5_U0Hook.java @@ -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 . + */ + +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; + } +} diff --git a/randomteleport-plugin-hooks/factions/pom.xml b/randomteleport-plugin-hooks/factions/pom.xml new file mode 100644 index 0000000..7adb460 --- /dev/null +++ b/randomteleport-plugin-hooks/factions/pom.xml @@ -0,0 +1,37 @@ + + + + + randomteleport-plugin-hooks + de.themoep.randomteleport.pluginhook + 2.0-SNAPSHOT + + 4.0.0 + + factions + + + + minebench-repo + https://repo.minebench.de/ + + + + + + com.massivecraft.factions + Factions + 2.12.0 + provided + + + com.massivecraft.massivecore + massivecore + 2.12.0 + provided + + + + \ No newline at end of file diff --git a/randomteleport-plugin-hooks/factions/src/main/java/de/themoep/randomteleport/hook/plugin/Factions2Hook.java b/randomteleport-plugin-hooks/factions/src/main/java/de/themoep/randomteleport/hook/plugin/Factions2Hook.java new file mode 100644 index 0000000..75baf3b --- /dev/null +++ b/randomteleport-plugin-hooks/factions/src/main/java/de/themoep/randomteleport/hook/plugin/Factions2Hook.java @@ -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 . + */ +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; + } +} diff --git a/randomteleport-plugin-hooks/pom.xml b/randomteleport-plugin-hooks/pom.xml index 9913ac9..977c0c9 100644 --- a/randomteleport-plugin-hooks/pom.xml +++ b/randomteleport-plugin-hooks/pom.xml @@ -19,6 +19,8 @@ worldguard-7 griefprevention redprotect + factions + factions-uuid worldborder