mirror of https://github.com/Maxlego08/zKoth.git
🚧 Add scoreboard hook
This commit is contained in:
parent
b081162d42
commit
9b814aaca0
Binary file not shown.
Binary file not shown.
Binary file not shown.
21
pom.xml
21
pom.xml
|
@ -165,5 +165,26 @@
|
|||
<version>6.44.6</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.ShieldCommunity</groupId>
|
||||
<artifactId>SternalBoard</artifactId>
|
||||
<version>2.2.0</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${basedir}/libs/SternalBoard-2.2.8-all.jar</systemPath>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>be.maximvdw.featherboard</groupId>
|
||||
<artifactId>FeatherBoard</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${basedir}/libs/FeatherBoard.jar</systemPath>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.puharesource.mc.titlemanager</groupId>
|
||||
<artifactId>TitleManager</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${basedir}/libs/TitleManager-2.3.6.jar</systemPath>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
|
@ -0,0 +1,25 @@
|
|||
package fr.maxlego08.koth.hook.scoreboard;
|
||||
|
||||
import be.maximvdw.featherboard.api.FeatherBoardAPI;
|
||||
import fr.maxlego08.koth.api.KothScoreboard;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
|
||||
public class FeatherBoardHook implements KothScoreboard {
|
||||
|
||||
@Override
|
||||
public void toggle(Player player, Consumer<Player> after) {
|
||||
if (!FeatherBoardAPI.isToggled(player)) {
|
||||
FeatherBoardAPI.toggle(player, true);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void hide(Player player, Consumer<Player> after) {
|
||||
if (FeatherBoardAPI.isToggled(player)) {
|
||||
FeatherBoardAPI.toggle(player, false);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
package fr.maxlego08.koth.hook.scoreboard;
|
||||
|
||||
import com.xism4.sternalboard.SternalBoardPlugin;
|
||||
import com.xism4.sternalboard.managers.ScoreboardManager;
|
||||
import fr.maxlego08.koth.api.KothScoreboard;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
|
||||
public class SternalBoardHook implements KothScoreboard {
|
||||
|
||||
private final ScoreboardManager manager;
|
||||
|
||||
public SternalBoardHook(Plugin plugin) {
|
||||
super();
|
||||
this.manager = ((SternalBoardPlugin) Bukkit.getPluginManager().getPlugin("SternalBoard")).getScoreboardManager();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void toggle(Player player, Consumer<Player> after) {
|
||||
this.manager.setScoreboard(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void hide(Player player, Consumer<Player> after) {
|
||||
this.manager.removeScoreboard(player);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
package fr.maxlego08.koth.hook.scoreboard;
|
||||
|
||||
import fr.maxlego08.koth.api.KothScoreboard;
|
||||
import io.puharesource.mc.titlemanager.api.v2.TitleManagerAPI;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
|
||||
public class TitleManagerHook implements KothScoreboard {
|
||||
|
||||
private TitleManagerAPI api;
|
||||
|
||||
@Override
|
||||
public void toggle(Player player, Consumer<Player> after) {
|
||||
if (api == null)
|
||||
api = (TitleManagerAPI) Bukkit.getServer().getPluginManager().getPlugin("TitleManager");
|
||||
api.giveDefaultScoreboard(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void hide(Player player, Consumer<Player> after) {
|
||||
if (api == null)
|
||||
api = (TitleManagerAPI) Bukkit.getServer().getPluginManager().getPlugin("TitleManager");
|
||||
api.removeScoreboard(player);
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue