Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length

* Notifications


Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - JD9999

Pages: [1] 2 3 ... 50
1
Sorry, there isn't a mostLikelyValue function. I meant to call my private method mostLikelyValue but instead called it mostLikelyInt. I've changed it now.

To fix your issue, you could load the locations of all weighted plates into memory on startup. For example:

NOTE: This also hasn't been tested, and may not work as expected
Code: [Select]
private List<MC_Location> locations = new ArrayList<>(); //Can be protected or public if required.

public void onServerFullyLoaded(){
    MC_Server server = RainbowUtils.getServer();
    server.broadcastMessage("Enabling Subway plugin. Please wait...");
    MC_World overworld = server.getWorld(0); //If this is for other worlds, you can use MC_Server.getWorlds()
    for(MC_Chunk chk : overworld.getAllLoadedChunks()){
        int lowX = chk.getCX << 4; //I don't know what this does, but it works
        int lowZ = chk.getCZ << 4;
        for(int incrementX = 0; incrementX < 16; incrementX++){
            for(int incrementZ = 0; incrementZ < 16; incrementZ++){
                for(int y = 0; y <= server.getMaxBuildHeight(); y++){
                    int x = lowX + incrementX;
                    int z = lowZ + incrementZ;
                    MC_Location loc = new MC_Location(x, y, z, 0);
                    MC_Block possBlock = overworld.getBlockAt(loc);
                    if(possBlock.getID() == MC_BlockType.HEAVY_WEIGHTED_PRESSURE_PLATE) location.add(loc);
                }
            }
        }
    }
    server.broadcastMessage("Subway plugin enabled!");
}

public void onAttemptPlayerMove(MC_Player plr, MC_Location locFrom, MC_Location locTo, MC_EventInfo ei){
    for(MC_Location loc : locations){
        if(loc.isSameBlockLocationAs(locTo) plr.sendMessage("<Subway> You stepped on a pressure plate.");
    }
}

2
The first one should mostly work. I don't think you need the -1 for the y as the pressure plate counts as being in the same block the player's foot is on, but I could be wrong.

I would also be careful with converting it to an int. If a player has an x value of 59.993 and is partly standing on the pressure plate, the plugin will think it is not (as converting a double to an int will always truncate its decimal).

I'm not sure what exactly the value is when this happens, and whether you will have to do direction-related stuff, but I'm thinking something like below:

NOTE: This has not been tested as is suspect to screwing things up
Code: [Select]
public void onAttemptPlayerMove(MC_Player plr, MC_Location locFrom, MC_Location locTo, MC_EventInfo ei) {
int plrD = locTo.dimension;
double x = locTo.x;
int plrX = mostLikelyValue(x, plr);
double y = locTo.y;
int plrY = mostLikelyValue(y, plr);
double z = locTo.z;
int plrZ = mostLikelyValue(z, plr);
if (myServer.getWorld(plrD).getBlockAt(plrX, plrY, plrZ).getId() == MC_BlockType.HEAVY_WEIGHTED_PRESSURE_PLATE) {
    plr.sendMessage("<Subway> You stepped on a pressure plate. ");
    }
}

private int mostLikelyValue(double value, MC_Player plr){
    if(plr.getDirection() == MC_DirectionNESWUD.NORTH || plr.getDirection() == MC_DirectionNESWUD.SOUTH){
        int mostLikely = (value - (double)(int)value) > 0.8 ? (int)Math.round(value) : (int)value;
        return mostLikely;
    }else return (int)value;
}

I doubt the second one will work as there is no entity for a weighted pressure plate (or a pressure plate at all!)

It might be useful for you to look at my Transporter plugin and see what I've done there.

3
Plugin Releases / Re: Ven Net Authentication Plugin
« on: July 23, 2017, 04:39:15 AM »
Q:
Quote
Is there a way to edit the file without literally opening the file yourself and changing the data?
A: Which file ?

Don't worry, you answered my question :D

4
Plugin Releases / Re: Ven Net Authentication Plugin
« on: July 21, 2017, 08:56:52 PM »
Hi Algoru,
Thanks for posting the plugin. I am yet to test it, though I am sure it will be great! :)

Can you please elaborate on the following:
- Are there any commands and permissions?
- How do you sign in/out of an account?
- Is there a way to edit the file without literally opening the file yourself and changing the data?

Thanks!

5
Help / Re: Run.bat File Not working
« on: July 18, 2017, 02:52:12 AM »
Does the folder C:\Program Files\Java\jre8\bin exist?
No it does not. That was my previous suggestion.

What version of Rainbow are you using?

I don't think it matters. I'm pretty sure the problem is that the path does not point to a java library.
In saying that, I could be wrong. You'd think it'd come up with a command prompt error message "the path... does not point to an executable, script, etc", which hasn't been documented here, so I'm not sure.

@smalakai17 try changing the path to the java path on your system and try again. If that doesn't work, please tell us what version of Rainbow you are using so @UnknownUser500 and I can help you

6
Help / Re: Run.bat File Not working
« on: July 17, 2017, 04:32:10 AM »
Hi,

I think I can help you.
In the script above, your path connects to a java 7 library, which should work OK

In the last script, it intends on connecting to a java 8 library, however the path won't exist.
Instead, you need to find the version of java. For example, my latest JRE version is JRE 1.8.0 revision 131.
So my path would be:
"C:\Program Files\Java\jre1.8.0_131\bin\java.exe"

Yours would be different depending on the java version you have

7
Help / Re: Non-OP Commands
« on: July 12, 2017, 05:31:38 PM »
Sure! The problem is that most of the commands have their own permissions (even those that are non-op), and so players that are not OP will need to add the permissions in separately.

What it sounds like you want is to use is the /perm command.

For the commands above (for example), the commands to give players those permissions would be:
/perm give <username> rainbow.bp
/perm give <username> rainbow.spawn

This is also the same for plugins. If they have permissions, they should tell you on their help page.

8
General Discussion / Re: Better Together Update: For DiW
« on: July 03, 2017, 05:13:36 AM »
I think we need to get this community back up and running before we consider multi-platform anyway. Theoretically it could be considered a "re-launch" if we were to "re-release" Rainbow as a multi-platform server. While this could help, a more established community would be much more instrumental. And to do this, we need to advertise.

In my opinion, "But I don't think anyone knows what rainbow is tbh" is a very accurate response which first needs to be responded to before we think about this.

9
Help / Re: Run.bat not working
« on: June 09, 2017, 09:41:44 PM »
There are two things that could be happening:
1) Rainbow.jar requires more RAM (more likely):
Try changing the arguments to allocate more memory:
java -Xmx1G - Xincgc -jar Rainbow.jar nogui

2) Your computer does not have enough memory (less likely):
You will need to close some applications on your computer, or maybe just restart your computer

10
V1.2.1 is up! Fixed a bug in ListConverter and Converter where an empty list/set would throw a StringIndexOutOfBoundsException

V1.2 is up! Added a toString(String) method to the ListConverter and SetConverter classes to have a custom split between each element in the list!

11
V1.1.2 is up! Fixed a bug in the RW4 encoder which would cause some characters not to be encoded and decoded correctly!

12
SharedPackages V1.0 is up!

Thanks for all your patience!

13
General Discussion / Re: Is anyone else still here?
« on: May 14, 2017, 12:21:09 AM »
Yeah, I'm here.
And BTW Shared Packages should be out tomorrow, if not two days.

14
I have great news! It is out of bug fixing stage and is into release stage!

I will be adding a couple of minor things for consistency, or removing a little bit of code clutter, as well as adding Javadoc to it. Other than that, it's ready!

Reading.Minecraft has been removed (as well), but that only had copies of classes inside the Reading package with slight changes for players. Everything else seems to exist (since my last post).

When I release it, it will be as a ZIP file, with each package as well as the whole thing. I will also be releasing all my code on GitHub when complete.

Enjoy! :)

15
General Discussion / Re: Rainbow Documentation
« on: April 03, 2017, 03:44:06 AM »
Secondly, no Rainbow plugin will ever require a POM file. The only two times you will ever need a file other than java class files is a plugin.properties file, and the manifest, as you can see about here and here, though most people won't need to worry about bytecode injection (the second one). The first one could be useful though.
I don't agree with that. While using a build system like maven or gradle is not necessary, it is good practice and will speed up the development. I think it's good to have the maven repository and artifacts we use documented somewhere.

Do we even use maven artifacts? There you go! I learn something every day.

Pages: [1] 2 3 ... 50