Skip to content

Instantly share code, notes, and snippets.

View EricZeiberg's full-sized avatar

Eric Zeiberg EricZeiberg

  • Boston, MA
View GitHub Profile
{
"text": "Want to get a diamond?",
"extra": [
{
"text": "Click here!",
"clickEvent": {
"action": "run_command",
if (hasGroup (e.getPlayer().getWorld().toString(), CalculableType.USER, e.getPlayer().getName(), "admin")) {
e.setFormat("\u2756" + e.getMessage());
}
else {
Bukkit.broadcastMessage("HI");
}
if (hasGroup (e.getPlayer().getWorld().toString(), CalculableType.USER, e.getPlayer().getName(), "moderator")) {
e.setFormat("Hi:" + e.getMessage());
}
String[] a = getGroups(e.getPlayer().getWorld().toString(), CalculableType.USER, e.getPlayer().getName());
@Override
public void onEnd() {
Bukkit.broadcastMessage(ChatColor.DARK_PURPLE + "############");
Bukkit.broadcastMessage(ChatColor.GREEN + "The match has started!");
Bukkit.broadcastMessage(ChatColor.DARK_PURPLE + "############");
TeamModule teamModule = (TeamModule) MatchHandler.getCurrentMatch().getModule("TeamModule");
List<MapTeam> teams = teamModule.getAllTeams();
for (MapTeam t : teams){
for (Player p : t.getPlayers()){
Location loc = SpawnUtils.handleSpawn(p);
@Override
public void onPacketReceive(PacketReceiveEvent event) {
Packet packet = event.getPacket();
packet.accept(visitor);
if (packet.getId() == 3){
PacketChat pc = (PacketChat) event.getPacket();
if (pc.getMessage().equalsIgnoreCase("test message")){
say("Recived");
System.out.print("TESTTTYTT");
}
@EricZeiberg
EricZeiberg / MatchHandler.java
Created January 13, 2014 21:02
Spawn Algorithm
Location location = p.getLocation();
for(int i = 0 ; i < 20 ; i++) {
int max = 10;
double x = Math.random() * (max * 2) - max;
double y = 0;
double z = Math.random() * (max * 2) - max;
location.add(x,y,z);
p.teleport(location);
}
for(int i = 0 ; i < 20 ; i++) {
int radius = 30;
int max = 10;
double x = (Math.random() * (max * 2)) - max;
double y = 0;
double z = (Math.random() * (max * 2)) - max;
int x1 = (int) x;
int z1 = (int) z;
double center_x = -17;
int center_z = -13;
package me.masterejay.pizzaspleef.commands;
import com.sk89q.minecraft.util.commands.Command;
import com.sk89q.minecraft.util.commands.CommandContext;
import com.sk89q.minecraft.util.commands.CommandException;
import me.masterejay.pizzaspleef.PizzaSpleef;
import me.masterejay.pizzaspleef.utils.Cuboid;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Location;
@EventHandler
public void onRespawn(PlayerRespawnEvent e){
e.getPlayer().teleport(new Location(PizzaSpleef.get().getServer().getWorld("Lobby"), -17, 72, -69, 2, 180));
}
@EricZeiberg
EricZeiberg / ConnectionListener.java
Created February 27, 2014 01:58
Does this not work?
ItemStack stick = new ItemStack(Material.STICK);
stick.getItemMeta().setDisplayName(ChatColor.AQUA + event.getPlayer().getDisplayName() + "'s wand");
event.getPlayer().getInventory().addItem(stick);
List<ItemStack> itemStackL = event.getDrops();
for (ItemStack i : itemStackL){
if (i != null){
for (ItemStack i2 : Scrimmage.getRotation().getSlot().getMap().getItemRemove()){
if (i2 != null){
if (i.isSimilar(i2)){
event.getDrops().remove(i);
}
}