#160 - Perks checked through server thread.

This commit is contained in:
Kino 2017-08-04 20:17:21 -04:00
parent 0fd61ed0f8
commit ef9abec1a7
3 changed files with 32 additions and 11 deletions

View file

@ -12,17 +12,14 @@ import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.ai.attributes.AttributeModifier;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.server.management.PlayerList;
import net.minecraft.util.DamageSource;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.Vec3d;
import net.minecraftforge.fml.common.FMLCommonHandler;
import net.minecraftforge.fml.relauncher.ReflectionHelper;

View file

@ -28,10 +28,8 @@ import com.legacy.aether.common.Aether;
import com.legacy.aether.common.items.ItemsAether;
import com.legacy.aether.common.networking.AetherNetworkingManager;
import com.legacy.aether.common.networking.packets.PacketAchievement;
import com.legacy.aether.common.networking.packets.PacketPerkChanged;
import com.legacy.aether.common.player.capability.PlayerAetherProvider;
import com.legacy.aether.common.player.perks.AetherPerks;
import com.legacy.aether.common.player.perks.util.EnumAetherPerkType;
import com.legacy.aether.common.player.perks.AetherPerkThread;
import com.legacy.aether.common.registry.achievements.AchievementsAether;
import com.legacy.aether.common.registry.objects.AetherAchievement;
@ -151,11 +149,7 @@ public class PlayerAetherEvents
{
playerAether.accessories.markDirty();
boolean isDonator = AetherPerks.isDonator(player.getUniqueID());
playerAether.setDonator(isDonator);
AetherNetworkingManager.sendTo(new PacketPerkChanged(player.getEntityId(), EnumAetherPerkType.Information, isDonator), (EntityPlayerMP) player);
FMLCommonHandler.instance().getMinecraftServerInstance().addScheduledTask(new AetherPerkThread(playerAether));
}
}

View file

@ -0,0 +1,30 @@
package com.legacy.aether.common.player.perks;
import net.minecraft.entity.player.EntityPlayerMP;
import com.legacy.aether.common.networking.AetherNetworkingManager;
import com.legacy.aether.common.networking.packets.PacketPerkChanged;
import com.legacy.aether.common.player.PlayerAether;
import com.legacy.aether.common.player.perks.util.EnumAetherPerkType;
public class AetherPerkThread implements Runnable
{
private PlayerAether playerAether;
public AetherPerkThread(PlayerAether playerAether)
{
this.playerAether = playerAether;
}
@Override
public void run()
{
boolean isDonator = AetherPerks.isDonator(this.playerAether.thePlayer.getUniqueID());
this.playerAether.setDonator(isDonator);
AetherNetworkingManager.sendTo(new PacketPerkChanged(this.playerAether.thePlayer.getEntityId(), EnumAetherPerkType.Information, isDonator), (EntityPlayerMP) this.playerAether.thePlayer);
}
}