Removing some useless left from before.

This commit is contained in:
Adsooi 2017-10-31 18:22:11 +01:00 committed by GitHub
parent b7367eb4fd
commit dd4c3d95e8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -53,23 +53,21 @@ class Main extends PluginBase implements Listener{
echo str_repeat("\010", $downRP ? strlen(TextFormat::toANSI("§f[Spooky] ⚪ Downloading resource pack...")) : 0) . TextFormat::toANSI("§f[Spooky] ⚪ Applying resource pack... "); // Replacing latest message echo str_repeat("\010", $downRP ? strlen(TextFormat::toANSI("§f[Spooky] ⚪ Downloading resource pack...")) : 0) . TextFormat::toANSI("§f[Spooky] ⚪ Applying resource pack... "); // Replacing latest message
$pack = new ZippedResourcePack($this->getDataFolder() . "Spooky.mcpack"); $pack = new ZippedResourcePack($this->getDataFolder() . "Spooky.mcpack");
$r = new \ReflectionClass("pocketmine\\resourcepacks\\ResourcePackManager"); $r = new \ReflectionClass("pocketmine\\resourcepacks\\ResourcePackManager");
if($pack instanceof \pocketmine\resourcepacks\ResourcePack){ // Reflection because devs thought it was a great idea to not let plugins manage resource packs :/
// Reflection because devs thought it was a great idea to not let plugins manage resource packs :/ $resourcePacks = $r->getProperty("resourcePacks");
$resourcePacks = $r->getProperty("resourcePacks"); $resourcePacks->setAccessible(true);
$resourcePacks->setAccessible(true); $rps = $resourcePacks->getValue($this->getServer()->getResourceManager());
$rps = $resourcePacks->getValue($this->getServer()->getResourceManager()); $rps[] = $pack;
$rps[] = $pack; $resourcePacks->setValue($this->getServer()->getResourceManager(), $rps);
$resourcePacks->setValue($this->getServer()->getResourceManager(), $rps); $resourceUuids = $r->getProperty("uuidList");
$resourceUuids = $r->getProperty("uuidList"); $resourceUuids->setAccessible(true);
$resourceUuids->setAccessible(true); $uuids = $resourceUuids->getValue($this->getServer()->getResourceManager());
$uuids = $resourceUuids->getValue($this->getServer()->getResourceManager()); $uuids[$pack->getPackId()] = $pack;
$uuids[$pack->getPackId()] = $pack; $resourceUuids->setValue($this->getServer()->getResourceManager(), $uuids);
$resourceUuids->setValue($this->getServer()->getResourceManager(), $uuids); // Forcing resource packs. We want the client to hear the music!
// Forcing resource packs. We want the client to hear the music! $forceResources = $r->getProperty("serverForceResources");
$forceResources = $r->getProperty("serverForceResources"); $forceResources->setAccessible(true);
$forceResources->setAccessible(true); $forceResources->setValue($this->getServer()->getResourceManager(), true);
$forceResources->setValue($this->getServer()->getResourceManager(), true);
}
echo str_repeat("\010", strlen("⚪ Applying resource pack... ")) . TextFormat::toANSI("§a✔ Done! Spooky enabled! \n"); echo str_repeat("\010", strlen("⚪ Applying resource pack... ")) . TextFormat::toANSI("§a✔ Done! Spooky enabled! \n");
} }
@ -197,4 +195,4 @@ class Main extends PluginBase implements Listener{
} }
} }
} }
} }