repo_name
stringlengths
7
104
file_path
stringlengths
13
198
context
stringlengths
67
7.15k
import_statement
stringlengths
16
4.43k
code
stringlengths
40
6.98k
prompt
stringlengths
227
8.27k
next_line
stringlengths
8
795
peterfuture/dttv-android
dttv/dttv-samples/src/main/java/dttv/app/compnent/PopWindowCompnent.java
// Path: dttv/dttv-samples/src/main/java/dttv/app/impl/ICallBack.java // public abstract class ICallBack { // public void doClickListener(View v) { // // } // // public void doItemClickListener(AdapterView<?> parent, View v, int position, long id) { // // } // // public void doItemSelectedListenter(AdapterView<?> parent, View v, int position, long id) { // // } // // // } // // Path: dttv/dttv-samples/src/main/java/dttv/app/impl/I_PopWindow.java // public interface I_PopWindow { // public void onItemClick(View v); // // public void onProgressChanged(int widgetId); // } // // Path: dttv/dttv-samples/src/main/java/dttv/app/utils/Constant.java // public class Constant { // // public final static String EXTRA_MESSAGE = "com.example.simpleplayer.MESSAGE"; // public final static String FILE_MSG = "dttp.app.media.URL"; // public final static String FILE_TYPE = "dttp.app.media.type"; // public static final String LOGTAG = "DTTV"; // // // public final static int REFRESH_TIME_MSG = 0x1000; // public final static int BEGIN_MEDIA_MSG = REFRESH_TIME_MSG + 1; // public final static int HIDE_OPREATE_BAR_MSG = BEGIN_MEDIA_MSG + 1; // public final static int HIDE_PROGRESS_BAR_MSG = HIDE_OPREATE_BAR_MSG + 1; // public final static int REFRESH_TIME = 1000; // // // public static final String ARGUMENTS_NAME = "arg"; // public static final int LOCAL_VIDEO = 0; // public static final int LOCAL_AUDIO = 1; // public static final int LOCAL_FILE = 2; // // public static final String MEIDA_NAME_STR = "dttv.app.media_name"; // // public static final String[] gEqulizerPresets = { // "Normal", // "Classical", // "Dance", // "Flat", // "Folk", // "Heavy Metal", // "Hip Hop", // "Jazz", // "Rock" // }; // // public static final int FILTER_SIZE = 1 * 1024 * 1024;// 1MB // public static final int FILTER_DURATION = 1 * 60 * 1000;// 1分钟 // // // // setting // public static final String KEY_SETTING_FILTER_AUDIO_FILTER = "key_checkbox_setting_audio_filter"; // public static final String KEY_SETTING_FILTER_VIDEO_FILTER = "key_checkbox_setting_video_filter"; // public static final String KEY_SETTING_DECODER_TYPE = "key_listpreference_setting_decoder_type"; // public static final String KEY_SETTING_DECODER_TYPE_SOFT = "0"; // public static final String KEY_SETTING_DECODER_TYPE_HW = "1"; // public static final String KEY_SETTING_BROWSER_MODE ="key_listpreference_filebrowser_display"; // public static final String KEY_SETTING_DISPLAY_MODE ="key_listpreference_setting_display_mode"; // // }
import android.app.Activity; import android.content.Context; import android.graphics.drawable.ColorDrawable; import android.util.Log; import android.view.Gravity; import android.view.LayoutInflater; import android.view.View; import android.view.WindowManager.LayoutParams; import android.widget.AdapterView; import android.widget.AdapterView.OnItemClickListener; import android.widget.ArrayAdapter; import android.widget.ListView; import android.widget.PopupWindow; import dttv.app.R; import dttv.app.impl.ICallBack; import dttv.app.impl.I_PopWindow; import dttv.app.utils.Constant;
Log.i(TAG, "enter PopWindowCompnent"); initialize(); } @Override public void initialize() { // TODO Auto-generated method stub super.initialize(); View view = LayoutInflater.from(mActivity).inflate(R.layout.effect_popwindow, null); mListView = (ListView) view.findViewById(R.id.pop_listview); fillData(); effectWindow = new PopupWindow(view, LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); effectWindow.setAnimationStyle(R.style.pop_win_style); ColorDrawable dw = new ColorDrawable(0xb0ffffff); effectWindow.setBackgroundDrawable(dw); mListView.setOnItemClickListener(new ItemClickListener()); } private class ItemClickListener implements OnItemClickListener { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { // TODO Auto-generated method stub callback.doItemClickListener(parent, view, position, id); effectWindow.dismiss(); } } private void fillData() { ArrayAdapter<String> adapter = new ArrayAdapter<String>(mActivity,
// Path: dttv/dttv-samples/src/main/java/dttv/app/impl/ICallBack.java // public abstract class ICallBack { // public void doClickListener(View v) { // // } // // public void doItemClickListener(AdapterView<?> parent, View v, int position, long id) { // // } // // public void doItemSelectedListenter(AdapterView<?> parent, View v, int position, long id) { // // } // // // } // // Path: dttv/dttv-samples/src/main/java/dttv/app/impl/I_PopWindow.java // public interface I_PopWindow { // public void onItemClick(View v); // // public void onProgressChanged(int widgetId); // } // // Path: dttv/dttv-samples/src/main/java/dttv/app/utils/Constant.java // public class Constant { // // public final static String EXTRA_MESSAGE = "com.example.simpleplayer.MESSAGE"; // public final static String FILE_MSG = "dttp.app.media.URL"; // public final static String FILE_TYPE = "dttp.app.media.type"; // public static final String LOGTAG = "DTTV"; // // // public final static int REFRESH_TIME_MSG = 0x1000; // public final static int BEGIN_MEDIA_MSG = REFRESH_TIME_MSG + 1; // public final static int HIDE_OPREATE_BAR_MSG = BEGIN_MEDIA_MSG + 1; // public final static int HIDE_PROGRESS_BAR_MSG = HIDE_OPREATE_BAR_MSG + 1; // public final static int REFRESH_TIME = 1000; // // // public static final String ARGUMENTS_NAME = "arg"; // public static final int LOCAL_VIDEO = 0; // public static final int LOCAL_AUDIO = 1; // public static final int LOCAL_FILE = 2; // // public static final String MEIDA_NAME_STR = "dttv.app.media_name"; // // public static final String[] gEqulizerPresets = { // "Normal", // "Classical", // "Dance", // "Flat", // "Folk", // "Heavy Metal", // "Hip Hop", // "Jazz", // "Rock" // }; // // public static final int FILTER_SIZE = 1 * 1024 * 1024;// 1MB // public static final int FILTER_DURATION = 1 * 60 * 1000;// 1分钟 // // // // setting // public static final String KEY_SETTING_FILTER_AUDIO_FILTER = "key_checkbox_setting_audio_filter"; // public static final String KEY_SETTING_FILTER_VIDEO_FILTER = "key_checkbox_setting_video_filter"; // public static final String KEY_SETTING_DECODER_TYPE = "key_listpreference_setting_decoder_type"; // public static final String KEY_SETTING_DECODER_TYPE_SOFT = "0"; // public static final String KEY_SETTING_DECODER_TYPE_HW = "1"; // public static final String KEY_SETTING_BROWSER_MODE ="key_listpreference_filebrowser_display"; // public static final String KEY_SETTING_DISPLAY_MODE ="key_listpreference_setting_display_mode"; // // } // Path: dttv/dttv-samples/src/main/java/dttv/app/compnent/PopWindowCompnent.java import android.app.Activity; import android.content.Context; import android.graphics.drawable.ColorDrawable; import android.util.Log; import android.view.Gravity; import android.view.LayoutInflater; import android.view.View; import android.view.WindowManager.LayoutParams; import android.widget.AdapterView; import android.widget.AdapterView.OnItemClickListener; import android.widget.ArrayAdapter; import android.widget.ListView; import android.widget.PopupWindow; import dttv.app.R; import dttv.app.impl.ICallBack; import dttv.app.impl.I_PopWindow; import dttv.app.utils.Constant; Log.i(TAG, "enter PopWindowCompnent"); initialize(); } @Override public void initialize() { // TODO Auto-generated method stub super.initialize(); View view = LayoutInflater.from(mActivity).inflate(R.layout.effect_popwindow, null); mListView = (ListView) view.findViewById(R.id.pop_listview); fillData(); effectWindow = new PopupWindow(view, LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); effectWindow.setAnimationStyle(R.style.pop_win_style); ColorDrawable dw = new ColorDrawable(0xb0ffffff); effectWindow.setBackgroundDrawable(dw); mListView.setOnItemClickListener(new ItemClickListener()); } private class ItemClickListener implements OnItemClickListener { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { // TODO Auto-generated method stub callback.doItemClickListener(parent, view, position, id); effectWindow.dismiss(); } } private void fillData() { ArrayAdapter<String> adapter = new ArrayAdapter<String>(mActivity,
android.R.layout.simple_list_item_1, Constant.gEqulizerPresets);
peterfuture/dttv-android
dttv/dttv-samples/src/main/java/dttv/app/compnent/PopWindowCompnent.java
// Path: dttv/dttv-samples/src/main/java/dttv/app/impl/ICallBack.java // public abstract class ICallBack { // public void doClickListener(View v) { // // } // // public void doItemClickListener(AdapterView<?> parent, View v, int position, long id) { // // } // // public void doItemSelectedListenter(AdapterView<?> parent, View v, int position, long id) { // // } // // // } // // Path: dttv/dttv-samples/src/main/java/dttv/app/impl/I_PopWindow.java // public interface I_PopWindow { // public void onItemClick(View v); // // public void onProgressChanged(int widgetId); // } // // Path: dttv/dttv-samples/src/main/java/dttv/app/utils/Constant.java // public class Constant { // // public final static String EXTRA_MESSAGE = "com.example.simpleplayer.MESSAGE"; // public final static String FILE_MSG = "dttp.app.media.URL"; // public final static String FILE_TYPE = "dttp.app.media.type"; // public static final String LOGTAG = "DTTV"; // // // public final static int REFRESH_TIME_MSG = 0x1000; // public final static int BEGIN_MEDIA_MSG = REFRESH_TIME_MSG + 1; // public final static int HIDE_OPREATE_BAR_MSG = BEGIN_MEDIA_MSG + 1; // public final static int HIDE_PROGRESS_BAR_MSG = HIDE_OPREATE_BAR_MSG + 1; // public final static int REFRESH_TIME = 1000; // // // public static final String ARGUMENTS_NAME = "arg"; // public static final int LOCAL_VIDEO = 0; // public static final int LOCAL_AUDIO = 1; // public static final int LOCAL_FILE = 2; // // public static final String MEIDA_NAME_STR = "dttv.app.media_name"; // // public static final String[] gEqulizerPresets = { // "Normal", // "Classical", // "Dance", // "Flat", // "Folk", // "Heavy Metal", // "Hip Hop", // "Jazz", // "Rock" // }; // // public static final int FILTER_SIZE = 1 * 1024 * 1024;// 1MB // public static final int FILTER_DURATION = 1 * 60 * 1000;// 1分钟 // // // // setting // public static final String KEY_SETTING_FILTER_AUDIO_FILTER = "key_checkbox_setting_audio_filter"; // public static final String KEY_SETTING_FILTER_VIDEO_FILTER = "key_checkbox_setting_video_filter"; // public static final String KEY_SETTING_DECODER_TYPE = "key_listpreference_setting_decoder_type"; // public static final String KEY_SETTING_DECODER_TYPE_SOFT = "0"; // public static final String KEY_SETTING_DECODER_TYPE_HW = "1"; // public static final String KEY_SETTING_BROWSER_MODE ="key_listpreference_filebrowser_display"; // public static final String KEY_SETTING_DISPLAY_MODE ="key_listpreference_setting_display_mode"; // // }
import android.app.Activity; import android.content.Context; import android.graphics.drawable.ColorDrawable; import android.util.Log; import android.view.Gravity; import android.view.LayoutInflater; import android.view.View; import android.view.WindowManager.LayoutParams; import android.widget.AdapterView; import android.widget.AdapterView.OnItemClickListener; import android.widget.ArrayAdapter; import android.widget.ListView; import android.widget.PopupWindow; import dttv.app.R; import dttv.app.impl.ICallBack; import dttv.app.impl.I_PopWindow; import dttv.app.utils.Constant;
public void onItemClick(View v) { // TODO Auto-generated method stub } @Override public void onProgressChanged(int widgetId) { // TODO Auto-generated method stub } public void show(View v, boolean isShowing) { if (isShowing) { int location[] = new int[2]; v.getLocationOnScreen(location); int _x = location[0]; int height = mListView.getMeasuredHeight(); int _y = location[1] - height;// effectWindow.getHeight(); Log.i(TAG, "_x is:" + _x + "--height is:" + height + "---_y is:" + _y); effectWindow.showAtLocation(v, Gravity.NO_GRAVITY, _x, _y); } else effectWindow.dismiss(); } @Override protected void setContentView(View contentView) { // TODO Auto-generated method stub super.setContentView(contentView); }
// Path: dttv/dttv-samples/src/main/java/dttv/app/impl/ICallBack.java // public abstract class ICallBack { // public void doClickListener(View v) { // // } // // public void doItemClickListener(AdapterView<?> parent, View v, int position, long id) { // // } // // public void doItemSelectedListenter(AdapterView<?> parent, View v, int position, long id) { // // } // // // } // // Path: dttv/dttv-samples/src/main/java/dttv/app/impl/I_PopWindow.java // public interface I_PopWindow { // public void onItemClick(View v); // // public void onProgressChanged(int widgetId); // } // // Path: dttv/dttv-samples/src/main/java/dttv/app/utils/Constant.java // public class Constant { // // public final static String EXTRA_MESSAGE = "com.example.simpleplayer.MESSAGE"; // public final static String FILE_MSG = "dttp.app.media.URL"; // public final static String FILE_TYPE = "dttp.app.media.type"; // public static final String LOGTAG = "DTTV"; // // // public final static int REFRESH_TIME_MSG = 0x1000; // public final static int BEGIN_MEDIA_MSG = REFRESH_TIME_MSG + 1; // public final static int HIDE_OPREATE_BAR_MSG = BEGIN_MEDIA_MSG + 1; // public final static int HIDE_PROGRESS_BAR_MSG = HIDE_OPREATE_BAR_MSG + 1; // public final static int REFRESH_TIME = 1000; // // // public static final String ARGUMENTS_NAME = "arg"; // public static final int LOCAL_VIDEO = 0; // public static final int LOCAL_AUDIO = 1; // public static final int LOCAL_FILE = 2; // // public static final String MEIDA_NAME_STR = "dttv.app.media_name"; // // public static final String[] gEqulizerPresets = { // "Normal", // "Classical", // "Dance", // "Flat", // "Folk", // "Heavy Metal", // "Hip Hop", // "Jazz", // "Rock" // }; // // public static final int FILTER_SIZE = 1 * 1024 * 1024;// 1MB // public static final int FILTER_DURATION = 1 * 60 * 1000;// 1分钟 // // // // setting // public static final String KEY_SETTING_FILTER_AUDIO_FILTER = "key_checkbox_setting_audio_filter"; // public static final String KEY_SETTING_FILTER_VIDEO_FILTER = "key_checkbox_setting_video_filter"; // public static final String KEY_SETTING_DECODER_TYPE = "key_listpreference_setting_decoder_type"; // public static final String KEY_SETTING_DECODER_TYPE_SOFT = "0"; // public static final String KEY_SETTING_DECODER_TYPE_HW = "1"; // public static final String KEY_SETTING_BROWSER_MODE ="key_listpreference_filebrowser_display"; // public static final String KEY_SETTING_DISPLAY_MODE ="key_listpreference_setting_display_mode"; // // } // Path: dttv/dttv-samples/src/main/java/dttv/app/compnent/PopWindowCompnent.java import android.app.Activity; import android.content.Context; import android.graphics.drawable.ColorDrawable; import android.util.Log; import android.view.Gravity; import android.view.LayoutInflater; import android.view.View; import android.view.WindowManager.LayoutParams; import android.widget.AdapterView; import android.widget.AdapterView.OnItemClickListener; import android.widget.ArrayAdapter; import android.widget.ListView; import android.widget.PopupWindow; import dttv.app.R; import dttv.app.impl.ICallBack; import dttv.app.impl.I_PopWindow; import dttv.app.utils.Constant; public void onItemClick(View v) { // TODO Auto-generated method stub } @Override public void onProgressChanged(int widgetId) { // TODO Auto-generated method stub } public void show(View v, boolean isShowing) { if (isShowing) { int location[] = new int[2]; v.getLocationOnScreen(location); int _x = location[0]; int height = mListView.getMeasuredHeight(); int _y = location[1] - height;// effectWindow.getHeight(); Log.i(TAG, "_x is:" + _x + "--height is:" + height + "---_y is:" + _y); effectWindow.showAtLocation(v, Gravity.NO_GRAVITY, _x, _y); } else effectWindow.dismiss(); } @Override protected void setContentView(View contentView) { // TODO Auto-generated method stub super.setContentView(contentView); }
private ICallBack callback;
peterfuture/dttv-android
dttv/dttv-samples/src/main/java/dttv/app/exception/CrashHandler.java
// Path: dttv/dttv-samples/src/main/java/dttv/app/AppManager.java // public class AppManager { // // //Activity 栈 // private static Stack<Activity> activityStack; // //单例模式 // private static AppManager instance; // // private AppManager(){} // // public static AppManager getInstance(){ // synchronized (instance){ // if (instance == null){ // instance = new AppManager(); // } // } // return instance; // } // // /** // * 添加Activity到堆栈 // * @param activity // */ // public void addActivity(Activity activity){ // if (activityStack == null){ // activityStack = new Stack<Activity>(); // } // activityStack.add(activity); // } // // /** // * 获取当前Activity // * @return // */ // public Activity currentActivity(){ // Activity activity = null; // if (activityStack != null){ // activity = activityStack.lastElement(); // } // return activity; // } // // /** // * 结束当前Activity(堆栈中最后一个压入的) // */ // public void finishActivity(){ // Activity activity = activityStack.lastElement(); // finishCurrentActivity(activity); // } // // public void finishCurrentActivity(Activity activity){ // if (activity != null){ // activityStack.remove(activity); // activity.finish(); // activity = null; // } // } // // public void finishAllActivity(){ // for (int i = 0; i < activityStack.size(); i++){ // if (null != activityStack.get(i)){ // activityStack.get(i).finish(); // } // } // activityStack.clear(); // } // // public void AppExit(Context context){ // try { // finishAllActivity(); // Process.killProcess(Process.myPid()); // System.exit(0); // }catch (Exception e){} // } // }
import android.content.Context; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; import android.os.Build; import android.os.Environment; import android.os.Looper; import android.util.Log; import android.widget.Toast; import java.io.File; import java.io.FileOutputStream; import java.io.PrintWriter; import java.io.StringWriter; import java.io.Writer; import java.lang.reflect.Field; import java.text.SimpleDateFormat; import java.util.Date; import java.util.HashMap; import java.util.Map; import dttv.app.AppManager;
package dttv.app.exception; /** * Created by shihuaxian on 2017/2/3. */ public class CrashHandler implements Thread.UncaughtExceptionHandler { private Thread.UncaughtExceptionHandler mDefaultHandler; private Context mContext; private Map<String,String> paramsMap = new HashMap<String, String>(); /** * 格式化时间 */ private SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd-HH-mm-ss"); private String TAG = this.getClass().getSimpleName(); private static CrashHandler mInstance; private CrashHandler(){} public static synchronized CrashHandler getInstance(){ if(mInstance == null){ mInstance = new CrashHandler(); } return mInstance; } public void init(Context context){ mContext = context; mDefaultHandler = Thread.getDefaultUncaughtExceptionHandler(); //设置该CrashHandler为系统默认的 Thread.setDefaultUncaughtExceptionHandler(this); } @Override public void uncaughtException(Thread thread, Throwable throwable) { if (!handleException(throwable) && mDefaultHandler != null){//如果自己没有处理则交给系统处理 mDefaultHandler.uncaughtException(thread,throwable); }else {//自己处理 try { Thread.sleep(3000); } catch (InterruptedException e) { e.printStackTrace(); } //退出程序
// Path: dttv/dttv-samples/src/main/java/dttv/app/AppManager.java // public class AppManager { // // //Activity 栈 // private static Stack<Activity> activityStack; // //单例模式 // private static AppManager instance; // // private AppManager(){} // // public static AppManager getInstance(){ // synchronized (instance){ // if (instance == null){ // instance = new AppManager(); // } // } // return instance; // } // // /** // * 添加Activity到堆栈 // * @param activity // */ // public void addActivity(Activity activity){ // if (activityStack == null){ // activityStack = new Stack<Activity>(); // } // activityStack.add(activity); // } // // /** // * 获取当前Activity // * @return // */ // public Activity currentActivity(){ // Activity activity = null; // if (activityStack != null){ // activity = activityStack.lastElement(); // } // return activity; // } // // /** // * 结束当前Activity(堆栈中最后一个压入的) // */ // public void finishActivity(){ // Activity activity = activityStack.lastElement(); // finishCurrentActivity(activity); // } // // public void finishCurrentActivity(Activity activity){ // if (activity != null){ // activityStack.remove(activity); // activity.finish(); // activity = null; // } // } // // public void finishAllActivity(){ // for (int i = 0; i < activityStack.size(); i++){ // if (null != activityStack.get(i)){ // activityStack.get(i).finish(); // } // } // activityStack.clear(); // } // // public void AppExit(Context context){ // try { // finishAllActivity(); // Process.killProcess(Process.myPid()); // System.exit(0); // }catch (Exception e){} // } // } // Path: dttv/dttv-samples/src/main/java/dttv/app/exception/CrashHandler.java import android.content.Context; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; import android.os.Build; import android.os.Environment; import android.os.Looper; import android.util.Log; import android.widget.Toast; import java.io.File; import java.io.FileOutputStream; import java.io.PrintWriter; import java.io.StringWriter; import java.io.Writer; import java.lang.reflect.Field; import java.text.SimpleDateFormat; import java.util.Date; import java.util.HashMap; import java.util.Map; import dttv.app.AppManager; package dttv.app.exception; /** * Created by shihuaxian on 2017/2/3. */ public class CrashHandler implements Thread.UncaughtExceptionHandler { private Thread.UncaughtExceptionHandler mDefaultHandler; private Context mContext; private Map<String,String> paramsMap = new HashMap<String, String>(); /** * 格式化时间 */ private SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd-HH-mm-ss"); private String TAG = this.getClass().getSimpleName(); private static CrashHandler mInstance; private CrashHandler(){} public static synchronized CrashHandler getInstance(){ if(mInstance == null){ mInstance = new CrashHandler(); } return mInstance; } public void init(Context context){ mContext = context; mDefaultHandler = Thread.getDefaultUncaughtExceptionHandler(); //设置该CrashHandler为系统默认的 Thread.setDefaultUncaughtExceptionHandler(this); } @Override public void uncaughtException(Thread thread, Throwable throwable) { if (!handleException(throwable) && mDefaultHandler != null){//如果自己没有处理则交给系统处理 mDefaultHandler.uncaughtException(thread,throwable); }else {//自己处理 try { Thread.sleep(3000); } catch (InterruptedException e) { e.printStackTrace(); } //退出程序
AppManager.getInstance().AppExit(mContext);
JakeWharton/u2020
app/src/main/java/com/jakewharton/u2020/data/DataModule.java
// Path: intent-factory/src/main/java/com/jakewharton/u2020/intentfactory/IntentFactory.java // public interface IntentFactory { // Intent createUrlIntent(String url); // // IntentFactory REAL = url -> { // Intent intent = new Intent(Intent.ACTION_VIEW); // intent.setData(Uri.parse(url)); // intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); // // return intent; // }; // }
import android.app.Application; import android.content.SharedPreferences; import com.f2prateek.rx.preferences.Preference; import com.f2prateek.rx.preferences.RxSharedPreferences; import com.jakewharton.picasso.OkHttp3Downloader; import com.jakewharton.u2020.data.api.ApiModule; import com.jakewharton.u2020.data.api.oauth.AccessToken; import com.jakewharton.u2020.intentfactory.IntentFactory; import com.squareup.moshi.Moshi; import com.squareup.picasso.Picasso; import dagger.Module; import dagger.Provides; import java.io.File; import javax.inject.Singleton; import okhttp3.Cache; import okhttp3.OkHttpClient; import org.threeten.bp.Clock; import timber.log.Timber; import static android.content.Context.MODE_PRIVATE; import static com.jakewharton.byteunits.DecimalByteUnit.MEGABYTES;
package com.jakewharton.u2020.data; @Module( includes = ApiModule.class, complete = false, library = true ) public final class DataModule { static final long DISK_CACHE_SIZE = MEGABYTES.toBytes(50); @Provides @Singleton SharedPreferences provideSharedPreferences(Application app) { return app.getSharedPreferences("u2020", MODE_PRIVATE); } @Provides @Singleton RxSharedPreferences provideRxSharedPreferences(SharedPreferences prefs) { return RxSharedPreferences.create(prefs); } @Provides @Singleton @AccessToken Preference<String> provideAccessToken(RxSharedPreferences prefs) { return prefs.getString("access-token"); } @Provides @Singleton Moshi provideMoshi() { return new Moshi.Builder() .add(new InstantAdapter()) .build(); } @Provides @Singleton Clock provideClock() { return Clock.systemDefaultZone(); }
// Path: intent-factory/src/main/java/com/jakewharton/u2020/intentfactory/IntentFactory.java // public interface IntentFactory { // Intent createUrlIntent(String url); // // IntentFactory REAL = url -> { // Intent intent = new Intent(Intent.ACTION_VIEW); // intent.setData(Uri.parse(url)); // intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); // // return intent; // }; // } // Path: app/src/main/java/com/jakewharton/u2020/data/DataModule.java import android.app.Application; import android.content.SharedPreferences; import com.f2prateek.rx.preferences.Preference; import com.f2prateek.rx.preferences.RxSharedPreferences; import com.jakewharton.picasso.OkHttp3Downloader; import com.jakewharton.u2020.data.api.ApiModule; import com.jakewharton.u2020.data.api.oauth.AccessToken; import com.jakewharton.u2020.intentfactory.IntentFactory; import com.squareup.moshi.Moshi; import com.squareup.picasso.Picasso; import dagger.Module; import dagger.Provides; import java.io.File; import javax.inject.Singleton; import okhttp3.Cache; import okhttp3.OkHttpClient; import org.threeten.bp.Clock; import timber.log.Timber; import static android.content.Context.MODE_PRIVATE; import static com.jakewharton.byteunits.DecimalByteUnit.MEGABYTES; package com.jakewharton.u2020.data; @Module( includes = ApiModule.class, complete = false, library = true ) public final class DataModule { static final long DISK_CACHE_SIZE = MEGABYTES.toBytes(50); @Provides @Singleton SharedPreferences provideSharedPreferences(Application app) { return app.getSharedPreferences("u2020", MODE_PRIVATE); } @Provides @Singleton RxSharedPreferences provideRxSharedPreferences(SharedPreferences prefs) { return RxSharedPreferences.create(prefs); } @Provides @Singleton @AccessToken Preference<String> provideAccessToken(RxSharedPreferences prefs) { return prefs.getString("access-token"); } @Provides @Singleton Moshi provideMoshi() { return new Moshi.Builder() .add(new InstantAdapter()) .build(); } @Provides @Singleton Clock provideClock() { return Clock.systemDefaultZone(); }
@Provides @Singleton IntentFactory provideIntentFactory() {
JakeWharton/u2020
app/src/main/java/com/jakewharton/u2020/data/api/oauth/OauthManager.java
// Path: intent-factory/src/main/java/com/jakewharton/u2020/intentfactory/IntentFactory.java // public interface IntentFactory { // Intent createUrlIntent(String url); // // IntentFactory REAL = url -> { // Intent intent = new Intent(Intent.ACTION_VIEW); // intent.setData(Uri.parse(url)); // intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); // // return intent; // }; // }
import android.content.Intent; import android.net.Uri; import com.f2prateek.rx.preferences.Preference; import com.jakewharton.u2020.intentfactory.IntentFactory; import com.squareup.moshi.Moshi; import java.io.IOException; import javax.inject.Inject; import javax.inject.Singleton; import okhttp3.FormBody; import okhttp3.HttpUrl; import okhttp3.OkHttpClient; import okhttp3.Request; import okhttp3.Response; import timber.log.Timber;
package com.jakewharton.u2020.data.api.oauth; @Singleton public final class OauthManager { private static final String CLIENT_ID = "5793abe5bcb6d90f0240"; private static final String CLIENT_SECRET = "81a35659c60fc376629432a51fd81e5c66a8dace";
// Path: intent-factory/src/main/java/com/jakewharton/u2020/intentfactory/IntentFactory.java // public interface IntentFactory { // Intent createUrlIntent(String url); // // IntentFactory REAL = url -> { // Intent intent = new Intent(Intent.ACTION_VIEW); // intent.setData(Uri.parse(url)); // intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); // // return intent; // }; // } // Path: app/src/main/java/com/jakewharton/u2020/data/api/oauth/OauthManager.java import android.content.Intent; import android.net.Uri; import com.f2prateek.rx.preferences.Preference; import com.jakewharton.u2020.intentfactory.IntentFactory; import com.squareup.moshi.Moshi; import java.io.IOException; import javax.inject.Inject; import javax.inject.Singleton; import okhttp3.FormBody; import okhttp3.HttpUrl; import okhttp3.OkHttpClient; import okhttp3.Request; import okhttp3.Response; import timber.log.Timber; package com.jakewharton.u2020.data.api.oauth; @Singleton public final class OauthManager { private static final String CLIENT_ID = "5793abe5bcb6d90f0240"; private static final String CLIENT_SECRET = "81a35659c60fc376629432a51fd81e5c66a8dace";
private final IntentFactory intentFactory;
JakeWharton/u2020
service/github-mock/src/main/java/com/jakewharton/u2020/data/api/SortUtil.java
// Path: service/github/src/main/java/com/jakewharton/u2020/data/api/model/Repository.java // public final class Repository { // @NonNull public final String name; // @NonNull public final User owner; // @Nullable public final String description; // // public final long watchers; // public final long forks; // // public final String html_url; // // public final Instant updated_at; // // private Repository(Builder builder) { // this.name = requireNonNull(builder.name, "name == null"); // this.owner = requireNonNull(builder.owner, "owner == null"); // this.description = builder.description; // this.watchers = builder.stars; // this.forks = builder.forks; // this.html_url = requireNonNull(builder.htmlUrl, "html_url == null"); // this.updated_at = requireNonNull(builder.updatedAt, "updated_at == null"); // } // // @Override public String toString() { // return "Repository{" + // "name='" + name + '\'' + // ", owner=" + owner + // ", description='" + description + '\'' + // ", watchers=" + watchers + // ", forks=" + forks + // ", html_url='" + html_url + '\'' + // ", updated_at=" + updated_at + // '}'; // } // // public static final class Builder { // private String name; // private User owner; // private String description; // private long stars; // private long forks; // private String htmlUrl; // private Instant updatedAt; // // public Builder name(String name) { // this.name = name; // return this; // } // // public Builder owner(User owner) { // this.owner = owner; // return this; // } // // public Builder description(String description) { // this.description = description; // return this; // } // // public Builder stars(long stars) { // this.stars = stars; // return this; // } // // public Builder forks(long forks) { // this.forks = forks; // return this; // } // // public Builder htmlUrl(String htmlUrl) { // this.htmlUrl = htmlUrl; // return this; // } // // public Builder updatedAt(Instant updatedAt) { // this.updatedAt = updatedAt; // return this; // } // // public Repository build() { // return new Repository(this); // } // } // }
import android.support.annotation.NonNull; import com.jakewharton.u2020.data.api.model.Repository; import java.util.Collections; import java.util.Comparator; import java.util.List; import static com.jakewharton.u2020.data.api.Order.ASC; import static com.jakewharton.u2020.data.api.Order.DESC;
package com.jakewharton.u2020.data.api; final class SortUtil { private static final StarsComparator STARS_ASC = new StarsComparator(ASC); private static final StarsComparator STARS_DESC = new StarsComparator(DESC); private static final ForksComparator FORKS_ASC = new ForksComparator(ASC); private static final ForksComparator FORKS_DESC = new ForksComparator(DESC); private static final UpdatedComparator UPDATED_ASC = new UpdatedComparator(ASC); private static final UpdatedComparator UPDATED_DESC = new UpdatedComparator(DESC);
// Path: service/github/src/main/java/com/jakewharton/u2020/data/api/model/Repository.java // public final class Repository { // @NonNull public final String name; // @NonNull public final User owner; // @Nullable public final String description; // // public final long watchers; // public final long forks; // // public final String html_url; // // public final Instant updated_at; // // private Repository(Builder builder) { // this.name = requireNonNull(builder.name, "name == null"); // this.owner = requireNonNull(builder.owner, "owner == null"); // this.description = builder.description; // this.watchers = builder.stars; // this.forks = builder.forks; // this.html_url = requireNonNull(builder.htmlUrl, "html_url == null"); // this.updated_at = requireNonNull(builder.updatedAt, "updated_at == null"); // } // // @Override public String toString() { // return "Repository{" + // "name='" + name + '\'' + // ", owner=" + owner + // ", description='" + description + '\'' + // ", watchers=" + watchers + // ", forks=" + forks + // ", html_url='" + html_url + '\'' + // ", updated_at=" + updated_at + // '}'; // } // // public static final class Builder { // private String name; // private User owner; // private String description; // private long stars; // private long forks; // private String htmlUrl; // private Instant updatedAt; // // public Builder name(String name) { // this.name = name; // return this; // } // // public Builder owner(User owner) { // this.owner = owner; // return this; // } // // public Builder description(String description) { // this.description = description; // return this; // } // // public Builder stars(long stars) { // this.stars = stars; // return this; // } // // public Builder forks(long forks) { // this.forks = forks; // return this; // } // // public Builder htmlUrl(String htmlUrl) { // this.htmlUrl = htmlUrl; // return this; // } // // public Builder updatedAt(Instant updatedAt) { // this.updatedAt = updatedAt; // return this; // } // // public Repository build() { // return new Repository(this); // } // } // } // Path: service/github-mock/src/main/java/com/jakewharton/u2020/data/api/SortUtil.java import android.support.annotation.NonNull; import com.jakewharton.u2020.data.api.model.Repository; import java.util.Collections; import java.util.Comparator; import java.util.List; import static com.jakewharton.u2020.data.api.Order.ASC; import static com.jakewharton.u2020.data.api.Order.DESC; package com.jakewharton.u2020.data.api; final class SortUtil { private static final StarsComparator STARS_ASC = new StarsComparator(ASC); private static final StarsComparator STARS_DESC = new StarsComparator(DESC); private static final ForksComparator FORKS_ASC = new ForksComparator(ASC); private static final ForksComparator FORKS_DESC = new ForksComparator(DESC); private static final UpdatedComparator UPDATED_ASC = new UpdatedComparator(ASC); private static final UpdatedComparator UPDATED_DESC = new UpdatedComparator(DESC);
static void sort(List<Repository> repositories, Sort sort, Order order) {
JakeWharton/u2020
service/github-mock/src/main/java/com/jakewharton/u2020/data/api/MockGithubService.java
// Path: service/github/src/main/java/com/jakewharton/u2020/data/api/model/Repository.java // public final class Repository { // @NonNull public final String name; // @NonNull public final User owner; // @Nullable public final String description; // // public final long watchers; // public final long forks; // // public final String html_url; // // public final Instant updated_at; // // private Repository(Builder builder) { // this.name = requireNonNull(builder.name, "name == null"); // this.owner = requireNonNull(builder.owner, "owner == null"); // this.description = builder.description; // this.watchers = builder.stars; // this.forks = builder.forks; // this.html_url = requireNonNull(builder.htmlUrl, "html_url == null"); // this.updated_at = requireNonNull(builder.updatedAt, "updated_at == null"); // } // // @Override public String toString() { // return "Repository{" + // "name='" + name + '\'' + // ", owner=" + owner + // ", description='" + description + '\'' + // ", watchers=" + watchers + // ", forks=" + forks + // ", html_url='" + html_url + '\'' + // ", updated_at=" + updated_at + // '}'; // } // // public static final class Builder { // private String name; // private User owner; // private String description; // private long stars; // private long forks; // private String htmlUrl; // private Instant updatedAt; // // public Builder name(String name) { // this.name = name; // return this; // } // // public Builder owner(User owner) { // this.owner = owner; // return this; // } // // public Builder description(String description) { // this.description = description; // return this; // } // // public Builder stars(long stars) { // this.stars = stars; // return this; // } // // public Builder forks(long forks) { // this.forks = forks; // return this; // } // // public Builder htmlUrl(String htmlUrl) { // this.htmlUrl = htmlUrl; // return this; // } // // public Builder updatedAt(Instant updatedAt) { // this.updatedAt = updatedAt; // return this; // } // // public Repository build() { // return new Repository(this); // } // } // }
import com.jakewharton.u2020.data.api.model.RepositoriesResponse; import com.jakewharton.u2020.data.api.model.Repository; import java.util.ArrayList; import retrofit2.adapter.rxjava.Result; import retrofit2.mock.BehaviorDelegate; import retrofit2.mock.Calls; import retrofit2.mock.MockRetrofit; import rx.Observable;
package com.jakewharton.u2020.data.api; public final class MockGithubService implements GithubService { private final BehaviorDelegate<GithubService> delegate; private final MockResponseSupplier responses; public MockGithubService(MockRetrofit mockRetrofit, MockResponseSupplier responses) { this.delegate = mockRetrofit.create(GithubService.class); this.responses = responses; } @Override public Observable<Result<RepositoriesResponse>> repositories(SearchQuery query, Sort sort, Order order) { RepositoriesResponse response = responses.get(MockRepositoriesResponse.class).response; if (response.items != null) { // Don't modify the original list when sorting.
// Path: service/github/src/main/java/com/jakewharton/u2020/data/api/model/Repository.java // public final class Repository { // @NonNull public final String name; // @NonNull public final User owner; // @Nullable public final String description; // // public final long watchers; // public final long forks; // // public final String html_url; // // public final Instant updated_at; // // private Repository(Builder builder) { // this.name = requireNonNull(builder.name, "name == null"); // this.owner = requireNonNull(builder.owner, "owner == null"); // this.description = builder.description; // this.watchers = builder.stars; // this.forks = builder.forks; // this.html_url = requireNonNull(builder.htmlUrl, "html_url == null"); // this.updated_at = requireNonNull(builder.updatedAt, "updated_at == null"); // } // // @Override public String toString() { // return "Repository{" + // "name='" + name + '\'' + // ", owner=" + owner + // ", description='" + description + '\'' + // ", watchers=" + watchers + // ", forks=" + forks + // ", html_url='" + html_url + '\'' + // ", updated_at=" + updated_at + // '}'; // } // // public static final class Builder { // private String name; // private User owner; // private String description; // private long stars; // private long forks; // private String htmlUrl; // private Instant updatedAt; // // public Builder name(String name) { // this.name = name; // return this; // } // // public Builder owner(User owner) { // this.owner = owner; // return this; // } // // public Builder description(String description) { // this.description = description; // return this; // } // // public Builder stars(long stars) { // this.stars = stars; // return this; // } // // public Builder forks(long forks) { // this.forks = forks; // return this; // } // // public Builder htmlUrl(String htmlUrl) { // this.htmlUrl = htmlUrl; // return this; // } // // public Builder updatedAt(Instant updatedAt) { // this.updatedAt = updatedAt; // return this; // } // // public Repository build() { // return new Repository(this); // } // } // } // Path: service/github-mock/src/main/java/com/jakewharton/u2020/data/api/MockGithubService.java import com.jakewharton.u2020.data.api.model.RepositoriesResponse; import com.jakewharton.u2020.data.api.model.Repository; import java.util.ArrayList; import retrofit2.adapter.rxjava.Result; import retrofit2.mock.BehaviorDelegate; import retrofit2.mock.Calls; import retrofit2.mock.MockRetrofit; import rx.Observable; package com.jakewharton.u2020.data.api; public final class MockGithubService implements GithubService { private final BehaviorDelegate<GithubService> delegate; private final MockResponseSupplier responses; public MockGithubService(MockRetrofit mockRetrofit, MockResponseSupplier responses) { this.delegate = mockRetrofit.create(GithubService.class); this.responses = responses; } @Override public Observable<Result<RepositoriesResponse>> repositories(SearchQuery query, Sort sort, Order order) { RepositoriesResponse response = responses.get(MockRepositoriesResponse.class).response; if (response.items != null) { // Don't modify the original list when sorting.
ArrayList<Repository> items = new ArrayList<>(response.items);
JakeWharton/u2020
app/src/internalDebug/java/com/jakewharton/u2020/data/api/DebugApiModule.java
// Path: app/src/internalDebug/java/com/jakewharton/u2020/data/NetworkErrorCode.java // public enum NetworkErrorCode { // HTTP_403(403), // HTTP_404(404), // HTTP_500(500), // HTTP_501(501), // HTTP_503(503), // HTTP_504(504), // ; // // public final int code; // // NetworkErrorCode(int code) { // this.code = code; // } // // @Override public String toString() { // return "HTTP " + code; // } // }
import android.content.SharedPreferences; import com.f2prateek.rx.preferences.Preference; import com.jakewharton.u2020.data.ApiEndpoint; import com.jakewharton.u2020.data.IsMockMode; import com.jakewharton.u2020.data.NetworkDelay; import com.jakewharton.u2020.data.NetworkErrorCode; import com.jakewharton.u2020.data.NetworkErrorPercent; import com.jakewharton.u2020.data.NetworkFailurePercent; import com.jakewharton.u2020.data.NetworkVariancePercent; import com.jakewharton.u2020.data.api.oauth.OauthInterceptor; import dagger.Module; import dagger.Provides; import javax.inject.Named; import javax.inject.Singleton; import okhttp3.HttpUrl; import okhttp3.OkHttpClient; import okhttp3.ResponseBody; import okhttp3.logging.HttpLoggingInterceptor; import retrofit2.Response; import retrofit2.Retrofit; import retrofit2.mock.MockRetrofit; import retrofit2.mock.NetworkBehavior; import timber.log.Timber; import static java.util.concurrent.TimeUnit.MILLISECONDS;
package com.jakewharton.u2020.data.api; @Module( complete = false, library = true, overrides = true ) public final class DebugApiModule { @Provides @Singleton HttpUrl provideHttpUrl(@ApiEndpoint Preference<String> apiEndpoint) { return HttpUrl.parse(apiEndpoint.get()); } @Provides @Singleton HttpLoggingInterceptor provideLoggingInterceptor() { HttpLoggingInterceptor loggingInterceptor = new HttpLoggingInterceptor(message -> Timber.tag("OkHttp").v(message)); loggingInterceptor.setLevel(HttpLoggingInterceptor.Level.HEADERS); return loggingInterceptor; } @Provides @Singleton @Named("Api") OkHttpClient provideApiClient(OkHttpClient client, OauthInterceptor oauthInterceptor, HttpLoggingInterceptor loggingInterceptor) { return ApiModule.createApiClient(client, oauthInterceptor) .addInterceptor(loggingInterceptor) .build(); } @Provides @Singleton NetworkBehavior provideBehavior(@NetworkDelay Preference<Long> networkDelay, @NetworkVariancePercent Preference<Integer> networkVariancePercent, @NetworkFailurePercent Preference<Integer> networkFailurePercent, @NetworkErrorPercent Preference<Integer> networkErrorPercent,
// Path: app/src/internalDebug/java/com/jakewharton/u2020/data/NetworkErrorCode.java // public enum NetworkErrorCode { // HTTP_403(403), // HTTP_404(404), // HTTP_500(500), // HTTP_501(501), // HTTP_503(503), // HTTP_504(504), // ; // // public final int code; // // NetworkErrorCode(int code) { // this.code = code; // } // // @Override public String toString() { // return "HTTP " + code; // } // } // Path: app/src/internalDebug/java/com/jakewharton/u2020/data/api/DebugApiModule.java import android.content.SharedPreferences; import com.f2prateek.rx.preferences.Preference; import com.jakewharton.u2020.data.ApiEndpoint; import com.jakewharton.u2020.data.IsMockMode; import com.jakewharton.u2020.data.NetworkDelay; import com.jakewharton.u2020.data.NetworkErrorCode; import com.jakewharton.u2020.data.NetworkErrorPercent; import com.jakewharton.u2020.data.NetworkFailurePercent; import com.jakewharton.u2020.data.NetworkVariancePercent; import com.jakewharton.u2020.data.api.oauth.OauthInterceptor; import dagger.Module; import dagger.Provides; import javax.inject.Named; import javax.inject.Singleton; import okhttp3.HttpUrl; import okhttp3.OkHttpClient; import okhttp3.ResponseBody; import okhttp3.logging.HttpLoggingInterceptor; import retrofit2.Response; import retrofit2.Retrofit; import retrofit2.mock.MockRetrofit; import retrofit2.mock.NetworkBehavior; import timber.log.Timber; import static java.util.concurrent.TimeUnit.MILLISECONDS; package com.jakewharton.u2020.data.api; @Module( complete = false, library = true, overrides = true ) public final class DebugApiModule { @Provides @Singleton HttpUrl provideHttpUrl(@ApiEndpoint Preference<String> apiEndpoint) { return HttpUrl.parse(apiEndpoint.get()); } @Provides @Singleton HttpLoggingInterceptor provideLoggingInterceptor() { HttpLoggingInterceptor loggingInterceptor = new HttpLoggingInterceptor(message -> Timber.tag("OkHttp").v(message)); loggingInterceptor.setLevel(HttpLoggingInterceptor.Level.HEADERS); return loggingInterceptor; } @Provides @Singleton @Named("Api") OkHttpClient provideApiClient(OkHttpClient client, OauthInterceptor oauthInterceptor, HttpLoggingInterceptor loggingInterceptor) { return ApiModule.createApiClient(client, oauthInterceptor) .addInterceptor(loggingInterceptor) .build(); } @Provides @Singleton NetworkBehavior provideBehavior(@NetworkDelay Preference<Long> networkDelay, @NetworkVariancePercent Preference<Integer> networkVariancePercent, @NetworkFailurePercent Preference<Integer> networkFailurePercent, @NetworkErrorPercent Preference<Integer> networkErrorPercent,
Preference<NetworkErrorCode> networkErrorCode) {
oaqa/baseqa
src/main/java/edu/cmu/lti/oaqa/baseqa/eval/persistence/JdbcEvalPersistenceProvider.java
// Path: src/main/java/edu/cmu/lti/oaqa/baseqa/eval/EvalPeristenceProvider.java // public interface EvalPeristenceProvider extends Resource { // // void insertPartialMeasurements(Key key, String sequenceId, String calculatorName, // String evaluateeName, Map<Measure, Double> measure2value); // // Table<Key, Measure, List<Double>> selectPartialMeasurements(ExperimentKey experiment, // String calculatorName, String evaluateeName); // // void deletePartialMeasurements(Key key, String sequenceId, String calculatorName, // String evaluateeName); // // void insertAccumulatedMeasurements(Key key, String calculatorName, String evaluateeName, // Map<Measure, Double> measure2value); // // void deleteAccumulatedMeasurements(ExperimentKey experiment, String calculatorName, // String evaluateeName); // // } // // Path: src/main/java/edu/cmu/lti/oaqa/baseqa/eval/Measure.java // public interface Measure { // // String getName(); // // Map<String, Measure> name2measure = new HashMap<>(); // // static Measure forName(String name) { // return name2measure.get(name); // } // // }
import com.google.common.collect.HashBasedTable; import com.google.common.collect.Table; import edu.cmu.lti.oaqa.baseqa.eval.EvalPeristenceProvider; import edu.cmu.lti.oaqa.baseqa.eval.Measure; import edu.cmu.lti.oaqa.ecd.config.ConfigurableProvider; import edu.cmu.lti.oaqa.ecd.phase.Trace; import edu.cmu.lti.oaqa.framework.DataStoreImpl; import edu.cmu.lti.oaqa.framework.eval.ExperimentKey; import edu.cmu.lti.oaqa.framework.eval.Key; import org.springframework.jdbc.core.BatchPreparedStatementSetter; import org.springframework.jdbc.core.PreparedStatementSetter; import org.springframework.jdbc.core.RowCallbackHandler; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; import java.util.List; import java.util.Map;
package edu.cmu.lti.oaqa.baseqa.eval.persistence; public class JdbcEvalPersistenceProvider extends ConfigurableProvider implements EvalPeristenceProvider { @Override public void insertPartialMeasurements(Key key, String sequenceId, String calculatorName,
// Path: src/main/java/edu/cmu/lti/oaqa/baseqa/eval/EvalPeristenceProvider.java // public interface EvalPeristenceProvider extends Resource { // // void insertPartialMeasurements(Key key, String sequenceId, String calculatorName, // String evaluateeName, Map<Measure, Double> measure2value); // // Table<Key, Measure, List<Double>> selectPartialMeasurements(ExperimentKey experiment, // String calculatorName, String evaluateeName); // // void deletePartialMeasurements(Key key, String sequenceId, String calculatorName, // String evaluateeName); // // void insertAccumulatedMeasurements(Key key, String calculatorName, String evaluateeName, // Map<Measure, Double> measure2value); // // void deleteAccumulatedMeasurements(ExperimentKey experiment, String calculatorName, // String evaluateeName); // // } // // Path: src/main/java/edu/cmu/lti/oaqa/baseqa/eval/Measure.java // public interface Measure { // // String getName(); // // Map<String, Measure> name2measure = new HashMap<>(); // // static Measure forName(String name) { // return name2measure.get(name); // } // // } // Path: src/main/java/edu/cmu/lti/oaqa/baseqa/eval/persistence/JdbcEvalPersistenceProvider.java import com.google.common.collect.HashBasedTable; import com.google.common.collect.Table; import edu.cmu.lti.oaqa.baseqa.eval.EvalPeristenceProvider; import edu.cmu.lti.oaqa.baseqa.eval.Measure; import edu.cmu.lti.oaqa.ecd.config.ConfigurableProvider; import edu.cmu.lti.oaqa.ecd.phase.Trace; import edu.cmu.lti.oaqa.framework.DataStoreImpl; import edu.cmu.lti.oaqa.framework.eval.ExperimentKey; import edu.cmu.lti.oaqa.framework.eval.Key; import org.springframework.jdbc.core.BatchPreparedStatementSetter; import org.springframework.jdbc.core.PreparedStatementSetter; import org.springframework.jdbc.core.RowCallbackHandler; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; import java.util.List; import java.util.Map; package edu.cmu.lti.oaqa.baseqa.eval.persistence; public class JdbcEvalPersistenceProvider extends ConfigurableProvider implements EvalPeristenceProvider { @Override public void insertPartialMeasurements(Key key, String sequenceId, String calculatorName,
String evaluateeName, Map<Measure, Double> measure2value) {
graywolf336/Jail
src/main/java/com/graywolf336/jail/JailsAPI.java
// Path: src/main/java/com/graywolf336/jail/interfaces/IJailStickManager.java // public interface IJailStickManager { // // /** // * Gets the {@link Stick jail stick} by the provided {@link Material}, can be null. // * // * @param mat of the stick to get // * @return The {@link Stick jail stick} // */ // public Stick getStick(Material mat); // // /** // * Checks if the provided Material is a valid {@link Stick jail stick} // * // * @param mat the {@link Material} to check // * @return whether the provided material is a valid stick // */ // public boolean isValidStick(Material mat); // // /** // * Adds a player to be using a jail stick, with the uuid of the player. // * // * @param id of the player to add // */ // public void addUsingStick(UUID id); // // /** // * Removes a player from using a jail stick, with the uuid of the player. // * // * @param id of the player to remove using a jail stick // */ // public void removeUsingStick(UUID id); // // /** // * Returns whether or not the player is using a jail stick. // * // * @param id of the player to check if using one // * @return true if the player is using a jail stick, false if not // */ // public boolean isUsingJailStick(UUID id); // // /** // * Toggles whether the player is using a jail stick, returning the true if enabled false if disabled. // * // * @param id of the player to toggle using a stick // * @return true if we enabled it, false if we disabled it. // */ // public boolean toggleUsingStick(UUID id); // // /** Removes all the users currently using the sticks. */ // public void removeAllStickUsers(); // }
import com.graywolf336.jail.interfaces.IJailStickManager;
package com.graywolf336.jail; /** * The static api interface for Jail plugin. * * <p> * * If you're looking for non-static methods, please see the * {@link JailMain} interface. * * @author graywolf336 * @version 3.0.0 * @since 3.0.0 */ public class JailsAPI { private static JailMain pl; protected JailsAPI(JailMain plugin) { pl = plugin; } /** * Returns the build number, it will return <strong>-1</strong> if an errors occurs. * * @return the build number of jail or -1 if an error occurred. */ public static int getBuildNumber() { String v = pl.getDescription().getVersion(); String[] split = v.split("-"); try { return Integer.parseInt(split[split.length - 1].replace("b", "")); }catch(NumberFormatException e) { return -1; } } /** * The instance of the {@link JailManager} which contains all the jails and in return prisoners. * * @return instance of the {@link JailManager} * @see JailManager */ public static JailManager getJailManager() { return pl.getJailManager(); } /** * The instance of the {@link PrisonerManager} which handles all the jailing of players. * * @return instance of the {@link PrisonerManager} * @see PrisonerManager */ public static PrisonerManager getPrisonerManager() { return pl.getPrisonerManager(); } /** * Gets an instance of the {@link IJailStickManager} which handles all the jail sticks. * * @return an instance of the {@link IJailStickManager} * @see IJailStickManager */
// Path: src/main/java/com/graywolf336/jail/interfaces/IJailStickManager.java // public interface IJailStickManager { // // /** // * Gets the {@link Stick jail stick} by the provided {@link Material}, can be null. // * // * @param mat of the stick to get // * @return The {@link Stick jail stick} // */ // public Stick getStick(Material mat); // // /** // * Checks if the provided Material is a valid {@link Stick jail stick} // * // * @param mat the {@link Material} to check // * @return whether the provided material is a valid stick // */ // public boolean isValidStick(Material mat); // // /** // * Adds a player to be using a jail stick, with the uuid of the player. // * // * @param id of the player to add // */ // public void addUsingStick(UUID id); // // /** // * Removes a player from using a jail stick, with the uuid of the player. // * // * @param id of the player to remove using a jail stick // */ // public void removeUsingStick(UUID id); // // /** // * Returns whether or not the player is using a jail stick. // * // * @param id of the player to check if using one // * @return true if the player is using a jail stick, false if not // */ // public boolean isUsingJailStick(UUID id); // // /** // * Toggles whether the player is using a jail stick, returning the true if enabled false if disabled. // * // * @param id of the player to toggle using a stick // * @return true if we enabled it, false if we disabled it. // */ // public boolean toggleUsingStick(UUID id); // // /** Removes all the users currently using the sticks. */ // public void removeAllStickUsers(); // } // Path: src/main/java/com/graywolf336/jail/JailsAPI.java import com.graywolf336.jail.interfaces.IJailStickManager; package com.graywolf336.jail; /** * The static api interface for Jail plugin. * * <p> * * If you're looking for non-static methods, please see the * {@link JailMain} interface. * * @author graywolf336 * @version 3.0.0 * @since 3.0.0 */ public class JailsAPI { private static JailMain pl; protected JailsAPI(JailMain plugin) { pl = plugin; } /** * Returns the build number, it will return <strong>-1</strong> if an errors occurs. * * @return the build number of jail or -1 if an error occurred. */ public static int getBuildNumber() { String v = pl.getDescription().getVersion(); String[] split = v.split("-"); try { return Integer.parseInt(split[split.length - 1].replace("b", "")); }catch(NumberFormatException e) { return -1; } } /** * The instance of the {@link JailManager} which contains all the jails and in return prisoners. * * @return instance of the {@link JailManager} * @see JailManager */ public static JailManager getJailManager() { return pl.getJailManager(); } /** * The instance of the {@link PrisonerManager} which handles all the jailing of players. * * @return instance of the {@link PrisonerManager} * @see PrisonerManager */ public static PrisonerManager getPrisonerManager() { return pl.getPrisonerManager(); } /** * Gets an instance of the {@link IJailStickManager} which handles all the jail sticks. * * @return an instance of the {@link IJailStickManager} * @see IJailStickManager */
public static IJailStickManager getJailStickManager() {
graywolf336/Jail
src/main/java/com/graywolf336/jail/beans/ConfirmPlayer.java
// Path: src/main/java/com/graywolf336/jail/enums/Confirmation.java // public enum Confirmation { // /** When they are clearing a jail from all their prisoner's with releasing properly. */ // CLEAR, // /** When they are clearing a jail from all their prisoner's by force. */ // CLEARFORCE, // /** When they are deleting a cell from a jail. */ // DELETECELL, // /** When they are deleting all a jail's cells. */ // DELETECELLS, // /** When they are deleting a jail. */ // DELETE; // }
import com.graywolf336.jail.enums.Confirmation;
package com.graywolf336.jail.beans; /** * Holds data for when a player is confirming a command. * * @author graywolf336 * @version 1.0.0 * @since 3.0.0 */ public class ConfirmPlayer { private String name; private String[] args;
// Path: src/main/java/com/graywolf336/jail/enums/Confirmation.java // public enum Confirmation { // /** When they are clearing a jail from all their prisoner's with releasing properly. */ // CLEAR, // /** When they are clearing a jail from all their prisoner's by force. */ // CLEARFORCE, // /** When they are deleting a cell from a jail. */ // DELETECELL, // /** When they are deleting all a jail's cells. */ // DELETECELLS, // /** When they are deleting a jail. */ // DELETE; // } // Path: src/main/java/com/graywolf336/jail/beans/ConfirmPlayer.java import com.graywolf336.jail.enums.Confirmation; package com.graywolf336.jail.beans; /** * Holds data for when a player is confirming a command. * * @author graywolf336 * @version 1.0.0 * @since 3.0.0 */ public class ConfirmPlayer { private String name; private String[] args;
private Confirmation confirm;
ArturVasilov/RxSamplesPractice
ParallelRequests/app/src/main/java/itis/homework/parallelrequests/MainFragment.java
// Path: ParallelRequests/app/src/main/java/itis/homework/parallelrequests/app/AppDelegate.java // public class AppDelegate extends Application { // // private RequestsService mRequestsService; // // @Override // public void onCreate() { // super.onCreate(); // mRequestsService = new RequestProcessor(new RequestControllerImpl()); // } // // @NonNull // public static AppDelegate get(Context context) { // return ((AppDelegate) context.getApplicationContext()); // } // // @NonNull // public RequestsService getRequestsService() { // return mRequestsService; // } // } // // Path: ParallelRequests/app/src/main/java/itis/homework/parallelrequests/network/RequestsService.java // public interface RequestsService { // // Observable<Boolean> config(); // // Observable<Boolean> auth(); // // Observable<Boolean> friends(); // // Observable<Boolean> posts(); // // Observable<Boolean> groups(); // // Observable<Boolean> messages(); // // Observable<Boolean> photos(); // // void reset(); // // }
import android.app.Fragment; import android.os.Bundle; import android.support.annotation.Nullable; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import itis.homework.parallelrequests.app.AppDelegate; import itis.homework.parallelrequests.network.RequestsService; import rx.Observable; import rx.schedulers.Schedulers;
package itis.homework.parallelrequests; /** * @author Artur Vasilov */ public class MainFragment extends Fragment { private RequestsService mRequestsService; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);
// Path: ParallelRequests/app/src/main/java/itis/homework/parallelrequests/app/AppDelegate.java // public class AppDelegate extends Application { // // private RequestsService mRequestsService; // // @Override // public void onCreate() { // super.onCreate(); // mRequestsService = new RequestProcessor(new RequestControllerImpl()); // } // // @NonNull // public static AppDelegate get(Context context) { // return ((AppDelegate) context.getApplicationContext()); // } // // @NonNull // public RequestsService getRequestsService() { // return mRequestsService; // } // } // // Path: ParallelRequests/app/src/main/java/itis/homework/parallelrequests/network/RequestsService.java // public interface RequestsService { // // Observable<Boolean> config(); // // Observable<Boolean> auth(); // // Observable<Boolean> friends(); // // Observable<Boolean> posts(); // // Observable<Boolean> groups(); // // Observable<Boolean> messages(); // // Observable<Boolean> photos(); // // void reset(); // // } // Path: ParallelRequests/app/src/main/java/itis/homework/parallelrequests/MainFragment.java import android.app.Fragment; import android.os.Bundle; import android.support.annotation.Nullable; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import itis.homework.parallelrequests.app.AppDelegate; import itis.homework.parallelrequests.network.RequestsService; import rx.Observable; import rx.schedulers.Schedulers; package itis.homework.parallelrequests; /** * @author Artur Vasilov */ public class MainFragment extends Fragment { private RequestsService mRequestsService; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);
mRequestsService = AppDelegate.get(getActivity()).getRequestsService();
ArturVasilov/RxSamplesPractice
RxPractice/app/src/main/java/ru/samples/itis/rxpractice/tasks/RxJavaTask3.java
// Path: RxPractice/app/src/main/java/ru/samples/itis/rxpractice/content/Person.java // public class Person { // // private final String mName; // private final int mAge; // // public Person(@NonNull String name, int age) { // mName = name; // mAge = age; // } // // @NonNull // public String getName() { // return mName; // } // // public int getAge() { // return mAge; // } // // @Override // public boolean equals(Object o) { // if (this == o) { // return true; // } // if (o == null || getClass() != o.getClass()) { // return false; // } // // Person person = (Person) o; // return getAge() == person.getAge() && getName().equals(person.getName()); // // } // // @Override // public int hashCode() { // int result = getName().hashCode(); // result = 31 * result + getAge(); // return result; // } // // @Override // public String toString() { // return "Person{" + // "mName='" + mName + '\'' + // ", mAge=" + mAge + // '}'; // } // // public int intValue() { // return getName().length() + getAge(); // } // // @NonNull // public Person makeChild(@NonNull Person person) { // String name = getName() + " : " + person.getName(); // return new Person(name, 0); // } // // @NonNull // public static Person randomPerson() { // Random random = new SecureRandom(); // final String template = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + // "abcdefghijklmnopqrstuvwxyz"; // // String name = randomString(random, template, random.nextInt(15) + 3); // int age = random.nextInt(100); // return new Person(name, age); // } // // @NonNull // public static List<Person> randomPersonsList(int size) { // List<Person> list = new ArrayList<>(size); // for (int i = 0; i < size; i++) { // list.add(randomPerson()); // } // return list; // } // // @NonNull // private static String randomString(Random random, String characters, int length) { // char[] text = new char[length]; // for (int i = 0; i < length; i++) { // text[i] = characters.charAt(random.nextInt(characters.length())); // } // return new String(text); // } // }
import android.support.annotation.NonNull; import java.util.List; import ru.samples.itis.rxpractice.content.Person; import rx.Observable;
package ru.samples.itis.rxpractice.tasks; /** * @author Artur Vasilov */ public class RxJavaTask3 { /** * TODO : implement this method * * This method takes observable of list of persons as a parameter. * Note: observable may have more than one persons list * * 1) Transform observable of list of persons into single observable of all persons * 2) For each person in new observable double person name * 3) Remove same persons from observable * 4) Create observable of single integer * which represents sum of calls Person#intValue for every persons * 5) Return observable from step 4 * * @param observable - observable of persons list * @return observable with single integer values */ @NonNull public static Observable<Integer> task3Observable(
// Path: RxPractice/app/src/main/java/ru/samples/itis/rxpractice/content/Person.java // public class Person { // // private final String mName; // private final int mAge; // // public Person(@NonNull String name, int age) { // mName = name; // mAge = age; // } // // @NonNull // public String getName() { // return mName; // } // // public int getAge() { // return mAge; // } // // @Override // public boolean equals(Object o) { // if (this == o) { // return true; // } // if (o == null || getClass() != o.getClass()) { // return false; // } // // Person person = (Person) o; // return getAge() == person.getAge() && getName().equals(person.getName()); // // } // // @Override // public int hashCode() { // int result = getName().hashCode(); // result = 31 * result + getAge(); // return result; // } // // @Override // public String toString() { // return "Person{" + // "mName='" + mName + '\'' + // ", mAge=" + mAge + // '}'; // } // // public int intValue() { // return getName().length() + getAge(); // } // // @NonNull // public Person makeChild(@NonNull Person person) { // String name = getName() + " : " + person.getName(); // return new Person(name, 0); // } // // @NonNull // public static Person randomPerson() { // Random random = new SecureRandom(); // final String template = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + // "abcdefghijklmnopqrstuvwxyz"; // // String name = randomString(random, template, random.nextInt(15) + 3); // int age = random.nextInt(100); // return new Person(name, age); // } // // @NonNull // public static List<Person> randomPersonsList(int size) { // List<Person> list = new ArrayList<>(size); // for (int i = 0; i < size; i++) { // list.add(randomPerson()); // } // return list; // } // // @NonNull // private static String randomString(Random random, String characters, int length) { // char[] text = new char[length]; // for (int i = 0; i < length; i++) { // text[i] = characters.charAt(random.nextInt(characters.length())); // } // return new String(text); // } // } // Path: RxPractice/app/src/main/java/ru/samples/itis/rxpractice/tasks/RxJavaTask3.java import android.support.annotation.NonNull; import java.util.List; import ru.samples.itis.rxpractice.content.Person; import rx.Observable; package ru.samples.itis.rxpractice.tasks; /** * @author Artur Vasilov */ public class RxJavaTask3 { /** * TODO : implement this method * * This method takes observable of list of persons as a parameter. * Note: observable may have more than one persons list * * 1) Transform observable of list of persons into single observable of all persons * 2) For each person in new observable double person name * 3) Remove same persons from observable * 4) Create observable of single integer * which represents sum of calls Person#intValue for every persons * 5) Return observable from step 4 * * @param observable - observable of persons list * @return observable with single integer values */ @NonNull public static Observable<Integer> task3Observable(
@NonNull Observable<List<Person>> observable) {
ArturVasilov/RxSamplesPractice
RxPractice/app/src/test/java/ru/samples/itis/rxpractice/Task1Test.java
// Path: RxPractice/app/src/main/java/ru/samples/itis/rxpractice/tasks/RxJavaTask1.java // public class RxJavaTask1 { // // /** // * TODO : implement this method // * // * This method takes list of strings and creates an observable of integers, // * that represents length of strings which contains letter 'r' (or 'R') // * // * @param list - list of string // * @return integer observable with strings length // */ // @NonNull // public static Observable<Integer> task1Observable(@NonNull List<String> list) { // throw new RuntimeException("Observable not implemented exception"); // } // // }
import android.support.annotation.NonNull; import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; import java.security.SecureRandom; import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Random; import ru.samples.itis.rxpractice.tasks.RxJavaTask1; import rx.Observable; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.fail;
package ru.samples.itis.rxpractice; /** * @author Artur Vasilov */ @RunWith(JUnit4.class) public class Task1Test { @Test public void testInput1() throws Exception { List<String> list = createList("Hello", "Reactive", "World");
// Path: RxPractice/app/src/main/java/ru/samples/itis/rxpractice/tasks/RxJavaTask1.java // public class RxJavaTask1 { // // /** // * TODO : implement this method // * // * This method takes list of strings and creates an observable of integers, // * that represents length of strings which contains letter 'r' (or 'R') // * // * @param list - list of string // * @return integer observable with strings length // */ // @NonNull // public static Observable<Integer> task1Observable(@NonNull List<String> list) { // throw new RuntimeException("Observable not implemented exception"); // } // // } // Path: RxPractice/app/src/test/java/ru/samples/itis/rxpractice/Task1Test.java import android.support.annotation.NonNull; import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; import java.security.SecureRandom; import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Random; import ru.samples.itis.rxpractice.tasks.RxJavaTask1; import rx.Observable; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.fail; package ru.samples.itis.rxpractice; /** * @author Artur Vasilov */ @RunWith(JUnit4.class) public class Task1Test { @Test public void testInput1() throws Exception { List<String> list = createList("Hello", "Reactive", "World");
Observable<Integer> observable = RxJavaTask1.task1Observable(list);
ArturVasilov/RxSamplesPractice
ParallelRequests/app/src/main/java/itis/homework/parallelrequests/network/RequestControllerImpl.java
// Path: ParallelRequests/app/src/main/java/itis/homework/parallelrequests/app/LoadingStateChangedEvent.java // public class LoadingStateChangedEvent { // // private final RequestsState mState; // // private LoadingStateChangedEvent(RequestsState state) { // mState = state; // } // // @Produce // @NonNull // public static LoadingStateChangedEvent produce(@NonNull RequestsState state) { // return new LoadingStateChangedEvent(state); // } // // @NonNull // public RequestsState getState() { // return mState; // } // } // // Path: ParallelRequests/app/src/main/java/itis/homework/parallelrequests/app/Otto.java // public class Otto { // // private final Bus mBus; // // private Otto(Bus bus) { // mBus = bus; // } // // @NonNull // public static Otto get() { // return Holder.INSTANCE; // } // // public void post(final @NonNull Object event) { // if (Looper.myLooper() == Looper.getMainLooper()) { // mBus.post(event); // } // else { // MainQueue.get().invoke(new Runnable() { // @Override // public void run() { // mBus.post(event); // } // }); // } // } // // public void register(@NonNull Object object) { // mBus.register(object); // } // // public void unregister(@NonNull Object object) { // mBus.unregister(object); // } // // private static final class Holder { // public static final Otto INSTANCE = new Otto(new Bus()); // } // }
import java.util.ArrayList; import java.util.List; import itis.homework.parallelrequests.app.LoadingStateChangedEvent; import itis.homework.parallelrequests.app.Otto;
package itis.homework.parallelrequests.network; /** * @author Artur Vasilov */ public class RequestControllerImpl implements RequestsController { private final List<RequestType> mLoadingRequests; private final List<RequestType> mLoadedRequests; private boolean mIsFatalError = false; public RequestControllerImpl() { mLoadingRequests = new ArrayList<>(); mLoadedRequests = new ArrayList<>(); } @Override public boolean tryRequest(RequestType requestType) { if (mIsFatalError) { return false; } if (mLoadingRequests.contains(requestType) || mLoadedRequests.contains(requestType)) { return false; } if (requestType == RequestType.AUTH || requestType == RequestType.CONFIG) { mLoadingRequests.add(requestType);
// Path: ParallelRequests/app/src/main/java/itis/homework/parallelrequests/app/LoadingStateChangedEvent.java // public class LoadingStateChangedEvent { // // private final RequestsState mState; // // private LoadingStateChangedEvent(RequestsState state) { // mState = state; // } // // @Produce // @NonNull // public static LoadingStateChangedEvent produce(@NonNull RequestsState state) { // return new LoadingStateChangedEvent(state); // } // // @NonNull // public RequestsState getState() { // return mState; // } // } // // Path: ParallelRequests/app/src/main/java/itis/homework/parallelrequests/app/Otto.java // public class Otto { // // private final Bus mBus; // // private Otto(Bus bus) { // mBus = bus; // } // // @NonNull // public static Otto get() { // return Holder.INSTANCE; // } // // public void post(final @NonNull Object event) { // if (Looper.myLooper() == Looper.getMainLooper()) { // mBus.post(event); // } // else { // MainQueue.get().invoke(new Runnable() { // @Override // public void run() { // mBus.post(event); // } // }); // } // } // // public void register(@NonNull Object object) { // mBus.register(object); // } // // public void unregister(@NonNull Object object) { // mBus.unregister(object); // } // // private static final class Holder { // public static final Otto INSTANCE = new Otto(new Bus()); // } // } // Path: ParallelRequests/app/src/main/java/itis/homework/parallelrequests/network/RequestControllerImpl.java import java.util.ArrayList; import java.util.List; import itis.homework.parallelrequests.app.LoadingStateChangedEvent; import itis.homework.parallelrequests.app.Otto; package itis.homework.parallelrequests.network; /** * @author Artur Vasilov */ public class RequestControllerImpl implements RequestsController { private final List<RequestType> mLoadingRequests; private final List<RequestType> mLoadedRequests; private boolean mIsFatalError = false; public RequestControllerImpl() { mLoadingRequests = new ArrayList<>(); mLoadedRequests = new ArrayList<>(); } @Override public boolean tryRequest(RequestType requestType) { if (mIsFatalError) { return false; } if (mLoadingRequests.contains(requestType) || mLoadedRequests.contains(requestType)) { return false; } if (requestType == RequestType.AUTH || requestType == RequestType.CONFIG) { mLoadingRequests.add(requestType);
Otto.get().post(LoadingStateChangedEvent.produce(new RequestsState(RequestsState.GeneralState.LOADING,
ArturVasilov/RxSamplesPractice
ParallelRequests/app/src/main/java/itis/homework/parallelrequests/network/RequestControllerImpl.java
// Path: ParallelRequests/app/src/main/java/itis/homework/parallelrequests/app/LoadingStateChangedEvent.java // public class LoadingStateChangedEvent { // // private final RequestsState mState; // // private LoadingStateChangedEvent(RequestsState state) { // mState = state; // } // // @Produce // @NonNull // public static LoadingStateChangedEvent produce(@NonNull RequestsState state) { // return new LoadingStateChangedEvent(state); // } // // @NonNull // public RequestsState getState() { // return mState; // } // } // // Path: ParallelRequests/app/src/main/java/itis/homework/parallelrequests/app/Otto.java // public class Otto { // // private final Bus mBus; // // private Otto(Bus bus) { // mBus = bus; // } // // @NonNull // public static Otto get() { // return Holder.INSTANCE; // } // // public void post(final @NonNull Object event) { // if (Looper.myLooper() == Looper.getMainLooper()) { // mBus.post(event); // } // else { // MainQueue.get().invoke(new Runnable() { // @Override // public void run() { // mBus.post(event); // } // }); // } // } // // public void register(@NonNull Object object) { // mBus.register(object); // } // // public void unregister(@NonNull Object object) { // mBus.unregister(object); // } // // private static final class Holder { // public static final Otto INSTANCE = new Otto(new Bus()); // } // }
import java.util.ArrayList; import java.util.List; import itis.homework.parallelrequests.app.LoadingStateChangedEvent; import itis.homework.parallelrequests.app.Otto;
package itis.homework.parallelrequests.network; /** * @author Artur Vasilov */ public class RequestControllerImpl implements RequestsController { private final List<RequestType> mLoadingRequests; private final List<RequestType> mLoadedRequests; private boolean mIsFatalError = false; public RequestControllerImpl() { mLoadingRequests = new ArrayList<>(); mLoadedRequests = new ArrayList<>(); } @Override public boolean tryRequest(RequestType requestType) { if (mIsFatalError) { return false; } if (mLoadingRequests.contains(requestType) || mLoadedRequests.contains(requestType)) { return false; } if (requestType == RequestType.AUTH || requestType == RequestType.CONFIG) { mLoadingRequests.add(requestType);
// Path: ParallelRequests/app/src/main/java/itis/homework/parallelrequests/app/LoadingStateChangedEvent.java // public class LoadingStateChangedEvent { // // private final RequestsState mState; // // private LoadingStateChangedEvent(RequestsState state) { // mState = state; // } // // @Produce // @NonNull // public static LoadingStateChangedEvent produce(@NonNull RequestsState state) { // return new LoadingStateChangedEvent(state); // } // // @NonNull // public RequestsState getState() { // return mState; // } // } // // Path: ParallelRequests/app/src/main/java/itis/homework/parallelrequests/app/Otto.java // public class Otto { // // private final Bus mBus; // // private Otto(Bus bus) { // mBus = bus; // } // // @NonNull // public static Otto get() { // return Holder.INSTANCE; // } // // public void post(final @NonNull Object event) { // if (Looper.myLooper() == Looper.getMainLooper()) { // mBus.post(event); // } // else { // MainQueue.get().invoke(new Runnable() { // @Override // public void run() { // mBus.post(event); // } // }); // } // } // // public void register(@NonNull Object object) { // mBus.register(object); // } // // public void unregister(@NonNull Object object) { // mBus.unregister(object); // } // // private static final class Holder { // public static final Otto INSTANCE = new Otto(new Bus()); // } // } // Path: ParallelRequests/app/src/main/java/itis/homework/parallelrequests/network/RequestControllerImpl.java import java.util.ArrayList; import java.util.List; import itis.homework.parallelrequests.app.LoadingStateChangedEvent; import itis.homework.parallelrequests.app.Otto; package itis.homework.parallelrequests.network; /** * @author Artur Vasilov */ public class RequestControllerImpl implements RequestsController { private final List<RequestType> mLoadingRequests; private final List<RequestType> mLoadedRequests; private boolean mIsFatalError = false; public RequestControllerImpl() { mLoadingRequests = new ArrayList<>(); mLoadedRequests = new ArrayList<>(); } @Override public boolean tryRequest(RequestType requestType) { if (mIsFatalError) { return false; } if (mLoadingRequests.contains(requestType) || mLoadedRequests.contains(requestType)) { return false; } if (requestType == RequestType.AUTH || requestType == RequestType.CONFIG) { mLoadingRequests.add(requestType);
Otto.get().post(LoadingStateChangedEvent.produce(new RequestsState(RequestsState.GeneralState.LOADING,
ArturVasilov/RxSamplesPractice
RxArhictecture/app/src/main/java/ru/samples/itis/rxarhictecture/database/PersonsProvider.java
// Path: RxArhictecture/app/src/main/java/ru/samples/itis/rxarhictecture/database/Utils.java // public static int safeIntFromCursor(@NonNull Cursor cursor, @NonNull String column) { // try { // return cursor.getInt(cursor.getColumnIndex(column)); // } catch (Exception e) { // return 0; // } // } // // Path: RxArhictecture/app/src/main/java/ru/samples/itis/rxarhictecture/database/Utils.java // public static String safeStringFromCursor(@NonNull Cursor cursor, @NonNull String column) { // try { // return cursor.getString(cursor.getColumnIndex(column)); // } catch (Exception e) { // return ""; // } // }
import android.content.ContentValues; import android.content.Context; import android.database.Cursor; import android.net.Uri; import android.support.annotation.NonNull; import java.util.ArrayList; import java.util.List; import static ru.samples.itis.rxarhictecture.database.Utils.safeIntFromCursor; import static ru.samples.itis.rxarhictecture.database.Utils.safeStringFromCursor;
package ru.samples.itis.rxarhictecture.database; /** * @author Artur Vasilov */ public class PersonsProvider { public static final Uri URI = DatabaseProvider.BASE_CONTENT_URI .buildUpon() .appendPath(PersonTable.getTable().getTableName()) .build(); public static void save(Context context, @NonNull Person person) { context.getContentResolver().insert(URI, toContentValues(person)); } public static void save(Context context, @NonNull List<Person> persons) { ContentValues[] values = new ContentValues[persons.size()]; for (int i = 0; i < persons.size(); i++) { values[i] = toContentValues(persons.get(i)); } context.getContentResolver().bulkInsert(URI, values); } @NonNull public static ContentValues toContentValues(@NonNull Person person) { ContentValues values = new ContentValues(); values.put(PersonTable.Columns.NAME, person.getName()); values.put(PersonTable.Columns.AGE, person.getAge()); return values; } @NonNull public static Person fromCursor(@NonNull Cursor cursor) {
// Path: RxArhictecture/app/src/main/java/ru/samples/itis/rxarhictecture/database/Utils.java // public static int safeIntFromCursor(@NonNull Cursor cursor, @NonNull String column) { // try { // return cursor.getInt(cursor.getColumnIndex(column)); // } catch (Exception e) { // return 0; // } // } // // Path: RxArhictecture/app/src/main/java/ru/samples/itis/rxarhictecture/database/Utils.java // public static String safeStringFromCursor(@NonNull Cursor cursor, @NonNull String column) { // try { // return cursor.getString(cursor.getColumnIndex(column)); // } catch (Exception e) { // return ""; // } // } // Path: RxArhictecture/app/src/main/java/ru/samples/itis/rxarhictecture/database/PersonsProvider.java import android.content.ContentValues; import android.content.Context; import android.database.Cursor; import android.net.Uri; import android.support.annotation.NonNull; import java.util.ArrayList; import java.util.List; import static ru.samples.itis.rxarhictecture.database.Utils.safeIntFromCursor; import static ru.samples.itis.rxarhictecture.database.Utils.safeStringFromCursor; package ru.samples.itis.rxarhictecture.database; /** * @author Artur Vasilov */ public class PersonsProvider { public static final Uri URI = DatabaseProvider.BASE_CONTENT_URI .buildUpon() .appendPath(PersonTable.getTable().getTableName()) .build(); public static void save(Context context, @NonNull Person person) { context.getContentResolver().insert(URI, toContentValues(person)); } public static void save(Context context, @NonNull List<Person> persons) { ContentValues[] values = new ContentValues[persons.size()]; for (int i = 0; i < persons.size(); i++) { values[i] = toContentValues(persons.get(i)); } context.getContentResolver().bulkInsert(URI, values); } @NonNull public static ContentValues toContentValues(@NonNull Person person) { ContentValues values = new ContentValues(); values.put(PersonTable.Columns.NAME, person.getName()); values.put(PersonTable.Columns.AGE, person.getAge()); return values; } @NonNull public static Person fromCursor(@NonNull Cursor cursor) {
String name = safeStringFromCursor(cursor, PersonTable.Columns.NAME);
ArturVasilov/RxSamplesPractice
RxArhictecture/app/src/main/java/ru/samples/itis/rxarhictecture/database/PersonsProvider.java
// Path: RxArhictecture/app/src/main/java/ru/samples/itis/rxarhictecture/database/Utils.java // public static int safeIntFromCursor(@NonNull Cursor cursor, @NonNull String column) { // try { // return cursor.getInt(cursor.getColumnIndex(column)); // } catch (Exception e) { // return 0; // } // } // // Path: RxArhictecture/app/src/main/java/ru/samples/itis/rxarhictecture/database/Utils.java // public static String safeStringFromCursor(@NonNull Cursor cursor, @NonNull String column) { // try { // return cursor.getString(cursor.getColumnIndex(column)); // } catch (Exception e) { // return ""; // } // }
import android.content.ContentValues; import android.content.Context; import android.database.Cursor; import android.net.Uri; import android.support.annotation.NonNull; import java.util.ArrayList; import java.util.List; import static ru.samples.itis.rxarhictecture.database.Utils.safeIntFromCursor; import static ru.samples.itis.rxarhictecture.database.Utils.safeStringFromCursor;
package ru.samples.itis.rxarhictecture.database; /** * @author Artur Vasilov */ public class PersonsProvider { public static final Uri URI = DatabaseProvider.BASE_CONTENT_URI .buildUpon() .appendPath(PersonTable.getTable().getTableName()) .build(); public static void save(Context context, @NonNull Person person) { context.getContentResolver().insert(URI, toContentValues(person)); } public static void save(Context context, @NonNull List<Person> persons) { ContentValues[] values = new ContentValues[persons.size()]; for (int i = 0; i < persons.size(); i++) { values[i] = toContentValues(persons.get(i)); } context.getContentResolver().bulkInsert(URI, values); } @NonNull public static ContentValues toContentValues(@NonNull Person person) { ContentValues values = new ContentValues(); values.put(PersonTable.Columns.NAME, person.getName()); values.put(PersonTable.Columns.AGE, person.getAge()); return values; } @NonNull public static Person fromCursor(@NonNull Cursor cursor) { String name = safeStringFromCursor(cursor, PersonTable.Columns.NAME);
// Path: RxArhictecture/app/src/main/java/ru/samples/itis/rxarhictecture/database/Utils.java // public static int safeIntFromCursor(@NonNull Cursor cursor, @NonNull String column) { // try { // return cursor.getInt(cursor.getColumnIndex(column)); // } catch (Exception e) { // return 0; // } // } // // Path: RxArhictecture/app/src/main/java/ru/samples/itis/rxarhictecture/database/Utils.java // public static String safeStringFromCursor(@NonNull Cursor cursor, @NonNull String column) { // try { // return cursor.getString(cursor.getColumnIndex(column)); // } catch (Exception e) { // return ""; // } // } // Path: RxArhictecture/app/src/main/java/ru/samples/itis/rxarhictecture/database/PersonsProvider.java import android.content.ContentValues; import android.content.Context; import android.database.Cursor; import android.net.Uri; import android.support.annotation.NonNull; import java.util.ArrayList; import java.util.List; import static ru.samples.itis.rxarhictecture.database.Utils.safeIntFromCursor; import static ru.samples.itis.rxarhictecture.database.Utils.safeStringFromCursor; package ru.samples.itis.rxarhictecture.database; /** * @author Artur Vasilov */ public class PersonsProvider { public static final Uri URI = DatabaseProvider.BASE_CONTENT_URI .buildUpon() .appendPath(PersonTable.getTable().getTableName()) .build(); public static void save(Context context, @NonNull Person person) { context.getContentResolver().insert(URI, toContentValues(person)); } public static void save(Context context, @NonNull List<Person> persons) { ContentValues[] values = new ContentValues[persons.size()]; for (int i = 0; i < persons.size(); i++) { values[i] = toContentValues(persons.get(i)); } context.getContentResolver().bulkInsert(URI, values); } @NonNull public static ContentValues toContentValues(@NonNull Person person) { ContentValues values = new ContentValues(); values.put(PersonTable.Columns.NAME, person.getName()); values.put(PersonTable.Columns.AGE, person.getAge()); return values; } @NonNull public static Person fromCursor(@NonNull Cursor cursor) { String name = safeStringFromCursor(cursor, PersonTable.Columns.NAME);
int age = safeIntFromCursor(cursor, PersonTable.Columns.AGE);
ArturVasilov/RxSamplesPractice
RxPractice/app/src/test/java/ru/samples/itis/rxpractice/Task3Test.java
// Path: RxPractice/app/src/main/java/ru/samples/itis/rxpractice/content/Person.java // public class Person { // // private final String mName; // private final int mAge; // // public Person(@NonNull String name, int age) { // mName = name; // mAge = age; // } // // @NonNull // public String getName() { // return mName; // } // // public int getAge() { // return mAge; // } // // @Override // public boolean equals(Object o) { // if (this == o) { // return true; // } // if (o == null || getClass() != o.getClass()) { // return false; // } // // Person person = (Person) o; // return getAge() == person.getAge() && getName().equals(person.getName()); // // } // // @Override // public int hashCode() { // int result = getName().hashCode(); // result = 31 * result + getAge(); // return result; // } // // @Override // public String toString() { // return "Person{" + // "mName='" + mName + '\'' + // ", mAge=" + mAge + // '}'; // } // // public int intValue() { // return getName().length() + getAge(); // } // // @NonNull // public Person makeChild(@NonNull Person person) { // String name = getName() + " : " + person.getName(); // return new Person(name, 0); // } // // @NonNull // public static Person randomPerson() { // Random random = new SecureRandom(); // final String template = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + // "abcdefghijklmnopqrstuvwxyz"; // // String name = randomString(random, template, random.nextInt(15) + 3); // int age = random.nextInt(100); // return new Person(name, age); // } // // @NonNull // public static List<Person> randomPersonsList(int size) { // List<Person> list = new ArrayList<>(size); // for (int i = 0; i < size; i++) { // list.add(randomPerson()); // } // return list; // } // // @NonNull // private static String randomString(Random random, String characters, int length) { // char[] text = new char[length]; // for (int i = 0; i < length; i++) { // text[i] = characters.charAt(random.nextInt(characters.length())); // } // return new String(text); // } // } // // Path: RxPractice/app/src/main/java/ru/samples/itis/rxpractice/tasks/RxJavaTask3.java // public class RxJavaTask3 { // // /** // * TODO : implement this method // * // * This method takes observable of list of persons as a parameter. // * Note: observable may have more than one persons list // * // * 1) Transform observable of list of persons into single observable of all persons // * 2) For each person in new observable double person name // * 3) Remove same persons from observable // * 4) Create observable of single integer // * which represents sum of calls Person#intValue for every persons // * 5) Return observable from step 4 // * // * @param observable - observable of persons list // * @return observable with single integer values // */ // @NonNull // public static Observable<Integer> task3Observable( // @NonNull Observable<List<Person>> observable) { // throw new RuntimeException("Observable not implemented exception"); // } // // }
import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; import java.util.ArrayList; import java.util.List; import ru.samples.itis.rxpractice.content.Person; import ru.samples.itis.rxpractice.tasks.RxJavaTask3; import rx.Observable; import static junit.framework.Assert.assertEquals; import static junit.framework.Assert.assertNotNull;
package ru.samples.itis.rxpractice; /** * @author Artur Vasilov */ @RunWith(JUnit4.class) public class Task3Test { @Test public void testInitialized() throws Exception {
// Path: RxPractice/app/src/main/java/ru/samples/itis/rxpractice/content/Person.java // public class Person { // // private final String mName; // private final int mAge; // // public Person(@NonNull String name, int age) { // mName = name; // mAge = age; // } // // @NonNull // public String getName() { // return mName; // } // // public int getAge() { // return mAge; // } // // @Override // public boolean equals(Object o) { // if (this == o) { // return true; // } // if (o == null || getClass() != o.getClass()) { // return false; // } // // Person person = (Person) o; // return getAge() == person.getAge() && getName().equals(person.getName()); // // } // // @Override // public int hashCode() { // int result = getName().hashCode(); // result = 31 * result + getAge(); // return result; // } // // @Override // public String toString() { // return "Person{" + // "mName='" + mName + '\'' + // ", mAge=" + mAge + // '}'; // } // // public int intValue() { // return getName().length() + getAge(); // } // // @NonNull // public Person makeChild(@NonNull Person person) { // String name = getName() + " : " + person.getName(); // return new Person(name, 0); // } // // @NonNull // public static Person randomPerson() { // Random random = new SecureRandom(); // final String template = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + // "abcdefghijklmnopqrstuvwxyz"; // // String name = randomString(random, template, random.nextInt(15) + 3); // int age = random.nextInt(100); // return new Person(name, age); // } // // @NonNull // public static List<Person> randomPersonsList(int size) { // List<Person> list = new ArrayList<>(size); // for (int i = 0; i < size; i++) { // list.add(randomPerson()); // } // return list; // } // // @NonNull // private static String randomString(Random random, String characters, int length) { // char[] text = new char[length]; // for (int i = 0; i < length; i++) { // text[i] = characters.charAt(random.nextInt(characters.length())); // } // return new String(text); // } // } // // Path: RxPractice/app/src/main/java/ru/samples/itis/rxpractice/tasks/RxJavaTask3.java // public class RxJavaTask3 { // // /** // * TODO : implement this method // * // * This method takes observable of list of persons as a parameter. // * Note: observable may have more than one persons list // * // * 1) Transform observable of list of persons into single observable of all persons // * 2) For each person in new observable double person name // * 3) Remove same persons from observable // * 4) Create observable of single integer // * which represents sum of calls Person#intValue for every persons // * 5) Return observable from step 4 // * // * @param observable - observable of persons list // * @return observable with single integer values // */ // @NonNull // public static Observable<Integer> task3Observable( // @NonNull Observable<List<Person>> observable) { // throw new RuntimeException("Observable not implemented exception"); // } // // } // Path: RxPractice/app/src/test/java/ru/samples/itis/rxpractice/Task3Test.java import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; import java.util.ArrayList; import java.util.List; import ru.samples.itis.rxpractice.content.Person; import ru.samples.itis.rxpractice.tasks.RxJavaTask3; import rx.Observable; import static junit.framework.Assert.assertEquals; import static junit.framework.Assert.assertNotNull; package ru.samples.itis.rxpractice; /** * @author Artur Vasilov */ @RunWith(JUnit4.class) public class Task3Test { @Test public void testInitialized() throws Exception {
Observable<Integer> observable = RxJavaTask3.task3Observable(Observable.just(new Person("a", 10)).toList());
ArturVasilov/RxSamplesPractice
RxPractice/app/src/test/java/ru/samples/itis/rxpractice/Task3Test.java
// Path: RxPractice/app/src/main/java/ru/samples/itis/rxpractice/content/Person.java // public class Person { // // private final String mName; // private final int mAge; // // public Person(@NonNull String name, int age) { // mName = name; // mAge = age; // } // // @NonNull // public String getName() { // return mName; // } // // public int getAge() { // return mAge; // } // // @Override // public boolean equals(Object o) { // if (this == o) { // return true; // } // if (o == null || getClass() != o.getClass()) { // return false; // } // // Person person = (Person) o; // return getAge() == person.getAge() && getName().equals(person.getName()); // // } // // @Override // public int hashCode() { // int result = getName().hashCode(); // result = 31 * result + getAge(); // return result; // } // // @Override // public String toString() { // return "Person{" + // "mName='" + mName + '\'' + // ", mAge=" + mAge + // '}'; // } // // public int intValue() { // return getName().length() + getAge(); // } // // @NonNull // public Person makeChild(@NonNull Person person) { // String name = getName() + " : " + person.getName(); // return new Person(name, 0); // } // // @NonNull // public static Person randomPerson() { // Random random = new SecureRandom(); // final String template = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + // "abcdefghijklmnopqrstuvwxyz"; // // String name = randomString(random, template, random.nextInt(15) + 3); // int age = random.nextInt(100); // return new Person(name, age); // } // // @NonNull // public static List<Person> randomPersonsList(int size) { // List<Person> list = new ArrayList<>(size); // for (int i = 0; i < size; i++) { // list.add(randomPerson()); // } // return list; // } // // @NonNull // private static String randomString(Random random, String characters, int length) { // char[] text = new char[length]; // for (int i = 0; i < length; i++) { // text[i] = characters.charAt(random.nextInt(characters.length())); // } // return new String(text); // } // } // // Path: RxPractice/app/src/main/java/ru/samples/itis/rxpractice/tasks/RxJavaTask3.java // public class RxJavaTask3 { // // /** // * TODO : implement this method // * // * This method takes observable of list of persons as a parameter. // * Note: observable may have more than one persons list // * // * 1) Transform observable of list of persons into single observable of all persons // * 2) For each person in new observable double person name // * 3) Remove same persons from observable // * 4) Create observable of single integer // * which represents sum of calls Person#intValue for every persons // * 5) Return observable from step 4 // * // * @param observable - observable of persons list // * @return observable with single integer values // */ // @NonNull // public static Observable<Integer> task3Observable( // @NonNull Observable<List<Person>> observable) { // throw new RuntimeException("Observable not implemented exception"); // } // // }
import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; import java.util.ArrayList; import java.util.List; import ru.samples.itis.rxpractice.content.Person; import ru.samples.itis.rxpractice.tasks.RxJavaTask3; import rx.Observable; import static junit.framework.Assert.assertEquals; import static junit.framework.Assert.assertNotNull;
package ru.samples.itis.rxpractice; /** * @author Artur Vasilov */ @RunWith(JUnit4.class) public class Task3Test { @Test public void testInitialized() throws Exception {
// Path: RxPractice/app/src/main/java/ru/samples/itis/rxpractice/content/Person.java // public class Person { // // private final String mName; // private final int mAge; // // public Person(@NonNull String name, int age) { // mName = name; // mAge = age; // } // // @NonNull // public String getName() { // return mName; // } // // public int getAge() { // return mAge; // } // // @Override // public boolean equals(Object o) { // if (this == o) { // return true; // } // if (o == null || getClass() != o.getClass()) { // return false; // } // // Person person = (Person) o; // return getAge() == person.getAge() && getName().equals(person.getName()); // // } // // @Override // public int hashCode() { // int result = getName().hashCode(); // result = 31 * result + getAge(); // return result; // } // // @Override // public String toString() { // return "Person{" + // "mName='" + mName + '\'' + // ", mAge=" + mAge + // '}'; // } // // public int intValue() { // return getName().length() + getAge(); // } // // @NonNull // public Person makeChild(@NonNull Person person) { // String name = getName() + " : " + person.getName(); // return new Person(name, 0); // } // // @NonNull // public static Person randomPerson() { // Random random = new SecureRandom(); // final String template = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + // "abcdefghijklmnopqrstuvwxyz"; // // String name = randomString(random, template, random.nextInt(15) + 3); // int age = random.nextInt(100); // return new Person(name, age); // } // // @NonNull // public static List<Person> randomPersonsList(int size) { // List<Person> list = new ArrayList<>(size); // for (int i = 0; i < size; i++) { // list.add(randomPerson()); // } // return list; // } // // @NonNull // private static String randomString(Random random, String characters, int length) { // char[] text = new char[length]; // for (int i = 0; i < length; i++) { // text[i] = characters.charAt(random.nextInt(characters.length())); // } // return new String(text); // } // } // // Path: RxPractice/app/src/main/java/ru/samples/itis/rxpractice/tasks/RxJavaTask3.java // public class RxJavaTask3 { // // /** // * TODO : implement this method // * // * This method takes observable of list of persons as a parameter. // * Note: observable may have more than one persons list // * // * 1) Transform observable of list of persons into single observable of all persons // * 2) For each person in new observable double person name // * 3) Remove same persons from observable // * 4) Create observable of single integer // * which represents sum of calls Person#intValue for every persons // * 5) Return observable from step 4 // * // * @param observable - observable of persons list // * @return observable with single integer values // */ // @NonNull // public static Observable<Integer> task3Observable( // @NonNull Observable<List<Person>> observable) { // throw new RuntimeException("Observable not implemented exception"); // } // // } // Path: RxPractice/app/src/test/java/ru/samples/itis/rxpractice/Task3Test.java import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; import java.util.ArrayList; import java.util.List; import ru.samples.itis.rxpractice.content.Person; import ru.samples.itis.rxpractice.tasks.RxJavaTask3; import rx.Observable; import static junit.framework.Assert.assertEquals; import static junit.framework.Assert.assertNotNull; package ru.samples.itis.rxpractice; /** * @author Artur Vasilov */ @RunWith(JUnit4.class) public class Task3Test { @Test public void testInitialized() throws Exception {
Observable<Integer> observable = RxJavaTask3.task3Observable(Observable.just(new Person("a", 10)).toList());
ArturVasilov/RxSamplesPractice
RxPractice/app/src/test/java/ru/samples/itis/rxpractice/SampleTaskTest.java
// Path: RxPractice/app/src/main/java/ru/samples/itis/rxpractice/tasks/RxJavaSampleTask.java // public class RxJavaSampleTask { // // /** // * Sample method for practice - for demo // * // * @param version - current version name // * @return is device has Android version greater than 21 // */ // @NonNull // public static Observable<Boolean> isLollipopOrHigher(int version) { // return Observable.just(version >= 21); // } // // }
import junit.framework.Assert; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; import ru.samples.itis.rxpractice.tasks.RxJavaSampleTask; import rx.Observable; import static junit.framework.Assert.assertNotNull;
package ru.samples.itis.rxpractice; /** * @author Artur Vasilov */ @RunWith(JUnit4.class) public class SampleTaskTest { @Test public void testNotNull() throws Exception {
// Path: RxPractice/app/src/main/java/ru/samples/itis/rxpractice/tasks/RxJavaSampleTask.java // public class RxJavaSampleTask { // // /** // * Sample method for practice - for demo // * // * @param version - current version name // * @return is device has Android version greater than 21 // */ // @NonNull // public static Observable<Boolean> isLollipopOrHigher(int version) { // return Observable.just(version >= 21); // } // // } // Path: RxPractice/app/src/test/java/ru/samples/itis/rxpractice/SampleTaskTest.java import junit.framework.Assert; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; import ru.samples.itis.rxpractice.tasks.RxJavaSampleTask; import rx.Observable; import static junit.framework.Assert.assertNotNull; package ru.samples.itis.rxpractice; /** * @author Artur Vasilov */ @RunWith(JUnit4.class) public class SampleTaskTest { @Test public void testNotNull() throws Exception {
Observable<Boolean> observable = RxJavaSampleTask.isLollipopOrHigher(10);
ArturVasilov/RxSamplesPractice
ParallelRequests/app/src/main/java/itis/homework/parallelrequests/RequestProcessView.java
// Path: ParallelRequests/app/src/main/java/itis/homework/parallelrequests/app/LoadingStateChangedEvent.java // public class LoadingStateChangedEvent { // // private final RequestsState mState; // // private LoadingStateChangedEvent(RequestsState state) { // mState = state; // } // // @Produce // @NonNull // public static LoadingStateChangedEvent produce(@NonNull RequestsState state) { // return new LoadingStateChangedEvent(state); // } // // @NonNull // public RequestsState getState() { // return mState; // } // } // // Path: ParallelRequests/app/src/main/java/itis/homework/parallelrequests/app/MainQueue.java // public class MainQueue { // // private static volatile Handler sMainHandler; // // private MainQueue() { // getMainHandler(); // } // // @NonNull // public static MainQueue get() { // return Holder.MAIN_QUEUE; // } // // @NonNull // public static Handler getMainHandler() { // Handler handler = sMainHandler; // if (sMainHandler == null) { // synchronized (MainQueue.class) { // handler = sMainHandler; // if (sMainHandler == null) { // handler = sMainHandler = new Handler(Looper.getMainLooper()); // } // } // } // return handler; // } // // public void invoke(Runnable runnable) { // sMainHandler.post(runnable); // } // // private static class Holder { // private static final MainQueue MAIN_QUEUE = new MainQueue(); // } // } // // Path: ParallelRequests/app/src/main/java/itis/homework/parallelrequests/app/Otto.java // public class Otto { // // private final Bus mBus; // // private Otto(Bus bus) { // mBus = bus; // } // // @NonNull // public static Otto get() { // return Holder.INSTANCE; // } // // public void post(final @NonNull Object event) { // if (Looper.myLooper() == Looper.getMainLooper()) { // mBus.post(event); // } // else { // MainQueue.get().invoke(new Runnable() { // @Override // public void run() { // mBus.post(event); // } // }); // } // } // // public void register(@NonNull Object object) { // mBus.register(object); // } // // public void unregister(@NonNull Object object) { // mBus.unregister(object); // } // // private static final class Holder { // public static final Otto INSTANCE = new Otto(new Bus()); // } // } // // Path: ParallelRequests/app/src/main/java/itis/homework/parallelrequests/network/RequestType.java // public enum RequestType { // // CONFIG(2_000, R.string.config_request), // AUTH(3_000, R.string.auth_request), // FRIENDS(6_000, R.string.friends_request), // POSTS(10_000, R.string.posts_request), // GROUPS(6_000, R.string.groups_request), // MESSAGES(8_000, R.string.messages_request), // PHOTOS(12_000, R.string.photos_request), // ; // // private final long mDelay; // // @StringRes // private final int mRequestText; // // RequestType(long delay, @StringRes int requestText) { // mDelay = delay; // mRequestText = requestText; // } // // public long getDelay() { // return mDelay; // } // // @StringRes // public int getRequestText() { // return mRequestText; // } // } // // Path: ParallelRequests/app/src/main/java/itis/homework/parallelrequests/network/RequestsState.java // public class RequestsState { // // private final GeneralState mState; // // private final List<RequestType> mLoadingRequests; // // private final List<RequestType> mLoadedRequest; // // public RequestsState(GeneralState state) { // this(state, new ArrayList<RequestType>(), new ArrayList<RequestType>()); // } // // public RequestsState(GeneralState state, @NonNull List<RequestType> loadingRequests, @NonNull List<RequestType> loadedRequest) { // mState = state; // mLoadingRequests = loadingRequests; // mLoadedRequest = loadedRequest; // } // // public boolean isWaiting() { // return mState == GeneralState.WIATING; // } // // public boolean isLoading() { // return mState == GeneralState.LOADING; // } // // public boolean isLoaded() { // return mState == GeneralState.LOADED; // } // // public boolean isError() { // return mState == GeneralState.ERROR; // } // // public boolean isRequestLoading(RequestType requestType) { // return mLoadingRequests.contains(requestType); // } // // public boolean isRequestLoaded(RequestType requestType) { // return mLoadedRequest.contains(requestType); // } // // public enum GeneralState { // WIATING, // LOADING, // LOADED, // ERROR // } // // }
import android.content.Context; import android.support.annotation.NonNull; import android.text.format.DateUtils; import android.util.AttributeSet; import android.view.ViewGroup; import android.widget.LinearLayout; import android.widget.TextView; import com.squareup.otto.Subscribe; import java.util.HashMap; import java.util.Map; import java.util.Timer; import java.util.TimerTask; import itis.homework.parallelrequests.app.LoadingStateChangedEvent; import itis.homework.parallelrequests.app.MainQueue; import itis.homework.parallelrequests.app.Otto; import itis.homework.parallelrequests.network.RequestType; import itis.homework.parallelrequests.network.RequestsState;
package itis.homework.parallelrequests; /** * @author Artur Vasilov */ public class RequestProcessView extends LinearLayout { private TextView mTimerTextView; private ViewGroup mStatusViewContainer;
// Path: ParallelRequests/app/src/main/java/itis/homework/parallelrequests/app/LoadingStateChangedEvent.java // public class LoadingStateChangedEvent { // // private final RequestsState mState; // // private LoadingStateChangedEvent(RequestsState state) { // mState = state; // } // // @Produce // @NonNull // public static LoadingStateChangedEvent produce(@NonNull RequestsState state) { // return new LoadingStateChangedEvent(state); // } // // @NonNull // public RequestsState getState() { // return mState; // } // } // // Path: ParallelRequests/app/src/main/java/itis/homework/parallelrequests/app/MainQueue.java // public class MainQueue { // // private static volatile Handler sMainHandler; // // private MainQueue() { // getMainHandler(); // } // // @NonNull // public static MainQueue get() { // return Holder.MAIN_QUEUE; // } // // @NonNull // public static Handler getMainHandler() { // Handler handler = sMainHandler; // if (sMainHandler == null) { // synchronized (MainQueue.class) { // handler = sMainHandler; // if (sMainHandler == null) { // handler = sMainHandler = new Handler(Looper.getMainLooper()); // } // } // } // return handler; // } // // public void invoke(Runnable runnable) { // sMainHandler.post(runnable); // } // // private static class Holder { // private static final MainQueue MAIN_QUEUE = new MainQueue(); // } // } // // Path: ParallelRequests/app/src/main/java/itis/homework/parallelrequests/app/Otto.java // public class Otto { // // private final Bus mBus; // // private Otto(Bus bus) { // mBus = bus; // } // // @NonNull // public static Otto get() { // return Holder.INSTANCE; // } // // public void post(final @NonNull Object event) { // if (Looper.myLooper() == Looper.getMainLooper()) { // mBus.post(event); // } // else { // MainQueue.get().invoke(new Runnable() { // @Override // public void run() { // mBus.post(event); // } // }); // } // } // // public void register(@NonNull Object object) { // mBus.register(object); // } // // public void unregister(@NonNull Object object) { // mBus.unregister(object); // } // // private static final class Holder { // public static final Otto INSTANCE = new Otto(new Bus()); // } // } // // Path: ParallelRequests/app/src/main/java/itis/homework/parallelrequests/network/RequestType.java // public enum RequestType { // // CONFIG(2_000, R.string.config_request), // AUTH(3_000, R.string.auth_request), // FRIENDS(6_000, R.string.friends_request), // POSTS(10_000, R.string.posts_request), // GROUPS(6_000, R.string.groups_request), // MESSAGES(8_000, R.string.messages_request), // PHOTOS(12_000, R.string.photos_request), // ; // // private final long mDelay; // // @StringRes // private final int mRequestText; // // RequestType(long delay, @StringRes int requestText) { // mDelay = delay; // mRequestText = requestText; // } // // public long getDelay() { // return mDelay; // } // // @StringRes // public int getRequestText() { // return mRequestText; // } // } // // Path: ParallelRequests/app/src/main/java/itis/homework/parallelrequests/network/RequestsState.java // public class RequestsState { // // private final GeneralState mState; // // private final List<RequestType> mLoadingRequests; // // private final List<RequestType> mLoadedRequest; // // public RequestsState(GeneralState state) { // this(state, new ArrayList<RequestType>(), new ArrayList<RequestType>()); // } // // public RequestsState(GeneralState state, @NonNull List<RequestType> loadingRequests, @NonNull List<RequestType> loadedRequest) { // mState = state; // mLoadingRequests = loadingRequests; // mLoadedRequest = loadedRequest; // } // // public boolean isWaiting() { // return mState == GeneralState.WIATING; // } // // public boolean isLoading() { // return mState == GeneralState.LOADING; // } // // public boolean isLoaded() { // return mState == GeneralState.LOADED; // } // // public boolean isError() { // return mState == GeneralState.ERROR; // } // // public boolean isRequestLoading(RequestType requestType) { // return mLoadingRequests.contains(requestType); // } // // public boolean isRequestLoaded(RequestType requestType) { // return mLoadedRequest.contains(requestType); // } // // public enum GeneralState { // WIATING, // LOADING, // LOADED, // ERROR // } // // } // Path: ParallelRequests/app/src/main/java/itis/homework/parallelrequests/RequestProcessView.java import android.content.Context; import android.support.annotation.NonNull; import android.text.format.DateUtils; import android.util.AttributeSet; import android.view.ViewGroup; import android.widget.LinearLayout; import android.widget.TextView; import com.squareup.otto.Subscribe; import java.util.HashMap; import java.util.Map; import java.util.Timer; import java.util.TimerTask; import itis.homework.parallelrequests.app.LoadingStateChangedEvent; import itis.homework.parallelrequests.app.MainQueue; import itis.homework.parallelrequests.app.Otto; import itis.homework.parallelrequests.network.RequestType; import itis.homework.parallelrequests.network.RequestsState; package itis.homework.parallelrequests; /** * @author Artur Vasilov */ public class RequestProcessView extends LinearLayout { private TextView mTimerTextView; private ViewGroup mStatusViewContainer;
private final Map<RequestType, RequestStatusView> mStatusViews = new HashMap<>();
ArturVasilov/RxSamplesPractice
RxPractice/app/src/main/java/ru/samples/itis/rxpractice/tasks/RxJavaTask4.java
// Path: RxPractice/app/src/main/java/ru/samples/itis/rxpractice/content/Person.java // public class Person { // // private final String mName; // private final int mAge; // // public Person(@NonNull String name, int age) { // mName = name; // mAge = age; // } // // @NonNull // public String getName() { // return mName; // } // // public int getAge() { // return mAge; // } // // @Override // public boolean equals(Object o) { // if (this == o) { // return true; // } // if (o == null || getClass() != o.getClass()) { // return false; // } // // Person person = (Person) o; // return getAge() == person.getAge() && getName().equals(person.getName()); // // } // // @Override // public int hashCode() { // int result = getName().hashCode(); // result = 31 * result + getAge(); // return result; // } // // @Override // public String toString() { // return "Person{" + // "mName='" + mName + '\'' + // ", mAge=" + mAge + // '}'; // } // // public int intValue() { // return getName().length() + getAge(); // } // // @NonNull // public Person makeChild(@NonNull Person person) { // String name = getName() + " : " + person.getName(); // return new Person(name, 0); // } // // @NonNull // public static Person randomPerson() { // Random random = new SecureRandom(); // final String template = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + // "abcdefghijklmnopqrstuvwxyz"; // // String name = randomString(random, template, random.nextInt(15) + 3); // int age = random.nextInt(100); // return new Person(name, age); // } // // @NonNull // public static List<Person> randomPersonsList(int size) { // List<Person> list = new ArrayList<>(size); // for (int i = 0; i < size; i++) { // list.add(randomPerson()); // } // return list; // } // // @NonNull // private static String randomString(Random random, String characters, int length) { // char[] text = new char[length]; // for (int i = 0; i < length; i++) { // text[i] = characters.charAt(random.nextInt(characters.length())); // } // return new String(text); // } // }
import android.support.annotation.NonNull; import java.util.List; import ru.samples.itis.rxpractice.content.Person; import rx.Observable;
package ru.samples.itis.rxpractice.tasks; /** * @author Artur Vasilov */ public class RxJavaTask4 { /** * TODO : implement this method * * This method takes 4 list of persons - you should return one single observable of persons * 1) Merge (concat) two fathers list into single fathers observable * 2) Repeat step 1 for mothers lists * 3) Using these 2 observables create observable of children using Person#makeChild method * * @param fathers1 - first fathers list * @param fathers2 - second fathers list * @param mothers1 - first mothers list * @param mothers2 - second mothers list * @return children list from merged fathers and mothers */ @NonNull
// Path: RxPractice/app/src/main/java/ru/samples/itis/rxpractice/content/Person.java // public class Person { // // private final String mName; // private final int mAge; // // public Person(@NonNull String name, int age) { // mName = name; // mAge = age; // } // // @NonNull // public String getName() { // return mName; // } // // public int getAge() { // return mAge; // } // // @Override // public boolean equals(Object o) { // if (this == o) { // return true; // } // if (o == null || getClass() != o.getClass()) { // return false; // } // // Person person = (Person) o; // return getAge() == person.getAge() && getName().equals(person.getName()); // // } // // @Override // public int hashCode() { // int result = getName().hashCode(); // result = 31 * result + getAge(); // return result; // } // // @Override // public String toString() { // return "Person{" + // "mName='" + mName + '\'' + // ", mAge=" + mAge + // '}'; // } // // public int intValue() { // return getName().length() + getAge(); // } // // @NonNull // public Person makeChild(@NonNull Person person) { // String name = getName() + " : " + person.getName(); // return new Person(name, 0); // } // // @NonNull // public static Person randomPerson() { // Random random = new SecureRandom(); // final String template = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + // "abcdefghijklmnopqrstuvwxyz"; // // String name = randomString(random, template, random.nextInt(15) + 3); // int age = random.nextInt(100); // return new Person(name, age); // } // // @NonNull // public static List<Person> randomPersonsList(int size) { // List<Person> list = new ArrayList<>(size); // for (int i = 0; i < size; i++) { // list.add(randomPerson()); // } // return list; // } // // @NonNull // private static String randomString(Random random, String characters, int length) { // char[] text = new char[length]; // for (int i = 0; i < length; i++) { // text[i] = characters.charAt(random.nextInt(characters.length())); // } // return new String(text); // } // } // Path: RxPractice/app/src/main/java/ru/samples/itis/rxpractice/tasks/RxJavaTask4.java import android.support.annotation.NonNull; import java.util.List; import ru.samples.itis.rxpractice.content.Person; import rx.Observable; package ru.samples.itis.rxpractice.tasks; /** * @author Artur Vasilov */ public class RxJavaTask4 { /** * TODO : implement this method * * This method takes 4 list of persons - you should return one single observable of persons * 1) Merge (concat) two fathers list into single fathers observable * 2) Repeat step 1 for mothers lists * 3) Using these 2 observables create observable of children using Person#makeChild method * * @param fathers1 - first fathers list * @param fathers2 - second fathers list * @param mothers1 - first mothers list * @param mothers2 - second mothers list * @return children list from merged fathers and mothers */ @NonNull
public static Observable<Person> task4Observable(@NonNull List<Person> fathers1,
ArturVasilov/RxSamplesPractice
RxPractice/app/src/test/java/ru/samples/itis/rxpractice/Task2Test.java
// Path: RxPractice/app/src/main/java/ru/samples/itis/rxpractice/tasks/RxJavaTask2.java // public class RxJavaTask2 { // // /** // * TODO : implement this method // * // * Take the range of integers [1..100000] and apply next functions: // * 1) Multiply all elements by 2 // * 2) Remove 40 000 elements from start and 40 000 elements from end // * 3) Remove all values which is not divided by 3 // * 4) Transform the left sequence of integers into sequence of BigInteger objects // * 5) Multiply all values into single BigInteger object // * 6) Cache the result // * // * @return observable with cached result of single BigInteger object // */ // @NonNull // public static Observable<BigInteger> task2Observable() { // throw new RuntimeException("Observable not implemented exception"); // } // // }
import org.junit.After; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; import java.math.BigInteger; import java.util.concurrent.atomic.AtomicLong; import ru.samples.itis.rxpractice.tasks.RxJavaTask2; import rx.Observable; import rx.Subscriber; import static junit.framework.Assert.assertEquals; import static junit.framework.Assert.assertNotNull; import static junit.framework.Assert.assertTrue; import static junit.framework.Assert.fail;
package ru.samples.itis.rxpractice; /** * @author Artur Vasilov */ @RunWith(JUnit4.class) public class Task2Test { private BigInteger expectedResult; @Before public void setUp() throws Exception { BigInteger result = BigInteger.ONE; for (int value = 80_002; value <= 120_000; value += 2) { if (value % 3 == 0) { result = result.multiply(BigInteger.valueOf(value)); } } expectedResult = result; } @Test public void testNotNull() throws Exception {
// Path: RxPractice/app/src/main/java/ru/samples/itis/rxpractice/tasks/RxJavaTask2.java // public class RxJavaTask2 { // // /** // * TODO : implement this method // * // * Take the range of integers [1..100000] and apply next functions: // * 1) Multiply all elements by 2 // * 2) Remove 40 000 elements from start and 40 000 elements from end // * 3) Remove all values which is not divided by 3 // * 4) Transform the left sequence of integers into sequence of BigInteger objects // * 5) Multiply all values into single BigInteger object // * 6) Cache the result // * // * @return observable with cached result of single BigInteger object // */ // @NonNull // public static Observable<BigInteger> task2Observable() { // throw new RuntimeException("Observable not implemented exception"); // } // // } // Path: RxPractice/app/src/test/java/ru/samples/itis/rxpractice/Task2Test.java import org.junit.After; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; import java.math.BigInteger; import java.util.concurrent.atomic.AtomicLong; import ru.samples.itis.rxpractice.tasks.RxJavaTask2; import rx.Observable; import rx.Subscriber; import static junit.framework.Assert.assertEquals; import static junit.framework.Assert.assertNotNull; import static junit.framework.Assert.assertTrue; import static junit.framework.Assert.fail; package ru.samples.itis.rxpractice; /** * @author Artur Vasilov */ @RunWith(JUnit4.class) public class Task2Test { private BigInteger expectedResult; @Before public void setUp() throws Exception { BigInteger result = BigInteger.ONE; for (int value = 80_002; value <= 120_000; value += 2) { if (value % 3 == 0) { result = result.multiply(BigInteger.valueOf(value)); } } expectedResult = result; } @Test public void testNotNull() throws Exception {
Observable<BigInteger> observable = RxJavaTask2.task2Observable();
ArturVasilov/RxSamplesPractice
RxPractice/app/src/main/java/ru/samples/itis/rxpractice/samples/CombiningObservables.java
// Path: RxPractice/app/src/main/java/ru/samples/itis/rxpractice/content/Person.java // public class Person { // // private final String mName; // private final int mAge; // // public Person(@NonNull String name, int age) { // mName = name; // mAge = age; // } // // @NonNull // public String getName() { // return mName; // } // // public int getAge() { // return mAge; // } // // @Override // public boolean equals(Object o) { // if (this == o) { // return true; // } // if (o == null || getClass() != o.getClass()) { // return false; // } // // Person person = (Person) o; // return getAge() == person.getAge() && getName().equals(person.getName()); // // } // // @Override // public int hashCode() { // int result = getName().hashCode(); // result = 31 * result + getAge(); // return result; // } // // @Override // public String toString() { // return "Person{" + // "mName='" + mName + '\'' + // ", mAge=" + mAge + // '}'; // } // // public int intValue() { // return getName().length() + getAge(); // } // // @NonNull // public Person makeChild(@NonNull Person person) { // String name = getName() + " : " + person.getName(); // return new Person(name, 0); // } // // @NonNull // public static Person randomPerson() { // Random random = new SecureRandom(); // final String template = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + // "abcdefghijklmnopqrstuvwxyz"; // // String name = randomString(random, template, random.nextInt(15) + 3); // int age = random.nextInt(100); // return new Person(name, age); // } // // @NonNull // public static List<Person> randomPersonsList(int size) { // List<Person> list = new ArrayList<>(size); // for (int i = 0; i < size; i++) { // list.add(randomPerson()); // } // return list; // } // // @NonNull // private static String randomString(Random random, String characters, int length) { // char[] text = new char[length]; // for (int i = 0; i < length; i++) { // text[i] = characters.charAt(random.nextInt(characters.length())); // } // return new String(text); // } // }
import android.support.annotation.NonNull; import ru.samples.itis.rxpractice.content.Person; import rx.Observable; import rx.functions.Func2;
package ru.samples.itis.rxpractice.samples; /** * @author Artur Vasilov */ public class CombiningObservables { @NonNull public static Observable<Integer> merge() { Observable<Integer> first = Observable.just(1, 2, 3, 4, 5, 6, 7, 8); Observable<Integer> second = Observable.just(1, 2, 3, 4, 5, 6, 7, 8); return first.mergeWith(second); } @NonNull public static Observable<Integer> mergeIntervals() { Observable<Integer> first = CreatingObservable.interval(); Observable<Integer> second = CreatingObservable.interval(); return first.mergeWith(second); } @NonNull public static Observable<Integer> concat() { Observable<Integer> first = CreatingObservable.interval(); Observable<Integer> second = CreatingObservable.interval(); return first.concatWith(second); } @NonNull
// Path: RxPractice/app/src/main/java/ru/samples/itis/rxpractice/content/Person.java // public class Person { // // private final String mName; // private final int mAge; // // public Person(@NonNull String name, int age) { // mName = name; // mAge = age; // } // // @NonNull // public String getName() { // return mName; // } // // public int getAge() { // return mAge; // } // // @Override // public boolean equals(Object o) { // if (this == o) { // return true; // } // if (o == null || getClass() != o.getClass()) { // return false; // } // // Person person = (Person) o; // return getAge() == person.getAge() && getName().equals(person.getName()); // // } // // @Override // public int hashCode() { // int result = getName().hashCode(); // result = 31 * result + getAge(); // return result; // } // // @Override // public String toString() { // return "Person{" + // "mName='" + mName + '\'' + // ", mAge=" + mAge + // '}'; // } // // public int intValue() { // return getName().length() + getAge(); // } // // @NonNull // public Person makeChild(@NonNull Person person) { // String name = getName() + " : " + person.getName(); // return new Person(name, 0); // } // // @NonNull // public static Person randomPerson() { // Random random = new SecureRandom(); // final String template = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + // "abcdefghijklmnopqrstuvwxyz"; // // String name = randomString(random, template, random.nextInt(15) + 3); // int age = random.nextInt(100); // return new Person(name, age); // } // // @NonNull // public static List<Person> randomPersonsList(int size) { // List<Person> list = new ArrayList<>(size); // for (int i = 0; i < size; i++) { // list.add(randomPerson()); // } // return list; // } // // @NonNull // private static String randomString(Random random, String characters, int length) { // char[] text = new char[length]; // for (int i = 0; i < length; i++) { // text[i] = characters.charAt(random.nextInt(characters.length())); // } // return new String(text); // } // } // Path: RxPractice/app/src/main/java/ru/samples/itis/rxpractice/samples/CombiningObservables.java import android.support.annotation.NonNull; import ru.samples.itis.rxpractice.content.Person; import rx.Observable; import rx.functions.Func2; package ru.samples.itis.rxpractice.samples; /** * @author Artur Vasilov */ public class CombiningObservables { @NonNull public static Observable<Integer> merge() { Observable<Integer> first = Observable.just(1, 2, 3, 4, 5, 6, 7, 8); Observable<Integer> second = Observable.just(1, 2, 3, 4, 5, 6, 7, 8); return first.mergeWith(second); } @NonNull public static Observable<Integer> mergeIntervals() { Observable<Integer> first = CreatingObservable.interval(); Observable<Integer> second = CreatingObservable.interval(); return first.mergeWith(second); } @NonNull public static Observable<Integer> concat() { Observable<Integer> first = CreatingObservable.interval(); Observable<Integer> second = CreatingObservable.interval(); return first.concatWith(second); } @NonNull
public static Observable<Person> zip() {
ArturVasilov/RxSamplesPractice
ParallelRequests/app/src/main/java/itis/homework/parallelrequests/app/AppDelegate.java
// Path: ParallelRequests/app/src/main/java/itis/homework/parallelrequests/network/RequestControllerImpl.java // public class RequestControllerImpl implements RequestsController { // // private final List<RequestType> mLoadingRequests; // // private final List<RequestType> mLoadedRequests; // // private boolean mIsFatalError = false; // // public RequestControllerImpl() { // mLoadingRequests = new ArrayList<>(); // mLoadedRequests = new ArrayList<>(); // } // // @Override // public boolean tryRequest(RequestType requestType) { // if (mIsFatalError) { // return false; // } // if (mLoadingRequests.contains(requestType) || mLoadedRequests.contains(requestType)) { // return false; // } // // if (requestType == RequestType.AUTH || requestType == RequestType.CONFIG) { // mLoadingRequests.add(requestType); // Otto.get().post(LoadingStateChangedEvent.produce(new RequestsState(RequestsState.GeneralState.LOADING, // mLoadingRequests, mLoadedRequests))); // return true; // } // // if ((requestType == RequestType.FRIENDS || requestType == RequestType.POSTS // || requestType == RequestType.MESSAGES || requestType == RequestType.GROUPS) // && (!mLoadedRequests.contains(RequestType.AUTH) || !mLoadedRequests.contains(RequestType.CONFIG))) { // mIsFatalError = true; // Otto.get().post(LoadingStateChangedEvent.produce(new RequestsState(RequestsState.GeneralState.ERROR))); // return false; // } // // if (requestType == RequestType.PHOTOS && !mLoadedRequests.contains(RequestType.MESSAGES)) { // mIsFatalError = true; // Otto.get().post(LoadingStateChangedEvent.produce(new RequestsState(RequestsState.GeneralState.ERROR))); // return false; // } // // mLoadingRequests.add(requestType); // Otto.get().post(LoadingStateChangedEvent.produce(new RequestsState(RequestsState.GeneralState.LOADING, // mLoadingRequests, mLoadedRequests))); // return true; // } // // @Override // public void onRequestFinished(RequestType requestType) { // if (mIsFatalError) { // Otto.get().post(LoadingStateChangedEvent.produce(new RequestsState(RequestsState.GeneralState.ERROR))); // return; // } // mLoadingRequests.remove(requestType); // mLoadedRequests.add(requestType); // if (mLoadedRequests.size() >= RequestType.values().length && mLoadingRequests.isEmpty()) { // Otto.get().post(LoadingStateChangedEvent.produce(new RequestsState(RequestsState.GeneralState.LOADED))); // } else { // Otto.get().post(LoadingStateChangedEvent.produce(new RequestsState(RequestsState.GeneralState.LOADING, // mLoadingRequests, mLoadedRequests))); // } // } // // @Override // public void reset() { // mLoadingRequests.clear(); // mLoadedRequests.clear(); // mIsFatalError = false; // // Otto.get().post(LoadingStateChangedEvent.produce(new RequestsState(RequestsState.GeneralState.WIATING))); // } // } // // Path: ParallelRequests/app/src/main/java/itis/homework/parallelrequests/network/RequestProcessor.java // public class RequestProcessor implements RequestsService { // // private final RequestsController mRequestsController; // // public RequestProcessor(RequestsController requestsController) { // mRequestsController = requestsController; // } // // @Override // public Observable<Boolean> config() { // return process(RequestType.CONFIG); // } // // @Override // public Observable<Boolean> auth() { // return process(RequestType.AUTH); // } // // @Override // public Observable<Boolean> friends() { // return process(RequestType.FRIENDS); // } // // @Override // public Observable<Boolean> posts() { // return process(RequestType.POSTS); // } // // @Override // public Observable<Boolean> groups() { // return process(RequestType.GROUPS); // } // // @Override // public Observable<Boolean> messages() { // return process(RequestType.MESSAGES); // } // // @Override // public Observable<Boolean> photos() { // return process(RequestType.PHOTOS); // } // // @Override // public void reset() { // mRequestsController.reset(); // } // // @NonNull // private Observable<Boolean> process(RequestType requestType) { // return Observable.create(new Observable.OnSubscribe<Boolean>() { // @Override // public void call(Subscriber<? super Boolean> subscriber) { // if (Looper.myLooper() == Looper.getMainLooper()) { // throw new NetworkOnMainThreadException(); // } // // if (!mRequestsController.tryRequest(requestType)) { // subscriber.onError(new Throwable()); // } // // SystemClock.sleep(requestType.getDelay()); // mRequestsController.onRequestFinished(requestType); // // subscriber.onCompleted(); // } // }); // } // } // // Path: ParallelRequests/app/src/main/java/itis/homework/parallelrequests/network/RequestsService.java // public interface RequestsService { // // Observable<Boolean> config(); // // Observable<Boolean> auth(); // // Observable<Boolean> friends(); // // Observable<Boolean> posts(); // // Observable<Boolean> groups(); // // Observable<Boolean> messages(); // // Observable<Boolean> photos(); // // void reset(); // // }
import android.app.Application; import android.content.Context; import android.support.annotation.NonNull; import itis.homework.parallelrequests.network.RequestControllerImpl; import itis.homework.parallelrequests.network.RequestProcessor; import itis.homework.parallelrequests.network.RequestsService;
package itis.homework.parallelrequests.app; /** * @author Artur Vasilov */ public class AppDelegate extends Application { private RequestsService mRequestsService; @Override public void onCreate() { super.onCreate();
// Path: ParallelRequests/app/src/main/java/itis/homework/parallelrequests/network/RequestControllerImpl.java // public class RequestControllerImpl implements RequestsController { // // private final List<RequestType> mLoadingRequests; // // private final List<RequestType> mLoadedRequests; // // private boolean mIsFatalError = false; // // public RequestControllerImpl() { // mLoadingRequests = new ArrayList<>(); // mLoadedRequests = new ArrayList<>(); // } // // @Override // public boolean tryRequest(RequestType requestType) { // if (mIsFatalError) { // return false; // } // if (mLoadingRequests.contains(requestType) || mLoadedRequests.contains(requestType)) { // return false; // } // // if (requestType == RequestType.AUTH || requestType == RequestType.CONFIG) { // mLoadingRequests.add(requestType); // Otto.get().post(LoadingStateChangedEvent.produce(new RequestsState(RequestsState.GeneralState.LOADING, // mLoadingRequests, mLoadedRequests))); // return true; // } // // if ((requestType == RequestType.FRIENDS || requestType == RequestType.POSTS // || requestType == RequestType.MESSAGES || requestType == RequestType.GROUPS) // && (!mLoadedRequests.contains(RequestType.AUTH) || !mLoadedRequests.contains(RequestType.CONFIG))) { // mIsFatalError = true; // Otto.get().post(LoadingStateChangedEvent.produce(new RequestsState(RequestsState.GeneralState.ERROR))); // return false; // } // // if (requestType == RequestType.PHOTOS && !mLoadedRequests.contains(RequestType.MESSAGES)) { // mIsFatalError = true; // Otto.get().post(LoadingStateChangedEvent.produce(new RequestsState(RequestsState.GeneralState.ERROR))); // return false; // } // // mLoadingRequests.add(requestType); // Otto.get().post(LoadingStateChangedEvent.produce(new RequestsState(RequestsState.GeneralState.LOADING, // mLoadingRequests, mLoadedRequests))); // return true; // } // // @Override // public void onRequestFinished(RequestType requestType) { // if (mIsFatalError) { // Otto.get().post(LoadingStateChangedEvent.produce(new RequestsState(RequestsState.GeneralState.ERROR))); // return; // } // mLoadingRequests.remove(requestType); // mLoadedRequests.add(requestType); // if (mLoadedRequests.size() >= RequestType.values().length && mLoadingRequests.isEmpty()) { // Otto.get().post(LoadingStateChangedEvent.produce(new RequestsState(RequestsState.GeneralState.LOADED))); // } else { // Otto.get().post(LoadingStateChangedEvent.produce(new RequestsState(RequestsState.GeneralState.LOADING, // mLoadingRequests, mLoadedRequests))); // } // } // // @Override // public void reset() { // mLoadingRequests.clear(); // mLoadedRequests.clear(); // mIsFatalError = false; // // Otto.get().post(LoadingStateChangedEvent.produce(new RequestsState(RequestsState.GeneralState.WIATING))); // } // } // // Path: ParallelRequests/app/src/main/java/itis/homework/parallelrequests/network/RequestProcessor.java // public class RequestProcessor implements RequestsService { // // private final RequestsController mRequestsController; // // public RequestProcessor(RequestsController requestsController) { // mRequestsController = requestsController; // } // // @Override // public Observable<Boolean> config() { // return process(RequestType.CONFIG); // } // // @Override // public Observable<Boolean> auth() { // return process(RequestType.AUTH); // } // // @Override // public Observable<Boolean> friends() { // return process(RequestType.FRIENDS); // } // // @Override // public Observable<Boolean> posts() { // return process(RequestType.POSTS); // } // // @Override // public Observable<Boolean> groups() { // return process(RequestType.GROUPS); // } // // @Override // public Observable<Boolean> messages() { // return process(RequestType.MESSAGES); // } // // @Override // public Observable<Boolean> photos() { // return process(RequestType.PHOTOS); // } // // @Override // public void reset() { // mRequestsController.reset(); // } // // @NonNull // private Observable<Boolean> process(RequestType requestType) { // return Observable.create(new Observable.OnSubscribe<Boolean>() { // @Override // public void call(Subscriber<? super Boolean> subscriber) { // if (Looper.myLooper() == Looper.getMainLooper()) { // throw new NetworkOnMainThreadException(); // } // // if (!mRequestsController.tryRequest(requestType)) { // subscriber.onError(new Throwable()); // } // // SystemClock.sleep(requestType.getDelay()); // mRequestsController.onRequestFinished(requestType); // // subscriber.onCompleted(); // } // }); // } // } // // Path: ParallelRequests/app/src/main/java/itis/homework/parallelrequests/network/RequestsService.java // public interface RequestsService { // // Observable<Boolean> config(); // // Observable<Boolean> auth(); // // Observable<Boolean> friends(); // // Observable<Boolean> posts(); // // Observable<Boolean> groups(); // // Observable<Boolean> messages(); // // Observable<Boolean> photos(); // // void reset(); // // } // Path: ParallelRequests/app/src/main/java/itis/homework/parallelrequests/app/AppDelegate.java import android.app.Application; import android.content.Context; import android.support.annotation.NonNull; import itis.homework.parallelrequests.network.RequestControllerImpl; import itis.homework.parallelrequests.network.RequestProcessor; import itis.homework.parallelrequests.network.RequestsService; package itis.homework.parallelrequests.app; /** * @author Artur Vasilov */ public class AppDelegate extends Application { private RequestsService mRequestsService; @Override public void onCreate() { super.onCreate();
mRequestsService = new RequestProcessor(new RequestControllerImpl());
ArturVasilov/RxSamplesPractice
ParallelRequests/app/src/main/java/itis/homework/parallelrequests/app/AppDelegate.java
// Path: ParallelRequests/app/src/main/java/itis/homework/parallelrequests/network/RequestControllerImpl.java // public class RequestControllerImpl implements RequestsController { // // private final List<RequestType> mLoadingRequests; // // private final List<RequestType> mLoadedRequests; // // private boolean mIsFatalError = false; // // public RequestControllerImpl() { // mLoadingRequests = new ArrayList<>(); // mLoadedRequests = new ArrayList<>(); // } // // @Override // public boolean tryRequest(RequestType requestType) { // if (mIsFatalError) { // return false; // } // if (mLoadingRequests.contains(requestType) || mLoadedRequests.contains(requestType)) { // return false; // } // // if (requestType == RequestType.AUTH || requestType == RequestType.CONFIG) { // mLoadingRequests.add(requestType); // Otto.get().post(LoadingStateChangedEvent.produce(new RequestsState(RequestsState.GeneralState.LOADING, // mLoadingRequests, mLoadedRequests))); // return true; // } // // if ((requestType == RequestType.FRIENDS || requestType == RequestType.POSTS // || requestType == RequestType.MESSAGES || requestType == RequestType.GROUPS) // && (!mLoadedRequests.contains(RequestType.AUTH) || !mLoadedRequests.contains(RequestType.CONFIG))) { // mIsFatalError = true; // Otto.get().post(LoadingStateChangedEvent.produce(new RequestsState(RequestsState.GeneralState.ERROR))); // return false; // } // // if (requestType == RequestType.PHOTOS && !mLoadedRequests.contains(RequestType.MESSAGES)) { // mIsFatalError = true; // Otto.get().post(LoadingStateChangedEvent.produce(new RequestsState(RequestsState.GeneralState.ERROR))); // return false; // } // // mLoadingRequests.add(requestType); // Otto.get().post(LoadingStateChangedEvent.produce(new RequestsState(RequestsState.GeneralState.LOADING, // mLoadingRequests, mLoadedRequests))); // return true; // } // // @Override // public void onRequestFinished(RequestType requestType) { // if (mIsFatalError) { // Otto.get().post(LoadingStateChangedEvent.produce(new RequestsState(RequestsState.GeneralState.ERROR))); // return; // } // mLoadingRequests.remove(requestType); // mLoadedRequests.add(requestType); // if (mLoadedRequests.size() >= RequestType.values().length && mLoadingRequests.isEmpty()) { // Otto.get().post(LoadingStateChangedEvent.produce(new RequestsState(RequestsState.GeneralState.LOADED))); // } else { // Otto.get().post(LoadingStateChangedEvent.produce(new RequestsState(RequestsState.GeneralState.LOADING, // mLoadingRequests, mLoadedRequests))); // } // } // // @Override // public void reset() { // mLoadingRequests.clear(); // mLoadedRequests.clear(); // mIsFatalError = false; // // Otto.get().post(LoadingStateChangedEvent.produce(new RequestsState(RequestsState.GeneralState.WIATING))); // } // } // // Path: ParallelRequests/app/src/main/java/itis/homework/parallelrequests/network/RequestProcessor.java // public class RequestProcessor implements RequestsService { // // private final RequestsController mRequestsController; // // public RequestProcessor(RequestsController requestsController) { // mRequestsController = requestsController; // } // // @Override // public Observable<Boolean> config() { // return process(RequestType.CONFIG); // } // // @Override // public Observable<Boolean> auth() { // return process(RequestType.AUTH); // } // // @Override // public Observable<Boolean> friends() { // return process(RequestType.FRIENDS); // } // // @Override // public Observable<Boolean> posts() { // return process(RequestType.POSTS); // } // // @Override // public Observable<Boolean> groups() { // return process(RequestType.GROUPS); // } // // @Override // public Observable<Boolean> messages() { // return process(RequestType.MESSAGES); // } // // @Override // public Observable<Boolean> photos() { // return process(RequestType.PHOTOS); // } // // @Override // public void reset() { // mRequestsController.reset(); // } // // @NonNull // private Observable<Boolean> process(RequestType requestType) { // return Observable.create(new Observable.OnSubscribe<Boolean>() { // @Override // public void call(Subscriber<? super Boolean> subscriber) { // if (Looper.myLooper() == Looper.getMainLooper()) { // throw new NetworkOnMainThreadException(); // } // // if (!mRequestsController.tryRequest(requestType)) { // subscriber.onError(new Throwable()); // } // // SystemClock.sleep(requestType.getDelay()); // mRequestsController.onRequestFinished(requestType); // // subscriber.onCompleted(); // } // }); // } // } // // Path: ParallelRequests/app/src/main/java/itis/homework/parallelrequests/network/RequestsService.java // public interface RequestsService { // // Observable<Boolean> config(); // // Observable<Boolean> auth(); // // Observable<Boolean> friends(); // // Observable<Boolean> posts(); // // Observable<Boolean> groups(); // // Observable<Boolean> messages(); // // Observable<Boolean> photos(); // // void reset(); // // }
import android.app.Application; import android.content.Context; import android.support.annotation.NonNull; import itis.homework.parallelrequests.network.RequestControllerImpl; import itis.homework.parallelrequests.network.RequestProcessor; import itis.homework.parallelrequests.network.RequestsService;
package itis.homework.parallelrequests.app; /** * @author Artur Vasilov */ public class AppDelegate extends Application { private RequestsService mRequestsService; @Override public void onCreate() { super.onCreate();
// Path: ParallelRequests/app/src/main/java/itis/homework/parallelrequests/network/RequestControllerImpl.java // public class RequestControllerImpl implements RequestsController { // // private final List<RequestType> mLoadingRequests; // // private final List<RequestType> mLoadedRequests; // // private boolean mIsFatalError = false; // // public RequestControllerImpl() { // mLoadingRequests = new ArrayList<>(); // mLoadedRequests = new ArrayList<>(); // } // // @Override // public boolean tryRequest(RequestType requestType) { // if (mIsFatalError) { // return false; // } // if (mLoadingRequests.contains(requestType) || mLoadedRequests.contains(requestType)) { // return false; // } // // if (requestType == RequestType.AUTH || requestType == RequestType.CONFIG) { // mLoadingRequests.add(requestType); // Otto.get().post(LoadingStateChangedEvent.produce(new RequestsState(RequestsState.GeneralState.LOADING, // mLoadingRequests, mLoadedRequests))); // return true; // } // // if ((requestType == RequestType.FRIENDS || requestType == RequestType.POSTS // || requestType == RequestType.MESSAGES || requestType == RequestType.GROUPS) // && (!mLoadedRequests.contains(RequestType.AUTH) || !mLoadedRequests.contains(RequestType.CONFIG))) { // mIsFatalError = true; // Otto.get().post(LoadingStateChangedEvent.produce(new RequestsState(RequestsState.GeneralState.ERROR))); // return false; // } // // if (requestType == RequestType.PHOTOS && !mLoadedRequests.contains(RequestType.MESSAGES)) { // mIsFatalError = true; // Otto.get().post(LoadingStateChangedEvent.produce(new RequestsState(RequestsState.GeneralState.ERROR))); // return false; // } // // mLoadingRequests.add(requestType); // Otto.get().post(LoadingStateChangedEvent.produce(new RequestsState(RequestsState.GeneralState.LOADING, // mLoadingRequests, mLoadedRequests))); // return true; // } // // @Override // public void onRequestFinished(RequestType requestType) { // if (mIsFatalError) { // Otto.get().post(LoadingStateChangedEvent.produce(new RequestsState(RequestsState.GeneralState.ERROR))); // return; // } // mLoadingRequests.remove(requestType); // mLoadedRequests.add(requestType); // if (mLoadedRequests.size() >= RequestType.values().length && mLoadingRequests.isEmpty()) { // Otto.get().post(LoadingStateChangedEvent.produce(new RequestsState(RequestsState.GeneralState.LOADED))); // } else { // Otto.get().post(LoadingStateChangedEvent.produce(new RequestsState(RequestsState.GeneralState.LOADING, // mLoadingRequests, mLoadedRequests))); // } // } // // @Override // public void reset() { // mLoadingRequests.clear(); // mLoadedRequests.clear(); // mIsFatalError = false; // // Otto.get().post(LoadingStateChangedEvent.produce(new RequestsState(RequestsState.GeneralState.WIATING))); // } // } // // Path: ParallelRequests/app/src/main/java/itis/homework/parallelrequests/network/RequestProcessor.java // public class RequestProcessor implements RequestsService { // // private final RequestsController mRequestsController; // // public RequestProcessor(RequestsController requestsController) { // mRequestsController = requestsController; // } // // @Override // public Observable<Boolean> config() { // return process(RequestType.CONFIG); // } // // @Override // public Observable<Boolean> auth() { // return process(RequestType.AUTH); // } // // @Override // public Observable<Boolean> friends() { // return process(RequestType.FRIENDS); // } // // @Override // public Observable<Boolean> posts() { // return process(RequestType.POSTS); // } // // @Override // public Observable<Boolean> groups() { // return process(RequestType.GROUPS); // } // // @Override // public Observable<Boolean> messages() { // return process(RequestType.MESSAGES); // } // // @Override // public Observable<Boolean> photos() { // return process(RequestType.PHOTOS); // } // // @Override // public void reset() { // mRequestsController.reset(); // } // // @NonNull // private Observable<Boolean> process(RequestType requestType) { // return Observable.create(new Observable.OnSubscribe<Boolean>() { // @Override // public void call(Subscriber<? super Boolean> subscriber) { // if (Looper.myLooper() == Looper.getMainLooper()) { // throw new NetworkOnMainThreadException(); // } // // if (!mRequestsController.tryRequest(requestType)) { // subscriber.onError(new Throwable()); // } // // SystemClock.sleep(requestType.getDelay()); // mRequestsController.onRequestFinished(requestType); // // subscriber.onCompleted(); // } // }); // } // } // // Path: ParallelRequests/app/src/main/java/itis/homework/parallelrequests/network/RequestsService.java // public interface RequestsService { // // Observable<Boolean> config(); // // Observable<Boolean> auth(); // // Observable<Boolean> friends(); // // Observable<Boolean> posts(); // // Observable<Boolean> groups(); // // Observable<Boolean> messages(); // // Observable<Boolean> photos(); // // void reset(); // // } // Path: ParallelRequests/app/src/main/java/itis/homework/parallelrequests/app/AppDelegate.java import android.app.Application; import android.content.Context; import android.support.annotation.NonNull; import itis.homework.parallelrequests.network.RequestControllerImpl; import itis.homework.parallelrequests.network.RequestProcessor; import itis.homework.parallelrequests.network.RequestsService; package itis.homework.parallelrequests.app; /** * @author Artur Vasilov */ public class AppDelegate extends Application { private RequestsService mRequestsService; @Override public void onCreate() { super.onCreate();
mRequestsService = new RequestProcessor(new RequestControllerImpl());
ArturVasilov/RxSamplesPractice
RxPractice/app/src/test/java/ru/samples/itis/rxpractice/Task4Test.java
// Path: RxPractice/app/src/main/java/ru/samples/itis/rxpractice/content/Person.java // public class Person { // // private final String mName; // private final int mAge; // // public Person(@NonNull String name, int age) { // mName = name; // mAge = age; // } // // @NonNull // public String getName() { // return mName; // } // // public int getAge() { // return mAge; // } // // @Override // public boolean equals(Object o) { // if (this == o) { // return true; // } // if (o == null || getClass() != o.getClass()) { // return false; // } // // Person person = (Person) o; // return getAge() == person.getAge() && getName().equals(person.getName()); // // } // // @Override // public int hashCode() { // int result = getName().hashCode(); // result = 31 * result + getAge(); // return result; // } // // @Override // public String toString() { // return "Person{" + // "mName='" + mName + '\'' + // ", mAge=" + mAge + // '}'; // } // // public int intValue() { // return getName().length() + getAge(); // } // // @NonNull // public Person makeChild(@NonNull Person person) { // String name = getName() + " : " + person.getName(); // return new Person(name, 0); // } // // @NonNull // public static Person randomPerson() { // Random random = new SecureRandom(); // final String template = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + // "abcdefghijklmnopqrstuvwxyz"; // // String name = randomString(random, template, random.nextInt(15) + 3); // int age = random.nextInt(100); // return new Person(name, age); // } // // @NonNull // public static List<Person> randomPersonsList(int size) { // List<Person> list = new ArrayList<>(size); // for (int i = 0; i < size; i++) { // list.add(randomPerson()); // } // return list; // } // // @NonNull // private static String randomString(Random random, String characters, int length) { // char[] text = new char[length]; // for (int i = 0; i < length; i++) { // text[i] = characters.charAt(random.nextInt(characters.length())); // } // return new String(text); // } // } // // Path: RxPractice/app/src/main/java/ru/samples/itis/rxpractice/tasks/RxJavaTask4.java // public class RxJavaTask4 { // // /** // * TODO : implement this method // * // * This method takes 4 list of persons - you should return one single observable of persons // * 1) Merge (concat) two fathers list into single fathers observable // * 2) Repeat step 1 for mothers lists // * 3) Using these 2 observables create observable of children using Person#makeChild method // * // * @param fathers1 - first fathers list // * @param fathers2 - second fathers list // * @param mothers1 - first mothers list // * @param mothers2 - second mothers list // * @return children list from merged fathers and mothers // */ // @NonNull // public static Observable<Person> task4Observable(@NonNull List<Person> fathers1, // @NonNull List<Person> fathers2, // @NonNull List<Person> mothers1, // @NonNull List<Person> mothers2) { // throw new RuntimeException("Observable not implemented exception"); // } // // }
import junit.framework.Assert; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; import java.security.SecureRandom; import java.util.ArrayList; import java.util.List; import java.util.Random; import ru.samples.itis.rxpractice.content.Person; import ru.samples.itis.rxpractice.tasks.RxJavaTask4; import rx.Observable; import static junit.framework.Assert.assertEquals; import static junit.framework.Assert.assertNotNull;
package ru.samples.itis.rxpractice; /** * @author Artur Vasilov */ @RunWith(JUnit4.class) public class Task4Test { @Test public void testInitialized() throws Exception {
// Path: RxPractice/app/src/main/java/ru/samples/itis/rxpractice/content/Person.java // public class Person { // // private final String mName; // private final int mAge; // // public Person(@NonNull String name, int age) { // mName = name; // mAge = age; // } // // @NonNull // public String getName() { // return mName; // } // // public int getAge() { // return mAge; // } // // @Override // public boolean equals(Object o) { // if (this == o) { // return true; // } // if (o == null || getClass() != o.getClass()) { // return false; // } // // Person person = (Person) o; // return getAge() == person.getAge() && getName().equals(person.getName()); // // } // // @Override // public int hashCode() { // int result = getName().hashCode(); // result = 31 * result + getAge(); // return result; // } // // @Override // public String toString() { // return "Person{" + // "mName='" + mName + '\'' + // ", mAge=" + mAge + // '}'; // } // // public int intValue() { // return getName().length() + getAge(); // } // // @NonNull // public Person makeChild(@NonNull Person person) { // String name = getName() + " : " + person.getName(); // return new Person(name, 0); // } // // @NonNull // public static Person randomPerson() { // Random random = new SecureRandom(); // final String template = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + // "abcdefghijklmnopqrstuvwxyz"; // // String name = randomString(random, template, random.nextInt(15) + 3); // int age = random.nextInt(100); // return new Person(name, age); // } // // @NonNull // public static List<Person> randomPersonsList(int size) { // List<Person> list = new ArrayList<>(size); // for (int i = 0; i < size; i++) { // list.add(randomPerson()); // } // return list; // } // // @NonNull // private static String randomString(Random random, String characters, int length) { // char[] text = new char[length]; // for (int i = 0; i < length; i++) { // text[i] = characters.charAt(random.nextInt(characters.length())); // } // return new String(text); // } // } // // Path: RxPractice/app/src/main/java/ru/samples/itis/rxpractice/tasks/RxJavaTask4.java // public class RxJavaTask4 { // // /** // * TODO : implement this method // * // * This method takes 4 list of persons - you should return one single observable of persons // * 1) Merge (concat) two fathers list into single fathers observable // * 2) Repeat step 1 for mothers lists // * 3) Using these 2 observables create observable of children using Person#makeChild method // * // * @param fathers1 - first fathers list // * @param fathers2 - second fathers list // * @param mothers1 - first mothers list // * @param mothers2 - second mothers list // * @return children list from merged fathers and mothers // */ // @NonNull // public static Observable<Person> task4Observable(@NonNull List<Person> fathers1, // @NonNull List<Person> fathers2, // @NonNull List<Person> mothers1, // @NonNull List<Person> mothers2) { // throw new RuntimeException("Observable not implemented exception"); // } // // } // Path: RxPractice/app/src/test/java/ru/samples/itis/rxpractice/Task4Test.java import junit.framework.Assert; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; import java.security.SecureRandom; import java.util.ArrayList; import java.util.List; import java.util.Random; import ru.samples.itis.rxpractice.content.Person; import ru.samples.itis.rxpractice.tasks.RxJavaTask4; import rx.Observable; import static junit.framework.Assert.assertEquals; import static junit.framework.Assert.assertNotNull; package ru.samples.itis.rxpractice; /** * @author Artur Vasilov */ @RunWith(JUnit4.class) public class Task4Test { @Test public void testInitialized() throws Exception {
List<Person> fathers1 = Person.randomPersonsList(1);
ArturVasilov/RxSamplesPractice
RxPractice/app/src/test/java/ru/samples/itis/rxpractice/Task4Test.java
// Path: RxPractice/app/src/main/java/ru/samples/itis/rxpractice/content/Person.java // public class Person { // // private final String mName; // private final int mAge; // // public Person(@NonNull String name, int age) { // mName = name; // mAge = age; // } // // @NonNull // public String getName() { // return mName; // } // // public int getAge() { // return mAge; // } // // @Override // public boolean equals(Object o) { // if (this == o) { // return true; // } // if (o == null || getClass() != o.getClass()) { // return false; // } // // Person person = (Person) o; // return getAge() == person.getAge() && getName().equals(person.getName()); // // } // // @Override // public int hashCode() { // int result = getName().hashCode(); // result = 31 * result + getAge(); // return result; // } // // @Override // public String toString() { // return "Person{" + // "mName='" + mName + '\'' + // ", mAge=" + mAge + // '}'; // } // // public int intValue() { // return getName().length() + getAge(); // } // // @NonNull // public Person makeChild(@NonNull Person person) { // String name = getName() + " : " + person.getName(); // return new Person(name, 0); // } // // @NonNull // public static Person randomPerson() { // Random random = new SecureRandom(); // final String template = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + // "abcdefghijklmnopqrstuvwxyz"; // // String name = randomString(random, template, random.nextInt(15) + 3); // int age = random.nextInt(100); // return new Person(name, age); // } // // @NonNull // public static List<Person> randomPersonsList(int size) { // List<Person> list = new ArrayList<>(size); // for (int i = 0; i < size; i++) { // list.add(randomPerson()); // } // return list; // } // // @NonNull // private static String randomString(Random random, String characters, int length) { // char[] text = new char[length]; // for (int i = 0; i < length; i++) { // text[i] = characters.charAt(random.nextInt(characters.length())); // } // return new String(text); // } // } // // Path: RxPractice/app/src/main/java/ru/samples/itis/rxpractice/tasks/RxJavaTask4.java // public class RxJavaTask4 { // // /** // * TODO : implement this method // * // * This method takes 4 list of persons - you should return one single observable of persons // * 1) Merge (concat) two fathers list into single fathers observable // * 2) Repeat step 1 for mothers lists // * 3) Using these 2 observables create observable of children using Person#makeChild method // * // * @param fathers1 - first fathers list // * @param fathers2 - second fathers list // * @param mothers1 - first mothers list // * @param mothers2 - second mothers list // * @return children list from merged fathers and mothers // */ // @NonNull // public static Observable<Person> task4Observable(@NonNull List<Person> fathers1, // @NonNull List<Person> fathers2, // @NonNull List<Person> mothers1, // @NonNull List<Person> mothers2) { // throw new RuntimeException("Observable not implemented exception"); // } // // }
import junit.framework.Assert; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; import java.security.SecureRandom; import java.util.ArrayList; import java.util.List; import java.util.Random; import ru.samples.itis.rxpractice.content.Person; import ru.samples.itis.rxpractice.tasks.RxJavaTask4; import rx.Observable; import static junit.framework.Assert.assertEquals; import static junit.framework.Assert.assertNotNull;
package ru.samples.itis.rxpractice; /** * @author Artur Vasilov */ @RunWith(JUnit4.class) public class Task4Test { @Test public void testInitialized() throws Exception { List<Person> fathers1 = Person.randomPersonsList(1); List<Person> fathers2 = Person.randomPersonsList(1); List<Person> mothers1 = Person.randomPersonsList(1); List<Person> mothers2 = Person.randomPersonsList(1);
// Path: RxPractice/app/src/main/java/ru/samples/itis/rxpractice/content/Person.java // public class Person { // // private final String mName; // private final int mAge; // // public Person(@NonNull String name, int age) { // mName = name; // mAge = age; // } // // @NonNull // public String getName() { // return mName; // } // // public int getAge() { // return mAge; // } // // @Override // public boolean equals(Object o) { // if (this == o) { // return true; // } // if (o == null || getClass() != o.getClass()) { // return false; // } // // Person person = (Person) o; // return getAge() == person.getAge() && getName().equals(person.getName()); // // } // // @Override // public int hashCode() { // int result = getName().hashCode(); // result = 31 * result + getAge(); // return result; // } // // @Override // public String toString() { // return "Person{" + // "mName='" + mName + '\'' + // ", mAge=" + mAge + // '}'; // } // // public int intValue() { // return getName().length() + getAge(); // } // // @NonNull // public Person makeChild(@NonNull Person person) { // String name = getName() + " : " + person.getName(); // return new Person(name, 0); // } // // @NonNull // public static Person randomPerson() { // Random random = new SecureRandom(); // final String template = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + // "abcdefghijklmnopqrstuvwxyz"; // // String name = randomString(random, template, random.nextInt(15) + 3); // int age = random.nextInt(100); // return new Person(name, age); // } // // @NonNull // public static List<Person> randomPersonsList(int size) { // List<Person> list = new ArrayList<>(size); // for (int i = 0; i < size; i++) { // list.add(randomPerson()); // } // return list; // } // // @NonNull // private static String randomString(Random random, String characters, int length) { // char[] text = new char[length]; // for (int i = 0; i < length; i++) { // text[i] = characters.charAt(random.nextInt(characters.length())); // } // return new String(text); // } // } // // Path: RxPractice/app/src/main/java/ru/samples/itis/rxpractice/tasks/RxJavaTask4.java // public class RxJavaTask4 { // // /** // * TODO : implement this method // * // * This method takes 4 list of persons - you should return one single observable of persons // * 1) Merge (concat) two fathers list into single fathers observable // * 2) Repeat step 1 for mothers lists // * 3) Using these 2 observables create observable of children using Person#makeChild method // * // * @param fathers1 - first fathers list // * @param fathers2 - second fathers list // * @param mothers1 - first mothers list // * @param mothers2 - second mothers list // * @return children list from merged fathers and mothers // */ // @NonNull // public static Observable<Person> task4Observable(@NonNull List<Person> fathers1, // @NonNull List<Person> fathers2, // @NonNull List<Person> mothers1, // @NonNull List<Person> mothers2) { // throw new RuntimeException("Observable not implemented exception"); // } // // } // Path: RxPractice/app/src/test/java/ru/samples/itis/rxpractice/Task4Test.java import junit.framework.Assert; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; import java.security.SecureRandom; import java.util.ArrayList; import java.util.List; import java.util.Random; import ru.samples.itis.rxpractice.content.Person; import ru.samples.itis.rxpractice.tasks.RxJavaTask4; import rx.Observable; import static junit.framework.Assert.assertEquals; import static junit.framework.Assert.assertNotNull; package ru.samples.itis.rxpractice; /** * @author Artur Vasilov */ @RunWith(JUnit4.class) public class Task4Test { @Test public void testInitialized() throws Exception { List<Person> fathers1 = Person.randomPersonsList(1); List<Person> fathers2 = Person.randomPersonsList(1); List<Person> mothers1 = Person.randomPersonsList(1); List<Person> mothers2 = Person.randomPersonsList(1);
Observable<Person> observable = RxJavaTask4.task4Observable(fathers1, fathers2,
ArturVasilov/RxSamplesPractice
ParallelRequests/app/src/main/java/itis/homework/parallelrequests/SampleService.java
// Path: ParallelRequests/app/src/main/java/itis/homework/parallelrequests/app/AppDelegate.java // public class AppDelegate extends Application { // // private RequestsService mRequestsService; // // @Override // public void onCreate() { // super.onCreate(); // mRequestsService = new RequestProcessor(new RequestControllerImpl()); // } // // @NonNull // public static AppDelegate get(Context context) { // return ((AppDelegate) context.getApplicationContext()); // } // // @NonNull // public RequestsService getRequestsService() { // return mRequestsService; // } // } // // Path: ParallelRequests/app/src/main/java/itis/homework/parallelrequests/network/RequestsService.java // public interface RequestsService { // // Observable<Boolean> config(); // // Observable<Boolean> auth(); // // Observable<Boolean> friends(); // // Observable<Boolean> posts(); // // Observable<Boolean> groups(); // // Observable<Boolean> messages(); // // Observable<Boolean> photos(); // // void reset(); // // } // // Path: ParallelRequests/app/src/main/java/itis/homework/parallelrequests/network/ThreadUtils.java // public class ThreadUtils { // // private static final long RETRY_DELAY = 100; // private static final int MINIMUM_POOL_SIZE = 4; // private static final int CORE_POOL_SIZE = Runtime.getRuntime().availableProcessors(); // private static final int MAXIMUM_POOL_SIZE = CORE_POOL_SIZE > 2 ? CORE_POOL_SIZE * 2 : MINIMUM_POOL_SIZE; // private static final int KEEP_ALIVE_TIME = 10; // // private static final Handler HANDLER = new Handler(Looper.getMainLooper()); // // private static final RejectedExecutionHandler REJECTED_EXECUTION_HANDLER = new RejectedExecutionHandler() { // @Override // public void rejectedExecution(final Runnable runnable, ThreadPoolExecutor executor) { // HANDLER.postDelayed(() -> THREAD_POOL_EXECUTOR.execute(runnable), RETRY_DELAY); // } // }; // // private static final ThreadPoolExecutor THREAD_POOL_EXECUTOR = new ThreadPoolExecutor(CORE_POOL_SIZE * 2, // MAXIMUM_POOL_SIZE, // KEEP_ALIVE_TIME, // TimeUnit.SECONDS, // new LinkedBlockingQueue<>(MAXIMUM_POOL_SIZE), // REJECTED_EXECUTION_HANDLER); // // @NonNull // public static Thread runInBackground(@NonNull final Runnable runnable) { // Thread thread = new Thread(runnable); // THREAD_POOL_EXECUTOR.execute(thread); // return thread; // } // }
import android.app.IntentService; import android.content.Context; import android.content.Intent; import itis.homework.parallelrequests.app.AppDelegate; import itis.homework.parallelrequests.network.RequestsService; import itis.homework.parallelrequests.network.ThreadUtils;
package itis.homework.parallelrequests; /** * @author Artur Vasilov */ public class SampleService extends IntentService { private boolean mIsConfigLoaded = false; private boolean mIsAuthLoaded = false; public static void start(Context context) { Intent intent = new Intent(context, SampleService.class); context.startService(intent); }
// Path: ParallelRequests/app/src/main/java/itis/homework/parallelrequests/app/AppDelegate.java // public class AppDelegate extends Application { // // private RequestsService mRequestsService; // // @Override // public void onCreate() { // super.onCreate(); // mRequestsService = new RequestProcessor(new RequestControllerImpl()); // } // // @NonNull // public static AppDelegate get(Context context) { // return ((AppDelegate) context.getApplicationContext()); // } // // @NonNull // public RequestsService getRequestsService() { // return mRequestsService; // } // } // // Path: ParallelRequests/app/src/main/java/itis/homework/parallelrequests/network/RequestsService.java // public interface RequestsService { // // Observable<Boolean> config(); // // Observable<Boolean> auth(); // // Observable<Boolean> friends(); // // Observable<Boolean> posts(); // // Observable<Boolean> groups(); // // Observable<Boolean> messages(); // // Observable<Boolean> photos(); // // void reset(); // // } // // Path: ParallelRequests/app/src/main/java/itis/homework/parallelrequests/network/ThreadUtils.java // public class ThreadUtils { // // private static final long RETRY_DELAY = 100; // private static final int MINIMUM_POOL_SIZE = 4; // private static final int CORE_POOL_SIZE = Runtime.getRuntime().availableProcessors(); // private static final int MAXIMUM_POOL_SIZE = CORE_POOL_SIZE > 2 ? CORE_POOL_SIZE * 2 : MINIMUM_POOL_SIZE; // private static final int KEEP_ALIVE_TIME = 10; // // private static final Handler HANDLER = new Handler(Looper.getMainLooper()); // // private static final RejectedExecutionHandler REJECTED_EXECUTION_HANDLER = new RejectedExecutionHandler() { // @Override // public void rejectedExecution(final Runnable runnable, ThreadPoolExecutor executor) { // HANDLER.postDelayed(() -> THREAD_POOL_EXECUTOR.execute(runnable), RETRY_DELAY); // } // }; // // private static final ThreadPoolExecutor THREAD_POOL_EXECUTOR = new ThreadPoolExecutor(CORE_POOL_SIZE * 2, // MAXIMUM_POOL_SIZE, // KEEP_ALIVE_TIME, // TimeUnit.SECONDS, // new LinkedBlockingQueue<>(MAXIMUM_POOL_SIZE), // REJECTED_EXECUTION_HANDLER); // // @NonNull // public static Thread runInBackground(@NonNull final Runnable runnable) { // Thread thread = new Thread(runnable); // THREAD_POOL_EXECUTOR.execute(thread); // return thread; // } // } // Path: ParallelRequests/app/src/main/java/itis/homework/parallelrequests/SampleService.java import android.app.IntentService; import android.content.Context; import android.content.Intent; import itis.homework.parallelrequests.app.AppDelegate; import itis.homework.parallelrequests.network.RequestsService; import itis.homework.parallelrequests.network.ThreadUtils; package itis.homework.parallelrequests; /** * @author Artur Vasilov */ public class SampleService extends IntentService { private boolean mIsConfigLoaded = false; private boolean mIsAuthLoaded = false; public static void start(Context context) { Intent intent = new Intent(context, SampleService.class); context.startService(intent); }
private RequestsService mRequestsService;
ArturVasilov/RxSamplesPractice
ParallelRequests/app/src/main/java/itis/homework/parallelrequests/SampleService.java
// Path: ParallelRequests/app/src/main/java/itis/homework/parallelrequests/app/AppDelegate.java // public class AppDelegate extends Application { // // private RequestsService mRequestsService; // // @Override // public void onCreate() { // super.onCreate(); // mRequestsService = new RequestProcessor(new RequestControllerImpl()); // } // // @NonNull // public static AppDelegate get(Context context) { // return ((AppDelegate) context.getApplicationContext()); // } // // @NonNull // public RequestsService getRequestsService() { // return mRequestsService; // } // } // // Path: ParallelRequests/app/src/main/java/itis/homework/parallelrequests/network/RequestsService.java // public interface RequestsService { // // Observable<Boolean> config(); // // Observable<Boolean> auth(); // // Observable<Boolean> friends(); // // Observable<Boolean> posts(); // // Observable<Boolean> groups(); // // Observable<Boolean> messages(); // // Observable<Boolean> photos(); // // void reset(); // // } // // Path: ParallelRequests/app/src/main/java/itis/homework/parallelrequests/network/ThreadUtils.java // public class ThreadUtils { // // private static final long RETRY_DELAY = 100; // private static final int MINIMUM_POOL_SIZE = 4; // private static final int CORE_POOL_SIZE = Runtime.getRuntime().availableProcessors(); // private static final int MAXIMUM_POOL_SIZE = CORE_POOL_SIZE > 2 ? CORE_POOL_SIZE * 2 : MINIMUM_POOL_SIZE; // private static final int KEEP_ALIVE_TIME = 10; // // private static final Handler HANDLER = new Handler(Looper.getMainLooper()); // // private static final RejectedExecutionHandler REJECTED_EXECUTION_HANDLER = new RejectedExecutionHandler() { // @Override // public void rejectedExecution(final Runnable runnable, ThreadPoolExecutor executor) { // HANDLER.postDelayed(() -> THREAD_POOL_EXECUTOR.execute(runnable), RETRY_DELAY); // } // }; // // private static final ThreadPoolExecutor THREAD_POOL_EXECUTOR = new ThreadPoolExecutor(CORE_POOL_SIZE * 2, // MAXIMUM_POOL_SIZE, // KEEP_ALIVE_TIME, // TimeUnit.SECONDS, // new LinkedBlockingQueue<>(MAXIMUM_POOL_SIZE), // REJECTED_EXECUTION_HANDLER); // // @NonNull // public static Thread runInBackground(@NonNull final Runnable runnable) { // Thread thread = new Thread(runnable); // THREAD_POOL_EXECUTOR.execute(thread); // return thread; // } // }
import android.app.IntentService; import android.content.Context; import android.content.Intent; import itis.homework.parallelrequests.app.AppDelegate; import itis.homework.parallelrequests.network.RequestsService; import itis.homework.parallelrequests.network.ThreadUtils;
package itis.homework.parallelrequests; /** * @author Artur Vasilov */ public class SampleService extends IntentService { private boolean mIsConfigLoaded = false; private boolean mIsAuthLoaded = false; public static void start(Context context) { Intent intent = new Intent(context, SampleService.class); context.startService(intent); } private RequestsService mRequestsService; public SampleService() { super(SampleService.class.getName()); } @Override public void onCreate() { super.onCreate();
// Path: ParallelRequests/app/src/main/java/itis/homework/parallelrequests/app/AppDelegate.java // public class AppDelegate extends Application { // // private RequestsService mRequestsService; // // @Override // public void onCreate() { // super.onCreate(); // mRequestsService = new RequestProcessor(new RequestControllerImpl()); // } // // @NonNull // public static AppDelegate get(Context context) { // return ((AppDelegate) context.getApplicationContext()); // } // // @NonNull // public RequestsService getRequestsService() { // return mRequestsService; // } // } // // Path: ParallelRequests/app/src/main/java/itis/homework/parallelrequests/network/RequestsService.java // public interface RequestsService { // // Observable<Boolean> config(); // // Observable<Boolean> auth(); // // Observable<Boolean> friends(); // // Observable<Boolean> posts(); // // Observable<Boolean> groups(); // // Observable<Boolean> messages(); // // Observable<Boolean> photos(); // // void reset(); // // } // // Path: ParallelRequests/app/src/main/java/itis/homework/parallelrequests/network/ThreadUtils.java // public class ThreadUtils { // // private static final long RETRY_DELAY = 100; // private static final int MINIMUM_POOL_SIZE = 4; // private static final int CORE_POOL_SIZE = Runtime.getRuntime().availableProcessors(); // private static final int MAXIMUM_POOL_SIZE = CORE_POOL_SIZE > 2 ? CORE_POOL_SIZE * 2 : MINIMUM_POOL_SIZE; // private static final int KEEP_ALIVE_TIME = 10; // // private static final Handler HANDLER = new Handler(Looper.getMainLooper()); // // private static final RejectedExecutionHandler REJECTED_EXECUTION_HANDLER = new RejectedExecutionHandler() { // @Override // public void rejectedExecution(final Runnable runnable, ThreadPoolExecutor executor) { // HANDLER.postDelayed(() -> THREAD_POOL_EXECUTOR.execute(runnable), RETRY_DELAY); // } // }; // // private static final ThreadPoolExecutor THREAD_POOL_EXECUTOR = new ThreadPoolExecutor(CORE_POOL_SIZE * 2, // MAXIMUM_POOL_SIZE, // KEEP_ALIVE_TIME, // TimeUnit.SECONDS, // new LinkedBlockingQueue<>(MAXIMUM_POOL_SIZE), // REJECTED_EXECUTION_HANDLER); // // @NonNull // public static Thread runInBackground(@NonNull final Runnable runnable) { // Thread thread = new Thread(runnable); // THREAD_POOL_EXECUTOR.execute(thread); // return thread; // } // } // Path: ParallelRequests/app/src/main/java/itis/homework/parallelrequests/SampleService.java import android.app.IntentService; import android.content.Context; import android.content.Intent; import itis.homework.parallelrequests.app.AppDelegate; import itis.homework.parallelrequests.network.RequestsService; import itis.homework.parallelrequests.network.ThreadUtils; package itis.homework.parallelrequests; /** * @author Artur Vasilov */ public class SampleService extends IntentService { private boolean mIsConfigLoaded = false; private boolean mIsAuthLoaded = false; public static void start(Context context) { Intent intent = new Intent(context, SampleService.class); context.startService(intent); } private RequestsService mRequestsService; public SampleService() { super(SampleService.class.getName()); } @Override public void onCreate() { super.onCreate();
mRequestsService = AppDelegate.get(this).getRequestsService();
ArturVasilov/RxSamplesPractice
ParallelRequests/app/src/main/java/itis/homework/parallelrequests/SampleService.java
// Path: ParallelRequests/app/src/main/java/itis/homework/parallelrequests/app/AppDelegate.java // public class AppDelegate extends Application { // // private RequestsService mRequestsService; // // @Override // public void onCreate() { // super.onCreate(); // mRequestsService = new RequestProcessor(new RequestControllerImpl()); // } // // @NonNull // public static AppDelegate get(Context context) { // return ((AppDelegate) context.getApplicationContext()); // } // // @NonNull // public RequestsService getRequestsService() { // return mRequestsService; // } // } // // Path: ParallelRequests/app/src/main/java/itis/homework/parallelrequests/network/RequestsService.java // public interface RequestsService { // // Observable<Boolean> config(); // // Observable<Boolean> auth(); // // Observable<Boolean> friends(); // // Observable<Boolean> posts(); // // Observable<Boolean> groups(); // // Observable<Boolean> messages(); // // Observable<Boolean> photos(); // // void reset(); // // } // // Path: ParallelRequests/app/src/main/java/itis/homework/parallelrequests/network/ThreadUtils.java // public class ThreadUtils { // // private static final long RETRY_DELAY = 100; // private static final int MINIMUM_POOL_SIZE = 4; // private static final int CORE_POOL_SIZE = Runtime.getRuntime().availableProcessors(); // private static final int MAXIMUM_POOL_SIZE = CORE_POOL_SIZE > 2 ? CORE_POOL_SIZE * 2 : MINIMUM_POOL_SIZE; // private static final int KEEP_ALIVE_TIME = 10; // // private static final Handler HANDLER = new Handler(Looper.getMainLooper()); // // private static final RejectedExecutionHandler REJECTED_EXECUTION_HANDLER = new RejectedExecutionHandler() { // @Override // public void rejectedExecution(final Runnable runnable, ThreadPoolExecutor executor) { // HANDLER.postDelayed(() -> THREAD_POOL_EXECUTOR.execute(runnable), RETRY_DELAY); // } // }; // // private static final ThreadPoolExecutor THREAD_POOL_EXECUTOR = new ThreadPoolExecutor(CORE_POOL_SIZE * 2, // MAXIMUM_POOL_SIZE, // KEEP_ALIVE_TIME, // TimeUnit.SECONDS, // new LinkedBlockingQueue<>(MAXIMUM_POOL_SIZE), // REJECTED_EXECUTION_HANDLER); // // @NonNull // public static Thread runInBackground(@NonNull final Runnable runnable) { // Thread thread = new Thread(runnable); // THREAD_POOL_EXECUTOR.execute(thread); // return thread; // } // }
import android.app.IntentService; import android.content.Context; import android.content.Intent; import itis.homework.parallelrequests.app.AppDelegate; import itis.homework.parallelrequests.network.RequestsService; import itis.homework.parallelrequests.network.ThreadUtils;
package itis.homework.parallelrequests; /** * @author Artur Vasilov */ public class SampleService extends IntentService { private boolean mIsConfigLoaded = false; private boolean mIsAuthLoaded = false; public static void start(Context context) { Intent intent = new Intent(context, SampleService.class); context.startService(intent); } private RequestsService mRequestsService; public SampleService() { super(SampleService.class.getName()); } @Override public void onCreate() { super.onCreate(); mRequestsService = AppDelegate.get(this).getRequestsService(); } @Override protected void onHandleIntent(Intent intent) { mRequestsService.reset();
// Path: ParallelRequests/app/src/main/java/itis/homework/parallelrequests/app/AppDelegate.java // public class AppDelegate extends Application { // // private RequestsService mRequestsService; // // @Override // public void onCreate() { // super.onCreate(); // mRequestsService = new RequestProcessor(new RequestControllerImpl()); // } // // @NonNull // public static AppDelegate get(Context context) { // return ((AppDelegate) context.getApplicationContext()); // } // // @NonNull // public RequestsService getRequestsService() { // return mRequestsService; // } // } // // Path: ParallelRequests/app/src/main/java/itis/homework/parallelrequests/network/RequestsService.java // public interface RequestsService { // // Observable<Boolean> config(); // // Observable<Boolean> auth(); // // Observable<Boolean> friends(); // // Observable<Boolean> posts(); // // Observable<Boolean> groups(); // // Observable<Boolean> messages(); // // Observable<Boolean> photos(); // // void reset(); // // } // // Path: ParallelRequests/app/src/main/java/itis/homework/parallelrequests/network/ThreadUtils.java // public class ThreadUtils { // // private static final long RETRY_DELAY = 100; // private static final int MINIMUM_POOL_SIZE = 4; // private static final int CORE_POOL_SIZE = Runtime.getRuntime().availableProcessors(); // private static final int MAXIMUM_POOL_SIZE = CORE_POOL_SIZE > 2 ? CORE_POOL_SIZE * 2 : MINIMUM_POOL_SIZE; // private static final int KEEP_ALIVE_TIME = 10; // // private static final Handler HANDLER = new Handler(Looper.getMainLooper()); // // private static final RejectedExecutionHandler REJECTED_EXECUTION_HANDLER = new RejectedExecutionHandler() { // @Override // public void rejectedExecution(final Runnable runnable, ThreadPoolExecutor executor) { // HANDLER.postDelayed(() -> THREAD_POOL_EXECUTOR.execute(runnable), RETRY_DELAY); // } // }; // // private static final ThreadPoolExecutor THREAD_POOL_EXECUTOR = new ThreadPoolExecutor(CORE_POOL_SIZE * 2, // MAXIMUM_POOL_SIZE, // KEEP_ALIVE_TIME, // TimeUnit.SECONDS, // new LinkedBlockingQueue<>(MAXIMUM_POOL_SIZE), // REJECTED_EXECUTION_HANDLER); // // @NonNull // public static Thread runInBackground(@NonNull final Runnable runnable) { // Thread thread = new Thread(runnable); // THREAD_POOL_EXECUTOR.execute(thread); // return thread; // } // } // Path: ParallelRequests/app/src/main/java/itis/homework/parallelrequests/SampleService.java import android.app.IntentService; import android.content.Context; import android.content.Intent; import itis.homework.parallelrequests.app.AppDelegate; import itis.homework.parallelrequests.network.RequestsService; import itis.homework.parallelrequests.network.ThreadUtils; package itis.homework.parallelrequests; /** * @author Artur Vasilov */ public class SampleService extends IntentService { private boolean mIsConfigLoaded = false; private boolean mIsAuthLoaded = false; public static void start(Context context) { Intent intent = new Intent(context, SampleService.class); context.startService(intent); } private RequestsService mRequestsService; public SampleService() { super(SampleService.class.getName()); } @Override public void onCreate() { super.onCreate(); mRequestsService = AppDelegate.get(this).getRequestsService(); } @Override protected void onHandleIntent(Intent intent) { mRequestsService.reset();
ThreadUtils.runInBackground(new Runnable() {
BukkitDevTeam/Fondue
src/main/java/com/md_5/fondue/protocol/packet/Packet1Login.java
// Path: src/main/java/com/md_5/fondue/protocol/PacketHandler.java // public abstract class PacketHandler { // // /** // * Method to determine whether this is a server handler, client handler or // * other. // * // * @return the type of method interface this handler should accept // */ // public abstract Class<? extends Annotation> getType(); // // @Server // public void handle(Packet0KeepAlive packet) { // } // // @ServerLogin // public void handle(Packet2Handshake packet) { // } // // @Server // public void handle(Packet3ChatMessage packet) { // } // // @Server // public void handle(Packet7UseEntity packet) { // } // // @Server // public void handle(PacketAFlying packet) { // } // // @Server // public void handle(PacketEDig packet) { // } // // @Server // // public void handle(PacketFPlace packet){} // // @Server // public void handle(Packet10HeldItem packet) { // } // // @Server // public void handle(Packet12Animation packet) { // } // // @Server // public void handle(Packet13EntityAction packet) { // } // // @Server // // public void handle(Packet66WindowClick packet){} // // @Server // public void handle(Packet6AConfirmTransaction packet) { // } // // @Server // public void handle(Packet6CEnchantItem packet) { // } // // @Server // public void handle(Packet82UpdateSign packet) { // } // // // @Server // // public void handle(Packet6BSlot); // @Server // public void handle(PacketCAPlayerAbilities packet) { // } // // @Server // public void handle(PacketCBTabComplete packet) { // } // // @Server // public void handle(PacketCCClientInfo packet) { // } // // @Server // @ServerLogin // public void handle(PacketCDClientStatus packet) { // } // // @Server // public void handle(PacketFAPluginMessage packet) { // } // // @ServerLogin // public void handle(PacketFCKeyResponse packet) { // } // // @ServerLogin // public void handle(PacketFEServerPing packet) { // } // // @Server // public void handle(PacketFFDisconnect packet) { // } // // /** // * Methods denoted by this annotation should be handled by a server // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Server { // } // // /** // * Methods denoted by this annotation should be handled by the initial // * server implementation of this class. // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface ServerLogin { // } // // /** // * Methods denoted by this method annotation be handled by a client // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Client { // } // }
import com.md_5.fondue.protocol.PacketHandler; import io.netty.buffer.ByteBuf; import lombok.EqualsAndHashCode; import lombok.ToString;
private byte difficulty; private byte unused; private byte maxPlayers; public Packet1Login() { } @Override public void read(ByteBuf in) { entityId = in.readInt(); levelType = readString(in); gameMode = in.readByte(); dimension = in.readByte(); difficulty = in.readByte(); unused = in.readByte(); maxPlayers = in.readByte(); } @Override public void write(ByteBuf out) { out.writeInt(entityId); writeString(out, levelType); out.writeByte(gameMode); out.writeByte(dimension); out.writeByte(difficulty); out.writeByte(unused); out.writeByte(maxPlayers); } @Override
// Path: src/main/java/com/md_5/fondue/protocol/PacketHandler.java // public abstract class PacketHandler { // // /** // * Method to determine whether this is a server handler, client handler or // * other. // * // * @return the type of method interface this handler should accept // */ // public abstract Class<? extends Annotation> getType(); // // @Server // public void handle(Packet0KeepAlive packet) { // } // // @ServerLogin // public void handle(Packet2Handshake packet) { // } // // @Server // public void handle(Packet3ChatMessage packet) { // } // // @Server // public void handle(Packet7UseEntity packet) { // } // // @Server // public void handle(PacketAFlying packet) { // } // // @Server // public void handle(PacketEDig packet) { // } // // @Server // // public void handle(PacketFPlace packet){} // // @Server // public void handle(Packet10HeldItem packet) { // } // // @Server // public void handle(Packet12Animation packet) { // } // // @Server // public void handle(Packet13EntityAction packet) { // } // // @Server // // public void handle(Packet66WindowClick packet){} // // @Server // public void handle(Packet6AConfirmTransaction packet) { // } // // @Server // public void handle(Packet6CEnchantItem packet) { // } // // @Server // public void handle(Packet82UpdateSign packet) { // } // // // @Server // // public void handle(Packet6BSlot); // @Server // public void handle(PacketCAPlayerAbilities packet) { // } // // @Server // public void handle(PacketCBTabComplete packet) { // } // // @Server // public void handle(PacketCCClientInfo packet) { // } // // @Server // @ServerLogin // public void handle(PacketCDClientStatus packet) { // } // // @Server // public void handle(PacketFAPluginMessage packet) { // } // // @ServerLogin // public void handle(PacketFCKeyResponse packet) { // } // // @ServerLogin // public void handle(PacketFEServerPing packet) { // } // // @Server // public void handle(PacketFFDisconnect packet) { // } // // /** // * Methods denoted by this annotation should be handled by a server // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Server { // } // // /** // * Methods denoted by this annotation should be handled by the initial // * server implementation of this class. // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface ServerLogin { // } // // /** // * Methods denoted by this method annotation be handled by a client // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Client { // } // } // Path: src/main/java/com/md_5/fondue/protocol/packet/Packet1Login.java import com.md_5.fondue.protocol.PacketHandler; import io.netty.buffer.ByteBuf; import lombok.EqualsAndHashCode; import lombok.ToString; private byte difficulty; private byte unused; private byte maxPlayers; public Packet1Login() { } @Override public void read(ByteBuf in) { entityId = in.readInt(); levelType = readString(in); gameMode = in.readByte(); dimension = in.readByte(); difficulty = in.readByte(); unused = in.readByte(); maxPlayers = in.readByte(); } @Override public void write(ByteBuf out) { out.writeInt(entityId); writeString(out, levelType); out.writeByte(gameMode); out.writeByte(dimension); out.writeByte(difficulty); out.writeByte(unused); out.writeByte(maxPlayers); } @Override
public void handle(PacketHandler handler) {
BukkitDevTeam/Fondue
src/main/java/com/md_5/fondue/protocol/packet/PacketCAPlayerAbilities.java
// Path: src/main/java/com/md_5/fondue/protocol/PacketHandler.java // public abstract class PacketHandler { // // /** // * Method to determine whether this is a server handler, client handler or // * other. // * // * @return the type of method interface this handler should accept // */ // public abstract Class<? extends Annotation> getType(); // // @Server // public void handle(Packet0KeepAlive packet) { // } // // @ServerLogin // public void handle(Packet2Handshake packet) { // } // // @Server // public void handle(Packet3ChatMessage packet) { // } // // @Server // public void handle(Packet7UseEntity packet) { // } // // @Server // public void handle(PacketAFlying packet) { // } // // @Server // public void handle(PacketEDig packet) { // } // // @Server // // public void handle(PacketFPlace packet){} // // @Server // public void handle(Packet10HeldItem packet) { // } // // @Server // public void handle(Packet12Animation packet) { // } // // @Server // public void handle(Packet13EntityAction packet) { // } // // @Server // // public void handle(Packet66WindowClick packet){} // // @Server // public void handle(Packet6AConfirmTransaction packet) { // } // // @Server // public void handle(Packet6CEnchantItem packet) { // } // // @Server // public void handle(Packet82UpdateSign packet) { // } // // // @Server // // public void handle(Packet6BSlot); // @Server // public void handle(PacketCAPlayerAbilities packet) { // } // // @Server // public void handle(PacketCBTabComplete packet) { // } // // @Server // public void handle(PacketCCClientInfo packet) { // } // // @Server // @ServerLogin // public void handle(PacketCDClientStatus packet) { // } // // @Server // public void handle(PacketFAPluginMessage packet) { // } // // @ServerLogin // public void handle(PacketFCKeyResponse packet) { // } // // @ServerLogin // public void handle(PacketFEServerPing packet) { // } // // @Server // public void handle(PacketFFDisconnect packet) { // } // // /** // * Methods denoted by this annotation should be handled by a server // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Server { // } // // /** // * Methods denoted by this annotation should be handled by the initial // * server implementation of this class. // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface ServerLogin { // } // // /** // * Methods denoted by this method annotation be handled by a client // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Client { // } // }
import com.md_5.fondue.protocol.PacketHandler; import io.netty.buffer.ByteBuf; import lombok.EqualsAndHashCode; import lombok.ToString;
package com.md_5.fondue.protocol.packet; @ToString @EqualsAndHashCode(callSuper = false) public class PacketCAPlayerAbilities extends Packet { private byte flags; private byte flyingSpeed; private byte walkingSpeed; public PacketCAPlayerAbilities() { } @Override public void read(ByteBuf in) { flags = in.readByte(); flyingSpeed = in.readByte(); walkingSpeed = in.readByte(); } @Override public void write(ByteBuf out) { out.writeByte(flags); out.writeByte(flyingSpeed); out.writeByte(walkingSpeed); } @Override
// Path: src/main/java/com/md_5/fondue/protocol/PacketHandler.java // public abstract class PacketHandler { // // /** // * Method to determine whether this is a server handler, client handler or // * other. // * // * @return the type of method interface this handler should accept // */ // public abstract Class<? extends Annotation> getType(); // // @Server // public void handle(Packet0KeepAlive packet) { // } // // @ServerLogin // public void handle(Packet2Handshake packet) { // } // // @Server // public void handle(Packet3ChatMessage packet) { // } // // @Server // public void handle(Packet7UseEntity packet) { // } // // @Server // public void handle(PacketAFlying packet) { // } // // @Server // public void handle(PacketEDig packet) { // } // // @Server // // public void handle(PacketFPlace packet){} // // @Server // public void handle(Packet10HeldItem packet) { // } // // @Server // public void handle(Packet12Animation packet) { // } // // @Server // public void handle(Packet13EntityAction packet) { // } // // @Server // // public void handle(Packet66WindowClick packet){} // // @Server // public void handle(Packet6AConfirmTransaction packet) { // } // // @Server // public void handle(Packet6CEnchantItem packet) { // } // // @Server // public void handle(Packet82UpdateSign packet) { // } // // // @Server // // public void handle(Packet6BSlot); // @Server // public void handle(PacketCAPlayerAbilities packet) { // } // // @Server // public void handle(PacketCBTabComplete packet) { // } // // @Server // public void handle(PacketCCClientInfo packet) { // } // // @Server // @ServerLogin // public void handle(PacketCDClientStatus packet) { // } // // @Server // public void handle(PacketFAPluginMessage packet) { // } // // @ServerLogin // public void handle(PacketFCKeyResponse packet) { // } // // @ServerLogin // public void handle(PacketFEServerPing packet) { // } // // @Server // public void handle(PacketFFDisconnect packet) { // } // // /** // * Methods denoted by this annotation should be handled by a server // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Server { // } // // /** // * Methods denoted by this annotation should be handled by the initial // * server implementation of this class. // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface ServerLogin { // } // // /** // * Methods denoted by this method annotation be handled by a client // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Client { // } // } // Path: src/main/java/com/md_5/fondue/protocol/packet/PacketCAPlayerAbilities.java import com.md_5.fondue.protocol.PacketHandler; import io.netty.buffer.ByteBuf; import lombok.EqualsAndHashCode; import lombok.ToString; package com.md_5.fondue.protocol.packet; @ToString @EqualsAndHashCode(callSuper = false) public class PacketCAPlayerAbilities extends Packet { private byte flags; private byte flyingSpeed; private byte walkingSpeed; public PacketCAPlayerAbilities() { } @Override public void read(ByteBuf in) { flags = in.readByte(); flyingSpeed = in.readByte(); walkingSpeed = in.readByte(); } @Override public void write(ByteBuf out) { out.writeByte(flags); out.writeByte(flyingSpeed); out.writeByte(walkingSpeed); } @Override
public void handle(PacketHandler handler) {
BukkitDevTeam/Fondue
src/main/java/com/md_5/fondue/protocol/packet/PacketFEServerPing.java
// Path: src/main/java/com/md_5/fondue/protocol/PacketHandler.java // public abstract class PacketHandler { // // /** // * Method to determine whether this is a server handler, client handler or // * other. // * // * @return the type of method interface this handler should accept // */ // public abstract Class<? extends Annotation> getType(); // // @Server // public void handle(Packet0KeepAlive packet) { // } // // @ServerLogin // public void handle(Packet2Handshake packet) { // } // // @Server // public void handle(Packet3ChatMessage packet) { // } // // @Server // public void handle(Packet7UseEntity packet) { // } // // @Server // public void handle(PacketAFlying packet) { // } // // @Server // public void handle(PacketEDig packet) { // } // // @Server // // public void handle(PacketFPlace packet){} // // @Server // public void handle(Packet10HeldItem packet) { // } // // @Server // public void handle(Packet12Animation packet) { // } // // @Server // public void handle(Packet13EntityAction packet) { // } // // @Server // // public void handle(Packet66WindowClick packet){} // // @Server // public void handle(Packet6AConfirmTransaction packet) { // } // // @Server // public void handle(Packet6CEnchantItem packet) { // } // // @Server // public void handle(Packet82UpdateSign packet) { // } // // // @Server // // public void handle(Packet6BSlot); // @Server // public void handle(PacketCAPlayerAbilities packet) { // } // // @Server // public void handle(PacketCBTabComplete packet) { // } // // @Server // public void handle(PacketCCClientInfo packet) { // } // // @Server // @ServerLogin // public void handle(PacketCDClientStatus packet) { // } // // @Server // public void handle(PacketFAPluginMessage packet) { // } // // @ServerLogin // public void handle(PacketFCKeyResponse packet) { // } // // @ServerLogin // public void handle(PacketFEServerPing packet) { // } // // @Server // public void handle(PacketFFDisconnect packet) { // } // // /** // * Methods denoted by this annotation should be handled by a server // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Server { // } // // /** // * Methods denoted by this annotation should be handled by the initial // * server implementation of this class. // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface ServerLogin { // } // // /** // * Methods denoted by this method annotation be handled by a client // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Client { // } // }
import com.md_5.fondue.protocol.PacketHandler; import io.netty.buffer.ByteBuf; import lombok.EqualsAndHashCode; import lombok.ToString;
package com.md_5.fondue.protocol.packet; @ToString @EqualsAndHashCode(callSuper = false) public class PacketFEServerPing extends Packet { public PacketFEServerPing() { } @Override public void read(ByteBuf in) { } @Override public void write(ByteBuf out) { } @Override
// Path: src/main/java/com/md_5/fondue/protocol/PacketHandler.java // public abstract class PacketHandler { // // /** // * Method to determine whether this is a server handler, client handler or // * other. // * // * @return the type of method interface this handler should accept // */ // public abstract Class<? extends Annotation> getType(); // // @Server // public void handle(Packet0KeepAlive packet) { // } // // @ServerLogin // public void handle(Packet2Handshake packet) { // } // // @Server // public void handle(Packet3ChatMessage packet) { // } // // @Server // public void handle(Packet7UseEntity packet) { // } // // @Server // public void handle(PacketAFlying packet) { // } // // @Server // public void handle(PacketEDig packet) { // } // // @Server // // public void handle(PacketFPlace packet){} // // @Server // public void handle(Packet10HeldItem packet) { // } // // @Server // public void handle(Packet12Animation packet) { // } // // @Server // public void handle(Packet13EntityAction packet) { // } // // @Server // // public void handle(Packet66WindowClick packet){} // // @Server // public void handle(Packet6AConfirmTransaction packet) { // } // // @Server // public void handle(Packet6CEnchantItem packet) { // } // // @Server // public void handle(Packet82UpdateSign packet) { // } // // // @Server // // public void handle(Packet6BSlot); // @Server // public void handle(PacketCAPlayerAbilities packet) { // } // // @Server // public void handle(PacketCBTabComplete packet) { // } // // @Server // public void handle(PacketCCClientInfo packet) { // } // // @Server // @ServerLogin // public void handle(PacketCDClientStatus packet) { // } // // @Server // public void handle(PacketFAPluginMessage packet) { // } // // @ServerLogin // public void handle(PacketFCKeyResponse packet) { // } // // @ServerLogin // public void handle(PacketFEServerPing packet) { // } // // @Server // public void handle(PacketFFDisconnect packet) { // } // // /** // * Methods denoted by this annotation should be handled by a server // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Server { // } // // /** // * Methods denoted by this annotation should be handled by the initial // * server implementation of this class. // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface ServerLogin { // } // // /** // * Methods denoted by this method annotation be handled by a client // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Client { // } // } // Path: src/main/java/com/md_5/fondue/protocol/packet/PacketFEServerPing.java import com.md_5.fondue.protocol.PacketHandler; import io.netty.buffer.ByteBuf; import lombok.EqualsAndHashCode; import lombok.ToString; package com.md_5.fondue.protocol.packet; @ToString @EqualsAndHashCode(callSuper = false) public class PacketFEServerPing extends Packet { public PacketFEServerPing() { } @Override public void read(ByteBuf in) { } @Override public void write(ByteBuf out) { } @Override
public void handle(PacketHandler handler) {
BukkitDevTeam/Fondue
src/main/java/com/md_5/fondue/protocol/packet/Packet3DEffect.java
// Path: src/main/java/com/md_5/fondue/protocol/PacketHandler.java // public abstract class PacketHandler { // // /** // * Method to determine whether this is a server handler, client handler or // * other. // * // * @return the type of method interface this handler should accept // */ // public abstract Class<? extends Annotation> getType(); // // @Server // public void handle(Packet0KeepAlive packet) { // } // // @ServerLogin // public void handle(Packet2Handshake packet) { // } // // @Server // public void handle(Packet3ChatMessage packet) { // } // // @Server // public void handle(Packet7UseEntity packet) { // } // // @Server // public void handle(PacketAFlying packet) { // } // // @Server // public void handle(PacketEDig packet) { // } // // @Server // // public void handle(PacketFPlace packet){} // // @Server // public void handle(Packet10HeldItem packet) { // } // // @Server // public void handle(Packet12Animation packet) { // } // // @Server // public void handle(Packet13EntityAction packet) { // } // // @Server // // public void handle(Packet66WindowClick packet){} // // @Server // public void handle(Packet6AConfirmTransaction packet) { // } // // @Server // public void handle(Packet6CEnchantItem packet) { // } // // @Server // public void handle(Packet82UpdateSign packet) { // } // // // @Server // // public void handle(Packet6BSlot); // @Server // public void handle(PacketCAPlayerAbilities packet) { // } // // @Server // public void handle(PacketCBTabComplete packet) { // } // // @Server // public void handle(PacketCCClientInfo packet) { // } // // @Server // @ServerLogin // public void handle(PacketCDClientStatus packet) { // } // // @Server // public void handle(PacketFAPluginMessage packet) { // } // // @ServerLogin // public void handle(PacketFCKeyResponse packet) { // } // // @ServerLogin // public void handle(PacketFEServerPing packet) { // } // // @Server // public void handle(PacketFFDisconnect packet) { // } // // /** // * Methods denoted by this annotation should be handled by a server // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Server { // } // // /** // * Methods denoted by this annotation should be handled by the initial // * server implementation of this class. // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface ServerLogin { // } // // /** // * Methods denoted by this method annotation be handled by a client // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Client { // } // }
import com.md_5.fondue.protocol.PacketHandler; import io.netty.buffer.ByteBuf; import lombok.EqualsAndHashCode; import lombok.ToString;
package com.md_5.fondue.protocol.packet; @ToString @EqualsAndHashCode(callSuper = false) public class Packet3DEffect extends Packet { private int effectId; private int x; private byte y; private int z; private int data; public Packet3DEffect() { } @Override public void read(ByteBuf in) { effectId = in.readInt(); x = in.readInt(); y = in.readByte(); z = in.readInt(); data = in.readInt(); } @Override public void write(ByteBuf out) { out.writeInt(effectId); out.writeInt(x); out.writeByte(y); out.writeInt(z); out.writeInt(data); } @Override
// Path: src/main/java/com/md_5/fondue/protocol/PacketHandler.java // public abstract class PacketHandler { // // /** // * Method to determine whether this is a server handler, client handler or // * other. // * // * @return the type of method interface this handler should accept // */ // public abstract Class<? extends Annotation> getType(); // // @Server // public void handle(Packet0KeepAlive packet) { // } // // @ServerLogin // public void handle(Packet2Handshake packet) { // } // // @Server // public void handle(Packet3ChatMessage packet) { // } // // @Server // public void handle(Packet7UseEntity packet) { // } // // @Server // public void handle(PacketAFlying packet) { // } // // @Server // public void handle(PacketEDig packet) { // } // // @Server // // public void handle(PacketFPlace packet){} // // @Server // public void handle(Packet10HeldItem packet) { // } // // @Server // public void handle(Packet12Animation packet) { // } // // @Server // public void handle(Packet13EntityAction packet) { // } // // @Server // // public void handle(Packet66WindowClick packet){} // // @Server // public void handle(Packet6AConfirmTransaction packet) { // } // // @Server // public void handle(Packet6CEnchantItem packet) { // } // // @Server // public void handle(Packet82UpdateSign packet) { // } // // // @Server // // public void handle(Packet6BSlot); // @Server // public void handle(PacketCAPlayerAbilities packet) { // } // // @Server // public void handle(PacketCBTabComplete packet) { // } // // @Server // public void handle(PacketCCClientInfo packet) { // } // // @Server // @ServerLogin // public void handle(PacketCDClientStatus packet) { // } // // @Server // public void handle(PacketFAPluginMessage packet) { // } // // @ServerLogin // public void handle(PacketFCKeyResponse packet) { // } // // @ServerLogin // public void handle(PacketFEServerPing packet) { // } // // @Server // public void handle(PacketFFDisconnect packet) { // } // // /** // * Methods denoted by this annotation should be handled by a server // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Server { // } // // /** // * Methods denoted by this annotation should be handled by the initial // * server implementation of this class. // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface ServerLogin { // } // // /** // * Methods denoted by this method annotation be handled by a client // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Client { // } // } // Path: src/main/java/com/md_5/fondue/protocol/packet/Packet3DEffect.java import com.md_5.fondue.protocol.PacketHandler; import io.netty.buffer.ByteBuf; import lombok.EqualsAndHashCode; import lombok.ToString; package com.md_5.fondue.protocol.packet; @ToString @EqualsAndHashCode(callSuper = false) public class Packet3DEffect extends Packet { private int effectId; private int x; private byte y; private int z; private int data; public Packet3DEffect() { } @Override public void read(ByteBuf in) { effectId = in.readInt(); x = in.readInt(); y = in.readByte(); z = in.readInt(); data = in.readInt(); } @Override public void write(ByteBuf out) { out.writeInt(effectId); out.writeInt(x); out.writeByte(y); out.writeInt(z); out.writeInt(data); } @Override
public void handle(PacketHandler handler) {
BukkitDevTeam/Fondue
src/main/java/com/md_5/fondue/protocol/packet/Packet11UseBed.java
// Path: src/main/java/com/md_5/fondue/protocol/PacketHandler.java // public abstract class PacketHandler { // // /** // * Method to determine whether this is a server handler, client handler or // * other. // * // * @return the type of method interface this handler should accept // */ // public abstract Class<? extends Annotation> getType(); // // @Server // public void handle(Packet0KeepAlive packet) { // } // // @ServerLogin // public void handle(Packet2Handshake packet) { // } // // @Server // public void handle(Packet3ChatMessage packet) { // } // // @Server // public void handle(Packet7UseEntity packet) { // } // // @Server // public void handle(PacketAFlying packet) { // } // // @Server // public void handle(PacketEDig packet) { // } // // @Server // // public void handle(PacketFPlace packet){} // // @Server // public void handle(Packet10HeldItem packet) { // } // // @Server // public void handle(Packet12Animation packet) { // } // // @Server // public void handle(Packet13EntityAction packet) { // } // // @Server // // public void handle(Packet66WindowClick packet){} // // @Server // public void handle(Packet6AConfirmTransaction packet) { // } // // @Server // public void handle(Packet6CEnchantItem packet) { // } // // @Server // public void handle(Packet82UpdateSign packet) { // } // // // @Server // // public void handle(Packet6BSlot); // @Server // public void handle(PacketCAPlayerAbilities packet) { // } // // @Server // public void handle(PacketCBTabComplete packet) { // } // // @Server // public void handle(PacketCCClientInfo packet) { // } // // @Server // @ServerLogin // public void handle(PacketCDClientStatus packet) { // } // // @Server // public void handle(PacketFAPluginMessage packet) { // } // // @ServerLogin // public void handle(PacketFCKeyResponse packet) { // } // // @ServerLogin // public void handle(PacketFEServerPing packet) { // } // // @Server // public void handle(PacketFFDisconnect packet) { // } // // /** // * Methods denoted by this annotation should be handled by a server // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Server { // } // // /** // * Methods denoted by this annotation should be handled by the initial // * server implementation of this class. // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface ServerLogin { // } // // /** // * Methods denoted by this method annotation be handled by a client // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Client { // } // }
import com.md_5.fondue.protocol.PacketHandler; import io.netty.buffer.ByteBuf; import lombok.EqualsAndHashCode; import lombok.ToString;
package com.md_5.fondue.protocol.packet; @ToString @EqualsAndHashCode(callSuper = false) public class Packet11UseBed extends Packet { private int entity; private byte unknown; private int x; private byte y; private int z; public Packet11UseBed() { } @Override public void read(ByteBuf in) { entity = in.readInt(); unknown = in.readByte(); x = in.readInt(); y = in.readByte(); z = in.readInt(); } @Override public void write(ByteBuf out) { out.writeInt(entity); out.writeByte(unknown); out.writeInt(x); out.writeByte(y); out.writeInt(z); } @Override
// Path: src/main/java/com/md_5/fondue/protocol/PacketHandler.java // public abstract class PacketHandler { // // /** // * Method to determine whether this is a server handler, client handler or // * other. // * // * @return the type of method interface this handler should accept // */ // public abstract Class<? extends Annotation> getType(); // // @Server // public void handle(Packet0KeepAlive packet) { // } // // @ServerLogin // public void handle(Packet2Handshake packet) { // } // // @Server // public void handle(Packet3ChatMessage packet) { // } // // @Server // public void handle(Packet7UseEntity packet) { // } // // @Server // public void handle(PacketAFlying packet) { // } // // @Server // public void handle(PacketEDig packet) { // } // // @Server // // public void handle(PacketFPlace packet){} // // @Server // public void handle(Packet10HeldItem packet) { // } // // @Server // public void handle(Packet12Animation packet) { // } // // @Server // public void handle(Packet13EntityAction packet) { // } // // @Server // // public void handle(Packet66WindowClick packet){} // // @Server // public void handle(Packet6AConfirmTransaction packet) { // } // // @Server // public void handle(Packet6CEnchantItem packet) { // } // // @Server // public void handle(Packet82UpdateSign packet) { // } // // // @Server // // public void handle(Packet6BSlot); // @Server // public void handle(PacketCAPlayerAbilities packet) { // } // // @Server // public void handle(PacketCBTabComplete packet) { // } // // @Server // public void handle(PacketCCClientInfo packet) { // } // // @Server // @ServerLogin // public void handle(PacketCDClientStatus packet) { // } // // @Server // public void handle(PacketFAPluginMessage packet) { // } // // @ServerLogin // public void handle(PacketFCKeyResponse packet) { // } // // @ServerLogin // public void handle(PacketFEServerPing packet) { // } // // @Server // public void handle(PacketFFDisconnect packet) { // } // // /** // * Methods denoted by this annotation should be handled by a server // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Server { // } // // /** // * Methods denoted by this annotation should be handled by the initial // * server implementation of this class. // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface ServerLogin { // } // // /** // * Methods denoted by this method annotation be handled by a client // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Client { // } // } // Path: src/main/java/com/md_5/fondue/protocol/packet/Packet11UseBed.java import com.md_5.fondue.protocol.PacketHandler; import io.netty.buffer.ByteBuf; import lombok.EqualsAndHashCode; import lombok.ToString; package com.md_5.fondue.protocol.packet; @ToString @EqualsAndHashCode(callSuper = false) public class Packet11UseBed extends Packet { private int entity; private byte unknown; private int x; private byte y; private int z; public Packet11UseBed() { } @Override public void read(ByteBuf in) { entity = in.readInt(); unknown = in.readByte(); x = in.readInt(); y = in.readByte(); z = in.readInt(); } @Override public void write(ByteBuf out) { out.writeInt(entity); out.writeByte(unknown); out.writeInt(x); out.writeByte(y); out.writeInt(z); } @Override
public void handle(PacketHandler handler) {
BukkitDevTeam/Fondue
src/main/java/com/md_5/fondue/protocol/packet/PacketFAPluginMessage.java
// Path: src/main/java/com/md_5/fondue/protocol/PacketHandler.java // public abstract class PacketHandler { // // /** // * Method to determine whether this is a server handler, client handler or // * other. // * // * @return the type of method interface this handler should accept // */ // public abstract Class<? extends Annotation> getType(); // // @Server // public void handle(Packet0KeepAlive packet) { // } // // @ServerLogin // public void handle(Packet2Handshake packet) { // } // // @Server // public void handle(Packet3ChatMessage packet) { // } // // @Server // public void handle(Packet7UseEntity packet) { // } // // @Server // public void handle(PacketAFlying packet) { // } // // @Server // public void handle(PacketEDig packet) { // } // // @Server // // public void handle(PacketFPlace packet){} // // @Server // public void handle(Packet10HeldItem packet) { // } // // @Server // public void handle(Packet12Animation packet) { // } // // @Server // public void handle(Packet13EntityAction packet) { // } // // @Server // // public void handle(Packet66WindowClick packet){} // // @Server // public void handle(Packet6AConfirmTransaction packet) { // } // // @Server // public void handle(Packet6CEnchantItem packet) { // } // // @Server // public void handle(Packet82UpdateSign packet) { // } // // // @Server // // public void handle(Packet6BSlot); // @Server // public void handle(PacketCAPlayerAbilities packet) { // } // // @Server // public void handle(PacketCBTabComplete packet) { // } // // @Server // public void handle(PacketCCClientInfo packet) { // } // // @Server // @ServerLogin // public void handle(PacketCDClientStatus packet) { // } // // @Server // public void handle(PacketFAPluginMessage packet) { // } // // @ServerLogin // public void handle(PacketFCKeyResponse packet) { // } // // @ServerLogin // public void handle(PacketFEServerPing packet) { // } // // @Server // public void handle(PacketFFDisconnect packet) { // } // // /** // * Methods denoted by this annotation should be handled by a server // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Server { // } // // /** // * Methods denoted by this annotation should be handled by the initial // * server implementation of this class. // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface ServerLogin { // } // // /** // * Methods denoted by this method annotation be handled by a client // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Client { // } // }
import com.md_5.fondue.protocol.PacketHandler; import io.netty.buffer.ByteBuf; import lombok.EqualsAndHashCode; import lombok.ToString;
package com.md_5.fondue.protocol.packet; @ToString @EqualsAndHashCode(callSuper = false) public class PacketFAPluginMessage extends Packet { private String channel; private byte[] data; public PacketFAPluginMessage() { } @Override public void read(ByteBuf in) { channel = readString(in); data = readBytes(in); } @Override public void write(ByteBuf out) { writeString(out, channel); writeBytes(out, data); } @Override
// Path: src/main/java/com/md_5/fondue/protocol/PacketHandler.java // public abstract class PacketHandler { // // /** // * Method to determine whether this is a server handler, client handler or // * other. // * // * @return the type of method interface this handler should accept // */ // public abstract Class<? extends Annotation> getType(); // // @Server // public void handle(Packet0KeepAlive packet) { // } // // @ServerLogin // public void handle(Packet2Handshake packet) { // } // // @Server // public void handle(Packet3ChatMessage packet) { // } // // @Server // public void handle(Packet7UseEntity packet) { // } // // @Server // public void handle(PacketAFlying packet) { // } // // @Server // public void handle(PacketEDig packet) { // } // // @Server // // public void handle(PacketFPlace packet){} // // @Server // public void handle(Packet10HeldItem packet) { // } // // @Server // public void handle(Packet12Animation packet) { // } // // @Server // public void handle(Packet13EntityAction packet) { // } // // @Server // // public void handle(Packet66WindowClick packet){} // // @Server // public void handle(Packet6AConfirmTransaction packet) { // } // // @Server // public void handle(Packet6CEnchantItem packet) { // } // // @Server // public void handle(Packet82UpdateSign packet) { // } // // // @Server // // public void handle(Packet6BSlot); // @Server // public void handle(PacketCAPlayerAbilities packet) { // } // // @Server // public void handle(PacketCBTabComplete packet) { // } // // @Server // public void handle(PacketCCClientInfo packet) { // } // // @Server // @ServerLogin // public void handle(PacketCDClientStatus packet) { // } // // @Server // public void handle(PacketFAPluginMessage packet) { // } // // @ServerLogin // public void handle(PacketFCKeyResponse packet) { // } // // @ServerLogin // public void handle(PacketFEServerPing packet) { // } // // @Server // public void handle(PacketFFDisconnect packet) { // } // // /** // * Methods denoted by this annotation should be handled by a server // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Server { // } // // /** // * Methods denoted by this annotation should be handled by the initial // * server implementation of this class. // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface ServerLogin { // } // // /** // * Methods denoted by this method annotation be handled by a client // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Client { // } // } // Path: src/main/java/com/md_5/fondue/protocol/packet/PacketFAPluginMessage.java import com.md_5.fondue.protocol.PacketHandler; import io.netty.buffer.ByteBuf; import lombok.EqualsAndHashCode; import lombok.ToString; package com.md_5.fondue.protocol.packet; @ToString @EqualsAndHashCode(callSuper = false) public class PacketFAPluginMessage extends Packet { private String channel; private byte[] data; public PacketFAPluginMessage() { } @Override public void read(ByteBuf in) { channel = readString(in); data = readBytes(in); } @Override public void write(ByteBuf out) { writeString(out, channel); writeBytes(out, data); } @Override
public void handle(PacketHandler handler) {
BukkitDevTeam/Fondue
src/main/java/com/md_5/fondue/protocol/packet/Packet35BlockChange.java
// Path: src/main/java/com/md_5/fondue/protocol/PacketHandler.java // public abstract class PacketHandler { // // /** // * Method to determine whether this is a server handler, client handler or // * other. // * // * @return the type of method interface this handler should accept // */ // public abstract Class<? extends Annotation> getType(); // // @Server // public void handle(Packet0KeepAlive packet) { // } // // @ServerLogin // public void handle(Packet2Handshake packet) { // } // // @Server // public void handle(Packet3ChatMessage packet) { // } // // @Server // public void handle(Packet7UseEntity packet) { // } // // @Server // public void handle(PacketAFlying packet) { // } // // @Server // public void handle(PacketEDig packet) { // } // // @Server // // public void handle(PacketFPlace packet){} // // @Server // public void handle(Packet10HeldItem packet) { // } // // @Server // public void handle(Packet12Animation packet) { // } // // @Server // public void handle(Packet13EntityAction packet) { // } // // @Server // // public void handle(Packet66WindowClick packet){} // // @Server // public void handle(Packet6AConfirmTransaction packet) { // } // // @Server // public void handle(Packet6CEnchantItem packet) { // } // // @Server // public void handle(Packet82UpdateSign packet) { // } // // // @Server // // public void handle(Packet6BSlot); // @Server // public void handle(PacketCAPlayerAbilities packet) { // } // // @Server // public void handle(PacketCBTabComplete packet) { // } // // @Server // public void handle(PacketCCClientInfo packet) { // } // // @Server // @ServerLogin // public void handle(PacketCDClientStatus packet) { // } // // @Server // public void handle(PacketFAPluginMessage packet) { // } // // @ServerLogin // public void handle(PacketFCKeyResponse packet) { // } // // @ServerLogin // public void handle(PacketFEServerPing packet) { // } // // @Server // public void handle(PacketFFDisconnect packet) { // } // // /** // * Methods denoted by this annotation should be handled by a server // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Server { // } // // /** // * Methods denoted by this annotation should be handled by the initial // * server implementation of this class. // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface ServerLogin { // } // // /** // * Methods denoted by this method annotation be handled by a client // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Client { // } // }
import com.md_5.fondue.protocol.PacketHandler; import io.netty.buffer.ByteBuf; import lombok.EqualsAndHashCode; import lombok.ToString;
package com.md_5.fondue.protocol.packet; @ToString @EqualsAndHashCode(callSuper = false) public class Packet35BlockChange extends Packet { private int x; private byte y; private int z; private short type; private byte data; public Packet35BlockChange() { } @Override public void read(ByteBuf in) { x = in.readInt(); y = in.readByte(); z = in.readInt(); type = in.readShort(); data = in.readByte(); } @Override public void write(ByteBuf out) { out.writeInt(x); out.writeByte(y); out.writeInt(z); out.writeShort(type); out.writeByte(data); } @Override
// Path: src/main/java/com/md_5/fondue/protocol/PacketHandler.java // public abstract class PacketHandler { // // /** // * Method to determine whether this is a server handler, client handler or // * other. // * // * @return the type of method interface this handler should accept // */ // public abstract Class<? extends Annotation> getType(); // // @Server // public void handle(Packet0KeepAlive packet) { // } // // @ServerLogin // public void handle(Packet2Handshake packet) { // } // // @Server // public void handle(Packet3ChatMessage packet) { // } // // @Server // public void handle(Packet7UseEntity packet) { // } // // @Server // public void handle(PacketAFlying packet) { // } // // @Server // public void handle(PacketEDig packet) { // } // // @Server // // public void handle(PacketFPlace packet){} // // @Server // public void handle(Packet10HeldItem packet) { // } // // @Server // public void handle(Packet12Animation packet) { // } // // @Server // public void handle(Packet13EntityAction packet) { // } // // @Server // // public void handle(Packet66WindowClick packet){} // // @Server // public void handle(Packet6AConfirmTransaction packet) { // } // // @Server // public void handle(Packet6CEnchantItem packet) { // } // // @Server // public void handle(Packet82UpdateSign packet) { // } // // // @Server // // public void handle(Packet6BSlot); // @Server // public void handle(PacketCAPlayerAbilities packet) { // } // // @Server // public void handle(PacketCBTabComplete packet) { // } // // @Server // public void handle(PacketCCClientInfo packet) { // } // // @Server // @ServerLogin // public void handle(PacketCDClientStatus packet) { // } // // @Server // public void handle(PacketFAPluginMessage packet) { // } // // @ServerLogin // public void handle(PacketFCKeyResponse packet) { // } // // @ServerLogin // public void handle(PacketFEServerPing packet) { // } // // @Server // public void handle(PacketFFDisconnect packet) { // } // // /** // * Methods denoted by this annotation should be handled by a server // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Server { // } // // /** // * Methods denoted by this annotation should be handled by the initial // * server implementation of this class. // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface ServerLogin { // } // // /** // * Methods denoted by this method annotation be handled by a client // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Client { // } // } // Path: src/main/java/com/md_5/fondue/protocol/packet/Packet35BlockChange.java import com.md_5.fondue.protocol.PacketHandler; import io.netty.buffer.ByteBuf; import lombok.EqualsAndHashCode; import lombok.ToString; package com.md_5.fondue.protocol.packet; @ToString @EqualsAndHashCode(callSuper = false) public class Packet35BlockChange extends Packet { private int x; private byte y; private int z; private short type; private byte data; public Packet35BlockChange() { } @Override public void read(ByteBuf in) { x = in.readInt(); y = in.readByte(); z = in.readInt(); type = in.readShort(); data = in.readByte(); } @Override public void write(ByteBuf out) { out.writeInt(x); out.writeByte(y); out.writeInt(z); out.writeShort(type); out.writeByte(data); } @Override
public void handle(PacketHandler handler) {
BukkitDevTeam/Fondue
src/main/java/com/md_5/fondue/protocol/packet/Packet27AttatchEntity.java
// Path: src/main/java/com/md_5/fondue/protocol/PacketHandler.java // public abstract class PacketHandler { // // /** // * Method to determine whether this is a server handler, client handler or // * other. // * // * @return the type of method interface this handler should accept // */ // public abstract Class<? extends Annotation> getType(); // // @Server // public void handle(Packet0KeepAlive packet) { // } // // @ServerLogin // public void handle(Packet2Handshake packet) { // } // // @Server // public void handle(Packet3ChatMessage packet) { // } // // @Server // public void handle(Packet7UseEntity packet) { // } // // @Server // public void handle(PacketAFlying packet) { // } // // @Server // public void handle(PacketEDig packet) { // } // // @Server // // public void handle(PacketFPlace packet){} // // @Server // public void handle(Packet10HeldItem packet) { // } // // @Server // public void handle(Packet12Animation packet) { // } // // @Server // public void handle(Packet13EntityAction packet) { // } // // @Server // // public void handle(Packet66WindowClick packet){} // // @Server // public void handle(Packet6AConfirmTransaction packet) { // } // // @Server // public void handle(Packet6CEnchantItem packet) { // } // // @Server // public void handle(Packet82UpdateSign packet) { // } // // // @Server // // public void handle(Packet6BSlot); // @Server // public void handle(PacketCAPlayerAbilities packet) { // } // // @Server // public void handle(PacketCBTabComplete packet) { // } // // @Server // public void handle(PacketCCClientInfo packet) { // } // // @Server // @ServerLogin // public void handle(PacketCDClientStatus packet) { // } // // @Server // public void handle(PacketFAPluginMessage packet) { // } // // @ServerLogin // public void handle(PacketFCKeyResponse packet) { // } // // @ServerLogin // public void handle(PacketFEServerPing packet) { // } // // @Server // public void handle(PacketFFDisconnect packet) { // } // // /** // * Methods denoted by this annotation should be handled by a server // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Server { // } // // /** // * Methods denoted by this annotation should be handled by the initial // * server implementation of this class. // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface ServerLogin { // } // // /** // * Methods denoted by this method annotation be handled by a client // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Client { // } // }
import com.md_5.fondue.protocol.PacketHandler; import io.netty.buffer.ByteBuf; import lombok.EqualsAndHashCode; import lombok.ToString;
package com.md_5.fondue.protocol.packet; @ToString @EqualsAndHashCode(callSuper = false) public class Packet27AttatchEntity extends Packet1EEntity { private int vehicleId; public Packet27AttatchEntity() { } @Override public void read(ByteBuf in) { super.read(in); vehicleId = in.readInt(); } @Override public void write(ByteBuf out) { super.write(out); out.writeInt(vehicleId); } @Override
// Path: src/main/java/com/md_5/fondue/protocol/PacketHandler.java // public abstract class PacketHandler { // // /** // * Method to determine whether this is a server handler, client handler or // * other. // * // * @return the type of method interface this handler should accept // */ // public abstract Class<? extends Annotation> getType(); // // @Server // public void handle(Packet0KeepAlive packet) { // } // // @ServerLogin // public void handle(Packet2Handshake packet) { // } // // @Server // public void handle(Packet3ChatMessage packet) { // } // // @Server // public void handle(Packet7UseEntity packet) { // } // // @Server // public void handle(PacketAFlying packet) { // } // // @Server // public void handle(PacketEDig packet) { // } // // @Server // // public void handle(PacketFPlace packet){} // // @Server // public void handle(Packet10HeldItem packet) { // } // // @Server // public void handle(Packet12Animation packet) { // } // // @Server // public void handle(Packet13EntityAction packet) { // } // // @Server // // public void handle(Packet66WindowClick packet){} // // @Server // public void handle(Packet6AConfirmTransaction packet) { // } // // @Server // public void handle(Packet6CEnchantItem packet) { // } // // @Server // public void handle(Packet82UpdateSign packet) { // } // // // @Server // // public void handle(Packet6BSlot); // @Server // public void handle(PacketCAPlayerAbilities packet) { // } // // @Server // public void handle(PacketCBTabComplete packet) { // } // // @Server // public void handle(PacketCCClientInfo packet) { // } // // @Server // @ServerLogin // public void handle(PacketCDClientStatus packet) { // } // // @Server // public void handle(PacketFAPluginMessage packet) { // } // // @ServerLogin // public void handle(PacketFCKeyResponse packet) { // } // // @ServerLogin // public void handle(PacketFEServerPing packet) { // } // // @Server // public void handle(PacketFFDisconnect packet) { // } // // /** // * Methods denoted by this annotation should be handled by a server // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Server { // } // // /** // * Methods denoted by this annotation should be handled by the initial // * server implementation of this class. // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface ServerLogin { // } // // /** // * Methods denoted by this method annotation be handled by a client // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Client { // } // } // Path: src/main/java/com/md_5/fondue/protocol/packet/Packet27AttatchEntity.java import com.md_5.fondue.protocol.PacketHandler; import io.netty.buffer.ByteBuf; import lombok.EqualsAndHashCode; import lombok.ToString; package com.md_5.fondue.protocol.packet; @ToString @EqualsAndHashCode(callSuper = false) public class Packet27AttatchEntity extends Packet1EEntity { private int vehicleId; public Packet27AttatchEntity() { } @Override public void read(ByteBuf in) { super.read(in); vehicleId = in.readInt(); } @Override public void write(ByteBuf out) { super.write(out); out.writeInt(vehicleId); } @Override
public void handle(PacketHandler handler) {
BukkitDevTeam/Fondue
src/main/java/com/md_5/fondue/protocol/packet/Packet2BSetExperience.java
// Path: src/main/java/com/md_5/fondue/protocol/PacketHandler.java // public abstract class PacketHandler { // // /** // * Method to determine whether this is a server handler, client handler or // * other. // * // * @return the type of method interface this handler should accept // */ // public abstract Class<? extends Annotation> getType(); // // @Server // public void handle(Packet0KeepAlive packet) { // } // // @ServerLogin // public void handle(Packet2Handshake packet) { // } // // @Server // public void handle(Packet3ChatMessage packet) { // } // // @Server // public void handle(Packet7UseEntity packet) { // } // // @Server // public void handle(PacketAFlying packet) { // } // // @Server // public void handle(PacketEDig packet) { // } // // @Server // // public void handle(PacketFPlace packet){} // // @Server // public void handle(Packet10HeldItem packet) { // } // // @Server // public void handle(Packet12Animation packet) { // } // // @Server // public void handle(Packet13EntityAction packet) { // } // // @Server // // public void handle(Packet66WindowClick packet){} // // @Server // public void handle(Packet6AConfirmTransaction packet) { // } // // @Server // public void handle(Packet6CEnchantItem packet) { // } // // @Server // public void handle(Packet82UpdateSign packet) { // } // // // @Server // // public void handle(Packet6BSlot); // @Server // public void handle(PacketCAPlayerAbilities packet) { // } // // @Server // public void handle(PacketCBTabComplete packet) { // } // // @Server // public void handle(PacketCCClientInfo packet) { // } // // @Server // @ServerLogin // public void handle(PacketCDClientStatus packet) { // } // // @Server // public void handle(PacketFAPluginMessage packet) { // } // // @ServerLogin // public void handle(PacketFCKeyResponse packet) { // } // // @ServerLogin // public void handle(PacketFEServerPing packet) { // } // // @Server // public void handle(PacketFFDisconnect packet) { // } // // /** // * Methods denoted by this annotation should be handled by a server // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Server { // } // // /** // * Methods denoted by this annotation should be handled by the initial // * server implementation of this class. // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface ServerLogin { // } // // /** // * Methods denoted by this method annotation be handled by a client // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Client { // } // }
import com.md_5.fondue.protocol.PacketHandler; import io.netty.buffer.ByteBuf; import lombok.EqualsAndHashCode; import lombok.ToString;
package com.md_5.fondue.protocol.packet; @ToString @EqualsAndHashCode(callSuper = false) public class Packet2BSetExperience extends Packet { private float bar; private short level; private short total; public Packet2BSetExperience() { } @Override public void read(ByteBuf in) { bar = in.readFloat(); level = in.readShort(); total = in.readShort(); } @Override public void write(ByteBuf out) { out.writeFloat(bar); out.writeShort(level); out.writeShort(total); } @Override
// Path: src/main/java/com/md_5/fondue/protocol/PacketHandler.java // public abstract class PacketHandler { // // /** // * Method to determine whether this is a server handler, client handler or // * other. // * // * @return the type of method interface this handler should accept // */ // public abstract Class<? extends Annotation> getType(); // // @Server // public void handle(Packet0KeepAlive packet) { // } // // @ServerLogin // public void handle(Packet2Handshake packet) { // } // // @Server // public void handle(Packet3ChatMessage packet) { // } // // @Server // public void handle(Packet7UseEntity packet) { // } // // @Server // public void handle(PacketAFlying packet) { // } // // @Server // public void handle(PacketEDig packet) { // } // // @Server // // public void handle(PacketFPlace packet){} // // @Server // public void handle(Packet10HeldItem packet) { // } // // @Server // public void handle(Packet12Animation packet) { // } // // @Server // public void handle(Packet13EntityAction packet) { // } // // @Server // // public void handle(Packet66WindowClick packet){} // // @Server // public void handle(Packet6AConfirmTransaction packet) { // } // // @Server // public void handle(Packet6CEnchantItem packet) { // } // // @Server // public void handle(Packet82UpdateSign packet) { // } // // // @Server // // public void handle(Packet6BSlot); // @Server // public void handle(PacketCAPlayerAbilities packet) { // } // // @Server // public void handle(PacketCBTabComplete packet) { // } // // @Server // public void handle(PacketCCClientInfo packet) { // } // // @Server // @ServerLogin // public void handle(PacketCDClientStatus packet) { // } // // @Server // public void handle(PacketFAPluginMessage packet) { // } // // @ServerLogin // public void handle(PacketFCKeyResponse packet) { // } // // @ServerLogin // public void handle(PacketFEServerPing packet) { // } // // @Server // public void handle(PacketFFDisconnect packet) { // } // // /** // * Methods denoted by this annotation should be handled by a server // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Server { // } // // /** // * Methods denoted by this annotation should be handled by the initial // * server implementation of this class. // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface ServerLogin { // } // // /** // * Methods denoted by this method annotation be handled by a client // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Client { // } // } // Path: src/main/java/com/md_5/fondue/protocol/packet/Packet2BSetExperience.java import com.md_5.fondue.protocol.PacketHandler; import io.netty.buffer.ByteBuf; import lombok.EqualsAndHashCode; import lombok.ToString; package com.md_5.fondue.protocol.packet; @ToString @EqualsAndHashCode(callSuper = false) public class Packet2BSetExperience extends Packet { private float bar; private short level; private short total; public Packet2BSetExperience() { } @Override public void read(ByteBuf in) { bar = in.readFloat(); level = in.readShort(); total = in.readShort(); } @Override public void write(ByteBuf out) { out.writeFloat(bar); out.writeShort(level); out.writeShort(total); } @Override
public void handle(PacketHandler handler) {
BukkitDevTeam/Fondue
src/main/java/com/md_5/fondue/protocol/packet/Packet46GameState.java
// Path: src/main/java/com/md_5/fondue/protocol/PacketHandler.java // public abstract class PacketHandler { // // /** // * Method to determine whether this is a server handler, client handler or // * other. // * // * @return the type of method interface this handler should accept // */ // public abstract Class<? extends Annotation> getType(); // // @Server // public void handle(Packet0KeepAlive packet) { // } // // @ServerLogin // public void handle(Packet2Handshake packet) { // } // // @Server // public void handle(Packet3ChatMessage packet) { // } // // @Server // public void handle(Packet7UseEntity packet) { // } // // @Server // public void handle(PacketAFlying packet) { // } // // @Server // public void handle(PacketEDig packet) { // } // // @Server // // public void handle(PacketFPlace packet){} // // @Server // public void handle(Packet10HeldItem packet) { // } // // @Server // public void handle(Packet12Animation packet) { // } // // @Server // public void handle(Packet13EntityAction packet) { // } // // @Server // // public void handle(Packet66WindowClick packet){} // // @Server // public void handle(Packet6AConfirmTransaction packet) { // } // // @Server // public void handle(Packet6CEnchantItem packet) { // } // // @Server // public void handle(Packet82UpdateSign packet) { // } // // // @Server // // public void handle(Packet6BSlot); // @Server // public void handle(PacketCAPlayerAbilities packet) { // } // // @Server // public void handle(PacketCBTabComplete packet) { // } // // @Server // public void handle(PacketCCClientInfo packet) { // } // // @Server // @ServerLogin // public void handle(PacketCDClientStatus packet) { // } // // @Server // public void handle(PacketFAPluginMessage packet) { // } // // @ServerLogin // public void handle(PacketFCKeyResponse packet) { // } // // @ServerLogin // public void handle(PacketFEServerPing packet) { // } // // @Server // public void handle(PacketFFDisconnect packet) { // } // // /** // * Methods denoted by this annotation should be handled by a server // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Server { // } // // /** // * Methods denoted by this annotation should be handled by the initial // * server implementation of this class. // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface ServerLogin { // } // // /** // * Methods denoted by this method annotation be handled by a client // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Client { // } // }
import com.md_5.fondue.protocol.PacketHandler; import io.netty.buffer.ByteBuf; import lombok.EqualsAndHashCode; import lombok.ToString;
package com.md_5.fondue.protocol.packet; @ToString @EqualsAndHashCode(callSuper = false) public class Packet46GameState extends Packet { private byte reason; private byte gameMode; public Packet46GameState() { } @Override public void read(ByteBuf in) { reason = in.readByte(); gameMode = in.readByte(); } @Override public void write(ByteBuf out) { out.writeByte(reason); out.writeByte(gameMode); } @Override
// Path: src/main/java/com/md_5/fondue/protocol/PacketHandler.java // public abstract class PacketHandler { // // /** // * Method to determine whether this is a server handler, client handler or // * other. // * // * @return the type of method interface this handler should accept // */ // public abstract Class<? extends Annotation> getType(); // // @Server // public void handle(Packet0KeepAlive packet) { // } // // @ServerLogin // public void handle(Packet2Handshake packet) { // } // // @Server // public void handle(Packet3ChatMessage packet) { // } // // @Server // public void handle(Packet7UseEntity packet) { // } // // @Server // public void handle(PacketAFlying packet) { // } // // @Server // public void handle(PacketEDig packet) { // } // // @Server // // public void handle(PacketFPlace packet){} // // @Server // public void handle(Packet10HeldItem packet) { // } // // @Server // public void handle(Packet12Animation packet) { // } // // @Server // public void handle(Packet13EntityAction packet) { // } // // @Server // // public void handle(Packet66WindowClick packet){} // // @Server // public void handle(Packet6AConfirmTransaction packet) { // } // // @Server // public void handle(Packet6CEnchantItem packet) { // } // // @Server // public void handle(Packet82UpdateSign packet) { // } // // // @Server // // public void handle(Packet6BSlot); // @Server // public void handle(PacketCAPlayerAbilities packet) { // } // // @Server // public void handle(PacketCBTabComplete packet) { // } // // @Server // public void handle(PacketCCClientInfo packet) { // } // // @Server // @ServerLogin // public void handle(PacketCDClientStatus packet) { // } // // @Server // public void handle(PacketFAPluginMessage packet) { // } // // @ServerLogin // public void handle(PacketFCKeyResponse packet) { // } // // @ServerLogin // public void handle(PacketFEServerPing packet) { // } // // @Server // public void handle(PacketFFDisconnect packet) { // } // // /** // * Methods denoted by this annotation should be handled by a server // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Server { // } // // /** // * Methods denoted by this annotation should be handled by the initial // * server implementation of this class. // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface ServerLogin { // } // // /** // * Methods denoted by this method annotation be handled by a client // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Client { // } // } // Path: src/main/java/com/md_5/fondue/protocol/packet/Packet46GameState.java import com.md_5.fondue.protocol.PacketHandler; import io.netty.buffer.ByteBuf; import lombok.EqualsAndHashCode; import lombok.ToString; package com.md_5.fondue.protocol.packet; @ToString @EqualsAndHashCode(callSuper = false) public class Packet46GameState extends Packet { private byte reason; private byte gameMode; public Packet46GameState() { } @Override public void read(ByteBuf in) { reason = in.readByte(); gameMode = in.readByte(); } @Override public void write(ByteBuf out) { out.writeByte(reason); out.writeByte(gameMode); } @Override
public void handle(PacketHandler handler) {
BukkitDevTeam/Fondue
src/main/java/com/md_5/fondue/protocol/packet/Packet1ASpawnExperience.java
// Path: src/main/java/com/md_5/fondue/protocol/PacketHandler.java // public abstract class PacketHandler { // // /** // * Method to determine whether this is a server handler, client handler or // * other. // * // * @return the type of method interface this handler should accept // */ // public abstract Class<? extends Annotation> getType(); // // @Server // public void handle(Packet0KeepAlive packet) { // } // // @ServerLogin // public void handle(Packet2Handshake packet) { // } // // @Server // public void handle(Packet3ChatMessage packet) { // } // // @Server // public void handle(Packet7UseEntity packet) { // } // // @Server // public void handle(PacketAFlying packet) { // } // // @Server // public void handle(PacketEDig packet) { // } // // @Server // // public void handle(PacketFPlace packet){} // // @Server // public void handle(Packet10HeldItem packet) { // } // // @Server // public void handle(Packet12Animation packet) { // } // // @Server // public void handle(Packet13EntityAction packet) { // } // // @Server // // public void handle(Packet66WindowClick packet){} // // @Server // public void handle(Packet6AConfirmTransaction packet) { // } // // @Server // public void handle(Packet6CEnchantItem packet) { // } // // @Server // public void handle(Packet82UpdateSign packet) { // } // // // @Server // // public void handle(Packet6BSlot); // @Server // public void handle(PacketCAPlayerAbilities packet) { // } // // @Server // public void handle(PacketCBTabComplete packet) { // } // // @Server // public void handle(PacketCCClientInfo packet) { // } // // @Server // @ServerLogin // public void handle(PacketCDClientStatus packet) { // } // // @Server // public void handle(PacketFAPluginMessage packet) { // } // // @ServerLogin // public void handle(PacketFCKeyResponse packet) { // } // // @ServerLogin // public void handle(PacketFEServerPing packet) { // } // // @Server // public void handle(PacketFFDisconnect packet) { // } // // /** // * Methods denoted by this annotation should be handled by a server // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Server { // } // // /** // * Methods denoted by this annotation should be handled by the initial // * server implementation of this class. // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface ServerLogin { // } // // /** // * Methods denoted by this method annotation be handled by a client // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Client { // } // }
import com.md_5.fondue.protocol.PacketHandler; import io.netty.buffer.ByteBuf; import lombok.EqualsAndHashCode; import lombok.ToString;
package com.md_5.fondue.protocol.packet; @ToString @EqualsAndHashCode(callSuper = false) public class Packet1ASpawnExperience extends Packet1EEntity { private int x; private int y; private int z; private short amount; public Packet1ASpawnExperience() { } @Override public void read(ByteBuf in) { super.read(in); x = in.readInt(); y = in.readInt(); z = in.readInt(); amount = in.readShort(); } @Override public void write(ByteBuf out) { super.write(out); out.writeInt(x); out.writeInt(y); out.writeInt(z); out.writeShort(amount); } @Override
// Path: src/main/java/com/md_5/fondue/protocol/PacketHandler.java // public abstract class PacketHandler { // // /** // * Method to determine whether this is a server handler, client handler or // * other. // * // * @return the type of method interface this handler should accept // */ // public abstract Class<? extends Annotation> getType(); // // @Server // public void handle(Packet0KeepAlive packet) { // } // // @ServerLogin // public void handle(Packet2Handshake packet) { // } // // @Server // public void handle(Packet3ChatMessage packet) { // } // // @Server // public void handle(Packet7UseEntity packet) { // } // // @Server // public void handle(PacketAFlying packet) { // } // // @Server // public void handle(PacketEDig packet) { // } // // @Server // // public void handle(PacketFPlace packet){} // // @Server // public void handle(Packet10HeldItem packet) { // } // // @Server // public void handle(Packet12Animation packet) { // } // // @Server // public void handle(Packet13EntityAction packet) { // } // // @Server // // public void handle(Packet66WindowClick packet){} // // @Server // public void handle(Packet6AConfirmTransaction packet) { // } // // @Server // public void handle(Packet6CEnchantItem packet) { // } // // @Server // public void handle(Packet82UpdateSign packet) { // } // // // @Server // // public void handle(Packet6BSlot); // @Server // public void handle(PacketCAPlayerAbilities packet) { // } // // @Server // public void handle(PacketCBTabComplete packet) { // } // // @Server // public void handle(PacketCCClientInfo packet) { // } // // @Server // @ServerLogin // public void handle(PacketCDClientStatus packet) { // } // // @Server // public void handle(PacketFAPluginMessage packet) { // } // // @ServerLogin // public void handle(PacketFCKeyResponse packet) { // } // // @ServerLogin // public void handle(PacketFEServerPing packet) { // } // // @Server // public void handle(PacketFFDisconnect packet) { // } // // /** // * Methods denoted by this annotation should be handled by a server // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Server { // } // // /** // * Methods denoted by this annotation should be handled by the initial // * server implementation of this class. // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface ServerLogin { // } // // /** // * Methods denoted by this method annotation be handled by a client // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Client { // } // } // Path: src/main/java/com/md_5/fondue/protocol/packet/Packet1ASpawnExperience.java import com.md_5.fondue.protocol.PacketHandler; import io.netty.buffer.ByteBuf; import lombok.EqualsAndHashCode; import lombok.ToString; package com.md_5.fondue.protocol.packet; @ToString @EqualsAndHashCode(callSuper = false) public class Packet1ASpawnExperience extends Packet1EEntity { private int x; private int y; private int z; private short amount; public Packet1ASpawnExperience() { } @Override public void read(ByteBuf in) { super.read(in); x = in.readInt(); y = in.readInt(); z = in.readInt(); amount = in.readShort(); } @Override public void write(ByteBuf out) { super.write(out); out.writeInt(x); out.writeInt(y); out.writeInt(z); out.writeShort(amount); } @Override
public void handle(PacketHandler handler) {
BukkitDevTeam/Fondue
src/main/java/com/md_5/fondue/protocol/packet/Packet7UseEntity.java
// Path: src/main/java/com/md_5/fondue/protocol/PacketHandler.java // public abstract class PacketHandler { // // /** // * Method to determine whether this is a server handler, client handler or // * other. // * // * @return the type of method interface this handler should accept // */ // public abstract Class<? extends Annotation> getType(); // // @Server // public void handle(Packet0KeepAlive packet) { // } // // @ServerLogin // public void handle(Packet2Handshake packet) { // } // // @Server // public void handle(Packet3ChatMessage packet) { // } // // @Server // public void handle(Packet7UseEntity packet) { // } // // @Server // public void handle(PacketAFlying packet) { // } // // @Server // public void handle(PacketEDig packet) { // } // // @Server // // public void handle(PacketFPlace packet){} // // @Server // public void handle(Packet10HeldItem packet) { // } // // @Server // public void handle(Packet12Animation packet) { // } // // @Server // public void handle(Packet13EntityAction packet) { // } // // @Server // // public void handle(Packet66WindowClick packet){} // // @Server // public void handle(Packet6AConfirmTransaction packet) { // } // // @Server // public void handle(Packet6CEnchantItem packet) { // } // // @Server // public void handle(Packet82UpdateSign packet) { // } // // // @Server // // public void handle(Packet6BSlot); // @Server // public void handle(PacketCAPlayerAbilities packet) { // } // // @Server // public void handle(PacketCBTabComplete packet) { // } // // @Server // public void handle(PacketCCClientInfo packet) { // } // // @Server // @ServerLogin // public void handle(PacketCDClientStatus packet) { // } // // @Server // public void handle(PacketFAPluginMessage packet) { // } // // @ServerLogin // public void handle(PacketFCKeyResponse packet) { // } // // @ServerLogin // public void handle(PacketFEServerPing packet) { // } // // @Server // public void handle(PacketFFDisconnect packet) { // } // // /** // * Methods denoted by this annotation should be handled by a server // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Server { // } // // /** // * Methods denoted by this annotation should be handled by the initial // * server implementation of this class. // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface ServerLogin { // } // // /** // * Methods denoted by this method annotation be handled by a client // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Client { // } // }
import com.md_5.fondue.protocol.PacketHandler; import io.netty.buffer.ByteBuf; import lombok.EqualsAndHashCode; import lombok.ToString;
package com.md_5.fondue.protocol.packet; @ToString @EqualsAndHashCode(callSuper = false) public class Packet7UseEntity extends Packet { private int user; private int target; private boolean mouse; public Packet7UseEntity() { } @Override public void read(ByteBuf in) { user = in.readInt(); target = in.readInt(); mouse = in.readBoolean(); } @Override public void write(ByteBuf out) { out.writeInt(user); out.writeInt(target); out.writeBoolean(mouse); } @Override
// Path: src/main/java/com/md_5/fondue/protocol/PacketHandler.java // public abstract class PacketHandler { // // /** // * Method to determine whether this is a server handler, client handler or // * other. // * // * @return the type of method interface this handler should accept // */ // public abstract Class<? extends Annotation> getType(); // // @Server // public void handle(Packet0KeepAlive packet) { // } // // @ServerLogin // public void handle(Packet2Handshake packet) { // } // // @Server // public void handle(Packet3ChatMessage packet) { // } // // @Server // public void handle(Packet7UseEntity packet) { // } // // @Server // public void handle(PacketAFlying packet) { // } // // @Server // public void handle(PacketEDig packet) { // } // // @Server // // public void handle(PacketFPlace packet){} // // @Server // public void handle(Packet10HeldItem packet) { // } // // @Server // public void handle(Packet12Animation packet) { // } // // @Server // public void handle(Packet13EntityAction packet) { // } // // @Server // // public void handle(Packet66WindowClick packet){} // // @Server // public void handle(Packet6AConfirmTransaction packet) { // } // // @Server // public void handle(Packet6CEnchantItem packet) { // } // // @Server // public void handle(Packet82UpdateSign packet) { // } // // // @Server // // public void handle(Packet6BSlot); // @Server // public void handle(PacketCAPlayerAbilities packet) { // } // // @Server // public void handle(PacketCBTabComplete packet) { // } // // @Server // public void handle(PacketCCClientInfo packet) { // } // // @Server // @ServerLogin // public void handle(PacketCDClientStatus packet) { // } // // @Server // public void handle(PacketFAPluginMessage packet) { // } // // @ServerLogin // public void handle(PacketFCKeyResponse packet) { // } // // @ServerLogin // public void handle(PacketFEServerPing packet) { // } // // @Server // public void handle(PacketFFDisconnect packet) { // } // // /** // * Methods denoted by this annotation should be handled by a server // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Server { // } // // /** // * Methods denoted by this annotation should be handled by the initial // * server implementation of this class. // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface ServerLogin { // } // // /** // * Methods denoted by this method annotation be handled by a client // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Client { // } // } // Path: src/main/java/com/md_5/fondue/protocol/packet/Packet7UseEntity.java import com.md_5.fondue.protocol.PacketHandler; import io.netty.buffer.ByteBuf; import lombok.EqualsAndHashCode; import lombok.ToString; package com.md_5.fondue.protocol.packet; @ToString @EqualsAndHashCode(callSuper = false) public class Packet7UseEntity extends Packet { private int user; private int target; private boolean mouse; public Packet7UseEntity() { } @Override public void read(ByteBuf in) { user = in.readInt(); target = in.readInt(); mouse = in.readBoolean(); } @Override public void write(ByteBuf out) { out.writeInt(user); out.writeInt(target); out.writeBoolean(mouse); } @Override
public void handle(PacketHandler handler) {
BukkitDevTeam/Fondue
src/main/java/com/md_5/fondue/protocol/packet/Packet.java
// Path: src/main/java/com/md_5/fondue/protocol/PacketHandler.java // public abstract class PacketHandler { // // /** // * Method to determine whether this is a server handler, client handler or // * other. // * // * @return the type of method interface this handler should accept // */ // public abstract Class<? extends Annotation> getType(); // // @Server // public void handle(Packet0KeepAlive packet) { // } // // @ServerLogin // public void handle(Packet2Handshake packet) { // } // // @Server // public void handle(Packet3ChatMessage packet) { // } // // @Server // public void handle(Packet7UseEntity packet) { // } // // @Server // public void handle(PacketAFlying packet) { // } // // @Server // public void handle(PacketEDig packet) { // } // // @Server // // public void handle(PacketFPlace packet){} // // @Server // public void handle(Packet10HeldItem packet) { // } // // @Server // public void handle(Packet12Animation packet) { // } // // @Server // public void handle(Packet13EntityAction packet) { // } // // @Server // // public void handle(Packet66WindowClick packet){} // // @Server // public void handle(Packet6AConfirmTransaction packet) { // } // // @Server // public void handle(Packet6CEnchantItem packet) { // } // // @Server // public void handle(Packet82UpdateSign packet) { // } // // // @Server // // public void handle(Packet6BSlot); // @Server // public void handle(PacketCAPlayerAbilities packet) { // } // // @Server // public void handle(PacketCBTabComplete packet) { // } // // @Server // public void handle(PacketCCClientInfo packet) { // } // // @Server // @ServerLogin // public void handle(PacketCDClientStatus packet) { // } // // @Server // public void handle(PacketFAPluginMessage packet) { // } // // @ServerLogin // public void handle(PacketFCKeyResponse packet) { // } // // @ServerLogin // public void handle(PacketFEServerPing packet) { // } // // @Server // public void handle(PacketFFDisconnect packet) { // } // // /** // * Methods denoted by this annotation should be handled by a server // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Server { // } // // /** // * Methods denoted by this annotation should be handled by the initial // * server implementation of this class. // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface ServerLogin { // } // // /** // * Methods denoted by this method annotation be handled by a client // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Client { // } // }
import com.md_5.fondue.protocol.PacketHandler; import gnu.trove.map.hash.TObjectIntHashMap; import io.netty.buffer.ByteBuf; import org.apache.commons.lang3.Validate;
package com.md_5.fondue.protocol.packet; public abstract class Packet { private static final Class[] byId = new Class[256]; private static final TObjectIntHashMap<Class<? extends Packet>> byClass = new TObjectIntHashMap<Class<? extends Packet>>(); private int id = -1; /** * Adds a new packet class to the known packet collections * * @param id of the packet to add * @param clazz of the packet */ private static void addMapping(int id, Class<? extends Packet> clazz) { Validate.isTrue(byId[id] == null, "Packet with id 0x" + Integer.toHexString(id) + " already registered"); Validate.isTrue(!byClass.containsKey(clazz), "Class " + clazz.getName() + " already registered"); byId[id] = clazz; byClass.put(clazz, id); } /** * Constructs a new, empty packet based on the supplied id. * * @param id of the packet to construct * @return the constructed packet or null if unable to construct one */ public static Packet newInstance(int id) { try { Class clazz = byId[id]; return clazz == null ? null : (Packet) clazz.getDeclaredConstructor().newInstance(); } catch (Exception ex) { ex.printStackTrace(); System.err.println("Skipping packet with id 0x" + Integer.toHexString(id)); return null; } } /** * @return this packet's id */ public final int getId() { return (id == -1) ? id = byClass.get(id) : id; } /** * Populates the fields in this packet by reading them from the specified * {@link ByteBuf} * * @param in the ByteBuf to read from */ public abstract void read(ByteBuf in); /** * Writes the fields in this packet to the specified {@link ByteBuf}. * * @param out the ByteBuf to write into */ public abstract void write(ByteBuf out); /** * Handle this method with a given handler. This is a must for performance * reasons. * * @param handler the handler to handle this packet */
// Path: src/main/java/com/md_5/fondue/protocol/PacketHandler.java // public abstract class PacketHandler { // // /** // * Method to determine whether this is a server handler, client handler or // * other. // * // * @return the type of method interface this handler should accept // */ // public abstract Class<? extends Annotation> getType(); // // @Server // public void handle(Packet0KeepAlive packet) { // } // // @ServerLogin // public void handle(Packet2Handshake packet) { // } // // @Server // public void handle(Packet3ChatMessage packet) { // } // // @Server // public void handle(Packet7UseEntity packet) { // } // // @Server // public void handle(PacketAFlying packet) { // } // // @Server // public void handle(PacketEDig packet) { // } // // @Server // // public void handle(PacketFPlace packet){} // // @Server // public void handle(Packet10HeldItem packet) { // } // // @Server // public void handle(Packet12Animation packet) { // } // // @Server // public void handle(Packet13EntityAction packet) { // } // // @Server // // public void handle(Packet66WindowClick packet){} // // @Server // public void handle(Packet6AConfirmTransaction packet) { // } // // @Server // public void handle(Packet6CEnchantItem packet) { // } // // @Server // public void handle(Packet82UpdateSign packet) { // } // // // @Server // // public void handle(Packet6BSlot); // @Server // public void handle(PacketCAPlayerAbilities packet) { // } // // @Server // public void handle(PacketCBTabComplete packet) { // } // // @Server // public void handle(PacketCCClientInfo packet) { // } // // @Server // @ServerLogin // public void handle(PacketCDClientStatus packet) { // } // // @Server // public void handle(PacketFAPluginMessage packet) { // } // // @ServerLogin // public void handle(PacketFCKeyResponse packet) { // } // // @ServerLogin // public void handle(PacketFEServerPing packet) { // } // // @Server // public void handle(PacketFFDisconnect packet) { // } // // /** // * Methods denoted by this annotation should be handled by a server // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Server { // } // // /** // * Methods denoted by this annotation should be handled by the initial // * server implementation of this class. // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface ServerLogin { // } // // /** // * Methods denoted by this method annotation be handled by a client // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Client { // } // } // Path: src/main/java/com/md_5/fondue/protocol/packet/Packet.java import com.md_5.fondue.protocol.PacketHandler; import gnu.trove.map.hash.TObjectIntHashMap; import io.netty.buffer.ByteBuf; import org.apache.commons.lang3.Validate; package com.md_5.fondue.protocol.packet; public abstract class Packet { private static final Class[] byId = new Class[256]; private static final TObjectIntHashMap<Class<? extends Packet>> byClass = new TObjectIntHashMap<Class<? extends Packet>>(); private int id = -1; /** * Adds a new packet class to the known packet collections * * @param id of the packet to add * @param clazz of the packet */ private static void addMapping(int id, Class<? extends Packet> clazz) { Validate.isTrue(byId[id] == null, "Packet with id 0x" + Integer.toHexString(id) + " already registered"); Validate.isTrue(!byClass.containsKey(clazz), "Class " + clazz.getName() + " already registered"); byId[id] = clazz; byClass.put(clazz, id); } /** * Constructs a new, empty packet based on the supplied id. * * @param id of the packet to construct * @return the constructed packet or null if unable to construct one */ public static Packet newInstance(int id) { try { Class clazz = byId[id]; return clazz == null ? null : (Packet) clazz.getDeclaredConstructor().newInstance(); } catch (Exception ex) { ex.printStackTrace(); System.err.println("Skipping packet with id 0x" + Integer.toHexString(id)); return null; } } /** * @return this packet's id */ public final int getId() { return (id == -1) ? id = byClass.get(id) : id; } /** * Populates the fields in this packet by reading them from the specified * {@link ByteBuf} * * @param in the ByteBuf to read from */ public abstract void read(ByteBuf in); /** * Writes the fields in this packet to the specified {@link ByteBuf}. * * @param out the ByteBuf to write into */ public abstract void write(ByteBuf out); /** * Handle this method with a given handler. This is a must for performance * reasons. * * @param handler the handler to handle this packet */
public abstract void handle(PacketHandler handler);
BukkitDevTeam/Fondue
src/main/java/com/md_5/fondue/protocol/packet/PacketEDig.java
// Path: src/main/java/com/md_5/fondue/protocol/PacketHandler.java // public abstract class PacketHandler { // // /** // * Method to determine whether this is a server handler, client handler or // * other. // * // * @return the type of method interface this handler should accept // */ // public abstract Class<? extends Annotation> getType(); // // @Server // public void handle(Packet0KeepAlive packet) { // } // // @ServerLogin // public void handle(Packet2Handshake packet) { // } // // @Server // public void handle(Packet3ChatMessage packet) { // } // // @Server // public void handle(Packet7UseEntity packet) { // } // // @Server // public void handle(PacketAFlying packet) { // } // // @Server // public void handle(PacketEDig packet) { // } // // @Server // // public void handle(PacketFPlace packet){} // // @Server // public void handle(Packet10HeldItem packet) { // } // // @Server // public void handle(Packet12Animation packet) { // } // // @Server // public void handle(Packet13EntityAction packet) { // } // // @Server // // public void handle(Packet66WindowClick packet){} // // @Server // public void handle(Packet6AConfirmTransaction packet) { // } // // @Server // public void handle(Packet6CEnchantItem packet) { // } // // @Server // public void handle(Packet82UpdateSign packet) { // } // // // @Server // // public void handle(Packet6BSlot); // @Server // public void handle(PacketCAPlayerAbilities packet) { // } // // @Server // public void handle(PacketCBTabComplete packet) { // } // // @Server // public void handle(PacketCCClientInfo packet) { // } // // @Server // @ServerLogin // public void handle(PacketCDClientStatus packet) { // } // // @Server // public void handle(PacketFAPluginMessage packet) { // } // // @ServerLogin // public void handle(PacketFCKeyResponse packet) { // } // // @ServerLogin // public void handle(PacketFEServerPing packet) { // } // // @Server // public void handle(PacketFFDisconnect packet) { // } // // /** // * Methods denoted by this annotation should be handled by a server // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Server { // } // // /** // * Methods denoted by this annotation should be handled by the initial // * server implementation of this class. // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface ServerLogin { // } // // /** // * Methods denoted by this method annotation be handled by a client // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Client { // } // }
import com.md_5.fondue.protocol.PacketHandler; import io.netty.buffer.ByteBuf; import lombok.EqualsAndHashCode; import lombok.ToString;
package com.md_5.fondue.protocol.packet; @ToString @EqualsAndHashCode(callSuper = false) public class PacketEDig extends Packet { private byte status; private int x; private byte y; private int z; private byte face; public PacketEDig() { } @Override public void read(ByteBuf in) { status = in.readByte(); x = in.readInt(); y = in.readByte(); z = in.readInt(); face = in.readByte(); } @Override public void write(ByteBuf out) { out.writeByte(status); out.writeInt(x); out.writeByte(y); out.writeInt(z); out.writeByte(face); } @Override
// Path: src/main/java/com/md_5/fondue/protocol/PacketHandler.java // public abstract class PacketHandler { // // /** // * Method to determine whether this is a server handler, client handler or // * other. // * // * @return the type of method interface this handler should accept // */ // public abstract Class<? extends Annotation> getType(); // // @Server // public void handle(Packet0KeepAlive packet) { // } // // @ServerLogin // public void handle(Packet2Handshake packet) { // } // // @Server // public void handle(Packet3ChatMessage packet) { // } // // @Server // public void handle(Packet7UseEntity packet) { // } // // @Server // public void handle(PacketAFlying packet) { // } // // @Server // public void handle(PacketEDig packet) { // } // // @Server // // public void handle(PacketFPlace packet){} // // @Server // public void handle(Packet10HeldItem packet) { // } // // @Server // public void handle(Packet12Animation packet) { // } // // @Server // public void handle(Packet13EntityAction packet) { // } // // @Server // // public void handle(Packet66WindowClick packet){} // // @Server // public void handle(Packet6AConfirmTransaction packet) { // } // // @Server // public void handle(Packet6CEnchantItem packet) { // } // // @Server // public void handle(Packet82UpdateSign packet) { // } // // // @Server // // public void handle(Packet6BSlot); // @Server // public void handle(PacketCAPlayerAbilities packet) { // } // // @Server // public void handle(PacketCBTabComplete packet) { // } // // @Server // public void handle(PacketCCClientInfo packet) { // } // // @Server // @ServerLogin // public void handle(PacketCDClientStatus packet) { // } // // @Server // public void handle(PacketFAPluginMessage packet) { // } // // @ServerLogin // public void handle(PacketFCKeyResponse packet) { // } // // @ServerLogin // public void handle(PacketFEServerPing packet) { // } // // @Server // public void handle(PacketFFDisconnect packet) { // } // // /** // * Methods denoted by this annotation should be handled by a server // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Server { // } // // /** // * Methods denoted by this annotation should be handled by the initial // * server implementation of this class. // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface ServerLogin { // } // // /** // * Methods denoted by this method annotation be handled by a client // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Client { // } // } // Path: src/main/java/com/md_5/fondue/protocol/packet/PacketEDig.java import com.md_5.fondue.protocol.PacketHandler; import io.netty.buffer.ByteBuf; import lombok.EqualsAndHashCode; import lombok.ToString; package com.md_5.fondue.protocol.packet; @ToString @EqualsAndHashCode(callSuper = false) public class PacketEDig extends Packet { private byte status; private int x; private byte y; private int z; private byte face; public PacketEDig() { } @Override public void read(ByteBuf in) { status = in.readByte(); x = in.readInt(); y = in.readByte(); z = in.readInt(); face = in.readByte(); } @Override public void write(ByteBuf out) { out.writeByte(status); out.writeInt(x); out.writeByte(y); out.writeInt(z); out.writeByte(face); } @Override
public void handle(PacketHandler handler) {
BukkitDevTeam/Fondue
src/main/java/com/md_5/fondue/protocol/packet/Packet47Thunderbolt.java
// Path: src/main/java/com/md_5/fondue/protocol/PacketHandler.java // public abstract class PacketHandler { // // /** // * Method to determine whether this is a server handler, client handler or // * other. // * // * @return the type of method interface this handler should accept // */ // public abstract Class<? extends Annotation> getType(); // // @Server // public void handle(Packet0KeepAlive packet) { // } // // @ServerLogin // public void handle(Packet2Handshake packet) { // } // // @Server // public void handle(Packet3ChatMessage packet) { // } // // @Server // public void handle(Packet7UseEntity packet) { // } // // @Server // public void handle(PacketAFlying packet) { // } // // @Server // public void handle(PacketEDig packet) { // } // // @Server // // public void handle(PacketFPlace packet){} // // @Server // public void handle(Packet10HeldItem packet) { // } // // @Server // public void handle(Packet12Animation packet) { // } // // @Server // public void handle(Packet13EntityAction packet) { // } // // @Server // // public void handle(Packet66WindowClick packet){} // // @Server // public void handle(Packet6AConfirmTransaction packet) { // } // // @Server // public void handle(Packet6CEnchantItem packet) { // } // // @Server // public void handle(Packet82UpdateSign packet) { // } // // // @Server // // public void handle(Packet6BSlot); // @Server // public void handle(PacketCAPlayerAbilities packet) { // } // // @Server // public void handle(PacketCBTabComplete packet) { // } // // @Server // public void handle(PacketCCClientInfo packet) { // } // // @Server // @ServerLogin // public void handle(PacketCDClientStatus packet) { // } // // @Server // public void handle(PacketFAPluginMessage packet) { // } // // @ServerLogin // public void handle(PacketFCKeyResponse packet) { // } // // @ServerLogin // public void handle(PacketFEServerPing packet) { // } // // @Server // public void handle(PacketFFDisconnect packet) { // } // // /** // * Methods denoted by this annotation should be handled by a server // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Server { // } // // /** // * Methods denoted by this annotation should be handled by the initial // * server implementation of this class. // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface ServerLogin { // } // // /** // * Methods denoted by this method annotation be handled by a client // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Client { // } // }
import com.md_5.fondue.protocol.PacketHandler; import io.netty.buffer.ByteBuf; import lombok.EqualsAndHashCode; import lombok.ToString;
package com.md_5.fondue.protocol.packet; @ToString @EqualsAndHashCode(callSuper = false) public class Packet47Thunderbolt extends Packet1EEntity { private boolean unknown; private int x; private int y; private int z; public Packet47Thunderbolt() { } @Override public void read(ByteBuf in) { super.read(in); unknown = in.readBoolean(); x = in.readInt(); y = in.readInt(); z = in.readInt(); } @Override public void write(ByteBuf out) { super.write(out); out.writeBoolean(unknown); out.writeInt(x); out.writeInt(y); out.writeInt(z); } @Override
// Path: src/main/java/com/md_5/fondue/protocol/PacketHandler.java // public abstract class PacketHandler { // // /** // * Method to determine whether this is a server handler, client handler or // * other. // * // * @return the type of method interface this handler should accept // */ // public abstract Class<? extends Annotation> getType(); // // @Server // public void handle(Packet0KeepAlive packet) { // } // // @ServerLogin // public void handle(Packet2Handshake packet) { // } // // @Server // public void handle(Packet3ChatMessage packet) { // } // // @Server // public void handle(Packet7UseEntity packet) { // } // // @Server // public void handle(PacketAFlying packet) { // } // // @Server // public void handle(PacketEDig packet) { // } // // @Server // // public void handle(PacketFPlace packet){} // // @Server // public void handle(Packet10HeldItem packet) { // } // // @Server // public void handle(Packet12Animation packet) { // } // // @Server // public void handle(Packet13EntityAction packet) { // } // // @Server // // public void handle(Packet66WindowClick packet){} // // @Server // public void handle(Packet6AConfirmTransaction packet) { // } // // @Server // public void handle(Packet6CEnchantItem packet) { // } // // @Server // public void handle(Packet82UpdateSign packet) { // } // // // @Server // // public void handle(Packet6BSlot); // @Server // public void handle(PacketCAPlayerAbilities packet) { // } // // @Server // public void handle(PacketCBTabComplete packet) { // } // // @Server // public void handle(PacketCCClientInfo packet) { // } // // @Server // @ServerLogin // public void handle(PacketCDClientStatus packet) { // } // // @Server // public void handle(PacketFAPluginMessage packet) { // } // // @ServerLogin // public void handle(PacketFCKeyResponse packet) { // } // // @ServerLogin // public void handle(PacketFEServerPing packet) { // } // // @Server // public void handle(PacketFFDisconnect packet) { // } // // /** // * Methods denoted by this annotation should be handled by a server // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Server { // } // // /** // * Methods denoted by this annotation should be handled by the initial // * server implementation of this class. // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface ServerLogin { // } // // /** // * Methods denoted by this method annotation be handled by a client // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Client { // } // } // Path: src/main/java/com/md_5/fondue/protocol/packet/Packet47Thunderbolt.java import com.md_5.fondue.protocol.PacketHandler; import io.netty.buffer.ByteBuf; import lombok.EqualsAndHashCode; import lombok.ToString; package com.md_5.fondue.protocol.packet; @ToString @EqualsAndHashCode(callSuper = false) public class Packet47Thunderbolt extends Packet1EEntity { private boolean unknown; private int x; private int y; private int z; public Packet47Thunderbolt() { } @Override public void read(ByteBuf in) { super.read(in); unknown = in.readBoolean(); x = in.readInt(); y = in.readInt(); z = in.readInt(); } @Override public void write(ByteBuf out) { super.write(out); out.writeBoolean(unknown); out.writeInt(x); out.writeInt(y); out.writeInt(z); } @Override
public void handle(PacketHandler handler) {
BukkitDevTeam/Fondue
src/main/java/com/md_5/fondue/protocol/packet/Packet21EntityLookMove.java
// Path: src/main/java/com/md_5/fondue/protocol/PacketHandler.java // public abstract class PacketHandler { // // /** // * Method to determine whether this is a server handler, client handler or // * other. // * // * @return the type of method interface this handler should accept // */ // public abstract Class<? extends Annotation> getType(); // // @Server // public void handle(Packet0KeepAlive packet) { // } // // @ServerLogin // public void handle(Packet2Handshake packet) { // } // // @Server // public void handle(Packet3ChatMessage packet) { // } // // @Server // public void handle(Packet7UseEntity packet) { // } // // @Server // public void handle(PacketAFlying packet) { // } // // @Server // public void handle(PacketEDig packet) { // } // // @Server // // public void handle(PacketFPlace packet){} // // @Server // public void handle(Packet10HeldItem packet) { // } // // @Server // public void handle(Packet12Animation packet) { // } // // @Server // public void handle(Packet13EntityAction packet) { // } // // @Server // // public void handle(Packet66WindowClick packet){} // // @Server // public void handle(Packet6AConfirmTransaction packet) { // } // // @Server // public void handle(Packet6CEnchantItem packet) { // } // // @Server // public void handle(Packet82UpdateSign packet) { // } // // // @Server // // public void handle(Packet6BSlot); // @Server // public void handle(PacketCAPlayerAbilities packet) { // } // // @Server // public void handle(PacketCBTabComplete packet) { // } // // @Server // public void handle(PacketCCClientInfo packet) { // } // // @Server // @ServerLogin // public void handle(PacketCDClientStatus packet) { // } // // @Server // public void handle(PacketFAPluginMessage packet) { // } // // @ServerLogin // public void handle(PacketFCKeyResponse packet) { // } // // @ServerLogin // public void handle(PacketFEServerPing packet) { // } // // @Server // public void handle(PacketFFDisconnect packet) { // } // // /** // * Methods denoted by this annotation should be handled by a server // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Server { // } // // /** // * Methods denoted by this annotation should be handled by the initial // * server implementation of this class. // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface ServerLogin { // } // // /** // * Methods denoted by this method annotation be handled by a client // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Client { // } // }
import com.md_5.fondue.protocol.PacketHandler; import io.netty.buffer.ByteBuf; import lombok.EqualsAndHashCode; import lombok.ToString;
package com.md_5.fondue.protocol.packet; @ToString @EqualsAndHashCode(callSuper = false) public class Packet21EntityLookMove extends Packet1EEntity { private byte dX; private byte dY; private byte dZ; private byte yaw; private byte pitch; public Packet21EntityLookMove() { } @Override public void read(ByteBuf in) { super.read(in); dX = in.readByte(); dY = in.readByte(); dZ = in.readByte(); yaw = in.readByte(); pitch = in.readByte(); } @Override public void write(ByteBuf out) { super.write(out); out.writeByte(dX); out.writeByte(dY); out.writeByte(dZ); out.writeByte(yaw); out.writeByte(pitch); } @Override
// Path: src/main/java/com/md_5/fondue/protocol/PacketHandler.java // public abstract class PacketHandler { // // /** // * Method to determine whether this is a server handler, client handler or // * other. // * // * @return the type of method interface this handler should accept // */ // public abstract Class<? extends Annotation> getType(); // // @Server // public void handle(Packet0KeepAlive packet) { // } // // @ServerLogin // public void handle(Packet2Handshake packet) { // } // // @Server // public void handle(Packet3ChatMessage packet) { // } // // @Server // public void handle(Packet7UseEntity packet) { // } // // @Server // public void handle(PacketAFlying packet) { // } // // @Server // public void handle(PacketEDig packet) { // } // // @Server // // public void handle(PacketFPlace packet){} // // @Server // public void handle(Packet10HeldItem packet) { // } // // @Server // public void handle(Packet12Animation packet) { // } // // @Server // public void handle(Packet13EntityAction packet) { // } // // @Server // // public void handle(Packet66WindowClick packet){} // // @Server // public void handle(Packet6AConfirmTransaction packet) { // } // // @Server // public void handle(Packet6CEnchantItem packet) { // } // // @Server // public void handle(Packet82UpdateSign packet) { // } // // // @Server // // public void handle(Packet6BSlot); // @Server // public void handle(PacketCAPlayerAbilities packet) { // } // // @Server // public void handle(PacketCBTabComplete packet) { // } // // @Server // public void handle(PacketCCClientInfo packet) { // } // // @Server // @ServerLogin // public void handle(PacketCDClientStatus packet) { // } // // @Server // public void handle(PacketFAPluginMessage packet) { // } // // @ServerLogin // public void handle(PacketFCKeyResponse packet) { // } // // @ServerLogin // public void handle(PacketFEServerPing packet) { // } // // @Server // public void handle(PacketFFDisconnect packet) { // } // // /** // * Methods denoted by this annotation should be handled by a server // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Server { // } // // /** // * Methods denoted by this annotation should be handled by the initial // * server implementation of this class. // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface ServerLogin { // } // // /** // * Methods denoted by this method annotation be handled by a client // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Client { // } // } // Path: src/main/java/com/md_5/fondue/protocol/packet/Packet21EntityLookMove.java import com.md_5.fondue.protocol.PacketHandler; import io.netty.buffer.ByteBuf; import lombok.EqualsAndHashCode; import lombok.ToString; package com.md_5.fondue.protocol.packet; @ToString @EqualsAndHashCode(callSuper = false) public class Packet21EntityLookMove extends Packet1EEntity { private byte dX; private byte dY; private byte dZ; private byte yaw; private byte pitch; public Packet21EntityLookMove() { } @Override public void read(ByteBuf in) { super.read(in); dX = in.readByte(); dY = in.readByte(); dZ = in.readByte(); yaw = in.readByte(); pitch = in.readByte(); } @Override public void write(ByteBuf out) { super.write(out); out.writeByte(dX); out.writeByte(dY); out.writeByte(dZ); out.writeByte(yaw); out.writeByte(pitch); } @Override
public void handle(PacketHandler handler) {
BukkitDevTeam/Fondue
src/main/java/com/md_5/fondue/protocol/packet/Packet19SpawnPainting.java
// Path: src/main/java/com/md_5/fondue/protocol/PacketHandler.java // public abstract class PacketHandler { // // /** // * Method to determine whether this is a server handler, client handler or // * other. // * // * @return the type of method interface this handler should accept // */ // public abstract Class<? extends Annotation> getType(); // // @Server // public void handle(Packet0KeepAlive packet) { // } // // @ServerLogin // public void handle(Packet2Handshake packet) { // } // // @Server // public void handle(Packet3ChatMessage packet) { // } // // @Server // public void handle(Packet7UseEntity packet) { // } // // @Server // public void handle(PacketAFlying packet) { // } // // @Server // public void handle(PacketEDig packet) { // } // // @Server // // public void handle(PacketFPlace packet){} // // @Server // public void handle(Packet10HeldItem packet) { // } // // @Server // public void handle(Packet12Animation packet) { // } // // @Server // public void handle(Packet13EntityAction packet) { // } // // @Server // // public void handle(Packet66WindowClick packet){} // // @Server // public void handle(Packet6AConfirmTransaction packet) { // } // // @Server // public void handle(Packet6CEnchantItem packet) { // } // // @Server // public void handle(Packet82UpdateSign packet) { // } // // // @Server // // public void handle(Packet6BSlot); // @Server // public void handle(PacketCAPlayerAbilities packet) { // } // // @Server // public void handle(PacketCBTabComplete packet) { // } // // @Server // public void handle(PacketCCClientInfo packet) { // } // // @Server // @ServerLogin // public void handle(PacketCDClientStatus packet) { // } // // @Server // public void handle(PacketFAPluginMessage packet) { // } // // @ServerLogin // public void handle(PacketFCKeyResponse packet) { // } // // @ServerLogin // public void handle(PacketFEServerPing packet) { // } // // @Server // public void handle(PacketFFDisconnect packet) { // } // // /** // * Methods denoted by this annotation should be handled by a server // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Server { // } // // /** // * Methods denoted by this annotation should be handled by the initial // * server implementation of this class. // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface ServerLogin { // } // // /** // * Methods denoted by this method annotation be handled by a client // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Client { // } // }
import com.md_5.fondue.protocol.PacketHandler; import io.netty.buffer.ByteBuf; import lombok.EqualsAndHashCode; import lombok.ToString;
package com.md_5.fondue.protocol.packet; @ToString @EqualsAndHashCode(callSuper = false) public class Packet19SpawnPainting extends Packet1EEntity { private String title; private int x; private int y; private int z; private int direction; public Packet19SpawnPainting() { } @Override public void read(ByteBuf in) { super.write(in); title = readString(in); x = in.readInt(); y = in.readInt(); z = in.readInt(); direction = in.readInt(); } @Override public void write(ByteBuf out) { super.read(out); writeString(out, title); out.writeInt(x); out.writeInt(y); out.writeInt(z); out.writeInt(direction); } @Override
// Path: src/main/java/com/md_5/fondue/protocol/PacketHandler.java // public abstract class PacketHandler { // // /** // * Method to determine whether this is a server handler, client handler or // * other. // * // * @return the type of method interface this handler should accept // */ // public abstract Class<? extends Annotation> getType(); // // @Server // public void handle(Packet0KeepAlive packet) { // } // // @ServerLogin // public void handle(Packet2Handshake packet) { // } // // @Server // public void handle(Packet3ChatMessage packet) { // } // // @Server // public void handle(Packet7UseEntity packet) { // } // // @Server // public void handle(PacketAFlying packet) { // } // // @Server // public void handle(PacketEDig packet) { // } // // @Server // // public void handle(PacketFPlace packet){} // // @Server // public void handle(Packet10HeldItem packet) { // } // // @Server // public void handle(Packet12Animation packet) { // } // // @Server // public void handle(Packet13EntityAction packet) { // } // // @Server // // public void handle(Packet66WindowClick packet){} // // @Server // public void handle(Packet6AConfirmTransaction packet) { // } // // @Server // public void handle(Packet6CEnchantItem packet) { // } // // @Server // public void handle(Packet82UpdateSign packet) { // } // // // @Server // // public void handle(Packet6BSlot); // @Server // public void handle(PacketCAPlayerAbilities packet) { // } // // @Server // public void handle(PacketCBTabComplete packet) { // } // // @Server // public void handle(PacketCCClientInfo packet) { // } // // @Server // @ServerLogin // public void handle(PacketCDClientStatus packet) { // } // // @Server // public void handle(PacketFAPluginMessage packet) { // } // // @ServerLogin // public void handle(PacketFCKeyResponse packet) { // } // // @ServerLogin // public void handle(PacketFEServerPing packet) { // } // // @Server // public void handle(PacketFFDisconnect packet) { // } // // /** // * Methods denoted by this annotation should be handled by a server // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Server { // } // // /** // * Methods denoted by this annotation should be handled by the initial // * server implementation of this class. // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface ServerLogin { // } // // /** // * Methods denoted by this method annotation be handled by a client // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Client { // } // } // Path: src/main/java/com/md_5/fondue/protocol/packet/Packet19SpawnPainting.java import com.md_5.fondue.protocol.PacketHandler; import io.netty.buffer.ByteBuf; import lombok.EqualsAndHashCode; import lombok.ToString; package com.md_5.fondue.protocol.packet; @ToString @EqualsAndHashCode(callSuper = false) public class Packet19SpawnPainting extends Packet1EEntity { private String title; private int x; private int y; private int z; private int direction; public Packet19SpawnPainting() { } @Override public void read(ByteBuf in) { super.write(in); title = readString(in); x = in.readInt(); y = in.readInt(); z = in.readInt(); direction = in.readInt(); } @Override public void write(ByteBuf out) { super.read(out); writeString(out, title); out.writeInt(x); out.writeInt(y); out.writeInt(z); out.writeInt(direction); } @Override
public void handle(PacketHandler handler) {
BukkitDevTeam/Fondue
src/main/java/com/md_5/fondue/protocol/packet/PacketFDKeyRequest.java
// Path: src/main/java/com/md_5/fondue/protocol/PacketHandler.java // public abstract class PacketHandler { // // /** // * Method to determine whether this is a server handler, client handler or // * other. // * // * @return the type of method interface this handler should accept // */ // public abstract Class<? extends Annotation> getType(); // // @Server // public void handle(Packet0KeepAlive packet) { // } // // @ServerLogin // public void handle(Packet2Handshake packet) { // } // // @Server // public void handle(Packet3ChatMessage packet) { // } // // @Server // public void handle(Packet7UseEntity packet) { // } // // @Server // public void handle(PacketAFlying packet) { // } // // @Server // public void handle(PacketEDig packet) { // } // // @Server // // public void handle(PacketFPlace packet){} // // @Server // public void handle(Packet10HeldItem packet) { // } // // @Server // public void handle(Packet12Animation packet) { // } // // @Server // public void handle(Packet13EntityAction packet) { // } // // @Server // // public void handle(Packet66WindowClick packet){} // // @Server // public void handle(Packet6AConfirmTransaction packet) { // } // // @Server // public void handle(Packet6CEnchantItem packet) { // } // // @Server // public void handle(Packet82UpdateSign packet) { // } // // // @Server // // public void handle(Packet6BSlot); // @Server // public void handle(PacketCAPlayerAbilities packet) { // } // // @Server // public void handle(PacketCBTabComplete packet) { // } // // @Server // public void handle(PacketCCClientInfo packet) { // } // // @Server // @ServerLogin // public void handle(PacketCDClientStatus packet) { // } // // @Server // public void handle(PacketFAPluginMessage packet) { // } // // @ServerLogin // public void handle(PacketFCKeyResponse packet) { // } // // @ServerLogin // public void handle(PacketFEServerPing packet) { // } // // @Server // public void handle(PacketFFDisconnect packet) { // } // // /** // * Methods denoted by this annotation should be handled by a server // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Server { // } // // /** // * Methods denoted by this annotation should be handled by the initial // * server implementation of this class. // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface ServerLogin { // } // // /** // * Methods denoted by this method annotation be handled by a client // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Client { // } // }
import com.md_5.fondue.protocol.PacketHandler; import io.netty.buffer.ByteBuf; import lombok.EqualsAndHashCode; import lombok.ToString;
package com.md_5.fondue.protocol.packet; @ToString @EqualsAndHashCode(callSuper = false) public class PacketFDKeyRequest extends Packet { private String serverId; private byte[] publicKey; private byte[] verifyToken; public PacketFDKeyRequest() { } @Override public void read(ByteBuf in) { serverId = readString(in); publicKey = readBytes(in); verifyToken = readBytes(in); } @Override public void write(ByteBuf out) { writeString(out, serverId); writeBytes(out, publicKey); writeBytes(out, verifyToken); } @Override
// Path: src/main/java/com/md_5/fondue/protocol/PacketHandler.java // public abstract class PacketHandler { // // /** // * Method to determine whether this is a server handler, client handler or // * other. // * // * @return the type of method interface this handler should accept // */ // public abstract Class<? extends Annotation> getType(); // // @Server // public void handle(Packet0KeepAlive packet) { // } // // @ServerLogin // public void handle(Packet2Handshake packet) { // } // // @Server // public void handle(Packet3ChatMessage packet) { // } // // @Server // public void handle(Packet7UseEntity packet) { // } // // @Server // public void handle(PacketAFlying packet) { // } // // @Server // public void handle(PacketEDig packet) { // } // // @Server // // public void handle(PacketFPlace packet){} // // @Server // public void handle(Packet10HeldItem packet) { // } // // @Server // public void handle(Packet12Animation packet) { // } // // @Server // public void handle(Packet13EntityAction packet) { // } // // @Server // // public void handle(Packet66WindowClick packet){} // // @Server // public void handle(Packet6AConfirmTransaction packet) { // } // // @Server // public void handle(Packet6CEnchantItem packet) { // } // // @Server // public void handle(Packet82UpdateSign packet) { // } // // // @Server // // public void handle(Packet6BSlot); // @Server // public void handle(PacketCAPlayerAbilities packet) { // } // // @Server // public void handle(PacketCBTabComplete packet) { // } // // @Server // public void handle(PacketCCClientInfo packet) { // } // // @Server // @ServerLogin // public void handle(PacketCDClientStatus packet) { // } // // @Server // public void handle(PacketFAPluginMessage packet) { // } // // @ServerLogin // public void handle(PacketFCKeyResponse packet) { // } // // @ServerLogin // public void handle(PacketFEServerPing packet) { // } // // @Server // public void handle(PacketFFDisconnect packet) { // } // // /** // * Methods denoted by this annotation should be handled by a server // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Server { // } // // /** // * Methods denoted by this annotation should be handled by the initial // * server implementation of this class. // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface ServerLogin { // } // // /** // * Methods denoted by this method annotation be handled by a client // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Client { // } // } // Path: src/main/java/com/md_5/fondue/protocol/packet/PacketFDKeyRequest.java import com.md_5.fondue.protocol.PacketHandler; import io.netty.buffer.ByteBuf; import lombok.EqualsAndHashCode; import lombok.ToString; package com.md_5.fondue.protocol.packet; @ToString @EqualsAndHashCode(callSuper = false) public class PacketFDKeyRequest extends Packet { private String serverId; private byte[] publicKey; private byte[] verifyToken; public PacketFDKeyRequest() { } @Override public void read(ByteBuf in) { serverId = readString(in); publicKey = readBytes(in); verifyToken = readBytes(in); } @Override public void write(ByteBuf out) { writeString(out, serverId); writeBytes(out, publicKey); writeBytes(out, verifyToken); } @Override
public void handle(PacketHandler handler) {
BukkitDevTeam/Fondue
src/main/java/com/md_5/fondue/protocol/packet/PacketCDClientStatus.java
// Path: src/main/java/com/md_5/fondue/protocol/PacketHandler.java // public abstract class PacketHandler { // // /** // * Method to determine whether this is a server handler, client handler or // * other. // * // * @return the type of method interface this handler should accept // */ // public abstract Class<? extends Annotation> getType(); // // @Server // public void handle(Packet0KeepAlive packet) { // } // // @ServerLogin // public void handle(Packet2Handshake packet) { // } // // @Server // public void handle(Packet3ChatMessage packet) { // } // // @Server // public void handle(Packet7UseEntity packet) { // } // // @Server // public void handle(PacketAFlying packet) { // } // // @Server // public void handle(PacketEDig packet) { // } // // @Server // // public void handle(PacketFPlace packet){} // // @Server // public void handle(Packet10HeldItem packet) { // } // // @Server // public void handle(Packet12Animation packet) { // } // // @Server // public void handle(Packet13EntityAction packet) { // } // // @Server // // public void handle(Packet66WindowClick packet){} // // @Server // public void handle(Packet6AConfirmTransaction packet) { // } // // @Server // public void handle(Packet6CEnchantItem packet) { // } // // @Server // public void handle(Packet82UpdateSign packet) { // } // // // @Server // // public void handle(Packet6BSlot); // @Server // public void handle(PacketCAPlayerAbilities packet) { // } // // @Server // public void handle(PacketCBTabComplete packet) { // } // // @Server // public void handle(PacketCCClientInfo packet) { // } // // @Server // @ServerLogin // public void handle(PacketCDClientStatus packet) { // } // // @Server // public void handle(PacketFAPluginMessage packet) { // } // // @ServerLogin // public void handle(PacketFCKeyResponse packet) { // } // // @ServerLogin // public void handle(PacketFEServerPing packet) { // } // // @Server // public void handle(PacketFFDisconnect packet) { // } // // /** // * Methods denoted by this annotation should be handled by a server // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Server { // } // // /** // * Methods denoted by this annotation should be handled by the initial // * server implementation of this class. // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface ServerLogin { // } // // /** // * Methods denoted by this method annotation be handled by a client // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Client { // } // }
import com.md_5.fondue.protocol.PacketHandler; import io.netty.buffer.ByteBuf; import lombok.EqualsAndHashCode; import lombok.ToString;
package com.md_5.fondue.protocol.packet; @ToString @EqualsAndHashCode(callSuper = false) public class PacketCDClientStatus extends Packet { private byte status; public PacketCDClientStatus() { } @Override public void read(ByteBuf in) { status = in.readByte(); } @Override public void write(ByteBuf out) { out.writeByte(status); } @Override
// Path: src/main/java/com/md_5/fondue/protocol/PacketHandler.java // public abstract class PacketHandler { // // /** // * Method to determine whether this is a server handler, client handler or // * other. // * // * @return the type of method interface this handler should accept // */ // public abstract Class<? extends Annotation> getType(); // // @Server // public void handle(Packet0KeepAlive packet) { // } // // @ServerLogin // public void handle(Packet2Handshake packet) { // } // // @Server // public void handle(Packet3ChatMessage packet) { // } // // @Server // public void handle(Packet7UseEntity packet) { // } // // @Server // public void handle(PacketAFlying packet) { // } // // @Server // public void handle(PacketEDig packet) { // } // // @Server // // public void handle(PacketFPlace packet){} // // @Server // public void handle(Packet10HeldItem packet) { // } // // @Server // public void handle(Packet12Animation packet) { // } // // @Server // public void handle(Packet13EntityAction packet) { // } // // @Server // // public void handle(Packet66WindowClick packet){} // // @Server // public void handle(Packet6AConfirmTransaction packet) { // } // // @Server // public void handle(Packet6CEnchantItem packet) { // } // // @Server // public void handle(Packet82UpdateSign packet) { // } // // // @Server // // public void handle(Packet6BSlot); // @Server // public void handle(PacketCAPlayerAbilities packet) { // } // // @Server // public void handle(PacketCBTabComplete packet) { // } // // @Server // public void handle(PacketCCClientInfo packet) { // } // // @Server // @ServerLogin // public void handle(PacketCDClientStatus packet) { // } // // @Server // public void handle(PacketFAPluginMessage packet) { // } // // @ServerLogin // public void handle(PacketFCKeyResponse packet) { // } // // @ServerLogin // public void handle(PacketFEServerPing packet) { // } // // @Server // public void handle(PacketFFDisconnect packet) { // } // // /** // * Methods denoted by this annotation should be handled by a server // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Server { // } // // /** // * Methods denoted by this annotation should be handled by the initial // * server implementation of this class. // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface ServerLogin { // } // // /** // * Methods denoted by this method annotation be handled by a client // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Client { // } // } // Path: src/main/java/com/md_5/fondue/protocol/packet/PacketCDClientStatus.java import com.md_5.fondue.protocol.PacketHandler; import io.netty.buffer.ByteBuf; import lombok.EqualsAndHashCode; import lombok.ToString; package com.md_5.fondue.protocol.packet; @ToString @EqualsAndHashCode(callSuper = false) public class PacketCDClientStatus extends Packet { private byte status; public PacketCDClientStatus() { } @Override public void read(ByteBuf in) { status = in.readByte(); } @Override public void write(ByteBuf out) { out.writeByte(status); } @Override
public void handle(PacketHandler handler) {
BukkitDevTeam/Fondue
src/main/java/com/md_5/fondue/protocol/packet/Packet22EntityTeleport.java
// Path: src/main/java/com/md_5/fondue/protocol/PacketHandler.java // public abstract class PacketHandler { // // /** // * Method to determine whether this is a server handler, client handler or // * other. // * // * @return the type of method interface this handler should accept // */ // public abstract Class<? extends Annotation> getType(); // // @Server // public void handle(Packet0KeepAlive packet) { // } // // @ServerLogin // public void handle(Packet2Handshake packet) { // } // // @Server // public void handle(Packet3ChatMessage packet) { // } // // @Server // public void handle(Packet7UseEntity packet) { // } // // @Server // public void handle(PacketAFlying packet) { // } // // @Server // public void handle(PacketEDig packet) { // } // // @Server // // public void handle(PacketFPlace packet){} // // @Server // public void handle(Packet10HeldItem packet) { // } // // @Server // public void handle(Packet12Animation packet) { // } // // @Server // public void handle(Packet13EntityAction packet) { // } // // @Server // // public void handle(Packet66WindowClick packet){} // // @Server // public void handle(Packet6AConfirmTransaction packet) { // } // // @Server // public void handle(Packet6CEnchantItem packet) { // } // // @Server // public void handle(Packet82UpdateSign packet) { // } // // // @Server // // public void handle(Packet6BSlot); // @Server // public void handle(PacketCAPlayerAbilities packet) { // } // // @Server // public void handle(PacketCBTabComplete packet) { // } // // @Server // public void handle(PacketCCClientInfo packet) { // } // // @Server // @ServerLogin // public void handle(PacketCDClientStatus packet) { // } // // @Server // public void handle(PacketFAPluginMessage packet) { // } // // @ServerLogin // public void handle(PacketFCKeyResponse packet) { // } // // @ServerLogin // public void handle(PacketFEServerPing packet) { // } // // @Server // public void handle(PacketFFDisconnect packet) { // } // // /** // * Methods denoted by this annotation should be handled by a server // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Server { // } // // /** // * Methods denoted by this annotation should be handled by the initial // * server implementation of this class. // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface ServerLogin { // } // // /** // * Methods denoted by this method annotation be handled by a client // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Client { // } // }
import com.md_5.fondue.protocol.PacketHandler; import io.netty.buffer.ByteBuf; import lombok.EqualsAndHashCode; import lombok.ToString;
package com.md_5.fondue.protocol.packet; @ToString @EqualsAndHashCode(callSuper = false) public class Packet22EntityTeleport extends Packet1EEntity { private int x; private int y; private int z; private byte yaw; private byte pitch; public Packet22EntityTeleport() { } @Override public void read(ByteBuf in) { super.read(in); x = in.readInt(); y = in.readInt(); z = in.readInt(); yaw = in.readByte(); pitch = in.readByte(); } @Override public void write(ByteBuf out) { super.write(out); out.writeInt(x); out.writeInt(y); out.writeInt(z); out.writeByte(yaw); out.writeByte(pitch); } @Override
// Path: src/main/java/com/md_5/fondue/protocol/PacketHandler.java // public abstract class PacketHandler { // // /** // * Method to determine whether this is a server handler, client handler or // * other. // * // * @return the type of method interface this handler should accept // */ // public abstract Class<? extends Annotation> getType(); // // @Server // public void handle(Packet0KeepAlive packet) { // } // // @ServerLogin // public void handle(Packet2Handshake packet) { // } // // @Server // public void handle(Packet3ChatMessage packet) { // } // // @Server // public void handle(Packet7UseEntity packet) { // } // // @Server // public void handle(PacketAFlying packet) { // } // // @Server // public void handle(PacketEDig packet) { // } // // @Server // // public void handle(PacketFPlace packet){} // // @Server // public void handle(Packet10HeldItem packet) { // } // // @Server // public void handle(Packet12Animation packet) { // } // // @Server // public void handle(Packet13EntityAction packet) { // } // // @Server // // public void handle(Packet66WindowClick packet){} // // @Server // public void handle(Packet6AConfirmTransaction packet) { // } // // @Server // public void handle(Packet6CEnchantItem packet) { // } // // @Server // public void handle(Packet82UpdateSign packet) { // } // // // @Server // // public void handle(Packet6BSlot); // @Server // public void handle(PacketCAPlayerAbilities packet) { // } // // @Server // public void handle(PacketCBTabComplete packet) { // } // // @Server // public void handle(PacketCCClientInfo packet) { // } // // @Server // @ServerLogin // public void handle(PacketCDClientStatus packet) { // } // // @Server // public void handle(PacketFAPluginMessage packet) { // } // // @ServerLogin // public void handle(PacketFCKeyResponse packet) { // } // // @ServerLogin // public void handle(PacketFEServerPing packet) { // } // // @Server // public void handle(PacketFFDisconnect packet) { // } // // /** // * Methods denoted by this annotation should be handled by a server // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Server { // } // // /** // * Methods denoted by this annotation should be handled by the initial // * server implementation of this class. // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface ServerLogin { // } // // /** // * Methods denoted by this method annotation be handled by a client // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Client { // } // } // Path: src/main/java/com/md_5/fondue/protocol/packet/Packet22EntityTeleport.java import com.md_5.fondue.protocol.PacketHandler; import io.netty.buffer.ByteBuf; import lombok.EqualsAndHashCode; import lombok.ToString; package com.md_5.fondue.protocol.packet; @ToString @EqualsAndHashCode(callSuper = false) public class Packet22EntityTeleport extends Packet1EEntity { private int x; private int y; private int z; private byte yaw; private byte pitch; public Packet22EntityTeleport() { } @Override public void read(ByteBuf in) { super.read(in); x = in.readInt(); y = in.readInt(); z = in.readInt(); yaw = in.readByte(); pitch = in.readByte(); } @Override public void write(ByteBuf out) { super.write(out); out.writeInt(x); out.writeInt(y); out.writeInt(z); out.writeByte(yaw); out.writeByte(pitch); } @Override
public void handle(PacketHandler handler) {
BukkitDevTeam/Fondue
src/main/java/com/md_5/fondue/protocol/packet/Packet69WindowProperty.java
// Path: src/main/java/com/md_5/fondue/protocol/PacketHandler.java // public abstract class PacketHandler { // // /** // * Method to determine whether this is a server handler, client handler or // * other. // * // * @return the type of method interface this handler should accept // */ // public abstract Class<? extends Annotation> getType(); // // @Server // public void handle(Packet0KeepAlive packet) { // } // // @ServerLogin // public void handle(Packet2Handshake packet) { // } // // @Server // public void handle(Packet3ChatMessage packet) { // } // // @Server // public void handle(Packet7UseEntity packet) { // } // // @Server // public void handle(PacketAFlying packet) { // } // // @Server // public void handle(PacketEDig packet) { // } // // @Server // // public void handle(PacketFPlace packet){} // // @Server // public void handle(Packet10HeldItem packet) { // } // // @Server // public void handle(Packet12Animation packet) { // } // // @Server // public void handle(Packet13EntityAction packet) { // } // // @Server // // public void handle(Packet66WindowClick packet){} // // @Server // public void handle(Packet6AConfirmTransaction packet) { // } // // @Server // public void handle(Packet6CEnchantItem packet) { // } // // @Server // public void handle(Packet82UpdateSign packet) { // } // // // @Server // // public void handle(Packet6BSlot); // @Server // public void handle(PacketCAPlayerAbilities packet) { // } // // @Server // public void handle(PacketCBTabComplete packet) { // } // // @Server // public void handle(PacketCCClientInfo packet) { // } // // @Server // @ServerLogin // public void handle(PacketCDClientStatus packet) { // } // // @Server // public void handle(PacketFAPluginMessage packet) { // } // // @ServerLogin // public void handle(PacketFCKeyResponse packet) { // } // // @ServerLogin // public void handle(PacketFEServerPing packet) { // } // // @Server // public void handle(PacketFFDisconnect packet) { // } // // /** // * Methods denoted by this annotation should be handled by a server // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Server { // } // // /** // * Methods denoted by this annotation should be handled by the initial // * server implementation of this class. // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface ServerLogin { // } // // /** // * Methods denoted by this method annotation be handled by a client // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Client { // } // }
import com.md_5.fondue.protocol.PacketHandler; import io.netty.buffer.ByteBuf; import lombok.EqualsAndHashCode; import lombok.ToString;
package com.md_5.fondue.protocol.packet; @ToString @EqualsAndHashCode(callSuper = false) public class Packet69WindowProperty extends Packet { private byte windowId; private short property; private short value; public Packet69WindowProperty() { } @Override public void read(ByteBuf in) { windowId = in.readByte(); property = in.readShort(); value = in.readShort(); } @Override public void write(ByteBuf out) { out.writeByte(windowId); out.writeShort(property); out.writeShort(value); } @Override
// Path: src/main/java/com/md_5/fondue/protocol/PacketHandler.java // public abstract class PacketHandler { // // /** // * Method to determine whether this is a server handler, client handler or // * other. // * // * @return the type of method interface this handler should accept // */ // public abstract Class<? extends Annotation> getType(); // // @Server // public void handle(Packet0KeepAlive packet) { // } // // @ServerLogin // public void handle(Packet2Handshake packet) { // } // // @Server // public void handle(Packet3ChatMessage packet) { // } // // @Server // public void handle(Packet7UseEntity packet) { // } // // @Server // public void handle(PacketAFlying packet) { // } // // @Server // public void handle(PacketEDig packet) { // } // // @Server // // public void handle(PacketFPlace packet){} // // @Server // public void handle(Packet10HeldItem packet) { // } // // @Server // public void handle(Packet12Animation packet) { // } // // @Server // public void handle(Packet13EntityAction packet) { // } // // @Server // // public void handle(Packet66WindowClick packet){} // // @Server // public void handle(Packet6AConfirmTransaction packet) { // } // // @Server // public void handle(Packet6CEnchantItem packet) { // } // // @Server // public void handle(Packet82UpdateSign packet) { // } // // // @Server // // public void handle(Packet6BSlot); // @Server // public void handle(PacketCAPlayerAbilities packet) { // } // // @Server // public void handle(PacketCBTabComplete packet) { // } // // @Server // public void handle(PacketCCClientInfo packet) { // } // // @Server // @ServerLogin // public void handle(PacketCDClientStatus packet) { // } // // @Server // public void handle(PacketFAPluginMessage packet) { // } // // @ServerLogin // public void handle(PacketFCKeyResponse packet) { // } // // @ServerLogin // public void handle(PacketFEServerPing packet) { // } // // @Server // public void handle(PacketFFDisconnect packet) { // } // // /** // * Methods denoted by this annotation should be handled by a server // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Server { // } // // /** // * Methods denoted by this annotation should be handled by the initial // * server implementation of this class. // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface ServerLogin { // } // // /** // * Methods denoted by this method annotation be handled by a client // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Client { // } // } // Path: src/main/java/com/md_5/fondue/protocol/packet/Packet69WindowProperty.java import com.md_5.fondue.protocol.PacketHandler; import io.netty.buffer.ByteBuf; import lombok.EqualsAndHashCode; import lombok.ToString; package com.md_5.fondue.protocol.packet; @ToString @EqualsAndHashCode(callSuper = false) public class Packet69WindowProperty extends Packet { private byte windowId; private short property; private short value; public Packet69WindowProperty() { } @Override public void read(ByteBuf in) { windowId = in.readByte(); property = in.readShort(); value = in.readShort(); } @Override public void write(ByteBuf out) { out.writeByte(windowId); out.writeShort(property); out.writeShort(value); } @Override
public void handle(PacketHandler handler) {
BukkitDevTeam/Fondue
src/main/java/com/md_5/fondue/protocol/packet/Packet26EntityStatus.java
// Path: src/main/java/com/md_5/fondue/protocol/PacketHandler.java // public abstract class PacketHandler { // // /** // * Method to determine whether this is a server handler, client handler or // * other. // * // * @return the type of method interface this handler should accept // */ // public abstract Class<? extends Annotation> getType(); // // @Server // public void handle(Packet0KeepAlive packet) { // } // // @ServerLogin // public void handle(Packet2Handshake packet) { // } // // @Server // public void handle(Packet3ChatMessage packet) { // } // // @Server // public void handle(Packet7UseEntity packet) { // } // // @Server // public void handle(PacketAFlying packet) { // } // // @Server // public void handle(PacketEDig packet) { // } // // @Server // // public void handle(PacketFPlace packet){} // // @Server // public void handle(Packet10HeldItem packet) { // } // // @Server // public void handle(Packet12Animation packet) { // } // // @Server // public void handle(Packet13EntityAction packet) { // } // // @Server // // public void handle(Packet66WindowClick packet){} // // @Server // public void handle(Packet6AConfirmTransaction packet) { // } // // @Server // public void handle(Packet6CEnchantItem packet) { // } // // @Server // public void handle(Packet82UpdateSign packet) { // } // // // @Server // // public void handle(Packet6BSlot); // @Server // public void handle(PacketCAPlayerAbilities packet) { // } // // @Server // public void handle(PacketCBTabComplete packet) { // } // // @Server // public void handle(PacketCCClientInfo packet) { // } // // @Server // @ServerLogin // public void handle(PacketCDClientStatus packet) { // } // // @Server // public void handle(PacketFAPluginMessage packet) { // } // // @ServerLogin // public void handle(PacketFCKeyResponse packet) { // } // // @ServerLogin // public void handle(PacketFEServerPing packet) { // } // // @Server // public void handle(PacketFFDisconnect packet) { // } // // /** // * Methods denoted by this annotation should be handled by a server // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Server { // } // // /** // * Methods denoted by this annotation should be handled by the initial // * server implementation of this class. // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface ServerLogin { // } // // /** // * Methods denoted by this method annotation be handled by a client // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Client { // } // }
import com.md_5.fondue.protocol.PacketHandler; import io.netty.buffer.ByteBuf; import lombok.EqualsAndHashCode; import lombok.ToString;
package com.md_5.fondue.protocol.packet; @ToString @EqualsAndHashCode(callSuper = false) public class Packet26EntityStatus extends Packet1EEntity { private byte status; public Packet26EntityStatus() { } @Override public void read(ByteBuf in) { super.read(in); status = in.readByte(); } @Override public void write(ByteBuf out) { super.write(out); out.writeByte(status); } @Override
// Path: src/main/java/com/md_5/fondue/protocol/PacketHandler.java // public abstract class PacketHandler { // // /** // * Method to determine whether this is a server handler, client handler or // * other. // * // * @return the type of method interface this handler should accept // */ // public abstract Class<? extends Annotation> getType(); // // @Server // public void handle(Packet0KeepAlive packet) { // } // // @ServerLogin // public void handle(Packet2Handshake packet) { // } // // @Server // public void handle(Packet3ChatMessage packet) { // } // // @Server // public void handle(Packet7UseEntity packet) { // } // // @Server // public void handle(PacketAFlying packet) { // } // // @Server // public void handle(PacketEDig packet) { // } // // @Server // // public void handle(PacketFPlace packet){} // // @Server // public void handle(Packet10HeldItem packet) { // } // // @Server // public void handle(Packet12Animation packet) { // } // // @Server // public void handle(Packet13EntityAction packet) { // } // // @Server // // public void handle(Packet66WindowClick packet){} // // @Server // public void handle(Packet6AConfirmTransaction packet) { // } // // @Server // public void handle(Packet6CEnchantItem packet) { // } // // @Server // public void handle(Packet82UpdateSign packet) { // } // // // @Server // // public void handle(Packet6BSlot); // @Server // public void handle(PacketCAPlayerAbilities packet) { // } // // @Server // public void handle(PacketCBTabComplete packet) { // } // // @Server // public void handle(PacketCCClientInfo packet) { // } // // @Server // @ServerLogin // public void handle(PacketCDClientStatus packet) { // } // // @Server // public void handle(PacketFAPluginMessage packet) { // } // // @ServerLogin // public void handle(PacketFCKeyResponse packet) { // } // // @ServerLogin // public void handle(PacketFEServerPing packet) { // } // // @Server // public void handle(PacketFFDisconnect packet) { // } // // /** // * Methods denoted by this annotation should be handled by a server // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Server { // } // // /** // * Methods denoted by this annotation should be handled by the initial // * server implementation of this class. // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface ServerLogin { // } // // /** // * Methods denoted by this method annotation be handled by a client // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Client { // } // } // Path: src/main/java/com/md_5/fondue/protocol/packet/Packet26EntityStatus.java import com.md_5.fondue.protocol.PacketHandler; import io.netty.buffer.ByteBuf; import lombok.EqualsAndHashCode; import lombok.ToString; package com.md_5.fondue.protocol.packet; @ToString @EqualsAndHashCode(callSuper = false) public class Packet26EntityStatus extends Packet1EEntity { private byte status; public Packet26EntityStatus() { } @Override public void read(ByteBuf in) { super.read(in); status = in.readByte(); } @Override public void write(ByteBuf out) { super.write(out); out.writeByte(status); } @Override
public void handle(PacketHandler handler) {
BukkitDevTeam/Fondue
src/main/java/com/md_5/fondue/protocol/packet/Packet2ARemoveEntityEffect.java
// Path: src/main/java/com/md_5/fondue/protocol/PacketHandler.java // public abstract class PacketHandler { // // /** // * Method to determine whether this is a server handler, client handler or // * other. // * // * @return the type of method interface this handler should accept // */ // public abstract Class<? extends Annotation> getType(); // // @Server // public void handle(Packet0KeepAlive packet) { // } // // @ServerLogin // public void handle(Packet2Handshake packet) { // } // // @Server // public void handle(Packet3ChatMessage packet) { // } // // @Server // public void handle(Packet7UseEntity packet) { // } // // @Server // public void handle(PacketAFlying packet) { // } // // @Server // public void handle(PacketEDig packet) { // } // // @Server // // public void handle(PacketFPlace packet){} // // @Server // public void handle(Packet10HeldItem packet) { // } // // @Server // public void handle(Packet12Animation packet) { // } // // @Server // public void handle(Packet13EntityAction packet) { // } // // @Server // // public void handle(Packet66WindowClick packet){} // // @Server // public void handle(Packet6AConfirmTransaction packet) { // } // // @Server // public void handle(Packet6CEnchantItem packet) { // } // // @Server // public void handle(Packet82UpdateSign packet) { // } // // // @Server // // public void handle(Packet6BSlot); // @Server // public void handle(PacketCAPlayerAbilities packet) { // } // // @Server // public void handle(PacketCBTabComplete packet) { // } // // @Server // public void handle(PacketCCClientInfo packet) { // } // // @Server // @ServerLogin // public void handle(PacketCDClientStatus packet) { // } // // @Server // public void handle(PacketFAPluginMessage packet) { // } // // @ServerLogin // public void handle(PacketFCKeyResponse packet) { // } // // @ServerLogin // public void handle(PacketFEServerPing packet) { // } // // @Server // public void handle(PacketFFDisconnect packet) { // } // // /** // * Methods denoted by this annotation should be handled by a server // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Server { // } // // /** // * Methods denoted by this annotation should be handled by the initial // * server implementation of this class. // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface ServerLogin { // } // // /** // * Methods denoted by this method annotation be handled by a client // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Client { // } // }
import com.md_5.fondue.protocol.PacketHandler; import io.netty.buffer.ByteBuf; import lombok.EqualsAndHashCode; import lombok.ToString;
package com.md_5.fondue.protocol.packet; @ToString @EqualsAndHashCode(callSuper = false) public class Packet2ARemoveEntityEffect extends Packet1EEntity { private byte effectId; public Packet2ARemoveEntityEffect() { } @Override public void read(ByteBuf in) { super.read(in); effectId = in.readByte(); } @Override public void write(ByteBuf out) { super.write(out); out.writeByte(effectId); } @Override
// Path: src/main/java/com/md_5/fondue/protocol/PacketHandler.java // public abstract class PacketHandler { // // /** // * Method to determine whether this is a server handler, client handler or // * other. // * // * @return the type of method interface this handler should accept // */ // public abstract Class<? extends Annotation> getType(); // // @Server // public void handle(Packet0KeepAlive packet) { // } // // @ServerLogin // public void handle(Packet2Handshake packet) { // } // // @Server // public void handle(Packet3ChatMessage packet) { // } // // @Server // public void handle(Packet7UseEntity packet) { // } // // @Server // public void handle(PacketAFlying packet) { // } // // @Server // public void handle(PacketEDig packet) { // } // // @Server // // public void handle(PacketFPlace packet){} // // @Server // public void handle(Packet10HeldItem packet) { // } // // @Server // public void handle(Packet12Animation packet) { // } // // @Server // public void handle(Packet13EntityAction packet) { // } // // @Server // // public void handle(Packet66WindowClick packet){} // // @Server // public void handle(Packet6AConfirmTransaction packet) { // } // // @Server // public void handle(Packet6CEnchantItem packet) { // } // // @Server // public void handle(Packet82UpdateSign packet) { // } // // // @Server // // public void handle(Packet6BSlot); // @Server // public void handle(PacketCAPlayerAbilities packet) { // } // // @Server // public void handle(PacketCBTabComplete packet) { // } // // @Server // public void handle(PacketCCClientInfo packet) { // } // // @Server // @ServerLogin // public void handle(PacketCDClientStatus packet) { // } // // @Server // public void handle(PacketFAPluginMessage packet) { // } // // @ServerLogin // public void handle(PacketFCKeyResponse packet) { // } // // @ServerLogin // public void handle(PacketFEServerPing packet) { // } // // @Server // public void handle(PacketFFDisconnect packet) { // } // // /** // * Methods denoted by this annotation should be handled by a server // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Server { // } // // /** // * Methods denoted by this annotation should be handled by the initial // * server implementation of this class. // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface ServerLogin { // } // // /** // * Methods denoted by this method annotation be handled by a client // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Client { // } // } // Path: src/main/java/com/md_5/fondue/protocol/packet/Packet2ARemoveEntityEffect.java import com.md_5.fondue.protocol.PacketHandler; import io.netty.buffer.ByteBuf; import lombok.EqualsAndHashCode; import lombok.ToString; package com.md_5.fondue.protocol.packet; @ToString @EqualsAndHashCode(callSuper = false) public class Packet2ARemoveEntityEffect extends Packet1EEntity { private byte effectId; public Packet2ARemoveEntityEffect() { } @Override public void read(ByteBuf in) { super.read(in); effectId = in.readByte(); } @Override public void write(ByteBuf out) { super.write(out); out.writeByte(effectId); } @Override
public void handle(PacketHandler handler) {
BukkitDevTeam/Fondue
src/main/java/com/md_5/fondue/protocol/packet/Packet0KeepAlive.java
// Path: src/main/java/com/md_5/fondue/protocol/PacketHandler.java // public abstract class PacketHandler { // // /** // * Method to determine whether this is a server handler, client handler or // * other. // * // * @return the type of method interface this handler should accept // */ // public abstract Class<? extends Annotation> getType(); // // @Server // public void handle(Packet0KeepAlive packet) { // } // // @ServerLogin // public void handle(Packet2Handshake packet) { // } // // @Server // public void handle(Packet3ChatMessage packet) { // } // // @Server // public void handle(Packet7UseEntity packet) { // } // // @Server // public void handle(PacketAFlying packet) { // } // // @Server // public void handle(PacketEDig packet) { // } // // @Server // // public void handle(PacketFPlace packet){} // // @Server // public void handle(Packet10HeldItem packet) { // } // // @Server // public void handle(Packet12Animation packet) { // } // // @Server // public void handle(Packet13EntityAction packet) { // } // // @Server // // public void handle(Packet66WindowClick packet){} // // @Server // public void handle(Packet6AConfirmTransaction packet) { // } // // @Server // public void handle(Packet6CEnchantItem packet) { // } // // @Server // public void handle(Packet82UpdateSign packet) { // } // // // @Server // // public void handle(Packet6BSlot); // @Server // public void handle(PacketCAPlayerAbilities packet) { // } // // @Server // public void handle(PacketCBTabComplete packet) { // } // // @Server // public void handle(PacketCCClientInfo packet) { // } // // @Server // @ServerLogin // public void handle(PacketCDClientStatus packet) { // } // // @Server // public void handle(PacketFAPluginMessage packet) { // } // // @ServerLogin // public void handle(PacketFCKeyResponse packet) { // } // // @ServerLogin // public void handle(PacketFEServerPing packet) { // } // // @Server // public void handle(PacketFFDisconnect packet) { // } // // /** // * Methods denoted by this annotation should be handled by a server // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Server { // } // // /** // * Methods denoted by this annotation should be handled by the initial // * server implementation of this class. // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface ServerLogin { // } // // /** // * Methods denoted by this method annotation be handled by a client // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Client { // } // }
import com.md_5.fondue.protocol.PacketHandler; import io.netty.buffer.ByteBuf; import lombok.EqualsAndHashCode; import lombok.ToString;
package com.md_5.fondue.protocol.packet; @ToString @EqualsAndHashCode(callSuper = false) public class Packet0KeepAlive extends Packet { private int id; public Packet0KeepAlive() { } @Override public void read(ByteBuf in) { id = in.readInt(); } @Override public void write(ByteBuf out) { out.writeInt(id); } @Override
// Path: src/main/java/com/md_5/fondue/protocol/PacketHandler.java // public abstract class PacketHandler { // // /** // * Method to determine whether this is a server handler, client handler or // * other. // * // * @return the type of method interface this handler should accept // */ // public abstract Class<? extends Annotation> getType(); // // @Server // public void handle(Packet0KeepAlive packet) { // } // // @ServerLogin // public void handle(Packet2Handshake packet) { // } // // @Server // public void handle(Packet3ChatMessage packet) { // } // // @Server // public void handle(Packet7UseEntity packet) { // } // // @Server // public void handle(PacketAFlying packet) { // } // // @Server // public void handle(PacketEDig packet) { // } // // @Server // // public void handle(PacketFPlace packet){} // // @Server // public void handle(Packet10HeldItem packet) { // } // // @Server // public void handle(Packet12Animation packet) { // } // // @Server // public void handle(Packet13EntityAction packet) { // } // // @Server // // public void handle(Packet66WindowClick packet){} // // @Server // public void handle(Packet6AConfirmTransaction packet) { // } // // @Server // public void handle(Packet6CEnchantItem packet) { // } // // @Server // public void handle(Packet82UpdateSign packet) { // } // // // @Server // // public void handle(Packet6BSlot); // @Server // public void handle(PacketCAPlayerAbilities packet) { // } // // @Server // public void handle(PacketCBTabComplete packet) { // } // // @Server // public void handle(PacketCCClientInfo packet) { // } // // @Server // @ServerLogin // public void handle(PacketCDClientStatus packet) { // } // // @Server // public void handle(PacketFAPluginMessage packet) { // } // // @ServerLogin // public void handle(PacketFCKeyResponse packet) { // } // // @ServerLogin // public void handle(PacketFEServerPing packet) { // } // // @Server // public void handle(PacketFFDisconnect packet) { // } // // /** // * Methods denoted by this annotation should be handled by a server // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Server { // } // // /** // * Methods denoted by this annotation should be handled by the initial // * server implementation of this class. // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface ServerLogin { // } // // /** // * Methods denoted by this method annotation be handled by a client // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Client { // } // } // Path: src/main/java/com/md_5/fondue/protocol/packet/Packet0KeepAlive.java import com.md_5.fondue.protocol.PacketHandler; import io.netty.buffer.ByteBuf; import lombok.EqualsAndHashCode; import lombok.ToString; package com.md_5.fondue.protocol.packet; @ToString @EqualsAndHashCode(callSuper = false) public class Packet0KeepAlive extends Packet { private int id; public Packet0KeepAlive() { } @Override public void read(ByteBuf in) { id = in.readInt(); } @Override public void write(ByteBuf out) { out.writeInt(id); } @Override
public void handle(PacketHandler handler) {
BukkitDevTeam/Fondue
src/main/java/com/md_5/fondue/protocol/packet/Packet6SpawnPosition.java
// Path: src/main/java/com/md_5/fondue/protocol/PacketHandler.java // public abstract class PacketHandler { // // /** // * Method to determine whether this is a server handler, client handler or // * other. // * // * @return the type of method interface this handler should accept // */ // public abstract Class<? extends Annotation> getType(); // // @Server // public void handle(Packet0KeepAlive packet) { // } // // @ServerLogin // public void handle(Packet2Handshake packet) { // } // // @Server // public void handle(Packet3ChatMessage packet) { // } // // @Server // public void handle(Packet7UseEntity packet) { // } // // @Server // public void handle(PacketAFlying packet) { // } // // @Server // public void handle(PacketEDig packet) { // } // // @Server // // public void handle(PacketFPlace packet){} // // @Server // public void handle(Packet10HeldItem packet) { // } // // @Server // public void handle(Packet12Animation packet) { // } // // @Server // public void handle(Packet13EntityAction packet) { // } // // @Server // // public void handle(Packet66WindowClick packet){} // // @Server // public void handle(Packet6AConfirmTransaction packet) { // } // // @Server // public void handle(Packet6CEnchantItem packet) { // } // // @Server // public void handle(Packet82UpdateSign packet) { // } // // // @Server // // public void handle(Packet6BSlot); // @Server // public void handle(PacketCAPlayerAbilities packet) { // } // // @Server // public void handle(PacketCBTabComplete packet) { // } // // @Server // public void handle(PacketCCClientInfo packet) { // } // // @Server // @ServerLogin // public void handle(PacketCDClientStatus packet) { // } // // @Server // public void handle(PacketFAPluginMessage packet) { // } // // @ServerLogin // public void handle(PacketFCKeyResponse packet) { // } // // @ServerLogin // public void handle(PacketFEServerPing packet) { // } // // @Server // public void handle(PacketFFDisconnect packet) { // } // // /** // * Methods denoted by this annotation should be handled by a server // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Server { // } // // /** // * Methods denoted by this annotation should be handled by the initial // * server implementation of this class. // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface ServerLogin { // } // // /** // * Methods denoted by this method annotation be handled by a client // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Client { // } // }
import com.md_5.fondue.protocol.PacketHandler; import io.netty.buffer.ByteBuf; import lombok.EqualsAndHashCode; import lombok.ToString;
package com.md_5.fondue.protocol.packet; @ToString @EqualsAndHashCode(callSuper = false) public class Packet6SpawnPosition extends Packet { private int x; private int y; private int z; public Packet6SpawnPosition() { } @Override public void read(ByteBuf in) { x = in.readInt(); y = in.readInt(); z = in.readInt(); } @Override public void write(ByteBuf out) { out.writeInt(x); out.writeInt(y); out.writeInt(z); } @Override
// Path: src/main/java/com/md_5/fondue/protocol/PacketHandler.java // public abstract class PacketHandler { // // /** // * Method to determine whether this is a server handler, client handler or // * other. // * // * @return the type of method interface this handler should accept // */ // public abstract Class<? extends Annotation> getType(); // // @Server // public void handle(Packet0KeepAlive packet) { // } // // @ServerLogin // public void handle(Packet2Handshake packet) { // } // // @Server // public void handle(Packet3ChatMessage packet) { // } // // @Server // public void handle(Packet7UseEntity packet) { // } // // @Server // public void handle(PacketAFlying packet) { // } // // @Server // public void handle(PacketEDig packet) { // } // // @Server // // public void handle(PacketFPlace packet){} // // @Server // public void handle(Packet10HeldItem packet) { // } // // @Server // public void handle(Packet12Animation packet) { // } // // @Server // public void handle(Packet13EntityAction packet) { // } // // @Server // // public void handle(Packet66WindowClick packet){} // // @Server // public void handle(Packet6AConfirmTransaction packet) { // } // // @Server // public void handle(Packet6CEnchantItem packet) { // } // // @Server // public void handle(Packet82UpdateSign packet) { // } // // // @Server // // public void handle(Packet6BSlot); // @Server // public void handle(PacketCAPlayerAbilities packet) { // } // // @Server // public void handle(PacketCBTabComplete packet) { // } // // @Server // public void handle(PacketCCClientInfo packet) { // } // // @Server // @ServerLogin // public void handle(PacketCDClientStatus packet) { // } // // @Server // public void handle(PacketFAPluginMessage packet) { // } // // @ServerLogin // public void handle(PacketFCKeyResponse packet) { // } // // @ServerLogin // public void handle(PacketFEServerPing packet) { // } // // @Server // public void handle(PacketFFDisconnect packet) { // } // // /** // * Methods denoted by this annotation should be handled by a server // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Server { // } // // /** // * Methods denoted by this annotation should be handled by the initial // * server implementation of this class. // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface ServerLogin { // } // // /** // * Methods denoted by this method annotation be handled by a client // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Client { // } // } // Path: src/main/java/com/md_5/fondue/protocol/packet/Packet6SpawnPosition.java import com.md_5.fondue.protocol.PacketHandler; import io.netty.buffer.ByteBuf; import lombok.EqualsAndHashCode; import lombok.ToString; package com.md_5.fondue.protocol.packet; @ToString @EqualsAndHashCode(callSuper = false) public class Packet6SpawnPosition extends Packet { private int x; private int y; private int z; public Packet6SpawnPosition() { } @Override public void read(ByteBuf in) { x = in.readInt(); y = in.readInt(); z = in.readInt(); } @Override public void write(ByteBuf out) { out.writeInt(x); out.writeInt(y); out.writeInt(z); } @Override
public void handle(PacketHandler handler) {
BukkitDevTeam/Fondue
src/main/java/com/md_5/fondue/protocol/packet/Packet37BlockAnimation.java
// Path: src/main/java/com/md_5/fondue/protocol/PacketHandler.java // public abstract class PacketHandler { // // /** // * Method to determine whether this is a server handler, client handler or // * other. // * // * @return the type of method interface this handler should accept // */ // public abstract Class<? extends Annotation> getType(); // // @Server // public void handle(Packet0KeepAlive packet) { // } // // @ServerLogin // public void handle(Packet2Handshake packet) { // } // // @Server // public void handle(Packet3ChatMessage packet) { // } // // @Server // public void handle(Packet7UseEntity packet) { // } // // @Server // public void handle(PacketAFlying packet) { // } // // @Server // public void handle(PacketEDig packet) { // } // // @Server // // public void handle(PacketFPlace packet){} // // @Server // public void handle(Packet10HeldItem packet) { // } // // @Server // public void handle(Packet12Animation packet) { // } // // @Server // public void handle(Packet13EntityAction packet) { // } // // @Server // // public void handle(Packet66WindowClick packet){} // // @Server // public void handle(Packet6AConfirmTransaction packet) { // } // // @Server // public void handle(Packet6CEnchantItem packet) { // } // // @Server // public void handle(Packet82UpdateSign packet) { // } // // // @Server // // public void handle(Packet6BSlot); // @Server // public void handle(PacketCAPlayerAbilities packet) { // } // // @Server // public void handle(PacketCBTabComplete packet) { // } // // @Server // public void handle(PacketCCClientInfo packet) { // } // // @Server // @ServerLogin // public void handle(PacketCDClientStatus packet) { // } // // @Server // public void handle(PacketFAPluginMessage packet) { // } // // @ServerLogin // public void handle(PacketFCKeyResponse packet) { // } // // @ServerLogin // public void handle(PacketFEServerPing packet) { // } // // @Server // public void handle(PacketFFDisconnect packet) { // } // // /** // * Methods denoted by this annotation should be handled by a server // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Server { // } // // /** // * Methods denoted by this annotation should be handled by the initial // * server implementation of this class. // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface ServerLogin { // } // // /** // * Methods denoted by this method annotation be handled by a client // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Client { // } // }
import com.md_5.fondue.protocol.PacketHandler; import io.netty.buffer.ByteBuf; import lombok.EqualsAndHashCode; import lombok.ToString;
package com.md_5.fondue.protocol.packet; @ToString @EqualsAndHashCode(callSuper = false) public class Packet37BlockAnimation extends Packet1EEntity { private int x; private int y; private int z; private byte stage; public Packet37BlockAnimation() { } @Override public void read(ByteBuf in) { super.read(in); x = in.readInt(); y = in.readInt(); z = in.readInt(); stage = in.readByte(); } @Override public void write(ByteBuf out) { super.write(out); out.writeInt(x); out.writeInt(y); out.writeInt(z); out.writeByte(stage); } @Override
// Path: src/main/java/com/md_5/fondue/protocol/PacketHandler.java // public abstract class PacketHandler { // // /** // * Method to determine whether this is a server handler, client handler or // * other. // * // * @return the type of method interface this handler should accept // */ // public abstract Class<? extends Annotation> getType(); // // @Server // public void handle(Packet0KeepAlive packet) { // } // // @ServerLogin // public void handle(Packet2Handshake packet) { // } // // @Server // public void handle(Packet3ChatMessage packet) { // } // // @Server // public void handle(Packet7UseEntity packet) { // } // // @Server // public void handle(PacketAFlying packet) { // } // // @Server // public void handle(PacketEDig packet) { // } // // @Server // // public void handle(PacketFPlace packet){} // // @Server // public void handle(Packet10HeldItem packet) { // } // // @Server // public void handle(Packet12Animation packet) { // } // // @Server // public void handle(Packet13EntityAction packet) { // } // // @Server // // public void handle(Packet66WindowClick packet){} // // @Server // public void handle(Packet6AConfirmTransaction packet) { // } // // @Server // public void handle(Packet6CEnchantItem packet) { // } // // @Server // public void handle(Packet82UpdateSign packet) { // } // // // @Server // // public void handle(Packet6BSlot); // @Server // public void handle(PacketCAPlayerAbilities packet) { // } // // @Server // public void handle(PacketCBTabComplete packet) { // } // // @Server // public void handle(PacketCCClientInfo packet) { // } // // @Server // @ServerLogin // public void handle(PacketCDClientStatus packet) { // } // // @Server // public void handle(PacketFAPluginMessage packet) { // } // // @ServerLogin // public void handle(PacketFCKeyResponse packet) { // } // // @ServerLogin // public void handle(PacketFEServerPing packet) { // } // // @Server // public void handle(PacketFFDisconnect packet) { // } // // /** // * Methods denoted by this annotation should be handled by a server // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Server { // } // // /** // * Methods denoted by this annotation should be handled by the initial // * server implementation of this class. // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface ServerLogin { // } // // /** // * Methods denoted by this method annotation be handled by a client // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Client { // } // } // Path: src/main/java/com/md_5/fondue/protocol/packet/Packet37BlockAnimation.java import com.md_5.fondue.protocol.PacketHandler; import io.netty.buffer.ByteBuf; import lombok.EqualsAndHashCode; import lombok.ToString; package com.md_5.fondue.protocol.packet; @ToString @EqualsAndHashCode(callSuper = false) public class Packet37BlockAnimation extends Packet1EEntity { private int x; private int y; private int z; private byte stage; public Packet37BlockAnimation() { } @Override public void read(ByteBuf in) { super.read(in); x = in.readInt(); y = in.readInt(); z = in.readInt(); stage = in.readByte(); } @Override public void write(ByteBuf out) { super.write(out); out.writeInt(x); out.writeInt(y); out.writeInt(z); out.writeByte(stage); } @Override
public void handle(PacketHandler handler) {
BukkitDevTeam/Fondue
src/main/java/com/md_5/fondue/protocol/packet/Packet12Animation.java
// Path: src/main/java/com/md_5/fondue/protocol/PacketHandler.java // public abstract class PacketHandler { // // /** // * Method to determine whether this is a server handler, client handler or // * other. // * // * @return the type of method interface this handler should accept // */ // public abstract Class<? extends Annotation> getType(); // // @Server // public void handle(Packet0KeepAlive packet) { // } // // @ServerLogin // public void handle(Packet2Handshake packet) { // } // // @Server // public void handle(Packet3ChatMessage packet) { // } // // @Server // public void handle(Packet7UseEntity packet) { // } // // @Server // public void handle(PacketAFlying packet) { // } // // @Server // public void handle(PacketEDig packet) { // } // // @Server // // public void handle(PacketFPlace packet){} // // @Server // public void handle(Packet10HeldItem packet) { // } // // @Server // public void handle(Packet12Animation packet) { // } // // @Server // public void handle(Packet13EntityAction packet) { // } // // @Server // // public void handle(Packet66WindowClick packet){} // // @Server // public void handle(Packet6AConfirmTransaction packet) { // } // // @Server // public void handle(Packet6CEnchantItem packet) { // } // // @Server // public void handle(Packet82UpdateSign packet) { // } // // // @Server // // public void handle(Packet6BSlot); // @Server // public void handle(PacketCAPlayerAbilities packet) { // } // // @Server // public void handle(PacketCBTabComplete packet) { // } // // @Server // public void handle(PacketCCClientInfo packet) { // } // // @Server // @ServerLogin // public void handle(PacketCDClientStatus packet) { // } // // @Server // public void handle(PacketFAPluginMessage packet) { // } // // @ServerLogin // public void handle(PacketFCKeyResponse packet) { // } // // @ServerLogin // public void handle(PacketFEServerPing packet) { // } // // @Server // public void handle(PacketFFDisconnect packet) { // } // // /** // * Methods denoted by this annotation should be handled by a server // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Server { // } // // /** // * Methods denoted by this annotation should be handled by the initial // * server implementation of this class. // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface ServerLogin { // } // // /** // * Methods denoted by this method annotation be handled by a client // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Client { // } // }
import com.md_5.fondue.protocol.PacketHandler; import io.netty.buffer.ByteBuf; import lombok.EqualsAndHashCode; import lombok.ToString;
package com.md_5.fondue.protocol.packet; @ToString @EqualsAndHashCode(callSuper = false) public class Packet12Animation extends Packet { private int entity; private byte animation; public Packet12Animation() { } @Override public void read(ByteBuf in) { entity = in.readInt(); animation = in.readByte(); } @Override public void write(ByteBuf out) { out.writeInt(entity); out.writeByte(animation); } @Override
// Path: src/main/java/com/md_5/fondue/protocol/PacketHandler.java // public abstract class PacketHandler { // // /** // * Method to determine whether this is a server handler, client handler or // * other. // * // * @return the type of method interface this handler should accept // */ // public abstract Class<? extends Annotation> getType(); // // @Server // public void handle(Packet0KeepAlive packet) { // } // // @ServerLogin // public void handle(Packet2Handshake packet) { // } // // @Server // public void handle(Packet3ChatMessage packet) { // } // // @Server // public void handle(Packet7UseEntity packet) { // } // // @Server // public void handle(PacketAFlying packet) { // } // // @Server // public void handle(PacketEDig packet) { // } // // @Server // // public void handle(PacketFPlace packet){} // // @Server // public void handle(Packet10HeldItem packet) { // } // // @Server // public void handle(Packet12Animation packet) { // } // // @Server // public void handle(Packet13EntityAction packet) { // } // // @Server // // public void handle(Packet66WindowClick packet){} // // @Server // public void handle(Packet6AConfirmTransaction packet) { // } // // @Server // public void handle(Packet6CEnchantItem packet) { // } // // @Server // public void handle(Packet82UpdateSign packet) { // } // // // @Server // // public void handle(Packet6BSlot); // @Server // public void handle(PacketCAPlayerAbilities packet) { // } // // @Server // public void handle(PacketCBTabComplete packet) { // } // // @Server // public void handle(PacketCCClientInfo packet) { // } // // @Server // @ServerLogin // public void handle(PacketCDClientStatus packet) { // } // // @Server // public void handle(PacketFAPluginMessage packet) { // } // // @ServerLogin // public void handle(PacketFCKeyResponse packet) { // } // // @ServerLogin // public void handle(PacketFEServerPing packet) { // } // // @Server // public void handle(PacketFFDisconnect packet) { // } // // /** // * Methods denoted by this annotation should be handled by a server // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Server { // } // // /** // * Methods denoted by this annotation should be handled by the initial // * server implementation of this class. // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface ServerLogin { // } // // /** // * Methods denoted by this method annotation be handled by a client // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Client { // } // } // Path: src/main/java/com/md_5/fondue/protocol/packet/Packet12Animation.java import com.md_5.fondue.protocol.PacketHandler; import io.netty.buffer.ByteBuf; import lombok.EqualsAndHashCode; import lombok.ToString; package com.md_5.fondue.protocol.packet; @ToString @EqualsAndHashCode(callSuper = false) public class Packet12Animation extends Packet { private int entity; private byte animation; public Packet12Animation() { } @Override public void read(ByteBuf in) { entity = in.readInt(); animation = in.readByte(); } @Override public void write(ByteBuf out) { out.writeInt(entity); out.writeByte(animation); } @Override
public void handle(PacketHandler handler) {
BukkitDevTeam/Fondue
src/main/java/com/md_5/fondue/protocol/packet/Packet2Handshake.java
// Path: src/main/java/com/md_5/fondue/protocol/PacketHandler.java // public abstract class PacketHandler { // // /** // * Method to determine whether this is a server handler, client handler or // * other. // * // * @return the type of method interface this handler should accept // */ // public abstract Class<? extends Annotation> getType(); // // @Server // public void handle(Packet0KeepAlive packet) { // } // // @ServerLogin // public void handle(Packet2Handshake packet) { // } // // @Server // public void handle(Packet3ChatMessage packet) { // } // // @Server // public void handle(Packet7UseEntity packet) { // } // // @Server // public void handle(PacketAFlying packet) { // } // // @Server // public void handle(PacketEDig packet) { // } // // @Server // // public void handle(PacketFPlace packet){} // // @Server // public void handle(Packet10HeldItem packet) { // } // // @Server // public void handle(Packet12Animation packet) { // } // // @Server // public void handle(Packet13EntityAction packet) { // } // // @Server // // public void handle(Packet66WindowClick packet){} // // @Server // public void handle(Packet6AConfirmTransaction packet) { // } // // @Server // public void handle(Packet6CEnchantItem packet) { // } // // @Server // public void handle(Packet82UpdateSign packet) { // } // // // @Server // // public void handle(Packet6BSlot); // @Server // public void handle(PacketCAPlayerAbilities packet) { // } // // @Server // public void handle(PacketCBTabComplete packet) { // } // // @Server // public void handle(PacketCCClientInfo packet) { // } // // @Server // @ServerLogin // public void handle(PacketCDClientStatus packet) { // } // // @Server // public void handle(PacketFAPluginMessage packet) { // } // // @ServerLogin // public void handle(PacketFCKeyResponse packet) { // } // // @ServerLogin // public void handle(PacketFEServerPing packet) { // } // // @Server // public void handle(PacketFFDisconnect packet) { // } // // /** // * Methods denoted by this annotation should be handled by a server // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Server { // } // // /** // * Methods denoted by this annotation should be handled by the initial // * server implementation of this class. // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface ServerLogin { // } // // /** // * Methods denoted by this method annotation be handled by a client // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Client { // } // }
import com.md_5.fondue.protocol.PacketHandler; import io.netty.buffer.ByteBuf; import lombok.EqualsAndHashCode; import lombok.ToString;
package com.md_5.fondue.protocol.packet; @ToString @EqualsAndHashCode(callSuper = false) public class Packet2Handshake extends Packet { private byte version; private String username; private String host; private int port; public Packet2Handshake() { } @Override public void read(ByteBuf in) { version = in.readByte(); username = readString(in); host = readString(in); port = in.readInt(); } @Override public void write(ByteBuf out) { out.writeByte(version); writeString(out, username); writeString(out, host); out.writeInt(port); } @Override
// Path: src/main/java/com/md_5/fondue/protocol/PacketHandler.java // public abstract class PacketHandler { // // /** // * Method to determine whether this is a server handler, client handler or // * other. // * // * @return the type of method interface this handler should accept // */ // public abstract Class<? extends Annotation> getType(); // // @Server // public void handle(Packet0KeepAlive packet) { // } // // @ServerLogin // public void handle(Packet2Handshake packet) { // } // // @Server // public void handle(Packet3ChatMessage packet) { // } // // @Server // public void handle(Packet7UseEntity packet) { // } // // @Server // public void handle(PacketAFlying packet) { // } // // @Server // public void handle(PacketEDig packet) { // } // // @Server // // public void handle(PacketFPlace packet){} // // @Server // public void handle(Packet10HeldItem packet) { // } // // @Server // public void handle(Packet12Animation packet) { // } // // @Server // public void handle(Packet13EntityAction packet) { // } // // @Server // // public void handle(Packet66WindowClick packet){} // // @Server // public void handle(Packet6AConfirmTransaction packet) { // } // // @Server // public void handle(Packet6CEnchantItem packet) { // } // // @Server // public void handle(Packet82UpdateSign packet) { // } // // // @Server // // public void handle(Packet6BSlot); // @Server // public void handle(PacketCAPlayerAbilities packet) { // } // // @Server // public void handle(PacketCBTabComplete packet) { // } // // @Server // public void handle(PacketCCClientInfo packet) { // } // // @Server // @ServerLogin // public void handle(PacketCDClientStatus packet) { // } // // @Server // public void handle(PacketFAPluginMessage packet) { // } // // @ServerLogin // public void handle(PacketFCKeyResponse packet) { // } // // @ServerLogin // public void handle(PacketFEServerPing packet) { // } // // @Server // public void handle(PacketFFDisconnect packet) { // } // // /** // * Methods denoted by this annotation should be handled by a server // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Server { // } // // /** // * Methods denoted by this annotation should be handled by the initial // * server implementation of this class. // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface ServerLogin { // } // // /** // * Methods denoted by this method annotation be handled by a client // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Client { // } // } // Path: src/main/java/com/md_5/fondue/protocol/packet/Packet2Handshake.java import com.md_5.fondue.protocol.PacketHandler; import io.netty.buffer.ByteBuf; import lombok.EqualsAndHashCode; import lombok.ToString; package com.md_5.fondue.protocol.packet; @ToString @EqualsAndHashCode(callSuper = false) public class Packet2Handshake extends Packet { private byte version; private String username; private String host; private int port; public Packet2Handshake() { } @Override public void read(ByteBuf in) { version = in.readByte(); username = readString(in); host = readString(in); port = in.readInt(); } @Override public void write(ByteBuf out) { out.writeByte(version); writeString(out, username); writeString(out, host); out.writeInt(port); } @Override
public void handle(PacketHandler handler) {
BukkitDevTeam/Fondue
src/main/java/com/md_5/fondue/protocol/packet/Packet64OpenWindow.java
// Path: src/main/java/com/md_5/fondue/protocol/PacketHandler.java // public abstract class PacketHandler { // // /** // * Method to determine whether this is a server handler, client handler or // * other. // * // * @return the type of method interface this handler should accept // */ // public abstract Class<? extends Annotation> getType(); // // @Server // public void handle(Packet0KeepAlive packet) { // } // // @ServerLogin // public void handle(Packet2Handshake packet) { // } // // @Server // public void handle(Packet3ChatMessage packet) { // } // // @Server // public void handle(Packet7UseEntity packet) { // } // // @Server // public void handle(PacketAFlying packet) { // } // // @Server // public void handle(PacketEDig packet) { // } // // @Server // // public void handle(PacketFPlace packet){} // // @Server // public void handle(Packet10HeldItem packet) { // } // // @Server // public void handle(Packet12Animation packet) { // } // // @Server // public void handle(Packet13EntityAction packet) { // } // // @Server // // public void handle(Packet66WindowClick packet){} // // @Server // public void handle(Packet6AConfirmTransaction packet) { // } // // @Server // public void handle(Packet6CEnchantItem packet) { // } // // @Server // public void handle(Packet82UpdateSign packet) { // } // // // @Server // // public void handle(Packet6BSlot); // @Server // public void handle(PacketCAPlayerAbilities packet) { // } // // @Server // public void handle(PacketCBTabComplete packet) { // } // // @Server // public void handle(PacketCCClientInfo packet) { // } // // @Server // @ServerLogin // public void handle(PacketCDClientStatus packet) { // } // // @Server // public void handle(PacketFAPluginMessage packet) { // } // // @ServerLogin // public void handle(PacketFCKeyResponse packet) { // } // // @ServerLogin // public void handle(PacketFEServerPing packet) { // } // // @Server // public void handle(PacketFFDisconnect packet) { // } // // /** // * Methods denoted by this annotation should be handled by a server // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Server { // } // // /** // * Methods denoted by this annotation should be handled by the initial // * server implementation of this class. // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface ServerLogin { // } // // /** // * Methods denoted by this method annotation be handled by a client // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Client { // } // }
import com.md_5.fondue.protocol.PacketHandler; import io.netty.buffer.ByteBuf; import lombok.EqualsAndHashCode; import lombok.ToString;
package com.md_5.fondue.protocol.packet; @ToString @EqualsAndHashCode(callSuper = false) public class Packet64OpenWindow extends Packet { private byte windowId; private byte inventoryType; private String windowTitle; private byte slotCount; public Packet64OpenWindow() { } @Override public void read(ByteBuf in) { windowId = in.readByte(); inventoryType = in.readByte(); windowTitle = readString(in); slotCount = in.readByte(); } @Override public void write(ByteBuf out) { out.writeByte(windowId); out.writeByte(inventoryType); writeString(out, windowTitle); out.writeByte(slotCount); } @Override
// Path: src/main/java/com/md_5/fondue/protocol/PacketHandler.java // public abstract class PacketHandler { // // /** // * Method to determine whether this is a server handler, client handler or // * other. // * // * @return the type of method interface this handler should accept // */ // public abstract Class<? extends Annotation> getType(); // // @Server // public void handle(Packet0KeepAlive packet) { // } // // @ServerLogin // public void handle(Packet2Handshake packet) { // } // // @Server // public void handle(Packet3ChatMessage packet) { // } // // @Server // public void handle(Packet7UseEntity packet) { // } // // @Server // public void handle(PacketAFlying packet) { // } // // @Server // public void handle(PacketEDig packet) { // } // // @Server // // public void handle(PacketFPlace packet){} // // @Server // public void handle(Packet10HeldItem packet) { // } // // @Server // public void handle(Packet12Animation packet) { // } // // @Server // public void handle(Packet13EntityAction packet) { // } // // @Server // // public void handle(Packet66WindowClick packet){} // // @Server // public void handle(Packet6AConfirmTransaction packet) { // } // // @Server // public void handle(Packet6CEnchantItem packet) { // } // // @Server // public void handle(Packet82UpdateSign packet) { // } // // // @Server // // public void handle(Packet6BSlot); // @Server // public void handle(PacketCAPlayerAbilities packet) { // } // // @Server // public void handle(PacketCBTabComplete packet) { // } // // @Server // public void handle(PacketCCClientInfo packet) { // } // // @Server // @ServerLogin // public void handle(PacketCDClientStatus packet) { // } // // @Server // public void handle(PacketFAPluginMessage packet) { // } // // @ServerLogin // public void handle(PacketFCKeyResponse packet) { // } // // @ServerLogin // public void handle(PacketFEServerPing packet) { // } // // @Server // public void handle(PacketFFDisconnect packet) { // } // // /** // * Methods denoted by this annotation should be handled by a server // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Server { // } // // /** // * Methods denoted by this annotation should be handled by the initial // * server implementation of this class. // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface ServerLogin { // } // // /** // * Methods denoted by this method annotation be handled by a client // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Client { // } // } // Path: src/main/java/com/md_5/fondue/protocol/packet/Packet64OpenWindow.java import com.md_5.fondue.protocol.PacketHandler; import io.netty.buffer.ByteBuf; import lombok.EqualsAndHashCode; import lombok.ToString; package com.md_5.fondue.protocol.packet; @ToString @EqualsAndHashCode(callSuper = false) public class Packet64OpenWindow extends Packet { private byte windowId; private byte inventoryType; private String windowTitle; private byte slotCount; public Packet64OpenWindow() { } @Override public void read(ByteBuf in) { windowId = in.readByte(); inventoryType = in.readByte(); windowTitle = readString(in); slotCount = in.readByte(); } @Override public void write(ByteBuf out) { out.writeByte(windowId); out.writeByte(inventoryType); writeString(out, windowTitle); out.writeByte(slotCount); } @Override
public void handle(PacketHandler handler) {
BukkitDevTeam/Fondue
src/main/java/com/md_5/fondue/protocol/packet/PacketAFlying.java
// Path: src/main/java/com/md_5/fondue/protocol/PacketHandler.java // public abstract class PacketHandler { // // /** // * Method to determine whether this is a server handler, client handler or // * other. // * // * @return the type of method interface this handler should accept // */ // public abstract Class<? extends Annotation> getType(); // // @Server // public void handle(Packet0KeepAlive packet) { // } // // @ServerLogin // public void handle(Packet2Handshake packet) { // } // // @Server // public void handle(Packet3ChatMessage packet) { // } // // @Server // public void handle(Packet7UseEntity packet) { // } // // @Server // public void handle(PacketAFlying packet) { // } // // @Server // public void handle(PacketEDig packet) { // } // // @Server // // public void handle(PacketFPlace packet){} // // @Server // public void handle(Packet10HeldItem packet) { // } // // @Server // public void handle(Packet12Animation packet) { // } // // @Server // public void handle(Packet13EntityAction packet) { // } // // @Server // // public void handle(Packet66WindowClick packet){} // // @Server // public void handle(Packet6AConfirmTransaction packet) { // } // // @Server // public void handle(Packet6CEnchantItem packet) { // } // // @Server // public void handle(Packet82UpdateSign packet) { // } // // // @Server // // public void handle(Packet6BSlot); // @Server // public void handle(PacketCAPlayerAbilities packet) { // } // // @Server // public void handle(PacketCBTabComplete packet) { // } // // @Server // public void handle(PacketCCClientInfo packet) { // } // // @Server // @ServerLogin // public void handle(PacketCDClientStatus packet) { // } // // @Server // public void handle(PacketFAPluginMessage packet) { // } // // @ServerLogin // public void handle(PacketFCKeyResponse packet) { // } // // @ServerLogin // public void handle(PacketFEServerPing packet) { // } // // @Server // public void handle(PacketFFDisconnect packet) { // } // // /** // * Methods denoted by this annotation should be handled by a server // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Server { // } // // /** // * Methods denoted by this annotation should be handled by the initial // * server implementation of this class. // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface ServerLogin { // } // // /** // * Methods denoted by this method annotation be handled by a client // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Client { // } // }
import com.md_5.fondue.protocol.PacketHandler; import io.netty.buffer.ByteBuf; import lombok.EqualsAndHashCode; import lombok.ToString;
package com.md_5.fondue.protocol.packet; @ToString @EqualsAndHashCode(callSuper = false) public class PacketAFlying extends Packet { protected boolean hasLocation; protected boolean hasLook; // protected boolean onGround; protected double x; protected double y; protected double stance; protected double z; protected float yaw; protected float pitch; public PacketAFlying() { } @Override public void read(ByteBuf in) { onGround = in.readBoolean(); } @Override public void write(ByteBuf out) { out.writeBoolean(onGround); } @Override
// Path: src/main/java/com/md_5/fondue/protocol/PacketHandler.java // public abstract class PacketHandler { // // /** // * Method to determine whether this is a server handler, client handler or // * other. // * // * @return the type of method interface this handler should accept // */ // public abstract Class<? extends Annotation> getType(); // // @Server // public void handle(Packet0KeepAlive packet) { // } // // @ServerLogin // public void handle(Packet2Handshake packet) { // } // // @Server // public void handle(Packet3ChatMessage packet) { // } // // @Server // public void handle(Packet7UseEntity packet) { // } // // @Server // public void handle(PacketAFlying packet) { // } // // @Server // public void handle(PacketEDig packet) { // } // // @Server // // public void handle(PacketFPlace packet){} // // @Server // public void handle(Packet10HeldItem packet) { // } // // @Server // public void handle(Packet12Animation packet) { // } // // @Server // public void handle(Packet13EntityAction packet) { // } // // @Server // // public void handle(Packet66WindowClick packet){} // // @Server // public void handle(Packet6AConfirmTransaction packet) { // } // // @Server // public void handle(Packet6CEnchantItem packet) { // } // // @Server // public void handle(Packet82UpdateSign packet) { // } // // // @Server // // public void handle(Packet6BSlot); // @Server // public void handle(PacketCAPlayerAbilities packet) { // } // // @Server // public void handle(PacketCBTabComplete packet) { // } // // @Server // public void handle(PacketCCClientInfo packet) { // } // // @Server // @ServerLogin // public void handle(PacketCDClientStatus packet) { // } // // @Server // public void handle(PacketFAPluginMessage packet) { // } // // @ServerLogin // public void handle(PacketFCKeyResponse packet) { // } // // @ServerLogin // public void handle(PacketFEServerPing packet) { // } // // @Server // public void handle(PacketFFDisconnect packet) { // } // // /** // * Methods denoted by this annotation should be handled by a server // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Server { // } // // /** // * Methods denoted by this annotation should be handled by the initial // * server implementation of this class. // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface ServerLogin { // } // // /** // * Methods denoted by this method annotation be handled by a client // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Client { // } // } // Path: src/main/java/com/md_5/fondue/protocol/packet/PacketAFlying.java import com.md_5.fondue.protocol.PacketHandler; import io.netty.buffer.ByteBuf; import lombok.EqualsAndHashCode; import lombok.ToString; package com.md_5.fondue.protocol.packet; @ToString @EqualsAndHashCode(callSuper = false) public class PacketAFlying extends Packet { protected boolean hasLocation; protected boolean hasLook; // protected boolean onGround; protected double x; protected double y; protected double stance; protected double z; protected float yaw; protected float pitch; public PacketAFlying() { } @Override public void read(ByteBuf in) { onGround = in.readBoolean(); } @Override public void write(ByteBuf out) { out.writeBoolean(onGround); } @Override
public void handle(PacketHandler handler) {
BukkitDevTeam/Fondue
src/main/java/com/md_5/fondue/protocol/packet/Packet15DroppedItem.java
// Path: src/main/java/com/md_5/fondue/protocol/PacketHandler.java // public abstract class PacketHandler { // // /** // * Method to determine whether this is a server handler, client handler or // * other. // * // * @return the type of method interface this handler should accept // */ // public abstract Class<? extends Annotation> getType(); // // @Server // public void handle(Packet0KeepAlive packet) { // } // // @ServerLogin // public void handle(Packet2Handshake packet) { // } // // @Server // public void handle(Packet3ChatMessage packet) { // } // // @Server // public void handle(Packet7UseEntity packet) { // } // // @Server // public void handle(PacketAFlying packet) { // } // // @Server // public void handle(PacketEDig packet) { // } // // @Server // // public void handle(PacketFPlace packet){} // // @Server // public void handle(Packet10HeldItem packet) { // } // // @Server // public void handle(Packet12Animation packet) { // } // // @Server // public void handle(Packet13EntityAction packet) { // } // // @Server // // public void handle(Packet66WindowClick packet){} // // @Server // public void handle(Packet6AConfirmTransaction packet) { // } // // @Server // public void handle(Packet6CEnchantItem packet) { // } // // @Server // public void handle(Packet82UpdateSign packet) { // } // // // @Server // // public void handle(Packet6BSlot); // @Server // public void handle(PacketCAPlayerAbilities packet) { // } // // @Server // public void handle(PacketCBTabComplete packet) { // } // // @Server // public void handle(PacketCCClientInfo packet) { // } // // @Server // @ServerLogin // public void handle(PacketCDClientStatus packet) { // } // // @Server // public void handle(PacketFAPluginMessage packet) { // } // // @ServerLogin // public void handle(PacketFCKeyResponse packet) { // } // // @ServerLogin // public void handle(PacketFEServerPing packet) { // } // // @Server // public void handle(PacketFFDisconnect packet) { // } // // /** // * Methods denoted by this annotation should be handled by a server // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Server { // } // // /** // * Methods denoted by this annotation should be handled by the initial // * server implementation of this class. // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface ServerLogin { // } // // /** // * Methods denoted by this method annotation be handled by a client // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Client { // } // }
import com.md_5.fondue.protocol.PacketHandler; import io.netty.buffer.ByteBuf; import lombok.EqualsAndHashCode; import lombok.ToString;
@Override public void read(ByteBuf in) { super.read(in); itemId = in.readShort(); count = in.readByte(); damage = in.readShort(); x = in.readInt(); y = in.readInt(); z = in.readInt(); rotation = in.readByte(); pitch = in.readByte(); roll = in.readByte(); } @Override public void write(ByteBuf out) { super.write(out); out.writeShort(itemId); out.writeByte(count); out.writeShort(damage); out.writeInt(x); out.writeInt(y); out.writeInt(z); out.writeByte(rotation); out.writeByte(pitch); out.writeByte(roll); } @Override
// Path: src/main/java/com/md_5/fondue/protocol/PacketHandler.java // public abstract class PacketHandler { // // /** // * Method to determine whether this is a server handler, client handler or // * other. // * // * @return the type of method interface this handler should accept // */ // public abstract Class<? extends Annotation> getType(); // // @Server // public void handle(Packet0KeepAlive packet) { // } // // @ServerLogin // public void handle(Packet2Handshake packet) { // } // // @Server // public void handle(Packet3ChatMessage packet) { // } // // @Server // public void handle(Packet7UseEntity packet) { // } // // @Server // public void handle(PacketAFlying packet) { // } // // @Server // public void handle(PacketEDig packet) { // } // // @Server // // public void handle(PacketFPlace packet){} // // @Server // public void handle(Packet10HeldItem packet) { // } // // @Server // public void handle(Packet12Animation packet) { // } // // @Server // public void handle(Packet13EntityAction packet) { // } // // @Server // // public void handle(Packet66WindowClick packet){} // // @Server // public void handle(Packet6AConfirmTransaction packet) { // } // // @Server // public void handle(Packet6CEnchantItem packet) { // } // // @Server // public void handle(Packet82UpdateSign packet) { // } // // // @Server // // public void handle(Packet6BSlot); // @Server // public void handle(PacketCAPlayerAbilities packet) { // } // // @Server // public void handle(PacketCBTabComplete packet) { // } // // @Server // public void handle(PacketCCClientInfo packet) { // } // // @Server // @ServerLogin // public void handle(PacketCDClientStatus packet) { // } // // @Server // public void handle(PacketFAPluginMessage packet) { // } // // @ServerLogin // public void handle(PacketFCKeyResponse packet) { // } // // @ServerLogin // public void handle(PacketFEServerPing packet) { // } // // @Server // public void handle(PacketFFDisconnect packet) { // } // // /** // * Methods denoted by this annotation should be handled by a server // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Server { // } // // /** // * Methods denoted by this annotation should be handled by the initial // * server implementation of this class. // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface ServerLogin { // } // // /** // * Methods denoted by this method annotation be handled by a client // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Client { // } // } // Path: src/main/java/com/md_5/fondue/protocol/packet/Packet15DroppedItem.java import com.md_5.fondue.protocol.PacketHandler; import io.netty.buffer.ByteBuf; import lombok.EqualsAndHashCode; import lombok.ToString; @Override public void read(ByteBuf in) { super.read(in); itemId = in.readShort(); count = in.readByte(); damage = in.readShort(); x = in.readInt(); y = in.readInt(); z = in.readInt(); rotation = in.readByte(); pitch = in.readByte(); roll = in.readByte(); } @Override public void write(ByteBuf out) { super.write(out); out.writeShort(itemId); out.writeByte(count); out.writeShort(damage); out.writeInt(x); out.writeInt(y); out.writeInt(z); out.writeByte(rotation); out.writeByte(pitch); out.writeByte(roll); } @Override
public void handle(PacketHandler handler) {
BukkitDevTeam/Fondue
src/main/java/com/md_5/fondue/protocol/packet/Packet8Health.java
// Path: src/main/java/com/md_5/fondue/protocol/PacketHandler.java // public abstract class PacketHandler { // // /** // * Method to determine whether this is a server handler, client handler or // * other. // * // * @return the type of method interface this handler should accept // */ // public abstract Class<? extends Annotation> getType(); // // @Server // public void handle(Packet0KeepAlive packet) { // } // // @ServerLogin // public void handle(Packet2Handshake packet) { // } // // @Server // public void handle(Packet3ChatMessage packet) { // } // // @Server // public void handle(Packet7UseEntity packet) { // } // // @Server // public void handle(PacketAFlying packet) { // } // // @Server // public void handle(PacketEDig packet) { // } // // @Server // // public void handle(PacketFPlace packet){} // // @Server // public void handle(Packet10HeldItem packet) { // } // // @Server // public void handle(Packet12Animation packet) { // } // // @Server // public void handle(Packet13EntityAction packet) { // } // // @Server // // public void handle(Packet66WindowClick packet){} // // @Server // public void handle(Packet6AConfirmTransaction packet) { // } // // @Server // public void handle(Packet6CEnchantItem packet) { // } // // @Server // public void handle(Packet82UpdateSign packet) { // } // // // @Server // // public void handle(Packet6BSlot); // @Server // public void handle(PacketCAPlayerAbilities packet) { // } // // @Server // public void handle(PacketCBTabComplete packet) { // } // // @Server // public void handle(PacketCCClientInfo packet) { // } // // @Server // @ServerLogin // public void handle(PacketCDClientStatus packet) { // } // // @Server // public void handle(PacketFAPluginMessage packet) { // } // // @ServerLogin // public void handle(PacketFCKeyResponse packet) { // } // // @ServerLogin // public void handle(PacketFEServerPing packet) { // } // // @Server // public void handle(PacketFFDisconnect packet) { // } // // /** // * Methods denoted by this annotation should be handled by a server // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Server { // } // // /** // * Methods denoted by this annotation should be handled by the initial // * server implementation of this class. // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface ServerLogin { // } // // /** // * Methods denoted by this method annotation be handled by a client // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Client { // } // }
import com.md_5.fondue.protocol.PacketHandler; import io.netty.buffer.ByteBuf; import lombok.EqualsAndHashCode; import lombok.ToString;
package com.md_5.fondue.protocol.packet; @ToString @EqualsAndHashCode(callSuper = false) public class Packet8Health extends Packet { private short health; private short food; private float saturation; public Packet8Health() { } @Override public void read(ByteBuf in) { health = in.readShort(); food = in.readShort(); saturation = in.readFloat(); } @Override public void write(ByteBuf out) { out.writeShort(health); out.writeShort(food); out.writeFloat(saturation); } @Override
// Path: src/main/java/com/md_5/fondue/protocol/PacketHandler.java // public abstract class PacketHandler { // // /** // * Method to determine whether this is a server handler, client handler or // * other. // * // * @return the type of method interface this handler should accept // */ // public abstract Class<? extends Annotation> getType(); // // @Server // public void handle(Packet0KeepAlive packet) { // } // // @ServerLogin // public void handle(Packet2Handshake packet) { // } // // @Server // public void handle(Packet3ChatMessage packet) { // } // // @Server // public void handle(Packet7UseEntity packet) { // } // // @Server // public void handle(PacketAFlying packet) { // } // // @Server // public void handle(PacketEDig packet) { // } // // @Server // // public void handle(PacketFPlace packet){} // // @Server // public void handle(Packet10HeldItem packet) { // } // // @Server // public void handle(Packet12Animation packet) { // } // // @Server // public void handle(Packet13EntityAction packet) { // } // // @Server // // public void handle(Packet66WindowClick packet){} // // @Server // public void handle(Packet6AConfirmTransaction packet) { // } // // @Server // public void handle(Packet6CEnchantItem packet) { // } // // @Server // public void handle(Packet82UpdateSign packet) { // } // // // @Server // // public void handle(Packet6BSlot); // @Server // public void handle(PacketCAPlayerAbilities packet) { // } // // @Server // public void handle(PacketCBTabComplete packet) { // } // // @Server // public void handle(PacketCCClientInfo packet) { // } // // @Server // @ServerLogin // public void handle(PacketCDClientStatus packet) { // } // // @Server // public void handle(PacketFAPluginMessage packet) { // } // // @ServerLogin // public void handle(PacketFCKeyResponse packet) { // } // // @ServerLogin // public void handle(PacketFEServerPing packet) { // } // // @Server // public void handle(PacketFFDisconnect packet) { // } // // /** // * Methods denoted by this annotation should be handled by a server // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Server { // } // // /** // * Methods denoted by this annotation should be handled by the initial // * server implementation of this class. // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface ServerLogin { // } // // /** // * Methods denoted by this method annotation be handled by a client // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Client { // } // } // Path: src/main/java/com/md_5/fondue/protocol/packet/Packet8Health.java import com.md_5.fondue.protocol.PacketHandler; import io.netty.buffer.ByteBuf; import lombok.EqualsAndHashCode; import lombok.ToString; package com.md_5.fondue.protocol.packet; @ToString @EqualsAndHashCode(callSuper = false) public class Packet8Health extends Packet { private short health; private short food; private float saturation; public Packet8Health() { } @Override public void read(ByteBuf in) { health = in.readShort(); food = in.readShort(); saturation = in.readFloat(); } @Override public void write(ByteBuf out) { out.writeShort(health); out.writeShort(food); out.writeFloat(saturation); } @Override
public void handle(PacketHandler handler) {
BukkitDevTeam/Fondue
src/main/java/com/md_5/fondue/protocol/packet/Packet13EntityAction.java
// Path: src/main/java/com/md_5/fondue/protocol/PacketHandler.java // public abstract class PacketHandler { // // /** // * Method to determine whether this is a server handler, client handler or // * other. // * // * @return the type of method interface this handler should accept // */ // public abstract Class<? extends Annotation> getType(); // // @Server // public void handle(Packet0KeepAlive packet) { // } // // @ServerLogin // public void handle(Packet2Handshake packet) { // } // // @Server // public void handle(Packet3ChatMessage packet) { // } // // @Server // public void handle(Packet7UseEntity packet) { // } // // @Server // public void handle(PacketAFlying packet) { // } // // @Server // public void handle(PacketEDig packet) { // } // // @Server // // public void handle(PacketFPlace packet){} // // @Server // public void handle(Packet10HeldItem packet) { // } // // @Server // public void handle(Packet12Animation packet) { // } // // @Server // public void handle(Packet13EntityAction packet) { // } // // @Server // // public void handle(Packet66WindowClick packet){} // // @Server // public void handle(Packet6AConfirmTransaction packet) { // } // // @Server // public void handle(Packet6CEnchantItem packet) { // } // // @Server // public void handle(Packet82UpdateSign packet) { // } // // // @Server // // public void handle(Packet6BSlot); // @Server // public void handle(PacketCAPlayerAbilities packet) { // } // // @Server // public void handle(PacketCBTabComplete packet) { // } // // @Server // public void handle(PacketCCClientInfo packet) { // } // // @Server // @ServerLogin // public void handle(PacketCDClientStatus packet) { // } // // @Server // public void handle(PacketFAPluginMessage packet) { // } // // @ServerLogin // public void handle(PacketFCKeyResponse packet) { // } // // @ServerLogin // public void handle(PacketFEServerPing packet) { // } // // @Server // public void handle(PacketFFDisconnect packet) { // } // // /** // * Methods denoted by this annotation should be handled by a server // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Server { // } // // /** // * Methods denoted by this annotation should be handled by the initial // * server implementation of this class. // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface ServerLogin { // } // // /** // * Methods denoted by this method annotation be handled by a client // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Client { // } // }
import com.md_5.fondue.protocol.PacketHandler; import io.netty.buffer.ByteBuf; import lombok.EqualsAndHashCode; import lombok.ToString;
package com.md_5.fondue.protocol.packet; @ToString @EqualsAndHashCode(callSuper = false) public class Packet13EntityAction extends Packet { private int entity; private byte action; public Packet13EntityAction() { } @Override public void read(ByteBuf in) { entity = in.readInt(); action = in.readByte(); } @Override public void write(ByteBuf out) { out.writeInt(entity); out.writeByte(action); } @Override
// Path: src/main/java/com/md_5/fondue/protocol/PacketHandler.java // public abstract class PacketHandler { // // /** // * Method to determine whether this is a server handler, client handler or // * other. // * // * @return the type of method interface this handler should accept // */ // public abstract Class<? extends Annotation> getType(); // // @Server // public void handle(Packet0KeepAlive packet) { // } // // @ServerLogin // public void handle(Packet2Handshake packet) { // } // // @Server // public void handle(Packet3ChatMessage packet) { // } // // @Server // public void handle(Packet7UseEntity packet) { // } // // @Server // public void handle(PacketAFlying packet) { // } // // @Server // public void handle(PacketEDig packet) { // } // // @Server // // public void handle(PacketFPlace packet){} // // @Server // public void handle(Packet10HeldItem packet) { // } // // @Server // public void handle(Packet12Animation packet) { // } // // @Server // public void handle(Packet13EntityAction packet) { // } // // @Server // // public void handle(Packet66WindowClick packet){} // // @Server // public void handle(Packet6AConfirmTransaction packet) { // } // // @Server // public void handle(Packet6CEnchantItem packet) { // } // // @Server // public void handle(Packet82UpdateSign packet) { // } // // // @Server // // public void handle(Packet6BSlot); // @Server // public void handle(PacketCAPlayerAbilities packet) { // } // // @Server // public void handle(PacketCBTabComplete packet) { // } // // @Server // public void handle(PacketCCClientInfo packet) { // } // // @Server // @ServerLogin // public void handle(PacketCDClientStatus packet) { // } // // @Server // public void handle(PacketFAPluginMessage packet) { // } // // @ServerLogin // public void handle(PacketFCKeyResponse packet) { // } // // @ServerLogin // public void handle(PacketFEServerPing packet) { // } // // @Server // public void handle(PacketFFDisconnect packet) { // } // // /** // * Methods denoted by this annotation should be handled by a server // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Server { // } // // /** // * Methods denoted by this annotation should be handled by the initial // * server implementation of this class. // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface ServerLogin { // } // // /** // * Methods denoted by this method annotation be handled by a client // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Client { // } // } // Path: src/main/java/com/md_5/fondue/protocol/packet/Packet13EntityAction.java import com.md_5.fondue.protocol.PacketHandler; import io.netty.buffer.ByteBuf; import lombok.EqualsAndHashCode; import lombok.ToString; package com.md_5.fondue.protocol.packet; @ToString @EqualsAndHashCode(callSuper = false) public class Packet13EntityAction extends Packet { private int entity; private byte action; public Packet13EntityAction() { } @Override public void read(ByteBuf in) { entity = in.readInt(); action = in.readByte(); } @Override public void write(ByteBuf out) { out.writeInt(entity); out.writeByte(action); } @Override
public void handle(PacketHandler handler) {
BukkitDevTeam/Fondue
src/main/java/com/md_5/fondue/protocol/packet/Packet82UpdateSign.java
// Path: src/main/java/com/md_5/fondue/protocol/PacketHandler.java // public abstract class PacketHandler { // // /** // * Method to determine whether this is a server handler, client handler or // * other. // * // * @return the type of method interface this handler should accept // */ // public abstract Class<? extends Annotation> getType(); // // @Server // public void handle(Packet0KeepAlive packet) { // } // // @ServerLogin // public void handle(Packet2Handshake packet) { // } // // @Server // public void handle(Packet3ChatMessage packet) { // } // // @Server // public void handle(Packet7UseEntity packet) { // } // // @Server // public void handle(PacketAFlying packet) { // } // // @Server // public void handle(PacketEDig packet) { // } // // @Server // // public void handle(PacketFPlace packet){} // // @Server // public void handle(Packet10HeldItem packet) { // } // // @Server // public void handle(Packet12Animation packet) { // } // // @Server // public void handle(Packet13EntityAction packet) { // } // // @Server // // public void handle(Packet66WindowClick packet){} // // @Server // public void handle(Packet6AConfirmTransaction packet) { // } // // @Server // public void handle(Packet6CEnchantItem packet) { // } // // @Server // public void handle(Packet82UpdateSign packet) { // } // // // @Server // // public void handle(Packet6BSlot); // @Server // public void handle(PacketCAPlayerAbilities packet) { // } // // @Server // public void handle(PacketCBTabComplete packet) { // } // // @Server // public void handle(PacketCCClientInfo packet) { // } // // @Server // @ServerLogin // public void handle(PacketCDClientStatus packet) { // } // // @Server // public void handle(PacketFAPluginMessage packet) { // } // // @ServerLogin // public void handle(PacketFCKeyResponse packet) { // } // // @ServerLogin // public void handle(PacketFEServerPing packet) { // } // // @Server // public void handle(PacketFFDisconnect packet) { // } // // /** // * Methods denoted by this annotation should be handled by a server // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Server { // } // // /** // * Methods denoted by this annotation should be handled by the initial // * server implementation of this class. // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface ServerLogin { // } // // /** // * Methods denoted by this method annotation be handled by a client // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Client { // } // }
import com.md_5.fondue.protocol.PacketHandler; import io.netty.buffer.ByteBuf; import lombok.EqualsAndHashCode; import lombok.ToString;
package com.md_5.fondue.protocol.packet; @ToString @EqualsAndHashCode(callSuper = false) public class Packet82UpdateSign extends Packet { private int x; private short y; private int z; private String[] lines = new String[4]; public Packet82UpdateSign() { } @Override public void read(ByteBuf in) { x = in.readInt(); y = in.readShort(); z = in.readInt(); for (int i = 0; i < lines.length; i++) { lines[i] = readString(in); } } @Override public void write(ByteBuf out) { out.writeInt(x); out.writeShort(y); out.writeInt(z); for (int i = 0; i < lines.length; i++) { writeString(out, lines[i]); } } @Override
// Path: src/main/java/com/md_5/fondue/protocol/PacketHandler.java // public abstract class PacketHandler { // // /** // * Method to determine whether this is a server handler, client handler or // * other. // * // * @return the type of method interface this handler should accept // */ // public abstract Class<? extends Annotation> getType(); // // @Server // public void handle(Packet0KeepAlive packet) { // } // // @ServerLogin // public void handle(Packet2Handshake packet) { // } // // @Server // public void handle(Packet3ChatMessage packet) { // } // // @Server // public void handle(Packet7UseEntity packet) { // } // // @Server // public void handle(PacketAFlying packet) { // } // // @Server // public void handle(PacketEDig packet) { // } // // @Server // // public void handle(PacketFPlace packet){} // // @Server // public void handle(Packet10HeldItem packet) { // } // // @Server // public void handle(Packet12Animation packet) { // } // // @Server // public void handle(Packet13EntityAction packet) { // } // // @Server // // public void handle(Packet66WindowClick packet){} // // @Server // public void handle(Packet6AConfirmTransaction packet) { // } // // @Server // public void handle(Packet6CEnchantItem packet) { // } // // @Server // public void handle(Packet82UpdateSign packet) { // } // // // @Server // // public void handle(Packet6BSlot); // @Server // public void handle(PacketCAPlayerAbilities packet) { // } // // @Server // public void handle(PacketCBTabComplete packet) { // } // // @Server // public void handle(PacketCCClientInfo packet) { // } // // @Server // @ServerLogin // public void handle(PacketCDClientStatus packet) { // } // // @Server // public void handle(PacketFAPluginMessage packet) { // } // // @ServerLogin // public void handle(PacketFCKeyResponse packet) { // } // // @ServerLogin // public void handle(PacketFEServerPing packet) { // } // // @Server // public void handle(PacketFFDisconnect packet) { // } // // /** // * Methods denoted by this annotation should be handled by a server // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Server { // } // // /** // * Methods denoted by this annotation should be handled by the initial // * server implementation of this class. // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface ServerLogin { // } // // /** // * Methods denoted by this method annotation be handled by a client // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Client { // } // } // Path: src/main/java/com/md_5/fondue/protocol/packet/Packet82UpdateSign.java import com.md_5.fondue.protocol.PacketHandler; import io.netty.buffer.ByteBuf; import lombok.EqualsAndHashCode; import lombok.ToString; package com.md_5.fondue.protocol.packet; @ToString @EqualsAndHashCode(callSuper = false) public class Packet82UpdateSign extends Packet { private int x; private short y; private int z; private String[] lines = new String[4]; public Packet82UpdateSign() { } @Override public void read(ByteBuf in) { x = in.readInt(); y = in.readShort(); z = in.readInt(); for (int i = 0; i < lines.length; i++) { lines[i] = readString(in); } } @Override public void write(ByteBuf out) { out.writeInt(x); out.writeShort(y); out.writeInt(z); for (int i = 0; i < lines.length; i++) { writeString(out, lines[i]); } } @Override
public void handle(PacketHandler handler) {
BukkitDevTeam/Fondue
src/main/java/com/md_5/fondue/protocol/packet/Packet6CEnchantItem.java
// Path: src/main/java/com/md_5/fondue/protocol/PacketHandler.java // public abstract class PacketHandler { // // /** // * Method to determine whether this is a server handler, client handler or // * other. // * // * @return the type of method interface this handler should accept // */ // public abstract Class<? extends Annotation> getType(); // // @Server // public void handle(Packet0KeepAlive packet) { // } // // @ServerLogin // public void handle(Packet2Handshake packet) { // } // // @Server // public void handle(Packet3ChatMessage packet) { // } // // @Server // public void handle(Packet7UseEntity packet) { // } // // @Server // public void handle(PacketAFlying packet) { // } // // @Server // public void handle(PacketEDig packet) { // } // // @Server // // public void handle(PacketFPlace packet){} // // @Server // public void handle(Packet10HeldItem packet) { // } // // @Server // public void handle(Packet12Animation packet) { // } // // @Server // public void handle(Packet13EntityAction packet) { // } // // @Server // // public void handle(Packet66WindowClick packet){} // // @Server // public void handle(Packet6AConfirmTransaction packet) { // } // // @Server // public void handle(Packet6CEnchantItem packet) { // } // // @Server // public void handle(Packet82UpdateSign packet) { // } // // // @Server // // public void handle(Packet6BSlot); // @Server // public void handle(PacketCAPlayerAbilities packet) { // } // // @Server // public void handle(PacketCBTabComplete packet) { // } // // @Server // public void handle(PacketCCClientInfo packet) { // } // // @Server // @ServerLogin // public void handle(PacketCDClientStatus packet) { // } // // @Server // public void handle(PacketFAPluginMessage packet) { // } // // @ServerLogin // public void handle(PacketFCKeyResponse packet) { // } // // @ServerLogin // public void handle(PacketFEServerPing packet) { // } // // @Server // public void handle(PacketFFDisconnect packet) { // } // // /** // * Methods denoted by this annotation should be handled by a server // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Server { // } // // /** // * Methods denoted by this annotation should be handled by the initial // * server implementation of this class. // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface ServerLogin { // } // // /** // * Methods denoted by this method annotation be handled by a client // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Client { // } // }
import com.md_5.fondue.protocol.PacketHandler; import io.netty.buffer.ByteBuf; import lombok.EqualsAndHashCode; import lombok.ToString;
package com.md_5.fondue.protocol.packet; @ToString @EqualsAndHashCode(callSuper = false) public class Packet6CEnchantItem extends Packet { private byte windowId; private byte enchantment; public Packet6CEnchantItem() { } @Override public void read(ByteBuf in) { windowId = in.readByte(); enchantment = in.readByte(); } @Override public void write(ByteBuf out) { out.writeByte(windowId); out.writeByte(enchantment); } @Override
// Path: src/main/java/com/md_5/fondue/protocol/PacketHandler.java // public abstract class PacketHandler { // // /** // * Method to determine whether this is a server handler, client handler or // * other. // * // * @return the type of method interface this handler should accept // */ // public abstract Class<? extends Annotation> getType(); // // @Server // public void handle(Packet0KeepAlive packet) { // } // // @ServerLogin // public void handle(Packet2Handshake packet) { // } // // @Server // public void handle(Packet3ChatMessage packet) { // } // // @Server // public void handle(Packet7UseEntity packet) { // } // // @Server // public void handle(PacketAFlying packet) { // } // // @Server // public void handle(PacketEDig packet) { // } // // @Server // // public void handle(PacketFPlace packet){} // // @Server // public void handle(Packet10HeldItem packet) { // } // // @Server // public void handle(Packet12Animation packet) { // } // // @Server // public void handle(Packet13EntityAction packet) { // } // // @Server // // public void handle(Packet66WindowClick packet){} // // @Server // public void handle(Packet6AConfirmTransaction packet) { // } // // @Server // public void handle(Packet6CEnchantItem packet) { // } // // @Server // public void handle(Packet82UpdateSign packet) { // } // // // @Server // // public void handle(Packet6BSlot); // @Server // public void handle(PacketCAPlayerAbilities packet) { // } // // @Server // public void handle(PacketCBTabComplete packet) { // } // // @Server // public void handle(PacketCCClientInfo packet) { // } // // @Server // @ServerLogin // public void handle(PacketCDClientStatus packet) { // } // // @Server // public void handle(PacketFAPluginMessage packet) { // } // // @ServerLogin // public void handle(PacketFCKeyResponse packet) { // } // // @ServerLogin // public void handle(PacketFEServerPing packet) { // } // // @Server // public void handle(PacketFFDisconnect packet) { // } // // /** // * Methods denoted by this annotation should be handled by a server // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Server { // } // // /** // * Methods denoted by this annotation should be handled by the initial // * server implementation of this class. // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface ServerLogin { // } // // /** // * Methods denoted by this method annotation be handled by a client // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Client { // } // } // Path: src/main/java/com/md_5/fondue/protocol/packet/Packet6CEnchantItem.java import com.md_5.fondue.protocol.PacketHandler; import io.netty.buffer.ByteBuf; import lombok.EqualsAndHashCode; import lombok.ToString; package com.md_5.fondue.protocol.packet; @ToString @EqualsAndHashCode(callSuper = false) public class Packet6CEnchantItem extends Packet { private byte windowId; private byte enchantment; public Packet6CEnchantItem() { } @Override public void read(ByteBuf in) { windowId = in.readByte(); enchantment = in.readByte(); } @Override public void write(ByteBuf out) { out.writeByte(windowId); out.writeByte(enchantment); } @Override
public void handle(PacketHandler handler) {
BukkitDevTeam/Fondue
src/main/java/com/md_5/fondue/protocol/packet/PacketCCClientInfo.java
// Path: src/main/java/com/md_5/fondue/protocol/PacketHandler.java // public abstract class PacketHandler { // // /** // * Method to determine whether this is a server handler, client handler or // * other. // * // * @return the type of method interface this handler should accept // */ // public abstract Class<? extends Annotation> getType(); // // @Server // public void handle(Packet0KeepAlive packet) { // } // // @ServerLogin // public void handle(Packet2Handshake packet) { // } // // @Server // public void handle(Packet3ChatMessage packet) { // } // // @Server // public void handle(Packet7UseEntity packet) { // } // // @Server // public void handle(PacketAFlying packet) { // } // // @Server // public void handle(PacketEDig packet) { // } // // @Server // // public void handle(PacketFPlace packet){} // // @Server // public void handle(Packet10HeldItem packet) { // } // // @Server // public void handle(Packet12Animation packet) { // } // // @Server // public void handle(Packet13EntityAction packet) { // } // // @Server // // public void handle(Packet66WindowClick packet){} // // @Server // public void handle(Packet6AConfirmTransaction packet) { // } // // @Server // public void handle(Packet6CEnchantItem packet) { // } // // @Server // public void handle(Packet82UpdateSign packet) { // } // // // @Server // // public void handle(Packet6BSlot); // @Server // public void handle(PacketCAPlayerAbilities packet) { // } // // @Server // public void handle(PacketCBTabComplete packet) { // } // // @Server // public void handle(PacketCCClientInfo packet) { // } // // @Server // @ServerLogin // public void handle(PacketCDClientStatus packet) { // } // // @Server // public void handle(PacketFAPluginMessage packet) { // } // // @ServerLogin // public void handle(PacketFCKeyResponse packet) { // } // // @ServerLogin // public void handle(PacketFEServerPing packet) { // } // // @Server // public void handle(PacketFFDisconnect packet) { // } // // /** // * Methods denoted by this annotation should be handled by a server // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Server { // } // // /** // * Methods denoted by this annotation should be handled by the initial // * server implementation of this class. // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface ServerLogin { // } // // /** // * Methods denoted by this method annotation be handled by a client // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Client { // } // }
import com.md_5.fondue.protocol.PacketHandler; import io.netty.buffer.ByteBuf; import lombok.EqualsAndHashCode; import lombok.ToString;
package com.md_5.fondue.protocol.packet; @ToString @EqualsAndHashCode(callSuper = false) public class PacketCCClientInfo extends Packet { private String locale; private byte viewDistance; private byte chatFlags; private byte difficulty; public PacketCCClientInfo() { } @Override public void read(ByteBuf in) { locale = readString(in); viewDistance = in.readByte(); chatFlags = in.readByte(); difficulty = in.readByte(); } @Override public void write(ByteBuf out) { writeString(out, locale); out.writeByte(viewDistance); out.writeByte(chatFlags); out.writeByte(difficulty); } @Override
// Path: src/main/java/com/md_5/fondue/protocol/PacketHandler.java // public abstract class PacketHandler { // // /** // * Method to determine whether this is a server handler, client handler or // * other. // * // * @return the type of method interface this handler should accept // */ // public abstract Class<? extends Annotation> getType(); // // @Server // public void handle(Packet0KeepAlive packet) { // } // // @ServerLogin // public void handle(Packet2Handshake packet) { // } // // @Server // public void handle(Packet3ChatMessage packet) { // } // // @Server // public void handle(Packet7UseEntity packet) { // } // // @Server // public void handle(PacketAFlying packet) { // } // // @Server // public void handle(PacketEDig packet) { // } // // @Server // // public void handle(PacketFPlace packet){} // // @Server // public void handle(Packet10HeldItem packet) { // } // // @Server // public void handle(Packet12Animation packet) { // } // // @Server // public void handle(Packet13EntityAction packet) { // } // // @Server // // public void handle(Packet66WindowClick packet){} // // @Server // public void handle(Packet6AConfirmTransaction packet) { // } // // @Server // public void handle(Packet6CEnchantItem packet) { // } // // @Server // public void handle(Packet82UpdateSign packet) { // } // // // @Server // // public void handle(Packet6BSlot); // @Server // public void handle(PacketCAPlayerAbilities packet) { // } // // @Server // public void handle(PacketCBTabComplete packet) { // } // // @Server // public void handle(PacketCCClientInfo packet) { // } // // @Server // @ServerLogin // public void handle(PacketCDClientStatus packet) { // } // // @Server // public void handle(PacketFAPluginMessage packet) { // } // // @ServerLogin // public void handle(PacketFCKeyResponse packet) { // } // // @ServerLogin // public void handle(PacketFEServerPing packet) { // } // // @Server // public void handle(PacketFFDisconnect packet) { // } // // /** // * Methods denoted by this annotation should be handled by a server // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Server { // } // // /** // * Methods denoted by this annotation should be handled by the initial // * server implementation of this class. // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface ServerLogin { // } // // /** // * Methods denoted by this method annotation be handled by a client // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Client { // } // } // Path: src/main/java/com/md_5/fondue/protocol/packet/PacketCCClientInfo.java import com.md_5.fondue.protocol.PacketHandler; import io.netty.buffer.ByteBuf; import lombok.EqualsAndHashCode; import lombok.ToString; package com.md_5.fondue.protocol.packet; @ToString @EqualsAndHashCode(callSuper = false) public class PacketCCClientInfo extends Packet { private String locale; private byte viewDistance; private byte chatFlags; private byte difficulty; public PacketCCClientInfo() { } @Override public void read(ByteBuf in) { locale = readString(in); viewDistance = in.readByte(); chatFlags = in.readByte(); difficulty = in.readByte(); } @Override public void write(ByteBuf out) { writeString(out, locale); out.writeByte(viewDistance); out.writeByte(chatFlags); out.writeByte(difficulty); } @Override
public void handle(PacketHandler handler) {
BukkitDevTeam/Fondue
src/main/java/com/md_5/fondue/protocol/packet/Packet29SoundEffect.java
// Path: src/main/java/com/md_5/fondue/protocol/PacketHandler.java // public abstract class PacketHandler { // // /** // * Method to determine whether this is a server handler, client handler or // * other. // * // * @return the type of method interface this handler should accept // */ // public abstract Class<? extends Annotation> getType(); // // @Server // public void handle(Packet0KeepAlive packet) { // } // // @ServerLogin // public void handle(Packet2Handshake packet) { // } // // @Server // public void handle(Packet3ChatMessage packet) { // } // // @Server // public void handle(Packet7UseEntity packet) { // } // // @Server // public void handle(PacketAFlying packet) { // } // // @Server // public void handle(PacketEDig packet) { // } // // @Server // // public void handle(PacketFPlace packet){} // // @Server // public void handle(Packet10HeldItem packet) { // } // // @Server // public void handle(Packet12Animation packet) { // } // // @Server // public void handle(Packet13EntityAction packet) { // } // // @Server // // public void handle(Packet66WindowClick packet){} // // @Server // public void handle(Packet6AConfirmTransaction packet) { // } // // @Server // public void handle(Packet6CEnchantItem packet) { // } // // @Server // public void handle(Packet82UpdateSign packet) { // } // // // @Server // // public void handle(Packet6BSlot); // @Server // public void handle(PacketCAPlayerAbilities packet) { // } // // @Server // public void handle(PacketCBTabComplete packet) { // } // // @Server // public void handle(PacketCCClientInfo packet) { // } // // @Server // @ServerLogin // public void handle(PacketCDClientStatus packet) { // } // // @Server // public void handle(PacketFAPluginMessage packet) { // } // // @ServerLogin // public void handle(PacketFCKeyResponse packet) { // } // // @ServerLogin // public void handle(PacketFEServerPing packet) { // } // // @Server // public void handle(PacketFFDisconnect packet) { // } // // /** // * Methods denoted by this annotation should be handled by a server // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Server { // } // // /** // * Methods denoted by this annotation should be handled by the initial // * server implementation of this class. // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface ServerLogin { // } // // /** // * Methods denoted by this method annotation be handled by a client // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Client { // } // }
import com.md_5.fondue.protocol.PacketHandler; import io.netty.buffer.ByteBuf; import lombok.EqualsAndHashCode; import lombok.ToString;
package com.md_5.fondue.protocol.packet; @ToString @EqualsAndHashCode(callSuper = false) public class Packet29SoundEffect extends Packet1EEntity { private byte effectId; private byte amplifier; private short duration; public Packet29SoundEffect() { } @Override public void read(ByteBuf in) { super.read(in); effectId = in.readByte(); amplifier = in.readByte(); duration = in.readShort(); } @Override public void write(ByteBuf out) { super.write(out); out.writeByte(effectId); out.writeByte(amplifier); out.writeShort(duration); } @Override
// Path: src/main/java/com/md_5/fondue/protocol/PacketHandler.java // public abstract class PacketHandler { // // /** // * Method to determine whether this is a server handler, client handler or // * other. // * // * @return the type of method interface this handler should accept // */ // public abstract Class<? extends Annotation> getType(); // // @Server // public void handle(Packet0KeepAlive packet) { // } // // @ServerLogin // public void handle(Packet2Handshake packet) { // } // // @Server // public void handle(Packet3ChatMessage packet) { // } // // @Server // public void handle(Packet7UseEntity packet) { // } // // @Server // public void handle(PacketAFlying packet) { // } // // @Server // public void handle(PacketEDig packet) { // } // // @Server // // public void handle(PacketFPlace packet){} // // @Server // public void handle(Packet10HeldItem packet) { // } // // @Server // public void handle(Packet12Animation packet) { // } // // @Server // public void handle(Packet13EntityAction packet) { // } // // @Server // // public void handle(Packet66WindowClick packet){} // // @Server // public void handle(Packet6AConfirmTransaction packet) { // } // // @Server // public void handle(Packet6CEnchantItem packet) { // } // // @Server // public void handle(Packet82UpdateSign packet) { // } // // // @Server // // public void handle(Packet6BSlot); // @Server // public void handle(PacketCAPlayerAbilities packet) { // } // // @Server // public void handle(PacketCBTabComplete packet) { // } // // @Server // public void handle(PacketCCClientInfo packet) { // } // // @Server // @ServerLogin // public void handle(PacketCDClientStatus packet) { // } // // @Server // public void handle(PacketFAPluginMessage packet) { // } // // @ServerLogin // public void handle(PacketFCKeyResponse packet) { // } // // @ServerLogin // public void handle(PacketFEServerPing packet) { // } // // @Server // public void handle(PacketFFDisconnect packet) { // } // // /** // * Methods denoted by this annotation should be handled by a server // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Server { // } // // /** // * Methods denoted by this annotation should be handled by the initial // * server implementation of this class. // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface ServerLogin { // } // // /** // * Methods denoted by this method annotation be handled by a client // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Client { // } // } // Path: src/main/java/com/md_5/fondue/protocol/packet/Packet29SoundEffect.java import com.md_5.fondue.protocol.PacketHandler; import io.netty.buffer.ByteBuf; import lombok.EqualsAndHashCode; import lombok.ToString; package com.md_5.fondue.protocol.packet; @ToString @EqualsAndHashCode(callSuper = false) public class Packet29SoundEffect extends Packet1EEntity { private byte effectId; private byte amplifier; private short duration; public Packet29SoundEffect() { } @Override public void read(ByteBuf in) { super.read(in); effectId = in.readByte(); amplifier = in.readByte(); duration = in.readShort(); } @Override public void write(ByteBuf out) { super.write(out); out.writeByte(effectId); out.writeByte(amplifier); out.writeShort(duration); } @Override
public void handle(PacketHandler handler) {
BukkitDevTeam/Fondue
src/main/java/com/md_5/fondue/protocol/packet/PacketCBTabComplete.java
// Path: src/main/java/com/md_5/fondue/protocol/PacketHandler.java // public abstract class PacketHandler { // // /** // * Method to determine whether this is a server handler, client handler or // * other. // * // * @return the type of method interface this handler should accept // */ // public abstract Class<? extends Annotation> getType(); // // @Server // public void handle(Packet0KeepAlive packet) { // } // // @ServerLogin // public void handle(Packet2Handshake packet) { // } // // @Server // public void handle(Packet3ChatMessage packet) { // } // // @Server // public void handle(Packet7UseEntity packet) { // } // // @Server // public void handle(PacketAFlying packet) { // } // // @Server // public void handle(PacketEDig packet) { // } // // @Server // // public void handle(PacketFPlace packet){} // // @Server // public void handle(Packet10HeldItem packet) { // } // // @Server // public void handle(Packet12Animation packet) { // } // // @Server // public void handle(Packet13EntityAction packet) { // } // // @Server // // public void handle(Packet66WindowClick packet){} // // @Server // public void handle(Packet6AConfirmTransaction packet) { // } // // @Server // public void handle(Packet6CEnchantItem packet) { // } // // @Server // public void handle(Packet82UpdateSign packet) { // } // // // @Server // // public void handle(Packet6BSlot); // @Server // public void handle(PacketCAPlayerAbilities packet) { // } // // @Server // public void handle(PacketCBTabComplete packet) { // } // // @Server // public void handle(PacketCCClientInfo packet) { // } // // @Server // @ServerLogin // public void handle(PacketCDClientStatus packet) { // } // // @Server // public void handle(PacketFAPluginMessage packet) { // } // // @ServerLogin // public void handle(PacketFCKeyResponse packet) { // } // // @ServerLogin // public void handle(PacketFEServerPing packet) { // } // // @Server // public void handle(PacketFFDisconnect packet) { // } // // /** // * Methods denoted by this annotation should be handled by a server // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Server { // } // // /** // * Methods denoted by this annotation should be handled by the initial // * server implementation of this class. // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface ServerLogin { // } // // /** // * Methods denoted by this method annotation be handled by a client // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Client { // } // }
import com.md_5.fondue.protocol.PacketHandler; import io.netty.buffer.ByteBuf; import lombok.EqualsAndHashCode; import lombok.ToString;
package com.md_5.fondue.protocol.packet; @ToString @EqualsAndHashCode(callSuper = false) public class PacketCBTabComplete extends Packet { private String text; public PacketCBTabComplete() { } @Override public void read(ByteBuf in) { text = readString(in); } @Override public void write(ByteBuf out) { writeString(out, text); } @Override
// Path: src/main/java/com/md_5/fondue/protocol/PacketHandler.java // public abstract class PacketHandler { // // /** // * Method to determine whether this is a server handler, client handler or // * other. // * // * @return the type of method interface this handler should accept // */ // public abstract Class<? extends Annotation> getType(); // // @Server // public void handle(Packet0KeepAlive packet) { // } // // @ServerLogin // public void handle(Packet2Handshake packet) { // } // // @Server // public void handle(Packet3ChatMessage packet) { // } // // @Server // public void handle(Packet7UseEntity packet) { // } // // @Server // public void handle(PacketAFlying packet) { // } // // @Server // public void handle(PacketEDig packet) { // } // // @Server // // public void handle(PacketFPlace packet){} // // @Server // public void handle(Packet10HeldItem packet) { // } // // @Server // public void handle(Packet12Animation packet) { // } // // @Server // public void handle(Packet13EntityAction packet) { // } // // @Server // // public void handle(Packet66WindowClick packet){} // // @Server // public void handle(Packet6AConfirmTransaction packet) { // } // // @Server // public void handle(Packet6CEnchantItem packet) { // } // // @Server // public void handle(Packet82UpdateSign packet) { // } // // // @Server // // public void handle(Packet6BSlot); // @Server // public void handle(PacketCAPlayerAbilities packet) { // } // // @Server // public void handle(PacketCBTabComplete packet) { // } // // @Server // public void handle(PacketCCClientInfo packet) { // } // // @Server // @ServerLogin // public void handle(PacketCDClientStatus packet) { // } // // @Server // public void handle(PacketFAPluginMessage packet) { // } // // @ServerLogin // public void handle(PacketFCKeyResponse packet) { // } // // @ServerLogin // public void handle(PacketFEServerPing packet) { // } // // @Server // public void handle(PacketFFDisconnect packet) { // } // // /** // * Methods denoted by this annotation should be handled by a server // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Server { // } // // /** // * Methods denoted by this annotation should be handled by the initial // * server implementation of this class. // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface ServerLogin { // } // // /** // * Methods denoted by this method annotation be handled by a client // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Client { // } // } // Path: src/main/java/com/md_5/fondue/protocol/packet/PacketCBTabComplete.java import com.md_5.fondue.protocol.PacketHandler; import io.netty.buffer.ByteBuf; import lombok.EqualsAndHashCode; import lombok.ToString; package com.md_5.fondue.protocol.packet; @ToString @EqualsAndHashCode(callSuper = false) public class PacketCBTabComplete extends Packet { private String text; public PacketCBTabComplete() { } @Override public void read(ByteBuf in) { text = readString(in); } @Override public void write(ByteBuf out) { writeString(out, text); } @Override
public void handle(PacketHandler handler) {
BukkitDevTeam/Fondue
src/main/java/com/md_5/fondue/protocol/packet/Packet9Respawn.java
// Path: src/main/java/com/md_5/fondue/protocol/PacketHandler.java // public abstract class PacketHandler { // // /** // * Method to determine whether this is a server handler, client handler or // * other. // * // * @return the type of method interface this handler should accept // */ // public abstract Class<? extends Annotation> getType(); // // @Server // public void handle(Packet0KeepAlive packet) { // } // // @ServerLogin // public void handle(Packet2Handshake packet) { // } // // @Server // public void handle(Packet3ChatMessage packet) { // } // // @Server // public void handle(Packet7UseEntity packet) { // } // // @Server // public void handle(PacketAFlying packet) { // } // // @Server // public void handle(PacketEDig packet) { // } // // @Server // // public void handle(PacketFPlace packet){} // // @Server // public void handle(Packet10HeldItem packet) { // } // // @Server // public void handle(Packet12Animation packet) { // } // // @Server // public void handle(Packet13EntityAction packet) { // } // // @Server // // public void handle(Packet66WindowClick packet){} // // @Server // public void handle(Packet6AConfirmTransaction packet) { // } // // @Server // public void handle(Packet6CEnchantItem packet) { // } // // @Server // public void handle(Packet82UpdateSign packet) { // } // // // @Server // // public void handle(Packet6BSlot); // @Server // public void handle(PacketCAPlayerAbilities packet) { // } // // @Server // public void handle(PacketCBTabComplete packet) { // } // // @Server // public void handle(PacketCCClientInfo packet) { // } // // @Server // @ServerLogin // public void handle(PacketCDClientStatus packet) { // } // // @Server // public void handle(PacketFAPluginMessage packet) { // } // // @ServerLogin // public void handle(PacketFCKeyResponse packet) { // } // // @ServerLogin // public void handle(PacketFEServerPing packet) { // } // // @Server // public void handle(PacketFFDisconnect packet) { // } // // /** // * Methods denoted by this annotation should be handled by a server // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Server { // } // // /** // * Methods denoted by this annotation should be handled by the initial // * server implementation of this class. // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface ServerLogin { // } // // /** // * Methods denoted by this method annotation be handled by a client // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Client { // } // }
import com.md_5.fondue.protocol.PacketHandler; import io.netty.buffer.ByteBuf; import lombok.EqualsAndHashCode; import lombok.ToString;
package com.md_5.fondue.protocol.packet; @ToString @EqualsAndHashCode(callSuper = false) public class Packet9Respawn extends Packet { private int dimension; private byte difficulty; private byte gameMode; private short worldHeight; private String levelType; public Packet9Respawn() { } @Override public void read(ByteBuf in) { dimension = in.readInt(); difficulty = in.readByte(); gameMode = in.readByte(); worldHeight = in.readShort(); levelType = readString(in); } @Override public void write(ByteBuf out) { out.writeInt(dimension); out.writeByte(difficulty); out.writeByte(gameMode); out.writeShort(worldHeight); writeString(out, levelType); } @Override
// Path: src/main/java/com/md_5/fondue/protocol/PacketHandler.java // public abstract class PacketHandler { // // /** // * Method to determine whether this is a server handler, client handler or // * other. // * // * @return the type of method interface this handler should accept // */ // public abstract Class<? extends Annotation> getType(); // // @Server // public void handle(Packet0KeepAlive packet) { // } // // @ServerLogin // public void handle(Packet2Handshake packet) { // } // // @Server // public void handle(Packet3ChatMessage packet) { // } // // @Server // public void handle(Packet7UseEntity packet) { // } // // @Server // public void handle(PacketAFlying packet) { // } // // @Server // public void handle(PacketEDig packet) { // } // // @Server // // public void handle(PacketFPlace packet){} // // @Server // public void handle(Packet10HeldItem packet) { // } // // @Server // public void handle(Packet12Animation packet) { // } // // @Server // public void handle(Packet13EntityAction packet) { // } // // @Server // // public void handle(Packet66WindowClick packet){} // // @Server // public void handle(Packet6AConfirmTransaction packet) { // } // // @Server // public void handle(Packet6CEnchantItem packet) { // } // // @Server // public void handle(Packet82UpdateSign packet) { // } // // // @Server // // public void handle(Packet6BSlot); // @Server // public void handle(PacketCAPlayerAbilities packet) { // } // // @Server // public void handle(PacketCBTabComplete packet) { // } // // @Server // public void handle(PacketCCClientInfo packet) { // } // // @Server // @ServerLogin // public void handle(PacketCDClientStatus packet) { // } // // @Server // public void handle(PacketFAPluginMessage packet) { // } // // @ServerLogin // public void handle(PacketFCKeyResponse packet) { // } // // @ServerLogin // public void handle(PacketFEServerPing packet) { // } // // @Server // public void handle(PacketFFDisconnect packet) { // } // // /** // * Methods denoted by this annotation should be handled by a server // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Server { // } // // /** // * Methods denoted by this annotation should be handled by the initial // * server implementation of this class. // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface ServerLogin { // } // // /** // * Methods denoted by this method annotation be handled by a client // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Client { // } // } // Path: src/main/java/com/md_5/fondue/protocol/packet/Packet9Respawn.java import com.md_5.fondue.protocol.PacketHandler; import io.netty.buffer.ByteBuf; import lombok.EqualsAndHashCode; import lombok.ToString; package com.md_5.fondue.protocol.packet; @ToString @EqualsAndHashCode(callSuper = false) public class Packet9Respawn extends Packet { private int dimension; private byte difficulty; private byte gameMode; private short worldHeight; private String levelType; public Packet9Respawn() { } @Override public void read(ByteBuf in) { dimension = in.readInt(); difficulty = in.readByte(); gameMode = in.readByte(); worldHeight = in.readShort(); levelType = readString(in); } @Override public void write(ByteBuf out) { out.writeInt(dimension); out.writeByte(difficulty); out.writeByte(gameMode); out.writeShort(worldHeight); writeString(out, levelType); } @Override
public void handle(PacketHandler handler) {
BukkitDevTeam/Fondue
src/main/java/com/md_5/fondue/protocol/packet/Packet36BlockAction.java
// Path: src/main/java/com/md_5/fondue/protocol/PacketHandler.java // public abstract class PacketHandler { // // /** // * Method to determine whether this is a server handler, client handler or // * other. // * // * @return the type of method interface this handler should accept // */ // public abstract Class<? extends Annotation> getType(); // // @Server // public void handle(Packet0KeepAlive packet) { // } // // @ServerLogin // public void handle(Packet2Handshake packet) { // } // // @Server // public void handle(Packet3ChatMessage packet) { // } // // @Server // public void handle(Packet7UseEntity packet) { // } // // @Server // public void handle(PacketAFlying packet) { // } // // @Server // public void handle(PacketEDig packet) { // } // // @Server // // public void handle(PacketFPlace packet){} // // @Server // public void handle(Packet10HeldItem packet) { // } // // @Server // public void handle(Packet12Animation packet) { // } // // @Server // public void handle(Packet13EntityAction packet) { // } // // @Server // // public void handle(Packet66WindowClick packet){} // // @Server // public void handle(Packet6AConfirmTransaction packet) { // } // // @Server // public void handle(Packet6CEnchantItem packet) { // } // // @Server // public void handle(Packet82UpdateSign packet) { // } // // // @Server // // public void handle(Packet6BSlot); // @Server // public void handle(PacketCAPlayerAbilities packet) { // } // // @Server // public void handle(PacketCBTabComplete packet) { // } // // @Server // public void handle(PacketCCClientInfo packet) { // } // // @Server // @ServerLogin // public void handle(PacketCDClientStatus packet) { // } // // @Server // public void handle(PacketFAPluginMessage packet) { // } // // @ServerLogin // public void handle(PacketFCKeyResponse packet) { // } // // @ServerLogin // public void handle(PacketFEServerPing packet) { // } // // @Server // public void handle(PacketFFDisconnect packet) { // } // // /** // * Methods denoted by this annotation should be handled by a server // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Server { // } // // /** // * Methods denoted by this annotation should be handled by the initial // * server implementation of this class. // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface ServerLogin { // } // // /** // * Methods denoted by this method annotation be handled by a client // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Client { // } // }
import com.md_5.fondue.protocol.PacketHandler; import io.netty.buffer.ByteBuf; import lombok.EqualsAndHashCode; import lombok.ToString;
private short y; private int z; private byte flag1; private byte flag2; private short blockId; public Packet36BlockAction() { } @Override public void read(ByteBuf in) { x = in.readInt(); y = in.readShort(); z = in.readInt(); flag1 = in.readByte(); flag2 = in.readByte(); blockId = in.readShort(); } @Override public void write(ByteBuf out) { out.writeInt(x); out.writeShort(y); out.writeInt(z); out.writeByte(flag1); out.writeByte(flag2); out.writeShort(blockId); } @Override
// Path: src/main/java/com/md_5/fondue/protocol/PacketHandler.java // public abstract class PacketHandler { // // /** // * Method to determine whether this is a server handler, client handler or // * other. // * // * @return the type of method interface this handler should accept // */ // public abstract Class<? extends Annotation> getType(); // // @Server // public void handle(Packet0KeepAlive packet) { // } // // @ServerLogin // public void handle(Packet2Handshake packet) { // } // // @Server // public void handle(Packet3ChatMessage packet) { // } // // @Server // public void handle(Packet7UseEntity packet) { // } // // @Server // public void handle(PacketAFlying packet) { // } // // @Server // public void handle(PacketEDig packet) { // } // // @Server // // public void handle(PacketFPlace packet){} // // @Server // public void handle(Packet10HeldItem packet) { // } // // @Server // public void handle(Packet12Animation packet) { // } // // @Server // public void handle(Packet13EntityAction packet) { // } // // @Server // // public void handle(Packet66WindowClick packet){} // // @Server // public void handle(Packet6AConfirmTransaction packet) { // } // // @Server // public void handle(Packet6CEnchantItem packet) { // } // // @Server // public void handle(Packet82UpdateSign packet) { // } // // // @Server // // public void handle(Packet6BSlot); // @Server // public void handle(PacketCAPlayerAbilities packet) { // } // // @Server // public void handle(PacketCBTabComplete packet) { // } // // @Server // public void handle(PacketCCClientInfo packet) { // } // // @Server // @ServerLogin // public void handle(PacketCDClientStatus packet) { // } // // @Server // public void handle(PacketFAPluginMessage packet) { // } // // @ServerLogin // public void handle(PacketFCKeyResponse packet) { // } // // @ServerLogin // public void handle(PacketFEServerPing packet) { // } // // @Server // public void handle(PacketFFDisconnect packet) { // } // // /** // * Methods denoted by this annotation should be handled by a server // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Server { // } // // /** // * Methods denoted by this annotation should be handled by the initial // * server implementation of this class. // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface ServerLogin { // } // // /** // * Methods denoted by this method annotation be handled by a client // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Client { // } // } // Path: src/main/java/com/md_5/fondue/protocol/packet/Packet36BlockAction.java import com.md_5.fondue.protocol.PacketHandler; import io.netty.buffer.ByteBuf; import lombok.EqualsAndHashCode; import lombok.ToString; private short y; private int z; private byte flag1; private byte flag2; private short blockId; public Packet36BlockAction() { } @Override public void read(ByteBuf in) { x = in.readInt(); y = in.readShort(); z = in.readInt(); flag1 = in.readByte(); flag2 = in.readByte(); blockId = in.readShort(); } @Override public void write(ByteBuf out) { out.writeInt(x); out.writeShort(y); out.writeInt(z); out.writeByte(flag1); out.writeByte(flag2); out.writeShort(blockId); } @Override
public void handle(PacketHandler handler) {
BukkitDevTeam/Fondue
src/main/java/com/md_5/fondue/protocol/packet/Packet1FEntityRelMove.java
// Path: src/main/java/com/md_5/fondue/protocol/PacketHandler.java // public abstract class PacketHandler { // // /** // * Method to determine whether this is a server handler, client handler or // * other. // * // * @return the type of method interface this handler should accept // */ // public abstract Class<? extends Annotation> getType(); // // @Server // public void handle(Packet0KeepAlive packet) { // } // // @ServerLogin // public void handle(Packet2Handshake packet) { // } // // @Server // public void handle(Packet3ChatMessage packet) { // } // // @Server // public void handle(Packet7UseEntity packet) { // } // // @Server // public void handle(PacketAFlying packet) { // } // // @Server // public void handle(PacketEDig packet) { // } // // @Server // // public void handle(PacketFPlace packet){} // // @Server // public void handle(Packet10HeldItem packet) { // } // // @Server // public void handle(Packet12Animation packet) { // } // // @Server // public void handle(Packet13EntityAction packet) { // } // // @Server // // public void handle(Packet66WindowClick packet){} // // @Server // public void handle(Packet6AConfirmTransaction packet) { // } // // @Server // public void handle(Packet6CEnchantItem packet) { // } // // @Server // public void handle(Packet82UpdateSign packet) { // } // // // @Server // // public void handle(Packet6BSlot); // @Server // public void handle(PacketCAPlayerAbilities packet) { // } // // @Server // public void handle(PacketCBTabComplete packet) { // } // // @Server // public void handle(PacketCCClientInfo packet) { // } // // @Server // @ServerLogin // public void handle(PacketCDClientStatus packet) { // } // // @Server // public void handle(PacketFAPluginMessage packet) { // } // // @ServerLogin // public void handle(PacketFCKeyResponse packet) { // } // // @ServerLogin // public void handle(PacketFEServerPing packet) { // } // // @Server // public void handle(PacketFFDisconnect packet) { // } // // /** // * Methods denoted by this annotation should be handled by a server // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Server { // } // // /** // * Methods denoted by this annotation should be handled by the initial // * server implementation of this class. // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface ServerLogin { // } // // /** // * Methods denoted by this method annotation be handled by a client // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Client { // } // }
import com.md_5.fondue.protocol.PacketHandler; import io.netty.buffer.ByteBuf; import lombok.EqualsAndHashCode; import lombok.ToString;
package com.md_5.fondue.protocol.packet; @ToString @EqualsAndHashCode(callSuper = false) public class Packet1FEntityRelMove extends Packet1EEntity { private byte dX; private byte dY; private byte dZ; public Packet1FEntityRelMove() { } @Override public void read(ByteBuf in) { super.read(in); dX = in.readByte(); dY = in.readByte(); dZ = in.readByte(); } @Override public void write(ByteBuf out) { super.write(out); out.writeByte(dX); out.writeByte(dY); out.writeByte(dZ); } @Override
// Path: src/main/java/com/md_5/fondue/protocol/PacketHandler.java // public abstract class PacketHandler { // // /** // * Method to determine whether this is a server handler, client handler or // * other. // * // * @return the type of method interface this handler should accept // */ // public abstract Class<? extends Annotation> getType(); // // @Server // public void handle(Packet0KeepAlive packet) { // } // // @ServerLogin // public void handle(Packet2Handshake packet) { // } // // @Server // public void handle(Packet3ChatMessage packet) { // } // // @Server // public void handle(Packet7UseEntity packet) { // } // // @Server // public void handle(PacketAFlying packet) { // } // // @Server // public void handle(PacketEDig packet) { // } // // @Server // // public void handle(PacketFPlace packet){} // // @Server // public void handle(Packet10HeldItem packet) { // } // // @Server // public void handle(Packet12Animation packet) { // } // // @Server // public void handle(Packet13EntityAction packet) { // } // // @Server // // public void handle(Packet66WindowClick packet){} // // @Server // public void handle(Packet6AConfirmTransaction packet) { // } // // @Server // public void handle(Packet6CEnchantItem packet) { // } // // @Server // public void handle(Packet82UpdateSign packet) { // } // // // @Server // // public void handle(Packet6BSlot); // @Server // public void handle(PacketCAPlayerAbilities packet) { // } // // @Server // public void handle(PacketCBTabComplete packet) { // } // // @Server // public void handle(PacketCCClientInfo packet) { // } // // @Server // @ServerLogin // public void handle(PacketCDClientStatus packet) { // } // // @Server // public void handle(PacketFAPluginMessage packet) { // } // // @ServerLogin // public void handle(PacketFCKeyResponse packet) { // } // // @ServerLogin // public void handle(PacketFEServerPing packet) { // } // // @Server // public void handle(PacketFFDisconnect packet) { // } // // /** // * Methods denoted by this annotation should be handled by a server // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Server { // } // // /** // * Methods denoted by this annotation should be handled by the initial // * server implementation of this class. // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface ServerLogin { // } // // /** // * Methods denoted by this method annotation be handled by a client // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Client { // } // } // Path: src/main/java/com/md_5/fondue/protocol/packet/Packet1FEntityRelMove.java import com.md_5.fondue.protocol.PacketHandler; import io.netty.buffer.ByteBuf; import lombok.EqualsAndHashCode; import lombok.ToString; package com.md_5.fondue.protocol.packet; @ToString @EqualsAndHashCode(callSuper = false) public class Packet1FEntityRelMove extends Packet1EEntity { private byte dX; private byte dY; private byte dZ; public Packet1FEntityRelMove() { } @Override public void read(ByteBuf in) { super.read(in); dX = in.readByte(); dY = in.readByte(); dZ = in.readByte(); } @Override public void write(ByteBuf out) { super.write(out); out.writeByte(dX); out.writeByte(dY); out.writeByte(dZ); } @Override
public void handle(PacketHandler handler) {
BukkitDevTeam/Fondue
src/main/java/com/md_5/fondue/protocol/packet/PacketC9PlayerListItem.java
// Path: src/main/java/com/md_5/fondue/protocol/PacketHandler.java // public abstract class PacketHandler { // // /** // * Method to determine whether this is a server handler, client handler or // * other. // * // * @return the type of method interface this handler should accept // */ // public abstract Class<? extends Annotation> getType(); // // @Server // public void handle(Packet0KeepAlive packet) { // } // // @ServerLogin // public void handle(Packet2Handshake packet) { // } // // @Server // public void handle(Packet3ChatMessage packet) { // } // // @Server // public void handle(Packet7UseEntity packet) { // } // // @Server // public void handle(PacketAFlying packet) { // } // // @Server // public void handle(PacketEDig packet) { // } // // @Server // // public void handle(PacketFPlace packet){} // // @Server // public void handle(Packet10HeldItem packet) { // } // // @Server // public void handle(Packet12Animation packet) { // } // // @Server // public void handle(Packet13EntityAction packet) { // } // // @Server // // public void handle(Packet66WindowClick packet){} // // @Server // public void handle(Packet6AConfirmTransaction packet) { // } // // @Server // public void handle(Packet6CEnchantItem packet) { // } // // @Server // public void handle(Packet82UpdateSign packet) { // } // // // @Server // // public void handle(Packet6BSlot); // @Server // public void handle(PacketCAPlayerAbilities packet) { // } // // @Server // public void handle(PacketCBTabComplete packet) { // } // // @Server // public void handle(PacketCCClientInfo packet) { // } // // @Server // @ServerLogin // public void handle(PacketCDClientStatus packet) { // } // // @Server // public void handle(PacketFAPluginMessage packet) { // } // // @ServerLogin // public void handle(PacketFCKeyResponse packet) { // } // // @ServerLogin // public void handle(PacketFEServerPing packet) { // } // // @Server // public void handle(PacketFFDisconnect packet) { // } // // /** // * Methods denoted by this annotation should be handled by a server // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Server { // } // // /** // * Methods denoted by this annotation should be handled by the initial // * server implementation of this class. // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface ServerLogin { // } // // /** // * Methods denoted by this method annotation be handled by a client // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Client { // } // }
import com.md_5.fondue.protocol.PacketHandler; import io.netty.buffer.ByteBuf; import lombok.EqualsAndHashCode; import lombok.ToString;
package com.md_5.fondue.protocol.packet; @ToString @EqualsAndHashCode(callSuper = false) public class PacketC9PlayerListItem extends Packet { private String name; private boolean online; private short ping; public PacketC9PlayerListItem() { } @Override public void read(ByteBuf in) { name = readString(in); online = in.readBoolean(); ping = in.readShort(); } @Override public void write(ByteBuf out) { writeString(out, name); out.writeBoolean(online); out.writeShort(ping); } @Override
// Path: src/main/java/com/md_5/fondue/protocol/PacketHandler.java // public abstract class PacketHandler { // // /** // * Method to determine whether this is a server handler, client handler or // * other. // * // * @return the type of method interface this handler should accept // */ // public abstract Class<? extends Annotation> getType(); // // @Server // public void handle(Packet0KeepAlive packet) { // } // // @ServerLogin // public void handle(Packet2Handshake packet) { // } // // @Server // public void handle(Packet3ChatMessage packet) { // } // // @Server // public void handle(Packet7UseEntity packet) { // } // // @Server // public void handle(PacketAFlying packet) { // } // // @Server // public void handle(PacketEDig packet) { // } // // @Server // // public void handle(PacketFPlace packet){} // // @Server // public void handle(Packet10HeldItem packet) { // } // // @Server // public void handle(Packet12Animation packet) { // } // // @Server // public void handle(Packet13EntityAction packet) { // } // // @Server // // public void handle(Packet66WindowClick packet){} // // @Server // public void handle(Packet6AConfirmTransaction packet) { // } // // @Server // public void handle(Packet6CEnchantItem packet) { // } // // @Server // public void handle(Packet82UpdateSign packet) { // } // // // @Server // // public void handle(Packet6BSlot); // @Server // public void handle(PacketCAPlayerAbilities packet) { // } // // @Server // public void handle(PacketCBTabComplete packet) { // } // // @Server // public void handle(PacketCCClientInfo packet) { // } // // @Server // @ServerLogin // public void handle(PacketCDClientStatus packet) { // } // // @Server // public void handle(PacketFAPluginMessage packet) { // } // // @ServerLogin // public void handle(PacketFCKeyResponse packet) { // } // // @ServerLogin // public void handle(PacketFEServerPing packet) { // } // // @Server // public void handle(PacketFFDisconnect packet) { // } // // /** // * Methods denoted by this annotation should be handled by a server // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Server { // } // // /** // * Methods denoted by this annotation should be handled by the initial // * server implementation of this class. // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface ServerLogin { // } // // /** // * Methods denoted by this method annotation be handled by a client // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Client { // } // } // Path: src/main/java/com/md_5/fondue/protocol/packet/PacketC9PlayerListItem.java import com.md_5.fondue.protocol.PacketHandler; import io.netty.buffer.ByteBuf; import lombok.EqualsAndHashCode; import lombok.ToString; package com.md_5.fondue.protocol.packet; @ToString @EqualsAndHashCode(callSuper = false) public class PacketC9PlayerListItem extends Packet { private String name; private boolean online; private short ping; public PacketC9PlayerListItem() { } @Override public void read(ByteBuf in) { name = readString(in); online = in.readBoolean(); ping = in.readShort(); } @Override public void write(ByteBuf out) { writeString(out, name); out.writeBoolean(online); out.writeShort(ping); } @Override
public void handle(PacketHandler handler) {
BukkitDevTeam/Fondue
src/main/java/com/md_5/fondue/protocol/packet/Packet3ENamedEffect.java
// Path: src/main/java/com/md_5/fondue/protocol/PacketHandler.java // public abstract class PacketHandler { // // /** // * Method to determine whether this is a server handler, client handler or // * other. // * // * @return the type of method interface this handler should accept // */ // public abstract Class<? extends Annotation> getType(); // // @Server // public void handle(Packet0KeepAlive packet) { // } // // @ServerLogin // public void handle(Packet2Handshake packet) { // } // // @Server // public void handle(Packet3ChatMessage packet) { // } // // @Server // public void handle(Packet7UseEntity packet) { // } // // @Server // public void handle(PacketAFlying packet) { // } // // @Server // public void handle(PacketEDig packet) { // } // // @Server // // public void handle(PacketFPlace packet){} // // @Server // public void handle(Packet10HeldItem packet) { // } // // @Server // public void handle(Packet12Animation packet) { // } // // @Server // public void handle(Packet13EntityAction packet) { // } // // @Server // // public void handle(Packet66WindowClick packet){} // // @Server // public void handle(Packet6AConfirmTransaction packet) { // } // // @Server // public void handle(Packet6CEnchantItem packet) { // } // // @Server // public void handle(Packet82UpdateSign packet) { // } // // // @Server // // public void handle(Packet6BSlot); // @Server // public void handle(PacketCAPlayerAbilities packet) { // } // // @Server // public void handle(PacketCBTabComplete packet) { // } // // @Server // public void handle(PacketCCClientInfo packet) { // } // // @Server // @ServerLogin // public void handle(PacketCDClientStatus packet) { // } // // @Server // public void handle(PacketFAPluginMessage packet) { // } // // @ServerLogin // public void handle(PacketFCKeyResponse packet) { // } // // @ServerLogin // public void handle(PacketFEServerPing packet) { // } // // @Server // public void handle(PacketFFDisconnect packet) { // } // // /** // * Methods denoted by this annotation should be handled by a server // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Server { // } // // /** // * Methods denoted by this annotation should be handled by the initial // * server implementation of this class. // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface ServerLogin { // } // // /** // * Methods denoted by this method annotation be handled by a client // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Client { // } // }
import com.md_5.fondue.protocol.PacketHandler; import io.netty.buffer.ByteBuf; import lombok.EqualsAndHashCode; import lombok.ToString;
private int x; private int y; private int z; private float volume; private byte pitch; public Packet3ENamedEffect() { } @Override public void read(ByteBuf in) { name = readString(in); x = in.readInt(); y = in.readInt(); z = in.readInt(); volume = in.readFloat(); pitch = in.readByte(); } @Override public void write(ByteBuf out) { writeString(out, name); out.writeInt(x); out.writeInt(y); out.writeInt(z); out.writeFloat(volume); out.writeByte(pitch); } @Override
// Path: src/main/java/com/md_5/fondue/protocol/PacketHandler.java // public abstract class PacketHandler { // // /** // * Method to determine whether this is a server handler, client handler or // * other. // * // * @return the type of method interface this handler should accept // */ // public abstract Class<? extends Annotation> getType(); // // @Server // public void handle(Packet0KeepAlive packet) { // } // // @ServerLogin // public void handle(Packet2Handshake packet) { // } // // @Server // public void handle(Packet3ChatMessage packet) { // } // // @Server // public void handle(Packet7UseEntity packet) { // } // // @Server // public void handle(PacketAFlying packet) { // } // // @Server // public void handle(PacketEDig packet) { // } // // @Server // // public void handle(PacketFPlace packet){} // // @Server // public void handle(Packet10HeldItem packet) { // } // // @Server // public void handle(Packet12Animation packet) { // } // // @Server // public void handle(Packet13EntityAction packet) { // } // // @Server // // public void handle(Packet66WindowClick packet){} // // @Server // public void handle(Packet6AConfirmTransaction packet) { // } // // @Server // public void handle(Packet6CEnchantItem packet) { // } // // @Server // public void handle(Packet82UpdateSign packet) { // } // // // @Server // // public void handle(Packet6BSlot); // @Server // public void handle(PacketCAPlayerAbilities packet) { // } // // @Server // public void handle(PacketCBTabComplete packet) { // } // // @Server // public void handle(PacketCCClientInfo packet) { // } // // @Server // @ServerLogin // public void handle(PacketCDClientStatus packet) { // } // // @Server // public void handle(PacketFAPluginMessage packet) { // } // // @ServerLogin // public void handle(PacketFCKeyResponse packet) { // } // // @ServerLogin // public void handle(PacketFEServerPing packet) { // } // // @Server // public void handle(PacketFFDisconnect packet) { // } // // /** // * Methods denoted by this annotation should be handled by a server // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Server { // } // // /** // * Methods denoted by this annotation should be handled by the initial // * server implementation of this class. // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface ServerLogin { // } // // /** // * Methods denoted by this method annotation be handled by a client // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Client { // } // } // Path: src/main/java/com/md_5/fondue/protocol/packet/Packet3ENamedEffect.java import com.md_5.fondue.protocol.PacketHandler; import io.netty.buffer.ByteBuf; import lombok.EqualsAndHashCode; import lombok.ToString; private int x; private int y; private int z; private float volume; private byte pitch; public Packet3ENamedEffect() { } @Override public void read(ByteBuf in) { name = readString(in); x = in.readInt(); y = in.readInt(); z = in.readInt(); volume = in.readFloat(); pitch = in.readByte(); } @Override public void write(ByteBuf out) { writeString(out, name); out.writeInt(x); out.writeInt(y); out.writeInt(z); out.writeFloat(volume); out.writeByte(pitch); } @Override
public void handle(PacketHandler handler) {
BukkitDevTeam/Fondue
src/main/java/com/md_5/fondue/protocol/packet/Packet1CEntityVelocity.java
// Path: src/main/java/com/md_5/fondue/protocol/PacketHandler.java // public abstract class PacketHandler { // // /** // * Method to determine whether this is a server handler, client handler or // * other. // * // * @return the type of method interface this handler should accept // */ // public abstract Class<? extends Annotation> getType(); // // @Server // public void handle(Packet0KeepAlive packet) { // } // // @ServerLogin // public void handle(Packet2Handshake packet) { // } // // @Server // public void handle(Packet3ChatMessage packet) { // } // // @Server // public void handle(Packet7UseEntity packet) { // } // // @Server // public void handle(PacketAFlying packet) { // } // // @Server // public void handle(PacketEDig packet) { // } // // @Server // // public void handle(PacketFPlace packet){} // // @Server // public void handle(Packet10HeldItem packet) { // } // // @Server // public void handle(Packet12Animation packet) { // } // // @Server // public void handle(Packet13EntityAction packet) { // } // // @Server // // public void handle(Packet66WindowClick packet){} // // @Server // public void handle(Packet6AConfirmTransaction packet) { // } // // @Server // public void handle(Packet6CEnchantItem packet) { // } // // @Server // public void handle(Packet82UpdateSign packet) { // } // // // @Server // // public void handle(Packet6BSlot); // @Server // public void handle(PacketCAPlayerAbilities packet) { // } // // @Server // public void handle(PacketCBTabComplete packet) { // } // // @Server // public void handle(PacketCCClientInfo packet) { // } // // @Server // @ServerLogin // public void handle(PacketCDClientStatus packet) { // } // // @Server // public void handle(PacketFAPluginMessage packet) { // } // // @ServerLogin // public void handle(PacketFCKeyResponse packet) { // } // // @ServerLogin // public void handle(PacketFEServerPing packet) { // } // // @Server // public void handle(PacketFFDisconnect packet) { // } // // /** // * Methods denoted by this annotation should be handled by a server // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Server { // } // // /** // * Methods denoted by this annotation should be handled by the initial // * server implementation of this class. // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface ServerLogin { // } // // /** // * Methods denoted by this method annotation be handled by a client // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Client { // } // }
import com.md_5.fondue.protocol.PacketHandler; import io.netty.buffer.ByteBuf; import lombok.EqualsAndHashCode; import lombok.ToString;
package com.md_5.fondue.protocol.packet; @ToString @EqualsAndHashCode(callSuper = false) public class Packet1CEntityVelocity extends Packet1EEntity { private short velocityX; private short velocityY; private short velocityZ; public Packet1CEntityVelocity() { } @Override public void read(ByteBuf in) { super.read(in); velocityX = in.readShort(); velocityY = in.readShort(); velocityZ = in.readShort(); } @Override public void write(ByteBuf out) { super.write(out); out.writeShort(velocityX); out.writeShort(velocityY); out.writeShort(velocityZ); } @Override
// Path: src/main/java/com/md_5/fondue/protocol/PacketHandler.java // public abstract class PacketHandler { // // /** // * Method to determine whether this is a server handler, client handler or // * other. // * // * @return the type of method interface this handler should accept // */ // public abstract Class<? extends Annotation> getType(); // // @Server // public void handle(Packet0KeepAlive packet) { // } // // @ServerLogin // public void handle(Packet2Handshake packet) { // } // // @Server // public void handle(Packet3ChatMessage packet) { // } // // @Server // public void handle(Packet7UseEntity packet) { // } // // @Server // public void handle(PacketAFlying packet) { // } // // @Server // public void handle(PacketEDig packet) { // } // // @Server // // public void handle(PacketFPlace packet){} // // @Server // public void handle(Packet10HeldItem packet) { // } // // @Server // public void handle(Packet12Animation packet) { // } // // @Server // public void handle(Packet13EntityAction packet) { // } // // @Server // // public void handle(Packet66WindowClick packet){} // // @Server // public void handle(Packet6AConfirmTransaction packet) { // } // // @Server // public void handle(Packet6CEnchantItem packet) { // } // // @Server // public void handle(Packet82UpdateSign packet) { // } // // // @Server // // public void handle(Packet6BSlot); // @Server // public void handle(PacketCAPlayerAbilities packet) { // } // // @Server // public void handle(PacketCBTabComplete packet) { // } // // @Server // public void handle(PacketCCClientInfo packet) { // } // // @Server // @ServerLogin // public void handle(PacketCDClientStatus packet) { // } // // @Server // public void handle(PacketFAPluginMessage packet) { // } // // @ServerLogin // public void handle(PacketFCKeyResponse packet) { // } // // @ServerLogin // public void handle(PacketFEServerPing packet) { // } // // @Server // public void handle(PacketFFDisconnect packet) { // } // // /** // * Methods denoted by this annotation should be handled by a server // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Server { // } // // /** // * Methods denoted by this annotation should be handled by the initial // * server implementation of this class. // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface ServerLogin { // } // // /** // * Methods denoted by this method annotation be handled by a client // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Client { // } // } // Path: src/main/java/com/md_5/fondue/protocol/packet/Packet1CEntityVelocity.java import com.md_5.fondue.protocol.PacketHandler; import io.netty.buffer.ByteBuf; import lombok.EqualsAndHashCode; import lombok.ToString; package com.md_5.fondue.protocol.packet; @ToString @EqualsAndHashCode(callSuper = false) public class Packet1CEntityVelocity extends Packet1EEntity { private short velocityX; private short velocityY; private short velocityZ; public Packet1CEntityVelocity() { } @Override public void read(ByteBuf in) { super.read(in); velocityX = in.readShort(); velocityY = in.readShort(); velocityZ = in.readShort(); } @Override public void write(ByteBuf out) { super.write(out); out.writeShort(velocityX); out.writeShort(velocityY); out.writeShort(velocityZ); } @Override
public void handle(PacketHandler handler) {
BukkitDevTeam/Fondue
src/main/java/com/md_5/fondue/protocol/packet/Packet16CollectItem.java
// Path: src/main/java/com/md_5/fondue/protocol/PacketHandler.java // public abstract class PacketHandler { // // /** // * Method to determine whether this is a server handler, client handler or // * other. // * // * @return the type of method interface this handler should accept // */ // public abstract Class<? extends Annotation> getType(); // // @Server // public void handle(Packet0KeepAlive packet) { // } // // @ServerLogin // public void handle(Packet2Handshake packet) { // } // // @Server // public void handle(Packet3ChatMessage packet) { // } // // @Server // public void handle(Packet7UseEntity packet) { // } // // @Server // public void handle(PacketAFlying packet) { // } // // @Server // public void handle(PacketEDig packet) { // } // // @Server // // public void handle(PacketFPlace packet){} // // @Server // public void handle(Packet10HeldItem packet) { // } // // @Server // public void handle(Packet12Animation packet) { // } // // @Server // public void handle(Packet13EntityAction packet) { // } // // @Server // // public void handle(Packet66WindowClick packet){} // // @Server // public void handle(Packet6AConfirmTransaction packet) { // } // // @Server // public void handle(Packet6CEnchantItem packet) { // } // // @Server // public void handle(Packet82UpdateSign packet) { // } // // // @Server // // public void handle(Packet6BSlot); // @Server // public void handle(PacketCAPlayerAbilities packet) { // } // // @Server // public void handle(PacketCBTabComplete packet) { // } // // @Server // public void handle(PacketCCClientInfo packet) { // } // // @Server // @ServerLogin // public void handle(PacketCDClientStatus packet) { // } // // @Server // public void handle(PacketFAPluginMessage packet) { // } // // @ServerLogin // public void handle(PacketFCKeyResponse packet) { // } // // @ServerLogin // public void handle(PacketFEServerPing packet) { // } // // @Server // public void handle(PacketFFDisconnect packet) { // } // // /** // * Methods denoted by this annotation should be handled by a server // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Server { // } // // /** // * Methods denoted by this annotation should be handled by the initial // * server implementation of this class. // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface ServerLogin { // } // // /** // * Methods denoted by this method annotation be handled by a client // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Client { // } // }
import com.md_5.fondue.protocol.PacketHandler; import io.netty.buffer.ByteBuf; import lombok.EqualsAndHashCode; import lombok.ToString;
package com.md_5.fondue.protocol.packet; @ToString @EqualsAndHashCode(callSuper = false) public class Packet16CollectItem extends Packet { private int collected; private int collector; public Packet16CollectItem() { } @Override public void read(ByteBuf in) { collected = in.readInt(); collector = in.readInt(); } @Override public void write(ByteBuf out) { out.writeInt(collected); out.writeInt(collector); } @Override
// Path: src/main/java/com/md_5/fondue/protocol/PacketHandler.java // public abstract class PacketHandler { // // /** // * Method to determine whether this is a server handler, client handler or // * other. // * // * @return the type of method interface this handler should accept // */ // public abstract Class<? extends Annotation> getType(); // // @Server // public void handle(Packet0KeepAlive packet) { // } // // @ServerLogin // public void handle(Packet2Handshake packet) { // } // // @Server // public void handle(Packet3ChatMessage packet) { // } // // @Server // public void handle(Packet7UseEntity packet) { // } // // @Server // public void handle(PacketAFlying packet) { // } // // @Server // public void handle(PacketEDig packet) { // } // // @Server // // public void handle(PacketFPlace packet){} // // @Server // public void handle(Packet10HeldItem packet) { // } // // @Server // public void handle(Packet12Animation packet) { // } // // @Server // public void handle(Packet13EntityAction packet) { // } // // @Server // // public void handle(Packet66WindowClick packet){} // // @Server // public void handle(Packet6AConfirmTransaction packet) { // } // // @Server // public void handle(Packet6CEnchantItem packet) { // } // // @Server // public void handle(Packet82UpdateSign packet) { // } // // // @Server // // public void handle(Packet6BSlot); // @Server // public void handle(PacketCAPlayerAbilities packet) { // } // // @Server // public void handle(PacketCBTabComplete packet) { // } // // @Server // public void handle(PacketCCClientInfo packet) { // } // // @Server // @ServerLogin // public void handle(PacketCDClientStatus packet) { // } // // @Server // public void handle(PacketFAPluginMessage packet) { // } // // @ServerLogin // public void handle(PacketFCKeyResponse packet) { // } // // @ServerLogin // public void handle(PacketFEServerPing packet) { // } // // @Server // public void handle(PacketFFDisconnect packet) { // } // // /** // * Methods denoted by this annotation should be handled by a server // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Server { // } // // /** // * Methods denoted by this annotation should be handled by the initial // * server implementation of this class. // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface ServerLogin { // } // // /** // * Methods denoted by this method annotation be handled by a client // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Client { // } // } // Path: src/main/java/com/md_5/fondue/protocol/packet/Packet16CollectItem.java import com.md_5.fondue.protocol.PacketHandler; import io.netty.buffer.ByteBuf; import lombok.EqualsAndHashCode; import lombok.ToString; package com.md_5.fondue.protocol.packet; @ToString @EqualsAndHashCode(callSuper = false) public class Packet16CollectItem extends Packet { private int collected; private int collector; public Packet16CollectItem() { } @Override public void read(ByteBuf in) { collected = in.readInt(); collector = in.readInt(); } @Override public void write(ByteBuf out) { out.writeInt(collected); out.writeInt(collector); } @Override
public void handle(PacketHandler handler) {
BukkitDevTeam/Fondue
src/main/java/com/md_5/fondue/protocol/packet/Packet3ChatMessage.java
// Path: src/main/java/com/md_5/fondue/protocol/PacketHandler.java // public abstract class PacketHandler { // // /** // * Method to determine whether this is a server handler, client handler or // * other. // * // * @return the type of method interface this handler should accept // */ // public abstract Class<? extends Annotation> getType(); // // @Server // public void handle(Packet0KeepAlive packet) { // } // // @ServerLogin // public void handle(Packet2Handshake packet) { // } // // @Server // public void handle(Packet3ChatMessage packet) { // } // // @Server // public void handle(Packet7UseEntity packet) { // } // // @Server // public void handle(PacketAFlying packet) { // } // // @Server // public void handle(PacketEDig packet) { // } // // @Server // // public void handle(PacketFPlace packet){} // // @Server // public void handle(Packet10HeldItem packet) { // } // // @Server // public void handle(Packet12Animation packet) { // } // // @Server // public void handle(Packet13EntityAction packet) { // } // // @Server // // public void handle(Packet66WindowClick packet){} // // @Server // public void handle(Packet6AConfirmTransaction packet) { // } // // @Server // public void handle(Packet6CEnchantItem packet) { // } // // @Server // public void handle(Packet82UpdateSign packet) { // } // // // @Server // // public void handle(Packet6BSlot); // @Server // public void handle(PacketCAPlayerAbilities packet) { // } // // @Server // public void handle(PacketCBTabComplete packet) { // } // // @Server // public void handle(PacketCCClientInfo packet) { // } // // @Server // @ServerLogin // public void handle(PacketCDClientStatus packet) { // } // // @Server // public void handle(PacketFAPluginMessage packet) { // } // // @ServerLogin // public void handle(PacketFCKeyResponse packet) { // } // // @ServerLogin // public void handle(PacketFEServerPing packet) { // } // // @Server // public void handle(PacketFFDisconnect packet) { // } // // /** // * Methods denoted by this annotation should be handled by a server // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Server { // } // // /** // * Methods denoted by this annotation should be handled by the initial // * server implementation of this class. // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface ServerLogin { // } // // /** // * Methods denoted by this method annotation be handled by a client // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Client { // } // }
import com.md_5.fondue.protocol.PacketHandler; import io.netty.buffer.ByteBuf; import lombok.EqualsAndHashCode; import lombok.ToString;
package com.md_5.fondue.protocol.packet; @ToString @EqualsAndHashCode(callSuper = false) public class Packet3ChatMessage extends Packet { private String message; public Packet3ChatMessage() { } @Override public void read(ByteBuf in) { message = readString(in); } @Override public void write(ByteBuf out) { writeString(out, message); } @Override
// Path: src/main/java/com/md_5/fondue/protocol/PacketHandler.java // public abstract class PacketHandler { // // /** // * Method to determine whether this is a server handler, client handler or // * other. // * // * @return the type of method interface this handler should accept // */ // public abstract Class<? extends Annotation> getType(); // // @Server // public void handle(Packet0KeepAlive packet) { // } // // @ServerLogin // public void handle(Packet2Handshake packet) { // } // // @Server // public void handle(Packet3ChatMessage packet) { // } // // @Server // public void handle(Packet7UseEntity packet) { // } // // @Server // public void handle(PacketAFlying packet) { // } // // @Server // public void handle(PacketEDig packet) { // } // // @Server // // public void handle(PacketFPlace packet){} // // @Server // public void handle(Packet10HeldItem packet) { // } // // @Server // public void handle(Packet12Animation packet) { // } // // @Server // public void handle(Packet13EntityAction packet) { // } // // @Server // // public void handle(Packet66WindowClick packet){} // // @Server // public void handle(Packet6AConfirmTransaction packet) { // } // // @Server // public void handle(Packet6CEnchantItem packet) { // } // // @Server // public void handle(Packet82UpdateSign packet) { // } // // // @Server // // public void handle(Packet6BSlot); // @Server // public void handle(PacketCAPlayerAbilities packet) { // } // // @Server // public void handle(PacketCBTabComplete packet) { // } // // @Server // public void handle(PacketCCClientInfo packet) { // } // // @Server // @ServerLogin // public void handle(PacketCDClientStatus packet) { // } // // @Server // public void handle(PacketFAPluginMessage packet) { // } // // @ServerLogin // public void handle(PacketFCKeyResponse packet) { // } // // @ServerLogin // public void handle(PacketFEServerPing packet) { // } // // @Server // public void handle(PacketFFDisconnect packet) { // } // // /** // * Methods denoted by this annotation should be handled by a server // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Server { // } // // /** // * Methods denoted by this annotation should be handled by the initial // * server implementation of this class. // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface ServerLogin { // } // // /** // * Methods denoted by this method annotation be handled by a client // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Client { // } // } // Path: src/main/java/com/md_5/fondue/protocol/packet/Packet3ChatMessage.java import com.md_5.fondue.protocol.PacketHandler; import io.netty.buffer.ByteBuf; import lombok.EqualsAndHashCode; import lombok.ToString; package com.md_5.fondue.protocol.packet; @ToString @EqualsAndHashCode(callSuper = false) public class Packet3ChatMessage extends Packet { private String message; public Packet3ChatMessage() { } @Override public void read(ByteBuf in) { message = readString(in); } @Override public void write(ByteBuf out) { writeString(out, message); } @Override
public void handle(PacketHandler handler) {
BukkitDevTeam/Fondue
src/main/java/com/md_5/fondue/protocol/packet/Packet65CloseWindow.java
// Path: src/main/java/com/md_5/fondue/protocol/PacketHandler.java // public abstract class PacketHandler { // // /** // * Method to determine whether this is a server handler, client handler or // * other. // * // * @return the type of method interface this handler should accept // */ // public abstract Class<? extends Annotation> getType(); // // @Server // public void handle(Packet0KeepAlive packet) { // } // // @ServerLogin // public void handle(Packet2Handshake packet) { // } // // @Server // public void handle(Packet3ChatMessage packet) { // } // // @Server // public void handle(Packet7UseEntity packet) { // } // // @Server // public void handle(PacketAFlying packet) { // } // // @Server // public void handle(PacketEDig packet) { // } // // @Server // // public void handle(PacketFPlace packet){} // // @Server // public void handle(Packet10HeldItem packet) { // } // // @Server // public void handle(Packet12Animation packet) { // } // // @Server // public void handle(Packet13EntityAction packet) { // } // // @Server // // public void handle(Packet66WindowClick packet){} // // @Server // public void handle(Packet6AConfirmTransaction packet) { // } // // @Server // public void handle(Packet6CEnchantItem packet) { // } // // @Server // public void handle(Packet82UpdateSign packet) { // } // // // @Server // // public void handle(Packet6BSlot); // @Server // public void handle(PacketCAPlayerAbilities packet) { // } // // @Server // public void handle(PacketCBTabComplete packet) { // } // // @Server // public void handle(PacketCCClientInfo packet) { // } // // @Server // @ServerLogin // public void handle(PacketCDClientStatus packet) { // } // // @Server // public void handle(PacketFAPluginMessage packet) { // } // // @ServerLogin // public void handle(PacketFCKeyResponse packet) { // } // // @ServerLogin // public void handle(PacketFEServerPing packet) { // } // // @Server // public void handle(PacketFFDisconnect packet) { // } // // /** // * Methods denoted by this annotation should be handled by a server // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Server { // } // // /** // * Methods denoted by this annotation should be handled by the initial // * server implementation of this class. // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface ServerLogin { // } // // /** // * Methods denoted by this method annotation be handled by a client // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Client { // } // }
import com.md_5.fondue.protocol.PacketHandler; import io.netty.buffer.ByteBuf; import lombok.EqualsAndHashCode; import lombok.ToString;
package com.md_5.fondue.protocol.packet; @ToString @EqualsAndHashCode(callSuper = false) public class Packet65CloseWindow extends Packet { private byte windowId; public Packet65CloseWindow() { } @Override public void read(ByteBuf in) { windowId = in.readByte(); } @Override public void write(ByteBuf out) { out.writeByte(windowId); } @Override
// Path: src/main/java/com/md_5/fondue/protocol/PacketHandler.java // public abstract class PacketHandler { // // /** // * Method to determine whether this is a server handler, client handler or // * other. // * // * @return the type of method interface this handler should accept // */ // public abstract Class<? extends Annotation> getType(); // // @Server // public void handle(Packet0KeepAlive packet) { // } // // @ServerLogin // public void handle(Packet2Handshake packet) { // } // // @Server // public void handle(Packet3ChatMessage packet) { // } // // @Server // public void handle(Packet7UseEntity packet) { // } // // @Server // public void handle(PacketAFlying packet) { // } // // @Server // public void handle(PacketEDig packet) { // } // // @Server // // public void handle(PacketFPlace packet){} // // @Server // public void handle(Packet10HeldItem packet) { // } // // @Server // public void handle(Packet12Animation packet) { // } // // @Server // public void handle(Packet13EntityAction packet) { // } // // @Server // // public void handle(Packet66WindowClick packet){} // // @Server // public void handle(Packet6AConfirmTransaction packet) { // } // // @Server // public void handle(Packet6CEnchantItem packet) { // } // // @Server // public void handle(Packet82UpdateSign packet) { // } // // // @Server // // public void handle(Packet6BSlot); // @Server // public void handle(PacketCAPlayerAbilities packet) { // } // // @Server // public void handle(PacketCBTabComplete packet) { // } // // @Server // public void handle(PacketCCClientInfo packet) { // } // // @Server // @ServerLogin // public void handle(PacketCDClientStatus packet) { // } // // @Server // public void handle(PacketFAPluginMessage packet) { // } // // @ServerLogin // public void handle(PacketFCKeyResponse packet) { // } // // @ServerLogin // public void handle(PacketFEServerPing packet) { // } // // @Server // public void handle(PacketFFDisconnect packet) { // } // // /** // * Methods denoted by this annotation should be handled by a server // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Server { // } // // /** // * Methods denoted by this annotation should be handled by the initial // * server implementation of this class. // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface ServerLogin { // } // // /** // * Methods denoted by this method annotation be handled by a client // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Client { // } // } // Path: src/main/java/com/md_5/fondue/protocol/packet/Packet65CloseWindow.java import com.md_5.fondue.protocol.PacketHandler; import io.netty.buffer.ByteBuf; import lombok.EqualsAndHashCode; import lombok.ToString; package com.md_5.fondue.protocol.packet; @ToString @EqualsAndHashCode(callSuper = false) public class Packet65CloseWindow extends Packet { private byte windowId; public Packet65CloseWindow() { } @Override public void read(ByteBuf in) { windowId = in.readByte(); } @Override public void write(ByteBuf out) { out.writeByte(windowId); } @Override
public void handle(PacketHandler handler) {
BukkitDevTeam/Fondue
src/main/java/com/md_5/fondue/protocol/packet/Packet6AConfirmTransaction.java
// Path: src/main/java/com/md_5/fondue/protocol/PacketHandler.java // public abstract class PacketHandler { // // /** // * Method to determine whether this is a server handler, client handler or // * other. // * // * @return the type of method interface this handler should accept // */ // public abstract Class<? extends Annotation> getType(); // // @Server // public void handle(Packet0KeepAlive packet) { // } // // @ServerLogin // public void handle(Packet2Handshake packet) { // } // // @Server // public void handle(Packet3ChatMessage packet) { // } // // @Server // public void handle(Packet7UseEntity packet) { // } // // @Server // public void handle(PacketAFlying packet) { // } // // @Server // public void handle(PacketEDig packet) { // } // // @Server // // public void handle(PacketFPlace packet){} // // @Server // public void handle(Packet10HeldItem packet) { // } // // @Server // public void handle(Packet12Animation packet) { // } // // @Server // public void handle(Packet13EntityAction packet) { // } // // @Server // // public void handle(Packet66WindowClick packet){} // // @Server // public void handle(Packet6AConfirmTransaction packet) { // } // // @Server // public void handle(Packet6CEnchantItem packet) { // } // // @Server // public void handle(Packet82UpdateSign packet) { // } // // // @Server // // public void handle(Packet6BSlot); // @Server // public void handle(PacketCAPlayerAbilities packet) { // } // // @Server // public void handle(PacketCBTabComplete packet) { // } // // @Server // public void handle(PacketCCClientInfo packet) { // } // // @Server // @ServerLogin // public void handle(PacketCDClientStatus packet) { // } // // @Server // public void handle(PacketFAPluginMessage packet) { // } // // @ServerLogin // public void handle(PacketFCKeyResponse packet) { // } // // @ServerLogin // public void handle(PacketFEServerPing packet) { // } // // @Server // public void handle(PacketFFDisconnect packet) { // } // // /** // * Methods denoted by this annotation should be handled by a server // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Server { // } // // /** // * Methods denoted by this annotation should be handled by the initial // * server implementation of this class. // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface ServerLogin { // } // // /** // * Methods denoted by this method annotation be handled by a client // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Client { // } // }
import com.md_5.fondue.protocol.PacketHandler; import io.netty.buffer.ByteBuf; import lombok.EqualsAndHashCode; import lombok.ToString;
package com.md_5.fondue.protocol.packet; @ToString @EqualsAndHashCode(callSuper = false) public class Packet6AConfirmTransaction extends Packet { private byte windowId; private short actionNumber; private boolean accepted; public Packet6AConfirmTransaction() { } @Override public void read(ByteBuf in) { windowId = in.readByte(); actionNumber = in.readShort(); accepted = in.readBoolean(); } @Override public void write(ByteBuf out) { out.writeByte(windowId); out.writeShort(actionNumber); out.writeBoolean(accepted); } @Override
// Path: src/main/java/com/md_5/fondue/protocol/PacketHandler.java // public abstract class PacketHandler { // // /** // * Method to determine whether this is a server handler, client handler or // * other. // * // * @return the type of method interface this handler should accept // */ // public abstract Class<? extends Annotation> getType(); // // @Server // public void handle(Packet0KeepAlive packet) { // } // // @ServerLogin // public void handle(Packet2Handshake packet) { // } // // @Server // public void handle(Packet3ChatMessage packet) { // } // // @Server // public void handle(Packet7UseEntity packet) { // } // // @Server // public void handle(PacketAFlying packet) { // } // // @Server // public void handle(PacketEDig packet) { // } // // @Server // // public void handle(PacketFPlace packet){} // // @Server // public void handle(Packet10HeldItem packet) { // } // // @Server // public void handle(Packet12Animation packet) { // } // // @Server // public void handle(Packet13EntityAction packet) { // } // // @Server // // public void handle(Packet66WindowClick packet){} // // @Server // public void handle(Packet6AConfirmTransaction packet) { // } // // @Server // public void handle(Packet6CEnchantItem packet) { // } // // @Server // public void handle(Packet82UpdateSign packet) { // } // // // @Server // // public void handle(Packet6BSlot); // @Server // public void handle(PacketCAPlayerAbilities packet) { // } // // @Server // public void handle(PacketCBTabComplete packet) { // } // // @Server // public void handle(PacketCCClientInfo packet) { // } // // @Server // @ServerLogin // public void handle(PacketCDClientStatus packet) { // } // // @Server // public void handle(PacketFAPluginMessage packet) { // } // // @ServerLogin // public void handle(PacketFCKeyResponse packet) { // } // // @ServerLogin // public void handle(PacketFEServerPing packet) { // } // // @Server // public void handle(PacketFFDisconnect packet) { // } // // /** // * Methods denoted by this annotation should be handled by a server // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Server { // } // // /** // * Methods denoted by this annotation should be handled by the initial // * server implementation of this class. // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface ServerLogin { // } // // /** // * Methods denoted by this method annotation be handled by a client // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Client { // } // } // Path: src/main/java/com/md_5/fondue/protocol/packet/Packet6AConfirmTransaction.java import com.md_5.fondue.protocol.PacketHandler; import io.netty.buffer.ByteBuf; import lombok.EqualsAndHashCode; import lombok.ToString; package com.md_5.fondue.protocol.packet; @ToString @EqualsAndHashCode(callSuper = false) public class Packet6AConfirmTransaction extends Packet { private byte windowId; private short actionNumber; private boolean accepted; public Packet6AConfirmTransaction() { } @Override public void read(ByteBuf in) { windowId = in.readByte(); actionNumber = in.readShort(); accepted = in.readBoolean(); } @Override public void write(ByteBuf out) { out.writeByte(windowId); out.writeShort(actionNumber); out.writeBoolean(accepted); } @Override
public void handle(PacketHandler handler) {
BukkitDevTeam/Fondue
src/main/java/com/md_5/fondue/protocol/packet/Packet4Time.java
// Path: src/main/java/com/md_5/fondue/protocol/PacketHandler.java // public abstract class PacketHandler { // // /** // * Method to determine whether this is a server handler, client handler or // * other. // * // * @return the type of method interface this handler should accept // */ // public abstract Class<? extends Annotation> getType(); // // @Server // public void handle(Packet0KeepAlive packet) { // } // // @ServerLogin // public void handle(Packet2Handshake packet) { // } // // @Server // public void handle(Packet3ChatMessage packet) { // } // // @Server // public void handle(Packet7UseEntity packet) { // } // // @Server // public void handle(PacketAFlying packet) { // } // // @Server // public void handle(PacketEDig packet) { // } // // @Server // // public void handle(PacketFPlace packet){} // // @Server // public void handle(Packet10HeldItem packet) { // } // // @Server // public void handle(Packet12Animation packet) { // } // // @Server // public void handle(Packet13EntityAction packet) { // } // // @Server // // public void handle(Packet66WindowClick packet){} // // @Server // public void handle(Packet6AConfirmTransaction packet) { // } // // @Server // public void handle(Packet6CEnchantItem packet) { // } // // @Server // public void handle(Packet82UpdateSign packet) { // } // // // @Server // // public void handle(Packet6BSlot); // @Server // public void handle(PacketCAPlayerAbilities packet) { // } // // @Server // public void handle(PacketCBTabComplete packet) { // } // // @Server // public void handle(PacketCCClientInfo packet) { // } // // @Server // @ServerLogin // public void handle(PacketCDClientStatus packet) { // } // // @Server // public void handle(PacketFAPluginMessage packet) { // } // // @ServerLogin // public void handle(PacketFCKeyResponse packet) { // } // // @ServerLogin // public void handle(PacketFEServerPing packet) { // } // // @Server // public void handle(PacketFFDisconnect packet) { // } // // /** // * Methods denoted by this annotation should be handled by a server // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Server { // } // // /** // * Methods denoted by this annotation should be handled by the initial // * server implementation of this class. // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface ServerLogin { // } // // /** // * Methods denoted by this method annotation be handled by a client // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Client { // } // }
import com.md_5.fondue.protocol.PacketHandler; import io.netty.buffer.ByteBuf; import lombok.EqualsAndHashCode; import lombok.ToString;
package com.md_5.fondue.protocol.packet; @ToString @EqualsAndHashCode(callSuper = false) public class Packet4Time extends Packet { private long time; public Packet4Time() { } @Override public void read(ByteBuf in) { time = in.readLong(); } @Override public void write(ByteBuf out) { out.writeLong(time); } @Override
// Path: src/main/java/com/md_5/fondue/protocol/PacketHandler.java // public abstract class PacketHandler { // // /** // * Method to determine whether this is a server handler, client handler or // * other. // * // * @return the type of method interface this handler should accept // */ // public abstract Class<? extends Annotation> getType(); // // @Server // public void handle(Packet0KeepAlive packet) { // } // // @ServerLogin // public void handle(Packet2Handshake packet) { // } // // @Server // public void handle(Packet3ChatMessage packet) { // } // // @Server // public void handle(Packet7UseEntity packet) { // } // // @Server // public void handle(PacketAFlying packet) { // } // // @Server // public void handle(PacketEDig packet) { // } // // @Server // // public void handle(PacketFPlace packet){} // // @Server // public void handle(Packet10HeldItem packet) { // } // // @Server // public void handle(Packet12Animation packet) { // } // // @Server // public void handle(Packet13EntityAction packet) { // } // // @Server // // public void handle(Packet66WindowClick packet){} // // @Server // public void handle(Packet6AConfirmTransaction packet) { // } // // @Server // public void handle(Packet6CEnchantItem packet) { // } // // @Server // public void handle(Packet82UpdateSign packet) { // } // // // @Server // // public void handle(Packet6BSlot); // @Server // public void handle(PacketCAPlayerAbilities packet) { // } // // @Server // public void handle(PacketCBTabComplete packet) { // } // // @Server // public void handle(PacketCCClientInfo packet) { // } // // @Server // @ServerLogin // public void handle(PacketCDClientStatus packet) { // } // // @Server // public void handle(PacketFAPluginMessage packet) { // } // // @ServerLogin // public void handle(PacketFCKeyResponse packet) { // } // // @ServerLogin // public void handle(PacketFEServerPing packet) { // } // // @Server // public void handle(PacketFFDisconnect packet) { // } // // /** // * Methods denoted by this annotation should be handled by a server // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Server { // } // // /** // * Methods denoted by this annotation should be handled by the initial // * server implementation of this class. // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface ServerLogin { // } // // /** // * Methods denoted by this method annotation be handled by a client // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Client { // } // } // Path: src/main/java/com/md_5/fondue/protocol/packet/Packet4Time.java import com.md_5.fondue.protocol.PacketHandler; import io.netty.buffer.ByteBuf; import lombok.EqualsAndHashCode; import lombok.ToString; package com.md_5.fondue.protocol.packet; @ToString @EqualsAndHashCode(callSuper = false) public class Packet4Time extends Packet { private long time; public Packet4Time() { } @Override public void read(ByteBuf in) { time = in.readLong(); } @Override public void write(ByteBuf out) { out.writeLong(time); } @Override
public void handle(PacketHandler handler) {
BukkitDevTeam/Fondue
src/main/java/com/md_5/fondue/protocol/packet/Packet20EntityLook.java
// Path: src/main/java/com/md_5/fondue/protocol/PacketHandler.java // public abstract class PacketHandler { // // /** // * Method to determine whether this is a server handler, client handler or // * other. // * // * @return the type of method interface this handler should accept // */ // public abstract Class<? extends Annotation> getType(); // // @Server // public void handle(Packet0KeepAlive packet) { // } // // @ServerLogin // public void handle(Packet2Handshake packet) { // } // // @Server // public void handle(Packet3ChatMessage packet) { // } // // @Server // public void handle(Packet7UseEntity packet) { // } // // @Server // public void handle(PacketAFlying packet) { // } // // @Server // public void handle(PacketEDig packet) { // } // // @Server // // public void handle(PacketFPlace packet){} // // @Server // public void handle(Packet10HeldItem packet) { // } // // @Server // public void handle(Packet12Animation packet) { // } // // @Server // public void handle(Packet13EntityAction packet) { // } // // @Server // // public void handle(Packet66WindowClick packet){} // // @Server // public void handle(Packet6AConfirmTransaction packet) { // } // // @Server // public void handle(Packet6CEnchantItem packet) { // } // // @Server // public void handle(Packet82UpdateSign packet) { // } // // // @Server // // public void handle(Packet6BSlot); // @Server // public void handle(PacketCAPlayerAbilities packet) { // } // // @Server // public void handle(PacketCBTabComplete packet) { // } // // @Server // public void handle(PacketCCClientInfo packet) { // } // // @Server // @ServerLogin // public void handle(PacketCDClientStatus packet) { // } // // @Server // public void handle(PacketFAPluginMessage packet) { // } // // @ServerLogin // public void handle(PacketFCKeyResponse packet) { // } // // @ServerLogin // public void handle(PacketFEServerPing packet) { // } // // @Server // public void handle(PacketFFDisconnect packet) { // } // // /** // * Methods denoted by this annotation should be handled by a server // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Server { // } // // /** // * Methods denoted by this annotation should be handled by the initial // * server implementation of this class. // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface ServerLogin { // } // // /** // * Methods denoted by this method annotation be handled by a client // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Client { // } // }
import com.md_5.fondue.protocol.PacketHandler; import io.netty.buffer.ByteBuf; import lombok.EqualsAndHashCode; import lombok.ToString;
package com.md_5.fondue.protocol.packet; @ToString @EqualsAndHashCode(callSuper = false) public class Packet20EntityLook extends Packet1EEntity { private byte yaw; private byte pitch; @Override public void read(ByteBuf in) { super.read(in); yaw = in.readByte(); pitch = in.readByte(); } @Override public void write(ByteBuf out) { super.write(out); out.writeByte(yaw); out.writeByte(pitch); } @Override
// Path: src/main/java/com/md_5/fondue/protocol/PacketHandler.java // public abstract class PacketHandler { // // /** // * Method to determine whether this is a server handler, client handler or // * other. // * // * @return the type of method interface this handler should accept // */ // public abstract Class<? extends Annotation> getType(); // // @Server // public void handle(Packet0KeepAlive packet) { // } // // @ServerLogin // public void handle(Packet2Handshake packet) { // } // // @Server // public void handle(Packet3ChatMessage packet) { // } // // @Server // public void handle(Packet7UseEntity packet) { // } // // @Server // public void handle(PacketAFlying packet) { // } // // @Server // public void handle(PacketEDig packet) { // } // // @Server // // public void handle(PacketFPlace packet){} // // @Server // public void handle(Packet10HeldItem packet) { // } // // @Server // public void handle(Packet12Animation packet) { // } // // @Server // public void handle(Packet13EntityAction packet) { // } // // @Server // // public void handle(Packet66WindowClick packet){} // // @Server // public void handle(Packet6AConfirmTransaction packet) { // } // // @Server // public void handle(Packet6CEnchantItem packet) { // } // // @Server // public void handle(Packet82UpdateSign packet) { // } // // // @Server // // public void handle(Packet6BSlot); // @Server // public void handle(PacketCAPlayerAbilities packet) { // } // // @Server // public void handle(PacketCBTabComplete packet) { // } // // @Server // public void handle(PacketCCClientInfo packet) { // } // // @Server // @ServerLogin // public void handle(PacketCDClientStatus packet) { // } // // @Server // public void handle(PacketFAPluginMessage packet) { // } // // @ServerLogin // public void handle(PacketFCKeyResponse packet) { // } // // @ServerLogin // public void handle(PacketFEServerPing packet) { // } // // @Server // public void handle(PacketFFDisconnect packet) { // } // // /** // * Methods denoted by this annotation should be handled by a server // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Server { // } // // /** // * Methods denoted by this annotation should be handled by the initial // * server implementation of this class. // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface ServerLogin { // } // // /** // * Methods denoted by this method annotation be handled by a client // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Client { // } // } // Path: src/main/java/com/md_5/fondue/protocol/packet/Packet20EntityLook.java import com.md_5.fondue.protocol.PacketHandler; import io.netty.buffer.ByteBuf; import lombok.EqualsAndHashCode; import lombok.ToString; package com.md_5.fondue.protocol.packet; @ToString @EqualsAndHashCode(callSuper = false) public class Packet20EntityLook extends Packet1EEntity { private byte yaw; private byte pitch; @Override public void read(ByteBuf in) { super.read(in); yaw = in.readByte(); pitch = in.readByte(); } @Override public void write(ByteBuf out) { super.write(out); out.writeByte(yaw); out.writeByte(pitch); } @Override
public void handle(PacketHandler handler) {
BukkitDevTeam/Fondue
src/main/java/com/md_5/fondue/protocol/packet/PacketC8IncrementStatistic.java
// Path: src/main/java/com/md_5/fondue/protocol/PacketHandler.java // public abstract class PacketHandler { // // /** // * Method to determine whether this is a server handler, client handler or // * other. // * // * @return the type of method interface this handler should accept // */ // public abstract Class<? extends Annotation> getType(); // // @Server // public void handle(Packet0KeepAlive packet) { // } // // @ServerLogin // public void handle(Packet2Handshake packet) { // } // // @Server // public void handle(Packet3ChatMessage packet) { // } // // @Server // public void handle(Packet7UseEntity packet) { // } // // @Server // public void handle(PacketAFlying packet) { // } // // @Server // public void handle(PacketEDig packet) { // } // // @Server // // public void handle(PacketFPlace packet){} // // @Server // public void handle(Packet10HeldItem packet) { // } // // @Server // public void handle(Packet12Animation packet) { // } // // @Server // public void handle(Packet13EntityAction packet) { // } // // @Server // // public void handle(Packet66WindowClick packet){} // // @Server // public void handle(Packet6AConfirmTransaction packet) { // } // // @Server // public void handle(Packet6CEnchantItem packet) { // } // // @Server // public void handle(Packet82UpdateSign packet) { // } // // // @Server // // public void handle(Packet6BSlot); // @Server // public void handle(PacketCAPlayerAbilities packet) { // } // // @Server // public void handle(PacketCBTabComplete packet) { // } // // @Server // public void handle(PacketCCClientInfo packet) { // } // // @Server // @ServerLogin // public void handle(PacketCDClientStatus packet) { // } // // @Server // public void handle(PacketFAPluginMessage packet) { // } // // @ServerLogin // public void handle(PacketFCKeyResponse packet) { // } // // @ServerLogin // public void handle(PacketFEServerPing packet) { // } // // @Server // public void handle(PacketFFDisconnect packet) { // } // // /** // * Methods denoted by this annotation should be handled by a server // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Server { // } // // /** // * Methods denoted by this annotation should be handled by the initial // * server implementation of this class. // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface ServerLogin { // } // // /** // * Methods denoted by this method annotation be handled by a client // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Client { // } // }
import com.md_5.fondue.protocol.PacketHandler; import io.netty.buffer.ByteBuf; import lombok.EqualsAndHashCode; import lombok.ToString;
package com.md_5.fondue.protocol.packet; @ToString @EqualsAndHashCode(callSuper = false) public class PacketC8IncrementStatistic extends Packet { private int statistic; private byte amount; public PacketC8IncrementStatistic() { } @Override public void read(ByteBuf in) { statistic = in.readInt(); amount = in.readByte(); } @Override public void write(ByteBuf out) { out.writeInt(statistic); out.writeByte(amount); } @Override
// Path: src/main/java/com/md_5/fondue/protocol/PacketHandler.java // public abstract class PacketHandler { // // /** // * Method to determine whether this is a server handler, client handler or // * other. // * // * @return the type of method interface this handler should accept // */ // public abstract Class<? extends Annotation> getType(); // // @Server // public void handle(Packet0KeepAlive packet) { // } // // @ServerLogin // public void handle(Packet2Handshake packet) { // } // // @Server // public void handle(Packet3ChatMessage packet) { // } // // @Server // public void handle(Packet7UseEntity packet) { // } // // @Server // public void handle(PacketAFlying packet) { // } // // @Server // public void handle(PacketEDig packet) { // } // // @Server // // public void handle(PacketFPlace packet){} // // @Server // public void handle(Packet10HeldItem packet) { // } // // @Server // public void handle(Packet12Animation packet) { // } // // @Server // public void handle(Packet13EntityAction packet) { // } // // @Server // // public void handle(Packet66WindowClick packet){} // // @Server // public void handle(Packet6AConfirmTransaction packet) { // } // // @Server // public void handle(Packet6CEnchantItem packet) { // } // // @Server // public void handle(Packet82UpdateSign packet) { // } // // // @Server // // public void handle(Packet6BSlot); // @Server // public void handle(PacketCAPlayerAbilities packet) { // } // // @Server // public void handle(PacketCBTabComplete packet) { // } // // @Server // public void handle(PacketCCClientInfo packet) { // } // // @Server // @ServerLogin // public void handle(PacketCDClientStatus packet) { // } // // @Server // public void handle(PacketFAPluginMessage packet) { // } // // @ServerLogin // public void handle(PacketFCKeyResponse packet) { // } // // @ServerLogin // public void handle(PacketFEServerPing packet) { // } // // @Server // public void handle(PacketFFDisconnect packet) { // } // // /** // * Methods denoted by this annotation should be handled by a server // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Server { // } // // /** // * Methods denoted by this annotation should be handled by the initial // * server implementation of this class. // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface ServerLogin { // } // // /** // * Methods denoted by this method annotation be handled by a client // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Client { // } // } // Path: src/main/java/com/md_5/fondue/protocol/packet/PacketC8IncrementStatistic.java import com.md_5.fondue.protocol.PacketHandler; import io.netty.buffer.ByteBuf; import lombok.EqualsAndHashCode; import lombok.ToString; package com.md_5.fondue.protocol.packet; @ToString @EqualsAndHashCode(callSuper = false) public class PacketC8IncrementStatistic extends Packet { private int statistic; private byte amount; public PacketC8IncrementStatistic() { } @Override public void read(ByteBuf in) { statistic = in.readInt(); amount = in.readByte(); } @Override public void write(ByteBuf out) { out.writeInt(statistic); out.writeByte(amount); } @Override
public void handle(PacketHandler handler) {
BukkitDevTeam/Fondue
src/main/java/com/md_5/fondue/protocol/packet/PacketFCKeyResponse.java
// Path: src/main/java/com/md_5/fondue/protocol/PacketHandler.java // public abstract class PacketHandler { // // /** // * Method to determine whether this is a server handler, client handler or // * other. // * // * @return the type of method interface this handler should accept // */ // public abstract Class<? extends Annotation> getType(); // // @Server // public void handle(Packet0KeepAlive packet) { // } // // @ServerLogin // public void handle(Packet2Handshake packet) { // } // // @Server // public void handle(Packet3ChatMessage packet) { // } // // @Server // public void handle(Packet7UseEntity packet) { // } // // @Server // public void handle(PacketAFlying packet) { // } // // @Server // public void handle(PacketEDig packet) { // } // // @Server // // public void handle(PacketFPlace packet){} // // @Server // public void handle(Packet10HeldItem packet) { // } // // @Server // public void handle(Packet12Animation packet) { // } // // @Server // public void handle(Packet13EntityAction packet) { // } // // @Server // // public void handle(Packet66WindowClick packet){} // // @Server // public void handle(Packet6AConfirmTransaction packet) { // } // // @Server // public void handle(Packet6CEnchantItem packet) { // } // // @Server // public void handle(Packet82UpdateSign packet) { // } // // // @Server // // public void handle(Packet6BSlot); // @Server // public void handle(PacketCAPlayerAbilities packet) { // } // // @Server // public void handle(PacketCBTabComplete packet) { // } // // @Server // public void handle(PacketCCClientInfo packet) { // } // // @Server // @ServerLogin // public void handle(PacketCDClientStatus packet) { // } // // @Server // public void handle(PacketFAPluginMessage packet) { // } // // @ServerLogin // public void handle(PacketFCKeyResponse packet) { // } // // @ServerLogin // public void handle(PacketFEServerPing packet) { // } // // @Server // public void handle(PacketFFDisconnect packet) { // } // // /** // * Methods denoted by this annotation should be handled by a server // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Server { // } // // /** // * Methods denoted by this annotation should be handled by the initial // * server implementation of this class. // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface ServerLogin { // } // // /** // * Methods denoted by this method annotation be handled by a client // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Client { // } // }
import com.md_5.fondue.protocol.PacketHandler; import io.netty.buffer.ByteBuf; import lombok.EqualsAndHashCode; import lombok.ToString;
package com.md_5.fondue.protocol.packet; @ToString @EqualsAndHashCode(callSuper = false) public class PacketFCKeyResponse extends Packet { private byte[] sharedSecret; private byte[] verifyToken; public PacketFCKeyResponse() { } @Override public void read(ByteBuf in) { sharedSecret = readBytes(in); verifyToken = readBytes(in); } @Override public void write(ByteBuf out) { writeBytes(out, sharedSecret); writeBytes(out, verifyToken); } @Override
// Path: src/main/java/com/md_5/fondue/protocol/PacketHandler.java // public abstract class PacketHandler { // // /** // * Method to determine whether this is a server handler, client handler or // * other. // * // * @return the type of method interface this handler should accept // */ // public abstract Class<? extends Annotation> getType(); // // @Server // public void handle(Packet0KeepAlive packet) { // } // // @ServerLogin // public void handle(Packet2Handshake packet) { // } // // @Server // public void handle(Packet3ChatMessage packet) { // } // // @Server // public void handle(Packet7UseEntity packet) { // } // // @Server // public void handle(PacketAFlying packet) { // } // // @Server // public void handle(PacketEDig packet) { // } // // @Server // // public void handle(PacketFPlace packet){} // // @Server // public void handle(Packet10HeldItem packet) { // } // // @Server // public void handle(Packet12Animation packet) { // } // // @Server // public void handle(Packet13EntityAction packet) { // } // // @Server // // public void handle(Packet66WindowClick packet){} // // @Server // public void handle(Packet6AConfirmTransaction packet) { // } // // @Server // public void handle(Packet6CEnchantItem packet) { // } // // @Server // public void handle(Packet82UpdateSign packet) { // } // // // @Server // // public void handle(Packet6BSlot); // @Server // public void handle(PacketCAPlayerAbilities packet) { // } // // @Server // public void handle(PacketCBTabComplete packet) { // } // // @Server // public void handle(PacketCCClientInfo packet) { // } // // @Server // @ServerLogin // public void handle(PacketCDClientStatus packet) { // } // // @Server // public void handle(PacketFAPluginMessage packet) { // } // // @ServerLogin // public void handle(PacketFCKeyResponse packet) { // } // // @ServerLogin // public void handle(PacketFEServerPing packet) { // } // // @Server // public void handle(PacketFFDisconnect packet) { // } // // /** // * Methods denoted by this annotation should be handled by a server // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Server { // } // // /** // * Methods denoted by this annotation should be handled by the initial // * server implementation of this class. // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface ServerLogin { // } // // /** // * Methods denoted by this method annotation be handled by a client // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Client { // } // } // Path: src/main/java/com/md_5/fondue/protocol/packet/PacketFCKeyResponse.java import com.md_5.fondue.protocol.PacketHandler; import io.netty.buffer.ByteBuf; import lombok.EqualsAndHashCode; import lombok.ToString; package com.md_5.fondue.protocol.packet; @ToString @EqualsAndHashCode(callSuper = false) public class PacketFCKeyResponse extends Packet { private byte[] sharedSecret; private byte[] verifyToken; public PacketFCKeyResponse() { } @Override public void read(ByteBuf in) { sharedSecret = readBytes(in); verifyToken = readBytes(in); } @Override public void write(ByteBuf out) { writeBytes(out, sharedSecret); writeBytes(out, verifyToken); } @Override
public void handle(PacketHandler handler) {
BukkitDevTeam/Fondue
src/main/java/com/md_5/fondue/protocol/packet/Packet23EntityHeadLook.java
// Path: src/main/java/com/md_5/fondue/protocol/PacketHandler.java // public abstract class PacketHandler { // // /** // * Method to determine whether this is a server handler, client handler or // * other. // * // * @return the type of method interface this handler should accept // */ // public abstract Class<? extends Annotation> getType(); // // @Server // public void handle(Packet0KeepAlive packet) { // } // // @ServerLogin // public void handle(Packet2Handshake packet) { // } // // @Server // public void handle(Packet3ChatMessage packet) { // } // // @Server // public void handle(Packet7UseEntity packet) { // } // // @Server // public void handle(PacketAFlying packet) { // } // // @Server // public void handle(PacketEDig packet) { // } // // @Server // // public void handle(PacketFPlace packet){} // // @Server // public void handle(Packet10HeldItem packet) { // } // // @Server // public void handle(Packet12Animation packet) { // } // // @Server // public void handle(Packet13EntityAction packet) { // } // // @Server // // public void handle(Packet66WindowClick packet){} // // @Server // public void handle(Packet6AConfirmTransaction packet) { // } // // @Server // public void handle(Packet6CEnchantItem packet) { // } // // @Server // public void handle(Packet82UpdateSign packet) { // } // // // @Server // // public void handle(Packet6BSlot); // @Server // public void handle(PacketCAPlayerAbilities packet) { // } // // @Server // public void handle(PacketCBTabComplete packet) { // } // // @Server // public void handle(PacketCCClientInfo packet) { // } // // @Server // @ServerLogin // public void handle(PacketCDClientStatus packet) { // } // // @Server // public void handle(PacketFAPluginMessage packet) { // } // // @ServerLogin // public void handle(PacketFCKeyResponse packet) { // } // // @ServerLogin // public void handle(PacketFEServerPing packet) { // } // // @Server // public void handle(PacketFFDisconnect packet) { // } // // /** // * Methods denoted by this annotation should be handled by a server // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Server { // } // // /** // * Methods denoted by this annotation should be handled by the initial // * server implementation of this class. // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface ServerLogin { // } // // /** // * Methods denoted by this method annotation be handled by a client // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Client { // } // }
import com.md_5.fondue.protocol.PacketHandler; import io.netty.buffer.ByteBuf; import lombok.EqualsAndHashCode; import lombok.ToString;
package com.md_5.fondue.protocol.packet; @ToString @EqualsAndHashCode(callSuper = false) public class Packet23EntityHeadLook extends Packet1EEntity { private byte headYaw; public Packet23EntityHeadLook() { } @Override public void read(ByteBuf in) { super.read(in); headYaw = in.readByte(); } @Override public void write(ByteBuf out) { super.write(out); out.writeByte(headYaw); } @Override
// Path: src/main/java/com/md_5/fondue/protocol/PacketHandler.java // public abstract class PacketHandler { // // /** // * Method to determine whether this is a server handler, client handler or // * other. // * // * @return the type of method interface this handler should accept // */ // public abstract Class<? extends Annotation> getType(); // // @Server // public void handle(Packet0KeepAlive packet) { // } // // @ServerLogin // public void handle(Packet2Handshake packet) { // } // // @Server // public void handle(Packet3ChatMessage packet) { // } // // @Server // public void handle(Packet7UseEntity packet) { // } // // @Server // public void handle(PacketAFlying packet) { // } // // @Server // public void handle(PacketEDig packet) { // } // // @Server // // public void handle(PacketFPlace packet){} // // @Server // public void handle(Packet10HeldItem packet) { // } // // @Server // public void handle(Packet12Animation packet) { // } // // @Server // public void handle(Packet13EntityAction packet) { // } // // @Server // // public void handle(Packet66WindowClick packet){} // // @Server // public void handle(Packet6AConfirmTransaction packet) { // } // // @Server // public void handle(Packet6CEnchantItem packet) { // } // // @Server // public void handle(Packet82UpdateSign packet) { // } // // // @Server // // public void handle(Packet6BSlot); // @Server // public void handle(PacketCAPlayerAbilities packet) { // } // // @Server // public void handle(PacketCBTabComplete packet) { // } // // @Server // public void handle(PacketCCClientInfo packet) { // } // // @Server // @ServerLogin // public void handle(PacketCDClientStatus packet) { // } // // @Server // public void handle(PacketFAPluginMessage packet) { // } // // @ServerLogin // public void handle(PacketFCKeyResponse packet) { // } // // @ServerLogin // public void handle(PacketFEServerPing packet) { // } // // @Server // public void handle(PacketFFDisconnect packet) { // } // // /** // * Methods denoted by this annotation should be handled by a server // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Server { // } // // /** // * Methods denoted by this annotation should be handled by the initial // * server implementation of this class. // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface ServerLogin { // } // // /** // * Methods denoted by this method annotation be handled by a client // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Client { // } // } // Path: src/main/java/com/md_5/fondue/protocol/packet/Packet23EntityHeadLook.java import com.md_5.fondue.protocol.PacketHandler; import io.netty.buffer.ByteBuf; import lombok.EqualsAndHashCode; import lombok.ToString; package com.md_5.fondue.protocol.packet; @ToString @EqualsAndHashCode(callSuper = false) public class Packet23EntityHeadLook extends Packet1EEntity { private byte headYaw; public Packet23EntityHeadLook() { } @Override public void read(ByteBuf in) { super.read(in); headYaw = in.readByte(); } @Override public void write(ByteBuf out) { super.write(out); out.writeByte(headYaw); } @Override
public void handle(PacketHandler handler) {
BukkitDevTeam/Fondue
src/main/java/com/md_5/fondue/protocol/packet/Packet83MapData.java
// Path: src/main/java/com/md_5/fondue/protocol/PacketHandler.java // public abstract class PacketHandler { // // /** // * Method to determine whether this is a server handler, client handler or // * other. // * // * @return the type of method interface this handler should accept // */ // public abstract Class<? extends Annotation> getType(); // // @Server // public void handle(Packet0KeepAlive packet) { // } // // @ServerLogin // public void handle(Packet2Handshake packet) { // } // // @Server // public void handle(Packet3ChatMessage packet) { // } // // @Server // public void handle(Packet7UseEntity packet) { // } // // @Server // public void handle(PacketAFlying packet) { // } // // @Server // public void handle(PacketEDig packet) { // } // // @Server // // public void handle(PacketFPlace packet){} // // @Server // public void handle(Packet10HeldItem packet) { // } // // @Server // public void handle(Packet12Animation packet) { // } // // @Server // public void handle(Packet13EntityAction packet) { // } // // @Server // // public void handle(Packet66WindowClick packet){} // // @Server // public void handle(Packet6AConfirmTransaction packet) { // } // // @Server // public void handle(Packet6CEnchantItem packet) { // } // // @Server // public void handle(Packet82UpdateSign packet) { // } // // // @Server // // public void handle(Packet6BSlot); // @Server // public void handle(PacketCAPlayerAbilities packet) { // } // // @Server // public void handle(PacketCBTabComplete packet) { // } // // @Server // public void handle(PacketCCClientInfo packet) { // } // // @Server // @ServerLogin // public void handle(PacketCDClientStatus packet) { // } // // @Server // public void handle(PacketFAPluginMessage packet) { // } // // @ServerLogin // public void handle(PacketFCKeyResponse packet) { // } // // @ServerLogin // public void handle(PacketFEServerPing packet) { // } // // @Server // public void handle(PacketFFDisconnect packet) { // } // // /** // * Methods denoted by this annotation should be handled by a server // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Server { // } // // /** // * Methods denoted by this annotation should be handled by the initial // * server implementation of this class. // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface ServerLogin { // } // // /** // * Methods denoted by this method annotation be handled by a client // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Client { // } // }
import com.md_5.fondue.protocol.PacketHandler; import io.netty.buffer.ByteBuf; import lombok.EqualsAndHashCode; import lombok.ToString;
package com.md_5.fondue.protocol.packet; @ToString @EqualsAndHashCode(callSuper = false) public class Packet83MapData extends Packet { private short itemId; private short itemData; private byte[] data; public Packet83MapData() { } @Override public void read(ByteBuf in) { itemId = in.readShort(); itemData = in.readShort(); data = readBytes(in); } @Override public void write(ByteBuf out) { out.writeShort(itemId); out.writeShort(itemData); writeBytes(out, data); } @Override
// Path: src/main/java/com/md_5/fondue/protocol/PacketHandler.java // public abstract class PacketHandler { // // /** // * Method to determine whether this is a server handler, client handler or // * other. // * // * @return the type of method interface this handler should accept // */ // public abstract Class<? extends Annotation> getType(); // // @Server // public void handle(Packet0KeepAlive packet) { // } // // @ServerLogin // public void handle(Packet2Handshake packet) { // } // // @Server // public void handle(Packet3ChatMessage packet) { // } // // @Server // public void handle(Packet7UseEntity packet) { // } // // @Server // public void handle(PacketAFlying packet) { // } // // @Server // public void handle(PacketEDig packet) { // } // // @Server // // public void handle(PacketFPlace packet){} // // @Server // public void handle(Packet10HeldItem packet) { // } // // @Server // public void handle(Packet12Animation packet) { // } // // @Server // public void handle(Packet13EntityAction packet) { // } // // @Server // // public void handle(Packet66WindowClick packet){} // // @Server // public void handle(Packet6AConfirmTransaction packet) { // } // // @Server // public void handle(Packet6CEnchantItem packet) { // } // // @Server // public void handle(Packet82UpdateSign packet) { // } // // // @Server // // public void handle(Packet6BSlot); // @Server // public void handle(PacketCAPlayerAbilities packet) { // } // // @Server // public void handle(PacketCBTabComplete packet) { // } // // @Server // public void handle(PacketCCClientInfo packet) { // } // // @Server // @ServerLogin // public void handle(PacketCDClientStatus packet) { // } // // @Server // public void handle(PacketFAPluginMessage packet) { // } // // @ServerLogin // public void handle(PacketFCKeyResponse packet) { // } // // @ServerLogin // public void handle(PacketFEServerPing packet) { // } // // @Server // public void handle(PacketFFDisconnect packet) { // } // // /** // * Methods denoted by this annotation should be handled by a server // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Server { // } // // /** // * Methods denoted by this annotation should be handled by the initial // * server implementation of this class. // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface ServerLogin { // } // // /** // * Methods denoted by this method annotation be handled by a client // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Client { // } // } // Path: src/main/java/com/md_5/fondue/protocol/packet/Packet83MapData.java import com.md_5.fondue.protocol.PacketHandler; import io.netty.buffer.ByteBuf; import lombok.EqualsAndHashCode; import lombok.ToString; package com.md_5.fondue.protocol.packet; @ToString @EqualsAndHashCode(callSuper = false) public class Packet83MapData extends Packet { private short itemId; private short itemData; private byte[] data; public Packet83MapData() { } @Override public void read(ByteBuf in) { itemId = in.readShort(); itemData = in.readShort(); data = readBytes(in); } @Override public void write(ByteBuf out) { out.writeShort(itemId); out.writeShort(itemData); writeBytes(out, data); } @Override
public void handle(PacketHandler handler) {
BukkitDevTeam/Fondue
src/main/java/com/md_5/fondue/protocol/packet/Packet10HeldItem.java
// Path: src/main/java/com/md_5/fondue/protocol/PacketHandler.java // public abstract class PacketHandler { // // /** // * Method to determine whether this is a server handler, client handler or // * other. // * // * @return the type of method interface this handler should accept // */ // public abstract Class<? extends Annotation> getType(); // // @Server // public void handle(Packet0KeepAlive packet) { // } // // @ServerLogin // public void handle(Packet2Handshake packet) { // } // // @Server // public void handle(Packet3ChatMessage packet) { // } // // @Server // public void handle(Packet7UseEntity packet) { // } // // @Server // public void handle(PacketAFlying packet) { // } // // @Server // public void handle(PacketEDig packet) { // } // // @Server // // public void handle(PacketFPlace packet){} // // @Server // public void handle(Packet10HeldItem packet) { // } // // @Server // public void handle(Packet12Animation packet) { // } // // @Server // public void handle(Packet13EntityAction packet) { // } // // @Server // // public void handle(Packet66WindowClick packet){} // // @Server // public void handle(Packet6AConfirmTransaction packet) { // } // // @Server // public void handle(Packet6CEnchantItem packet) { // } // // @Server // public void handle(Packet82UpdateSign packet) { // } // // // @Server // // public void handle(Packet6BSlot); // @Server // public void handle(PacketCAPlayerAbilities packet) { // } // // @Server // public void handle(PacketCBTabComplete packet) { // } // // @Server // public void handle(PacketCCClientInfo packet) { // } // // @Server // @ServerLogin // public void handle(PacketCDClientStatus packet) { // } // // @Server // public void handle(PacketFAPluginMessage packet) { // } // // @ServerLogin // public void handle(PacketFCKeyResponse packet) { // } // // @ServerLogin // public void handle(PacketFEServerPing packet) { // } // // @Server // public void handle(PacketFFDisconnect packet) { // } // // /** // * Methods denoted by this annotation should be handled by a server // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Server { // } // // /** // * Methods denoted by this annotation should be handled by the initial // * server implementation of this class. // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface ServerLogin { // } // // /** // * Methods denoted by this method annotation be handled by a client // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Client { // } // }
import com.md_5.fondue.protocol.PacketHandler; import io.netty.buffer.ByteBuf; import lombok.EqualsAndHashCode; import lombok.ToString;
package com.md_5.fondue.protocol.packet; @ToString @EqualsAndHashCode(callSuper = false) public class Packet10HeldItem extends Packet { private short slot; public Packet10HeldItem() { } @Override public void read(ByteBuf in) { slot = in.readShort(); } @Override public void write(ByteBuf out) { out.writeShort(slot); } @Override
// Path: src/main/java/com/md_5/fondue/protocol/PacketHandler.java // public abstract class PacketHandler { // // /** // * Method to determine whether this is a server handler, client handler or // * other. // * // * @return the type of method interface this handler should accept // */ // public abstract Class<? extends Annotation> getType(); // // @Server // public void handle(Packet0KeepAlive packet) { // } // // @ServerLogin // public void handle(Packet2Handshake packet) { // } // // @Server // public void handle(Packet3ChatMessage packet) { // } // // @Server // public void handle(Packet7UseEntity packet) { // } // // @Server // public void handle(PacketAFlying packet) { // } // // @Server // public void handle(PacketEDig packet) { // } // // @Server // // public void handle(PacketFPlace packet){} // // @Server // public void handle(Packet10HeldItem packet) { // } // // @Server // public void handle(Packet12Animation packet) { // } // // @Server // public void handle(Packet13EntityAction packet) { // } // // @Server // // public void handle(Packet66WindowClick packet){} // // @Server // public void handle(Packet6AConfirmTransaction packet) { // } // // @Server // public void handle(Packet6CEnchantItem packet) { // } // // @Server // public void handle(Packet82UpdateSign packet) { // } // // // @Server // // public void handle(Packet6BSlot); // @Server // public void handle(PacketCAPlayerAbilities packet) { // } // // @Server // public void handle(PacketCBTabComplete packet) { // } // // @Server // public void handle(PacketCCClientInfo packet) { // } // // @Server // @ServerLogin // public void handle(PacketCDClientStatus packet) { // } // // @Server // public void handle(PacketFAPluginMessage packet) { // } // // @ServerLogin // public void handle(PacketFCKeyResponse packet) { // } // // @ServerLogin // public void handle(PacketFEServerPing packet) { // } // // @Server // public void handle(PacketFFDisconnect packet) { // } // // /** // * Methods denoted by this annotation should be handled by a server // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Server { // } // // /** // * Methods denoted by this annotation should be handled by the initial // * server implementation of this class. // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface ServerLogin { // } // // /** // * Methods denoted by this method annotation be handled by a client // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Client { // } // } // Path: src/main/java/com/md_5/fondue/protocol/packet/Packet10HeldItem.java import com.md_5.fondue.protocol.PacketHandler; import io.netty.buffer.ByteBuf; import lombok.EqualsAndHashCode; import lombok.ToString; package com.md_5.fondue.protocol.packet; @ToString @EqualsAndHashCode(callSuper = false) public class Packet10HeldItem extends Packet { private short slot; public Packet10HeldItem() { } @Override public void read(ByteBuf in) { slot = in.readShort(); } @Override public void write(ByteBuf out) { out.writeShort(slot); } @Override
public void handle(PacketHandler handler) {
BukkitDevTeam/Fondue
src/main/java/com/md_5/fondue/protocol/packet/PacketFFDisconnect.java
// Path: src/main/java/com/md_5/fondue/protocol/PacketHandler.java // public abstract class PacketHandler { // // /** // * Method to determine whether this is a server handler, client handler or // * other. // * // * @return the type of method interface this handler should accept // */ // public abstract Class<? extends Annotation> getType(); // // @Server // public void handle(Packet0KeepAlive packet) { // } // // @ServerLogin // public void handle(Packet2Handshake packet) { // } // // @Server // public void handle(Packet3ChatMessage packet) { // } // // @Server // public void handle(Packet7UseEntity packet) { // } // // @Server // public void handle(PacketAFlying packet) { // } // // @Server // public void handle(PacketEDig packet) { // } // // @Server // // public void handle(PacketFPlace packet){} // // @Server // public void handle(Packet10HeldItem packet) { // } // // @Server // public void handle(Packet12Animation packet) { // } // // @Server // public void handle(Packet13EntityAction packet) { // } // // @Server // // public void handle(Packet66WindowClick packet){} // // @Server // public void handle(Packet6AConfirmTransaction packet) { // } // // @Server // public void handle(Packet6CEnchantItem packet) { // } // // @Server // public void handle(Packet82UpdateSign packet) { // } // // // @Server // // public void handle(Packet6BSlot); // @Server // public void handle(PacketCAPlayerAbilities packet) { // } // // @Server // public void handle(PacketCBTabComplete packet) { // } // // @Server // public void handle(PacketCCClientInfo packet) { // } // // @Server // @ServerLogin // public void handle(PacketCDClientStatus packet) { // } // // @Server // public void handle(PacketFAPluginMessage packet) { // } // // @ServerLogin // public void handle(PacketFCKeyResponse packet) { // } // // @ServerLogin // public void handle(PacketFEServerPing packet) { // } // // @Server // public void handle(PacketFFDisconnect packet) { // } // // /** // * Methods denoted by this annotation should be handled by a server // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Server { // } // // /** // * Methods denoted by this annotation should be handled by the initial // * server implementation of this class. // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface ServerLogin { // } // // /** // * Methods denoted by this method annotation be handled by a client // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Client { // } // }
import com.md_5.fondue.protocol.PacketHandler; import io.netty.buffer.ByteBuf; import lombok.EqualsAndHashCode; import lombok.ToString;
package com.md_5.fondue.protocol.packet; @ToString @EqualsAndHashCode(callSuper = false) public class PacketFFDisconnect extends Packet { private String reason; public PacketFFDisconnect() { } public PacketFFDisconnect(String reason) { this.reason = reason; } @Override public void read(ByteBuf in) { reason = readString(in); } @Override public void write(ByteBuf out) { writeString(out, reason); } @Override
// Path: src/main/java/com/md_5/fondue/protocol/PacketHandler.java // public abstract class PacketHandler { // // /** // * Method to determine whether this is a server handler, client handler or // * other. // * // * @return the type of method interface this handler should accept // */ // public abstract Class<? extends Annotation> getType(); // // @Server // public void handle(Packet0KeepAlive packet) { // } // // @ServerLogin // public void handle(Packet2Handshake packet) { // } // // @Server // public void handle(Packet3ChatMessage packet) { // } // // @Server // public void handle(Packet7UseEntity packet) { // } // // @Server // public void handle(PacketAFlying packet) { // } // // @Server // public void handle(PacketEDig packet) { // } // // @Server // // public void handle(PacketFPlace packet){} // // @Server // public void handle(Packet10HeldItem packet) { // } // // @Server // public void handle(Packet12Animation packet) { // } // // @Server // public void handle(Packet13EntityAction packet) { // } // // @Server // // public void handle(Packet66WindowClick packet){} // // @Server // public void handle(Packet6AConfirmTransaction packet) { // } // // @Server // public void handle(Packet6CEnchantItem packet) { // } // // @Server // public void handle(Packet82UpdateSign packet) { // } // // // @Server // // public void handle(Packet6BSlot); // @Server // public void handle(PacketCAPlayerAbilities packet) { // } // // @Server // public void handle(PacketCBTabComplete packet) { // } // // @Server // public void handle(PacketCCClientInfo packet) { // } // // @Server // @ServerLogin // public void handle(PacketCDClientStatus packet) { // } // // @Server // public void handle(PacketFAPluginMessage packet) { // } // // @ServerLogin // public void handle(PacketFCKeyResponse packet) { // } // // @ServerLogin // public void handle(PacketFEServerPing packet) { // } // // @Server // public void handle(PacketFFDisconnect packet) { // } // // /** // * Methods denoted by this annotation should be handled by a server // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Server { // } // // /** // * Methods denoted by this annotation should be handled by the initial // * server implementation of this class. // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface ServerLogin { // } // // /** // * Methods denoted by this method annotation be handled by a client // * implementation of this class // */ // @Target(ElementType.METHOD) // @Retention(RetentionPolicy.RUNTIME) // protected @interface Client { // } // } // Path: src/main/java/com/md_5/fondue/protocol/packet/PacketFFDisconnect.java import com.md_5.fondue.protocol.PacketHandler; import io.netty.buffer.ByteBuf; import lombok.EqualsAndHashCode; import lombok.ToString; package com.md_5.fondue.protocol.packet; @ToString @EqualsAndHashCode(callSuper = false) public class PacketFFDisconnect extends Packet { private String reason; public PacketFFDisconnect() { } public PacketFFDisconnect(String reason) { this.reason = reason; } @Override public void read(ByteBuf in) { reason = readString(in); } @Override public void write(ByteBuf out) { writeString(out, reason); } @Override
public void handle(PacketHandler handler) {
Skarafaz/mercury
app/src/main/java/it/skarafaz/mercury/MercuryApplication.java
// Path: app/src/main/java/it/skarafaz/mercury/fragment/ProgressDialogFragment.java // public class ProgressDialogFragment extends DialogFragment { // public static final String TAG = "PROGRESS_DIALOG"; // private static final String CONTENT_ARG = "CONTENT_ARG"; // // @BindView(R.id.message) // protected TextView message; // // private String content; // // public static ProgressDialogFragment newInstance(String content) { // ProgressDialogFragment fragment = new ProgressDialogFragment(); // Bundle args = new Bundle(); // args.putString(CONTENT_ARG, content); // fragment.setArguments(args); // return fragment; // } // // @Override // public void onCreate(Bundle savedInstanceState) { // super.onCreate(savedInstanceState); // // setStyle(STYLE_NO_FRAME, R.style.DialogTransparent); // setCancelable(false); // // content = getArguments() != null ? getArguments().getString(CONTENT_ARG) : null; // } // // @Override // public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // View view = inflater.inflate(R.layout.dialog_fragment_progress, container, false); // ButterKnife.bind(this, view); // // message.setText(content); // // return view; // } // }
import android.view.ViewConfiguration; import it.skarafaz.mercury.fragment.ProgressDialogFragment; import org.greenrobot.eventbus.EventBus; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.lang.reflect.Field; import android.app.Activity; import android.app.Application; import android.content.Context; import android.content.pm.PackageManager; import android.os.Environment; import android.support.v4.app.ActivityCompat; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentTransaction; import android.support.v4.content.ContextCompat;
/* * Mercury-SSH * Copyright (C) 2017 Skarafaz * * This file is part of Mercury-SSH. * * Mercury-SSH is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 2 of the License, or * (at your option) any later version. * * Mercury-SSH is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Mercury-SSH. If not, see <http://www.gnu.org/licenses/>. */ package it.skarafaz.mercury; public class MercuryApplication extends Application { private static final String S_HAS_PERMANENT_MENU_KEY = "sHasPermanentMenuKey"; private static final Logger logger = LoggerFactory.getLogger(MercuryApplication.class); private static Context context; public static Context getContext() { return context; } @Override public void onCreate() { super.onCreate(); context = this; EventBus.builder().addIndex(new EventBusIndex()).build(); // hack for devices with hw options button try { ViewConfiguration config = ViewConfiguration.get(this); Field menuKeyField = ViewConfiguration.class.getDeclaredField(S_HAS_PERMANENT_MENU_KEY); if (menuKeyField != null) { menuKeyField.setAccessible(true); menuKeyField.setBoolean(config, false); } } catch (Exception e) { logger.error(e.getMessage().replace("\n", " ")); } } public static void showProgressDialog(FragmentManager manager, String content) { FragmentTransaction transaction = manager.beginTransaction();
// Path: app/src/main/java/it/skarafaz/mercury/fragment/ProgressDialogFragment.java // public class ProgressDialogFragment extends DialogFragment { // public static final String TAG = "PROGRESS_DIALOG"; // private static final String CONTENT_ARG = "CONTENT_ARG"; // // @BindView(R.id.message) // protected TextView message; // // private String content; // // public static ProgressDialogFragment newInstance(String content) { // ProgressDialogFragment fragment = new ProgressDialogFragment(); // Bundle args = new Bundle(); // args.putString(CONTENT_ARG, content); // fragment.setArguments(args); // return fragment; // } // // @Override // public void onCreate(Bundle savedInstanceState) { // super.onCreate(savedInstanceState); // // setStyle(STYLE_NO_FRAME, R.style.DialogTransparent); // setCancelable(false); // // content = getArguments() != null ? getArguments().getString(CONTENT_ARG) : null; // } // // @Override // public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // View view = inflater.inflate(R.layout.dialog_fragment_progress, container, false); // ButterKnife.bind(this, view); // // message.setText(content); // // return view; // } // } // Path: app/src/main/java/it/skarafaz/mercury/MercuryApplication.java import android.view.ViewConfiguration; import it.skarafaz.mercury.fragment.ProgressDialogFragment; import org.greenrobot.eventbus.EventBus; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.lang.reflect.Field; import android.app.Activity; import android.app.Application; import android.content.Context; import android.content.pm.PackageManager; import android.os.Environment; import android.support.v4.app.ActivityCompat; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentTransaction; import android.support.v4.content.ContextCompat; /* * Mercury-SSH * Copyright (C) 2017 Skarafaz * * This file is part of Mercury-SSH. * * Mercury-SSH is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 2 of the License, or * (at your option) any later version. * * Mercury-SSH is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Mercury-SSH. If not, see <http://www.gnu.org/licenses/>. */ package it.skarafaz.mercury; public class MercuryApplication extends Application { private static final String S_HAS_PERMANENT_MENU_KEY = "sHasPermanentMenuKey"; private static final Logger logger = LoggerFactory.getLogger(MercuryApplication.class); private static Context context; public static Context getContext() { return context; } @Override public void onCreate() { super.onCreate(); context = this; EventBus.builder().addIndex(new EventBusIndex()).build(); // hack for devices with hw options button try { ViewConfiguration config = ViewConfiguration.get(this); Field menuKeyField = ViewConfiguration.class.getDeclaredField(S_HAS_PERMANENT_MENU_KEY); if (menuKeyField != null) { menuKeyField.setAccessible(true); menuKeyField.setBoolean(config, false); } } catch (Exception e) { logger.error(e.getMessage().replace("\n", " ")); } } public static void showProgressDialog(FragmentManager manager, String content) { FragmentTransaction transaction = manager.beginTransaction();
transaction.add(ProgressDialogFragment.newInstance(content), ProgressDialogFragment.TAG);
Skarafaz/mercury
app/src/main/java/it/skarafaz/mercury/fragment/ServerFragment.java
// Path: app/src/main/java/it/skarafaz/mercury/adapter/CommandListAdapter.java // public class CommandListAdapter extends ArrayAdapter<Command> { // // public CommandListAdapter(Context context, List<Command> commands) { // super(context, R.layout.command_list_item, commands); // } // // @Override // public View getView(int position, View view, ViewGroup parent) { // ViewHolder holder; // if (view == null) { // LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE); // view = inflater.inflate(R.layout.command_list_item, parent, false); // holder = new ViewHolder(view); // view.setTag(holder); // } else { // holder = (ViewHolder) view.getTag(); // } // // final Command command = getItem(position); // holder.name.setText(command.getName()); // holder.info.setOnClickListener(new View.OnClickListener() { // @Override // public void onClick(View v) { // new MaterialDialog.Builder(getContext()) // .title(command.getName()) // .content(command.getCmd()) // .show(); // } // }); // holder.row.setOnClickListener(new View.OnClickListener() { // @Override // public void onClick(View v) { // new SshCommandRegular(command).start(); // } // }); // return view; // } // // static class ViewHolder { // @BindView(R.id.row) // RelativeLayout row; // @BindView(R.id.name) // TextView name; // @BindView(R.id.info) // ImageView info; // // public ViewHolder(View view) { // ButterKnife.bind(this, view); // } // } // } // // Path: app/src/main/java/it/skarafaz/mercury/model/config/Server.java // @SuppressWarnings("unused") // public class Server implements Serializable, Comparable<Server> { // private static final long serialVersionUID = 7247694914871605048L; // private String name; // private String host; // private Integer port; // private String user; // private String password; // private Boolean sudoNoPasswd; // private String sudoPath; // private String nohupPath; // private List<Command> commands; // // public String getName() { // return name; // } // // public void setName(String name) { // this.name = name; // } // // public String getHost() { // return host; // } // // public void setHost(String host) { // this.host = host; // } // // public Integer getPort() { // return port; // } // // public void setPort(Integer port) { // this.port = port; // } // // public String getUser() { // return user; // } // // public void setUser(String user) { // this.user = user; // } // // public String getPassword() { // return password; // } // // public void setPassword(String password) { // this.password = password; // } // // public Boolean getSudoNoPasswd() { // return sudoNoPasswd; // } // // public void setSudoNoPasswd(Boolean sudoNoPasswd) { // this.sudoNoPasswd = sudoNoPasswd; // } // // public String getSudoPath() { // return sudoPath; // } // // public void setSudoPath(String sudoPath) { // this.sudoPath = sudoPath; // } // // public String getNohupPath() { // return nohupPath; // } // // public void setNohupPath(String nohupPath) { // this.nohupPath = nohupPath; // } // // @JsonManagedReference // public List<Command> getCommands() { // return commands; // } // // public void setCommands(List<Command> commands) { // this.commands = commands; // } // // @Override // public int compareTo(@NonNull Server another) { // return name.toLowerCase().compareTo(another.getName().toLowerCase()); // } // }
import android.os.Bundle; import android.support.v4.app.ListFragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import it.skarafaz.mercury.R; import it.skarafaz.mercury.adapter.CommandListAdapter; import it.skarafaz.mercury.model.config.Server;
/* * Mercury-SSH * Copyright (C) 2017 Skarafaz * * This file is part of Mercury-SSH. * * Mercury-SSH is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 2 of the License, or * (at your option) any later version. * * Mercury-SSH is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Mercury-SSH. If not, see <http://www.gnu.org/licenses/>. */ package it.skarafaz.mercury.fragment; public class ServerFragment extends ListFragment { public static final String SERVER_ARG = "SERVER_ARG";
// Path: app/src/main/java/it/skarafaz/mercury/adapter/CommandListAdapter.java // public class CommandListAdapter extends ArrayAdapter<Command> { // // public CommandListAdapter(Context context, List<Command> commands) { // super(context, R.layout.command_list_item, commands); // } // // @Override // public View getView(int position, View view, ViewGroup parent) { // ViewHolder holder; // if (view == null) { // LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE); // view = inflater.inflate(R.layout.command_list_item, parent, false); // holder = new ViewHolder(view); // view.setTag(holder); // } else { // holder = (ViewHolder) view.getTag(); // } // // final Command command = getItem(position); // holder.name.setText(command.getName()); // holder.info.setOnClickListener(new View.OnClickListener() { // @Override // public void onClick(View v) { // new MaterialDialog.Builder(getContext()) // .title(command.getName()) // .content(command.getCmd()) // .show(); // } // }); // holder.row.setOnClickListener(new View.OnClickListener() { // @Override // public void onClick(View v) { // new SshCommandRegular(command).start(); // } // }); // return view; // } // // static class ViewHolder { // @BindView(R.id.row) // RelativeLayout row; // @BindView(R.id.name) // TextView name; // @BindView(R.id.info) // ImageView info; // // public ViewHolder(View view) { // ButterKnife.bind(this, view); // } // } // } // // Path: app/src/main/java/it/skarafaz/mercury/model/config/Server.java // @SuppressWarnings("unused") // public class Server implements Serializable, Comparable<Server> { // private static final long serialVersionUID = 7247694914871605048L; // private String name; // private String host; // private Integer port; // private String user; // private String password; // private Boolean sudoNoPasswd; // private String sudoPath; // private String nohupPath; // private List<Command> commands; // // public String getName() { // return name; // } // // public void setName(String name) { // this.name = name; // } // // public String getHost() { // return host; // } // // public void setHost(String host) { // this.host = host; // } // // public Integer getPort() { // return port; // } // // public void setPort(Integer port) { // this.port = port; // } // // public String getUser() { // return user; // } // // public void setUser(String user) { // this.user = user; // } // // public String getPassword() { // return password; // } // // public void setPassword(String password) { // this.password = password; // } // // public Boolean getSudoNoPasswd() { // return sudoNoPasswd; // } // // public void setSudoNoPasswd(Boolean sudoNoPasswd) { // this.sudoNoPasswd = sudoNoPasswd; // } // // public String getSudoPath() { // return sudoPath; // } // // public void setSudoPath(String sudoPath) { // this.sudoPath = sudoPath; // } // // public String getNohupPath() { // return nohupPath; // } // // public void setNohupPath(String nohupPath) { // this.nohupPath = nohupPath; // } // // @JsonManagedReference // public List<Command> getCommands() { // return commands; // } // // public void setCommands(List<Command> commands) { // this.commands = commands; // } // // @Override // public int compareTo(@NonNull Server another) { // return name.toLowerCase().compareTo(another.getName().toLowerCase()); // } // } // Path: app/src/main/java/it/skarafaz/mercury/fragment/ServerFragment.java import android.os.Bundle; import android.support.v4.app.ListFragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import it.skarafaz.mercury.R; import it.skarafaz.mercury.adapter.CommandListAdapter; import it.skarafaz.mercury.model.config.Server; /* * Mercury-SSH * Copyright (C) 2017 Skarafaz * * This file is part of Mercury-SSH. * * Mercury-SSH is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 2 of the License, or * (at your option) any later version. * * Mercury-SSH is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Mercury-SSH. If not, see <http://www.gnu.org/licenses/>. */ package it.skarafaz.mercury.fragment; public class ServerFragment extends ListFragment { public static final String SERVER_ARG = "SERVER_ARG";
private Server server;
Skarafaz/mercury
app/src/main/java/it/skarafaz/mercury/fragment/ServerFragment.java
// Path: app/src/main/java/it/skarafaz/mercury/adapter/CommandListAdapter.java // public class CommandListAdapter extends ArrayAdapter<Command> { // // public CommandListAdapter(Context context, List<Command> commands) { // super(context, R.layout.command_list_item, commands); // } // // @Override // public View getView(int position, View view, ViewGroup parent) { // ViewHolder holder; // if (view == null) { // LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE); // view = inflater.inflate(R.layout.command_list_item, parent, false); // holder = new ViewHolder(view); // view.setTag(holder); // } else { // holder = (ViewHolder) view.getTag(); // } // // final Command command = getItem(position); // holder.name.setText(command.getName()); // holder.info.setOnClickListener(new View.OnClickListener() { // @Override // public void onClick(View v) { // new MaterialDialog.Builder(getContext()) // .title(command.getName()) // .content(command.getCmd()) // .show(); // } // }); // holder.row.setOnClickListener(new View.OnClickListener() { // @Override // public void onClick(View v) { // new SshCommandRegular(command).start(); // } // }); // return view; // } // // static class ViewHolder { // @BindView(R.id.row) // RelativeLayout row; // @BindView(R.id.name) // TextView name; // @BindView(R.id.info) // ImageView info; // // public ViewHolder(View view) { // ButterKnife.bind(this, view); // } // } // } // // Path: app/src/main/java/it/skarafaz/mercury/model/config/Server.java // @SuppressWarnings("unused") // public class Server implements Serializable, Comparable<Server> { // private static final long serialVersionUID = 7247694914871605048L; // private String name; // private String host; // private Integer port; // private String user; // private String password; // private Boolean sudoNoPasswd; // private String sudoPath; // private String nohupPath; // private List<Command> commands; // // public String getName() { // return name; // } // // public void setName(String name) { // this.name = name; // } // // public String getHost() { // return host; // } // // public void setHost(String host) { // this.host = host; // } // // public Integer getPort() { // return port; // } // // public void setPort(Integer port) { // this.port = port; // } // // public String getUser() { // return user; // } // // public void setUser(String user) { // this.user = user; // } // // public String getPassword() { // return password; // } // // public void setPassword(String password) { // this.password = password; // } // // public Boolean getSudoNoPasswd() { // return sudoNoPasswd; // } // // public void setSudoNoPasswd(Boolean sudoNoPasswd) { // this.sudoNoPasswd = sudoNoPasswd; // } // // public String getSudoPath() { // return sudoPath; // } // // public void setSudoPath(String sudoPath) { // this.sudoPath = sudoPath; // } // // public String getNohupPath() { // return nohupPath; // } // // public void setNohupPath(String nohupPath) { // this.nohupPath = nohupPath; // } // // @JsonManagedReference // public List<Command> getCommands() { // return commands; // } // // public void setCommands(List<Command> commands) { // this.commands = commands; // } // // @Override // public int compareTo(@NonNull Server another) { // return name.toLowerCase().compareTo(another.getName().toLowerCase()); // } // }
import android.os.Bundle; import android.support.v4.app.ListFragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import it.skarafaz.mercury.R; import it.skarafaz.mercury.adapter.CommandListAdapter; import it.skarafaz.mercury.model.config.Server;
/* * Mercury-SSH * Copyright (C) 2017 Skarafaz * * This file is part of Mercury-SSH. * * Mercury-SSH is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 2 of the License, or * (at your option) any later version. * * Mercury-SSH is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Mercury-SSH. If not, see <http://www.gnu.org/licenses/>. */ package it.skarafaz.mercury.fragment; public class ServerFragment extends ListFragment { public static final String SERVER_ARG = "SERVER_ARG"; private Server server; public static ServerFragment newInstance(Server server) { ServerFragment fragment = new ServerFragment(); Bundle args = new Bundle(); args.putSerializable(SERVER_ARG, server); fragment.setArguments(args); return fragment; } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); server = getArguments() != null ? (Server) getArguments().getSerializable(SERVER_ARG) : null; } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { return inflater.inflate(R.layout.fragment_server, container, false); } @Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState);
// Path: app/src/main/java/it/skarafaz/mercury/adapter/CommandListAdapter.java // public class CommandListAdapter extends ArrayAdapter<Command> { // // public CommandListAdapter(Context context, List<Command> commands) { // super(context, R.layout.command_list_item, commands); // } // // @Override // public View getView(int position, View view, ViewGroup parent) { // ViewHolder holder; // if (view == null) { // LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE); // view = inflater.inflate(R.layout.command_list_item, parent, false); // holder = new ViewHolder(view); // view.setTag(holder); // } else { // holder = (ViewHolder) view.getTag(); // } // // final Command command = getItem(position); // holder.name.setText(command.getName()); // holder.info.setOnClickListener(new View.OnClickListener() { // @Override // public void onClick(View v) { // new MaterialDialog.Builder(getContext()) // .title(command.getName()) // .content(command.getCmd()) // .show(); // } // }); // holder.row.setOnClickListener(new View.OnClickListener() { // @Override // public void onClick(View v) { // new SshCommandRegular(command).start(); // } // }); // return view; // } // // static class ViewHolder { // @BindView(R.id.row) // RelativeLayout row; // @BindView(R.id.name) // TextView name; // @BindView(R.id.info) // ImageView info; // // public ViewHolder(View view) { // ButterKnife.bind(this, view); // } // } // } // // Path: app/src/main/java/it/skarafaz/mercury/model/config/Server.java // @SuppressWarnings("unused") // public class Server implements Serializable, Comparable<Server> { // private static final long serialVersionUID = 7247694914871605048L; // private String name; // private String host; // private Integer port; // private String user; // private String password; // private Boolean sudoNoPasswd; // private String sudoPath; // private String nohupPath; // private List<Command> commands; // // public String getName() { // return name; // } // // public void setName(String name) { // this.name = name; // } // // public String getHost() { // return host; // } // // public void setHost(String host) { // this.host = host; // } // // public Integer getPort() { // return port; // } // // public void setPort(Integer port) { // this.port = port; // } // // public String getUser() { // return user; // } // // public void setUser(String user) { // this.user = user; // } // // public String getPassword() { // return password; // } // // public void setPassword(String password) { // this.password = password; // } // // public Boolean getSudoNoPasswd() { // return sudoNoPasswd; // } // // public void setSudoNoPasswd(Boolean sudoNoPasswd) { // this.sudoNoPasswd = sudoNoPasswd; // } // // public String getSudoPath() { // return sudoPath; // } // // public void setSudoPath(String sudoPath) { // this.sudoPath = sudoPath; // } // // public String getNohupPath() { // return nohupPath; // } // // public void setNohupPath(String nohupPath) { // this.nohupPath = nohupPath; // } // // @JsonManagedReference // public List<Command> getCommands() { // return commands; // } // // public void setCommands(List<Command> commands) { // this.commands = commands; // } // // @Override // public int compareTo(@NonNull Server another) { // return name.toLowerCase().compareTo(another.getName().toLowerCase()); // } // } // Path: app/src/main/java/it/skarafaz/mercury/fragment/ServerFragment.java import android.os.Bundle; import android.support.v4.app.ListFragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import it.skarafaz.mercury.R; import it.skarafaz.mercury.adapter.CommandListAdapter; import it.skarafaz.mercury.model.config.Server; /* * Mercury-SSH * Copyright (C) 2017 Skarafaz * * This file is part of Mercury-SSH. * * Mercury-SSH is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 2 of the License, or * (at your option) any later version. * * Mercury-SSH is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Mercury-SSH. If not, see <http://www.gnu.org/licenses/>. */ package it.skarafaz.mercury.fragment; public class ServerFragment extends ListFragment { public static final String SERVER_ARG = "SERVER_ARG"; private Server server; public static ServerFragment newInstance(Server server) { ServerFragment fragment = new ServerFragment(); Bundle args = new Bundle(); args.putSerializable(SERVER_ARG, server); fragment.setArguments(args); return fragment; } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); server = getArguments() != null ? (Server) getArguments().getSerializable(SERVER_ARG) : null; } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { return inflater.inflate(R.layout.fragment_server, container, false); } @Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState);
setListAdapter(new CommandListAdapter(getActivity(), server.getCommands()));
Skarafaz/mercury
app/src/main/java/it/skarafaz/mercury/model/event/SshCommandMessage.java
// Path: app/src/main/java/it/skarafaz/mercury/ssh/SshCommandDrop.java // public class SshCommandDrop<E> { // private static final Logger logger = LoggerFactory.getLogger(SshCommandDrop.class); // private E obj; // private boolean empty = true; // // public synchronized E take() { // while (empty) { // try { // wait(); // } catch (InterruptedException e) { // logger.error(e.getMessage().replace("\n", " ")); // } // } // empty = true; // notifyAll(); // return obj; // } // // public synchronized void put(E obj) { // while (!empty) { // try { // wait(); // } catch (InterruptedException e) { // logger.error(e.getMessage().replace("\n", " ")); // } // } // empty = false; // this.obj = obj; // notifyAll(); // } // }
import it.skarafaz.mercury.ssh.SshCommandDrop;
/* * Mercury-SSH * Copyright (C) 2018 Skarafaz * * This file is part of Mercury-SSH. * * Mercury-SSH is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 2 of the License, or * (at your option) any later version. * * Mercury-SSH is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Mercury-SSH. If not, see <http://www.gnu.org/licenses/>. */ package it.skarafaz.mercury.model.event; public class SshCommandMessage { private String message;
// Path: app/src/main/java/it/skarafaz/mercury/ssh/SshCommandDrop.java // public class SshCommandDrop<E> { // private static final Logger logger = LoggerFactory.getLogger(SshCommandDrop.class); // private E obj; // private boolean empty = true; // // public synchronized E take() { // while (empty) { // try { // wait(); // } catch (InterruptedException e) { // logger.error(e.getMessage().replace("\n", " ")); // } // } // empty = true; // notifyAll(); // return obj; // } // // public synchronized void put(E obj) { // while (!empty) { // try { // wait(); // } catch (InterruptedException e) { // logger.error(e.getMessage().replace("\n", " ")); // } // } // empty = false; // this.obj = obj; // notifyAll(); // } // } // Path: app/src/main/java/it/skarafaz/mercury/model/event/SshCommandMessage.java import it.skarafaz.mercury.ssh.SshCommandDrop; /* * Mercury-SSH * Copyright (C) 2018 Skarafaz * * This file is part of Mercury-SSH. * * Mercury-SSH is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 2 of the License, or * (at your option) any later version. * * Mercury-SSH is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Mercury-SSH. If not, see <http://www.gnu.org/licenses/>. */ package it.skarafaz.mercury.model.event; public class SshCommandMessage { private String message;
private SshCommandDrop<Boolean> drop;
Skarafaz/mercury
app/src/main/java/it/skarafaz/mercury/adapter/ServerPagerAdapter.java
// Path: app/src/main/java/it/skarafaz/mercury/fragment/ServerFragment.java // public class ServerFragment extends ListFragment { // public static final String SERVER_ARG = "SERVER_ARG"; // private Server server; // // public static ServerFragment newInstance(Server server) { // ServerFragment fragment = new ServerFragment(); // Bundle args = new Bundle(); // args.putSerializable(SERVER_ARG, server); // fragment.setArguments(args); // return fragment; // } // // @Override // public void onCreate(Bundle savedInstanceState) { // super.onCreate(savedInstanceState); // // server = getArguments() != null ? (Server) getArguments().getSerializable(SERVER_ARG) : null; // } // // @Override // public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // return inflater.inflate(R.layout.fragment_server, container, false); // } // // @Override // public void onActivityCreated(Bundle savedInstanceState) { // super.onActivityCreated(savedInstanceState); // // setListAdapter(new CommandListAdapter(getActivity(), server.getCommands())); // } // } // // Path: app/src/main/java/it/skarafaz/mercury/model/config/Server.java // @SuppressWarnings("unused") // public class Server implements Serializable, Comparable<Server> { // private static final long serialVersionUID = 7247694914871605048L; // private String name; // private String host; // private Integer port; // private String user; // private String password; // private Boolean sudoNoPasswd; // private String sudoPath; // private String nohupPath; // private List<Command> commands; // // public String getName() { // return name; // } // // public void setName(String name) { // this.name = name; // } // // public String getHost() { // return host; // } // // public void setHost(String host) { // this.host = host; // } // // public Integer getPort() { // return port; // } // // public void setPort(Integer port) { // this.port = port; // } // // public String getUser() { // return user; // } // // public void setUser(String user) { // this.user = user; // } // // public String getPassword() { // return password; // } // // public void setPassword(String password) { // this.password = password; // } // // public Boolean getSudoNoPasswd() { // return sudoNoPasswd; // } // // public void setSudoNoPasswd(Boolean sudoNoPasswd) { // this.sudoNoPasswd = sudoNoPasswd; // } // // public String getSudoPath() { // return sudoPath; // } // // public void setSudoPath(String sudoPath) { // this.sudoPath = sudoPath; // } // // public String getNohupPath() { // return nohupPath; // } // // public void setNohupPath(String nohupPath) { // this.nohupPath = nohupPath; // } // // @JsonManagedReference // public List<Command> getCommands() { // return commands; // } // // public void setCommands(List<Command> commands) { // this.commands = commands; // } // // @Override // public int compareTo(@NonNull Server another) { // return name.toLowerCase().compareTo(another.getName().toLowerCase()); // } // }
import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentStatePagerAdapter; import it.skarafaz.mercury.fragment.ServerFragment; import it.skarafaz.mercury.model.config.Server; import java.util.ArrayList; import java.util.List;
/* * Mercury-SSH * Copyright (C) 2017 Skarafaz * * This file is part of Mercury-SSH. * * Mercury-SSH is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 2 of the License, or * (at your option) any later version. * * Mercury-SSH is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Mercury-SSH. If not, see <http://www.gnu.org/licenses/>. */ package it.skarafaz.mercury.adapter; public class ServerPagerAdapter extends FragmentStatePagerAdapter { private List<Server> servers; public ServerPagerAdapter(FragmentManager fm) { super(fm); servers = new ArrayList<>(); } @Override public int getCount() { return servers.size(); } @Override public Fragment getItem(int i) {
// Path: app/src/main/java/it/skarafaz/mercury/fragment/ServerFragment.java // public class ServerFragment extends ListFragment { // public static final String SERVER_ARG = "SERVER_ARG"; // private Server server; // // public static ServerFragment newInstance(Server server) { // ServerFragment fragment = new ServerFragment(); // Bundle args = new Bundle(); // args.putSerializable(SERVER_ARG, server); // fragment.setArguments(args); // return fragment; // } // // @Override // public void onCreate(Bundle savedInstanceState) { // super.onCreate(savedInstanceState); // // server = getArguments() != null ? (Server) getArguments().getSerializable(SERVER_ARG) : null; // } // // @Override // public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // return inflater.inflate(R.layout.fragment_server, container, false); // } // // @Override // public void onActivityCreated(Bundle savedInstanceState) { // super.onActivityCreated(savedInstanceState); // // setListAdapter(new CommandListAdapter(getActivity(), server.getCommands())); // } // } // // Path: app/src/main/java/it/skarafaz/mercury/model/config/Server.java // @SuppressWarnings("unused") // public class Server implements Serializable, Comparable<Server> { // private static final long serialVersionUID = 7247694914871605048L; // private String name; // private String host; // private Integer port; // private String user; // private String password; // private Boolean sudoNoPasswd; // private String sudoPath; // private String nohupPath; // private List<Command> commands; // // public String getName() { // return name; // } // // public void setName(String name) { // this.name = name; // } // // public String getHost() { // return host; // } // // public void setHost(String host) { // this.host = host; // } // // public Integer getPort() { // return port; // } // // public void setPort(Integer port) { // this.port = port; // } // // public String getUser() { // return user; // } // // public void setUser(String user) { // this.user = user; // } // // public String getPassword() { // return password; // } // // public void setPassword(String password) { // this.password = password; // } // // public Boolean getSudoNoPasswd() { // return sudoNoPasswd; // } // // public void setSudoNoPasswd(Boolean sudoNoPasswd) { // this.sudoNoPasswd = sudoNoPasswd; // } // // public String getSudoPath() { // return sudoPath; // } // // public void setSudoPath(String sudoPath) { // this.sudoPath = sudoPath; // } // // public String getNohupPath() { // return nohupPath; // } // // public void setNohupPath(String nohupPath) { // this.nohupPath = nohupPath; // } // // @JsonManagedReference // public List<Command> getCommands() { // return commands; // } // // public void setCommands(List<Command> commands) { // this.commands = commands; // } // // @Override // public int compareTo(@NonNull Server another) { // return name.toLowerCase().compareTo(another.getName().toLowerCase()); // } // } // Path: app/src/main/java/it/skarafaz/mercury/adapter/ServerPagerAdapter.java import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentStatePagerAdapter; import it.skarafaz.mercury.fragment.ServerFragment; import it.skarafaz.mercury.model.config.Server; import java.util.ArrayList; import java.util.List; /* * Mercury-SSH * Copyright (C) 2017 Skarafaz * * This file is part of Mercury-SSH. * * Mercury-SSH is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 2 of the License, or * (at your option) any later version. * * Mercury-SSH is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Mercury-SSH. If not, see <http://www.gnu.org/licenses/>. */ package it.skarafaz.mercury.adapter; public class ServerPagerAdapter extends FragmentStatePagerAdapter { private List<Server> servers; public ServerPagerAdapter(FragmentManager fm) { super(fm); servers = new ArrayList<>(); } @Override public int getCount() { return servers.size(); } @Override public Fragment getItem(int i) {
return ServerFragment.newInstance(servers.get(i));
Skarafaz/mercury
app/src/main/java/it/skarafaz/mercury/fragment/LogFragment.java
// Path: app/src/main/java/it/skarafaz/mercury/adapter/LogListAdapter.java // public class LogListAdapter extends ArrayAdapter<String> { // // public LogListAdapter(Context context, List<String> lines) { // super(context, R.layout.log_list_item, lines); // } // // @Override // public boolean isEnabled(int position) { // return false; // } // }
import java.io.File; import java.io.IOException; import java.util.ArrayList; import java.util.List; import android.content.Context; import android.os.Bundle; import android.support.v4.app.ListFragment; import android.view.*; import it.skarafaz.mercury.R; import it.skarafaz.mercury.adapter.LogListAdapter; import org.apache.commons.io.FileUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory;
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { return inflater.inflate(R.layout.fragment_log, container, false); } @Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); reload(); } @Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { inflater.inflate(R.menu.menu_log, menu); } @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.action_clear: clearLog(); return true; default: return super.onOptionsItemSelected(item); } } private void reload() {
// Path: app/src/main/java/it/skarafaz/mercury/adapter/LogListAdapter.java // public class LogListAdapter extends ArrayAdapter<String> { // // public LogListAdapter(Context context, List<String> lines) { // super(context, R.layout.log_list_item, lines); // } // // @Override // public boolean isEnabled(int position) { // return false; // } // } // Path: app/src/main/java/it/skarafaz/mercury/fragment/LogFragment.java import java.io.File; import java.io.IOException; import java.util.ArrayList; import java.util.List; import android.content.Context; import android.os.Bundle; import android.support.v4.app.ListFragment; import android.view.*; import it.skarafaz.mercury.R; import it.skarafaz.mercury.adapter.LogListAdapter; import org.apache.commons.io.FileUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { return inflater.inflate(R.layout.fragment_log, container, false); } @Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); reload(); } @Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { inflater.inflate(R.menu.menu_log, menu); } @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.action_clear: clearLog(); return true; default: return super.onOptionsItemSelected(item); } } private void reload() {
setListAdapter(new LogListAdapter(getActivity(), readLog()));
Skarafaz/mercury
app/src/main/java/it/skarafaz/mercury/model/event/SshCommandPassword.java
// Path: app/src/main/java/it/skarafaz/mercury/ssh/SshCommandDrop.java // public class SshCommandDrop<E> { // private static final Logger logger = LoggerFactory.getLogger(SshCommandDrop.class); // private E obj; // private boolean empty = true; // // public synchronized E take() { // while (empty) { // try { // wait(); // } catch (InterruptedException e) { // logger.error(e.getMessage().replace("\n", " ")); // } // } // empty = true; // notifyAll(); // return obj; // } // // public synchronized void put(E obj) { // while (!empty) { // try { // wait(); // } catch (InterruptedException e) { // logger.error(e.getMessage().replace("\n", " ")); // } // } // empty = false; // this.obj = obj; // notifyAll(); // } // }
import it.skarafaz.mercury.ssh.SshCommandDrop;
/* * Mercury-SSH * Copyright (C) 2018 Skarafaz * * This file is part of Mercury-SSH. * * Mercury-SSH is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 2 of the License, or * (at your option) any later version. * * Mercury-SSH is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Mercury-SSH. If not, see <http://www.gnu.org/licenses/>. */ package it.skarafaz.mercury.model.event; public class SshCommandPassword { private String message;
// Path: app/src/main/java/it/skarafaz/mercury/ssh/SshCommandDrop.java // public class SshCommandDrop<E> { // private static final Logger logger = LoggerFactory.getLogger(SshCommandDrop.class); // private E obj; // private boolean empty = true; // // public synchronized E take() { // while (empty) { // try { // wait(); // } catch (InterruptedException e) { // logger.error(e.getMessage().replace("\n", " ")); // } // } // empty = true; // notifyAll(); // return obj; // } // // public synchronized void put(E obj) { // while (!empty) { // try { // wait(); // } catch (InterruptedException e) { // logger.error(e.getMessage().replace("\n", " ")); // } // } // empty = false; // this.obj = obj; // notifyAll(); // } // } // Path: app/src/main/java/it/skarafaz/mercury/model/event/SshCommandPassword.java import it.skarafaz.mercury.ssh.SshCommandDrop; /* * Mercury-SSH * Copyright (C) 2018 Skarafaz * * This file is part of Mercury-SSH. * * Mercury-SSH is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 2 of the License, or * (at your option) any later version. * * Mercury-SSH is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Mercury-SSH. If not, see <http://www.gnu.org/licenses/>. */ package it.skarafaz.mercury.model.event; public class SshCommandPassword { private String message;
private SshCommandDrop<String> drop;
Skarafaz/mercury
app/src/main/java/it/skarafaz/mercury/ssh/SshCommand.java
// Path: app/src/main/java/it/skarafaz/mercury/model/event/SshCommandEnd.java // public class SshCommandEnd { // private SshCommandStatus status; // // public SshCommandEnd(SshCommandStatus status) { // this.status = status; // } // // public SshCommandStatus getStatus() { // return status; // } // } // // Path: app/src/main/java/it/skarafaz/mercury/model/event/SshCommandStart.java // public class SshCommandStart { // }
import com.jcraft.jsch.*; import it.skarafaz.mercury.model.event.SshCommandEnd; import it.skarafaz.mercury.model.event.SshCommandStart; import org.greenrobot.eventbus.EventBus; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.io.IOException; import java.io.InputStream; import java.util.Properties;
/* * Mercury-SSH * Copyright (C) 2019 Skarafaz * * This file is part of Mercury-SSH. * * Mercury-SSH is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 2 of the License, or * (at your option) any later version. * * Mercury-SSH is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Mercury-SSH. If not, see <http://www.gnu.org/licenses/>. */ package it.skarafaz.mercury.ssh; public abstract class SshCommand extends Thread { protected static final int TIMEOUT = 30000; private static final Logger logger = LoggerFactory.getLogger(SshCommand.class); protected JSch jsch; protected Session session; protected String host; protected Integer port; protected String user; protected String password; protected Boolean sudoNoPasswd; protected String shellPath; protected String sudoPath; protected String nohupPath; protected Boolean sudo; protected String cmd; protected Boolean confirm; public SshCommand() { this.jsch = new JSch(); } @Override public void run() { if(beforeExecute()) { SshCommandStatus status = execute(); afterExecute(status); } } protected boolean beforeExecute() {
// Path: app/src/main/java/it/skarafaz/mercury/model/event/SshCommandEnd.java // public class SshCommandEnd { // private SshCommandStatus status; // // public SshCommandEnd(SshCommandStatus status) { // this.status = status; // } // // public SshCommandStatus getStatus() { // return status; // } // } // // Path: app/src/main/java/it/skarafaz/mercury/model/event/SshCommandStart.java // public class SshCommandStart { // } // Path: app/src/main/java/it/skarafaz/mercury/ssh/SshCommand.java import com.jcraft.jsch.*; import it.skarafaz.mercury.model.event.SshCommandEnd; import it.skarafaz.mercury.model.event.SshCommandStart; import org.greenrobot.eventbus.EventBus; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.io.IOException; import java.io.InputStream; import java.util.Properties; /* * Mercury-SSH * Copyright (C) 2019 Skarafaz * * This file is part of Mercury-SSH. * * Mercury-SSH is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 2 of the License, or * (at your option) any later version. * * Mercury-SSH is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Mercury-SSH. If not, see <http://www.gnu.org/licenses/>. */ package it.skarafaz.mercury.ssh; public abstract class SshCommand extends Thread { protected static final int TIMEOUT = 30000; private static final Logger logger = LoggerFactory.getLogger(SshCommand.class); protected JSch jsch; protected Session session; protected String host; protected Integer port; protected String user; protected String password; protected Boolean sudoNoPasswd; protected String shellPath; protected String sudoPath; protected String nohupPath; protected Boolean sudo; protected String cmd; protected Boolean confirm; public SshCommand() { this.jsch = new JSch(); } @Override public void run() { if(beforeExecute()) { SshCommandStatus status = execute(); afterExecute(status); } } protected boolean beforeExecute() {
EventBus.getDefault().postSticky(new SshCommandStart());
Skarafaz/mercury
app/src/main/java/it/skarafaz/mercury/ssh/SshCommand.java
// Path: app/src/main/java/it/skarafaz/mercury/model/event/SshCommandEnd.java // public class SshCommandEnd { // private SshCommandStatus status; // // public SshCommandEnd(SshCommandStatus status) { // this.status = status; // } // // public SshCommandStatus getStatus() { // return status; // } // } // // Path: app/src/main/java/it/skarafaz/mercury/model/event/SshCommandStart.java // public class SshCommandStart { // }
import com.jcraft.jsch.*; import it.skarafaz.mercury.model.event.SshCommandEnd; import it.skarafaz.mercury.model.event.SshCommandStart; import org.greenrobot.eventbus.EventBus; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.io.IOException; import java.io.InputStream; import java.util.Properties;
SshCommandStatus status = execute(); afterExecute(status); } } protected boolean beforeExecute() { EventBus.getDefault().postSticky(new SshCommandStart()); return true; } private SshCommandStatus execute() { SshCommandStatus status = SshCommandStatus.COMMAND_SENT; if (initConnection()) { if (connect()) { if (!send(formatCmd(cmd))) { status = SshCommandStatus.EXECUTION_FAILED; } disconnect(); } else { status = SshCommandStatus.CONNECTION_FAILED; } } else { status = SshCommandStatus.CONNECTION_INIT_ERROR; } return status; } protected void afterExecute(SshCommandStatus status) {
// Path: app/src/main/java/it/skarafaz/mercury/model/event/SshCommandEnd.java // public class SshCommandEnd { // private SshCommandStatus status; // // public SshCommandEnd(SshCommandStatus status) { // this.status = status; // } // // public SshCommandStatus getStatus() { // return status; // } // } // // Path: app/src/main/java/it/skarafaz/mercury/model/event/SshCommandStart.java // public class SshCommandStart { // } // Path: app/src/main/java/it/skarafaz/mercury/ssh/SshCommand.java import com.jcraft.jsch.*; import it.skarafaz.mercury.model.event.SshCommandEnd; import it.skarafaz.mercury.model.event.SshCommandStart; import org.greenrobot.eventbus.EventBus; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.io.IOException; import java.io.InputStream; import java.util.Properties; SshCommandStatus status = execute(); afterExecute(status); } } protected boolean beforeExecute() { EventBus.getDefault().postSticky(new SshCommandStart()); return true; } private SshCommandStatus execute() { SshCommandStatus status = SshCommandStatus.COMMAND_SENT; if (initConnection()) { if (connect()) { if (!send(formatCmd(cmd))) { status = SshCommandStatus.EXECUTION_FAILED; } disconnect(); } else { status = SshCommandStatus.CONNECTION_FAILED; } } else { status = SshCommandStatus.CONNECTION_INIT_ERROR; } return status; } protected void afterExecute(SshCommandStatus status) {
EventBus.getDefault().postSticky(new SshCommandEnd(status));
Skarafaz/mercury
app/src/main/java/it/skarafaz/mercury/ssh/SshCommandUserInfo.java
// Path: app/src/main/java/it/skarafaz/mercury/MercuryApplication.java // public class MercuryApplication extends Application { // private static final String S_HAS_PERMANENT_MENU_KEY = "sHasPermanentMenuKey"; // private static final Logger logger = LoggerFactory.getLogger(MercuryApplication.class); // private static Context context; // // public static Context getContext() { // return context; // } // // @Override // public void onCreate() { // super.onCreate(); // // context = this; // // EventBus.builder().addIndex(new EventBusIndex()).build(); // // // hack for devices with hw options button // try { // ViewConfiguration config = ViewConfiguration.get(this); // Field menuKeyField = ViewConfiguration.class.getDeclaredField(S_HAS_PERMANENT_MENU_KEY); // if (menuKeyField != null) { // menuKeyField.setAccessible(true); // menuKeyField.setBoolean(config, false); // } // } catch (Exception e) { // logger.error(e.getMessage().replace("\n", " ")); // } // } // // public static void showProgressDialog(FragmentManager manager, String content) { // FragmentTransaction transaction = manager.beginTransaction(); // transaction.add(ProgressDialogFragment.newInstance(content), ProgressDialogFragment.TAG); // transaction.commitAllowingStateLoss(); // } // // public static void dismissProgressDialog(FragmentManager manager) { // FragmentTransaction transaction = manager.beginTransaction(); // Fragment fragment = manager.findFragmentByTag(ProgressDialogFragment.TAG); // if (fragment != null) { // transaction.remove(fragment); // } // transaction.commitAllowingStateLoss(); // } // // public static boolean hasPermission(String permission) { // return ContextCompat.checkSelfPermission(context, permission) == PackageManager.PERMISSION_GRANTED; // } // // public static boolean requestPermission(Activity activity, int requestCode, String permission) { // boolean requested = false; // if (!ActivityCompat.shouldShowRequestPermissionRationale(activity, permission)) { // ActivityCompat.requestPermissions(activity, new String[]{permission}, requestCode); // requested = true; // } // return requested; // } // // public static boolean isExternalStorageReadable() { // String state = Environment.getExternalStorageState(); // return Environment.MEDIA_MOUNTED.equals(state) || Environment.MEDIA_MOUNTED_READ_ONLY.equals(state); // } // // public static boolean isExternalStorageWritable() { // String state = Environment.getExternalStorageState(); // return Environment.MEDIA_MOUNTED.equals(state); // } // } // // Path: app/src/main/java/it/skarafaz/mercury/model/event/SshCommandMessage.java // public class SshCommandMessage { // private String message; // private SshCommandDrop<Boolean> drop; // // public SshCommandMessage(String message, SshCommandDrop<Boolean> drop) { // this.message = message; // this.drop = drop; // } // // public String getMessage() { // return message; // } // // public SshCommandDrop<Boolean> getDrop() { // return drop; // } // } // // Path: app/src/main/java/it/skarafaz/mercury/model/event/SshCommandPassword.java // public class SshCommandPassword { // private String message; // private SshCommandDrop<String> drop; // // public SshCommandPassword(String message, SshCommandDrop<String> drop) { // this.message = message; // this.drop = drop; // } // // public SshCommandDrop<String> getDrop() { // return drop; // } // // public String getMessage() { // return message; // } // } // // Path: app/src/main/java/it/skarafaz/mercury/model/event/SshCommandYesNo.java // public class SshCommandYesNo { // private String message; // private SshCommandDrop<Boolean> drop; // // public SshCommandYesNo(String message, SshCommandDrop<Boolean> drop) { // this.message = message; // this.drop = drop; // } // // public String getMessage() { // return message; // } // // public SshCommandDrop<Boolean> getDrop() { // return drop; // } // }
import com.jcraft.jsch.UserInfo; import it.skarafaz.mercury.MercuryApplication; import it.skarafaz.mercury.R; import it.skarafaz.mercury.model.event.SshCommandMessage; import it.skarafaz.mercury.model.event.SshCommandPassword; import it.skarafaz.mercury.model.event.SshCommandYesNo; import org.greenrobot.eventbus.EventBus;
/* * Mercury-SSH * Copyright (C) 2017 Skarafaz * * This file is part of Mercury-SSH. * * Mercury-SSH is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 2 of the License, or * (at your option) any later version. * * Mercury-SSH is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Mercury-SSH. If not, see <http://www.gnu.org/licenses/>. */ package it.skarafaz.mercury.ssh; public class SshCommandUserInfo implements UserInfo { private String password; @Override public String getPassphrase() { return null; } @Override public String getPassword() { return password; } @Override public boolean promptPassword(String message) { SshCommandDrop<String> drop = new SshCommandDrop<>();
// Path: app/src/main/java/it/skarafaz/mercury/MercuryApplication.java // public class MercuryApplication extends Application { // private static final String S_HAS_PERMANENT_MENU_KEY = "sHasPermanentMenuKey"; // private static final Logger logger = LoggerFactory.getLogger(MercuryApplication.class); // private static Context context; // // public static Context getContext() { // return context; // } // // @Override // public void onCreate() { // super.onCreate(); // // context = this; // // EventBus.builder().addIndex(new EventBusIndex()).build(); // // // hack for devices with hw options button // try { // ViewConfiguration config = ViewConfiguration.get(this); // Field menuKeyField = ViewConfiguration.class.getDeclaredField(S_HAS_PERMANENT_MENU_KEY); // if (menuKeyField != null) { // menuKeyField.setAccessible(true); // menuKeyField.setBoolean(config, false); // } // } catch (Exception e) { // logger.error(e.getMessage().replace("\n", " ")); // } // } // // public static void showProgressDialog(FragmentManager manager, String content) { // FragmentTransaction transaction = manager.beginTransaction(); // transaction.add(ProgressDialogFragment.newInstance(content), ProgressDialogFragment.TAG); // transaction.commitAllowingStateLoss(); // } // // public static void dismissProgressDialog(FragmentManager manager) { // FragmentTransaction transaction = manager.beginTransaction(); // Fragment fragment = manager.findFragmentByTag(ProgressDialogFragment.TAG); // if (fragment != null) { // transaction.remove(fragment); // } // transaction.commitAllowingStateLoss(); // } // // public static boolean hasPermission(String permission) { // return ContextCompat.checkSelfPermission(context, permission) == PackageManager.PERMISSION_GRANTED; // } // // public static boolean requestPermission(Activity activity, int requestCode, String permission) { // boolean requested = false; // if (!ActivityCompat.shouldShowRequestPermissionRationale(activity, permission)) { // ActivityCompat.requestPermissions(activity, new String[]{permission}, requestCode); // requested = true; // } // return requested; // } // // public static boolean isExternalStorageReadable() { // String state = Environment.getExternalStorageState(); // return Environment.MEDIA_MOUNTED.equals(state) || Environment.MEDIA_MOUNTED_READ_ONLY.equals(state); // } // // public static boolean isExternalStorageWritable() { // String state = Environment.getExternalStorageState(); // return Environment.MEDIA_MOUNTED.equals(state); // } // } // // Path: app/src/main/java/it/skarafaz/mercury/model/event/SshCommandMessage.java // public class SshCommandMessage { // private String message; // private SshCommandDrop<Boolean> drop; // // public SshCommandMessage(String message, SshCommandDrop<Boolean> drop) { // this.message = message; // this.drop = drop; // } // // public String getMessage() { // return message; // } // // public SshCommandDrop<Boolean> getDrop() { // return drop; // } // } // // Path: app/src/main/java/it/skarafaz/mercury/model/event/SshCommandPassword.java // public class SshCommandPassword { // private String message; // private SshCommandDrop<String> drop; // // public SshCommandPassword(String message, SshCommandDrop<String> drop) { // this.message = message; // this.drop = drop; // } // // public SshCommandDrop<String> getDrop() { // return drop; // } // // public String getMessage() { // return message; // } // } // // Path: app/src/main/java/it/skarafaz/mercury/model/event/SshCommandYesNo.java // public class SshCommandYesNo { // private String message; // private SshCommandDrop<Boolean> drop; // // public SshCommandYesNo(String message, SshCommandDrop<Boolean> drop) { // this.message = message; // this.drop = drop; // } // // public String getMessage() { // return message; // } // // public SshCommandDrop<Boolean> getDrop() { // return drop; // } // } // Path: app/src/main/java/it/skarafaz/mercury/ssh/SshCommandUserInfo.java import com.jcraft.jsch.UserInfo; import it.skarafaz.mercury.MercuryApplication; import it.skarafaz.mercury.R; import it.skarafaz.mercury.model.event.SshCommandMessage; import it.skarafaz.mercury.model.event.SshCommandPassword; import it.skarafaz.mercury.model.event.SshCommandYesNo; import org.greenrobot.eventbus.EventBus; /* * Mercury-SSH * Copyright (C) 2017 Skarafaz * * This file is part of Mercury-SSH. * * Mercury-SSH is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 2 of the License, or * (at your option) any later version. * * Mercury-SSH is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Mercury-SSH. If not, see <http://www.gnu.org/licenses/>. */ package it.skarafaz.mercury.ssh; public class SshCommandUserInfo implements UserInfo { private String password; @Override public String getPassphrase() { return null; } @Override public String getPassword() { return password; } @Override public boolean promptPassword(String message) { SshCommandDrop<String> drop = new SshCommandDrop<>();
message = String.format(MercuryApplication.getContext().getString(R.string.type_login_password), message.toLowerCase());
Skarafaz/mercury
app/src/main/java/it/skarafaz/mercury/ssh/SshCommandUserInfo.java
// Path: app/src/main/java/it/skarafaz/mercury/MercuryApplication.java // public class MercuryApplication extends Application { // private static final String S_HAS_PERMANENT_MENU_KEY = "sHasPermanentMenuKey"; // private static final Logger logger = LoggerFactory.getLogger(MercuryApplication.class); // private static Context context; // // public static Context getContext() { // return context; // } // // @Override // public void onCreate() { // super.onCreate(); // // context = this; // // EventBus.builder().addIndex(new EventBusIndex()).build(); // // // hack for devices with hw options button // try { // ViewConfiguration config = ViewConfiguration.get(this); // Field menuKeyField = ViewConfiguration.class.getDeclaredField(S_HAS_PERMANENT_MENU_KEY); // if (menuKeyField != null) { // menuKeyField.setAccessible(true); // menuKeyField.setBoolean(config, false); // } // } catch (Exception e) { // logger.error(e.getMessage().replace("\n", " ")); // } // } // // public static void showProgressDialog(FragmentManager manager, String content) { // FragmentTransaction transaction = manager.beginTransaction(); // transaction.add(ProgressDialogFragment.newInstance(content), ProgressDialogFragment.TAG); // transaction.commitAllowingStateLoss(); // } // // public static void dismissProgressDialog(FragmentManager manager) { // FragmentTransaction transaction = manager.beginTransaction(); // Fragment fragment = manager.findFragmentByTag(ProgressDialogFragment.TAG); // if (fragment != null) { // transaction.remove(fragment); // } // transaction.commitAllowingStateLoss(); // } // // public static boolean hasPermission(String permission) { // return ContextCompat.checkSelfPermission(context, permission) == PackageManager.PERMISSION_GRANTED; // } // // public static boolean requestPermission(Activity activity, int requestCode, String permission) { // boolean requested = false; // if (!ActivityCompat.shouldShowRequestPermissionRationale(activity, permission)) { // ActivityCompat.requestPermissions(activity, new String[]{permission}, requestCode); // requested = true; // } // return requested; // } // // public static boolean isExternalStorageReadable() { // String state = Environment.getExternalStorageState(); // return Environment.MEDIA_MOUNTED.equals(state) || Environment.MEDIA_MOUNTED_READ_ONLY.equals(state); // } // // public static boolean isExternalStorageWritable() { // String state = Environment.getExternalStorageState(); // return Environment.MEDIA_MOUNTED.equals(state); // } // } // // Path: app/src/main/java/it/skarafaz/mercury/model/event/SshCommandMessage.java // public class SshCommandMessage { // private String message; // private SshCommandDrop<Boolean> drop; // // public SshCommandMessage(String message, SshCommandDrop<Boolean> drop) { // this.message = message; // this.drop = drop; // } // // public String getMessage() { // return message; // } // // public SshCommandDrop<Boolean> getDrop() { // return drop; // } // } // // Path: app/src/main/java/it/skarafaz/mercury/model/event/SshCommandPassword.java // public class SshCommandPassword { // private String message; // private SshCommandDrop<String> drop; // // public SshCommandPassword(String message, SshCommandDrop<String> drop) { // this.message = message; // this.drop = drop; // } // // public SshCommandDrop<String> getDrop() { // return drop; // } // // public String getMessage() { // return message; // } // } // // Path: app/src/main/java/it/skarafaz/mercury/model/event/SshCommandYesNo.java // public class SshCommandYesNo { // private String message; // private SshCommandDrop<Boolean> drop; // // public SshCommandYesNo(String message, SshCommandDrop<Boolean> drop) { // this.message = message; // this.drop = drop; // } // // public String getMessage() { // return message; // } // // public SshCommandDrop<Boolean> getDrop() { // return drop; // } // }
import com.jcraft.jsch.UserInfo; import it.skarafaz.mercury.MercuryApplication; import it.skarafaz.mercury.R; import it.skarafaz.mercury.model.event.SshCommandMessage; import it.skarafaz.mercury.model.event.SshCommandPassword; import it.skarafaz.mercury.model.event.SshCommandYesNo; import org.greenrobot.eventbus.EventBus;
/* * Mercury-SSH * Copyright (C) 2017 Skarafaz * * This file is part of Mercury-SSH. * * Mercury-SSH is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 2 of the License, or * (at your option) any later version. * * Mercury-SSH is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Mercury-SSH. If not, see <http://www.gnu.org/licenses/>. */ package it.skarafaz.mercury.ssh; public class SshCommandUserInfo implements UserInfo { private String password; @Override public String getPassphrase() { return null; } @Override public String getPassword() { return password; } @Override public boolean promptPassword(String message) { SshCommandDrop<String> drop = new SshCommandDrop<>(); message = String.format(MercuryApplication.getContext().getString(R.string.type_login_password), message.toLowerCase());
// Path: app/src/main/java/it/skarafaz/mercury/MercuryApplication.java // public class MercuryApplication extends Application { // private static final String S_HAS_PERMANENT_MENU_KEY = "sHasPermanentMenuKey"; // private static final Logger logger = LoggerFactory.getLogger(MercuryApplication.class); // private static Context context; // // public static Context getContext() { // return context; // } // // @Override // public void onCreate() { // super.onCreate(); // // context = this; // // EventBus.builder().addIndex(new EventBusIndex()).build(); // // // hack for devices with hw options button // try { // ViewConfiguration config = ViewConfiguration.get(this); // Field menuKeyField = ViewConfiguration.class.getDeclaredField(S_HAS_PERMANENT_MENU_KEY); // if (menuKeyField != null) { // menuKeyField.setAccessible(true); // menuKeyField.setBoolean(config, false); // } // } catch (Exception e) { // logger.error(e.getMessage().replace("\n", " ")); // } // } // // public static void showProgressDialog(FragmentManager manager, String content) { // FragmentTransaction transaction = manager.beginTransaction(); // transaction.add(ProgressDialogFragment.newInstance(content), ProgressDialogFragment.TAG); // transaction.commitAllowingStateLoss(); // } // // public static void dismissProgressDialog(FragmentManager manager) { // FragmentTransaction transaction = manager.beginTransaction(); // Fragment fragment = manager.findFragmentByTag(ProgressDialogFragment.TAG); // if (fragment != null) { // transaction.remove(fragment); // } // transaction.commitAllowingStateLoss(); // } // // public static boolean hasPermission(String permission) { // return ContextCompat.checkSelfPermission(context, permission) == PackageManager.PERMISSION_GRANTED; // } // // public static boolean requestPermission(Activity activity, int requestCode, String permission) { // boolean requested = false; // if (!ActivityCompat.shouldShowRequestPermissionRationale(activity, permission)) { // ActivityCompat.requestPermissions(activity, new String[]{permission}, requestCode); // requested = true; // } // return requested; // } // // public static boolean isExternalStorageReadable() { // String state = Environment.getExternalStorageState(); // return Environment.MEDIA_MOUNTED.equals(state) || Environment.MEDIA_MOUNTED_READ_ONLY.equals(state); // } // // public static boolean isExternalStorageWritable() { // String state = Environment.getExternalStorageState(); // return Environment.MEDIA_MOUNTED.equals(state); // } // } // // Path: app/src/main/java/it/skarafaz/mercury/model/event/SshCommandMessage.java // public class SshCommandMessage { // private String message; // private SshCommandDrop<Boolean> drop; // // public SshCommandMessage(String message, SshCommandDrop<Boolean> drop) { // this.message = message; // this.drop = drop; // } // // public String getMessage() { // return message; // } // // public SshCommandDrop<Boolean> getDrop() { // return drop; // } // } // // Path: app/src/main/java/it/skarafaz/mercury/model/event/SshCommandPassword.java // public class SshCommandPassword { // private String message; // private SshCommandDrop<String> drop; // // public SshCommandPassword(String message, SshCommandDrop<String> drop) { // this.message = message; // this.drop = drop; // } // // public SshCommandDrop<String> getDrop() { // return drop; // } // // public String getMessage() { // return message; // } // } // // Path: app/src/main/java/it/skarafaz/mercury/model/event/SshCommandYesNo.java // public class SshCommandYesNo { // private String message; // private SshCommandDrop<Boolean> drop; // // public SshCommandYesNo(String message, SshCommandDrop<Boolean> drop) { // this.message = message; // this.drop = drop; // } // // public String getMessage() { // return message; // } // // public SshCommandDrop<Boolean> getDrop() { // return drop; // } // } // Path: app/src/main/java/it/skarafaz/mercury/ssh/SshCommandUserInfo.java import com.jcraft.jsch.UserInfo; import it.skarafaz.mercury.MercuryApplication; import it.skarafaz.mercury.R; import it.skarafaz.mercury.model.event.SshCommandMessage; import it.skarafaz.mercury.model.event.SshCommandPassword; import it.skarafaz.mercury.model.event.SshCommandYesNo; import org.greenrobot.eventbus.EventBus; /* * Mercury-SSH * Copyright (C) 2017 Skarafaz * * This file is part of Mercury-SSH. * * Mercury-SSH is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 2 of the License, or * (at your option) any later version. * * Mercury-SSH is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Mercury-SSH. If not, see <http://www.gnu.org/licenses/>. */ package it.skarafaz.mercury.ssh; public class SshCommandUserInfo implements UserInfo { private String password; @Override public String getPassphrase() { return null; } @Override public String getPassword() { return password; } @Override public boolean promptPassword(String message) { SshCommandDrop<String> drop = new SshCommandDrop<>(); message = String.format(MercuryApplication.getContext().getString(R.string.type_login_password), message.toLowerCase());
EventBus.getDefault().postSticky(new SshCommandPassword(message, drop));
Skarafaz/mercury
app/src/main/java/it/skarafaz/mercury/ssh/SshCommandUserInfo.java
// Path: app/src/main/java/it/skarafaz/mercury/MercuryApplication.java // public class MercuryApplication extends Application { // private static final String S_HAS_PERMANENT_MENU_KEY = "sHasPermanentMenuKey"; // private static final Logger logger = LoggerFactory.getLogger(MercuryApplication.class); // private static Context context; // // public static Context getContext() { // return context; // } // // @Override // public void onCreate() { // super.onCreate(); // // context = this; // // EventBus.builder().addIndex(new EventBusIndex()).build(); // // // hack for devices with hw options button // try { // ViewConfiguration config = ViewConfiguration.get(this); // Field menuKeyField = ViewConfiguration.class.getDeclaredField(S_HAS_PERMANENT_MENU_KEY); // if (menuKeyField != null) { // menuKeyField.setAccessible(true); // menuKeyField.setBoolean(config, false); // } // } catch (Exception e) { // logger.error(e.getMessage().replace("\n", " ")); // } // } // // public static void showProgressDialog(FragmentManager manager, String content) { // FragmentTransaction transaction = manager.beginTransaction(); // transaction.add(ProgressDialogFragment.newInstance(content), ProgressDialogFragment.TAG); // transaction.commitAllowingStateLoss(); // } // // public static void dismissProgressDialog(FragmentManager manager) { // FragmentTransaction transaction = manager.beginTransaction(); // Fragment fragment = manager.findFragmentByTag(ProgressDialogFragment.TAG); // if (fragment != null) { // transaction.remove(fragment); // } // transaction.commitAllowingStateLoss(); // } // // public static boolean hasPermission(String permission) { // return ContextCompat.checkSelfPermission(context, permission) == PackageManager.PERMISSION_GRANTED; // } // // public static boolean requestPermission(Activity activity, int requestCode, String permission) { // boolean requested = false; // if (!ActivityCompat.shouldShowRequestPermissionRationale(activity, permission)) { // ActivityCompat.requestPermissions(activity, new String[]{permission}, requestCode); // requested = true; // } // return requested; // } // // public static boolean isExternalStorageReadable() { // String state = Environment.getExternalStorageState(); // return Environment.MEDIA_MOUNTED.equals(state) || Environment.MEDIA_MOUNTED_READ_ONLY.equals(state); // } // // public static boolean isExternalStorageWritable() { // String state = Environment.getExternalStorageState(); // return Environment.MEDIA_MOUNTED.equals(state); // } // } // // Path: app/src/main/java/it/skarafaz/mercury/model/event/SshCommandMessage.java // public class SshCommandMessage { // private String message; // private SshCommandDrop<Boolean> drop; // // public SshCommandMessage(String message, SshCommandDrop<Boolean> drop) { // this.message = message; // this.drop = drop; // } // // public String getMessage() { // return message; // } // // public SshCommandDrop<Boolean> getDrop() { // return drop; // } // } // // Path: app/src/main/java/it/skarafaz/mercury/model/event/SshCommandPassword.java // public class SshCommandPassword { // private String message; // private SshCommandDrop<String> drop; // // public SshCommandPassword(String message, SshCommandDrop<String> drop) { // this.message = message; // this.drop = drop; // } // // public SshCommandDrop<String> getDrop() { // return drop; // } // // public String getMessage() { // return message; // } // } // // Path: app/src/main/java/it/skarafaz/mercury/model/event/SshCommandYesNo.java // public class SshCommandYesNo { // private String message; // private SshCommandDrop<Boolean> drop; // // public SshCommandYesNo(String message, SshCommandDrop<Boolean> drop) { // this.message = message; // this.drop = drop; // } // // public String getMessage() { // return message; // } // // public SshCommandDrop<Boolean> getDrop() { // return drop; // } // }
import com.jcraft.jsch.UserInfo; import it.skarafaz.mercury.MercuryApplication; import it.skarafaz.mercury.R; import it.skarafaz.mercury.model.event.SshCommandMessage; import it.skarafaz.mercury.model.event.SshCommandPassword; import it.skarafaz.mercury.model.event.SshCommandYesNo; import org.greenrobot.eventbus.EventBus;
/* * Mercury-SSH * Copyright (C) 2017 Skarafaz * * This file is part of Mercury-SSH. * * Mercury-SSH is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 2 of the License, or * (at your option) any later version. * * Mercury-SSH is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Mercury-SSH. If not, see <http://www.gnu.org/licenses/>. */ package it.skarafaz.mercury.ssh; public class SshCommandUserInfo implements UserInfo { private String password; @Override public String getPassphrase() { return null; } @Override public String getPassword() { return password; } @Override public boolean promptPassword(String message) { SshCommandDrop<String> drop = new SshCommandDrop<>(); message = String.format(MercuryApplication.getContext().getString(R.string.type_login_password), message.toLowerCase()); EventBus.getDefault().postSticky(new SshCommandPassword(message, drop)); password = drop.take(); return password != null; } @Override public boolean promptPassphrase(String message) { return false; } @Override public boolean promptYesNo(String message) { SshCommandDrop<Boolean> drop = new SshCommandDrop<>();
// Path: app/src/main/java/it/skarafaz/mercury/MercuryApplication.java // public class MercuryApplication extends Application { // private static final String S_HAS_PERMANENT_MENU_KEY = "sHasPermanentMenuKey"; // private static final Logger logger = LoggerFactory.getLogger(MercuryApplication.class); // private static Context context; // // public static Context getContext() { // return context; // } // // @Override // public void onCreate() { // super.onCreate(); // // context = this; // // EventBus.builder().addIndex(new EventBusIndex()).build(); // // // hack for devices with hw options button // try { // ViewConfiguration config = ViewConfiguration.get(this); // Field menuKeyField = ViewConfiguration.class.getDeclaredField(S_HAS_PERMANENT_MENU_KEY); // if (menuKeyField != null) { // menuKeyField.setAccessible(true); // menuKeyField.setBoolean(config, false); // } // } catch (Exception e) { // logger.error(e.getMessage().replace("\n", " ")); // } // } // // public static void showProgressDialog(FragmentManager manager, String content) { // FragmentTransaction transaction = manager.beginTransaction(); // transaction.add(ProgressDialogFragment.newInstance(content), ProgressDialogFragment.TAG); // transaction.commitAllowingStateLoss(); // } // // public static void dismissProgressDialog(FragmentManager manager) { // FragmentTransaction transaction = manager.beginTransaction(); // Fragment fragment = manager.findFragmentByTag(ProgressDialogFragment.TAG); // if (fragment != null) { // transaction.remove(fragment); // } // transaction.commitAllowingStateLoss(); // } // // public static boolean hasPermission(String permission) { // return ContextCompat.checkSelfPermission(context, permission) == PackageManager.PERMISSION_GRANTED; // } // // public static boolean requestPermission(Activity activity, int requestCode, String permission) { // boolean requested = false; // if (!ActivityCompat.shouldShowRequestPermissionRationale(activity, permission)) { // ActivityCompat.requestPermissions(activity, new String[]{permission}, requestCode); // requested = true; // } // return requested; // } // // public static boolean isExternalStorageReadable() { // String state = Environment.getExternalStorageState(); // return Environment.MEDIA_MOUNTED.equals(state) || Environment.MEDIA_MOUNTED_READ_ONLY.equals(state); // } // // public static boolean isExternalStorageWritable() { // String state = Environment.getExternalStorageState(); // return Environment.MEDIA_MOUNTED.equals(state); // } // } // // Path: app/src/main/java/it/skarafaz/mercury/model/event/SshCommandMessage.java // public class SshCommandMessage { // private String message; // private SshCommandDrop<Boolean> drop; // // public SshCommandMessage(String message, SshCommandDrop<Boolean> drop) { // this.message = message; // this.drop = drop; // } // // public String getMessage() { // return message; // } // // public SshCommandDrop<Boolean> getDrop() { // return drop; // } // } // // Path: app/src/main/java/it/skarafaz/mercury/model/event/SshCommandPassword.java // public class SshCommandPassword { // private String message; // private SshCommandDrop<String> drop; // // public SshCommandPassword(String message, SshCommandDrop<String> drop) { // this.message = message; // this.drop = drop; // } // // public SshCommandDrop<String> getDrop() { // return drop; // } // // public String getMessage() { // return message; // } // } // // Path: app/src/main/java/it/skarafaz/mercury/model/event/SshCommandYesNo.java // public class SshCommandYesNo { // private String message; // private SshCommandDrop<Boolean> drop; // // public SshCommandYesNo(String message, SshCommandDrop<Boolean> drop) { // this.message = message; // this.drop = drop; // } // // public String getMessage() { // return message; // } // // public SshCommandDrop<Boolean> getDrop() { // return drop; // } // } // Path: app/src/main/java/it/skarafaz/mercury/ssh/SshCommandUserInfo.java import com.jcraft.jsch.UserInfo; import it.skarafaz.mercury.MercuryApplication; import it.skarafaz.mercury.R; import it.skarafaz.mercury.model.event.SshCommandMessage; import it.skarafaz.mercury.model.event.SshCommandPassword; import it.skarafaz.mercury.model.event.SshCommandYesNo; import org.greenrobot.eventbus.EventBus; /* * Mercury-SSH * Copyright (C) 2017 Skarafaz * * This file is part of Mercury-SSH. * * Mercury-SSH is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 2 of the License, or * (at your option) any later version. * * Mercury-SSH is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Mercury-SSH. If not, see <http://www.gnu.org/licenses/>. */ package it.skarafaz.mercury.ssh; public class SshCommandUserInfo implements UserInfo { private String password; @Override public String getPassphrase() { return null; } @Override public String getPassword() { return password; } @Override public boolean promptPassword(String message) { SshCommandDrop<String> drop = new SshCommandDrop<>(); message = String.format(MercuryApplication.getContext().getString(R.string.type_login_password), message.toLowerCase()); EventBus.getDefault().postSticky(new SshCommandPassword(message, drop)); password = drop.take(); return password != null; } @Override public boolean promptPassphrase(String message) { return false; } @Override public boolean promptYesNo(String message) { SshCommandDrop<Boolean> drop = new SshCommandDrop<>();
EventBus.getDefault().postSticky(new SshCommandYesNo(message, drop));