mirror of
https://github.com/Freezy-Studios/BlazeSMP.git
synced 2025-04-21 19:44:05 +02:00
fix PressurePlateListener
This commit is contained in:
parent
e85ca6785c
commit
7240f34ff0
2 changed files with 34 additions and 6 deletions
|
@ -5,6 +5,7 @@ import me.freezy.plugins.papermc.blazesmp.module.manager.L4M4;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.Particle;
|
||||||
import org.bukkit.configuration.file.FileConfiguration;
|
import org.bukkit.configuration.file.FileConfiguration;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
|
@ -40,9 +41,8 @@ public class PressurePlateListener implements Listener {
|
||||||
config.getDouble("spawn-location.y", 200),
|
config.getDouble("spawn-location.y", 200),
|
||||||
config.getDouble("spawn-location.z", 0)
|
config.getDouble("spawn-location.z", 0)
|
||||||
);
|
);
|
||||||
// Verwende die zentrale Nachricht aus der messages.json
|
|
||||||
teleportMessage = L4M4.get("pressureplate.teleport");
|
teleportMessage = L4M4.get("pressureplate.teleport");
|
||||||
teleportDelay = 5*20L; // Default to 5 seconds (100 ticks)
|
teleportDelay = 5 * 20L;
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
|
@ -59,11 +59,26 @@ public class PressurePlateListener implements Listener {
|
||||||
};
|
};
|
||||||
task.runTaskLater(plugin, teleportDelay);
|
task.runTaskLater(plugin, teleportDelay);
|
||||||
playerTasks.put(event.getPlayer().getUniqueId(), task);
|
playerTasks.put(event.getPlayer().getUniqueId(), task);
|
||||||
|
|
||||||
|
new BukkitRunnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
if (playerTasks.containsKey(event.getPlayer().getUniqueId())) {
|
||||||
|
event.getPlayer().getWorld().spawnParticle(Particle.PORTAL, event.getPlayer().getLocation(), 30, 0.5, 0.5, 0.5, 0.1);
|
||||||
|
} else {
|
||||||
|
cancel();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}.runTaskTimer(plugin, 0, 10);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (playerTasks.containsKey(event.getPlayer().getUniqueId())) {
|
if (playerTasks.containsKey(event.getPlayer().getUniqueId())) {
|
||||||
playerTasks.get(event.getPlayer().getUniqueId()).cancel();
|
if (event.getFrom().getBlockX() != event.getTo().getBlockX() ||
|
||||||
playerTasks.remove(event.getPlayer().getUniqueId());
|
event.getFrom().getBlockY() != event.getTo().getBlockY() ||
|
||||||
|
event.getFrom().getBlockZ() != event.getTo().getBlockZ()) {
|
||||||
|
playerTasks.get(event.getPlayer().getUniqueId()).cancel();
|
||||||
|
playerTasks.remove(event.getPlayer().getUniqueId());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,3 +3,16 @@ player-prefix: '<color:dark_gray>[</color><gradient:#747e80:#828d8f><b>Player</b
|
||||||
discord-report-webhook: ''
|
discord-report-webhook: ''
|
||||||
discord-url: 'https://discord.gg/cww2YDt2bx'
|
discord-url: 'https://discord.gg/cww2YDt2bx'
|
||||||
tab_update_interval: 5 #Seconds
|
tab_update_interval: 5 #Seconds
|
||||||
|
isEndOpen: false
|
||||||
|
|
||||||
|
pressure-plate:
|
||||||
|
world: "world"
|
||||||
|
x: 1
|
||||||
|
y: 68
|
||||||
|
z: 0
|
||||||
|
|
||||||
|
spawn-location:
|
||||||
|
world: "world"
|
||||||
|
x: 0
|
||||||
|
y: 200
|
||||||
|
z: 0
|
Loading…
Add table
Add a link
Reference in a new issue