can't fint a solution for the errors

Discussion in 'Plugin Development' started by Jeroen123TC, Apr 23, 2021.

Thread Status:
Not open for further replies.
  1. Offline

    Jeroen123TC

    Code:
    package com.jeroen123.instanttnt;import org.bukkit.Location;import org.bukkit.World;import org.bukkit.entity.Entity;import org.bukkit.entity.TNTPrimed;import org.bukkit.plugin.java.JavaPlugin;import org.bukkit.scheduler.BukkitRunnable;import org.bukkit.util.Vector;import java.text.DecimalFormat;import java.util.List;import java.util.Random;public final class InstantTnTPlugin extends JavaPlugin {
    
    public static final Random RANDOM = new Random(); private static final DecimalFormat DECIMAL_FORMAT = new DecimalFormat("0.0");@Overridepublic void onEnable() {
    saveDefaultConfig();getLogger().info("Plugin is Enable!");getCommand("instanttnt").setExecutor(new InstantTnTCommands(this));getServer().getPluginManager().registerEvents(new InstantTnTListener(this), this);}
    
    public boolean isWorldEnabled(World world) {
    return !containsIgnoreCase(getConfig().getStringList("DisableWorlds"), world.getName());}
    
    public String getRandomTNTName() {
    List<String> names = getConfig().getStringList("Names"); return color(names.get(RANDOM.nextInt(names.size())));}
    
    private String color(String s) {
    }
    
    public TNTPrimed spawnTNT(Location location, Entity source, String name) {
    return spawnTNT(location, source, name, true);}
    
    public TNTPrimed spawnTNT(Location location, Entity source, String name, boolean applyVelocity) {
    TNTPrimed tnt = location.getWorld().spawn(location.add(0.5, 0.25, 0.5), TNTPrimed.class); if (applyVelocity) {
    tnt.setVelocity(new Vector(0, 0.25, 0));tnt.teleport(location);}
    tnt.setIsIncendiary(getConfig().getBoolean("Fire"));tnt.setFuseTicks(getConfig().getInt("ExplodeTicks"));tnt.setYield((float) getConfig().getDouble("Radius")); if (getConfig().getBoolean("CustomName")) {
    tnt.setCustomNameVisible(true); if (!name.contains("%timer")) {
    tnt.setCustomName(name);} else {
    new BukkitRunnable() {
    
    @Overridepublic void run() {
    tnt.setCustomName(name.replace("%timer", DECIMAL_FORMAT.format(tnt.getFuseTicks() / 20.0))); if (!tnt.isValid() || tnt.getFuseTicks() <= 0) {
    cancel();}
    }
    }.runTaskTimer(this, 0, 1);}
    }
    }
    
    public boolean containsIgnoreCase(List<String> list, String s) {
    return list.stream().anyMatch(s::equalsIgnoreCase);}
    }
    

    can some one help me out how I can fix the errors? I can't find how to fix the errors.
     
    Last edited by a moderator: Apr 23, 2021
  2. Online

    timtower Administrator Administrator Moderator

    @Jeroen123TC You able to fix the code? There are not really enters in there.
     
  3. Offline

    Jeroen123TC

    sorry i don’t know what you mean

    or do you have a code for a simple instant tnt plugin that only activate tnt by placing and a Cooldowns for placing the next tnt?

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Apr 23, 2021
  4. Online

    timtower Administrator Administrator Moderator

    Look at the code you posted.
    It is unreadable.
    Code:
    package com.jeroen123.instanttnt;import org.bukkit.Location;import org.bukkit.World;import org.bukkit.entity.Entity;
    Not gonna read the entire code like that
     
    Xp10d3 and Newdel like this.
  5. Offline

    darthvader1925

    Reformat your code, then tell me the error and what is going wrong. Then I'll help you.
     
    Last edited: May 3, 2021
Thread Status:
Not open for further replies.

Share This Page