I'm currently working on a Plugin, which lets Players decide, whether they want to load a 16x16 ResourcePack or a 32x32 one. The packs are forced (they're needed for the gameplay). My problem is, that when I select a pack it should do this:
p.setResourcePack("https://github.com/Ole1Tau1/RPG/blob/main/RPGPack.zip", "E3CED908E76C7390DDC4F47C22F6FF16", true);
But instead of loading it, the client gives me an error:
Server resource pack couldn't be applied
Any functionality that requires custom resources might not work as expected
Anybody got an idea what I did wrong?
Full code is here BTW: https://github.com/Ole1Tau1/RPG/tree/main/RPSelector/src/main/java/dev/onetone/rpg/rpselector
Your repository seems private. So, only you -with your account- can access to it. With this, for all players that tried to download it, it will return 404 error.
To fix this, you can:
Make your repository public. I think you don't want, but if it contains only the zip file, it's fine.
Create a second repository to host it. It can be a good solution if you already have another repo with a wiki or other help that are public.
Use something else to host it. A website on the server where spigot is running, another website or anything else, you can host the zip file then change the link in your plugin.
Related
Background:
I have a plugin which should give out links to helpfiles of other, currently installed, eclipse plugins.
At first I thought that I include those html files in my plugin, but I couldn't open them unless I copy them into the current workspace of the user. Since this is not an option, the most elegant way would be to use the eclipse-built-in help system.
So I need to access the eclipse help system programmatically to include the files into my code.
Does anyone know a workaround for this?
Edit: I guess I missed a central point: I generate an HTML-File, in which the links to the help system should be embedded.
When I open the helpfile to a given plugin, there is a link like this at the bottom:
http://127.0.0.1:11925/help/topic/plugin/help/html/maintopic.html?cp=5_1_2
The problem is: I can't access this document but I would need to.
From the Eclipse Platform API Specification, implement the IWorkbenchHelpSystem interface and call the displayHelp() method without an argument to programmatically open the Help window, or call the displayHelp() method with the context ID string as the single argument to programmatically open context-sensitive help for a specific context ID. Read the API for further information.
I’m coding my first java Desktop application using eclipse and I’m having difficulty deploying it. My project uses JavaFX2 and the e(fx)clipse plugin, the latter is in charge of generating the build.xml file.
ABOUT THE APP
The app, amongst other things, provides an interface where the user can create categories and associate these with labels. All modifications are saved within a single file (the data is stored as a serialized object.) and are supposed to be loaded automatically when the app is reopened.
THE PROBLEM
When build as an executable jar using a .xml file (Ant), the project runs fine within the folder where it gets created. I can run my application, modify data, and save everything once I’m done. When I reopen the app everything gets loaded as it should.
However, if I copy the folder elsewhere, I can no longer save any data. Everything else seems to work; the app will even load the data that was saved when it was in its original directory. I assume that this means that the app can still see the data file, but can no longer write to it.
WHAT IVE TRIED
I’ve read that warping the .jar around an installer may fix the issue; however, one of the goals for the app was to make it as portable as possible. Meaning that it should be possible to move it around from one directory/computer to another, ideally in a manner that is cross-platform friendly, without the need of installing it.
I’ve tried various things to get it to work. I’ve shifted the whole project to Netbeans (to produce a different build), I’ve modified the save/load method file path to make sure the right document is targeted, I’ve tweaked the .xml file the best I could, and I even tried to build the project using the javafxpackager. No matter what I do, when the build works, I get the same results.
Right now, I’m thinking that there may still be something wrong with the .xml file but I’ve got a hard time understanding how to modify it. Perhaps the problem is somehow caused by the way the data gets serialized. I know that at one point when I moved things around within my project, both the save and load methods could no longer interact with the data.
What I find strange is that when the project is moved the load method still works. If the problem is caused by changing the file path, how come only the save method ceases to function?
APP FILES AND STRUCTURE
+src
-(Main.java)
+controller
-(misc.javas)
+modelData
-(Library.java) -->the object that is serialized
+modelLogic
-(misc.javas)
+view
-(misc.javas)
+files
-(library.data) -->the file where the serialized object is saved
+lib
-(empty.empty)
So, is their anything I can do to solve my problem?
Thanks in advance.
In the end, the problem was rather simple. When I was moving the app, I was always putting it on the desktop, which, in the case of my PC, sets by default all content as read-only (in relation to the app's privileges). Because of this, the app could not modify any files that were within folders on the desktop.
Therefore, all I had to do was to move the app to another directory, such as C:\randomFolder, and the problem was solved.
So, if anyone has a similar problem, moving the app elsewhere may be the solution. Alternatively, taking full ownership of the folder and its content can also work.
When possible, it is usually better to have the app ask its user for a specific location to save its data.
I'm trying to make a Java game updater launcher for my game. Similar to how minecraft works. However, minecraft has only a few .jar's to download wheras I would need to redownload all of my game assets. Is there any easy way for Java to check a file for which operations need to be taken? One idea I had was using .7z files since those can be compressed really small. That wouldn't work though because I can't seem to get Java to hook onto 7zip operations. Another idea I had was if it determined if an update was needed it would read a file with a set of commands like this:
remove assets/models/malecharacter.obj
add assets/models/alien.obj
...etc
But I'm not sure this is very efficient and I am also not able to find a lot of help with managing files. Any help and ideas would be appreciated.
I made a Game Launcher in Java recently, I still have a few problems to solve like how to update the launcher itself.
Anyhow, for the game updates/versions I just have a "versions" folder with a folder for each downloaded version, it might not be the prettiest of solutions but it works for multiple versions and it's easy to make.
My launcher checks a URL from my dedicated server which has all available versions, which I call it versionlist, then since the versions folder on the server obeys a path order I can call any versions which are in the versionlist. I download the selected version and extract it to a separate version folder on the user's pc.
Up until now, when I needed to update the content of any pages, I have always had to update the source code directly and re-deploy the whole application. Right now, I want to implement a feature such that I can update the content of any HTML pages dynamically without having to re-deploy the application.
I tried to implement the feature with PrimeFaces's <p:editor> component but it does not work. To be more precise, my functions can correctly update the required page. When I goes to the source code folder, I can actually see my changes. However, subsequent requests for the page still render the old content.
I'd be very grateful if you could show me what I have done wrong. I'd also appreciate it very much if you could show me any other ways to achieve the same goal.
I think you are editing your work-space from your deployment. :)
You have 2 places with the code. One is deployed, and the other in your "working space".
First, it sounds to me like you want your working space to be the deployment. This way whenever you are editing something, you will be changing the deployment directly. For that, simply create a new project in your IDE and point it to the deployment folder.
I bet that :
C:\\Users\\James\\Documents\\NetBeansProjects\\MyProject\\MyProject-war\\web\\
points to your work-space and not the deployment. so effectively, your deployment is editing your work-space.
I think you are looking for this one:
FacesContext.getCurrentInstance().getExternalContext().getRealPath("/")
and if you want the location of the WEB-INF
use the following
String fullpath = FacesContext.getCurrentInstance().getExternalContext().getRealPath("/")+File.separator+"WEB-INF";
and so on...
My code actually was working perfectly. From the above answer of user1068746, I did some research and found this article. The solution is very simple: creating a virtual directory mapping to my hard-disk's directory. As a result, any updates to my files on the hard-disk will immediately be visible to future requests.
Good afternoon
I'm in the search of a solid way to determine if an external jar exist on the client machine, who're going to use my java applet. Right now what I'm doing is this in pseudo code
try
{
controller.init()
}
catch Exception(Jar does not exist)
{
make pretty screen to tell users to download setup file
fire up browser with link to setup file
}
However the exception that is thrown at me is UnsatisfiedLinkError which I can't catch as it's not something that's recoverable. This basically means I'm "left" with a browser window with the link to the setup file, but no explanation as to why it has come up.
Of course an "easy" fix is just to add to the html page that hosts the applet that "If Java blows up, please just download the setup file that is suggested", however I would much rather like a programmatical solution, and it's here you guys and gals come into the picture :)
Thanks in advance for any and all answers.
/Jeb
You can check whether the jar exists in the classpath (System.getProperty("java.class.path")).
Another approach is to see if you can load the class file resource. Say you are going to load com.thirdparty.SomeClass. Then, in whichever class that is calling controller.init() you can try
this.getClass().getCloassLoader.findResource("com.thirdparty.SomeClass.class")
this.getClass().getClassLoader().getResource("com.thirdparty.SomeClass.class")
If the return value is not null then the class loading should hopefully succeed.
Of course, the classes in jar may themselves depend on other classes...you have to decide how you want to handle that situation.