save entry location in database

This commit is contained in:
2024-07-14 13:50:23 +02:00
parent 4b2203e5ae
commit 89de8b6ab5
3 changed files with 79 additions and 17 deletions

View File

@@ -16,19 +16,19 @@ import java.util.*;
import static eu.mhsl.minecraft.pixelblocks.PixelBlocks.plugin;
public class PlayerInteractListener implements Listener {
@EventHandler
static void onPlayerInteract(PlayerInteractEvent event) {
if(event.getAction() == Action.RIGHT_CLICK_BLOCK && event.getClickedBlock() != null) {
if(event.getClickedBlock().getType() == Material.GLASS) {
// final WorldCreator worldCreator = new WorldCreator(plugin.getDataFolder().getPath()+"/"+event.getPlayer().getUniqueId());
// worldCreator.type(WorldType.FLAT);
//
// World newWorld = Bukkit.createWorld(worldCreator);
//
// event.getPlayer().teleport(newWorld.getSpawnLocation());
}
}
}
// @EventHandler
// static void onPlayerInteract(PlayerInteractEvent event) {
// if(event.getAction() == Action.RIGHT_CLICK_BLOCK && event.getClickedBlock() != null) {
// if(event.getClickedBlock().getType() == Material.GLASS) {
//// final WorldCreator worldCreator = new WorldCreator(plugin.getDataFolder().getPath()+"/"+event.getPlayer().getUniqueId());
//// worldCreator.type(WorldType.FLAT);
////
//// World newWorld = Bukkit.createWorld(worldCreator);
////
//// event.getPlayer().teleport(newWorld.getSpawnLocation());
// }
// }
// }
@EventHandler
static void onPlayerInteractEntity(PlayerInteractEntityEvent event) {
@@ -47,6 +47,7 @@ public class PlayerInteractListener implements Listener {
if(playerUID.equals(blockOwner)) {
pixelBlock.lastEntryLocation = event.getPlayer().getLocation();
pixelBlock.lastEntryTime = System.currentTimeMillis();
pixelBlock.saveToDB();
World blockWorld = Bukkit.getWorld(plugin.getDataFolder().getPath()+ "/" +pixelBlock.uuid);
assert blockWorld != null;