-
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
AuthMe, SkinRestorer & LimboAuth integrations
- Loading branch information
1 parent
dea1597
commit 3d8b7a9
Showing
12 changed files
with
148 additions
and
8 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,6 +1,6 @@ | ||
allprojects { | ||
group 'com.azuriom' | ||
version '1.3.0' | ||
version '1.3.1' | ||
} | ||
|
||
subprojects { | ||
|
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
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
42 changes: 42 additions & 0 deletions
42
bukkit/src/main/java/com/azuriom/azlink/bukkit/integrations/SkinRestorerIntegration.java
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,42 @@ | ||
package com.azuriom.azlink.bukkit.integrations; | ||
|
||
import com.azuriom.azlink.bukkit.AzLinkBukkitPlugin; | ||
import net.skinsrestorer.api.PlayerWrapper; | ||
import net.skinsrestorer.api.SkinsRestorerAPI; | ||
import net.skinsrestorer.api.exception.SkinRequestException; | ||
import net.skinsrestorer.api.property.IProperty; | ||
import org.bukkit.entity.Player; | ||
import org.bukkit.event.EventHandler; | ||
import org.bukkit.event.Listener; | ||
import org.bukkit.event.player.PlayerJoinEvent; | ||
|
||
public class SkinRestorerIntegration implements Listener { | ||
|
||
private final AzLinkBukkitPlugin plugin; | ||
|
||
public SkinRestorerIntegration(AzLinkBukkitPlugin plugin) { | ||
this.plugin = plugin; | ||
|
||
this.plugin.getLoggerAdapter().info("SkinRestorer integration enabled."); | ||
} | ||
|
||
@EventHandler | ||
public void onPlayerJoin(PlayerJoinEvent e) { | ||
Player player = e.getPlayer(); | ||
String baseUrl = this.plugin.getPlugin().getConfig().getSiteUrl(); | ||
|
||
|
||
if (baseUrl == null) { | ||
return; | ||
} | ||
|
||
try { | ||
String url = baseUrl + "/api/skin-api/skins/" + player.getName(); | ||
IProperty skin = SkinsRestorerAPI.getApi().genSkinUrl(url, null); | ||
|
||
SkinsRestorerAPI.getApi().applySkin(new PlayerWrapper(player), skin); | ||
} catch (SkinRequestException ex) { | ||
this.plugin.getLoggerAdapter().warn("Unable to apply skin for " + player.getName() + ": " + ex.getMessage()); | ||
} | ||
} | ||
} |
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
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
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
35 changes: 35 additions & 0 deletions
35
velocity/src/main/java/com/azuriom/azlink/velocity/integrations/LimboAuthIntegration.java
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,35 @@ | ||
package com.azuriom.azlink.velocity.integrations; | ||
|
||
import com.azuriom.azlink.velocity.AzLinkVelocityPlugin; | ||
import com.velocitypowered.api.event.Subscribe; | ||
import com.velocitypowered.api.proxy.Player; | ||
import net.elytrium.limboauth.event.PostRegisterEvent; | ||
|
||
import java.net.InetAddress; | ||
|
||
public class LimboAuthIntegration { | ||
|
||
private final AzLinkVelocityPlugin plugin; | ||
|
||
public LimboAuthIntegration(AzLinkVelocityPlugin plugin) { | ||
this.plugin = plugin; | ||
|
||
this.plugin.getLoggerAdapter().info("LimboAuth integration enabled."); | ||
} | ||
|
||
@Subscribe | ||
public void onPostRegister(PostRegisterEvent event) { | ||
Player player = event.getPlayer().getProxyPlayer(); | ||
String password = event.getPassword(); | ||
InetAddress ip = player.getRemoteAddress().getAddress(); | ||
|
||
this.plugin.getPlugin() | ||
.getHttpClient() | ||
.registerUser(player.getUsername(), null, player.getUniqueId(), password, ip) | ||
.exceptionally(ex -> { | ||
this.plugin.getLoggerAdapter().error("Unable to register " + player.getUsername(), ex); | ||
|
||
return null; | ||
}); | ||
} | ||
} |