-
Notifications
You must be signed in to change notification settings - Fork 1
bugfix/DEV-1 #130
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
bugfix/DEV-1 #130
Conversation
- b3147 is the final working version that is compatible with 1.8.8 upgrading will break it as the newer plugin ymls use a syntax that doesn't work with the old bukkit parser.
// TODO Find correct sounds // TODO needs to implement dynamic GUIs
- Fix typos - Register NPC separately so we can add our own custom Metadata CITIZENS API SUCKKKKKS
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR refactors and extends the Minecraft Pit server plugin with significant architectural improvements and new features. The changes span across multiple systems including items, enchantments, GUIs, NPCs, and build configurations.
Key Changes
- Item System Refactoring: Introduced a new
Iteminterface with separated default, shop, and mystic items, centralizing item configuration and build logic - GUI System Enhancement: Added dynamic row sizing, close handlers, locked slots, and click handler builders for more flexible inventory management
- NPC System Redesign: Refactored NPCs to use a centralized click handler and definition-based configuration with level requirements
- New Enchantments: Added 5 new enchantments (Volley, PushComesToShove, PinDown, WhatDoesntKillYou, Explosive)
- Build System Updates: Upgraded Kotlin to 1.9.22, optimized Gradle configuration, added development tasks, and improved dependency management
Reviewed changes
Copilot reviewed 100 out of 106 changed files in this pull request and generated 10 comments.
Show a summary per file
| File | Description |
|---|---|
| plugin.yml | Added new commands (set, freshpants), fixed description formatting |
| build.gradle.kts | Upgraded Kotlin, optimized dependencies, added dev tasks, minimization config |
| Timer.kt | Added tickInterval parameter for throttled callbacks |
| Player.kt | Added utility functions for inventory management and item checking |
| NPC.kt | Refactored to centralized handler with level-gated access |
| ItemStack.kt | Added color support, data parameter, leather armor coloring |
| GUI.kt | Enhanced with dynamic sizing, close handlers, locked slots |
| Shop.kt | Complete shop GUI implementation with dynamic pricing and multi-items |
| Items (various) | New shop/default/mystic item implementations |
| Enchants (various) | New enchantments and description refactoring |
| Commands | Added SetStats and FreshPantsCommand, refactored to PluginCommand interface |
| DamageIndicator.kt | New damage indicator display system |
| Main.kt | Updated registration for items, commands, and NPC handler |
Files not reviewed (5)
- .idea/copilot.data.migration.agent.xml: Language not supported
- .idea/gradle.xml: Language not supported
- .idea/kotlinc.xml: Language not supported
- .idea/misc.xml: Language not supported
- .idea/vcs.xml: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if (player.data.level < level) { | ||
| player.sendMessage(replaceChatColorTags("<red>You must be level $level to access this!</red>")) | ||
| player.playSound(player.location, Sound.VILLAGER_NO, 1.0f, 1.0f) | ||
| // return // TODO: UNCOMMENT FOR PRODUCTION |
Copilot
AI
Dec 26, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The TODO comment references a production check that is currently commented out. This allows any player regardless of level to access NPCs. Either remove the TODO and commented code if this is intentional for development, or uncomment line 117 for production builds.
| return rootNBT.getString(pitItemIdKey(signature)) | ||
| } | ||
|
|
||
| // Will nee to overhaul |
Copilot
AI
Dec 26, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo in comment: "Will nee to overhaul" should be "Will need to overhaul".
| val enchantTier = it.enchantTier | ||
| val range = range[enchantTier] ?: undefPropErr("range", enchantTier) | ||
| val explosionPitch = explosionPitch[enchantTier] ?: undefPropErr("explosionPitch", enchantTier) | ||
| val explosionParticle = explosionParticle[enchantTier] ?: undefPropErr("explosion)Particle", enchantTier) |
Copilot
AI
Dec 26, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo in variable name: "explosion)Particle" should be "explosionParticle" (closing parenthesis should be removed).
| for (item in contents) { | ||
| if (item.type == Material.LEATHER_HELMET) { | ||
| freshPants.add(item) | ||
| } | ||
| } |
Copilot
AI
Dec 26, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Incomplete implementation: The check for Material.LEATHER_HELMET on line 109 should check for Material.LEATHER_LEGGINGS since this is a pants bundle. Using helmet material will check for the wrong item type.
| ) | ||
|
|
||
| private val description: EnchantDescription = { | ||
| "Your hits <green>heal</green> you for <red>${damagedHearts[it]?.toInt()}${Text.HEART}</red><br/>and them for <red>${damagerHearts[it]?.toInt()}${Text.HEART}</red> ($cooldown}s cooldown)" |
Copilot
AI
Dec 26, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The string interpolation syntax $cooldown}s is missing the opening brace. It should be ${cooldown.seconds()}s to properly display the cooldown value.
| fun playerHasItem(player: Player, material: Material): Boolean { | ||
| val inventory = player.inventory | ||
|
|
||
| // Check armor slots | ||
| val hasEquipped = when { | ||
| isHelmet(material) -> inventory.helmet?.type == material | ||
| isChestplate(material) -> inventory.chestplate?.type == material | ||
| isLeggings(material) -> inventory.leggings?.type == material | ||
| isBoots(material) -> inventory.boots?.type == material | ||
| else -> false | ||
| } | ||
|
|
||
| if (!hasEquipped) { | ||
| return false | ||
| } | ||
|
|
||
| // Check main inventory | ||
| return inventory.contents.any { it?.type == material } | ||
| } |
Copilot
AI
Dec 26, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The logic check if (!hasEquipped) on line 74 returns false, but the function then unconditionally returns true on line 79, meaning this function will always return true regardless of whether the armor piece is equipped. The logic should be: return true if the player HAS the item equipped OR in inventory, not check if they don't have it equipped then always return true.
| if (isLeather(material) && isLeggings(material)) { | ||
| itemMeta = itemMeta as LeatherArmorMeta | ||
| itemMeta.color = pantsColors(itemColor ?: "white") | ||
| } |
Copilot
AI
Dec 26, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The condition checks if the item is both leather AND leggings, but it should check if it's leather leggings specifically. The current logic will never execute because isLeather(material) && isLeggings(material) can only be true for Material.LEATHER_LEGGINGS. Consider simplifying to material == Material.LEATHER_LEGGINGS.
| // Prevent self damage | ||
| if (entity !== shooter) return@forEach |
Copilot
AI
Dec 26, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The condition if (entity !== shooter) on line 95 inverts the logic - it returns early if the entity is NOT the shooter, meaning only the shooter will receive damage. This should be if (entity == shooter) to prevent self-damage as the comment indicates.
| if (respawnLocations.isEmpty()) { | ||
| player.teleport(randomSpawnLocation) | ||
| } else { | ||
| val location = respawnLocations.remove(player.uniqueId) | ||
| player.teleport(location) | ||
| } |
Copilot
AI
Dec 26, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The respawnLocations check on line 39 uses isEmpty() but should check if the map contains the player's UUID. An empty map would prevent all players from using tactical insertion. Change to if (!respawnLocations.containsKey(player.uniqueId)) or use respawnLocations[player.uniqueId] with null-safe handling.
| var tickCount = 0 | ||
| val throttledOnTick = onTick?.let { | ||
| Runnable { | ||
| if ((tickCount % tickInterval).toInt() == 0) { | ||
| it.run() | ||
| } | ||
| tickCount++ | ||
| } |
Copilot
AI
Dec 26, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The tickCount variable is never incremented in the throttled onTick callback. This means the modulo check will always evaluate to true on the first call, and the counter will never advance. Move the tickCount++ statement before the if condition, or redesign the logic to properly track tick intervals.
PLEASE MERGE THIS