Glowstone and glass suffocation

Discussion in 'Archived: Plugin Requests' started by giuliocame, Jun 3, 2013.

  1. Offline

    giuliocame

    Plugin category: ANTI-GLITCH

    Suggested name: Glass & Glowstone Suffocation

    What I want: I'd like a plugin that makes suffocate anyone who is stuck inside glowstone or glass. This because I've seen many players using that glitch to see under the ground and that would be nice to prevent that form of cheating. Basically it makes you suffocate when inside these transparent blocks.

    Ideas for commands: No commands needed for this plugin.

    Ideas for permissions: I don't think it needs any permissions!

    When I'd like it by: Well, as soon as possible if you can!
     
  2. Offline

    whitehooder

    Wow. Didn't know about this exploit. I was able to reproduce it with glowstone but not with glass blocks. If I get time I will whip up a plugin for this. Maybe I'll simply remove the glowstone whenever a player has one in their head :)
     
  3. Offline

    comexpert

    I'm not sure if this is working, but I made this really quick.


    Code:
    package me.comexpert.suffocatePlus;
     
    import org.bukkit.Bukkit;
    import org.bukkit.Location;
    import org.bukkit.Material;
    import org.bukkit.entity.Player;
    import org.bukkit.plugin.java.JavaPlugin;
     
    public class Suffocate extends JavaPlugin {
     
    int i=0;
    Player[] players;
    Location[] locations;
     
    {
    players[0]=null;
    locations[0]=null;
    }
     
    public void onEnable(){
     
    }
    public void onDisable(){
     
    }
    public void check(){
    players=Bukkit.getServer().getOnlinePlayers();
    locations=null;
    i=0;
    while(i<=players.length){
    locations[i]=players[i].getLocation();
    i++;
    }
    i=0;
    while(i<=locations.length){
    if(locations[i].getBlock().getType()==Material.AIR && locations[i].add(0,1,0).getBlock().getType()==Material.AIR){
    locations[i]=null;
    players[i]=null;
    }
    }
    }
     
    public void countDown() {
     
    Runnable counter=new Runnable(){
    public void run(){
    i=0;
    while(i<=players.length){
    if(players[i]!=null){
    players[i].setHealth(players[i].getHealth()-2);
    }
    }
    check();
    }
    };
     
    this.getServer().getScheduler().scheduleSyncRepeatingTask(this, counter, 0L, 20L);
    }
    }
    
     

Share This Page