Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pm5 Change #228

Closed
GabBiswajit opened this issue Aug 18, 2023 · 16 comments
Closed

Pm5 Change #228

GabBiswajit opened this issue Aug 18, 2023 · 16 comments
Labels
question Further information is requested

Comments

@GabBiswajit
Copy link

What's Change For This In Pm5?
$visitingPlayer = Server::getInstance()->getPlayerExact(str_replace(["§r §b", " §r"], ["", ""], $itemOut->getCustomName()));
$inv->setItem(21, ItemFactory::getInstance()->get(0, 0, 0));

@Muqsit
Copy link
Owner

Muqsit commented Aug 18, 2023

The code doesn't seem to interact with InvMenu's API, but ItemFactory::getInstance()->get(0, 0, 0) must be replaced with VanillaItems::AIR(). Alternatively, you can use a simpler $inv->clear(21);.

@Muqsit Muqsit added the question Further information is requested label Aug 18, 2023
@GabBiswajit
Copy link
Author

@Muqsit what is use if($itemOutId === 262 && $itemOutMeta === 0) { $this->MainGUI($player); } In Pm5 This Is Not Work..

$inv->setItem(48, GlobalItemDataHandlers::getDeserializer()->deserializeStack(GlobalItemDataHandlers::getUpgrader()->upgradeItemTypeDataInt(262, 0, 1, null))->setCustomName("§r §cBack §r\n§r §7click to go back to the privious menu §r"));
I Use This

@Muqsit
Copy link
Owner

Muqsit commented Aug 19, 2023

What is the functionality you're trying to achieve?

@GabBiswajit
Copy link
Author

It's send player to MainGUI When Player Click On Item 262.

@GabBiswajit
Copy link
Author

GabBiswajit commented Aug 19, 2023

$inv->setItem(48, VanillaBlocks::STONE()->setCustomName("§r §cBack §r\n§r §7click to go back to the privious menu §r"));

NOW CAN YOU TELL ME HOW I DO THIS WHEN PLAYER CLICK ON STONE THAN SEND THE PLAYER TO MainGUI ??
@Muqsit

@GabBiswajit
Copy link
Author

@Muqsit reply

@Muqsit
Copy link
Owner

Muqsit commented Aug 19, 2023

Item ID and meta were removed in PM5. Use Item::getTypeId() instead for comparison:

if($item->getTypeId() === ItemTypeIds::fromBlockTypeId(VanillaBlocks::STONE()->getTypeId())){
	// send player to main gui
}

I'd suggest familiarizing with PocketMine API 5 changes that were officially documented. It includes a broader range of changes: https://github.com/pmmp/PocketMine-MP/blob/stable/changelogs/5.0.md#pocketmineitem

Alternatively, if the 'back button' is always present in slot 48, you can simply check for slot instead: if($transaction->getAction()->getSlot() === 48){ ... }.

@GabBiswajit
Copy link
Author

What Is Visible For$item ??

@GabBiswajit
Copy link
Author

@Muqsit

@Muqsit
Copy link
Owner

Muqsit commented Aug 20, 2023

What do you mean by Visible?

@GabBiswajit
Copy link
Author

@Muqsit variable*
Undefined variable $item

@Muqsit
Copy link
Owner

Muqsit commented Aug 20, 2023

$item would be $transaction->getItemClicked() for your case.

@GabBiswajit
Copy link
Author

Ok

@GabBiswajit
Copy link
Author

GabBiswajit commented Aug 20, 2023

@Muqsit It's Work ??

if($item->getTypeId() === ItemTypeIds::fromBlockTypeId(VanillaItems::AIR()->getTypeId())) { $member = str_replace(["§r §e", " §r"], ["", ""], $itemOutName); $this->Management($player, $member); }

$inv->setItem(20, VanillaItems::AIR());

$inv->setItem(21, VanillaItems::AIR());

@GabBiswajit
Copy link
Author

@Muqsit reply

@Muqsit
Copy link
Owner

Muqsit commented Aug 20, 2023

I unfortunately cannot help further without knowing the intricate details of your goal. You'll have to work on that by yourself. Look around the wiki for further documentation and examples:

@Muqsit Muqsit closed this as completed Aug 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants