From 182eac89c93c05fdb80ac6cc522e94d0a342a9ba Mon Sep 17 00:00:00 2001 From: gnembon Date: Tue, 31 Mar 2020 20:53:10 -0300 Subject: [PATCH 1/4] too long player names, fixes #195 --- src/main/java/carpet/commands/PlayerCommand.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main/java/carpet/commands/PlayerCommand.java b/src/main/java/carpet/commands/PlayerCommand.java index 4440efb4..0ceba52d 100644 --- a/src/main/java/carpet/commands/PlayerCommand.java +++ b/src/main/java/carpet/commands/PlayerCommand.java @@ -246,12 +246,18 @@ public class PlayerCommand } catch (CommandSyntaxException ignored) {} String playerName = StringArgumentType.getString(context, "player"); + if (playerName.length()>40) + { + Messenger.m(context.getSource(), "rb Player name: "+playerName+" is too long"); + return 0; + } MinecraftServer server = source.getMinecraftServer(); PlayerEntity player = EntityPlayerMPFake.createFake(playerName, server, pos.x, pos.y, pos.z, facing.y, facing.x, dim, mode); if (player == null) { Messenger.m(context.getSource(), "rb Player " + StringArgumentType.getString(context, "player") + " doesn't exist " + "and cannot spawn in online mode. Turn the server offline to spawn non-existing players"); + return 0; } return 1; } From 652ca7d6a0ca9377f87f1c2b915bb40ccb3f1b11 Mon Sep 17 00:00:00 2001 From: gnembon Date: Tue, 31 Mar 2020 21:04:09 -0300 Subject: [PATCH 2/4] spawning illegal entities with perimetercheck, fixes #194 --- src/main/java/carpet/commands/PerimeterInfoCommand.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/main/java/carpet/commands/PerimeterInfoCommand.java b/src/main/java/carpet/commands/PerimeterInfoCommand.java index 06760f38..27b80b45 100644 --- a/src/main/java/carpet/commands/PerimeterInfoCommand.java +++ b/src/main/java/carpet/commands/PerimeterInfoCommand.java @@ -7,6 +7,7 @@ import carpet.utils.PerimeterDiagnostics; import com.mojang.brigadier.CommandDispatcher; import com.mojang.brigadier.builder.LiteralArgumentBuilder; import net.minecraft.command.suggestion.SuggestionProviders; +import net.minecraft.entity.Entity; import net.minecraft.entity.EntityType; import net.minecraft.entity.mob.MobEntity; import net.minecraft.server.command.ServerCommandSource; @@ -51,15 +52,17 @@ public class PerimeterInfoCommand if (mobId != null) { nbttagcompound.putString("id", mobId); - entityliving = (MobEntity) EntityType.loadEntityWithPassengers(nbttagcompound, source.getWorld(), (entity_1x) -> { + Entity baseEntity = EntityType.loadEntityWithPassengers(nbttagcompound, source.getWorld(), (entity_1x) -> { entity_1x.refreshPositionAndAngles(pos.offset(Direction.UP,2), entity_1x.yaw, entity_1x.pitch); return !source.getWorld().tryLoadEntity(entity_1x) ? null : entity_1x; }); - if (entityliving == null) + if (!(baseEntity instanceof MobEntity)) { Messenger.m(source, "r Failed to spawn test entity"); + if (baseEntity != null) baseEntity.remove(); return 0; } + entityliving = (MobEntity) baseEntity; } PerimeterDiagnostics.Result res = PerimeterDiagnostics.countSpots(source.getWorld(), pos, entityliving); From c2dfaca1b8938f6765d1e72195f980cda6a5209c Mon Sep 17 00:00:00 2001 From: gnembon Date: Wed, 1 Apr 2020 13:09:02 -0300 Subject: [PATCH 3/4] added 'ping' --- docs/scarpet/Full.md | 4 ++++ docs/scarpet/api/Entities.md | 4 ++++ src/main/java/carpet/script/value/EntityValue.java | 9 +++++++++ 3 files changed, 17 insertions(+) diff --git a/docs/scarpet/Full.md b/docs/scarpet/Full.md index 3a04f299..e45949d4 100644 --- a/docs/scarpet/Full.md +++ b/docs/scarpet/Full.md @@ -2502,6 +2502,10 @@ Returns `null` if the argument is not a player, otherwise: * `shadow`: any carpet-shadowed real player * `realms`: ? +### `query(e,'ping')` + +Player's ping in milliseconds, or `null` if its not a player. + ### `query(e,'permission_level')` Player's permission level, or `null` if not applicable for this entity. diff --git a/docs/scarpet/api/Entities.md b/docs/scarpet/api/Entities.md index 623fd37c..5fec0d0b 100644 --- a/docs/scarpet/api/Entities.md +++ b/docs/scarpet/api/Entities.md @@ -265,6 +265,10 @@ Returns `null` if the argument is not a player, otherwise: * `shadow`: any carpet-shadowed real player * `realms`: ? +### `query(e,'ping')` + +Player's ping in milliseconds, or `null` if its not a player. + ### `query(e,'permission_level')` Player's permission level, or `null` if not applicable for this entity. diff --git a/src/main/java/carpet/script/value/EntityValue.java b/src/main/java/carpet/script/value/EntityValue.java index 4088478a..3cd5726e 100644 --- a/src/main/java/carpet/script/value/EntityValue.java +++ b/src/main/java/carpet/script/value/EntityValue.java @@ -331,6 +331,15 @@ public class EntityValue extends Value return Value.NULL; }); + put("ping", (e, a) -> { + if (e instanceof ServerPlayerEntity) + { + ServerPlayerEntity spe = (ServerPlayerEntity) e; + return new NumericValue(spe.pingMilliseconds); + } + return Value.NULL; + }); + //spectating_entity // isGlowing put("effect", (e, a) -> From 321a051a809f0b3fe67e23307b7cd2a58698420b Mon Sep 17 00:00:00 2001 From: gnembon Date: Wed, 1 Apr 2020 13:19:37 -0300 Subject: [PATCH 4/4] 1.3.17? --- gradle.properties | 2 +- src/main/java/carpet/CarpetSettings.java | 2 +- src/main/resources/fabric.mod.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/gradle.properties b/gradle.properties index 53e836ed..03cd20b9 100644 --- a/gradle.properties +++ b/gradle.properties @@ -9,7 +9,7 @@ org.gradle.jvmargs=-Xmx1G loader_version=0.7.8+build.188 # Mod Properties - mod_version = 1.3.16+v200325 + mod_version = 1.3.17+v200401 maven_group = carpet archives_base_name = fabric-carpet diff --git a/src/main/java/carpet/CarpetSettings.java b/src/main/java/carpet/CarpetSettings.java index a46c7019..79e32445 100644 --- a/src/main/java/carpet/CarpetSettings.java +++ b/src/main/java/carpet/CarpetSettings.java @@ -35,7 +35,7 @@ import static carpet.settings.RuleCategory.CLIENT; @SuppressWarnings("CanBeFinal") public class CarpetSettings { - public static final String carpetVersion = "1.3.16+v200325"; + public static final String carpetVersion = "1.3.17+v200401"; public static final Logger LOG = LogManager.getLogger(); public static boolean skipGenerationChecks = false; public static boolean impendingFillSkipUpdates = false; diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 232722b7..e0f72738 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -1,7 +1,7 @@ { "schemaVersion": 1, "id": "carpet", - "version": "1.3.16", + "version": "1.3.17", "name": "Carpet Mod in Fabric", "description": "Carpet made out of fabric",