Add block interaction enhancements and git properties
Updated block interaction behavior for IRON_TRAPDOOR and BIG_DRIPLEAF_PLACEABLE to allow their state to be toggled. Added the use of git properties to build.gradle.kts, allowing insightful git information such as commit id and time to be retrieved and printed.
This commit is contained in:
parent
df875406e1
commit
6209b71db4
|
|
@ -1,6 +1,7 @@
|
|||
plugins {
|
||||
id("java")
|
||||
id("maven-publish")
|
||||
id("com.gorylenko.gradle-git-properties") version "2.3.1"
|
||||
}
|
||||
|
||||
group = "com.alttd"
|
||||
|
|
@ -15,6 +16,10 @@ java {
|
|||
}
|
||||
}
|
||||
|
||||
gitProperties {
|
||||
keys = listOf("git.commit.id", "git.commit.time")
|
||||
}
|
||||
|
||||
tasks {
|
||||
withType<JavaCompile> {
|
||||
options.encoding = Charsets.UTF_8.name()
|
||||
|
|
|
|||
|
|
@ -11,6 +11,10 @@ import com.alttd.playerutils.util.Logger;
|
|||
import org.bukkit.plugin.PluginManager;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.Properties;
|
||||
|
||||
public final class PlayerUtils extends JavaPlugin {
|
||||
|
||||
private Logger logger;
|
||||
|
|
@ -22,6 +26,20 @@ public final class PlayerUtils extends JavaPlugin {
|
|||
registerCommands();
|
||||
registerEvents();
|
||||
reloadConfigs();
|
||||
printVersion();
|
||||
}
|
||||
|
||||
private void printVersion() {
|
||||
Properties gitProps = new Properties();
|
||||
try (InputStream inputStream = getClass().getClassLoader().getResourceAsStream("git.properties")) {
|
||||
gitProps.load(inputStream);
|
||||
} catch (IOException e) {
|
||||
logger.severe("Unable to load git.properties, unknown version");
|
||||
return;
|
||||
}
|
||||
|
||||
logger.info("Git commit ID: %s".formatted(gitProps.getProperty("git.commit.id")));
|
||||
logger.info("Git commit time: %s".formatted(gitProps.getProperty("git.commit.time")));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -55,7 +55,13 @@ public class RotateBlockEvent implements Listener {
|
|||
return;
|
||||
|
||||
Material type = block.getType();
|
||||
if (Tag.STAIRS.isTagged(type)) {
|
||||
if (type.equals(Material.IRON_TRAPDOOR) && event.getAction().isLeftClick()) {
|
||||
event.setCancelled(true);
|
||||
toggleTrapDoor(block, player);
|
||||
} else if (Tag.BIG_DRIPLEAF_PLACEABLE.isTagged(type) && event.getAction().isLeftClick()) {
|
||||
event.setCancelled(true);
|
||||
toggleDripLeaf(block, player);
|
||||
} else if (Tag.STAIRS.isTagged(type)) {
|
||||
event.setCancelled(true);
|
||||
rotateStairs(block, player);
|
||||
} else if (Tag.WALLS.isTagged(type)) {
|
||||
|
|
@ -67,12 +73,6 @@ public class RotateBlockEvent implements Listener {
|
|||
} else if(Tag.RAILS.isTagged(type)) {
|
||||
event.setCancelled(true);
|
||||
toggleRails(block, player);
|
||||
} else if (type.equals(Material.IRON_TRAPDOOR) && event.getAction().isLeftClick()) {
|
||||
event.setCancelled(true);
|
||||
toggleTrapDoor(block, player);
|
||||
} else if (Tag.BIG_DRIPLEAF_PLACEABLE.isTagged(type) && event.getAction().isLeftClick()) {
|
||||
event.setCancelled(true);
|
||||
toggleDripLeaf(block, player);
|
||||
} else if (block.getBlockData() instanceof Directional directional) {
|
||||
event.setCancelled(true);
|
||||
rotateDirectionalBlock(block, directional, player);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user