mirror of
https://github.com/xfl03/MCCustomSkinLoader.git
synced 2026-11-18 20:49:16 +00:00
Fix Readme & Remove useless loader
This commit is contained in:
1 parent
7dc2c45600
commit
e26bc85f46
3 files changed
+104
-151
No files matched your search
@@ -1,132 +0,0 @@
|
||||
package customskinloader.loader;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.prefs.Preferences;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
import customskinloader.CustomSkinLoader;
|
||||
import customskinloader.config.SkinSiteProfile;
|
||||
import customskinloader.loader.ProfileLoader.IProfileLoader;
|
||||
import customskinloader.profile.UserProfile;
|
||||
import customskinloader.utils.HttpRequestUtil;
|
||||
import customskinloader.utils.HttpRequestUtil.HttpRequest;
|
||||
import customskinloader.utils.HttpRequestUtil.HttpResponce;
|
||||
import customskinloader.utils.MinecraftUtil;
|
||||
|
||||
//For ElfSkin http://www.mcelf.com/s/mcskin
|
||||
public class ElfSkinLoader implements IProfileLoader {
|
||||
private static final String LOGIN_URL="http://status.mcelf.com/login?gid=%SERVER_IP%&name=%USERNAME%&oid=%ELF_ID%";
|
||||
private static final String LOGOUT_URL="http://status.mcelf.com/logout?gid=%SERVER_IP%&name=%USERNAME%";
|
||||
private static final String PROFILE_URL="http://status.mcelf.com/s?gid=%SERVER_IP%&name=%USERNAME%";
|
||||
|
||||
private static String elfID=Preferences.userRoot().node("elfskin").get("elfid", "null");
|
||||
private static String lastLoginServer=null;
|
||||
private static HashMap<String,Profile> cache=new HashMap<String, Profile>();
|
||||
@Override
|
||||
public UserProfile loadProfile(SkinSiteProfile ssp, GameProfile gameProfile) throws Exception {
|
||||
String username=gameProfile.getName();
|
||||
String ip=MinecraftUtil.getServerAddress();
|
||||
if(elfID!=null && isIPChange(ip)){
|
||||
if(lastLoginServer!=null)
|
||||
makeLogout(lastLoginServer,MinecraftUtil.getCurrentUsername());
|
||||
Profile[] ps=makeLogin(ip,MinecraftUtil.getCurrentUsername(),elfID);
|
||||
cache.clear();
|
||||
for(Profile pp:ps){
|
||||
cache.put(pp.name, pp);
|
||||
}
|
||||
}
|
||||
|
||||
Profile p=cache.containsKey(username)?cache.get(username):getProfile(MinecraftUtil.getServerAddress(),username);
|
||||
if(p==null)
|
||||
return null;
|
||||
UserProfile profile=new UserProfile();
|
||||
profile.skinUrl=p.skin;
|
||||
profile.capeUrl=p.cape;
|
||||
if(profile.isEmpty()){
|
||||
CustomSkinLoader.logger.info("Profile is empty.");
|
||||
return null;
|
||||
}
|
||||
return profile;
|
||||
}
|
||||
private boolean isIPChange(String newIP){
|
||||
return lastLoginServer==null ? newIP!=null : !lastLoginServer.equalsIgnoreCase(newIP);
|
||||
}
|
||||
|
||||
public static Profile[] makeLogin(String ip,String username,String elfID){
|
||||
String url=LOGIN_URL.replaceAll("%SERVER_IP%", ip).replaceAll("%USERNAME%", username).replaceAll("%ELF_ID%", elfID);
|
||||
HttpResponce responce=HttpRequestUtil.makeHttpRequest(new HttpRequest(url));
|
||||
|
||||
if(!responce.success||StringUtils.isEmpty(responce.content)){
|
||||
CustomSkinLoader.logger.info("Request failed.");
|
||||
return null;
|
||||
}
|
||||
BasicResponce r=CustomSkinLoader.GSON.fromJson(responce.content, BasicResponce.class);
|
||||
if(r.error!=0){
|
||||
CustomSkinLoader.logger.info("Error "+r.error+": "+r.msg);
|
||||
return null;
|
||||
}
|
||||
if(r.players==null||r.players.length==0){
|
||||
CustomSkinLoader.logger.info("No Profile found.");
|
||||
return null;
|
||||
}
|
||||
|
||||
return r.players;
|
||||
}
|
||||
public static void makeLogout(String ip,String username){
|
||||
String url=LOGOUT_URL.replaceAll("%SERVER_IP%", ip).replaceAll("%USERNAME%", username);
|
||||
HttpRequestUtil.makeHttpRequest(new HttpRequest(url).setCacheTime(-1));
|
||||
}
|
||||
public static Profile getProfile(String ip,String username){
|
||||
String url=PROFILE_URL.replaceAll("%SERVER_IP%", ip).replaceAll("%USERNAME%", username);
|
||||
HttpResponce responce=HttpRequestUtil.makeHttpRequest(new HttpRequest(url));
|
||||
|
||||
if(!responce.success||StringUtils.isEmpty(responce.content)){
|
||||
CustomSkinLoader.logger.info("Request failed.");
|
||||
return null;
|
||||
}
|
||||
BasicResponce r=CustomSkinLoader.GSON.fromJson(responce.content, BasicResponce.class);
|
||||
if(r.error!=0){
|
||||
CustomSkinLoader.logger.info("Error "+r.error+": "+r.msg);
|
||||
return null;
|
||||
}
|
||||
if(r.players==null||r.players.length==0){
|
||||
CustomSkinLoader.logger.info("Profile not found.");
|
||||
return null;
|
||||
}
|
||||
|
||||
return r.players[0];
|
||||
}
|
||||
private static class BasicResponce{
|
||||
int error;
|
||||
String msg;
|
||||
|
||||
String gid;
|
||||
String expired_at;
|
||||
Profile[] players;
|
||||
}
|
||||
private static class Profile{
|
||||
String name;
|
||||
String login_time;
|
||||
String skin;
|
||||
String cape;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean compare(SkinSiteProfile ssp0, SkinSiteProfile ssp1) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "ElfSkin";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initLocalFolder(SkinSiteProfile ssp) {
|
||||
//No local skin
|
||||
}
|
||||
}
|
||||
@@ -13,8 +13,7 @@ public class ProfileLoader {
|
||||
new JsonAPILoader(JsonAPILoader.Type.CustomSkinAPI),
|
||||
new JsonAPILoader(JsonAPILoader.Type.CustomSkinAPIPlus),
|
||||
new LegacyLoader(),
|
||||
new JsonAPILoader(JsonAPILoader.Type.UniSkinAPI),
|
||||
new ElfSkinLoader()};
|
||||
new JsonAPILoader(JsonAPILoader.Type.UniSkinAPI)};
|
||||
|
||||
public static final HashMap<String,IProfileLoader> LOADERS=initLoaders();
|
||||
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
#CustomSkinLoader
|
||||
##What's this?
|
||||
# CustomSkinLoader
|
||||
## What's this?
|
||||
Custom Skin Loader mod for Minecraft.
|
||||
You can use it to load any skin from any website.
|
||||
|
||||
##Download
|
||||
## Download
|
||||
Build Server : [Infinity Studio CI](https://ci.infstudio.net/job/CustomSkinLoader/)
|
||||
[](https://ci.infstudio.net/job/CustomSkinLoader/)
|
||||
Release Page : [MCBBS](http://www.mcbbs.net/thread-269807-1-1.html)
|
||||
|
||||
##Feature
|
||||
###Plenty of Skin Load API Support and Customizable Skin Load List
|
||||
## Feature
|
||||
### Plenty of Skin Load API Support and Customizable Skin Load List
|
||||
Skin Load API Supported:
|
||||
- [Mojang API](http://wiki.vg/Mojang_API)
|
||||
- [CustomSkinAPI](https://github.com/xfl03/CustomSkinLoaderAPI/tree/master/CustomSkinAPI)
|
||||
@@ -21,33 +21,34 @@ Skin Load API Supported:
|
||||
You can use this feature to customize your skin load list so as to load from any skin server you want.
|
||||
If you are the owner of skin server, you can use CustomSkinLoader to load skin from your server if one of the api has been actualized.
|
||||
|
||||
###HD Skins Support
|
||||
### HD Skins Support
|
||||
Even though there is no Optifine or MCPatcher, CustomSkinLoader has fix this problem.
|
||||
You can easily to get a better view in skin.
|
||||
|
||||
###Skull Support
|
||||
### Skull Support
|
||||
Fixed skull load bug.
|
||||
Dynamic skull supported.
|
||||
|
||||
###Profile Cache
|
||||
### Profile Cache
|
||||
- Decrease frenquency of using network.
|
||||
- Meanwhile,you can still load profile without network.
|
||||
|
||||
*Should be open in configratulation file.
|
||||
|
||||
###Local Skin
|
||||
### Local Skin
|
||||
Load skin without skin server.
|
||||
Furthermore, by using this function you can preview your skin in game and even change default skin and model.
|
||||
You can load local skin by using any API(excluding MojangAPI).
|
||||
*While using default configratulation, just put skin into `.minecraft/CustomSkinLoader/LocalSkin/(skin|cape)s/{USERNAME}.png`.
|
||||
|
||||
###Extra List
|
||||
### Extra List
|
||||
A json file generated by supported skin server.
|
||||
To add server to load list, users just need to put file into `.minecraft/CustomSkinLoader/ExtraList` .
|
||||
|
||||
###Transparent Skin Support
|
||||
### Transparent Skin Support
|
||||
The problem of rendering incorrect texture has been fixed.
|
||||
|
||||
##Default Load List
|
||||
## Default Load List
|
||||
- [Mojang](http://www.minecraft.net/) (Mojang API)
|
||||
- [Blessing Skin](http://123.57.132.134/) (CustomSkinAPI)
|
||||
- [OneSkin](http://fleey.cn/skin/) (CustomSkinAPI)
|
||||
@@ -55,22 +56,107 @@ The problem of rendering incorrect texture has been fixed.
|
||||
- LocalSkin (Legacy)
|
||||
If you want to apply to add other skin server to default list, please go to [issue](https://github.com/JLChnToZ/MCCustomSkinLoader/issues).
|
||||
|
||||
##To Skin Server Owner
|
||||
## To Skin Server Owner
|
||||
CustomSkinLoader is designed for #CustomSkinLoader
|
||||
## What's this?
|
||||
Custom Skin Loader mod for Minecraft.
|
||||
You can use it to load any skin from any website.
|
||||
|
||||
## Download
|
||||
Build Server : [Infinity Studio CI](https://ci.infstudio.net/job/CustomSkinLoader/)
|
||||
[](https://ci.infstudio.net/job/CustomSkinLoader/)
|
||||
Release Page : [MCBBS](http://www.mcbbs.net/thread-269807-1-1.html)
|
||||
|
||||
## Feature
|
||||
### Plenty of Skin Load API Support and Customizable Skin Load List
|
||||
Skin Load API Supported:
|
||||
- [Mojang API](http://wiki.vg/Mojang_API)
|
||||
- [CustomSkinAPI](https://github.com/xfl03/CustomSkinLoaderAPI/tree/master/CustomSkinAPI)
|
||||
- CustomSkinAPIPlus (Test Only)
|
||||
- [UniSkinAPI](https://github.com/RecursiveG/UniSkinServer/tree/master/doc)
|
||||
- Legacy
|
||||
- ElfSkin (Self-made API, Test Only)
|
||||
|
||||
You can use this feature to customize your skin load list so as to load from any skin server you want.
|
||||
If you are the owner of skin server, you can use CustomSkinLoader to load skin from your server if one of the api has been actualized.
|
||||
|
||||
### HD Skins Support
|
||||
Even though there is no Optifine or MCPatcher, CustomSkinLoader has fix this problem.
|
||||
You can easily to get a better view in skin.
|
||||
|
||||
### Skull Support
|
||||
Fixed skull load bug.
|
||||
Dynamic skull supported.
|
||||
|
||||
### Profile Cache
|
||||
- Decrease frenquency of using network.
|
||||
- Meanwhile,you can still load profile without network.
|
||||
*Should be open in configratulation file.
|
||||
|
||||
### Local Skin
|
||||
Load skin without skin server.
|
||||
Furthermore, by using this function you can preview your skin in game and even change default skin and model.
|
||||
You can load local skin by using any API(excluding MojangAPI).
|
||||
*While using default configratulation, just put skin into `.minecraft/CustomSkinLoader/LocalSkin/(skin|cape)s/{USERNAME}.png`.
|
||||
|
||||
### Extra List
|
||||
A json file generated by supported skin server.
|
||||
To add server to load list, users just need to put file into `.minecraft/CustomSkinLoader/ExtraList` .
|
||||
|
||||
### Transparent Skin Support
|
||||
The problem of rendering incorrect texture has been fixed.
|
||||
|
||||
## Default Load List
|
||||
- [Mojang](http://www.minecraft.net/) (Mojang API)
|
||||
- [Blessing Skin](http://123.57.132.134/) (CustomSkinAPI)
|
||||
- [OneSkin](http://fleey.cn/skin/) (CustomSkinAPI)
|
||||
- SkinMe (UniSkinAPI)
|
||||
- LocalSkin (Legacy)
|
||||
|
||||
If you want to apply to add other skin server to default list, please go to [issue](https://github.com/JLChnToZ/MCCustomSkinLoader/issues).
|
||||
|
||||
## To Skin Server Owner
|
||||
CustomSkinLoader is designed for loading from any server, which makes it complex.
|
||||
It's not a good idea to refer to CustomSkinLoader's source code to develop your own skin mod.
|
||||
It's recommended to use CustomSkinLoader for your server directly.
|
||||
Furthermore, you can add your server to 'Default Load List'.
|
||||
You also can use 'ExtraList' which makes it easier for user to adds your server into load list.
|
||||
|
||||
##Copyright & LICENSE
|
||||
###Binary File
|
||||
## Copyright & LICENSE
|
||||
### Binary File
|
||||
You could not modify binary file.
|
||||
Feel free to use and share this mod and unmodified file in anyway like modpack.
|
||||
When using in modpack, you must put 'CustomSkinLoader' in mod list.
|
||||
You could not repost this mod to any website without permission.
|
||||
You could not earn money with this mod excluding modpack.
|
||||
###Source Code
|
||||
####Package 'customskinloader'
|
||||
### Source Code
|
||||
#### Package 'customskinloader'
|
||||
Including some code from
|
||||
- [AsteriskTeam/TabIconHackForge](http://git.oschina.net/AsteriskTeam/TabIconHackForge) (GPLv3)
|
||||
- [RecursiveG/UniSkinMod](https://github.com/RecursiveG/UniSkinMod) (GPLv3)
|
||||
|
||||
Copyright(C) 2013-2017 JLChnToZ xfl03
|
||||
|
||||
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
GPLv3: http://www.gnu.org/licenses/gpl.html
|
||||
You should change the name of package to avoid others' misunderstanding. loading from any server, which makes it complex.
|
||||
It's not a good idea to refer to CustomSkinLoader's source code to develop your own skin mod.
|
||||
It's recommended to use CustomSkinLoader for your server directly.
|
||||
Furthermore, you can add your server to 'Default Load List'.
|
||||
You also can use 'ExtraList' which makes it easier for user to adds your server into load list.
|
||||
|
||||
## Copyright & LICENSE
|
||||
### Binary File
|
||||
You could not modify binary file.
|
||||
Feel free to use and share this mod and unmodified file in anyway like modpack.
|
||||
When using in modpack, you must put 'CustomSkinLoader' in mod list.
|
||||
You could not repost this mod to any website without permission.
|
||||
You could not earn money with this mod excluding modpack.
|
||||
### Source Code
|
||||
#### Package 'customskinloader'
|
||||
Including some code from
|
||||
- [AsteriskTeam/TabIconHackForge](http://git.oschina.net/AsteriskTeam/TabIconHackForge) (GPLv3)
|
||||
- [RecursiveG/UniSkinMod](https://github.com/RecursiveG/UniSkinMod) (GPLv3)
|
||||
|
||||
Reference in new issue
Block a user