Method give wrong return statement

public interface IProxy{
public void getMap();
public void initProxy();
}

public class ClientProxy implements IProxy{

private Map mapClient;

@Override
public void initProxy() {
mapClient = new HashMap<>();
}

@Override
public Map getMap() {
return mapClient;
}
}

public class ServerProxy implements IProxy{

private Map mapServer;

@Override
public void initProxy() {
mapServer = new HashMap<>();
}

@Override
public Map getMap() {
return mapServer;
}
}

@SidedProxy(clientSide = "mod.ClientProxy", serverSide = "mod.ServerProxy")
public static IProxy proxy;
public interface IProxy{
public void getMap();
public void initProxy();
}

public class ClientProxy implements IProxy{

private Map mapClient;

@Override
public void initProxy() {
mapClient = new HashMap<>();
}

@Override
public Map getMap() {
return mapClient;
}
}

public class ServerProxy implements IProxy{

private Map mapServer;

@Override
public void initProxy() {
mapServer = new HashMap<>();
}

@Override
public Map getMap() {
return mapServer;
}
}

@SidedProxy(clientSide = "mod.ClientProxy", serverSide = "mod.ServerProxy")
public static IProxy proxy;
if i do now proxy.getMap().clear() on the client the server map will be also cleared, idk why when printing proxy right after that i get mob.ClientProxy@16125bbc when printing proxy inside getMap() i get Server thread [mob.ClientProxy:56]: clientside_map and CLient thread [mob.ClientProxy:56]: clientside_map
6 Replies
JavaBot
JavaBot3y ago
Hey, @Verse! Please remember to /close this post once your question has been answered!
I Run Code
I Run Code3y ago
I can execute code right here in Discord! (click here for instructions)
Update: Discord changed their client to prevent sending messages that are preceeded by a slash (/) To run code you can use "./run" or " /run" until further notice Here are my supported languages: awk, bash, basic, basic.net, befunge93, bqn, brachylog, brainfuck, c, c++, cjam, clojure, cobol, coffeescript, cow, crystal, csharp, csharp.net, d, dart, dash, dragon, elixir, emacs, emojicode, erlang, file, forte, forth, fortran, freebasic, fsharp.net, fsi, go, golfscript, groovy, haskell, husk, iverilog, japt, java, javascript, jelly, julia, kotlin, lisp, llvm_ir, lolcode, lua, matl, nasm, nasm64, nim, ocaml, octave, osabie, paradoc, pascal, perl, php, ponylang, powershell, prolog, pure, pyth, python, python2, racket, raku, retina, rockstar, rscript, ruby, rust, scala, smalltalk, sqlite3, swift, typescript, vlang, vyxal, yeethon, zig You can run code like this: ./run <language> command line parameters (optional) - 1 per line ``` your code ``` standard input (optional) Provided by the Engineer Man Discord Server - visit:https://emkc.org/run to get it in your own server • https://discord.gg/engineerman for more info
JavaBot
JavaBot3y ago
@help-ping
Requested by Jonosa#1242
Tomasm21
Tomasm213y ago
@Override public void getMap() { return mapClient; } if you return mapClient, then function type should not be void. It must be Map
Verse
VerseOP3y ago
oh i wrote it wrong into discord right How am i going to fix the wrong return now? i dont understand how this happens i made a new test and proxy seem to be both on clientthread and serverthread be the clientproxy?
JavaBot
JavaBot3y ago
Post Closed
This post has been closed by <@356517007924920340>.

Did you find this page helpful?