dresnite / skyblock

🦅 SkyBlock for PocketMine-MP
GNU Lesser General Public License v3.0
105 stars 53 forks source link

Some of the things coming to SkyBlock #68

Closed dresnite closed 5 years ago

dresnite commented 6 years ago

These are some of the features coming to SkyBlock. I would create an issue for each feature with deep information about it, but I don't have a lot of free time.

So here you have what I have thought for now, if you have any idea, feel free to comment below.

PS: Lately, we have been having many backward compatibility breaking changes (And I'm sorry for that, but they were necessary!), and you should expect a few more until SkyBlock is officially released.

zKoz210 commented 5 years ago

Delete files of the world, if the user deleted Island

dresnite commented 5 years ago

@zKoz210 As far as I know, PocketMine-MP is not allowed to delete files (nor are the plugins).

ver24436 commented 5 years ago

@zKoz210 As far as I know, PocketMine-MP is not allowed to delete files (nor are the plugins).

Would it be possible to then have the plugin simply create a log of of the disbanded island files, then someone could create an external script/tool to parse the log and delete the junk files externally?

zKoz210 commented 5 years ago

It seems to me that it is bad to keep SkyBlock in one world, because it will have to somehow limit the island, the meaning and the possibility of unlimited development are lost.

$levelName = "world";
self::deleteDirectory($this->getServer()->getDataPath() . "/worlds/" . $levelName);
    public static function deleteDirectory($dir)
    {
        if (is_dir($dir)) {
            $files = scandir($dir);
            foreach ($files as $file) {
                if ($file != "." && $file != "..") {
                    self::deleteDirectory("$dir/$file");
                }
            }
            rmdir($dir);
        } else if (file_exists($dir)) {
            unlink($dir);
        }
    }
dresnite commented 5 years ago

@zKoz210

array_map('unlink', glob("$dirname/*.*"));

However, "unlink" will not work without extra permissions, that is the reason I haven't implemented it.

@ver24436 Yes, I am probably going to code an external script for this plugin to automatically remove the unused worlds.

zKoz210 commented 5 years ago

@GiantQuartz Yeah, but you delete the files, not the folder with all the files, okay?)

I have maps in BedWars are removed without any extra permission, where did you get it at all?

dresnite commented 5 years ago

@zKoz210 Still more effective that the method you mentioned before, I could just use it to all the subfolders and then remove the directories with rmdir().

In theory, you need extra permissions to use unlink(), you are probably running that "BedWars" plugin on an user with all the permissions (like root in Linux). Try to run it on a normal Linux/Windows user and you will get an exception: "Permission denied".

zKoz210 commented 5 years ago

Never encountered such a problem.

AlexPads commented 5 years ago

i can help you make a FormUI for the plugin :) Ask me if you would like me to it dosent matter if you want to use it inside the plugin either :) i can still help HUGE fan of this plugin :)

ZandercraftGames commented 5 years ago

@GiantQuartz If you want to see how to delete a world look at MultiWorld's code for their /mw delete (or /mw remove) command.

FaanMaario commented 5 years ago

Hi, I have a suggestion for this plugin; Is it possible to have one (or more) command from another plugin blocked in the islands?

Xenophilicy commented 5 years ago

@FaanMaario There are other plugins made for that, but in this case, it wouldn't be beneficial to the SkyBlock core itself. In the plugin linked above, @JackNoordhuis used this code to prevent players from executing commands while in combat:

    public function onCommandPreProcess(PlayerCommandPreprocessEvent $event) {
        $player = $event->getPlayer();
        if($this->plugin->isTagged($player)) {
            $message = $event->getMessage();
            if(substr($message, 0, 1) === "/") {
                $command = substr(explode(" ", $message)[0], 1);
                if(in_array(strtolower($command), $this->bannedCommands)) {
                    $event->setCancelled();
                    $player->sendMessage($this->plugin->getMessageManager()->getMessage("player-run-banned-command"));
                }
            }
        }
    }

Nobody is stopping you from implementing it on your own, or even making a separate private plugin.

FaanMaario commented 5 years ago

@Xenophilicy Okay, I understand but I'm not used to code so that's why I'm asking. :) It's because players set their homes in other players skybase

Xenophilicy commented 5 years ago

@FaanMaario Ah, I see. Maybe you can request a small plugin be made by a "for hire" developer on Poggit or the PMMP forums. If you'd like, you can DM me on Discord and I can help you fulfill your request. Although you said something about setting home on their island. This would instead be beneficial to the plugin if that is however your case (I now admit my response above is wrong in this case lol).

I'm also not completely fluent with this plugin but I do recall a /is visit <player> command that allows you to join any unlocked island. I think that your issue can be solved sort of like when Giant implemented the locking islands feature. Maybe if players don't want people to join, for the time being at least, just tell them to lock their islands.

All in all, good idea to disallow /sethome on islands. DM me here if you're wanting to follow through with it → Xenophilicy#8252

AcktarPlaysMC commented 5 years ago

How About A FloatingText Of The TopIslands