-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
95 changed files
with
2,080 additions
and
826 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,52 @@ | ||
MIT License | ||
|
||
Copyright (c) 2021 KAMKEEL | ||
|
||
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. | ||
MorePlayerModels+ is distributed under a reasonably open license. You probably want to have a read through this if you want to do something with it other than just play. | ||
|
||
You are completely free and have the right to Use, Share and Adapt the mod. These rights can not be removed from you as long as follow the license terms. | ||
If you simply wish to play with the mod and do nothing else, go for it, this license is of no use to you. | ||
|
||
TL;DR | ||
> You CAN | ||
-- Fork and modify the code. | ||
-- Submit Pull Requests to this repository. | ||
-- Copy portions of this code for use in other projects. | ||
-- Write your own code that uses this code as a dependency. (addon mods!) | ||
|
||
> You CANNOT | ||
-- Redistribute this in its entirety as source or compiled code. | ||
-- Create or distribute code which contains 50% or more Functionally Equivalent Statements* from this repository. | ||
|
||
> You MUST | ||
-- Maintain a visible repository of your code which is inspired by, derived from, or copied from this code. Basically, if you use it, pay it forward. You keep rights to your OWN code, but you still must make your source visible. | ||
|
||
General Clauses | ||
Clauses that apply in general to any of the uses that follow. | ||
- Personal Permission Clause | ||
I will only give personal permission if I, KAMKEEL, am directly asked. If personal permission is given this does not imply endorsement. | ||
- Waive Clause | ||
All restrictive clauses in this license can be ignored with personal permission. Read the above clause. | ||
- Extensive Clause | ||
This license applies to MorePlayerModels+, the MorePlayerModels+ website, the legacy MorePlayerModels+ website and all other code, assets or binaries found on this website or the github repository unless otherwise indicated. | ||
- Informal Clause | ||
This license will not hold up in court. I have no intention of suing anyone for breaking it, the worst that can happen to you if you do is that I'll get annoyed and ask you to rectify your mistake. If you use a public distribution platform (such as CurseForge) it's also possible your project will get taken down. Breaking the license also makes you a jerk, and you don't want to be a jerk, do you? | ||
|
||
If you want to Distribute MorePlayerModels+ | ||
"Distribution" refers to making available binaries, assets, or source of the mod available from the original sources as part of your modpack or otherwise. | ||
- Attribution Clause | ||
You must give appropriate credit to KAMKEEL as the creator of MorePlayerModels+ or the parts of it you're using. Noppes can also be credit as the original Mod Author. If you do any alterations the fact that you do so should also be indicated. A link back is optional but it would be cool if you would do so. | ||
- Redistribution Clause | ||
You may not redistribute the enitirity of the source code provided, unless heavy modifications are made to it as a whole. More than 50% of the code cannot be redistributed unless direct permission is provided from either KAMKEEL or Noppes. | ||
- Non-Monetary Clause | ||
You may not charge for access to the distribution itself or gain money through it, this includes any type of inline advertisement, such as url shorteners (adf.ly or otherwise) or ads in your service slowing the download down. This includes restricting any amount of access behind a paywall. Charging for ingame goods such as mod items or cosmetic features on a server does not count as distribution and falls purely under the Mojang Terms of Service. | ||
|
||
If you want to Feature MorePlayerModels+ | ||
"Featuring" refers to using MorePlayerModels+ in an environment where you do not distribute binaries, assets, or source. An example would be a YouTube Let's Play. | ||
- Thief Clause | ||
You must not claim that you made MorePlayerModels+. Giving appropriate credit to KAMKEEL as the creator of MorePlayerModels+ makes you cooler, but you don't have to do it if you don't want to. | ||
|
||
If you want to Use MorePlayerModels+ Code or Assets | ||
Usage of code or assets falls under the Extensive Clause. | ||
- External Clause | ||
Certain parts of the codebase are indicated to be licensed under alternative licenses. You must obey those licenses. | ||
- Attribution Clause | ||
You must give appropriate credit to KAMKEEL as the creator of MorePlayerModels+ or the parts of it you're using. Noppes can also be credit as the original Mod Author. If you do any alterations the fact that you do so should also be indicated. A link back is optional but it would be cool if you would do so. | ||
- Copyleft Clause | ||
Your project must be open source (have its source visible and allow for redistribution and modification) and include a clause similar to this one in its license. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,124 @@ | ||
package kamkeel; | ||
|
||
import net.minecraft.entity.player.EntityPlayer; | ||
import noppes.mpm.MorePlayerModels; | ||
import noppes.mpm.config.ConfigMain; | ||
import org.apache.logging.log4j.LogManager; | ||
|
||
import java.lang.reflect.InvocationTargetException; | ||
import java.lang.reflect.Method; | ||
import java.util.ArrayList; | ||
import java.util.Collections; | ||
import java.util.List; | ||
|
||
|
||
public class MorePlayerModelsPermissions { | ||
public static final Permission CONFIG_SKIN = new Permission("mpm.config.skin"); | ||
public static final Permission CONFIG_SOUND = new Permission("mpm.config.sound"); | ||
public static final Permission CONFIG_ENTITY = new Permission("mpm.config.entity"); | ||
public static final Permission CONFIG_SCALE = new Permission("mpm.config.scale"); | ||
public static final Permission CONFIG_HIDE = new Permission("mpm.config.hide"); | ||
public static final Permission CONFIG_SAVE = new Permission("mpm.config.save"); | ||
public static final Permission CONFIG_LOAD = new Permission("mpm.config.load"); | ||
|
||
public static final Permission PARTS = new Permission("mpm.parts"); | ||
public static final Permission PARTS_BEARD = new Permission("mpm.parts.beard"); | ||
public static final Permission PARTS_BREAST = new Permission("mpm.parts.breast"); | ||
public static final Permission PARTS_CAPE = new Permission("mpm.parts.cape"); | ||
public static final Permission PARTS_CLAWS = new Permission("mpm.parts.claws"); | ||
public static final Permission PARTS_EARS = new Permission("mpm.parts.ears"); | ||
public static final Permission PARTS_FIN = new Permission("mpm.parts.fin"); | ||
public static final Permission PARTS_HAIR = new Permission("mpm.parts.hair"); | ||
public static final Permission PARTS_HORNS = new Permission("mpm.parts.horns"); | ||
public static final Permission PARTS_LEGS = new Permission("mpm.parts.legs"); | ||
public static final Permission PARTS_MOHAWK = new Permission("mpm.parts.mohawk"); | ||
public static final Permission PARTS_PARTICLES = new Permission("mpm.parts.particles"); | ||
public static final Permission PARTS_SKIRT = new Permission("mpm.parts.skirt"); | ||
public static final Permission PARTS_SNOUT = new Permission("mpm.parts.snout"); | ||
public static final Permission PARTS_TAIL = new Permission("mpm.parts.tail"); | ||
public static final Permission PARTS_WINGS = new Permission("mpm.parts.wings"); | ||
|
||
public static MorePlayerModelsPermissions Instance; | ||
private Class<?> bukkit; | ||
private Method getPlayer; | ||
private Method hasPermission; | ||
public MorePlayerModelsPermissions(){ | ||
Instance = this; | ||
try { | ||
bukkit = Class.forName("org.bukkit.Bukkit"); | ||
getPlayer = bukkit.getMethod("getPlayer", String.class); | ||
hasPermission = Class.forName("org.bukkit.entity.Player").getMethod("hasPermission", String.class); | ||
LogManager.getLogger(MorePlayerModels.class).info("Bukkit permissions enabled"); | ||
LogManager.getLogger(MorePlayerModels.class).info("Permissions available:"); | ||
Collections.sort(Permission.permissions, String.CASE_INSENSITIVE_ORDER); | ||
for(String p : Permission.permissions){ | ||
LogManager.getLogger(MorePlayerModels.class).info(p); | ||
} | ||
} catch (ClassNotFoundException e) { | ||
// bukkit/mcpc+ is not loaded | ||
} catch (NoSuchMethodException e) { | ||
e.printStackTrace(); | ||
} catch (SecurityException e) { | ||
e.printStackTrace(); | ||
} | ||
} | ||
|
||
public static boolean hasPermission(EntityPlayer player, Permission permission){ | ||
if(!ConfigMain.EnablePermissions){ | ||
return true; | ||
} | ||
if(player != null){ | ||
if(permission != null){ | ||
if(Instance.bukkit != null){ | ||
return Instance.bukkitPermission(player.getCommandSenderName(), permission.name); | ||
} | ||
} | ||
} | ||
return true; | ||
} | ||
|
||
public static boolean hasPermission(EntityPlayer player, String permission){ | ||
if(!ConfigMain.EnablePermissions){ | ||
return true; | ||
} | ||
if(player != null){ | ||
if(permission != null){ | ||
if(Instance.bukkit != null){ | ||
return Instance.bukkitPermission(player.getCommandSenderName(), permission); | ||
} | ||
} | ||
} | ||
return true; | ||
} | ||
|
||
private boolean bukkitPermission(String username, String permission) { | ||
try { | ||
Object player = getPlayer.invoke(null, username); | ||
return (Boolean) hasPermission.invoke(player, permission); | ||
} catch (IllegalAccessException e) { | ||
e.printStackTrace(); | ||
} catch (IllegalArgumentException e) { | ||
e.printStackTrace(); | ||
} catch (InvocationTargetException e) { | ||
e.printStackTrace(); | ||
} | ||
return false; | ||
} | ||
|
||
public static class Permission{ | ||
public static final List<Permission> permissionNode = new ArrayList<Permission>(); | ||
public static final List<String> permissions = new ArrayList<String>(); | ||
public String name; | ||
public Permission(String name){ | ||
this.name = name; | ||
if(!permissions.contains(name)){ | ||
permissions.add(name); | ||
permissionNode.add(this); | ||
} | ||
} | ||
} | ||
|
||
public static boolean enabled() { | ||
return Instance.bukkit != null; | ||
} | ||
} |
Oops, something went wrong.