Added Function on Tripwire for 1.12
Dieser Commit ist enthalten in:
Ursprung
5ccf3ddf3c
Commit
c27a548866
@ -23,10 +23,13 @@ import org.bukkit.Bukkit;
|
|||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.block.BlockState;
|
import org.bukkit.entity.ArmorStand;
|
||||||
import org.bukkit.event.block.Action;
|
import org.bukkit.entity.Entity;
|
||||||
|
import org.bukkit.entity.EntityType;
|
||||||
import org.bukkit.event.player.PlayerInteractEvent;
|
import org.bukkit.event.player.PlayerInteractEvent;
|
||||||
import org.bukkit.material.Tripwire;
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
|
||||||
class AutoLoader_12 {
|
class AutoLoader_12 {
|
||||||
@ -55,6 +58,20 @@ class AutoLoader_12 {
|
|||||||
block.setData((byte) 1);
|
block.setData((byte) 1);
|
||||||
else
|
else
|
||||||
block.setData((byte) 0);
|
block.setData((byte) 0);
|
||||||
|
}else if(material == Material.TRIPWIRE) {
|
||||||
|
if(active) {
|
||||||
|
ArmorStand armorStand = (ArmorStand) Bukkit.getWorlds().get(0).spawnEntity(location, EntityType.ARMOR_STAND);
|
||||||
|
armorStand.setVisible(false);
|
||||||
|
armorStand.setBasePlate(false);
|
||||||
|
armorStand.addScoreboardTag("detonator-" + location.getBlockX() + location.getBlockY() + location.getBlockZ());
|
||||||
|
}else {
|
||||||
|
List<Entity> entityList = Bukkit.getWorlds().get(0).getEntitiesByClasses(ArmorStand.class).stream().filter(entity ->
|
||||||
|
entity.getScoreboardTags().contains("detonator-" + location.getBlockX() + location.getBlockY() + location.getBlockZ()))
|
||||||
|
.limit(1)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
if(entityList.isEmpty()) return false;
|
||||||
|
entityList.get(0).remove();
|
||||||
|
}
|
||||||
}else{
|
}else{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -80,6 +97,8 @@ class AutoLoader_12 {
|
|||||||
return new Detoloader("Noteblock", 1);
|
return new Detoloader("Noteblock", 1);
|
||||||
}else if(material == Material.STONE_PLATE || material == Material.WOOD_PLATE){
|
}else if(material == Material.STONE_PLATE || material == Material.WOOD_PLATE){
|
||||||
return new Detoloader("Druckplatte", 20);
|
return new Detoloader("Druckplatte", 20);
|
||||||
|
}else if (material == Material.TRIPWIRE) {
|
||||||
|
return new Detoloader("Tripwire", 10);
|
||||||
}
|
}
|
||||||
return new Detoloader("§eUnbekannter Block betätigt (nicht aufgenommen)", 0).setAddBack(false);
|
return new Detoloader("§eUnbekannter Block betätigt (nicht aufgenommen)", 0).setAddBack(false);
|
||||||
}
|
}
|
||||||
|
@ -108,7 +108,7 @@ class AutoLoader_15 {
|
|||||||
}else if (material == Material.NOTE_BLOCK) {
|
}else if (material == Material.NOTE_BLOCK) {
|
||||||
return new Detoloader("Noteblock", 1);
|
return new Detoloader("Noteblock", 1);
|
||||||
}else if (material.name().equals("TRIPWIRE")) {
|
}else if (material.name().equals("TRIPWIRE")) {
|
||||||
return new Detoloader("Tripwire", 20);
|
return new Detoloader("Tripwire", 10);
|
||||||
} else {
|
} else {
|
||||||
return new Detoloader("§eUnbekannter Block betätigt", 0).setAddBack(false);
|
return new Detoloader("§eUnbekannter Block betätigt", 0).setAddBack(false);
|
||||||
}
|
}
|
||||||
|
@ -175,7 +175,7 @@ public class AutoLoader extends IAutoLoader implements Listener {
|
|||||||
if(detoloader.useActive)
|
if(detoloader.useActive)
|
||||||
new IAutoLoader.RedstoneActivation(this, event.getClickedBlock().getLocation()
|
new IAutoLoader.RedstoneActivation(this, event.getClickedBlock().getLocation()
|
||||||
, detoloader.getActivation() == 0 ? getLastActivation() : detoloader.getActivation()
|
, detoloader.getActivation() == 0 ? getLastActivation() : detoloader.getActivation()
|
||||||
, detoloader.isActiv());
|
, detoloader.isActive());
|
||||||
else
|
else
|
||||||
new IAutoLoader.TemporaryActivation(this, event.getClickedBlock().getLocation()
|
new IAutoLoader.TemporaryActivation(this, event.getClickedBlock().getLocation()
|
||||||
, detoloader.getActivation());
|
, detoloader.getActivation());
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren