forked from PaperMC/paperweight-test-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
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
1 parent
0a1d4bf
commit 057d944
Showing
6 changed files
with
127 additions
and
78 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
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
32 changes: 32 additions & 0 deletions
32
.../java/net/slqmy/template_paper_plugin/http_server/event/listeners/PlayerJoinListener.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,32 @@ | ||
package net.slqmy.template_paper_plugin.http_server.event.listeners; | ||
|
||
import java.net.URI; | ||
|
||
import org.bukkit.entity.Player; | ||
import org.bukkit.event.EventHandler; | ||
import org.bukkit.event.Listener; | ||
import org.bukkit.event.player.PlayerJoinEvent; | ||
|
||
import net.kyori.adventure.resource.ResourcePackInfo; | ||
import net.kyori.adventure.resource.ResourcePackRequest; | ||
import net.slqmy.template_paper_plugin.TemplatePaperPlugin; | ||
import net.slqmy.template_paper_plugin.file.FileUtil; | ||
import net.slqmy.template_paper_plugin.http_server.HttpServerManager; | ||
|
||
public class PlayerJoinListener implements Listener { | ||
|
||
private ResourcePackInfo resourcePackInfo; | ||
|
||
public PlayerJoinListener(TemplatePaperPlugin plugin, HttpServerManager httpServerManager) { | ||
plugin.getLogger().info(httpServerManager.getSocketAddress()); | ||
|
||
resourcePackInfo = ResourcePackInfo.resourcePackInfo().hash(FileUtil.getSha1HexString(plugin.getResourcePackManager().getResourcePackZipFile())) | ||
.uri(URI.create("http://" + httpServerManager.getSocketAddress() + "/")).build(); | ||
} | ||
|
||
@EventHandler | ||
public void onPlayerJoin(PlayerJoinEvent event) { | ||
Player player = event.getPlayer(); | ||
player.sendResourcePacks(ResourcePackRequest.resourcePackRequest().packs(resourcePackInfo).required(true).build()); | ||
} | ||
} |
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
37 changes: 0 additions & 37 deletions
37
...ava/net/slqmy/template_paper_plugin/resource_pack/event/listeners/PlayerJoinListener.java
This file was deleted.
Oops, something went wrong.