mirror of
https://gitlab.com/phoenix-dvpmt/mmocore.git
synced 2024-12-29 05:47:36 +01:00
!Improved block trigger calculation
This commit is contained in:
parent
adb5239d36
commit
64db110f3c
@ -7,11 +7,10 @@ import net.Indyuce.mmocore.api.load.MMOLineConfig;
|
|||||||
import net.Indyuce.mmocore.api.player.PlayerData;
|
import net.Indyuce.mmocore.api.player.PlayerData;
|
||||||
|
|
||||||
public abstract class Trigger {
|
public abstract class Trigger {
|
||||||
private long delay;
|
private final long delay;
|
||||||
|
|
||||||
public Trigger(MMOLineConfig config) {
|
public Trigger(MMOLineConfig config) {
|
||||||
if (config.contains("delay"))
|
delay = config.contains("delay") ? (long) (config.getDouble("delay") * 20) : 0;
|
||||||
delay = (long) (config.getDouble("delay") * 20);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasDelay() {
|
public boolean hasDelay() {
|
||||||
|
@ -18,7 +18,6 @@ import org.bukkit.metadata.FixedMetadataValue;
|
|||||||
import net.Indyuce.mmocore.MMOCore;
|
import net.Indyuce.mmocore.MMOCore;
|
||||||
import net.Indyuce.mmocore.api.event.CustomBlockMineEvent;
|
import net.Indyuce.mmocore.api.event.CustomBlockMineEvent;
|
||||||
import net.Indyuce.mmocore.api.player.PlayerData;
|
import net.Indyuce.mmocore.api.player.PlayerData;
|
||||||
import net.Indyuce.mmocore.api.quest.trigger.ExperienceTrigger;
|
|
||||||
import net.Indyuce.mmocore.manager.CustomBlockManager.BlockInfo;
|
import net.Indyuce.mmocore.manager.CustomBlockManager.BlockInfo;
|
||||||
import net.Indyuce.mmocore.manager.RestrictionManager.BlockPermissions;
|
import net.Indyuce.mmocore.manager.RestrictionManager.BlockPermissions;
|
||||||
|
|
||||||
@ -81,15 +80,11 @@ public class BlockListener implements Listener {
|
|||||||
* apply triggers, add experience info to the event so the other
|
* apply triggers, add experience info to the event so the other
|
||||||
* events can give exp to other TOOLS and display HOLOGRAMS
|
* events can give exp to other TOOLS and display HOLOGRAMS
|
||||||
*/
|
*/
|
||||||
if (info.hasTriggers()) {
|
if (info.hasTriggers() && !block.hasMetadata("player_placed")) {
|
||||||
PlayerData playerData = PlayerData.get(player);
|
PlayerData playerData = PlayerData.get(player);
|
||||||
info.getTriggers().forEach(trigger -> {
|
info.getTriggers().forEach(trigger -> trigger.apply(playerData));
|
||||||
if (!block.hasMetadata("player_placed") && trigger instanceof ExperienceTrigger)
|
|
||||||
trigger.apply(playerData);
|
|
||||||
});
|
|
||||||
if (!block.hasMetadata("player_placed") && info.hasExperience() && MMOCore.plugin.hasHolograms())
|
if (!block.hasMetadata("player_placed") && info.hasExperience() && MMOCore.plugin.hasHolograms())
|
||||||
MMOCore.plugin.hologramSupport.displayIndicator(block.getLocation().add(.5, 1.5, .5),
|
MMOCore.plugin.hologramSupport.displayIndicator(block.getLocation().add(.5, 1.5, .5), MMOCore.plugin.configManager.getSimpleMessage("exp-hologram", "exp", "" + called.getGainedExperience().getValue()).message(), player);
|
||||||
MMOCore.plugin.configManager.getSimpleMessage("exp-hologram", "exp", "" + called.getGainedExperience().getValue()).message(), player);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
Reference in New Issue
Block a user