Skip to content

Commit

Permalink
3.0.2 bug fixes
Browse files Browse the repository at this point in the history
レシピが全て消えてしまうバグの修正
使用しないフィールドの消去
EventPriorityの設定
  • Loading branch information
gotahu committed Apr 9, 2018
1 parent ddc9f4e commit 1f5c990
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 29 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>net.hinyari.plugin.storagebox.StorageBoxMain</groupId>
<artifactId>StorageBox</artifactId>
<version>3.0.1</version>
<version>3.0.2</version>

<properties>
<kotlin.version>1.2.31</kotlin.version>
Expand Down
11 changes: 10 additions & 1 deletion src/main/kotlin/net/hinyari/plugin/storagebox/StorageBoxMain.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import org.bukkit.event.Listener
import org.bukkit.inventory.ItemStack
import org.bukkit.inventory.ShapedRecipe
import org.bukkit.plugin.java.JavaPlugin
import java.awt.Shape

class StorageBoxMain : JavaPlugin() {

Expand Down Expand Up @@ -56,10 +57,18 @@ class StorageBoxMain : JavaPlugin() {
fun reloadRecipe() {
if (Config.values.enableCraftingStorageBox) {
val rawRecipe = Config.values.recipe

// レシピがconfigに定義されていたら
if (rawRecipe.isNotEmpty()) {
val recipeList = server.getRecipesFor(registerChest)
if (recipeList.isNotEmpty()) {
server.clearRecipes()
val iterator = server.recipeIterator()
while (iterator.hasNext()) {
val r = iterator.next()
if (r is ShapedRecipe && r == recipeList[0]) {
iterator.remove()
}
}
}

// レシピ作成部
Expand Down
19 changes: 2 additions & 17 deletions src/main/kotlin/net/hinyari/plugin/storagebox/event/Interact.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import net.hinyari.plugin.storagebox.extensions.*
import net.hinyari.plugin.storagebox.util.SBUtil
import org.bukkit.Sound
import org.bukkit.event.EventHandler
import org.bukkit.event.EventPriority
import org.bukkit.event.Listener
import org.bukkit.event.block.Action
import org.bukkit.event.player.PlayerInteractEvent
Expand All @@ -14,7 +15,7 @@ class Interact constructor(val plugin: StorageBoxMain) : Listener {

private val inventoryUtil = plugin.inventoryUtil

@EventHandler
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
fun onPlayerInteractEvent(event: PlayerInteractEvent) {

val item = event.item
Expand Down Expand Up @@ -66,21 +67,5 @@ class Interact constructor(val plugin: StorageBoxMain) : Listener {
player.playSound(player.location, Sound.BLOCK_NOTE_BASS, 0.2f, 0.4f)
return
}

/*
when (item.type) {
Material.ENDER_PEARL -> {
object : BukkitRunnable() {
override fun run() {
// メインハンドにStorageBoxを所持している場合
if (isMainHand) player.itemInMainHand = item.toStorageBox(amount - 1)
else player.itemInOffHand = item.toStorageBox(amount - 1)
}
}.runTaskLater(plugin, 1L)
}
else -> return
}
*/
}
}
2 changes: 0 additions & 2 deletions src/main/kotlin/net/hinyari/plugin/storagebox/event/Pickup.kt
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ import org.bukkit.event.entity.EntityPickupItemEvent

class Pickup constructor(val plugin: StorageBoxMain) : Listener {

private var triedtimes = 0

@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
fun onPlayerPickupItemEvent(event: EntityPickupItemEvent) {

Expand Down
9 changes: 1 addition & 8 deletions src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: StorageBox
version: 3.0.1
version: 3.0.2
description: StorageBoxを追加します。
author: Hinyari_Gohan
main: net.hinyari.plugin.storagebox.StorageBoxMain
Expand All @@ -21,9 +21,6 @@ permissions:
sb.info:
description: infoコマンドの使用権限
default: true
sb.remove:
description: removeコマンドの使用権限
default: true
sb.pickup:
description: pickupの使用権限
default: true
Expand All @@ -33,14 +30,10 @@ permissions:
sb.consume:
description: consumeの使用権限
default: true
sb.owner:
description: ownerコマンドの使用権限
default: true
sb.use:
children:
sb.create: true
sb.info: true
sb.remove: true
sb.pickup: true
sb.place: true
sb.consume: true
Expand Down

0 comments on commit 1f5c990

Please sign in to comment.