Search in sources :

Example 1 with PlayerIdentifier

use of logisticspipes.utils.PlayerIdentifier in project LogisticsPipes by RS485.

the class CraftingPermissionManager method tick.

public void tick() {
    if (tick++ % 100 != 0) {
        return;
    }
    tick = 1;
    for (PlayerIdentifier player : serverCache.keySet()) {
        if (serverCache.get(player).getValue1() + 30000 < System.currentTimeMillis()) {
            serverCache.remove(player);
            tick = 0;
            return;
        }
    }
}
Also used : PlayerIdentifier(logisticspipes.utils.PlayerIdentifier)

Example 2 with PlayerIdentifier

use of logisticspipes.utils.PlayerIdentifier in project LogisticsPipes by RS485.

the class LogisticsEventListener method onPlayerLogout.

@SubscribeEvent
public void onPlayerLogout(PlayerLoggedOutEvent event) {
    SimpleServiceLocator.serverBufferHandler.clear(event.player);
    PlayerIdentifier ident = PlayerIdentifier.get(event.player);
    PlayerConfig config = LogisticsEventListener.playerConfigs.get(ident);
    if (config != null) {
        config.writeToFile();
    }
    LogisticsEventListener.playerConfigs.remove(ident);
}
Also used : PlayerIdentifier(logisticspipes.utils.PlayerIdentifier) PlayerConfig(logisticspipes.config.PlayerConfig) SubscribeEvent(cpw.mods.fml.common.eventhandler.SubscribeEvent)

Example 3 with PlayerIdentifier

use of logisticspipes.utils.PlayerIdentifier in project LogisticsPipes by RS485.

the class LogisticsEventListener method onItemCrafting.

@SubscribeEvent
public void onItemCrafting(PlayerEvent.ItemCraftedEvent event) {
    if (event.player.isServerWorld() && !event.crafting.isEmpty()) {
        if (event.crafting.getItem().getRegistryName().getResourceDomain().equals(LPConstants.LP_MOD_ID)) {
            PlayerIdentifier identifier = PlayerIdentifier.get(event.player);
            PlayerConfiguration config = LogisticsPipes.getServerConfigManager().getPlayerConfiguration(identifier);
            if (!config.getHasCraftedLPItem() && !LogisticsPipes.isDEBUG()) {
                ItemStack book = new ItemStack(LPItems.itemGuideBook, 1);
                event.player.addItemStackToInventory(book);
                config.setHasCraftedLPItem(true);
                LogisticsPipes.getServerConfigManager().setPlayerConfiguration(identifier, config);
            }
        }
    }
}
Also used : PlayerConfiguration(network.rs485.logisticspipes.config.PlayerConfiguration) PlayerIdentifier(logisticspipes.utils.PlayerIdentifier) ItemStack(net.minecraft.item.ItemStack) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent)

Aggregations

PlayerIdentifier (logisticspipes.utils.PlayerIdentifier)3 SubscribeEvent (cpw.mods.fml.common.eventhandler.SubscribeEvent)1 PlayerConfig (logisticspipes.config.PlayerConfig)1 ItemStack (net.minecraft.item.ItemStack)1 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)1 PlayerConfiguration (network.rs485.logisticspipes.config.PlayerConfiguration)1