Commit da1ea20 1 parent 7e369ab commit da1ea20 Copy full SHA for da1ea20
File tree 2 files changed +24
-1
lines changed
src/main/java/com/untamedears/humbug
2 files changed +24
-1
lines changed Original file line number Diff line number Diff line change 6
6
<groupId >com.untamedears</groupId >
7
7
<artifactId >Humbug</artifactId >
8
8
<packaging >jar</packaging >
9
- <version >1.8.22 </version >
9
+ <version >1.8.23 </version >
10
10
<name >Humbug</name >
11
11
<url >https://github.com/Civcraft/Humbug</url >
12
12
Original file line number Diff line number Diff line change @@ -513,6 +513,29 @@ public void EmptyEnderChest(HumanEntity human) {
513
513
}
514
514
}
515
515
516
+ @ BahHumbugs ({
517
+ @ BahHumbug (opt ="hopper_limit" , def ="false" ),
518
+ @ BahHumbug (opt ="hopper_limit_per_chunk" , type =OptType .Int , def ="4" )
519
+ })
520
+ @ EventHandler (priority = EventPriority .LOW )
521
+ public void hopperChunkLimit (BlockPlaceEvent e ) {
522
+ if (!config_ .get ("hopper_limit" ).getBool () || e .getBlock ().getType () != Material .HOPPER ) {
523
+ return ;
524
+ }
525
+
526
+ int counter = 0 ;
527
+ for (BlockState bs : e .getBlock ().getChunk ().getTileEntities ()) {
528
+ if (bs instanceof Hopper ) {
529
+ counter ++;
530
+ if (counter >= config_ .get ("hopper_limit_per_chunk" ).getInt ()) {
531
+ e .setCancelled (true );
532
+ e .getPlayer ().sendMessage (ChatColor .RED + "The chunk you are in has reached the maximum amount of " + config_ .get ("hopper_limit_per_chunk" ).getInt () + " hoppers" );
533
+ return ;
534
+ }
535
+ }
536
+ }
537
+ }
538
+
516
539
public void dropInventory (Location loc , Inventory inv ) {
517
540
final World world = loc .getWorld ();
518
541
final int end = inv .getSize ();
You can’t perform that action at this time.
0 commit comments