mirror of
https://github.com/TotalFreedomMC/TF-WorldGuardExtraFlagsPlugin.git
synced 2025-07-24 22:44:00 +00:00
Really fixed block-break flags
This commit is contained in:
parent
190ece604b
commit
ee37c705c2
3 changed files with 26 additions and 29 deletions
|
@ -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
|
||||||
|
|
|
@ -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)
|
||||||
|
|
|
@ -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;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue