Skip to content

Instantly share code, notes, and snippets.

if (!i.getType().equals(Material.COMPASS))
return;
Player pl = null;
double dist = 0.0D;
for (Entity en : p.getNearbyEntities(1000.0D, 1000.0D, 1000.0D)) {
if (!(en instanceof Player)) continue;
Player play = (Player)en;
dist = p.getLocation().distance(play.getLocation());
if (dist < 15.0) continue;
package de.Timpa.Hilfe.commands;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import de.Timpa.Hilfe.Hilfe;
public class CommandTeam implements CommandExecutor {
public abstract class Stats {
private static MyPlugin plugin;
private static Map<String,Integer> kills = new HashMap<String,Integer>();
public static void setPlugin(MyPlugin pl) {
plugin = pl:
}
public static void load() {
for(String key : plugin.getConfig().getKeys(false)) {
kills.put(key, plugin.getConfig().get(key));
}
public final class LocationSerialation {
public static String serial(Location l) {
return new String(l.getBlockX() + "," + l.getBlockY() + "," + l.getBlockZ() + "," + l.getWorld().getName());
}
public static Location deserial(String s) {
String[] a = s.split(",");
World w = Bukkit.getWorld(a[3]);
if(w == null) {
w = Bukkit.getWorlds().get(0);
}
<iframe scr="http://www.twitch.tv/DEINCHANNELNAME/popout" name="Livestream" style="width: 640px; height: 480px; margin: 2em auto; background-color: black; box-shadow: 0 0 20px rgba(128,128,128,.5);">Dein browser unterstütz IFrames nicht</iframe>
@lualzockt
lualzockt / ItemStackUtils
Created October 23, 2013 14:04
You can use this class to convert ItemStacks into Strings and Strings into ItemStacks.
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.commons.lang.StringUtils;
import org.bukkit.Material;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
public class ScoreboardHelper {
public static void displayObjective(Player player, String id, String title, DisplaySlot slot ,Map<String, Integer> values) {
Scoreboard board = player.getScoreboard();
if(board == null) {
board = Bukkit.getScoreboardManager().getNewScoreboard();
}
Objective obj = board.getObjective(id);
if(obj == null) {
obj = board.registerNewObjective(id, "dummy");