Donation perks fixed

This commit is contained in:
Kino 2016-12-28 21:10:34 -05:00
parent b8fee9aade
commit 9835768f27
4 changed files with 45 additions and 11 deletions

View file

@ -28,6 +28,8 @@ public class GuiAetherPerks extends GuiScreen
private EntityMoa moa;
public GuiButton perkMoa, perkHalo;
private GuiButton defualtSkin, enableHalo, confirmPreference;
private GuiTextField moaWingMarking, moaWing, moaBody, moaBodyMarking, moaEye, moaOutside;
@ -91,7 +93,7 @@ public class GuiAetherPerks extends GuiScreen
this.moaSkin.shouldUseDefualt(this.defualtSkin.displayString.contains("true"));
if (!this.enableHaloEditor || !AetherRankings.isRankedPlayer(this.player.thePlayer.getUniqueID()))
if (!this.enableHaloEditor)
{
this.enableHalo.visible = false;
}
@ -111,13 +113,18 @@ public class GuiAetherPerks extends GuiScreen
this.guiLeft = (this.width - 176) / 2;
this.guiTop = (this.height - 166) / 2;
this.buttonList.add(new GuiButton(1, 4, 17, 100, 20, "Moa Customizer"));
this.buttonList.add(new GuiButton(5, 110, 17, 100, 20, "Developer Perks"));
this.buttonList.add(this.perkMoa = new GuiButton(1, 4, 17, 100, 20, "Moa Customizer"));
this.buttonList.add(this.perkHalo = new GuiButton(5, 110, 17, 100, 20, "Developer Perks"));
this.buttonList.add(this.enableHalo = new GuiButton(6, this.width / 2 - 50, this.height - 20, 100, 20, "Enable Halo: "));
this.buttonList.add(this.defualtSkin = new GuiButton(2, this.width / 2 - 100, this.height - 20, 100, 20, "Default skin: " + this.player.donatorMoaSkin.shouldUseDefualt()));
this.buttonList.add(this.confirmPreference = new GuiButton(4, this.width / 2, this.height - 20, 100, 20, "Confirm Skin"));
if (!AetherRankings.isRankedPlayer(this.player.thePlayer.getUniqueID()))
{
this.perkHalo.visible = false;
}
this.enableHalo.displayString = this.enableHalo.displayString + Boolean.toString(this.player.shouldRenderHalo ? false : true);
this.moaEye = new GuiTextField(1, this.fontRendererObj, (this.width / 2) + 105, 70, 45, 20);

View file

@ -13,7 +13,7 @@ public class PacketPerkChanged extends AetherPacket<PacketPerkChanged>
public int entityID;
public boolean renderHalo;
public boolean renderHalo, isDonator;
public DonatorMoaSkin moaSkin;
@ -24,11 +24,19 @@ public class PacketPerkChanged extends AetherPacket<PacketPerkChanged>
}
public PacketPerkChanged(int entityID, EnumAetherPerkType type, boolean renderHalo)
public PacketPerkChanged(int entityID, EnumAetherPerkType type, boolean info)
{
this.entityID = entityID;
this.renderHalo = renderHalo;
this.perkType = type;
if (type == EnumAetherPerkType.Halo)
{
this.renderHalo = info;
}
else
{
this.isDonator = info;
}
}
public PacketPerkChanged(int entityID, EnumAetherPerkType type, DonatorMoaSkin moa)
@ -48,6 +56,10 @@ public class PacketPerkChanged extends AetherPacket<PacketPerkChanged>
{
this.renderHalo = buf.readBoolean();
}
else if (this.perkType == EnumAetherPerkType.Information)
{
this.isDonator = buf.readBoolean();
}
else if (this.perkType == EnumAetherPerkType.Moa)
{
this.moaSkin = DonatorMoaSkin.readMoaSkin(buf);
@ -64,6 +76,10 @@ public class PacketPerkChanged extends AetherPacket<PacketPerkChanged>
{
buf.writeBoolean(this.renderHalo);
}
else if (this.perkType == EnumAetherPerkType.Information)
{
buf.writeBoolean(this.isDonator);
}
else if (this.perkType == EnumAetherPerkType.Moa)
{
this.moaSkin.writeMoaSkin(buf);
@ -85,6 +101,10 @@ public class PacketPerkChanged extends AetherPacket<PacketPerkChanged>
{
instance.shouldRenderHalo = message.renderHalo;
}
else if (message.perkType == EnumAetherPerkType.Information)
{
instance.setDonator(message.isDonator);
}
else if (message.perkType == EnumAetherPerkType.Moa)
{
instance.donatorMoaSkin = message.moaSkin;

View file

@ -28,8 +28,10 @@ import com.legacy.aether.server.Aether;
import com.legacy.aether.server.items.ItemsAether;
import com.legacy.aether.server.networking.AetherNetworkingManager;
import com.legacy.aether.server.networking.packets.PacketAchievement;
import com.legacy.aether.server.networking.packets.PacketPerkChanged;
import com.legacy.aether.server.player.capability.PlayerAetherProvider;
import com.legacy.aether.server.player.perks.AetherPerks;
import com.legacy.aether.server.player.perks.util.EnumAetherPerkType;
import com.legacy.aether.server.registry.achievements.AchievementsAether;
import com.legacy.aether.server.registry.objects.AetherAchievement;
@ -39,6 +41,7 @@ public class PlayerAetherEvents
private static final ResourceLocation PLAYER_LOCATION = new ResourceLocation(Aether.modid, "aether_players");
@SubscribeEvent
@SuppressWarnings("deprecation")
public void PlayerConstructingEvent(AttachCapabilitiesEvent.Entity event)
{
if ((event.getEntity() instanceof EntityPlayer))
@ -69,7 +72,6 @@ public class PlayerAetherEvents
if (newPlayer != null)
{
newPlayer.loadNBTData(data);
newPlayer.hasTeleported = original.hasTeleported;
}
}
}
@ -141,13 +143,18 @@ public class PlayerAetherEvents
@SubscribeEvent
public void onPlayerLogin(PlayerLoggedInEvent event)
{
PlayerAether playerAether = PlayerAether.get(event.player);
EntityPlayer player = event.player;
PlayerAether playerAether = PlayerAether.get(player);
if (playerAether != null)
{
playerAether.accessories.markDirty();
playerAether.setDonator(AetherPerks.isDonator(event.player.getUniqueID()));
boolean isDonator = AetherPerks.isDonator(player.getUniqueID());
playerAether.setDonator(isDonator);
AetherNetworkingManager.sendTo(new PacketPerkChanged(player.getEntityId(), EnumAetherPerkType.Information, isDonator), (EntityPlayerMP) player);
}
}

View file

@ -2,7 +2,7 @@ package com.legacy.aether.server.player.perks.util;
public enum EnumAetherPerkType
{
Halo(0), Moa(1);
Information(0), Halo(1), Moa(2);
private int perkID;
@ -18,6 +18,6 @@ public enum EnumAetherPerkType
public static EnumAetherPerkType getPerkByID(int id)
{
return id == 0 ? Halo : Moa;
return id == 0 ? Information : id == 1 ? Halo : Moa;
}
}