Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package me.ankokunsan.entityPose
import org.bukkit.Material
import org.bukkit.Sound
import org.bukkit.entity.Entity
import org.bukkit.entity.LivingEntity
import org.bukkit.entity.Player
import org.bukkit.metadata.FixedMetadataValue
import org.bukkit.scheduler.BukkitRunnable
Expand Down Expand Up @@ -83,20 +84,20 @@ object AirBlock {
}
val result =
player.world.rayTraceEntities(
player.eyeLocation, player.location.direction, 7.0, 0.6) {
it != player
player.eyeLocation, player.location.direction, 5.0, 0.1) {
it is LivingEntity && it !is Player
}
val target = result?.hitEntity ?: return

val newtarget = result?.hitEntity
val lastTarget = glowingTarget[uuid]
if (target != lastTarget) {
if (newtarget != lastTarget) {
lastTarget?.isGlowing = false

target.isGlowing = true
glowingTarget[uuid] = target
newtarget?.isGlowing = true
if (newtarget != null) {
glowingTarget[uuid] = newtarget
} else glowingTarget.remove(uuid)
}
}
}
.runTaskTimer(EntityPose.INSTANCE, 0L, 2L) // 0Lにすることで、設置直後から判定を開始
.runTaskTimer(EntityPose.INSTANCE, 0L, 2L)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -653,6 +653,12 @@ class EntityClick : Listener {
} else {
listOf(entity)
}
val suffix =
if (targets.size > 1) {
"§6(${targets.size}体を同時に操作中)"
} else {
""
}
when (part) {
StandPart.HEAD_X -> {
entity.headPose = entity.headPose.setX(entity.headPose.x + rad)
Expand Down Expand Up @@ -768,26 +774,20 @@ class EntityClick : Listener {
loc.yaw += delta
target.teleport(loc)
}
val status = targets.take(10).joinToString("/") { formatDeg(it.location.yaw.toDouble()) }
val suffix =
if (targets.size > 10) {
"§7...ほか${targets.size - 10}体"
} else {
""
}
actionBar(player, "§a全体: (${targets.size}体): §e$status$suffix")
val deg = entity.location.yaw.toDouble()
actionBar(player, "§a全体: ${formatDeg(deg)}$suffix")
}
StandPart.X -> {
targets.forEach { target -> target.teleport(target.location.add(move1, 0.0, 0.0)) }
actionBar(player, "§aX座標: (${targets.size}体): ${formatLoc(entity.location.x)}")
actionBar(player, "§aX座標: ${formatLoc(entity.location.x)}$suffix")
}
StandPart.Y -> {
targets.forEach { target -> target.teleport(target.location.add(0.0, move1, 0.0)) }
actionBar(player, "§aY座標: (${targets.size}体): ${formatLoc(entity.location.y)}")
actionBar(player, "§aY座標: ${formatLoc(entity.location.y)}$suffix")
}
StandPart.Z -> {
targets.forEach { target -> target.teleport(target.location.add(0.0, 0.0, move1)) }
actionBar(player, "§aZ座標: (${targets.size}体): ${formatLoc(entity.location.z)}")
actionBar(player, "§aZ座標: ${formatLoc(entity.location.z)}$suffix")
}
}
return
Expand All @@ -808,6 +808,12 @@ class EntityClick : Listener {
listOf(entity)
}
val deltaF = (if (player.isSneaking) -step else step).toFloat()
val suffix =
if (targets.size > 1) {
"§6(${targets.size}体を同時に操作中)"
} else {
""
}

when (part1) {
EntiPart.HEAD -> {
Expand All @@ -825,14 +831,8 @@ class EntityClick : Listener {
loc.yaw += deltaF
target.teleport(loc)
}
val status = targets.take(10).joinToString("/") { formatDeg(it.location.yaw.toDouble()) }
val suffix =
if (targets.size > 10) {
"§7...ほか${targets.size - 10}体"
} else {
""
}
actionBar(player, "§a全体: (${targets.size}体): §e$status$suffix")
val deg = entity.location.yaw.toDouble()
actionBar(player, "§a全体: ${formatDeg(deg)}$suffix")
}

EntiPart.SITTING -> {
Expand All @@ -846,15 +846,15 @@ class EntityClick : Listener {
}
EntiPart.X -> {
targets.forEach { target -> target.teleport(target.location.add(move1, 0.0, 0.0)) }
actionBar(player, "§aX座標変更中 (${targets.size}体): ${formatLoc(entity.location.x)}")
actionBar(player, "§aX座標: ${formatLoc(entity.location.x)}$suffix")
}
EntiPart.Y -> {
targets.forEach { target -> target.teleport(target.location.add(0.0, move1, 0.0)) }
actionBar(player, "§aY座標変更中 (${targets.size}体): ${formatLoc(entity.location.y)}")
actionBar(player, "§aY座標: ${formatLoc(entity.location.y)}$suffix")
}
EntiPart.Z -> {
targets.forEach { target -> target.teleport(target.location.add(0.0, 0.0, move1)) }
actionBar(player, "§aZ座標変更中 (${targets.size}体): ${formatLoc(entity.location.z)}")
actionBar(player, "§aZ座標: ${formatLoc(entity.location.z)}$suffix")
}
EntiPart.HAN -> {
val board = Bukkit.getScoreboardManager()!!.mainScoreboard
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class EntityScale : CommandExecutor {
return true
}
val result =
player.world.rayTraceEntities(player.eyeLocation, player.location.direction, 3.0, 0.5) {
player.world.rayTraceEntities(player.eyeLocation, player.location.direction, 3.0, 0.1) {
it != player && it !is ExperienceOrb
}
val target = result?.hitEntity
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class Entityinfo : CommandExecutor, TabCompleter {
return true
}
val result =
sender.world.rayTraceEntities(sender.eyeLocation, sender.location.direction, 3.0, 0.5) {
sender.world.rayTraceEntities(sender.eyeLocation, sender.location.direction, 3.0, 0.1) {
it != sender
}
val target =
Expand Down Expand Up @@ -238,13 +238,13 @@ class Entityinfo : CommandExecutor, TabCompleter {
meta.setDisplayName("§fサイズ設定(大きくするほう)")
val lorelist = mutableListOf<String>()
lorelist.add("§7----- 現在のサイズ一覧 -----")
targets.take(10).forEach { target ->
targets.take(6).forEach { target ->
val scale = (target as? LivingEntity)?.getAttribute(Attribute.SCALE)?.baseValue ?: 1.0
val typeName = target.type.name
lorelist.add("§8-$typeName: §b${String.format("%.1f", scale)}")
}
if (targets.size > 10) {
lorelist.add("§8...ほか ${targets.size - 10}体")
if (targets.size > 6) {
lorelist.add("§8...ほか ${targets.size - 6}体")
}
meta.lore = lorelist
itemMeta = meta
Expand All @@ -256,13 +256,13 @@ class Entityinfo : CommandExecutor, TabCompleter {
meta.setDisplayName("§fサイズ設定(小さくするほう)")
val lorelist = mutableListOf<String>()
lorelist.add("§7----- 現在のサイズ一覧 -----")
targets.take(10).forEach { target ->
targets.take(6).forEach { target ->
val scale = (target as? LivingEntity)?.getAttribute(Attribute.SCALE)?.baseValue ?: 1.0
val typeName = target.type.name
lorelist.add("§8-$typeName: §b${String.format("%.1f", scale)}")
}
if (targets.size > 10) {
lorelist.add("§8...ほか ${targets.size - 10}体")
if (targets.size > 6) {
lorelist.add("§8...ほか ${targets.size - 6}体")
}
meta.lore = lorelist
itemMeta = meta
Expand Down
Loading