feat(hamster-protect-piston-wool-carpet): 完成 hamster-protect-piston-wool-carpet 插件

This commit is contained in:
2023-06-06 21:56:19 +08:00
parent a44804be75
commit 97a234d75a
4 changed files with 54 additions and 0 deletions

View File

@@ -0,0 +1,2 @@
version '1.0.0'
setArchivesBaseName("HamsterProtect-PistonWoolCarpet")

View File

@@ -0,0 +1,42 @@
package cn.hamster3.mc.plugin.protect.piston.wool.carpet;
import org.bukkit.Bukkit;
import org.bukkit.block.Block;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockPistonExtendEvent;
import org.bukkit.plugin.java.JavaPlugin;
public class PistonWoolCarpetProtectPlugin extends JavaPlugin implements Listener {
@Override
public void onEnable() {
Bukkit.getPluginManager().registerEvents(this, this);
}
@EventHandler(ignoreCancelled = true)
public void onBlockPistonExtend(BlockPistonExtendEvent event) {
for (Block block : event.getBlocks()) {
switch (block.getType()) {
case MOSS_CARPET:
case WHITE_CARPET:
case ORANGE_CARPET:
case MAGENTA_CARPET:
case LIGHT_BLUE_CARPET:
case YELLOW_CARPET:
case LIME_CARPET:
case PINK_CARPET:
case GRAY_CARPET:
case LIGHT_GRAY_CARPET:
case CYAN_CARPET:
case PURPLE_CARPET:
case BLUE_CARPET:
case BROWN_CARPET:
case GREEN_CARPET:
case RED_CARPET: {
event.setCancelled(true);
return;
}
}
}
}
}

View File

@@ -0,0 +1,8 @@
name: HamsterProtect-PistonWoolCarpet
main: cn.hamster3.mc.plugin.protect.piston.wool.carpet.PistonWoolCarpetProtectPlugin
version: ${version}
api-version: 1.13
author: MiniDay
website: https://github.com/MiniDay/hamster-little-plugins
description: 刷羊毛保护

View File

@@ -10,4 +10,6 @@ include 'hamster-spawn'
include 'hamster-chain-break' include 'hamster-chain-break'
include 'hamster-tpa' include 'hamster-tpa'
include 'hamster-join-message' include 'hamster-join-message'
include 'hamster-protect-explosion'
include 'hamster-protect-piston-wool-carpet'