mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-30 02:05:41 +00:00
Disables block gravity and makes it togglable (FS-89) (#50)
* Disables block gravity by default (FS-89) * Combine these checks as Codacy ever so kindly suggested
This commit is contained in:
parent
20c2c4c96e
commit
2cdf1e66a6
@ -14,6 +14,7 @@ import org.bukkit.attribute.AttributeModifier;
|
|||||||
import org.bukkit.block.data.AnaloguePowerable;
|
import org.bukkit.block.data.AnaloguePowerable;
|
||||||
import org.bukkit.block.data.Powerable;
|
import org.bukkit.block.data.Powerable;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
|
import org.bukkit.entity.FallingBlock;
|
||||||
import org.bukkit.entity.Tameable;
|
import org.bukkit.entity.Tameable;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
@ -30,6 +31,7 @@ import org.bukkit.event.entity.EntityCombustEvent;
|
|||||||
import org.bukkit.event.entity.EntityDamageEvent;
|
import org.bukkit.event.entity.EntityDamageEvent;
|
||||||
import org.bukkit.event.entity.EntityDeathEvent;
|
import org.bukkit.event.entity.EntityDeathEvent;
|
||||||
import org.bukkit.event.entity.EntityExplodeEvent;
|
import org.bukkit.event.entity.EntityExplodeEvent;
|
||||||
|
import org.bukkit.event.entity.EntitySpawnEvent;
|
||||||
import org.bukkit.event.entity.ExplosionPrimeEvent;
|
import org.bukkit.event.entity.ExplosionPrimeEvent;
|
||||||
import org.bukkit.event.entity.FireworkExplodeEvent;
|
import org.bukkit.event.entity.FireworkExplodeEvent;
|
||||||
import org.bukkit.event.entity.PlayerDeathEvent;
|
import org.bukkit.event.entity.PlayerDeathEvent;
|
||||||
@ -212,6 +214,15 @@ public class EventBlocker extends FreedomService
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onEntitySpawn(EntitySpawnEvent event)
|
||||||
|
{
|
||||||
|
if (!ConfigEntry.ALLOW_GRAVITY.getBoolean() && event.getEntity() instanceof FallingBlock)
|
||||||
|
{
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onBlockPhysics(BlockPhysicsEvent event)
|
public void onBlockPhysics(BlockPhysicsEvent event)
|
||||||
{
|
{
|
||||||
|
@ -54,6 +54,7 @@ public class Command_toggle extends FreedomCommand
|
|||||||
msg("- landmines");
|
msg("- landmines");
|
||||||
msg("- mp44");
|
msg("- mp44");
|
||||||
msg("- tossmob");
|
msg("- tossmob");
|
||||||
|
msg("- gravity");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -297,6 +298,12 @@ public class Command_toggle extends FreedomCommand
|
|||||||
toggle("Tossmob is", ConfigEntry.TOSSMOB_ENABLED);
|
toggle("Tossmob is", ConfigEntry.TOSSMOB_ENABLED);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case "gravity":
|
||||||
|
{
|
||||||
|
toggle("Block gravity is", ConfigEntry.ALLOW_GRAVITY);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -320,7 +327,7 @@ public class Command_toggle extends FreedomCommand
|
|||||||
"waterplace", "fireplace", "lavaplace", "fluidspread", "lavadmg", "firespread", "frostwalk",
|
"waterplace", "fireplace", "lavaplace", "fluidspread", "lavadmg", "firespread", "frostwalk",
|
||||||
"firework", "prelog", "lockdown", "petprotect", "entitywipe", "nonuke", "explosives", "unsafeenchs",
|
"firework", "prelog", "lockdown", "petprotect", "entitywipe", "nonuke", "explosives", "unsafeenchs",
|
||||||
"bells", "armorstands", "structureblocks", "jigsaws", "grindstones", "jukeboxes", "spawners", "4chan", "beehives",
|
"bells", "armorstands", "structureblocks", "jigsaws", "grindstones", "jukeboxes", "spawners", "4chan", "beehives",
|
||||||
"respawnanchors", "autotp", "autoclear", "minecarts", "mp44", "landmines", "tossmob");
|
"respawnanchors", "autotp", "autoclear", "minecarts", "mp44", "landmines", "tossmob", "gravity");
|
||||||
}
|
}
|
||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
}
|
}
|
||||||
|
@ -34,6 +34,7 @@ public enum ConfigEntry
|
|||||||
ALLOW_RESPAWN_ANCHORS(Boolean.class, "allow.respawnanchors"),
|
ALLOW_RESPAWN_ANCHORS(Boolean.class, "allow.respawnanchors"),
|
||||||
AUTO_TP(Boolean.class, "allow.auto_tp"),
|
AUTO_TP(Boolean.class, "allow.auto_tp"),
|
||||||
AUTO_CLEAR(Boolean.class, "allow.auto_clear"),
|
AUTO_CLEAR(Boolean.class, "allow.auto_clear"),
|
||||||
|
ALLOW_GRAVITY(Boolean.class, "allow.gravity"),
|
||||||
//
|
//
|
||||||
BLOCKED_CHATCODES(String.class, "blocked_chatcodes"),
|
BLOCKED_CHATCODES(String.class, "blocked_chatcodes"),
|
||||||
//
|
//
|
||||||
|
@ -226,6 +226,7 @@ allow:
|
|||||||
respawnanchors: false
|
respawnanchors: false
|
||||||
auto_tp: false
|
auto_tp: false
|
||||||
auto_clear: false
|
auto_clear: false
|
||||||
|
gravity: false
|
||||||
|
|
||||||
# Blocked commands:
|
# Blocked commands:
|
||||||
#
|
#
|
||||||
|
Loading…
Reference in New Issue
Block a user