Does this seem like a good rough design for a minecraft server wrapper program?


I am doing some research on how to write a Minecraft server wrapper
program. Right now I run a minecraft server with the
minecraft_server.jar file from Minecraft.net. When I want to execute
complex commands I usually draft them in a text editor and copy and
paste them into my Mac's terminal where the server is running. This
more tedious than I would like it to be, so I have decided to see if
it would be feasible to write a program that will run the server and
read to the server commands that I have composed in a file. I think
this is basically like enabling me to make scripts for my server.



Here is an illustration of the basic idea. I would communicate with
the server wrapper program, and the server wrapper program would
communicate with the server sending it my commands and also running
scripts of commands for me.



src="http://i.stack.imgur.com/nXvOv.png" alt="communication
schematic">



Here is a sketch of the GUI I would like to build. It would show
the normal server output which currently is fed to the console window
running the server. It also has a field for allowing me to run
commands as usual. Next there is a selectable list of scripts, a
button that prompts the user for a script, and a button that will run
the selected script.



src="http://i.stack.imgur.com/R9jCK.png" alt="GUI layout">



There may be programs out there on the internet that already do
this type of thing, but I am interested in writing this to practice my
programming/Java skills. Some classes that I think I will be using are
Runtime,
ProcessBuilder,
JFrame, other Swing stuff,
and others.



Write now I have three classes:




  • MinecraftServerWrapper,

  • ServerOutputThread, and

  • ServerInputThread.



MinecraftServerWrapper is the main class which uses
ProcessBuilder to execute minecraft_server.jar,
then it creates a ServerOutputThread instance and a
ServerInputThread instance which take in the process and
access its input and output streams to read from
System.in and write to the server's input stream and take
the server's output stream and writes it to System.out.
My next step is to send that output to a GUI and be able to use the
GUI to send the input to the server.



Question: I am primarily concerned about how much this
kind of application can handle, i.e., how long of scripts could it
handle at once. Does this approach seem reasonable, or does it seem
like I might be missing something conceptually?

i'm in the process of converting from windows to ubuntu.
i'm used
to using dreamweaver to help me make web pages.
i'm looking for a
program on ubuntu that gives me the features i'm used to in
dreamweaver.
i've brefly tried bluefish and scream, and the first
feature i'm looking for is quick & easy relative links.
in
dreamweaver i highlight the text, and click the link button on the
bottom, then a window pops up, and i select a file, then the code
relative link is made to the file is made.
i don't see this in
either bluefish or scream (Or atleast, i don't know how to access this
feature).
three other
Ubuntu
Hey guys, so I Have minecraft working just fine, no problems with it.
I want to edit my Charter's skin, I know how to do every thing, I just
can't find the char.png file I am supposed to be replacing though...
So if anyone knows how to I would be very happy, also... I'd be more
then willing to make a skin for you =]
So the most helpful thing
you could do is post a simple guide as such:
Home folder> down
loads> minecraft>minecraftSP.jar>Someother folder>one more
folder> Bam! char.png!
so yeah, thx
~spi
Ubuntu

I have a tricky precedence issue.



I'm wrapping Python primitives such as Float,
Long, String, etc.



Note all Python primitives inherit from Object, which
contains a ...



PyObject* ptr(){ return m_pointerToUnderlyingPythonObject;
}


I'm trying to handle:




  1. foo + Object -- upgrade foo to Object

  2. Object + foo -- upgrade foo to Object

  3. Object + Object -- use Python's C-API
    pointer=PyNumber_Add(lhs.ptr(),rhs.ptr()), and wrap it in a new
    Object, so Object{ptr}



So for...



Long L{42};
long l{L+100};


I want 3 to be promoted, so: L+Long{100}
invokes (3) i.e. Object + Object -> Object. Python
will be smart enough to create a Long, which we receive via the return
value of PyNumber_Add.



This presents a problem. L+100 it has been replaced with an
Object.



We require to convert back to C++ long type.



Here we have a problem. Our Long wrapper contains the necessary
type conversion methods. But the result of applying + returns to us a
generic Object. It could be Long Float String Dict, it depends what
operands were passed.



We could convert a generic Object into a long... but sometimes the
operation would fail.



How to fix this?




  • as just mentioned, we can convert a generic Object into a long,
    and throw upon illegal operation


  • we could have a separate operator+ triple (1,2 and 3) defined
    for each of Long Float String Dict ... -- yuck!


  • is there some way of templating <FooDerivedFromObject,
    BarNotDer>
    Then it can return FooDerivedFromObject{
    PyNumber_Add(...)}
    i.e. Package the result of the addition into
    the correct type.




Everything below can be disregarded, and is just supplied to give
context.






This section will change as I sort out what to do. I will probably
eventually break it out into an answer once I fix the issue.



void test_numbers()
{
Long i;
i = 2;

Float a;
a = 3 + i; // Use of overloaded operator '+' is ambiguous (with
operand types 'int' and 'Py::Long')


^ However, I'm getting an "ambiguous use of overloaded operator"
error.



Clang displays the potential candidates. They are: both the below
templated operators, followed by about 50 inbuilts (Built-in candidate
operator+(long long, long)).



class Object
{
:
// (1) <-- Candidate function [with T = Long]
template<typename T>
friend Object operator + ( const Object& a, const T b )
{
return Object{ PyNumber_Add( a.ptr(), Object{b}.ptr() ),
borrow_ref };
}

// (2) <-- Candidate function [with T = int]
template<typename T> friend
Object operator + ( const T a, const Object& b ) {
return Object{ PyNumber_Add( b.ptr(), Object{a}.ptr() ),
borrow_ref };
}

// (3)
Object operator + ( const Object& rhs ) const {
return Object{ PyNumber_Add( ptr() , rhs.ptr() ) };
}


The strategy is: if both operands derive from Object, the last one
handles it. If only one derives from Object, one of the first two
handles it.



The important thing is that for both templated operators, exactly
ONE of the two operands must derive from Object.



Not both!



I thought it by providing the third operator, this would take
precedence and catch the cases where BOTH operands derive from
Object.



However, for 3+i (1) is still attempting to promote 3
to Object and do Object + Object



I don't understand why this is happening. Looking through the
methods on Object,



    Object( const long& l )         ;
Object( const double& d ) ;
Object( const std::string& s ) ;


So we can construct an Object from a long (3 in our case). Does
this cause (1) to become a candidate? No, commenting it out, nothing
changes.



Here is the complete definition for Long:



class Long :        public ObjBase< Long, Object,
_Long_Check, PyNumber_Long > {
public:
using ObjBase< Long, Object, _Long_Check,
PyNumber_Long >::ObjBase;
using ObjBase< Long, Object, _Long_Check,
PyNumber_Long >::operator=;

// π I *think* the explicit was originally on the wrong function
below
// explicit Long( const Long& ob ) :
ObjBase{ ob } { }
// Long( const Object& ob ) :
ObjBase{ PyNumber_Long(ob.ptr()) , borrow_ref } { }
// ... any object


// try to create from ...
explicit Long( int v ) : ObjBase{
PyLong_FromLong(long(v)) , borrow_ref } { } // ... int
explicit Long( long v = 0L ) : ObjBase{
PyLong_FromLong(v) , borrow_ref } { }
explicit Long( unsigned long v ) : ObjBase{
PyLong_FromUnsignedLong(v) , borrow_ref } { }

// Long& operator=( const Object& ob ) {
set( Long{ob}.ptr() , borrow_ref ); return *this; }
Long& operator=( int v ) { set(
PyLong_FromLong(long(v)) , borrow_ref ); return *this; }
Long& operator=( long v ) { set(
PyLong_FromLong(v) , borrow_ref ); return *this; }
Long& operator=( unsigned long v ) { set(
PyLong_FromUnsignedLong(v) , borrow_ref ); return *this; }

long as_long() const { return
PyLong_AsLong ( ptr() ); } // convert to long
long as_unsigned_long() const { return
PyLong_AsUnsignedLong ( ptr() ); } // convert to unsigned
double as_double() const { return
PyLong_AsDouble ( ptr() ); } // convert to double


// We can have a maximum of one non-explicit conversion, otherwise
compiler generates ambiguous overload errors
// these conversions automatically give us working == != > <
>= <=
// as e.g. Long->double makes (double==Long) perform
(double==double(Long))
operator long() const { return
as_long(); }
explicit operator int() const { return
static_cast<int>(as_long()); }
explicit operator unsigned long() const { return
as_unsigned_long(); }
explicit operator double() const { return
as_double(); }

// This handles Long==Long etc.
// we get Long==long, int==Long, foo==Long etc. for free because
the above conversions
bool operator == ( const Long& rhs ) const {
return as_long() == rhs.as_long(); };
bool operator != ( const Long& rhs ) const {
return as_long() != rhs.as_long(); };
bool operator <= ( const Long& rhs ) const {
return as_long() <= rhs.as_long(); };
bool operator < ( const Long& rhs ) const {
return as_long() < rhs.as_long(); };
bool operator >= ( const Long& rhs ) const {
return as_long() >= rhs.as_long(); };
bool operator > ( const Long& rhs ) const {
return as_long() > rhs.as_long(); };

// prefix
Long operator++() { set( PyNumber_Add
( ptr(), Long{1}.ptr() ) ); return *this; } // π tidy with static
Long{1}
Long operator--() { set(
PyNumber_Subtract( ptr(), Long{1}.ptr() ) ); return *this; }

// postfix
Long operator++( int ) { Long a{ *this }; set( PyNumber_Add
( ptr(), Long{1}.ptr() ) ); return a; }
Long operator--( int ) { Long a{ *this }; set(
PyNumber_Subtract( ptr(), Long{1}.ptr() ) ); return a; }
};


The current code handles operators thus:



#define OP( op, func, param_a, param_b, expr_A, expr_B ) 
inline Object operator op( param_a, param_b )
{
return Object{ func(expr_A,expr_B), borrow_ref };
}

#define OPS( ... )
OP( +, PyNumber_Add , __VA_ARGS__ )
OP( -, PyNumber_Subtract , __VA_ARGS__ )
OP( *, PyNumber_Multiply , __VA_ARGS__ )
OP( /, PyNumber_TrueDivide , __VA_ARGS__ )
OP( %, PyNumber_Remainder , __VA_ARGS__ )

#define BI_( param_a, param_b, expr_A, expr_B )
OPS( param_a, param_b, expr_A, expr_B )
OPS( param_b, param_a, expr_B, expr_A )

OPS( const Object& a, const Object& b , a.ptr(),
b.ptr() )
BI_( const Object& a, int b , a.ptr(), Long{b}.ptr()
)
BI_( const Object& a, long b , a.ptr(), Long{b}.ptr()
)
BI_( const Object& a, double b , a.ptr(), Float{b}.ptr()
)

#undef BI_
#undef UNI
#undef OPS
#undef OP


I'm not entirely convinced this is bad.

Web Development

I am trying my hands on JPA. For this I am thinking of using
example of student admission process as shown in the below
diagram.



Database<br />
Digram



Is this design good ?



Any suggestions for improvement are more than welcome.



I am also confused about what Entity classes should I create for
this.
Especially for College_Major, should there be an Entity class for this
or it should only be a mapping table created for many to many mapping
between College and Major?
If later is a better case, how can the Admission_Form table refer to a
Major in a College?
In either case how Entity classes (if good to have) for College_Major
and Admission_Form should look like ?

Web Development

src="http://cdn9.howtogeek.com/thumbcache/580/230/3c34458b3dc482f0767e5b52b8fabb9e/wp-content/uploads/2015/12/img_5678ab7f6dc3d.jpg"
/>

There are a lot of ways to go about hosting a Minecraft game
but it’s tough to beat the simplicity of buying a server
directly from Mojang, the company behind Minecraft (and now it even
comes with a free 30 day trial!) Read on as we show you how to
purchase and configure a Minecraft Realms server.

href='http://www.howtogeek.com/237174/how-to-set-up-a-simple-no-stress-minecraft-server-with-minecraft-realms/'>Click
Here to Continue Reading

src="http://feeds.feedburner.com/~r/HowToGeek/~4/9cfUi2mwPvw"
height="1" width="1" alt=""/>
Computers

I am doing some research on how to write a Minecraft server wrapper
program. Right now I run a minecraft server with the
minecraft_server.jar file from Minecraft.net. When I want to execute
complex commands I usually draft them in a text editor and copy and
paste them into my Mac's terminal where the server is running. This
more tedious than I would like it to be, so I have decided to see if
it would be feasible to write a program that will run the server and
read to the server commands that I have composed in a file. I think
this is basically like enabling me to make scripts for my server.



Here is an illustration of the basic idea. I would communicate with
the server wrapper program, and the server wrapper program would
communicate with the server sending it my commands and also running
scripts of commands for me.



src="http://i.stack.imgur.com/nXvOv.png" alt="communication
schematic">



Here is a sketch of the GUI I would like to build. It would show
the normal server output which currently is fed to the console window
running the server. It also has a field for allowing me to run
commands as usual. Next there is a selectable list of scripts, a
button that prompts the user for a script, and a button that will run
the selected script.



src="http://i.stack.imgur.com/R9jCK.png" alt="GUI layout">



There may be programs out there on the internet that already do
this type of thing, but I am interested in writing this to practice my
programming/Java skills. Some classes that I think I will be using are
Runtime,
ProcessBuilder,
JFrame, other Swing stuff,
and others.



Write now I have three classes:




  • MinecraftServerWrapper,

  • ServerOutputThread, and

  • ServerInputThread.



MinecraftServerWrapper is the main class which uses
ProcessBuilder to execute minecraft_server.jar,
then it creates a ServerOutputThread instance and a
ServerInputThread instance which take in the process and
access its input and output streams to read from
System.in and write to the server's input stream and take
the server's output stream and writes it to System.out.
My next step is to send that output to a GUI and be able to use the
GUI to send the input to the server.



Question: I am primarily concerned about how much this
kind of application can handle, i.e., how long of scripts could it
handle at once. Does this approach seem reasonable, or does it seem
like I might be missing something conceptually?

Programming Languages

- Technology - Languages
+ Webmasters
+ Development
+ Development Tools
+ Internet
+ Mobile Programming
+ Linux
+ Unix
+ Apple
+ Ubuntu
+ Mobile & Tablets
+ Databases
+ Android
+ Network & Servers
+ Operating Systems
+ Coding
+ Design Software
+ Web Development
+ Game Development
+ Access
+ Excel
+ Web Design
+ Web Hosting
+ Web Site Reviews
+ Domain Name
+ Information Security
+ Software
+ Computers
+ Electronics
+ Hardware
+ Windows
+ PHP
+ ASP/ASP.Net
+ C/C++/C#
+ VB/VB.Net
+ JAVA
+ Javascript
+ Programming
Privacy Policy - Copyrights Notice - Feedback - Report Violation 2018 © BigHow