use of com.github.games647.craftapi.model.skin.Skin in project ChangeSkin by games647.
the class SetCommand method setSkinUUID.
private void setSkinUUID(CommandSender sender, ProxiedPlayer receiverPayer, String targetUUID, boolean bukkitOp, boolean keepSkin) {
try {
UUID uuid = UUID.fromString(targetUUID);
if (plugin.getCore().getConfig().getBoolean("skinPermission") && !plugin.hasSkinPermission(sender, uuid, true)) {
return;
}
plugin.sendMessage(sender, "skin-change-queue");
Runnable skinDownloader = new SkinDownloader(plugin, sender, receiverPayer, uuid, bukkitOp, keepSkin);
ProxyServer.getInstance().getScheduler().runAsync(plugin, skinDownloader);
} catch (IllegalArgumentException illegalArgumentException) {
plugin.sendMessage(sender, "invalid-uuid");
}
}
use of com.github.games647.craftapi.model.skin.Skin in project FastLogin by games647.
the class FastLoginBukkit method onEnable.
@Override
public void onEnable() {
core = new FastLoginCore<>(this);
core.load();
if (getServer().getOnlineMode()) {
// we need to require offline to prevent a loginSession request for an offline player
logger.error("Server has to be in offline mode");
setEnabled(false);
return;
}
if (!initializeFloodgate()) {
setEnabled(false);
}
bungeeManager = new BungeeManager(this);
bungeeManager.initialize();
PluginManager pluginManager = getServer().getPluginManager();
if (bungeeManager.isEnabled()) {
markInitialized();
} else {
if (!core.setupDatabase()) {
setEnabled(false);
return;
}
if (pluginManager.isPluginEnabled("ProtocolSupport")) {
pluginManager.registerEvents(new ProtocolSupportListener(this, core.getRateLimiter()), this);
} else if (pluginManager.isPluginEnabled("ProtocolLib")) {
ProtocolLibListener.register(this, core.getRateLimiter());
if (isPluginInstalled("floodgate")) {
if (getConfig().getBoolean("floodgatePrefixWorkaround")) {
ManualNameChange.register(this, floodgateService);
logger.info("Floodgate prefix injection workaround has been enabled.");
logger.info("If you have problems joining the server, try disabling it in the configuration.");
} else {
logger.warn("We have detected that you are runnging FastLogin alongside Floodgate and ProtocolLib.");
logger.warn("Currently there is an issue with FastLogin that prevents Floodgate name prefixes from showing up " + "when it is together used with ProtocolLib.");
logger.warn("If you would like to use Floodgate name prefixes, you can enable an experimental workaround by changing " + "the value 'floodgatePrefixWorkaround' to true in config.yml.");
logger.warn("For more information visit https://github.com/games647/FastLogin/issues/493");
}
}
// if server is using paper - we need to set the skin at pre login anyway, so no need for this listener
if (!PaperLib.isPaper() && getConfig().getBoolean("forwardSkin")) {
pluginManager.registerEvents(new SkinApplyListener(this), this);
}
} else {
logger.warn("Either ProtocolLib or ProtocolSupport have to be installed if you don't use BungeeCord");
setEnabled(false);
return;
}
}
// delay dependency setup because we load the plugin very early where plugins are initialized yet
getServer().getScheduler().runTaskLater(this, new DelayedAuthHook(this), 5L);
pluginManager.registerEvents(new ConnectionListener(this), this);
// if server is using paper - we need to add one more listener to correct the user cache usage
if (PaperLib.isPaper()) {
pluginManager.registerEvents(new PaperCacheListener(this), this);
}
// register commands using a unique name
Optional.ofNullable(getCommand("premium")).ifPresent(c -> c.setExecutor(new PremiumCommand(this)));
Optional.ofNullable(getCommand("cracked")).ifPresent(c -> c.setExecutor(new CrackedCommand(this)));
if (pluginManager.isPluginEnabled("PlaceholderAPI")) {
premiumPlaceholder = new PremiumPlaceholder(this);
premiumPlaceholder.register();
}
dependencyWarnings();
}
use of com.github.games647.craftapi.model.skin.Skin in project CraftAPI by games647.
the class AbstractResolverTest method encodeSkinSlim.
@Test
public void encodeSkinSlim() throws Exception {
Skin skin = new Skin(Instant.ofEpochMilli(1519552798232L), UUIDAdapter.parseId("78c3a4e837e448189df8f9ce61c5efcc"), "F0ggyMonst3r", "52847ba3eb656e7ac69f2af9cec58d4ec2f5a2ea7e18968c97907e87efa9cc4", Model.SLIM, "");
skin.setSignature(hexStringToByteArray(SLIM_SIGNATURE));
SkinProperty property = resolver.encodeSkin(skin);
assertThat(property.getValue(), is(SkinPropertyTest.SLIM_VALUE));
assertThat(property.getSignature(), is(SkinPropertyTest.SLIM_SIGNATURE));
}
use of com.github.games647.craftapi.model.skin.Skin in project CraftAPI by games647.
the class AbstractResolverTest method decodeSkinCape.
@Test
public void decodeSkinCape() throws Exception {
SkinProperty property = new SkinProperty(SkinPropertyTest.CAPE_VALUE, SkinPropertyTest.CAPE_SIGNATURE);
Skin skin = resolver.decodeSkin(property);
assertThat(skin.getSignature(), is(hexStringToByteArray(CAPE_SIGNATURE)));
assertThat(skin.getTimeFetched(), is(Instant.ofEpochMilli(1520277572322L)));
assertThat(skin.getOwnerId(), is(UUIDAdapter.parseId("61699b2ed3274a019f1e0ea8c3f06bc6")));
assertThat(skin.getOwnerName(), is("Dinnerbone"));
Texture skinTexture = skin.getTexture(Type.SKIN).get();
assertThat(skinTexture.getHash(), is("cd6be915b261643fd13621ee4e99c9e541a551d80272687a3b56183b981fb9a"));
assertThat(skinTexture.getArmModel().orElse(null), is(Model.SQUARE));
Texture capeTexture = skin.getTexture(Type.CAPE).get();
assertThat(capeTexture.getHash(), is("eec3cabfaeed5dafe61c6546297e853a547c39ec238d7c44bf4eb4a49dc1f2c0"));
assertThat(capeTexture.getArmModel(), is(Optional.empty()));
}
use of com.github.games647.craftapi.model.skin.Skin in project CraftAPI by games647.
the class AbstractResolverTest method encodeSkinSteve.
@Test
public void encodeSkinSteve() throws Exception {
Skin skin = new Skin(Instant.ofEpochMilli(1517052435668L), UUIDAdapter.parseId("0aaa2c13922a411bb6559b8c08404695"), "games647", "a2e6a3f8caea7913ab48237beea6d6a1a6f76936e3b71af4c7a08bb61c7870", Model.SQUARE, "");
skin.setSignature(hexStringToByteArray(STEVE_SIGNATURE));
SkinProperty property = resolver.encodeSkin(skin);
assertThat(property.getValue(), is(SkinPropertyTest.STEVE_VALUE));
assertThat(property.getSignature(), is(SkinPropertyTest.STEVE_SIGNATURE));
}
Aggregations