2.0.3
Fixed - Clicking on buttons, doors, levers, trap doors no longer trigger the "Please select a Hopper, Chest, or Barrel." message.
This commit is contained in:
1 parent
377158b5be
commit
d754addf93
2 files changed
+24
-19
No files matched your search
@@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
<groupId>com.rsscripting</groupId>
|
<groupId>com.rsscripting</groupId>
|
||||||
<artifactId>RS-ItemMagnet</artifactId>
|
<artifactId>RS-ItemMagnet</artifactId>
|
||||||
<version>2.0.2</version>
|
<version>2.0.3</version>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<maven.compiler.source>21</maven.compiler.source>
|
<maven.compiler.source>21</maven.compiler.source>
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import com.rsscripting.itemmagnet.managers.PendingConversion;
|
|||||||
import com.rsscripting.itemmagnet.managers.RSConversionManager;
|
import com.rsscripting.itemmagnet.managers.RSConversionManager;
|
||||||
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.Tag;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
@@ -77,24 +78,22 @@ public class RSConvertListener
|
|||||||
|
|
||||||
if (targetAssignmentMachine != null) {
|
if (targetAssignmentMachine != null) {
|
||||||
|
|
||||||
Material type =
|
Material type = block.getType();
|
||||||
block.getType();
|
|
||||||
|
if (isIgnoredTargetSelectionBlock(type)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
type != Material.HOPPER
|
type != Material.HOPPER
|
||||||
&&
|
&& type != Material.CHEST
|
||||||
type != Material.CHEST
|
&& type != Material.BARREL
|
||||||
&&
|
|
||||||
type != Material.BARREL
|
|
||||||
) {
|
) {
|
||||||
|
|
||||||
RSMessageUtils.error(
|
RSMessageUtils.error(
|
||||||
player,
|
player,
|
||||||
"Please select a Hopper, Chest, or Barrel."
|
"Please select a Hopper, Chest, or Barrel."
|
||||||
);
|
);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
@@ -183,24 +182,22 @@ public class RSConvertListener
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Material type =
|
Material type = block.getType();
|
||||||
block.getType();
|
|
||||||
|
if (isIgnoredTargetSelectionBlock(type)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
type != Material.HOPPER
|
type != Material.HOPPER
|
||||||
&&
|
&& type != Material.CHEST
|
||||||
type != Material.CHEST
|
&& type != Material.BARREL
|
||||||
&&
|
|
||||||
type != Material.BARREL
|
|
||||||
) {
|
) {
|
||||||
|
|
||||||
RSMessageUtils.error(
|
RSMessageUtils.error(
|
||||||
player,
|
player,
|
||||||
"Please select a Hopper, Chest, or Barrel."
|
"Please select a Hopper, Chest, or Barrel."
|
||||||
);
|
);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
@@ -467,4 +464,12 @@ public class RSConvertListener
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean isIgnoredTargetSelectionBlock(Material type) {
|
||||||
|
return Tag.DOORS.isTagged(type)
|
||||||
|
|| Tag.BUTTONS.isTagged(type)
|
||||||
|
|| Tag.TRAPDOORS.isTagged(type)
|
||||||
|
|| Tag.FENCE_GATES.isTagged(type)
|
||||||
|
|| type == Material.LEVER;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user