11package com .programmerdan .minecraft .simpleadminhacks .hacks ;
22
33import org .bukkit .Material ;
4+ import org .bukkit .World .Environment ;
45import org .bukkit .ChatColor ;
6+ import org .bukkit .block .Biome ;
57import org .bukkit .block .Block ;
68import org .bukkit .block .BlockFace ;
79import org .bukkit .configuration .ConfigurationSection ;
@@ -70,27 +72,42 @@ public String status() {
7072 genStatus .append ("GameFixes is " );
7173 if (config != null && config .isEnabled ()) {
7274 genStatus .append (ChatColor .GREEN ).append ("active\n " ).append (ChatColor .RESET );
75+ genStatus .append (" Block elytra break bug is " );
7376 if (config .isBlockElytraBreakBug ()) {
74- genStatus .append (" Block elytra break bug is " ).append (ChatColor .GREEN ).append ("enabled\n " )
75- .append (ChatColor .RESET );
77+ genStatus .append (ChatColor .GREEN ).append ("enabled\n " ).append (ChatColor .RESET );
7678 genStatus .append (" Will deal " + config .getDamageOnElytraBreakBug () + " damage to players\n " );
7779 } else {
78- genStatus .append (" Block elytra break bug is " ).append (ChatColor .RED ).append ("disabled\n " )
79- .append (ChatColor .RESET );
80+ genStatus .append (ChatColor .RED ).append ("disabled\n " ).append (ChatColor .RESET );
8081 }
82+ genStatus .append (" Block storage entities from teleporting to prevents exploits " );
8183 if (!config .canStorageTeleport ()) {
82- genStatus .append (" Block storage entities from teleporting to prevents exploits " )
83- .append (ChatColor .GREEN ).append ("enabled\n " ).append (ChatColor .RESET );
84+ genStatus .append (ChatColor .GREEN ).append ("enabled\n " ).append (ChatColor .RESET );
8485 } else {
85- genStatus .append (" Block storage entities from teleporting to prevents exploits " )
86- .append (ChatColor .RED ).append ("disabled\n " ).append (ChatColor .RESET );
86+ genStatus .append (ChatColor .RED ).append ("disabled\n " ).append (ChatColor .RESET );
8787 }
88+ genStatus .append (" Hopper self-feed duplication exploit fix " );
8889 if (config .isStopHopperDupe ()) {
89- genStatus .append (" Hopper self-feed duplication exploit fix " )
90- .append (ChatColor .GREEN ).append ("enabled\n " ).append (ChatColor .RESET );
90+ genStatus .append (ChatColor .GREEN ).append ("enabled\n " ).append (ChatColor .RESET );
9191 } else {
92- genStatus .append (" Hopper self-feed duplication exploit fix " )
93- .append (ChatColor .RED ).append ("disabled\n " ).append (ChatColor .RESET );
92+ genStatus .append (ChatColor .RED ).append ("disabled\n " ).append (ChatColor .RESET );
93+ }
94+ genStatus .append (" Duplications using rails exploit fix " );
95+ if (config .isStopRailDupe ()) {
96+ genStatus .append (ChatColor .GREEN ).append ("enabled\n " ).append (ChatColor .RESET );
97+ } else {
98+ genStatus .append (ChatColor .RED ).append ("disabled\n " ).append (ChatColor .RESET );
99+ }
100+ genStatus .append (" End Portal removal exploit fix " );
101+ if (config .isStopEndPortalDeletion ()) {
102+ genStatus .append (ChatColor .GREEN ).append ("enabled\n " ).append (ChatColor .RESET );
103+ } else {
104+ genStatus .append (ChatColor .RED ).append ("disabled\n " ).append (ChatColor .RESET );
105+ }
106+ genStatus .append (" Bed Bombing in Nether / Hell Biomes fix " );
107+ if (config .stopBedBombing ()) {
108+ genStatus .append (ChatColor .GREEN ).append ("enabled\n " ).append (ChatColor .RESET );
109+ } else {
110+ genStatus .append (ChatColor .RED ).append ("disabled\n " ).append (ChatColor .RESET );
94111 }
95112 } else {
96113 genStatus .append (ChatColor .RED ).append ("inactive" ).append (ChatColor .RESET );
@@ -147,7 +164,7 @@ public void onInventoryMoveItem(InventoryMoveItemEvent event) {
147164
148165 @ EventHandler (priority = EventPriority .LOWEST , ignoreCancelled = true )
149166 public void onPistonPushRail (BlockPistonExtendEvent event ) {
150- if (config .isStopRailDupe ()) {
167+ if (config .isEnabled () && config . isStopRailDupe ()) {
151168 for (Block block : event .getBlocks ()) {
152169 Material type = block .getType ();
153170
@@ -161,7 +178,7 @@ public void onPistonPushRail(BlockPistonExtendEvent event) {
161178
162179 @ EventHandler (priority = EventPriority .LOWEST , ignoreCancelled = true )
163180 public void onRailPlace (BlockPlaceEvent event ) {
164- if (config .isStopRailDupe ()) {
181+ if (config .isEnabled () && config . isStopRailDupe ()) {
165182 Block block = event .getBlock ();
166183 Material type = block .getType ();
167184
@@ -181,7 +198,7 @@ public void onRailPlace(BlockPlaceEvent event) {
181198 //Trying to stop players from deleting end portals
182199 @ EventHandler (priority = EventPriority .LOWEST , ignoreCancelled = true )
183200 public void onPlayerBucketEmpty (PlayerBucketEmptyEvent event ) {
184- if (config .isStopEndPortalDeletion ()) {
201+ if (config .isEnabled () && config . isStopEndPortalDeletion ()) {
185202 Block block = event .getBlockClicked ().getRelative (event .getBlockFace ());
186203
187204 if (block .getType () == Material .ENDER_PORTAL ) {
@@ -192,7 +209,7 @@ public void onPlayerBucketEmpty(PlayerBucketEmptyEvent event) {
192209
193210 @ EventHandler (priority = EventPriority .LOWEST , ignoreCancelled = true )
194211 public void onDispenseEvent (BlockDispenseEvent event ) {
195- if (config .isStopEndPortalDeletion ()) {
212+ if (config .isEnabled () && config . isStopEndPortalDeletion ()) {
196213 if (event .getBlock ().getType () == Material .DISPENSER ) {
197214 Dispenser disp = (Dispenser ) event .getBlock ().getState ().getData ();
198215 Material type = event .getBlock ().getRelative (disp .getFacing ()).getType ();
@@ -204,6 +221,21 @@ public void onDispenseEvent(BlockDispenseEvent event) {
204221 }
205222 }
206223 }
224+
225+ @ EventHandler (priority = EventPriority .HIGHEST )
226+ public void onPlayerEnterBed (BlockPlaceEvent event ) {
227+ if (!config .isEnabled () || !config .stopBedBombing ()) return ;
228+
229+ Block b = event .getBlock ();
230+ if (!(b .getType () == Material .BED || b .getType () == Material .BED_BLOCK ))
231+ return ;
232+
233+ Environment env = b .getLocation ().getWorld ().getEnvironment ();
234+ Biome biome = b .getLocation ().getBlock ().getBiome ();
235+ if (env == Environment .NETHER || env == Environment .THE_END || Biome .HELL == biome || Biome .SKY == biome ) {
236+ event .setCancelled (true );
237+ }
238+ }
207239
208240 public static GameFixesConfig generate (SimpleAdminHacks plugin , ConfigurationSection config ) {
209241 return new GameFixesConfig (plugin , config );
0 commit comments