Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
c067444
JsonDocPrinter - fix cancellable issue
ShaneBeee Feb 8, 2026
e222cdf
JsonDocPrinter - fix some expressions being keyed incorrectly
ShaneBeee Feb 8, 2026
38d4069
JsonDocPrinter - fix return type name
ShaneBeee Feb 8, 2026
fc89eb7
EffectCommands - fix permission part 2
ShaneBeee Feb 8, 2026
5f309cb
config.sk - change effect commands perm to match other perms
ShaneBeee Feb 8, 2026
1016ac7
Utils - add in debug
ShaneBeee Feb 8, 2026
bc3d593
SkriptRegistration - enable debug since it's handled in the logger
ShaneBeee Feb 8, 2026
8902f09
SkriptRegistration - enable debug since it's handled in the logger (p…
ShaneBeee Feb 8, 2026
33cbaf0
Skript - fix debug setup
ShaneBeee Feb 8, 2026
a79fb28
[ci skip] build.gradle.kts - switch parser to dev branch
ShaneBeee Feb 8, 2026
e1f33cc
EvtPlayerDiscoverZone - fix incorrect context value class
ShaneBeee Feb 8, 2026
536d64b
JsonDocPrinter - change "event values" to "context values"
ShaneBeee Feb 8, 2026
5d6c8d9
SkriptCommand - add some color
ShaneBeee Feb 8, 2026
95e009a
JsonVariableStorage - more detailed messages
ShaneBeee Feb 8, 2026
c7242fb
gitignore - add idea folder
ShaneBeee Feb 8, 2026
94a1e24
Merge branch 'master' into dev/patch
ShaneBeee Feb 8, 2026
2d893d6
Utils - nicer logging
ShaneBeee Feb 8, 2026
e81cf03
Doc updates
ShaneBeee Feb 8, 2026
13fbff1
ExprUUID - fix getting uuid of `player`
ShaneBeee Feb 8, 2026
af23138
ExprUUID - oops forgot entities
ShaneBeee Feb 8, 2026
975c29d
ExprTargetBlockOfPlayer - add config value for max distance
ShaneBeee Feb 8, 2026
dff06fa
SkriptConfig - refactor how config is handled
ShaneBeee Feb 8, 2026
6307165
SkriptConfig - prep work for updating config with version check
ShaneBeee Feb 8, 2026
34067a6
SkriptConfig - prep work for updating config with version check (part 2)
ShaneBeee Feb 8, 2026
be334e7
Skript - delay post-load triggers til after the server finishes booting
ShaneBeee Feb 9, 2026
51cef14
EffSendMessage - some updates to senders
ShaneBeee Feb 9, 2026
a65e1d1
Add delay information
ShaneBeee Feb 9, 2026
cc0ea53
ScriptCommand - add option to turn off default permission
ShaneBeee Feb 9, 2026
bc19318
SkriptConfig - add option to enable/disable default command perms
ShaneBeee Feb 9, 2026
659ef4a
ScriptCommand - checkstyle - fix long line
ShaneBeee Feb 9, 2026
f58d42a
ScriptSubCommand - don't allow sub commands outside of commands
ShaneBeee Feb 9, 2026
2f2dc04
EntityComponentUtils - add uuid/name stuff
ShaneBeee Feb 9, 2026
5a8aaa2
EntityComponentUtils - rename to EntityUtils
ShaneBeee Feb 9, 2026
09d363a
DefaultConverters - add message to string converter
ShaneBeee Feb 9, 2026
4a084b5
Entity names - handle this better
ShaneBeee Feb 9, 2026
ea9215d
EntityUtils - remove debug messages
ShaneBeee Feb 9, 2026
3384f74
ExprName - put entity first as it tries to convert an entity to a player
ShaneBeee Feb 9, 2026
b4d1009
Types - add toVariableNameFunction to lotsa types
ShaneBeee Feb 9, 2026
a08d721
Types - checkstyle - long times
ShaneBeee Feb 9, 2026
2ae4517
build.gradle.kts - update skript-parser to 1.0.6
ShaneBeee Feb 9, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ repositories {
dependencies {
compileOnly("com.hypixel.hytale:Server:${hytaleVersion}")
compileOnly("org.jetbrains:annotations:26.0.2")
implementation("com.github.SkriptDev:skript-parser:1.0.5") {
implementation("com.github.SkriptDev:skript-parser:1.0.6") {
isTransitive = false
}
implementation("com.github.Zoltus:TinyMessage:2.0.1") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,10 @@ public String toTypeString() {
this.getType().getId(), this.pos.getX(), this.pos.getY(), this.pos.getZ(), this.world.getName());
}

public String toVariableNameString() {
return String.format("%s_%s_%s_%s_%s", this.world.getName(), this.getType().getId(), this.pos.getX(), this.pos.getY(), this.pos.getZ());
}

@Override
public String toString() {
return "Block{" +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ public String getName() {
return this.name;
}

public String getVariableName() {
return "direction:" + this.name.toLowerCase(Locale.ROOT);
}

private static Location create(Location location, Number offset, int x, int y, int z) {
double value = offset.doubleValue();
Vector3d add = location.getPosition().add(x * value, y * value, z * value);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@
import com.hypixel.hytale.math.vector.Vector3d;
import com.hypixel.hytale.math.vector.Vector3f;
import com.hypixel.hytale.server.core.entity.Entity;
import com.hypixel.hytale.server.core.entity.EntityUtils;
import com.hypixel.hytale.server.core.entity.LivingEntity;
import com.hypixel.hytale.server.core.entity.UUIDComponent;
import com.hypixel.hytale.server.core.entity.movement.MovementStatesComponent;
import com.hypixel.hytale.server.core.entity.nameplate.Nameplate;
import com.hypixel.hytale.server.core.inventory.ItemStack;
import com.hypixel.hytale.server.core.modules.entity.item.ItemComponent;
import com.hypixel.hytale.server.core.modules.entitystats.EntityStatMap;
Expand All @@ -23,11 +24,79 @@
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.util.UUID;

/**
* Quick utility class for accessing entity components.
*/
@SuppressWarnings("UnusedReturnValue")
public class EntityComponentUtils {
public class EntityUtils {

/**
* Get the UUID of an {@link Entity}
*
* @param entity Entity to get UUID from
* @return UUID of the entity, or null if the entity has no UUID component
*/
public static @Nullable UUID getUUID(@NotNull Entity entity) {
Ref<EntityStore> reference = entity.getReference();
if (reference == null) return null;

Store<EntityStore> store = reference.getStore();
UUIDComponent component = store.getComponent(reference, UUIDComponent.getComponentType());
if (component == null) return null;
return component.getUuid();
}

/**
* Get the name of an {@link Entity}.
*
* @param entity Entity to get name from
* @return Name of the entity, or null if the entity has no name component
*/
@SuppressWarnings("removal")
public static @NotNull String getName(Entity entity) {
Ref<EntityStore> reference = entity.getReference();
if (reference == null) return "no-reference";

Store<EntityStore> store = reference.getStore();
Nameplate component = store.getComponent(reference, Nameplate.getComponentType());
if (component != null) {
return component.getText();
}
// REMOVAL (we shouldn't be using this as a backup)
return entity.getLegacyDisplayName();
}

public static @NotNull String getVariableName(Entity entity) {
UUID uuid = getUUID(entity);
if (uuid == null) return "<unknown>";
return uuid.toString();
}

/**
* Set the name of an {@link Entity}.
*
* @param entity Entity to set name on
* @param name New name for the entity
*/
public static void setNameplateName(Entity entity, @Nullable String name) {
Ref<EntityStore> reference = entity.getReference();
if (reference == null) return;

Store<EntityStore> store = reference.getStore();
if (name == null) {
store.removeComponent(reference, Nameplate.getComponentType());
return;
}
Nameplate component = store.getComponent(reference, Nameplate.getComponentType());
if (component != null) {
component.setText(name);
} else {
Nameplate n = new Nameplate(name);
store.addComponent(reference, Nameplate.getComponentType(), n);
}
}

/**
* Get a component from an Entity
Expand Down Expand Up @@ -101,7 +170,7 @@ public class EntityComponentUtils {

store.addEntity(itemEntityHolder, AddReason.SPAWN);

return new Pair<>(EntityUtils.getEntity(itemEntityHolder), itemComponent);
return new Pair<>(com.hypixel.hytale.server.core.entity.EntityUtils.getEntity(itemEntityHolder), itemComponent);
}

}
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package com.github.skriptdev.skript.api.skript.addon;

import com.github.skriptdev.skript.api.utils.Utils;
import com.hypixel.hytale.logger.HytaleLogger;
import com.hypixel.hytale.server.core.Message;
import fi.sulku.hytale.TinyMsg;
import io.github.syst3ms.skriptparser.registration.SkriptAddon;
import org.jetbrains.annotations.Nullable;

Expand All @@ -18,7 +20,7 @@ public abstract class HySkriptAddon extends SkriptAddon {

public HySkriptAddon(String name) {
super(name);
this.hytaleLogger = HytaleLogger.get("HySkript|" + name + "|A");
this.hytaleLogger = Utils.getAddonLogger(name);
}

/**
Expand Down Expand Up @@ -47,16 +49,17 @@ public final Manifest getManifest() {

public final Message[] getInfo() {
List<Message> info = new ArrayList<>();
info.add(Message.raw("Version: " + this.manifest.getVersion()));
info.add(TinyMsg.parse("Version: <color:#FADD89>" + this.manifest.getVersion()));

String description = this.manifest.getDescription();
if (description != null) info.add(Message.raw("Description: " + description));
if (description != null) info.add(TinyMsg.parse("Description: <color:#FADD89>" + description));

@Nullable String[] authors = this.manifest.getAuthors();
if (authors != null) info.add(Message.raw("Authors: " + String.join(", ", authors)));
if (authors != null)
info.add(TinyMsg.parse("Authors: <color:#FADD89>" + String.join("<reset>, <color:#FADD89>", authors)));

String website = this.manifest.getWebsite();
if (website != null) info.add(Message.raw("Website: ").insert(Message.raw(website).link(website)));
if (website != null) info.add(TinyMsg.parse("Website: <color:#0CE8C3><link:" + website + ">" + website));

return info.toArray(Message[]::new);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.github.skriptdev.skript.api.skript.command;

import com.github.skriptdev.skript.plugin.HySk;
import com.github.skriptdev.skript.plugin.Skript;
import com.github.skriptdev.skript.plugin.elements.command.ScriptCommand.PlayerScriptCommandContext;
import com.github.skriptdev.skript.plugin.elements.command.ScriptCommand.ScriptCommandContext;
import com.github.skriptdev.skript.plugin.elements.command.ScriptCommand.WorldScriptCommandContext;
Expand Down Expand Up @@ -44,6 +45,8 @@
*/
public class ScriptCommandBuilder {

private static final boolean CAN_GENERATE_PERMISSION_DEFAULT = Skript.getInstance().getSkriptConfig().getCommandsGeneratePermissions();

public static ScriptCommandBuilder create(int commandType, SkriptLogger logger) {
return new ScriptCommandBuilder(commandType, logger);
}
Expand All @@ -56,6 +59,7 @@ public static ScriptCommandBuilder create(int commandType, SkriptLogger logger)
private AbstractCommand hyCommand;

private final SectionConfiguration sec = new SectionConfiguration.Builder()
.addOptionalLiteral("can-generate-permission", Boolean.class)
.addOptionalKey("permission")
.addOptionalKey("description")
.addOptionalList("aliases")
Expand Down Expand Up @@ -111,6 +115,9 @@ public List<Statement> setupCommand(FileSection section, ParserState parserState
description = "";
}

Boolean canGeneratePermission = this.sec.getValue("can-generate-permission", Boolean.class)
.orElse(CAN_GENERATE_PERMISSION_DEFAULT);

if (hasTrigger) {
CodeSection trigger = triggerSec.get();
if (trigger.getItems().isEmpty()) {
Expand All @@ -120,6 +127,11 @@ public List<Statement> setupCommand(FileSection section, ParserState parserState

this.hyCommand = switch (commandType) {
case 1 -> new AbstractPlayerCommand(this.commandName, description) {
@Override
protected boolean canGeneratePermission() {
return canGeneratePermission;
}

@Override
protected void execute(@NotNull CommandContext commandContext, @NotNull Store<EntityStore> store,
@NotNull Ref<EntityStore> ref, @NotNull PlayerRef playerRef, @NotNull World world) {
Expand All @@ -134,6 +146,10 @@ protected void execute(@NotNull CommandContext commandContext, @NotNull Store<En
}
};
case 2 -> new AbstractWorldCommand(this.commandName, description) {
@Override
protected boolean canGeneratePermission() {
return canGeneratePermission;
}

@Override
protected void execute(@NotNull CommandContext commandContext, @NotNull World world,
Expand All @@ -147,7 +163,10 @@ protected void execute(@NotNull CommandContext commandContext, @NotNull World wo
}
};
default -> new AbstractCommand(this.commandName, description) {

@Override
protected boolean canGeneratePermission() {
return canGeneratePermission;
}
@Override
protected @Nullable CompletableFuture<Void> execute(@NotNull CommandContext commandContext) {
CompletableFuture.runAsync(() -> {
Expand All @@ -167,7 +186,10 @@ protected void execute(@NotNull CommandContext commandContext, @NotNull World wo
};
} else {
this.hyCommand = new AbstractCommandCollection(this.commandName, description) {

@Override
protected boolean canGeneratePermission() {
return canGeneratePermission;
}
};
}
this.args.forEach((key, arg) -> {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
package com.github.skriptdev.skript.api.skript.config;

import com.github.skriptdev.skript.api.utils.Utils;
import com.github.skriptdev.skript.plugin.Skript;
import com.hypixel.hytale.common.semver.Semver;
import io.github.syst3ms.skriptparser.config.Config;
import io.github.syst3ms.skriptparser.config.Config.ConfigSection;
import io.github.syst3ms.skriptparser.log.ErrorType;
import io.github.syst3ms.skriptparser.log.LogEntry;
import io.github.syst3ms.skriptparser.log.SkriptLogger;
import org.jetbrains.annotations.Nullable;

import java.nio.file.Path;

/**
* Config for Skript
*/
public class SkriptConfig {

private final Config config;
private final boolean debug;
private final int maxTargetBlockDistance;
private final ConfigSection effectCommands;
private final ConfigSection databases;
private final boolean commandsGeneratePermissions;

public SkriptConfig(Skript skript) {
Path skriptConfigPath = skript.getPlugin().getDataDirectory().resolve("config.sk");
SkriptLogger logger = new SkriptLogger(true);
this.config = new Config(skriptConfigPath, "/config.sk", logger);

// Set up debug mode
this.debug = this.config.getBoolean("debug");
Utils.setDebug(this.debug);

// Check for update
String string = this.config.getString("hyskript-version");
if (string != null) {
Semver configVersion = Semver.fromString(string);
logger.debug("Checking for update from: " + configVersion);
Semver hySkriptVersion = skript.getPlugin().getManifest().getVersion();
if (configVersion.compareTo(hySkriptVersion) < 0) {
logger.debug("Updating config to version: " + hySkriptVersion);
updateConfig();
} else {
logger.debug("Config is up to date");
}
} else {
logger.error("hyskript-version not found in config.sk, no update checking can be performed.", ErrorType.STRUCTURE_ERROR);
}

// Set up max-target-block-distance
this.maxTargetBlockDistance = this.config.getInt("max-target-block-distance");
if (this.maxTargetBlockDistance == -1) {
// This would happen if the config is missing this value
// TODO update config
} else if (this.maxTargetBlockDistance < 0) {
logger.error("max-target-block-distance must be greater than or equal to 0", ErrorType.STRUCTURE_ERROR);
}

// Set up effect commands
this.effectCommands = this.config.getConfigSection("effect-commands");
if (this.effectCommands == null) {
logger.error("Effect commands section not found in config.sk", ErrorType.STRUCTURE_ERROR);
// TODO update config
}

// Set up databases
this.databases = this.config.getConfigSection("databases");
if (this.databases == null) {
logger.error("Databases section not found in config.sk", ErrorType.STRUCTURE_ERROR);
// TODO update config
}

// Set up commands generate permissions
this.commandsGeneratePermissions = this.config.getBoolean("commands-generate-permissions", true);

logger.finalizeLogs();
for (LogEntry logEntry : logger.close()) {
Utils.log(null, logEntry);
}
}

@SuppressWarnings("unused")
public Config getBaseConfig() {
return this.config;
}

/**
* Get whether debug mode is enabled
*
* @return Whether debug mode is enabled
*/
public boolean getDebug() {
return this.debug;
}

/**
* Get the maximum target block distance.
*
* @return Maximum target block distance.
*/
public int getMaxTargetBlockDistance() {
return this.maxTargetBlockDistance;
}

/**
* Get the effect commands section.
*
* @return Effect commands section.
*/
public @Nullable ConfigSection getEffectCommands() {
return this.effectCommands;
}

/**
* Get the databases section.
*
* @return Databases section.
*/
public @Nullable ConfigSection getDatabases() {
return this.databases;
}

/**
* Get whether commands should generate permissions.
*
* @return Whether commands should generate permissions.
*/
public boolean getCommandsGeneratePermissions() {
return this.commandsGeneratePermissions;
}

private void updateConfig() {
// TODO update config
}

}
Loading
Loading