Finished up setbanner command and colored the meta and display name for the serialized banners
This commit is contained in:
parent
243c2d19bd
commit
3ce14d2085
@ -46,8 +46,8 @@ public class CmdBanner extends FCommand {
|
|||||||
ItemStack warBanner = fme.getFaction().getBanner();
|
ItemStack warBanner = fme.getFaction().getBanner();
|
||||||
if (warBanner != null) {
|
if (warBanner != null) {
|
||||||
ItemMeta warmeta = warBanner.getItemMeta();
|
ItemMeta warmeta = warBanner.getItemMeta();
|
||||||
warmeta.setDisplayName(P.p.getConfig().getString("fbanners.Item.Name"));
|
warmeta.setDisplayName(P.p.color(P.p.getConfig().getString("fbanners.Item.Name")));
|
||||||
warmeta.setLore(P.p.getConfig().getStringList("fbanners.Item.Lore"));
|
warmeta.setLore(P.p.colorList(P.p.getConfig().getStringList("fbanners.Item.Lore")));
|
||||||
warBanner.setItemMeta(warmeta);
|
warBanner.setItemMeta(warmeta);
|
||||||
me.getInventory().addItem(warBanner);
|
me.getInventory().addItem(warBanner);
|
||||||
|
|
||||||
|
@ -99,7 +99,7 @@ public class FCmdRoot extends FCommand {
|
|||||||
public CmdLowPower cmdLowPower = new CmdLowPower();
|
public CmdLowPower cmdLowPower = new CmdLowPower();
|
||||||
public CmdTntFill cmdTntFill = new CmdTntFill();
|
public CmdTntFill cmdTntFill = new CmdTntFill();
|
||||||
public CmdChest cmdChest = new CmdChest();
|
public CmdChest cmdChest = new CmdChest();
|
||||||
|
public CmdSetBanner cmdSetBanner = new CmdSetBanner();
|
||||||
|
|
||||||
|
|
||||||
public FCmdRoot() {
|
public FCmdRoot() {
|
||||||
@ -210,6 +210,8 @@ public class FCmdRoot extends FCommand {
|
|||||||
this.addSubCommand(this.cmdLowPower);
|
this.addSubCommand(this.cmdLowPower);
|
||||||
this.addSubCommand(this.cmdTntFill);
|
this.addSubCommand(this.cmdTntFill);
|
||||||
this.addSubCommand(this.cmdChest);
|
this.addSubCommand(this.cmdChest);
|
||||||
|
this.addSubCommand(this.cmdSetBanner);
|
||||||
|
|
||||||
|
|
||||||
if (Bukkit.getServer().getPluginManager().getPlugin("CoreProtect") != null){
|
if (Bukkit.getServer().getPluginManager().getPlugin("CoreProtect") != null){
|
||||||
P.p.log("Found CoreProtect, enabling Inspect");
|
P.p.log("Found CoreProtect, enabling Inspect");
|
||||||
|
@ -204,55 +204,55 @@ public class FactionsEntityListener implements Listener {
|
|||||||
|
|
||||||
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||||
public void onEntityExplode(EntityExplodeEvent event) {
|
public void onEntityExplode(EntityExplodeEvent event) {
|
||||||
Entity boomer = event.getEntity();
|
Entity boomer = event.getEntity();
|
||||||
|
|
||||||
// Before we need to check the location where the block is placed
|
// Before we need to check the location where the block is placed
|
||||||
if (!this.checkExplosionForBlock(boomer, event.getLocation().getBlock())) {
|
if (!this.checkExplosionForBlock(boomer, event.getLocation().getBlock())) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Loop the blocklist to run checks on each aimed block
|
// Loop the blocklist to run checks on each aimed block
|
||||||
Iterator<Block> blockList = event.blockList().iterator();
|
Iterator<Block> blockList = event.blockList().iterator();
|
||||||
|
|
||||||
while (blockList.hasNext()) {
|
while (blockList.hasNext()) {
|
||||||
Block block = blockList.next();
|
Block block = blockList.next();
|
||||||
|
|
||||||
if (!this.checkExplosionForBlock(boomer, block)) {
|
if (!this.checkExplosionForBlock(boomer, block)) {
|
||||||
// The block don't have to explode
|
// The block don't have to explode
|
||||||
blockList.remove();
|
blockList.remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Cancel the event if no block will explode
|
// Cancel the event if no block will explode
|
||||||
if (event.blockList().isEmpty()) {
|
if (event.blockList().isEmpty()) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
|
||||||
// Or handle the exploit of TNT in water/lava
|
// Or handle the exploit of TNT in water/lava
|
||||||
} else if ((boomer instanceof TNTPrimed || boomer instanceof ExplosiveMinecart) && Conf.handleExploitTNTWaterlog) {
|
} else if ((boomer instanceof TNTPrimed || boomer instanceof ExplosiveMinecart) && Conf.handleExploitTNTWaterlog) {
|
||||||
// TNT in water/lava doesn't normally destroy any surrounding blocks, which is usually desired behavior, but...
|
// TNT in water/lava doesn't normally destroy any surrounding blocks, which is usually desired behavior, but...
|
||||||
// this change below provides workaround for waterwalling providing perfect protection,
|
// this change below provides workaround for waterwalling providing perfect protection,
|
||||||
// and makes cheap (non-obsidian) TNT cannons require minor maintenance between shots
|
// and makes cheap (non-obsidian) TNT cannons require minor maintenance between shots
|
||||||
Block center = event.getLocation().getBlock();
|
Block center = event.getLocation().getBlock();
|
||||||
|
|
||||||
if (center.isLiquid()) {
|
if (center.isLiquid()) {
|
||||||
// a single surrounding block in all 6 directions is broken if the material is weak enough
|
// a single surrounding block in all 6 directions is broken if the material is weak enough
|
||||||
List<Block> targets = new ArrayList<>();
|
List<Block> targets = new ArrayList<>();
|
||||||
targets.add(center.getRelative(0, 0, 1));
|
targets.add(center.getRelative(0, 0, 1));
|
||||||
targets.add(center.getRelative(0, 0, -1));
|
targets.add(center.getRelative(0, 0, -1));
|
||||||
targets.add(center.getRelative(0, 1, 0));
|
targets.add(center.getRelative(0, 1, 0));
|
||||||
targets.add(center.getRelative(0, -1, 0));
|
targets.add(center.getRelative(0, -1, 0));
|
||||||
targets.add(center.getRelative(1, 0, 0));
|
targets.add(center.getRelative(1, 0, 0));
|
||||||
targets.add(center.getRelative(-1, 0, 0));
|
targets.add(center.getRelative(-1, 0, 0));
|
||||||
for (Block target : targets) {
|
for (Block target : targets) {
|
||||||
int id = target.getTypeId();
|
int id = target.getTypeId();
|
||||||
// ignore air, bedrock, water, lava, obsidian, enchanting table, etc.... too bad we can't get a blast resistance value through Bukkit yet
|
// ignore air, bedrock, water, lava, obsidian, enchanting table, etc.... too bad we can't get a blast resistance value through Bukkit yet
|
||||||
if (id != 0 && (id < 7 || id > 11) && id != 49 && id != 90 && id != 116 && id != 119 && id != 120 && id != 130) {
|
if (id != 0 && (id < 7 || id > 11) && id != 49 && id != 90 && id != 116 && id != 119 && id != 120 && id != 130) {
|
||||||
target.breakNaturally();
|
target.breakNaturally();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean checkExplosionForBlock(Entity boomer, Block block) {
|
private boolean checkExplosionForBlock(Entity boomer, Block block) {
|
||||||
|
Loading…
Reference in New Issue
Block a user