Really fixed block-break flags

This commit is contained in:
isokissa3 2017-01-26 01:12:03 +02:00
parent 190ece604b
commit ee37c705c2
3 changed files with 26 additions and 29 deletions

View file

@ -22,7 +22,7 @@ public class MaterialFlag extends Flag<Material>
@Override @Override
public Material parseInput(FlagContext context) throws InvalidFlagFormat public Material parseInput(FlagContext context) throws InvalidFlagFormat
{ {
return Material.getMaterial(context.getUserInput().trim()); return Material.getMaterial(context.getUserInput().trim().toUpperCase());
} }
@Override @Override

View file

@ -49,8 +49,7 @@ public class BlockListener implements Listener
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = false) @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = false)
public void onBlockPlaceEvent(PlaceBlockEvent event) public void onBlockPlaceEvent(PlaceBlockEvent event)
{ {
if (event.getResult() == Result.DEFAULT) Result originalResult = event.getResult();
{
Object cause = event.getCause().getRootCause(); Object cause = event.getCause().getRootCause();
if (cause instanceof Player) if (cause instanceof Player)
@ -78,7 +77,7 @@ public class BlockListener implements Listener
} }
else else
{ {
event.setResult(Result.DEFAULT); event.setResult(originalResult);
return; return;
} }
} }
@ -86,7 +85,6 @@ public class BlockListener implements Listener
} }
} }
} }
}
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = false) @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = false)
public void onBlockBreakEvent(BreakBlockEvent event) public void onBlockBreakEvent(BreakBlockEvent event)

View file

@ -30,7 +30,6 @@ import org.bukkit.potion.Potion;
import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType; import org.bukkit.potion.PotionEffectType;
import org.bukkit.scheduler.BukkitRunnable; import org.bukkit.scheduler.BukkitRunnable;
import org.spigotmc.event.player.PlayerSpawnLocationEvent;
import com.sk89q.worldedit.Location; import com.sk89q.worldedit.Location;
import com.sk89q.worldedit.bukkit.BukkitUtil; import com.sk89q.worldedit.bukkit.BukkitUtil;