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;
}
}
}
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);
}
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);
}
}
}
}
Aggregations