Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
ServerPackCreatorExampleAddon
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
JetBrains YouTrack
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Griefed
ServerPackCreatorExampleAddon
Merge requests
!24
Rewrite with plf4j
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Rewrite with plf4j
rewriteWithPlf4j
into
master
Overview
0
Commits
3
Pipelines
0
Changes
12
Merged
Griefed
requested to merge
rewriteWithPlf4j
into
master
3 years ago
Overview
0
Commits
3
Pipelines
0
Changes
12
Expand
0
0
Merge request reports
Compare
master
version 1
7807b724
3 years ago
master (base)
and
latest version
latest version
ab71fa11
3 commits,
3 years ago
version 1
7807b724
2 commits,
3 years ago
12 files
+
386
−
1011
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
12
Search (e.g. *.vue) (Ctrl+P)
src/main/java/de/griefed/serverpackcreatoraddonexample/configuration/AddonConfiguration.java deleted
100644 → 0
+
0
−
81
Options
/*
* The MIT License (MIT)
*
* Copyright (C) 2021 Griefed
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package
de.griefed.serverpackcreatoraddonexample.configuration
;
import
com.typesafe.config.Config
;
import
com.typesafe.config.ConfigFactory
;
import
de.griefed.serverpackcreatoraddonexample.Main
;
import
java.net.MalformedURLException
;
import
java.net.URL
;
/**
* Example class for reading the addon.conf-file and getting values from it.
* @author Griefed
*/
public
class
AddonConfiguration
{
private
final
Config
ADDONCONFIGURATION
;
/**
* Constructor for the AddonConfiguration.class which automatically parses the addon.conf-file in the JAR-file.
* @author Griefed
*/
public
AddonConfiguration
()
{
URL
urlToConfig
=
null
;
String
addonLocation
=
null
;
try
{
addonLocation
=
Main
.
class
.
getProtectionDomain
().
getCodeSource
().
getLocation
().
getFile
();
urlToConfig
=
new
URL
(
String
.
format
(
"jar:file:%s!/addon.conf"
,
addonLocation
));
}
catch
(
MalformedURLException
ex
)
{
ex
.
printStackTrace
();
}
assert
urlToConfig
!=
null
;
this
.
ADDONCONFIGURATION
=
ConfigFactory
.
parseURL
(
urlToConfig
);
}
/**
* Getter for the addon configuration.
* @author Griefed
* @return Config. Returns the {@link Config} object which was initiated in the constructor of this class.
*/
public
Config
getAddonConfiguration
()
{
return
ADDONCONFIGURATION
;
}
/**
* Uses {@link #getAddonConfiguration()} to retrieve the string from a config parameter in the addon.conf-file.
* @author Griefed
* @return String. Returns the value of <code>serverpackcreator.addon.someconfig</code> giving an example on how to
* work with the addon.conf-file.
*/
public
String
exampleConfig
()
{
return
getAddonConfiguration
().
getString
(
"someconfig"
);
}
}
Loading