id
stringlengths 36
36
| text
stringlengths 1
1.25M
|
---|---|
fb391ecd-ea3e-4712-9aff-86acfc21860b | public void addComponents(Component[] components) {
for (Component component : components) {
content.add(component);
}
} |
7bd64ab4-6cc7-41e1-b50d-931bc7053a84 | public TextField() {
this.defaultSettings();
} |
3c56bd9c-d866-405c-8f1e-b866bbf7136d | public TextField(String text) {
this.defaultSettings();
this.setText(text);
} |
f2fb2c29-ba1a-4d51-8aaa-08a29e940793 | public TextField(Color c) {
this.defaultSettings();
this.setForeground(c);
} |
27a1e239-fb61-43cf-904e-b3320b8bf13b | public TextField(Font f) {
this.defaultSettings();
this.setFont(f);
} |
c62cf105-7cd0-49e1-a7c7-0ec2b9202536 | public TextField(String text, Color c) {
this.defaultSettings();
this.setText(text);
this.setForeground(c);
} |
0af3ab41-402e-4575-a030-6a586baceeff | public TextField(String text, Font f) {
this.defaultSettings();
this.setText(text);
this.setFont(f);
} |
a7b55178-2e33-42dd-be24-3c6018829bed | public TextField(Color c, Font f) {
this.defaultSettings();
this.setForeground(c);
this.setFont(f);
} |
5194c04e-9733-4a66-b375-8fa605514570 | public TextField(String text, Color c, Font f) {
this.defaultSettings();
this.setText(text);
this.setForeground(c);
this.setFont(f);
} |
2befebb9-78f8-40b8-be84-256243d13af8 | public void defaultSettings() {
this.setOpaque(false);
this.setBackground(null);
} |
14e01514-41df-4844-982c-113764aaa99e | public Button() {
this.defaultSettings();
} |
b874771e-0c56-43ca-a52e-805efb712960 | public Button(String text) {
this.defaultSettings();
this.setText(text);
} |
70ed6b2f-a9fa-422e-b756-389887089c67 | public Button(Color c) {
this.defaultSettings();
this.setForeground(c);
} |
b247f8e4-f986-44f6-aa27-a3a41f45064a | public Button(Font f) {
this.defaultSettings();
this.setFont(f);
} |
9d9a0452-63ff-44c0-9cc3-dcdbcefd21b6 | public Button(String text, Color c) {
this.defaultSettings();
this.setText(text);
this.setForeground(c);
} |
d7c4bb6f-bd4b-4049-a9b2-5dc98c5eda89 | public Button(String text, Font f) {
this.defaultSettings();
this.setText(text);
this.setFont(f);
} |
24b5be66-b6d1-49b0-8fd3-cc210a04a8d6 | public Button(Color c, Font f) {
this.defaultSettings();
this.setForeground(c);
this.setFont(f);
} |
4070695d-3ca9-4658-b328-f6b770ad7239 | public Button(String text, Color c, Font f) {
this.defaultSettings();
this.setText(text);
this.setForeground(c);
this.setFont(f);
} |
17dc9065-b74c-4a31-90e0-ab41093d5af8 | public void defaultSettings() {
this.setOpaque(false);
this.setContentAreaFilled(false);
} |
26eb3751-a753-4b9a-b779-1034f19cfdfe | public void removeDecorations() {
this.setFocusPainted(false);
this.setFocusPainted(false);
this.setBorder(BorderFactory.createEmptyBorder());
} |
3cd1a3dc-aacb-4886-96e0-7ceda2f46a05 | public void center() {
this.setHorizontalTextPosition(JButton.CENTER);
this.setVerticalTextPosition(JButton.CENTER);
} |
087ac7bf-cb5c-48f0-b6d8-3b9ea8f7670f | public void setImage(String image) {
this.setIcon(new ImageIcon(this.getClass().getResource(image)));
} |
5c3d8af1-a32b-499a-a53d-df5553c1ee12 | public Label() {} |
3ae62bde-2ec1-45c8-9f26-1b299b140835 | public Label(String text) {
this.setText(text);
} |
bb97de5a-1a31-46da-be58-e4fbee53ef71 | public Label(Color c) {
this.setForeground(c);
} |
08265324-ca07-46db-a0d1-237564bee79b | public Label(Font f) {
this.setFont(f);
} |
af8e1f99-399a-4057-af0c-f8d1d99d6023 | public Label(String text, Color c) {
this.setText(text);
this.setForeground(c);
} |
7c2525e6-df5d-4a02-8cbe-914f7596f610 | public Label(String text, Font f) {
this.setText(text);
this.setFont(f);
} |
e1d3b28a-d435-4a30-995a-426c6cc98089 | public Label(Color c, Font f) {
this.setForeground(c);
this.setFont(f);
} |
02a3f11a-d190-47ab-b2d8-e5236fc9f63a | public Label(String text, Color c, Font f) {
this.setText(text);
this.setForeground(c);
this.setFont(f);
} |
a7917c79-9aeb-40da-baa2-c3227117b78c | public void addComponents(Component[] components) {
for (Component component : components) {
this.add(component);
}
} |
056de967-6d30-47d5-b3be-6541d45d703e | public PasswordField() {
this.defaultSettings();
} |
6422eaf0-dcba-4389-a7fc-0c52cf00c68a | public PasswordField(String text) {
this.defaultSettings();
this.setText(text);
} |
c7dae960-176d-4e2a-ac2e-b17772bcf5a0 | public PasswordField(Color c) {
this.defaultSettings();
this.setForeground(c);
} |
827c10a9-c067-4c9d-9ab4-25e6e08ce614 | public PasswordField(Font f) {
this.defaultSettings();
this.setFont(f);
} |
01907fc2-856d-455b-bf32-0e628ff3866d | public PasswordField(String text, Color c) {
this.defaultSettings();
this.setText(text);
this.setForeground(c);
} |
f8f0c482-39dc-46f9-9a75-f7273e65510f | public PasswordField(String text, Font f) {
this.defaultSettings();
this.setText(text);
this.setFont(f);
} |
2a242fb8-6e36-4ebf-9880-c0c307fc6575 | public PasswordField(Color c, Font f) {
this.defaultSettings();
this.setForeground(c);
this.setFont(f);
} |
521eacb2-b23a-4609-9c13-5422168e42ec | public PasswordField(String text, Color c, Font f) {
this.defaultSettings();
this.setText(text);
this.setForeground(c);
this.setFont(f);
} |
6daf3a1c-79ec-4465-9d39-85fc031f3685 | public void defaultSettings() {
this.setOpaque(false);
this.setBackground(null);
} |
f64680fd-c9bb-494e-a381-761ffcde574b | public ProgressBar() {} |
30079240-0b98-4186-a190-3a19824905e6 | public ProgressBar(Color color, String type) {
if (type.toUpperCase().equals("BACKGROUND")) {
this.setBackground(color);
} else if (type.toUpperCase().equals("FOREGROUND")) {
this.setForeground(color);
}
} |
0450cf80-767b-44ae-8630-798b407d915f | public ProgressBar(Color background, Color foreground) {
this.setBackground(background);
this.setForeground(foreground);
} |
81fcdfc2-4833-462d-b927-bef127ba811b | public void removeDecorations() {
this.setBorder(null);
this.setBorderPainted(false);
} |
713f5efa-1b9c-48f0-a566-bc23c6f65e24 | public static DisguiseAPI getAPI() {
return api;
} |
c535431a-8bcd-4d87-bb1d-c8f90241b92d | public void initialize(final JavaPlugin plugin) {
this.plugin = plugin;
// Registers new listener.
plugin.getServer().getPluginManager().registerEvents(new Listener() {
// Handles player respawn skin change glitch.
@EventHandler
public void onRespawn(PlayerRespawnEvent e) {
// Runs a scheduled task to refresh. (Won't work instantly.)
// *Edit: I meant the disguise won't re-apply if the task
// is not delayed.*
new BukkitRunnable() {
@Override
public void run() {
refresh();
}
}.runTaskLater(plugin, 1l);
}
@EventHandler
public void onMove(PlayerMoveEvent e) {
Player p = e.getPlayer();
if (getDisguise(p) == null)
return;
Disguise dis = getDisguise(p);
dis.move(e.getFrom(), e.getTo());
}
@EventHandler
public void onQuit(PlayerQuitEvent e) {
Player p = e.getPlayer();
for (Disguise d : disguises) {
new BukkitRunnable() {
@Override
public void run() {
d.revertDisguise(Arrays.asList(p));
}
}.runTaskLater(plugin, 1l);
}
if (getDisguise(p) == null)
return;
Disguise d = getDisguise(p);
d.revertDisguise(online());
disguises.remove(d);
}
@EventHandler
public void onJoin(PlayerJoinEvent e) {
Player p = e.getPlayer();
for (Disguise d : disguises) {
new BukkitRunnable() {
@Override
public void run() {
d.applyDisguise(Arrays.asList(p));
}
}.runTaskLater(plugin, 1l);
}
}
@EventHandler
public void onHoldItem(PlayerItemHeldEvent e) {
Player p = e.getPlayer();
if (getDisguise(p) == null)
return;
Disguise dis = getDisguise(p);
if (!(dis instanceof PlayerDisguise))
return;
PlayerDisguise pd = (PlayerDisguise) dis;
pd.setItemInHand(e.getNewSlot());
}
@EventHandler
public void onInteract(PlayerInteractEvent e) {
if (e.getAction() != Action.LEFT_CLICK_AIR
&& e.getAction() != Action.LEFT_CLICK_BLOCK)
return;
Player p = e.getPlayer();
if (getDisguise(p) == null)
return;
Disguise dis = getDisguise(p);
if (!(dis instanceof PlayerDisguise))
return;
PlayerDisguise pd = (PlayerDisguise) dis;
pd.swingArm();
}
@EventHandler
public void onSneak(PlayerToggleSneakEvent e) {
Player p = e.getPlayer();
if (getDisguise(p) == null)
return;
Disguise dis = getDisguise(p);
if (!(dis instanceof PlayerDisguise))
return;
PlayerDisguise pd = (PlayerDisguise) dis;
pd.sneak(e.isSneaking());
}
}, plugin);
} |
e6f0244d-d4b3-48b6-900b-195e3811a770 | @EventHandler
public void onRespawn(PlayerRespawnEvent e) {
// Runs a scheduled task to refresh. (Won't work instantly.)
// *Edit: I meant the disguise won't re-apply if the task
// is not delayed.*
new BukkitRunnable() {
@Override
public void run() {
refresh();
}
}.runTaskLater(plugin, 1l);
} |
6fc225c1-5b80-4b63-ae1f-42a45801f560 | @Override
public void run() {
refresh();
} |
06946d84-e8f4-4862-b3f7-58bcece27200 | @EventHandler
public void onMove(PlayerMoveEvent e) {
Player p = e.getPlayer();
if (getDisguise(p) == null)
return;
Disguise dis = getDisguise(p);
dis.move(e.getFrom(), e.getTo());
} |
372fb783-d5da-4652-8ad2-5605a842900b | @EventHandler
public void onQuit(PlayerQuitEvent e) {
Player p = e.getPlayer();
for (Disguise d : disguises) {
new BukkitRunnable() {
@Override
public void run() {
d.revertDisguise(Arrays.asList(p));
}
}.runTaskLater(plugin, 1l);
}
if (getDisguise(p) == null)
return;
Disguise d = getDisguise(p);
d.revertDisguise(online());
disguises.remove(d);
} |
7d099894-44f1-4cd2-9a86-32f15c1f6f11 | @Override
public void run() {
d.revertDisguise(Arrays.asList(p));
} |
418a5b89-bafd-410e-aebd-c00bad78805b | @EventHandler
public void onJoin(PlayerJoinEvent e) {
Player p = e.getPlayer();
for (Disguise d : disguises) {
new BukkitRunnable() {
@Override
public void run() {
d.applyDisguise(Arrays.asList(p));
}
}.runTaskLater(plugin, 1l);
}
} |
30163e19-44e3-4de0-aa74-6933b41296d6 | @Override
public void run() {
d.applyDisguise(Arrays.asList(p));
} |
30578db8-5cd3-4d86-8f1e-58ca73e88540 | @EventHandler
public void onHoldItem(PlayerItemHeldEvent e) {
Player p = e.getPlayer();
if (getDisguise(p) == null)
return;
Disguise dis = getDisguise(p);
if (!(dis instanceof PlayerDisguise))
return;
PlayerDisguise pd = (PlayerDisguise) dis;
pd.setItemInHand(e.getNewSlot());
} |
0d550e31-99c4-4ead-8570-c99857202eeb | @EventHandler
public void onInteract(PlayerInteractEvent e) {
if (e.getAction() != Action.LEFT_CLICK_AIR
&& e.getAction() != Action.LEFT_CLICK_BLOCK)
return;
Player p = e.getPlayer();
if (getDisguise(p) == null)
return;
Disguise dis = getDisguise(p);
if (!(dis instanceof PlayerDisguise))
return;
PlayerDisguise pd = (PlayerDisguise) dis;
pd.swingArm();
} |
c31b714e-2753-4a02-902f-bf2496f83446 | @EventHandler
public void onSneak(PlayerToggleSneakEvent e) {
Player p = e.getPlayer();
if (getDisguise(p) == null)
return;
Disguise dis = getDisguise(p);
if (!(dis instanceof PlayerDisguise))
return;
PlayerDisguise pd = (PlayerDisguise) dis;
pd.sneak(e.isSneaking());
} |
ef71cef6-91fd-4dcc-9975-f943ee4c37b3 | public List<String> getDisguised() {
List<String> s = new ArrayList<String>();
for (Disguise d : disguises) {
s.add(d.getPlayer().getName());
}
return s;
} |
804a7c2c-9a2a-4869-b4c1-e7efc2acfb3a | public boolean isDisguised(Player p) {
for (Disguise d : disguises) {
if (d.getPlayer().equals(p))
return true;
}
return false;
} |
7917b589-0452-470f-a253-80e4169caf82 | public Disguise getDisguise(Player p) {
for (Disguise d : disguises) {
if (d.getPlayer().equals(p))
return d;
}
return null;
} |
9665cd4d-c432-4f70-92e0-35b33a243155 | public void unDisguisePlayer(Player p) {
if (!isDisguised(p))
return;
getDisguise(p).revertDisguise(online());
disguises.remove(getDisguise(p));
} |
0449757d-699f-495a-ba93-70860d071fd7 | public Collection<Player> online() {
return new ArrayList<Player>(Bukkit.getOnlinePlayers());
} |
7f8cdab7-c0df-403c-9c54-424c4502b358 | public void disguisePlayer(Player p, Disguise d,
Collection<Player> players) {
if (isDisguised(p))
return;
d.applyDisguise(players);
disguises.add(d);
} |
c1efee02-42e3-4336-8bc5-625cdf527245 | public void disguisePlayer(Player p, Disguise d) {
disguisePlayer(p, d, online());
} |
11f4c754-6ca9-45bf-b523-c03936258c71 | public void refresh() {
// Refreshing every single player.
for (Disguise d : disguises) {
refresh(d.getPlayer());
}
} |
101e8cdd-bc31-4443-b022-610322434b65 | private void refresh(Player p) {
Disguise d = getDisguise(p);
new BukkitRunnable() {
@Override
public void run() {
d.revertDisguise(online());
d.applyDisguise(online());
}
}.runTaskLater(plugin, 1l);
} |
5f89d0ef-1b65-4dd6-877a-16f07fea1999 | @Override
public void run() {
d.revertDisguise(online());
d.applyDisguise(online());
} |
5265f3eb-6532-4461-90b5-d1d139c1a5fe | public UUIDRetriever(String name) {
this.name = ChatColor
.stripColor(ChatColor.translateAlternateColorCodes('&', name));
retrieve();
} |
b03d15a8-a027-4d72-95c9-21a293e5a012 | public UUID getUUID() {
return uuid;
} |
8c5ef3aa-a062-4d0d-b941-3a87a8e0636c | public static void setSkin(GameProfile gp) {
if (getMap().containsKey(gp.getId())) {
PropertyMap map = gp.getProperties();
map.put("textures", getMap().get(gp.getId()));
return;
}
try {
URL url = new URL(
"https://sessionserver.mojang.com/session/minecraft/profile/"
+ gp.getId().toString().replaceAll("-", "")
+ "?unsigned=false");
BufferedReader reader = new BufferedReader(
new InputStreamReader(url.openStream()));
JSONParser parser = new JSONParser();
JSONObject root = (JSONObject) parser.parse(reader);
JSONArray properties = (JSONArray) root.get("properties");
String data = (String) ((JSONObject) properties.get(0))
.get("value");
String signature = (String) ((JSONObject) properties.get(0))
.get("signature");
reader.close();
PropertyMap map = gp.getProperties();
Property property = new Property("textures", data, signature);
map.put("textures", property);
getMap().put(gp.getId(), property);
} catch (Exception e) {
e.printStackTrace();
}
} |
eed2ac0a-1be5-48c1-a9ca-6b2b1a0009fc | private void retrieve() {
try {
URL url = new URL(WEB_PAGE + name);
BufferedReader reader = new BufferedReader(
new InputStreamReader(url.openStream()));
JSONParser parser = new JSONParser();
JSONObject object = (JSONObject) parser.parse(reader);
String uid = (String) object.get("uuid_formatted");
this.uuid = UUID.fromString(uid);
reader.close();
} catch (Exception e) {
e.printStackTrace();
}
} |
79547ffd-dbd7-4d54-8b83-93c2b32c7ba3 | public static Map<UUID, Property> getMap() {
return map;
} |
5097c2c4-ccc1-4dcf-a154-917f6fea5bac | public PlayerDisguise(Player player, String name) {
super(player, EntityType.PLAYER);
this.name = ChatColor.translateAlternateColorCodes('&', name);
} |
4de2ef4f-6d96-4299-b626-3e3f69af8ec2 | @Override
public void applyDisguise(Collection<Player> players) {
UUID uid = new UUIDRetriever(name).getUUID();
GameProfile gp = new GameProfile(uid == null ? UUID.randomUUID() : uid,
name);
UUIDRetriever.setSkin(gp);
EntityPlayer playerEntity = ((CraftPlayer) getPlayer()).getHandle();
EntityPlayer ep = this.ep == null
? this.ep = new EntityPlayer(playerEntity.server,
(WorldServer) playerEntity.world, gp,
new PlayerInteractManager(playerEntity.world))
: this.ep;
ep.inventory = playerEntity.inventory;
ep.locX = playerEntity.locX;
ep.locY = playerEntity.locY;
ep.locZ = playerEntity.locZ;
ep.yaw = playerEntity.yaw;
ep.pitch = playerEntity.pitch;
PacketPlayOutEntityDestroy destroy = new PacketPlayOutEntityDestroy(
playerEntity.getId());
PacketPlayOutPlayerInfo infoRemove = new PacketPlayOutPlayerInfo(
EnumPlayerInfoAction.REMOVE_PLAYER, playerEntity);
PacketPlayOutPlayerInfo infoAdd = new PacketPlayOutPlayerInfo(
EnumPlayerInfoAction.ADD_PLAYER, ep);
PacketPlayOutNamedEntitySpawn spawn = new PacketPlayOutNamedEntitySpawn(
ep);
for (Player p : players) {
if (p == getPlayer())
continue;
EntityPlayer aep = ((CraftPlayer) p).getHandle();
PlayerConnection pc = aep.playerConnection;
pc.sendPacket(destroy);
pc.sendPacket(infoRemove);
pc.sendPacket(infoAdd);
pc.sendPacket(spawn);
}
} |
4ea967d3-a5cc-4256-9b4a-33fb5560ec23 | @Override
public void revertDisguise(Collection<Player> players) {
EntityPlayer playerEntity = ((CraftPlayer) getPlayer()).getHandle();
PacketPlayOutEntityDestroy destroy = new PacketPlayOutEntityDestroy(
ep.getId());
PacketPlayOutPlayerInfo infoRemove = new PacketPlayOutPlayerInfo(
EnumPlayerInfoAction.REMOVE_PLAYER, ep);
PacketPlayOutPlayerInfo infoAdd = new PacketPlayOutPlayerInfo(
EnumPlayerInfoAction.ADD_PLAYER, playerEntity);
PacketPlayOutNamedEntitySpawn spawn = new PacketPlayOutNamedEntitySpawn(
playerEntity);
for (Player p : players) {
if (p == getPlayer())
continue;
EntityPlayer aep = ((CraftPlayer) p).getHandle();
PlayerConnection pc = aep.playerConnection;
pc.sendPacket(destroy);
pc.sendPacket(infoRemove);
pc.sendPacket(infoAdd);
pc.sendPacket(spawn);
}
} |
429656d9-923e-41a2-8fc5-ad72aecc323a | public void sneak(boolean sneak) {
this.ep.setSneaking(sneak);
PacketPlayOutEntityMetadata meta = new PacketPlayOutEntityMetadata(
this.ep.getId(), this.ep.getDataWatcher(), true);
for (Player p : Bukkit.getOnlinePlayers()) {
if (p == getPlayer())
continue;
EntityPlayer aep = ((CraftPlayer) p).getHandle();
aep.playerConnection.sendPacket(meta);
}
} |
18c9b3ee-c8e0-41c4-910c-d8cf54f78d8e | public void swingArm() {
PacketPlayOutAnimation animation = new PacketPlayOutAnimation(this.ep,
0);
for (Player p : Bukkit.getOnlinePlayers()) {
if (p == getPlayer())
continue;
EntityPlayer aep = ((CraftPlayer) p).getHandle();
aep.playerConnection.sendPacket(animation);
}
} |
677d6c11-d7ad-49b0-82b0-bd3a5d1e8c81 | public void setItemInHand(int slot) {
PacketPlayOutHeldItemSlot held = new PacketPlayOutHeldItemSlot(slot);
for (Player p : Bukkit.getOnlinePlayers()) {
if (p == getPlayer())
continue;
EntityPlayer aep = ((CraftPlayer) p).getHandle();
aep.playerConnection.sendPacket(held);
}
} |
b9365aec-0c33-47c0-9611-64f8a1ab300b | @Override
public void move(Location old, Location newloc) {
PacketPlayOutRelEntityMoveLook moveLook = new PacketPlayOutRelEntityMoveLook(
this.ep.getId(),
(byte) ((newloc.getBlockX() - old.getBlockX()) * 32),
(byte) ((newloc.getBlockY() - old.getBlockY()) * 32),
(byte) ((newloc.getBlockZ() - old.getBlockZ()) * 32), (byte) 0,
(byte) 0, ep.getBukkitEntity().isOnGround());
PacketPlayOutEntityLook look = new PacketPlayOutEntityLook(
this.ep.getId(), (byte) (newloc.getYaw() * 256 / 360),
(byte) (newloc.getPitch() * 256 / 360),
ep.getBukkitEntity().isOnGround());
PacketPlayOutEntityHeadRotation rotation = new PacketPlayOutEntityHeadRotation(
ep, (byte) (newloc.getYaw() * 256 / 360));
ep.yaw = newloc.getYaw();
ep.pitch = newloc.getPitch();
for (Player p : Bukkit.getOnlinePlayers()) {
if (p == getPlayer())
continue;
EntityPlayer aep = ((CraftPlayer) p).getHandle();
aep.playerConnection.sendPacket(moveLook);
aep.playerConnection.sendPacket(look);
aep.playerConnection.sendPacket(rotation);
}
} |
647d4709-97b1-4c1b-bb19-82292b02bdf8 | public String getName() {
return name;
} |
14fed042-2814-414c-8e04-c0f4578d4f7c | protected Disguise(Player player, EntityType type) {
this.player = player;
this.type = type;
} |
c88d3003-dfbe-4c4a-98b2-be64339ad18e | public abstract void applyDisguise(Collection<Player> players); |
0429bf8e-537e-4c1c-9fc9-e8599acabef2 | public abstract void revertDisguise(Collection<Player> players); |
33034310-607e-4fd2-a182-028fedff13d3 | public abstract void move(Location old, Location newloc); |
785e801a-d426-4bdf-8046-bc754866ebf9 | public final Player getPlayer() {
return player;
} |
87ac3e87-5a20-4f98-ad45-1ef7b3f8862b | public final EntityType getType() {
return type;
} |
c397ae4e-96e1-48a0-9c29-e3bbd30d5384 | public EntityDisguise(Player p, EntityType type) {
super(p, type);
} |
438d33e3-d7c6-4601-a2cd-c178b6e2f510 | @SuppressWarnings("deprecation")
public String getName() {
String name = "Pig";
switch (living.getBukkitEntity().getType()) {
case CAVE_SPIDER:
name = "Cave Spider";
break;
case HORSE:
name = "Horse";
break;
case IRON_GOLEM:
name = "Iron Golem";
break;
case MAGMA_CUBE:
name = "Magma Cube";
break;
case MINECART:
name = "Minecart";
break;
case MINECART_CHEST:
name = "Minecart w/ Chest";
break;
case MINECART_COMMAND:
name = "Minecart w/ Command Block";
break;
case MINECART_FURNACE:
name = "Minecart w/ Furnace";
break;
case MINECART_HOPPER:
name = "Minecart w/ Hopper";
break;
case MINECART_MOB_SPAWNER:
name = "Minecart w/ Spawner";
break;
case MINECART_TNT:
name = "Minecart w/ TNT";
break;
case MUSHROOM_COW:
name = "Mooshroom";
break;
case OCELOT:
name = "Ocelot";
break;
case PAINTING:
name = "Painting";
break;
case PIG_ZOMBIE:
name = "Zombie Pigman";
break;
case SKELETON:
Skeleton skeleton = (Skeleton) living.getBukkitEntity();
name = skeleton.getSkeletonType() == SkeletonType.NORMAL
? "Skeleton" : "Wither Skeleton";
break;
case SNOWMAN:
name = "Snow Golem";
break;
case WITHER:
name = "Wither Boss";
break;
default:
name = living.getBukkitEntity().getType().getName();
break;
}
return name;
} |
29c830af-a57e-4474-8765-4b2ecdaaa3fb | @Override
public void applyDisguise(Collection<Player> players) {
EntityPlayer ep = ((CraftPlayer) getPlayer()).getHandle();
EntityLiving ent = convert(getType());
ent.setLocation(ep.locX, ep.locY, ep.locZ, ep.yaw, ep.pitch);
PacketPlayOutEntityDestroy destroy = new PacketPlayOutEntityDestroy(
ep.getId());
PacketPlayOutPlayerInfo infoRemove = new PacketPlayOutPlayerInfo(
EnumPlayerInfoAction.REMOVE_PLAYER, ep);
PacketPlayOutSpawnEntityLiving spawn = new PacketPlayOutSpawnEntityLiving(
ent);
for (Player p : players) {
if (p == getPlayer())
continue;
EntityPlayer aep = ((CraftPlayer) p).getHandle();
PlayerConnection pc = aep.playerConnection;
pc.sendPacket(destroy);
pc.sendPacket(infoRemove);
pc.sendPacket(spawn);
}
this.living = ent;
} |
23484e45-4226-4745-bd38-02869dee5c5b | @Override
public void revertDisguise(Collection<Player> players) {
PacketPlayOutEntityDestroy destroy = new PacketPlayOutEntityDestroy(
living.getId());
EntityPlayer ep = ((CraftPlayer) getPlayer()).getHandle();
PacketPlayOutPlayerInfo infoAdd = new PacketPlayOutPlayerInfo(
EnumPlayerInfoAction.ADD_PLAYER, ep);
PacketPlayOutNamedEntitySpawn spawn = new PacketPlayOutNamedEntitySpawn(
ep);
for (Player p : players) {
if (p == getPlayer())
continue;
EntityPlayer aep = ((CraftPlayer) p).getHandle();
PlayerConnection pc = aep.playerConnection;
pc.sendPacket(destroy);
pc.sendPacket(infoAdd);
pc.sendPacket(spawn);
}
} |
a4624efa-29f2-4ad1-b174-54f08b1ccb05 | @SuppressWarnings("deprecation")
@Override
public void move(Location old, Location newloc) {
PacketPlayOutRelEntityMoveLook moveLook = new PacketPlayOutRelEntityMoveLook(
this.living.getId(),
(byte) ((newloc.getBlockX() - old.getBlockX()) * 32),
(byte) ((newloc.getBlockY() - old.getBlockY()) * 32),
(byte) ((newloc.getBlockZ() - old.getBlockZ()) * 32),
(byte) newloc.getYaw(), (byte) newloc.getPitch(),
getPlayer().isOnGround());
PacketPlayOutEntityHeadRotation rotation = new PacketPlayOutEntityHeadRotation(
living, (byte) (newloc.getYaw() * 256 / 360));
for (Player p : Bukkit.getOnlinePlayers()) {
if (p == getPlayer())
continue;
EntityPlayer aep = ((CraftPlayer) p).getHandle();
aep.playerConnection.sendPacket(moveLook);
aep.playerConnection.sendPacket(rotation);
}
} |
027e7da8-3dfe-450f-9b3c-aa84dd4efef9 | private EntityLiving convert(EntityType type) {
EntityLiving living = null;
EntityPlayer ep = ((CraftPlayer) getPlayer()).getHandle();
World world = ep.getWorld();
switch (type) {
case BAT:
EntityBat bat = new EntityBat(world);
living = bat;
break;
case BLAZE:
living = new EntityBlaze(world);
break;
case CAVE_SPIDER:
living = new EntityCaveSpider(world);
break;
case CHICKEN:
living = new EntityChicken(world);
break;
case COW:
living = new EntityCow(world);
break;
case CREEPER:
living = new EntityCreeper(world);
break;
case ENDERMAN:
living = new EntityEnderman(world);
break;
case ENDERMITE:
living = new EntityEndermite(world);
break;
// case ENDER_CRYSTAL:
// living = new EntityEnderCrystal(world);
// break;
case ENDER_DRAGON:
living = new EntityEnderDragon(world);
break;
case GHAST:
living = new EntityGhast(world);
break;
case GIANT:
living = new EntityGiantZombie(world);
break;
case GUARDIAN:
living = new EntityGuardian(world);
break;
case HORSE:
living = new EntityHorse(world);
break;
case IRON_GOLEM:
living = new EntityIronGolem(world);
break;
case MAGMA_CUBE:
living = new EntityMagmaCube(world);
break;
// case MINECART:
// living = new EntityMinecartRideable(world);
// break;
case MUSHROOM_COW:
living = new EntityMushroomCow(world);
break;
case OCELOT:
living = new EntityOcelot(world);
break;
case PIG:
living = new EntityPig(world);
break;
case PIG_ZOMBIE:
living = new EntityPigZombie(world);
break;
case RABBIT:
living = new EntityRabbit(world);
break;
case SHEEP:
living = new EntitySheep(world);
break;
case SILVERFISH:
living = new EntitySilverfish(world);
break;
case SKELETON:
living = new EntitySkeleton(world);
break;
case SLIME:
living = new EntitySlime(world);
break;
case SNOWMAN:
living = new EntitySnowman(world);
break;
case SPIDER:
living = new EntitySpider(world);
break;
case SQUID:
living = new EntitySquid(world);
break;
case VILLAGER:
living = new EntityVillager(world);
break;
case WITCH:
living = new EntityWitch(world);
break;
case WITHER:
living = new EntityWither(world);
break;
case WOLF:
living = new EntityWolf(world);
break;
case ZOMBIE:
living = new EntityZombie(world);
break;
default:
living = new EntityPig(world);
break;
}
return living;
} |
aefb88c4-e106-468b-b917-0e0297ac55ea | public EntityLiving getEntity() {
return living;
} |
93319bc5-f25d-4b06-b4df-4f9626735417 | @Override
public void onEnable() {
// Doing all the hard work for me.
DisguiseAPI.getAPI().initialize(this);
} |
acf0fb8f-b3ae-470e-b7be-d53d16b901e4 | @SuppressWarnings("deprecation")
@Override
public boolean onCommand(CommandSender s, Command cmd, String label,
String[] args) {
if (!(s instanceof Player))
return true;
Player p = (Player) s;
if (cmd.getName().equalsIgnoreCase("dis")) {
if (args.length == 0) {
p.sendMessage(ChatColor.RED + "Usage: /dis <player>");
} else if (args.length == 1) {
if (DisguiseAPI.getAPI().isDisguised(p)) {
p.sendMessage(ChatColor.RED
+ "Undisguise before you disguise again!");
} else {
Disguise d = new PlayerDisguise(p, args[0]);
DisguiseAPI.getAPI().disguisePlayer(p, d,
DisguiseAPI.getAPI().online());
p.sendMessage(
ChatColor.GREEN + "Disguised as " + args[0] + "!");
}
} else if (args.length == 2) {
// Splitting players by a comma.
String[] players = args[1].split("\\,");
List<Player> dis = new ArrayList<Player>();
for (String sp : players) {
if (Bukkit.getPlayer(sp) == null)
continue;
dis.add(Bukkit.getPlayer(sp));
}
Disguise d = new PlayerDisguise(p, args[0]);
DisguiseAPI.getAPI().disguisePlayer(p, d, dis);
p.sendMessage(
ChatColor.GREEN + "Disguised as " + args[0] + "!");
} else {
}
} else if (cmd.getName().equalsIgnoreCase("udis")) {
if (DisguiseAPI.getAPI().isDisguised(p)) {
p.sendMessage(ChatColor.GREEN + "You have been undisguised!");
DisguiseAPI.getAPI().unDisguisePlayer(p);
} else {
p.sendMessage(ChatColor.RED + "You are not disguised!");
}
}
return true;
} |
63b0a820-1b40-4a00-a482-04e2dfab9c07 | List<Post> findAll(); |
6d820dfb-90d7-45ef-8772-2818af198676 | public String getComment() {
return comment;
} |
006cf6c1-838c-485e-9dfa-3b4d46611f77 | public void setComment(String comment) {
this.comment = comment;
} |
917f8bbc-d6aa-462d-b14a-4fe892af0b28 | public int getId() {
return id;
} |
f3488802-e181-4cfd-a07f-87d53e2dc638 | public boolean isDeleted() {
return deleted;
} |
5663b11f-4298-4576-89e2-22644bd4881f | public Date getCreationDatetime() {
return creationDatetime;
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.