Coder Social home page Coder Social logo

notbeer / gametest-api-wrapper Goto Github PK

View Code? Open in Web Editor NEW
44.0 10.0 24.0 263 KB

Library built off of Minecraft Bedrock Edition Gametest API. Easily allows you to interact with the API, while including a lot more features!

License: MIT License

JavaScript 48.38% TypeScript 51.41% Shell 0.05% Batchfile 0.16%
minecraft-scripts minecraft minecraft-gametest minecraft-plugin minecraft-bedrock-edition mcbe-plugin mcbe-gametest minecraft-custom-commands realms mcbe-realms

gametest-api-wrapper's Introduction


Logo

GameTest API Wrapper

Gametest API Wrapper is a library built using Minecraft Bedrock Edition Gametest API. This library will help you keep your code clean and make it easier to interact with the Gametest API, while including a lot of new functions/methods for you to use! This pack will have some miscellaneous and some custom command that you may use!
Docs Coming soon »

View Demo · Report Bug · Request Feature

Contributors Forks Stargazers Issues MIT License

Table of Contents

  1. About The Project
  2. Getting Started
  3. Usage
  4. Roadmap
  5. Contributing
  6. License
  7. Contact
  8. Acknowledgements

About The Project

Gametest API Wrapper will provide you with a lot of classes and methods for you to use. There be a lot of useful custom methods for you to use. There are also classes like Database. Gametest API doesn't come with a Database as of now, so I have added a way for you to easily store and get access to the data. There are a lot more stuff in this library!

Built With


Getting Started

Easy Method

  • Download this zip folder and name it to .mcpack and import it by double clicking on the folder. This method will only work if you have Minecraft Bedrock Edition on the same device you are doing this action on.

Recommended Method

  • Another Method would be to take the zipped folder and unzip/extract it. Take your folder and move it to the folder 'development_behavior_packs', which can be found in a path like \Users\USER_NAME\AppData\Local\Packages\Microsoft.MinecraftUWP_8wekyb3d8bbwe\LocalState\games\com.mojang\development_behavior_packs. This will make your life way easier, while developing this pack. It will update the content inside your game everytime you make any changes to the script. For the changes to apply you must leave and rejoin your world where the pack is applied at.

Installation

  1. Clone the repo
    git clone https://github.com/notbeer/Gametest-API-Wrapper.git

Usage

WARNING: If you are going to apply any GameTest related scripts to your world, please make a copy of your world before you do so! I'm not responsible if anything goes wrong-

Create a new world, since GameTest FrameWork is still experimental. Make sure in your settings you have GameTest FrameWork enabled under Experiments category. I have some examples on how you can use this library. Specifically on custom commands. Type in the game chat +help for the list of custom commands or +help [command name] to get information on a specific command!

If you want to add or edit your own stuff to the pack. Please head to the src folder. You can start working with the typescript files in there. At the end of your work make sure to transpile your work. You can run transpile.sh to tranpile your work!


Roadmap

See the open issues for a list of proposed features (and known issues).


Contributing

You can share your amazing talent with other people! Any Contributions are greatly appreciated.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

Distributed under the MIT License. See LICENSE for more information.


Contact

Discord - Message me on notbeer#9204 or contact me throught the Bedrock OSS Discord server.

Project Link: https://github.com/notbeer/Gametest-API-Wrapper


Acknowledgements

gametest-api-wrapper's People

Contributors

balloonieee avatar jrcarl624 avatar notbeer avatar pmk744 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gametest-api-wrapper's Issues

tp request/accept

Can you make a tp request/accept I think is possible because I saw a lot of people make it but still have some error

Custom command

Can you add some examples docs to create custom command .js file ?

Database flaw

Database private _getTable() method is broken. Its looping through the dummy players needs to be fixed

The leaderboard

image
i got this to work but the Rank, gamertag, scores are not working

Floating Leaderboard

Why this not working??

`//Importing stuff that is used in this file
import * as Minecraft from 'Minecraft';
import * as allCommands from './commands/export.js';
import * as misc from './utils/misc.js';
import * as utils from './utils/others.js';

var config = {
commandPrefix: "+" //Our custom command prefix
};

Minecraft.World.events.beforeChat.subscribe(chatmsg => { //Event to listen for message being sent in chat
if(!chatmsg.message.startsWith(config.commandPrefix)) return; //If message doesn't start with the prefix don't execute any of the stuff below

const args = chatmsg.message.slice(config.commandPrefix.length).trim().split(/ +/); //args just splits the message by "space" so you can take different inputs of the user message
const commandName = args.shift().toLowerCase(); //The first index of the array from variable "args" will be stored in commandName
const command = allCommands[commandName]; //We look if "commandName" can be found inside "allCommands"

if(!command || (command.commandInfo.ownerOnly && !utils.findTag({ entityRequirements: `[type=player,name="${chatmsg.sender.name}"]` }, { searchTag: 'OWNER'}))) return utils.runCommand(`tellraw "${chatmsg.sender.name}" {"rawtext":[{"text":"§c"},{"translate":"commands.generic.unknown", "with": ["§f${commandName}§c"]}]}`); //Throw error if command doesn't exist OR the command is avaiable to selected players and the player who executed the command isn't one of the selected

if(command.commandInfo.cancelMessage) chatmsg.canceled = true; //This goes to the command file and looks if variable "commandInfo" has a propert "cancelMessage" set to true. If it does it will make sure the message the user sent in chat never actually gets displayed in chat

try { //Try to execute the command file
    command.execute(chatmsg, args, Minecraft);
} catch (error) {
    utils.runCommand(`say : §c${error}`);
};

});

//I seperated these stuff to make stuff more organized
Minecraft.World.events.beforeChat.subscribe(chatmsg => { //Another chat listening event
if(chatmsg.message.startsWith(config.commandPrefix)) return; //If they are trying to execute a custom command don't execute the stuff below
if(utils.findTag({ entityRequirements: [type=player,name="${chatmsg.sender.name}"] }, { searchTag: 'rainbowText'})) chatmsg.message = misc.rainbowText(chatmsg.message); //Look for the tag 'rainbowText' on the player who executed the command, if they have the tag make their chat text to rainbow
misc.displayRank(chatmsg); //This will check if they have a rank, if they do add a rank to their text in chat
});

//!This will execute a function inide it which will be "setTickInterval" only once when the server side is loaded
let tickExeOnce = 0;
Minecraft.World.events.tick.subscribe(() => { //Run stuff inside every world tick
if(tickExeOnce >= 1) return;
utils.runCommand(tellraw @a {"rawtext":[{"text":"§eGameTest FrameWork API Starter Pack§r\n§bCredit: §rThis pack was made by §anotbeer\n§9Discord: §fnotbeer#9204\n§aXbox Live: §fColoringEmy86\n\n§dType §a${config.commandPrefix}help §dfor more information!"}]});
//utils.setTickInterval(startupFunctions, 20);
tickExeOnce++;
});

function startupFunctions() {
misc.writeLeaderboard(
{
floatingTextIdentifier: 'notbeer:floating_text',
leaderboardEntity: 'MoneyL',
objective: 'money',
displayLength: 10
},
{
leaderboardHeading: 'Money Leaderboard\nTop players with the most Money\n§r\n',
leaderboardLayout: '§e#$(RANK) §b$(GAMERTAG) §f- §a$§c$(SCORE)'
},
{
compressScore: false
}
);
};

export { config };
`

Ask for help

How to write the subscription destruction box and how to do HTTP get

import {Commands, World} from 'mojang-minecraft';
/*
    执行指令
/*————*/
const log = function(msg) {
    Commands.run(`tellraw @a {"rawtext":[{"text":"${msg}"}]}`, World.getDimension('overworld'));
}
World.events.BlockBreakEvent.subscribe((event) => {
    /*
        订阅玩家破坏方块消息
    */
    blocks(event);
})
function blocks(event) {
    var blocktype = event.block.id;//方块类型
    var playername = event.player.name;//玩家名称
    log(`${playername} 破坏 ${blocktype}`);
}

home command error

Sometimes the home command does not return the correct coordinate value

Leaderboard

Can you explain how to create a Leaderboard?

Add a broadcast function for translations.

The proposal is simple; create a broadcast function that instead accepts a translation key as an argument, as well as a list of text to substitute within the translation.
This could be implemented using the tellraw command. And could also be extended to errors in custom commands when one is thrown.

Misc request

Can u pls add something like a world edit?
It Will be very helpfull for map building and stuff.

Leaderboard

Hello can you help with leaderboard

Regards
RealModking

ChatRank

ChatRank is not working in the current update

Leaderboard Bug

If every player doesn't have at least 1 score in the objective it wont update at all.

Install failed

Screenshot_20240107-101439_Minecraft
install failed on Minecraft Pocket editon 1.20.1
Plz fix it.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.