diff --git a/pom.xml b/pom.xml
index 1d34c89..22d99fe 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
cn.superiormc
MythicTotem
- 2.6.0
+ 2.7.3
jar
MythicTotem
diff --git a/src/main/java/cn/superiormc/mythictotem/MythicTotem.java b/src/main/java/cn/superiormc/mythictotem/MythicTotem.java
index 8aee10f..057c099 100644
--- a/src/main/java/cn/superiormc/mythictotem/MythicTotem.java
+++ b/src/main/java/cn/superiormc/mythictotem/MythicTotem.java
@@ -7,7 +7,9 @@
import cn.superiormc.mythictotem.events.PlayerClickEvent;
import cn.superiormc.mythictotem.events.PlayerPlaceEvent;
import cn.superiormc.mythictotem.events.TotemRedstoneEvent;
-import cn.superiormc.mythictotem.managers.*;
+import cn.superiormc.mythictotem.libreforge.TriggerTotemActived;
+import cn.superiormc.mythictotem.managers.PlacedBlockCheckManager;
+import cn.superiormc.mythictotem.managers.TotemManager;
import cn.superiormc.mythictotem.utils.CheckPluginLoad;
import io.th0rgal.protectionlib.ProtectionLib;
import org.bukkit.Bukkit;
@@ -26,7 +28,7 @@ public final class MythicTotem extends JavaPlugin {
public static String lastErrorMessage = "";
- public static boolean freeVersion = true;
+ public static boolean freeVersion = false;
public static int threeDtotemAmount = 0;
@@ -45,6 +47,11 @@ public void onEnable() {
instance = this;
ProtectionLib.init(this);
this.saveDefaultConfig();
+ if (GeneralSettingConfigs.GetRegisterLibreforge()) {
+ Bukkit.getConsoleSender().sendMessage("§x§9§8§F§B§9§8[MythicTotem] §fHooking into libreforge...");
+ TriggerTotemActived.load();
+ Bukkit.getConsoleSender().sendMessage("§x§9§8§F§B§9§8[MythicTotem] §fRegistered totem_actived trigger for libreforge!");
+ }
TotemConfigs.GetTotemConfigs();
Events();
Commands();
diff --git a/src/main/java/cn/superiormc/mythictotem/api/TotemActivedEvent.java b/src/main/java/cn/superiormc/mythictotem/api/TotemActivedEvent.java
new file mode 100644
index 0000000..6de040c
--- /dev/null
+++ b/src/main/java/cn/superiormc/mythictotem/api/TotemActivedEvent.java
@@ -0,0 +1,47 @@
+package cn.superiormc.mythictotem.api;
+
+import org.bukkit.Bukkit;
+import org.bukkit.Location;
+import org.bukkit.entity.Player;
+import org.bukkit.event.Event;
+import org.bukkit.event.HandlerList;
+import org.jetbrains.annotations.NotNull;
+
+public class TotemActivedEvent extends Event {
+
+ private static final HandlerList handlers = new HandlerList();
+
+ private final Player player;
+
+ private final Location location;
+
+ private final String totemID;
+
+ public TotemActivedEvent(String totemID, Player player, Location location) {
+ this.player = player;
+ this.location = location;
+ this.totemID = totemID;
+ }
+
+ public Player GetPlayer() {
+ return player;
+ }
+
+ public Location GetLocation() {
+ return location;
+ }
+
+ public String GetTotemID() {
+ return totemID;
+ }
+
+ @NotNull
+ @Override
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+}
diff --git a/src/main/java/cn/superiormc/mythictotem/configs/GeneralSettingConfigs.java b/src/main/java/cn/superiormc/mythictotem/configs/GeneralSettingConfigs.java
index a8b8a14..22c2046 100644
--- a/src/main/java/cn/superiormc/mythictotem/configs/GeneralSettingConfigs.java
+++ b/src/main/java/cn/superiormc/mythictotem/configs/GeneralSettingConfigs.java
@@ -41,4 +41,8 @@ public static boolean GetBlockDamageEventCancel(){
return MythicTotem.instance.getConfig().getBoolean("settings.disappear.BlockDamageEvent.enabled", false);
}
+ public static boolean GetRegisterLibreforge(){
+ return MythicTotem.instance.getConfig().getBoolean("settings.register-libreforge", false);
+ }
+
}
diff --git a/src/main/java/cn/superiormc/mythictotem/events/PlayerClickEvent.java b/src/main/java/cn/superiormc/mythictotem/events/PlayerClickEvent.java
index e25accd..d90fdcd 100644
--- a/src/main/java/cn/superiormc/mythictotem/events/PlayerClickEvent.java
+++ b/src/main/java/cn/superiormc/mythictotem/events/PlayerClickEvent.java
@@ -3,8 +3,6 @@
import cn.superiormc.mythictotem.MythicTotem;
import cn.superiormc.mythictotem.configs.GeneralSettingConfigs;
import cn.superiormc.mythictotem.managers.ValidManager;
-import dev.lone.itemsadder.api.CustomBlock;
-import io.lumine.mythic.core.items.MythicItem;
import org.bukkit.Bukkit;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
@@ -41,7 +39,7 @@ public void InteractEvent(PlayerInteractEvent event) {
}, MythicTotem.instance.getConfig().getLong("settings.cooldown-tick", 5L));
if (MythicTotem.instance.getConfig().getBoolean("settings.debug", false)) {
Bukkit.getConsoleSender().sendMessage("§x§9§8§F§B§9§8[MythicTotem] §eLocation: " + event.getClickedBlock().getLocation());
- Bukkit.getConsoleSender().sendMessage("§x§9§8§F§B§9§8[MythicTotem] §bIA Block: " + CustomBlock.byAlreadyPlaced(event.getClickedBlock()).getNamespacedID());
+ //Bukkit.getConsoleSender().sendMessage("§x§9§8§F§B§9§8[MythicTotem] §bIA Block: " + CustomBlock.byAlreadyPlaced(event.getClickedBlock()).getNamespacedID());
Bukkit.getConsoleSender().sendMessage("§x§9§8§F§B§9§8[MythicTotem] §cBiome: " + event.getClickedBlock().getBiome().name());
}
}
diff --git a/src/main/java/cn/superiormc/mythictotem/events/TotemRedstoneEvent.java b/src/main/java/cn/superiormc/mythictotem/events/TotemRedstoneEvent.java
index 954770d..e33b7ea 100644
--- a/src/main/java/cn/superiormc/mythictotem/events/TotemRedstoneEvent.java
+++ b/src/main/java/cn/superiormc/mythictotem/events/TotemRedstoneEvent.java
@@ -14,9 +14,6 @@ public class TotemRedstoneEvent implements Listener {
@EventHandler
public void RedstoneEvent(BlockRedstoneEvent event) {
- if (event.isCancelled()) {
- return;
- }
Bukkit.getScheduler().runTaskAsynchronously(MythicTotem.instance, () -> {
synchronized(event) {
new ValidManager(event);
@@ -24,7 +21,7 @@ public void RedstoneEvent(BlockRedstoneEvent event) {
});
if (MythicTotem.instance.getConfig().getBoolean("settings.debug", false)) {
Bukkit.getConsoleSender().sendMessage("§x§9§8§F§B§9§8[MythicTotem] §eLocation: " + event.getBlock().getLocation());
- Bukkit.getConsoleSender().sendMessage("§x§9§8§F§B§9§8[MythicTotem] §bIA Block: " + CustomBlock.byAlreadyPlaced(event.getBlock()).getNamespacedID());
+ //Bukkit.getConsoleSender().sendMessage("§x§9§8§F§B§9§8[MythicTotem] §bIA Block: " + CustomBlock.byAlreadyPlaced(event.getBlock()).getNamespacedID());
}
}
}
diff --git a/src/main/java/cn/superiormc/mythictotem/libreforge/TriggerTotemActived.java b/src/main/java/cn/superiormc/mythictotem/libreforge/TriggerTotemActived.java
new file mode 100644
index 0000000..ab89a66
--- /dev/null
+++ b/src/main/java/cn/superiormc/mythictotem/libreforge/TriggerTotemActived.java
@@ -0,0 +1,88 @@
+package cn.superiormc.mythictotem.libreforge;
+
+import cn.superiormc.mythictotem.api.TotemActivedEvent;
+import com.willfp.libreforge.Holder;
+import com.willfp.libreforge.ProvidedHolder;
+import com.willfp.libreforge.SimpleProvidedHolder;
+import com.willfp.libreforge.triggers.Trigger;
+import com.willfp.libreforge.triggers.TriggerData;
+import com.willfp.libreforge.triggers.TriggerParameter;
+import com.willfp.libreforge.triggers.Triggers;
+import org.bukkit.Location;
+import org.bukkit.block.Block;
+import org.bukkit.entity.Player;
+import org.bukkit.event.EventHandler;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import java.util.HashSet;
+import java.util.Set;
+
+public class TriggerTotemActived extends Trigger {
+
+ public static void load() {
+ Triggers.INSTANCE.register(new TriggerTotemActived());
+ }
+
+ public TriggerTotemActived() {
+ super("totem_actived");
+ }
+
+
+ @NotNull
+ @Override
+ public Set getParameters() {
+ Set data = new HashSet<>();
+ data.add(TriggerParameter.PLAYER);
+ data.add(TriggerParameter.BLOCK);
+ data.add(TriggerParameter.LOCATION);
+ data.add(TriggerParameter.TEXT);
+ return data;
+ }
+
+ @EventHandler
+ public void handle(TotemActivedEvent event) {
+ Player player = event.GetPlayer();
+ Location location = event.GetLocation();
+ Block block = location.getBlock();
+ String text = event.GetTotemID();
+ ProvidedHolder holder = new ProvidedHolder() {
+ @NotNull
+ @Override
+ public Holder getHolder() {
+ return null;
+ }
+
+ @Nullable
+ @Override
+ public Object getProvider() {
+ return null;
+ }
+
+ @NotNull
+ @Override
+ public Holder component1() {
+ return null;
+ }
+
+ @Nullable
+ @Override
+ public Object component2() {
+ return null;
+ }
+ };
+ TriggerData data = new TriggerData(holder,
+ player,
+ null,
+ block,
+ null,
+ location,
+ null,
+ null,
+ null,
+ text,
+ 1,
+ player);
+ this.dispatch(player, data, null);
+ }
+}
diff --git a/src/main/java/cn/superiormc/mythictotem/managers/ValidManager.java b/src/main/java/cn/superiormc/mythictotem/managers/ValidManager.java
index 2b511ec..ad1a15e 100644
--- a/src/main/java/cn/superiormc/mythictotem/managers/ValidManager.java
+++ b/src/main/java/cn/superiormc/mythictotem/managers/ValidManager.java
@@ -1,6 +1,7 @@
package cn.superiormc.mythictotem.managers;
import cn.superiormc.mythictotem.MythicTotem;
+import cn.superiormc.mythictotem.api.TotemActivedEvent;
import cn.superiormc.mythictotem.utils.CheckPluginLoad;
import cn.superiormc.mythictotem.utils.CheckProtection;
import cn.superiormc.mythictotem.utils.RemoveBlock;
@@ -8,6 +9,7 @@
import io.th0rgal.oraxen.api.OraxenBlocks;
import org.bukkit.Bukkit;
import org.bukkit.Location;
+import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.event.block.BlockPlaceEvent;
@@ -543,6 +545,11 @@ private void AfterCheck(PlacedBlockCheckManager singleTotem,
Bukkit.getScheduler().callSyncMethod(MythicTotem.instance, () -> {
ActionManager actionManager = new ActionManager(startLocation, singleTotem, singleTotem.GetTotemManager().GetTotemAction(), player, block);
actionManager.CheckAction();
+ TotemActivedEvent totemActivedEvent = new TotemActivedEvent(
+ singleTotem.GetTotemManager().GetSection().getName(),
+ this.player,
+ this.block.getLocation());
+ Bukkit.getPluginManager().callEvent(totemActivedEvent);
return null;
});
}
diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml
index 6f825e5..7751ead 100644
--- a/src/main/resources/config.yml
+++ b/src/main/resources/config.yml
@@ -71,6 +71,7 @@ settings:
can-break: false
can-interact: false
can-use: false
+ register-libreforge: false
disappear:
BukkitAPI:
# This BukkitAPI option can not be disabled!