Merge branch 'clans-beta' of ssh://184.154.0.242:7999/min/mineplex into clans-beta
This commit is contained in:
commit
bd2fda17b0
@ -6,7 +6,6 @@
|
|||||||
<directory url="file://$PROJECT_DIR$/Nautilus.Game.PvP" includeSubdirectories="true" />
|
<directory url="file://$PROJECT_DIR$/Nautilus.Game.PvP" includeSubdirectories="true" />
|
||||||
<directory url="file://$PROJECT_DIR$/Mineplex.ServerMonitor" includeSubdirectories="true" />
|
<directory url="file://$PROJECT_DIR$/Mineplex.ServerMonitor" includeSubdirectories="true" />
|
||||||
<directory url="file://$PROJECT_DIR$/Nautilus.Game.Arcade" includeSubdirectories="true" />
|
<directory url="file://$PROJECT_DIR$/Nautilus.Game.Arcade" includeSubdirectories="true" />
|
||||||
<directory url="file://$PROJECT_DIR$/Mineplex.Hub" includeSubdirectories="true" />
|
|
||||||
</excludeFromCompile>
|
</excludeFromCompile>
|
||||||
<resourceExtensions />
|
<resourceExtensions />
|
||||||
<wildcardResourcePatterns>
|
<wildcardResourcePatterns>
|
||||||
|
@ -12,5 +12,4 @@
|
|||||||
<orderEntry type="library" name="commons-pool2" level="project" />
|
<orderEntry type="library" name="commons-pool2" level="project" />
|
||||||
<orderEntry type="library" name="commons-logging" level="project" />
|
<orderEntry type="library" name="commons-logging" level="project" />
|
||||||
</component>
|
</component>
|
||||||
</module>
|
</module>
|
||||||
|
|
@ -0,0 +1,537 @@
|
|||||||
|
//
|
||||||
|
// Source code recreated from a .class file by IntelliJ IDEA
|
||||||
|
// (powered by Fernflower decompiler)
|
||||||
|
//
|
||||||
|
|
||||||
|
package net.minecraft.server.v1_7_R4;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
import net.minecraft.server.v1_7_R4.AttributeMapServer;
|
||||||
|
import net.minecraft.server.v1_7_R4.Block;
|
||||||
|
import net.minecraft.server.v1_7_R4.DataWatcher;
|
||||||
|
import net.minecraft.server.v1_7_R4.Entity;
|
||||||
|
import net.minecraft.server.v1_7_R4.EntityArrow;
|
||||||
|
import net.minecraft.server.v1_7_R4.EntityBoat;
|
||||||
|
import net.minecraft.server.v1_7_R4.EntityEgg;
|
||||||
|
import net.minecraft.server.v1_7_R4.EntityEnderCrystal;
|
||||||
|
import net.minecraft.server.v1_7_R4.EntityEnderDragon;
|
||||||
|
import net.minecraft.server.v1_7_R4.EntityEnderPearl;
|
||||||
|
import net.minecraft.server.v1_7_R4.EntityEnderSignal;
|
||||||
|
import net.minecraft.server.v1_7_R4.EntityExperienceOrb;
|
||||||
|
import net.minecraft.server.v1_7_R4.EntityFallingBlock;
|
||||||
|
import net.minecraft.server.v1_7_R4.EntityFireball;
|
||||||
|
import net.minecraft.server.v1_7_R4.EntityFireworks;
|
||||||
|
import net.minecraft.server.v1_7_R4.EntityFishingHook;
|
||||||
|
import net.minecraft.server.v1_7_R4.EntityHuman;
|
||||||
|
import net.minecraft.server.v1_7_R4.EntityInsentient;
|
||||||
|
import net.minecraft.server.v1_7_R4.EntityItem;
|
||||||
|
import net.minecraft.server.v1_7_R4.EntityItemFrame;
|
||||||
|
import net.minecraft.server.v1_7_R4.EntityLeash;
|
||||||
|
import net.minecraft.server.v1_7_R4.EntityLiving;
|
||||||
|
import net.minecraft.server.v1_7_R4.EntityMinecartAbstract;
|
||||||
|
import net.minecraft.server.v1_7_R4.EntityPainting;
|
||||||
|
import net.minecraft.server.v1_7_R4.EntityPlayer;
|
||||||
|
import net.minecraft.server.v1_7_R4.EntityPotion;
|
||||||
|
import net.minecraft.server.v1_7_R4.EntitySmallFireball;
|
||||||
|
import net.minecraft.server.v1_7_R4.EntitySnowball;
|
||||||
|
import net.minecraft.server.v1_7_R4.EntityTNTPrimed;
|
||||||
|
import net.minecraft.server.v1_7_R4.EntityThrownExpBottle;
|
||||||
|
import net.minecraft.server.v1_7_R4.EntityWitherSkull;
|
||||||
|
import net.minecraft.server.v1_7_R4.IAnimal;
|
||||||
|
import net.minecraft.server.v1_7_R4.ItemStack;
|
||||||
|
import net.minecraft.server.v1_7_R4.ItemWorldMap;
|
||||||
|
import net.minecraft.server.v1_7_R4.Items;
|
||||||
|
import net.minecraft.server.v1_7_R4.MathHelper;
|
||||||
|
import net.minecraft.server.v1_7_R4.MobEffect;
|
||||||
|
import net.minecraft.server.v1_7_R4.Packet;
|
||||||
|
import net.minecraft.server.v1_7_R4.PacketPlayOutAttachEntity;
|
||||||
|
import net.minecraft.server.v1_7_R4.PacketPlayOutBed;
|
||||||
|
import net.minecraft.server.v1_7_R4.PacketPlayOutEntityEffect;
|
||||||
|
import net.minecraft.server.v1_7_R4.PacketPlayOutEntityEquipment;
|
||||||
|
import net.minecraft.server.v1_7_R4.PacketPlayOutEntityHeadRotation;
|
||||||
|
import net.minecraft.server.v1_7_R4.PacketPlayOutEntityLook;
|
||||||
|
import net.minecraft.server.v1_7_R4.PacketPlayOutEntityMetadata;
|
||||||
|
import net.minecraft.server.v1_7_R4.PacketPlayOutEntityTeleport;
|
||||||
|
import net.minecraft.server.v1_7_R4.PacketPlayOutEntityVelocity;
|
||||||
|
import net.minecraft.server.v1_7_R4.PacketPlayOutNamedEntitySpawn;
|
||||||
|
import net.minecraft.server.v1_7_R4.PacketPlayOutPlayerInfo;
|
||||||
|
import net.minecraft.server.v1_7_R4.PacketPlayOutRelEntityMove;
|
||||||
|
import net.minecraft.server.v1_7_R4.PacketPlayOutRelEntityMoveLook;
|
||||||
|
import net.minecraft.server.v1_7_R4.PacketPlayOutSpawnEntity;
|
||||||
|
import net.minecraft.server.v1_7_R4.PacketPlayOutSpawnEntityExperienceOrb;
|
||||||
|
import net.minecraft.server.v1_7_R4.PacketPlayOutSpawnEntityLiving;
|
||||||
|
import net.minecraft.server.v1_7_R4.PacketPlayOutSpawnEntityPainting;
|
||||||
|
import net.minecraft.server.v1_7_R4.PacketPlayOutUpdateAttributes;
|
||||||
|
import net.minecraft.server.v1_7_R4.WorldMap;
|
||||||
|
import org.apache.logging.log4j.LogManager;
|
||||||
|
import org.apache.logging.log4j.Logger;
|
||||||
|
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.player.PlayerVelocityEvent;
|
||||||
|
import org.bukkit.util.Vector;
|
||||||
|
import org.spigotmc.AsyncCatcher;
|
||||||
|
|
||||||
|
public class EntityTrackerEntry {
|
||||||
|
private static final Logger p = LogManager.getLogger();
|
||||||
|
public Entity tracker;
|
||||||
|
public int b;
|
||||||
|
public int c;
|
||||||
|
public int xLoc;
|
||||||
|
public int yLoc;
|
||||||
|
public int zLoc;
|
||||||
|
public int yRot;
|
||||||
|
public int xRot;
|
||||||
|
public int i;
|
||||||
|
public double j;
|
||||||
|
public double k;
|
||||||
|
public double l;
|
||||||
|
public int m;
|
||||||
|
private double q;
|
||||||
|
private double r;
|
||||||
|
private double s;
|
||||||
|
private boolean isMoving;
|
||||||
|
private boolean u;
|
||||||
|
private int v;
|
||||||
|
private Entity w;
|
||||||
|
private boolean x;
|
||||||
|
public boolean n;
|
||||||
|
public Set trackedPlayers = new HashSet();
|
||||||
|
|
||||||
|
public EntityTrackerEntry(Entity entity, int i, int j, boolean flag) {
|
||||||
|
this.tracker = entity;
|
||||||
|
this.b = i;
|
||||||
|
this.c = j;
|
||||||
|
this.u = flag;
|
||||||
|
this.xLoc = MathHelper.floor(entity.locX * 32.0D);
|
||||||
|
this.yLoc = MathHelper.floor(entity.locY * 32.0D);
|
||||||
|
this.zLoc = MathHelper.floor(entity.locZ * 32.0D);
|
||||||
|
this.yRot = MathHelper.d(entity.yaw * 256.0F / 360.0F);
|
||||||
|
this.xRot = MathHelper.d(entity.pitch * 256.0F / 360.0F);
|
||||||
|
this.i = MathHelper.d(entity.getHeadRotation() * 256.0F / 360.0F);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean equals(Object object) {
|
||||||
|
return object instanceof EntityTrackerEntry?((EntityTrackerEntry)object).tracker.getId() == this.tracker.getId():false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int hashCode() {
|
||||||
|
return this.tracker.getId();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void track(List list) {
|
||||||
|
this.n = false;
|
||||||
|
if(!this.isMoving || this.tracker.e(this.q, this.r, this.s) > 16.0D) {
|
||||||
|
this.q = this.tracker.locX;
|
||||||
|
this.r = this.tracker.locY;
|
||||||
|
this.s = this.tracker.locZ;
|
||||||
|
this.isMoving = true;
|
||||||
|
this.n = true;
|
||||||
|
this.scanPlayers(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(this.w != this.tracker.vehicle || this.tracker.vehicle != null && this.m % 60 == 0) {
|
||||||
|
this.w = this.tracker.vehicle;
|
||||||
|
this.broadcast(new PacketPlayOutAttachEntity(0, this.tracker, this.tracker.vehicle));
|
||||||
|
}
|
||||||
|
|
||||||
|
if(this.tracker instanceof EntityItemFrame) {
|
||||||
|
EntityItemFrame cancelled = (EntityItemFrame)this.tracker;
|
||||||
|
ItemStack player = cancelled.getItem();
|
||||||
|
if(this.m % 10 == 0 && player != null && player.getItem() instanceof ItemWorldMap) {
|
||||||
|
WorldMap velocity = Items.MAP.getSavedMap(player, this.tracker.world);
|
||||||
|
Iterator event = this.trackedPlayers.iterator();
|
||||||
|
|
||||||
|
while(event.hasNext()) {
|
||||||
|
EntityHuman i1 = (EntityHuman)event.next();
|
||||||
|
EntityPlayer j1 = (EntityPlayer)i1;
|
||||||
|
velocity.a(j1, player);
|
||||||
|
Packet k1 = Items.MAP.c(player, this.tracker.world, j1);
|
||||||
|
if(k1 != null) {
|
||||||
|
j1.playerConnection.sendPacket(k1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.b();
|
||||||
|
} else if(this.m % this.c == 0 || this.tracker.al || this.tracker.getDataWatcher().a()) {
|
||||||
|
int var23;
|
||||||
|
int var24;
|
||||||
|
if(this.tracker.vehicle == null) {
|
||||||
|
++this.v;
|
||||||
|
var23 = this.tracker.as.a(this.tracker.locX);
|
||||||
|
var24 = MathHelper.floor(this.tracker.locY * 32.0D);
|
||||||
|
int var28 = this.tracker.as.a(this.tracker.locZ);
|
||||||
|
int var30 = MathHelper.d(this.tracker.yaw * 256.0F / 360.0F);
|
||||||
|
int var32 = MathHelper.d(this.tracker.pitch * 256.0F / 360.0F);
|
||||||
|
int var33 = var23 - this.xLoc;
|
||||||
|
int var34 = var24 - this.yLoc;
|
||||||
|
int l1 = var28 - this.zLoc;
|
||||||
|
Object object = null;
|
||||||
|
boolean flag = Math.abs(var33) >= 4 || Math.abs(var34) >= 4 || Math.abs(l1) >= 4 || this.m % 60 == 0;
|
||||||
|
boolean flag1 = Math.abs(var30 - this.yRot) >= 4 || Math.abs(var32 - this.xRot) >= 4;
|
||||||
|
if(flag) {
|
||||||
|
this.xLoc = var23;
|
||||||
|
this.yLoc = var24;
|
||||||
|
this.zLoc = var28;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(flag1) {
|
||||||
|
this.yRot = var30;
|
||||||
|
this.xRot = var32;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(this.m > 0 || this.tracker instanceof EntityArrow) {
|
||||||
|
if(var33 >= -128 && var33 < 128 && var34 >= -128 && var34 < 128 && l1 >= -128 && l1 < 128 && this.v <= 400 && !this.x) {
|
||||||
|
if(flag && flag1) {
|
||||||
|
object = new PacketPlayOutRelEntityMoveLook(this.tracker.getId(), (byte)var33, (byte)var34, (byte)l1, (byte)var30, (byte)var32, this.tracker.onGround);
|
||||||
|
} else if(flag) {
|
||||||
|
object = new PacketPlayOutRelEntityMove(this.tracker.getId(), (byte)var33, (byte)var34, (byte)l1, this.tracker.onGround);
|
||||||
|
} else if(flag1) {
|
||||||
|
object = new PacketPlayOutEntityLook(this.tracker.getId(), (byte)var30, (byte)var32, this.tracker.onGround);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.v = 0;
|
||||||
|
if(this.tracker instanceof EntityPlayer) {
|
||||||
|
this.scanPlayers(new ArrayList(this.trackedPlayers));
|
||||||
|
}
|
||||||
|
|
||||||
|
object = new PacketPlayOutEntityTeleport(this.tracker.getId(), var23, var24, var28, (byte)var30, (byte)var32, this.tracker.onGround);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(this.u) {
|
||||||
|
double d0 = this.tracker.motX - this.j;
|
||||||
|
double d1 = this.tracker.motY - this.k;
|
||||||
|
double d2 = this.tracker.motZ - this.l;
|
||||||
|
double d3 = 0.02D;
|
||||||
|
double d4 = d0 * d0 + d1 * d1 + d2 * d2;
|
||||||
|
if(d4 > d3 * d3 || d4 > 0.0D && this.tracker.motX == 0.0D && this.tracker.motY == 0.0D && this.tracker.motZ == 0.0D) {
|
||||||
|
this.j = this.tracker.motX;
|
||||||
|
this.k = this.tracker.motY;
|
||||||
|
this.l = this.tracker.motZ;
|
||||||
|
this.broadcast(new PacketPlayOutEntityVelocity(this.tracker.getId(), this.j, this.k, this.l));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(object != null) {
|
||||||
|
this.broadcast((Packet)object);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.b();
|
||||||
|
this.x = false;
|
||||||
|
} else {
|
||||||
|
var23 = MathHelper.d(this.tracker.yaw * 256.0F / 360.0F);
|
||||||
|
var24 = MathHelper.d(this.tracker.pitch * 256.0F / 360.0F);
|
||||||
|
boolean var27 = Math.abs(var23 - this.yRot) >= 4 || Math.abs(var24 - this.xRot) >= 4;
|
||||||
|
if(var27) {
|
||||||
|
this.broadcast(new PacketPlayOutEntityLook(this.tracker.getId(), (byte)var23, (byte)var24, this.tracker.onGround));
|
||||||
|
this.yRot = var23;
|
||||||
|
this.xRot = var24;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.xLoc = this.tracker.as.a(this.tracker.locX);
|
||||||
|
this.yLoc = MathHelper.floor(this.tracker.locY * 32.0D);
|
||||||
|
this.zLoc = this.tracker.as.a(this.tracker.locZ);
|
||||||
|
this.b();
|
||||||
|
this.x = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
var23 = MathHelper.d(this.tracker.getHeadRotation() * 256.0F / 360.0F);
|
||||||
|
if(Math.abs(var23 - this.i) >= 4) {
|
||||||
|
this.broadcast(new PacketPlayOutEntityHeadRotation(this.tracker, (byte)var23));
|
||||||
|
this.i = var23;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.tracker.al = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
++this.m;
|
||||||
|
if(this.tracker.velocityChanged) {
|
||||||
|
boolean var25 = false;
|
||||||
|
if(this.tracker instanceof EntityPlayer) {
|
||||||
|
Player var26 = (Player)this.tracker.getBukkitEntity();
|
||||||
|
Vector var29 = var26.getVelocity();
|
||||||
|
PlayerVelocityEvent var31 = new PlayerVelocityEvent(var26, var29);
|
||||||
|
this.tracker.world.getServer().getPluginManager().callEvent(var31);
|
||||||
|
if(var31.isCancelled()) {
|
||||||
|
var25 = true;
|
||||||
|
} else if(!var29.equals(var31.getVelocity())) {
|
||||||
|
var26.setVelocity(var29);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!var25) {
|
||||||
|
this.broadcastIncludingSelf(new PacketPlayOutEntityVelocity(this.tracker));
|
||||||
|
}
|
||||||
|
|
||||||
|
this.tracker.velocityChanged = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void b() {
|
||||||
|
DataWatcher datawatcher = this.tracker.getDataWatcher();
|
||||||
|
if(datawatcher.a()) {
|
||||||
|
this.broadcastIncludingSelf(new PacketPlayOutEntityMetadata(this.tracker.getId(), datawatcher, false));
|
||||||
|
}
|
||||||
|
|
||||||
|
if(this.tracker instanceof EntityLiving) {
|
||||||
|
AttributeMapServer attributemapserver = (AttributeMapServer)((EntityLiving)this.tracker).getAttributeMap();
|
||||||
|
Set set = attributemapserver.getAttributes();
|
||||||
|
if(!set.isEmpty()) {
|
||||||
|
if(this.tracker instanceof EntityPlayer) {
|
||||||
|
((EntityPlayer)this.tracker).getBukkitEntity().injectScaledMaxHealth(set, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.broadcastIncludingSelf(new PacketPlayOutUpdateAttributes(this.tracker.getId(), set));
|
||||||
|
}
|
||||||
|
|
||||||
|
set.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void broadcast(Packet packet) {
|
||||||
|
Iterator iterator = this.trackedPlayers.iterator();
|
||||||
|
|
||||||
|
while(iterator.hasNext()) {
|
||||||
|
EntityPlayer entityplayer = (EntityPlayer)iterator.next();
|
||||||
|
entityplayer.playerConnection.sendPacket(packet);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void broadcastIncludingSelf(Packet packet) {
|
||||||
|
this.broadcast(packet);
|
||||||
|
if(this.tracker instanceof EntityPlayer) {
|
||||||
|
((EntityPlayer)this.tracker).playerConnection.sendPacket(packet);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void a() {
|
||||||
|
Iterator iterator = this.trackedPlayers.iterator();
|
||||||
|
|
||||||
|
while(iterator.hasNext()) {
|
||||||
|
EntityPlayer entityplayer = (EntityPlayer)iterator.next();
|
||||||
|
entityplayer.d(this.tracker);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void a(EntityPlayer entityplayer) {
|
||||||
|
if(this.trackedPlayers.contains(entityplayer)) {
|
||||||
|
entityplayer.d(this.tracker);
|
||||||
|
this.trackedPlayers.remove(entityplayer);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void updatePlayer(EntityPlayer entityplayer) {
|
||||||
|
AsyncCatcher.catchOp("player tracker update");
|
||||||
|
if(entityplayer != this.tracker) {
|
||||||
|
double d0 = entityplayer.locX - (double)(this.xLoc / 32);
|
||||||
|
double d1 = entityplayer.locZ - (double)(this.zLoc / 32);
|
||||||
|
if(d0 >= (double)(-this.b) && d0 <= (double)this.b && d1 >= (double)(-this.b) && d1 <= (double)this.b) {
|
||||||
|
if(!this.trackedPlayers.contains(entityplayer) && (this.d(entityplayer) || this.tracker.attachedToPlayer)) {
|
||||||
|
if(this.tracker instanceof EntityPlayer) {
|
||||||
|
CraftPlayer packet = ((EntityPlayer)this.tracker).getBukkitEntity();
|
||||||
|
if(!entityplayer.getBukkitEntity().canSee(packet)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
entityplayer.removeQueue.remove(Integer.valueOf(this.tracker.getId()));
|
||||||
|
this.trackedPlayers.add(entityplayer);
|
||||||
|
Packet var10 = this.c();
|
||||||
|
if(this.tracker instanceof EntityPlayer) {
|
||||||
|
entityplayer.playerConnection.sendPacket(PacketPlayOutPlayerInfo.addPlayer(entityplayer, (EntityPlayer)this.tracker));
|
||||||
|
}
|
||||||
|
|
||||||
|
entityplayer.playerConnection.sendPacket(var10);
|
||||||
|
if(!this.tracker.getDataWatcher().d()) {
|
||||||
|
entityplayer.playerConnection.sendPacket(new PacketPlayOutEntityMetadata(this.tracker.getId(), this.tracker.getDataWatcher(), true));
|
||||||
|
}
|
||||||
|
|
||||||
|
if(this.tracker instanceof EntityLiving) {
|
||||||
|
AttributeMapServer entityliving = (AttributeMapServer)((EntityLiving)this.tracker).getAttributeMap();
|
||||||
|
Collection iterator = entityliving.c();
|
||||||
|
if(this.tracker.getId() == entityplayer.getId()) {
|
||||||
|
((EntityPlayer)this.tracker).getBukkitEntity().injectScaledMaxHealth(iterator, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!iterator.isEmpty()) {
|
||||||
|
entityplayer.playerConnection.sendPacket(new PacketPlayOutUpdateAttributes(this.tracker.getId(), iterator));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.j = this.tracker.motX;
|
||||||
|
this.k = this.tracker.motY;
|
||||||
|
this.l = this.tracker.motZ;
|
||||||
|
if(this.u && !(var10 instanceof PacketPlayOutSpawnEntityLiving)) {
|
||||||
|
entityplayer.playerConnection.sendPacket(new PacketPlayOutEntityVelocity(this.tracker.getId(), this.tracker.motX, this.tracker.motY, this.tracker.motZ));
|
||||||
|
}
|
||||||
|
|
||||||
|
if(this.tracker.vehicle != null) {
|
||||||
|
entityplayer.playerConnection.sendPacket(new PacketPlayOutAttachEntity(0, this.tracker, this.tracker.vehicle));
|
||||||
|
}
|
||||||
|
|
||||||
|
if(this.tracker.passenger != null) {
|
||||||
|
entityplayer.playerConnection.sendPacket(new PacketPlayOutAttachEntity(0, this.tracker.passenger, this.tracker));
|
||||||
|
}
|
||||||
|
|
||||||
|
if(this.tracker instanceof EntityInsentient && ((EntityInsentient)this.tracker).getLeashHolder() != null) {
|
||||||
|
entityplayer.playerConnection.sendPacket(new PacketPlayOutAttachEntity(1, this.tracker, ((EntityInsentient)this.tracker).getLeashHolder()));
|
||||||
|
}
|
||||||
|
|
||||||
|
if(this.tracker instanceof EntityLiving) {
|
||||||
|
for(int var11 = 0; var11 < 5; ++var11) {
|
||||||
|
ItemStack var13 = ((EntityLiving)this.tracker).getEquipment(var11);
|
||||||
|
if(var13 != null) {
|
||||||
|
entityplayer.playerConnection.sendPacket(new PacketPlayOutEntityEquipment(this.tracker.getId(), var11, var13));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(this.tracker instanceof EntityHuman) {
|
||||||
|
EntityHuman var12 = (EntityHuman)this.tracker;
|
||||||
|
if(var12.isSleeping()) {
|
||||||
|
entityplayer.playerConnection.sendPacket(new PacketPlayOutBed(var12, MathHelper.floor(this.tracker.locX), MathHelper.floor(this.tracker.locY), MathHelper.floor(this.tracker.locZ)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.i = MathHelper.d(this.tracker.getHeadRotation() * 256.0F / 360.0F);
|
||||||
|
this.broadcast(new PacketPlayOutEntityHeadRotation(this.tracker, (byte)this.i));
|
||||||
|
if(this.tracker instanceof EntityLiving) {
|
||||||
|
EntityLiving var14 = (EntityLiving)this.tracker;
|
||||||
|
Iterator var15 = var14.getEffects().iterator();
|
||||||
|
|
||||||
|
while(var15.hasNext()) {
|
||||||
|
MobEffect mobeffect = (MobEffect)var15.next();
|
||||||
|
entityplayer.playerConnection.sendPacket(new PacketPlayOutEntityEffect(this.tracker.getId(), mobeffect));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if(this.trackedPlayers.contains(entityplayer)) {
|
||||||
|
this.trackedPlayers.remove(entityplayer);
|
||||||
|
entityplayer.d(this.tracker);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean d(EntityPlayer entityplayer) {
|
||||||
|
return entityplayer.r().getPlayerChunkMap().a(entityplayer, this.tracker.ah, this.tracker.aj);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void scanPlayers(List list) {
|
||||||
|
for(int i = 0; i < list.size(); ++i) {
|
||||||
|
this.updatePlayer((EntityPlayer)list.get(i));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private Packet c() {
|
||||||
|
if(this.tracker.dead) {
|
||||||
|
return null;
|
||||||
|
} else if(this.tracker instanceof EntityItem) {
|
||||||
|
return new PacketPlayOutSpawnEntity(this.tracker, 2, 1);
|
||||||
|
} else if(this.tracker instanceof EntityPlayer) {
|
||||||
|
return new PacketPlayOutNamedEntitySpawn((EntityHuman)this.tracker);
|
||||||
|
} else if(this.tracker instanceof EntityMinecartAbstract) {
|
||||||
|
EntityMinecartAbstract packetplayoutspawnentity3 = (EntityMinecartAbstract)this.tracker;
|
||||||
|
return new PacketPlayOutSpawnEntity(this.tracker, 10, packetplayoutspawnentity3.m());
|
||||||
|
} else if(this.tracker instanceof EntityBoat) {
|
||||||
|
return new PacketPlayOutSpawnEntity(this.tracker, 1);
|
||||||
|
} else if(!(this.tracker instanceof IAnimal) && !(this.tracker instanceof EntityEnderDragon)) {
|
||||||
|
if(this.tracker instanceof EntityFishingHook) {
|
||||||
|
EntityHuman packetplayoutspawnentity2 = ((EntityFishingHook)this.tracker).owner;
|
||||||
|
return new PacketPlayOutSpawnEntity(this.tracker, 90, packetplayoutspawnentity2 != null?packetplayoutspawnentity2.getId():this.tracker.getId());
|
||||||
|
} else if(this.tracker instanceof EntityArrow) {
|
||||||
|
Entity packetplayoutspawnentity1 = ((EntityArrow)this.tracker).shooter;
|
||||||
|
return new PacketPlayOutSpawnEntity(this.tracker, 60, packetplayoutspawnentity1 != null?packetplayoutspawnentity1.getId():this.tracker.getId());
|
||||||
|
} else if(this.tracker instanceof EntitySnowball) {
|
||||||
|
return new PacketPlayOutSpawnEntity(this.tracker, 61);
|
||||||
|
} else if(this.tracker instanceof EntityPotion) {
|
||||||
|
return new PacketPlayOutSpawnEntity(this.tracker, 73, ((EntityPotion)this.tracker).getPotionValue());
|
||||||
|
} else if(this.tracker instanceof EntityThrownExpBottle) {
|
||||||
|
return new PacketPlayOutSpawnEntity(this.tracker, 75);
|
||||||
|
} else if(this.tracker instanceof EntityEnderPearl) {
|
||||||
|
return new PacketPlayOutSpawnEntity(this.tracker, 65);
|
||||||
|
} else if(this.tracker instanceof EntityEnderSignal) {
|
||||||
|
return new PacketPlayOutSpawnEntity(this.tracker, 72);
|
||||||
|
} else if(this.tracker instanceof EntityFireworks) {
|
||||||
|
return new PacketPlayOutSpawnEntity(this.tracker, 76);
|
||||||
|
} else {
|
||||||
|
PacketPlayOutSpawnEntity packetplayoutspawnentity;
|
||||||
|
if(this.tracker instanceof EntityFireball) {
|
||||||
|
EntityFireball entityleash3 = (EntityFireball)this.tracker;
|
||||||
|
packetplayoutspawnentity = null;
|
||||||
|
byte b0 = 63;
|
||||||
|
if(this.tracker instanceof EntitySmallFireball) {
|
||||||
|
b0 = 64;
|
||||||
|
} else if(this.tracker instanceof EntityWitherSkull) {
|
||||||
|
b0 = 66;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(entityleash3.shooter != null) {
|
||||||
|
packetplayoutspawnentity = new PacketPlayOutSpawnEntity(this.tracker, b0, ((EntityFireball)this.tracker).shooter.getId());
|
||||||
|
} else {
|
||||||
|
packetplayoutspawnentity = new PacketPlayOutSpawnEntity(this.tracker, b0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
packetplayoutspawnentity.d((int)(entityleash3.dirX * 8000.0D));
|
||||||
|
packetplayoutspawnentity.e((int)(entityleash3.dirY * 8000.0D));
|
||||||
|
packetplayoutspawnentity.f((int)(entityleash3.dirZ * 8000.0D));
|
||||||
|
return packetplayoutspawnentity;
|
||||||
|
} else if(this.tracker instanceof EntityEgg) {
|
||||||
|
return new PacketPlayOutSpawnEntity(this.tracker, 62);
|
||||||
|
} else if(this.tracker instanceof EntityTNTPrimed) {
|
||||||
|
return new PacketPlayOutSpawnEntity(this.tracker, 50);
|
||||||
|
} else if(this.tracker instanceof EntityEnderCrystal) {
|
||||||
|
return new PacketPlayOutSpawnEntity(this.tracker, 51);
|
||||||
|
} else if(this.tracker instanceof EntityFallingBlock) {
|
||||||
|
EntityFallingBlock entityleash2 = (EntityFallingBlock)this.tracker;
|
||||||
|
return new PacketPlayOutSpawnEntity(this.tracker, 70, Block.getId(entityleash2.f()) | entityleash2.data << 16);
|
||||||
|
} else if(this.tracker instanceof EntityPainting) {
|
||||||
|
return new PacketPlayOutSpawnEntityPainting((EntityPainting)this.tracker);
|
||||||
|
} else if(this.tracker instanceof EntityItemFrame) {
|
||||||
|
EntityItemFrame entityleash1 = (EntityItemFrame)this.tracker;
|
||||||
|
packetplayoutspawnentity = new PacketPlayOutSpawnEntity(this.tracker, 71, entityleash1.direction);
|
||||||
|
packetplayoutspawnentity.a(MathHelper.d((float)(entityleash1.x * 32)));
|
||||||
|
packetplayoutspawnentity.b(MathHelper.d((float)(entityleash1.y * 32)));
|
||||||
|
packetplayoutspawnentity.c(MathHelper.d((float)(entityleash1.z * 32)));
|
||||||
|
return packetplayoutspawnentity;
|
||||||
|
} else if(this.tracker instanceof EntityLeash) {
|
||||||
|
EntityLeash entityleash = (EntityLeash)this.tracker;
|
||||||
|
packetplayoutspawnentity = new PacketPlayOutSpawnEntity(this.tracker, 77);
|
||||||
|
packetplayoutspawnentity.a(MathHelper.d((float)(entityleash.x * 32)));
|
||||||
|
packetplayoutspawnentity.b(MathHelper.d((float)(entityleash.y * 32)));
|
||||||
|
packetplayoutspawnentity.c(MathHelper.d((float)(entityleash.z * 32)));
|
||||||
|
return packetplayoutspawnentity;
|
||||||
|
} else if(this.tracker instanceof EntityExperienceOrb) {
|
||||||
|
return new PacketPlayOutSpawnEntityExperienceOrb((EntityExperienceOrb)this.tracker);
|
||||||
|
} else {
|
||||||
|
throw new IllegalArgumentException("Don\'t know how to add " + this.tracker.getClass() + "!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.i = MathHelper.d(this.tracker.getHeadRotation() * 256.0F / 360.0F);
|
||||||
|
return new PacketPlayOutSpawnEntityLiving((EntityLiving)this.tracker);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void clear(EntityPlayer entityplayer) {
|
||||||
|
AsyncCatcher.catchOp("player tracker clear");
|
||||||
|
if(this.trackedPlayers.contains(entityplayer)) {
|
||||||
|
this.trackedPlayers.remove(entityplayer);
|
||||||
|
entityplayer.d(this.tracker);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -11,6 +11,7 @@ import java.util.Iterator;
|
|||||||
|
|
||||||
import org.bukkit.craftbukkit.v1_7_R4.scoreboard.CraftScoreboard;
|
import org.bukkit.craftbukkit.v1_7_R4.scoreboard.CraftScoreboard;
|
||||||
import org.bukkit.craftbukkit.v1_7_R4.util.CraftChatMessage;
|
import org.bukkit.craftbukkit.v1_7_R4.util.CraftChatMessage;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.scoreboard.Team;
|
import org.bukkit.scoreboard.Team;
|
||||||
import net.minecraft.util.com.mojang.authlib.GameProfile;
|
import net.minecraft.util.com.mojang.authlib.GameProfile;
|
||||||
import net.minecraft.util.com.mojang.authlib.properties.Property;
|
import net.minecraft.util.com.mojang.authlib.properties.Property;
|
||||||
@ -37,6 +38,18 @@ public class PacketPlayOutPlayerInfo extends Packet {
|
|||||||
public PacketPlayOutPlayerInfo() {
|
public PacketPlayOutPlayerInfo() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static PacketPlayOutPlayerInfo addPlayer(EntityPlayer sendTo, EntityPlayer player) {
|
||||||
|
PacketPlayOutPlayerInfo packet = new PacketPlayOutPlayerInfo();
|
||||||
|
packet.action = 0;
|
||||||
|
packet.username = player.listName;
|
||||||
|
packet.player = player.getProfile();
|
||||||
|
packet.ping = player.ping;
|
||||||
|
packet.gamemode = player.playerInteractManager.getGameMode().getId();
|
||||||
|
|
||||||
|
packet._tabName = getFormattedName(sendTo, player);
|
||||||
|
return packet;
|
||||||
|
}
|
||||||
|
|
||||||
public static PacketPlayOutPlayerInfo addPlayer(EntityPlayer player) {
|
public static PacketPlayOutPlayerInfo addPlayer(EntityPlayer player) {
|
||||||
PacketPlayOutPlayerInfo packet = new PacketPlayOutPlayerInfo();
|
PacketPlayOutPlayerInfo packet = new PacketPlayOutPlayerInfo();
|
||||||
packet.action = 0;
|
packet.action = 0;
|
||||||
@ -67,8 +80,9 @@ public class PacketPlayOutPlayerInfo extends Packet {
|
|||||||
return packet;
|
return packet;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static PacketPlayOutPlayerInfo updateDisplayName(EntityPlayer player) {
|
public static PacketPlayOutPlayerInfo updateDisplayName(EntityPlayer sendPacketTo, EntityPlayer player)
|
||||||
return updateDisplayName(player, getFormattedName(player));
|
{
|
||||||
|
return updateDisplayName(player, getFormattedName(sendPacketTo, player));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static PacketPlayOutPlayerInfo updateDisplayName(EntityPlayer player, String displayName)
|
public static PacketPlayOutPlayerInfo updateDisplayName(EntityPlayer player, String displayName)
|
||||||
@ -177,7 +191,7 @@ public class PacketPlayOutPlayerInfo extends Packet {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void handle(PacketListener packetlistener) {
|
public void handle(PacketListener packetlistener) {
|
||||||
this.a((PacketPlayOutListener)((PacketPlayOutListener)packetlistener));
|
this.a((PacketPlayOutListener) ((PacketPlayOutListener) packetlistener));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String getFormattedName(EntityPlayer player)
|
private static String getFormattedName(EntityPlayer player)
|
||||||
@ -197,6 +211,23 @@ public class PacketPlayOutPlayerInfo extends Packet {
|
|||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static String getFormattedName(EntityPlayer sendPacketTo, EntityPlayer player)
|
||||||
|
{
|
||||||
|
String name = player.getName();
|
||||||
|
|
||||||
|
if (isAprilFools()) name = "Notch";
|
||||||
|
|
||||||
|
CraftScoreboard scoreboard = sendPacketTo.getBukkitEntity().getScoreboard();
|
||||||
|
if (scoreboard != null)
|
||||||
|
{
|
||||||
|
Team team = scoreboard.getPlayerTeam(player.getBukkitEntity());
|
||||||
|
if (team != null)
|
||||||
|
name = team.getPrefix() + name + team.getSuffix();
|
||||||
|
}
|
||||||
|
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
public static boolean isAprilFools()
|
public static boolean isAprilFools()
|
||||||
{
|
{
|
||||||
// Calendar c = Calendar.getInstance();
|
// Calendar c = Calendar.getInstance();
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,13 @@
|
|||||||
|
package net.minecraft.util.com.mojang.authlib.yggdrasil;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import net.minecraft.util.com.mojang.authlib.GameProfile;
|
||||||
|
|
||||||
|
public interface ProfileCache
|
||||||
|
{
|
||||||
|
public GameProfile attemptToLoadProfile(String playerName);
|
||||||
|
|
||||||
|
public void cacheProfile(GameProfile response);
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,145 @@
|
|||||||
|
//
|
||||||
|
// Source code recreated from a .class file by IntelliJ IDEA
|
||||||
|
// (powered by Fernflower decompiler)
|
||||||
|
//
|
||||||
|
|
||||||
|
package net.minecraft.util.com.mojang.authlib.yggdrasil;
|
||||||
|
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
|
import net.minecraft.util.com.google.common.base.Strings;
|
||||||
|
import net.minecraft.util.com.google.common.collect.Iterables;
|
||||||
|
import net.minecraft.util.com.google.common.collect.Sets;
|
||||||
|
import net.minecraft.util.com.mojang.authlib.Agent;
|
||||||
|
import net.minecraft.util.com.mojang.authlib.GameProfile;
|
||||||
|
import net.minecraft.util.com.mojang.authlib.GameProfileRepository;
|
||||||
|
import net.minecraft.util.com.mojang.authlib.HttpAuthenticationService;
|
||||||
|
import net.minecraft.util.com.mojang.authlib.ProfileLookupCallback;
|
||||||
|
import net.minecraft.util.com.mojang.authlib.exceptions.AuthenticationException;
|
||||||
|
import net.minecraft.util.com.mojang.authlib.yggdrasil.ProfileNotFoundException;
|
||||||
|
import net.minecraft.util.com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService;
|
||||||
|
import net.minecraft.util.com.mojang.authlib.yggdrasil.response.ProfileSearchResultsResponse;
|
||||||
|
import org.apache.logging.log4j.LogManager;
|
||||||
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
|
public class YggdrasilGameProfileRepository implements GameProfileRepository {
|
||||||
|
private static final Logger LOGGER = LogManager.getLogger();
|
||||||
|
private static final String BASE_URL = "https://api.mojang.com/";
|
||||||
|
private static final String SEARCH_PAGE_URL = "https://api.mojang.com/profiles/";
|
||||||
|
private static final int ENTRIES_PER_PAGE = 2;
|
||||||
|
private static final int MAX_FAIL_COUNT = 3;
|
||||||
|
private static final int DELAY_BETWEEN_PAGES = 100;
|
||||||
|
private static final int DELAY_BETWEEN_FAILURES = 750;
|
||||||
|
private final YggdrasilAuthenticationService authenticationService;
|
||||||
|
|
||||||
|
private static ProfileCache _profileCache;
|
||||||
|
|
||||||
|
public YggdrasilGameProfileRepository(YggdrasilAuthenticationService authenticationService) {
|
||||||
|
this.authenticationService = authenticationService;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setProfileCache(ProfileCache profileCache)
|
||||||
|
{
|
||||||
|
_profileCache = profileCache;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void findProfilesByNames(String[] names, Agent agent, ProfileLookupCallback callback) {
|
||||||
|
HashSet criteria = Sets.newHashSet();
|
||||||
|
String[] page = names;
|
||||||
|
int i$ = names.length;
|
||||||
|
|
||||||
|
for(int request = 0; request < i$; ++request) {
|
||||||
|
String failCount = page[request];
|
||||||
|
if(!Strings.isNullOrEmpty(failCount)) {
|
||||||
|
criteria.add(failCount.toLowerCase());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_profileCache != null)
|
||||||
|
{
|
||||||
|
// Attempt to load profiles from cache
|
||||||
|
Iterator<String> iterator = criteria.iterator();
|
||||||
|
while (iterator.hasNext())
|
||||||
|
{
|
||||||
|
String name = iterator.next();
|
||||||
|
// System.out.println("Trying to load profile from cache (GameProfileRepository): " + name);
|
||||||
|
GameProfile profile = _profileCache.attemptToLoadProfile(name);
|
||||||
|
if (profile != null)
|
||||||
|
{
|
||||||
|
// System.out.println("Successfully loaded profile: " + name);
|
||||||
|
iterator.remove();
|
||||||
|
callback.onProfileLookupSucceeded(profile);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
byte var19 = 0;
|
||||||
|
Iterator var20 = Iterables.partition(criteria, 2).iterator();
|
||||||
|
|
||||||
|
while(var20.hasNext()) {
|
||||||
|
List var21 = (List)var20.next();
|
||||||
|
int var22 = 0;
|
||||||
|
|
||||||
|
while(true) {
|
||||||
|
boolean failed = false;
|
||||||
|
|
||||||
|
try {
|
||||||
|
ProfileSearchResultsResponse var23 = (ProfileSearchResultsResponse)this.authenticationService.makeRequest(HttpAuthenticationService.constantURL("https://api.mojang.com/profiles/" + agent.getName().toLowerCase()), var21, ProfileSearchResultsResponse.class);
|
||||||
|
var22 = 0;
|
||||||
|
LOGGER.debug("Page {} returned {} results, parsing", new Object[]{Integer.valueOf(var19), Integer.valueOf(var23.getProfiles().length)});
|
||||||
|
HashSet var24 = Sets.newHashSet(var21);
|
||||||
|
GameProfile[] var25 = var23.getProfiles();
|
||||||
|
int name1 = var25.length;
|
||||||
|
|
||||||
|
for(int i$1 = 0; i$1 < name1; ++i$1) {
|
||||||
|
GameProfile profile = var25[i$1];
|
||||||
|
LOGGER.debug("Successfully looked up profile {}", new Object[]{profile});
|
||||||
|
var24.remove(profile.getName().toLowerCase());
|
||||||
|
callback.onProfileLookupSucceeded(profile);
|
||||||
|
}
|
||||||
|
|
||||||
|
Iterator var26 = var24.iterator();
|
||||||
|
|
||||||
|
while(var26.hasNext()) {
|
||||||
|
String var27 = (String)var26.next();
|
||||||
|
LOGGER.debug("Couldn\'t find profile {}", new Object[]{var27});
|
||||||
|
callback.onProfileLookupFailed(new GameProfile((UUID)null, var27), new ProfileNotFoundException("Server did not find the requested profile"));
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
Thread.sleep(100L);
|
||||||
|
} catch (InterruptedException var17) {
|
||||||
|
;
|
||||||
|
}
|
||||||
|
} catch (AuthenticationException var18) {
|
||||||
|
AuthenticationException e = var18;
|
||||||
|
++var22;
|
||||||
|
if(var22 == 3) {
|
||||||
|
Iterator ignored = var21.iterator();
|
||||||
|
|
||||||
|
while(ignored.hasNext()) {
|
||||||
|
String name = (String)ignored.next();
|
||||||
|
LOGGER.debug("Couldn\'t find profile {} because of a server error", new Object[]{name});
|
||||||
|
callback.onProfileLookupFailed(new GameProfile((UUID)null, name), e);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
Thread.sleep(750L);
|
||||||
|
} catch (InterruptedException var16) {
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
failed = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!failed) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,178 @@
|
|||||||
|
//
|
||||||
|
// Source code recreated from a .class file by IntelliJ IDEA
|
||||||
|
// (powered by Fernflower decompiler)
|
||||||
|
//
|
||||||
|
|
||||||
|
package net.minecraft.util.com.mojang.authlib.yggdrasil;
|
||||||
|
|
||||||
|
import java.net.URL;
|
||||||
|
import java.security.KeyFactory;
|
||||||
|
import java.security.PublicKey;
|
||||||
|
import java.security.spec.X509EncodedKeySpec;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.UUID;
|
||||||
|
import net.minecraft.util.com.google.common.collect.Iterables;
|
||||||
|
import net.minecraft.util.com.google.gson.Gson;
|
||||||
|
import net.minecraft.util.com.google.gson.GsonBuilder;
|
||||||
|
import net.minecraft.util.com.google.gson.JsonParseException;
|
||||||
|
import net.minecraft.util.com.mojang.authlib.GameProfile;
|
||||||
|
import net.minecraft.util.com.mojang.authlib.HttpAuthenticationService;
|
||||||
|
import net.minecraft.util.com.mojang.authlib.exceptions.AuthenticationException;
|
||||||
|
import net.minecraft.util.com.mojang.authlib.exceptions.AuthenticationUnavailableException;
|
||||||
|
import net.minecraft.util.com.mojang.authlib.minecraft.HttpMinecraftSessionService;
|
||||||
|
import net.minecraft.util.com.mojang.authlib.minecraft.InsecureTextureException;
|
||||||
|
import net.minecraft.util.com.mojang.authlib.minecraft.MinecraftProfileTexture;
|
||||||
|
import net.minecraft.util.com.mojang.authlib.minecraft.MinecraftProfileTexture.Type;
|
||||||
|
import net.minecraft.util.com.mojang.authlib.properties.Property;
|
||||||
|
import net.minecraft.util.com.mojang.authlib.yggdrasil.request.JoinMinecraftServerRequest;
|
||||||
|
import net.minecraft.util.com.mojang.authlib.yggdrasil.response.HasJoinedMinecraftServerResponse;
|
||||||
|
import net.minecraft.util.com.mojang.authlib.yggdrasil.response.MinecraftProfilePropertiesResponse;
|
||||||
|
import net.minecraft.util.com.mojang.authlib.yggdrasil.response.MinecraftTexturesPayload;
|
||||||
|
import net.minecraft.util.com.mojang.authlib.yggdrasil.response.Response;
|
||||||
|
import net.minecraft.util.com.mojang.util.UUIDTypeAdapter;
|
||||||
|
import net.minecraft.util.org.apache.commons.codec.Charsets;
|
||||||
|
import net.minecraft.util.org.apache.commons.codec.binary.Base64;
|
||||||
|
import net.minecraft.util.org.apache.commons.io.IOUtils;
|
||||||
|
|
||||||
|
import org.apache.logging.log4j.LogManager;
|
||||||
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
|
public class YggdrasilMinecraftSessionService extends HttpMinecraftSessionService {
|
||||||
|
private static final Logger LOGGER = LogManager.getLogger();
|
||||||
|
private static final String BASE_URL = "https://sessionserver.mojang.com/session/minecraft/";
|
||||||
|
private static final URL JOIN_URL = HttpAuthenticationService.constantURL("https://sessionserver.mojang.com/session/minecraft/join");
|
||||||
|
private static final URL CHECK_URL = HttpAuthenticationService.constantURL("https://sessionserver.mojang.com/session/minecraft/hasJoined");
|
||||||
|
private final PublicKey publicKey;
|
||||||
|
private final Gson gson = (new GsonBuilder()).registerTypeAdapter(UUID.class, new UUIDTypeAdapter()).create();
|
||||||
|
|
||||||
|
private static ProfileCache _profileCache;
|
||||||
|
|
||||||
|
public static void setProfileCache(ProfileCache cacher)
|
||||||
|
{
|
||||||
|
_profileCache = cacher;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected YggdrasilMinecraftSessionService(YggdrasilAuthenticationService authenticationService) {
|
||||||
|
super(authenticationService);
|
||||||
|
|
||||||
|
try {
|
||||||
|
X509EncodedKeySpec e = new X509EncodedKeySpec(IOUtils.toByteArray(YggdrasilMinecraftSessionService.class.getResourceAsStream("/yggdrasil_session_pubkey.der")));
|
||||||
|
KeyFactory keyFactory = KeyFactory.getInstance("RSA");
|
||||||
|
this.publicKey = keyFactory.generatePublic(e);
|
||||||
|
} catch (Exception var4) {
|
||||||
|
throw new Error("Missing/invalid yggdrasil public key!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void joinServer(GameProfile profile, String authenticationToken, String serverId) throws AuthenticationException {
|
||||||
|
JoinMinecraftServerRequest request = new JoinMinecraftServerRequest();
|
||||||
|
request.accessToken = authenticationToken;
|
||||||
|
request.selectedProfile = profile.getId();
|
||||||
|
request.serverId = serverId;
|
||||||
|
this.getAuthenticationService().makeRequest(JOIN_URL, request, Response.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public GameProfile hasJoinedServer(GameProfile user, String serverId) throws AuthenticationUnavailableException {
|
||||||
|
HashMap arguments = new HashMap();
|
||||||
|
arguments.put("username", user.getName());
|
||||||
|
arguments.put("serverId", serverId);
|
||||||
|
URL url = HttpAuthenticationService.concatenateURL(CHECK_URL, HttpAuthenticationService.buildQuery(arguments));
|
||||||
|
|
||||||
|
try {
|
||||||
|
HasJoinedMinecraftServerResponse e = (HasJoinedMinecraftServerResponse)this.getAuthenticationService().makeRequest(url, (Object)null, HasJoinedMinecraftServerResponse.class);
|
||||||
|
if(e != null && e.getId() != null) {
|
||||||
|
GameProfile result = new GameProfile(e.getId(), user.getName());
|
||||||
|
if(e.getProperties() != null) {
|
||||||
|
result.getProperties().putAll(e.getProperties());
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
} catch (AuthenticationUnavailableException var7) {
|
||||||
|
throw var7;
|
||||||
|
} catch (AuthenticationException var8) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Map<Type, MinecraftProfileTexture> getTextures(GameProfile profile, boolean requireSecure) {
|
||||||
|
Property textureProperty = (Property)Iterables.getFirst(profile.getProperties().get("textures"), (Object)null);
|
||||||
|
if(textureProperty == null) {
|
||||||
|
return new HashMap();
|
||||||
|
} else {
|
||||||
|
if(requireSecure) {
|
||||||
|
if(!textureProperty.hasSignature()) {
|
||||||
|
LOGGER.error("Signature is missing from textures payload");
|
||||||
|
throw new InsecureTextureException("Signature is missing from textures payload");
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!textureProperty.isSignatureValid(this.publicKey)) {
|
||||||
|
LOGGER.error("Textures payload has been tampered with (signature invalid)");
|
||||||
|
throw new InsecureTextureException("Textures payload has been tampered with (signature invalid)");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
MinecraftTexturesPayload result;
|
||||||
|
try {
|
||||||
|
String e = new String(Base64.decodeBase64(textureProperty.getValue()), Charsets.UTF_8);
|
||||||
|
result = (MinecraftTexturesPayload)this.gson.fromJson(e, MinecraftTexturesPayload.class);
|
||||||
|
} catch (JsonParseException var6) {
|
||||||
|
LOGGER.error("Could not decode textures payload", var6);
|
||||||
|
return new HashMap();
|
||||||
|
}
|
||||||
|
|
||||||
|
return (Map)(result.getTextures() == null?new HashMap():result.getTextures());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public GameProfile fillProfileProperties(GameProfile profile, boolean requireSecure) {
|
||||||
|
if(profile.getId() == null) {
|
||||||
|
return profile;
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
if (requireSecure && _profileCache != null)
|
||||||
|
{
|
||||||
|
GameProfile repoProfile = _profileCache.attemptToLoadProfile(profile.getName());
|
||||||
|
if (repoProfile != null)
|
||||||
|
{
|
||||||
|
profile.getProperties().putAll(repoProfile.getProperties());
|
||||||
|
return repoProfile;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
URL e = HttpAuthenticationService.constantURL("https://sessionserver.mojang.com/session/minecraft/profile/" + UUIDTypeAdapter.fromUUID(profile.getId()));
|
||||||
|
e = HttpAuthenticationService.concatenateURL(e, "unsigned=" + !requireSecure);
|
||||||
|
MinecraftProfilePropertiesResponse response = (MinecraftProfilePropertiesResponse) this.getAuthenticationService().makeRequest(e, (Object) null, MinecraftProfilePropertiesResponse.class);
|
||||||
|
if (response == null)
|
||||||
|
{
|
||||||
|
LOGGER.debug("Couldn\'t fetch profile properties for " + profile + " as the profile does not exist");
|
||||||
|
return profile;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
GameProfile result = new GameProfile(response.getId(), response.getName());
|
||||||
|
result.getProperties().putAll(response.getProperties());
|
||||||
|
profile.getProperties().putAll(response.getProperties());
|
||||||
|
|
||||||
|
if (requireSecure && _profileCache != null)
|
||||||
|
{
|
||||||
|
_profileCache.cacheProfile(result);
|
||||||
|
System.out.println("Added new profile to repository");
|
||||||
|
}
|
||||||
|
LOGGER.debug("Successfully fetched profile properties for " + profile);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
} catch (AuthenticationException var6) {
|
||||||
|
LOGGER.warn("Couldn\'t look up profile properties for " + profile, var6);
|
||||||
|
return profile;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public YggdrasilAuthenticationService getAuthenticationService() {
|
||||||
|
return (YggdrasilAuthenticationService)super.getAuthenticationService();
|
||||||
|
}
|
||||||
|
}
|
Binary file not shown.
@ -13,12 +13,12 @@
|
|||||||
<orderEntry type="library" name="jedis" level="project" />
|
<orderEntry type="library" name="jedis" level="project" />
|
||||||
<orderEntry type="library" name="commons-pool2" level="project" />
|
<orderEntry type="library" name="commons-pool2" level="project" />
|
||||||
<orderEntry type="module" module-name="Mineplex.Core.Common" />
|
<orderEntry type="module" module-name="Mineplex.Core.Common" />
|
||||||
|
<orderEntry type="module" module-name="Classpath.Dummy" />
|
||||||
<orderEntry type="module" module-name="Mineplex.ServerData" />
|
<orderEntry type="module" module-name="Mineplex.ServerData" />
|
||||||
<orderEntry type="library" name="craftbukkit" level="project" />
|
<orderEntry type="library" name="craftbukkit" level="project" />
|
||||||
<orderEntry type="module" module-name="Mineplex.Database" />
|
<orderEntry type="module" module-name="Mineplex.Database" />
|
||||||
<orderEntry type="library" name="jooq" level="project" />
|
<orderEntry type="library" name="jooq" level="project" />
|
||||||
<orderEntry type="library" name="commons-dbcp2" level="project" />
|
<orderEntry type="library" name="commons-dbcp2" level="project" />
|
||||||
<orderEntry type="module" module-name="Classpath.Dummy" />
|
|
||||||
<orderEntry type="library" name="NoCheatPlus" level="project" />
|
<orderEntry type="library" name="NoCheatPlus" level="project" />
|
||||||
</component>
|
</component>
|
||||||
</module>
|
</module>
|
@ -32,22 +32,34 @@ public class TablistFix extends MiniPlugin
|
|||||||
if (!player.isOnline())
|
if (!player.isOnline())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
PacketPlayOutPlayerInfo packet = PacketPlayOutPlayerInfo.updateDisplayName(((CraftPlayer) player).getHandle());
|
|
||||||
|
|
||||||
if (UtilPlayer.is1_8(player))
|
|
||||||
{
|
|
||||||
UtilPlayer.sendPacket(player, packet);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (Player other : UtilServer.getPlayers())
|
for (Player other : UtilServer.getPlayers())
|
||||||
{
|
{
|
||||||
if (other.equals(player) || !other.canSee(player))
|
PacketPlayOutPlayerInfo packet = PacketPlayOutPlayerInfo.updateDisplayName(((CraftPlayer) other).getHandle(), ((CraftPlayer) player).getHandle());
|
||||||
continue;
|
PacketPlayOutPlayerInfo toLoginPlayer = PacketPlayOutPlayerInfo.updateDisplayName(((CraftPlayer) player).getHandle(), ((CraftPlayer) other).getHandle());
|
||||||
|
|
||||||
if (UtilPlayer.is1_8(other))
|
if (other.canSee(player) && UtilPlayer.is1_8(other))
|
||||||
UtilPlayer.sendPacket(other, packet);
|
UtilPlayer.sendPacket(other, packet);
|
||||||
|
|
||||||
|
if (player.canSee(other) && UtilPlayer.is1_8(player))
|
||||||
|
UtilPlayer.sendPacket(player, toLoginPlayer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, 20L);
|
}, 20L);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void refreshForPlayer(Player player)
|
||||||
|
{
|
||||||
|
if (!UtilPlayer.is1_8(player))
|
||||||
|
return;
|
||||||
|
|
||||||
|
for (Player other : UtilServer.getPlayers())
|
||||||
|
{
|
||||||
|
if (player.canSee(other))
|
||||||
|
{
|
||||||
|
PacketPlayOutPlayerInfo packet = PacketPlayOutPlayerInfo.updateDisplayName(((CraftPlayer) player).getHandle(), ((CraftPlayer) other).getHandle());
|
||||||
|
UtilPlayer.sendPacket(player, packet);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,71 @@
|
|||||||
|
package mineplex.core.profileCache;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
import net.minecraft.util.com.google.gson.Gson;
|
||||||
|
import net.minecraft.util.com.google.gson.GsonBuilder;
|
||||||
|
import net.minecraft.util.com.mojang.authlib.GameProfile;
|
||||||
|
import net.minecraft.util.com.mojang.authlib.properties.PropertyMap;
|
||||||
|
import net.minecraft.util.com.mojang.authlib.yggdrasil.ProfileCache;
|
||||||
|
import net.minecraft.util.com.mojang.authlib.yggdrasil.YggdrasilGameProfileRepository;
|
||||||
|
import net.minecraft.util.com.mojang.authlib.yggdrasil.YggdrasilMinecraftSessionService;
|
||||||
|
import net.minecraft.util.com.mojang.authlib.yggdrasil.response.ProfileSearchResultsResponse;
|
||||||
|
import net.minecraft.util.com.mojang.util.UUIDTypeAdapter;
|
||||||
|
|
||||||
|
import mineplex.core.MiniPlugin;
|
||||||
|
import mineplex.serverdata.Region;
|
||||||
|
import mineplex.serverdata.redis.RedisDataRepository;
|
||||||
|
import mineplex.serverdata.servers.ServerManager;
|
||||||
|
|
||||||
|
public class ProfileCacheManager extends MiniPlugin implements ProfileCache
|
||||||
|
{
|
||||||
|
private RedisDataRepository<ProfileData> _profileRepository;
|
||||||
|
private Gson _gson;
|
||||||
|
|
||||||
|
public ProfileCacheManager(JavaPlugin plugin)
|
||||||
|
{
|
||||||
|
super("Profile Cache", plugin);
|
||||||
|
|
||||||
|
_profileRepository = new RedisDataRepository<ProfileData>(ServerManager.getMasterConnection(), ServerManager.getSlaveConnection(),
|
||||||
|
Region.ALL, ProfileData.class, "profileCacheRepo");
|
||||||
|
|
||||||
|
GsonBuilder builder = new GsonBuilder();
|
||||||
|
builder.registerTypeAdapter(PropertyMap.class, new PropertyMap.Serializer());
|
||||||
|
builder.registerTypeAdapter(UUID.class, new UUIDTypeAdapter());
|
||||||
|
builder.registerTypeAdapter(ProfileSearchResultsResponse.class, new net.minecraft.util.com.mojang.authlib.yggdrasil.response.ProfileSearchResultsResponse.Serializer());
|
||||||
|
_gson = builder.create();
|
||||||
|
|
||||||
|
YggdrasilMinecraftSessionService.setProfileCache(this);
|
||||||
|
YggdrasilGameProfileRepository.setProfileCache(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public GameProfile attemptToLoadProfile(String playerName)
|
||||||
|
{
|
||||||
|
ProfileData profile = _profileRepository.getElement(playerName.toLowerCase());
|
||||||
|
|
||||||
|
if (profile != null)
|
||||||
|
{
|
||||||
|
PropertyMap propertyMap = _gson.fromJson(profile.getPropertyMap(), PropertyMap.class);
|
||||||
|
GameProfile gameProfile = new GameProfile(profile.getUuid(), profile.getPlayerName());
|
||||||
|
gameProfile.getProperties().putAll(propertyMap);
|
||||||
|
|
||||||
|
// System.out.println("Loaded profile " + playerName + " from repository!");
|
||||||
|
return gameProfile;
|
||||||
|
}
|
||||||
|
|
||||||
|
// System.out.println("Profile Null");
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void cacheProfile(GameProfile profile)
|
||||||
|
{
|
||||||
|
// System.out.println("Cached profile: " + profile.getName());
|
||||||
|
ProfileData data = new ProfileData(profile.getId(), profile.getName(), _gson.toJson(profile.getProperties()));
|
||||||
|
_profileRepository.addElement(data, 60 * 60 * 24); // 1 day
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,40 @@
|
|||||||
|
package mineplex.core.profileCache;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import mineplex.serverdata.data.Data;
|
||||||
|
|
||||||
|
public class ProfileData implements Data
|
||||||
|
{
|
||||||
|
private UUID _uuid;
|
||||||
|
private String _playerName;
|
||||||
|
private String _propertyMap;
|
||||||
|
|
||||||
|
public ProfileData(UUID uuid, String playerName, String propertyMap)
|
||||||
|
{
|
||||||
|
_uuid = uuid;
|
||||||
|
_playerName = playerName;
|
||||||
|
_propertyMap = propertyMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPlayerName()
|
||||||
|
{
|
||||||
|
return _playerName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPropertyMap()
|
||||||
|
{
|
||||||
|
return _propertyMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
public UUID getUuid()
|
||||||
|
{
|
||||||
|
return _uuid;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getDataId()
|
||||||
|
{
|
||||||
|
return _playerName.toLowerCase();
|
||||||
|
}
|
||||||
|
}
|
@ -10,6 +10,7 @@ import net.minecraft.server.v1_7_R4.EntityPlayer;
|
|||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
|
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
|
||||||
import org.bukkit.craftbukkit.v1_7_R4.event.CraftEventFactory;
|
import org.bukkit.craftbukkit.v1_7_R4.event.CraftEventFactory;
|
||||||
|
import org.bukkit.entity.HumanEntity;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
@ -118,7 +119,7 @@ public abstract class ShopBase<PluginType extends MiniPlugin> implements Listene
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected ShopPageBase<PluginType, ? extends ShopBase<PluginType>> getOpeningPageForPlayer(Player player)
|
protected ShopPageBase<PluginType, ? extends ShopBase<PluginType>> getOpeningPageForPlayer(HumanEntity player)
|
||||||
{
|
{
|
||||||
return _playerPageMap.get(player.getName());
|
return _playerPageMap.get(player.getName());
|
||||||
}
|
}
|
||||||
@ -126,10 +127,19 @@ public abstract class ShopBase<PluginType extends MiniPlugin> implements Listene
|
|||||||
@EventHandler
|
@EventHandler
|
||||||
public void onInventoryClick(InventoryClickEvent event)
|
public void onInventoryClick(InventoryClickEvent event)
|
||||||
{
|
{
|
||||||
if (_playerPageMap.containsKey(event.getWhoClicked().getName()) && _playerPageMap.get(event.getWhoClicked().getName()).getName().equalsIgnoreCase(event.getInventory().getName()))
|
if (isPlayerInShop(event.getWhoClicked()))
|
||||||
{
|
{
|
||||||
_playerPageMap.get(event.getWhoClicked().getName()).playerClicked(event);
|
ShopPageBase<?,?> page = getOpeningPageForPlayer(event.getWhoClicked());
|
||||||
event.setCancelled(true);
|
|
||||||
|
if (page.matchesInventory(event.getInventory()))
|
||||||
|
{
|
||||||
|
_playerPageMap.get(event.getWhoClicked().getName()).playerClicked(event);
|
||||||
|
|
||||||
|
if (event.getRawSlot() < page.getSize())
|
||||||
|
{
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -238,7 +248,7 @@ public abstract class ShopBase<PluginType extends MiniPlugin> implements Listene
|
|||||||
|
|
||||||
protected abstract ShopPageBase<PluginType, ? extends ShopBase<PluginType>> buildPagesFor(Player player);
|
protected abstract ShopPageBase<PluginType, ? extends ShopBase<PluginType>> buildPagesFor(Player player);
|
||||||
|
|
||||||
public boolean isPlayerInShop(Player player)
|
public boolean isPlayerInShop(HumanEntity player)
|
||||||
{
|
{
|
||||||
return _playerPageMap.containsKey(player.getName());
|
return _playerPageMap.containsKey(player.getName());
|
||||||
}
|
}
|
||||||
|
@ -135,27 +135,25 @@ public abstract class ShopPageBase<PluginType extends MiniPlugin, ShopType exten
|
|||||||
|
|
||||||
public void playerClicked(InventoryClickEvent event)
|
public void playerClicked(InventoryClickEvent event)
|
||||||
{
|
{
|
||||||
if (_buttonMap.containsKey(event.getRawSlot()))
|
int rawSlot = event.getRawSlot();
|
||||||
|
|
||||||
|
if (_buttonMap.containsKey(rawSlot))
|
||||||
{
|
{
|
||||||
_buttonMap.get(event.getRawSlot()).onClick(_player, event.getClick());
|
_buttonMap.get(event.getRawSlot()).onClick(_player, event.getClick());
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
else if (event.getRawSlot() != -999)
|
else if (rawSlot != -999 && rawSlot < inventory.getSize())
|
||||||
{
|
{
|
||||||
if (event.getRawSlot() < inventory.getSize())
|
playDenySound(_player);
|
||||||
{
|
event.setCancelled(true);
|
||||||
playDenySound(_player);
|
|
||||||
event.setCancelled(true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean matchesInventory(Inventory newInventory)
|
public boolean matchesInventory(Inventory newInventory)
|
||||||
{
|
{
|
||||||
return newInventory.getTitle() == inventory.getInventoryName();
|
return getName().equalsIgnoreCase(newInventory.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void playerOpened()
|
public void playerOpened()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -29,6 +29,7 @@ import mineplex.core.observer.ObserverManager;
|
|||||||
import mineplex.core.packethandler.PacketHandler;
|
import mineplex.core.packethandler.PacketHandler;
|
||||||
import mineplex.core.portal.Portal;
|
import mineplex.core.portal.Portal;
|
||||||
import mineplex.core.preferences.PreferencesManager;
|
import mineplex.core.preferences.PreferencesManager;
|
||||||
|
import mineplex.core.profileCache.ProfileCacheManager;
|
||||||
import mineplex.core.punish.Punish;
|
import mineplex.core.punish.Punish;
|
||||||
import mineplex.core.recharge.Recharge;
|
import mineplex.core.recharge.Recharge;
|
||||||
import mineplex.core.serverConfig.ServerConfiguration;
|
import mineplex.core.serverConfig.ServerConfiguration;
|
||||||
@ -78,6 +79,7 @@ public class Clans extends JavaPlugin
|
|||||||
ItemStackFactory.Initialize(this, false);
|
ItemStackFactory.Initialize(this, false);
|
||||||
Recharge.Initialize(this);
|
Recharge.Initialize(this);
|
||||||
VisibilityManager.Initialize(this);
|
VisibilityManager.Initialize(this);
|
||||||
|
new ProfileCacheManager(this);
|
||||||
|
|
||||||
_donationManager = new DonationManager(this, _clientManager, webServerAddress);
|
_donationManager = new DonationManager(this, _clientManager, webServerAddress);
|
||||||
|
|
||||||
|
@ -116,7 +116,10 @@ public class ClansManager extends MiniClientPlugin<ClientClan> implements IRelat
|
|||||||
private Teleport _teleport;
|
private Teleport _teleport;
|
||||||
private ConditionManager _condition;
|
private ConditionManager _condition;
|
||||||
private ClassCombatShop _classShop;
|
private ClassCombatShop _classShop;
|
||||||
|
|
||||||
private ClassManager _classManager;
|
private ClassManager _classManager;
|
||||||
|
public ClassManager getClassManager() { return _classManager; }
|
||||||
|
|
||||||
private WarManager _warManager;
|
private WarManager _warManager;
|
||||||
private ProjectileManager _projectileManager;
|
private ProjectileManager _projectileManager;
|
||||||
private WorldEventManager _worldEvent;
|
private WorldEventManager _worldEvent;
|
||||||
@ -515,7 +518,7 @@ public class ClansManager extends MiniClientPlugin<ClientClan> implements IRelat
|
|||||||
String message = event.getMessage();
|
String message = event.getMessage();
|
||||||
message = _chat.getFilteredMessage(event.getPlayer(), message);
|
message = _chat.getFilteredMessage(event.getPlayer(), message);
|
||||||
ClanRelation rel = _clanUtility.rel(clan, otherClan);
|
ClanRelation rel = _clanUtility.rel(clan, otherClan);
|
||||||
String formatted = rel.getColor(true) + clan.getName() + " " + rel.getColor(false) + event.getPlayer().getName() + " " + C.cWhite + message;
|
String formatted = rel.getColor(true) + clan.getName() + " " + C.cYellow + event.getPlayer().getName() + " " + C.cWhite + message;
|
||||||
other.sendMessage(formatted);
|
other.sendMessage(formatted);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -34,16 +34,23 @@ public class ClansPlayerScoreboard extends PlayerScoreboard
|
|||||||
for (Player otherPlayer : Bukkit.getOnlinePlayers())
|
for (Player otherPlayer : Bukkit.getOnlinePlayers())
|
||||||
{
|
{
|
||||||
if (otherPlayer.equals(player))
|
if (otherPlayer.equals(player))
|
||||||
continue;
|
{
|
||||||
|
ClanInfo clan = _clansManager.getClan(player);
|
||||||
|
ClanRelation rel = _clansManager.getClanUtility().rel(clan, clan);
|
||||||
|
// Add Self to Self
|
||||||
|
add(getScoreboard(), otherPlayer, clan, rel);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ClanInfo clan = _clansManager.getClan(player);
|
||||||
|
ClanInfo otherClan = _clansManager.getClan(otherPlayer);
|
||||||
|
ClanRelation rel = _clansManager.getClanUtility().rel(clan, otherClan);
|
||||||
|
|
||||||
ClanInfo clan = _clansManager.getClan(player);
|
// Add Other to Self
|
||||||
ClanInfo otherClan = _clansManager.getClan(otherPlayer);
|
add(getScoreboard(), otherPlayer, otherClan, rel);
|
||||||
ClanRelation rel = _clansManager.getClanUtility().rel(clan, otherClan);
|
// Add Self to Other
|
||||||
|
add(otherPlayer.getScoreboard(), player, clan, rel);
|
||||||
// Add Other to Self
|
}
|
||||||
add(getScoreboard(), otherPlayer, otherClan, rel);
|
|
||||||
// Add Self to Other
|
|
||||||
add(otherPlayer.getScoreboard(), player, clan, rel);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,6 +5,7 @@ import org.bukkit.event.EventHandler;
|
|||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
import mineplex.core.MiniPlugin;
|
import mineplex.core.MiniPlugin;
|
||||||
|
import mineplex.core.TablistFix;
|
||||||
import mineplex.core.account.CoreClientManager;
|
import mineplex.core.account.CoreClientManager;
|
||||||
import mineplex.core.donation.DonationManager;
|
import mineplex.core.donation.DonationManager;
|
||||||
import mineplex.core.scoreboard.PlayerScoreboard;
|
import mineplex.core.scoreboard.PlayerScoreboard;
|
||||||
@ -72,6 +73,7 @@ public class ClansScoreboardManager extends ScoreboardManager
|
|||||||
for (Player player : clanInfo.getOnlinePlayers())
|
for (Player player : clanInfo.getOnlinePlayers())
|
||||||
{
|
{
|
||||||
refresh(player);
|
refresh(player);
|
||||||
|
TablistFix.refreshForPlayer(player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,6 +4,8 @@ import java.util.HashMap;
|
|||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
|
||||||
import mineplex.core.MiniPlugin;
|
import mineplex.core.MiniPlugin;
|
||||||
|
import mineplex.minecraft.game.classcombat.Class.ClientClass;
|
||||||
|
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
|
||||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||||
import mineplex.minecraft.game.core.damage.DamageManager;
|
import mineplex.minecraft.game.core.damage.DamageManager;
|
||||||
import mineplex.core.itemstack.ItemStackFactory;
|
import mineplex.core.itemstack.ItemStackFactory;
|
||||||
@ -43,6 +45,7 @@ import org.bukkit.event.block.BlockIgniteEvent;
|
|||||||
import org.bukkit.event.block.BlockIgniteEvent.IgniteCause;
|
import org.bukkit.event.block.BlockIgniteEvent.IgniteCause;
|
||||||
import org.bukkit.event.block.BlockPlaceEvent;
|
import org.bukkit.event.block.BlockPlaceEvent;
|
||||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||||
|
import org.bukkit.event.entity.EntityShootBowEvent;
|
||||||
import org.bukkit.event.entity.EntitySpawnEvent;
|
import org.bukkit.event.entity.EntitySpawnEvent;
|
||||||
import org.bukkit.event.entity.FoodLevelChangeEvent;
|
import org.bukkit.event.entity.FoodLevelChangeEvent;
|
||||||
import org.bukkit.event.player.PlayerBucketEmptyEvent;
|
import org.bukkit.event.player.PlayerBucketEmptyEvent;
|
||||||
@ -71,6 +74,23 @@ public class Gameplay extends MiniPlugin
|
|||||||
_foodDecrease = new WeightSet<Boolean>(new Weight<Boolean>(10, true), new Weight<Boolean>(90, false));
|
_foodDecrease = new WeightSet<Boolean>(new Weight<Boolean>(10, true), new Weight<Boolean>(90, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onBowShoot(EntityShootBowEvent event)
|
||||||
|
{
|
||||||
|
if (event.getEntity() instanceof Player)
|
||||||
|
{
|
||||||
|
Player player = (Player) event.getEntity();
|
||||||
|
ClientClass playerClass = _clansManager.getClassManager().Get(player);
|
||||||
|
|
||||||
|
if (!playerClass.IsGameClass(ClassType.Assassin, ClassType.Ranger))
|
||||||
|
{
|
||||||
|
notify(player, "You cannot use bows without the proper class!");
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void BucketEmpty(PlayerBucketEmptyEvent event)
|
public void BucketEmpty(PlayerBucketEmptyEvent event)
|
||||||
{
|
{
|
||||||
@ -591,4 +611,9 @@ public class Gameplay extends MiniPlugin
|
|||||||
{
|
{
|
||||||
return _damageManager;
|
return _damageManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void notify(Player player, String message)
|
||||||
|
{
|
||||||
|
UtilPlayer.message(player, F.main("Clans", message));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
package mineplex.game.clans.items.smelting;
|
package mineplex.game.clans.items.smelting;
|
||||||
|
|
||||||
|
import mineplex.core.common.util.F;
|
||||||
|
import mineplex.core.common.util.UtilPlayer;
|
||||||
import mineplex.game.clans.items.GearManager;
|
import mineplex.game.clans.items.GearManager;
|
||||||
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
@ -19,7 +21,7 @@ public class Smelter
|
|||||||
player.getInventory().setItemInHand(returns);
|
player.getInventory().setItemInHand(returns);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Notify player of smelt success/failure?
|
notify(player, "You have successfully smelted your item!");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ItemStack smeltItem(ItemStack item)
|
public static ItemStack smeltItem(ItemStack item)
|
||||||
@ -109,4 +111,9 @@ public class Smelter
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void notify(Player player, String message)
|
||||||
|
{
|
||||||
|
UtilPlayer.message(player, F.main("Smelter", message));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,67 @@
|
|||||||
|
package mineplex.game.clans.shop;
|
||||||
|
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import mineplex.core.account.CoreClientManager;
|
||||||
|
import mineplex.core.donation.DonationManager;
|
||||||
|
import mineplex.core.shop.ShopBase;
|
||||||
|
import mineplex.core.shop.page.ShopPageBase;
|
||||||
|
import mineplex.game.clans.Clans;
|
||||||
|
import mineplex.game.clans.clans.ClansManager;
|
||||||
|
|
||||||
|
public abstract class ClansShopPage<T extends ShopBase<ClansManager>> extends ShopPageBase<ClansManager, T>
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
* @param plugin
|
||||||
|
* @param shop
|
||||||
|
* @param clientManager
|
||||||
|
* @param donationManager
|
||||||
|
* @param name
|
||||||
|
* @param player
|
||||||
|
* @param slots
|
||||||
|
*/
|
||||||
|
public ClansShopPage(ClansManager plugin, T shop, CoreClientManager clientManager,
|
||||||
|
DonationManager donationManager, String name, Player player, int slots)
|
||||||
|
{
|
||||||
|
super(plugin, shop, clientManager, donationManager, name, player, slots);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
* @param plugin
|
||||||
|
* @param shop
|
||||||
|
* @param clientManager
|
||||||
|
* @param donationManager
|
||||||
|
* @param name
|
||||||
|
* @param player
|
||||||
|
*/
|
||||||
|
public ClansShopPage(ClansManager plugin, T shop, CoreClientManager clientManager,
|
||||||
|
DonationManager donationManager, String name, Player player)
|
||||||
|
{
|
||||||
|
super(plugin, shop, clientManager, donationManager, name, player);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addShopItem(int slot, Material material, int buyPrice, int sellPrice)
|
||||||
|
{
|
||||||
|
addShopItem(slot, material, buyPrice, sellPrice, Clans.prettifyName(material));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addShopItem(int slot, Material material, int buyPrice, int sellPrice, byte data)
|
||||||
|
{
|
||||||
|
addShopItem(slot, material, buyPrice, sellPrice, Clans.prettifyName(material));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addShopItem(int slot, Material material, int buyPrice, int sellPrice, String displayName)
|
||||||
|
{
|
||||||
|
addShopItem(slot, material, buyPrice, sellPrice, (byte)0, displayName, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addShopItem(int slot, Material material, int buyPrice, int sellPrice, byte data, String displayName, int amount)
|
||||||
|
{
|
||||||
|
PvpItem item = new PvpItem(material, data, 1, displayName, buyPrice, sellPrice, 64);
|
||||||
|
addButton(slot, item, new ShopItemButton<ClansShopPage<?>>(this, buyPrice, sellPrice, material, data, amount));
|
||||||
|
}
|
||||||
|
}
|
@ -1,115 +0,0 @@
|
|||||||
package mineplex.game.clans.shop;
|
|
||||||
|
|
||||||
import org.bukkit.craftbukkit.v1_7_R4.inventory.CraftInventory;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.event.inventory.ClickType;
|
|
||||||
import org.bukkit.inventory.ItemStack;
|
|
||||||
|
|
||||||
import mineplex.core.common.util.Callback;
|
|
||||||
import mineplex.core.common.util.F;
|
|
||||||
import mineplex.core.common.util.InventoryUtil;
|
|
||||||
import mineplex.core.common.util.UtilPlayer;
|
|
||||||
import mineplex.core.itemstack.ItemStackFactory;
|
|
||||||
import mineplex.core.shop.item.IButton;
|
|
||||||
import mineplex.core.shop.item.ShopItem;
|
|
||||||
import mineplex.core.shop.page.ShopPageBase;
|
|
||||||
import mineplex.game.clans.clans.ClansManager;
|
|
||||||
|
|
||||||
public class PvpShopButton<PageType extends ShopPageBase<ClansManager, ?>> implements IButton
|
|
||||||
{
|
|
||||||
protected PageType Page;
|
|
||||||
protected PvpItem Item;
|
|
||||||
|
|
||||||
public PvpShopButton(PageType page, PvpItem item)
|
|
||||||
{
|
|
||||||
Page = page;
|
|
||||||
Item = item;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onClick(final Player player, ClickType clickType)
|
|
||||||
{
|
|
||||||
int balance = Page.getDonationManager().Get(player.getName()).getGold();
|
|
||||||
int cost = Item.getPrice();
|
|
||||||
int tempAmount = Item.getAmount();
|
|
||||||
|
|
||||||
if (clickType == ClickType.SHIFT_LEFT)
|
|
||||||
{
|
|
||||||
cost *= Item.getBulkCount() == -1 ? 1 : Item.getBulkCount();
|
|
||||||
tempAmount = Item.getBulkCount() == -1 ? Item.getAmount() : Item.getBulkCount();
|
|
||||||
}
|
|
||||||
|
|
||||||
final int deliveryAmount = tempAmount;
|
|
||||||
|
|
||||||
if (clickType == ClickType.LEFT || clickType == ClickType.SHIFT_LEFT)
|
|
||||||
{
|
|
||||||
if (cost > balance)
|
|
||||||
{
|
|
||||||
Page.playDenySound(player);
|
|
||||||
UtilPlayer.message(player, F.main(Page.getPlugin().getName(), "You do not have enough funds to purchase " + deliveryAmount + " " + Item.GetName() + "."));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Page.getDonationManager().rewardGold(new Callback<Boolean>()
|
|
||||||
{
|
|
||||||
public void run(Boolean result)
|
|
||||||
{
|
|
||||||
if (result)
|
|
||||||
{
|
|
||||||
Page.playAcceptSound(player);
|
|
||||||
ShopItem item = Item.clone();
|
|
||||||
item.setAmount(deliveryAmount);
|
|
||||||
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Item.getType(), Item.getData().getData(), Item.getAmount(), Item.GetName(), new String[] {}, player.getName() + " Shop", false));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Page.playDenySound(player);
|
|
||||||
UtilPlayer.message(player, F.main(Page.getPlugin().getName(), "An error occurred processing your purchase."));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}, "Clans", player.getName(), Page.getClientManager().Get(player).getAccountId(), -cost);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (clickType == ClickType.RIGHT || clickType == ClickType.SHIFT_RIGHT)
|
|
||||||
{
|
|
||||||
int removed = 1;
|
|
||||||
ItemStack dumbItem = new ItemStack(Item.getType(), Item.getAmount(), Item.getDurability());
|
|
||||||
|
|
||||||
if (InventoryUtil.first((CraftInventory)player.getInventory(), 36, dumbItem, true) == -1)
|
|
||||||
{
|
|
||||||
Page.playDenySound(player);
|
|
||||||
UtilPlayer.message(player, F.main(Page.getPlugin().getName(), "You do not have " + deliveryAmount + " " + Item.GetName() + " in your inventory."));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (clickType == ClickType.RIGHT)
|
|
||||||
{
|
|
||||||
if (player.getInventory().contains(Item.getType(), Item.getAmount()))
|
|
||||||
InventoryUtil.removeItem((CraftInventory)player.getInventory(), 36, dumbItem);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
removed = InventoryUtil.getCountOfObjectsRemoved((CraftInventory)player.getInventory(), 36, dumbItem);
|
|
||||||
|
|
||||||
final int creditAmount = removed * Item.getPrice() / 2;
|
|
||||||
System.out.println("Crediting " + player.getName() + " with " + creditAmount + " gold.");
|
|
||||||
Page.getDonationManager().rewardGold(new Callback<Boolean>()
|
|
||||||
{
|
|
||||||
public void run(Boolean result)
|
|
||||||
{
|
|
||||||
if (result)
|
|
||||||
{
|
|
||||||
Page.playAcceptSound(player);
|
|
||||||
System.out.println("Credited " + player.getName() + " with " + creditAmount + " gold.");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Page.playDenySound(player);
|
|
||||||
UtilPlayer.message(player, F.main(Page.getPlugin().getName(), "An error occurred processing your return."));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}, "Clans", player.getName(), Page.getClientManager().Get(player).getAccountId(), creditAmount);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,5 +1,6 @@
|
|||||||
package mineplex.game.clans.shop;
|
package mineplex.game.clans.shop;
|
||||||
|
|
||||||
|
import org.bukkit.Material;
|
||||||
import org.bukkit.craftbukkit.v1_7_R4.inventory.CraftInventory;
|
import org.bukkit.craftbukkit.v1_7_R4.inventory.CraftInventory;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.inventory.ClickType;
|
import org.bukkit.event.inventory.ClickType;
|
||||||
@ -18,15 +19,20 @@ public class ShopItemButton<T extends ShopPageBase<?, ?>> implements IButton
|
|||||||
{
|
{
|
||||||
private int _buyPrice;
|
private int _buyPrice;
|
||||||
private int _sellPrice;
|
private int _sellPrice;
|
||||||
|
private ItemStack _item;
|
||||||
private T _page;
|
private T _page;
|
||||||
private PvpItem _item;
|
|
||||||
|
|
||||||
public ShopItemButton(T page, PvpItem item, int buyPrice, int sellPrice)
|
public ShopItemButton(T page, int buyPrice, int sellPrice, Material material, byte data, int amount)
|
||||||
{
|
{
|
||||||
_page = page;
|
_page = page;
|
||||||
_item = item;
|
|
||||||
_sellPrice = sellPrice;
|
_sellPrice = sellPrice;
|
||||||
_buyPrice = buyPrice;
|
_buyPrice = buyPrice;
|
||||||
|
_item = new ItemStack(material, amount, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ShopItemButton(T page, int buyPrice, int sellPrice, Material material)
|
||||||
|
{
|
||||||
|
this(page, buyPrice, sellPrice, material, (byte)0, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -37,9 +43,8 @@ public class ShopItemButton<T extends ShopPageBase<?, ?>> implements IButton
|
|||||||
if (clickType == ClickType.SHIFT_RIGHT || clickType == ClickType.RIGHT)
|
if (clickType == ClickType.SHIFT_RIGHT || clickType == ClickType.RIGHT)
|
||||||
{
|
{
|
||||||
int amount = 1; // # of items removed/sold from inventory
|
int amount = 1; // # of items removed/sold from inventory
|
||||||
ItemStack dumbItem = new ItemStack(_item.getType(), amount);
|
|
||||||
|
|
||||||
if (!hasItem(player, dumbItem))
|
if (!hasItem(player, _item))
|
||||||
{
|
{
|
||||||
_page.playDenySound(player);
|
_page.playDenySound(player);
|
||||||
notify(player, "You do not have any of the appropriate item in your inventory!");
|
notify(player, "You do not have any of the appropriate item in your inventory!");
|
||||||
@ -48,11 +53,11 @@ public class ShopItemButton<T extends ShopPageBase<?, ?>> implements IButton
|
|||||||
|
|
||||||
if (shiftClick)
|
if (shiftClick)
|
||||||
{
|
{
|
||||||
amount = InventoryUtil.getCountOfObjectsRemoved((CraftInventory)player.getInventory(), 36, dumbItem);
|
amount = InventoryUtil.getCountOfObjectsRemoved((CraftInventory)player.getInventory(), 36, _item);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
InventoryUtil.removeItem((CraftInventory)player.getInventory(), 36, dumbItem);
|
InventoryUtil.removeItem((CraftInventory)player.getInventory(), 36, _item);
|
||||||
}
|
}
|
||||||
|
|
||||||
int reward = amount * _sellPrice;
|
int reward = amount * _sellPrice;
|
||||||
@ -108,7 +113,8 @@ public class ShopItemButton<T extends ShopPageBase<?, ?>> implements IButton
|
|||||||
|
|
||||||
private void giftItem(Player player, int amount)
|
private void giftItem(Player player, int amount)
|
||||||
{
|
{
|
||||||
ItemStack item = new ItemStack(_item.getType(), amount);
|
ItemStack item = _item.clone();
|
||||||
|
item.setAmount(amount);
|
||||||
player.getInventory().addItem(item);
|
player.getInventory().addItem(item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,9 +15,6 @@ import mineplex.core.shop.page.ShopPageBase;
|
|||||||
import mineplex.game.clans.clans.ClanInfo;
|
import mineplex.game.clans.clans.ClanInfo;
|
||||||
import mineplex.game.clans.clans.ClansManager;
|
import mineplex.game.clans.clans.ClansManager;
|
||||||
import mineplex.game.clans.economy.GoldManager;
|
import mineplex.game.clans.economy.GoldManager;
|
||||||
import mineplex.game.clans.shop.PvpItem;
|
|
||||||
import mineplex.game.clans.shop.PvpShopButton;
|
|
||||||
import mineplex.game.clans.shop.building.BuildingPage;
|
|
||||||
|
|
||||||
public class BankPage extends ShopPageBase<ClansManager, BankShop>
|
public class BankPage extends ShopPageBase<ClansManager, BankShop>
|
||||||
{
|
{
|
||||||
@ -120,11 +117,6 @@ public class BankPage extends ShopPageBase<ClansManager, BankShop>
|
|||||||
ShopItem shopItem = new ShopItem(Material.GOLD_RECORD, title, new String[] {" ", playerGoldString, purchaseString, goldString}, 0, true, true);
|
ShopItem shopItem = new ShopItem(Material.GOLD_RECORD, title, new String[] {" ", playerGoldString, purchaseString, goldString}, 0, true, true);
|
||||||
addButton(3, shopItem, button);
|
addButton(3, shopItem, button);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addPvpItem(int slot, PvpItem item)
|
|
||||||
{
|
|
||||||
addButton(slot, item, new PvpShopButton<BankPage>(this, item));
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean hasEnoughGold()
|
public boolean hasEnoughGold()
|
||||||
{
|
{
|
||||||
|
@ -37,6 +37,7 @@ public class CashInButton implements IButton
|
|||||||
GoldToken token = (GoldToken) cursorItem;
|
GoldToken token = (GoldToken) cursorItem;
|
||||||
GoldManager.getInstance().cashIn(player, token);
|
GoldManager.getInstance().cashIn(player, token);
|
||||||
player.setItemOnCursor(null); // Delete the gold token on cursor
|
player.setItemOnCursor(null); // Delete the gold token on cursor
|
||||||
|
_page.playAcceptSound(player);
|
||||||
_page.refresh();
|
_page.refresh();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,12 +7,11 @@ import mineplex.core.donation.DonationManager;
|
|||||||
import mineplex.core.shop.page.ShopPageBase;
|
import mineplex.core.shop.page.ShopPageBase;
|
||||||
import mineplex.game.clans.Clans;
|
import mineplex.game.clans.Clans;
|
||||||
import mineplex.game.clans.clans.ClansManager;
|
import mineplex.game.clans.clans.ClansManager;
|
||||||
|
import mineplex.game.clans.shop.ClansShopPage;
|
||||||
import mineplex.game.clans.shop.PvpItem;
|
import mineplex.game.clans.shop.PvpItem;
|
||||||
import mineplex.game.clans.shop.PvpShopButton;
|
|
||||||
import mineplex.game.clans.shop.ShopItemButton;
|
import mineplex.game.clans.shop.ShopItemButton;
|
||||||
import mineplex.game.clans.shop.mining.MiningPage;
|
|
||||||
|
|
||||||
public class BuildingPage extends ShopPageBase<ClansManager, BuildingShop>
|
public class BuildingPage extends ClansShopPage<BuildingShop>
|
||||||
{
|
{
|
||||||
public BuildingPage(ClansManager plugin, BuildingShop shop, CoreClientManager clientManager, DonationManager donationManager, org.bukkit.entity.Player player)
|
public BuildingPage(ClansManager plugin, BuildingShop shop, CoreClientManager clientManager, DonationManager donationManager, org.bukkit.entity.Player player)
|
||||||
{
|
{
|
||||||
@ -44,15 +43,4 @@ public class BuildingPage extends ShopPageBase<ClansManager, BuildingShop>
|
|||||||
addShopItem(24, Material.QUARTZ_BLOCK, 75, 15);
|
addShopItem(24, Material.QUARTZ_BLOCK, 75, 15);
|
||||||
addShopItem(25, Material.CLAY, 30, 6);
|
addShopItem(25, Material.CLAY, 30, 6);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addShopItem(int slot, Material material, int buyPrice, int sellPrice)
|
|
||||||
{
|
|
||||||
addShopItem(slot, material, buyPrice, sellPrice, (byte) 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addShopItem(int slot, Material material, int buyPrice, int sellPrice, byte data)
|
|
||||||
{
|
|
||||||
PvpItem item = new PvpItem(material, (byte)0, 1, Clans.prettifyName(material), buyPrice, sellPrice, 64);
|
|
||||||
addButton(slot, item, new ShopItemButton<BuildingPage>(this, item, buyPrice, sellPrice));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -7,10 +7,12 @@ import mineplex.core.donation.DonationManager;
|
|||||||
import mineplex.core.shop.page.ShopPageBase;
|
import mineplex.core.shop.page.ShopPageBase;
|
||||||
import mineplex.game.clans.Clans;
|
import mineplex.game.clans.Clans;
|
||||||
import mineplex.game.clans.clans.ClansManager;
|
import mineplex.game.clans.clans.ClansManager;
|
||||||
|
import mineplex.game.clans.shop.ClansShopPage;
|
||||||
import mineplex.game.clans.shop.PvpItem;
|
import mineplex.game.clans.shop.PvpItem;
|
||||||
import mineplex.game.clans.shop.ShopItemButton;
|
import mineplex.game.clans.shop.ShopItemButton;
|
||||||
|
import mineplex.game.clans.shop.mining.MiningShop;
|
||||||
|
|
||||||
public class FarmingPage extends ShopPageBase<ClansManager, FarmingShop>
|
public class FarmingPage extends ClansShopPage<FarmingShop>
|
||||||
{
|
{
|
||||||
public FarmingPage(ClansManager plugin, FarmingShop shop, CoreClientManager clientManager, DonationManager donationManager, org.bukkit.entity.Player player)
|
public FarmingPage(ClansManager plugin, FarmingShop shop, CoreClientManager clientManager, DonationManager donationManager, org.bukkit.entity.Player player)
|
||||||
{
|
{
|
||||||
@ -38,10 +40,4 @@ public class FarmingPage extends ShopPageBase<ClansManager, FarmingShop>
|
|||||||
addShopItem(15, Material.ROTTEN_FLESH, 5, 5);
|
addShopItem(15, Material.ROTTEN_FLESH, 5, 5);
|
||||||
addShopItem(16, Material.SPIDER_EYE, 5, 5);
|
addShopItem(16, Material.SPIDER_EYE, 5, 5);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addShopItem(int slot, Material material, int buyPrice, int sellPrice)
|
|
||||||
{
|
|
||||||
PvpItem item = new PvpItem(material, (byte)0, 1, Clans.prettifyName(material), buyPrice, sellPrice, 64);
|
|
||||||
addButton(slot, item, new ShopItemButton<FarmingPage>(this, item, buyPrice, sellPrice));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -7,10 +7,11 @@ import mineplex.core.donation.DonationManager;
|
|||||||
import mineplex.core.shop.page.ShopPageBase;
|
import mineplex.core.shop.page.ShopPageBase;
|
||||||
import mineplex.game.clans.Clans;
|
import mineplex.game.clans.Clans;
|
||||||
import mineplex.game.clans.clans.ClansManager;
|
import mineplex.game.clans.clans.ClansManager;
|
||||||
|
import mineplex.game.clans.shop.ClansShopPage;
|
||||||
import mineplex.game.clans.shop.PvpItem;
|
import mineplex.game.clans.shop.PvpItem;
|
||||||
import mineplex.game.clans.shop.ShopItemButton;
|
import mineplex.game.clans.shop.ShopItemButton;
|
||||||
|
|
||||||
public class MiningPage extends ShopPageBase<ClansManager, MiningShop>
|
public class MiningPage extends ClansShopPage<MiningShop>
|
||||||
{
|
{
|
||||||
public MiningPage(ClansManager plugin, MiningShop shop, CoreClientManager clientManager, DonationManager donationManager, org.bukkit.entity.Player player)
|
public MiningPage(ClansManager plugin, MiningShop shop, CoreClientManager clientManager, DonationManager donationManager, org.bukkit.entity.Player player)
|
||||||
{
|
{
|
||||||
@ -30,10 +31,4 @@ public class MiningPage extends ShopPageBase<ClansManager, MiningShop>
|
|||||||
addShopItem(6, Material.REDSTONE, 10, 2);
|
addShopItem(6, Material.REDSTONE, 10, 2);
|
||||||
addShopItem(7, Material.LAPIS_BLOCK, 500, 100);
|
addShopItem(7, Material.LAPIS_BLOCK, 500, 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addShopItem(int slot, Material material, int buyPrice, int sellPrice)
|
|
||||||
{
|
|
||||||
PvpItem item = new PvpItem(material, (byte)0, 1, Clans.prettifyName(material), buyPrice, sellPrice, 64);
|
|
||||||
addButton(slot, item, new ShopItemButton<MiningPage>(this, item, buyPrice, sellPrice));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -4,12 +4,10 @@ import org.bukkit.Material;
|
|||||||
|
|
||||||
import mineplex.core.account.CoreClientManager;
|
import mineplex.core.account.CoreClientManager;
|
||||||
import mineplex.core.donation.DonationManager;
|
import mineplex.core.donation.DonationManager;
|
||||||
import mineplex.core.shop.page.ShopPageBase;
|
|
||||||
import mineplex.game.clans.clans.ClansManager;
|
import mineplex.game.clans.clans.ClansManager;
|
||||||
import mineplex.game.clans.shop.PvpItem;
|
import mineplex.game.clans.shop.ClansShopPage;
|
||||||
import mineplex.game.clans.shop.PvpShopButton;
|
|
||||||
|
|
||||||
public class PvpPage extends ShopPageBase<ClansManager, PvpShop>
|
public class PvpPage extends ClansShopPage<PvpShop>
|
||||||
{
|
{
|
||||||
public PvpPage(ClansManager plugin, PvpShop shop, CoreClientManager clientManager, DonationManager donationManager, org.bukkit.entity.Player player)
|
public PvpPage(ClansManager plugin, PvpShop shop, CoreClientManager clientManager, DonationManager donationManager, org.bukkit.entity.Player player)
|
||||||
{
|
{
|
||||||
@ -21,49 +19,45 @@ public class PvpPage extends ShopPageBase<ClansManager, PvpShop>
|
|||||||
@Override
|
@Override
|
||||||
protected void buildPage()
|
protected void buildPage()
|
||||||
{
|
{
|
||||||
addPvpItem(9, new PvpItem(Material.GOLD_HELMET, (byte)0, 1, "Mage Helmet", 875, 175, 4));
|
addShopItem(9, Material.GOLD_HELMET, 875, 175, "Mage Helmet");
|
||||||
addPvpItem(18, new PvpItem(Material.GOLD_CHESTPLATE, (byte)0, 1, "Mage Chestplate", 1400, 280, 4));
|
addShopItem(18, Material.GOLD_CHESTPLATE, 1400, 280, "Mage Chestplate");
|
||||||
addPvpItem(27, new PvpItem(Material.GOLD_LEGGINGS, (byte)0, 1, "Mage Leggings", 1225, 245, 4));
|
addShopItem(27, Material.GOLD_LEGGINGS, 1225, 245, "Mage Leggings");
|
||||||
addPvpItem(36, new PvpItem(Material.GOLD_BOOTS, (byte)0, 1, "Mage Boots", 700, 140, 4));
|
addShopItem(36, Material.GOLD_BOOTS, 700, 140, "Mage Boots");
|
||||||
|
|
||||||
addPvpItem(10, new PvpItem(Material.LEATHER_HELMET, (byte)0, 1, "Assassin Helmet", 625, 125, 4));
|
|
||||||
addPvpItem(19, new PvpItem(Material.LEATHER_CHESTPLATE, (byte)0, 1, "Assassin Chestplate", 1000, 200, 4));
|
|
||||||
addPvpItem(28, new PvpItem(Material.LEATHER_LEGGINGS, (byte)0, 1, "Assassin Leggings", 875, 125, 4));
|
|
||||||
addPvpItem(37, new PvpItem(Material.LEATHER_BOOTS, (byte)0, 1, "Assassin Boots", 500, 100, 4));
|
|
||||||
|
|
||||||
addPvpItem(11, new PvpItem(Material.CHAINMAIL_HELMET, (byte)0, 1, "Ranger Helmet", 750, 150, 4));
|
|
||||||
addPvpItem(20, new PvpItem(Material.CHAINMAIL_CHESTPLATE, (byte)0, 1, "Ranger Chestplate", 1200, 240, 4));
|
|
||||||
addPvpItem(29, new PvpItem(Material.CHAINMAIL_LEGGINGS, (byte)0, 1, "Ranger Leggings", 1050, 210, 4));
|
|
||||||
addPvpItem(38, new PvpItem(Material.CHAINMAIL_BOOTS, (byte)0, 1, "Ranger Boots", 600, 120, 4));
|
|
||||||
|
|
||||||
addPvpItem(12, new PvpItem(Material.IRON_HELMET, (byte)0, 1, "Knight Helmet", 750, 150, 4));
|
addShopItem(10, Material.LEATHER_HELMET, 625, 125, "Assassin Helmet");
|
||||||
addPvpItem(21, new PvpItem(Material.IRON_CHESTPLATE, (byte)0, 1, "Knight Chestplate", 1200, 240, 4));
|
addShopItem(19, Material.LEATHER_CHESTPLATE, 1000, 200, "Assassin Chestplate");
|
||||||
addPvpItem(30, new PvpItem(Material.IRON_LEGGINGS, (byte)0, 1, "Knight Leggings", 1050, 210, 4));
|
addShopItem(28, Material.LEATHER_LEGGINGS, 875, 125, "Assassin Leggings");
|
||||||
addPvpItem(39, new PvpItem(Material.IRON_BOOTS, (byte)0, 1, "Knight Boots", 600, 120, 4));
|
addShopItem(37, Material.LEATHER_BOOTS, 500, 100, "Assassin Boots");
|
||||||
|
|
||||||
addPvpItem(13, new PvpItem(Material.DIAMOND_HELMET, (byte)0, 1, "Brute Helmet", 1000, 200, 4));
|
addShopItem(11, Material.CHAINMAIL_HELMET, 750, 150, "Ranger Helmet");
|
||||||
addPvpItem(22, new PvpItem(Material.DIAMOND_CHESTPLATE, (byte)0, 1, "Brute Chestplate", 1600, 320, 4));
|
addShopItem(20, Material.CHAINMAIL_CHESTPLATE, 1200, 240, "Ranger Chestplate");
|
||||||
addPvpItem(31, new PvpItem(Material.DIAMOND_LEGGINGS, (byte)0, 1, "Brute Leggings", 1400, 280, 4));
|
addShopItem(29, Material.CHAINMAIL_LEGGINGS, 1050, 210, "Ranger Leggings");
|
||||||
addPvpItem(40, new PvpItem(Material.DIAMOND_BOOTS, (byte)0, 1, "Brute Boots", 800, 160, 4));
|
addShopItem(38, Material.CHAINMAIL_BOOTS, 600, 120, "Ranger Boots");
|
||||||
|
|
||||||
addPvpItem(15, new PvpItem(Material.IRON_SWORD, (byte)0, 1, "Iron Sword", 320, 160, 4));
|
|
||||||
addPvpItem(16, new PvpItem(Material.DIAMOND_SWORD, (byte)0, 1, "Power Sword", 800, 400, 4));
|
|
||||||
addPvpItem(17, new PvpItem(Material.GOLD_SWORD, (byte)0, 1, "Booster Sword", 800, 400, 4));
|
|
||||||
|
|
||||||
addPvpItem(24, new PvpItem(Material.IRON_AXE, (byte)0, 1, "Iron Axe", 470, 95, 4));
|
|
||||||
addPvpItem(25, new PvpItem(Material.DIAMOND_AXE, (byte)0, 1, "Power Axe", 800, 400, 4));
|
|
||||||
addPvpItem(26, new PvpItem(Material.GOLD_AXE, (byte)0, 1, "Booster Axe", 800, 400, 4));
|
|
||||||
|
|
||||||
addPvpItem(33, new PvpItem(Material.BOW, (byte)0, 1, "Standard Bow", 175, 35, 4));
|
|
||||||
addPvpItem(34, new PvpItem(Material.ARROW, (byte)0, 16, "Arrows", 10, 2));
|
|
||||||
|
|
||||||
addPvpItem(51, new PvpItem(Material.ENCHANTMENT_TABLE, (byte)0, 1, "Class Shop", 30000));
|
addShopItem(12, Material.IRON_HELMET, 750, 150, "Knight Helmet");
|
||||||
addPvpItem(52, new PvpItem(Material.TNT, (byte)0, 1, "TNT", 30000, 1));
|
addShopItem(21, Material.IRON_CHESTPLATE, 1200, 240, "Knight Chestplate");
|
||||||
addPvpItem(53, new PvpItem(Material.BREWING_STAND_ITEM, (byte)0, 1, "TNT Generator", 300000));
|
addShopItem(30, Material.IRON_LEGGINGS, 1050, 210, "Knight Leggings");
|
||||||
|
addShopItem(39, Material.IRON_BOOTS, 600, 120, "Knight Boots");
|
||||||
|
|
||||||
|
addShopItem(13, Material.DIAMOND_HELMET, 1000, 200, "Brute Helmet");
|
||||||
|
addShopItem(22, Material.DIAMOND_CHESTPLATE, 1600, 320, "Brute Chestplate");
|
||||||
|
addShopItem(31, Material.DIAMOND_LEGGINGS, 1400, 280, "Brute Leggings");
|
||||||
|
addShopItem(40, Material.DIAMOND_BOOTS, 800, 160, "Brute Boots");
|
||||||
|
|
||||||
|
addShopItem(15, Material.IRON_SWORD, 320, 160, "Iron Sword");
|
||||||
|
addShopItem(16, Material.DIAMOND_SWORD, 800, 400, "Power Sword");
|
||||||
|
addShopItem(17, Material.GOLD_SWORD, 800, 400, "Booster Sword");
|
||||||
|
|
||||||
|
addShopItem(24, Material.IRON_AXE, 470, 95, "Iron Axe");
|
||||||
|
addShopItem(25, Material.DIAMOND_AXE, 800, 400, "Power Axe");
|
||||||
|
addShopItem(26, Material.GOLD_AXE, 800, 400, "Booster Axe");
|
||||||
|
|
||||||
|
addShopItem(33, Material.BOW, 175, 35, "Standard Bow");
|
||||||
|
addShopItem(34, Material.ARROW, 10, 2, (byte)0, "Arrows", 16);
|
||||||
|
|
||||||
|
//addPvpItem(51, new PvpItem(Material.ENCHANTMENT_TABLE, (byte)0, 1, "Class Shop", 30000));
|
||||||
|
//addPvpItem(52, new PvpItem(Material.TNT, (byte)0, 1, "TNT", 30000, 1));
|
||||||
|
//addPvpItem(53, new PvpItem(Material.BREWING_STAND_ITEM, (byte)0, 1, "TNT Generator", 300000));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addPvpItem(int slot, PvpItem item)
|
|
||||||
{
|
|
||||||
addButton(slot, item, new PvpShopButton<PvpPage>(this, item));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -116,7 +116,7 @@ public class Spawn extends MiniPlugin
|
|||||||
UtilTextMiddle.display(null, message, 0, 20, 0, cur);
|
UtilTextMiddle.display(null, message, 0, 20, 0, cur);
|
||||||
_clansManager.getCondition().Factory().Custom(COMBAT_TAG_NAME, cur, cur, ConditionType.CUSTOM, 1, 0, false, Material.FIRE, (byte)0, true);
|
_clansManager.getCondition().Factory().Custom(COMBAT_TAG_NAME, cur, cur, ConditionType.CUSTOM, 1, 0, false, Material.FIRE, (byte)0, true);
|
||||||
}
|
}
|
||||||
else if (!UtilTime.elapsed(lastDamager, COMBAT_TAG_DURATION + 1000))
|
else if (!UtilTime.elapsed(lastDamager, COMBAT_TAG_DURATION + 600))
|
||||||
{
|
{
|
||||||
UtilTextMiddle.display(null, ChatColor.GREEN + "Safe!", 0, 60, 20, cur);
|
UtilTextMiddle.display(null, ChatColor.GREEN + "Safe!", 0, 60, 20, cur);
|
||||||
}
|
}
|
||||||
|
@ -6,10 +6,7 @@ import org.bukkit.Material;
|
|||||||
import mineplex.core.account.CoreClientManager;
|
import mineplex.core.account.CoreClientManager;
|
||||||
import mineplex.core.donation.DonationManager;
|
import mineplex.core.donation.DonationManager;
|
||||||
import mineplex.core.shop.page.ShopPageBase;
|
import mineplex.core.shop.page.ShopPageBase;
|
||||||
import mineplex.game.clans.Clans;
|
|
||||||
import mineplex.game.clans.clans.ClansManager;
|
import mineplex.game.clans.clans.ClansManager;
|
||||||
import mineplex.game.clans.shop.PvpItem;
|
|
||||||
import mineplex.game.clans.shop.PvpShopButton;
|
|
||||||
import mineplex.game.clans.spawn.Spawn;
|
import mineplex.game.clans.spawn.Spawn;
|
||||||
|
|
||||||
public class TravelPage extends ShopPageBase<ClansManager, TravelShop>
|
public class TravelPage extends ShopPageBase<ClansManager, TravelShop>
|
||||||
|
@ -3,6 +3,8 @@ package mineplex.hub;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
|
import net.minecraft.util.com.mojang.authlib.yggdrasil.ProfileCache;
|
||||||
|
|
||||||
import mineplex.core.CustomTagFix;
|
import mineplex.core.CustomTagFix;
|
||||||
import mineplex.core.TablistFix;
|
import mineplex.core.TablistFix;
|
||||||
import mineplex.core.account.CoreClientManager;
|
import mineplex.core.account.CoreClientManager;
|
||||||
@ -34,6 +36,7 @@ import mineplex.core.pet.PetManager;
|
|||||||
import mineplex.core.poll.PollManager;
|
import mineplex.core.poll.PollManager;
|
||||||
import mineplex.core.portal.Portal;
|
import mineplex.core.portal.Portal;
|
||||||
import mineplex.core.preferences.PreferencesManager;
|
import mineplex.core.preferences.PreferencesManager;
|
||||||
|
import mineplex.core.profileCache.ProfileCacheManager;
|
||||||
import mineplex.core.projectile.ProjectileManager;
|
import mineplex.core.projectile.ProjectileManager;
|
||||||
import mineplex.core.punish.Punish;
|
import mineplex.core.punish.Punish;
|
||||||
import mineplex.core.recharge.Recharge;
|
import mineplex.core.recharge.Recharge;
|
||||||
@ -86,6 +89,7 @@ public class Hub extends JavaPlugin implements IRelation
|
|||||||
CoreClientManager clientManager = new CoreClientManager(this, webServerAddress);
|
CoreClientManager clientManager = new CoreClientManager(this, webServerAddress);
|
||||||
CommandCenter.Instance.setClientManager(clientManager);
|
CommandCenter.Instance.setClientManager(clientManager);
|
||||||
|
|
||||||
|
new ProfileCacheManager(this);
|
||||||
ItemStackFactory.Initialize(this, false);
|
ItemStackFactory.Initialize(this, false);
|
||||||
Recharge.Initialize(this);
|
Recharge.Initialize(this);
|
||||||
VisibilityManager.Initialize(this); Give.Initialize(this);
|
VisibilityManager.Initialize(this); Give.Initialize(this);
|
||||||
|
@ -14,15 +14,12 @@ import mineplex.core.donation.DonationManager;
|
|||||||
import mineplex.core.itemstack.ItemStackFactory;
|
import mineplex.core.itemstack.ItemStackFactory;
|
||||||
import mineplex.core.shop.page.ShopPageBase;
|
import mineplex.core.shop.page.ShopPageBase;
|
||||||
import mineplex.hub.server.ServerManager;
|
import mineplex.hub.server.ServerManager;
|
||||||
import mineplex.hub.server.ui.button.SelectBETAButton;
|
|
||||||
import mineplex.hub.server.ui.button.SelectBHButton;
|
|
||||||
import mineplex.hub.server.ui.button.SelectBLDButton;
|
import mineplex.hub.server.ui.button.SelectBLDButton;
|
||||||
import mineplex.hub.server.ui.button.SelectBRButton;
|
import mineplex.hub.server.ui.button.SelectBRButton;
|
||||||
import mineplex.hub.server.ui.button.SelectCSButton;
|
import mineplex.hub.server.ui.button.SelectCSButton;
|
||||||
import mineplex.hub.server.ui.button.SelectDMTButton;
|
import mineplex.hub.server.ui.button.SelectDMTButton;
|
||||||
import mineplex.hub.server.ui.button.SelectDOMButton;
|
import mineplex.hub.server.ui.button.SelectDOMButton;
|
||||||
import mineplex.hub.server.ui.button.SelectMINButton;
|
import mineplex.hub.server.ui.button.SelectMINButton;
|
||||||
import mineplex.hub.server.ui.button.SelectMSButton;
|
|
||||||
import mineplex.hub.server.ui.button.SelectPLAYERButton;
|
import mineplex.hub.server.ui.button.SelectPLAYERButton;
|
||||||
import mineplex.hub.server.ui.button.SelectSGButton;
|
import mineplex.hub.server.ui.button.SelectSGButton;
|
||||||
import mineplex.hub.server.ui.button.SelectSKYButton;
|
import mineplex.hub.server.ui.button.SelectSKYButton;
|
||||||
@ -196,9 +193,9 @@ public class ServerGameMenu extends ShopPageBase<ServerManager, QuickShop>
|
|||||||
getButtonMap().put(8, new SelectWIZButton(this));
|
getButtonMap().put(8, new SelectWIZButton(this));
|
||||||
|
|
||||||
getButtonMap().put(18, new SelectCSButton(this));
|
getButtonMap().put(18, new SelectCSButton(this));
|
||||||
getButtonMap().put(20, new SelectBHButton(this));
|
// getButtonMap().put(20, new SelectBHButton(this));
|
||||||
getButtonMap().put(22, new SelectSSMButton(this));
|
getButtonMap().put(22, new SelectSSMButton(this));
|
||||||
getButtonMap().put(24, new SelectMSButton(this));
|
// getButtonMap().put(24, new SelectMSButton(this));
|
||||||
getButtonMap().put(26, new SelectDMTButton(this));
|
getButtonMap().put(26, new SelectDMTButton(this));
|
||||||
getButtonMap().put(36, new SelectDOMButton(this));
|
getButtonMap().put(36, new SelectDOMButton(this));
|
||||||
getButtonMap().put(38, new SelectTDMButton(this));
|
getButtonMap().put(38, new SelectTDMButton(this));
|
||||||
|
@ -474,13 +474,21 @@ public class ClientClass
|
|||||||
{
|
{
|
||||||
return _gameClass;
|
return _gameClass;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean IsGameClass(ClassType type)
|
public boolean IsGameClass(ClassType... types)
|
||||||
{
|
{
|
||||||
if (GetGameClass() == null)
|
if (GetGameClass() == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
for (ClassType type : types)
|
||||||
|
{
|
||||||
|
if (type == GetGameClass().GetType())
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return GetGameClass().GetType() == type;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Collection<ISkill> GetSkills()
|
public Collection<ISkill> GetSkills()
|
||||||
|
@ -100,7 +100,7 @@ public class HeavyArrows extends Skill
|
|||||||
if (level == 0) return;
|
if (level == 0) return;
|
||||||
|
|
||||||
//Knockback
|
//Knockback
|
||||||
event.AddKnockback(GetName(), 1.1 + (0.1 * level));
|
event.AddKnockback(GetName(), 0.55d + (0.1 * level));
|
||||||
event.AddMod(GetName(), GetName(), 1 + level, true);
|
event.AddMod(GetName(), GetName(), 1 + level, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user