Hello mc-market developers to day I would like to know how to do 2 things
One is how to add custom name to my items when a player joins the server
Code for that:
Second, how would I make it in the config to when a player hits y 0 they get teleport back to the cords but they get put back to the cords they put in the config
He is the code I have so far:
One is how to add custom name to my items when a player joins the server
Code for that:
Code:
// Armor on join \\
@EventHandler
public void onJoin(PlayerJoinEvent e) {
e.getPlayer().getInventory().setHelmet(new ItemStack(Material.STAINED_GLASS, 1));
e.getPlayer().getInventory().setChestplate(new ItemStack(Material.IRON_CHESTPLATE, 1));
e.getPlayer().getInventory().setLeggings(new ItemStack(Material.IRON_LEGGINGS, 1));
e.getPlayer().getInventory().setBoots(new ItemStack(Material.IRON_BOOTS, 1));
e.getPlayer().setMaxHealth(2.0);
e.getPlayer().setHealth(2.0);
e.getPlayer().setFoodLevel(20);
}
Second, how would I make it in the config to when a player hits y 0 they get teleport back to the cords but they get put back to the cords they put in the config
He is the code I have so far:
Code:
@EventHandler
public void onPlayerMove (PlayerMoveEvent e){
Player p = e.getPlayer();
Location loc = p.getLocation();
World world = Bukkit.getServer().getWorld("world");
if (loc.getBlockY() <= 0) {
World w = Bukkit.getServer().getWorld(getConfig().getString("location"));
double x = getConfig().getDouble("loc.x");
double y = getConfig().getDouble("loc.y");
double z = getConfig().getDouble("loc.z");
p.teleport(new Location(w, x, y, z));
}
}
