feat(hamster-protect-piston-wool-carpet): 完成 hamster-protect-piston-wool-carpet 插件
This commit is contained in:
2
hamster-protect-piston-wool-carpet/build.gradle
Normal file
2
hamster-protect-piston-wool-carpet/build.gradle
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
version '1.0.0'
|
||||||
|
setArchivesBaseName("HamsterProtect-PistonWoolCarpet")
|
@@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -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: 刷羊毛保护
|
@@ -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'
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user