More codebase updates for 1.14.4

This commit is contained in:
David Berdik 2019-09-02 18:29:35 -04:00
parent 0bb95cafd7
commit ff1fb6f713
9 changed files with 76 additions and 98 deletions

View File

@ -143,7 +143,7 @@ public class BuildCave extends Core {
Random randgen = Utils.getRandomGen();
int chance = randgen.nextInt(100);
if (chance > 70) {
world.getBlockAt(x, y, z).setType(Material.REDSTONE_TORCH_ON);
world.getBlockAt(x, y, z).setType(Material.REDSTONE_TORCH);
}
}

View File

@ -81,12 +81,12 @@ public class BuryPlayer extends Core {
Location loc = new Location(world, X, Y, Z);
Location signloc = new Location(world, X, Y, Z - 2);
Block signblock = signloc.add(0, 0D, 0).getBlock();
signblock.setType(Material.SIGN_POST);
signblock.setType(Material.OAK_SIGN);
Sign sign = (Sign) signblock.getState();
sign.setLine(1, playername);
sign.update();
loc.getWorld().getBlockAt(X, Y - 1, Z).setTypeIdAndData(98, (byte) 2, false);
loc.getWorld().getBlockAt(X, Y - 1, Z - 1).setTypeIdAndData(98, (byte) 2, false);
loc.getWorld().getBlockAt(X, Y - 1, Z).setType(Material.STONE_BRICKS, false);
loc.getWorld().getBlockAt(X, Y - 1, Z - 1).setType(Material.STONE_BRICKS, false);
}
}

View File

@ -213,7 +213,7 @@ public class Pyramid extends Core {
// Level 3
world.getBlockAt(X, Y + 2, Z).setType(mainMat);
// Level 4
world.getBlockAt(X, Y + 3, Z).setType(Material.REDSTONE_TORCH_ON);
world.getBlockAt(X, Y + 3, Z).setType(Material.REDSTONE_TORCH);
}

View File

@ -6,6 +6,8 @@ import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.Sign;
import org.bukkit.block.data.BlockData;
import org.bukkit.block.data.Directional;
import org.jakub1221.herobrineai.HerobrineAI;
import org.jakub1221.herobrineai.Utils;
import org.jakub1221.herobrineai.AI.ConsoleLogger;
@ -78,11 +80,14 @@ public class Signs extends Core {
Block undersignblock = signblock.getLocation().subtract(0D, 1D, 0D).getBlock();
if (!signblock.getType().isSolid() && undersignblock.getType().isSolid()) {
signblock.setType(Material.SIGN_POST);
signblock.setType(Material.OAK_SIGN);
Sign sign = (Sign) signblock.getState();
sign.setLine(1, HerobrineAI.getPluginCore().getConfigDB().useSignMessages.get(randmsg));
sign.setRawData((byte) BlockChanger.getPlayerBlockFace(ploc).ordinal());
BlockData blockData = sign.getBlockData();
((Directional) blockData).setFacing(BlockChanger.getPlayerBlockFace(ploc));
sign.setBlockData(blockData);
sign.setLine(1, HerobrineAI.getPluginCore().getConfigDB().useSignMessages.get(randmsg));
sign.update();
}
}

View File

@ -187,69 +187,48 @@ public class Temple extends Core {
}
}
}
// Chest
ItemStack ciItem = null;
if (HerobrineAI.getPluginCore().getConfigDB().UseCustomItems) {
if (HerobrineAI.getPluginCore().getConfigDB().UseCustomItemsList.size() > 0) {
Random generator = new Random();
int chance = generator.nextInt(HerobrineAI.getPluginCore().getConfigDB().UseCustomItemsList.size());
if (HerobrineAI.getPluginCore().getSupport().isCustomItems()) {
if (HerobrineAI.getPluginCore().getSupport().getCustomItems()
.checkItem(HerobrineAI.getPluginCore().getConfigDB().UseCustomItemsList.get(chance))) {
ciItem = HerobrineAI.getPluginCore().getSupport().getCustomItems()
.getItem(HerobrineAI.getPluginCore().getConfigDB().UseCustomItemsList.get(chance));
}
}
}
// Chest
Random generator = Utils.getRandomGen();
int chance = generator.nextInt(15);
ItemStack item = null;
ArrayList<String> newLore = new ArrayList<String>();
if (chance < 4 && HerobrineAI.getPluginCore().getConfigDB().UseArtifactBow) {
item = new ItemStack(Material.BOW);
newLore.add("Herobrine<EFBFBD>s artifact");
newLore.add("Bow of Teleporting");
item = ItemName.setNameAndLore(item, "Bow of Teleporting", newLore);
item.addEnchantment(Enchantment.ARROW_FIRE, 1);
item.addEnchantment(Enchantment.ARROW_KNOCKBACK, 1);
} else if (chance < 8 && HerobrineAI.getPluginCore().getConfigDB().UseArtifactSword) {
item = new ItemStack(Material.DIAMOND_SWORD);
newLore.add("Herobrine<EFBFBD>s artifact");
newLore.add("Sword of Lighting");
item = ItemName.setNameAndLore(item, "Sword of Lighting", newLore);
item.addEnchantment(Enchantment.KNOCKBACK, 2);
item.addEnchantment(Enchantment.DAMAGE_ALL, 2);
item.addEnchantment(Enchantment.DURABILITY, 3);
} else if (chance < 12 && HerobrineAI.getPluginCore().getConfigDB().UseArtifactApple) {
item = new ItemStack(Material.GOLDEN_APPLE);
newLore.add("Herobrine<EFBFBD>s artifact");
newLore.add("Apple of Death");
item = ItemName.setNameAndLore(item, "Apple of Death", newLore);
if (ciItem != null) {
Chest chest = (Chest) loc.getWorld().getBlockAt(MainX + 6, MainY + 0, MainZ + 2).getState();
chest.getBlockInventory().setItem(chest.getInventory().firstEmpty(), ciItem);
}
} else {
Random generator = Utils.getRandomGen();
int chance = generator.nextInt(15);
ItemStack item = null;
ArrayList<String> newLore = new ArrayList<String>();
if (chance < 4 && HerobrineAI.getPluginCore().getConfigDB().UseArtifactBow) {
item = new ItemStack(Material.BOW);
newLore.add("Herobrine<EFBFBD>s artifact");
newLore.add("Bow of Teleporting");
item = ItemName.setNameAndLore(item, "Bow of Teleporting", newLore);
item.addEnchantment(Enchantment.ARROW_FIRE, 1);
item.addEnchantment(Enchantment.ARROW_KNOCKBACK, 1);
} else if (chance < 8 && HerobrineAI.getPluginCore().getConfigDB().UseArtifactSword) {
item = new ItemStack(Material.DIAMOND_SWORD);
newLore.add("Herobrine<EFBFBD>s artifact");
newLore.add("Sword of Lighting");
item = ItemName.setNameAndLore(item, "Sword of Lighting", newLore);
if (HerobrineAI.getPluginCore().getConfigDB().UseAncientSword) {
item = HerobrineAI.getPluginCore().getAICore().createAncientSword();
item.addEnchantment(Enchantment.KNOCKBACK, 2);
item.addEnchantment(Enchantment.DAMAGE_ALL, 2);
item.addEnchantment(Enchantment.DURABILITY, 3);
} else if (chance < 12 && HerobrineAI.getPluginCore().getConfigDB().UseArtifactApple) {
item = new ItemStack(Material.GOLDEN_APPLE);
newLore.add("Herobrine<EFBFBD>s artifact");
newLore.add("Apple of Death");
item = ItemName.setNameAndLore(item, "Apple of Death", newLore);
} else {
if (HerobrineAI.getPluginCore().getConfigDB().UseAncientSword) {
item = HerobrineAI.getPluginCore().getAICore().createAncientSword();
item.addEnchantment(Enchantment.KNOCKBACK, 2);
item.addEnchantment(Enchantment.DAMAGE_ALL, 2);
}
}
Chest chest = (Chest) loc.getWorld().getBlockAt(MainX + 6, MainY + 0, MainZ + 2).getState();
chest.getBlockInventory().setItem(chest.getInventory().firstEmpty(), item);
}
Chest chest = (Chest) loc.getWorld().getBlockAt(MainX + 6, MainY + 0, MainZ + 2).getState();
chest.getBlockInventory().setItem(chest.getInventory().firstEmpty(), item);
}
}

View File

@ -9,6 +9,8 @@ import org.jakub1221.herobrineai.HerobrineAI;
import org.jakub1221.herobrineai.Utils;
import org.jakub1221.herobrineai.misc.ItemName;
import net.minecraft.server.v1_14_R1.ChatComponentText;
import net.minecraft.server.v1_14_R1.EntityTypes;
import net.minecraft.server.v1_14_R1.GenericAttributes;
import net.minecraft.server.v1_14_R1.World;
@ -17,7 +19,7 @@ public class CustomSkeleton extends net.minecraft.server.v1_14_R1.EntitySkeleton
private MobType mobType = null;
public CustomSkeleton(World world, Location loc, MobType mbt) {
super(world);
super(EntityTypes.SKELETON, world);
this.mobType = mbt;
if (mbt == MobType.DEMON) {
spawnDemon(loc);
@ -26,10 +28,10 @@ public class CustomSkeleton extends net.minecraft.server.v1_14_R1.EntitySkeleton
public void spawnDemon(Location loc) {
this.getAttributeInstance(GenericAttributes.c).setValue(HerobrineAI.getPluginCore().getConfigDB().npc.getDouble("npc.Demon.Speed"));
this.getAttributeInstance(GenericAttributes.maxHealth).setValue(HerobrineAI.getPluginCore().getConfigDB().npc.getInt("npc.Demon.HP"));
this.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED).setValue(HerobrineAI.getPluginCore().getConfigDB().npc.getDouble("npc.Demon.Speed"));
this.getAttributeInstance(GenericAttributes.MAX_HEALTH).setValue(HerobrineAI.getPluginCore().getConfigDB().npc.getInt("npc.Demon.HP"));
this.setHealth(HerobrineAI.getPluginCore().getConfigDB().npc.getInt("npc.Demon.HP"));
this.setCustomName("Demon");
this.setCustomName(new ChatComponentText("Demon"));
Skeleton entityCast = (Skeleton) this.getBukkitEntity();
@ -43,7 +45,7 @@ public class CustomSkeleton extends net.minecraft.server.v1_14_R1.EntitySkeleton
}
public CustomSkeleton(World world) {
super(world);
super(EntityTypes.SKELETON, world);
}
@Override

View File

@ -43,10 +43,10 @@ public class BlockListener implements Listener {
{ new Vector(1, -1, 1), Material.GOLD_BLOCK },
{ new Vector(0, -1, -1), Material.GOLD_BLOCK },
{ new Vector(0, -1, +1), Material.GOLD_BLOCK },
{ new Vector(0, 0, 1), Material.REDSTONE_TORCH_ON },
{ new Vector(0, 0, -1), Material.REDSTONE_TORCH_ON },
{ new Vector(1, 0, 0), Material.REDSTONE_TORCH_ON },
{ new Vector(-1, 0, 0), Material.REDSTONE_TORCH_ON }
{ new Vector(0, 0, 1), Material.REDSTONE_TORCH },
{ new Vector(0, 0, -1), Material.REDSTONE_TORCH },
{ new Vector(1, 0, 0), Material.REDSTONE_TORCH },
{ new Vector(-1, 0, 0), Material.REDSTONE_TORCH }
};
boolean checkListCorrect = true;

View File

@ -1,6 +1,6 @@
package org.jakub1221.herobrineai.support;
import net.sacredlabyrinth.Phaed.PreciousStones.FieldFlag;
import net.sacredlabyrinth.Phaed.PreciousStones.field.FieldFlag;
import net.sacredlabyrinth.Phaed.PreciousStones.PreciousStones;
import org.bukkit.Bukkit;
@ -13,8 +13,6 @@ public class PreciousStonesHook {
}
public boolean isSecuredArea(Location loc) {
PreciousStones preciousStones = (PreciousStones) Bukkit.getServer().getPluginManager().getPlugin("PreciousStones");
return preciousStones.API().isFieldProtectingArea(FieldFlag.ALL, loc);
return PreciousStones.API().isFieldProtectingArea(FieldFlag.ALL, loc);
}
}

View File

@ -1,14 +1,12 @@
package org.jakub1221.herobrineai.support;
import java.util.Map;
import java.util.Map.Entry;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
import com.sk89q.worldguard.protection.managers.RegionManager;
import com.sk89q.worldguard.protection.regions.ProtectedRegion;
import com.sk89q.worldguard.WorldGuard;
import com.sk89q.worldguard.protection.ApplicableRegionSet;
import com.sk89q.worldguard.protection.regions.RegionContainer;
import com.sk89q.worldguard.protection.regions.RegionQuery;
public class WorldGuardHook {
public boolean Check() {
@ -17,20 +15,16 @@ public class WorldGuardHook {
}
public boolean isSecuredArea(Location loc) {
WorldGuardPlugin worldGuard = (WorldGuardPlugin) Bukkit.getServer().getPluginManager().getPlugin("WorldGuard");
RegionManager rm = worldGuard.getRegionManager(loc.getWorld());
if (rm != null) {
Map<String, ProtectedRegion> mp = rm.getRegions();
if (mp != null) {
for (Entry<String, ProtectedRegion> s : mp.entrySet()) {
if (s.getValue().contains(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ())) {
return true;
}
}
}
RegionContainer container = WorldGuard.getInstance().getPlatform().getRegionContainer();
RegionQuery query = container.createQuery();
ApplicableRegionSet set = query.getApplicableRegions(new com.sk89q.worldedit.util.Location(null, loc.getX(), loc.getY(), loc.getZ()));
if (set != null) {
return set.size() != 0;
}
else
{
return false;
}
return false;
}
}