(PLUGIN HELP!) KnockBack-TnT READ THE DESCRIPTION!

Discussion in 'Archived: Plugin Requests' started by mrgreen33gamer, Aug 23, 2013.

  1. Offline

    mrgreen33gamer


    Mk
     
  2. Offline

    mrgreen33gamer

    BUMP, i need a plugin that really works
     
  3. Offline

    timtower Administrator Administrator Moderator

    bobacadodl
     
  4. Offline

    mrgreen33gamer


    Thanks for helping me bump :)
     
  5. Offline

    TheOCcrew

    this plugin looks great do you know when it will be done mrgreen33gamer?
     
  6. Offline

    TheOCcrew

    What plugin are u using in the video, because i know its not command blocks ???
     
  7. Offline

    bobacadodl

    Sorry, I dont have time to finish this. Someone else should be able to do it pretty quick though, its very simple.

    Heres the source:
    Code:
    import java.util.Random;
     
    import org.bukkit.Material;
    import org.bukkit.enchantments.Enchantment;
    import org.bukkit.entity.Entity;
    import org.bukkit.entity.EntityType;
    import org.bukkit.entity.LivingEntity;
    import org.bukkit.entity.TNTPrimed;
    import org.bukkit.event.EventHandler;
    import org.bukkit.event.EventPriority;
    import org.bukkit.event.Listener;
    import org.bukkit.event.block.Action;
    import org.bukkit.event.block.BlockPlaceEvent;
    import org.bukkit.event.entity.EntityExplodeEvent;
    import org.bukkit.event.player.PlayerInteractEvent;
    import org.bukkit.inventory.ItemStack;
    import org.bukkit.inventory.ShapedRecipe;
    import org.bukkit.inventory.meta.ItemMeta;
    import org.bukkit.metadata.FixedMetadataValue;
    import org.bukkit.plugin.java.JavaPlugin;
    import org.bukkit.scheduler.BukkitRunnable;
     
    public class KnockbackTNT extends JavaPlugin implements Listener{
        Random r = new Random();
       
        ItemStack kbtnt;
        public void onEnable(){
            kbtnt = new ItemStack(Material.TNT,1);
            kbtnt.addUnsafeEnchantment(Enchantment.KNOCKBACK, 1);
            ItemMeta kbmeta = kbtnt.getItemMeta();
            kbmeta.setDisplayName("Knockback TNT");
            kbtnt.setItemMeta(kbmeta);
           
            ShapedRecipe tntrecipe = new ShapedRecipe(kbtnt);
            tntrecipe = tntrecipe.shape("sss","sds","sss");
            tntrecipe = tntrecipe.setIngredient('s', Material.SAND);
            tntrecipe = tntrecipe.setIngredient('d', Material.DIAMOND);
            getServer().addRecipe(tntrecipe);
            getServer().getPluginManager().registerEvents(this, this);
        }
       
        @EventHandler(priority=EventPriority.HIGH, ignoreCancelled=true)
        public void onBlockPlace(BlockPlaceEvent e){
            if(e.getItemInHand()!=null){
                if(e.getItemInHand().getType()==kbtnt.getType()){
                    if(e.getItemInHand().getItemMeta()!=null){
                        if(e.getItemInHand().getItemMeta().getDisplayName()!=null){
                            if(e.getItemInHand().getItemMeta().getDisplayName().equals("Knockback TNT")){
                                if(e.getItemInHand().getEnchantments().containsKey(Enchantment.KNOCKBACK)){
                                    e.setCancelled(true);
                                    if(e.getItemInHand().getAmount()==1){
                                        e.getItemInHand().setType(Material.AIR);
                                    }
                                    else{
                                        e.getItemInHand().setAmount(e.getItemInHand().getAmount()-1);
                                    }
                                    TNTPrimed tnt = (TNTPrimed) e.getBlockPlaced().getWorld().spawnEntity(e.getBlockPlaced().getLocation().add(0,1,0), EntityType.PRIMED_TNT);
                                    tnt.setMetadata("KnockbackTNT", new FixedMetadataValue(this,true));
                                }
                            }
                        }
                    }
                }
            }
        }
       
        @EventHandler
        public void onExplode(EntityExplodeEvent e){
            if(e.getEntity() instanceof TNTPrimed){
                if(e.getEntity().hasMetadata("KnockbackTNT")){
                    e.blockList().clear();
                    e.setYield(0f);
                    for(final Entity hit:e.getEntity().getNearbyEntities(4, 4, 4)){
                        if(hit instanceof LivingEntity){
                            new BukkitRunnable() {
                                @Override
                                public void run() {
                                    hit.setVelocity(hit.getVelocity().multiply(10.0));
                                }
                            }.runTaskLater(this, 1L);
                        }
                    }
                }
            }
        }
       
        @EventHandler
        public void onInteract(PlayerInteractEvent e){
            if(e.getAction()==Action.RIGHT_CLICK_AIR || e.getAction()==Action.LEFT_CLICK_AIR){
                if(e.getItem()!=null){
                    if(e.getItem().getType()==kbtnt.getType()){
                        if(e.getItem().getItemMeta()!=null){
                            if(e.getItem().getItemMeta().getDisplayName()!=null){
                                if(e.getItem().getItemMeta().getDisplayName().equals("Knockback TNT")){
                                    if(e.getItem().getEnchantments().containsKey(Enchantment.KNOCKBACK)){
                                        if(e.getItem().getAmount()==1){
                                            e.getItem().setType(Material.AIR);
                                        }
                                        else{
                                            e.getItem().setAmount(e.getItem().getAmount()-1);
                                        }
                                        TNTPrimed tnt = (TNTPrimed) e.getPlayer().getWorld().spawnEntity(e.getPlayer().getLocation().add(0,2,0), EntityType.PRIMED_TNT);
                                        tnt.setMetadata("KnockbackTNT", new FixedMetadataValue(this,true));
                                        tnt.setVelocity(e.getPlayer().getEyeLocation().getDirection().normalize().multiply(1.5));
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
    
     
  8. Offline

    IcyCoolDude

    Decided to try my hand at this. Source is in the jar file.
    Everything is pretty much in config.
    Use your recipe to make the TNT.
    <Edit by Moderator: Redacted filesmelt url>
     
    Last edited by a moderator: Jan 28, 2019
  9. Offline

    georgsterman567

  10. Offline

    mrgreen33gamer

     
    Last edited by a moderator: Jan 28, 2019
  11. Offline

    IcyCoolDude

    Well I am tired I made some changes and blah blah blah so tired...also delete your config to create the new not missed name crap(had knockback as knockbackVerticalMultipler in coding) + I only did 20 minutes look over on this and light testing I tested while in survival no permissions with over enchanted armor to prevent killing me.
    Also, forgot to mention permission: TNTKnockBack.TNTDamage.false -obvious take 0 tnt damage.
    <Edit by Moderator: Redacted mediafire url>
    Lastly,
    [quote uid=35441 name="IcyCoolDude" post=1839949]Source is in the jar file.[/quote]
    [quote uid=90864121 name="mrgreen33gamer" post=1844830]I decompiled your code,[/quote]
    what? just open the jar with 7zip or something and it is in the src folder.
     
    Last edited by a moderator: Nov 5, 2016
  12. Offline

    mrgreen33gamer

    I used my Java Decompiler to see your java codes you made :) i can get any codes, like from SurvivalGames, MobArena, and other .jar files, which means FREE CODES! :p
     

Share This Page