Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

JensenX

Members
  • Joined

  • Last visited

  1. I'm sure this has been answered somewhere else, but I have not been able to find it. I have an issue with the PlayerLoggedOutEvent triggering on player logout. Is there an alternative to this or am I just doing something wrong. RSSkills.java package Jensen.RSSkills; import java.nio.file.Paths; import java.util.ArrayList; import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.eventhandler.SubscribeEvent; import cpw.mods.fml.common.Mod.EventHandler; import cpw.mods.fml.common.event.FMLPreInitializationEvent; import cpw.mods.fml.common.registry.GameRegistry; @Mod(modid = RSSkills.MODID, version = RSSkills.VERSION) public class RSSkills { public static final String MODID = "RSSkills"; public static final String VERSION = "0.1"; public static final String DIR = Paths.get("").toAbsolutePath().toString(); public static ArrayList<PlayerSkills> playerSkills = new ArrayList<PlayerSkills>(); @EventHandler public void preInit(FMLPreInitializationEvent event) { FMLCommonHandler.instance().bus().register(new OnPlayerLogin()); FMLCommonHandler.instance().bus().register(new OnPlayerLogout()); } } OnPlayerLogout.java package Jensen.RSSkills; import java.io.BufferedWriter; import java.io.File; import java.io.IOException; import java.nio.charset.Charset; import java.nio.file.Files; import cpw.mods.fml.common.eventhandler.SubscribeEvent; import cpw.mods.fml.common.gameevent.PlayerEvent; public class OnPlayerLogout { @SubscribeEvent public void onLogout(PlayerEvent.PlayerLoggedOutEvent event){ String username = event.player.getDisplayName(); //save skills to txt file System.out.println("Save Skills for " + username); File skills = new File(RSSkills.DIR + "/" + username + ".txt"); System.out.println(skills.getAbsolutePath()); try(BufferedWriter writer = Files.newBufferedWriter(skills.toPath(), Charset.forName("US-ASCII")){ for(int i = 0; i < PlayerSkills.skillNames.length; i++){ writer.write(RSSkills.playerSkills.get(RSSkills.playerSkills.size()-1).xp[i] + "\n"); } writer.close(); } catch (IOException e) {e.printStackTrace();} } } PS: Help if you're going to help, if not do not bother replying. Thanks.[/code]

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.