├── .gitignore ├── DeathStuff ├── README.md ├── nb-configuration.xml ├── pom.xml └── src │ └── main │ ├── java │ └── net │ │ └── md_5 │ │ └── DeathStuff.java │ └── resources │ └── plugin.yml ├── DropParty ├── README.md ├── nb-configuration.xml ├── pom.xml └── src │ └── main │ ├── java │ └── net │ │ └── md_5 │ │ └── DropParty.java │ └── resources │ └── plugin.yml ├── EmeraldSword ├── README.md ├── nb-configuration.xml ├── pom.xml └── src │ └── main │ ├── java │ └── net │ │ └── md_5 │ │ └── EmeraldSword.java │ └── resources │ └── plugin.yml ├── ForgetMe ├── README.md ├── nb-configuration.xml ├── pom.xml └── src │ └── main │ ├── java │ └── net │ │ └── md_5 │ │ └── ForgetMe.java │ └── resources │ └── plugin.yml ├── PrefixTags ├── PermissionsEx.jar ├── README.md ├── nb-configuration.xml ├── pom.xml └── src │ └── main │ ├── java │ └── net │ │ └── md_5 │ │ └── PrefixTags.java │ └── resources │ └── plugin.yml ├── README.md ├── StickyMob ├── README.md ├── nb-configuration.xml ├── pom.xml └── src │ └── main │ ├── java │ └── net │ │ └── md_5 │ │ └── StickyMob.java │ └── resources │ └── plugin.yml ├── TestPlugin ├── HoloAPI.jar ├── README.md ├── nb-configuration.xml ├── pom.xml └── src │ └── main │ ├── java │ └── net │ │ └── md_5 │ │ └── TestPlugin.java │ └── resources │ └── plugin.yml ├── VoidTP ├── nb-configuration.xml ├── pom.xml └── src │ └── main │ ├── java │ └── net │ │ └── md_5 │ │ └── VoidTP.java │ └── resources │ └── plugin.yml └── pom.xml /.gitignore: -------------------------------------------------------------------------------- 1 | # Eclipse stuff 2 | .classpath 3 | .project 4 | .settings/ 5 | 6 | # netbeans 7 | nbproject/ 8 | nbactions.xml 9 | 10 | # we use maven! 11 | build.xml 12 | 13 | # maven 14 | target/ 15 | dependency-reduced-pom.xml 16 | 17 | # vim 18 | .*.sw[a-p] 19 | 20 | # various other potential build files 21 | build/ 22 | bin/ 23 | dist/ 24 | manifest.mf 25 | 26 | # Mac filesystem dust 27 | .DS_Store/ 28 | 29 | # intellij 30 | *.iml 31 | *.ipr 32 | *.iws 33 | .idea/ 34 | 35 | # other files 36 | *.log* 37 | 38 | # delombok 39 | */src/main/lombok 40 | -------------------------------------------------------------------------------- /DeathStuff/README.md: -------------------------------------------------------------------------------- 1 | DeathStuff 2 | ========== 3 | 4 | Does stuff to players during death / PvP. 5 | -------------------------------------------------------------------------------- /DeathStuff/nb-configuration.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | 10 | 16 | project 17 | NEW_LINE 18 | NEW_LINE 19 | NEW_LINE 20 | true 21 | true 22 | true 23 | true 24 | true 25 | true 26 | true 27 | true 28 | true 29 | true 30 | 31 | 32 | -------------------------------------------------------------------------------- /DeathStuff/pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4.0.0 4 | 5 | 6 | net.md_5 7 | SmallPlugins 8 | 1.0-SNAPSHOT 9 | 10 | 11 | net.md_5 12 | DeathStuff 13 | 1.0-SNAPSHOT 14 | jar 15 | 16 | DeathStuff 17 | Does stuff to players during death / PvP. 18 | 19 | 20 | 21 | org.bukkit 22 | bukkit 23 | ${bukkit.version} 24 | compile 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /DeathStuff/src/main/java/net/md_5/DeathStuff.java: -------------------------------------------------------------------------------- 1 | package net.md_5; 2 | 3 | import org.bukkit.Effect; 4 | import org.bukkit.Material; 5 | import org.bukkit.entity.Player; 6 | import org.bukkit.event.EventHandler; 7 | import org.bukkit.event.Listener; 8 | import org.bukkit.event.entity.EntityDamageByEntityEvent; 9 | import org.bukkit.event.entity.PlayerDeathEvent; 10 | import org.bukkit.inventory.ItemStack; 11 | import org.bukkit.plugin.java.JavaPlugin; 12 | 13 | public class DeathStuff extends JavaPlugin implements Listener 14 | { 15 | 16 | private Material reward; 17 | 18 | @Override 19 | public void onEnable() 20 | { 21 | getConfig().addDefault( "reward", "EMERALD" ); 22 | getConfig().addDefault( "reward_count", 1 ); 23 | getConfig().options().copyDefaults( true ); 24 | saveConfig(); 25 | 26 | reward = Material.getMaterial( getConfig().getString( "reward" ) ); 27 | 28 | getServer().getPluginManager().registerEvents( this, this ); 29 | } 30 | 31 | @EventHandler 32 | public void playerDeath(PlayerDeathEvent event) 33 | { 34 | if ( reward != null ) 35 | { 36 | Player killer = event.getEntity().getKiller(); 37 | if ( killer != null ) 38 | { 39 | killer.getInventory().addItem( new ItemStack( reward, getConfig().getInt( "reward_count" ) ) ); 40 | } 41 | } 42 | } 43 | 44 | @EventHandler(ignoreCancelled = true) 45 | public void playerHit(EntityDamageByEntityEvent event) 46 | { 47 | if ( event.getEntity() instanceof Player && event.getDamager() instanceof Player ) 48 | { 49 | event.getEntity().getWorld().playEffect( event.getEntity().getLocation(), Effect.SMOKE, 0 ); 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /DeathStuff/src/main/resources/plugin.yml: -------------------------------------------------------------------------------- 1 | name: ${project.name} 2 | version: ${project.version} 3 | description: ${project.description} 4 | main: net.md_5.DeathStuff 5 | -------------------------------------------------------------------------------- /DropParty/README.md: -------------------------------------------------------------------------------- 1 | DropParty 2 | ========== 3 | 4 | Drops items and stuff. 5 | -------------------------------------------------------------------------------- /DropParty/nb-configuration.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | 10 | 16 | project 17 | NEW_LINE 18 | NEW_LINE 19 | NEW_LINE 20 | true 21 | true 22 | true 23 | true 24 | true 25 | true 26 | true 27 | true 28 | true 29 | true 30 | 31 | 32 | -------------------------------------------------------------------------------- /DropParty/pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4.0.0 4 | 5 | 6 | net.md_5 7 | SmallPlugins 8 | 1.0-SNAPSHOT 9 | 10 | 11 | net.md_5 12 | DropParty 13 | 1.0-SNAPSHOT 14 | jar 15 | 16 | DropParty 17 | Drops items and stuff. 18 | 19 | 20 | 21 | org.bukkit 22 | bukkit 23 | ${bukkit.version} 24 | compile 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /DropParty/src/main/java/net/md_5/DropParty.java: -------------------------------------------------------------------------------- 1 | package net.md_5; 2 | 3 | import java.util.ArrayDeque; 4 | import java.util.ArrayList; 5 | import java.util.Arrays; 6 | import java.util.List; 7 | import java.util.Queue; 8 | import java.util.Random; 9 | import java.util.logging.Level; 10 | import org.bukkit.ChatColor; 11 | import org.bukkit.Material; 12 | import org.bukkit.entity.Player; 13 | import org.bukkit.inventory.ItemStack; 14 | import org.bukkit.plugin.java.JavaPlugin; 15 | 16 | public class DropParty extends JavaPlugin 17 | { 18 | 19 | private final Random random = new Random(); 20 | private final List dropItems = new ArrayList(); 21 | 22 | @Override 23 | public void onEnable() 24 | { 25 | getConfig().addDefault( "start_message", "&7A drop party has begun!" ); 26 | getConfig().addDefault( "give_message", "&9Wow you just got free stuff!" ); 27 | getConfig().addDefault( "end_message", "&8Oh no, the party is over!" ); 28 | getConfig().addDefault( "items", Arrays.asList( "DIAMOND_SWORD", "DIAMOND", "IRON_INGOT", "GOLD_INGOT" ) ); 29 | getConfig().addDefault( "interval", 60 ); 30 | getConfig().addDefault( "duration", 180 ); 31 | 32 | getConfig().options().copyDefaults( true ); 33 | saveConfig(); 34 | 35 | for ( String s : getConfig().getStringList( "items" ) ) 36 | { 37 | String[] split = s.split( ":", 2 ); 38 | String name = split[0]; 39 | int amount = split.length > 1 ? Integer.parseInt( split[1] ) : 1; 40 | 41 | Material material = Material.matchMaterial( name ); 42 | if ( material == null ) 43 | { 44 | getLogger().log( Level.WARNING, "Could not find material {0}", name ); 45 | } 46 | dropItems.add( new ItemStack( material, amount ) ); 47 | } 48 | 49 | int intervalTicks = getConfig().getInt( "interval" ) * 60 * 20; 50 | 51 | getServer().getScheduler().scheduleSyncRepeatingTask( this, new PartySchedule(), intervalTicks, intervalTicks ); 52 | } 53 | 54 | private class PartySchedule implements Runnable 55 | { 56 | 57 | @Override 58 | public void run() 59 | { 60 | getServer().broadcastMessage( ChatColor.translateAlternateColorCodes( '&', getConfig().getString( "start_message" ) ) ); 61 | new PartyTime(); 62 | } 63 | } 64 | 65 | private class PartyTime implements Runnable 66 | { 67 | 68 | private final int taskId; 69 | private final Queue playersToGive; 70 | 71 | public PartyTime() 72 | { 73 | playersToGive = new ArrayDeque( Arrays.asList( getServer().getOnlinePlayers() ) ); 74 | int approxInterval = getConfig().getInt( "duration" ) / playersToGive.size(); // In seconds 75 | taskId = getServer().getScheduler().scheduleSyncRepeatingTask( DropParty.this, this, 0, approxInterval * 20 ); 76 | } 77 | 78 | @Override 79 | public void run() 80 | { 81 | Player player = playersToGive.poll(); 82 | 83 | if ( player != null && player.isOnline() ) 84 | { 85 | 86 | player.sendMessage( ChatColor.translateAlternateColorCodes( '&', getConfig().getString( "give_message" ) ) ); 87 | player.getInventory().addItem( dropItems.get( random.nextInt( dropItems.size() ) ) ); 88 | } 89 | 90 | if ( playersToGive.isEmpty() ) 91 | { 92 | getServer().getScheduler().cancelTask( taskId ); 93 | getServer().broadcastMessage( ChatColor.translateAlternateColorCodes( '&', getConfig().getString( "end_message" ) ) ); 94 | } 95 | } 96 | } 97 | } 98 | -------------------------------------------------------------------------------- /DropParty/src/main/resources/plugin.yml: -------------------------------------------------------------------------------- 1 | name: ${project.name} 2 | version: ${project.version} 3 | description: ${project.description} 4 | main: net.md_5.DropParty 5 | -------------------------------------------------------------------------------- /EmeraldSword/README.md: -------------------------------------------------------------------------------- 1 | EmeraldSword 2 | ============ 3 | 4 | Build a powerful sword out of Emeralds. 5 | -------------------------------------------------------------------------------- /EmeraldSword/nb-configuration.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | 10 | 16 | project 17 | NEW_LINE 18 | NEW_LINE 19 | NEW_LINE 20 | true 21 | true 22 | true 23 | true 24 | true 25 | true 26 | true 27 | true 28 | true 29 | true 30 | 31 | 32 | -------------------------------------------------------------------------------- /EmeraldSword/pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4.0.0 4 | 5 | 6 | net.md_5 7 | SmallPlugins 8 | 1.0-SNAPSHOT 9 | 10 | 11 | net.md_5 12 | EmeraldSword 13 | 1.0-SNAPSHOT 14 | jar 15 | 16 | EmeraldSword 17 | Build a powerful sword out of Emeralds. 18 | 19 | 20 | 21 | org.bukkit 22 | bukkit 23 | ${bukkit.version} 24 | compile 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /EmeraldSword/src/main/java/net/md_5/EmeraldSword.java: -------------------------------------------------------------------------------- 1 | package net.md_5; 2 | 3 | import org.bukkit.Material; 4 | import org.bukkit.enchantments.Enchantment; 5 | import org.bukkit.inventory.ItemStack; 6 | import org.bukkit.inventory.ShapedRecipe; 7 | import org.bukkit.inventory.meta.ItemMeta; 8 | import org.bukkit.plugin.java.JavaPlugin; 9 | 10 | public class EmeraldSword extends JavaPlugin 11 | { 12 | 13 | @Override 14 | public void onEnable() 15 | { 16 | ItemStack sword = new ItemStack( Material.DIAMOND_SWORD ); 17 | ItemMeta im = sword.getItemMeta(); 18 | im.setDisplayName( "Emerald Sword" ); 19 | sword.setItemMeta( im ); 20 | sword.addEnchantment( Enchantment.DAMAGE_ALL, 5 ); 21 | ShapedRecipe recipe = new ShapedRecipe( sword ); 22 | recipe.shape( " E ", " E ", " S " ); 23 | recipe.setIngredient( 'E', Material.EMERALD ); 24 | recipe.setIngredient( 'S', Material.STICK ); 25 | getServer().addRecipe( recipe ); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /EmeraldSword/src/main/resources/plugin.yml: -------------------------------------------------------------------------------- 1 | name: ${project.name} 2 | version: ${project.version} 3 | description: ${project.description} 4 | main: net.md_5.EmeraldSword 5 | -------------------------------------------------------------------------------- /ForgetMe/README.md: -------------------------------------------------------------------------------- 1 | ForgetMe 2 | ======== 3 | 4 | Runs commands on inactive players. 5 | -------------------------------------------------------------------------------- /ForgetMe/nb-configuration.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | 10 | 16 | project 17 | NEW_LINE 18 | NEW_LINE 19 | NEW_LINE 20 | true 21 | true 22 | true 23 | true 24 | true 25 | true 26 | true 27 | true 28 | true 29 | true 30 | 31 | 32 | -------------------------------------------------------------------------------- /ForgetMe/pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4.0.0 4 | 5 | 6 | net.md_5 7 | SmallPlugins 8 | 1.0-SNAPSHOT 9 | 10 | 11 | net.md_5 12 | ForgetMe 13 | 1.0-SNAPSHOT 14 | jar 15 | 16 | ForgetMe 17 | Runs commands on inactive players. 18 | 19 | 20 | 21 | org.bukkit 22 | bukkit 23 | ${bukkit.version} 24 | compile 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /ForgetMe/src/main/java/net/md_5/ForgetMe.java: -------------------------------------------------------------------------------- 1 | package net.md_5; 2 | 3 | import java.io.File; 4 | import java.io.IOException; 5 | import java.util.Arrays; 6 | import java.util.Calendar; 7 | import java.util.Date; 8 | import java.util.List; 9 | import java.util.logging.Level; 10 | import org.bukkit.OfflinePlayer; 11 | import org.bukkit.configuration.ConfigurationSection; 12 | import org.bukkit.configuration.file.YamlConfiguration; 13 | import org.bukkit.event.EventHandler; 14 | import org.bukkit.event.EventPriority; 15 | import org.bukkit.event.Listener; 16 | import org.bukkit.event.player.PlayerJoinEvent; 17 | import org.bukkit.plugin.java.JavaPlugin; 18 | 19 | public class ForgetMe extends JavaPlugin implements Listener, Runnable 20 | { 21 | 22 | private List ignoredList; 23 | private List forgotten; 24 | private YamlConfiguration ignored; 25 | private File ignoredFile; 26 | 27 | @Override 28 | public void onEnable() 29 | { 30 | getConfig().addDefault( "time.7000", Arrays.asList( "say player %s has been gone for 7000 days", "ban %s not welcome :(" ) ); 31 | getConfig().addDefault( "interval", 360 ); 32 | 33 | getConfig().options().copyDefaults( true ); 34 | saveConfig(); 35 | 36 | ignoredFile = new File( getDataFolder(), "ignored.yml" ); 37 | 38 | getServer().getPluginManager().registerEvents( this, this ); 39 | 40 | int interval = getConfig().getInt( "interval" ) * 20 * 60; 41 | getServer().getScheduler().runTaskTimerAsynchronously( this, this, interval, interval ); 42 | 43 | try 44 | { 45 | ignored = YamlConfiguration.loadConfiguration( ignoredFile ); 46 | } catch ( Exception ex ) 47 | { 48 | getLogger().log( Level.SEVERE, "Error loading ignored!", ex ); 49 | } 50 | 51 | ignoredList = ignored.getStringList( "players" ); 52 | forgotten = ignored.getStringList( "forgotten" ); 53 | 54 | getServer().getScheduler().runTaskTimerAsynchronously( this, new Runnable() 55 | { 56 | 57 | @Override 58 | public void run() 59 | { 60 | ignored.set( "players", ignoredList ); 61 | ignored.set( "forgotten", forgotten ); 62 | try 63 | { 64 | ignored.save( ignoredFile ); 65 | } catch ( IOException ex ) 66 | { 67 | getLogger().log( Level.SEVERE, "Error saving ignored players", ex ); 68 | } 69 | } 70 | }, 60 * 20, 60 * 20 ); 71 | } 72 | 73 | @EventHandler(priority = EventPriority.MONITOR) 74 | public void playerJoin(PlayerJoinEvent event) 75 | { 76 | if ( event.getPlayer().hasPermission( "inactive.ignore" ) ) 77 | { 78 | String name = event.getPlayer().getName().toLowerCase(); 79 | if ( !ignoredList.contains( name ) ) 80 | { 81 | ignoredList.add( name ); 82 | } 83 | } 84 | forgotten.remove( event.getPlayer().getName().toLowerCase() ); 85 | } 86 | 87 | @Override 88 | public void run() 89 | { 90 | ConfigurationSection timeSection = getConfig().getConfigurationSection( "time" ); 91 | for ( String key : timeSection.getKeys( false ) ) 92 | { 93 | int elapsed = Integer.parseInt( key ); 94 | Calendar threshold = Calendar.getInstance(); 95 | threshold.add( Calendar.DATE, -elapsed ); 96 | Date thresholdDate = threshold.getTime(); 97 | 98 | List commands = timeSection.getStringList( key ); 99 | 100 | for ( final OfflinePlayer player : getServer().getOfflinePlayers() ) 101 | { 102 | String lowerCaseName = player.getName().toLowerCase(); 103 | if ( ignoredList.contains( lowerCaseName ) || forgotten.contains( lowerCaseName ) ) 104 | { 105 | continue; 106 | } 107 | 108 | Date lastPlayed = new Date( player.getLastPlayed() ); 109 | if ( lastPlayed.before( thresholdDate ) ) 110 | { 111 | for ( final String command : commands ) 112 | { 113 | getServer().getScheduler().runTask( this, new Runnable() 114 | { 115 | 116 | @Override 117 | public void run() 118 | { 119 | getServer().dispatchCommand( getServer().getConsoleSender(), String.format( command, player.getName() ) ); 120 | } 121 | } ); 122 | } 123 | forgotten.add( lowerCaseName ); 124 | } 125 | } 126 | } 127 | } 128 | } 129 | -------------------------------------------------------------------------------- /ForgetMe/src/main/resources/plugin.yml: -------------------------------------------------------------------------------- 1 | name: ${project.name} 2 | version: ${project.version} 3 | description: ${project.description} 4 | main: net.md_5.ForgetMe 5 | 6 | permission: 7 | inactive.ignore: 8 | description: Do not have inactive commands run 9 | default: op 10 | -------------------------------------------------------------------------------- /PrefixTags/PermissionsEx.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/md-5/SmallPlugins/e4611c9b303a2d6a72c037d05f9b7014cfa8f288/PrefixTags/PermissionsEx.jar -------------------------------------------------------------------------------- /PrefixTags/README.md: -------------------------------------------------------------------------------- 1 | PrefixTags 2 | ========== 3 | 4 | Prefixes player's in game names with their PEX prefix. 5 | -------------------------------------------------------------------------------- /PrefixTags/nb-configuration.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | 10 | 16 | project 17 | NEW_LINE 18 | NEW_LINE 19 | NEW_LINE 20 | true 21 | true 22 | true 23 | true 24 | true 25 | true 26 | true 27 | true 28 | true 29 | true 30 | 31 | 32 | -------------------------------------------------------------------------------- /PrefixTags/pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4.0.0 4 | 5 | 6 | net.md_5 7 | SmallPlugins 8 | 1.0-SNAPSHOT 9 | 10 | 11 | net.md_5 12 | PrefixTags 13 | 1.0-SNAPSHOT 14 | jar 15 | 16 | PrefixTags 17 | Prefixes player's in game names with their PEX prefix. 18 | 19 | 20 | 21 | org.bukkit 22 | bukkit 23 | ${bukkit.version} 24 | compile 25 | 26 | 27 | ru.tehkode 28 | PermissionsEx 29 | 1.20.4 30 | system 31 | ${project.basedir}/PermissionsEx.jar 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /PrefixTags/src/main/java/net/md_5/PrefixTags.java: -------------------------------------------------------------------------------- 1 | package net.md_5; 2 | 3 | import org.bukkit.ChatColor; 4 | import org.bukkit.entity.Player; 5 | import org.bukkit.event.EventHandler; 6 | import org.bukkit.event.EventPriority; 7 | import org.bukkit.event.Listener; 8 | import org.bukkit.event.player.PlayerJoinEvent; 9 | import org.bukkit.event.player.PlayerQuitEvent; 10 | import org.bukkit.plugin.java.JavaPlugin; 11 | import org.bukkit.scoreboard.Team; 12 | import ru.tehkode.permissions.bukkit.PermissionsEx; 13 | 14 | public class PrefixTags extends JavaPlugin implements Listener 15 | { 16 | 17 | @Override 18 | public void onEnable() 19 | { 20 | getServer().getPluginManager().registerEvents( this, this ); 21 | } 22 | 23 | @EventHandler(priority = EventPriority.MONITOR) 24 | public void playerJoin(PlayerJoinEvent event) 25 | { 26 | Player player = event.getPlayer(); 27 | Team team = player.getScoreboard().getTeam( player.getName() ); 28 | if ( team == null ) 29 | { 30 | team = player.getScoreboard().registerNewTeam( player.getName() ); 31 | } 32 | 33 | String prefix = PermissionsEx.getUser( player ).getPrefix(); 34 | if ( prefix != null ) 35 | { 36 | team.setPrefix( ChatColor.translateAlternateColorCodes( '&', prefix.substring( 0, Math.min( prefix.length(), 16 ) ) ) ); 37 | } 38 | team.addPlayer( player ); 39 | } 40 | 41 | @EventHandler(priority = EventPriority.MONITOR) 42 | public void playerQuit(PlayerQuitEvent event) 43 | { 44 | Player player = event.getPlayer(); 45 | Team team = player.getScoreboard().getTeam( player.getName() ); 46 | if ( team != null ) 47 | { 48 | team.removePlayer( player ); 49 | team.unregister(); 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /PrefixTags/src/main/resources/plugin.yml: -------------------------------------------------------------------------------- 1 | name: ${project.name} 2 | version: ${project.version} 3 | description: ${project.description} 4 | main: net.md_5.PrefixTags 5 | depend: [PermissionsEx] 6 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | SmallPlugins 2 | ============ 3 | 4 | A collection of small plugins written by me 5 | -------------------------------------------------------------------------------- /StickyMob/README.md: -------------------------------------------------------------------------------- 1 | StickyMob 2 | ========== 3 | 4 | Spawns a single mob and keeps him there, stickily. 5 | -------------------------------------------------------------------------------- /StickyMob/nb-configuration.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | 10 | 16 | project 17 | NEW_LINE 18 | NEW_LINE 19 | NEW_LINE 20 | true 21 | true 22 | true 23 | true 24 | true 25 | true 26 | true 27 | true 28 | true 29 | true 30 | 31 | 32 | -------------------------------------------------------------------------------- /StickyMob/pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4.0.0 4 | 5 | 6 | net.md_5 7 | SmallPlugins 8 | 1.0-SNAPSHOT 9 | 10 | 11 | net.md_5 12 | StickyMob 13 | 1.0-SNAPSHOT 14 | jar 15 | 16 | StickyMob 17 | Spawns a single mob and keeps him there, stickily. 18 | 19 | 20 | 21 | org.bukkit 22 | bukkit 23 | ${bukkit.version} 24 | compile 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /StickyMob/src/main/java/net/md_5/StickyMob.java: -------------------------------------------------------------------------------- 1 | package net.md_5; 2 | 3 | import org.bukkit.Location; 4 | import org.bukkit.World; 5 | import org.bukkit.configuration.ConfigurationSection; 6 | import org.bukkit.entity.Entity; 7 | import org.bukkit.entity.EntityType; 8 | import org.bukkit.plugin.java.JavaPlugin; 9 | 10 | public class StickyMob extends JavaPlugin implements Runnable 11 | { 12 | 13 | @Override 14 | public void onEnable() 15 | { 16 | getConfig().addDefault( "mobs.wither-gate.world", "world" ); 17 | getConfig().addDefault( "mobs.wither-gate.mob", "WITHER" ); 18 | getConfig().addDefault( "mobs.wither-gate.x", 0 ); 19 | getConfig().addDefault( "mobs.wither-gate.y", 64 ); 20 | getConfig().addDefault( "mobs.wither-gate.z", 0 ); 21 | getConfig().addDefault( "mobs.wither-gate.yaw", 0 ); 22 | getConfig().addDefault( "mobs.wither-gate.pitch", 0 ); 23 | getConfig().addDefault( "interval", 30 ); 24 | 25 | getConfig().options().copyDefaults( true ); 26 | saveConfig(); 27 | 28 | int interval = getConfig().getInt( "interval" ) * 20; 29 | getServer().getScheduler().scheduleSyncRepeatingTask( this, this, interval, interval ); 30 | } 31 | 32 | @Override 33 | public void run() 34 | { 35 | ConfigurationSection mobs = getConfig().getConfigurationSection( "mobs" ); 36 | outer: 37 | for ( String sectionName : mobs.getKeys( false ) ) 38 | { 39 | ConfigurationSection mobSection = mobs.getConfigurationSection( sectionName ); 40 | 41 | String entityName = mobSection.getString( "mob" ); 42 | EntityType entityType = EntityType.fromName( entityName ); 43 | if ( entityType == null ) 44 | { 45 | getLogger().warning( "Tried to spawn mob entry " + sectionName + " of type " + entityName + " but type does not exist" ); 46 | continue; 47 | } 48 | 49 | World world = getServer().getWorld( mobSection.getString( "world" ) ); 50 | if ( world == null ) 51 | { 52 | getLogger().warning( "Tried to spawn mob entry " + sectionName + " in world " + world + " which is not loaded" ); 53 | continue; 54 | } 55 | 56 | String uuid = mobSection.getString( "uuid" ); 57 | if ( uuid != null ) 58 | { 59 | for ( Entity e : world.getEntitiesByClass( entityType.getEntityClass() ) ) 60 | { 61 | if ( e.getUniqueId().toString().equals( uuid ) ) 62 | { 63 | continue outer; 64 | } 65 | } 66 | } 67 | 68 | Location loc = new Location( world, mobSection.getDouble( "x" ), mobSection.getDouble( "y" ), mobSection.getDouble( "z" ), 69 | (float) mobSection.getDouble( "yaw" ), (float) mobSection.getDouble( "pitch" ) ); 70 | 71 | Entity spawned = world.spawnEntity( loc, entityType ); 72 | String spawnedId = spawned.getUniqueId().toString(); 73 | mobSection.set( "uuid", spawnedId ); 74 | saveConfig(); 75 | 76 | getLogger().info( "Successfully spawned a " + entityType + " with UUID " + spawnedId + " at " + loc ); 77 | } 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /StickyMob/src/main/resources/plugin.yml: -------------------------------------------------------------------------------- 1 | name: ${project.name} 2 | version: ${project.version} 3 | description: ${project.description} 4 | main: net.md_5.StickyMob 5 | -------------------------------------------------------------------------------- /TestPlugin/HoloAPI.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/md-5/SmallPlugins/e4611c9b303a2d6a72c037d05f9b7014cfa8f288/TestPlugin/HoloAPI.jar -------------------------------------------------------------------------------- /TestPlugin/README.md: -------------------------------------------------------------------------------- 1 | TestPlugin 2 | ========== 3 | 4 | Test stuff. 5 | -------------------------------------------------------------------------------- /TestPlugin/nb-configuration.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | 10 | 16 | project 17 | NEW_LINE 18 | NEW_LINE 19 | NEW_LINE 20 | true 21 | true 22 | true 23 | true 24 | true 25 | true 26 | true 27 | true 28 | true 29 | true 30 | 31 | 32 | -------------------------------------------------------------------------------- /TestPlugin/pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4.0.0 4 | 5 | 6 | net.md_5 7 | SmallPlugins 8 | 1.0-SNAPSHOT 9 | 10 | 11 | net.md_5 12 | TestPlugin 13 | 1.0-SNAPSHOT 14 | jar 15 | 16 | TestPlugin 17 | Test stuff. 18 | 19 | 20 | 21 | com.dsh105 22 | HoloAPI 23 | 1.2.3 24 | system 25 | ${project.basedir}/HoloAPI.jar 26 | 27 | 28 | org.bukkit 29 | bukkit 30 | ${bukkit.version} 31 | compile 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /TestPlugin/src/main/java/net/md_5/TestPlugin.java: -------------------------------------------------------------------------------- 1 | package net.md_5; 2 | 3 | import com.dsh105.holoapi.api.Hologram; 4 | import com.dsh105.holoapi.api.HologramFactory; 5 | import com.google.common.collect.Iterables; 6 | import java.util.List; 7 | import org.bukkit.ChatColor; 8 | import org.bukkit.Location; 9 | import org.bukkit.command.Command; 10 | import org.bukkit.command.CommandSender; 11 | import org.bukkit.entity.Player; 12 | import org.bukkit.event.EventHandler; 13 | import org.bukkit.event.Listener; 14 | import org.bukkit.event.player.PlayerMoveEvent; 15 | import org.bukkit.metadata.FixedMetadataValue; 16 | import org.bukkit.metadata.MetadataValue; 17 | import org.bukkit.plugin.java.JavaPlugin; 18 | import org.bukkit.util.Vector; 19 | 20 | public class TestPlugin extends JavaPlugin implements Listener 21 | { 22 | 23 | private static final String META_KEY = "asgyuhkdf"; 24 | 25 | @Override 26 | public void onEnable() 27 | { 28 | getServer().getPluginManager().registerEvents( this, this ); 29 | } 30 | 31 | @Override 32 | public boolean onCommand(CommandSender sender, Command command, String label, String[] args) 33 | { 34 | Player player = (Player) sender; 35 | 36 | Hologram holo = new HologramFactory( this ).withText( ChatColor.RED + "This is a really nice test. asuilhdasd." ).withLocation( locate( player ) ).build(); 37 | holo.show( player ); 38 | 39 | player.setMetadata( META_KEY, new FixedMetadataValue( this, holo ) ); 40 | 41 | return true; 42 | } 43 | 44 | private Location locate(Player player) 45 | { 46 | Location inFront = player.getLocation(); 47 | inFront.add( 0, player.getEyeHeight(), 0 ); 48 | inFront.add( posMinecraft( 5, inFront.getYaw(), inFront.getPitch() ) ); 49 | 50 | return inFront; 51 | } 52 | 53 | @EventHandler 54 | public void move(PlayerMoveEvent event) 55 | { 56 | update( event.getPlayer() ); 57 | } 58 | 59 | private void update(Player player) 60 | { 61 | List meta = player.getMetadata( META_KEY ); 62 | if ( meta == null || meta.isEmpty() ) 63 | { 64 | return; 65 | } 66 | 67 | Hologram holo = (Hologram) Iterables.getOnlyElement( meta ).value(); 68 | Location inFront = locate( player ); 69 | player.sendMessage( inFront.toString() ); 70 | holo.move( inFront ); 71 | } 72 | 73 | /** 74 | * This function converts the Minecraft yaw and pitch to proper Euler 75 | * angles, passes it into {@link #pos(double, double, double)} and then 76 | * transforms the result back into Minecraft geometry. 77 | * 78 | * @param radius 79 | * @param yaw 80 | * @param pitch 81 | * @return 82 | */ 83 | public static Vector posMinecraft(double radius, double yaw, double pitch) 84 | { 85 | Vector eulerPos = pos( radius, -yaw, pitch + 90 ); 86 | 87 | return new Vector( eulerPos.getY(), eulerPos.getZ(), eulerPos.getX() ); 88 | } 89 | 90 | /** 91 | * This is the mathematically correct method to return a 3d vector which is 92 | * radius out from the origin, rotated by yaw and inclined by pitch. 93 | * 94 | * A yaw of 0 would be (x, 0, z) whilst a pitch of 0 would be (0, 0, r). 95 | * 96 | * @param radius the radius out from the origin. 97 | * @param yaw the yaw from the Y axis 98 | * @param pitch the pitch from the Z axis where 0 is vertical. 99 | * @return the transformed vector 100 | */ 101 | public static Vector pos(double radius, double yaw, double pitch) 102 | { 103 | double sRadians = Math.toRadians( yaw ); 104 | double tRadians = Math.toRadians( pitch ); 105 | 106 | double x = radius * Math.cos( sRadians ) * Math.sin( tRadians ); 107 | double y = radius * Math.sin( sRadians ) * Math.sin( tRadians ); 108 | double z = radius * Math.cos( tRadians ); 109 | 110 | return new Vector( x, y, z ); 111 | } 112 | } 113 | -------------------------------------------------------------------------------- /TestPlugin/src/main/resources/plugin.yml: -------------------------------------------------------------------------------- 1 | name: ${project.name} 2 | version: ${project.version} 3 | description: ${project.description} 4 | main: net.md_5.TestPlugin 5 | 6 | 7 | commands: 8 | test: 9 | -------------------------------------------------------------------------------- /VoidTP/nb-configuration.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | 10 | 16 | project 17 | 4 18 | 8 19 | 4 20 | true 21 | 80 22 | none 23 | 4 24 | 4 25 | 4 26 | false 27 | 80 28 | none 29 | 30 | 31 | -------------------------------------------------------------------------------- /VoidTP/pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4.0.0 4 | 5 | 6 | net.md_5 7 | SmallPlugins 8 | 1.0-SNAPSHOT 9 | 10 | 11 | net.md_5 12 | VoidTP 13 | 1.0-SNAPSHOT 14 | jar 15 | 16 | VoidTP 17 | Executes a command such as /home or /spawn when a player gets damaged by the void. 18 | 19 | 20 | 21 | org.bukkit 22 | bukkit 23 | ${bukkit.version} 24 | compile 25 | 26 | 27 | org.spigotmc 28 | spigot 29 | 1.7.9-R0.2-SNAPSHOT 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /VoidTP/src/main/java/net/md_5/VoidTP.java: -------------------------------------------------------------------------------- 1 | package net.md_5; 2 | 3 | import org.bukkit.entity.Player; 4 | import org.bukkit.event.EventHandler; 5 | import org.bukkit.event.Listener; 6 | import org.bukkit.event.entity.EntityDamageEvent; 7 | import org.bukkit.plugin.java.JavaPlugin; 8 | 9 | public class VoidTP extends JavaPlugin implements Listener { 10 | 11 | @Override 12 | public void onEnable() { 13 | getConfig().addDefault("command", "home"); 14 | getConfig().options().copyDefaults(true); 15 | saveConfig(); 16 | 17 | getServer().getPluginManager().registerEvents(this, this); 18 | } 19 | 20 | @EventHandler(ignoreCancelled = true) 21 | public void damage(EntityDamageEvent event) { 22 | if (event.getEntity() instanceof Player && event.getCause() == EntityDamageEvent.DamageCause.VOID) { 23 | getServer().dispatchCommand(((Player) event.getEntity()), getConfig().getString("command")); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /VoidTP/src/main/resources/plugin.yml: -------------------------------------------------------------------------------- 1 | name: ${project.name} 2 | version: ${project.version} 3 | description: ${project.description} 4 | main: net.md_5.VoidTP 5 | -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | 7 | org.sonatype.oss 8 | oss-parent 9 | 7 10 | 11 | 12 | net.md_5 13 | SmallPlugins 14 | 1.0-SNAPSHOT 15 | pom 16 | 17 | SmallPlugins 18 | Parent project for all small plugins 19 | https://github.com/md-5/SmallPlugins/ 20 | 21 | 22 | 23 | md_5-public 24 | http://repo.md-5.net/content/groups/public/ 25 | 26 | 27 | 28 | 29 | DeathStuff 30 | DropPart 31 | EmeraldSword 32 | PrefixTags 33 | StickyMob 34 | VoidTP 35 | 36 | 37 | 38 | UTF-8 39 | 1.7.9-R0.2 40 | 1.7-SNAPSHOT 41 | 42 | 43 | 44 | ${project.name} 45 | 46 | 47 | true 48 | ${project.basedir}/src/main/resources 49 | 50 | 51 | 52 | 53 | org.apache.maven.plugins 54 | maven-compiler-plugin 55 | 2.5.1 56 | 57 | 1.6 58 | 1.6 59 | 60 | 61 | 62 | 63 | 64 | --------------------------------------------------------------------------------