RedCraftGH / RedSkyBlock

Red's (amazing) SkyBlock plugin :) Seriously, it's awesome and easy to use!
GNU General Public License v2.0
46 stars 33 forks source link

Would like to contribute to the repo #20

Open inxomnyaa opened 5 years ago

inxomnyaa commented 5 years ago

Hi :)

I have some long time experience with PocketMine and plugins, which you could see at my GitHub.

I recently discovered this repository and would like to help out.

I use the IDE PHPStorm, which helps alot debugging and cleaning up some code. For now i fixed several missing fields and PHPDoc comments, and fixed some minor issues.

Also, i have a test running for challenges, i.e. 64 cobble gives 10 island value and all types of sapling. It is using InvMenu, and is fully dynamic, and uses json files as configuration.

Several times i tried to code SkyBlock plugins, and this one is getting very close to what a good finished plugin should look like.

For now, things that may be changed are:

RedCraftGH commented 5 years ago

Heyo! Do you have a discord account? I'd love to talk with you a bit more about this. 😄

inxomnyaa commented 5 years ago

Discord: @XenialDan#6835

isoz commented 5 years ago

I'm also in contact with @thebigsmileXD we've known each other for the past 3 years he's a good developer and because I'm running your plugin in a popular server its faster to identify bugs, I have a feeling things will break eventually lol but so far its holding up for the past 10 or so hours.

So far the players managed to reach 155K coords:

      start:
        X: 154950
        "Y": 0
        Z: 154950
      end:
        X: 155050
        "Y": 256
        Z: 155050

Status still looking OK: World "sbworld": 2,103 chunks, 31 entities. Time 5.04ms

What I've done so far was remove the ore generator settings from the lava file, make a check where if the player has "0" value it will not keep going down so they don't get negative, in /is setspawn the array_keys were called too late had to move it up a little, transformed /is settings into a UI because PE players could not work with the inventory menu and also they could grab items from it lol, added a character limit to /is name

What I need the most right now would be:

RedCraftGH commented 5 years ago

Hi! I'm actually surprised that nothing has broken thus far; that's quite far out into the world! I am happy to inform you that tomorrow a new update for this plugin is going to be released which actually fixes quite a few bugs AND adds a bunch of the features that you would like.

In the next update, there will be:

Furthermore, it is safe to use the /is increase command to sell packs for increasing player islands. Just make sure that you don't allow their islands to get too big otherwise they might overlap. The island interval can help you figure out how big you can let islands get. At an island interval of 500 players islands can get up to about 350x350 each before other islands become visible. However, in order to use this next update, there is a possibility that all SB data will have to be reset.

isoz commented 5 years ago

Sounds promising, my players will be very happy, especially "A limit for the number of islands allowed to generate in a world before a new world is created." I like that.

I think I understand why the players want to leave their island, because when they do /is go or tp and they are a member of someone else's island it doesn't take them there because they would need to type the friends name, so they think they have to delete their island.

I can send you the /is settings UI that I made, it's just a little clumsy since I'm not a developer, I just figure my way out of things but it works very well and it's snappy.

For /is increase, I did /is increase 100 and it went to 300x300 or something like that, hows the calculation done?

Will it be backwards compatible or do you think a reset will be in need?

RedCraftGH commented 5 years ago

The /is increase had a small bug in it--which will be fixed--which was increasing player island limits in all directions by the amount specified, and it was only supposed to increase the limits in all directions by half of the amount specified.

I am shooting for backward compatibility...but I'm not sure if it will work out. Fingers are crossed though that I can figure that mess out.

Also, with the way that I made island members work players can have islands of there own while they are members on another's island, so deleting their island wouldn't really allow them to do what they want. I was thinking of changing this...but I'm not really sure about it yet as there are advantages and disadvantages to both systems that I have thought of.

I would love to see the /is settings UI that you made! It would definitely be helpful for me when I finally get around to making the UI for RedSkyBlock.

isoz commented 5 years ago

It's short enough to be able to post here, so here's the code:

    public function executeSetting(Player $player, string $sname)
    {
        $sb = $this->getServer()->getPluginManager()->getPlugin("RedSkyBlock");
        $name = strtolower($player->getName());
        $skyblockArray = $sb->skyblock->get("SkyBlock", []);

        if ($skyblockArray[$name]["Settings"]["$sname"] === "on") {
            $skyblockArray[$name]["Settings"]["$sname"] = "off";
            $sb->skyblock->set("SkyBlock", $skyblockArray);
            $sb->skyblock->save();
            $player->sendMessage(TextFormat::RED . $sname . " protection has been disabled on your island.");
            $this->createForm($player);
        } else {
            $skyblockArray[$name]["Settings"]["$sname"] = "on";
            $sb->skyblock->set("SkyBlock", $skyblockArray);
            $sb->skyblock->save();
            $player->sendMessage(TextFormat::GREEN . $sname . " protection has been enabled on your island.");
            $this->createForm($player);
        }
    }

    public function createForm(Player $player)
    {
        $formsapi = $this->getServer()->getPluginManager()->getPlugin("FormAPI");
        $form = $formsapi->createSimpleForm(function (Player $player, array $data) {

            $sb = $this->getServer()->getPluginManager()->getPlugin("RedSkyBlock");
            $name = strtolower($player->getName());
            $skyblockArray = $sb->skyblock->get("SkyBlock", []);
            $sbsettings = $skyblockArray[$name]["Settings"];

            if ($data[0] !== null) {
                $button = $data[0];
                $list = array_keys($sbsettings);
                $item = $list[$button];

                $this->executeSetting($player, $item);
            }

            return false;
        });

        $sb = $this->getServer()->getPluginManager()->getPlugin("RedSkyBlock");

        $skyblockArray = $sb->skyblock->get("SkyBlock", []);
        $name = strtolower($player->getName());
        $sbsettings = $skyblockArray[$name]["Settings"];

        $form->setTitle(TextFormat::RED . $skyblockArray[strtolower($player->getName())]["Name"] . " Island Settings:");

        foreach ($sbsettings as $type => $value) {

            if ($value == "on")
                $form->addButton($type . " Protection §l§8[§r§l§a" . $value . "§l§8]§r");
            elseif ($value == "off")
                $form->addButton($type . " Protection §l§8[§r§l§c" . $value . "§l§8]§r");
        }
        $form->sendToPlayer($player);
        return true;
    }

and then I just made Settings call the createForm function.

inxomnyaa commented 5 years ago

Cool. I use InvMenu, so i do not even have to care about the items being stolen or so. Would like to upgrade to virion usage

LeoBdt commented 5 years ago

Do you have error since new update when you type "/is go" ?